diff --git a/README.md b/README.md index a91fa19..a458425 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,26 @@ An initiative which aims to make it easy to create complex, light-weight, and pe A superset of the Map class, it extends the Map classes capabilities with awesome new features, and relieves some of the inconvient quirks of the Map class. -[Dobumentation](/docs/manager/index.md) | [NPM](https://www.npmjs.com/package/@okikio/manager) +[Documentation](/docs/manager/index.md) | [NPM](https://www.npmjs.com/package/@okikio/manager) ## [@okikio/emitter](/docs/emitter/index.md) A small Event Emitter written in typescript with performance and ease of use in mind. -[Dobumentation](/docs/emitter/index.md) | [NPM](https://www.npmjs.com/package/@okikio/emitter) +[Documentation](/docs/emitter/index.md) | [NPM](https://www.npmjs.com/package/@okikio/emitter) ## [@okikio/animate](/docs/animate/index.md) An animation library for the modern web. Inspired by animate plus, and animejs, it is a Javascript animation library focused on performance and ease of use. It utilizes the Web Animation API (WAAPI) to deliver fluid animations at a *semi-small* size. -[Dobumentation](/docs/animate/index.md) | [NPM](https://www.npmjs.com/package/@okikio/animate) +[Documentation](/docs/animate/index.md) | [NPM](https://www.npmjs.com/package/@okikio/animate) ## [@okikio/native](/docs/native/index.md) A framework to build custom dynamic web experiences around. It acts as a very light weight to build complex web apps, ranging from PJAX based sites to other Single Page Applications (SPA) (React, Vue, etc...) based sites and web apps. -[Dobumentation](/docs/native/index.md) | [NPM](https://www.npmjs.com/package/@okikio/native) +[Documentation](/docs/native/index.md) | [NPM](https://www.npmjs.com/package/@okikio/native) ## Demo & Showcases diff --git a/astro.config.mjs b/astro.config.mjs index 0dbde78..aa5e74b 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,6 +1,15 @@ import plugins from "./src/markdown-plugins.js"; -export default { +// Full Astro Configuration API Documentation: +// https://docs.astro.build/reference/configuration-reference + +// @type-check enabled! +// VSCode and other TypeScript-enabled text editors will provide auto-completion, +// helpful tooltips, and warnings if your exported object is invalid. +// You can disable this by removing "@ts-check" and `@type` comments below. + +// @ts-check +export default /** @type {import('astro').AstroUserConfig} */ ({ // projectRoot: '.', // Where to resolve all URLs relative to. Useful if you have a monorepo project. // pages: './src/pages', // Path to Astro components, pages, and data // dist: './dist', // When running `astro build`, path to final static output @@ -14,5 +23,6 @@ export default { // port: 3000, // The port to run the dev server on. tailwindConfig: './tailwind.config.cjs', // Path to tailwind.config.js if used, e.g. './tailwind.config.js' }, + // Enable the React renderer to support React JSX components. renderers: ['@astrojs/renderer-solid'], -}; \ No newline at end of file +}); \ No newline at end of file diff --git a/docs/animate/api/index.md b/docs/animate/api/index.md index 0aab042..9279608 100644 --- a/docs/animate/api/index.md +++ b/docs/animate/api/index.md @@ -88,6 +88,11 @@ animate({ }, }); ``` +### Animation Options + +`Animate` supports many options ranging from `target` to `fillMode`, etc..., I highly suggest looking through the options offered as many of the features of `@okikio/animate` are unlocked when you know the options, and properly understand their quirks and abilities. + +> [Read more about Animation Options →](/docs/animate/api/options/index.md) ### Animation Options & CSS Properties as Methods diff --git a/docs/animate/api/options/fill-mode.md b/docs/animate/api/options/fill-mode.md index e2a20f6..a1616e0 100644 --- a/docs/animate/api/options/fill-mode.md +++ b/docs/animate/api/options/fill-mode.md @@ -4,7 +4,7 @@ | :------ | :------------------------------------------------------------------------------------------------------ | | `auto` | String \| [TypeCallback](/docs/api/modules/_okikio_animate.md#typecallback) | -_Be careful when using fillMode, it has some problems when it comes to concurrency of animations read more on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill), if browser support were better I would remove fillMode and use Animation.commitStyles, I'll have to change the way `fillMode` functions later. Use the onfinish method to commit styles [onfinish](/docs/animate/api/options/onfinish.md)._ +> _Be careful when using fillMode, it has some problems when it comes to concurrency of animations read more on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill). I highly suggest using [IAnimationOptions.persist](/docs/api/interfaces/_okikio_animate.IAnimationOptions.html#persist), as it's less permanent, or better yet use the [IAnimationOptions.onfinish(...)](/docs/api/interfaces/_okikio_animate.IAnimationOptions.html#onfinish) method, with [Animate.commitStyles(...)](/docs/api/classes/_okikio_animate.Animate.html#commitStyles) to commit styles._ Defines how an element should look after the animation. The fillModes availble are: diff --git a/docs/animate/api/options/index.md b/docs/animate/api/options/index.md index b0083fe..baf8685 100644 --- a/docs/animate/api/options/index.md +++ b/docs/animate/api/options/index.md @@ -17,9 +17,36 @@ export const DefaultAnimationOptions: AnimationOptions = { easing: "ease", autoplay: true, duration: 1000, - fillMode: "auto", + + persist: true, + fillMode: "none", + direction: "normal", padEndDelay: true, extend: {} }; -``` \ No newline at end of file +``` + +The options themselves are, + +* [target(s)](/docs/animate/api/options/target.md): Determines the DOM elements to animate. You can pass it a CSS selector, DOM elements, or an Array of DOM Elements and/or CSS Selectors. +* [easing](/docs/animate/api/options/easing.md): Determines the acceleration curve of your animation. Based on the easings of [easings.net](https://easings.net). +* [duration](/docs/animate/api/options/duration.md): Determines the duration of your animation in milliseconds. By passing it a callback, you can define a different duration for each element. The callback takes the index of each element, the target dom element, and the total number of target elements as its argument and returns a number. +* [delay](/docs/animate/api/options/delay.md): Determines the delay of your animation in milliseconds. By passing it a callback, you can define a different delay for each element. The callback takes the index of each element, the target dom element, and the total number of target elements as its argument and returns a number. +* [timelineOffset](/docs/animate/api/options/timeline-offset.md): Adds an offset ammount to the `delay`, for creating a timeline similar to `animejs`. +* [endDelay](/docs/animate/api/options/end-delay.md): Similar to delay but it indicates the number of milliseconds to delay **after** the full animation has played **not before**. +* [padEndDelay](/docs/animate/api/options/pad-end-delay.md): This ensures all `animations` match up to the total duration, and don't finish too early, if animations finish too early when the `.play()` method is called specific animations that are finished will restart while the rest of the animations will continue playing. +* [loop](/docs/animate/api/options/loop.md): Determines if the animation should repeat, and how many times it should repeat. +* [onfinish](/docs/animate/api/options/onfinish.md): Occurs when the animation for one of the targets completes, meaning when animating many targets that finish at different times this will run multiple times. The arguments it takes is slightly different from the rest of the animation options. +* [oncancel](/docs/animate/api/options/oncancel.md): Occurs when the animation for one of the targets is cancelled, meaning when animating many targets that are cancelled at different times this will run multiple times. The arguments it takes is slightly different from the rest of the animation options. +* [autoplay](/docs/animate/api/options/autoplay.md): Determines if the animation should automatically play immediately after being instantiated. +* [direction](/docs/animate/api/options/direction.md): Determines the direction of the animation. +* [speed](/docs/animate/api/options/speed.md): Determines the animation playback rate. Useful in the authoring process to speed up some parts of a long sequence (value above 1) or slow down a specific animation to observe it (value between 0 to 1). +* [fillMode](/docs/animate/api/options/fill-mode.md): Defines how an element should look after the animation. +* [persist](/docs/animate/api/options/persist.md): Persists animation state, so, when an animation is complete it keeps said finished animation state. Think of it more like a less strict version of [fillMode](/docs/animate/api/options/fill-mode.md), it was inspired by [motion one](https://motion.dev/). +* [options](/docs/animate/api/options/options.md): Another way to input options for an animation, it's also used to chain animations. +* [offset](/docs/animate/api/options/offset.md): Contols the starting point of certain parts of an animation. +* [timeline](/docs/animate/api/options/timeline.md): Represents the timeline of animation. It exists to pass timeline features to Animations (default is [DocumentTimeline](https://developer.mozilla.org/en-US/docs/Web/API/DocumentTimeline)). +* [keyframes](/docs/animate/api/options/keyframes.md): Allows you to manually set keyframes using a `keyframe` array. +* [composite](/docs/animate/api/options/composite.md): The `composite` property of a `KeyframeEffect` resolves how an element's animation impacts its underlying property values. +* [extend](/docs/animate/api/options/extend.md): The properties of the `extend` animation option are not interperted or computed, they are given directly to the `Web Animation API`, as way to access features that haven't been implemented in `@okikio/animate`, for example, `iterationStart`. diff --git a/docs/animate/api/options/options.md b/docs/animate/api/options/options.md index 9688843..dacd6a5 100644 --- a/docs/animate/api/options/options.md +++ b/docs/animate/api/options/options.md @@ -85,4 +85,6 @@ _**Note**: you can't use this property as a method._ console.log(options); //= { ... } })(); -``` \ No newline at end of file +``` + +> Go through the [animation options docs](/docs/animate/api/options/index.md) for extra info. on other animation options. \ No newline at end of file diff --git a/docs/animate/api/options/persist.md b/docs/animate/api/options/persist.md new file mode 100644 index 0000000..2a5f37d --- /dev/null +++ b/docs/animate/api/options/persist.md @@ -0,0 +1,12 @@ +### persist + +| Default | Type | +| :------ | :------ | +| `true` | Boolean | + +Persists animation state, so, when an animation is complete it keeps said finished animation state. +Think of it more like a less strict version of [IAnimationOptions.fillMode](/docs/api/interfaces/_okikio_animate.IAnimationOptions.html#fillMode), it was inspired by [motion one](https://motion.dev/). + +By default WAAPI resets animations back to their initial state once an animation is complete and fillMode isn't being used. The persist animation option, basically tells Animate to find the final state of all CSS Properties being animated, and then set them, so, once the animation is finished and WAAPI resets animations back to their initial state (so `initial state = final state`) the user doesn't notice difference and it looks like the animation stopped on the final state. + +> _**Note**: use this most of the time instead of `fillMode`, as it's impact is less permanent._ \ No newline at end of file diff --git a/docs/animate/api/options/timeline-offset.md b/docs/animate/api/options/timeline-offset.md index 51ce0f7..a9212d7 100644 --- a/docs/animate/api/options/timeline-offset.md +++ b/docs/animate/api/options/timeline-offset.md @@ -6,4 +6,4 @@ Adds an offset amount to the `delay` option, for creating a timeline similar to `animejs`. -I don't intend to create a `timeline` function for this library but if you wish to please try your hands at creating one, if it's small, light-weight, and there is a need I might incorperate it. \ No newline at end of file +> _**Note**: all uses of `delay` include the `timelineOffset` amount by default, if you wish to get the actual unoffseted delay you need to subtract the `timelineOffset` amount from the `delay`._ \ No newline at end of file diff --git a/packages/animate/lib/api.cjs b/packages/animate/lib/api.cjs index f90b91b..53bfa9c 100644 --- a/packages/animate/lib/api.cjs +++ b/packages/animate/lib/api.cjs @@ -1 +1 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=t=>[].concat(...t),e=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,i=(t,e)=>{let i,s,n=Object.keys(t),r={};for(let a=0,o=n.length;a""+t,n=t=>{let e=parseFloat(t);return s(t).replace(s(e),"")},r=t=>s(t).trim(),a=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],o=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),l=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,u=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),p=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},h=(t,e)=>{let i=[...t],s={};for(let t of i)o(e[t])&&(s[t]=e[t]);return s},c=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=a(t),s=i.length;return s>e&&(e=s),i}))).length;for(let n=0;n"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,f=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let n=0;nt.offset-e.offset))};class d{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const g=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,y=g(),b=g("px"),x=g("deg"),E=t=>e=>o(e)?a(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],S=(t,e)=>a(t).map(E(e)),O=E(y),A=E(b),k=E(x),w=new d,D=(t="transparent")=>{if(t=t.trim(),w.has(t))return w.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),n=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return w.set(t,n),n},I={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},C="registerProperty"in CSS,P=Object.keys(I),M=(t={})=>Object.keys(t).filter((t=>P.includes(t))).map((t=>{if(!C)return"";let e=[].concat(I[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),T=(t={})=>{let e={};return P.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>o(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let n=[].concat(I[i]),r=s.every((t=>Array.isArray(t))),a=1==s.length&&"scale"==i;n.forEach(((t,i)=>{let n=a?0:i,l=r?c(...s)[n]:s;if(o(l)){let i=t;/translate|perspective/i.test(i)?l=A(l):/rotate3d3|skew/i.test(i)?l=k(l):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(l=k(l)),e[t]=l}}))})),e},v="function"==typeof Float32Array,N=(t,e)=>1-3*e+3*t,F=(t,e)=>3*e-6*t,j=t=>3*t,z=(t,e,i)=>((N(e,i)*t+F(e,i))*t+j(e))*t,R=(t,e,i)=>3*N(e,i)*t*t+2*F(e,i)*t+j(e),q=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var n=v?new Float32Array(11):new Array(11),r=0;r<11;++r)n[r]=z(.1*r,t,i);const a=e=>{let s=0,r=1;for(;10!==r&&n[r]<=e;++r)s+=.1;--r;let a=s+.1*((e-n[r])/(n[r+1]-n[r])),o=R(a,t,i);return o>=.001?((t,e,i,s)=>{for(var n=0;n<4;++n){let n=R(e,i,s);if(0===n)return e;e-=(z(e,i,s)-t)/n}return e})(e,a,t,i):0===o?a:((t,e,i,s,n)=>{let r,a,o=0;do{a=e+(i-e)/2,r=z(a,s,n)-t,r>0?i=a:e=a}while(Math.abs(r)>1e-7&&++o<10);return a})(e,s,s+.1,t,i)};return t=>0===t||1===t?t:z(a(t),e,s)},L=(t,e,i)=>Math.min(Math.max(t,e),i),_=t=>Math.pow(t,2),V=t=>Math.pow(t,3),K=t=>Math.pow(t,4),U=t=>Math.pow(t,5),X=t=>Math.pow(t,6),Y=t=>1-Math.cos(t*Math.PI/2),G=t=>1-Math.sqrt(1-t*t),Z=t=>t*t*(3*t-2),$=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},B=(t,e=[])=>{let[i=1,s=.5]=e;const n=L(i,1,10),r=L(s,.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)},W=(t,e=[],i)=>{let[s=1,n=100,r=10,a=0]=e;s=L(s,.1,1e3),n=L(n,.1,1e3),r=L(r,.1,1e3),a=L(a,.1,1e3);const o=Math.sqrt(n/s),l=r/(2*Math.sqrt(n*s)),u=l<1?o*Math.sqrt(1-l*l):0,p=l<1?(l*o-a)/u:-a+o;let h=i?i*t/1e3:t;return h=l<1?Math.exp(-h*l*o)*(1*Math.cos(u*h)+p*Math.sin(u*h)):(1+p*h)*Math.exp(-h*o),0===t||1===t?t:1-h},H=new Map,Q=(t="spring")=>{if(H.has(t))return H.get(t);const e="function"==typeof t?t:ot(t),i="function"==typeof t?[]:lt(t),s=1/6;let n=0,r=0,a=0;for(;++a<1e4;)if(n+=s,1===e(n,i,null)){if(r++,r>=16)break}else r=0;const o=n*s*1e3;return H.set(t,o),o},J=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(L(t,0,1)*i)/i},tt=(t,e=[])=>{let[i,s,n,r]=e;return q(i,s,n,r)(t)},et=q(.42,0,1,1),it=t=>(e,i=[],s)=>1-t(1-e,i,s),st=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,nt=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,rt={steps:J,"step-start":t=>J(t,[1,"start"]),"step-end":t=>J(t,[1,"end"]),linear:t=>t,"cubic-bezier":tt,ease:t=>tt(t,[.25,.1,.25,1]),in:et,out:it(et),"in-out":st(et),"out-in":nt(et),"in-quad":_,"out-quad":it(_),"in-out-quad":st(_),"out-in-quad":nt(_),"in-cubic":V,"out-cubic":it(V),"in-out-cubic":st(V),"out-in-cubic":nt(V),"in-quart":K,"out-quart":it(K),"in-out-quart":st(K),"out-in-quart":nt(K),"in-quint":U,"out-quint":it(U),"in-out-quint":st(U),"out-in-quint":nt(U),"in-expo":X,"out-expo":it(X),"in-out-expo":st(X),"out-in-expo":nt(X),"in-sine":Y,"out-sine":it(Y),"in-out-sine":st(Y),"out-in-sine":nt(Y),"in-circ":G,"out-circ":it(G),"in-out-circ":st(G),"out-in-circ":nt(G),"in-back":Z,"out-back":it(Z),"in-out-back":st(Z),"out-in-back":nt(Z),"in-bounce":$,"out-bounce":it($),"in-out-bounce":st($),"out-in-bounce":nt($),"in-elastic":B,"out-elastic":it(B),"in-out-elastic":st(B),"out-in-elastic":nt(B),spring:W,"spring-in":W,"spring-out":it(W),"spring-in-out":st(W),"spring-out-in":nt(W)};exports.EasingFunctionKeys=Object.keys(rt);const at=t=>l(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),ot=t=>{let e=at(s(t));return exports.EasingFunctionKeys.includes(e)?rt[e]:null},lt=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(s(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},ut=(t,e,i)=>e+(i-e)*t,pt=(t,e)=>Math.round(t*10**e)/10**e,ht=(t,e,i=3)=>{let s=e.length-1,n=L(Math.floor(t*s),0,s-1),r=e[n],a=e[n+1];return pt(ut((t-n/s)*s,r,a),i)},ct=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},mt=(t,e)=>{t=L(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},ft=(t,e,i=3)=>{let s="";return ct(e[0])&&(s=n(e[0])),ht(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},dt=(t,e,i=3)=>c(...e.map((t=>D(t)))).map(((e,s)=>{let n=ht(t,e);return s<3?Math.round(n):pt(n,i)})),gt=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(o),yt=(t,e,i=3)=>e.every((t=>"number"==typeof t))?ht(t,e,i):e.every((t=>CSS.supports("color",s(t))))?`rgba(${dt(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?c(...e.map(gt)).map((e=>yt(t,e,i))).join(" "):e.every((t=>ct(t)))?ft(t,e,i):mt(t,e):void 0,bt=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:n=3,duration:r}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:n,duration:r}},xt=new Map,Et=({easing:t,numPoints:e,duration:i}={})=>{const s=[],n=`${t}${e}`;if(xt.has(n))return xt.get(n);const r="function"==typeof t?t:ot(t),a="function"==typeof t?[]:lt(t);for(let t=0;t{if("string"==typeof t.easing){let e=at(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=Q(t.easing))}},Ot=(t,e={})=>{let i=bt(e);return St(i),Et(i).map((e=>yt(e,t,i.decimal)))},At=(t={})=>{let{easing:e,numPoints:s,decimal:n,duration:r,...a}=t,l={easing:e,numPoints:s,decimal:n,duration:r};St(l);let u=i(a,(t=>Ot(t,l))),p={};return o(r)?p={duration:r}:o(l.duration)&&(p={duration:l.duration}),Object.assign({},u,p)},kt={translate:t=>S(t,b),translate3d:t=>S(t,b),translateX:t=>A(t),translateY:t=>A(t),translateZ:t=>A(t),rotate:t=>S(t,x),rotate3d:t=>S(t,y),rotateX:t=>k(t),rotateY:t=>k(t),rotateZ:t=>k(t),scale:t=>S(t,y),scale3d:t=>S(t,y),scaleX:t=>O(t),scaleY:t=>O(t),scaleZ:t=>O(t),skew:t=>S(t,x),skewX:t=>k(t),skewY:t=>k(t),perspective:t=>A(t)},wt=Object.keys(kt),Dt=t=>{let e,i,s=Object.keys(t),n={};for(let r=0,a=s.length;r{let i="",s=t.length;for(let n=0;n(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?c(...Pt(c(...t),e)):i!==e?Array.from(Array(e),((s,n)=>{let r=1==i?Array(2).fill(t[0]):t;return ft(n/(e-1),r)})):t}))),Mt=t=>{let e,n,a=Dt(t);if(C)e=Object.assign({},T(a),p(P,a));else{let t=Object.keys(a).filter((t=>wt.includes(t))),i=t.map((t=>kt[t](a[t])));i=Pt(i),n=c(...i).filter(o).map((e=>It(t,e))),e=p(wt,a)}return e=i(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Ct,"i").test(e)||CSS.supports(l(e),"1px");if(s||n)return s?i=k:n&&(i=A),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(s)})),Object.assign({},o(n)?{transform:n}:null,e)},Tt=t=>t.map((t=>{let e=Dt(t);if(C)return{rest:Object.assign({},T(e),p(P,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:n,translateY:r,translateZ:a,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:c,scale:m,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:x,skewY:E,perspective:S,...w}=e;return i=A(i),s=A(s),n=A(n)[0],r=A(r)[0],a=A(a)[0],o=k(o),l=O(l),u=k(u)[0],h=k(h)[0],c=k(c)[0],m=O(m),f=O(f),d=O(d)[0],g=O(g)[0],y=O(y)[0],b=k(b),x=k(x)[0],E=k(E)[0],S=A(S)[0],{rest:w,transformFunctions:[s,i,n,r,a,l,o,u,h,c,f,m,d,g,y,b,x,E,S]}})).map((({rest:t,transformFunctions:e})=>{let n=C?null:It(wt,e);return t=i(t,((t,e)=>{let i;if(t=s(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Ct,"i").test(e);if(s||n)return s?i=k:n&&(i=A),i(t).join(" ")}return t})),Object.assign({},o(n)?{transform:n}:null,t)})),vt=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class Nt extends d{constructor(t="event"){super(),this.name=t}}const Ft=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class jt extends d{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof Nt?e:(this.set(t,new Nt(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(vt({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,r=Ft(t),a=r?e:i;return r||(n=e),Object.keys(t).forEach((e=>{s=r?e:t[e],r&&(n=t[e]),this.newListener(s,n,a)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof Nt&&e){let n=vt({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===n.callback&&t.scope===n.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,r=Ft(t),a=r?e:i;return r||(n=e),Object.keys(t).forEach((e=>{s=r?e:t[e],r&&(n=t[e]),"function"==typeof n?this.removeListener(s,n,a):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=Ft(t);return Object.keys(t).forEach((n=>{let r=s?n:t[n],a=s?t[n]:e,o=s?e:i,l=(...t)=>{a.apply(o,t),this.removeListener(r,l,o)};this.newListener(r,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof Nt&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const zt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],Rt=e=>Array.isArray(e)?t(e.map(Rt)):"string"==typeof e||e instanceof Node?zt(e):e instanceof NodeList||e instanceof HTMLCollection?Array.from(e):[],qt=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Lt=(t,e,s)=>i(t,(t=>qt(t,e,s))),_t={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Vt=Object.keys(_t),Kt=(t="ease")=>{let e=l(t).replace(/^ease-/,"");return Vt.includes(e)?_t[e]:t},Ut={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Xt=t=>{let{options:e,...i}=t,s=e instanceof Bt?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Yt=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],Gt=["keyframes","padEndDelay","onfinish","oncancel","autoplay","target","targets","timeline"],Zt=[...Yt,...Gt],$t=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new jt,this.targets=new d,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),$t.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/$t.FRAME_RATE,i=t-$t.FRAME_START_TIME;i>e&&($t.FRAME_START_TIME=t-i%e,$t.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),$t.RUNNING.size>0?$t.animationFrame=window.requestAnimationFrame($t.requestFrame):$t.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame($t.animationFrame),$t.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){$t.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),$t.RUNNING.add(this),$t.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:n,endDelay:r,speed:a,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Ut[e];return"function"!=typeof i?i:Ut[e]}));o=Number(o),n=Number(n),i=Number(i),r=Number(r),a=Number(a),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=a,this.maxDuration=i,this.maxEndDelay=r,this.totalDuration=e+o+i*n+r,this.totalDurationOptions={delay:e,duration:i,iterations:n,endDelay:r,speed:a,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((n,r)=>{let a=this.computedOptions.get(n)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??a[i]??this.options[e]??Ut[e]})),l=Lt(o,[r,e,n],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Kt(t))):Kt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:p,endDelay:h,delay:c,duration:m,iterations:f,...d}=l;u=Number(u),f=Number(f),m=Number(m),h=Number(h),p=Number(p),c=Number(c),this.timelineOffset=u??this.timelineOffset,this.minDelay>c&&(this.minDelay=c),this.maxSpeed>p&&(this.maxSpeed=p),this.maxDuration{let d,{speed:g,keyframes:y,tempDurations:b,timelineOffset:x,...E}=n[c];r&&0==E.endDelay&&Math.abs(E.iterations)!=Math.abs(1/0)&&(E.endDelay=this.totalDuration-b);let S,O,A=y;e(A)&&(A=f(A));let k,w,D=this.computedKeyframes.get(t)??{},P="transform"in this.properties?D:p(["transform"],D),T=Object.assign({},a,P),v=i(T,((t,e)=>this.properties[e]??t));if(O=o(A)?A:v,Array.isArray(O))S=O.map((t=>{let{easing:e,offset:i,...s}=p(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Kt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:m(i)}:null)})),d=M(I),S=Tt(S);else{let e=p(["keyframes"],O),{offset:i,...n}=Lt(e,[c,s,t],this);d=M(Dt(n)),n=Mt(n);let r=i;S=Object.assign({},n,o(r)?{offset:r.map(m)}:null)}this.keyframeEffects.has(t)?(w=this.keyframeEffects.get(t),k=this.animations.get(w),w?.setKeyframes?.(S),w?.updateTiming?.(E)):(w=new KeyframeEffect(t,S,E),k=new Animation(w,h),this.keyframeEffects.set(t,w),this.animations.set(w,k)),k.updatePlaybackRate?k.updatePlaybackRate(g):k.playbackRate=g,k.onfinish=()=>{"function"==typeof l&&l.call(this,t,c,s,k)},k.oncancel=()=>{"function"==typeof u&&u.call(this,t,c,s,k)},C&&Object.assign(t.style,{transform:d}),this.computedOptions.set(t,E),this.computedKeyframes.set(t,S)}))}updateOptions(t={}){try{let e=Xt(t);this.initialOptions=e,this.options=Object.assign({},Ut,this.options,e);let{padEndDelay:i,autoplay:s,target:n,targets:r,timeline:a,onfinish:o,oncancel:l,...u}=p(Yt,this.options);this.properties=p(Zt,e);let h=this.targets.values(),c=[...new Set([...h,...Rt(r),...Rt(n)])];this.targets.clear(),c.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let m=this.targets.size,f=this.createArrayOfComputedOptions(e,m);if(this.createAnimations({arrOfComputedOptions:f,padEndDelay:i,oldCSSProperties:u,onfinish:o,oncancel:l,timeline:a},m),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("@okikio/animate - `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,a)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),n=this.is("paused");return this.updateOptions(),s?this.play():n&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&($t.RUNNING.add(this),null==$t.animationFrame&&$t.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let Bt=$t;Bt.RUNNING=new Set,Bt.FRAME_RATE=60,Bt.FRAME_START_TIME=0,Bt.pauseOnPageHidden=!0;exports.UIDCount=0;const Wt=document.createElement("div"),Ht=()=>{o(Wt.id)||(Wt.id="empty-tween-el-container",Wt.style.setProperty("display","none"),Wt.style.setProperty("contain","paint layout size"),document.body.appendChild(Wt));let t=document.createElement("div");return t.id="empty-animate-el-"+exports.UIDCount++,t.style.setProperty("display","none"),Wt.appendChild(t),t};class Qt extends Bt{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const Jt=(t={})=>{let{easing:e,decimal:i,numPoints:s,opacity:n,...r}=Xt(t),a=h(Zt,r),o=e;if("string"==typeof e){let t=at(e);o=Vt.includes(t)||["linear","steps","step-start","step-end"].includes(t)?Kt(e):exports.EasingFunctionKeys.includes(t)?ot(e):e}return{..."function"==typeof o?At({opacity:[0,1],easing:e,decimal:i,numPoints:s}):{opacity:[0,1],easing:e},...a}};class te extends Qt{constructor(){super(...arguments),this.updateListeners=new d}updateOptions(t={}){let e=Xt(t),s=this.targets.size>1?null:{target:Ht()},n=Object.assign({},Jt(p(["target","targets"],e)),s);super.updateOptions(n);let r=p(Zt,e);try{this.updateListeners=this.updateListeners??new d,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:s}=e,n=[...new Set([...Rt(s),...Rt(t)])],a=n.length,o=this.targets.get(0),l=window.getComputedStyle(o);n.forEach(((t,s)=>{i(r,((i,n)=>{let r,o=t.getAttribute(n);this.on("update",r=()=>{let r,u=Number(l.getPropertyValue("opacity"));r="function"==typeof i?i(u,s,a,t):yt(u,Array.isArray(i)?i:[o,i],e.decimal),t.setAttribute(n,""+r)}),this.updateListeners.add(r)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const ee=(t,e={})=>{const{grid:i,axis:s,from:r=0,easing:a,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,p=parseFloat(l?t[0]:t),h=l?parseFloat(t[u]):0,{start:c=(l?p:0)}=e,m=n(l?t[u]:t)||0,f="function"==typeof a?a:ot(a),d="function"==typeof a?[]:lt(a);let g,y=[],b=0,x=r;return/from/i.test(r)&&(x=0),(t,e)=>{if(/center/i.test(r)&&(x=(e-1)/2),/last/i.test(r)&&(x=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return c+g*(Math.round(100*y[t])/100)+m}},ie=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class se{constructor(t={}){this.animateInstances=new d,this.initialOptions={},this.mainInstance=new Bt({duration:0}),this.initialOptions=Object.assign({},Ut,Xt(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Xt(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Ut,this.initialOptions,t instanceof Bt?t.initialOptions:Xt(t));return s.timelineOffset=ie(e,this.totalDuration),s.autoplay=this.initialOptions.autoplay,t instanceof Bt?(i=t,i.updateOptions(s)):i=new Bt(s),this.animateInstances.add(i),this.updateTiming(),this}updateTiming(){let t=this.animateInstances.values(),e=Math.max(...t.map((t=>t.totalDuration)));return this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:n}=i.totalDurationOptions,r=Number(s)-Number(n);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Timeline"}}exports.ALL_TIMING_KEYS=Zt,exports.Animate=Bt,exports.AnimateAttributes=te,exports.ApplyCustomEasing=At,exports.Back=Z,exports.Bezier=tt,exports.Bounce=$,exports.CSSArrValue=S,exports.CSSCamelCase=Dt,exports.CSSPXDataType=Ct,exports.CSSValue=E,exports.CSSVarSupport=C,exports.CSS_CACHE=w,exports.Circ=G,exports.ComplexEasingSyntax=at,exports.ComplexStrtoArr=gt,exports.Cubic=V,exports.CustomEasing=Ot,exports.CustomEasingOptions=bt,exports.DefaultAnimationOptions=Ut,exports.DestroyableAnimate=Qt,exports.EASINGS=_t,exports.EFFECTS={},exports.EaseInOut=st,exports.EaseOut=it,exports.EaseOutIn=nt,exports.EasingDurationCache=H,exports.EasingFunctions=rt,exports.EasingKeys=Vt,exports.EasingPts=Et,exports.Elastic=B,exports.EmptyTweenElContainer=Wt,exports.Expo=X,exports.FUNCTION_SUPPORTED_TIMING_KEYS=Yt,exports.GetEase=Kt,exports.GetEasingFunction=ot,exports.INTINITE_LOOP_LIMIT=1e4,exports.KeyframeParse=f,exports.NOT_FUNCTION_SUPPORTED_TIMING_KEYS=Gt,exports.ParseTransformableCSSKeyframes=Tt,exports.ParseTransformableCSSProperties=Mt,exports.Quad=_,exports.Quart=K,exports.Quint=U,exports.Sine=Y,exports.Spring=W,exports.SpringEasing=(t,e={})=>{let i=bt(e),{duration:s}=i;return St(i),[Ot(t,i),o(s)?s:i.duration]},exports.StaggerCustomEasing=(t,e={})=>{let i=e.stagger??{};return(s,n)=>{let r=t.map(((e,r)=>{let a=t[Math.max(0,r-1)];return ee([a,e],i)(s,n)}));return Ot(r,e)}},exports.Steps=J,exports.Timeline=se,exports.TransformFunctionNames=wt,exports.TransformFunctions=kt,exports.TweenCache=xt,exports.UnitDEG=x,exports.UnitDEGCSSValue=k,exports.UnitLess=y,exports.UnitLessCSSValue=O,exports.UnitPX=b,exports.UnitPXCSSValue=A,exports.addCSSUnit=g,exports.animate=(t={})=>new Bt(t),exports.arrFill=Pt,exports.camelCase=u,exports.computeOption=qt,exports.convertToDash=l,exports.createEmptyEl=Ht,exports.createTransformProperty=It,exports.createTransformValue=M,exports.createTweenOptions=Jt,exports.easein=et,exports.flatten=t,exports.getEasingDuration=Q,exports.getElements=zt,exports.getTargets=Rt,exports.getUnit=n,exports.interpolateColor=dt,exports.interpolateComplex=yt,exports.interpolateNumber=ht,exports.interpolateString=ft,exports.interpolateUsingIndex=mt,exports.isEmpty=t=>{for(let e in t)return!1;return!0},exports.isNumberLike=ct,exports.isObject=e,exports.isValid=o,exports.limit=L,exports.mapAnimationOptions=Lt,exports.mapObject=i,exports.omit=p,exports.parseEasingParameters=lt,exports.parseOffset=m,exports.parseOptions=Xt,exports.pick=h,exports.random=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,exports.registerEasingFunction=(t,e)=>{Object.assign(rt,{[t]:e}),exports.EasingFunctionKeys=Object.keys(rt)},exports.registerEasingFunctions=(...t)=>{Object.assign(rt,...t),exports.EasingFunctionKeys=Object.keys(rt)},exports.relativeTo=ie,exports.scale=ut,exports.stagger=ee,exports.timeline=(t={})=>new se(t),exports.toArr=a,exports.toCSSVars=T,exports.toFixed=pt,exports.toRGBAArr=D,exports.toStr=s,exports.transformCSSVars=I,exports.transformProperyNames=P,exports.transpose=c,exports.trim=r,exports.tweenAttr=(t={})=>new te(t); +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const t=t=>[].concat(...t),e=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,i=(t,e)=>{let i,s,n=Object.keys(t),r={};for(let a=0,o=n.length;a""+t,n=t=>{let e=parseFloat(t);return s(t).replace(s(e),"")},r=t=>s(t).trim(),a=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],o=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),l=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,u=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),p=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},h=(t,e)=>{let i=[...t],s={};for(let t of i)o(e[t])&&(s[t]=e[t]);return s},c=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=a(t),s=i.length;return s>e&&(e=s),i}))).length;for(let n=0;n"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,f=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let n=0;nt.offset-e.offset))};class d{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const g=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,y=g(),b=g("px"),x=g("deg"),E=t=>e=>o(e)?a(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],S=(t,e)=>a(t).map(E(e)),O=E(y),A=E(b),k=E(x),w=new d,D=(t="transparent")=>{if(t=t.trim(),w.has(t))return w.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),n=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return w.set(t,n),n},I={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},P="registerProperty"in CSS,C=Object.keys(I),M=(t={})=>Object.keys(t).filter((t=>C.includes(t))).map((t=>{if(!P)return"";let e=[].concat(I[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),v=(t={})=>{let e={};return C.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>o(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let n=[].concat(I[i]),r=s.every((t=>Array.isArray(t))),a=1==s.length&&"scale"==i;n.forEach(((t,i)=>{let n=a?0:i,l=r?c(...s)[n]:s;if(o(l)){let i=t;/translate|perspective/i.test(i)?l=A(l):/rotate3d3|skew/i.test(i)?l=k(l):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(l=k(l)),e[t]=l}}))})),e},T="function"==typeof Float32Array,N=(t,e)=>1-3*e+3*t,F=(t,e)=>3*e-6*t,j=t=>3*t,z=(t,e,i)=>((N(e,i)*t+F(e,i))*t+j(e))*t,q=(t,e,i)=>3*N(e,i)*t*t+2*F(e,i)*t+j(e),R=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var n=T?new Float32Array(11):new Array(11),r=0;r<11;++r)n[r]=z(.1*r,t,i);const a=e=>{let s=0,r=1;for(;10!==r&&n[r]<=e;++r)s+=.1;--r;let a=s+.1*((e-n[r])/(n[r+1]-n[r])),o=q(a,t,i);return o>=.001?((t,e,i,s)=>{for(var n=0;n<4;++n){let n=q(e,i,s);if(0===n)return e;e-=(z(e,i,s)-t)/n}return e})(e,a,t,i):0===o?a:((t,e,i,s,n)=>{let r,a,o=0;do{a=e+(i-e)/2,r=z(a,s,n)-t,r>0?i=a:e=a}while(Math.abs(r)>1e-7&&++o<10);return a})(e,s,s+.1,t,i)};return t=>0===t||1===t?t:z(a(t),e,s)},L=(t,e,i)=>Math.min(Math.max(t,e),i),_=t=>Math.pow(t,2),V=t=>Math.pow(t,3),K=t=>Math.pow(t,4),U=t=>Math.pow(t,5),Y=t=>Math.pow(t,6),X=t=>1-Math.cos(t*Math.PI/2),G=t=>1-Math.sqrt(1-t*t),Z=t=>t*t*(3*t-2),$=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},Q=(t,e=[])=>{let[i=1,s=.5]=e;const n=L(i,1,10),r=L(s,.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-r/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/r)},B=(t,e=[],i)=>{let[s=1,n=100,r=10,a=0]=e;s=L(s,.1,1e3),n=L(n,.1,1e3),r=L(r,.1,1e3),a=L(a,.1,1e3);const o=Math.sqrt(n/s),l=r/(2*Math.sqrt(n*s)),u=l<1?o*Math.sqrt(1-l*l):0,p=l<1?(l*o-a)/u:-a+o;let h=i?i*t/1e3:t;return h=l<1?Math.exp(-h*l*o)*(1*Math.cos(u*h)+p*Math.sin(u*h)):(1+p*h)*Math.exp(-h*o),0===t||1===t?t:1-h},W=new Map,H=(t="spring")=>{if(W.has(t))return W.get(t);const e="function"==typeof t?t:ot(t),i="function"==typeof t?[]:lt(t),s=1/6;let n=0,r=0,a=0;for(;++a<1e4;)if(n+=s,1===e(n,i,null)){if(r++,r>=16)break}else r=0;const o=n*s*1e3;return W.set(t,o),o},J=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(L(t,0,1)*i)/i},tt=(t,e=[])=>{let[i,s,n,r]=e;return R(i,s,n,r)(t)},et=R(.42,0,1,1),it=t=>(e,i=[],s)=>1-t(1-e,i,s),st=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,nt=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,rt={steps:J,"step-start":t=>J(t,[1,"start"]),"step-end":t=>J(t,[1,"end"]),linear:t=>t,"cubic-bezier":tt,ease:t=>tt(t,[.25,.1,.25,1]),in:et,out:it(et),"in-out":st(et),"out-in":nt(et),"in-quad":_,"out-quad":it(_),"in-out-quad":st(_),"out-in-quad":nt(_),"in-cubic":V,"out-cubic":it(V),"in-out-cubic":st(V),"out-in-cubic":nt(V),"in-quart":K,"out-quart":it(K),"in-out-quart":st(K),"out-in-quart":nt(K),"in-quint":U,"out-quint":it(U),"in-out-quint":st(U),"out-in-quint":nt(U),"in-expo":Y,"out-expo":it(Y),"in-out-expo":st(Y),"out-in-expo":nt(Y),"in-sine":X,"out-sine":it(X),"in-out-sine":st(X),"out-in-sine":nt(X),"in-circ":G,"out-circ":it(G),"in-out-circ":st(G),"out-in-circ":nt(G),"in-back":Z,"out-back":it(Z),"in-out-back":st(Z),"out-in-back":nt(Z),"in-bounce":$,"out-bounce":it($),"in-out-bounce":st($),"out-in-bounce":nt($),"in-elastic":Q,"out-elastic":it(Q),"in-out-elastic":st(Q),"out-in-elastic":nt(Q),spring:B,"spring-in":B,"spring-out":it(B),"spring-in-out":st(B),"spring-out-in":nt(B)};exports.EasingFunctionKeys=Object.keys(rt);const at=t=>l(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),ot=t=>{let e=at(s(t));return exports.EasingFunctionKeys.includes(e)?rt[e]:null},lt=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(s(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},ut=(t,e,i)=>e+(i-e)*t,pt=(t,e)=>Math.round(t*10**e)/10**e,ht=(t,e,i=3)=>{let s=e.length-1,n=L(Math.floor(t*s),0,s-1),r=e[n],a=e[n+1];return pt(ut((t-n/s)*s,r,a),i)},ct=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},mt=(t,e)=>{t=L(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},ft=(t,e,i=3)=>{let s="";return ct(e[0])&&(s=n(e[0])),ht(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},dt=(t,e,i=3)=>c(...e.map((t=>D(t)))).map(((e,s)=>{let n=ht(t,e);return s<3?Math.round(n):pt(n,i)})),gt=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(o),yt=(t,e,i=3)=>e.every((t=>"number"==typeof t))?ht(t,e,i):e.every((t=>CSS.supports("color",s(t))))?`rgba(${dt(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?c(...e.map(gt)).map((e=>yt(t,e,i))).join(" "):e.every((t=>ct(t)))?ft(t,e,i):mt(t,e):void 0,bt=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:n=3,duration:r}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:n,duration:r}},xt=new Map,Et=({easing:t,numPoints:e,duration:i}={})=>{const s=[],n=`${t}${e}`;if(xt.has(n))return xt.get(n);const r="function"==typeof t?t:ot(t),a="function"==typeof t?[]:lt(t);for(let t=0;t{if("string"==typeof t.easing){let e=at(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=H(t.easing))}},Ot=(t,e={})=>{let i=bt(e);return St(i),Et(i).map((e=>yt(e,t,i.decimal)))},At=(t={})=>{let{easing:e,numPoints:s,decimal:n,duration:r,...a}=t,l={easing:e,numPoints:s,decimal:n,duration:r};St(l);let u=i(a,(t=>Ot(t,l))),p={};return o(r)?p={duration:r}:o(l.duration)&&(p={duration:l.duration}),Object.assign({},u,p)},kt={translate:t=>S(t,b),translate3d:t=>S(t,b),translateX:t=>A(t),translateY:t=>A(t),translateZ:t=>A(t),rotate:t=>S(t,x),rotate3d:t=>S(t,y),rotateX:t=>k(t),rotateY:t=>k(t),rotateZ:t=>k(t),scale:t=>S(t,y),scale3d:t=>S(t,y),scaleX:t=>O(t),scaleY:t=>O(t),scaleZ:t=>O(t),skew:t=>S(t,x),skewX:t=>k(t),skewY:t=>k(t),perspective:t=>A(t)},wt=Object.keys(kt),Dt=t=>{let e,i,s=Object.keys(t),n={};for(let r=0,a=s.length;r{let i="",s=t.length;for(let n=0;n(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?c(...Ct(c(...t),e)):i!==e?Array.from(Array(e),((s,n)=>{let r=1==i?Array(2).fill(t[0]):t;return ft(n/(e-1),r)})):t}))),Mt=t=>{let e,n,a=Dt(t);if(P)e=Object.assign({},v(a),p(C,a));else{let t=Object.keys(a).filter((t=>wt.includes(t))),i=t.map((t=>kt[t](a[t])));i=Ct(i),n=c(...i).filter(o).map((e=>It(t,e))),e=p(wt,a)}return e=i(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Pt,"i").test(e)||CSS.supports(l(e),"1px");if(s||n)return s?i=k:n&&(i=A),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(s)})),Object.assign({},o(n)?{transform:n}:null,e)},vt=t=>t.map((t=>{let e=Dt(t);if(P)return{rest:Object.assign({},v(e),p(C,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:n,translateY:r,translateZ:a,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:c,scale:m,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:x,skewY:E,perspective:S,...w}=e;return i=A(i),s=A(s),n=A(n)[0],r=A(r)[0],a=A(a)[0],o=k(o),l=O(l),u=k(u)[0],h=k(h)[0],c=k(c)[0],m=O(m),f=O(f),d=O(d)[0],g=O(g)[0],y=O(y)[0],b=k(b),x=k(x)[0],E=k(E)[0],S=A(S)[0],{rest:w,transformFunctions:[s,i,n,r,a,l,o,u,h,c,f,m,d,g,y,b,x,E,S]}})).map((({rest:t,transformFunctions:e})=>{let n=P?null:It(wt,e);return t=i(t,((t,e)=>{let i;if(t=s(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Pt,"i").test(e);if(s||n)return s?i=k:n&&(i=A),i(t).join(" ")}return t})),Object.assign({},o(n)?{transform:n}:null,t)})),Tt=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class Nt extends d{constructor(t="event"){super(),this.name=t}}const Ft=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class jt extends d{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof Nt?e:(this.set(t,new Nt(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(Tt({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,r=Ft(t),a=r?e:i;return r||(n=e),Object.keys(t).forEach((e=>{s=r?e:t[e],r&&(n=t[e]),this.newListener(s,n,a)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof Nt&&e){let n=Tt({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===n.callback&&t.scope===n.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,r=Ft(t),a=r?e:i;return r||(n=e),Object.keys(t).forEach((e=>{s=r?e:t[e],r&&(n=t[e]),"function"==typeof n?this.removeListener(s,n,a):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=Ft(t);return Object.keys(t).forEach((n=>{let r=s?n:t[n],a=s?t[n]:e,o=s?e:i,l=(...t)=>{a.apply(o,t),this.removeListener(r,l,o)};this.newListener(r,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof Nt&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const zt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],qt=e=>Array.isArray(e)?t(e.map(qt)):"string"==typeof e||e instanceof Node?zt(e):e instanceof NodeList||e instanceof HTMLCollection?Array.from(e):[],Rt=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Lt=(t,e,s)=>i(t,(t=>Rt(t,e,s))),_t={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Vt=Object.keys(_t),Kt=(t="ease")=>{let e=l(t).replace(/^ease-/,"");return Vt.includes(e)?_t[e]:t},Ut={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,persist:!0,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Yt=t=>{let{options:e,...i}=t,s=e instanceof Qt?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Xt=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],Gt=["keyframes","padEndDelay","persist","onfinish","oncancel","autoplay","target","targets","timeline"],Zt=[...Xt,...Gt],$t=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new jt,this.targets=new d,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),$t.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/$t.FRAME_RATE,i=t-$t.FRAME_START_TIME;i>e&&($t.FRAME_START_TIME=t-i%e,$t.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),$t.RUNNING.size>0?$t.animationFrame=window.requestAnimationFrame($t.requestFrame):$t.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame($t.animationFrame),$t.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){$t.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),$t.RUNNING.add(this),$t.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:n,endDelay:r,speed:a,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Ut[e];return"function"!=typeof i?i:Ut[e]}));o=Number(o),n=Number(n),i=Number(i),r=Number(r),a=Number(a),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=a,this.maxDuration=i,this.maxEndDelay=r,this.totalDuration=e+o+i*n+r,this.totalDurationOptions={delay:e,duration:i,iterations:n,endDelay:r,speed:a,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((n,r)=>{let a=this.computedOptions.get(n)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??a[i]??this.options[e]??Ut[e]})),l=Lt(o,[r,e,n],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Kt(t))):Kt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:p,endDelay:h,delay:c,duration:m,iterations:f,...d}=l;u=Number(u),f=Number(f),m=Number(m),h=Number(h),p=Number(p),c=Number(c)+u,this.timelineOffset=u??this.timelineOffset,this.minDelay>c&&(this.minDelay=c),this.maxSpeed>p&&(this.maxSpeed=p),this.maxDuration{let g,{speed:y,keyframes:b,tempDurations:x,timelineOffset:E,...S}=n[d];r&&0==S.endDelay&&Math.abs(S.iterations)!=Math.abs(1/0)&&(S.endDelay=this.totalDuration-x);let O,A,k=b;e(k)&&(k=f(k));let w,D,C=this.computedKeyframes.get(t)??{},v="transform"in this.properties?C:p(["transform"],C),T=Object.assign({},a,v),N=i(T,((t,e)=>this.properties[e]??t));if(A=o(k)?k:N,Array.isArray(A))O=A.map((t=>{let{easing:e,offset:i,...s}=p(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Kt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:m(i)}:null)})),g=M(I),O=vt(O),h&&O.length&&i(O[O.length-1],((e,i)=>{t.style.setProperty(i,e)}));else{let e=p(["keyframes"],A),{offset:n,...r}=Lt(e,[d,s,t],this);g=M(Dt(r)),r=Mt(r);let a=n;O=Object.assign({},r,o(a)?{offset:a.map(m)}:null),h&&i(r,((e,i)=>{!e.length||t.style.setProperty(i,e[e.length-1])}))}this.keyframeEffects.has(t)?(D=this.keyframeEffects.get(t),w=this.animations.get(D),D?.setKeyframes?.(O),D?.updateTiming?.(S)):(D=new KeyframeEffect(t,O,S),w=new Animation(D,c),this.keyframeEffects.set(t,D),this.animations.set(D,w)),w.updatePlaybackRate?w.updatePlaybackRate(y):w.playbackRate=y,w.onfinish=()=>{"function"==typeof l&&l.call(this,t,d,s,w)},w.oncancel=()=>{"function"==typeof u&&u.call(this,t,d,s,w)},P&&Object.assign(t.style,{transform:g}),this.computedOptions.set(t,S),this.computedKeyframes.set(t,O)}))}updateOptions(t={}){try{let e=Yt(t);this.initialOptions=e,this.options=Object.assign({},Ut,this.options,e);let{padEndDelay:i,autoplay:s,target:n,targets:r,timeline:a,persist:o,onfinish:l,oncancel:u,...h}=p(Xt,this.options);this.properties=p(Zt,e);let c=this.targets.values(),m=[...new Set([...c,...qt(r),...qt(n)])];this.targets.clear(),m.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let f=this.targets.size,d=this.createArrayOfComputedOptions(e,f);if(this.createAnimations({arrOfComputedOptions:d,padEndDelay:i,oldCSSProperties:h,onfinish:l,oncancel:u,persist:o,timeline:a},f),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("[Animate - @okikio/animate] `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,a)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),n=this.is("paused");return this.updateOptions(),s?this.play():n&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&($t.RUNNING.add(this),null==$t.animationFrame&&$t.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let Qt=$t;Qt.RUNNING=new Set,Qt.FRAME_RATE=60,Qt.FRAME_START_TIME=0,Qt.pauseOnPageHidden=!0;exports.UIDCount=0;const Bt=document.createElement("div"),Wt=()=>{o(Bt.id)||(Bt.id="empty-tween-el-container",Bt.style.setProperty("display","none"),Bt.style.setProperty("contain","paint layout size"),document.body.appendChild(Bt));let t=document.createElement("div");return t.id="empty-animate-el-"+exports.UIDCount++,t.style.setProperty("display","none"),Bt.appendChild(t),t};class Ht extends Qt{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const Jt=(t={})=>{let{easing:e,decimal:i,numPoints:s,opacity:n,...r}=Yt(t),a=h(Zt,r),o=e;if("string"==typeof e){let t=at(e);o=Vt.includes(t)||["linear","steps","step-start","step-end"].includes(t)?Kt(e):exports.EasingFunctionKeys.includes(t)?ot(e):e}return{..."function"==typeof o?At({opacity:[0,1],easing:e,decimal:i,numPoints:s}):{opacity:[0,1],easing:e},...a}};class te extends Ht{constructor(){super(...arguments),this.updateListeners=new d}updateOptions(t={}){let e=Yt(t),s=this.targets.size>1?null:{target:Wt()},n=Object.assign({},Jt(p(["target","targets"],e)),s);super.updateOptions(n);let r=p(Zt,e);try{this.updateListeners=this.updateListeners??new d,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:s}=e,n=[...new Set([...qt(s),...qt(t)])],a=n.length,o=this.targets.get(0),l=window.getComputedStyle(o);n.forEach(((t,s)=>{i(r,((i,n)=>{let r,o=t.getAttribute(n);this.on("update",r=()=>{let r,u=Number(l.getPropertyValue("opacity"));r="function"==typeof i?i(u,s,a,t):yt(u,Array.isArray(i)?i:[o,i],e.decimal),t.setAttribute(n,""+r)}),this.updateListeners.add(r)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const ee=(t,e={})=>{const{grid:i,axis:s,from:r=0,easing:a,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,p=parseFloat(l?t[0]:t),h=l?parseFloat(t[u]):0,{start:c=(l?p:0)}=e,m=n(l?t[u]:t)||0,f="function"==typeof a?a:ot(a),d="function"==typeof a?[]:lt(a);let g,y=[],b=0,x=r;return/from/i.test(r)&&(x=0),(t,e)=>{if(/center/i.test(r)&&(x=(e-1)/2),/last/i.test(r)&&(x=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return c+g*(Math.round(100*y[t])/100)+m}},ie=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class se{constructor(t={}){this.animateInstances=new d,this.initialOptions={},this.mainInstance=new Qt({duration:0}),this.initialOptions=Object.assign({},Ut,Yt(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Yt(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Ut,this.initialOptions,t instanceof Qt?t.initialOptions:Yt(t));if(Math.abs(this.totalDuration)!==1/0)if(/\t.totalDuration)));return Math.abs(e)==1/0?(console.warn('[Queue - @okikio/animate] individual Animate instances that are part of a Queue can\'t have Infinite totalDuration. You can\'t queue animations one after the other if one of the animations last for literally infinity. This issue may come from setting the "loop, duration, endDelay, delay, etc..." animation options to either Infinity (or for the loop option only, "true").'),this):(this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this)}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:n}=i.totalDurationOptions,r=Number(s)-Number(n);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Queue"}}exports.ALL_TIMING_KEYS=Zt,exports.Animate=Qt,exports.AnimateAttributes=te,exports.ApplyCustomEasing=At,exports.Back=Z,exports.Bezier=tt,exports.Bounce=$,exports.CSSArrValue=S,exports.CSSCamelCase=Dt,exports.CSSPXDataType=Pt,exports.CSSValue=E,exports.CSSVarSupport=P,exports.CSS_CACHE=w,exports.Circ=G,exports.ComplexEasingSyntax=at,exports.ComplexStrtoArr=gt,exports.Cubic=V,exports.CustomEasing=Ot,exports.CustomEasingOptions=bt,exports.DefaultAnimationOptions=Ut,exports.DestroyableAnimate=Ht,exports.EASINGS=_t,exports.EFFECTS={},exports.EaseInOut=st,exports.EaseOut=it,exports.EaseOutIn=nt,exports.EasingDurationCache=W,exports.EasingFunctions=rt,exports.EasingKeys=Vt,exports.EasingPts=Et,exports.Elastic=Q,exports.EmptyTweenElContainer=Bt,exports.Expo=Y,exports.FUNCTION_SUPPORTED_TIMING_KEYS=Xt,exports.GetEase=Kt,exports.GetEasingFunction=ot,exports.INTINITE_LOOP_LIMIT=1e4,exports.KeyframeParse=f,exports.NOT_FUNCTION_SUPPORTED_TIMING_KEYS=Gt,exports.ParseTransformableCSSKeyframes=vt,exports.ParseTransformableCSSProperties=Mt,exports.Quad=_,exports.Quart=K,exports.Queue=se,exports.Quint=U,exports.Sine=X,exports.Spring=B,exports.SpringEasing=(t,e={})=>{let i=bt(e),{duration:s}=i;return St(i),[Ot(t,i),o(s)?s:i.duration]},exports.StaggerCustomEasing=(t,e={})=>{let i=e.stagger??{};return(s,n)=>{let r=t.map(((e,r)=>{let a=t[Math.max(0,r-1)];return ee([a,e],i)(s,n)}));return Ot(r,e)}},exports.Steps=J,exports.TransformFunctionNames=wt,exports.TransformFunctions=kt,exports.TweenCache=xt,exports.UnitDEG=x,exports.UnitDEGCSSValue=k,exports.UnitLess=y,exports.UnitLessCSSValue=O,exports.UnitPX=b,exports.UnitPXCSSValue=A,exports.addCSSUnit=g,exports.animate=(t={})=>new Qt(t),exports.arrFill=Ct,exports.camelCase=u,exports.computeOption=Rt,exports.convertToDash=l,exports.createEmptyEl=Wt,exports.createTransformProperty=It,exports.createTransformValue=M,exports.createTweenOptions=Jt,exports.easein=et,exports.flatten=t,exports.getEasingDuration=H,exports.getElements=zt,exports.getTargets=qt,exports.getUnit=n,exports.interpolateColor=dt,exports.interpolateComplex=yt,exports.interpolateNumber=ht,exports.interpolateString=ft,exports.interpolateUsingIndex=mt,exports.isEmpty=t=>{for(let e in t)return!1;return!0},exports.isNumberLike=ct,exports.isObject=e,exports.isValid=o,exports.limit=L,exports.mapAnimationOptions=Lt,exports.mapObject=i,exports.omit=p,exports.parseEasingParameters=lt,exports.parseOffset=m,exports.parseOptions=Yt,exports.pick=h,exports.queue=(t={})=>new se(t),exports.random=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,exports.registerEasingFunction=(t,e)=>{Object.assign(rt,{[t]:e}),exports.EasingFunctionKeys=Object.keys(rt)},exports.registerEasingFunctions=(...t)=>{Object.assign(rt,...t),exports.EasingFunctionKeys=Object.keys(rt)},exports.relativeTo=ie,exports.scale=ut,exports.stagger=ee,exports.toArr=a,exports.toCSSVars=v,exports.toFixed=pt,exports.toRGBAArr=D,exports.toStr=s,exports.transformCSSVars=I,exports.transformProperyNames=C,exports.transpose=c,exports.trim=r,exports.tweenAttr=(t={})=>new te(t); diff --git a/packages/animate/lib/api.js b/packages/animate/lib/api.js index 69ecf3b..7d1ec00 100644 --- a/packages/animate/lib/api.js +++ b/packages/animate/lib/api.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).animate={})}(this,(function(t){"use strict";const e=t=>[].concat(...t),i=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,s=(t,e)=>{let i,s,n=Object.keys(t),a={};for(let r=0,o=n.length;r""+t,a=t=>{let e=parseFloat(t);return n(t).replace(n(e),"")},r=t=>n(t).trim(),o=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],l=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),u=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,h=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),c=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},m=(t,e)=>{let i=[...t],s={};for(let t of i)l(e[t])&&(s[t]=e[t]);return s},p=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=o(t),s=i.length;return s>e&&(e=s),i}))).length;for(let n=0;n"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,d=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let n=0;nt.offset-e.offset))};class g{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const y=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,b=y(),E=y("px"),S=y("deg"),O=t=>e=>l(e)?o(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],A=(t,e)=>o(t).map(O(e)),k=O(b),w=O(E),D=O(S),x=new g,I=(t="transparent")=>{if(t=t.trim(),x.has(t))return x.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),n=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return x.set(t,n),n},C={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},P="registerProperty"in CSS,M=Object.keys(C),T=(t={})=>Object.keys(t).filter((t=>M.includes(t))).map((t=>{if(!P)return"";let e=[].concat(C[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),v=(t={})=>{let e={};return M.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>l(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let n=[].concat(C[i]),a=s.every((t=>Array.isArray(t))),r=1==s.length&&"scale"==i;n.forEach(((t,i)=>{let n=r?0:i,o=a?p(...s)[n]:s;if(l(o)){let i=t;/translate|perspective/i.test(i)?o=w(o):/rotate3d3|skew/i.test(i)?o=D(o):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(o=D(o)),e[t]=o}}))})),e},N=.1,F="function"==typeof Float32Array,j=(t,e)=>1-3*e+3*t,z=(t,e)=>3*e-6*t,R=t=>3*t,q=(t,e,i)=>((j(e,i)*t+z(e,i))*t+R(e))*t,L=(t,e,i)=>3*j(e,i)*t*t+2*z(e,i)*t+R(e),_=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var n=F?new Float32Array(11):new Array(11),a=0;a<11;++a)n[a]=q(a*N,t,i);const r=e=>{let s=0,a=1;for(;10!==a&&n[a]<=e;++a)s+=N;--a;let r=s+(e-n[a])/(n[a+1]-n[a])*N,o=L(r,t,i);return o>=.001?((t,e,i,s)=>{for(var n=0;n<4;++n){let n=L(e,i,s);if(0===n)return e;e-=(q(e,i,s)-t)/n}return e})(e,r,t,i):0===o?r:((t,e,i,s,n)=>{let a,r,o=0;do{r=e+(i-e)/2,a=q(r,s,n)-t,a>0?i=r:e=r}while(Math.abs(a)>1e-7&&++o<10);return r})(e,s,s+N,t,i)};return t=>0===t||1===t?t:q(r(t),e,s)},V=(t,e,i)=>Math.min(Math.max(t,e),i),K=t=>Math.pow(t,2),U=t=>Math.pow(t,3),X=t=>Math.pow(t,4),Y=t=>Math.pow(t,5),G=t=>Math.pow(t,6),Z=t=>1-Math.cos(t*Math.PI/2),$=t=>1-Math.sqrt(1-t*t),B=t=>t*t*(3*t-2),W=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},H=(t,e=[])=>{let[i=1,s=.5]=e;const n=V(i,1,10),a=V(s,.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/a)},Q=(t,e=[],i)=>{let[s=1,n=100,a=10,r=0]=e;s=V(s,.1,1e3),n=V(n,.1,1e3),a=V(a,.1,1e3),r=V(r,.1,1e3);const o=Math.sqrt(n/s),l=a/(2*Math.sqrt(n*s)),u=l<1?o*Math.sqrt(1-l*l):0,h=l<1?(l*o-r)/u:-r+o;let c=i?i*t/1e3:t;return c=l<1?Math.exp(-c*l*o)*(1*Math.cos(u*c)+h*Math.sin(u*c)):(1+h*c)*Math.exp(-c*o),0===t||1===t?t:1-c},J=new Map,tt=(t="spring")=>{if(J.has(t))return J.get(t);const e="function"==typeof t?t:ut(t),i="function"==typeof t?[]:ht(t),s=1/6;let n=0,a=0,r=0;for(;++r<1e4;)if(n+=s,1===e(n,i,null)){if(a++,a>=16)break}else a=0;const o=n*s*1e3;return J.set(t,o),o},et=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(V(t,0,1)*i)/i},it=(t,e=[])=>{let[i,s,n,a]=e;return _(i,s,n,a)(t)},st=_(.42,0,1,1),nt=t=>(e,i=[],s)=>1-t(1-e,i,s),at=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,rt=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,ot={steps:et,"step-start":t=>et(t,[1,"start"]),"step-end":t=>et(t,[1,"end"]),linear:t=>t,"cubic-bezier":it,ease:t=>it(t,[.25,.1,.25,1]),in:st,out:nt(st),"in-out":at(st),"out-in":rt(st),"in-quad":K,"out-quad":nt(K),"in-out-quad":at(K),"out-in-quad":rt(K),"in-cubic":U,"out-cubic":nt(U),"in-out-cubic":at(U),"out-in-cubic":rt(U),"in-quart":X,"out-quart":nt(X),"in-out-quart":at(X),"out-in-quart":rt(X),"in-quint":Y,"out-quint":nt(Y),"in-out-quint":at(Y),"out-in-quint":rt(Y),"in-expo":G,"out-expo":nt(G),"in-out-expo":at(G),"out-in-expo":rt(G),"in-sine":Z,"out-sine":nt(Z),"in-out-sine":at(Z),"out-in-sine":rt(Z),"in-circ":$,"out-circ":nt($),"in-out-circ":at($),"out-in-circ":rt($),"in-back":B,"out-back":nt(B),"in-out-back":at(B),"out-in-back":rt(B),"in-bounce":W,"out-bounce":nt(W),"in-out-bounce":at(W),"out-in-bounce":rt(W),"in-elastic":H,"out-elastic":nt(H),"in-out-elastic":at(H),"out-in-elastic":rt(H),spring:Q,"spring-in":Q,"spring-out":nt(Q),"spring-in-out":at(Q),"spring-out-in":rt(Q)};t.EasingFunctionKeys=Object.keys(ot);const lt=t=>u(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),ut=e=>{let i=lt(n(e));return t.EasingFunctionKeys.includes(i)?ot[i]:null},ht=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(n(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},ct=(t,e,i)=>e+(i-e)*t,mt=(t,e)=>Math.round(t*10**e)/10**e,pt=(t,e,i=3)=>{let s=e.length-1,n=V(Math.floor(t*s),0,s-1),a=e[n],r=e[n+1];return mt(ct((t-n/s)*s,a,r),i)},ft=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},dt=(t,e)=>{t=V(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},gt=(t,e,i=3)=>{let s="";return ft(e[0])&&(s=a(e[0])),pt(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},yt=(t,e,i=3)=>p(...e.map((t=>I(t)))).map(((e,s)=>{let n=pt(t,e);return s<3?Math.round(n):mt(n,i)})),bt=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(l),Et=(t,e,i=3)=>e.every((t=>"number"==typeof t))?pt(t,e,i):e.every((t=>CSS.supports("color",n(t))))?`rgba(${yt(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?p(...e.map(bt)).map((e=>Et(t,e,i))).join(" "):e.every((t=>ft(t)))?gt(t,e,i):dt(t,e):void 0,St=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:n=3,duration:a}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:n,duration:a}},Ot=new Map,At=({easing:t,numPoints:e,duration:i}={})=>{const s=[],n=`${t}${e}`;if(Ot.has(n))return Ot.get(n);const a="function"==typeof t?t:ut(t),r="function"==typeof t?[]:ht(t);for(let t=0;t{if("string"==typeof t.easing){let e=lt(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=tt(t.easing))}},wt=(t,e={})=>{let i=St(e);return kt(i),At(i).map((e=>Et(e,t,i.decimal)))},Dt=(t={})=>{let{easing:e,numPoints:i,decimal:n,duration:a,...r}=t,o={easing:e,numPoints:i,decimal:n,duration:a};kt(o);let u=s(r,(t=>wt(t,o))),h={};return l(a)?h={duration:a}:l(o.duration)&&(h={duration:o.duration}),Object.assign({},u,h)},xt={translate:t=>A(t,E),translate3d:t=>A(t,E),translateX:t=>w(t),translateY:t=>w(t),translateZ:t=>w(t),rotate:t=>A(t,S),rotate3d:t=>A(t,b),rotateX:t=>D(t),rotateY:t=>D(t),rotateZ:t=>D(t),scale:t=>A(t,b),scale3d:t=>A(t,b),scaleX:t=>k(t),scaleY:t=>k(t),scaleZ:t=>k(t),skew:t=>A(t,S),skewX:t=>D(t),skewY:t=>D(t),perspective:t=>w(t)},It=Object.keys(xt),Ct=t=>{let e,i,s=Object.keys(t),n={};for(let a=0,r=s.length;a{let i="",s=t.length;for(let n=0;n(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?p(...Tt(p(...t),e)):i!==e?Array.from(Array(e),((s,n)=>{let a=1==i?Array(2).fill(t[0]):t;return gt(n/(e-1),a)})):t}))),vt=t=>{let e,i,a=Ct(t);if(P)e=Object.assign({},v(a),c(M,a));else{let t=Object.keys(a).filter((t=>It.includes(t))),s=t.map((t=>xt[t](a[t])));s=Tt(s),i=p(...s).filter(l).map((e=>Pt(t,e))),e=c(It,a)}return e=s(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Mt,"i").test(e)||CSS.supports(u(e),"1px");if(s||n)return s?i=D:n&&(i=w),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(n)})),Object.assign({},l(i)?{transform:i}:null,e)},Nt=t=>t.map((t=>{let e=Ct(t);if(P)return{rest:Object.assign({},v(e),c(M,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:n,translateY:a,translateZ:r,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:m,scale:p,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:E,skewY:S,perspective:O,...A}=e;return i=w(i),s=w(s),n=w(n)[0],a=w(a)[0],r=w(r)[0],o=D(o),l=k(l),u=D(u)[0],h=D(h)[0],m=D(m)[0],p=k(p),f=k(f),d=k(d)[0],g=k(g)[0],y=k(y)[0],b=D(b),E=D(E)[0],S=D(S)[0],O=w(O)[0],{rest:A,transformFunctions:[s,i,n,a,r,l,o,u,h,m,f,p,d,g,y,b,E,S,O]}})).map((({rest:t,transformFunctions:e})=>{let i=P?null:Pt(It,e);return t=s(t,((t,e)=>{let i;if(t=n(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Mt,"i").test(e);if(s||n)return s?i=D:n&&(i=w),i(t).join(" ")}return t})),Object.assign({},l(i)?{transform:i}:null,t)})),Ft=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class jt extends g{constructor(t="event"){super(),this.name=t}}const zt=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class Rt extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof jt?e:(this.set(t,new jt(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(Ft({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,a=zt(t),r=a?e:i;return a||(n=e),Object.keys(t).forEach((e=>{s=a?e:t[e],a&&(n=t[e]),this.newListener(s,n,r)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof jt&&e){let n=Ft({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===n.callback&&t.scope===n.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,a=zt(t),r=a?e:i;return a||(n=e),Object.keys(t).forEach((e=>{s=a?e:t[e],a&&(n=t[e]),"function"==typeof n?this.removeListener(s,n,r):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=zt(t);return Object.keys(t).forEach((n=>{let a=s?n:t[n],r=s?t[n]:e,o=s?e:i,l=(...t)=>{r.apply(o,t),this.removeListener(a,l,o)};this.newListener(a,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof jt&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const qt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],Lt=t=>Array.isArray(t)?e(t.map(Lt)):"string"==typeof t||t instanceof Node?qt(t):t instanceof NodeList||t instanceof HTMLCollection?Array.from(t):[],_t=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Vt=(t,e,i)=>s(t,(t=>_t(t,e,i))),Kt={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Ut=Object.keys(Kt),Xt=(t="ease")=>{let e=u(t).replace(/^ease-/,"");return Ut.includes(e)?Kt[e]:t},Yt={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Gt=t=>{let{options:e,...i}=t,s=e instanceof Ht?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Zt=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],$t=["keyframes","padEndDelay","onfinish","oncancel","autoplay","target","targets","timeline"],Bt=[...Zt,...$t],Wt=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new Rt,this.targets=new g,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),Wt.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/Wt.FRAME_RATE,i=t-Wt.FRAME_START_TIME;i>e&&(Wt.FRAME_START_TIME=t-i%e,Wt.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),Wt.RUNNING.size>0?Wt.animationFrame=window.requestAnimationFrame(Wt.requestFrame):Wt.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame(Wt.animationFrame),Wt.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){Wt.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),Wt.RUNNING.add(this),Wt.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:n,endDelay:a,speed:r,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Yt[e];return"function"!=typeof i?i:Yt[e]}));o=Number(o),n=Number(n),i=Number(i),a=Number(a),r=Number(r),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=r,this.maxDuration=i,this.maxEndDelay=a,this.totalDuration=e+o+i*n+a,this.totalDurationOptions={delay:e,duration:i,iterations:n,endDelay:a,speed:r,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((n,a)=>{let r=this.computedOptions.get(n)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??r[i]??this.options[e]??Yt[e]})),l=Vt(o,[a,e,n],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Xt(t))):Xt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:h,endDelay:c,delay:m,duration:p,iterations:f,...d}=l;u=Number(u),f=Number(f),p=Number(p),c=Number(c),h=Number(h),m=Number(m),this.timelineOffset=u??this.timelineOffset,this.minDelay>m&&(this.minDelay=m),this.maxSpeed>h&&(this.maxSpeed=h),this.maxDuration{let p,{speed:g,keyframes:y,tempDurations:b,timelineOffset:E,...S}=n[m];a&&0==S.endDelay&&Math.abs(S.iterations)!=Math.abs(1/0)&&(S.endDelay=this.totalDuration-b);let O,A,k=y;i(k)&&(k=d(k));let w,D,x=this.computedKeyframes.get(t)??{},I="transform"in this.properties?x:c(["transform"],x),M=Object.assign({},r,I),v=s(M,((t,e)=>this.properties[e]??t));if(A=l(k)?k:v,Array.isArray(A))O=A.map((t=>{let{easing:e,offset:i,...s}=c(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Xt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:f(i)}:null)})),p=T(C),O=Nt(O);else{let i=c(["keyframes"],A),{offset:s,...n}=Vt(i,[m,e,t],this);p=T(Ct(n)),n=vt(n);let a=s;O=Object.assign({},n,l(a)?{offset:a.map(f)}:null)}this.keyframeEffects.has(t)?(D=this.keyframeEffects.get(t),w=this.animations.get(D),D?.setKeyframes?.(O),D?.updateTiming?.(S)):(D=new KeyframeEffect(t,O,S),w=new Animation(D,h),this.keyframeEffects.set(t,D),this.animations.set(D,w)),w.updatePlaybackRate?w.updatePlaybackRate(g):w.playbackRate=g,w.onfinish=()=>{"function"==typeof o&&o.call(this,t,m,e,w)},w.oncancel=()=>{"function"==typeof u&&u.call(this,t,m,e,w)},P&&Object.assign(t.style,{transform:p}),this.computedOptions.set(t,S),this.computedKeyframes.set(t,O)}))}updateOptions(t={}){try{let e=Gt(t);this.initialOptions=e,this.options=Object.assign({},Yt,this.options,e);let{padEndDelay:i,autoplay:s,target:n,targets:a,timeline:r,onfinish:o,oncancel:l,...u}=c(Zt,this.options);this.properties=c(Bt,e);let h=this.targets.values(),m=[...new Set([...h,...Lt(a),...Lt(n)])];this.targets.clear(),m.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let p=this.targets.size,f=this.createArrayOfComputedOptions(e,p);if(this.createAnimations({arrOfComputedOptions:f,padEndDelay:i,oldCSSProperties:u,onfinish:o,oncancel:l,timeline:r},p),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("@okikio/animate - `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,r)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),n=this.is("paused");return this.updateOptions(),s?this.play():n&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&(Wt.RUNNING.add(this),null==Wt.animationFrame&&Wt.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let Ht=Wt;Ht.RUNNING=new Set,Ht.FRAME_RATE=60,Ht.FRAME_START_TIME=0,Ht.pauseOnPageHidden=!0;t.UIDCount=0;const Qt=document.createElement("div"),Jt=()=>{l(Qt.id)||(Qt.id="empty-tween-el-container",Qt.style.setProperty("display","none"),Qt.style.setProperty("contain","paint layout size"),document.body.appendChild(Qt));let e=document.createElement("div");return e.id="empty-animate-el-"+t.UIDCount++,e.style.setProperty("display","none"),Qt.appendChild(e),e};class te extends Ht{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const ee=(e={})=>{let{easing:i,decimal:s,numPoints:n,opacity:a,...r}=Gt(e),o=m(Bt,r),l=i;if("string"==typeof i){let e=lt(i);l=Ut.includes(e)||["linear","steps","step-start","step-end"].includes(e)?Xt(i):t.EasingFunctionKeys.includes(e)?ut(i):i}return{..."function"==typeof l?Dt({opacity:[0,1],easing:i,decimal:s,numPoints:n}):{opacity:[0,1],easing:i},...o}};class ie extends te{constructor(){super(...arguments),this.updateListeners=new g}updateOptions(t={}){let e=Gt(t),i=this.targets.size>1?null:{target:Jt()},n=Object.assign({},ee(c(["target","targets"],e)),i);super.updateOptions(n);let a=c(Bt,e);try{this.updateListeners=this.updateListeners??new g,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:i}=e,n=[...new Set([...Lt(i),...Lt(t)])],r=n.length,o=this.targets.get(0),l=window.getComputedStyle(o);n.forEach(((t,i)=>{s(a,((s,n)=>{let a,o=t.getAttribute(n);this.on("update",a=()=>{let a,u=Number(l.getPropertyValue("opacity"));a="function"==typeof s?s(u,i,r,t):Et(u,Array.isArray(s)?s:[o,s],e.decimal),t.setAttribute(n,""+a)}),this.updateListeners.add(a)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const se=(t,e={})=>{const{grid:i,axis:s,from:n=0,easing:r,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,h=parseFloat(l?t[0]:t),c=l?parseFloat(t[u]):0,{start:m=(l?h:0)}=e,p=a(l?t[u]:t)||0,f="function"==typeof r?r:ut(r),d="function"==typeof r?[]:ht(r);let g,y=[],b=0,E=n;return/from/i.test(n)&&(E=0),(t,e)=>{if(/center/i.test(n)&&(E=(e-1)/2),/last/i.test(n)&&(E=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return m+g*(Math.round(100*y[t])/100)+p}},ne=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class ae{constructor(t={}){this.animateInstances=new g,this.initialOptions={},this.mainInstance=new Ht({duration:0}),this.initialOptions=Object.assign({},Yt,Gt(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Gt(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Yt,this.initialOptions,t instanceof Ht?t.initialOptions:Gt(t));return s.timelineOffset=ne(e,this.totalDuration),s.autoplay=this.initialOptions.autoplay,t instanceof Ht?(i=t,i.updateOptions(s)):i=new Ht(s),this.animateInstances.add(i),this.updateTiming(),this}updateTiming(){let t=this.animateInstances.values(),e=Math.max(...t.map((t=>t.totalDuration)));return this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:n}=i.totalDurationOptions,a=Number(s)-Number(n);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Timeline"}}t.ALL_TIMING_KEYS=Bt,t.Animate=Ht,t.AnimateAttributes=ie,t.ApplyCustomEasing=Dt,t.Back=B,t.Bezier=it,t.Bounce=W,t.CSSArrValue=A,t.CSSCamelCase=Ct,t.CSSPXDataType=Mt,t.CSSValue=O,t.CSSVarSupport=P,t.CSS_CACHE=x,t.Circ=$,t.ComplexEasingSyntax=lt,t.ComplexStrtoArr=bt,t.Cubic=U,t.CustomEasing=wt,t.CustomEasingOptions=St,t.DefaultAnimationOptions=Yt,t.DestroyableAnimate=te,t.EASINGS=Kt,t.EFFECTS={},t.EaseInOut=at,t.EaseOut=nt,t.EaseOutIn=rt,t.EasingDurationCache=J,t.EasingFunctions=ot,t.EasingKeys=Ut,t.EasingPts=At,t.Elastic=H,t.EmptyTweenElContainer=Qt,t.Expo=G,t.FUNCTION_SUPPORTED_TIMING_KEYS=Zt,t.GetEase=Xt,t.GetEasingFunction=ut,t.INTINITE_LOOP_LIMIT=1e4,t.KeyframeParse=d,t.NOT_FUNCTION_SUPPORTED_TIMING_KEYS=$t,t.ParseTransformableCSSKeyframes=Nt,t.ParseTransformableCSSProperties=vt,t.Quad=K,t.Quart=X,t.Quint=Y,t.Sine=Z,t.Spring=Q,t.SpringEasing=(t,e={})=>{let i=St(e),{duration:s}=i;return kt(i),[wt(t,i),l(s)?s:i.duration]},t.StaggerCustomEasing=(t,e={})=>{let i=e.stagger??{};return(s,n)=>{let a=t.map(((e,a)=>{let r=t[Math.max(0,a-1)];return se([r,e],i)(s,n)}));return wt(a,e)}},t.Steps=et,t.Timeline=ae,t.TransformFunctionNames=It,t.TransformFunctions=xt,t.TweenCache=Ot,t.UnitDEG=S,t.UnitDEGCSSValue=D,t.UnitLess=b,t.UnitLessCSSValue=k,t.UnitPX=E,t.UnitPXCSSValue=w,t.addCSSUnit=y,t.animate=(t={})=>new Ht(t),t.arrFill=Tt,t.camelCase=h,t.computeOption=_t,t.convertToDash=u,t.createEmptyEl=Jt,t.createTransformProperty=Pt,t.createTransformValue=T,t.createTweenOptions=ee,t.easein=st,t.flatten=e,t.getEasingDuration=tt,t.getElements=qt,t.getTargets=Lt,t.getUnit=a,t.interpolateColor=yt,t.interpolateComplex=Et,t.interpolateNumber=pt,t.interpolateString=gt,t.interpolateUsingIndex=dt,t.isEmpty=t=>{for(let e in t)return!1;return!0},t.isNumberLike=ft,t.isObject=i,t.isValid=l,t.limit=V,t.mapAnimationOptions=Vt,t.mapObject=s,t.omit=c,t.parseEasingParameters=ht,t.parseOffset=f,t.parseOptions=Gt,t.pick=m,t.random=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,t.registerEasingFunction=(e,i)=>{Object.assign(ot,{[e]:i}),t.EasingFunctionKeys=Object.keys(ot)},t.registerEasingFunctions=(...e)=>{Object.assign(ot,...e),t.EasingFunctionKeys=Object.keys(ot)},t.relativeTo=ne,t.scale=ct,t.stagger=se,t.timeline=(t={})=>new ae(t),t.toArr=o,t.toCSSVars=v,t.toFixed=mt,t.toRGBAArr=I,t.toStr=n,t.transformCSSVars=C,t.transformProperyNames=M,t.transpose=p,t.trim=r,t.tweenAttr=(t={})=>new ie(t),Object.defineProperty(t,"__esModule",{value:!0})})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).animate={})}(this,(function(t){"use strict";const e=t=>[].concat(...t),i=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,s=(t,e)=>{let i,s,n=Object.keys(t),a={};for(let r=0,o=n.length;r""+t,a=t=>{let e=parseFloat(t);return n(t).replace(n(e),"")},r=t=>n(t).trim(),o=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],l=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),u=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,h=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),c=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},p=(t,e)=>{let i=[...t],s={};for(let t of i)l(e[t])&&(s[t]=e[t]);return s},m=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=o(t),s=i.length;return s>e&&(e=s),i}))).length;for(let n=0;n"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,d=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let n=0;nt.offset-e.offset))};class g{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const y=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,b=y(),E=y("px"),S=y("deg"),O=t=>e=>l(e)?o(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],A=(t,e)=>o(t).map(O(e)),k=O(b),w=O(E),D=O(S),I=new g,x=(t="transparent")=>{if(t=t.trim(),I.has(t))return I.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),n=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return I.set(t,n),n},P={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},C="registerProperty"in CSS,M=Object.keys(P),T=(t={})=>Object.keys(t).filter((t=>M.includes(t))).map((t=>{if(!C)return"";let e=[].concat(P[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),v=(t={})=>{let e={};return M.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>l(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let n=[].concat(P[i]),a=s.every((t=>Array.isArray(t))),r=1==s.length&&"scale"==i;n.forEach(((t,i)=>{let n=r?0:i,o=a?m(...s)[n]:s;if(l(o)){let i=t;/translate|perspective/i.test(i)?o=w(o):/rotate3d3|skew/i.test(i)?o=D(o):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(o=D(o)),e[t]=o}}))})),e},N=.1,F="function"==typeof Float32Array,j=(t,e)=>1-3*e+3*t,z=(t,e)=>3*e-6*t,q=t=>3*t,R=(t,e,i)=>((j(e,i)*t+z(e,i))*t+q(e))*t,L=(t,e,i)=>3*j(e,i)*t*t+2*z(e,i)*t+q(e),_=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var n=F?new Float32Array(11):new Array(11),a=0;a<11;++a)n[a]=R(a*N,t,i);const r=e=>{let s=0,a=1;for(;10!==a&&n[a]<=e;++a)s+=N;--a;let r=s+(e-n[a])/(n[a+1]-n[a])*N,o=L(r,t,i);return o>=.001?((t,e,i,s)=>{for(var n=0;n<4;++n){let n=L(e,i,s);if(0===n)return e;e-=(R(e,i,s)-t)/n}return e})(e,r,t,i):0===o?r:((t,e,i,s,n)=>{let a,r,o=0;do{r=e+(i-e)/2,a=R(r,s,n)-t,a>0?i=r:e=r}while(Math.abs(a)>1e-7&&++o<10);return r})(e,s,s+N,t,i)};return t=>0===t||1===t?t:R(r(t),e,s)},V=(t,e,i)=>Math.min(Math.max(t,e),i),K=t=>Math.pow(t,2),U=t=>Math.pow(t,3),Y=t=>Math.pow(t,4),X=t=>Math.pow(t,5),G=t=>Math.pow(t,6),Z=t=>1-Math.cos(t*Math.PI/2),$=t=>1-Math.sqrt(1-t*t),Q=t=>t*t*(3*t-2),B=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},W=(t,e=[])=>{let[i=1,s=.5]=e;const n=V(i,1,10),a=V(s,.1,2);return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-a/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/a)},H=(t,e=[],i)=>{let[s=1,n=100,a=10,r=0]=e;s=V(s,.1,1e3),n=V(n,.1,1e3),a=V(a,.1,1e3),r=V(r,.1,1e3);const o=Math.sqrt(n/s),l=a/(2*Math.sqrt(n*s)),u=l<1?o*Math.sqrt(1-l*l):0,h=l<1?(l*o-r)/u:-r+o;let c=i?i*t/1e3:t;return c=l<1?Math.exp(-c*l*o)*(1*Math.cos(u*c)+h*Math.sin(u*c)):(1+h*c)*Math.exp(-c*o),0===t||1===t?t:1-c},J=new Map,tt=(t="spring")=>{if(J.has(t))return J.get(t);const e="function"==typeof t?t:ut(t),i="function"==typeof t?[]:ht(t),s=1/6;let n=0,a=0,r=0;for(;++r<1e4;)if(n+=s,1===e(n,i,null)){if(a++,a>=16)break}else a=0;const o=n*s*1e3;return J.set(t,o),o},et=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(V(t,0,1)*i)/i},it=(t,e=[])=>{let[i,s,n,a]=e;return _(i,s,n,a)(t)},st=_(.42,0,1,1),nt=t=>(e,i=[],s)=>1-t(1-e,i,s),at=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,rt=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,ot={steps:et,"step-start":t=>et(t,[1,"start"]),"step-end":t=>et(t,[1,"end"]),linear:t=>t,"cubic-bezier":it,ease:t=>it(t,[.25,.1,.25,1]),in:st,out:nt(st),"in-out":at(st),"out-in":rt(st),"in-quad":K,"out-quad":nt(K),"in-out-quad":at(K),"out-in-quad":rt(K),"in-cubic":U,"out-cubic":nt(U),"in-out-cubic":at(U),"out-in-cubic":rt(U),"in-quart":Y,"out-quart":nt(Y),"in-out-quart":at(Y),"out-in-quart":rt(Y),"in-quint":X,"out-quint":nt(X),"in-out-quint":at(X),"out-in-quint":rt(X),"in-expo":G,"out-expo":nt(G),"in-out-expo":at(G),"out-in-expo":rt(G),"in-sine":Z,"out-sine":nt(Z),"in-out-sine":at(Z),"out-in-sine":rt(Z),"in-circ":$,"out-circ":nt($),"in-out-circ":at($),"out-in-circ":rt($),"in-back":Q,"out-back":nt(Q),"in-out-back":at(Q),"out-in-back":rt(Q),"in-bounce":B,"out-bounce":nt(B),"in-out-bounce":at(B),"out-in-bounce":rt(B),"in-elastic":W,"out-elastic":nt(W),"in-out-elastic":at(W),"out-in-elastic":rt(W),spring:H,"spring-in":H,"spring-out":nt(H),"spring-in-out":at(H),"spring-out-in":rt(H)};t.EasingFunctionKeys=Object.keys(ot);const lt=t=>u(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),ut=e=>{let i=lt(n(e));return t.EasingFunctionKeys.includes(i)?ot[i]:null},ht=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(n(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},ct=(t,e,i)=>e+(i-e)*t,pt=(t,e)=>Math.round(t*10**e)/10**e,mt=(t,e,i=3)=>{let s=e.length-1,n=V(Math.floor(t*s),0,s-1),a=e[n],r=e[n+1];return pt(ct((t-n/s)*s,a,r),i)},ft=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},dt=(t,e)=>{t=V(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},gt=(t,e,i=3)=>{let s="";return ft(e[0])&&(s=a(e[0])),mt(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},yt=(t,e,i=3)=>m(...e.map((t=>x(t)))).map(((e,s)=>{let n=mt(t,e);return s<3?Math.round(n):pt(n,i)})),bt=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(l),Et=(t,e,i=3)=>e.every((t=>"number"==typeof t))?mt(t,e,i):e.every((t=>CSS.supports("color",n(t))))?`rgba(${yt(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?m(...e.map(bt)).map((e=>Et(t,e,i))).join(" "):e.every((t=>ft(t)))?gt(t,e,i):dt(t,e):void 0,St=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:n=3,duration:a}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:n,duration:a}},Ot=new Map,At=({easing:t,numPoints:e,duration:i}={})=>{const s=[],n=`${t}${e}`;if(Ot.has(n))return Ot.get(n);const a="function"==typeof t?t:ut(t),r="function"==typeof t?[]:ht(t);for(let t=0;t{if("string"==typeof t.easing){let e=lt(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=tt(t.easing))}},wt=(t,e={})=>{let i=St(e);return kt(i),At(i).map((e=>Et(e,t,i.decimal)))},Dt=(t={})=>{let{easing:e,numPoints:i,decimal:n,duration:a,...r}=t,o={easing:e,numPoints:i,decimal:n,duration:a};kt(o);let u=s(r,(t=>wt(t,o))),h={};return l(a)?h={duration:a}:l(o.duration)&&(h={duration:o.duration}),Object.assign({},u,h)},It={translate:t=>A(t,E),translate3d:t=>A(t,E),translateX:t=>w(t),translateY:t=>w(t),translateZ:t=>w(t),rotate:t=>A(t,S),rotate3d:t=>A(t,b),rotateX:t=>D(t),rotateY:t=>D(t),rotateZ:t=>D(t),scale:t=>A(t,b),scale3d:t=>A(t,b),scaleX:t=>k(t),scaleY:t=>k(t),scaleZ:t=>k(t),skew:t=>A(t,S),skewX:t=>D(t),skewY:t=>D(t),perspective:t=>w(t)},xt=Object.keys(It),Pt=t=>{let e,i,s=Object.keys(t),n={};for(let a=0,r=s.length;a{let i="",s=t.length;for(let n=0;n(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?m(...Tt(m(...t),e)):i!==e?Array.from(Array(e),((s,n)=>{let a=1==i?Array(2).fill(t[0]):t;return gt(n/(e-1),a)})):t}))),vt=t=>{let e,i,a=Pt(t);if(C)e=Object.assign({},v(a),c(M,a));else{let t=Object.keys(a).filter((t=>xt.includes(t))),s=t.map((t=>It[t](a[t])));s=Tt(s),i=m(...s).filter(l).map((e=>Ct(t,e))),e=c(xt,a)}return e=s(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Mt,"i").test(e)||CSS.supports(u(e),"1px");if(s||n)return s?i=D:n&&(i=w),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(n)})),Object.assign({},l(i)?{transform:i}:null,e)},Nt=t=>t.map((t=>{let e=Pt(t);if(C)return{rest:Object.assign({},v(e),c(M,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:n,translateY:a,translateZ:r,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:p,scale:m,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:E,skewY:S,perspective:O,...A}=e;return i=w(i),s=w(s),n=w(n)[0],a=w(a)[0],r=w(r)[0],o=D(o),l=k(l),u=D(u)[0],h=D(h)[0],p=D(p)[0],m=k(m),f=k(f),d=k(d)[0],g=k(g)[0],y=k(y)[0],b=D(b),E=D(E)[0],S=D(S)[0],O=w(O)[0],{rest:A,transformFunctions:[s,i,n,a,r,l,o,u,h,p,f,m,d,g,y,b,E,S,O]}})).map((({rest:t,transformFunctions:e})=>{let i=C?null:Ct(xt,e);return t=s(t,((t,e)=>{let i;if(t=n(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),n=new RegExp(Mt,"i").test(e);if(s||n)return s?i=D:n&&(i=w),i(t).join(" ")}return t})),Object.assign({},l(i)?{transform:i}:null,t)})),Ft=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class jt extends g{constructor(t="event"){super(),this.name=t}}const zt=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class qt extends g{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof jt?e:(this.set(t,new jt(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(Ft({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,a=zt(t),r=a?e:i;return a||(n=e),Object.keys(t).forEach((e=>{s=a?e:t[e],a&&(n=t[e]),this.newListener(s,n,r)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof jt&&e){let n=Ft({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===n.callback&&t.scope===n.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,n,a=zt(t),r=a?e:i;return a||(n=e),Object.keys(t).forEach((e=>{s=a?e:t[e],a&&(n=t[e]),"function"==typeof n?this.removeListener(s,n,r):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=zt(t);return Object.keys(t).forEach((n=>{let a=s?n:t[n],r=s?t[n]:e,o=s?e:i,l=(...t)=>{r.apply(o,t),this.removeListener(a,l,o)};this.newListener(a,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof jt&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const Rt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],Lt=t=>Array.isArray(t)?e(t.map(Lt)):"string"==typeof t||t instanceof Node?Rt(t):t instanceof NodeList||t instanceof HTMLCollection?Array.from(t):[],_t=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Vt=(t,e,i)=>s(t,(t=>_t(t,e,i))),Kt={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},Ut=Object.keys(Kt),Yt=(t="ease")=>{let e=u(t).replace(/^ease-/,"");return Ut.includes(e)?Kt[e]:t},Xt={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,persist:!0,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Gt=t=>{let{options:e,...i}=t,s=e instanceof Wt?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Zt=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],$t=["keyframes","padEndDelay","persist","onfinish","oncancel","autoplay","target","targets","timeline"],Qt=[...Zt,...$t],Bt=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new qt,this.targets=new g,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),Bt.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/Bt.FRAME_RATE,i=t-Bt.FRAME_START_TIME;i>e&&(Bt.FRAME_START_TIME=t-i%e,Bt.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),Bt.RUNNING.size>0?Bt.animationFrame=window.requestAnimationFrame(Bt.requestFrame):Bt.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame(Bt.animationFrame),Bt.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){Bt.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),Bt.RUNNING.add(this),Bt.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:n,endDelay:a,speed:r,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Xt[e];return"function"!=typeof i?i:Xt[e]}));o=Number(o),n=Number(n),i=Number(i),a=Number(a),r=Number(r),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=r,this.maxDuration=i,this.maxEndDelay=a,this.totalDuration=e+o+i*n+a,this.totalDurationOptions={delay:e,duration:i,iterations:n,endDelay:a,speed:r,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((n,a)=>{let r=this.computedOptions.get(n)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??r[i]??this.options[e]??Xt[e]})),l=Vt(o,[a,e,n],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Yt(t))):Yt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:h,endDelay:c,delay:p,duration:m,iterations:f,...d}=l;u=Number(u),f=Number(f),m=Number(m),c=Number(c),h=Number(h),p=Number(p)+u,this.timelineOffset=u??this.timelineOffset,this.minDelay>p&&(this.minDelay=p),this.maxSpeed>h&&(this.maxSpeed=h),this.maxDuration{let g,{speed:y,keyframes:b,tempDurations:E,timelineOffset:S,...O}=n[m];a&&0==O.endDelay&&Math.abs(O.iterations)!=Math.abs(1/0)&&(O.endDelay=this.totalDuration-E);let A,k,w=b;i(w)&&(w=d(w));let D,I,x=this.computedKeyframes.get(t)??{},M="transform"in this.properties?x:c(["transform"],x),v=Object.assign({},r,M),N=s(v,((t,e)=>this.properties[e]??t));if(k=l(w)?w:N,Array.isArray(k))A=k.map((t=>{let{easing:e,offset:i,...s}=c(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Yt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:f(i)}:null)})),g=T(P),A=Nt(A),h&&A.length&&s(A[A.length-1],((e,i)=>{t.style.setProperty(i,e)}));else{let i=c(["keyframes"],k),{offset:n,...a}=Vt(i,[m,e,t],this);g=T(Pt(a)),a=vt(a);let r=n;A=Object.assign({},a,l(r)?{offset:r.map(f)}:null),h&&s(a,((e,i)=>{!e.length||t.style.setProperty(i,e[e.length-1])}))}this.keyframeEffects.has(t)?(I=this.keyframeEffects.get(t),D=this.animations.get(I),I?.setKeyframes?.(A),I?.updateTiming?.(O)):(I=new KeyframeEffect(t,A,O),D=new Animation(I,p),this.keyframeEffects.set(t,I),this.animations.set(I,D)),D.updatePlaybackRate?D.updatePlaybackRate(y):D.playbackRate=y,D.onfinish=()=>{"function"==typeof o&&o.call(this,t,m,e,D)},D.oncancel=()=>{"function"==typeof u&&u.call(this,t,m,e,D)},C&&Object.assign(t.style,{transform:g}),this.computedOptions.set(t,O),this.computedKeyframes.set(t,A)}))}updateOptions(t={}){try{let e=Gt(t);this.initialOptions=e,this.options=Object.assign({},Xt,this.options,e);let{padEndDelay:i,autoplay:s,target:n,targets:a,timeline:r,persist:o,onfinish:l,oncancel:u,...h}=c(Zt,this.options);this.properties=c(Qt,e);let p=this.targets.values(),m=[...new Set([...p,...Lt(a),...Lt(n)])];this.targets.clear(),m.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let f=this.targets.size,d=this.createArrayOfComputedOptions(e,f);if(this.createAnimations({arrOfComputedOptions:d,padEndDelay:i,oldCSSProperties:h,onfinish:l,oncancel:u,persist:o,timeline:r},f),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("[Animate - @okikio/animate] `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,r)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),n=this.is("paused");return this.updateOptions(),s?this.play():n&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&(Bt.RUNNING.add(this),null==Bt.animationFrame&&Bt.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let Wt=Bt;Wt.RUNNING=new Set,Wt.FRAME_RATE=60,Wt.FRAME_START_TIME=0,Wt.pauseOnPageHidden=!0;t.UIDCount=0;const Ht=document.createElement("div"),Jt=()=>{l(Ht.id)||(Ht.id="empty-tween-el-container",Ht.style.setProperty("display","none"),Ht.style.setProperty("contain","paint layout size"),document.body.appendChild(Ht));let e=document.createElement("div");return e.id="empty-animate-el-"+t.UIDCount++,e.style.setProperty("display","none"),Ht.appendChild(e),e};class te extends Wt{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const ee=(e={})=>{let{easing:i,decimal:s,numPoints:n,opacity:a,...r}=Gt(e),o=p(Qt,r),l=i;if("string"==typeof i){let e=lt(i);l=Ut.includes(e)||["linear","steps","step-start","step-end"].includes(e)?Yt(i):t.EasingFunctionKeys.includes(e)?ut(i):i}return{..."function"==typeof l?Dt({opacity:[0,1],easing:i,decimal:s,numPoints:n}):{opacity:[0,1],easing:i},...o}};class ie extends te{constructor(){super(...arguments),this.updateListeners=new g}updateOptions(t={}){let e=Gt(t),i=this.targets.size>1?null:{target:Jt()},n=Object.assign({},ee(c(["target","targets"],e)),i);super.updateOptions(n);let a=c(Qt,e);try{this.updateListeners=this.updateListeners??new g,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:i}=e,n=[...new Set([...Lt(i),...Lt(t)])],r=n.length,o=this.targets.get(0),l=window.getComputedStyle(o);n.forEach(((t,i)=>{s(a,((s,n)=>{let a,o=t.getAttribute(n);this.on("update",a=()=>{let a,u=Number(l.getPropertyValue("opacity"));a="function"==typeof s?s(u,i,r,t):Et(u,Array.isArray(s)?s:[o,s],e.decimal),t.setAttribute(n,""+a)}),this.updateListeners.add(a)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const se=(t,e={})=>{const{grid:i,axis:s,from:n=0,easing:r,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,h=parseFloat(l?t[0]:t),c=l?parseFloat(t[u]):0,{start:p=(l?h:0)}=e,m=a(l?t[u]:t)||0,f="function"==typeof r?r:ut(r),d="function"==typeof r?[]:ht(r);let g,y=[],b=0,E=n;return/from/i.test(n)&&(E=0),(t,e)=>{if(/center/i.test(n)&&(E=(e-1)/2),/last/i.test(n)&&(E=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return p+g*(Math.round(100*y[t])/100)+m}},ne=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class ae{constructor(t={}){this.animateInstances=new g,this.initialOptions={},this.mainInstance=new Wt({duration:0}),this.initialOptions=Object.assign({},Xt,Gt(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Gt(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Xt,this.initialOptions,t instanceof Wt?t.initialOptions:Gt(t));if(Math.abs(this.totalDuration)!==1/0)if(/\t.totalDuration)));return Math.abs(e)==1/0?(console.warn('[Queue - @okikio/animate] individual Animate instances that are part of a Queue can\'t have Infinite totalDuration. You can\'t queue animations one after the other if one of the animations last for literally infinity. This issue may come from setting the "loop, duration, endDelay, delay, etc..." animation options to either Infinity (or for the loop option only, "true").'),this):(this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this)}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:n}=i.totalDurationOptions,a=Number(s)-Number(n);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Queue"}}t.ALL_TIMING_KEYS=Qt,t.Animate=Wt,t.AnimateAttributes=ie,t.ApplyCustomEasing=Dt,t.Back=Q,t.Bezier=it,t.Bounce=B,t.CSSArrValue=A,t.CSSCamelCase=Pt,t.CSSPXDataType=Mt,t.CSSValue=O,t.CSSVarSupport=C,t.CSS_CACHE=I,t.Circ=$,t.ComplexEasingSyntax=lt,t.ComplexStrtoArr=bt,t.Cubic=U,t.CustomEasing=wt,t.CustomEasingOptions=St,t.DefaultAnimationOptions=Xt,t.DestroyableAnimate=te,t.EASINGS=Kt,t.EFFECTS={},t.EaseInOut=at,t.EaseOut=nt,t.EaseOutIn=rt,t.EasingDurationCache=J,t.EasingFunctions=ot,t.EasingKeys=Ut,t.EasingPts=At,t.Elastic=W,t.EmptyTweenElContainer=Ht,t.Expo=G,t.FUNCTION_SUPPORTED_TIMING_KEYS=Zt,t.GetEase=Yt,t.GetEasingFunction=ut,t.INTINITE_LOOP_LIMIT=1e4,t.KeyframeParse=d,t.NOT_FUNCTION_SUPPORTED_TIMING_KEYS=$t,t.ParseTransformableCSSKeyframes=Nt,t.ParseTransformableCSSProperties=vt,t.Quad=K,t.Quart=Y,t.Queue=ae,t.Quint=X,t.Sine=Z,t.Spring=H,t.SpringEasing=(t,e={})=>{let i=St(e),{duration:s}=i;return kt(i),[wt(t,i),l(s)?s:i.duration]},t.StaggerCustomEasing=(t,e={})=>{let i=e.stagger??{};return(s,n)=>{let a=t.map(((e,a)=>{let r=t[Math.max(0,a-1)];return se([r,e],i)(s,n)}));return wt(a,e)}},t.Steps=et,t.TransformFunctionNames=xt,t.TransformFunctions=It,t.TweenCache=Ot,t.UnitDEG=S,t.UnitDEGCSSValue=D,t.UnitLess=b,t.UnitLessCSSValue=k,t.UnitPX=E,t.UnitPXCSSValue=w,t.addCSSUnit=y,t.animate=(t={})=>new Wt(t),t.arrFill=Tt,t.camelCase=h,t.computeOption=_t,t.convertToDash=u,t.createEmptyEl=Jt,t.createTransformProperty=Ct,t.createTransformValue=T,t.createTweenOptions=ee,t.easein=st,t.flatten=e,t.getEasingDuration=tt,t.getElements=Rt,t.getTargets=Lt,t.getUnit=a,t.interpolateColor=yt,t.interpolateComplex=Et,t.interpolateNumber=mt,t.interpolateString=gt,t.interpolateUsingIndex=dt,t.isEmpty=t=>{for(let e in t)return!1;return!0},t.isNumberLike=ft,t.isObject=i,t.isValid=l,t.limit=V,t.mapAnimationOptions=Vt,t.mapObject=s,t.omit=c,t.parseEasingParameters=ht,t.parseOffset=f,t.parseOptions=Gt,t.pick=p,t.queue=(t={})=>new ae(t),t.random=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,t.registerEasingFunction=(e,i)=>{Object.assign(ot,{[e]:i}),t.EasingFunctionKeys=Object.keys(ot)},t.registerEasingFunctions=(...e)=>{Object.assign(ot,...e),t.EasingFunctionKeys=Object.keys(ot)},t.relativeTo=ne,t.scale=ct,t.stagger=se,t.toArr=o,t.toCSSVars=v,t.toFixed=pt,t.toRGBAArr=x,t.toStr=n,t.transformCSSVars=P,t.transformProperyNames=M,t.transpose=m,t.trim=r,t.tweenAttr=(t={})=>new ie(t),Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/animate/lib/api.mjs b/packages/animate/lib/api.mjs index 5c7006f..8adf7e2 100644 --- a/packages/animate/lib/api.mjs +++ b/packages/animate/lib/api.mjs @@ -1 +1 @@ -const t=t=>[].concat(...t),e=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,i=t=>{for(let e in t)return!1;return!0},s=(t,e)=>{let i,s,a=Object.keys(t),n={};for(let r=0,o=a.length;r""+t,n=t=>{let e=parseFloat(t);return a(t).replace(a(e),"")},r=t=>a(t).trim(),o=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],l=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),u=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,h=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),c=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},m=(t,e)=>{let i=[...t],s={};for(let t of i)l(e[t])&&(s[t]=e[t]);return s},p=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=o(t),s=i.length;return s>e&&(e=s),i}))).length;for(let a=0;a"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,d=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let a=0;at.offset-e.offset))},g={};class y{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const b=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,E=b(),S=b("px"),O=b("deg"),A=t=>e=>l(e)?o(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],k=(t,e)=>o(t).map(A(e)),w=A(E),D=A(S),x=A(O),I=new y,C=(t="transparent")=>{if(t=t.trim(),I.has(t))return I.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),a=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return I.set(t,a),a},P={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},M="registerProperty"in CSS,T=Object.keys(P),v=(t={})=>Object.keys(t).filter((t=>T.includes(t))).map((t=>{if(!M)return"";let e=[].concat(P[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),N=(t={})=>{let e={};return T.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>l(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let a=[].concat(P[i]),n=s.every((t=>Array.isArray(t))),r=1==s.length&&"scale"==i;a.forEach(((t,i)=>{let a=r?0:i,o=n?p(...s)[a]:s;if(l(o)){let i=t;/translate|perspective/i.test(i)?o=D(o):/rotate3d3|skew/i.test(i)?o=x(o):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(o=x(o)),e[t]=o}}))})),e},F="function"==typeof Float32Array,j=(t,e)=>1-3*e+3*t,z=(t,e)=>3*e-6*t,R=t=>3*t,q=(t,e,i)=>((j(e,i)*t+z(e,i))*t+R(e))*t,L=(t,e,i)=>3*j(e,i)*t*t+2*z(e,i)*t+R(e),_=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var a=F?new Float32Array(11):new Array(11),n=0;n<11;++n)a[n]=q(.1*n,t,i);const r=e=>{let s=0,n=1;for(;10!==n&&a[n]<=e;++n)s+=.1;--n;let r=s+.1*((e-a[n])/(a[n+1]-a[n])),o=L(r,t,i);return o>=.001?((t,e,i,s)=>{for(var a=0;a<4;++a){let a=L(e,i,s);if(0===a)return e;e-=(q(e,i,s)-t)/a}return e})(e,r,t,i):0===o?r:((t,e,i,s,a)=>{let n,r,o=0;do{r=e+(i-e)/2,n=q(r,s,a)-t,n>0?i=r:e=r}while(Math.abs(n)>1e-7&&++o<10);return r})(e,s,s+.1,t,i)};return t=>0===t||1===t?t:q(r(t),e,s)},V=(t,e,i)=>Math.min(Math.max(t,e),i),U=t=>Math.pow(t,2),X=t=>Math.pow(t,3),Y=t=>Math.pow(t,4),K=t=>Math.pow(t,5),G=t=>Math.pow(t,6),Z=t=>1-Math.cos(t*Math.PI/2),$=t=>1-Math.sqrt(1-t*t),B=t=>t*t*(3*t-2),W=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},H=(t,e=[])=>{let[i=1,s=.5]=e;const a=V(i,1,10),n=V(s,.1,2);return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/n)},Q=(t,e=[],i)=>{let[s=1,a=100,n=10,r=0]=e;s=V(s,.1,1e3),a=V(a,.1,1e3),n=V(n,.1,1e3),r=V(r,.1,1e3);const o=Math.sqrt(a/s),l=n/(2*Math.sqrt(a*s)),u=l<1?o*Math.sqrt(1-l*l):0,h=l<1?(l*o-r)/u:-r+o;let c=i?i*t/1e3:t;return c=l<1?Math.exp(-c*l*o)*(1*Math.cos(u*c)+h*Math.sin(u*c)):(1+h*c)*Math.exp(-c*o),0===t||1===t?t:1-c},J=new Map,tt=1e4,et=(t="spring")=>{if(J.has(t))return J.get(t);const e="function"==typeof t?t:pt(t),i="function"==typeof t?[]:ft(t),s=1/6;let a=0,n=0,r=0;for(;++r<1e4;)if(a+=s,1===e(a,i,null)){if(n++,n>=16)break}else n=0;const o=a*s*1e3;return J.set(t,o),o},it=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(V(t,0,1)*i)/i},st=(t,e=[])=>{let[i,s,a,n]=e;return _(i,s,a,n)(t)},at=_(.42,0,1,1),nt=t=>(e,i=[],s)=>1-t(1-e,i,s),rt=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,ot=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,lt={steps:it,"step-start":t=>it(t,[1,"start"]),"step-end":t=>it(t,[1,"end"]),linear:t=>t,"cubic-bezier":st,ease:t=>st(t,[.25,.1,.25,1]),in:at,out:nt(at),"in-out":rt(at),"out-in":ot(at),"in-quad":U,"out-quad":nt(U),"in-out-quad":rt(U),"out-in-quad":ot(U),"in-cubic":X,"out-cubic":nt(X),"in-out-cubic":rt(X),"out-in-cubic":ot(X),"in-quart":Y,"out-quart":nt(Y),"in-out-quart":rt(Y),"out-in-quart":ot(Y),"in-quint":K,"out-quint":nt(K),"in-out-quint":rt(K),"out-in-quint":ot(K),"in-expo":G,"out-expo":nt(G),"in-out-expo":rt(G),"out-in-expo":ot(G),"in-sine":Z,"out-sine":nt(Z),"in-out-sine":rt(Z),"out-in-sine":ot(Z),"in-circ":$,"out-circ":nt($),"in-out-circ":rt($),"out-in-circ":ot($),"in-back":B,"out-back":nt(B),"in-out-back":rt(B),"out-in-back":ot(B),"in-bounce":W,"out-bounce":nt(W),"in-out-bounce":rt(W),"out-in-bounce":ot(W),"in-elastic":H,"out-elastic":nt(H),"in-out-elastic":rt(H),"out-in-elastic":ot(H),spring:Q,"spring-in":Q,"spring-out":nt(Q),"spring-in-out":rt(Q),"spring-out-in":ot(Q)};let ut=Object.keys(lt);const ht=(t,e)=>{Object.assign(lt,{[t]:e}),ut=Object.keys(lt)},ct=(...t)=>{Object.assign(lt,...t),ut=Object.keys(lt)},mt=t=>u(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),pt=t=>{let e=mt(a(t));return ut.includes(e)?lt[e]:null},ft=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(a(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},dt=(t,e,i)=>e+(i-e)*t,gt=(t,e)=>Math.round(t*10**e)/10**e,yt=(t,e,i=3)=>{let s=e.length-1,a=V(Math.floor(t*s),0,s-1),n=e[a],r=e[a+1];return gt(dt((t-a/s)*s,n,r),i)},bt=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},Et=(t,e)=>{t=V(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},St=(t,e,i=3)=>{let s="";return bt(e[0])&&(s=n(e[0])),yt(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},Ot=(t,e,i=3)=>p(...e.map((t=>C(t)))).map(((e,s)=>{let a=yt(t,e);return s<3?Math.round(a):gt(a,i)})),At=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(l),kt=(t,e,i=3)=>e.every((t=>"number"==typeof t))?yt(t,e,i):e.every((t=>CSS.supports("color",a(t))))?`rgba(${Ot(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?p(...e.map(At)).map((e=>kt(t,e,i))).join(" "):e.every((t=>bt(t)))?St(t,e,i):Et(t,e):void 0,wt=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:a=3,duration:n}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:a,duration:n}},Dt=new Map,xt=({easing:t,numPoints:e,duration:i}={})=>{const s=[],a=`${t}${e}`;if(Dt.has(a))return Dt.get(a);const n="function"==typeof t?t:pt(t),r="function"==typeof t?[]:ft(t);for(let t=0;t{if("string"==typeof t.easing){let e=mt(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=et(t.easing))}},Ct=(t,e={})=>{let i=wt(e);return It(i),xt(i).map((e=>kt(e,t,i.decimal)))},Pt=(t,e={})=>{let i=wt(e),{duration:s}=i;return It(i),[Ct(t,i),l(s)?s:i.duration]},Mt=(t={})=>{let{easing:e,numPoints:i,decimal:a,duration:n,...r}=t,o={easing:e,numPoints:i,decimal:a,duration:n};It(o);let u=s(r,(t=>Ct(t,o))),h={};return l(n)?h={duration:n}:l(o.duration)&&(h={duration:o.duration}),Object.assign({},u,h)},Tt={translate:t=>k(t,S),translate3d:t=>k(t,S),translateX:t=>D(t),translateY:t=>D(t),translateZ:t=>D(t),rotate:t=>k(t,O),rotate3d:t=>k(t,E),rotateX:t=>x(t),rotateY:t=>x(t),rotateZ:t=>x(t),scale:t=>k(t,E),scale3d:t=>k(t,E),scaleX:t=>w(t),scaleY:t=>w(t),scaleZ:t=>w(t),skew:t=>k(t,O),skewX:t=>x(t),skewY:t=>x(t),perspective:t=>D(t)},vt=Object.keys(Tt),Nt=t=>{let e,i,s=Object.keys(t),a={};for(let n=0,r=s.length;n{let i="",s=t.length;for(let a=0;a(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?p(...zt(p(...t),e)):i!==e?Array.from(Array(e),((s,a)=>{let n=1==i?Array(2).fill(t[0]):t;return St(a/(e-1),n)})):t}))),Rt=t=>{let e,i,n=Nt(t);if(M)e=Object.assign({},N(n),c(T,n));else{let t=Object.keys(n).filter((t=>vt.includes(t))),s=t.map((t=>Tt[t](n[t])));s=zt(s),i=p(...s).filter(l).map((e=>Ft(t,e))),e=c(vt,n)}return e=s(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),a=new RegExp(jt,"i").test(e)||CSS.supports(u(e),"1px");if(s||a)return s?i=x:a&&(i=D),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(a)})),Object.assign({},l(i)?{transform:i}:null,e)},qt=t=>t.map((t=>{let e=Nt(t);if(M)return{rest:Object.assign({},N(e),c(T,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:a,translateY:n,translateZ:r,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:m,scale:p,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:E,skewY:S,perspective:O,...A}=e;return i=D(i),s=D(s),a=D(a)[0],n=D(n)[0],r=D(r)[0],o=x(o),l=w(l),u=x(u)[0],h=x(h)[0],m=x(m)[0],p=w(p),f=w(f),d=w(d)[0],g=w(g)[0],y=w(y)[0],b=x(b),E=x(E)[0],S=x(S)[0],O=D(O)[0],{rest:A,transformFunctions:[s,i,a,n,r,l,o,u,h,m,f,p,d,g,y,b,E,S,O]}})).map((({rest:t,transformFunctions:e})=>{let i=M?null:Ft(vt,e);return t=s(t,((t,e)=>{let i;if(t=a(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),a=new RegExp(jt,"i").test(e);if(s||a)return s?i=x:a&&(i=D),i(t).join(" ")}return t})),Object.assign({},l(i)?{transform:i}:null,t)})),Lt=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class _t extends y{constructor(t="event"){super(),this.name=t}}const Vt=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class Ut extends y{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof _t?e:(this.set(t,new _t(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(Lt({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,a,n=Vt(t),r=n?e:i;return n||(a=e),Object.keys(t).forEach((e=>{s=n?e:t[e],n&&(a=t[e]),this.newListener(s,a,r)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof _t&&e){let a=Lt({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===a.callback&&t.scope===a.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,a,n=Vt(t),r=n?e:i;return n||(a=e),Object.keys(t).forEach((e=>{s=n?e:t[e],n&&(a=t[e]),"function"==typeof a?this.removeListener(s,a,r):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=Vt(t);return Object.keys(t).forEach((a=>{let n=s?a:t[a],r=s?t[a]:e,o=s?e:i,l=(...t)=>{r.apply(o,t),this.removeListener(n,l,o)};this.newListener(n,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof _t&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const Xt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],Yt=e=>Array.isArray(e)?t(e.map(Yt)):"string"==typeof e||e instanceof Node?Xt(e):e instanceof NodeList||e instanceof HTMLCollection?Array.from(e):[],Kt=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Gt=(t,e,i)=>s(t,(t=>Kt(t,e,i))),Zt={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},$t=Object.keys(Zt),Bt=(t="ease")=>{let e=u(t).replace(/^ease-/,"");return $t.includes(e)?Zt[e]:t},Wt={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Ht=t=>{let{options:e,...i}=t,s=e instanceof ie?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Qt=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],Jt=["keyframes","padEndDelay","onfinish","oncancel","autoplay","target","targets","timeline"],te=[...Qt,...Jt],ee=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new Ut,this.targets=new y,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),ee.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/ee.FRAME_RATE,i=t-ee.FRAME_START_TIME;i>e&&(ee.FRAME_START_TIME=t-i%e,ee.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),ee.RUNNING.size>0?ee.animationFrame=window.requestAnimationFrame(ee.requestFrame):ee.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame(ee.animationFrame),ee.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){ee.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),ee.RUNNING.add(this),ee.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:a,endDelay:n,speed:r,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Wt[e];return"function"!=typeof i?i:Wt[e]}));o=Number(o),a=Number(a),i=Number(i),n=Number(n),r=Number(r),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=r,this.maxDuration=i,this.maxEndDelay=n,this.totalDuration=e+o+i*a+n,this.totalDurationOptions={delay:e,duration:i,iterations:a,endDelay:n,speed:r,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((a,n)=>{let r=this.computedOptions.get(a)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??r[i]??this.options[e]??Wt[e]})),l=Gt(o,[n,e,a],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Bt(t))):Bt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:h,endDelay:c,delay:m,duration:p,iterations:f,...d}=l;u=Number(u),f=Number(f),p=Number(p),c=Number(c),h=Number(h),m=Number(m),this.timelineOffset=u??this.timelineOffset,this.minDelay>m&&(this.minDelay=m),this.maxSpeed>h&&(this.maxSpeed=h),this.maxDuration{let p,{speed:g,keyframes:y,tempDurations:b,timelineOffset:E,...S}=a[m];n&&0==S.endDelay&&Math.abs(S.iterations)!=Math.abs(1/0)&&(S.endDelay=this.totalDuration-b);let O,A,k=y;e(k)&&(k=d(k));let w,D,x=this.computedKeyframes.get(t)??{},I="transform"in this.properties?x:c(["transform"],x),C=Object.assign({},r,I),T=s(C,((t,e)=>this.properties[e]??t));if(A=l(k)?k:T,Array.isArray(A))O=A.map((t=>{let{easing:e,offset:i,...s}=c(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Bt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:f(i)}:null)})),p=v(P),O=qt(O);else{let e=c(["keyframes"],A),{offset:s,...a}=Gt(e,[m,i,t],this);p=v(Nt(a)),a=Rt(a);let n=s;O=Object.assign({},a,l(n)?{offset:n.map(f)}:null)}this.keyframeEffects.has(t)?(D=this.keyframeEffects.get(t),w=this.animations.get(D),D?.setKeyframes?.(O),D?.updateTiming?.(S)):(D=new KeyframeEffect(t,O,S),w=new Animation(D,h),this.keyframeEffects.set(t,D),this.animations.set(D,w)),w.updatePlaybackRate?w.updatePlaybackRate(g):w.playbackRate=g,w.onfinish=()=>{"function"==typeof o&&o.call(this,t,m,i,w)},w.oncancel=()=>{"function"==typeof u&&u.call(this,t,m,i,w)},M&&Object.assign(t.style,{transform:p}),this.computedOptions.set(t,S),this.computedKeyframes.set(t,O)}))}updateOptions(t={}){try{let e=Ht(t);this.initialOptions=e,this.options=Object.assign({},Wt,this.options,e);let{padEndDelay:i,autoplay:s,target:a,targets:n,timeline:r,onfinish:o,oncancel:l,...u}=c(Qt,this.options);this.properties=c(te,e);let h=this.targets.values(),m=[...new Set([...h,...Yt(n),...Yt(a)])];this.targets.clear(),m.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let p=this.targets.size,f=this.createArrayOfComputedOptions(e,p);if(this.createAnimations({arrOfComputedOptions:f,padEndDelay:i,oldCSSProperties:u,onfinish:o,oncancel:l,timeline:r},p),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("@okikio/animate - `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,r)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),a=this.is("paused");return this.updateOptions(),s?this.play():a&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&(ee.RUNNING.add(this),null==ee.animationFrame&&ee.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let ie=ee;ie.RUNNING=new Set,ie.FRAME_RATE=60,ie.FRAME_START_TIME=0,ie.pauseOnPageHidden=!0;const se=(t={})=>new ie(t);let ae=0;const ne=document.createElement("div"),re=()=>{l(ne.id)||(ne.id="empty-tween-el-container",ne.style.setProperty("display","none"),ne.style.setProperty("contain","paint layout size"),document.body.appendChild(ne));let t=document.createElement("div");return t.id="empty-animate-el-"+ae++,t.style.setProperty("display","none"),ne.appendChild(t),t};class oe extends ie{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const le=(t={})=>{let{easing:e,decimal:i,numPoints:s,opacity:a,...n}=Ht(t),r=m(te,n),o=e;if("string"==typeof e){let t=mt(e);o=$t.includes(t)||["linear","steps","step-start","step-end"].includes(t)?Bt(e):ut.includes(t)?pt(e):e}return{..."function"==typeof o?Mt({opacity:[0,1],easing:e,decimal:i,numPoints:s}):{opacity:[0,1],easing:e},...r}};class ue extends oe{constructor(){super(...arguments),this.updateListeners=new y}updateOptions(t={}){let e=Ht(t),i=this.targets.size>1?null:{target:re()},a=Object.assign({},le(c(["target","targets"],e)),i);super.updateOptions(a);let n=c(te,e);try{this.updateListeners=this.updateListeners??new y,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:i}=e,a=[...new Set([...Yt(i),...Yt(t)])],r=a.length,o=this.targets.get(0),l=window.getComputedStyle(o);a.forEach(((t,i)=>{s(n,((s,a)=>{let n,o=t.getAttribute(a);this.on("update",n=()=>{let n,u=Number(l.getPropertyValue("opacity"));n="function"==typeof s?s(u,i,r,t):kt(u,Array.isArray(s)?s:[o,s],e.decimal),t.setAttribute(a,""+n)}),this.updateListeners.add(n)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const he=(t={})=>new ue(t),ce=(t,e={})=>{const{grid:i,axis:s,from:a=0,easing:r,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,h=parseFloat(l?t[0]:t),c=l?parseFloat(t[u]):0,{start:m=(l?h:0)}=e,p=n(l?t[u]:t)||0,f="function"==typeof r?r:pt(r),d="function"==typeof r?[]:ft(r);let g,y=[],b=0,E=a;return/from/i.test(a)&&(E=0),(t,e)=>{if(/center/i.test(a)&&(E=(e-1)/2),/last/i.test(a)&&(E=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return m+g*(Math.round(100*y[t])/100)+p}},me=(t,e={})=>{let i=e.stagger??{};return(s,a)=>{let n=t.map(((e,n)=>{let r=t[Math.max(0,n-1)];return ce([r,e],i)(s,a)}));return Ct(n,e)}},pe=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,fe=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class de{constructor(t={}){this.animateInstances=new y,this.initialOptions={},this.mainInstance=new ie({duration:0}),this.initialOptions=Object.assign({},Wt,Ht(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Ht(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Wt,this.initialOptions,t instanceof ie?t.initialOptions:Ht(t));return s.timelineOffset=fe(e,this.totalDuration),s.autoplay=this.initialOptions.autoplay,t instanceof ie?(i=t,i.updateOptions(s)):i=new ie(s),this.animateInstances.add(i),this.updateTiming(),this}updateTiming(){let t=this.animateInstances.values(),e=Math.max(...t.map((t=>t.totalDuration)));return this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:a}=i.totalDurationOptions,n=Number(s)-Number(a);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Timeline"}}const ge=(t={})=>new de(t);export{te as ALL_TIMING_KEYS,ie as Animate,ue as AnimateAttributes,Mt as ApplyCustomEasing,B as Back,st as Bezier,W as Bounce,k as CSSArrValue,Nt as CSSCamelCase,jt as CSSPXDataType,A as CSSValue,M as CSSVarSupport,I as CSS_CACHE,$ as Circ,mt as ComplexEasingSyntax,At as ComplexStrtoArr,X as Cubic,Ct as CustomEasing,wt as CustomEasingOptions,Wt as DefaultAnimationOptions,oe as DestroyableAnimate,Zt as EASINGS,g as EFFECTS,rt as EaseInOut,nt as EaseOut,ot as EaseOutIn,J as EasingDurationCache,ut as EasingFunctionKeys,lt as EasingFunctions,$t as EasingKeys,xt as EasingPts,H as Elastic,ne as EmptyTweenElContainer,G as Expo,Qt as FUNCTION_SUPPORTED_TIMING_KEYS,Bt as GetEase,pt as GetEasingFunction,tt as INTINITE_LOOP_LIMIT,d as KeyframeParse,Jt as NOT_FUNCTION_SUPPORTED_TIMING_KEYS,qt as ParseTransformableCSSKeyframes,Rt as ParseTransformableCSSProperties,U as Quad,Y as Quart,K as Quint,Z as Sine,Q as Spring,Pt as SpringEasing,me as StaggerCustomEasing,it as Steps,de as Timeline,vt as TransformFunctionNames,Tt as TransformFunctions,Dt as TweenCache,ae as UIDCount,O as UnitDEG,x as UnitDEGCSSValue,E as UnitLess,w as UnitLessCSSValue,S as UnitPX,D as UnitPXCSSValue,b as addCSSUnit,se as animate,zt as arrFill,h as camelCase,Kt as computeOption,u as convertToDash,re as createEmptyEl,Ft as createTransformProperty,v as createTransformValue,le as createTweenOptions,at as easein,t as flatten,et as getEasingDuration,Xt as getElements,Yt as getTargets,n as getUnit,Ot as interpolateColor,kt as interpolateComplex,yt as interpolateNumber,St as interpolateString,Et as interpolateUsingIndex,i as isEmpty,bt as isNumberLike,e as isObject,l as isValid,V as limit,Gt as mapAnimationOptions,s as mapObject,c as omit,ft as parseEasingParameters,f as parseOffset,Ht as parseOptions,m as pick,pe as random,ht as registerEasingFunction,ct as registerEasingFunctions,fe as relativeTo,dt as scale,ce as stagger,ge as timeline,o as toArr,N as toCSSVars,gt as toFixed,C as toRGBAArr,a as toStr,P as transformCSSVars,T as transformProperyNames,p as transpose,r as trim,he as tweenAttr}; +const t=t=>[].concat(...t),e=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t,i=t=>{for(let e in t)return!1;return!0},s=(t,e)=>{let i,s,a=Object.keys(t),n={};for(let r=0,o=a.length;r""+t,n=t=>{let e=parseFloat(t);return a(t).replace(a(e),"")},r=t=>a(t).trim(),o=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],l=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),u=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,h=t=>t.includes("--")?t:`${t}`.replace(/-([a-z])/g,((t,e)=>e.toUpperCase())),c=(t,e)=>{let i=[...t],s={...e};for(;i.length;){let{[i.pop()]:t,...e}=s;s=e}return s},m=(t,e)=>{let i=[...t],s={};for(let t of i)l(e[t])&&(s[t]=e[t]);return s},p=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=o(t),s=i.length;return s>e&&(e=s),i}))).length;for(let a=0;a"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,d=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let a=0;at.offset-e.offset))},g={};class y{constructor(t){this.map=new Map(t)}getMap(){return this.map}get(t){return this.map.get(t)}keys(){return Array.from(this.map.keys())}values(){return Array.from(this.map.values())}set(t,e){return this.map.set(t,e),this}add(t){let e=this.size;return this.set(e,t),this}get size(){return this.map.size}get length(){return this.map.size}last(t=1){let e=this.keys()[this.size-t];return this.get(e)}delete(t){return this.map.delete(t)}remove(t){return this.map.delete(t),this}clear(){return this.map.clear(),this}has(t){return this.map.has(t)}entries(){return this.map.entries()}forEach(t,e){return this.map.forEach(t,e),this}[Symbol.iterator](){return this.entries()}}const b=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,E=b(),S=b("px"),O=b("deg"),A=t=>e=>l(e)?o(e).map((e=>{if("number"!=typeof e&&"string"!=typeof e)return e;let i=Number(e),s=Number.isNaN(i)?"string"==typeof e?e.trim():e:i;return t(s)})):[],k=(t,e)=>o(t).map(A(e)),w=A(E),D=A(S),I=A(O),x=new y,P=(t="transparent")=>{if(t=t.trim(),x.has(t))return x.get(t);if(!CSS.supports("background-color",t))return t;let e=document.createElement("div");e.style.backgroundColor=t,document.body.appendChild(e);let{backgroundColor:i}=getComputedStyle(e);e.remove();let s=/\(([^)]+)\)?/.exec(i)?.[1].split(","),a=(3==s.length?[...s,"1"]:s).map((t=>parseFloat(t)));return x.set(t,a),a},C={translate3d:["--translate3d0","--translate3d1","--translate3d2"],translate:["--translate0","--translate1"],translateX:"--translateX",translateY:"--translateY",translateZ:"--translateZ",rotate3d:["--rotate3d0","--rotate3d1","--rotate3d2","--rotate3d3"],rotate:"--rotate",rotateX:"--rotateX",rotateY:"--rotateY",rotateZ:"--rotateZ",scale3d:["--scale3d0","--scale3d1","--scale3d2"],scale:["--scale0","--scale1"],scaleX:"--scaleX",scaleY:"--scaleY",scaleZ:"--scaleZ",skew:["--skew0","--skew1"],skewX:"--skewX",skewY:"--skewY",perspective:"--perspective"},M="registerProperty"in CSS,v=Object.keys(C),T=(t={})=>Object.keys(t).filter((t=>v.includes(t))).map((t=>{if(!M)return"";let e=[].concat(C[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?CSS.registerProperty({...e,syntax:"",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&CSS.registerProperty({...e,syntax:"",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),N=(t={})=>{let e={};return v.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>l(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let a=[].concat(C[i]),n=s.every((t=>Array.isArray(t))),r=1==s.length&&"scale"==i;a.forEach(((t,i)=>{let a=r?0:i,o=n?p(...s)[a]:s;if(l(o)){let i=t;/translate|perspective/i.test(i)?o=D(o):/rotate3d3|skew/i.test(i)?o=I(o):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(o=I(o)),e[t]=o}}))})),e},F="function"==typeof Float32Array,j=(t,e)=>1-3*e+3*t,z=(t,e)=>3*e-6*t,q=t=>3*t,R=(t,e,i)=>((j(e,i)*t+z(e,i))*t+q(e))*t,L=(t,e,i)=>3*j(e,i)*t*t+2*z(e,i)*t+q(e),_=(t,e,i,s)=>{if(!(0<=t&&t<=1&&0<=i&&i<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&i===s)return t=>t;for(var a=F?new Float32Array(11):new Array(11),n=0;n<11;++n)a[n]=R(.1*n,t,i);const r=e=>{let s=0,n=1;for(;10!==n&&a[n]<=e;++n)s+=.1;--n;let r=s+.1*((e-a[n])/(a[n+1]-a[n])),o=L(r,t,i);return o>=.001?((t,e,i,s)=>{for(var a=0;a<4;++a){let a=L(e,i,s);if(0===a)return e;e-=(R(e,i,s)-t)/a}return e})(e,r,t,i):0===o?r:((t,e,i,s,a)=>{let n,r,o=0;do{r=e+(i-e)/2,n=R(r,s,a)-t,n>0?i=r:e=r}while(Math.abs(n)>1e-7&&++o<10);return r})(e,s,s+.1,t,i)};return t=>0===t||1===t?t:R(r(t),e,s)},V=(t,e,i)=>Math.min(Math.max(t,e),i),U=t=>Math.pow(t,2),Y=t=>Math.pow(t,3),X=t=>Math.pow(t,4),K=t=>Math.pow(t,5),G=t=>Math.pow(t,6),Z=t=>1-Math.cos(t*Math.PI/2),$=t=>1-Math.sqrt(1-t*t),Q=t=>t*t*(3*t-2),B=t=>{let e,i=4;for(;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)},W=(t,e=[])=>{let[i=1,s=.5]=e;const a=V(i,1,10),n=V(s,.1,2);return 0===t||1===t?t:-a*Math.pow(2,10*(t-1))*Math.sin((t-1-n/(2*Math.PI)*Math.asin(1/a))*(2*Math.PI)/n)},H=(t,e=[],i)=>{let[s=1,a=100,n=10,r=0]=e;s=V(s,.1,1e3),a=V(a,.1,1e3),n=V(n,.1,1e3),r=V(r,.1,1e3);const o=Math.sqrt(a/s),l=n/(2*Math.sqrt(a*s)),u=l<1?o*Math.sqrt(1-l*l):0,h=l<1?(l*o-r)/u:-r+o;let c=i?i*t/1e3:t;return c=l<1?Math.exp(-c*l*o)*(1*Math.cos(u*c)+h*Math.sin(u*c)):(1+h*c)*Math.exp(-c*o),0===t||1===t?t:1-c},J=new Map,tt=1e4,et=(t="spring")=>{if(J.has(t))return J.get(t);const e="function"==typeof t?t:pt(t),i="function"==typeof t?[]:ft(t),s=1/6;let a=0,n=0,r=0;for(;++r<1e4;)if(a+=s,1===e(a,i,null)){if(n++,n>=16)break}else n=0;const o=a*s*1e3;return J.set(t,o),o},it=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(V(t,0,1)*i)/i},st=(t,e=[])=>{let[i,s,a,n]=e;return _(i,s,a,n)(t)},at=_(.42,0,1,1),nt=t=>(e,i=[],s)=>1-t(1-e,i,s),rt=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,ot=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,lt={steps:it,"step-start":t=>it(t,[1,"start"]),"step-end":t=>it(t,[1,"end"]),linear:t=>t,"cubic-bezier":st,ease:t=>st(t,[.25,.1,.25,1]),in:at,out:nt(at),"in-out":rt(at),"out-in":ot(at),"in-quad":U,"out-quad":nt(U),"in-out-quad":rt(U),"out-in-quad":ot(U),"in-cubic":Y,"out-cubic":nt(Y),"in-out-cubic":rt(Y),"out-in-cubic":ot(Y),"in-quart":X,"out-quart":nt(X),"in-out-quart":rt(X),"out-in-quart":ot(X),"in-quint":K,"out-quint":nt(K),"in-out-quint":rt(K),"out-in-quint":ot(K),"in-expo":G,"out-expo":nt(G),"in-out-expo":rt(G),"out-in-expo":ot(G),"in-sine":Z,"out-sine":nt(Z),"in-out-sine":rt(Z),"out-in-sine":ot(Z),"in-circ":$,"out-circ":nt($),"in-out-circ":rt($),"out-in-circ":ot($),"in-back":Q,"out-back":nt(Q),"in-out-back":rt(Q),"out-in-back":ot(Q),"in-bounce":B,"out-bounce":nt(B),"in-out-bounce":rt(B),"out-in-bounce":ot(B),"in-elastic":W,"out-elastic":nt(W),"in-out-elastic":rt(W),"out-in-elastic":ot(W),spring:H,"spring-in":H,"spring-out":nt(H),"spring-in-out":rt(H),"spring-out-in":ot(H)};let ut=Object.keys(lt);const ht=(t,e)=>{Object.assign(lt,{[t]:e}),ut=Object.keys(lt)},ct=(...t)=>{Object.assign(lt,...t),ut=Object.keys(lt)},mt=t=>u(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),pt=t=>{let e=mt(a(t));return ut.includes(e)?lt[e]:null},ft=t=>{const e=/(\(|\s)([^)]+)\)?/.exec(a(t));return e?e[2].split(",").map((t=>{let e=parseFloat(t);return Number.isNaN(e)?t.trim():e})):[]},dt=(t,e,i)=>e+(i-e)*t,gt=(t,e)=>Math.round(t*10**e)/10**e,yt=(t,e,i=3)=>{let s=e.length-1,a=V(Math.floor(t*s),0,s-1),n=e[a],r=e[a+1];return gt(dt((t-a/s)*s,n,r),i)},bt=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},Et=(t,e)=>{t=V(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},St=(t,e,i=3)=>{let s="";return bt(e[0])&&(s=n(e[0])),yt(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},Ot=(t,e,i=3)=>p(...e.map((t=>P(t)))).map(((e,s)=>{let a=yt(t,e);return s<3?Math.round(a):gt(a,i)})),At=t=>r(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(r).filter(l),kt=(t,e,i=3)=>e.every((t=>"number"==typeof t))?yt(t,e,i):e.every((t=>CSS.supports("color",a(t))))?`rgba(${Ot(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(r(t))))?p(...e.map(At)).map((e=>kt(t,e,i))).join(" "):e.every((t=>bt(t)))?St(t,e,i):Et(t,e):void 0,wt=(t={})=>{let e="string"==typeof t||"function"==typeof t,{easing:i="spring(1, 100, 10, 0)",numPoints:s=100,decimal:a=3,duration:n}=e?{easing:t}:t;return{easing:i,numPoints:s,decimal:a,duration:n}},Dt=new Map,It=({easing:t,numPoints:e,duration:i}={})=>{const s=[],a=`${t}${e}`;if(Dt.has(a))return Dt.get(a);const n="function"==typeof t?t:pt(t),r="function"==typeof t?[]:ft(t);for(let t=0;t{if("string"==typeof t.easing){let e=mt(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=et(t.easing))}},Pt=(t,e={})=>{let i=wt(e);return xt(i),It(i).map((e=>kt(e,t,i.decimal)))},Ct=(t,e={})=>{let i=wt(e),{duration:s}=i;return xt(i),[Pt(t,i),l(s)?s:i.duration]},Mt=(t={})=>{let{easing:e,numPoints:i,decimal:a,duration:n,...r}=t,o={easing:e,numPoints:i,decimal:a,duration:n};xt(o);let u=s(r,(t=>Pt(t,o))),h={};return l(n)?h={duration:n}:l(o.duration)&&(h={duration:o.duration}),Object.assign({},u,h)},vt={translate:t=>k(t,S),translate3d:t=>k(t,S),translateX:t=>D(t),translateY:t=>D(t),translateZ:t=>D(t),rotate:t=>k(t,O),rotate3d:t=>k(t,E),rotateX:t=>I(t),rotateY:t=>I(t),rotateZ:t=>I(t),scale:t=>k(t,E),scale3d:t=>k(t,E),scaleX:t=>w(t),scaleY:t=>w(t),scaleZ:t=>w(t),skew:t=>k(t,O),skewX:t=>I(t),skewY:t=>I(t),perspective:t=>D(t)},Tt=Object.keys(vt),Nt=t=>{let e,i,s=Object.keys(t),a={};for(let n=0,r=s.length;n{let i="",s=t.length;for(let a=0;a(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?p(...zt(p(...t),e)):i!==e?Array.from(Array(e),((s,a)=>{let n=1==i?Array(2).fill(t[0]):t;return St(a/(e-1),n)})):t}))),qt=t=>{let e,i,n=Nt(t);if(M)e=Object.assign({},N(n),c(v,n));else{let t=Object.keys(n).filter((t=>Tt.includes(t))),s=t.map((t=>vt[t](n[t])));s=zt(s),i=p(...s).filter(l).map((e=>Ft(t,e))),e=c(Tt,n)}return e=s(e,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let s=/rotate/i.test(e),a=new RegExp(jt,"i").test(e)||CSS.supports(u(e),"1px");if(s||a)return s?i=I:a&&(i=D),i(t).map((t=>{let e=r(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(a)})),Object.assign({},l(i)?{transform:i}:null,e)},Rt=t=>t.map((t=>{let e=Nt(t);if(M)return{rest:Object.assign({},N(e),c(v,e)),transformFunctions:null};let{translate:i,translate3d:s,translateX:a,translateY:n,translateZ:r,rotate:o,rotate3d:l,rotateX:u,rotateY:h,rotateZ:m,scale:p,scale3d:f,scaleX:d,scaleY:g,scaleZ:y,skew:b,skewX:E,skewY:S,perspective:O,...A}=e;return i=D(i),s=D(s),a=D(a)[0],n=D(n)[0],r=D(r)[0],o=I(o),l=w(l),u=I(u)[0],h=I(h)[0],m=I(m)[0],p=w(p),f=w(f),d=w(d)[0],g=w(g)[0],y=w(y)[0],b=I(b),E=I(E)[0],S=I(S)[0],O=D(O)[0],{rest:A,transformFunctions:[s,i,a,n,r,l,o,u,h,m,f,p,d,g,y,b,E,S,O]}})).map((({rest:t,transformFunctions:e})=>{let i=M?null:Ft(Tt,e);return t=s(t,((t,e)=>{let i;if(t=a(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),a=new RegExp(jt,"i").test(e);if(s||a)return s?i=I:a&&(i=D),i(t).join(" ")}return t})),Object.assign({},l(i)?{transform:i}:null,t)})),Lt=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class _t extends y{constructor(t="event"){super(),this.name=t}}const Vt=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class Ut extends y{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof _t?e:(this.set(t,new _t(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(Lt({name:t,callback:e,scope:i})),s}on(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,a,n=Vt(t),r=n?e:i;return n||(a=e),Object.keys(t).forEach((e=>{s=n?e:t[e],n&&(a=t[e]),this.newListener(s,a,r)}),this),this}removeListener(t,e,i){let s=this.get(t);if(s instanceof _t&&e){let a=Lt({name:t,callback:e,scope:i});s.forEach(((t,e)=>{if(t.callback===a.callback&&t.scope===a.scope)return s.remove(e)}))}return s}off(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s,a,n=Vt(t),r=n?e:i;return n||(a=e),Object.keys(t).forEach((e=>{s=n?e:t[e],n&&(a=t[e]),"function"==typeof a?this.removeListener(s,a,r):this.remove(s)}),this),this}once(t,e,i){if(null==t||null==t)return this;"string"==typeof t&&(t=t.trim().split(/\s+/));let s=Vt(t);return Object.keys(t).forEach((a=>{let n=s?a:t[a],r=s?t[a]:e,o=s?e:i,l=(...t)=>{r.apply(o,t),this.removeListener(n,l,o)};this.newListener(n,l,o)}),this),this}emit(t,...e){return null==t||null==t||("string"==typeof t&&(t=t.trim().split(/\s+/)),t.forEach((t=>{let i=this.get(t);i instanceof _t&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return((t,e,...i)=>{t.forEach((t=>{t[e](...i)}))})(this,"clear"),super.clear(),this}}const Yt=t=>"string"==typeof t?Array.from(document.querySelectorAll(t)):[t],Xt=e=>Array.isArray(e)?t(e.map(Xt)):"string"==typeof e||e instanceof Node?Yt(e):e instanceof NodeList||e instanceof HTMLCollection?Array.from(e):[],Kt=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,Gt=(t,e,i)=>s(t,(t=>Kt(t,e,i))),Zt={in:"ease-in",out:"ease-out","in-out":"ease-in-out","in-sine":"cubic-bezier(0.47, 0, 0.745, 0.715)","out-sine":"cubic-bezier(0.39, 0.575, 0.565, 1)","in-out-sine":"cubic-bezier(0.445, 0.05, 0.55, 0.95)","in-quad":"cubic-bezier(0.55, 0.085, 0.68, 0.53)","out-quad":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","in-out-quad":"cubic-bezier(0.455, 0.03, 0.515, 0.955)","in-cubic":"cubic-bezier(0.55, 0.055, 0.675, 0.19)","out-cubic":"cubic-bezier(0.215, 0.61, 0.355, 1)","in-out-cubic":"cubic-bezier(0.645, 0.045, 0.355, 1)","in-quart":"cubic-bezier(0.895, 0.03, 0.685, 0.22)","out-quart":"cubic-bezier(0.165, 0.84, 0.44, 1)","in-out-quart":"cubic-bezier(0.77, 0, 0.175, 1)","in-quint":"cubic-bezier(0.755, 0.05, 0.855, 0.06)","out-quint":"cubic-bezier(0.23, 1, 0.32, 1)","in-out-quint":"cubic-bezier(0.86, 0, 0.07, 1)","in-expo":"cubic-bezier(0.95, 0.05, 0.795, 0.035)","out-expo":"cubic-bezier(0.19, 1, 0.22, 1)","in-out-expo":"cubic-bezier(1, 0, 0, 1)","in-circ":"cubic-bezier(0.6, 0.04, 0.98, 0.335)","out-circ":"cubic-bezier(0.075, 0.82, 0.165, 1)","in-out-circ":"cubic-bezier(0.785, 0.135, 0.15, 0.86)","in-back":"cubic-bezier(0.6, -0.28, 0.735, 0.045)","out-back":"cubic-bezier(0.175, 0.885, 0.32, 1.275)","in-out-back":"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},$t=Object.keys(Zt),Qt=(t="ease")=>{let e=u(t).replace(/^ease-/,"");return $t.includes(e)?Zt[e]:t},Bt={keyframes:[],offset:[],loop:1,delay:0,speed:1,endDelay:0,easing:"ease",timelineOffset:0,autoplay:!0,duration:1e3,persist:!0,fillMode:"none",direction:"normal",padEndDelay:!1,timeline:document.timeline,extend:{}},Wt=t=>{let{options:e,...i}=t,s=e instanceof ie?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},Ht=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],Jt=["keyframes","padEndDelay","persist","onfinish","oncancel","autoplay","target","targets","timeline"],te=[...Ht,...Jt],ee=class{constructor(t={}){this.options={},this.initialOptions={},this.properties={},this.totalDuration=0,this.totalDurationOptions={},this.maxDuration=0,this.minDelay=1/0,this.maxSpeed=1/0,this.maxEndDelay=0,this.timelineOffset=0,this.emitter=new Ut,this.targets=new y,this.targetIndexes=new WeakMap,this.keyframeEffects=new WeakMap,this.computedOptions=new WeakMap,this.animations=new WeakMap,this.computedKeyframes=new WeakMap,this.loop=this.loop.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.on("error",console.error),this.updateOptions(t),this.mainAnimation&&(this.visibilityPlayState=this.getPlayState(),ee.pauseOnPageHidden&&document.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/ee.FRAME_RATE,i=t-ee.FRAME_START_TIME;i>e&&(ee.FRAME_START_TIME=t-i%e,ee.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),ee.RUNNING.size>0?ee.animationFrame=window.requestAnimationFrame(ee.requestFrame):ee.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame(ee.animationFrame),ee.animationFrame=null}loop(){this.emit("update",this.getProgress(),this)}stopLoop(){ee.RUNNING.delete(this)}onVisibilityChange(){document.hidden?(this.visibilityPlayState=this.getPlayState(),this.is("running")&&(this.loop(),this.pause())):"running"==this.visibilityPlayState&&this.is("paused")&&this.play()}newPromise(){return this.promise=new Promise(((t,e)=>{this.emitter?.once?.("finish",(()=>t([this]))),this.emitter?.once?.("error",(t=>e(t)))})),this.promise}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.promise?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.promise?.catch?.(t),this}finally(t){return t=t?.bind(this),this.promise?.finally?.(t),this}allAnimations(t){return this.targets.forEach((e=>{let i=this.keyframeEffects.get(e),s=this.animations.get(i);return t(s,e)})),this}all(t){return this.mainAnimation&&t(this.mainAnimation,this.mainElement),this.allAnimations(t),this}beginEvent(){0==this.getProgress()&&this.emit("begin",this)}play(){let t=this.getPlayState();return this.beginEvent(),this.all((t=>t.play())),this.emit("play",t,this),this.emit("playstate-change",t,this),this.loop(),ee.RUNNING.add(this),ee.requestFrame(),this}pause(){let t=this.getPlayState();return this.all((t=>t.pause())),this.emit("pause",t,this),this.emit("playstate-change",t,this),this.stopLoop(),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.setProgress(0),this.options.autoplay?this.play():this.pause(),this}commitStyles(){return this.all((t=>t?.commitStyles())),this}persist(){return this.all((t=>t?.persist())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),document.removeEventListener("visibilitychange",this.onVisibilityChange,!1),this.targets.forEach((t=>this.removeTarget(t))),this.emit("stop"),this.emitter.clear(),this.mainkeyframeEffect=null,this.mainAnimation=null,this.mainElement?.remove?.(),this.mainElement=null,this.promise=null,this.computedOptions=null,this.animations=null,this.keyframeEffects=null,this.emitter=null,this.targets=null,this.options=null,this.properties=null}getAnimation(t){let e=this.keyframeEffects.get(t);return this.animations.get(e)}getTiming(t){return{...this.computedOptions.get(t)??{},...this.keyframeEffects.get(t).getTiming?.()??{}}}getCurrentTime(){return this.mainAnimation.currentTime}getProgress(){return this.getCurrentTime()/this.totalDuration*100}getSpeed(){return this.mainAnimation.playbackRate}getPlayState(){return this.mainAnimation.playState}is(t){return this.getPlayState()==t}setCurrentTime(t){return this.all((e=>e.currentTime=t)),this.emit("update",this.getProgress()),this}setProgress(t){let e=t/100*this.totalDuration;return this.setCurrentTime(e),this}setSpeed(t=1){return this.maxSpeed=t,this.all((e=>{e.updatePlaybackRate?e.updatePlaybackRate(t):e.playbackRate=t})),this}createArrayOfComputedOptions(t,e){let i=[],s=t=>Object.assign({easing:t("easing"),iterations:t("loop"),direction:t("direction"),endDelay:t("endDelay"),duration:t("duration"),speed:t("speed"),delay:t("delay"),timelineOffset:t("timelineOffset"),keyframes:t("keyframes"),fill:t("fillMode"),composite:t("composite")},t("extend")??{});if(0==this.targets.size){let{delay:e,duration:i,iterations:a,endDelay:n,speed:r,timelineOffset:o}=s((e=>{let i=t[e]??this.options[e]??Bt[e];return"function"!=typeof i?i:Bt[e]}));o=Number(o),a=Number(a),i=Number(i),n=Number(n),r=Number(r),e=Number(e),this.timelineOffset=o,this.minDelay=e,this.maxSpeed=r,this.maxDuration=i,this.maxEndDelay=n,this.totalDuration=e+o+i*a+n,this.totalDurationOptions={delay:e,duration:i,iterations:a,endDelay:n,speed:r,timelineOffset:o,totalDuration:this.totalDuration}}return this.targets.forEach(((a,n)=>{let r=this.computedOptions.get(a)??{},o=s((e=>{let i=e;return"loop"==e&&(i="iterations"),"fillMode"==e&&(i="fill"),t[e]??r[i]??this.options[e]??Bt[e]})),l=Gt(o,[n,e,a],this);if("string"==typeof l.easing||Array.isArray(l.easing)){let{easing:t}=l;l.easing=Array.isArray(t)?t.map((t=>Qt(t))):Qt(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:h,endDelay:c,delay:m,duration:p,iterations:f,...d}=l;u=Number(u),f=Number(f),p=Number(p),c=Number(c),h=Number(h),m=Number(m)+u,this.timelineOffset=u??this.timelineOffset,this.minDelay>m&&(this.minDelay=m),this.maxSpeed>h&&(this.maxSpeed=h),this.maxDuration{let g,{speed:y,keyframes:b,tempDurations:E,timelineOffset:S,...O}=a[p];n&&0==O.endDelay&&Math.abs(O.iterations)!=Math.abs(1/0)&&(O.endDelay=this.totalDuration-E);let A,k,w=b;e(w)&&(w=d(w));let D,I,x=this.computedKeyframes.get(t)??{},P="transform"in this.properties?x:c(["transform"],x),v=Object.assign({},r,P),N=s(v,((t,e)=>this.properties[e]??t));if(k=l(w)?w:N,Array.isArray(k))A=k.map((t=>{let{easing:e,offset:i,...s}=c(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:Qt(e)}:null,"string"==typeof i||"number"==typeof i?{offset:f(i)}:null)})),g=T(C),A=Rt(A),h&&A.length&&s(A[A.length-1],((e,i)=>{t.style.setProperty(i,e)}));else{let e=c(["keyframes"],k),{offset:a,...n}=Gt(e,[p,i,t],this);g=T(Nt(n)),n=qt(n);let r=a;A=Object.assign({},n,l(r)?{offset:r.map(f)}:null),h&&s(n,((e,i)=>{!e.length||t.style.setProperty(i,e[e.length-1])}))}this.keyframeEffects.has(t)?(I=this.keyframeEffects.get(t),D=this.animations.get(I),I?.setKeyframes?.(A),I?.updateTiming?.(O)):(I=new KeyframeEffect(t,A,O),D=new Animation(I,m),this.keyframeEffects.set(t,I),this.animations.set(I,D)),D.updatePlaybackRate?D.updatePlaybackRate(y):D.playbackRate=y,D.onfinish=()=>{"function"==typeof o&&o.call(this,t,p,i,D)},D.oncancel=()=>{"function"==typeof u&&u.call(this,t,p,i,D)},M&&Object.assign(t.style,{transform:g}),this.computedOptions.set(t,O),this.computedKeyframes.set(t,A)}))}updateOptions(t={}){try{let e=Wt(t);this.initialOptions=e,this.options=Object.assign({},Bt,this.options,e);let{padEndDelay:i,autoplay:s,target:a,targets:n,timeline:r,persist:o,onfinish:l,oncancel:u,...h}=c(Ht,this.options);this.properties=c(te,e);let m=this.targets.values(),p=[...new Set([...m,...Xt(n),...Xt(a)])];this.targets.clear(),p.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let f=this.targets.size,d=this.createArrayOfComputedOptions(e,f);if(this.createAnimations({arrOfComputedOptions:d,padEndDelay:i,oldCSSProperties:h,onfinish:l,oncancel:u,persist:o,timeline:r},f),this.mainAnimation?(this.mainkeyframeEffect?.updateTiming?.({duration:this.totalDuration}),(!this.mainkeyframeEffect.setKeyframes||!this.mainkeyframeEffect.updateTiming)&&console.warn("[Animate - @okikio/animate] `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser.")):(this.mainkeyframeEffect=new KeyframeEffect(this.mainElement,null,{duration:this.totalDuration}),this.mainAnimation=new Animation(this.mainkeyframeEffect,r)),this.mainAnimation.updatePlaybackRate?this.mainAnimation.updatePlaybackRate(this.maxSpeed):this.mainAnimation.playbackRate=this.maxSpeed,this.mainAnimation.onfinish=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("finish",this)},this.mainAnimation.oncancel=()=>{if(this.mainAnimation){let t=this.getPlayState();this.emit("playstate-change",t,this),this.loop(),this.stopLoop()}this.emit("cancel",this)},s){let t=window.setTimeout((()=>{this.emit("begin",this);let e=this.getPlayState();this.emit("playstate-change",e,this),t=window.clearTimeout(t)}),0);this.play()}else this.pause()}catch(t){this.emit("error",t)}}add(t){let e=this.getProgress(),i=this.is("running"),s=this.is("paused");return this.updateOptions({target:t}),this.setProgress(e),i?this.play():s&&this.pause(),this}removeTarget(t){let e=this.keyframeEffects.get(t);this.animations.delete(e),e=null,this.computedKeyframes.delete(t),this.computedOptions.delete(t),this.keyframeEffects.delete(t);let i=this.targetIndexes.get(t);return this.targets.delete(i),this.targetIndexes.delete(t),this}remove(t){this.removeTarget(t);let e=new Set([].concat(this.targets.values()));this.options.target=[...e],this.options.targets=[],e.clear(),e=null;let i=this.getProgress(),s=this.is("running"),a=this.is("paused");return this.updateOptions(),s?this.play():a&&this.pause(),this.setProgress(i),this}on(t,e,i){return i=i??this,this.emitter?.on?.(t,e??i,i),this.emitter.getEvent("update").length>0&&(ee.RUNNING.add(this),null==ee.animationFrame&&ee.requestFrame()),this}off(t,e,i){return i=i??this,this.emitter?.off?.(t,e??i,i),this}emit(t,...e){return this.emitter?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Animate"}};let ie=ee;ie.RUNNING=new Set,ie.FRAME_RATE=60,ie.FRAME_START_TIME=0,ie.pauseOnPageHidden=!0;const se=(t={})=>new ie(t);let ae=0;const ne=document.createElement("div"),re=()=>{l(ne.id)||(ne.id="empty-tween-el-container",ne.style.setProperty("display","none"),ne.style.setProperty("contain","paint layout size"),document.body.appendChild(ne));let t=document.createElement("div");return t.id="empty-animate-el-"+ae++,t.style.setProperty("display","none"),ne.appendChild(t),t};class oe extends ie{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const le=(t={})=>{let{easing:e,decimal:i,numPoints:s,opacity:a,...n}=Wt(t),r=m(te,n),o=e;if("string"==typeof e){let t=mt(e);o=$t.includes(t)||["linear","steps","step-start","step-end"].includes(t)?Qt(e):ut.includes(t)?pt(e):e}return{..."function"==typeof o?Mt({opacity:[0,1],easing:e,decimal:i,numPoints:s}):{opacity:[0,1],easing:e},...r}};class ue extends oe{constructor(){super(...arguments),this.updateListeners=new y}updateOptions(t={}){let e=Wt(t),i=this.targets.size>1?null:{target:re()},a=Object.assign({},le(c(["target","targets"],e)),i);super.updateOptions(a);let n=c(te,e);try{this.updateListeners=this.updateListeners??new y,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:i}=e,a=[...new Set([...Xt(i),...Xt(t)])],r=a.length,o=this.targets.get(0),l=window.getComputedStyle(o);a.forEach(((t,i)=>{s(n,((s,a)=>{let n,o=t.getAttribute(a);this.on("update",n=()=>{let n,u=Number(l.getPropertyValue("opacity"));n="function"==typeof s?s(u,i,r,t):kt(u,Array.isArray(s)?s:[o,s],e.decimal),t.setAttribute(a,""+n)}),this.updateListeners.add(n)}))}),this)}catch(t){this?.stopLoop(),this?.emit?.("error",t)}return this}}const he=(t={})=>new ue(t),ce=(t,e={})=>{const{grid:i,axis:s,from:a=0,easing:r,direction:o="normal"}=e,l=Array.isArray(t),u=l?t.length-1:null,h=parseFloat(l?t[0]:t),c=l?parseFloat(t[u]):0,{start:m=(l?h:0)}=e,p=n(l?t[u]:t)||0,f="function"==typeof r?r:pt(r),d="function"==typeof r?[]:ft(r);let g,y=[],b=0,E=a;return/from/i.test(a)&&(E=0),(t,e)=>{if(/center/i.test(a)&&(E=(e-1)/2),/last/i.test(a)&&(E=e-1),0==y.length){for(let t=0;tf(t/b,d)*b))),/reverse/i.test(o)&&y.reverse()}return m+g*(Math.round(100*y[t])/100)+p}},me=(t,e={})=>{let i=e.stagger??{};return(s,a)=>{let n=t.map(((e,n)=>{let r=t[Math.max(0,n-1)];return ce([r,e],i)(s,a)}));return Pt(n,e)}},pe=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,fe=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class de{constructor(t={}){this.animateInstances=new y,this.initialOptions={},this.mainInstance=new ie({duration:0}),this.initialOptions=Object.assign({},Bt,Wt(t)),this.totalDuration=0,this.maxDuration=0}get totalDuration(){return this.mainInstance.totalDuration}set totalDuration(t){this.mainInstance.totalDuration=t}get maxDuration(){return this.mainInstance.maxDuration}set maxDuration(t){this.mainInstance.maxDuration=t}get minDelay(){return this.mainInstance.minDelay}set minDelay(t){this.mainInstance.minDelay=t}get maxSpeed(){return this.mainInstance.maxSpeed}set maxSpeed(t){this.mainInstance.maxSpeed=t}get maxEndDelay(){return this.mainInstance.maxEndDelay}set maxEndDelay(t){this.mainInstance.maxEndDelay=t}get timelineOffset(){return this.mainInstance.timelineOffset}set timelineOffset(t){this.mainInstance.timelineOffset=t}get options(){return this.mainInstance.options}set options(t){this.mainInstance.options=Wt(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},Bt,this.initialOptions,t instanceof ie?t.initialOptions:Wt(t));if(Math.abs(this.totalDuration)!==1/0)if(/\t.totalDuration)));return Math.abs(e)==1/0?(console.warn('[Queue - @okikio/animate] individual Animate instances that are part of a Queue can\'t have Infinite totalDuration. You can\'t queue animations one after the other if one of the animations last for literally infinity. This issue may come from setting the "loop, duration, endDelay, delay, etc..." animation options to either Infinity (or for the loop option only, "true").'),this):(this.mainInstance.updateOptions({autoplay:this.initialOptions.autoplay,duration:e,delay:Math.max(...t.map((t=>t.minDelay))),endDelay:e-Math.max(...t.map((t=>t.totalDuration-t.maxEndDelay)))}),this)}remove(t){let e=this.animateInstances.size;if(this.animateInstances.has(t)){let i=this.animateInstances.get(t),{totalDuration:s,timelineOffset:a}=i.totalDurationOptions,n=Number(s)-Number(a);for(let i=t;it.play())),this}pause(){return this.all((t=>t.pause())),this}reverse(){return this.all((t=>t.reverse())),this}reset(){return this.all((t=>t.reset())),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.all((t=>t.stop())),this.animateInstances.clear(),this.mainInstance=null,this.animateInstances=null}getCurrentTime(){return this.mainInstance.getCurrentTime()}getProgress(){return this.mainInstance.getProgress()}getPlayState(){return this.mainInstance.getPlayState()}is(t){return this.mainInstance.is(t)}setCurrentTime(t){return this.all((e=>e.setCurrentTime(t))),this}setProgress(t){return this.all((e=>e.setProgress(t))),this}setSpeed(t=1){return this.all((e=>e.setSpeed(t))),this}on(t,e,i){return i=i??this,this.mainInstance?.on?.(t,e??i,i),this}off(t,e,i){return i=i??this,this.mainInstance?.off?.(t,e??i,i),this}emit(t,...e){return this.mainInstance?.emit?.(t,...e),this}toJSON(){return this.options}get[Symbol.toStringTag](){return"Queue"}}const ge=(t={})=>new de(t);export{te as ALL_TIMING_KEYS,ie as Animate,ue as AnimateAttributes,Mt as ApplyCustomEasing,Q as Back,st as Bezier,B as Bounce,k as CSSArrValue,Nt as CSSCamelCase,jt as CSSPXDataType,A as CSSValue,M as CSSVarSupport,x as CSS_CACHE,$ as Circ,mt as ComplexEasingSyntax,At as ComplexStrtoArr,Y as Cubic,Pt as CustomEasing,wt as CustomEasingOptions,Bt as DefaultAnimationOptions,oe as DestroyableAnimate,Zt as EASINGS,g as EFFECTS,rt as EaseInOut,nt as EaseOut,ot as EaseOutIn,J as EasingDurationCache,ut as EasingFunctionKeys,lt as EasingFunctions,$t as EasingKeys,It as EasingPts,W as Elastic,ne as EmptyTweenElContainer,G as Expo,Ht as FUNCTION_SUPPORTED_TIMING_KEYS,Qt as GetEase,pt as GetEasingFunction,tt as INTINITE_LOOP_LIMIT,d as KeyframeParse,Jt as NOT_FUNCTION_SUPPORTED_TIMING_KEYS,Rt as ParseTransformableCSSKeyframes,qt as ParseTransformableCSSProperties,U as Quad,X as Quart,de as Queue,K as Quint,Z as Sine,H as Spring,Ct as SpringEasing,me as StaggerCustomEasing,it as Steps,Tt as TransformFunctionNames,vt as TransformFunctions,Dt as TweenCache,ae as UIDCount,O as UnitDEG,I as UnitDEGCSSValue,E as UnitLess,w as UnitLessCSSValue,S as UnitPX,D as UnitPXCSSValue,b as addCSSUnit,se as animate,zt as arrFill,h as camelCase,Kt as computeOption,u as convertToDash,re as createEmptyEl,Ft as createTransformProperty,T as createTransformValue,le as createTweenOptions,at as easein,t as flatten,et as getEasingDuration,Yt as getElements,Xt as getTargets,n as getUnit,Ot as interpolateColor,kt as interpolateComplex,yt as interpolateNumber,St as interpolateString,Et as interpolateUsingIndex,i as isEmpty,bt as isNumberLike,e as isObject,l as isValid,V as limit,Gt as mapAnimationOptions,s as mapObject,c as omit,ft as parseEasingParameters,f as parseOffset,Wt as parseOptions,m as pick,ge as queue,pe as random,ht as registerEasingFunction,ct as registerEasingFunctions,fe as relativeTo,dt as scale,ce as stagger,o as toArr,N as toCSSVars,gt as toFixed,P as toRGBAArr,a as toStr,C as transformCSSVars,v as transformProperyNames,p as transpose,r as trim,he as tweenAttr}; diff --git a/packages/animate/src/animate.ts b/packages/animate/src/animate.ts index abb76ac..58883ab 100644 --- a/packages/animate/src/animate.ts +++ b/packages/animate/src/animate.ts @@ -169,7 +169,10 @@ export const GetEase = (ease: keyof typeof EASINGS | string = "ease"): string => * easing: "ease", * autoplay: true, * duration: 1000, + * + * persist: true, * fillMode: "none", + * * direction: "normal", * padEndDelay: false, * timeline: document.timeline, @@ -189,7 +192,10 @@ export const DefaultAnimationOptions: IAnimationOptions = { timelineOffset: 0, autoplay: true, duration: 1000, + + persist: true, fillMode: "none", + direction: "normal", padEndDelay: false, timeline: document.timeline, @@ -204,7 +210,7 @@ export const parseOptions = (options: IAnimationOptions): IAnimationOptions => { } export const FUNCTION_SUPPORTED_TIMING_KEYS = ["easing", "loop", "endDelay", "duration", "speed", "delay", "timelineOffset", "direction", "extend", "fillMode", "composite"]; -export const NOT_FUNCTION_SUPPORTED_TIMING_KEYS = ["keyframes", "padEndDelay", "onfinish", "oncancel", "autoplay", "target", "targets", "timeline"]; +export const NOT_FUNCTION_SUPPORTED_TIMING_KEYS = ["keyframes", "padEndDelay", "persist", "onfinish", "oncancel", "autoplay", "target", "targets", "timeline"]; export const ALL_TIMING_KEYS = [...FUNCTION_SUPPORTED_TIMING_KEYS, ...NOT_FUNCTION_SUPPORTED_TIMING_KEYS]; /** @@ -332,7 +338,6 @@ export class Animate { constructor(options: IAnimationOptions = {}) { this.loop = this.loop.bind(this); this.onVisibilityChange = this.onVisibilityChange.bind(this); - this.on("error", console.error); this.updateOptions(options); @@ -585,6 +590,8 @@ export class Animate { /** * Explicitly persists an animation, when it would otherwise be removed due to the browser's Automatically removing filling animations behavior. * Learn more on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Animation/persist) + * + * > _**Warning**: This is different from {@link IAnimationOptions.persist}, this keeps Animations while {@link IAnimationOptions.persist}, keeps the final state of CSS during the animation, in some instances they may have similar effects, **but they are very different**._ */ public persist() { this.all(anim => anim?.persist()); @@ -808,7 +815,7 @@ export class Animate { duration = Number(duration); endDelay = Number(endDelay); speed = Number(speed); - delay = Number(delay); + delay = Number(delay) + timelineOffset; this.timelineOffset = timelineOffset ?? this.timelineOffset; if (this.minDelay > delay) this.minDelay = delay; @@ -841,7 +848,7 @@ export class Animate { speed, tempDurations: tempDuration, endDelay, - delay: delay + timelineOffset, + delay, duration, iterations, timelineOffset @@ -853,13 +860,14 @@ export class Animate { /** * Creates animations out of an array of computed options */ - protected createAnimations(param: { arrOfComputedOptions: any; padEndDelay: any; oldCSSProperties: any; onfinish: any; oncancel: any; timeline?: any; }, len: number) { + protected createAnimations(param: { arrOfComputedOptions: any; padEndDelay: any; oldCSSProperties: any; onfinish: any; oncancel: any; persist?: boolean; timeline?: any; }, len: number) { let { arrOfComputedOptions, padEndDelay, oldCSSProperties, onfinish, oncancel, + persist, timeline } = param; @@ -926,6 +934,14 @@ export class Animate { CSSProperties, isValid(_offset) ? { offset: _offset.map(parseOffset) } : null ) as PropertyIndexedKeyframes; + + // Persist animation states without `fillMode` + if (persist) { + mapObject(CSSProperties, (value: any, key: any) => { + if (!value.length) return; + target.style.setProperty(key, value[value.length - 1]); + }); + } } else { computedKeyframes = animationKeyframe.map((keyframe: Keyframe) => { // Remove `speed` & `loop`, they are not valid CSS properties @@ -944,6 +960,13 @@ export class Animate { // Transform transformable CSS properties in each keyframe of the keyframe array computedKeyframes = ParseTransformableCSSKeyframes(computedKeyframes) as Keyframe[]; + + // Persist animation states without `fillMode` + if (persist && computedKeyframes.length) { + mapObject(computedKeyframes[computedKeyframes.length - 1], (value: any, key: any) => { + target.style.setProperty(key, value); + }); + } } let animation: Animation, keyFrameEffect: KeyframeEffect; @@ -1006,6 +1029,7 @@ export class Animate { target, targets, timeline, + persist, // These values are always functions onfinish, @@ -1038,6 +1062,7 @@ export class Animate { oldCSSProperties, onfinish, oncancel, + persist, timeline }, len); @@ -1053,7 +1078,7 @@ export class Animate { }); if (!this.mainkeyframeEffect.setKeyframes || !this.mainkeyframeEffect.updateTiming) - console.warn("@okikio/animate - `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser."); + console.warn("[Animate - @okikio/animate] `KeyframeEffect.setKeyframes` and/or `KeyframeEffect.updateTiming` are not supported in this browser."); } if (this.mainAnimation.updatePlaybackRate) diff --git a/packages/animate/src/custom-easing.ts b/packages/animate/src/custom-easing.ts index 1496953..d48e8b4 100644 --- a/packages/animate/src/custom-easing.ts +++ b/packages/animate/src/custom-easing.ts @@ -10,6 +10,8 @@ import { import { toRGBAArr } from "./unit-conversion"; import bezier from "./bezier-easing"; +import type { IAnimationOptions } from "./types"; + export const limit = (value: number, min: number, max: number) => Math.min(Math.max(value, min), max); @@ -719,7 +721,7 @@ const updateDuration = (optionsObj: TypeCustomEasingOptions = {}) => { export const CustomEasing = ( values: (string | number)[], options: TypeCustomEasingOptions | string | TypeEasingFunction = {} -) => { +): (string | number)[] => { let optionsObj = CustomEasingOptions(options); updateDuration(optionsObj); @@ -760,8 +762,8 @@ export const CustomEasing = ( */ export const SpringEasing = ( values: (string | number)[], - options: TypeCustomEasingOptions = {} -) => { + options: TypeCustomEasingOptions | string = {} +): [(string | number)[], number] => { let optionsObj = CustomEasingOptions(options); let { duration } = optionsObj; @@ -819,7 +821,13 @@ export const ApplyCustomEasing = ( | TypeEasingFunction | (number | string)[]; } = {} -) => { +): IAnimationOptions & TypeCustomEasingOptions & { + [key: string]: + | number + | string + | TypeEasingFunction + | (number | string)[]; +} => { let { easing, numPoints, decimal, duration, ...rest } = options; let optionsObj = { easing, numPoints, decimal, duration }; updateDuration(optionsObj); diff --git a/packages/animate/src/queue.ts b/packages/animate/src/queue.ts index 0ca8b22..3225dc9 100644 --- a/packages/animate/src/queue.ts +++ b/packages/animate/src/queue.ts @@ -158,8 +158,19 @@ export class Queue { let newInst: Animate | Queue; let insParams: IAnimationOptions = Object.assign({}, DefaultAnimationOptions, this.initialOptions, options instanceof Animate ? options.initialOptions : parseOptions(options)); + + if (Math.abs(this.totalDuration) !== Infinity) { + if (/\ x.totalDuration)); + if (Math.abs(duration) == Infinity) { + console.warn(`[Queue - @okikio/animate] individual Animate instances that are part of a Queue can't have Infinite totalDuration. You can't queue animations one after the other if one of the animations last for literally infinity. This issue may come from setting the "loop, duration, endDelay, delay, etc..." animation options to either Infinity (or for the loop option only, "true").`); + return this; + } + this.mainInstance.updateOptions({ autoplay: this.initialOptions.autoplay, duration, diff --git a/packages/animate/src/types.ts b/packages/animate/src/types.ts index 7178356..19812d5 100644 --- a/packages/animate/src/types.ts +++ b/packages/animate/src/types.ts @@ -68,23 +68,50 @@ export type TypeMissingCSSProperties = { maxLines?: number | string | (string | number)[] | TypeCallback, offsetPosition?: number | string | (string | number)[] | TypeCallback, scrollbarColor?: string | string[] | TypeCallback, -} & { +} & +/** + * @ignore + */ +{ [K in TypeAnimatableCSSProperties]?: TypeAnimationOptionTypes } /** * Full list of CSS & SVG Animatable Properties & Animation Options that are supported + * + * Animatable CSS properties are {@link TypeMissingCSSProperties} + * SVG Presentation Attributes are {@link TypeAnimatableSVGAttributes} + * */ export type TypeCSSAnimationOptions = + /** + * @ignore + */ { [K in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[K] | CSSStyleDeclaration[K][] | TypeAnimationOptionTypes } & + /** + * @ignore + */ { [K in keyof CSSStyleDeclaration as KebabCase]?: CSSStyleDeclaration[K] | CSSStyleDeclaration[K][] | TypeAnimationOptionTypes } & - TypeCSSTransformableProperties & KebabCasedProperties & - TypeMissingCSSProperties & KebabCasedProperties & - TypeAnimatableSVGAttributes & KebabCasedProperties; + TypeCSSTransformableProperties & + /** + * @ignore + */ + KebabCasedProperties & + /** + * @ignore + */ + TypeMissingCSSProperties & + /** + * @ignore + */KebabCasedProperties & + TypeAnimatableSVGAttributes & + /** + * @ignore + */KebabCasedProperties; /** * Animation options control how an animation is produced, it shouldn't be too different for those who have used `animejs`, or `jquery`'s animate method. @@ -298,10 +325,20 @@ export interface IAnimationOptions extends TypeCSSAnimationOptions { * * You can learn more here on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill). - * _Be careful when using fillMode, it has some problems when it comes to concurrency of animations read more on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill), if browser support were better I would remove fillMode and use Animation.commitStyles, I'll have to change the way `fillMode` functions later. Use the onfinish method to commit styles [onfinish](#onfinish)._ + * > _Be careful when using fillMode, it has some problems when it comes to concurrency of animations read more on [MDN](https://developer.mozilla.org/en-US/docs/Web/API/EffectTiming/fill). I highly suggest using {@link IAnimationOptions.persist | persist}, as it's less permanent, or better yet use the {@link IAnimationOptions.onfinish | onfinish(...) } method, with {@link Animate.commitStyles | Animate.commitStyles(...)\ } to commit styles._ */ fillMode?: KeyframeEffectOptions["fill"] | FillMode, + /** + * Persists animation state, so, when an animation is complete it keeps said finished animation state. + * Think of it more like a less strict version of {@link IAnimationOptions.fillMode | fillMode}, it was inspired by [motion one](https://motion.dev/). + * + * By default WAAPI resets animations back to their initial state once an animation is complete and fillMode isn't being used. The persist animation option, basically tells Animate to find the final state of all CSS Properties being animated, and then set them, so, once the animation is finished and WAAPI resets animations back to their initial state (so `initial state = final state`) the user doesn't notice difference and it looks like the animation stopped on the final state. + * + * > _**Note**: use this most of the time instead of `fillMode`, as it's impact is less permanent._ + */ + persist?: boolean, + /** * Another way to input options for an animation, it's also used to chain animations. * diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4bc6214..9cdf947 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -980,7 +980,7 @@ packages: source-map: 0.6.1 string-length: 4.0.2 terminal-link: 2.1.1 - v8-to-istanbul: 8.0.0 + v8-to-istanbul: 8.1.0 transitivePeerDependencies: - supports-color dev: true @@ -1669,8 +1669,8 @@ packages: resolution: {integrity: sha512-ARATsLdrGPUnaBvxLhUlnltcMgn7pQG312S8ccdYlnyijabrX9RN/KN/iGj9Am96CoW8e/K9628BA7Bv4XHdrA==} dev: true - /@types/prettier/2.4.0: - resolution: {integrity: sha512-WHRsy5nMpjXfU9B0LqOqPT06EI2+8Xv5NERy0pLxJLbU98q7uhcGogQzfX+rXpU7S5mgHsLxHrLCufZcV/P8TQ==} + /@types/prettier/2.4.1: + resolution: {integrity: sha512-Fo79ojj3vdEZOHg3wR9ksAMRz4P3S5fDB5e/YWZiFnyFQI1WY2Vftu9XoXVVtJfxB7Bpce/QTqWSSntkz2Znrw==} dev: true /@types/pug/2.0.5: @@ -2147,7 +2147,7 @@ packages: supports-esm: 1.0.0 tiny-glob: 0.2.9 yargs-parser: 20.2.9 - zod: 3.9.1 + zod: 3.9.3 transitivePeerDependencies: - coffeescript - less @@ -2179,9 +2179,9 @@ packages: postcss: ^8.1.0 dependencies: browserslist: 4.17.1 - caniuse-lite: 1.0.30001260 + caniuse-lite: 1.0.30001261 fraction.js: 4.1.1 - nanocolors: 0.2.9 + nanocolors: 0.2.11 normalize-range: 0.1.2 postcss: 8.3.8 postcss-value-parser: 4.1.0 @@ -2479,8 +2479,8 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001260 - electron-to-chromium: 1.3.850 + caniuse-lite: 1.0.30001261 + electron-to-chromium: 1.3.851 escalade: 3.1.1 nanocolors: 0.1.12 node-releases: 1.1.76 @@ -2637,10 +2637,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite/1.0.30001260: - resolution: {integrity: sha512-Fhjc/k8725ItmrvW5QomzxLeojewxvqiYCKeFcfFEhut28IVLdpHU19dneOmltZQIE5HNbawj1HYD+1f2bM1Dg==} - dependencies: - nanocolors: 0.1.12 + /caniuse-lite/1.0.30001261: + resolution: {integrity: sha512-vM8D9Uvp7bHIN0fZ2KQ4wnmYFpJo/Etb4Vwsuc+ka0tfGDHvOPrFm6S/7CCNLSOkAUjenT2HnUPESdOIL91FaA==} dev: true /capture-exit/2.0.0: @@ -3358,8 +3356,8 @@ packages: resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: true - /electron-to-chromium/1.3.850: - resolution: {integrity: sha512-ZzkDcdzePeF4dhoGZQT77V2CyJOpwfTZEOg4h0x6R/jQhGt/rIRpbRyVreWLtD7B/WsVxo91URm2WxMKR9JQZA==} + /electron-to-chromium/1.3.851: + resolution: {integrity: sha512-Ak970eGtRSoHTaJkoDjdkeXYetbwm5Bl9pN/nPOQ3QzLfw1EWRjReOlWUra6o58SVgxfpwOT9U2P1BUXoJ57dw==} dev: true /emittery/0.8.1: @@ -4898,8 +4896,8 @@ packages: rgba-regex: 1.0.0 dev: true - /is-core-module/2.6.0: - resolution: {integrity: sha512-wShG8vs60jKfPWpF2KZRaAtvt3a20OAn7+IJ6hLPECpSABLcKtFKTTI4ZtH5QcBruBHlq+WsdHWyz0BCZW7svQ==} + /is-core-module/2.7.0: + resolution: {integrity: sha512-ByY+tjCciCr+9nLryBYcSD50EOGWt95c7tIsKTG1J2ixKKXPvF7Ej3AVd+UfDydAJom3biBGDBALaO79ktwgEQ==} dependencies: has: 1.0.3 dev: true @@ -5674,7 +5672,7 @@ packages: '@jest/transform': 27.2.2 '@jest/types': 27.1.1 '@types/babel__traverse': 7.14.2 - '@types/prettier': 2.4.0 + '@types/prettier': 2.4.1 babel-preset-current-node-syntax: 1.0.1_@babel+core@7.15.5 chalk: 4.1.2 expect: 27.2.2 @@ -6084,8 +6082,8 @@ packages: engines: {node: '>=8'} dev: true - /lowlight/2.2.1: - resolution: {integrity: sha512-KDl2wTuCDk1+aJx/gfi4FPAxRNZ4fDa1zHQ0zpSjEf6qxmBD+1Pk6KriHikaQBshbS9gMIkZ/XCDT6IKAEKDsg==} + /lowlight/2.3.0: + resolution: {integrity: sha512-jt5hnNR6l1dITmu905cYTrM7YywF38Ae+CoGCHegLPmPL+5mmiwlH6Na3aSTW5Ge11z4M06Pn2aOz2pdG3RFSA==} dependencies: '@types/hast': 2.3.4 fault: 2.0.0 @@ -6850,8 +6848,8 @@ packages: resolution: {integrity: sha512-2nMHqg1x5PU+unxX7PGY7AuYxl2qDx7PSrTRjizr8sxdd3l/3hBuWWaki62qmtYm2U5i4Z5E7GbjlyDFhs9/EQ==} dev: true - /nanocolors/0.2.9: - resolution: {integrity: sha512-aymgS4Xe0LMqHOHl7jSUEkFh/6O/pcF0j61dBtreQZ1nmbyYdYjSYSJzz0iPLbKPkMtSmdRgyBGywNZGjKOEfw==} + /nanocolors/0.2.11: + resolution: {integrity: sha512-83ttyvfJj66dKMadWfBkEUOEDFfRc8FpzTJvh1MySR/pzWFmFikTQZGOV6kHZRz7yR/heiQ1y/MHBBN5P/e7WQ==} dev: true /nanoid/3.1.28: @@ -7620,7 +7618,7 @@ packages: resolution: {integrity: sha512-GT5bTjjZnwDifajzczOC+r3FI3Cu+PgPvrsjhQdRqa2kTJ4968/X9CUce9xttIB0xOs5c6xf0TCWZo/y9lF6bA==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanocolors: 0.2.9 + nanocolors: 0.2.11 nanoid: 3.1.28 source-map-js: 0.6.2 dev: true @@ -7983,7 +7981,7 @@ packages: dependencies: '@types/hast': 2.3.4 hast-util-to-text: 3.1.0 - lowlight: 2.2.1 + lowlight: 2.3.0 unified: 10.1.0 unist-util-visit: 4.1.0 dev: true @@ -8198,7 +8196,7 @@ packages: /resolve/1.20.0: resolution: {integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==} dependencies: - is-core-module: 2.6.0 + is-core-module: 2.7.0 path-parse: 1.0.7 dev: true @@ -9704,8 +9702,8 @@ packages: hasBin: true dev: true - /v8-to-istanbul/8.0.0: - resolution: {integrity: sha512-LkmXi8UUNxnCC+JlH7/fsfsKr5AU110l+SYGJimWNkWhxbN5EyeOtm1MJ0hhvqMMOhGwBj1Fp70Yv9i+hX0QAg==} + /v8-to-istanbul/8.1.0: + resolution: {integrity: sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA==} engines: {node: '>=10.12.0'} dependencies: '@types/istanbul-lib-coverage': 2.0.3 @@ -10075,8 +10073,8 @@ packages: engines: {node: '>=10'} dev: true - /zod/3.9.1: - resolution: {integrity: sha512-4h+26dlguuEScIYIEt8icqxVYXDbDAnOMgV2r/RO/0qpb0jJyK/VosUQWi/EF/2MB1HrtBZZxiRQrTbIqVLKeQ==} + /zod/3.9.3: + resolution: {integrity: sha512-xjLdXoS9+b4Cnh/JmjvFF6pjUfrZjVYfQG3yOsN+0ZnT2n0Vi27H0LEid7oPxiP08nwGo4sqARAELVR7QIp9qw==} dev: true /zwitch/1.0.5: diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 918520c..1ac334c 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -3,7 +3,7 @@ - Homepage + { Astro.props?.title ?? "Homepage" } diff --git a/src/pages/[...page].astro b/src/pages/[...page].astro index 95f4f98..cea2960 100644 --- a/src/pages/[...page].astro +++ b/src/pages/[...page].astro @@ -1,7 +1,8 @@ --- // import { Markdown } from 'astro/components'; -import Markdown from "~/components/Markdown"; -import BaseLayout from "~/layouts/BaseLayout"; +// import { Markdown } from 'astro/components'; +import Markdown from "../components/Markdown.astro"; +import BaseLayout from "../layouts/BaseLayout.astro"; import { globby } from 'globby'; import { readFileSync } from "node:fs"; @@ -34,9 +35,11 @@ export async function getStaticPaths() { const {content} = Astro.props; let pathArr = Astro.request.params.page.split("/"); +let title = content.match(/\#{1,6}(.*)/)?.[1]?.trim() ?? "Homepage"; +let pkg = "@okikio/" + pathArr[0]; --- - +

Home{ pathArr.length ? " / " : "" } diff --git a/src/pages/demo/index.astro b/src/pages/demo/index.astro index 0c9005f..e27469f 100644 --- a/src/pages/demo/index.astro +++ b/src/pages/demo/index.astro @@ -1,18 +1,18 @@ --- // import { Markdown } from 'astro/components'; -import Markdown from "~/components/Markdown"; -import BaseLayout from "~/layouts/BaseLayout"; +import Markdown from "../../components/Markdown.astro"; +import BaseLayout from "../../layouts/BaseLayout.astro"; --- - +

Home /

-
-
+
+
- +
\ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index d380fe6..63301db 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,7 +1,7 @@ --- // import { Markdown } from 'astro/components'; -import Markdown from "~/components/Markdown"; -import BaseLayout from "~/layouts/BaseLayout"; +import Markdown from "../components/Markdown.astro"; +import BaseLayout from "../layouts/BaseLayout.astro"; const content = Astro.fetchContent('../../README.md')[0].astro.source; --- diff --git a/src/pages/demo/animate.ts b/src/ts/animate.ts similarity index 87% rename from src/pages/demo/animate.ts rename to src/ts/animate.ts index 614fe90..4206306 100644 --- a/src/pages/demo/animate.ts +++ b/src/ts/animate.ts @@ -1,4 +1,4 @@ -import { animate, tweenAttr, random, queue, AnimateAttributes } from "@okikio/animate"; +import { animate, tweenAttr, random, queue, AnimateAttributes, SpringEasing } from "@okikio/animate"; import { interpolate } from "polymorph-js"; import type { IAnimationOptions, TypePlayStates, Queue, Animate } from "@okikio/animate"; @@ -318,22 +318,52 @@ function playbackFn(containerSel: string, queueInst: Queue) { } */ -(() => { - let queueInst = queue({ - padEndDelay: true, - easing: "ease", - duration: 2000, - loop: 4, +(async () => { + let [translateX, duration] = SpringEasing(["0vw", "50vw"], "spring(5, 100, 10, 1)"); + let el = document.querySelector('#block-2') as HTMLElement; + let opts = await animate({ + target: el, + "translate-x": ["0vw", "50vw"], + // translateX, + // translateY: [0, 500], + // padEndDelay: true, + easing: "linear", + // duration, + // loop: true, speed: 1, + direction: "alternate" }); - - queueInst.add(((): IAnimationOptions => { - let el = document.querySelector('#block') as HTMLElement; - - // To support older browsers I can't use partial keyframes - return { - target: el, - "translate-x": [0, 600] - }; - })(), "= 0"); + await animate({ + options: opts, + "translate-x": ["0vw", "50vw"].reverse(), + }); + + // let queueInst = queue({ + // padEndDelay: true, + // easing: "ease", + // duration, + // loop: true, + // speed: 1, + // direction: "alternate" + // }); + + // queueInst.add(((): IAnimationOptions => { + // let el = document.querySelector('#block') as HTMLElement; + + // // To support older browsers I can't use partial keyframes + // return { + // target: el, + // "translate-x": translateX, + // }; + // })(), "= 0"); + + // queueInst.add(((): IAnimationOptions => { + // let el = document.querySelector('#block-2') as HTMLElement; + + // // To support older browsers I can't use partial keyframes + // return { + // target: el, + // "translate-x": translateX, + // }; + // })(), "< 0"); })(); \ No newline at end of file