UNPKG

alrdy-animate

Version:

A library to handle animations on scroll with GSAP integration.

2 lines 29.2 kB
/*! For license information please see AlrdyAnimate.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AlrdyAnimate=e():t.AlrdyAnimate=e()}(this,(()=>(()=>{var t,e,r={181:(t,e,r)=>{var n=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt,u="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,l="object"==typeof self&&self&&self.Object===Object&&self,s=u||l||Function("return this")(),f=Object.prototype.toString,p=Math.max,d=Math.min,h=function(){return s.Date.now()};function g(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function v(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&"[object Symbol]"==f.call(t)}(t))return NaN;if(g(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=g(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(n,"");var r=o.test(t);return r||i.test(t)?c(t.slice(2),r?2:8):a.test(t)?NaN:+t}t.exports=function(t,e,r){var n,a,o,i,c,u,l=0,s=!1,f=!1,y=!0;if("function"!=typeof t)throw new TypeError("Expected a function");function b(e){var r=n,o=a;return n=a=void 0,l=e,i=t.apply(o,r)}function m(t){var r=t-u;return void 0===u||r>=e||r<0||f&&t-l>=o}function w(){var t=h();if(m(t))return A(t);c=setTimeout(w,function(t){var r=e-(t-u);return f?d(r,o-(t-l)):r}(t))}function A(t){return c=void 0,y&&n?b(t):(n=a=void 0,i)}function x(){var t=h(),r=m(t);if(n=arguments,a=this,u=t,r){if(void 0===c)return function(t){return l=t,c=setTimeout(w,e),s?b(t):i}(u);if(f)return c=setTimeout(w,e),b(u)}return void 0===c&&(c=setTimeout(w,e)),i}return e=v(e)||0,g(r)&&(s=!!r.leading,o=(f="maxWait"in r)?p(v(r.maxWait)||0,e):o,y="trailing"in r?!!r.trailing:y),x.cancel=function(){void 0!==c&&clearTimeout(c),l=0,n=u=a=c=void 0},x.flush=function(){return void 0===c?i:A(h())},x}}},n={};function a(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={exports:{}};return r[t](o,o.exports,a),o.exports}a.m=r,a.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},a.d=(t,e)=>{for(var r in e)a.o(e,r)&&!a.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce(((e,r)=>(a.f[r](t,e),e)),[])),a.u=t=>"chunks/"+{267:"gsap-hover",478:"gsap-text",678:"gsap-core",704:"gsap-draggable",928:"gsap-scroll"}[t]+"."+{267:"85770879c592b4ad62c3",478:"1028ca9ad26ab9ba161a",678:"82a37ff54b39c0b2320f",704:"8583c4307203d93c6f47",928:"258d1e6c124fa145af69"}[t]+".js",a.miniCssF=t=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t={},e="AlrdyAnimate:",a.l=(r,n,o,i)=>{if(t[r])t[r].push(n);else{var c,u;if(void 0!==o)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var f=l[s];if(f.getAttribute("src")==r||f.getAttribute("data-webpack")==e+o){c=f;break}}c||(u=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,a.nc&&c.setAttribute("nonce",a.nc),c.setAttribute("data-webpack",e+o),c.src=r),t[r]=[n];var p=(e,n)=>{c.onerror=c.onload=null,clearTimeout(d);var a=t[r];if(delete t[r],c.parentNode&&c.parentNode.removeChild(c),a&&a.forEach((t=>t(n))),e)return e(n)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),u&&document.head.appendChild(c)}},a.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=r[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={792:0};a.f.j=(e,r)=>{var n=a.o(t,e)?t[e]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise(((r,a)=>n=t[e]=[r,a]));r.push(n[2]=o);var i=a.p+a.u(e),c=new Error;a.l(i,(r=>{if(a.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),i=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+i+")",c.name="ChunkLoadError",c.type=o,c.request=i,n[1](c)}}),"chunk-"+e,e)}};var e=(e,r)=>{var n,o,[i,c,u]=r,l=0;if(i.some((e=>0!==t[e]))){for(n in c)a.o(c,n)&&(a.m[n]=c[n]);u&&u(a)}for(e&&e(r);l<i.length;l++)o=i[l],a.o(t,o)&&t[o]&&t[o][0](),t[o]=0},r=this.webpackChunkAlrdyAnimate=this.webpackChunkAlrdyAnimate||[];r.forEach(e.bind(null,0)),r.push=e.bind(null,r.push.bind(r))})();var o={};return(()=>{"use strict";a.d(o,{AlrdyAnimate:()=>F});var t=a(181),e=a.n(t);function r(t){var r=!1,n=!1,a=e()((function(){t&&r&&(t.getAll().forEach((function(t){var e;null!==(e=t.vars.trigger)&&void 0!==e&&e.hasAttribute("aa-nav")||t.refresh()})),r=!1)}),200);window.scrollY>0&&function(){if(!n){var e=window.scrollY||document.documentElement.scrollTop,r=document.querySelectorAll('img[loading="lazy"]'),a=0,o=0;r.forEach((function(r){r.getBoundingClientRect().top+e<e&&(a++,r.complete?o++:r.addEventListener("load",(function(){++o===a&&t.refresh()}),{once:!0}),r.loading="eager")})),a>0&&o===a&&t.refresh(!0),n=!0}}(),document.querySelectorAll('img[loading="lazy"]').forEach((function(t){t.complete||t.addEventListener("load",(function(){r=!0}),{once:!0})})),t.addEventListener("scrollEnd",(function(){r&&a()}))}function n(t,n,a,o){var i=window.innerWidth,c=e()((function(){var e,c=window.innerWidth;c!==i&&(a=c<768,null!==(e=t.animations)&&void 0!==e&&e.slider&&t.animations.cleanupLoops(),document.querySelectorAll("[aa-animate]").forEach((function(e){var r=e.getAttribute("aa-animate");r&&(r.includes("slider")||r.includes("text"))&&(e.splitInstance&&e.splitInstance.revert(),o(e,e.settings,n,a,t))})),r(t.ScrollTrigger),i=c)}),250);window.matchMedia("(hover: none)").matches?window.addEventListener("orientationchange",(function(){setTimeout((function(){c()}),100)})):window.addEventListener("resize",c)}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function c(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?c(Object(r),!0).forEach((function(e){l(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e,r){return(e=function(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function p(){p=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,i=Object.create(o.prototype),c=new F(n||[]);return a(i,"_invoke",{value:T(t,r,c)}),i}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var h="suspendedStart",g="suspendedYield",v="executing",y="completed",b={};function m(){}function w(){}function A(){}var x={};l(x,i,(function(){return this}));var S=Object.getPrototypeOf,O=S&&S(S(I([])));O&&O!==r&&n.call(O,i)&&(x=O);var j=A.prototype=m.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(a,o,i,c){var u=d(t[a],t,o);if("throw"!==u.type){var l=u.arg,s=l.value;return s&&"object"==f(s)&&n.call(s,"__await")?e.resolve(s.__await).then((function(t){r("next",t,i,c)}),(function(t){r("throw",t,i,c)})):e.resolve(s).then((function(t){l.value=t,i(l)}),(function(t){return r("throw",t,i,c)}))}c(u.arg)}var o;a(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,a){r(t,n,e,a)}))}return o=o?o.then(a,a):a()}})}function T(e,r,n){var a=h;return function(o,i){if(a===v)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:t,done:!0}}for(n.method=o,n.arg=i;;){var c=n.delegate;if(c){var u=k(c,n);if(u){if(u===b)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===h)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=v;var l=d(e,r,n);if("normal"===l.type){if(a=n.done?y:g,l.arg===b)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(a=y,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,a=e.iterator[n];if(a===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b;var o=d(a,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function F(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function I(e){if(e||""===e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(f(e)+" is not iterable")}return w.prototype=A,a(j,"constructor",{value:A,configurable:!0}),a(A,"constructor",{value:w,configurable:!0}),w.displayName=l(A,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,A):(t.__proto__=A,l(t,u,"GeneratorFunction")),t.prototype=Object.create(j),t},e.awrap=function(t){return{__await:t}},E(P.prototype),l(P.prototype,c,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var i=new P(s(t,r,n,a),o);return e.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(j),l(j,u,"Generator"),l(j,i,(function(){return this})),l(j,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=I,F.prototype={constructor:F,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(D),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return c.type="throw",c.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),l=n.call(i,"finallyLoc");if(u&&l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var o=a;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,b):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;D(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:I(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}function d(t,e){return b(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,c=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,a=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw a}}return c}}(t,e)||g(t,e)||h()}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(t,e){if(t){if("string"==typeof t)return v(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function y(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function b(t){if(Array.isArray(t))return t}function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach((function(e){A(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function A(t,e,r){return(e=function(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function x(t,e,r,n,a,o,i){try{var c=t[o](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,a)}function S(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function i(t){x(o,n,a,i,c,"next",t)}function c(t){x(o,n,a,i,c,"throw",t)}i(void 0)}))}}var O=null,j=!1,E=!1,P={ease:"ease-in-out",again:!0,viewportPercentage:.8,duration:1,delay:0,distance:1,hoverDuration:.3,hoverDelay:0,hoverEase:"power3.out",hoverDistance:.1,gsapFeatures:[],debug:!1},T={"text-slide-up":"slideUp","text-slide-down":"slideDown","text-tilt-up":"tiltUp","text-tilt-down":"tiltDown","text-rotate-soft":"rotateSoft","text-fade-soft":"fadeSoft","text-fade":"fade","text-fade-up":"fadeUp","text-blur":"blur","text-blur-left":"blurLeft","text-blur-right":"blurRight","text-blur-up":"blurUp","text-blur-down":"blurDown"};function k(){return k=S(p().mark((function t(){var e,o,i,c,u,l=arguments;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l.length>0&&void 0!==l[0]?l[0]:{},o=w(w({},P),e),s=document.querySelectorAll("[aa-animate], [aa-children], [aa-hover]"),i=function(t){if(Array.isArray(t))return v(t)}(s)||y(s)||g(s)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),O=i,j=window.innerWidth<768,E=o.gsapFeatures.length>0,"IntersectionObserver"in window||E){t.next=9;break}return O.forEach((function(t){t.classList.add("in-view")})),t.abrupt("return");case 9:return document.body.style.setProperty("--aa-default-duration","".concat(o.duration,"s")),document.body.style.setProperty("--aa-default-delay","".concat(o.delay,"s")),document.body.style.setProperty("--aa-default-distance","".concat(o.distance)),document.body.style.setProperty("--aa-default-hover-duration","".concat(o.hoverDuration,"s")),document.body.style.setProperty("--aa-default-hover-delay","".concat(o.hoverDelay,"s")),document.body.style.setProperty("--aa-default-hover-distance","".concat(o.distance)),document.body.setAttribute("aa-ease",o.ease),c=null,u=null,E&&(c=S(p().mark((function t(){var e,r,n,i,c,u;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,a.e(678).then(a.bind(a,551));case 3:return e=t.sent,r=e.gsap,n=e.ScrollTrigger,i=e.gsapBundles,c={gsap:r,ScrollTrigger:n},u={},r.registerPlugin(n),window.gsap=r,window.ScrollTrigger=n,t.prev=12,t.next=15,Promise.all(o.gsapFeatures.map(function(){var t=S(p().mark((function t(e){var n,a,o,l;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,n=i[e]){t.next=4;break}return t.abrupt("return");case 4:if(!n.plugins){t.next=9;break}return t.next=7,n.plugins();case 7:t.sent.forEach((function(t){try{Object.entries(t).forEach((function(t){var e=d(t,2),n=e[0],a=e[1];r.registerPlugin(a),("Draggable"===n||a.toString().includes("Draggable"))&&(window.Draggable=a,globalThis.Draggable=a)})),Object.assign(c,t)}catch(t){console.warn("Failed to register plugin for feature ".concat(e,":"),t)}}));case 9:if(!n.dependencies){t.next=14;break}return t.next=12,n.dependencies();case 12:a=t.sent,Object.assign(c,a);case 14:if(!n.animations){t.next=31;break}return t.next=17,n.animations();case 17:o=t.sent,l={},t.t0=e,t.next="text"===t.t0?22:"scroll"===t.t0?24:"slider"===t.t0?26:"hover"===t.t0?28:30;break;case 22:return l=o.createTextAnimations(c.gsap),t.abrupt("break",30);case 24:return l=o.createScrollAnimations(c.gsap,c.ScrollTrigger),t.abrupt("break",30);case 26:return l=o.createSliderAnimations(c.gsap,c.Draggable),t.abrupt("break",30);case 28:return l=o.createHoverAnimations(c.gsap,c.splitText),t.abrupt("break",30);case 30:Object.assign(u,l);case 31:t.next=36;break;case 33:t.prev=33,t.t1=t.catch(0),console.warn("Failed to load feature ".concat(e,":"),t.t1);case 36:case"end":return t.stop()}}),t,null,[[0,33]])})));return function(e){return t.apply(this,arguments)}}()));case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(12),console.warn("Failed to load some GSAP features:",t.t0);case 20:return c.animations=u,t.abrupt("return",c);case 24:return t.prev=24,t.t1=t.catch(0),console.warn("Failed to load GSAP core:",t.t1),t.abrupt("return",null);case 28:case"end":return t.stop()}}),t,null,[[0,24],[12,17]])})))()),t.abrupt("return",new Promise((function(t){window.addEventListener("load",S(p().mark((function e(){var a,i,l,s,f,d,h,g;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!E){e.next=7;break}return e.next=3,c;case 3:(u=e.sent)?((a=document.querySelector("[aa-nav]"))&&(s=a.getAttribute("aa-nav"),f=a.getAttribute("aa-ease"),d=a.getAttribute("aa-duration"),h=a.getAttribute("aa-distance"),g=s.includes("-")&&parseInt(s.split("-").pop())||100,null===(i=(l=u.animations).nav)||void 0===i||i.call(l,a,s,null!=f?f:"back.inOut",null!=d?d:.4,null!=h?h:1,g)),L(O,o,j,u),n(u,o,j,D),r(u.ScrollTrigger),t({gsap:u.gsap,ScrollTrigger:u.ScrollTrigger})):(E=!1,O.forEach((function(t){t.style.visibility="visible"})),L(O,o,j,{gsap:null,ScrollTrigger:null}),t({gsap:null,ScrollTrigger:null})),e.next=9;break;case 7:L(O,o,j,{gsap:null,ScrollTrigger:null}),t({gsap:null,ScrollTrigger:null});case 9:case"end":return e.stop()}}),e)}))))})));case 20:case"end":return t.stop()}var s}),t)}))),k.apply(this,arguments)}function L(t,e,r,n){t.forEach((function(t){if(t.hasAttribute("aa-children")){var a=function(t){var e=Array.from(t.children),r=t.hasAttribute("aa-delay")?parseFloat(t.getAttribute("aa-delay")):0,n=t.hasAttribute("aa-stagger")?parseFloat(t.getAttribute("aa-stagger")):0,a=t.getAttribute("aa-children");return e.forEach((function(e,o){if(!e.hasAttribute("aa-animate")){a&&"true"!==a&&e.setAttribute("aa-animate",a),Array.from(t.attributes).filter((function(t){return t.name.startsWith("aa-")&&!["aa-children","aa-stagger","aa-delay"].includes(t.name)})).forEach((function(t){e.setAttribute(t.name,t.value)}));var i=r+o*n;e.setAttribute("aa-delay",i.toString())}})),t.style.opacity="1",e}(t);L(a,e,r,n)}else{var o=function(t,e){var r=t.getAttribute("aa-animate"),n=t.getAttribute("aa-hover");if(r&&r.includes(":")||n&&n.includes(":"))try{var a={};return(null!=r&&r.includes(":")||null!=r&&r.startsWith("{")?r:n).split(";").forEach((function(t){var e,r,n=(e=t.split(":").map((function(t){return t.trim()})),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,c=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(t){l=!0,a=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw a}}return c}}(e,r)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],i=n[1];o&&i&&(a[o]=isNaN(i)?i:parseFloat(i))})),u(u(u({},e),a),{},{animationType:r&&!r.includes(":")?r:a.animationType,hoverType:n&&!n.includes(":")?n:a.hoverType,anchorSelector:a.anchorSelector||null,anchorElement:a.anchorSelector?document.querySelector(a.anchorSelector):t,isReverse:!!a.hoverType&&a.hoverType.includes("reverse"),bg:t.querySelector("[aa-hover-bg]")})}catch(t){console.warn("Invalid settings format:",t)}var o=t.getAttribute("aa-animate"),i=t.getAttribute("aa-hover"),c=t.getAttribute("aa-anchor"),l=c?document.querySelector(c):t,f=null!=o&&o.includes("#")?"#"+o.split("#")[1]:void 0;return{animationType:o,ease:t.hasAttribute("aa-ease")?t.getAttribute("aa-ease"):e.ease,split:t.getAttribute("aa-split"),scrub:t.getAttribute("aa-scrub")||void 0,distance:t.hasAttribute("aa-distance")?parseFloat(t.getAttribute("aa-distance")):e.distance,hoverType:i,hoverDirection:t.getAttribute("aa-hover-direction")||"all",isReverse:!!i&&i.includes("reverse"),hoverDuration:t.hasAttribute("aa-duration")?parseFloat(t.getAttribute("aa-duration")):e.hoverDuration,hoverDelay:t.hasAttribute("aa-delay")?parseFloat(t.getAttribute("aa-delay")):e.hoverDelay,hoverEase:t.hasAttribute("aa-ease")?t.getAttribute("aa-ease"):e.hoverEase,hoverDistance:t.hasAttribute("aa-distance")?parseFloat(t.getAttribute("aa-distance")):e.hoverDistance,hoverStagger:t.hasAttribute("aa-stagger")?parseFloat(t.getAttribute("aa-stagger")):.03,bg:t.querySelector("[aa-hover-bg]"),duration:t.hasAttribute("aa-duration")?parseFloat(t.getAttribute("aa-duration")):e.duration,delay:t.hasAttribute("aa-delay")?parseFloat(t.getAttribute("aa-delay")):e.delay,delayMobile:t.hasAttribute("aa-delay-mobile")?parseFloat(t.getAttribute("aa-delay-mobile")):void 0,stagger:t.hasAttribute("aa-stagger")?parseFloat(t.getAttribute("aa-stagger")):void 0,pseudoColor:f,viewportPercentage:t.hasAttribute("aa-viewport")?parseFloat(t.getAttribute("aa-viewport")):e.viewportPercentage,anchorSelector:c,anchorElement:l,isParent:t.hasAttribute("aa-children"),childrenAnimation:t.getAttribute("aa-children")}}(t,e);t.settings=o,function(t,e,r){var n,a=e.duration,o=e.delay,i=e.distance,c=e.delayMobile,u=e.pseudoColor;if(t.hasAttribute("aa-duration")&&t.style.setProperty("--aa-duration","".concat(a,"s")),t.hasAttribute("aa-delay")){var l=r&&void 0!==c?c:o;t.style.setProperty("--aa-delay","".concat(l,"s"))}t.hasAttribute("aa-distance")&&t.style.setProperty("--aa-distance","".concat(i)),null!==(n=t.getAttribute("aa-animate"))&&void 0!==n&&n.includes("#")&&t.style.setProperty("--aa-pseudo-color",u)}(t,o,r),t.hasAttribute("aa-hover")&&E&&e.gsapFeatures.includes("hover")&&function(t,e,r,n,a){e.hoverType.split("&").forEach((function(r){var n,o=b(n=r.split("-"))||y(n)||g(n)||h(),i=o[0],c=o.slice(1);switch(i){case"text":a.animations.initializeTextHover(t,w(w({},e),{},{hoverType:r}));break;case"bg":a.animations.initializeBackgroundHover(t,w(w({},e),{},{hoverType:r}),c[0]);break;case"icon":a.animations.initializeIconHover(t,w(w({},e),{},{hoverType:r}))}}))}(t,o,0,0,n),t.hasAttribute("aa-animate")&&(E?D(t,o,e,0,n):(t.style.visibility="visible",function(t,e,r){var n=e.anchorElement,a=e.anchorSelector,o=e.viewportPercentage,i="0px 0px -".concat(100*(1-o),"% 0px"),c=new IntersectionObserver((function(e){e.forEach((function(e){e.isIntersecting&&t.classList.add("in-view")}))}),{threshold:[0,1],rootMargin:i}),u=new IntersectionObserver((function(e){e.forEach((function(e){var n=e.target.getBoundingClientRect();!e.isIntersecting&&n.top>=window.innerHeight&&(r.again||a)&&t.classList.remove("in-view")}))}),{threshold:0,rootMargin:"0px"});c.observe(n),u.observe(n)}(t,o,e)))}}))}function D(t,e,r,n,a){var o=e.animationType,i=e.split,c=e.scrub,u=e.duration,l=e.stagger,s=e.delay,f=e.ease,p=e.distance,d=e.anchorElement,h=e.anchorSelector,g=e.viewportPercentage,v=o.includes("-")?o.split("-")[0]:o;t.timeline&&t.timeline.kill(),t.splitInstance&&t.splitInstance.revert();var y=a.gsap.timeline({paused:!c});t.timeline=y,a.ScrollTrigger.create(w(w({trigger:d},c?{start:"top ".concat(100*g,"%"),end:"top 40%",scrub:"smoother"===c?4:"smooth"===c?2:"snap"!==c||{snap:.2}}:{start:"top ".concat(100*g,"%")}),{},{animation:y,onEnter:function(){t.classList.add("in-view"),c||y.play(),gsap.set(t,{visibility:"visible"})},markers:r.debug})),a.ScrollTrigger.create({trigger:d,start:"top 100%",onLeaveBack:function(){(r.again||h)&&(t.classList.remove("in-view"),y.progress(0).pause())}}),["appear","reveal","counter","text","slider","background","parallax","marquee"].includes(v)&&requestAnimationFrame((function(){switch(v){case"slider":a.animations.slider(t,o,u,f,s);break;case"background":a.animations.backgroundColor(t,u,f,g,r.debug);break;case"parallax":a.animations.parallax(t,c);break;case"appear":y.add(a.animations.appear(t,u,f,s,p));break;case"reveal":y.add(a.animations.reveal(t,u,f,s));break;case"counter":y.add(a.animations.counter(t,u,f,s));break;case"marquee":a.animations.marquee(t,u,c);break;case"text":var e=a.splitText(t,i),n=e.splitElements,d=e.splitInstance;t.splitInstance=d;var h=T[o.replace("-clip","")];h&&y.add(a.animations[h](t,n,i,u,l,s,f));break;default:console.warn("Unknown animation type: ".concat(v))}}))}var F={init:function(){return k.apply(this,arguments)},getGSAP:function(){return window.gsap},getScrollTrigger:function(){return window.ScrollTrigger},getDraggable:function(){return window.Draggable}};"undefined"!=typeof window&&(window.AlrdyAnimate=F)})(),o.AlrdyAnimate})()));