motion 10.13.1 → 10.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  Motion One adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [10.14.0] [2022-08-17]
6
+
7
+ ### Added
8
+
9
+ - Support for `glide` and `spring` for non-transform numerical values.
10
+ - Support for animating transforms as unit values.
11
+
12
+ ## [10.13.3] [2022-08-12]
13
+
14
+ ### Fixed
15
+
16
+ - Fixing `InViewOptions` within Motion One for Solid.
17
+
18
+ ## [10.13.2] [2022-08-05]
19
+
20
+ ### Fixed
21
+
22
+ - Making `BezierDefinition` `readonly`.
23
+
5
24
  ## [10.13.1] [2022-07-18]
6
25
 
7
26
  ### Added
package/README.md CHANGED
@@ -16,14 +16,12 @@ Create Motion One and CSS animations faster than ever with [Motion DevTools](htt
16
16
 
17
17
  A huge thank you to all sponsors of this project, with a special shoutout to:
18
18
 
19
- - [Victor Pontis](https://github.com/vpontis)
20
19
  - [‹div›RIOTS](https://github.com/divriots)
21
20
  - [Alex Frazer](https://github.com/AlexFrazer)
22
- - [Derek Reynolds](https://github.com/derekr)
23
21
  - [Martin Pitt](https://github.com/Martin-Pitt)
24
22
  - [Mihael Konjević](https://github.com/retro)
25
23
  - [impactvelocity](https://github.com/impactvelocity)
26
24
  - [Namit Chadha](https://github.com/nc)
27
25
  - [Adam Snodgrass](https://twitter.com/overra)
28
26
 
29
- [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.
27
+ [Become a sponsor](https://motion.dev/pro).
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Motion={})}(this,(function(t){"use strict";class e{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const n=new WeakMap;function i(t){return n.has(t)||n.set(t,{transforms:[],values:new Map}),n.get(t)}function r(t,e){-1===t.indexOf(e)&&t.push(e)}function o(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const s=(t,e,n)=>Math.min(Math.max(n,t),e),a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},c=t=>"number"==typeof t,l=t=>Array.isArray(t)&&!c(t[0]);function u(t,e){return l(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const f=(t,e,n)=>-n*t+n*e+t,h=()=>{},d=t=>t,g=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=g(0,e,i);t.push(f(n,1,r))}}function m(t){const e=[0];return p(e,t-1),e}function y(t,e=m(t.length),n=d){const i=t.length,r=i-e.length;return r>0&&p(e,r),r=>{let o=0;for(;o<i-2&&!(r<e[o+1]);o++);let a=s(0,1,g(e[o],e[o+1],r));return a=u(n,o)(a),f(t[o],t[o+1],a)}}const v=t=>"object"==typeof t&&Boolean(t.createAnimation),w=t=>"function"==typeof t,b=t=>"string"==typeof t,E=t=>1e3*t,x=t=>t/1e3;function O(t,e){return e?t*(1e3/e):0}const S=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},T={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},A={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:T,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:d},skew:T},D=new Map,L=t=>`--motion-${t}`,k=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{S.forEach((e=>{k.push(t+e),D.set(L(t+e),A[t])}))}));const W=(t,e)=>k.indexOf(t)-k.indexOf(e),j=new Set(k),R=t=>j.has(t),z=t=>t.sort(W).reduce(B,"").trim(),B=(t,e)=>`${t} ${e}(var(${L(e)}))`,P=t=>t.startsWith("--"),V=new Set;const $=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function q(t,e,n,i){if(t===e&&n===i)return d;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=$(s,i,r)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:$(r(t),e,i)}const C={ease:q(.25,.1,.25,1),"ease-in":q(.42,0,1,1),"ease-in-out":q(.42,0,.58,1),"ease-out":q(0,0,.58,1)},F=/\((.*?)\)/;function H(t){if(w(t))return t;if(Array.isArray(t))return q(...t);if(C[t])return C[t];if(t.startsWith("steps")){const e=F.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(i):Math.ceil(i);return s(0,1,r/t)})(parseFloat(t[0]),t[1].trim())}}return d}class I{constructor(t,e=[0,1],{easing:n,duration:i=a.duration,delay:r=a.delay,endDelay:o=a.endDelay,repeat:s=a.repeat,offset:c,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=d,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),n=n||a.easing,v(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(i=t.duration)}this.repeat=s,this.easing=l(n)?d:H(n),this.updateDuration(i);const f=y(e,c,l(n)?n.map(H):d);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-r,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const s=i/this.duration;let a=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&a--;const l=a%2;("reverse"===u||"alternate"===u&&l||"alternate-reverse"===u&&!l)&&(c=1-c);const h=i>=this.totalDuration?1:Math.min(c,1),d=f(this.easing(h));t(d);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+o)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 U=(t,e)=>document.createElement("div").animate(t,e),_={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{U({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(U({opacity:[0,1]},{duration:.001}).finished),linearEasing:()=>{try{U({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},N={},G={};for(const t in _)G[t]=()=>(void 0===N[t]&&(N[t]=_[t]()),N[t]);const Z=(t,e)=>w(t)?G.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(g(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:a.easing:(t=>Array.isArray(t)&&c(t[0]))(t)?K(t):t,K=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const X=t=>Array.isArray(t)?t:[t];function Y(t){return M[t]&&(t=M[t]),R(t)?L(t):t}const J={get:(t,e)=>{e=Y(e);let n=P(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=D.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=Y(e),P(e)?t.style.setProperty(e,n):t.style[e]=n}};function Q(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function tt(t,n,o,s={}){const u=window.__MOTION_DEV_TOOLS_RECORD,f=!1!==s.record&&u;let d,{duration:g=a.duration,delay:p=a.delay,endDelay:m=a.endDelay,repeat:y=a.repeat,easing:b=a.easing,direction:x,offset:O,allowWebkitAcceleration:S=!1}=s;const T=i(t),A=R(n);let L=G.waapi();A&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:n}=i(t);r(n,e),t.style.transform=z(n)})(t,n);const k=Y(n),W=function(t,n){return t.has(n)||t.set(n,new e),t.get(n)}(T.values,k),j=D.get(k);return Q(W.animation,!(v(b)&&W.generator)&&!1!==s.record),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=J.get(t,k))&&void 0!==e?e:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let i=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(X(o),e);if(v(b)){const t=b.createAnimation(i,e,A,k,W);b=t.easing,void 0!==t.keyframes&&(i=t.keyframes),void 0!==t.duration&&(g=t.duration)}if(P(k)&&(G.cssRegisterProperty()?function(t){if(!V.has(t)){V.add(t);try{const{syntax:e,initialValue:n}=D.has(t)?D.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(k):L=!1),A&&!G.linearEasing()&&(w(b)||l(b)&&b.some(w))&&(L=!1),L){j&&(i=i.map((t=>c(t)?j.toDefaultUnit(t):t))),1!==i.length||G.partialKeyframes()&&!f||i.unshift(e());const n={delay:E(p),duration:E(g),endDelay:E(m),easing:l(b)?void 0:Z(b,g),direction:x,iterations:y+1,fill:"both"};d=t.animate({[k]:i,offset:O,easing:l(b)?b.map((t=>Z(t,g))):void 0},n),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const r=i[i.length-1];d.finished.then((()=>{J.set(t,k,r),d.cancel()})).catch(h),S||(d.playbackRate=1.000001)}else if(A){i=i.map((t=>"string"==typeof t?parseFloat(t):t)),1===i.length&&i.unshift(parseFloat(e()));d=new I((e=>{j&&(e=j.toDefaultUnit(e)),J.set(t,k,e)}),i,Object.assign(Object.assign({},s),{duration:g,easing:b}))}else{const e=i[i.length-1];J.set(t,k,j&&c(e)?j.toDefaultUnit(e):e)}return f&&u(t,n,i,{duration:g,delay:p,easing:b,repeat:y,offset:O},"motion-one"),W.setAnimation(d),d}}const et=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function nt(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 it=t=>t(),rt=(t,e,n=a.duration)=>new Proxy({animations:t.map(it).filter(Boolean),duration:n,options:e},ot),ot={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return x((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(st)).catch(h)),t.finished;case"stop":return()=>{t.animations.forEach((t=>Q(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=E(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},st=t=>t.finished;function at(t,e,n){return w(t)?t(e,n):t}function ct(t,e,n={}){const i=(t=nt(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=et(n,t);a.delay=at(a.delay,o,i);const c=tt(s,t,e[t],a);r.push(c)}}return rt(r,n,n.duration)}function lt(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 r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function ut(t,e,n,i){var r;return c(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function ft(t,e,n,i,r,s){!function(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];r.at>e&&r.at<n&&(o(t,r),i--)}}(t,r,s);for(let o=0;o<e.length;o++)t.push({value:e[o],at:f(r,s,i[o]),easing:u(n,o)})}function ht(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function dt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function gt(t,e){return e[t]||(e[t]=[]),e[t]}function pt(t,e,n){const i=Math.max(e-5,0);return O(n-t(i),e-i)}const mt=100,yt=10,vt=1;const wt=({stiffness:t=mt,damping:e=yt,mass:n=vt,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?x(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=mt,e=yt,n=vt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>r-Math.exp(-f*u*e)*((f*u*l-o)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>r-Math.exp(-u*t)*(l+(u*l-o)*t);return t=>{c.current=h(t);const e=0===t?o:pt(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(r-c.current)<=a;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=i,f=r,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function bt(t){const e=new WeakMap;return(n={})=>{const i=new Map,r=(e=0,r=100,o=0,s=!1)=>{const a=`${e}-${r}-${o}-${s}`;return i.has(a)||i.set(a,t(Object.assign({from:e,to:r,velocity:o,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),i.get(a)},o=t=>(e.has(t)||e.set(t,function(t){let e,n=10,i=t(0);const r=[i.current];for(;!i.done&&n<1e4;)i=t(n),r.push(i.done?i.target:i.current),void 0===e&&i.hasReachedTarget&&(e=n),n+=10;const o=n-10;return 1===r.length&&r.push(i.current),{keyframes:r,duration:o/1e3,overshootDuration:(null!=e?e:o)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,i,s)=>{var a,c;let l;const u=t.length;if(n&&u<=2&&t.every(Et)){const n=t[u-1],f=1===u?null:t[0];let h=0,d=0;const g=null==s?void 0:s.generator;if(g){const{animation:e,generatorStartTime:n}=s,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=g(r).current;d=null!==(a=f)&&void 0!==a?a:o,(1===u||2===u&&null===t[0])&&(h=pt((t=>g(t).current),r,o))}else d=null!==(c=f)&&void 0!==c?c:parseFloat(e());const p=r(d,n,h,null==i?void 0:i.includes("scale")),m=o(p);l=Object.assign(Object.assign({},m),{easing:"linear"}),s&&(s.generator=p,s.generatorStartTime=performance.now())}else{l={easing:"ease",duration:o(r(0,100)).overshootDuration}}return l}}}}const Et=t=>"string"!=typeof t,xt=bt(wt),Ot=bt((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:r,bounceStiffness:o,changeTarget:s,min:a,max:c,restDistance:l=.5,restSpeed:u})=>{i=E(i);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let d=n*e;const g=t+d,p=void 0===s?g:s(g);f.target=p,p!==g&&(d=p-t);const m=t=>-d*Math.exp(-t/i),y=t=>p+m(t),v=t=>{const e=m(t),n=y(t);f.done=Math.abs(e)<=l,f.current=f.done?p:n};let w,b;const x=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,b=wt({from:f.current,to:h(f.current),velocity:pt(y,t,f.current),damping:r,stiffness:o,restDistance:l,restSpeed:u}))};return x(0),t=>{let e=!1;return b||void 0!==w||(e=!0,v(t),x(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,b(t-w)):(f.hasReachedTarget=!1,!e&&v(t),f)}})),St={any:0,all:1};function Mt(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=nt(t),s=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);w(n)?s.set(t.target,n):a.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n,rootMargin:i,threshold:"number"==typeof r?r:St[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Tt=new WeakMap;let At;function Dt({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Tt.get(t))||void 0===i||i.forEach((i=>{i({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function Lt(t){t.forEach(Dt)}function kt(t,e){At||"undefined"!=typeof ResizeObserver&&(At=new ResizeObserver(Lt));const n=nt(t);return n.forEach((t=>{let n=Tt.get(t);n||(n=new Set,Tt.set(t,n)),n.add(e),null==At||At.observe(t)})),()=>{n.forEach((t=>{const n=Tt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==At||At.unobserve(t)}))}}const Wt=new Set;let jt;function Rt(t){return Wt.add(t),jt||(jt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Wt.forEach((t=>t(e)))},window.addEventListener("resize",jt)),()=>{Wt.delete(t),!Wt.size&&jt&&(jt=void 0)}}function zt(t,e){return w(t)?Rt(t):kt(t,e)}const Bt={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Pt(t,e,n,i){const r=n[e],{length:o,position:s}=Bt[e],a=r.current,c=n.time;r.current=t["scroll"+s],r.scrollLength=t["scroll"+o]-t["client"+o],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=g(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:O(r.current-a,l)}const Vt={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},$t={start:0,center:.5,end:1};function qt(t,e,n=0){let i=0;if(void 0!==$t[t]&&(t=$t[t]),b(t)){const e=parseFloat(t);t.endsWith("px")?i=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?i=e/100*document.documentElement.clientWidth:t.endsWith("vh")?i=e/100*document.documentElement.clientHeight:t=e}return c(t)&&(i=e*t),n+i}const Ct=[0,0];function Ft(t,e,n,i){let r=Array.isArray(t)?t:Ct,o=0,s=0;return c(t)?r=[t,t]:b(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,$t[t]?t:"0"]),o=qt(r[0],n,i),s=qt(r[1],e),o-s}const Ht={x:0,y:0};function It(t,e,n){let{offset:i=Vt.All}=n;const{target:r=t,axis:o="y"}=n,s="y"===o?"height":"width",a=r!==t?function(t,e){let n={x:0,y:0},i=t;for(;i&&i!==e;)if(i instanceof HTMLElement)n.x+=i.offsetLeft,n.y+=i.offsetTop,i=i.offsetParent;else if(i instanceof SVGGraphicsElement&&"getBBox"in i){const{top:t,left:e}=i.getBBox();for(n.x+=e,n.y+=t;i&&"svg"!==i.tagName;)i=i.parentNode}return n}(r,t):Ht,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:{width:r.clientWidth,height:r.clientHeight},l={width:t.clientWidth,height:t.clientHeight};e[o].offset.length=0;let u=!e[o].interpolate;const f=i.length;for(let t=0;t<f;t++){const n=Ft(i[t],l[s],c[s],a[o]);u||n===e[o].interpolatorOffsets[t]||(u=!0),e[o].offset[t]=n}u&&(e[o].interpolate=y(m(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function Ut(t,e,n,i={}){const r=i.axis||"y";return{measure:()=>function(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let i=e;for(;i&&i!=t;)n.x.targetOffset+=i.offsetLeft,n.y.targetOffset+=i.offsetTop,i=i.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,i.target,n),update:e=>{!function(t,e,n){Pt(t,"x",e,n),Pt(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&It(t,n,i)},notify:w(e)?()=>e(n):_t(e,n[r])}}function _t(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=d),t.updateDuration(1);else{const r={duration:1e3};e||(r.easing="linear"),null===(i=null===(n=t.effect)||void 0===n?void 0:n.updateTiming)||void 0===i||i.call(n,r)}})),()=>{t.currentTime=e.progress}}const Nt=new WeakMap,Gt=new WeakMap,Zt=new WeakMap,Kt=t=>t===document.documentElement?window:t;function Xt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let Yt;function Jt(){if(!Yt)return;const t=Yt.sort(te).map(ee);t.forEach(ne),t.forEach(ne),Yt=void 0}function Qt(t){Yt?r(Yt,t):(Yt=[t],requestAnimationFrame(Jt))}const te=(t,e)=>t.getDepth()-e.getDepth(),ee=t=>t.animateUpdates(),ne=t=>t.next(),ie=(t,e)=>new CustomEvent(t,{detail:{target:e}});function re(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function oe(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const se=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),re(t,e,i))},ae={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=lt(i,["once"]);return Mt(t,(i=>{if(e(),oe(t,"viewenter",i),!r)return e=>{n(),oe(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=se(t,"hoverstart",e),r=se(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),re(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),re(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},ce=["initial","animate",...Object.keys(ae),"exit"],le=new WeakMap;function ue(t){const e={},n=[];for(let i in t){const r=t[i];R(i)&&(M[i]&&(i=M[i]),n.push(i),i=L(i));let o=Array.isArray(r)?r[0]:r;const s=D.get(i);s&&(o=c(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=z(n)),e}const fe=t=>`-${t.toLowerCase()}`;function he(t,e={}){return rt([()=>{const n=new I(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}t.MotionValue=e,t.ScrollOffset=Vt,t.animate=function(t,e,n){return(w(t)?he:ct)(t,e,n)},t.animateStyle=tt,t.createMotionState=function(t={},e){let n,i=e?e.getDepth()+1:0;const r={initial:!0,animate:!0},s={},a={};for(const n of ce)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=lt(Xt(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l),f=(t,e)=>()=>{r[t]=e,Qt(g)},d=()=>{for(const e in ae){const i=ae[e].isActive(t),r=s[e];i&&!r?s[e]=ae[e].subscribe(n,{enable:f(e,!0),disable:f(e,!1)},t):!i&&r&&(r(),delete s[e])}},g={update:e=>{n&&(t=e,d(),Qt(g))},setActive:(t,e)=>{n&&(r[t]=e,Qt(g))},animateUpdates:function*(){var e,i;const o=l;l={};const s={};for(const n of ce){if(!r[n])continue;const o=Xt(t[n]);if(o)for(const n in o)"transition"!==n&&(l[n]=o[n],s[n]=et(null!==(i=null!==(e=o.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},n))}const a=new Set([...Object.keys(l),...Object.keys(o)]),c=[];a.forEach((t=>{var e,i,r;void 0===l[t]&&(l[t]=u[t]),i=o[t],r=l[t],typeof i==typeof r&&(Array.isArray(i)&&Array.isArray(r)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,r):i===r)||(null!==(e=u[t])&&void 0!==e||(u[t]=J.get(n,t)),c.push(tt(n,t,l[t],s[t])))})),yield;const f=c.map((t=>t())).filter(Boolean);if(!f.length)return;const d=l;n.dispatchEvent(ie("motionstart",d)),Promise.all(f.map((t=>t.finished))).then((()=>{n.dispatchEvent(ie("motioncomplete",d))})).catch(h)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(n=t,le.set(n,g),d(),()=>{le.delete(n),function(t){Yt&&o(Yt,t)}(g);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return g},t.createStyleString=function(t={}){const e=ue(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,fe),n+=`: ${e[t]}; `;return n},t.createStyles=ue,t.getAnimationData=i,t.getStyleName=Y,t.glide=Ot,t.inView=Mt,t.mountedStates=le,t.resize=zt,t.scroll=function(t,e={}){var{container:n=document.documentElement}=e,i=lt(e,["container"]);let r=Zt.get(n);r||(r=new Set,Zt.set(n,r));const o=Ut(n,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},i);if(r.add(o),!Nt.has(n)){const t=()=>{const t=performance.now();for(const t of r)t.measure();for(const e of r)e.update(t);for(const t of r)t.notify()};Nt.set(n,t);const e=Kt(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Gt.set(n,zt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=Nt.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Zt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=Nt.get(n);Nt.delete(n),r&&(Kt(n).removeEventListener("scroll",r),null===(e=Gt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}},t.spring=xt,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(r,o)=>{const s=c(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,o),a=Math.abs(s-r);let l=t*a;if(i){const e=o*t;l=H(i)(l/e)*e}return e+l}},t.style=J,t.timeline=function(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=lt(e,["defaultOptions"]);const r=[],o=new Map,s={},c=new Map;let l=0,u=0,f=0;for(let e=0;e<t.length;e++){const i=t[e];if(b(i)){c.set(i,u);continue}if(!Array.isArray(i)){c.set(i.name,ut(u,i.at,l,c));continue}const[r,h,d={}]=i;void 0!==d.at&&(u=ut(u,d.at,l,c));let g=0;const y=nt(r,s),w=y.length;for(let t=0;t<w;t++){const e=dt(y[t],o);for(const i in h){const r=gt(i,e);let o=X(h[i]);const s=et(d,i);let{duration:c=n.duration||a.duration,easing:l=n.easing||a.easing}=s;if(v(l)){const t=R(i);o.length;const e=l.createAnimation(o,(()=>"0"),t);l=e.easing,void 0!==e.keyframes&&(o=e.keyframes),void 0!==e.duration&&(c=e.duration)}const y=at(d.delay,t,w)||0,b=u+y,E=b+c;let{offset:x=m(o.length)}=s;1===x.length&&0===x[0]&&(x[1]=1);const O=length-o.length;O>0&&p(x,O),1===o.length&&o.unshift(null),ft(r,o,l,x,b,E),g=Math.max(y+c,g),f=Math.max(E,f)}}l=u,u+=g}return o.forEach(((t,e)=>{for(const o in t){const s=t[o];s.sort(ht);const c=[],l=[],u=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];c.push(n),l.push(g(0,f,e)),u.push(i||a.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),r.push([e,o,c,Object.assign(Object.assign(Object.assign({},n),{duration:f,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>tt(...t))).filter(Boolean);return rt(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)},t.withControls=rt,Object.defineProperty(t,"__esModule",{value:!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";class e{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const n=new WeakMap;function i(t){return n.has(t)||n.set(t,{transforms:[],values:new Map}),n.get(t)}function r(t,e){-1===t.indexOf(e)&&t.push(e)}function o(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const s=(t,e,n)=>Math.min(Math.max(n,t),e),a={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},c=t=>"number"==typeof t,l=t=>Array.isArray(t)&&!c(t[0]);function u(t,e){return l(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const f=(t,e,n)=>-n*t+n*e+t,h=()=>{},d=t=>t,g=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=g(0,e,i);t.push(f(n,1,r))}}function m(t){const e=[0];return p(e,t-1),e}function y(t,e=m(t.length),n=d){const i=t.length,r=i-e.length;return r>0&&p(e,r),r=>{let o=0;for(;o<i-2&&!(r<e[o+1]);o++);let a=s(0,1,g(e[o],e[o+1],r));return a=u(n,o)(a),f(t[o],t[o+1],a)}}const v=t=>Array.isArray(t)&&c(t[0]),w=t=>"object"==typeof t&&Boolean(t.createAnimation),b=t=>"function"==typeof t,E=t=>"string"==typeof t,x=t=>1e3*t,O=t=>t/1e3;function S(t,e){return e?t*(1e3/e):0}const M=["","X","Y","Z"],T={x:"translateX",y:"translateY",z:"translateZ"},A={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},D={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:A,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:d},skew:A},L=new Map,k=t=>`--motion-${t}`,W=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{M.forEach((e=>{W.push(t+e),L.set(k(t+e),D[t])}))}));const j=(t,e)=>W.indexOf(t)-W.indexOf(e),R=new Set(W),z=t=>R.has(t),B=t=>t.sort(j).reduce(P,"").trim(),P=(t,e)=>`${t} ${e}(var(${k(e)}))`,V=t=>t.startsWith("--"),$=new Set;const q=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function C(t,e,n,i){if(t===e&&n===i)return d;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=q(s,i,r)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:q(r(t),e,i)}const F={ease:C(.25,.1,.25,1),"ease-in":C(.42,0,1,1),"ease-in-out":C(.42,0,.58,1),"ease-out":C(0,0,.58,1)},H=/\((.*?)\)/;function I(t){if(b(t))return t;if(v(t))return C(...t);if(F[t])return F[t];if(t.startsWith("steps")){const e=H.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(i):Math.ceil(i);return s(0,1,r/t)})(parseFloat(t[0]),t[1].trim())}}return d}class U{constructor(t,e=[0,1],{easing:n,duration:i=a.duration,delay:r=a.delay,endDelay:o=a.endDelay,repeat:s=a.repeat,offset:c,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=d,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),n=n||a.easing,w(n)){const t=n.createAnimation(e);n=t.easing,e=t.keyframes||e,i=t.duration||i}this.repeat=s,this.easing=l(n)?d:I(n),this.updateDuration(i);const f=y(e,c,l(n)?n.map(I):d);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-r,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const s=i/this.duration;let a=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&a--;const l=a%2;("reverse"===u||"alternate"===u&&l||"alternate-reverse"===u&&!l)&&(c=1-c);const h=i>=this.totalDuration?1:Math.min(c,1),d=f(this.easing(h));t(d);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+o)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 N=(t,e)=>document.createElement("div").animate(t,e),_={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{N({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(N({opacity:[0,1]},{duration:.001}).finished),linearEasing:()=>{try{N({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},G={},Z={};for(const t in _)Z[t]=()=>(void 0===G[t]&&(G[t]=_[t]()),G[t]);const K=(t,e)=>b(t)?Z.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(g(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:a.easing:v(t)?X(t):t,X=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const Y=t=>Array.isArray(t)?t:[t];function J(t){return T[t]&&(t=T[t]),z(t)?k(t):t}const Q={get:(t,e)=>{e=J(e);let n=V(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=L.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=J(e),V(e)?t.style.setProperty(e,n):t.style[e]=n}};function tt(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function et(t,e){var n;let i=(null==e?void 0:e.toDefaultUnit)||d;const r=t[t.length-1];if(E(r)){const t=(null===(n=r.match(/(-?[\d.]+)([a-z%]*)/))||void 0===n?void 0:n[2])||"";t&&(i=e=>e+t)}return i}function nt(t,n,o,s={}){const u=window.__MOTION_DEV_TOOLS_RECORD,f=!1!==s.record&&u;let d,{duration:g=a.duration,delay:p=a.delay,endDelay:m=a.endDelay,repeat:y=a.repeat,easing:v=a.easing,direction:E,offset:O,allowWebkitAcceleration:S=!1}=s;const M=i(t),A=z(n);let D=Z.waapi();A&&((t,e)=>{T[e]&&(e=T[e]);const{transforms:n}=i(t);r(n,e),t.style.transform=B(n)})(t,n);const k=J(n),W=function(t,n){return t.has(n)||t.set(n,new e),t.get(n)}(M.values,k),j=L.get(k);return tt(W.animation,!(w(v)&&W.generator)&&!1!==s.record),()=>{const e=()=>{var e,n;return null!==(n=null!==(e=Q.get(t,k))&&void 0!==e?e:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let i=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(Y(o),e);const r=et(i,j);if(w(v)){const t=v.createAnimation(i,"opacity"!==n,e,k,W);v=t.easing,i=t.keyframes||i,g=t.duration||g}if(V(k)&&(Z.cssRegisterProperty()?function(t){if(!$.has(t)){$.add(t);try{const{syntax:e,initialValue:n}=L.has(t)?L.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(k):D=!1),A&&!Z.linearEasing()&&(b(v)||l(v)&&v.some(b))&&(D=!1),D){j&&(i=i.map((t=>c(t)?j.toDefaultUnit(t):t))),1!==i.length||Z.partialKeyframes()&&!f||i.unshift(e());const n={delay:x(p),duration:x(g),endDelay:x(m),easing:l(v)?void 0:K(v,g),direction:E,iterations:y+1,fill:"both"};d=t.animate({[k]:i,offset:O,easing:l(v)?v.map((t=>K(t,g))):void 0},n),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const r=i[i.length-1];d.finished.then((()=>{Q.set(t,k,r),d.cancel()})).catch(h),S||(d.playbackRate=1.000001)}else if(A)i=i.map((t=>"string"==typeof t?parseFloat(t):t)),1===i.length&&i.unshift(parseFloat(e())),d=new U((e=>{Q.set(t,k,r?r(e):e)}),i,Object.assign(Object.assign({},s),{duration:g,easing:v}));else{const e=i[i.length-1];Q.set(t,k,j&&c(e)?j.toDefaultUnit(e):e)}return f&&u(t,n,i,{duration:g,delay:p,easing:v,repeat:y,offset:O},"motion-one"),W.setAnimation(d),d}}const it=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function rt(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 ot=t=>t(),st=(t,e,n=a.duration)=>new Proxy({animations:t.map(ot).filter(Boolean),duration:n,options:e},at),at={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return O((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(ct)).catch(h)),t.finished;case"stop":return()=>{t.animations.forEach((t=>tt(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=x(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},ct=t=>t.finished;function lt(t,e,n){return b(t)?t(e,n):t}function ut(t,e,n={}){const i=(t=rt(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=it(n,t);a.delay=lt(a.delay,o,i);const c=nt(s,t,e[t],a);r.push(c)}}return st(r,n,n.duration)}function ft(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 r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function ht(t,e,n,i){var r;return c(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function dt(t,e,n,i,r,s){!function(t,e,n){for(let i=0;i<t.length;i++){const r=t[i];r.at>e&&r.at<n&&(o(t,r),i--)}}(t,r,s);for(let o=0;o<e.length;o++)t.push({value:e[o],at:f(r,s,i[o]),easing:u(n,o)})}function gt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function pt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function mt(t,e){return e[t]||(e[t]=[]),e[t]}function yt(t,e,n){const i=Math.max(e-5,0);return S(n-t(i),e-i)}const vt=100,wt=10,bt=1;const Et=({stiffness:t=vt,damping:e=wt,mass:n=bt,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?O(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=vt,e=wt,n=bt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>r-Math.exp(-f*u*e)*((f*u*l-o)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>r-Math.exp(-u*t)*(l+(u*l-o)*t);return t=>{c.current=h(t);const e=0===t?o:yt(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(r-c.current)<=a;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=i,f=r,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function xt(t){return c(t)&&!isNaN(t)}function Ot(t){return E(t)?parseFloat(t):t}function St(t){const e=new WeakMap;return(n={})=>{const i=new Map,r=(e=0,r=100,o=0,s=!1)=>{const a=`${e}-${r}-${o}-${s}`;return i.has(a)||i.set(a,t(Object.assign({from:e,to:r,velocity:o,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),i.get(a)},o=(t,n)=>(e.has(t)||e.set(t,function(t,e=d){let n,i=10,r=t(0);const o=[e(r.current)];for(;!r.done&&i<1e4;)r=t(i),o.push(e(r.done?r.target:r.current)),void 0===n&&r.hasReachedTarget&&(n=i),i+=10;const s=i-10;return 1===o.length&&o.push(r.current),{keyframes:o,duration:s/1e3,overshootDuration:(null!=n?n:s)/1e3}}(t,n)),e.get(t));return{createAnimation:(t,e=!0,n,i,s)=>{let a,c,l,u=0,f=d;const h=t.length;if(e){f=et(t,i?L.get(J(i)):void 0);if(l=Ot(t[h-1]),h>1&&null!==t[0])c=Ot(t[0]);else{const t=null==s?void 0:s.generator;if(t){const{animation:e,generatorStartTime:n}=s,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=t(r).current;c=o,u=yt((e=>t(e).current),r,o)}else n&&(c=Ot(n()))}}if(xt(c)&&xt(l)){const t=r(c,l,u,null==i?void 0:i.includes("scale"));a=Object.assign(Object.assign({},o(t,f)),{easing:"linear"}),s&&(s.generator=t,s.generatorStartTime=performance.now())}if(!a){a={easing:"ease",duration:o(r(0,100)).overshootDuration}}return a}}}}const Mt=St(Et),Tt=St((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:r,bounceStiffness:o,changeTarget:s,min:a,max:c,restDistance:l=.5,restSpeed:u})=>{i=x(i);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let d=n*e;const g=t+d,p=void 0===s?g:s(g);f.target=p,p!==g&&(d=p-t);const m=t=>-d*Math.exp(-t/i),y=t=>p+m(t),v=t=>{const e=m(t),n=y(t);f.done=Math.abs(e)<=l,f.current=f.done?p:n};let w,b;const E=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,b=Et({from:f.current,to:h(f.current),velocity:yt(y,t,f.current),damping:r,stiffness:o,restDistance:l,restSpeed:u}))};return E(0),t=>{let e=!1;return b||void 0!==w||(e=!0,v(t),E(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,b(t-w)):(f.hasReachedTarget=!1,!e&&v(t),f)}})),At={any:0,all:1};function Dt(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=rt(t),s=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);b(n)?s.set(t.target,n):a.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n,rootMargin:i,threshold:"number"==typeof r?r:At[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Lt=new WeakMap;let kt;function Wt({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Lt.get(t))||void 0===i||i.forEach((i=>{i({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function jt(t){t.forEach(Wt)}function Rt(t,e){kt||"undefined"!=typeof ResizeObserver&&(kt=new ResizeObserver(jt));const n=rt(t);return n.forEach((t=>{let n=Lt.get(t);n||(n=new Set,Lt.set(t,n)),n.add(e),null==kt||kt.observe(t)})),()=>{n.forEach((t=>{const n=Lt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==kt||kt.unobserve(t)}))}}const zt=new Set;let Bt;function Pt(t){return zt.add(t),Bt||(Bt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};zt.forEach((t=>t(e)))},window.addEventListener("resize",Bt)),()=>{zt.delete(t),!zt.size&&Bt&&(Bt=void 0)}}function Vt(t,e){return b(t)?Pt(t):Rt(t,e)}const $t={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function qt(t,e,n,i){const r=n[e],{length:o,position:s}=$t[e],a=r.current,c=n.time;r.current=t["scroll"+s],r.scrollLength=t["scroll"+o]-t["client"+o],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=g(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:S(r.current-a,l)}const Ct={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Ft={start:0,center:.5,end:1};function Ht(t,e,n=0){let i=0;if(void 0!==Ft[t]&&(t=Ft[t]),E(t)){const e=parseFloat(t);t.endsWith("px")?i=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?i=e/100*document.documentElement.clientWidth:t.endsWith("vh")?i=e/100*document.documentElement.clientHeight:t=e}return c(t)&&(i=e*t),n+i}const It=[0,0];function Ut(t,e,n,i){let r=Array.isArray(t)?t:It,o=0,s=0;return c(t)?r=[t,t]:E(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,Ft[t]?t:"0"]),o=Ht(r[0],n,i),s=Ht(r[1],e),o-s}const Nt={x:0,y:0};function _t(t,e,n){let{offset:i=Ct.All}=n;const{target:r=t,axis:o="y"}=n,s="y"===o?"height":"width",a=r!==t?function(t,e){let n={x:0,y:0},i=t;for(;i&&i!==e;)if(i instanceof HTMLElement)n.x+=i.offsetLeft,n.y+=i.offsetTop,i=i.offsetParent;else if(i instanceof SVGGraphicsElement&&"getBBox"in i){const{top:t,left:e}=i.getBBox();for(n.x+=e,n.y+=t;i&&"svg"!==i.tagName;)i=i.parentNode}return n}(r,t):Nt,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:{width:r.clientWidth,height:r.clientHeight},l={width:t.clientWidth,height:t.clientHeight};e[o].offset.length=0;let u=!e[o].interpolate;const f=i.length;for(let t=0;t<f;t++){const n=Ut(i[t],l[s],c[s],a[o]);u||n===e[o].interpolatorOffsets[t]||(u=!0),e[o].offset[t]=n}u&&(e[o].interpolate=y(m(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function Gt(t,e,n,i={}){const r=i.axis||"y";return{measure:()=>function(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let i=e;for(;i&&i!=t;)n.x.targetOffset+=i.offsetLeft,n.y.targetOffset+=i.offsetTop,i=i.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,i.target,n),update:e=>{!function(t,e,n){qt(t,"x",e,n),qt(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&_t(t,n,i)},notify:b(e)?()=>e(n):Zt(e,n[r])}}function Zt(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=d),t.updateDuration(1);else{const r={duration:1e3};e||(r.easing="linear"),null===(i=null===(n=t.effect)||void 0===n?void 0:n.updateTiming)||void 0===i||i.call(n,r)}})),()=>{t.currentTime=e.progress}}const Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Jt=t=>t===document.documentElement?window:t;function Qt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let te;function ee(){if(!te)return;const t=te.sort(ie).map(re);t.forEach(oe),t.forEach(oe),te=void 0}function ne(t){te?r(te,t):(te=[t],requestAnimationFrame(ee))}const ie=(t,e)=>t.getDepth()-e.getDepth(),re=t=>t.animateUpdates(),oe=t=>t.next(),se=(t,e)=>new CustomEvent(t,{detail:{target:e}});function ae(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function ce(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const le=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),ae(t,e,i))},ue={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=ft(i,["once"]);return Dt(t,(i=>{if(e(),ce(t,"viewenter",i),!r)return e=>{n(),ce(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=le(t,"hoverstart",e),r=le(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),ae(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),ae(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},fe=["initial","animate",...Object.keys(ue),"exit"],he=new WeakMap;function de(t){const e={},n=[];for(let i in t){const r=t[i];z(i)&&(T[i]&&(i=T[i]),n.push(i),i=k(i));let o=Array.isArray(r)?r[0]:r;const s=L.get(i);s&&(o=c(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=B(n)),e}const ge=t=>`-${t.toLowerCase()}`;function pe(t,e={}){return st([()=>{const n=new U(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}t.MotionValue=e,t.ScrollOffset=Ct,t.animate=function(t,e,n){return(b(t)?pe:ut)(t,e,n)},t.animateStyle=nt,t.createMotionState=function(t={},e){let n,i=e?e.getDepth()+1:0;const r={initial:!0,animate:!0},s={},a={};for(const n of fe)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=ft(Qt(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l),f=(t,e)=>()=>{r[t]=e,ne(g)},d=()=>{for(const e in ue){const i=ue[e].isActive(t),r=s[e];i&&!r?s[e]=ue[e].subscribe(n,{enable:f(e,!0),disable:f(e,!1)},t):!i&&r&&(r(),delete s[e])}},g={update:e=>{n&&(t=e,d(),ne(g))},setActive:(t,e)=>{n&&(r[t]=e,ne(g))},animateUpdates:function*(){var e,i;const o=l;l={};const s={};for(const n of fe){if(!r[n])continue;const o=Qt(t[n]);if(o)for(const n in o)"transition"!==n&&(l[n]=o[n],s[n]=it(null!==(i=null!==(e=o.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},n))}const a=new Set([...Object.keys(l),...Object.keys(o)]),c=[];a.forEach((t=>{var e,i,r;void 0===l[t]&&(l[t]=u[t]),i=o[t],r=l[t],typeof i==typeof r&&(Array.isArray(i)&&Array.isArray(r)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,r):i===r)||(null!==(e=u[t])&&void 0!==e||(u[t]=Q.get(n,t)),c.push(nt(n,t,l[t],s[t])))})),yield;const f=c.map((t=>t())).filter(Boolean);if(!f.length)return;const d=l;n.dispatchEvent(se("motionstart",d)),Promise.all(f.map((t=>t.finished))).then((()=>{n.dispatchEvent(se("motioncomplete",d))})).catch(h)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(n=t,he.set(n,g),d(),()=>{he.delete(n),function(t){te&&o(te,t)}(g);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return g},t.createStyleString=function(t={}){const e=de(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,ge),n+=`: ${e[t]}; `;return n},t.createStyles=de,t.getAnimationData=i,t.getStyleName=J,t.glide=Tt,t.inView=Dt,t.mountedStates=he,t.resize=Vt,t.scroll=function(t,e={}){var{container:n=document.documentElement}=e,i=ft(e,["container"]);let r=Yt.get(n);r||(r=new Set,Yt.set(n,r));const o=Gt(n,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},i);if(r.add(o),!Kt.has(n)){const t=()=>{const t=performance.now();for(const t of r)t.measure();for(const e of r)e.update(t);for(const t of r)t.notify()};Kt.set(n,t);const e=Jt(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Xt.set(n,Vt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=Kt.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Yt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=Kt.get(n);Kt.delete(n),r&&(Jt(n).removeEventListener("scroll",r),null===(e=Xt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}},t.spring=Mt,t.stagger=function(t=.1,{start:e=0,from:n=0,easing:i}={}){return(r,o)=>{const s=c(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,o),a=Math.abs(s-r);let l=t*a;if(i){const e=o*t;l=I(i)(l/e)*e}return e+l}},t.style=Q,t.timeline=function(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=ft(e,["defaultOptions"]);const r=[],o=new Map,s={},c=new Map;let l=0,u=0,f=0;for(let e=0;e<t.length;e++){const i=t[e];if(E(i)){c.set(i,u);continue}if(!Array.isArray(i)){c.set(i.name,ht(u,i.at,l,c));continue}const[r,h,d={}]=i;void 0!==d.at&&(u=ht(u,d.at,l,c));let g=0;const y=rt(r,s),v=y.length;for(let t=0;t<v;t++){const e=pt(y[t],o);for(const i in h){const r=mt(i,e);let o=Y(h[i]);const s=it(d,i);let{duration:c=n.duration||a.duration,easing:l=n.easing||a.easing}=s;if(w(l)){"opacity"===i||o.length;const t=l.createAnimation(o,"opacity"!==i,(()=>0),i);l=t.easing,o=t.keyframes||o,c=t.duration||c}const y=lt(d.delay,t,v)||0,b=u+y,E=b+c;let{offset:x=m(o.length)}=s;1===x.length&&0===x[0]&&(x[1]=1);const O=length-o.length;O>0&&p(x,O),1===o.length&&o.unshift(null),dt(r,o,l,x,b,E),g=Math.max(y+c,g),f=Math.max(E,f)}}l=u,u+=g}return o.forEach(((t,e)=>{for(const o in t){const s=t[o];s.sort(gt);const c=[],l=[],u=[];for(let t=0;t<s.length;t++){const{at:e,value:n,easing:i}=s[t];c.push(n),l.push(g(0,f,e)),u.push(i||a.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),r.push([e,o,c,Object.assign(Object.assign(Object.assign({},n),{duration:f,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>nt(...t))).filter(Boolean);return st(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)},t.withControls=st,Object.defineProperty(t,"__esModule",{value:!0})}));
@@ -302,7 +302,7 @@
302
302
  if (isFunction(definition))
303
303
  return definition;
304
304
  // If an easing curve definition, return bezier function
305
- if (Array.isArray(definition))
305
+ if (isCubicBezier(definition))
306
306
  return cubicBezier(...definition);
307
307
  // If we have a predefined easing function, return
308
308
  if (namedEasings[definition])
@@ -335,12 +335,10 @@
335
335
  });
336
336
  easing = easing || defaults$1.easing;
337
337
  if (isEasingGenerator(easing)) {
338
- const custom = easing.createAnimation(keyframes, () => "0", true);
338
+ const custom = easing.createAnimation(keyframes);
339
339
  easing = custom.easing;
340
- if (custom.keyframes !== undefined)
341
- keyframes = custom.keyframes;
342
- if (custom.duration !== undefined)
343
- initialDuration = custom.duration;
340
+ keyframes = custom.keyframes || keyframes;
341
+ initialDuration = custom.duration || initialDuration;
344
342
  }
345
343
  this.repeat = repeat;
346
344
  this.easing = isEasingList(easing) ? noopReturn : getEasingFunction(easing);
@@ -591,6 +589,18 @@
591
589
  catch (e) { }
592
590
  }
593
591
 
592
+ function getUnitConverter(keyframes, definition) {
593
+ var _a;
594
+ let toUnit = (definition === null || definition === void 0 ? void 0 : definition.toDefaultUnit) || noopReturn;
595
+ const finalKeyframe = keyframes[keyframes.length - 1];
596
+ if (isString(finalKeyframe)) {
597
+ const unit = ((_a = finalKeyframe.match(/(-?[\d.]+)([a-z%]*)/)) === null || _a === void 0 ? void 0 : _a[2]) || "";
598
+ if (unit)
599
+ toUnit = (value) => value + unit;
600
+ }
601
+ return toUnit;
602
+ }
603
+
594
604
  function getDevToolsRecord() {
595
605
  return window.__MOTION_DEV_TOOLS_RECORD;
596
606
  }
@@ -632,13 +642,15 @@
632
642
  * it from the DOM if it's the first keyframe.
633
643
  */
634
644
  let keyframes = hydrateKeyframes(keyframesList(keyframesDefinition), readInitialValue);
645
+ /**
646
+ * Detect unit type of keyframes.
647
+ */
648
+ const toUnit = getUnitConverter(keyframes, definition);
635
649
  if (isEasingGenerator(easing)) {
636
- const custom = easing.createAnimation(keyframes, readInitialValue, valueIsTransform, name, motionValue);
650
+ const custom = easing.createAnimation(keyframes, key !== "opacity", readInitialValue, name, motionValue);
637
651
  easing = custom.easing;
638
- if (custom.keyframes !== undefined)
639
- keyframes = custom.keyframes;
640
- if (custom.duration !== undefined)
641
- duration = custom.duration;
652
+ keyframes = custom.keyframes || keyframes;
653
+ duration = custom.duration || duration;
642
654
  }
643
655
  /**
644
656
  * If this is a CSS variable we need to register it with the browser
@@ -748,12 +760,9 @@
748
760
  if (keyframes.length === 1) {
749
761
  keyframes.unshift(parseFloat(readInitialValue()));
750
762
  }
751
- const render = (latest) => {
752
- if (definition)
753
- latest = definition.toDefaultUnit(latest);
754
- style.set(element, name, latest);
755
- };
756
- animation = new Animation(render, keyframes, Object.assign(Object.assign({}, options), { duration,
763
+ animation = new Animation((latest) => {
764
+ style.set(element, name, toUnit ? toUnit(latest) : latest);
765
+ }, keyframes, Object.assign(Object.assign({}, options), { duration,
757
766
  easing }));
758
767
  }
759
768
  else {
@@ -1078,17 +1087,11 @@
1078
1087
  const valueOptions = getOptions(options, key);
1079
1088
  let { duration = defaultOptions.duration || defaults$1.duration, easing = defaultOptions.easing || defaults$1.easing, } = valueOptions;
1080
1089
  if (isEasingGenerator(easing)) {
1081
- const valueIsTransform = isTransform(key);
1082
- invariant(valueKeyframes.length === 2 || !valueIsTransform, "spring must be provided 2 keyframes within timeline");
1083
- const custom = easing.createAnimation(valueKeyframes,
1084
- // TODO We currently only support explicit keyframes
1085
- // so this doesn't currently read from the DOM
1086
- () => "0", valueIsTransform);
1090
+ invariant(key === "opacity" || valueKeyframes.length > 1, "spring must be provided 2 keyframes within timeline()");
1091
+ const custom = easing.createAnimation(valueKeyframes, key !== "opacity", () => 0, key);
1087
1092
  easing = custom.easing;
1088
- if (custom.keyframes !== undefined)
1089
- valueKeyframes = custom.keyframes;
1090
- if (custom.duration !== undefined)
1091
- duration = custom.duration;
1093
+ valueKeyframes = custom.keyframes || valueKeyframes;
1094
+ duration = custom.duration || duration;
1092
1095
  }
1093
1096
  const delay = resolveOption(options.delay, elementIndex, numElements) || 0;
1094
1097
  const startTime = currentTime + delay;
@@ -1339,14 +1342,14 @@
1339
1342
 
1340
1343
  const timeStep = 10;
1341
1344
  const maxDuration = 10000;
1342
- function pregenerateKeyframes(generator) {
1345
+ function pregenerateKeyframes(generator, toUnit = noopReturn) {
1343
1346
  let overshootDuration = undefined;
1344
1347
  let timestamp = timeStep;
1345
1348
  let state = generator(0);
1346
- const keyframes = [state.current];
1349
+ const keyframes = [toUnit(state.current)];
1347
1350
  while (!state.done && timestamp < maxDuration) {
1348
1351
  state = generator(timestamp);
1349
- keyframes.push(state.done ? state.target : state.current);
1352
+ keyframes.push(toUnit(state.done ? state.target : state.current));
1350
1353
  if (overshootDuration === undefined && state.hasReachedTarget) {
1351
1354
  overshootDuration = timestamp;
1352
1355
  }
@@ -1366,6 +1369,12 @@
1366
1369
  };
1367
1370
  }
1368
1371
 
1372
+ function canGenerate(value) {
1373
+ return isNumber(value) && !isNaN(value);
1374
+ }
1375
+ function getAsNumber(value) {
1376
+ return isString(value) ? parseFloat(value) : value;
1377
+ }
1369
1378
  function createGeneratorEasing(createGenerator) {
1370
1379
  const keyframesCache = new WeakMap();
1371
1380
  return (options = {}) => {
@@ -1379,54 +1388,80 @@
1379
1388
  }
1380
1389
  return generatorCache.get(key);
1381
1390
  };
1382
- const getKeyframes = (generator) => {
1391
+ const getKeyframes = (generator, toUnit) => {
1383
1392
  if (!keyframesCache.has(generator)) {
1384
- keyframesCache.set(generator, pregenerateKeyframes(generator));
1393
+ keyframesCache.set(generator, pregenerateKeyframes(generator, toUnit));
1385
1394
  }
1386
1395
  return keyframesCache.get(generator);
1387
1396
  };
1388
1397
  return {
1389
- createAnimation: (keyframes, getOrigin, canUseGenerator, name, motionValue) => {
1390
- var _a, _b;
1398
+ createAnimation: (keyframes, shouldGenerate = true, getOrigin, name, motionValue) => {
1391
1399
  let settings;
1400
+ let origin;
1401
+ let target;
1402
+ let velocity = 0;
1403
+ let toUnit = noopReturn;
1392
1404
  const numKeyframes = keyframes.length;
1393
- let shouldUseGenerator = canUseGenerator &&
1394
- numKeyframes <= 2 &&
1395
- keyframes.every(isNumberOrNull);
1396
- if (shouldUseGenerator) {
1397
- const target = keyframes[numKeyframes - 1];
1398
- const unresolvedOrigin = numKeyframes === 1 ? null : keyframes[0];
1399
- let velocity = 0;
1400
- let origin = 0;
1401
- const prevGenerator = motionValue === null || motionValue === void 0 ? void 0 : motionValue.generator;
1402
- if (prevGenerator) {
1405
+ /**
1406
+ * If we should generate an animation for this value, run some preperation
1407
+ * like resolving target/origin, finding a unit (if any) and determine if
1408
+ * it is actually possible to generate.
1409
+ */
1410
+ if (shouldGenerate) {
1411
+ toUnit = getUnitConverter(keyframes, name ? transformDefinitions.get(getStyleName(name)) : undefined);
1412
+ const targetDefinition = keyframes[numKeyframes - 1];
1413
+ target = getAsNumber(targetDefinition);
1414
+ if (numKeyframes > 1 && keyframes[0] !== null) {
1403
1415
  /**
1404
- * If we have a generator for this value we can use it to resolve
1405
- * the animations's current value and velocity.
1416
+ * If we have multiple keyframes, take the initial keyframe as the origin.
1406
1417
  */
1407
- const { animation, generatorStartTime } = motionValue;
1408
- const startTime = (animation === null || animation === void 0 ? void 0 : animation.startTime) || generatorStartTime || 0;
1409
- const currentTime = (animation === null || animation === void 0 ? void 0 : animation.currentTime) || performance.now() - startTime;
1410
- const prevGeneratorCurrent = prevGenerator(currentTime).current;
1411
- origin = (_a = unresolvedOrigin) !== null && _a !== void 0 ? _a : prevGeneratorCurrent;
1412
- if (numKeyframes === 1 ||
1413
- (numKeyframes === 2 && keyframes[0] === null)) {
1414
- velocity = calcGeneratorVelocity((t) => prevGenerator(t).current, currentTime, prevGeneratorCurrent);
1415
- }
1418
+ origin = getAsNumber(keyframes[0]);
1416
1419
  }
1417
1420
  else {
1418
- origin = (_b = unresolvedOrigin) !== null && _b !== void 0 ? _b : parseFloat(getOrigin());
1421
+ const prevGenerator = motionValue === null || motionValue === void 0 ? void 0 : motionValue.generator;
1422
+ /**
1423
+ * If we have an existing generator for this value we can use it to resolve
1424
+ * the animation's current value and velocity.
1425
+ */
1426
+ if (prevGenerator) {
1427
+ /**
1428
+ * If we have a generator for this value we can use it to resolve
1429
+ * the animations's current value and velocity.
1430
+ */
1431
+ const { animation, generatorStartTime } = motionValue;
1432
+ const startTime = (animation === null || animation === void 0 ? void 0 : animation.startTime) || generatorStartTime || 0;
1433
+ const currentTime = (animation === null || animation === void 0 ? void 0 : animation.currentTime) || performance.now() - startTime;
1434
+ const prevGeneratorCurrent = prevGenerator(currentTime).current;
1435
+ origin = prevGeneratorCurrent;
1436
+ velocity = calcGeneratorVelocity((t) => prevGenerator(t).current, currentTime, prevGeneratorCurrent);
1437
+ }
1438
+ else if (getOrigin) {
1439
+ /**
1440
+ * As a last resort, read the origin from the DOM.
1441
+ */
1442
+ origin = getAsNumber(getOrigin());
1443
+ }
1419
1444
  }
1445
+ }
1446
+ /**
1447
+ * If we've determined it is possible to generate an animation, do so.
1448
+ */
1449
+ if (canGenerate(origin) && canGenerate(target)) {
1420
1450
  const generator = getGenerator(origin, target, velocity, name === null || name === void 0 ? void 0 : name.includes("scale"));
1421
- const keyframesMetadata = getKeyframes(generator);
1422
- settings = Object.assign(Object.assign({}, keyframesMetadata), { easing: "linear" });
1451
+ settings = Object.assign(Object.assign({}, getKeyframes(generator, toUnit)), { easing: "linear" });
1423
1452
  // TODO Add test for this
1424
1453
  if (motionValue) {
1425
1454
  motionValue.generator = generator;
1426
1455
  motionValue.generatorStartTime = performance.now();
1427
1456
  }
1428
1457
  }
1429
- else {
1458
+ /**
1459
+ * If by now we haven't generated a set of keyframes, create a generic generator
1460
+ * based on the provided props that animates from 0-100 to fetch a rough
1461
+ * "overshootDuration" - the moment when the generator first hits the animation target.
1462
+ * Then return animation settings that will run a normal animation for that duration.
1463
+ */
1464
+ if (!settings) {
1430
1465
  const keyframesMetadata = getKeyframes(getGenerator(0, 100));
1431
1466
  settings = {
1432
1467
  easing: "ease",
@@ -1438,7 +1473,6 @@
1438
1473
  };
1439
1474
  };
1440
1475
  }
1441
- const isNumberOrNull = (value) => typeof value !== "string";
1442
1476
 
1443
1477
  const spring = createGeneratorEasing(spring$1);
1444
1478
 
@@ -1 +1 @@
1
- class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}function i(t,e){-1===t.indexOf(e)&&t.push(e)}function r(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const o=(t,e,n)=>Math.min(Math.max(n,t),e),s={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,c=t=>Array.isArray(t)&&!a(t[0]);function l(t,e){return c(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const u=(t,e,n)=>-n*t+n*e+t,f=()=>{},h=t=>t,d=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=d(0,e,i);t.push(u(n,1,r))}}function g(t){const e=[0];return p(e,t-1),e}function m(t,e=g(t.length),n=h){const i=t.length,r=i-e.length;return r>0&&p(e,r),r=>{let s=0;for(;s<i-2&&!(r<e[s+1]);s++);let a=o(0,1,d(e[s],e[s+1],r));return a=l(n,s)(a),u(t[s],t[s+1],a)}}const v=t=>"object"==typeof t&&Boolean(t.createAnimation),y=t=>"function"==typeof t,w=t=>"string"==typeof t,b=t=>1e3*t,E=t=>t/1e3;function O(t,e){return e?t*(1e3/e):0}const x=["","X","Y","Z"],A={x:"translateX",y:"translateY",z:"translateZ"},T={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},M={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:T,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:h},skew:T},S=new Map,D=t=>`--motion-${t}`,k=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{x.forEach((e=>{k.push(t+e),S.set(D(t+e),M[t])}))}));const L=(t,e)=>k.indexOf(t)-k.indexOf(e),W=new Set(k),j=t=>W.has(t),R=t=>t.sort(L).reduce(B,"").trim(),B=(t,e)=>`${t} ${e}(var(${D(e)}))`,z=t=>t.startsWith("--"),P=new Set;const V=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function $(t,e,n,i){if(t===e&&n===i)return h;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=V(s,i,r)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:V(r(t),e,i)}const q={ease:$(.25,.1,.25,1),"ease-in":$(.42,0,1,1),"ease-in-out":$(.42,0,.58,1),"ease-out":$(0,0,.58,1)},F=/\((.*?)\)/;function C(t){if(y(t))return t;if(Array.isArray(t))return $(...t);if(q[t])return q[t];if(t.startsWith("steps")){const e=F.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(i):Math.ceil(i);return o(0,1,r/t)})(parseFloat(t[0]),t[1].trim())}}return h}class H{constructor(t,e=[0,1],{easing:n,duration:i=s.duration,delay:r=s.delay,endDelay:o=s.endDelay,repeat:a=s.repeat,offset:l,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=h,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),n=n||s.easing,v(n)){const t=n.createAnimation(e,(()=>"0"),!0);n=t.easing,void 0!==t.keyframes&&(e=t.keyframes),void 0!==t.duration&&(i=t.duration)}this.repeat=a,this.easing=c(n)?h:C(n),this.updateDuration(i);const f=m(e,l,c(n)?n.map(C):h);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-r,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const s=i/this.duration;let a=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&a--;const l=a%2;("reverse"===u||"alternate"===u&&l||"alternate-reverse"===u&&!l)&&(c=1-c);const h=i>=this.totalDuration?1:Math.min(c,1),d=f(this.easing(h));t(d);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+o)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 I=(t,e)=>document.createElement("div").animate(t,e),U={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{I({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(I({opacity:[0,1]},{duration:.001}).finished),linearEasing:()=>{try{I({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},N={},_={};for(const t in U)_[t]=()=>(void 0===N[t]&&(N[t]=U[t]()),N[t]);const G=(t,e)=>y(t)?_.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(d(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:s.easing:(t=>Array.isArray(t)&&a(t[0]))(t)?Z(t):t,Z=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const K=t=>Array.isArray(t)?t:[t];function X(t){return A[t]&&(t=A[t]),j(t)?D(t):t}const Y={get:(t,e)=>{e=X(e);let n=z(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=S.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=X(e),z(e)?t.style.setProperty(e,n):t.style[e]=n}};function J(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function Q(e,r,o,l={}){const u=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==l.record&&u;let d,{duration:p=s.duration,delay:g=s.delay,endDelay:m=s.endDelay,repeat:w=s.repeat,easing:E=s.easing,direction:O,offset:x,allowWebkitAcceleration:T=!1}=l;const M=n(e),D=j(r);let k=_.waapi();D&&((t,e)=>{A[e]&&(e=A[e]);const{transforms:r}=n(t);i(r,e),t.style.transform=R(r)})(e,r);const L=X(r),W=function(e,n){return e.has(n)||e.set(n,new t),e.get(n)}(M.values,L),B=S.get(L);return J(W.animation,!(v(E)&&W.generator)&&!1!==l.record),()=>{const t=()=>{var t,n;return null!==(n=null!==(t=Y.get(e,L))&&void 0!==t?t:null==B?void 0:B.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(K(o),t);if(v(E)){const e=E.createAnimation(n,t,D,L,W);E=e.easing,void 0!==e.keyframes&&(n=e.keyframes),void 0!==e.duration&&(p=e.duration)}if(z(L)&&(_.cssRegisterProperty()?function(t){if(!P.has(t)){P.add(t);try{const{syntax:e,initialValue:n}=S.has(t)?S.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(L):k=!1),D&&!_.linearEasing()&&(y(E)||c(E)&&E.some(y))&&(k=!1),k){B&&(n=n.map((t=>a(t)?B.toDefaultUnit(t):t))),1!==n.length||_.partialKeyframes()&&!h||n.unshift(t());const i={delay:b(g),duration:b(p),endDelay:b(m),easing:c(E)?void 0:G(E,p),direction:O,iterations:w+1,fill:"both"};d=e.animate({[L]:n,offset:x,easing:c(E)?E.map((t=>G(t,p))):void 0},i),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const r=n[n.length-1];d.finished.then((()=>{Y.set(e,L,r),d.cancel()})).catch(f),T||(d.playbackRate=1.000001)}else if(D){n=n.map((t=>"string"==typeof t?parseFloat(t):t)),1===n.length&&n.unshift(parseFloat(t()));d=new H((t=>{B&&(t=B.toDefaultUnit(t)),Y.set(e,L,t)}),n,Object.assign(Object.assign({},l),{duration:p,easing:E}))}else{const t=n[n.length-1];Y.set(e,L,B&&a(t)?B.toDefaultUnit(t):t)}return h&&u(e,r,n,{duration:p,delay:g,easing:E,repeat:w,offset:x},"motion-one"),W.setAnimation(d),d}}const tt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function et(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 nt=t=>t(),it=(t,e,n=s.duration)=>new Proxy({animations:t.map(nt).filter(Boolean),duration:n,options:e},rt),rt={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return E((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(ot)).catch(f)),t.finished;case"stop":return()=>{t.animations.forEach((t=>J(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>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}},ot=t=>t.finished;function st(t=.1,{start:e=0,from:n=0,easing:i}={}){return(r,o)=>{const s=a(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,o),c=Math.abs(s-r);let l=t*c;if(i){const e=o*t;l=C(i)(l/e)*e}return e+l}}function at(t,e,n){return y(t)?t(e,n):t}function ct(t,e,n={}){const i=(t=et(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=tt(n,t);a.delay=at(a.delay,o,i);const c=Q(s,t,e[t],a);r.push(c)}}return it(r,n,n.duration)}function lt(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 r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}var ut=function(){};function ft(t,e,n,i){var r;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function ht(t,e,n,i,o,s){!function(t,e,n){for(let i=0;i<t.length;i++){const o=t[i];o.at>e&&o.at<n&&(r(t,o),i--)}}(t,o,s);for(let r=0;r<e.length;r++)t.push({value:e[r],at:u(o,s,i[r]),easing:l(n,r)})}function dt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function pt(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=lt(e,["defaultOptions"]);const r=[],o=new Map,a={},c=new Map;let l=0,u=0,f=0;for(let e=0;e<t.length;e++){const i=t[e];if(w(i)){c.set(i,u);continue}if(!Array.isArray(i)){c.set(i.name,ft(u,i.at,l,c));continue}const[r,h,d={}]=i;void 0!==d.at&&(u=ft(u,d.at,l,c));let m=0;const y=et(r,a),b=y.length;for(let t=0;t<b;t++){const e=gt(y[t],o);for(const i in h){const r=mt(i,e);let o=K(h[i]);const a=tt(d,i);let{duration:c=n.duration||s.duration,easing:l=n.easing||s.easing}=a;if(v(l)){const t=j(i);ut(2===o.length||!t,"spring must be provided 2 keyframes within timeline");const e=l.createAnimation(o,(()=>"0"),t);l=e.easing,void 0!==e.keyframes&&(o=e.keyframes),void 0!==e.duration&&(c=e.duration)}const y=at(d.delay,t,b)||0,w=u+y,E=w+c;let{offset:O=g(o.length)}=a;1===O.length&&0===O[0]&&(O[1]=1);const x=length-o.length;x>0&&p(O,x),1===o.length&&o.unshift(null),ht(r,o,l,O,w,E),m=Math.max(y+c,m),f=Math.max(E,f)}}l=u,u+=m}return o.forEach(((t,e)=>{for(const o in t){const a=t[o];a.sort(dt);const c=[],l=[],u=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:i}=a[t];c.push(n),l.push(d(0,f,e)),u.push(i||s.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),r.push([e,o,c,Object.assign(Object.assign(Object.assign({},n),{duration:f,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>Q(...t))).filter(Boolean);return it(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)}function gt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function mt(t,e){return e[t]||(e[t]=[]),e[t]}"production"!==process.env.NODE_ENV&&(ut=function(t,e){if(!t)throw new Error(e)});function vt(t,e,n){const i=Math.max(e-5,0);return O(n-t(i),e-i)}const yt=100,wt=10,bt=1;const Et=({stiffness:t=yt,damping:e=wt,mass:n=bt,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?E(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=yt,e=wt,n=bt)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>r-Math.exp(-f*u*e)*((f*u*l-o)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>r-Math.exp(-u*t)*(l+(u*l-o)*t);return t=>{c.current=h(t);const e=0===t?o:vt(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(r-c.current)<=a;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=i,f=r,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function Ot(t){const e=new WeakMap;return(n={})=>{const i=new Map,r=(e=0,r=100,o=0,s=!1)=>{const a=`${e}-${r}-${o}-${s}`;return i.has(a)||i.set(a,t(Object.assign({from:e,to:r,velocity:o,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),i.get(a)},o=t=>(e.has(t)||e.set(t,function(t){let e,n=10,i=t(0);const r=[i.current];for(;!i.done&&n<1e4;)i=t(n),r.push(i.done?i.target:i.current),void 0===e&&i.hasReachedTarget&&(e=n),n+=10;const o=n-10;return 1===r.length&&r.push(i.current),{keyframes:r,duration:o/1e3,overshootDuration:(null!=e?e:o)/1e3}}(t)),e.get(t));return{createAnimation:(t,e,n,i,s)=>{var a,c;let l;const u=t.length;if(n&&u<=2&&t.every(xt)){const n=t[u-1],f=1===u?null:t[0];let h=0,d=0;const p=null==s?void 0:s.generator;if(p){const{animation:e,generatorStartTime:n}=s,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=p(r).current;d=null!==(a=f)&&void 0!==a?a:o,(1===u||2===u&&null===t[0])&&(h=vt((t=>p(t).current),r,o))}else d=null!==(c=f)&&void 0!==c?c:parseFloat(e());const g=r(d,n,h,null==i?void 0:i.includes("scale")),m=o(g);l=Object.assign(Object.assign({},m),{easing:"linear"}),s&&(s.generator=g,s.generatorStartTime=performance.now())}else{l={easing:"ease",duration:o(r(0,100)).overshootDuration}}return l}}}}const xt=t=>"string"!=typeof t,At=Ot(Et),Tt=Ot((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:r,bounceStiffness:o,changeTarget:s,min:a,max:c,restDistance:l=.5,restSpeed:u})=>{i=b(i);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let d=n*e;const p=t+d,g=void 0===s?p:s(p);f.target=g,g!==p&&(d=g-t);const m=t=>-d*Math.exp(-t/i),v=t=>g+m(t),y=t=>{const e=m(t),n=v(t);f.done=Math.abs(e)<=l,f.current=f.done?g:n};let w,E;const O=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,E=Et({from:f.current,to:h(f.current),velocity:vt(v,t,f.current),damping:r,stiffness:o,restDistance:l,restSpeed:u}))};return O(0),t=>{let e=!1;return E||void 0!==w||(e=!0,y(t),O(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,E(t-w)):(f.hasReachedTarget=!1,!e&&y(t),f)}})),Mt={any:0,all:1};function St(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=et(t),s=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);y(n)?s.set(t.target,n):a.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n,rootMargin:i,threshold:"number"==typeof r?r:Mt[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Dt=new WeakMap;let kt;function Lt({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Dt.get(t))||void 0===i||i.forEach((i=>{i({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function Wt(t){t.forEach(Lt)}function jt(t,e){kt||"undefined"!=typeof ResizeObserver&&(kt=new ResizeObserver(Wt));const n=et(t);return n.forEach((t=>{let n=Dt.get(t);n||(n=new Set,Dt.set(t,n)),n.add(e),null==kt||kt.observe(t)})),()=>{n.forEach((t=>{const n=Dt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==kt||kt.unobserve(t)}))}}const Rt=new Set;let Bt;function zt(t){return Rt.add(t),Bt||(Bt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Rt.forEach((t=>t(e)))},window.addEventListener("resize",Bt)),()=>{Rt.delete(t),!Rt.size&&Bt&&(Bt=void 0)}}function Pt(t,e){return y(t)?zt(t):jt(t,e)}const Vt={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function $t(t,e,n,i){const r=n[e],{length:o,position:s}=Vt[e],a=r.current,c=n.time;r.current=t["scroll"+s],r.scrollLength=t["scroll"+o]-t["client"+o],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=d(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:O(r.current-a,l)}const qt={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},Ft={start:0,center:.5,end:1};function Ct(t,e,n=0){let i=0;if(void 0!==Ft[t]&&(t=Ft[t]),w(t)){const e=parseFloat(t);t.endsWith("px")?i=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?i=e/100*document.documentElement.clientWidth:t.endsWith("vh")?i=e/100*document.documentElement.clientHeight:t=e}return a(t)&&(i=e*t),n+i}const Ht=[0,0];function It(t,e,n,i){let r=Array.isArray(t)?t:Ht,o=0,s=0;return a(t)?r=[t,t]:w(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,Ft[t]?t:"0"]),o=Ct(r[0],n,i),s=Ct(r[1],e),o-s}const Ut={x:0,y:0};function Nt(t,e,n){let{offset:i=qt.All}=n;const{target:r=t,axis:o="y"}=n,s="y"===o?"height":"width",a=r!==t?function(t,e){let n={x:0,y:0},i=t;for(;i&&i!==e;)if(i instanceof HTMLElement)n.x+=i.offsetLeft,n.y+=i.offsetTop,i=i.offsetParent;else if(i instanceof SVGGraphicsElement&&"getBBox"in i){const{top:t,left:e}=i.getBBox();for(n.x+=e,n.y+=t;i&&"svg"!==i.tagName;)i=i.parentNode}return n}(r,t):Ut,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:{width:r.clientWidth,height:r.clientHeight},l={width:t.clientWidth,height:t.clientHeight};e[o].offset.length=0;let u=!e[o].interpolate;const f=i.length;for(let t=0;t<f;t++){const n=It(i[t],l[s],c[s],a[o]);u||n===e[o].interpolatorOffsets[t]||(u=!0),e[o].offset[t]=n}u&&(e[o].interpolate=m(g(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function _t(t,e,n,i={}){const r=i.axis||"y";return{measure:()=>function(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let i=e;for(;i&&i!=t;)n.x.targetOffset+=i.offsetLeft,n.y.targetOffset+=i.offsetTop,i=i.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,i.target,n),update:e=>{!function(t,e,n){$t(t,"x",e,n),$t(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&Nt(t,n,i)},notify:y(e)?()=>e(n):Gt(e,n[r])}}function Gt(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=h),t.updateDuration(1);else{const r={duration:1e3};e||(r.easing="linear"),null===(i=null===(n=t.effect)||void 0===n?void 0:n.updateTiming)||void 0===i||i.call(n,r)}})),()=>{t.currentTime=e.progress}}const Zt=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=t=>t===document.documentElement?window:t;function Jt(t,e={}){var{container:n=document.documentElement}=e,i=lt(e,["container"]);let r=Xt.get(n);r||(r=new Set,Xt.set(n,r));const o=_t(n,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},i);if(r.add(o),!Zt.has(n)){const t=()=>{const t=performance.now();for(const t of r)t.measure();for(const e of r)e.update(t);for(const t of r)t.notify()};Zt.set(n,t);const e=Yt(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Kt.set(n,Pt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=Zt.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Xt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=Zt.get(n);Zt.delete(n),r&&(Yt(n).removeEventListener("scroll",r),null===(e=Kt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}}function Qt(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let te;function ee(){if(!te)return;const t=te.sort(ie).map(re);t.forEach(oe),t.forEach(oe),te=void 0}function ne(t){te?i(te,t):(te=[t],requestAnimationFrame(ee))}const ie=(t,e)=>t.getDepth()-e.getDepth(),re=t=>t.animateUpdates(),oe=t=>t.next(),se=(t,e)=>new CustomEvent(t,{detail:{target:e}});function ae(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function ce(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const le=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),ae(t,e,i))},ue={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=lt(i,["once"]);return St(t,(i=>{if(e(),ce(t,"viewenter",i),!r)return e=>{n(),ce(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=le(t,"hoverstart",e),r=le(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),ae(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),ae(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},fe=["initial","animate",...Object.keys(ue),"exit"],he=new WeakMap;function de(t={},e){let n,i=e?e.getDepth()+1:0;const o={initial:!0,animate:!0},s={},a={};for(const n of fe)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=lt(Qt(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l);const h=(t,e)=>()=>{o[t]=e,ne(p)},d=()=>{for(const e in ue){const i=ue[e].isActive(t),r=s[e];i&&!r?s[e]=ue[e].subscribe(n,{enable:h(e,!0),disable:h(e,!1)},t):!i&&r&&(r(),delete s[e])}},p={update:e=>{n&&(t=e,d(),ne(p))},setActive:(t,e)=>{n&&(o[t]=e,ne(p))},animateUpdates:function*(){var e,i;const r=l;l={};const s={};for(const n of fe){if(!o[n])continue;const r=Qt(t[n]);if(r)for(const n in r)"transition"!==n&&(l[n]=r[n],s[n]=tt(null!==(i=null!==(e=r.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},n))}const a=new Set([...Object.keys(l),...Object.keys(r)]),c=[];a.forEach((t=>{var e,i,o;void 0===l[t]&&(l[t]=u[t]),i=r[t],o=l[t],typeof i==typeof o&&(Array.isArray(i)&&Array.isArray(o)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,o):i===o)||(null!==(e=u[t])&&void 0!==e||(u[t]=Y.get(n,t)),c.push(Q(n,t,l[t],s[t])))})),yield;const h=c.map((t=>t())).filter(Boolean);if(!h.length)return;const d=l;n.dispatchEvent(se("motionstart",d)),Promise.all(h.map((t=>t.finished))).then((()=>{n.dispatchEvent(se("motioncomplete",d))})).catch(f)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(ut(Boolean(t),"Animation state must be mounted with valid Element"),n=t,he.set(n,p),d(),()=>{he.delete(n),function(t){te&&r(te,t)}(p);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return p}function pe(t){const e={},n=[];for(let i in t){const r=t[i];j(i)&&(A[i]&&(i=A[i]),n.push(i),i=D(i));let o=Array.isArray(r)?r[0]:r;const s=S.get(i);s&&(o=a(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=R(n)),e}const ge=t=>`-${t.toLowerCase()}`;function me(t={}){const e=pe(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,ge),n+=`: ${e[t]}; `;return n}function ve(t,e={}){return it([()=>{const n=new H(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}function ye(t,e,n){return(y(t)?ve:ct)(t,e,n)}export{t as MotionValue,qt as ScrollOffset,ye as animate,Q as animateStyle,de as createMotionState,me as createStyleString,pe as createStyles,n as getAnimationData,X as getStyleName,Tt as glide,St as inView,he as mountedStates,Pt as resize,Jt as scroll,At as spring,st as stagger,Y as style,pt as timeline,it as withControls};
1
+ class t{setAnimation(t){this.animation=t,null==t||t.finished.then((()=>this.clearAnimation())).catch((()=>{}))}clearAnimation(){this.animation=this.generator=void 0}}const e=new WeakMap;function n(t){return e.has(t)||e.set(t,{transforms:[],values:new Map}),e.get(t)}function i(t,e){-1===t.indexOf(e)&&t.push(e)}function r(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const o=(t,e,n)=>Math.min(Math.max(n,t),e),s={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},a=t=>"number"==typeof t,c=t=>Array.isArray(t)&&!a(t[0]);function l(t,e){return c(t)?t[((t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t})(0,t.length,e)]:t}const u=(t,e,n)=>-n*t+n*e+t,f=()=>{},h=t=>t,d=(t,e,n)=>e-t==0?1:(n-t)/(e-t);function p(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=d(0,e,i);t.push(u(n,1,r))}}function g(t){const e=[0];return p(e,t-1),e}function m(t,e=g(t.length),n=h){const i=t.length,r=i-e.length;return r>0&&p(e,r),r=>{let s=0;for(;s<i-2&&!(r<e[s+1]);s++);let a=o(0,1,d(e[s],e[s+1],r));return a=l(n,s)(a),u(t[s],t[s+1],a)}}const v=t=>Array.isArray(t)&&a(t[0]),y=t=>"object"==typeof t&&Boolean(t.createAnimation),w=t=>"function"==typeof t,b=t=>"string"==typeof t,E=t=>1e3*t,O=t=>t/1e3;function x(t,e){return e?t*(1e3/e):0}const T=["","X","Y","Z"],M={x:"translateX",y:"translateY",z:"translateZ"},A={syntax:"<angle>",initialValue:"0deg",toDefaultUnit:t=>t+"deg"},S={translate:{syntax:"<length-percentage>",initialValue:"0px",toDefaultUnit:t=>t+"px"},rotate:A,scale:{syntax:"<number>",initialValue:1,toDefaultUnit:h},skew:A},D=new Map,L=t=>`--motion-${t}`,k=["x","y","z"];["translate","scale","rotate","skew"].forEach((t=>{T.forEach((e=>{k.push(t+e),D.set(L(t+e),S[t])}))}));const W=(t,e)=>k.indexOf(t)-k.indexOf(e),j=new Set(k),R=t=>j.has(t),B=t=>t.sort(W).reduce(z,"").trim(),z=(t,e)=>`${t} ${e}(var(${L(e)}))`,P=t=>t.startsWith("--"),V=new Set;const $=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function q(t,e,n,i){if(t===e&&n===i)return h;const r=e=>function(t,e,n,i,r){let o,s,a=0;do{s=e+(n-e)/2,o=$(s,i,r)-t,o>0?n=s:e=s}while(Math.abs(o)>1e-7&&++a<12);return s}(e,0,1,t,n);return t=>0===t||1===t?t:$(r(t),e,i)}const F={ease:q(.25,.1,.25,1),"ease-in":q(.42,0,1,1),"ease-in-out":q(.42,0,.58,1),"ease-out":q(0,0,.58,1)},C=/\((.*?)\)/;function H(t){if(w(t))return t;if(v(t))return q(...t);if(F[t])return F[t];if(t.startsWith("steps")){const e=C.exec(t);if(e){const t=e[1].split(",");return((t,e="end")=>n=>{const i=(n="end"===e?Math.min(n,.999):Math.max(n,.001))*t,r="end"===e?Math.floor(i):Math.ceil(i);return o(0,1,r/t)})(parseFloat(t[0]),t[1].trim())}}return h}class I{constructor(t,e=[0,1],{easing:n,duration:i=s.duration,delay:r=s.delay,endDelay:o=s.endDelay,repeat:a=s.repeat,offset:l,direction:u="normal"}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=h,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise(((t,e)=>{this.resolve=t,this.reject=e})),n=n||s.easing,y(n)){const t=n.createAnimation(e);n=t.easing,e=t.keyframes||e,i=t.duration||i}this.repeat=a,this.easing=c(n)?h:H(n),this.updateDuration(i);const f=m(e,l,c(n)?n.map(H):h);this.tick=e=>{var n;let i=0;i=void 0!==this.pauseTime?this.pauseTime:(e-this.startTime)*this.rate,this.t=i,i/=1e3,i=Math.max(i-r,0),"finished"===this.playState&&void 0===this.pauseTime&&(i=this.totalDuration);const s=i/this.duration;let a=Math.floor(s),c=s%1;!c&&s>=1&&(c=1),1===c&&a--;const l=a%2;("reverse"===u||"alternate"===u&&l||"alternate-reverse"===u&&!l)&&(c=1-c);const h=i>=this.totalDuration?1:Math.min(c,1),d=f(this.easing(h));t(d);void 0===this.pauseTime&&("finished"===this.playState||i>=this.totalDuration+o)?(this.playState="finished",null===(n=this.resolve)||void 0===n||n.call(this,d)):"idle"!==this.playState&&(this.frameRequestId=requestAnimationFrame(this.tick))},this.play()}play(){const t=performance.now();this.playState="running",void 0!==this.pauseTime?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",void 0!==this.frameRequestId&&cancelAnimationFrame(this.frameRequestId),null===(t=this.reject)||void 0===t||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){void 0!==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 N=(t,e)=>document.createElement("div").animate(t,e),U={cssRegisterProperty:()=>"undefined"!=typeof CSS&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{N({opacity:[1]})}catch(t){return!1}return!0},finished:()=>Boolean(N({opacity:[0,1]},{duration:.001}).finished),linearEasing:()=>{try{N({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0}},_={},G={};for(const t in U)G[t]=()=>(void 0===_[t]&&(_[t]=U[t]()),_[t]);const Z=(t,e)=>w(t)?G.linearEasing()?`linear(${((t,e)=>{let n="";const i=Math.round(e/.015);for(let e=0;e<i;e++)n+=t(d(0,i-1,e))+", ";return n.substring(0,n.length-2)})(t,e)})`:s.easing:v(t)?K(t):t,K=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`;const X=t=>Array.isArray(t)?t:[t];function Y(t){return M[t]&&(t=M[t]),R(t)?L(t):t}const J={get:(t,e)=>{e=Y(e);let n=P(e)?t.style.getPropertyValue(e):getComputedStyle(t)[e];if(!n&&0!==n){const t=D.get(e);t&&(n=t.initialValue)}return n},set:(t,e,n)=>{e=Y(e),P(e)?t.style.setProperty(e,n):t.style[e]=n}};function Q(t,e=!0){if(t&&"finished"!==t.playState)try{t.stop?t.stop():(e&&t.commitStyles(),t.cancel())}catch(t){}}function tt(t,e){var n;let i=(null==e?void 0:e.toDefaultUnit)||h;const r=t[t.length-1];if(b(r)){const t=(null===(n=r.match(/(-?[\d.]+)([a-z%]*)/))||void 0===n?void 0:n[2])||"";t&&(i=e=>e+t)}return i}function et(e,r,o,l={}){const u=window.__MOTION_DEV_TOOLS_RECORD,h=!1!==l.record&&u;let d,{duration:p=s.duration,delay:g=s.delay,endDelay:m=s.endDelay,repeat:v=s.repeat,easing:b=s.easing,direction:O,offset:x,allowWebkitAcceleration:T=!1}=l;const A=n(e),S=R(r);let L=G.waapi();S&&((t,e)=>{M[e]&&(e=M[e]);const{transforms:r}=n(t);i(r,e),t.style.transform=B(r)})(e,r);const k=Y(r),W=function(e,n){return e.has(n)||e.set(n,new t),e.get(n)}(A.values,k),j=D.get(k);return Q(W.animation,!(y(b)&&W.generator)&&!1!==l.record),()=>{const t=()=>{var t,n;return null!==(n=null!==(t=J.get(e,k))&&void 0!==t?t:null==j?void 0:j.initialValue)&&void 0!==n?n:0};let n=function(t,e){for(let n=0;n<t.length;n++)null===t[n]&&(t[n]=n?t[n-1]:e());return t}(X(o),t);const i=tt(n,j);if(y(b)){const e=b.createAnimation(n,"opacity"!==r,t,k,W);b=e.easing,n=e.keyframes||n,p=e.duration||p}if(P(k)&&(G.cssRegisterProperty()?function(t){if(!V.has(t)){V.add(t);try{const{syntax:e,initialValue:n}=D.has(t)?D.get(t):{};CSS.registerProperty({name:t,inherits:!1,syntax:e,initialValue:n})}catch(t){}}}(k):L=!1),S&&!G.linearEasing()&&(w(b)||c(b)&&b.some(w))&&(L=!1),L){j&&(n=n.map((t=>a(t)?j.toDefaultUnit(t):t))),1!==n.length||G.partialKeyframes()&&!h||n.unshift(t());const i={delay:E(g),duration:E(p),endDelay:E(m),easing:c(b)?void 0:Z(b,p),direction:O,iterations:v+1,fill:"both"};d=e.animate({[k]:n,offset:x,easing:c(b)?b.map((t=>Z(t,p))):void 0},i),d.finished||(d.finished=new Promise(((t,e)=>{d.onfinish=t,d.oncancel=e})));const r=n[n.length-1];d.finished.then((()=>{J.set(e,k,r),d.cancel()})).catch(f),T||(d.playbackRate=1.000001)}else if(S)n=n.map((t=>"string"==typeof t?parseFloat(t):t)),1===n.length&&n.unshift(parseFloat(t())),d=new I((t=>{J.set(e,k,i?i(t):t)}),n,Object.assign(Object.assign({},l),{duration:p,easing:b}));else{const t=n[n.length-1];J.set(e,k,j&&a(t)?j.toDefaultUnit(t):t)}return h&&u(e,r,n,{duration:p,delay:g,easing:b,repeat:v,offset:x},"motion-one"),W.setAnimation(d),d}}const nt=(t,e)=>t[e]?Object.assign(Object.assign({},t),t[e]):Object.assign({},t);function it(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 rt=t=>t(),ot=(t,e,n=s.duration)=>new Proxy({animations:t.map(rt).filter(Boolean),duration:n,options:e},st),st={get:(t,e)=>{const n=t.animations[0];switch(e){case"duration":return t.duration;case"currentTime":return O((null==n?void 0:n[e])||0);case"playbackRate":case"playState":return null==n?void 0:n[e];case"finished":return t.finished||(t.finished=Promise.all(t.animations.map(at)).catch(f)),t.finished;case"stop":return()=>{t.animations.forEach((t=>Q(t)))};case"forEachNative":return e=>{t.animations.forEach((n=>e(n,t)))};default:return void 0===(null==n?void 0:n[e])?void 0:()=>t.animations.forEach((t=>t[e]()))}},set:(t,e,n)=>{switch(e){case"currentTime":n=E(n);case"currentTime":case"playbackRate":for(let i=0;i<t.animations.length;i++)t.animations[i][e]=n;return!0}return!1}},at=t=>t.finished;function ct(t=.1,{start:e=0,from:n=0,easing:i}={}){return(r,o)=>{const s=a(n)?n:function(t,e){if("first"===t)return 0;{const n=e-1;return"last"===t?n:n/2}}(n,o),c=Math.abs(s-r);let l=t*c;if(i){const e=o*t;l=H(i)(l/e)*e}return e+l}}function lt(t,e,n){return w(t)?t(e,n):t}function ut(t,e,n={}){const i=(t=it(t)).length,r=[];for(let o=0;o<i;o++){const s=t[o];for(const t in e){const a=nt(n,t);a.delay=lt(a.delay,o,i);const c=et(s,t,e[t],a);r.push(c)}}return ot(r,n,n.duration)}function ft(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 r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}var ht=function(){};function dt(t,e,n,i){var r;return a(e)?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):"<"===e?n:null!==(r=i.get(e))&&void 0!==r?r:t}function pt(t,e,n,i,o,s){!function(t,e,n){for(let i=0;i<t.length;i++){const o=t[i];o.at>e&&o.at<n&&(r(t,o),i--)}}(t,o,s);for(let r=0;r<e.length;r++)t.push({value:e[r],at:u(o,s,i[r]),easing:l(n,r)})}function gt(t,e){return t.at===e.at?null===t.value?1:-1:t.at-e.at}function mt(t,e={}){var n;const i=function(t,e={}){var{defaultOptions:n={}}=e,i=ft(e,["defaultOptions"]);const r=[],o=new Map,a={},c=new Map;let l=0,u=0,f=0;for(let e=0;e<t.length;e++){const i=t[e];if(b(i)){c.set(i,u);continue}if(!Array.isArray(i)){c.set(i.name,dt(u,i.at,l,c));continue}const[r,h,d={}]=i;void 0!==d.at&&(u=dt(u,d.at,l,c));let m=0;const v=it(r,a),w=v.length;for(let t=0;t<w;t++){const e=vt(v[t],o);for(const i in h){const r=yt(i,e);let o=X(h[i]);const a=nt(d,i);let{duration:c=n.duration||s.duration,easing:l=n.easing||s.easing}=a;if(y(l)){ht("opacity"===i||o.length>1,"spring must be provided 2 keyframes within timeline()");const t=l.createAnimation(o,"opacity"!==i,(()=>0),i);l=t.easing,o=t.keyframes||o,c=t.duration||c}const v=lt(d.delay,t,w)||0,b=u+v,E=b+c;let{offset:O=g(o.length)}=a;1===O.length&&0===O[0]&&(O[1]=1);const x=length-o.length;x>0&&p(O,x),1===o.length&&o.unshift(null),pt(r,o,l,O,b,E),m=Math.max(v+c,m),f=Math.max(E,f)}}l=u,u+=m}return o.forEach(((t,e)=>{for(const o in t){const a=t[o];a.sort(gt);const c=[],l=[],u=[];for(let t=0;t<a.length;t++){const{at:e,value:n,easing:i}=a[t];c.push(n),l.push(d(0,f,e)),u.push(i||s.easing)}0!==l[0]&&(l.unshift(0),c.unshift(c[0]),u.unshift("linear")),1!==l[l.length-1]&&(l.push(1),c.push(null)),r.push([e,o,c,Object.assign(Object.assign(Object.assign({},n),{duration:f,easing:u,offset:l}),i)])}})),r}(t,e),r=i.map((t=>et(...t))).filter(Boolean);return ot(r,e,null===(n=i[0])||void 0===n?void 0:n[3].duration)}function vt(t,e){return!e.has(t)&&e.set(t,{}),e.get(t)}function yt(t,e){return e[t]||(e[t]=[]),e[t]}"production"!==process.env.NODE_ENV&&(ht=function(t,e){if(!t)throw new Error(e)});function wt(t,e,n){const i=Math.max(e-5,0);return x(n-t(i),e-i)}const bt=100,Et=10,Ot=1;const xt=({stiffness:t=bt,damping:e=Et,mass:n=Ot,from:i=0,to:r=1,velocity:o=0,restSpeed:s=2,restDistance:a=.5}={})=>{o=o?O(o):0;const c={done:!1,hasReachedTarget:!1,current:i,target:r},l=r-i,u=Math.sqrt(t/n)/1e3,f=((t=bt,e=Et,n=Ot)=>e/(2*Math.sqrt(t*n)))(t,e,n);let h;if(f<1){const t=u*Math.sqrt(1-f*f);h=e=>r-Math.exp(-f*u*e)*((f*u*l-o)/t*Math.sin(t*e)+l*Math.cos(t*e))}else h=t=>r-Math.exp(-u*t)*(l+(u*l-o)*t);return t=>{c.current=h(t);const e=0===t?o:wt(h,t,c.current),n=Math.abs(e)<=s,l=Math.abs(r-c.current)<=a;var u,f,d;return c.done=n&&l,c.hasReachedTarget=(u=i,f=r,d=c.current,u<f&&d>=f||u>f&&d<=f),c}};function Tt(t){return a(t)&&!isNaN(t)}function Mt(t){return b(t)?parseFloat(t):t}function At(t){const e=new WeakMap;return(n={})=>{const i=new Map,r=(e=0,r=100,o=0,s=!1)=>{const a=`${e}-${r}-${o}-${s}`;return i.has(a)||i.set(a,t(Object.assign({from:e,to:r,velocity:o,restSpeed:s?.05:2,restDistance:s?.01:.5},n))),i.get(a)},o=(t,n)=>(e.has(t)||e.set(t,function(t,e=h){let n,i=10,r=t(0);const o=[e(r.current)];for(;!r.done&&i<1e4;)r=t(i),o.push(e(r.done?r.target:r.current)),void 0===n&&r.hasReachedTarget&&(n=i),i+=10;const s=i-10;return 1===o.length&&o.push(r.current),{keyframes:o,duration:s/1e3,overshootDuration:(null!=n?n:s)/1e3}}(t,n)),e.get(t));return{createAnimation:(t,e=!0,n,i,s)=>{let a,c,l,u=0,f=h;const d=t.length;if(e){f=tt(t,i?D.get(Y(i)):void 0);if(l=Mt(t[d-1]),d>1&&null!==t[0])c=Mt(t[0]);else{const t=null==s?void 0:s.generator;if(t){const{animation:e,generatorStartTime:n}=s,i=(null==e?void 0:e.startTime)||n||0,r=(null==e?void 0:e.currentTime)||performance.now()-i,o=t(r).current;c=o,u=wt((e=>t(e).current),r,o)}else n&&(c=Mt(n()))}}if(Tt(c)&&Tt(l)){const t=r(c,l,u,null==i?void 0:i.includes("scale"));a=Object.assign(Object.assign({},o(t,f)),{easing:"linear"}),s&&(s.generator=t,s.generatorStartTime=performance.now())}if(!a){a={easing:"ease",duration:o(r(0,100)).overshootDuration}}return a}}}}const St=At(xt),Dt=At((({from:t=0,velocity:e=0,power:n=.8,decay:i=.325,bounceDamping:r,bounceStiffness:o,changeTarget:s,min:a,max:c,restDistance:l=.5,restSpeed:u})=>{i=E(i);const f={hasReachedTarget:!1,done:!1,current:t,target:t},h=t=>void 0===a?c:void 0===c||Math.abs(a-t)<Math.abs(c-t)?a:c;let d=n*e;const p=t+d,g=void 0===s?p:s(p);f.target=g,g!==p&&(d=g-t);const m=t=>-d*Math.exp(-t/i),v=t=>g+m(t),y=t=>{const e=m(t),n=v(t);f.done=Math.abs(e)<=l,f.current=f.done?g:n};let w,b;const O=t=>{var e;(e=f.current,void 0!==a&&e<a||void 0!==c&&e>c)&&(w=t,b=xt({from:f.current,to:h(f.current),velocity:wt(v,t,f.current),damping:r,stiffness:o,restDistance:l,restSpeed:u}))};return O(0),t=>{let e=!1;return b||void 0!==w||(e=!0,y(t),O(t)),void 0!==w&&t>w?(f.hasReachedTarget=!0,b(t-w)):(f.hasReachedTarget=!1,!e&&y(t),f)}})),Lt={any:0,all:1};function kt(t,e,{root:n,margin:i,amount:r="any"}={}){if("undefined"==typeof IntersectionObserver)return()=>{};const o=it(t),s=new WeakMap,a=new IntersectionObserver((t=>{t.forEach((t=>{const n=s.get(t.target);if(t.isIntersecting!==Boolean(n))if(t.isIntersecting){const n=e(t);w(n)?s.set(t.target,n):a.unobserve(t.target)}else n&&(n(t),s.delete(t.target))}))}),{root:n,rootMargin:i,threshold:"number"==typeof r?r:Lt[r]});return o.forEach((t=>a.observe(t))),()=>a.disconnect()}const Wt=new WeakMap;let jt;function Rt({target:t,contentRect:e,borderBoxSize:n}){var i;null===(i=Wt.get(t))||void 0===i||i.forEach((i=>{i({target:t,contentSize:e,get size(){return function(t,e){if(e){const{inlineSize:t,blockSize:n}=e[0];return{width:t,height:n}}return t instanceof SVGElement&&"getBBox"in t?t.getBBox():{width:t.offsetWidth,height:t.offsetHeight}}(t,n)}})}))}function Bt(t){t.forEach(Rt)}function zt(t,e){jt||"undefined"!=typeof ResizeObserver&&(jt=new ResizeObserver(Bt));const n=it(t);return n.forEach((t=>{let n=Wt.get(t);n||(n=new Set,Wt.set(t,n)),n.add(e),null==jt||jt.observe(t)})),()=>{n.forEach((t=>{const n=Wt.get(t);null==n||n.delete(e),(null==n?void 0:n.size)||null==jt||jt.unobserve(t)}))}}const Pt=new Set;let Vt;function $t(t){return Pt.add(t),Vt||(Vt=()=>{const t={width:window.innerWidth,height:window.innerHeight},e={target:window,size:t,contentSize:t};Pt.forEach((t=>t(e)))},window.addEventListener("resize",Vt)),()=>{Pt.delete(t),!Pt.size&&Vt&&(Vt=void 0)}}function qt(t,e){return w(t)?$t(t):zt(t,e)}const Ft={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function Ct(t,e,n,i){const r=n[e],{length:o,position:s}=Ft[e],a=r.current,c=n.time;r.current=t["scroll"+s],r.scrollLength=t["scroll"+o]-t["client"+o],r.offset.length=0,r.offset[0]=0,r.offset[1]=r.scrollLength,r.progress=d(0,r.scrollLength,r.current);const l=i-c;r.velocity=l>50?0:x(r.current-a,l)}const Ht={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},It={start:0,center:.5,end:1};function Nt(t,e,n=0){let i=0;if(void 0!==It[t]&&(t=It[t]),b(t)){const e=parseFloat(t);t.endsWith("px")?i=e:t.endsWith("%")?t=e/100:t.endsWith("vw")?i=e/100*document.documentElement.clientWidth:t.endsWith("vh")?i=e/100*document.documentElement.clientHeight:t=e}return a(t)&&(i=e*t),n+i}const Ut=[0,0];function _t(t,e,n,i){let r=Array.isArray(t)?t:Ut,o=0,s=0;return a(t)?r=[t,t]:b(t)&&(r=(t=t.trim()).includes(" ")?t.split(" "):[t,It[t]?t:"0"]),o=Nt(r[0],n,i),s=Nt(r[1],e),o-s}const Gt={x:0,y:0};function Zt(t,e,n){let{offset:i=Ht.All}=n;const{target:r=t,axis:o="y"}=n,s="y"===o?"height":"width",a=r!==t?function(t,e){let n={x:0,y:0},i=t;for(;i&&i!==e;)if(i instanceof HTMLElement)n.x+=i.offsetLeft,n.y+=i.offsetTop,i=i.offsetParent;else if(i instanceof SVGGraphicsElement&&"getBBox"in i){const{top:t,left:e}=i.getBBox();for(n.x+=e,n.y+=t;i&&"svg"!==i.tagName;)i=i.parentNode}return n}(r,t):Gt,c=r===t?{width:t.scrollWidth,height:t.scrollHeight}:{width:r.clientWidth,height:r.clientHeight},l={width:t.clientWidth,height:t.clientHeight};e[o].offset.length=0;let u=!e[o].interpolate;const f=i.length;for(let t=0;t<f;t++){const n=_t(i[t],l[s],c[s],a[o]);u||n===e[o].interpolatorOffsets[t]||(u=!0),e[o].offset[t]=n}u&&(e[o].interpolate=m(g(f),e[o].offset),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=e[o].interpolate(e[o].current)}function Kt(t,e,n,i={}){const r=i.axis||"y";return{measure:()=>function(t,e=t,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==t){let i=e;for(;i&&i!=t;)n.x.targetOffset+=i.offsetLeft,n.y.targetOffset+=i.offsetTop,i=i.offsetParent}n.x.targetLength=e===t?e.scrollWidth:e.clientWidth,n.y.targetLength=e===t?e.scrollHeight:e.clientHeight,n.x.containerLength=t.clientWidth,n.y.containerLength=t.clientHeight}(t,i.target,n),update:e=>{!function(t,e,n){Ct(t,"x",e,n),Ct(t,"y",e,n),e.time=n}(t,n,e),(i.offset||i.target)&&Zt(t,n,i)},notify:w(e)?()=>e(n):Xt(e,n[r])}}function Xt(t,e){return t.pause(),t.forEachNative(((t,{easing:e})=>{var n,i;if(t.updateDuration)e||(t.easing=h),t.updateDuration(1);else{const r={duration:1e3};e||(r.easing="linear"),null===(i=null===(n=t.effect)||void 0===n?void 0:n.updateTiming)||void 0===i||i.call(n,r)}})),()=>{t.currentTime=e.progress}}const Yt=new WeakMap,Jt=new WeakMap,Qt=new WeakMap,te=t=>t===document.documentElement?window:t;function ee(t,e={}){var{container:n=document.documentElement}=e,i=ft(e,["container"]);let r=Qt.get(n);r||(r=new Set,Qt.set(n,r));const o=Kt(n,t,{time:0,x:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0},y:{current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}},i);if(r.add(o),!Yt.has(n)){const t=()=>{const t=performance.now();for(const t of r)t.measure();for(const e of r)e.update(t);for(const t of r)t.notify()};Yt.set(n,t);const e=te(n);window.addEventListener("resize",t,{passive:!0}),n!==document.documentElement&&Jt.set(n,qt(n,t)),e.addEventListener("scroll",t,{passive:!0})}const s=Yt.get(n),a=requestAnimationFrame(s);return()=>{var e;"function"!=typeof t&&t.stop(),cancelAnimationFrame(a);const i=Qt.get(n);if(!i)return;if(i.delete(o),i.size)return;const r=Yt.get(n);Yt.delete(n),r&&(te(n).removeEventListener("scroll",r),null===(e=Jt.get(n))||void 0===e||e(),window.removeEventListener("resize",r))}}function ne(t,e){return function(t){return"object"==typeof t}(t)?t:t&&e?e[t]:void 0}let ie;function re(){if(!ie)return;const t=ie.sort(se).map(ae);t.forEach(ce),t.forEach(ce),ie=void 0}function oe(t){ie?i(ie,t):(ie=[t],requestAnimationFrame(re))}const se=(t,e)=>t.getDepth()-e.getDepth(),ae=t=>t.animateUpdates(),ce=t=>t.next(),le=(t,e)=>new CustomEvent(t,{detail:{target:e}});function ue(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEvent:n}}))}function fe(t,e,n){t.dispatchEvent(new CustomEvent(e,{detail:{originalEntry:n}}))}const he=(t,e,n)=>i=>{i.pointerType&&"mouse"!==i.pointerType||(n(),ue(t,e,i))},de={inView:{isActive:t=>Boolean(t.inView),subscribe:(t,{enable:e,disable:n},{inViewOptions:i={}})=>{const{once:r}=i,o=ft(i,["once"]);return kt(t,(i=>{if(e(),fe(t,"viewenter",i),!r)return e=>{n(),fe(t,"viewleave",e)}}),o)}},hover:{isActive:t=>Boolean(t.hover),subscribe:(t,{enable:e,disable:n})=>{const i=he(t,"hoverstart",e),r=he(t,"hoverend",n);return t.addEventListener("pointerenter",i),t.addEventListener("pointerleave",r),()=>{t.removeEventListener("pointerenter",i),t.removeEventListener("pointerleave",r)}}},press:{isActive:t=>Boolean(t.press),subscribe:(t,{enable:e,disable:n})=>{const i=e=>{n(),ue(t,"pressend",e),window.removeEventListener("pointerup",i)},r=n=>{e(),ue(t,"pressstart",n),window.addEventListener("pointerup",i)};return t.addEventListener("pointerdown",r),()=>{t.removeEventListener("pointerdown",r),window.removeEventListener("pointerup",i)}}}},pe=["initial","animate",...Object.keys(de),"exit"],ge=new WeakMap;function me(t={},e){let n,i=e?e.getDepth()+1:0;const o={initial:!0,animate:!0},s={},a={};for(const n of pe)a[n]="string"==typeof t[n]?t[n]:null==e?void 0:e.getContext()[n];const c=!1===t.initial?"animate":"initial";let l=ft(ne(t[c]||a[c],t.variants)||{},["transition"]);const u=Object.assign({},l);const h=(t,e)=>()=>{o[t]=e,oe(p)},d=()=>{for(const e in de){const i=de[e].isActive(t),r=s[e];i&&!r?s[e]=de[e].subscribe(n,{enable:h(e,!0),disable:h(e,!1)},t):!i&&r&&(r(),delete s[e])}},p={update:e=>{n&&(t=e,d(),oe(p))},setActive:(t,e)=>{n&&(o[t]=e,oe(p))},animateUpdates:function*(){var e,i;const r=l;l={};const s={};for(const n of pe){if(!o[n])continue;const r=ne(t[n]);if(r)for(const n in r)"transition"!==n&&(l[n]=r[n],s[n]=nt(null!==(i=null!==(e=r.transition)&&void 0!==e?e:t.transition)&&void 0!==i?i:{},n))}const a=new Set([...Object.keys(l),...Object.keys(r)]),c=[];a.forEach((t=>{var e,i,o;void 0===l[t]&&(l[t]=u[t]),i=r[t],o=l[t],typeof i==typeof o&&(Array.isArray(i)&&Array.isArray(o)?function(t,e){const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}(i,o):i===o)||(null!==(e=u[t])&&void 0!==e||(u[t]=J.get(n,t)),c.push(et(n,t,l[t],s[t])))})),yield;const h=c.map((t=>t())).filter(Boolean);if(!h.length)return;const d=l;n.dispatchEvent(le("motionstart",d)),Promise.all(h.map((t=>t.finished))).then((()=>{n.dispatchEvent(le("motioncomplete",d))})).catch(f)},getDepth:()=>i,getTarget:()=>l,getOptions:()=>t,getContext:()=>a,mount:t=>(ht(Boolean(t),"Animation state must be mounted with valid Element"),n=t,ge.set(n,p),d(),()=>{ge.delete(n),function(t){ie&&r(ie,t)}(p);for(const t in s)s[t]()}),isMounted:()=>Boolean(n)};return p}function ve(t){const e={},n=[];for(let i in t){const r=t[i];R(i)&&(M[i]&&(i=M[i]),n.push(i),i=L(i));let o=Array.isArray(r)?r[0]:r;const s=D.get(i);s&&(o=a(r)?s.toDefaultUnit(r):r),e[i]=o}return n.length&&(e.transform=B(n)),e}const ye=t=>`-${t.toLowerCase()}`;function we(t={}){const e=ve(t);let n="";for(const t in e)n+=t.startsWith("--")?t:t.replace(/[A-Z]/g,ye),n+=`: ${e[t]}; `;return n}function be(t,e={}){return ot([()=>{const n=new I(t,[0,1],e);return n.finished.catch((()=>{})),n}],e,e.duration)}function Ee(t,e,n){return(w(t)?be:ut)(t,e,n)}export{t as MotionValue,Ht as ScrollOffset,Ee as animate,et as animateStyle,me as createMotionState,we as createStyleString,ve as createStyles,n as getAnimationData,Y as getStyleName,Dt as glide,kt as inView,ge as mountedStates,qt as resize,ee as scroll,St as spring,ct as stagger,J as style,mt as timeline,ot as withControls};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "motion",
3
3
  "description": "A tiny, performant animation library for the web",
4
- "version": "10.13.1",
4
+ "version": "10.14.0",
5
5
  "license": "MIT",
6
6
  "author": "Matt Perry",
7
7
  "main": "dist/main.cjs.js",
@@ -23,12 +23,12 @@
23
23
  "dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --c --watch --no-watch.clearScreen\""
24
24
  },
25
25
  "dependencies": {
26
- "@motionone/animation": "^10.13.1",
27
- "@motionone/dom": "^10.13.1",
28
- "@motionone/svelte": "^10.13.1",
29
- "@motionone/types": "^10.13.0",
30
- "@motionone/utils": "^10.13.1",
31
- "@motionone/vue": "^10.13.1"
26
+ "@motionone/animation": "^10.14.0",
27
+ "@motionone/dom": "^10.14.0",
28
+ "@motionone/svelte": "^10.14.0",
29
+ "@motionone/types": "^10.14.0",
30
+ "@motionone/utils": "^10.14.0",
31
+ "@motionone/vue": "^10.14.0"
32
32
  },
33
- "gitHead": "ddaaf9ddc461760f8ebdca38b12f5049e1b92953"
33
+ "gitHead": "4c59ce9e5539899722427bd00f857dc80f29fc09"
34
34
  }