Socket
Socket
Sign inDemoInstall

motion

Package Overview
Dependencies
Maintainers
1
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

motion - npm Package Compare versions

Comparing version 10.0.3 to 10.1.0

dist/size-webpack-animate.js

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Changelog

## [10.1.0] [2021-09-27]
### New
- **Duration:** The duration of timelines is usually automatically calculated from its defined animations. It can now be read from the new read-only `duration` prop on [animation controls](http://motion.dev/dom/controls).
### Changed
- **Performance:** Before Motion One starts a new animation, it stops the old one. Stopping an animation commits its styles, which can cause a style recalculation. Now, when an animation finishes, we delete the reference to the old animation. Additionally, we check the animation status isn't `"finished"` before committing styles within `stop`. This prevents unnecessary style recalculations.
## [10.0.3] [2021-09-25]

@@ -7,0 +17,0 @@

2

dist/motion.min.js

@@ -1,1 +0,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).Motion={})}(this,(function(t){"use strict";const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{activeTransforms:[],activeAnimations:{}}),e.get(t)}function i(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const a=()=>{},s=t=>t,r=["","X","Y","Z"],o={x:"translateX",y:"translateY",z:"translateZ"},c={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},l={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:c,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:s},skew:c},u=new Map,f=t=>`--motion-${t}`,h=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{r.forEach((e=>{h.push(t+e),u.set(f(t+e),l[t])}))}));const p=(t,e)=>h.indexOf(t)-h.indexOf(e),m=new Set(h),y=t=>t.sort(p).reduce(d,"").trim(),d=(t,e)=>`${t} ${e}(var(${f(e)}))`,g=t=>t.startsWith("--"),v=new Set;const b=t=>1e3*t;function x(t){try{t.commitStyles(),t.cancel()}catch(t){}}const O=t=>Array.isArray(t)&&"number"!=typeof t[0],T=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?w(t):t,w=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,S=t=>document.createElement("div").animate(t,{duration:.001}),M={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{S({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(S({opacity:[0,1]}).finished)},A={},j=Object.keys(M).reduce(((t,e)=>(t[e]=()=>(void 0===A[e]&&(A[e]=M[e]()),A[e]),t)),{}),P={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},k=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function D(t,e,n,i){if(t===e&&n===i)return s;const a=e=>function(t,e,n,i,a){let s,r,o=0;do{r=e+(n-e)/2,s=k(r,i,a)-t,s>0?n=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:k(a(t),e,i)}var E=function(t,e,n){var i=e-t;return 0===i?1:(n-t)/i},V=function(t,e,n){return-n*t+n*e+t},$=function(t,e){return void 0===e&&(e="end"),function(n){var i,a,s,r=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(r):Math.ceil(r);return i=0,a=1,s=o/t,Math.min(Math.max(s,i),a)}};const R={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},U=/\((.*?)\)/;function W(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(R[t])return R[t];if(t.startsWith("steps")){const e=U.exec(t);if(e){const t=e[1].split(",");return $(parseFloat(t[0]),t[1].trim())}}return s}function F(t,e){return O(t)?t[(n=0,i=t.length,a=e,s=i-n,((a-n)%s+s)%s+n)]:t;var n,i,a,s}function q(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=E(0,e,i);t.push(V(n,1,a))}}function C(t){const e=[0];return q(e,t-1),e}function z(t,e=C(t.length),n=s){const i=t.length,a=i-e.length;return a>0&&q(e,a),a=>{let s=0;for(;s<i-2&&!(a<e[s+1]);s++);let r=(o=E(e[s],e[s+1],a),Math.min(1,Math.max(o,0)));var o;return r=F(n,s)(r),V(t[s],t[s+1],r)}}class K{constructor(t,e,{easing:n=P.easing,duration:i=P.duration,delay:a=P.delay,endDelay:s=P.endDelay,offset:r,repeat:o=P.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=i*(o+1),u=z(e,r,O(n)?n.map(W):W(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-a,0);const r=n/i;let o=Math.floor(r),f=r%1;!f&&r>=1&&(f=1),1===f&&o--;const h=o%2;("reverse"===c||"alternate"===c&&h||"alternate-reverse"===c&&!h)&&(f=1-f);const p=n>=l?1:Math.min(f,1),m=u(p);t(m);n>=l+s?(this.playState="finished",this.resolve(m)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const X=(t,e)=>{let n=g(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=u.get(e);t&&(n=t.initialValue)}return n};const Y=t=>Array.isArray(t)?t:[t];function Z(t,e,i,s={}){let{duration:r=P.duration,delay:c=P.delay,endDelay:l=P.endDelay,repeat:h=P.repeat,easing:p=P.easing,direction:d,offset:w,allowWebkitAcceleration:S=!1}=s;const M=n(t);let A=j.waapi(),k=a;const D=(t=>m.has(t))(e);D&&(o[e]&&(e=o[e]),((t,e)=>{const{activeTransforms:i}=n(t);var a,s;s=e,-1===(a=i).indexOf(s)&&a.push(s),t.style.transform=y(i)})(t,e),e=f(e));const E=u.get(e);let V,$=function(t,e,n){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:X(e,n));return t}(Y(i),t,e);if(function(t,e){t.activeAnimations[e]&&(x(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(M,e),g(e)?(k=((t,e)=>n=>t.style.setProperty(e,n))(t,e),j.cssRegisterProperty()?function(t){if(!v.has(t)){v.add(t);try{const{syntax:e,initialValue:n}=u.has(t)?u.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):A=!1):k=((t,e)=>n=>t.style[e]=n)(t,e),A){E&&($=$.map((t=>"number"==typeof t?E.toDefaultUnit(t):t))),j.partialKeyframes()||1!==$.length||$.unshift(X(t,e));const n={delay:b(c),duration:b(r),endDelay:b(l),easing:O(p)?void 0:T(p),direction:d,iterations:h+1};V=t.animate({[e]:$,offset:w,easing:O(p)?p.map(T):void 0},n),V.finished||(V.finished=new Promise(((t,e)=>{V.onfinish=t,V.oncancel=e})));const i=$[$.length-1];V.finished.then((()=>k(i))).catch(a),S||(V.playbackRate=1.000001)}else if(D&&$.every(_)){if(1===$.length&&$.unshift(X(t,e)||(null==E?void 0:E.initialValue)||0),$=$.map((t=>"string"==typeof t?parseFloat(t):t)),E){const t=k;k=e=>t(E.toDefaultUnit(e))}V=function(t,e=[0,1],n={}){return new K(t,e,n)}(k,$,s)}else{const t=$[$.length-1];k(E&&"number"==typeof t?E.toDefaultUnit(t):t)}return M.activeAnimations[e]=V,V}const _=t=>"number"==typeof t,B=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function I(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}const G=t=>new Proxy({animations:t},H),H={get:(t,e)=>{var n,i;switch(e){case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(J)).catch(a)),t.finished;case"currentTime":const s=(null===(n=t.animations[0])||void 0===n?void 0:n[e])||0;return s?s/1e3:0;case"playbackRate":return null===(i=t.animations[0])||void 0===i?void 0:i[e];case"stop":return()=>t.animations.forEach(x);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=b(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},J=t=>t.finished;function L(t,e,n){return"function"==typeof t?t(e,n):t}function N(t,e,n,i){var a;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function Q(t,e,n,a,s,r){!function(t,e,n){for(let a=0;a<t.length;a++){const s=t[a];s.at>e&&s.at<n&&(i(t,s),a--)}}(t,s,r);for(let i=0;i<e.length;i++)t.push({value:e[i],at:V(s,r,a[i]),easing:F(n,i)})}function tt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function et(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function nt(t,e){return e[t]||(e[t]=[]),e[t]}t.animate=function(t,e,n={}){const i=[],a=(t=I(t)).length;for(let s=0;s<a;s++){const r=t[s];for(const t in e){const o=B(n,t);o.delay=L(o.delay,s,a);const c=Z(r,t,e[t],o);c&&i.push(c)}}return G(i)},t.animateStyle=Z,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(a,s)=>{const r="number"==typeof n?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,s),o=Math.abs(r-a);let c=t*o;if(i){const t=s*a;c=W(i)(c/t)*t}return e+c}},t.timeline=function(t,e={}){const n=[],i=function(t,e={}){var{defaultOptions:n={}}=e,i=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(n[i[a]]=t[i[a]])}return n}(e,["defaultOptions"]);const a=[],s=new Map,r={},o=new Map;let c=0,l=0,u=0;for(let e=0;e<t.length;e++){const[i,a,f={}]=t[e];void 0!==f.at&&(l=N(l,f.at,c,o));let h=0;const p=I(i,r),m=p.length;for(let t=0;t<m;t++){const e=et(p[t],s);for(const i in a){const s=nt(i,e),r=Y(a[i]),o=B(f,i),{duration:c=n.duration||P.duration,easing:p=n.easing||P.easing,offset:y=C(r.length)}=o,d=L(f.delay,t,m)||0,g=l+d,v=g+c;1===y.length&&0===y[0]&&(y[1]=1);const b=length-r.length;b>0&&q(y,b),1===r.length&&r.unshift(null),Q(s,r,p,y,g,v),h=Math.max(d+c,h),u=Math.max(v,u)}}c=l,l+=h}return s.forEach(((t,e)=>{for(const s in t){const r=t[s];r.sort(tt);const o=[],c=[],l=[];for(let t=0;t<r.length;t++){const{at:e,value:n,easing:i}=r[t];o.push(n),c.push(E(0,u,e)),l.push(i||P.easing)}1!==c[c.length-1]&&(c.push(1),o.push(null)),a.push([e,s,o,Object.assign(Object.assign(Object.assign({},n),{duration:u,easing:l,offset:c}),i)])}})),a}(t,e);for(let t=0;t<i.length;t++){const e=Z(...i[t]);e&&n.push(e)}return G(n)},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).Motion={})}(this,(function(t){"use strict";const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{activeTransforms:[],activeAnimations:{}}),e.get(t)}function i(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const a=()=>{},r=t=>t,s=["","X","Y","Z"],o={x:"translateX",y:"translateY",z:"translateZ"},l={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},c={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:l,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:r},skew:l},u=new Map,f=t=>`--motion-${t}`,h=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{s.forEach((e=>{h.push(t+e),u.set(f(t+e),c[t])}))}));const p=(t,e)=>h.indexOf(t)-h.indexOf(e),d=new Set(h),y=t=>t.sort(p).reduce(m,"").trim(),m=(t,e)=>`${t} ${e}(var(${f(e)}))`,g=t=>t.startsWith("--"),v=new Set;const b=t=>1e3*t;function x(t){try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}const O=t=>Array.isArray(t)&&"number"!=typeof t[0],T=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?w(t):t,w=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,S=t=>document.createElement("div").animate(t,{duration:.001}),M={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{S({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(S({opacity:[0,1]}).finished)},A={},j=Object.keys(M).reduce(((t,e)=>(t[e]=()=>(void 0===A[e]&&(A[e]=M[e]()),A[e]),t)),{}),P={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},k=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function D(t,e,n,i){if(t===e&&n===i)return r;const a=e=>function(t,e,n,i,a){let r,s,o=0;do{s=e+(n-e)/2,r=k(s,i,a)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:k(a(t),e,i)}var E=function(t,e,n){var i=e-t;return 0===i?1:(n-t)/i},V=function(t,e,n){return-n*t+n*e+t},$=function(t,e){return void 0===e&&(e="end"),function(n){var i,a,r,s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(s):Math.ceil(s);return i=0,a=1,r=o/t,Math.min(Math.max(r,i),a)}};const R={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},U=/\((.*?)\)/;function W(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if(R[t])return R[t];if(t.startsWith("steps")){const e=U.exec(t);if(e){const t=e[1].split(",");return $(parseFloat(t[0]),t[1].trim())}}return r}function F(t,e){return O(t)?t[(n=0,i=t.length,a=e,r=i-n,((a-n)%r+r)%r+n)]:t;var n,i,a,r}function q(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=E(0,e,i);t.push(V(n,1,a))}}function C(t){const e=[0];return q(e,t-1),e}function z(t,e=C(t.length),n=r){const i=t.length,a=i-e.length;return a>0&&q(e,a),a=>{let r=0;for(;r<i-2&&!(a<e[r+1]);r++);let s=(o=E(e[r],e[r+1],a),Math.min(1,Math.max(o,0)));var o;return s=F(n,r)(s),V(t[r],t[r+1],s)}}class K{constructor(t,e,{easing:n=P.easing,duration:i=P.duration,delay:a=P.delay,endDelay:r=P.endDelay,offset:s,repeat:o=P.repeat,direction:l="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const c=i*(o+1),u=z(e,s,O(n)?n.map(W):W(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-a,0);const s=n/i;let o=Math.floor(s),f=s%1;!f&&s>=1&&(f=1),1===f&&o--;const h=o%2;("reverse"===l||"alternate"===l&&h||"alternate-reverse"===l&&!h)&&(f=1-f);const p=n>=c?1:Math.min(f,1),d=u(p);t(d);n>=c+r?(this.playState="finished",this.resolve(d)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const X=(t,e)=>{let n=g(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=u.get(e);t&&(n=t.initialValue)}return n};const Y=t=>Array.isArray(t)?t:[t];function Z(t,e,i,r={}){let{duration:s=P.duration,delay:l=P.delay,endDelay:c=P.endDelay,repeat:h=P.repeat,easing:p=P.easing,direction:m,offset:w,allowWebkitAcceleration:S=!1}=r;const M=n(t);let A=j.waapi(),k=a;const D=(t=>d.has(t))(e);D&&(o[e]&&(e=o[e]),((t,e)=>{const{activeTransforms:i}=n(t);var a,r;r=e,-1===(a=i).indexOf(r)&&a.push(r),t.style.transform=y(i)})(t,e),e=f(e));const E=u.get(e);let V,$=function(t,e,n){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:X(e,n));return t}(Y(i),t,e);if(function(t,e){t.activeAnimations[e]&&(x(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(M,e),g(e)?(k=((t,e)=>n=>t.style.setProperty(e,n))(t,e),j.cssRegisterProperty()?function(t){if(!v.has(t)){v.add(t);try{const{syntax:e,initialValue:n}=u.has(t)?u.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):A=!1):k=((t,e)=>n=>t.style[e]=n)(t,e),A){E&&($=$.map((t=>"number"==typeof t?E.toDefaultUnit(t):t))),j.partialKeyframes()||1!==$.length||$.unshift(X(t,e));const n={delay:b(l),duration:b(s),endDelay:b(c),easing:O(p)?void 0:T(p),direction:m,iterations:h+1};V=t.animate({[e]:$,offset:w,easing:O(p)?p.map(T):void 0},n),V.finished||(V.finished=new Promise(((t,e)=>{V.onfinish=t,V.oncancel=e})));const i=$[$.length-1];V.finished.then((()=>k(i))).catch(a),S||(V.playbackRate=1.000001)}else if(D&&$.every(_)){if(1===$.length&&$.unshift(X(t,e)||(null==E?void 0:E.initialValue)||0),$=$.map((t=>"string"==typeof t?parseFloat(t):t)),E){const t=k;k=e=>t(E.toDefaultUnit(e))}V=function(t,e=[0,1],n={}){return new K(t,e,n)}(k,$,r)}else{const t=$[$.length-1];k(E&&"number"==typeof t?E.toDefaultUnit(t):t)}return M.activeAnimations[e]=V,null==V||V.finished.then((()=>M.activeAnimations[e]=void 0)).catch(a),V}const _=t=>"number"==typeof t,B=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function I(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}const G=(t,e)=>new Proxy({animations:t,duration:e},J),H=t=>t.animations[0],J={get:(t,e)=>{var n,i;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(n=H(t))||void 0===n?void 0:n[e])||0;return r?r/1e3:0;case"playbackRate":return null===(i=H(t))||void 0===i?void 0:i[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(L)).catch(a)),t.finished;case"stop":return()=>t.animations.forEach(x);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=b(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},L=t=>t.finished;function N(t,e,n){return"function"==typeof t?t(e,n):t}function Q(t,e,n,i){var a;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function tt(t,e,n,a,r,s){!function(t,e,n){for(let a=0;a<t.length;a++){const r=t[a];r.at>e&&r.at<n&&(i(t,r),a--)}}(t,r,s);for(let i=0;i<e.length;i++)t.push({value:e[i],at:V(r,s,a[i]),easing:F(n,i)})}function et(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function nt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function it(t,e){return e[t]||(e[t]=[]),e[t]}t.animate=function(t,e,n={}){var i;const a=[],r=(t=I(t)).length;for(let i=0;i<r;i++){const s=t[i];for(const t in e){const o=B(n,t);o.delay=N(o.delay,i,r);const l=Z(s,t,e[t],o);l&&a.push(l)}}return G(a,null!==(i=n.duration)&&void 0!==i?i:P.duration)},t.animateStyle=Z,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(a,r)=>{const s="number"==typeof n?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,r),o=Math.abs(s-a);let l=t*o;if(i){const t=r*a;l=W(i)(l/t)*t}return e+l}},t.timeline=function(t,e={}){var n,i;const a=[],r=function(t,e={}){var{defaultOptions:n={}}=e,i=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(n[i[a]]=t[i[a]])}return n}(e,["defaultOptions"]);const a=[],r=new Map,s={},o=new Map;let l=0,c=0,u=0;for(let e=0;e<t.length;e++){const[i,a,f={}]=t[e];void 0!==f.at&&(c=Q(c,f.at,l,o));let h=0;const p=I(i,s),d=p.length;for(let t=0;t<d;t++){const e=nt(p[t],r);for(const i in a){const r=it(i,e),s=Y(a[i]),o=B(f,i),{duration:l=n.duration||P.duration,easing:p=n.easing||P.easing,offset:y=C(s.length)}=o,m=N(f.delay,t,d)||0,g=c+m,v=g+l;1===y.length&&0===y[0]&&(y[1]=1);const b=length-s.length;b>0&&q(y,b),1===s.length&&s.unshift(null),tt(r,s,p,y,g,v),h=Math.max(m+l,h),u=Math.max(v,u)}}l=c,c+=h}return r.forEach(((t,e)=>{for(const r in t){const s=t[r];s.sort(et);const o=[],l=[],c=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];o.push(n),l.push(E(0,u,e)),c.push(i||P.easing)}1!==l[l.length-1]&&(l.push(1),o.push(null)),a.push([e,r,o,Object.assign(Object.assign(Object.assign({},n),{duration:u,easing:c,offset:l}),i)])}})),a}(t,e);for(let t=0;t<r.length;t++){const e=Z(...r[t]);e&&a.push(e)}return G(a,null!==(i=null===(n=r[0])||void 0===n?void 0:n[3].duration)&&void 0!==i?i:P.duration)},Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -120,3 +120,6 @@ (function (global, factory) {

try {
animation.commitStyles();
/**
* commitStyles has overhead so we only want to commit and cancel
*/
animation.playState !== "finished" && animation.commitStyles();
animation.cancel();

@@ -617,2 +620,6 @@ }

data.activeAnimations[name] = animation;
/**
* When an animation finishes, delete the reference to the previous animation.
*/
animation === null || animation === void 0 ? void 0 : animation.finished.then(() => (data.activeAnimations[name] = undefined)).catch(noop);
return animation;

@@ -647,3 +654,9 @@ }

const createAnimationControls = (animations) => new Proxy({ animations }, controls);
const createAnimationControls = (animations, duration) => new Proxy({ animations, duration }, controls);
/**
* TODO:
* Currently this returns the first animation, ideally it would return
* the first active animation.
*/
const getActiveAnimation = (state) => state.animations[0];
const controls = {

@@ -653,2 +666,9 @@ get: (target, key) => {

switch (key) {
case "duration":
return target.duration;
case "currentTime":
let time = ((_a = getActiveAnimation(target)) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return time ? time / 1000 : 0;
case "playbackRate":
return (_b = getActiveAnimation(target)) === null || _b === void 0 ? void 0 : _b[key];
case "finished":

@@ -659,9 +679,2 @@ if (!target.finished) {

return target.finished;
case "currentTime":
// TODO Find first active animation
const duration = ((_a = target.animations[0]) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return duration ? duration / 1000 : 0;
case "playbackRate":
// TODO Find first active animation
return (_b = target.animations[0]) === null || _b === void 0 ? void 0 : _b[key];
case "stop":

@@ -718,2 +731,3 @@ return () => target.animations.forEach(stopAnimation);

function animate(elements, keyframes, options = {}) {
var _a;
elements = resolveElements(elements);

@@ -731,3 +745,3 @@ const animations = [];

}
return createAnimationControls(animations);
return createAnimationControls(animations, (_a = options.duration) !== null && _a !== void 0 ? _a : defaults.duration);
}

@@ -787,2 +801,3 @@

function timeline(definition, options = {}) {
var _a, _b;
const animations = [];

@@ -794,3 +809,5 @@ const animationDefinitions = createAnimationsFromTimeline(definition, options);

}
return createAnimationControls(animations);
return createAnimationControls(animations,
// Get the duration from the first animation definition
(_b = (_a = animationDefinitions[0]) === null || _a === void 0 ? void 0 : _a[3].duration) !== null && _b !== void 0 ? _b : defaults.duration);
}

@@ -797,0 +814,0 @@ function createAnimationsFromTimeline(definition, _a = {}) {

@@ -1,1 +0,1 @@

const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{activeTransforms:[],activeAnimations:{}}),t.get(e)}const n=()=>{},i=t=>t,a=["","X","Y","Z"],r={x:"translateX",y:"translateY",z:"translateZ"},s={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},o={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:s,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:i},skew:s},c=new Map,l=t=>`--motion-${t}`,u=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{a.forEach((e=>{u.push(t+e),c.set(l(t+e),o[t])}))}));const h=(t,e)=>u.indexOf(t)-u.indexOf(e),f=new Set(u),m=t=>t.sort(h).reduce(y,"").trim(),y=(t,e)=>`${t} ${e}(var(${l(e)}))`,p=t=>t.startsWith("--"),d=new Set;const g=t=>1e3*t;function v(t){try{t.commitStyles(),t.cancel()}catch(t){}}const T=t=>Array.isArray(t)&&"number"!=typeof t[0],b=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?w(t):t,w=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,S=t=>document.createElement("div").animate(t,{duration:.001}),x={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{S({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(S({opacity:[0,1]}).finished)},A={},k=Object.keys(x).reduce(((t,e)=>(t[e]=()=>(void 0===A[e]&&(A[e]=x[e]()),A[e]),t)),{}),M={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},D=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function P(t,e,n,a){if(t===e&&n===a)return i;const r=e=>function(t,e,n,i,a){let r,s,o=0;do{s=e+(n-e)/2,r=D(s,i,a)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:D(r(t),e,a)}var O=function(t,e,n){var i=e-t;return 0===i?1:(n-t)/i},j=function(t,e,n){return-n*t+n*e+t},V=function(t,e){return void 0===e&&(e="end"),function(n){var i,a,r,s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(s):Math.ceil(s);return i=0,a=1,r=o/t,Math.min(Math.max(r,i),a)}};const $={ease:P(.25,.1,.25,1),"ease-in":P(.42,0,1,1),"ease-in-out":P(.42,0,.58,1),"ease-out":P(0,0,.58,1)},E=/\((.*?)\)/;function R(t){if("function"==typeof t)return t;if(Array.isArray(t))return P(...t);if($[t])return $[t];if(t.startsWith("steps")){const e=E.exec(t);if(e){const t=e[1].split(",");return V(parseFloat(t[0]),t[1].trim())}}return i}function U(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=O(0,e,i);t.push(j(n,1,a))}}function q(t,e=function(t){const e=[0];return U(e,t-1),e}(t.length),n=i){const a=t.length,r=a-e.length;return r>0&&U(e,r),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let s=(o=O(e[r],e[r+1],i),Math.min(1,Math.max(o,0)));var o;return s=function(t,e){return T(t)?t[(n=0,i=t.length,a=e,r=i-n,((a-n)%r+r)%r+n)]:t;var n,i,a,r}(n,r)(s),j(t[r],t[r+1],s)}}class C{constructor(t,e,{easing:n=M.easing,duration:i=M.duration,delay:a=M.delay,endDelay:r=M.endDelay,offset:s,repeat:o=M.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=i*(o+1),u=q(e,s,T(n)?n.map(R):R(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-a,0);const s=n/i;let o=Math.floor(s),h=s%1;!h&&s>=1&&(h=1),1===h&&o--;const f=o%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(h=1-h);const m=n>=l?1:Math.min(h,1),y=u(m);t(y);n>=l+r?(this.playState="finished",this.resolve(y)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const F=(t,e)=>{let n=p(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=c.get(e);t&&(n=t.initialValue)}return n};function W(t,i,a,s={}){let{duration:o=M.duration,delay:u=M.delay,endDelay:h=M.endDelay,repeat:y=M.repeat,easing:w=M.easing,direction:S,offset:x,allowWebkitAcceleration:A=!1}=s;const D=e(t);let P=k.waapi(),O=n;const j=(t=>f.has(t))(i);j&&(r[i]&&(i=r[i]),((t,n)=>{const{activeTransforms:i}=e(t);var a,r;r=n,-1===(a=i).indexOf(r)&&a.push(r),t.style.transform=m(i)})(t,i),i=l(i));const V=c.get(i);let $,E=function(t,e,n){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:F(e,n));return t}((t=>Array.isArray(t)?t:[t])(a),t,i);if(function(t,e){t.activeAnimations[e]&&(v(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(D,i),p(i)?(O=((t,e)=>n=>t.style.setProperty(e,n))(t,i),k.cssRegisterProperty()?function(t){if(!d.has(t)){d.add(t);try{const{syntax:e,initialValue:n}=c.has(t)?c.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(i):P=!1):O=((t,e)=>n=>t.style[e]=n)(t,i),P){V&&(E=E.map((t=>"number"==typeof t?V.toDefaultUnit(t):t))),k.partialKeyframes()||1!==E.length||E.unshift(F(t,i));const e={delay:g(u),duration:g(o),endDelay:g(h),easing:T(w)?void 0:b(w),direction:S,iterations:y+1};$=t.animate({[i]:E,offset:x,easing:T(w)?w.map(b):void 0},e),$.finished||($.finished=new Promise(((t,e)=>{$.onfinish=t,$.oncancel=e})));const a=E[E.length-1];$.finished.then((()=>O(a))).catch(n),A||($.playbackRate=1.000001)}else if(j&&E.every(z)){if(1===E.length&&E.unshift(F(t,i)||(null==V?void 0:V.initialValue)||0),E=E.map((t=>"string"==typeof t?parseFloat(t):t)),V){const t=O;O=e=>t(V.toDefaultUnit(e))}$=function(t,e=[0,1],n={}){return new C(t,e,n)}(O,E,s)}else{const t=E[E.length-1];O(V&&"number"==typeof t?V.toDefaultUnit(t):t)}return D.activeAnimations[i]=$,$}const z=t=>"number"==typeof t,K=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const X={get:(t,e)=>{var i,a;switch(e){case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(Y)).catch(n)),t.finished;case"currentTime":const r=(null===(i=t.animations[0])||void 0===i?void 0:i[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=t.animations[0])||void 0===a?void 0:a[e];case"stop":return()=>t.animations.forEach(v);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=g(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},Y=t=>t.finished;function Z(t,e,n){return"function"==typeof t?t(e,n):t}function B(t,e,n={}){const i=[],a=(t=function(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length;for(let r=0;r<a;r++){const s=t[r];for(const t in e){const o=K(n,t);o.delay=Z(o.delay,r,a);const c=W(s,t,e[t],o);c&&i.push(c)}}return(t=>new Proxy({animations:t},X))(i)}export{B as animate};
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{activeTransforms:[],activeAnimations:{}}),t.get(e)}const n=()=>{},i=t=>t,a=["","X","Y","Z"],r={x:"translateX",y:"translateY",z:"translateZ"},s={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},o={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:s,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:i},skew:s},c=new Map,l=t=>`--motion-${t}`,u=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{a.forEach((e=>{u.push(t+e),c.set(l(t+e),o[t])}))}));const h=(t,e)=>u.indexOf(t)-u.indexOf(e),f=new Set(u),m=t=>t.sort(h).reduce(d,"").trim(),d=(t,e)=>`${t} ${e}(var(${l(e)}))`,y=t=>t.startsWith("--"),p=new Set;const g=t=>1e3*t;function v(t){try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}const T=t=>Array.isArray(t)&&"number"!=typeof t[0],S=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?b(t):t,b=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,w=t=>document.createElement("div").animate(t,{duration:.001}),A={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{w({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(w({opacity:[0,1]}).finished)},x={},k=Object.keys(A).reduce(((t,e)=>(t[e]=()=>(void 0===x[e]&&(x[e]=A[e]()),x[e]),t)),{}),M={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},D=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function P(t,e,n,a){if(t===e&&n===a)return i;const r=e=>function(t,e,n,i,a){let r,s,o=0;do{s=e+(n-e)/2,r=D(s,i,a)-t,r>0?n=s:e=s}while(Math.abs(r)>1e-7&&++o<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:D(r(t),e,a)}var O=function(t,e,n){var i=e-t;return 0===i?1:(n-t)/i},j=function(t,e,n){return-n*t+n*e+t},V=function(t,e){return void 0===e&&(e="end"),function(n){var i,a,r,s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(s):Math.ceil(s);return i=0,a=1,r=o/t,Math.min(Math.max(r,i),a)}};const $={ease:P(.25,.1,.25,1),"ease-in":P(.42,0,1,1),"ease-in-out":P(.42,0,.58,1),"ease-out":P(0,0,.58,1)},E=/\((.*?)\)/;function R(t){if("function"==typeof t)return t;if(Array.isArray(t))return P(...t);if($[t])return $[t];if(t.startsWith("steps")){const e=E.exec(t);if(e){const t=e[1].split(",");return V(parseFloat(t[0]),t[1].trim())}}return i}function U(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const a=O(0,e,i);t.push(j(n,1,a))}}function q(t,e=function(t){const e=[0];return U(e,t-1),e}(t.length),n=i){const a=t.length,r=a-e.length;return r>0&&U(e,r),i=>{let r=0;for(;r<a-2&&!(i<e[r+1]);r++);let s=(o=O(e[r],e[r+1],i),Math.min(1,Math.max(o,0)));var o;return s=function(t,e){return T(t)?t[(n=0,i=t.length,a=e,r=i-n,((a-n)%r+r)%r+n)]:t;var n,i,a,r}(n,r)(s),j(t[r],t[r+1],s)}}class C{constructor(t,e,{easing:n=M.easing,duration:i=M.duration,delay:a=M.delay,endDelay:r=M.endDelay,offset:s,repeat:o=M.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=i*(o+1),u=q(e,s,T(n)?n.map(R):R(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-a,0);const s=n/i;let o=Math.floor(s),h=s%1;!h&&s>=1&&(h=1),1===h&&o--;const f=o%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(h=1-h);const m=n>=l?1:Math.min(h,1),d=u(m);t(d);n>=l+r?(this.playState="finished",this.resolve(d)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const F=(t,e)=>{let n=y(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=c.get(e);t&&(n=t.initialValue)}return n};function W(t,i,a,s={}){let{duration:o=M.duration,delay:u=M.delay,endDelay:h=M.endDelay,repeat:d=M.repeat,easing:b=M.easing,direction:w,offset:A,allowWebkitAcceleration:x=!1}=s;const D=e(t);let P=k.waapi(),O=n;const j=(t=>f.has(t))(i);j&&(r[i]&&(i=r[i]),((t,n)=>{const{activeTransforms:i}=e(t);var a,r;r=n,-1===(a=i).indexOf(r)&&a.push(r),t.style.transform=m(i)})(t,i),i=l(i));const V=c.get(i);let $,E=function(t,e,n){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:F(e,n));return t}((t=>Array.isArray(t)?t:[t])(a),t,i);if(function(t,e){t.activeAnimations[e]&&(v(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(D,i),y(i)?(O=((t,e)=>n=>t.style.setProperty(e,n))(t,i),k.cssRegisterProperty()?function(t){if(!p.has(t)){p.add(t);try{const{syntax:e,initialValue:n}=c.has(t)?c.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(i):P=!1):O=((t,e)=>n=>t.style[e]=n)(t,i),P){V&&(E=E.map((t=>"number"==typeof t?V.toDefaultUnit(t):t))),k.partialKeyframes()||1!==E.length||E.unshift(F(t,i));const e={delay:g(u),duration:g(o),endDelay:g(h),easing:T(b)?void 0:S(b),direction:w,iterations:d+1};$=t.animate({[i]:E,offset:A,easing:T(b)?b.map(S):void 0},e),$.finished||($.finished=new Promise(((t,e)=>{$.onfinish=t,$.oncancel=e})));const a=E[E.length-1];$.finished.then((()=>O(a))).catch(n),x||($.playbackRate=1.000001)}else if(j&&E.every(z)){if(1===E.length&&E.unshift(F(t,i)||(null==V?void 0:V.initialValue)||0),E=E.map((t=>"string"==typeof t?parseFloat(t):t)),V){const t=O;O=e=>t(V.toDefaultUnit(e))}$=function(t,e=[0,1],n={}){return new C(t,e,n)}(O,E,s)}else{const t=E[E.length-1];O(V&&"number"==typeof t?V.toDefaultUnit(t):t)}return D.activeAnimations[i]=$,null==$||$.finished.then((()=>D.activeAnimations[i]=void 0)).catch(n),$}const z=t=>"number"==typeof t,K=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);const X=t=>t.animations[0],Y={get:(t,e)=>{var i,a;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(i=X(t))||void 0===i?void 0:i[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=X(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(Z)).catch(n)),t.finished;case"stop":return()=>t.animations.forEach(v);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=g(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},Z=t=>t.finished;function B(t,e,n){return"function"==typeof t?t(e,n):t}function G(t,e,n={}){var i;const a=[],r=(t=function(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}(t)).length;for(let i=0;i<r;i++){const s=t[i];for(const t in e){const o=K(n,t);o.delay=B(o.delay,i,r);const c=W(s,t,e[t],o);c&&a.push(c)}}return((t,e)=>new Proxy({animations:t,duration:e},Y))(a,null!==(i=n.duration)&&void 0!==i?i:M.duration)}export{G as animate};

@@ -1,1 +0,1 @@

const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{activeTransforms:[],activeAnimations:{}}),t.get(e)}const i=()=>{},n=t=>t,a=["","X","Y","Z"],s={x:"translateX",y:"translateY",z:"translateZ"},r={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},o={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:r,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:n},skew:r},c=new Map,l=t=>`--motion-${t}`,h=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{a.forEach((e=>{h.push(t+e),c.set(l(t+e),o[t])}))}));const u=(t,e)=>h.indexOf(t)-h.indexOf(e),f=new Set(h),p=t=>t.sort(u).reduce(y,"").trim(),y=(t,e)=>`${t} ${e}(var(${l(e)}))`,m=t=>t.startsWith("--"),d=new Set;const g=t=>1e3*t;const v=t=>Array.isArray(t)&&"number"!=typeof t[0],T=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?S(t):t,S=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,w=t=>document.createElement("div").animate(t,{duration:.001}),x={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{w({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(w({opacity:[0,1]}).finished)},b={},A=Object.keys(x).reduce(((t,e)=>(t[e]=()=>(void 0===b[e]&&(b[e]=x[e]()),b[e]),t)),{}),M={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},k=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function D(t,e,i,a){if(t===e&&i===a)return n;const s=e=>function(t,e,i,n,a){let s,r,o=0;do{r=e+(i-e)/2,s=k(r,n,a)-t,s>0?i=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:k(s(t),e,a)}var P=function(t,e,i){var n=e-t;return 0===n?1:(i-t)/n},O=function(t,e,i){return-i*t+i*e+t},V=function(t,e){return void 0===e&&(e="end"),function(i){var n,a,s,r=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,o="end"===e?Math.floor(r):Math.ceil(r);return n=0,a=1,s=o/t,Math.min(Math.max(s,n),a)}};const $={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},U=/\((.*?)\)/;function j(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if($[t])return $[t];if(t.startsWith("steps")){const e=U.exec(t);if(e){const t=e[1].split(",");return V(parseFloat(t[0]),t[1].trim())}}return n}function R(t,e){const i=t[t.length-1];for(let n=1;n<=e;n++){const a=P(0,e,n);t.push(O(i,1,a))}}function C(t,e=function(t){const e=[0];return R(e,t-1),e}(t.length),i=n){const a=t.length,s=a-e.length;return s>0&&R(e,s),n=>{let s=0;for(;s<a-2&&!(n<e[s+1]);s++);let r=(o=P(e[s],e[s+1],n),Math.min(1,Math.max(o,0)));var o;return r=function(t,e){return v(t)?t[(i=0,n=t.length,a=e,s=n-i,((a-i)%s+s)%s+i)]:t;var i,n,a,s}(i,s)(r),O(t[s],t[s+1],r)}}class E{constructor(t,e,{easing:i=M.easing,duration:n=M.duration,delay:a=M.delay,endDelay:s=M.endDelay,offset:r,repeat:o=M.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=n*(o+1),h=C(e,r,v(i)?i.map(j):j(i));this.tick=e=>{if("finished"===this.playState){const e=h(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let i=(e-this.startTime)*this.rate;this.t=i,i/=1e3,i=Math.max(i-a,0);const r=i/n;let o=Math.floor(r),u=r%1;!u&&r>=1&&(u=1),1===u&&o--;const f=o%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(u=1-u);const p=i>=l?1:Math.min(u,1),y=h(p);t(y);i>=l+s?(this.playState="finished",this.resolve(y)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const F=(t,e)=>{let i=m(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!i&&0!==i){const t=c.get(e);t&&(i=t.initialValue)}return i};function W(t,n,a,r={}){let{duration:o=M.duration,delay:h=M.delay,endDelay:u=M.endDelay,repeat:y=M.repeat,easing:S=M.easing,direction:w,offset:x,allowWebkitAcceleration:b=!1}=r;const k=e(t);let D=A.waapi(),P=i;const O=(t=>f.has(t))(n);O&&(s[n]&&(n=s[n]),((t,i)=>{const{activeTransforms:n}=e(t);var a,s;s=i,-1===(a=n).indexOf(s)&&a.push(s),t.style.transform=p(n)})(t,n),n=l(n));const V=c.get(n);let $,U=function(t,e,i){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:F(e,i));return t}((t=>Array.isArray(t)?t:[t])(a),t,n);if(function(t,e){t.activeAnimations[e]&&(!function(t){try{t.commitStyles(),t.cancel()}catch(t){}}(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(k,n),m(n)?(P=((t,e)=>i=>t.style.setProperty(e,i))(t,n),A.cssRegisterProperty()?function(t){if(!d.has(t)){d.add(t);try{const{syntax:e,initialValue:i}=c.has(t)?c.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:i})}catch(t){}}}(n):D=!1):P=((t,e)=>i=>t.style[e]=i)(t,n),D){V&&(U=U.map((t=>"number"==typeof t?V.toDefaultUnit(t):t))),A.partialKeyframes()||1!==U.length||U.unshift(F(t,n));const e={delay:g(h),duration:g(o),endDelay:g(u),easing:v(S)?void 0:T(S),direction:w,iterations:y+1};$=t.animate({[n]:U,offset:x,easing:v(S)?S.map(T):void 0},e),$.finished||($.finished=new Promise(((t,e)=>{$.onfinish=t,$.oncancel=e})));const a=U[U.length-1];$.finished.then((()=>P(a))).catch(i),b||($.playbackRate=1.000001)}else if(O&&U.every(z)){if(1===U.length&&U.unshift(F(t,n)||(null==V?void 0:V.initialValue)||0),U=U.map((t=>"string"==typeof t?parseFloat(t):t)),V){const t=P;P=e=>t(V.toDefaultUnit(e))}$=function(t,e=[0,1],i={}){return new E(t,e,i)}(P,U,r)}else{const t=U[U.length-1];P(V&&"number"==typeof t?V.toDefaultUnit(t):t)}return k.activeAnimations[n]=$,$}const z=t=>"number"==typeof t;export{W as animateStyle};
const t=new WeakMap;function e(e){return t.has(e)||t.set(e,{activeTransforms:[],activeAnimations:{}}),t.get(e)}const i=()=>{},n=t=>t,a=["","X","Y","Z"],s={x:"translateX",y:"translateY",z:"translateZ"},r={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},o={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:r,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:n},skew:r},c=new Map,l=t=>`--motion-${t}`,h=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{a.forEach((e=>{h.push(t+e),c.set(l(t+e),o[t])}))}));const u=(t,e)=>h.indexOf(t)-h.indexOf(e),f=new Set(h),p=t=>t.sort(u).reduce(y,"").trim(),y=(t,e)=>`${t} ${e}(var(${l(e)}))`,m=t=>t.startsWith("--"),d=new Set;const g=t=>1e3*t;const v=t=>Array.isArray(t)&&"number"!=typeof t[0],T=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?S(t):t,S=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,w=t=>document.createElement("div").animate(t,{duration:.001}),x={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{w({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(w({opacity:[0,1]}).finished)},A={},b=Object.keys(x).reduce(((t,e)=>(t[e]=()=>(void 0===A[e]&&(A[e]=x[e]()),A[e]),t)),{}),M={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},k=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function D(t,e,i,a){if(t===e&&i===a)return n;const s=e=>function(t,e,i,n,a){let s,r,o=0;do{r=e+(i-e)/2,s=k(r,n,a)-t,s>0?i=r:e=r}while(Math.abs(s)>1e-7&&++o<12);return r}(e,0,1,t,i);return t=>0===t||1===t?t:k(s(t),e,a)}var P=function(t,e,i){var n=e-t;return 0===n?1:(i-t)/n},O=function(t,e,i){return-i*t+i*e+t},V=function(t,e){return void 0===e&&(e="end"),function(i){var n,a,s,r=(i="end"===e?Math.min(i,.999):Math.max(i,.001))*t,o="end"===e?Math.floor(r):Math.ceil(r);return n=0,a=1,s=o/t,Math.min(Math.max(s,n),a)}};const $={ease:D(.25,.1,.25,1),"ease-in":D(.42,0,1,1),"ease-in-out":D(.42,0,.58,1),"ease-out":D(0,0,.58,1)},U=/\((.*?)\)/;function j(t){if("function"==typeof t)return t;if(Array.isArray(t))return D(...t);if($[t])return $[t];if(t.startsWith("steps")){const e=U.exec(t);if(e){const t=e[1].split(",");return V(parseFloat(t[0]),t[1].trim())}}return n}function R(t,e){const i=t[t.length-1];for(let n=1;n<=e;n++){const a=P(0,e,n);t.push(O(i,1,a))}}function C(t,e=function(t){const e=[0];return R(e,t-1),e}(t.length),i=n){const a=t.length,s=a-e.length;return s>0&&R(e,s),n=>{let s=0;for(;s<a-2&&!(n<e[s+1]);s++);let r=(o=P(e[s],e[s+1],n),Math.min(1,Math.max(o,0)));var o;return r=function(t,e){return v(t)?t[(i=0,n=t.length,a=e,s=n-i,((a-i)%s+s)%s+i)]:t;var i,n,a,s}(i,s)(r),O(t[s],t[s+1],r)}}class E{constructor(t,e,{easing:i=M.easing,duration:n=M.duration,delay:a=M.delay,endDelay:s=M.endDelay,offset:r,repeat:o=M.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=n*(o+1),h=C(e,r,v(i)?i.map(j):j(i));this.tick=e=>{if("finished"===this.playState){const e=h(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let i=(e-this.startTime)*this.rate;this.t=i,i/=1e3,i=Math.max(i-a,0);const r=i/n;let o=Math.floor(r),u=r%1;!u&&r>=1&&(u=1),1===u&&o--;const f=o%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(u=1-u);const p=i>=l?1:Math.min(u,1),y=h(p);t(y);i>=l+s?(this.playState="finished",this.resolve(y)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const F=(t,e)=>{let i=m(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!i&&0!==i){const t=c.get(e);t&&(i=t.initialValue)}return i};function W(t,n,a,r={}){let{duration:o=M.duration,delay:h=M.delay,endDelay:u=M.endDelay,repeat:y=M.repeat,easing:S=M.easing,direction:w,offset:x,allowWebkitAcceleration:A=!1}=r;const k=e(t);let D=b.waapi(),P=i;const O=(t=>f.has(t))(n);O&&(s[n]&&(n=s[n]),((t,i)=>{const{activeTransforms:n}=e(t);var a,s;s=i,-1===(a=n).indexOf(s)&&a.push(s),t.style.transform=p(n)})(t,n),n=l(n));const V=c.get(n);let $,U=function(t,e,i){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:F(e,i));return t}((t=>Array.isArray(t)?t:[t])(a),t,n);if(function(t,e){t.activeAnimations[e]&&(!function(t){try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(k,n),m(n)?(P=((t,e)=>i=>t.style.setProperty(e,i))(t,n),b.cssRegisterProperty()?function(t){if(!d.has(t)){d.add(t);try{const{syntax:e,initialValue:i}=c.has(t)?c.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:i})}catch(t){}}}(n):D=!1):P=((t,e)=>i=>t.style[e]=i)(t,n),D){V&&(U=U.map((t=>"number"==typeof t?V.toDefaultUnit(t):t))),b.partialKeyframes()||1!==U.length||U.unshift(F(t,n));const e={delay:g(h),duration:g(o),endDelay:g(u),easing:v(S)?void 0:T(S),direction:w,iterations:y+1};$=t.animate({[n]:U,offset:x,easing:v(S)?S.map(T):void 0},e),$.finished||($.finished=new Promise(((t,e)=>{$.onfinish=t,$.oncancel=e})));const a=U[U.length-1];$.finished.then((()=>P(a))).catch(i),A||($.playbackRate=1.000001)}else if(O&&U.every(z)){if(1===U.length&&U.unshift(F(t,n)||(null==V?void 0:V.initialValue)||0),U=U.map((t=>"string"==typeof t?parseFloat(t):t)),V){const t=P;P=e=>t(V.toDefaultUnit(e))}$=function(t,e=[0,1],i={}){return new E(t,e,i)}(P,U,r)}else{const t=U[U.length-1];P(V&&"number"==typeof t?V.toDefaultUnit(t):t)}return k.activeAnimations[n]=$,null==$||$.finished.then((()=>k.activeAnimations[n]=void 0)).catch(i),$}const z=t=>"number"==typeof t;export{W as animateStyle};

@@ -1,1 +0,1 @@

import*as t from"react";import{useRef as e,useEffect as n,useState as r,createContext as i,useContext as s,forwardRef as o,createElement as a,useMemo as c}from"react";const l=new WeakMap;function u(t){return l.has(t)||l.set(t,{activeTransforms:[],activeAnimations:{}}),l.get(t)}const p=()=>{},f=t=>t,h=["","X","Y","Z"],y={x:"translateX",y:"translateY",z:"translateZ"},m={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},d={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:m,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:f},skew:m},v=new Map,g=t=>`--motion-${t}`,w=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{h.forEach((e=>{w.push(t+e),v.set(g(t+e),d[t])}))}));const b=(t,e)=>w.indexOf(t)-w.indexOf(e),O=new Set(w),x=t=>O.has(t),S=t=>t.sort(b).reduce(j,"").trim(),j=(t,e)=>`${t} ${e}(var(${g(e)}))`,P=t=>t.startsWith("--"),A=new Set;const T=t=>1e3*t;const V=t=>Array.isArray(t)&&"number"!=typeof t[0],k=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?M(t):t,M=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,D=t=>document.createElement("div").animate(t,{duration:.001}),E={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{D({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(D({opacity:[0,1]}).finished)},$={},C=Object.keys(E).reduce(((t,e)=>(t[e]=()=>(void 0===$[e]&&($[e]=E[e]()),$[e]),t)),{}),L={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},U=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function I(t,e,n,r){if(t===e&&n===r)return f;const i=e=>function(t,e,n,r,i){let s,o,a=0;do{o=e+(n-e)/2,s=U(o,r,i)-t,s>0?n=o:e=o}while(Math.abs(s)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:U(i(t),e,r)}var R=function(t,e,n){var r=e-t;return 0===r?1:(n-t)/r},F=function(t,e,n){return-n*t+n*e+t},W=function(t,e){return void 0===e&&(e="end"),function(n){var r,i,s,o=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(o):Math.ceil(o);return r=0,i=1,s=a/t,Math.min(Math.max(s,r),i)}};const z={ease:I(.25,.1,.25,1),"ease-in":I(.42,0,1,1),"ease-in-out":I(.42,0,.58,1),"ease-out":I(0,0,.58,1)},q=/\((.*?)\)/;function B(t){if("function"==typeof t)return t;if(Array.isArray(t))return I(...t);if(z[t])return z[t];if(t.startsWith("steps")){const e=q.exec(t);if(e){const t=e[1].split(",");return W(parseFloat(t[0]),t[1].trim())}}return f}function K(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=R(0,e,r);t.push(F(n,1,i))}}function X(t,e=function(t){const e=[0];return K(e,t-1),e}(t.length),n=f){const r=t.length,i=r-e.length;return i>0&&K(e,i),i=>{let s=0;for(;s<r-2&&!(i<e[s+1]);s++);let o=(a=R(e[s],e[s+1],i),Math.min(1,Math.max(a,0)));var a;return o=function(t,e){return V(t)?t[(n=0,r=t.length,i=e,s=r-n,((i-n)%s+s)%s+n)]:t;var n,r,i,s}(n,s)(o),F(t[s],t[s+1],o)}}class Y{constructor(t,e,{easing:n=L.easing,duration:r=L.duration,delay:i=L.delay,endDelay:s=L.endDelay,offset:o,repeat:a=L.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=r*(a+1),u=X(e,o,V(n)?n.map(B):B(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-i,0);const o=n/r;let a=Math.floor(o),p=o%1;!p&&o>=1&&(p=1),1===p&&a--;const f=a%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(p=1-p);const h=n>=l?1:Math.min(p,1),y=u(h);t(y);n>=l+s?(this.playState="finished",this.resolve(y)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const Z=(t,e)=>{let n=P(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=v.get(e);t&&(n=t.initialValue)}return n};function G(t,e,n,r={}){let{duration:i=L.duration,delay:s=L.delay,endDelay:o=L.endDelay,repeat:a=L.repeat,easing:c=L.easing,direction:l,offset:f,allowWebkitAcceleration:h=!1}=r;const m=u(t);let d=C.waapi(),w=p;const b=x(e);b&&(y[e]&&(e=y[e]),((t,e)=>{const{activeTransforms:n}=u(t);var r,i;i=e,-1===(r=n).indexOf(i)&&r.push(i),t.style.transform=S(n)})(t,e),e=g(e));const O=v.get(e);let j,M=function(t,e,n){for(let r=0;r<t.length;r++)null===t[r]&&(t[r]=r?t[r-1]:Z(e,n));return t}((t=>Array.isArray(t)?t:[t])(n),t,e);if(function(t,e){t.activeAnimations[e]&&(!function(t){try{t.commitStyles(),t.cancel()}catch(t){}}(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(m,e),P(e)?(w=((t,e)=>n=>t.style.setProperty(e,n))(t,e),C.cssRegisterProperty()?function(t){if(!A.has(t)){A.add(t);try{const{syntax:e,initialValue:n}=v.has(t)?v.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):d=!1):w=((t,e)=>n=>t.style[e]=n)(t,e),d){O&&(M=M.map((t=>"number"==typeof t?O.toDefaultUnit(t):t))),C.partialKeyframes()||1!==M.length||M.unshift(Z(t,e));const n={delay:T(s),duration:T(i),endDelay:T(o),easing:V(c)?void 0:k(c),direction:l,iterations:a+1};j=t.animate({[e]:M,offset:f,easing:V(c)?c.map(k):void 0},n),j.finished||(j.finished=new Promise(((t,e)=>{j.onfinish=t,j.oncancel=e})));const r=M[M.length-1];j.finished.then((()=>w(r))).catch(p),h||(j.playbackRate=1.000001)}else if(b&&M.every(H)){if(1===M.length&&M.unshift(Z(t,e)||(null==O?void 0:O.initialValue)||0),M=M.map((t=>"string"==typeof t?parseFloat(t):t)),O){const t=w;w=e=>t(O.toDefaultUnit(e))}j=function(t,e=[0,1],n={}){return new Y(t,e,n)}(w,M,r)}else{const t=M[M.length-1];w(O&&"number"==typeof t?O.toDefaultUnit(t):t)}return m.activeAnimations[e]=j,j}const H=t=>"number"==typeof t;const J=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function N(t,r,i,s,o,a){const c=e(r);n((()=>{const e={};if(new Set([...Object.keys(i),...Object.keys(c.current)]).forEach((t=>{let n=i[t];var r,s;(r=n,s=c.current[t],typeof r==typeof s&&(Array.isArray(r)&&Array.isArray(s)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}(r,s):r===s))||(e[t]=n)})),Object.keys(e).length&&t.current){null==o||o(e);const n=[];for(const r in e){const i=G(t.current,r,e[r],J(s,r));i&&n.push(i)}Promise.all(n.map((t=>t.finished))).then((()=>null==a?void 0:a(e))).catch(p)}c.current=i}))}function Q(t,e,n={}){return t?"string"==typeof t?n[t]:t:e?n[e]:void 0}function _(t,e,n){if(n)for(const r in n)"options"!==r&&(t[r]=n[r],n.options&&(e[r]=J(n.options,r)))}function tt(t,e,n,i,s){const[o,a]=r(!1);return(o||i)&&_(t,e,Q(n,i,s)),[o||Boolean(i),a]}var et=i(null);var nt=0,rt=function(){return nt++},it=function(){return t=rt,null===(n=e(null)).current&&(n.current=t()),n.current;var t,n};function st(t,e,{exit:r,poses:i},{exit:o}){const[a,c]=function(){var t=s(et);if(null===t)return[!0,null];var e=t.isPresent,r=t.onExitComplete,i=t.register,o=it();return n((function(){return i(o)}),[]),!e&&r?[!1,function(){return null==r?void 0:r(o)}]:[!0]}();if(n((()=>{r||null==c||c()}),[a]),r&&!a)return _(t,e,Q(r,o,i)),c}const ot=i({});function at(r){return o((function(i,o){const l=e(null),{options:u,style:p,initial:f,hover:h,press:m,exit:d,inViewport:w,viewport:b,poses:O,onStart:j,onComplete:P,onViewportEnter:A,onViewportLeave:T,inherit:V=!0}=i,k=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["options","style","initial","hover","press","exit","inViewport","viewport","poses","onStart","onComplete","onViewportEnter","onViewportLeave","inherit"]),M={initial:!0,style:!0};let D=s(ot);V||(D={});const E=Q(p,D.style,O),$=Q(f,D.initial,O),C=Object.assign(Object.assign({},E),$),L=Object.assign(Object.assign({},$),E),U=Object.assign(Object.assign({},u),null==E?void 0:E.options),I=e(null);I.current||(I.current=function(t){const e={},n=[];for(let r in t){const i=t[r];x(r)&&(y[r]&&(r=y[r]),n.push(r),r=g(r));let s=Array.isArray(i)?i[0]:i;const o=v.get(r);o&&(s="number"==typeof i?o.toDefaultUnit(i):i),e[r]=s}return n.length&&(e.transform=S(n)),e}(C));const R=function(t,e,{hover:n,onPointerEnter:r,onPointerLeave:i,poses:s}={},{hover:o},a){const[c,l]=tt(t,e,n,o,s);return a.hover=c,n?{onPointerEnter:t=>{null==r||r(t),l(!0)},onPointerLeave:t=>{null==i||i(t),l(!1)}}:{}}(L,U,i,D,M),F=function(t,e,{press:n,onPointerDown:r,poses:i}={},{press:s},o){const[a,c]=tt(t,e,n,s,i);if(o.press=a,!n)return{};const l=()=>{c(!1),window.removeEventListener("pointerup",l)};return{onPointerDown:t=>{null==r||r(t),c(!0),window.addEventListener("pointerup",l)}}}(L,U,i,D,M);!function(t,e,r,{inViewport:i,poses:s,viewport:o={},onViewportEnter:a,onViewportLeave:c},{inViewport:l},u){const{root:p,margin:f,once:h,threshold:y}=o,[m,d]=tt(e,r,i,l,s);u.inViewport=m;let v=!!i||!!a||!!c;h&&m&&(v=!1),n((()=>{if(!v||"undefined"==typeof IntersectionObserver)return;const e=new IntersectionObserver((([t])=>{d(t.isIntersecting);const e=t.isIntersecting?a:c;e&&e(t)}),{root:null==p?void 0:p.current,rootMargin:f,threshold:y});return e.observe(t.current),()=>e.disconnect()}),[i,a,c,p,f,y])}(l,L,U,i,D,M);const W=st(L,U,i,D);N(l,C,L,U,j,(t=>{P&&P(t),W&&W()}));const z=a(r,Object.assign({},k,R,F,{style:I.current,ref:l})),q=ct.reduce(((t,e)=>(t[e]=void 0,i[e]?"string"==typeof i[e]&&M[e]&&(t[e]=i[e]):D[e]&&(t[e]=D[e]),t)),{}),B=c((()=>q),Object.values(q));return t.createElement(ot.Provider,{value:B},z)}))}const ct=["initial","style","hover","press","inViewport","exit"],lt=new Map,ut=new Proxy({},{get:(t,e)=>(lt.has(e)||lt.set(e,at(e)),lt.get(e))});export{ut as animated};
import*as t from"react";import{useRef as e,useEffect as n,useState as r,createContext as i,useContext as s,forwardRef as o,createElement as a,useMemo as c}from"react";const l=new WeakMap;function u(t){return l.has(t)||l.set(t,{activeTransforms:[],activeAnimations:{}}),l.get(t)}const f=()=>{},p=t=>t,h=["","X","Y","Z"],y={x:"translateX",y:"translateY",z:"translateZ"},m={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},d={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:m,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:p},skew:m},v=new Map,g=t=>`--motion-${t}`,w=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{h.forEach((e=>{w.push(t+e),v.set(g(t+e),d[t])}))}));const b=(t,e)=>w.indexOf(t)-w.indexOf(e),O=new Set(w),x=t=>O.has(t),S=t=>t.sort(b).reduce(j,"").trim(),j=(t,e)=>`${t} ${e}(var(${g(e)}))`,A=t=>t.startsWith("--"),P=new Set;const T=t=>1e3*t;const V=t=>Array.isArray(t)&&"number"!=typeof t[0],k=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?M(t):t,M=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,D=t=>document.createElement("div").animate(t,{duration:.001}),E={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{D({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(D({opacity:[0,1]}).finished)},$={},C=Object.keys(E).reduce(((t,e)=>(t[e]=()=>(void 0===$[e]&&($[e]=E[e]()),$[e]),t)),{}),L={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},U=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function I(t,e,n,r){if(t===e&&n===r)return p;const i=e=>function(t,e,n,r,i){let s,o,a=0;do{o=e+(n-e)/2,s=U(o,r,i)-t,s>0?n=o:e=o}while(Math.abs(s)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:U(i(t),e,r)}var R=function(t,e,n){var r=e-t;return 0===r?1:(n-t)/r},F=function(t,e,n){return-n*t+n*e+t},W=function(t,e){return void 0===e&&(e="end"),function(n){var r,i,s,o=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,a="end"===e?Math.floor(o):Math.ceil(o);return r=0,i=1,s=a/t,Math.min(Math.max(s,r),i)}};const z={ease:I(.25,.1,.25,1),"ease-in":I(.42,0,1,1),"ease-in-out":I(.42,0,.58,1),"ease-out":I(0,0,.58,1)},q=/\((.*?)\)/;function B(t){if("function"==typeof t)return t;if(Array.isArray(t))return I(...t);if(z[t])return z[t];if(t.startsWith("steps")){const e=q.exec(t);if(e){const t=e[1].split(",");return W(parseFloat(t[0]),t[1].trim())}}return p}function K(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=R(0,e,r);t.push(F(n,1,i))}}function X(t,e=function(t){const e=[0];return K(e,t-1),e}(t.length),n=p){const r=t.length,i=r-e.length;return i>0&&K(e,i),i=>{let s=0;for(;s<r-2&&!(i<e[s+1]);s++);let o=(a=R(e[s],e[s+1],i),Math.min(1,Math.max(a,0)));var a;return o=function(t,e){return V(t)?t[(n=0,r=t.length,i=e,s=r-n,((i-n)%s+s)%s+n)]:t;var n,r,i,s}(n,s)(o),F(t[s],t[s+1],o)}}class Y{constructor(t,e,{easing:n=L.easing,duration:r=L.duration,delay:i=L.delay,endDelay:s=L.endDelay,offset:o,repeat:a=L.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const l=r*(a+1),u=X(e,o,V(n)?n.map(B):B(n));this.tick=e=>{if("finished"===this.playState){const e=u(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-i,0);const o=n/r;let a=Math.floor(o),f=o%1;!f&&o>=1&&(f=1),1===f&&a--;const p=a%2;("reverse"===c||"alternate"===c&&p||"alternate-reverse"===c&&!p)&&(f=1-f);const h=n>=l?1:Math.min(f,1),y=u(h);t(y);n>=l+s?(this.playState="finished",this.resolve(y)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const Z=(t,e)=>{let n=A(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=v.get(e);t&&(n=t.initialValue)}return n};function G(t,e,n,r={}){let{duration:i=L.duration,delay:s=L.delay,endDelay:o=L.endDelay,repeat:a=L.repeat,easing:c=L.easing,direction:l,offset:p,allowWebkitAcceleration:h=!1}=r;const m=u(t);let d=C.waapi(),w=f;const b=x(e);b&&(y[e]&&(e=y[e]),((t,e)=>{const{activeTransforms:n}=u(t);var r,i;i=e,-1===(r=n).indexOf(i)&&r.push(i),t.style.transform=S(n)})(t,e),e=g(e));const O=v.get(e);let j,M=function(t,e,n){for(let r=0;r<t.length;r++)null===t[r]&&(t[r]=r?t[r-1]:Z(e,n));return t}((t=>Array.isArray(t)?t:[t])(n),t,e);if(function(t,e){t.activeAnimations[e]&&(!function(t){try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(m,e),A(e)?(w=((t,e)=>n=>t.style.setProperty(e,n))(t,e),C.cssRegisterProperty()?function(t){if(!P.has(t)){P.add(t);try{const{syntax:e,initialValue:n}=v.has(t)?v.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):d=!1):w=((t,e)=>n=>t.style[e]=n)(t,e),d){O&&(M=M.map((t=>"number"==typeof t?O.toDefaultUnit(t):t))),C.partialKeyframes()||1!==M.length||M.unshift(Z(t,e));const n={delay:T(s),duration:T(i),endDelay:T(o),easing:V(c)?void 0:k(c),direction:l,iterations:a+1};j=t.animate({[e]:M,offset:p,easing:V(c)?c.map(k):void 0},n),j.finished||(j.finished=new Promise(((t,e)=>{j.onfinish=t,j.oncancel=e})));const r=M[M.length-1];j.finished.then((()=>w(r))).catch(f),h||(j.playbackRate=1.000001)}else if(b&&M.every(H)){if(1===M.length&&M.unshift(Z(t,e)||(null==O?void 0:O.initialValue)||0),M=M.map((t=>"string"==typeof t?parseFloat(t):t)),O){const t=w;w=e=>t(O.toDefaultUnit(e))}j=function(t,e=[0,1],n={}){return new Y(t,e,n)}(w,M,r)}else{const t=M[M.length-1];w(O&&"number"==typeof t?O.toDefaultUnit(t):t)}return m.activeAnimations[e]=j,null==j||j.finished.then((()=>m.activeAnimations[e]=void 0)).catch(f),j}const H=t=>"number"==typeof t;const J=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function N(t,r,i,s,o,a){const c=e(r);n((()=>{const e={};if(new Set([...Object.keys(i),...Object.keys(c.current)]).forEach((t=>{let n=i[t];var r,s;(r=n,s=c.current[t],typeof r==typeof s&&(Array.isArray(r)&&Array.isArray(s)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}(r,s):r===s))||(e[t]=n)})),Object.keys(e).length&&t.current){null==o||o(e);const n=[];for(const r in e){const i=G(t.current,r,e[r],J(s,r));i&&n.push(i)}Promise.all(n.map((t=>t.finished))).then((()=>null==a?void 0:a(e))).catch(f)}c.current=i}))}function Q(t,e,n={}){return t?"string"==typeof t?n[t]:t:e?n[e]:void 0}function _(t,e,n){if(n)for(const r in n)"options"!==r&&(t[r]=n[r],n.options&&(e[r]=J(n.options,r)))}function tt(t,e,n,i,s){const[o,a]=r(!1);return(o||i)&&_(t,e,Q(n,i,s)),[o||Boolean(i),a]}var et=i(null);var nt=0,rt=function(){return nt++},it=function(){return t=rt,null===(n=e(null)).current&&(n.current=t()),n.current;var t,n};function st(t,e,{exit:r,poses:i},{exit:o}){const[a,c]=function(){var t=s(et);if(null===t)return[!0,null];var e=t.isPresent,r=t.onExitComplete,i=t.register,o=it();return n((function(){return i(o)}),[]),!e&&r?[!1,function(){return null==r?void 0:r(o)}]:[!0]}();if(n((()=>{r||null==c||c()}),[a]),r&&!a)return _(t,e,Q(r,o,i)),c}const ot=i({});function at(r){return o((function(i,o){const l=e(null),{options:u,style:f,initial:p,hover:h,press:m,exit:d,inViewport:w,viewport:b,poses:O,onStart:j,onComplete:A,onViewportEnter:P,onViewportLeave:T,inherit:V=!0}=i,k=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["options","style","initial","hover","press","exit","inViewport","viewport","poses","onStart","onComplete","onViewportEnter","onViewportLeave","inherit"]),M={initial:!0,style:!0};let D=s(ot);V||(D={});const E=Q(f,D.style,O),$=Q(p,D.initial,O),C=Object.assign(Object.assign({},E),$),L=Object.assign(Object.assign({},$),E),U=Object.assign(Object.assign({},u),null==E?void 0:E.options),I=e(null);I.current||(I.current=function(t){const e={},n=[];for(let r in t){const i=t[r];x(r)&&(y[r]&&(r=y[r]),n.push(r),r=g(r));let s=Array.isArray(i)?i[0]:i;const o=v.get(r);o&&(s="number"==typeof i?o.toDefaultUnit(i):i),e[r]=s}return n.length&&(e.transform=S(n)),e}(C));const R=function(t,e,{hover:n,onPointerEnter:r,onPointerLeave:i,poses:s}={},{hover:o},a){const[c,l]=tt(t,e,n,o,s);return a.hover=c,n?{onPointerEnter:t=>{null==r||r(t),l(!0)},onPointerLeave:t=>{null==i||i(t),l(!1)}}:{}}(L,U,i,D,M),F=function(t,e,{press:n,onPointerDown:r,poses:i}={},{press:s},o){const[a,c]=tt(t,e,n,s,i);if(o.press=a,!n)return{};const l=()=>{c(!1),window.removeEventListener("pointerup",l)};return{onPointerDown:t=>{null==r||r(t),c(!0),window.addEventListener("pointerup",l)}}}(L,U,i,D,M);!function(t,e,r,{inViewport:i,poses:s,viewport:o={},onViewportEnter:a,onViewportLeave:c},{inViewport:l},u){const{root:f,margin:p,once:h,threshold:y}=o,[m,d]=tt(e,r,i,l,s);u.inViewport=m;let v=!!i||!!a||!!c;h&&m&&(v=!1),n((()=>{if(!v||"undefined"==typeof IntersectionObserver)return;const e=new IntersectionObserver((([t])=>{d(t.isIntersecting);const e=t.isIntersecting?a:c;e&&e(t)}),{root:null==f?void 0:f.current,rootMargin:p,threshold:y});return e.observe(t.current),()=>e.disconnect()}),[i,a,c,f,p,y])}(l,L,U,i,D,M);const W=st(L,U,i,D);N(l,C,L,U,j,(t=>{A&&A(t),W&&W()}));const z=a(r,Object.assign({},k,R,F,{style:I.current,ref:l})),q=ct.reduce(((t,e)=>(t[e]=void 0,i[e]?"string"==typeof i[e]&&M[e]&&(t[e]=i[e]):D[e]&&(t[e]=D[e]),t)),{}),B=c((()=>q),Object.values(q));return t.createElement(ot.Provider,{value:B},z)}))}const ct=["initial","style","hover","press","inViewport","exit"],lt=new Map,ut=new Proxy({},{get:(t,e)=>(lt.has(e)||lt.set(e,at(e)),lt.get(e))});export{ut as animated};

@@ -1,1 +0,1 @@

var t=function(t,e,n){var a=e-t;return 0===a?1:(n-t)/a},e=function(t,e,n){return-n*t+n*e+t},n=function(t,e){return void 0===e&&(e="end"),function(n){var a,i,s,r=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(r):Math.ceil(r);return a=0,i=1,s=o/t,Math.min(Math.max(s,a),i)}};const a=()=>{},i=t=>t,s=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function r(t,e,n,a){if(t===e&&n===a)return i;const r=e=>function(t,e,n,a,i){let r,o,c=0;do{o=e+(n-e)/2,r=s(o,a,i)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++c<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:s(r(t),e,a)}const o={ease:r(.25,.1,.25,1),"ease-in":r(.42,0,1,1),"ease-in-out":r(.42,0,.58,1),"ease-out":r(0,0,.58,1)},c=/\((.*?)\)/;function l(t){if("function"==typeof t)return t;if(Array.isArray(t))return r(...t);if(o[t])return o[t];if(t.startsWith("steps")){const e=c.exec(t);if(e){const t=e[1].split(",");return n(parseFloat(t[0]),t[1].trim())}}return i}function u(t,e,n){return"function"==typeof t?t(e,n):t}function h(n,a){const i=n[n.length-1];for(let s=1;s<=a;s++){const r=t(0,a,s);n.push(e(i,1,r))}}function f(t){const e=[0];return h(e,t-1),e}const p=new WeakMap;function m(t){return p.has(t)||p.set(t,{activeTransforms:[],activeAnimations:{}}),p.get(t)}function y(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const d=["","X","Y","Z"],g={x:"translateX",y:"translateY",z:"translateZ"},v={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},b={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:v,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:i},skew:v},w=new Map,O=t=>`--motion-${t}`,x=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{d.forEach((e=>{x.push(t+e),w.set(O(t+e),b[t])}))}));const T=(t,e)=>x.indexOf(t)-x.indexOf(e),S=new Set(x),A=t=>t.sort(T).reduce(M,"").trim(),M=(t,e)=>`${t} ${e}(var(${O(e)}))`,j=t=>t.startsWith("--"),k=new Set;const P=t=>1e3*t;function D(t){try{t.commitStyles(),t.cancel()}catch(t){}}const E=t=>Array.isArray(t)&&"number"!=typeof t[0],V=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?$(t):t,$=([t,e,n,a])=>`cubic-bezier(${t}, ${e}, ${n}, ${a})`,R=t=>document.createElement("div").animate(t,{duration:.001}),U={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{R({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(R({opacity:[0,1]}).finished)},W={},F=Object.keys(U).reduce(((t,e)=>(t[e]=()=>(void 0===W[e]&&(W[e]=U[e]()),W[e]),t)),{}),q={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"};function C(t,e){return E(t)?t[(n=0,a=t.length,i=e,s=a-n,((i-n)%s+s)%s+n)]:t;var n,a,i,s}function z(n,a=f(n.length),s=i){const r=n.length,o=r-a.length;return o>0&&h(a,o),i=>{let o=0;for(;o<r-2&&!(i<a[o+1]);o++);let c=(l=t(a[o],a[o+1],i),Math.min(1,Math.max(l,0)));var l;return c=C(s,o)(c),e(n[o],n[o+1],c)}}class K{constructor(t,e,{easing:n=q.easing,duration:a=q.duration,delay:i=q.delay,endDelay:s=q.endDelay,offset:r,repeat:o=q.repeat,direction:c="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const u=a*(o+1),h=z(e,r,E(n)?n.map(l):l(n));this.tick=e=>{if("finished"===this.playState){const e=h(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-i,0);const r=n/a;let o=Math.floor(r),l=r%1;!l&&r>=1&&(l=1),1===l&&o--;const f=o%2;("reverse"===c||"alternate"===c&&f||"alternate-reverse"===c&&!f)&&(l=1-l);const p=n>=u?1:Math.min(l,1),m=h(p);t(m);n>=u+s?(this.playState="finished",this.resolve(m)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const X=(t,e)=>{let n=j(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=w.get(e);t&&(n=t.initialValue)}return n};const Y=t=>Array.isArray(t)?t:[t];function Z(t,e,n,i={}){let{duration:s=q.duration,delay:r=q.delay,endDelay:o=q.endDelay,repeat:c=q.repeat,easing:l=q.easing,direction:u,offset:h,allowWebkitAcceleration:f=!1}=i;const p=m(t);let y=F.waapi(),d=a;const v=(t=>S.has(t))(e);v&&(g[e]&&(e=g[e]),((t,e)=>{const{activeTransforms:n}=m(t);var a,i;i=e,-1===(a=n).indexOf(i)&&a.push(i),t.style.transform=A(n)})(t,e),e=O(e));const b=w.get(e);let x,T=function(t,e,n){for(let a=0;a<t.length;a++)null===t[a]&&(t[a]=a?t[a-1]:X(e,n));return t}(Y(n),t,e);if(function(t,e){t.activeAnimations[e]&&(D(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(p,e),j(e)?(d=((t,e)=>n=>t.style.setProperty(e,n))(t,e),F.cssRegisterProperty()?function(t){if(!k.has(t)){k.add(t);try{const{syntax:e,initialValue:n}=w.has(t)?w.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):y=!1):d=((t,e)=>n=>t.style[e]=n)(t,e),y){b&&(T=T.map((t=>"number"==typeof t?b.toDefaultUnit(t):t))),F.partialKeyframes()||1!==T.length||T.unshift(X(t,e));const n={delay:P(r),duration:P(s),endDelay:P(o),easing:E(l)?void 0:V(l),direction:u,iterations:c+1};x=t.animate({[e]:T,offset:h,easing:E(l)?l.map(V):void 0},n),x.finished||(x.finished=new Promise(((t,e)=>{x.onfinish=t,x.oncancel=e})));const i=T[T.length-1];x.finished.then((()=>d(i))).catch(a),f||(x.playbackRate=1.000001)}else if(v&&T.every(B)){if(1===T.length&&T.unshift(X(t,e)||(null==b?void 0:b.initialValue)||0),T=T.map((t=>"string"==typeof t?parseFloat(t):t)),b){const t=d;d=e=>t(b.toDefaultUnit(e))}x=function(t,e=[0,1],n={}){return new K(t,e,n)}(d,T,i)}else{const t=T[T.length-1];d(b&&"number"==typeof t?b.toDefaultUnit(t):t)}return p.activeAnimations[e]=x,x}const B=t=>"number"==typeof t,I={get:(t,e)=>{var n,i;switch(e){case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(G)).catch(a)),t.finished;case"currentTime":const s=(null===(n=t.animations[0])||void 0===n?void 0:n[e])||0;return s?s/1e3:0;case"playbackRate":return null===(i=t.animations[0])||void 0===i?void 0:i[e];case"stop":return()=>t.animations.forEach(D);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=P(n);case"currentTime":case"playbackRate":for(let a=0;a<t.animations.length;a++)t.animations[a][e]=n;return!0}return!1}},G=t=>t.finished,H=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function J(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}function L(t,e,n,a){var i;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(i=a.get(e))&&void 0!==i?i:t}function N(t,n,a,i,s,r){!function(t,e,n){for(let a=0;a<t.length;a++){const i=t[a];i.at>e&&i.at<n&&(y(t,i),a--)}}(t,s,r);for(let o=0;o<n.length;o++)t.push({value:n[o],at:e(s,r,i[o]),easing:C(a,o)})}function Q(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function _(t,e={}){const n=[],a=tt(t,e);for(let t=0;t<a.length;t++){const e=Z(...a[t]);e&&n.push(e)}return(t=>new Proxy({animations:t},I))(n)}function tt(e,n={}){var{defaultOptions:a={}}=n,i=function(t,e){var n={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.indexOf(a)<0&&(n[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(t);i<a.length;i++)e.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(t,a[i])&&(n[a[i]]=t[a[i]])}return n}(n,["defaultOptions"]);const s=[],r=new Map,o={},c=new Map;let l=0,p=0,m=0;for(let t=0;t<e.length;t++){const[n,i,s={}]=e[t];void 0!==s.at&&(p=L(p,s.at,l,c));let y=0;const d=J(n,o),g=d.length;for(let t=0;t<g;t++){const e=et(d[t],r);for(const n in i){const r=nt(n,e),o=Y(i[n]),c=H(s,n),{duration:l=a.duration||q.duration,easing:d=a.easing||q.easing,offset:v=f(o.length)}=c,b=u(s.delay,t,g)||0,w=p+b,O=w+l;1===v.length&&0===v[0]&&(v[1]=1);const x=length-o.length;x>0&&h(v,x),1===o.length&&o.unshift(null),N(r,o,d,v,w,O),y=Math.max(b+l,y),m=Math.max(O,m)}}l=p,p+=y}return r.forEach(((e,n)=>{for(const r in e){const o=e[r];o.sort(Q);const c=[],l=[],u=[];for(let e=0;e<o.length;e++){const{at:n,value:a,easing:i}=o[e];c.push(a),l.push(t(0,m,n)),u.push(i||q.easing)}1!==l[l.length-1]&&(l.push(1),c.push(null)),s.push([n,r,c,Object.assign(Object.assign(Object.assign({},a),{duration:m,easing:u,offset:l}),i)])}})),s}function et(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function nt(t,e){return e[t]||(e[t]=[]),e[t]}export{tt as createAnimationsFromTimeline,_ as timeline};
var t=function(t,e,n){var i=e-t;return 0===i?1:(n-t)/i},e=function(t,e,n){return-n*t+n*e+t},n=function(t,e){return void 0===e&&(e="end"),function(n){var i,a,r,s=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,o="end"===e?Math.floor(s):Math.ceil(s);return i=0,a=1,r=o/t,Math.min(Math.max(r,i),a)}};const i=()=>{},a=t=>t,r=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function s(t,e,n,i){if(t===e&&n===i)return a;const s=e=>function(t,e,n,i,a){let s,o,l=0;do{o=e+(n-e)/2,s=r(o,i,a)-t,s>0?n=o:e=o}while(Math.abs(s)>1e-7&&++l<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:r(s(t),e,i)}const o={ease:s(.25,.1,.25,1),"ease-in":s(.42,0,1,1),"ease-in-out":s(.42,0,.58,1),"ease-out":s(0,0,.58,1)},l=/\((.*?)\)/;function c(t){if("function"==typeof t)return t;if(Array.isArray(t))return s(...t);if(o[t])return o[t];if(t.startsWith("steps")){const e=l.exec(t);if(e){const t=e[1].split(",");return n(parseFloat(t[0]),t[1].trim())}}return a}function u(t,e,n){return"function"==typeof t?t(e,n):t}function h(n,i){const a=n[n.length-1];for(let r=1;r<=i;r++){const s=t(0,i,r);n.push(e(a,1,s))}}function f(t){const e=[0];return h(e,t-1),e}const p=new WeakMap;function d(t){return p.has(t)||p.set(t,{activeTransforms:[],activeAnimations:{}}),p.get(t)}function m(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const y=["","X","Y","Z"],g={x:"translateX",y:"translateY",z:"translateZ"},v={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},b={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:v,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:a},skew:v},w=new Map,O=t=>`--motion-${t}`,x=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{y.forEach((e=>{x.push(t+e),w.set(O(t+e),b[t])}))}));const T=(t,e)=>x.indexOf(t)-x.indexOf(e),S=new Set(x),A=t=>t.sort(T).reduce(M,"").trim(),M=(t,e)=>`${t} ${e}(var(${O(e)}))`,j=t=>t.startsWith("--"),k=new Set;const P=t=>1e3*t;function D(t){try{"finished"!==t.playState&&t.commitStyles(),t.cancel()}catch(t){}}const E=t=>Array.isArray(t)&&"number"!=typeof t[0],V=t=>(t=>Array.isArray(t)&&"number"==typeof t[0])(t)?$(t):t,$=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,R=t=>document.createElement("div").animate(t,{duration:.001}),U={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{R({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(R({opacity:[0,1]}).finished)},W={},F=Object.keys(U).reduce(((t,e)=>(t[e]=()=>(void 0===W[e]&&(W[e]=U[e]()),W[e]),t)),{}),q={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"};function C(t,e){return E(t)?t[(n=0,i=t.length,a=e,r=i-n,((a-n)%r+r)%r+n)]:t;var n,i,a,r}function z(n,i=f(n.length),r=a){const s=n.length,o=s-i.length;return o>0&&h(i,o),a=>{let o=0;for(;o<s-2&&!(a<i[o+1]);o++);let l=(c=t(i[o],i[o+1],a),Math.min(1,Math.max(c,0)));var c;return l=C(r,o)(l),e(n[o],n[o+1],l)}}class K{constructor(t,e,{easing:n=q.easing,duration:i=q.duration,delay:a=q.delay,endDelay:r=q.endDelay,offset:s,repeat:o=q.repeat,direction:l="normal"}){this.startTime=0,this.rate=1,this.t=0,this.cancelT=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e}));const u=i*(o+1),h=z(e,s,E(n)?n.map(c):c(n));this.tick=e=>{if("finished"===this.playState){const e=h(1);return t(e),void this.resolve(e)}this.pauseTime&&(e=this.pauseTime);let n=(e-this.startTime)*this.rate;this.t=n,n/=1e3,n=Math.max(n-a,0);const s=n/i;let o=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&o--;const f=o%2;("reverse"===l||"alternate"===l&&f||"alternate-reverse"===l&&!f)&&(c=1-c);const p=n>=u?1:Math.min(c,1),d=h(p);t(d);n>=u+r?(this.playState="finished",this.resolve(d)):"idle"!==this.playState&&requestAnimationFrame(this.tick)},this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime?this.startTime=t-(this.pauseTime-this.startTime):this.startTime||(this.startTime=t),this.pauseTime=void 0,requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=performance.now()}finish(){this.playState="finished",this.tick(0)}cancel(){this.playState="idle",this.tick(this.cancelT),this.reject(!1)}reverse(){this.rate*=-1}commitStyles(){this.cancelT=this.t}get currentTime(){return this.t}set currentTime(t){this.pauseTime||0===this.rate?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}const X=(t,e)=>{let n=j(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=w.get(e);t&&(n=t.initialValue)}return n};const Y=t=>Array.isArray(t)?t:[t];function Z(t,e,n,a={}){let{duration:r=q.duration,delay:s=q.delay,endDelay:o=q.endDelay,repeat:l=q.repeat,easing:c=q.easing,direction:u,offset:h,allowWebkitAcceleration:f=!1}=a;const p=d(t);let m=F.waapi(),y=i;const v=(t=>S.has(t))(e);v&&(g[e]&&(e=g[e]),((t,e)=>{const{activeTransforms:n}=d(t);var i,a;a=e,-1===(i=n).indexOf(a)&&i.push(a),t.style.transform=A(n)})(t,e),e=O(e));const b=w.get(e);let x,T=function(t,e,n){for(let i=0;i<t.length;i++)null===t[i]&&(t[i]=i?t[i-1]:X(e,n));return t}(Y(n),t,e);if(function(t,e){t.activeAnimations[e]&&(D(t.activeAnimations[e]),t.activeAnimations[e]=void 0)}(p,e),j(e)?(y=((t,e)=>n=>t.style.setProperty(e,n))(t,e),F.cssRegisterProperty()?function(t){if(!k.has(t)){k.add(t);try{const{syntax:e,initialValue:n}=w.has(t)?w.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(e):m=!1):y=((t,e)=>n=>t.style[e]=n)(t,e),m){b&&(T=T.map((t=>"number"==typeof t?b.toDefaultUnit(t):t))),F.partialKeyframes()||1!==T.length||T.unshift(X(t,e));const n={delay:P(s),duration:P(r),endDelay:P(o),easing:E(c)?void 0:V(c),direction:u,iterations:l+1};x=t.animate({[e]:T,offset:h,easing:E(c)?c.map(V):void 0},n),x.finished||(x.finished=new Promise(((t,e)=>{x.onfinish=t,x.oncancel=e})));const a=T[T.length-1];x.finished.then((()=>y(a))).catch(i),f||(x.playbackRate=1.000001)}else if(v&&T.every(B)){if(1===T.length&&T.unshift(X(t,e)||(null==b?void 0:b.initialValue)||0),T=T.map((t=>"string"==typeof t?parseFloat(t):t)),b){const t=y;y=e=>t(b.toDefaultUnit(e))}x=function(t,e=[0,1],n={}){return new K(t,e,n)}(y,T,a)}else{const t=T[T.length-1];y(b&&"number"==typeof t?b.toDefaultUnit(t):t)}return p.activeAnimations[e]=x,null==x||x.finished.then((()=>p.activeAnimations[e]=void 0)).catch(i),x}const B=t=>"number"==typeof t,I=t=>t.animations[0],G={get:(t,e)=>{var n,a;switch(e){case"duration":return t.duration;case"currentTime":let r=(null===(n=I(t))||void 0===n?void 0:n[e])||0;return r?r/1e3:0;case"playbackRate":return null===(a=I(t))||void 0===a?void 0:a[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(H)).catch(i)),t.finished;case"stop":return()=>t.animations.forEach(D);default:return()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=P(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},H=t=>t.finished,J=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function L(t,e){var n;return"string"==typeof t?e?(null!==(n=e[t])&&void 0!==n||(e[t]=document.querySelectorAll(t)),t=e[t]):t=document.querySelectorAll(t):t instanceof Element&&(t=[t]),Array.from(t)}function N(t,e,n,i){var a;return"number"==typeof e?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(a=i.get(e))&&void 0!==a?a:t}function Q(t,n,i,a,r,s){!function(t,e,n){for(let i=0;i<t.length;i++){const a=t[i];a.at>e&&a.at<n&&(m(t,a),i--)}}(t,r,s);for(let o=0;o<n.length;o++)t.push({value:n[o],at:e(r,s,a[o]),easing:C(i,o)})}function _(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function tt(t,e={}){var n,i;const a=[],r=et(t,e);for(let t=0;t<r.length;t++){const e=Z(...r[t]);e&&a.push(e)}return((t,e)=>new Proxy({animations:t,duration:e},G))(a,null!==(i=null===(n=r[0])||void 0===n?void 0:n[3].duration)&&void 0!==i?i:q.duration)}function et(e,n={}){var{defaultOptions:i={}}=n,a=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(n[i[a]]=t[i[a]])}return n}(n,["defaultOptions"]);const r=[],s=new Map,o={},l=new Map;let c=0,p=0,d=0;for(let t=0;t<e.length;t++){const[n,a,r={}]=e[t];void 0!==r.at&&(p=N(p,r.at,c,l));let m=0;const y=L(n,o),g=y.length;for(let t=0;t<g;t++){const e=nt(y[t],s);for(const n in a){const s=it(n,e),o=Y(a[n]),l=J(r,n),{duration:c=i.duration||q.duration,easing:y=i.easing||q.easing,offset:v=f(o.length)}=l,b=u(r.delay,t,g)||0,w=p+b,O=w+c;1===v.length&&0===v[0]&&(v[1]=1);const x=length-o.length;x>0&&h(v,x),1===o.length&&o.unshift(null),Q(s,o,y,v,w,O),m=Math.max(b+c,m),d=Math.max(O,d)}}c=p,p+=m}return s.forEach(((e,n)=>{for(const s in e){const o=e[s];o.sort(_);const l=[],c=[],u=[];for(let e=0;e<o.length;e++){const{at:n,value:i,easing:a}=o[e];l.push(i),c.push(t(0,d,n)),u.push(a||q.easing)}1!==c[c.length-1]&&(c.push(1),l.push(null)),r.push([n,s,l,Object.assign(Object.assign(Object.assign({},i),{duration:d,easing:u,offset:c}),a)])}})),r}function nt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function it(t,e){return e[t]||(e[t]=[]),e[t]}export{et as createAnimationsFromTimeline,tt as timeline};

@@ -142,2 +142,6 @@ 'use strict';

data$1.activeAnimations[name] = animation;
/**
* When an animation finishes, delete the reference to the previous animation.
*/
animation === null || animation === void 0 ? void 0 : animation.finished.then(() => (data$1.activeAnimations[name] = undefined)).catch(noop.noop);
return animation;

@@ -144,0 +148,0 @@ }

@@ -138,2 +138,6 @@ import { getAnimationData } from './data.es.js';

data.activeAnimations[name] = animation;
/**
* When an animation finishes, delete the reference to the previous animation.
*/
animation === null || animation === void 0 ? void 0 : animation.finished.then(() => (data.activeAnimations[name] = undefined)).catch(noop);
return animation;

@@ -140,0 +144,0 @@ }

@@ -10,4 +10,6 @@ 'use strict';

var stagger = require('../../utils/stagger.cjs.js');
var defaults = require('./utils/defaults.cjs.js');
function animate(elements, keyframes, options$1 = {}) {
var _a;
elements = resolveElements.resolveElements(elements);

@@ -25,5 +27,5 @@ const animations = [];

}
return controls.createAnimationControls(animations);
return controls.createAnimationControls(animations, (_a = options$1.duration) !== null && _a !== void 0 ? _a : defaults.defaults.duration);
}
exports.animate = animate;

@@ -6,4 +6,6 @@ import { animateStyle } from './animate-style.es.js';

import { resolveOption } from '../../utils/stagger.es.js';
import { defaults } from './utils/defaults.es.js';
function animate(elements, keyframes, options = {}) {
var _a;
elements = resolveElements(elements);

@@ -21,5 +23,5 @@ const animations = [];

}
return createAnimationControls(animations);
return createAnimationControls(animations, (_a = options.duration) !== null && _a !== void 0 ? _a : defaults.duration);
}
export { animate };

@@ -20,2 +20,3 @@ 'use strict';

function timeline(definition, options = {}) {
var _a, _b;
const animations = [];

@@ -27,3 +28,5 @@ const animationDefinitions = createAnimationsFromTimeline(definition, options);

}
return controls.createAnimationControls(animations);
return controls.createAnimationControls(animations,
// Get the duration from the first animation definition
(_b = (_a = animationDefinitions[0]) === null || _a === void 0 ? void 0 : _a[3].duration) !== null && _b !== void 0 ? _b : defaults.defaults.duration);
}

@@ -30,0 +33,0 @@ function createAnimationsFromTimeline(definition, _a = {}) {

@@ -16,2 +16,3 @@ import { __rest } from 'tslib';

function timeline(definition, options = {}) {
var _a, _b;
const animations = [];

@@ -23,3 +24,5 @@ const animationDefinitions = createAnimationsFromTimeline(definition, options);

}
return createAnimationControls(animations);
return createAnimationControls(animations,
// Get the duration from the first animation definition
(_b = (_a = animationDefinitions[0]) === null || _a === void 0 ? void 0 : _a[3].duration) !== null && _b !== void 0 ? _b : defaults.duration);
}

@@ -26,0 +29,0 @@ function createAnimationsFromTimeline(definition, _a = {}) {

@@ -9,3 +9,9 @@ 'use strict';

const createAnimationControls = (animations) => new Proxy({ animations }, controls);
const createAnimationControls = (animations, duration) => new Proxy({ animations, duration }, controls);
/**
* TODO:
* Currently this returns the first animation, ideally it would return
* the first active animation.
*/
const getActiveAnimation = (state) => state.animations[0];
const controls = {

@@ -15,2 +21,9 @@ get: (target, key) => {

switch (key) {
case "duration":
return target.duration;
case "currentTime":
let time = ((_a = getActiveAnimation(target)) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return time ? time / 1000 : 0;
case "playbackRate":
return (_b = getActiveAnimation(target)) === null || _b === void 0 ? void 0 : _b[key];
case "finished":

@@ -21,9 +34,2 @@ if (!target.finished) {

return target.finished;
case "currentTime":
// TODO Find first active animation
const duration = ((_a = target.animations[0]) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return duration ? duration / 1000 : 0;
case "playbackRate":
// TODO Find first active animation
return (_b = target.animations[0]) === null || _b === void 0 ? void 0 : _b[key];
case "stop":

@@ -30,0 +36,0 @@ return () => target.animations.forEach(stopAnimation.stopAnimation);

@@ -5,3 +5,9 @@ import { noop } from '../../../utils/noop.es.js';

const createAnimationControls = (animations) => new Proxy({ animations }, controls);
const createAnimationControls = (animations, duration) => new Proxy({ animations, duration }, controls);
/**
* TODO:
* Currently this returns the first animation, ideally it would return
* the first active animation.
*/
const getActiveAnimation = (state) => state.animations[0];
const controls = {

@@ -11,2 +17,9 @@ get: (target, key) => {

switch (key) {
case "duration":
return target.duration;
case "currentTime":
let time = ((_a = getActiveAnimation(target)) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return time ? time / 1000 : 0;
case "playbackRate":
return (_b = getActiveAnimation(target)) === null || _b === void 0 ? void 0 : _b[key];
case "finished":

@@ -17,9 +30,2 @@ if (!target.finished) {

return target.finished;
case "currentTime":
// TODO Find first active animation
const duration = ((_a = target.animations[0]) === null || _a === void 0 ? void 0 : _a[key]) || 0;
return duration ? duration / 1000 : 0;
case "playbackRate":
// TODO Find first active animation
return (_b = target.animations[0]) === null || _b === void 0 ? void 0 : _b[key];
case "stop":

@@ -26,0 +32,0 @@ return () => target.animations.forEach(stopAnimation);

@@ -8,3 +8,6 @@ 'use strict';

try {
animation.commitStyles();
/**
* commitStyles has overhead so we only want to commit and cancel
*/
animation.playState !== "finished" && animation.commitStyles();
animation.cancel();

@@ -11,0 +14,0 @@ }

function stopAnimation(animation) {
// Suppress error thrown by WAAPI
try {
animation.commitStyles();
/**
* commitStyles has overhead so we only want to commit and cancel
*/
animation.playState !== "finished" && animation.commitStyles();
animation.cancel();

@@ -6,0 +9,0 @@ }

{
"name": "motion",
"version": "10.0.3",
"version": "10.1.0",
"description": "The Motion library for the web",

@@ -20,3 +20,3 @@ "author": "Matt Perry",

"scripts": {
"build": "rm -rf lib dist types && tsc -p . && rollup -c && bundlesize",
"build": "rm -rf lib dist types && tsc -p . && rollup -c && npm run measure",
"test": "jest --coverage --config jest.config.json --maxWorkers=2",

@@ -32,2 +32,3 @@ "test-react": "",

"dev": "python -m SimpleHTTPServer",
"measure": "webpack --config webpack.config.js && bundlesize",
"build-storybook": "build-storybook"

@@ -56,4 +57,3 @@ },

"popmotion": "^9.3.5",
"tslib": "^2.3.0",
"web-animations-js": "^2.3.2"
"tslib": "^2.3.0"
},

@@ -93,3 +93,5 @@ "peerDependencies": {

"concurrently": "^6.2.0",
"convert-tsconfig-paths-to-webpack-aliases": "^0.9.2",
"cypress": "^7.6.0",
"gsap": "^3.7.1",
"husky": "=4",

@@ -103,4 +105,9 @@ "jest": "^26.6.3",

"start-server-and-test": "^1.12.5",
"terser-webpack-plugin": "^4.2.3",
"ts-jest": "^26.5.4",
"typescript": "^4.4.0-beta"
"ts-loader": "^8.3.0",
"typescript": "^4.4.0-beta",
"web-animations-js": "^2.3.2",
"webpack": "^4.46.0",
"webpack-cli": "^4.8.0"
},

@@ -138,3 +145,3 @@ "husky": {

"path": "./dist/size-timeline-dom.js",
"maxSize": "3.85 kB"
"maxSize": "3.9 kB"
},

@@ -148,4 +155,8 @@ {

"maxSize": "4.4 kB"
},
{
"path": "./dist/size-webpack-animate.js",
"maxSize": "3.5 kB"
}
]
}

@@ -16,4 +16,3 @@ # Motion One

- [Martin Pitt](https://github.com/Martin-Pitt)
- [Leonard Bogdonoff](https://github.com/rememberlenny)
[Become a sponsor](https://github.com/sponsors/mattgperry) and get access to the private Motion One repo. File issues, read the changelog and source code, and join discussions that help shape the future of the API.

@@ -69,2 +69,3 @@ import { OptionResolver } from "../../utils/stagger";

}
export declare type PlayState = "idle" | "running" | "paused" | "finished";
export interface BasicAnimationControls {

@@ -75,2 +76,3 @@ pause: () => void;

cancel: () => void;
playState: PlayState;
}

@@ -90,2 +92,3 @@ export declare type AnimationListOptions = Omit<AnimationOptionsWithOverrides, "delay"> & {

currentTime: number | null;
duration: number;
playbackRate: number;

@@ -92,0 +95,0 @@ }

import { AnimationControls, AnimationWithCommitStyles } from "../types";
interface AnimationState {
duration: number;
animations: AnimationWithCommitStyles[];
finished?: Promise<any>;
}
export declare const createAnimationControls: (animations: AnimationWithCommitStyles[]) => AnimationControls;
export declare const createAnimationControls: (animations: AnimationWithCommitStyles[], duration: number) => AnimationControls;
export declare const controls: {
get: (target: AnimationState, key: string) => number | Promise<any> | (() => void);
get: (target: AnimationState, key: string) => number | Promise<any> | (() => void) | undefined;
set: (target: AnimationState, key: string, value: number) => boolean;
};
export {};
import { AnimationControls, AnimationOptions } from "../dom/types";
export declare class Animation implements Omit<AnimationControls, "stop"> {
export declare class Animation implements Omit<AnimationControls, "stop" | "duration"> {
private resolve;

@@ -4,0 +4,0 @@ private reject;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc