Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/native. An initiative which aims to make it easy to create complex, light-weight, and perfor okikio.github.io/native
Something went wrong. Try again.
12!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=>{for(let e in t)return!1;return!0},a=(t,e)=>{let i,s,a=Object.keys(t),n={};for(let r=0,o=a.length;r<o;r++)i=a[r],s=t[i],n[i]=e(s,i,t);return n},n=t=>""+t,r=t=>{let e=parseFloat(t);return n(t).replace(n(e),"")},o=t=>n(t).trim(),l=t=>Array.isArray(t)||"string"==typeof t?("string"==typeof t&&(t=t.split(/\s+/)),t):[t],u=t=>Array.isArray(t)||"string"==typeof t?Boolean(t.length):null!=t&&null!=t&&!Number.isNaN(t),h=t=>"-"==(t=t.replace(/([A-Z])/g,(t=>`-${t.toLowerCase()}`))).charAt(0)?t.substr(1):t,c=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},m=(t,e)=>{let i=[...t],s={};for(let t of i)u(e[t])&&(s[t]=e[t]);return s},g=(...t)=>{let e=0,i=[],s=(t=t.map((t=>{let i=l(t),s=i.length;return s>e&&(e=s),i}))).length;for(let a=0;a<e;a++){i[a]=[];for(let e=0;e<s;e++){let s=t[e][a];u(s)&&(i[a][e]=s)}}return i};var f={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};const d={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,s,a,n,r=t[0]/360,o=t[1]/100,l=t[2]/100;if(0===o)return[n=255*l,n,n];e=2*l-(i=l<.5?l*(1+o):l+o-l*o),a=[0,0,0];for(var u=0;u<3;u++)(s=r+1/3*-(u-1))<0?s++:s>1&&s--,n=6*s<1?e+6*(i-e)*s:2*s<1?i:3*s<2?e+(i-e)*(2/3-s)*6:e,a[u]=255*n;return a}};var y={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};const b=t=>{var e,i,s=[],a=1;if("string"==typeof t)if(f[t])s=f[t].slice(),i="rgb";else if("transparent"===t)a=0,i="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var n=t.slice(1);a=1,(l=n.length)<=4?(s=[parseInt(n[0]+n[0],16),parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16)],4===l&&(a=parseInt(n[3]+n[3],16)/255)):(s=[parseInt(n[0]+n[1],16),parseInt(n[2]+n[3],16),parseInt(n[4]+n[5],16)],8===l&&(a=parseInt(n[6]+n[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),i="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var r=e[1],o="rgb"===r;i=n=r.replace(/a$/,"");var l="cmyk"===n?4:"gray"===n?1:3;s=e[2].trim().split(/\s*[,\/]\s*|\s+/).map((function(t,e){if(/%$/.test(t))return e===l?parseFloat(t)/100:"rgb"===n?255*parseFloat(t)/100:parseFloat(t);if("h"===n[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==y[t])return y[t]}return parseFloat(t)})),r===n&&s.push(1),a=o||void 0===s[l]?1:s[l],s=s.slice(0,l)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi).join("").toLowerCase());else Number.isNaN(t)?Array.isArray(t)||t.length?(s=[t[0],t[1],t[2]],i="rgb",a=4===t.length?t[3]:1):t instanceof Object&&(null!=t.r||null!=t.red||null!=t.R?(i="rgb",s=[t.r||t.red||t.R||0,t.g||t.green||t.G||0,t.b||t.blue||t.B||0]):(i="hsl",s=[t.h||t.hue||t.H||0,t.s||t.saturation||t.S||0,t.l||t.lightness||t.L||t.b||t.brightness]),a=t.a||t.alpha||t.opacity||1,null!=t.opacity&&(a/=100)):(i="rgb",s=[t>>>16,(65280&t)>>>8,255&t]);return{space:i,values:s,alpha:a}},S=t=>{Array.isArray(t)&&t.raw&&(t=String.raw(...arguments));var e,i=b(t);return i.space?((e=Array(3))[0]=Math.min(Math.max(i.values[0],0),255),e[1]=Math.min(Math.max(i.values[1],0),255),e[2]=Math.min(Math.max(i.values[2],0),255),"h"===i.space[0]&&(e=d.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e):[]},E=()=>({document:"document"in globalThis?globalThis.document:{},CSS:"CSS"in globalThis?globalThis.CSS:{}}),k=()=>E().document,A=()=>E().CSS,O=t=>"string"==typeof t?t.includes("%")?parseFloat(t)/100:"from"==t?0:"to"==t?1:parseFloat(t):t,w=t=>{let e=new Set,i=Object.keys(t),s=i.length;for(let a=0;a<s;a++){let s=""+i[a],n=t[s],r=s.split(","),o=r.length;for(let t=0;t<o;t++){let i=O(r[t]);e.add({...n,offset:i})}}return[...e].sort(((t,e)=>t.offset-e.offset))},v={};class I{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 D=(t,e,...i)=>{t.forEach((t=>{t[e](...i)}))},x=(t="")=>e=>"string"==typeof e?e:`${e}${t}`,M=x(),C=x("px"),P=x("deg"),N=t=>e=>u(e)?l(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)})):[],T=(t,e)=>l(t).map(N(e)),F=N(M),j=N(C),q=N(P),z=new I,R=(t="transparent")=>{let e;if(t=t.trim(),z.has(t))return z.get(t);if(s(A())&&(e=S(t)),!s(k())){if(!A()?.supports("background-color",t))return t;let i=k()?.createElement("div");i.style.backgroundColor=t,k()?.body.appendChild(i);let{backgroundColor:s}=globalThis?.getComputedStyle?.(i);i.remove();let a=/\(([^)]+)\)?/.exec(s)?.[1].split(",");e=(3==a.length?[...a,"1"]:a).map((t=>parseFloat(t)))}return z.set(t,e),e},_={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"},L="registerProperty"in A(),V=Object.keys(_),U=(t={})=>Object.keys(t).filter((t=>V.includes(t))).map((t=>{if(!L)return"";let e=[].concat(_[t]);return e.forEach((t=>{if(globalThis.RegisteredCSSVars?.[t])return;let e={name:t,inherits:!1};/translate|perspective/i.test(t)?A()?.registerProperty?.({...e,syntax:"<length-percentage>",initialValue:"0px"}):/rotate3d3|skew/i.test(t)?A()?.registerProperty?.({...e,syntax:"<angle>",initialValue:"0deg"}):/scale|rotate3d/i.test(t)?A()?.registerProperty?.({...e,syntax:"<number>",initialValue:/rotate3d/i.test(t)?0:1}):/rotate/i.test(t)&&A()?.registerProperty?.({...e,syntax:"<angle>",initialValue:"0deg"}),globalThis.RegisteredCSSVars??={},globalThis.RegisteredCSSVars[t]=!0})),`${t}(${e.map((t=>`var(${t})`))})`})).join(" "),K=(t={})=>{let e={};return V.forEach((i=>{if(!(i in t))return;let s=[].concat(t[i]).filter((t=>u(t))).map((t=>"string"==typeof t&&/\s/.test(t.trim())?t.split(/\s+/):t));if(0==s.length)return;let a=[].concat(_[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?g(...s)[a]:s;if(u(o)){let i=t;/translate|perspective/i.test(i)?o=j(o):/rotate3d3|skew/i.test(i)?o=q(o):/scale|rotate3d/i.test(i)||/rotate/i.test(i)&&(o=q(o)),e[t]=o}}))})),e},Y=4,X=.001,$=1e-7,G=10,Z=11,B=1/(Z-1),Q="function"==typeof Float32Array,H=(t,e)=>1-3*e+3*t,W=(t,e)=>3*e-6*t,J=t=>3*t,tt=(t,e,i)=>((H(e,i)*t+W(e,i))*t+J(e))*t,et=(t,e,i)=>3*H(e,i)*t*t+2*W(e,i)*t+J(e),it=(t,e,i,s,a)=>{let n,r,o=0;do{r=e+(i-e)/2,n=tt(r,s,a)-t,n>0?i=r:e=r}while(Math.abs(n)>$&&++o<G);return r},st=(t,e,i,s)=>{for(var a=0;a<Y;++a){let a=et(e,i,s);if(0===a)return e;e-=(tt(e,i,s)-t)/a}return e},at=(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=Q?new Float32Array(Z):new Array(Z),n=0;n<Z;++n)a[n]=tt(n*B,t,i);return n=>0===n||1===n?n:tt((e=>{let s=0,n=1,r=Z-1;for(;n!==r&&a[n]<=e;++n)s+=B;--n;let o=s+(e-a[n])/(a[n+1]-a[n])*B,l=et(o,t,i);return l>=X?st(e,o,t,i):0===l?o:it(e,s,s+B,t,i)})(n),e,s)},nt=(t,e,i)=>Math.min(Math.max(t,e),i),rt=t=>Math.pow(t,2),ot=t=>Math.pow(t,3),lt=t=>Math.pow(t,4),ut=t=>Math.pow(t,5),ht=t=>Math.pow(t,6),ct=t=>1-Math.cos(t*Math.PI/2),pt=t=>1-Math.sqrt(1-t*t),mt=t=>t*t*(3*t-2),gt=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)},ft=(t,e=[])=>{let[i=1,s=.5]=e;const a=nt(i,1,10),n=nt(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)},dt=(t,e=[],i)=>{let[s=1,a=100,n=10,r=0]=e;s=nt(s,.1,1e3),a=nt(a,.1,1e3),n=nt(n,.1,1e3),r=nt(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},yt=new Map,bt=1e4,St=(t="spring")=>{if(yt.has(t))return yt.get(t);const e="function"==typeof t?t:Ct(t),i="function"==typeof t?[]:Pt(t),s=1/6;let a=0,n=0,r=0;for(;++r<bt;)if(a+=s,1===e(a,i,null)){if(n++,n>=16)break}else n=0;const o=a*s*1e3;return yt.set(t,o),o},Et=(t,e=[])=>{let[i=10,s]=e;return("start"==s?Math.ceil:Math.floor)(nt(t,0,1)*i)/i},kt=(t,e=[])=>{let[i,s,a,n]=e;return at(i,s,a,n)(t)},At=at(.42,0,1,1),Ot=t=>(e,i=[],s)=>1-t(1-e,i,s),wt=t=>(e,i=[],s)=>e<.5?t(2*e,i,s)/2:1-t(-2*e+2,i,s)/2,vt=t=>(e,i=[],s)=>e<.5?(1-t(1-2*e,i,s))/2:(t(2*e-1,i,s)+1)/2,It={steps:Et,"step-start":t=>Et(t,[1,"start"]),"step-end":t=>Et(t,[1,"end"]),linear:t=>t,"cubic-bezier":kt,ease:t=>kt(t,[.25,.1,.25,1]),in:At,out:Ot(At),"in-out":wt(At),"out-in":vt(At),"in-quad":rt,"out-quad":Ot(rt),"in-out-quad":wt(rt),"out-in-quad":vt(rt),"in-cubic":ot,"out-cubic":Ot(ot),"in-out-cubic":wt(ot),"out-in-cubic":vt(ot),"in-quart":lt,"out-quart":Ot(lt),"in-out-quart":wt(lt),"out-in-quart":vt(lt),"in-quint":ut,"out-quint":Ot(ut),"in-out-quint":wt(ut),"out-in-quint":vt(ut),"in-expo":ht,"out-expo":Ot(ht),"in-out-expo":wt(ht),"out-in-expo":vt(ht),"in-sine":ct,"out-sine":Ot(ct),"in-out-sine":wt(ct),"out-in-sine":vt(ct),"in-circ":pt,"out-circ":Ot(pt),"in-out-circ":wt(pt),"out-in-circ":vt(pt),"in-back":mt,"out-back":Ot(mt),"in-out-back":wt(mt),"out-in-back":vt(mt),"in-bounce":gt,"out-bounce":Ot(gt),"in-out-bounce":wt(gt),"out-in-bounce":vt(gt),"in-elastic":ft,"out-elastic":Ot(ft),"in-out-elastic":wt(ft),"out-in-elastic":vt(ft),spring:dt,"spring-in":dt,"spring-out":Ot(dt),"spring-in-out":wt(dt),"spring-out-in":vt(dt)};t.EasingFunctionKeys=Object.keys(It);const Dt=(e,i)=>{Object.assign(It,{[e]:i}),t.EasingFunctionKeys=Object.keys(It)},xt=(...e)=>{Object.assign(It,...e),t.EasingFunctionKeys=Object.keys(It)},Mt=t=>h(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim(),Ct=e=>{let i=Mt(n(e));return t.EasingFunctionKeys.includes(i)?It[i]:null},Pt=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})):[]},Nt=(t,e,i)=>e+(i-e)*t,Tt=(t,e)=>Math.round(t*10**e)/10**e,Ft=(t,e,i=3)=>{let s=e.length-1,a=nt(Math.floor(t*s),0,s-1),n=e[a],r=e[a+1];return Tt(Nt((t-a/s)*s,n,r),i)},jt=t=>{let e=parseFloat(t);return"number"==typeof e&&!Number.isNaN(e)},qt=(t,e)=>{t=nt(t,0,1);let i=e.length-1;return e[Math.round(t*i)]},zt=(t,e,i=3)=>{let s="";return jt(e[0])&&(s=r(e[0])),Ft(t,e.map((t=>"number"==typeof t?t:parseFloat(t))),i)+s},Rt=(t,e,i=3)=>g(...e.map((t=>R(t)))).map(((e,s)=>{let a=Ft(t,e);return s<3?Math.round(a):Tt(a,i)})),_t=t=>o(t).replace(/(\d|\)|\w)\s/g,(t=>t[0]+"__")).split("__").map(o).filter(u),Lt=(t,e,i=3)=>e.every((t=>"number"==typeof t))?Ft(t,e,i):e.every((t=>s(A())?u(S(t??null)):A()?.supports?.("color",n(t))))?`rgba(${Rt(t,e,i)})`:e.some((t=>"string"==typeof t))?e.some((t=>/(\d|\)|\w)\s/.test(o(t))))?g(...e.map(_t)).map((e=>Lt(t,e,i))).join(" "):e.every((t=>jt(t)))?zt(t,e,i):qt(t,e):void 0,Vt=(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}},Ut=new Map,Kt=({easing:t,numPoints:e,duration:i}={})=>{const s=[],a=`${t}${e}`;if(Ut.has(a))return Ut.get(a);const n="function"==typeof t?t:Ct(t),r="function"==typeof t?[]:Pt(t);for(let t=0;t<e;t++)s[t]=n(t/(e-1),r,i);return Ut.set(a,s),s},Yt=(t={})=>{if("string"==typeof t.easing){let e=Mt(t.easing);/(spring|spring-in)$/i.test(e)&&(t.duration=St(t.easing))}},Xt=(t,e={})=>{let i=Vt(e);return Yt(i),Kt(i).map((e=>Lt(e,t,i.decimal)))},$t=(t,e={})=>{let i=Vt(e),{duration:s}=i;return Yt(i),[Xt(t,i),u(s)?s:i.duration]},Gt=(t={})=>{let{easing:e,numPoints:i,decimal:s,duration:n,...r}=t,o={easing:e,numPoints:i,decimal:s,duration:n};Yt(o);let l=a(r,(t=>Xt(t,o))),h={};return u(n)?h={duration:n}:u(o.duration)&&(h={duration:o.duration}),Object.assign({},l,h)},Zt={translate:t=>T(t,C),translate3d:t=>T(t,C),translateX:t=>j(t),translateY:t=>j(t),translateZ:t=>j(t),rotate:t=>T(t,P),rotate3d:t=>T(t,M),rotateX:t=>q(t),rotateY:t=>q(t),rotateZ:t=>q(t),scale:t=>T(t,M),scale3d:t=>T(t,M),scaleX:t=>F(t),scaleY:t=>F(t),scaleZ:t=>F(t),skew:t=>T(t,P),skewX:t=>q(t),skewY:t=>q(t),perspective:t=>j(t)},Bt=Object.keys(Zt),Qt=t=>{let e,i,s=Object.keys(t),a={};for(let n=0,r=s.length;n<r;n++)e=c(s[n]),i=t[s[n]],a[e]=i;return a},Ht=(t,e)=>{let i="",s=t.length;for(let a=0;a<s;a++){let s=t[a],n=e[a];u(n)&&(i+=`${s}(${Array.isArray(n)?n.join(", "):n}) `)}return i.trim()},Wt=["margin","padding","size","width","height","left","right","top","bottom","radius","gap","basis","inset","outline-offset","translate","perspective","thickness","position","distance","spacing"].map(c).join("|"),Jt=(t,e)=>(e=e??Math.max(...t.map((t=>t.length))),t.map((t=>{let i=t.length;return t.every((t=>Array.isArray(t)))?g(...Jt(g(...t),e)):i!==e?Array.from(Array(e),((s,a)=>{let n=1==i?Array(2).fill(t[0]):t;return zt(a/(e-1),n)})):t}))),te=(t,e=!1)=>{let i,r,l=Qt(t);if(L&&e)i=Object.assign({},p(V,l),K(l));else{let t=Object.keys(l).filter((t=>Bt.includes(t))),e=t.map((t=>Zt[t](l[t])));e=Jt(e),r=g(...e).filter(u).map((e=>Ht(t,e))),i=p(Bt,l)}return i=a(i,((t,e)=>{let i;if(!/color|shadow/i.test(e)){let a=/rotate/i.test(e),n=new RegExp(Wt,"i").test(e)||!s(A())&&A()?.supports?.(h(e),"1px");if(a||n)return a?i=q:n&&(i=j),i(t).map((t=>{let e=o(t).split(/\s+/);return i(e).join(" ")}))}return[].concat(t).map(n)})),Object.assign({},u(r)?{transform:r}:null,i)},ee=(t,e=!1)=>t.map((t=>{let i=Qt(t);if(L&&e)return{rest:Object.assign({},K(i),p(V,i)),transformFunctions:null};let{translate:s,translate3d:a,translateX:n,translateY:r,translateZ:o,rotate:l,rotate3d:u,rotateX:h,rotateY:c,rotateZ:m,scale:g,scale3d:f,scaleX:d,scaleY:y,scaleZ:b,skew:S,skewX:E,skewY:k,perspective:A,...O}=i;return s=j(s),a=j(a),n=j(n)[0],r=j(r)[0],o=j(o)[0],l=q(l),u=F(u),h=q(h)[0],c=q(c)[0],m=q(m)[0],g=F(g),f=F(f),d=F(d)[0],y=F(y)[0],b=F(b)[0],S=q(S),E=q(E)[0],k=q(k)[0],A=j(A)[0],{rest:O,transformFunctions:[a,s,n,r,o,u,l,h,c,m,f,g,d,y,b,S,E,k,A]}})).map((({rest:t,transformFunctions:e})=>{let i=L?null:Ht(Bt,e);return t=a(t,((t,e)=>{let i;if(t=n(t),!/color|shadow/i.test(e)){let s=/rotate/i.test(e),a=new RegExp(Wt,"i").test(e);if(s||a)return s?i=q:a&&(i=j),i(t).join(" ")}return t})),Object.assign({},u(i)?{transform:i}:null,t)})),ie=({callback:t=(()=>{}),scope:e=null,name:i="event"})=>({callback:t,scope:e,name:i});class se extends I{constructor(t="event"){super(),this.name=t}}const ae=t=>"object"==typeof t&&!Array.isArray(t)&&"function"!=typeof t;class ne extends I{constructor(){super()}getEvent(t){let e=this.get(t);return e instanceof se?e:(this.set(t,new se(t)),this.get(t))}newListener(t,e,i){let s=this.getEvent(t);return s.add(ie({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=ae(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 se&&e){let a=ie({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=ae(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=ae(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 se&&i.forEach((t=>{let{callback:i,scope:s}=t;i.apply(s,e)}))}),this)),this}clear(){return D(this,"clear"),super.clear(),this}}const re=t=>"string"==typeof t?Array.from(k()?.querySelectorAll?.(t)):[t],oe=t=>Array.isArray(t)?e(t.map(oe)):"string"==typeof t||t instanceof Node?re(t):t instanceof NodeList||t instanceof HTMLCollection?Array.from(t):[],le=(t,e,i)=>"function"==typeof t?t.apply(i,e):t,ue=(t,e,i)=>a(t,(t=>le(t,e,i))),he={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)"},ce=Object.keys(he),pe=(t="ease")=>{let e=h(t).replace(/^ease-/,"");return ce.includes(e)?he[e]:t},me={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:k()?.timeline,extend:{}},ge=t=>{let{options:e,...i}=t,s=e instanceof Se?e.options:Array.isArray(e)?e?.[0]?.options:e;return Object.assign({},s,i)},fe=["easing","loop","endDelay","duration","speed","delay","timelineOffset","direction","extend","fillMode","composite"],de=["keyframes","padEndDelay","persist","onfinish","oncancel","autoplay","target","targets","timeline"],ye=[...fe,...de],be=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 ne,this.targets=new I,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(),be.pauseOnPageHidden&&k()?.addEventListener("visibilitychange",this.onVisibilityChange,!1)),this.newPromise()}static requestFrame(t=0){let e=1e3/be.FRAME_RATE,i=t-be.FRAME_START_TIME;i>e&&(be.FRAME_START_TIME=t-i%e,be.RUNNING.forEach((t=>{t.emitter.getEvent("update").length<=0?t.stopLoop():t.loop()}))),be.RUNNING.size>0?be.animationFrame=window.requestAnimationFrame(be.requestFrame):be.cancelFrame()}static cancelFrame(){window.cancelAnimationFrame(be.animationFrame),be.animationFrame=null}loop(){return this.emit("update",this.getProgress(),this),this}stopLoop(){return be.RUNNING.delete(this),this}onVisibilityChange(){k()?.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(),be.RUNNING.add(this),be.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.targets.forEach((t=>{let e=this.computedKeyframes.get(t);Array.isArray(e)&&e.length?a(e[e.length-1],((e,i)=>{t.style.setProperty(i,e)})):a(e,((e,i)=>{!e.length||"offset"==i||t.style.setProperty(i,e[e.length-1])}))})),this}cancel(){return this.all((t=>t.cancel())),this}finish(){return this.all((t=>t.finish())),this}stop(){this.cancel(),this.stopLoop(),k()?.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"string"==typeof t&&(t=Number(t)),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]??me[e];return"function"!=typeof i?i:me[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]??me[e]})),l=ue(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=>pe(t))):pe(t)}!0===l.iterations&&(l.iterations=1/0);let{timelineOffset:u,speed:h,endDelay:c,delay:p,duration:m,iterations:g,...f}=l;u=Number(u),g=Number(g),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<m&&(this.maxDuration=m),this.maxEndDelay<c&&(this.maxEndDelay=c);let d=p+u+m*g+c;this.totalDuration<d&&(this.totalDuration=d,this.totalDurationOptions={delay:p,duration:m,totalDuration:d,iterations:g,endDelay:c,speed:h,timelineOffset:u}),i[n]={...f,speed:h,tempDurations:d,endDelay:c,delay:p,duration:m,iterations:g,timelineOffset:u}}),this),i}createAnimations(t,e){let{arrOfComputedOptions:s,padEndDelay:n,oldCSSProperties:r,onfinish:o,oncancel:l,persist:h,timeline:c}=t;this.targets.forEach(((t,m)=>{let g,{speed:f,keyframes:d,tempDurations:y,timelineOffset:b,...S}=s[m];n&&0==S.endDelay&&Math.abs(S.iterations)!=Math.abs(1/0)&&(S.endDelay=this.totalDuration-y);let E,k,A=d;i(A)&&(A=w(A));let v,I,D=this.computedKeyframes.get(t)??{},x="transform"in this.properties?D:p(["transform"],D),M=Object.assign({},r,x),C=a(M,((t,e)=>this.properties[e]??t));if(k=u(A)?A:C,Array.isArray(k))E=k.map((t=>{let{easing:e,offset:i,...s}=p(["speed","loop"],t);return Object.assign({},s,"string"==typeof e?{easing:pe(e)}:null,"string"==typeof i||"number"==typeof i?{offset:O(i)}:null)})),g=U(_),E=ee(E,be.USE_CSS_VARS);else{let i=p(["keyframes"],k),{offset:s,...a}=ue(i,[m,e,t],this);g=U(Qt(a));let n=te(a,be.USE_CSS_VARS),r=s;E=Object.assign({},n,u(r)?{offset:r.map((t=>O(t)))}:null)}this.keyframeEffects.has(t)?(I=this.keyframeEffects.get(t),v=this.animations.get(I),I?.setKeyframes?.(E),I?.updateTiming?.(S)):(I=new KeyframeEffect(t,E,S),v=new Animation(I,c),this.keyframeEffects.set(t,I),this.animations.set(I,v)),"string"==typeof f&&(f=Number(f)),v.updatePlaybackRate?v.updatePlaybackRate(f):v.playbackRate=f,v.onfinish=()=>{h&&(Array.isArray(E)&&E.length?a(E[E.length-1],((e,i)=>{t.style.setProperty(i,e)})):a(E,((e,i)=>{!e.length||"offset"==i||t.style.setProperty(i,e[e.length-1])}))),"function"==typeof o&&o.call(this,t,m,e,v)},v.oncancel=()=>{"function"==typeof l&&l.call(this,t,m,e,v)},L&&be.USE_CSS_VARS&&Object.assign(t?.style,{transform:g}),this.computedOptions.set(t,S),this.computedKeyframes.set(t,E)}))}updateOptions(t={}){try{let e=ge(t);this.initialOptions=e,this.options=Object.assign({},me,this.options,e);let{padEndDelay:i,autoplay:s,target:a,targets:n,timeline:r,persist:o,onfinish:l,oncancel:u,...h}=p(fe,this.options);this.properties=p(ye,e);let c=this.targets.values(),m=[...new Set([...c,...oe(n),...oe(a)])];this.targets.clear(),m.forEach(((t,e)=>{this.targets.set(e,t),this.targetIndexes.set(t,e)}));let g=this.targets.size,f=this.createArrayOfComputedOptions(e,g);if(this.createAnimations({arrOfComputedOptions:f,padEndDelay:i,oldCSSProperties:h,onfinish:l,oncancel:u,persist:o,timeline:r},g),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&&(be.RUNNING.add(this),null==be.animationFrame&&be.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 Se=be;Se.RUNNING=new Set,Se.FRAME_RATE=60,Se.FRAME_START_TIME=0,Se.pauseOnPageHidden=!0,Se.USE_CSS_VARS=!1;const Ee=(t={})=>new Se(t);t.UIDCount=0;const ke=k()?.createElement?.("div"),Ae=()=>{u(ke.id)||(ke.id="empty-tween-el-container",ke.style.setProperty("display","none"),ke.style.setProperty("contain","paint layout size"),k()?.body?.appendChild(ke));let e=k()?.createElement?.("div");return e.id="empty-animate-el-"+t.UIDCount++,e.style.setProperty("display","none"),ke.appendChild(e),e};class Oe extends Se{stop(){this.targets.forEach((t=>t?.remove?.())),super.stop()}}const we=(e={})=>{let{easing:i,decimal:s,numPoints:a,opacity:n,...r}=ge(e),o=m(ye,r),l=i;if("string"==typeof i){let e=Mt(i);l=ce.includes(e)||["linear","steps","step-start","step-end"].includes(e)?pe(i):t.EasingFunctionKeys.includes(e)?Ct(i):i}return{..."function"==typeof l?Gt({opacity:[0,1],easing:i,decimal:s,numPoints:a}):{opacity:[0,1],easing:i},...o}};class ve extends Oe{constructor(){super(...arguments),this.updateListeners=new I}updateOptions(t={}){let e=ge(t),i=this.targets.size>1?null:{target:Ae()},s=Object.assign({},we(p(["target","targets"],e)),i);super.updateOptions(s);let n=p(ye,e);try{this.updateListeners=this.updateListeners??new I,this.updateListeners.forEach(((t,e)=>{this.off("update",t),this.updateListeners.remove(e)}),this);let{target:t,targets:i}=e,s=[...new Set([...oe(i),...oe(t)])],r=s.length,o=this.targets.get(0),l=window.getComputedStyle(o);s.forEach(((t,i)=>{a(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):Lt(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 Ie=(t={})=>new ve(t),De=(t,e={})=>{const{grid:i,axis:s,from:a=0,easing:n,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=r(l?t[u]:t)||0,g="function"==typeof n?n:Ct(n),f="function"==typeof n?[]:Pt(n);let d,y=[],b=0,S=a;return/from/i.test(a)&&(S=0),(t,e)=>{if(/center/i.test(a)&&(S=(e-1)/2),/last/i.test(a)&&(S=e-1),0==y.length){for(let t=0;t<e;t++)if(Array.isArray(i)){const e="center"!==a?S%i[0]:(i[0]-1)/2,n="center"!==a?Math.floor(S/i[0]):(i[1]-1)/2,r=e-t%i[0],o=n-Math.floor(t/i[0]);let l;l="x"===s?-r:"y"===s?-o:Math.sqrt(r*r+o*o),y.push(l)}else y.push(Math.abs(S-t));b=Math.max(...y),d=l?(c-h)/b:h,"function"==typeof g&&(y=y.map((t=>g(t/b,f)*b))),/reverse/i.test(o)&&y.reverse()}return p+d*(Math.round(100*y[t])/100)+m}},xe=(t,e={})=>{let i=e.stagger??{};return(s,a)=>{let n=t.map(((e,n)=>{let r=t[Math.max(0,n-1)];return De([r,e],i)(s,a)}));return Xt(n,e)}},Me=(t,e)=>Math.floor(Math.random()*(e-t+1))+t,Ce=(t,e)=>"string"==typeof t?/^\=/.test(t)?parseFloat(t.replace("=","")):parseFloat(t)+e:t+e;class Pe{constructor(t={}){this.animateInstances=new I,this.initialOptions={},this.mainInstance=new Se({duration:0}),this.initialOptions=Object.assign({},me,ge(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=ge(t)}get emitter(){return this.mainInstance.emitter}get promise(){return this.mainInstance.promise}add(t={},e=0){let i,s=Object.assign({},me,this.initialOptions,t instanceof Se?t.initialOptions:ge(t));if(Math.abs(this.totalDuration)!==1/0){let t=""+e;if(/^\^/.test(t)){let e=this.animateInstances.last()?.totalDuration??0;Math.abs(e)!==1/0&&(s.timelineOffset=Ce("^"==t.trim()?0:t.replace(/^\^/,""),this.totalDuration-e))}else s.timelineOffset=Ce(e,this.totalDuration)}return s.autoplay=this.initialOptions.autoplay,t instanceof Se?(i=t,i.updateOptions(s)):i=new Se(s),this.animateInstances.add(i),this.updateTiming(),this}updateTiming(){let t=this.animateInstances.values(),e=Math.max(...t.map((t=>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;i<e;i++){let t=this.animateInstances.get(i);t.updateOptions({timelineOffset:t.timelineOffset-n})}return this.animateInstances.remove(t),this.updateTiming(),i}return null}then(t,e){return t=t?.bind(this),e=e?.bind(this),this.mainInstance?.then?.(t,e),this}catch(t){return t=t?.bind(this),this.mainInstance?.catch?.(t),this}finally(t){return t=t?.bind(this),this.mainInstance?.finally?.(t),this}allInstances(t){return this.animateInstances.forEach(t),this}all(t){return this.mainInstance&&t(this.mainInstance),this.allInstances(t),this}play(){return this.all((t=>t.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 Ne=(t={})=>new Pe(t);t.ALL_ANIMATION_CONFIG_KEYS=ye,t.Animate=Se,t.AnimateAttributes=ve,t.ApplyCustomEasing=Gt,t.Back=mt,t.Bezier=kt,t.Bounce=gt,t.CSSArrValue=T,t.CSSCamelCase=Qt,t.CSSPXDataType=Wt,t.CSSValue=N,t.CSSVarSupport=L,t.CSS_CACHE=z,t.Circ=pt,t.ComplexEasingSyntax=Mt,t.ComplexStrtoArr=_t,t.Cubic=ot,t.CustomEasing=Xt,t.CustomEasingOptions=Vt,t.DefaultAnimationOptions=me,t.DestroyableAnimate=Oe,t.EASINGS=he,t.EFFECTS=v,t.EaseInOut=wt,t.EaseOut=Ot,t.EaseOutIn=vt,t.EasingDurationCache=yt,t.EasingFunctions=It,t.EasingKeys=ce,t.EasingPts=Kt,t.Elastic=ft,t.EmptyTweenElContainer=ke,t.Expo=ht,t.FUNCTION_SUPPORTED_ANIMATION_CONFIG_KEYS=fe,t.GetEase=pe,t.GetEasingFunction=Ct,t.INTINITE_LOOP_LIMIT=bt,t.KeyframeParse=w,t.NON_FUNCTION_SUPPORTED_ANIMATION_CONFIG_KEYS=de,t.ParseTransformableCSSKeyframes=ee,t.ParseTransformableCSSProperties=te,t.Quad=rt,t.Quart=lt,t.Queue=Pe,t.Quint=ut,t.Sine=ct,t.Spring=dt,t.SpringEasing=$t,t.StaggerCustomEasing=xe,t.Steps=Et,t.TransformFunctionNames=Bt,t.TransformFunctions=Zt,t.TweenCache=Ut,t.UnitDEG=P,t.UnitDEGCSSValue=q,t.UnitLess=M,t.UnitLessCSSValue=F,t.UnitPX=C,t.UnitPXCSSValue=j,t.addCSSUnit=x,t.animate=Ee,t.arrFill=Jt,t.camelCase=c,t.computeOption=le,t.convertToDash=h,t.createEmptyEl=Ae,t.createTransformProperty=Ht,t.createTransformValue=U,t.createTweenOptions=we,t.easein=At,t.flatten=e,t.getBrowserObject=E,t.getCSS=A,t.getDocument=k,t.getEasingDuration=St,t.getElements=re,t.getTargets=oe,t.getUnit=r,t.hsl=d,t.interpolateColor=Rt,t.interpolateComplex=Lt,t.interpolateNumber=Ft,t.interpolateString=zt,t.interpolateUsingIndex=qt,t.isEmpty=s,t.isNumberLike=jt,t.isObject=i,t.isValid=u,t.limit=nt,t.mapAnimationOptions=ue,t.mapObject=a,t.omit=p,t.parse=b,t.parseEasingParameters=Pt,t.parseOffset=O,t.parseOptions=ge,t.pick=m,t.queue=Ne,t.random=Me,t.registerEasingFunction=Dt,t.registerEasingFunctions=xt,t.relativeTo=Ce,t.rgba=S,t.scale=Nt,t.stagger=De,t.toArr=l,t.toCSSVars=K,t.toFixed=Tt,t.toRGBAArr=R,t.toStr=n,t.transformCSSVars=_,t.transformProperyNames=V,t.transpose=g,t.trim=o,t.tweenAttr=Ie,Object.defineProperty(t,"__esModule",{value:!0})}));