UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 122 kB
!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";function e(t,e){-1===t.indexOf(e)&&t.push(e)}function n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const i=(t,e,n)=>n>e?e:n<t?t:n;function s(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}t.warning=()=>{},t.invariant=()=>{},"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(t.warning=(t,e,n)=>{t||"undefined"==typeof console||console.warn(s(e,n))},t.invariant=(t,e,n)=>{if(!t)throw new Error(s(e,n))});const o={},r=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function a(t){return"object"==typeof t&&null!==t}const l=t=>/^0[^.\s]+$/u.test(t);function c(t){let e;return()=>(void 0===e&&(e=t()),e)}const u=t=>t,h=(t,e)=>n=>e(t(n)),d=(...t)=>t.reduce(h),p=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class m{constructor(){this.subscriptions=[]}add(t){return e(this.subscriptions,t),()=>n(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const f=t=>1e3*t,g=t=>t/1e3;function y(t,e){return e?t*(1e3/e):0}const v=new Set;const x=(t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t},T=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function w(t,e,n,i){if(t===e&&n===i)return u;const s=e=>function(t,e,n,i,s){let o,r,a=0;do{r=e+(n-e)/2,o=T(r,i,s)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:T(s(t),e,i)}const b=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,S=t=>e=>1-t(1-e),A=w(.33,1.53,.69,.99),V=S(A),P=b(V),E=t=>(t*=2)<1?.5*V(t):.5*(2-Math.pow(2,-10*(t-1))),M=t=>1-Math.sin(Math.acos(t)),k=S(M),D=b(M),R=w(.42,0,1,1),B=w(0,0,.58,1),C=w(.42,0,.58,1);const L=t=>Array.isArray(t)&&"number"!=typeof t[0];function j(t,e){return L(t)?t[x(0,t.length,e)]:t}const F=t=>Array.isArray(t)&&"number"==typeof t[0],O={linear:u,easeIn:R,easeInOut:C,easeOut:B,circIn:M,circInOut:D,circOut:k,backIn:V,backInOut:P,backOut:A,anticipate:E},I=e=>{if(F(e)){t.invariant(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[n,i,s,o]=e;return w(n,i,s,o)}return"string"==typeof e?(t.invariant(void 0!==O[e],`Invalid easing type '${e}'`,"invalid-easing-type"),O[e]):e},N=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],W={value:null,addProjectionMetrics:null};function U(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,a=N.reduce((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,o=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},l=0;function c(e){r.has(e)&&(u.schedule(e),t()),l++,e(a)}const u={schedule:(t,e=!1,o=!1)=>{const a=o&&s?n:i;return e&&r.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),r.delete(t)},process:t=>{a=t,s?o=!0:(s=!0,[n,i]=[i,n],n.forEach(c),e&&W.value&&W.value.frameloop[e].push(l),l=0,n.clear(),s=!1,o&&(o=!1,u.process(t)))}};return u}(r,e?n:void 0),t),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:h,update:d,preRender:p,render:m,postRender:f}=a,g=()=>{const r=o.useManualTiming?s.timestamp:performance.now();n=!1,o.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(r-s.timestamp,40),1)),s.timestamp=r,s.isProcessing=!0,l.process(s),c.process(s),u.process(s),h.process(s),d.process(s),p.process(s),m.process(s),f.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(g))};return{schedule:N.reduce((e,o)=>{const r=a[o];return e[o]=(e,o=!1,a=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(g)),r.schedule(e,o,a)),e},{}),cancel:t=>{for(let e=0;e<N.length;e++)a[N[e]].cancel(t)},state:s,steps:a}}const{schedule:$,cancel:K,state:z,steps:Y}=U("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:u,!0);let X;function H(){X=void 0}const G={now:()=>(void 0===X&&G.set(z.isProcessing||o.useManualTiming?z.timestamp:performance.now()),X),set:t=>{X=t,queueMicrotask(H)}},q={layout:0,mainThread:0,waapi:0},Z=t=>e=>"string"==typeof e&&e.startsWith(t),_=Z("--"),J=Z("var(--"),Q=t=>!!J(t)&&tt.test(t.split("/*")[0].trim()),tt=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function et(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const nt={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},it={...nt,transform:t=>i(0,1,t)},st={...nt,default:1},ot=t=>Math.round(1e5*t)/1e5,rt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const at=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,lt=(t,e)=>n=>Boolean("string"==typeof n&&at.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),ct=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(rt);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},ut={...nt,transform:t=>Math.round((t=>i(0,255,t))(t))},ht={test:lt("rgb","red"),parse:ct("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ut.transform(t)+", "+ut.transform(e)+", "+ut.transform(n)+", "+ot(it.transform(i))+")"};const dt={test:lt("#"),parse:function(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}},transform:ht.transform},pt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),mt=pt("deg"),ft=pt("%"),gt=pt("px"),yt=pt("vh"),vt=pt("vw"),xt=(()=>({...ft,parse:t=>ft.parse(t)/100,transform:t=>ft.transform(100*t)}))(),Tt={test:lt("hsl","hue"),parse:ct("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+ft.transform(ot(e))+", "+ft.transform(ot(n))+", "+ot(it.transform(i))+")"},wt={test:t=>ht.test(t)||dt.test(t)||Tt.test(t),parse:t=>ht.test(t)?ht.parse(t):Tt.test(t)?Tt.parse(t):dt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ht.transform(t):Tt.transform(t),getAnimatableNone:t=>{const e=wt.parse(t);return e.alpha=0,wt.transform(e)}},bt=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const St="number",At="color",Vt=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Pt(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(Vt,t=>(wt.test(t)?(i.color.push(o),s.push(At),n.push(wt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(St),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:i,types:s}}function Et(t){return Pt(t).values}function Mt(t){const{split:e,types:n}=Pt(t),i=e.length;return t=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],void 0!==t[o]){const e=n[o];s+=e===St?ot(t[o]):e===At?wt.transform(t[o]):t[o]}return s}}const kt=t=>"number"==typeof t?0:wt.test(t)?wt.getAnimatableNone(t):t;const Dt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(rt)?.length||0)+(t.match(bt)?.length||0)>0},parse:Et,createTransformer:Mt,getAnimatableNone:function(t){const e=Et(t);return Mt(t)(e.map(kt))}};function Rt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Bt({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,o=0,r=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Rt(a,i,t+1/3),o=Rt(a,i,t),r=Rt(a,i,t-1/3)}else s=o=r=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}function Ct(t,e){return n=>n>0?e:t}const Lt=(t,e,n)=>t+(e-t)*n,jt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Ft=[dt,ht,Tt];function Ot(e){const n=(i=e,Ft.find(t=>t.test(i)));var i;if(t.warning(Boolean(n),`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(n))return!1;let s=n.parse(e);return n===Tt&&(s=Bt(s)),s}const It=(t,e)=>{const n=Ot(t),i=Ot(e);if(!n||!i)return Ct(t,e);const s={...n};return t=>(s.red=jt(n.red,i.red,t),s.green=jt(n.green,i.green,t),s.blue=jt(n.blue,i.blue,t),s.alpha=Lt(n.alpha,i.alpha,t),ht.transform(s))},Nt=new Set(["none","hidden"]);function Wt(t,e){return Nt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Ut(t,e){return n=>Lt(t,e,n)}function $t(t){return"number"==typeof t?Ut:"string"==typeof t?Q(t)?Ct:wt.test(t)?It:Yt:Array.isArray(t)?Kt:"object"==typeof t?wt.test(t)?It:zt:Ct}function Kt(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>$t(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function zt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=$t(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Yt=(e,n)=>{const i=Dt.createTransformer(n),s=Pt(e),o=Pt(n);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?Nt.has(e)&&!o.values.length||Nt.has(n)&&!s.values.length?Wt(e,n):d(Kt(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][i[o]],a=t.values[r]??0;n[s]=a,i[o]++}return n}(s,o),o.values),i):(t.warning(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),Ct(e,n))};function Xt(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Lt(t,e,n);return $t(t)(t,e)}const Ht=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>$.update(e,t),stop:()=>K(e),now:()=>z.isProcessing?z.timestamp:G.now()}},Gt=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},qt=2e4;function Zt(t){let e=0;let n=t.next(e);for(;!n.done&&e<qt;)e+=50,n=t.next(e);return e>=qt?1/0:e}function _t(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(Zt(i),qt);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:g(s)}}function Jt(t,e,n){const i=Math.max(e-5,0);return y(n-t(i),e-i)}const Qt=100,te=10,ee=1,ne=0,ie=800,se=.3,oe=.3,re={granular:.01,default:2},ae={granular:.005,default:.5},le=.01,ce=10,ue=.05,he=1,de=.001;function pe({duration:e=ie,bounce:n=se,velocity:s=ne,mass:o=ee}){let r,a;t.warning(e<=f(ce),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-n;l=i(ue,he,l),e=i(le,ce,g(e)),l<1?(r=t=>{const n=t*l,i=n*e,o=n-s,r=fe(t,l),a=Math.exp(-i);return de-o/r*a},a=t=>{const n=t*l*e,i=n*s+s,o=Math.pow(l,2)*Math.pow(t,2)*e,a=Math.exp(-n),c=fe(Math.pow(t,2),l);return(-r(t)+de>0?-1:1)*((i-o)*a)/c}):(r=t=>Math.exp(-t*e)*((t-s)*e+1)-.001,a=t=>Math.exp(-t*e)*(e*e*(s-t)));const c=function(t,e,n){let i=n;for(let n=1;n<me;n++)i-=t(i)/e(i);return i}(r,a,5/e);if(e=f(e),isNaN(c))return{stiffness:Qt,damping:te,duration:e};{const t=Math.pow(c,2)*o;return{stiffness:t,damping:2*l*Math.sqrt(o*t),duration:e}}}const me=12;function fe(t,e){return t*Math.sqrt(1-e*e)}const ge=["duration","bounce"],ye=["stiffness","damping","mass"];function ve(t,e){return e.some(e=>void 0!==t[e])}function xe(t=oe,e=se){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:o}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],l={done:!1,value:r},{stiffness:c,damping:u,mass:h,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:ne,stiffness:Qt,damping:te,mass:ee,isResolvedFromDuration:!1,...t};if(!ve(t,ye)&&ve(t,ge))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(1.2*n),o=s*s,r=2*i(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:ee,stiffness:o,damping:r}}else{const n=pe(t);e={...e,...n,mass:ee},e.isResolvedFromDuration=!0}return e}({...n,velocity:-g(n.velocity||0)}),y=p||0,v=u/(2*Math.sqrt(c*h)),x=a-r,T=g(Math.sqrt(c/h)),w=Math.abs(x)<5;let b;if(s||(s=w?re.granular:re.default),o||(o=w?ae.granular:ae.default),v<1){const t=fe(T,v);b=e=>{const n=Math.exp(-v*T*e);return a-n*((y+v*T*x)/t*Math.sin(t*e)+x*Math.cos(t*e))}}else if(1===v)b=t=>a-Math.exp(-T*t)*(x+(y+T*x)*t);else{const t=T*Math.sqrt(v*v-1);b=e=>{const n=Math.exp(-v*T*e),i=Math.min(t*e,300);return a-n*((y+v*T*x)*Math.sinh(i)+t*x*Math.cosh(i))/t}}const S={calculatedDuration:m&&d||null,next:t=>{const e=b(t);if(m)l.done=t>=d;else{let n=0===t?y:0;v<1&&(n=0===t?f(y):Jt(b,t,e));const i=Math.abs(n)<=s,r=Math.abs(a-e)<=o;l.done=i&&r}return l.value=l.done?a:e,l},toString:()=>{const t=Math.min(Zt(S),qt),e=Gt(e=>S.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return S}function Te({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=t[0],d={done:!1,value:h},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=n*e;const f=h+m,g=void 0===r?f:r(f);g!==f&&(m=g-h);const y=t=>-m*Math.exp(-t/i),v=t=>g+y(t),x=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=c,d.value=d.done?g:n};let T,w;const b=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,w=xe({keyframes:[d.value,p(d.value)],velocity:Jt(v,t,d.value),damping:s,stiffness:o,restDelta:c,restSpeed:u}))};return b(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,x(t),b(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&x(t),d)}}}function we(e,n,{clamp:s=!0,ease:r,mixer:a}={}){const l=e.length;if(t.invariant(l===n.length,"Both input and output ranges must be the same length","range-length"),1===l)return()=>n[0];if(2===l&&n[0]===n[1])return()=>n[1];const c=e[0]===e[1];e[0]>e[l-1]&&(e=[...e].reverse(),n=[...n].reverse());const h=function(t,e,n){const i=[],s=n||o.mix||Xt,r=t.length-1;for(let n=0;n<r;n++){let o=s(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||u:e;o=d(t,o)}i.push(o)}return i}(n,r,a),m=h.length,f=t=>{if(c&&t<e[0])return n[0];let i=0;if(m>1)for(;i<e.length-2&&!(t<e[i+1]);i++);const s=p(e[i],e[i+1],t);return h[i](s)};return s?t=>f(i(e[0],e[l-1],t)):f}function be(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=p(0,e,i);t.push(Lt(n,1,s))}}function Se(t){const e=[0];return be(e,t.length-1),e}function Ae(t,e){return t.map(t=>t*e)}function Ve(t,e){return t.map(()=>e||C).splice(0,t.length-1)}function Pe({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=L(i)?i.map(I):I(i),o={done:!1,value:e[0]},r=we(Ae(n&&n.length===e.length?n:Se(e),t),e,{ease:Array.isArray(s)?s:Ve(e,s)});return{calculatedDuration:t,next:e=>(o.value=r(e),o.done=e>=t,o)}}xe.applyToOptions=t=>{const e=_t(t,100,xe);return t.ease=e.ease,t.duration=f(e.duration),t.type="keyframes",t};const Ee=t=>null!==t;function Me(t,{repeat:e,repeatType:n="loop"},i,s=1){const o=t.filter(Ee),r=s<0||e&&"loop"!==n&&e%2==1?0:o.length-1;return r&&void 0!==i?i:o[r]}const ke={decay:Te,inertia:Te,tween:Pe,keyframes:Pe,spring:xe};function De(t){"string"==typeof t.type&&(t.type=ke[t.type])}class Re{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}const Be=t=>t/100;class Ce extends Re{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==G.now()&&this.tick(G.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},q.mainThread++,this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;De(t);const{type:e=Pe,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||Pe;a!==Pe&&"number"!=typeof r[0]&&(this.mixKeyframes=d(Be,Xt(r[0],r[1])),r=[0,100]);const l=a({...t,keyframes:r});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Zt(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=l}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:s,mixKeyframes:o,mirroredGenerator:r,resolvedDuration:a,calculatedDuration:l}=this;if(null===this.startTime)return n.next(0);const{delay:c=0,keyframes:u,repeat:h,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:g}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=s);let x=this.currentTime,T=n;if(h){const t=Math.min(this.currentTime,s)/a;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,h+1);Boolean(e%2)&&("reverse"===d?(n=1-n,p&&(n-=p/a)):"mirror"===d&&(T=r)),x=i(0,1,n)*a}const w=v?{done:!1,value:u[0]}:T.next(x);o&&(w.value=o(w.value));let{done:b}=w;v||null===l||(b=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&b);return S&&m!==Te&&(w.value=Me(u,this.options,g,this.speed)),f&&f(w.value),S&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return g(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+g(t)}get time(){return g(this.currentTime)}set time(t){t=f(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(G.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=g(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Ht,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime:this.startTime||(this.startTime=e??n),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(G.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,q.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}function Le(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const je=t=>180*t/Math.PI,Fe=t=>{const e=je(Math.atan2(t[1],t[0]));return Ie(e)},Oe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Fe,rotateZ:Fe,skewX:t=>je(Math.atan(t[1])),skewY:t=>je(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ie=t=>((t%=360)<0&&(t+=360),t),Ne=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),We=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ue={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ne,scaleY:We,scale:t=>(Ne(t)+We(t))/2,rotateX:t=>Ie(je(Math.atan2(t[6],t[5]))),rotateY:t=>Ie(je(Math.atan2(-t[2],t[0]))),rotateZ:Fe,rotate:Fe,skewX:t=>je(Math.atan(t[4])),skewY:t=>je(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function $e(t){return t.includes("scale")?1:0}function Ke(t,e){if(!t||"none"===t)return $e(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=Ue,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Oe,s=e}if(!s)return $e(e);const o=i[e],r=s[1].split(",").map(Ye);return"function"==typeof o?o(r):r[o]}const ze=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Ke(n,e)};function Ye(t){return parseFloat(t.trim())}const Xe=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],He=(()=>new Set(Xe))(),Ge=t=>t===nt||t===gt,qe=new Set(["x","y","z"]),Ze=Xe.filter(t=>!qe.has(t));const _e={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Ke(e,"x"),y:(t,{transform:e})=>Ke(e,"y")};_e.translateX=_e.x,_e.translateY=_e.y;const Je=new Set;let Qe=!1,tn=!1,en=!1;function nn(){if(tn){const t=Array.from(Je).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),n=new Map;e.forEach(t=>{const e=function(t){const e=[];return Ze.forEach(n=>{const i=t.getValue(n);void 0!==i&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}(t);e.length&&(n.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=n.get(t);e&&e.forEach(([e,n])=>{t.getValue(e)?.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}tn=!1,Qe=!1,Je.forEach(t=>t.complete(en)),Je.clear()}function sn(){Je.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(tn=!0)})}function on(){en=!0,sn(),nn(),en=!1}class rn{constructor(t,e,n,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Je.add(this),Qe||(Qe=!0,$.read(sn),$.resolveKeyframes(nn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,o);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===s&&i.set(t[0])}Le(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Je.delete(this)}cancel(){"scheduled"===this.state&&(Je.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const an=t=>t.startsWith("--");function ln(t,e,n){an(e)?t.style.setProperty(e,n):t.style[e]=n}const cn=c(()=>void 0!==window.ScrollTimeline),un={};function hn(t,e){const n=c(t);return()=>un[e]??n()}const dn=hn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),pn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,mn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pn([0,.65,.55,1]),circOut:pn([.55,0,1,.45]),backIn:pn([.31,.01,.66,-.59]),backOut:pn([.33,1.53,.69,.99])};function fn(t,e){return t?"function"==typeof t?dn()?Gt(t,e):"ease-out":F(t)?pn(t):Array.isArray(t)?t.map(t=>fn(t,e)||mn.easeOut):mn[t]:void 0}function gn(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[e]:n};l&&(u.offset=l);const h=fn(a,s);Array.isArray(h)&&(u.easing=h),W.value&&q.waapi++;const d={delay:i,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};c&&(d.pseudoElement=c);const p=t.animate(u,d);return W.value&&p.finished.finally(()=>{q.waapi--}),p}function yn(t){return"function"==typeof t&&"applyToOptions"in t}function vn({type:t,...e}){return yn(t)&&dn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class xn extends Re{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:o,allowFlatten:r=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=Boolean(o),this.allowFlatten=r,this.options=e,t.invariant("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const c=vn(e);this.animation=gn(n,i,s,c,o),!1===c.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const t=Me(s,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(t):ln(n,i,t),this.animation.cancel()}l?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return g(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+g(t)}get time(){return g(Number(this.animation.currentTime)||0)}set time(t){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=f(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&cn()?(this.animation.timeline=t,u):e(this)}}const Tn={anticipate:E,backInOut:P,circInOut:D};function wn(t){"string"==typeof t.ease&&t.ease in Tn&&(t.ease=Tn[t.ease])}class bn extends xn{constructor(t){wn(t),De(t),super(t),void 0!==t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:s,element:o,...r}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const a=new Ce({...r,autoplay:!1}),l=Math.max(10,G.now()-this.startTime),c=i(0,10,l-10);e.setWithVelocity(a.sample(Math.max(0,l-c)).value,a.sample(l).value,c),a.stop()}}const Sn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Dt.test(t)&&"0"!==t||t.startsWith("url(")));function An(t){t.duration=0,t.type="keyframes"}const Vn=new Set(["opacity","clipPath","filter","transform"]),Pn=c(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function En(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Pn()&&n&&Vn.has(n)&&("transform"!==n||!c)&&!l&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r}class Mn extends Re{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=G.now();const h={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:c,...u},d=c?.KeyframeResolver||rn;this.keyframeResolver=new d(r,(t,e,n)=>this.onKeyframesResolved(t,e,h,!n),a,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:r,type:a,velocity:l,delay:c,isHandoff:h,onUpdate:d}=i;this.resolvedAt=G.now(),function(e,n,i,s){const o=e[0];if(null===o)return!1;if("display"===n||"visibility"===n)return!0;const r=e[e.length-1],a=Sn(o,n),l=Sn(r,n);return t.warning(a===l,`You are trying to animate ${n} from "${o}" to "${r}". "${a?r:o}" is not an animatable value.`,"value-not-animatable"),!(!a||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(e)||("spring"===i||yn(i))&&s)}(e,r,a,l)||(!o.instantAnimations&&c||d?.(Me(e,i,n)),e[0]=e[e.length-1],An(i),i.repeat=0);const p={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},m=!h&&En(p)?new bn({...p,element:p.motionValue.owner.current}):new Ce(p);m.finished.then(()=>this.notifyFinished()).catch(u),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),on()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}class kn{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let n=0;n<this.animations.length;n++)this.animations[n][t]=e}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return Dn(this.animations,"duration")}get iterationDuration(){return Dn(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(e=>e[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function Dn(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t[i][e];null!==s&&s>n&&(n=s)}return n}class Rn extends kn{then(t,e){return this.finished.finally(t).then(()=>{})}}class Bn extends xn{constructor(t){super(),this.animation=t,t.onfinish=()=>{this.finishedTime=this.time,this.notifyFinished()}}}const Cn=new WeakMap,Ln=(t,e="")=>`${t}:${e}`;function jn(t){const e=Cn.get(t)||new Map;return Cn.set(t,e),e}const Fn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function On(t){const e=Fn.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function In(e,n,i=1){t.invariant(i<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,o]=On(e);if(!s)return;const a=window.getComputedStyle(n).getPropertyValue(s);if(a){const t=a.trim();return r(t)?parseFloat(t):t}return Q(o)?In(o,n,i+1):o}function Nn(t,e){return t?.[e]??t?.default??t}const Wn={type:"spring",stiffness:500,damping:25,restSpeed:10},Un={type:"keyframes",duration:.8},$n={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Kn=(t,{keyframes:e})=>e.length>2?Un:He.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Wn:$n;function zn({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const Yn=t=>null!==t;function Xn(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(Yn),o=e&&"loop"!==n&&e%2==1?0:s.length-1;return o&&void 0!==i?i:s[o]}function Hn(t,e,n,i=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*i;return"function"==typeof n?n(o,r):1===s?o*i:a-o*i}const Gn=(t,e,n,i={},s,r)=>a=>{const l=Nn(i,t)||{},c=l.delay||i.delay||0;let{elapsed:u=0}=i;u-=f(c);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:r?void 0:s};zn(l)||Object.assign(h,Kn(t,h)),h.duration&&(h.duration=f(h.duration)),h.repeatDelay&&(h.repeatDelay=f(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let d=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(An(h),0===h.delay&&(d=!0)),(o.instantAnimations||o.skipAnimations)&&(d=!0,An(h),h.delay=0),h.allowFlatten=!l.type&&!l.ease,d&&!r&&void 0!==e.get()){const t=Xn(h.keyframes,l);if(void 0!==t)return void $.update(()=>{h.onUpdate(t),h.onComplete()})}return l.isSync?new Ce(h):new Mn(h)},qn=new Set(["width","height","top","left","right","bottom",...Xe]),Zn={current:void 0};class _n{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=G.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=G.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new m);const n=this.events[t].add(e);return"change"===t?()=>{n(),$.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return Zn.current&&Zn.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const t=G.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return y(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Jn(t,e){return new _n(t,e)}function Qn(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function ti(t,e,n,i){if("function"==typeof e){const[s,o]=Qn(i);e=e(void 0!==n?n:t.custom,s,o)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[s,o]=Qn(i);e=e(void 0!==n?n:t.custom,s,o)}return e}function ei(t,e,n){const i=t.getProps();return ti(i,e,void 0!==n?n:i.custom,t)}const ni=t=>Array.isArray(t);function ii(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Jn(n))}function si(t){return ni(t)?t[t.length-1]||0:t}function oi(t,e){const n=ei(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o){ii(t,e,si(o[e]))}}const ri=t=>Boolean(t&&t.getVelocity);function ai(t){return Boolean(ri(t)&&t.add)}function li(t,e){const n=t.getValue("willChange");if(ai(n))return n.add(e);if(!n&&o.WillChange){const n=new o.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function ci(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const ui="framerAppearId",hi="data-"+ci(ui);function di(t){return t.props[hi]}function pi({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function mi(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=e;i&&(o=i);const l=[],c=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||c&&pi(c,e))continue;const r={delay:n,...Nn(o||{},e)},u=i.get();if(void 0!==u&&!i.isAnimating&&!Array.isArray(s)&&s===u&&!r.velocity)continue;let h=!1;if(window.MotionHandoffAnimation){const n=di(t);if(n){const t=window.MotionHandoffAnimation(n,e,$);null!==t&&(r.startTime=t,h=!0)}}li(t,e),i.start(Gn(e,i,s,t.shouldReduceMotion&&qn.has(e)?{type:!1}:r,t,h));const d=i.animation;d&&l.push(d)}return r&&Promise.all(l).then(()=>{$.update(()=>{r&&oi(t,r)})}),l}function fi(t,e,n={}){const i=ei(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const o=i?()=>Promise.all(mi(t,i,n)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(fi(l,e,{...r,delay:n+("function"==typeof i?0:i)+Hn(t.variantChildren,l,i,s,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,i,o,r,a,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[o,r]:[r,o];return t().then(()=>e())}return Promise.all([o(),r(n.delay)])}function gi(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>fi(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=fi(t,e,n);else{const s="function"==typeof e?ei(t,e,n.custom):e;i=Promise.all(mi(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const yi=t=>e=>e.test(t),vi=[nt,gt,ft,mt,vt,yt,{test:t=>"auto"===t,parse:t=>t}],xi=t=>vi.find(yi(t));function Ti(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||l(t))}const wi=new Set(["brightness","contrast","saturate","opacity"]);function bi(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(rt)||[];if(!i)return t;const s=n.replace(i,"");let o=wi.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const Si=/\b([a-z-]*)\(.*?\)/gu,Ai={...Dt,getAnimatableNone:t=>{const e=t.match(Si);return e?e.map(bi).join(" "):t}},Vi={...nt,transform:Math.round},Pi={rotate:mt,rotateX:mt,rotateY:mt,rotateZ:mt,scale:st,scaleX:st,scaleY:st,scaleZ:st,skew:mt,skewX:mt,skewY:mt,distance:gt,translateX:gt,translateY:gt,translateZ:gt,x:gt,y:gt,z:gt,perspective:gt,transformPerspective:gt,opacity:it,originX:xt,originY:xt,originZ:gt},Ei={borderWidth:gt,borderTopWidth:gt,borderRightWidth:gt,borderBottomWidth:gt,borderLeftWidth:gt,borderRadius:gt,radius:gt,borderTopLeftRadius:gt,borderTopRightRadius:gt,borderBottomRightRadius:gt,borderBottomLeftRadius:gt,width:gt,maxWidth:gt,height:gt,maxHeight:gt,top:gt,right:gt,bottom:gt,left:gt,inset:gt,insetBlock:gt,insetBlockStart:gt,insetBlockEnd:gt,insetInline:gt,insetInlineStart:gt,insetInlineEnd:gt,padding:gt,paddingTop:gt,paddingRight:gt,paddingBottom:gt,paddingLeft:gt,paddingBlock:gt,paddingBlockStart:gt,paddingBlockEnd:gt,paddingInline:gt,paddingInlineStart:gt,paddingInlineEnd:gt,margin:gt,marginTop:gt,marginRight:gt,marginBottom:gt,marginLeft:gt,marginBlock:gt,marginBlockStart:gt,marginBlockEnd:gt,marginInline:gt,marginInlineStart:gt,marginInlineEnd:gt,backgroundPositionX:gt,backgroundPositionY:gt,...Pi,zIndex:Vi,fillOpacity:it,strokeOpacity:it,numOctaves:Vi},Mi={...Ei,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:Ai,WebkitFilter:Ai},ki=t=>Mi[t];function Di(t,e){let n=ki(t);return n!==Ai&&(n=Dt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ri=new Set(["auto","none","0"]);class Bi extends rn{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),Q(i))){const s=In(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!qn.has(n)||2!==t.length)return;const[i,s]=t,o=xi(i),r=xi(s);if(et(i)!==et(s)&&_e[n])this.needsMeasurement=!0;else if(o!==r)if(Ge(o)&&Ge(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else _e[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Ti(t[e]))&&n.push(e);n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Ri.has(e)&&Pt(e).values.length&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]=Di(n,i)}(t,n,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t||!t.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_e[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&t.getValue(n,i).jump(i,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const i=t.getValue(e);i&&i.jump(this.measuredOrigin,!1);const s=n.length-1,o=n[s];n[s]=_e[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const Ci=new Set(["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderRadius","radius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","width","maxWidth","height","maxHeight","top","right","bottom","left","inset","insetBlock","insetBlockStart","insetBlockEnd","insetInline","insetInlineStart","insetInlineEnd","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockStart","paddingBlockEnd","paddingInline","paddingInlineStart","paddingInlineEnd","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockStart","marginBlockEnd","marginInline","marginInlineStart","marginInlineEnd","backgroundPositionX","backgroundPositionY"]);function Li(t,e){for(let n=0;n<t.length;n++)"number"==typeof t[n]&&Ci.has(e)&&(t[n]=t[n]+"px")}const ji=c(()=>{try{document.createElement("div").animate({opacity:[1]})}catch(t){return!1}return!0}),Fi=new Set(["opacity","clipPath","filter","transform"]);function Oi(t,e,n){if(t instanceof EventTarget)return[t];if("string"==typeof t){let i=document;e&&(i=e.current);const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}function Ii(t){return(e,n)=>{const i=Oi(e),s=[];for(const e of i){const i=t(e,n);s.push(i)}return()=>{for(const t of s)t()}}}const Ni=(t,e)=>e&&"number"==typeof t?e.transform(t):t;class Wi{constructor(){this.latest={},this.values=new Map}set(t,e,n,i,s=!0){const o=this.values.get(t);o&&o.onRemove();const r=()=>{const i=e.get();this.latest[t]=s?Ni(i,Ei[t]):i,n&&$.render(n)};r();const a=e.on("change",r);i&&e.addDependent(i);const l=()=>{a(),n&&K(n),this.values.delete(t),i&&e.removeDependent(i)};return this.values.set(t,{value:e,onRemove:l}),l}get(t){return this.values.get(t)?.value}destroy(){for(const t of this.values.values())t.onRemove()}}function Ui(t){const e=new WeakMap,n=[];return(i,s)=>{const o=e.get(i)??new Wi;e.set(i,o);for(const e in s){const r=s[e],a=t(i,o,e,r);n.push(a)}return()=>{for(const t of n)t()}}}const $i=(t,e,n,i)=>{const s=function(t,e){if(!(e in t))return!1;const n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),e)||Object.getOwnPropertyDescriptor(t,e);return n&&"function"==typeof n.set}(t,n),o=s?n:n.startsWith("data")||n.startsWith("aria")?ci(n):n,r=s?()=>{t[o]=e.latest[n]}:()=>{const i=e.latest[n];null==i?t.removeAttribute(o):t.setAttribute(o,String(i))};return e.set(n,i,r)},Ki=Ii(Ui($i)),zi=Ui((t,e,n,i)=>e.set(n,i,()=>{t[n]=e.latest[n]},void 0,!1));function Yi(t){return a(t)&&"offsetHeight"in t}const Xi={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};const Hi=new Set(["originX","originY","originZ"]),Gi=(t,e,n,i)=>{let s,o;return He.has(n)?(e.get("transform")||(Yi(t)||e.get("transformBox")||Gi(t,e,"transformBox",new _n("fill-box")),e.set("transform",new _n("none"),()=>{t.style.transform=function(t){let e="",n=!0;for(let i=0;i<Xe.length;i++){const s=Xe[i],o=t.latest[s];if(void 0===o)continue;let r=!0;r="number"==typeof o?o===(s.startsWith("scale")?1:0):0===parseFloat(o),r||(n=!1,e+=`${Xi[s]||s}(${t.latest[s]}) `)}return n?"none":e.trim()}(e)})),o=e.get("transform")):Hi.has(n)?(e.get("transformOrigin")||e.set("transformOrigin",new _n(""),()=>{const n=e.latest.originX??"50%",i=e.latest.originY??"50%",s=e.latest.originZ??0;t.style.transformOrigin=`${n} ${i} ${s}`}),o=e.get("transformOrigin")):s=an(n)?()=>{t.style.setProperty(n,e.latest[n])}:()=>{t.style[n]=e.latest[n]},e.set(n,i,s,o)},qi=Ii(Ui(Gi)),Zi=gt.transform;const _i=Ii(Ui((t,e,n,i)=>{if(n.startsWith("path"))return function(t,e,n,i){return $.render(()=>t.setAttribute("pathLength","1")),"pathOffset"===n?e.set(n,i,()=>t.setAttribute("stroke-dashoffset",Zi(-e.latest[n]))):(e.get("stroke-dasharray")||e.set("stroke-dasharray",new _n("1 1"),()=>{const{pathLength:n=1,pathSpacing:i}=e.latest;t.setAttribute("stroke-dasharray",`${Zi(n)} ${Zi(i??1-Number(n))}`)}),e.set(n,i,void 0,e.get("stroke-dasharray")))}(t,e,n,i);if(n.startsWith("attr"))return $i(t,e,function(t){return t.replace(/^attr([A-Z])/,(t,e)=>e.toLowerCase())}(n),i);return(n in t.style?Gi:$i)(t,e,n,i)}));const{schedule:Ji,cancel:Qi}=U(queueMicrotask,!1),ts={x:!1,y:!1};function es(){return ts.x||ts.y}function ns(t,e){const n=Oi(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function is(t){return!("touch"===t.pointerType||es())}const ss=(t,e)=>!!e&&(t===e||ss(t,e.parentElement)),os=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,rs=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function as(t){return rs.has(t.tagName)||!0===t.isContentEditable}const ls=new WeakSet;function cs(t){return e=>{"Enter"===e.key&&t(e)}}function us(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function hs(t){return os(t)&&!es()}function ds(t,e){const n=window.getComputedStyle(t);return an(e)?n.getPropertyValue(e):n[e]}function ps(t){return a(t)&&"ownerSVGElement"in t}const ms=new WeakMap;let fs;const gs=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:ps(i)&&"getBBox"in i?i.getBBox()[e]:i[n],ys=gs("inline","width","offsetWidth"),vs=gs("block","height","offsetHeight");function xs({target:t,borderBoxSize:e}){ms.get(t)?.forEach(n=>{n(t,{get width(){return ys(t,e)},get height(){return vs(t,e)}})})}function Ts(t){t.forEach(xs)}function ws(t,e){fs||"undefined"!=typeof ResizeObserver&&(fs=new ResizeObserver(Ts));const n=Oi(t);return n.forEach(t=>{let n=ms.get(t);n||(n=new Set,ms.set(t,n)),n.add(e),fs?.observe(t)}),()=>{n.forEach(t=>{const n=ms.get(t);n?.delete(e),n?.size||fs?.unobserve(t)})}}const bs=new Set;let Ss;function As(t){return bs.add(t),Ss||(Ss=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};bs.forEach(e=>e(t))},window.addEventListener("resize",Ss)),()=>{bs.delete(t),bs.size||"function"!=typeof Ss||(window.removeEventListener("resize",Ss),Ss=void 0)}}function Vs(t,e){return"function"==typeof t?As(t):ws(t,e)}function Ps(t,e){let n;const i=()=>{const{currentTime:i}=e,s=(null===i?0:i.value)/100;n!==s&&t(s),n=s};return $.preUpdate(i,!0),()=>K(i)}function Es(){const{value:t}=W;null!==t?(t.frameloop.rate.push(z.delta),t.animations.mainThread.push(q.mainThread),t.animations.waapi.push(q.waapi),t.animations.layout.push(q.layout)):K(Es)}function M