/* * arrive.js * v2.5.2 * https://github.com/uzairfarooq/arrive * MIT licensed * * Copyright (c) 2014-2024 Uzair Farooq */ var Arrive=function(e,t,n){"use strict";if(e.MutationObserver&&"undefined"!=typeof HTMLElement){var r,i,o=0,l=(r=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector,{matchesSelector:function(e,t){return e instanceof HTMLElement&&r.call(e,t)},addMethod:function(e,t,n){var r=e[t];e[t]=function(){return n.length==arguments.length?n.apply(this,arguments):"function"==typeof r?r.apply(this,arguments):void 0}},callCallbacks:function(e,t,n){if(e.length){t&&t.options.onceOnly&&(e=[e[0]],t.me.unbindEventWithSelectorAndCallback.call(t.target,t.selector,t.callback));for(var r,i=0;r=e[i];i++)r&&r.callback&&r.callback.call(r.elem,r.elem);t&&t.callback&&n&&n.addTimeoutHandler(t.target,t.selector,t.callback,t.options,t.data)}},checkChildNodesRecursively:function(e,t,n,r){for(var i,o=0;i=e[o];o++)n(i,t,r)&&r.push({callback:t.callback,elem:i}),i.childNodes.length>0&&l.checkChildNodesRecursively(i.childNodes,t,n,r)},mergeArrays:function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},toElementsArray:function(t){return void 0!==t&&("number"!=typeof t.length||t===e)&&(t=[t]),t}}),a=((i=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null}).prototype.addEvent=function(e,t,n,r,i){var o={target:e,selector:t,options:n,callback:r,data:i,firedElems:[]};return this._beforeAdding&&this._beforeAdding(o),this._eventsBucket.push(o),o},i.prototype.removeEvent=function(e){for(var t,n=this._eventsBucket.length-1;t=this._eventsBucket[n];n--)if(e(t)){this._beforeRemoving&&this._beforeRemoving(t),t.data&&t.data.timeoutId&&clearTimeout(t.data.timeoutId);var r=this._eventsBucket.splice(n,1);r&&r.length&&(r[0].callback=null)}},i.prototype.beforeAdding=function(e){this._beforeAdding=e},i.prototype.beforeRemoving=function(e){this._beforeRemoving=e},i),c=function(t,r){var i=new a,o=this,c={fireOnAttributesModification:!1};return i.beforeAdding(function(n){var i,l=n.target;(l===e.document||l===e)&&(l=document.getElementsByTagName("html")[0]),i=new MutationObserver(function(e){r.call(this,e,n)});var a=t(n.options);i.observe(l,a),n.observer=i,n.me=o}),i.beforeRemoving(function(e){e.observer.disconnect()}),this.bindEvent=function(e,t,n){t=l.mergeArrays(c,t);for(var r=l.toElementsArray(this),a=0;a{o.unbindEventWithSelectorAndCallback.call(e,t,n),n.call(null,null)},r.timeout))},this},u=function(){var e={onceOnly:!1,timeout:0};function t(e,t){return l.matchesSelector(e,t.selector)}var r=(d=new c(function e(){return{childList:!0,subtree:!0}},function e(n,r){n.forEach(function(e){var n=e.removedNodes,i=[];null!==n&&n.length>0&&l.checkChildNodesRecursively(n,r,t,i),l.callCallbacks(i,r,d)})})).bindEvent;return d.bindEvent=function(t,i,o){var a="object"==typeof i?l.mergeArrays(e,i):{...e},c="function"==typeof o?o:"function"==typeof i?i:n;if(c)r.call(this,t,a,c);else{a.onceOnly=!0;var u=this;return new Promise(e=>r.call(u,t,a,e))}},d},s=new function(){var e={fireOnAttributesModification:!1,onceOnly:!1,existing:!1,timeout:0};function t(e,t,r){return!!l.matchesSelector(e,t.selector)&&(n===e._id&&(e._id=o++),-1==t.firedElems.indexOf(e._id))&&(t.firedElems.push(e._id),!0)}var r=(s=new c(function e(t){var n={attributes:!1,childList:!0,subtree:!0};return t.fireOnAttributesModification&&(n.attributes=!0),n},function e(n,r){n.forEach(function(e){var n=e.addedNodes,i=e.target,o=[];null!==n&&n.length>0?l.checkChildNodesRecursively(n,r,t,o):"attributes"===e.type&&t(i,r,o)&&o.push({callback:r.callback,elem:i}),l.callCallbacks(o,r,s)})})).bindEvent;return s.bindEvent=function(t,i,o){var a="object"==typeof i?l.mergeArrays(e,i):{...e},c="function"==typeof o?o:"function"==typeof i?i:n,u=l.toElementsArray(this);if(c||(a.onceOnly=!0),a.existing){for(var s=[],d=0;dr.call(v,t,a,e))}},s},d=new u;t&&v(t.fn),v(HTMLElement.prototype),v(NodeList.prototype),v(HTMLCollection.prototype),v(HTMLDocument.prototype),v(Window.prototype);var f={};return h(s,f,"unbindAllArrive"),h(d,f,"unbindAllLeave"),f}function h(e,t,n){l.addMethod(t,n,e.unbindEvent),l.addMethod(t,n,e.unbindEventWithSelectorOrCallback),l.addMethod(t,n,e.unbindEventWithSelectorAndCallback)}function v(e){e.arrive=s.bindEvent,h(s,e,"unbindArrive"),e.leave=d.bindEvent,h(d,e,"unbindLeave")}}(window,"undefined"==typeof jQuery?null:jQuery,void 0);