UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 62.9 kB
function t(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const e=(t,e,n)=>n>e?e:n<t?t:n;function n(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}let s=()=>{},i=()=>{};"undefined"!=typeof process&&"production"!==process.env?.NODE_ENV&&(s=(t,e,s)=>{t||"undefined"==typeof console||console.warn(n(e,s))},i=(t,e,s)=>{if(!t)throw new Error(n(e,s))});const r={},a=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),o=t=>/^0[^.\s]+$/u.test(t);function l(t){let e;return()=>(void 0===e&&(e=t()),e)}const u=t=>t,h=(...t)=>t.reduce((t,e)=>n=>e(t(n))),c=(t,e,n)=>{const s=e-t;return s?(n-t)/s:1};class d{constructor(){this.subscriptions=[]}add(e){var n,s;return n=this.subscriptions,s=e,-1===n.indexOf(s)&&n.push(s),()=>t(this.subscriptions,e)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const p=t=>1e3*t,m=t=>t/1e3,f=(t,e)=>e?t*(1e3/e):0,g=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function y(t,e,n,s){if(t===e&&n===s)return u;const i=e=>function(t,e,n,s,i){let r,a,o=0;do{a=e+(n-e)/2,r=g(a,s,i)-t,r>0?n=a:e=a}while(Math.abs(r)>1e-7&&++o<12);return a}(e,0,1,t,n);return t=>0===t||1===t?t:g(i(t),e,s)}const v=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b=t=>e=>1-t(1-e),T=y(.33,1.53,.69,.99),w=b(T),M=v(w),S=t=>t>=1?1:(t*=2)<1?.5*w(t):.5*(2-Math.pow(2,-10*(t-1))),x=t=>1-Math.sin(Math.acos(t)),A=b(x),k=v(x),V=y(.42,0,1,1),C=y(0,0,.58,1),F=y(.42,0,.58,1),P=t=>Array.isArray(t)&&"number"!=typeof t[0];function B(t,e){return P(t)?t[((t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t})(0,t.length,e)]:t}const E=t=>Array.isArray(t)&&"number"==typeof t[0],R={linear:u,easeIn:V,easeInOut:F,easeOut:C,circIn:x,circInOut:k,circOut:A,backIn:w,backInOut:M,backOut:T,anticipate:S},D=t=>{if(E(t)){i(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,s,r]=t;return y(e,n,s,r)}return"string"==typeof t?(i(void 0!==R[t],`Invalid easing type '${t}'`,"invalid-easing-type"),R[t]):t},I=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function O(t,e){let n=!1,s=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=I.reduce((t,e)=>(t[e]=function(t){let e=new Set,n=new Set,s=!1,i=!1;const r=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function o(e){r.has(e)&&(l.schedule(e),t()),e(a)}const l={schedule:(t,i=!1,a=!1)=>{const o=a&&s?e:n;return i&&r.add(t),o.add(t),t},cancel:t=>{n.delete(t),r.delete(t)},process:t=>{if(a=t,s)return void(i=!0);s=!0;const r=e;e=n,n=r,e.forEach(o),e.clear(),s=!1,i&&(i=!1,l.process(t))}};return l}(a),t),{}),{setup:l,read:u,resolveKeyframes:h,preUpdate:c,update:d,preRender:p,render:m,postRender:f}=o,g=()=>{const a=r.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=s?1e3/60:Math.max(Math.min(o-i.timestamp,40),1)),i.timestamp=o,i.isProcessing=!0,l.process(i),u.process(i),h.process(i),c.process(i),d.process(i),p.process(i),m.process(i),f.process(i),i.isProcessing=!1,n&&e&&(s=!1,t(g))};return{schedule:I.reduce((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,s=!0,i.isProcessing||t(g)),a.schedule(e,r,o)),e},{}),cancel:t=>{for(let e=0;e<I.length;e++)o[I[e]].cancel(t)},state:i,steps:o}}const{schedule:N,cancel:$,state:K}=O("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:u,!0);let j;function W(){j=void 0}const L={now:()=>(void 0===j&&L.set(K.isProcessing||r.useManualTiming?K.timestamp:performance.now()),j),set:t=>{j=t,queueMicrotask(W)}},Y=t=>e=>"string"==typeof e&&e.startsWith(t),U=Y("--"),X=Y("var(--"),q=t=>!!X(t)&&z.test(t.split("/*")[0].trim()),z=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Z(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const _={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},H={..._,transform:t=>e(0,1,t)},G={..._,default:1},J=t=>Math.round(1e5*t)/1e5,Q=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const tt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,et=(t,e)=>n=>Boolean("string"==typeof n&&tt.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),nt=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(Q);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},st={..._,transform:t=>Math.round((t=>e(0,255,t))(t))},it={test:et("rgb","red"),parse:nt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+st.transform(t)+", "+st.transform(e)+", "+st.transform(n)+", "+J(H.transform(s))+")"};const rt={test:et("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:it.transform},at=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),ot=at("deg"),lt=at("%"),ut=at("px"),ht=at("vh"),ct=at("vw"),dt=(()=>({...lt,parse:t=>lt.parse(t)/100,transform:t=>lt.transform(100*t)}))(),pt={test:et("hsl","hue"),parse:nt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+lt.transform(J(e))+", "+lt.transform(J(n))+", "+J(H.transform(s))+")"},mt={test:t=>it.test(t)||rt.test(t)||pt.test(t),parse:t=>it.test(t)?it.parse(t):pt.test(t)?pt.parse(t):rt.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?it.transform(t):pt.transform(t),getAnimatableNone:t=>{const e=mt.parse(t);return e.alpha=0,mt.transform(e)}},ft=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const gt="number",yt="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 bt(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},i=[];let r=0;const a=e.replace(vt,t=>(mt.test(t)?(s.color.push(r),i.push(yt),n.push(mt.parse(t))):t.startsWith("var(")?(s.var.push(r),i.push("var"),n.push(t)):(s.number.push(r),i.push(gt),n.push(parseFloat(t))),++r,"${}")).split("${}");return{values:n,split:a,indexes:s,types:i}}function Tt({split:t,types:e}){const n=t.length;return s=>{let i="";for(let r=0;r<n;r++)if(i+=t[r],void 0!==s[r]){const t=e[r];i+=t===gt?J(s[r]):t===yt?mt.transform(s[r]):s[r]}return i}}const wt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(n=t)?0:mt.test(n)?mt.getAnimatableNone(n):n;var n};const Mt={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(Q)?.length||0)+(t.match(ft)?.length||0)>0},parse:function(t){return bt(t).values},createTransformer:function(t){return Tt(bt(t))},getAnimatableNone:function(t){const e=bt(t);return Tt(e)(e.values.map((t,n)=>wt(t,e.split[n])))}};function St(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 xt(t,e){return n=>n>0?e:t}const At=(t,e,n)=>t+(e-t)*n,kt=(t,e,n)=>{const s=t*t,i=n*(e*e-s)+s;return i<0?0:Math.sqrt(i)},Vt=[rt,it,pt];function Ct(t){const e=(n=t,Vt.find(t=>t.test(n)));var n;if(s(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let i=e.parse(t);return e===pt&&(i=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,r=0,a=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,o=2*n-s;i=St(o,s,t+1/3),r=St(o,s,t),a=St(o,s,t-1/3)}else i=r=a=n;return{red:Math.round(255*i),green:Math.round(255*r),blue:Math.round(255*a),alpha:s}}(i)),i}const Ft=(t,e)=>{const n=Ct(t),s=Ct(e);if(!n||!s)return xt(t,e);const i={...n};return t=>(i.red=kt(n.red,s.red,t),i.green=kt(n.green,s.green,t),i.blue=kt(n.blue,s.blue,t),i.alpha=At(n.alpha,s.alpha,t),it.transform(i))},Pt=new Set(["none","hidden"]);function Bt(t,e){return n=>At(t,e,n)}function Et(t){return"number"==typeof t?Bt:"string"==typeof t?q(t)?xt:mt.test(t)?Ft:It:Array.isArray(t)?Rt:"object"==typeof t?mt.test(t)?Ft:Dt:xt}function Rt(t,e){const n=[...t],s=n.length,i=t.map((t,n)=>Et(t)(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}}function Dt(t,e){const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=Et(t[i])(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}}const It=(t,e)=>{const n=Mt.createTransformer(e),i=bt(t),r=bt(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?Pt.has(t)&&!r.values.length||Pt.has(e)&&!i.values.length?function(t,e){return Pt.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):h(Rt(function(t,e){const n=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const r=e.types[i],a=t.indexes[r][s[r]],o=t.values[a]??0;n[i]=o,s[r]++}return n}(i,r),r.values),n):(s(!0,`Complex values '${t}' and '${e}' 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"),xt(t,e))};function Ot(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return At(t,e,n);return Et(t)(t,e)}const Nt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>N.update(e,t),stop:()=>$(e),now:()=>K.isProcessing?K.timestamp:L.now()}},$t=(t,e,n=10)=>{let s="";const i=Math.max(Math.round(e/n),2);for(let e=0;e<i;e++)s+=Math.round(1e4*t(e/(i-1)))/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Kt=2e4;function jt(t){let e=0;let n=t.next(e);for(;!n.done&&e<Kt;)e+=50,n=t.next(e);return e>=Kt?1/0:e}function Wt(t,e=100,n){const s=n({...t,keyframes:[0,e]}),i=Math.min(jt(s),Kt);return{type:"keyframes",ease:t=>s.next(i*t).value/e,duration:m(i)}}const Lt=100,Yt=10,Ut=1,Xt=0,qt=800,zt=.3,Zt=.3,_t={granular:.01,default:2},Ht={granular:.005,default:.5},Gt=.01,Jt=10,Qt=.05,te=1;function ee(t,e){return t*Math.sqrt(1-e*e)}const ne=.001;const se=["duration","bounce"],ie=["stiffness","damping","mass"];function re(t,e){return e.some(e=>void 0!==t[e])}function ae(t){let n={velocity:Xt,stiffness:Lt,damping:Yt,mass:Ut,isResolvedFromDuration:!1,...t};if(!re(t,ie)&&re(t,se))if(n.velocity=0,t.visualDuration){const s=t.visualDuration,i=2*Math.PI/(1.2*s),r=i*i,a=2*e(.05,1,1-(t.bounce||0))*Math.sqrt(r);n={...n,mass:Ut,stiffness:r,damping:a}}else{const i=function({duration:t=qt,bounce:n=zt,velocity:i=Xt,mass:r=Ut}){let a,o;s(t<=p(Jt),"Spring duration must be 10 seconds or less","spring-duration-limit");let l=1-n;l=e(Qt,te,l),t=e(Gt,Jt,m(t)),l<1?(a=e=>{const n=e*l,s=n*t,r=n-i,a=ee(e,l),o=Math.exp(-s);return ne-r/a*o},o=e=>{const n=e*l*t,s=n*i+i,r=Math.pow(l,2)*Math.pow(e,2)*t,o=Math.exp(-n),u=ee(Math.pow(e,2),l);return(-a(e)+ne>0?-1:1)*((s-r)*o)/u}):(a=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,o=e=>Math.exp(-e*t)*(t*t*(i-e)));const u=function(t,e,n){let s=n;for(let n=1;n<12;n++)s-=t(s)/e(s);return s}(a,o,5/t);if(t=p(t),isNaN(u))return{stiffness:Lt,damping:Yt,duration:t};{const e=Math.pow(u,2)*r;return{stiffness:e,damping:2*l*Math.sqrt(r*e),duration:t}}}({...t,velocity:0});n={...n,...i,mass:Ut},n.isResolvedFromDuration=!0}return n}function oe(t=Zt,e=zt){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:i}=n;const r=n.keyframes[0],a=n.keyframes[n.keyframes.length-1],o={done:!1,value:r},{stiffness:l,damping:u,mass:h,duration:c,velocity:d,isResolvedFromDuration:f}=ae({...n,velocity:-m(n.velocity||0)}),g=d||0,y=u/(2*Math.sqrt(l*h)),v=a-r,b=m(Math.sqrt(l/h)),T=Math.abs(v)<5;let w,M,S,x,A,k;if(s||(s=T?_t.granular:_t.default),i||(i=T?Ht.granular:Ht.default),y<1)S=ee(b,y),x=(g+y*b*v)/S,w=t=>{const e=Math.exp(-y*b*t);return a-e*(x*Math.sin(S*t)+v*Math.cos(S*t))},A=y*b*x+v*S,k=y*b*v-x*S,M=t=>Math.exp(-y*b*t)*(A*Math.sin(S*t)+k*Math.cos(S*t));else if(1===y){w=t=>a-Math.exp(-b*t)*(v+(g+b*v)*t);const t=g+b*v;M=e=>Math.exp(-b*e)*(b*t*e-g)}else{const t=b*Math.sqrt(y*y-1);w=e=>{const n=Math.exp(-y*b*e),s=Math.min(t*e,300);return a-n*((g+y*b*v)*Math.sinh(s)+t*v*Math.cosh(s))/t};const e=(g+y*b*v)/t,n=y*b*e-v*t,s=y*b*v-e*t;M=e=>{const i=Math.exp(-y*b*e),r=Math.min(t*e,300);return i*(n*Math.sinh(r)+s*Math.cosh(r))}}const V={calculatedDuration:f&&c||null,velocity:t=>p(M(t)),next:t=>{if(!f&&y<1){const e=Math.exp(-y*b*t),n=Math.sin(S*t),r=Math.cos(S*t),l=a-e*(x*n+v*r),u=p(e*(A*n+k*r));return o.done=Math.abs(u)<=s&&Math.abs(a-l)<=i,o.value=o.done?a:l,o}const e=w(t);if(f)o.done=t>=c;else{const n=p(M(t));o.done=Math.abs(n)<=s&&Math.abs(a-e)<=i}return o.value=o.done?a:e,o},toString:()=>{const t=Math.min(jt(V),Kt),e=$t(e=>V.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return V}oe.applyToOptions=t=>{const e=Wt(t,100,oe);return t.ease=e.ease,t.duration=p(e.duration),t.type="keyframes",t};function le(t,e,n){const s=Math.max(e-5,0);return f(n-t(s),e-s)}function ue({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:i=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===o?l:void 0===l||Math.abs(o-t)<Math.abs(l-t)?o:l;let m=n*e;const f=c+m,g=void 0===a?f:a(f);g!==f&&(m=g-c);const y=t=>-m*Math.exp(-t/s),v=t=>g+y(t),b=t=>{const e=y(t),n=v(t);d.done=Math.abs(e)<=u,d.value=d.done?g:n};let T,w;const M=t=>{var e;(e=d.value,void 0!==o&&e<o||void 0!==l&&e>l)&&(T=t,w=oe({keyframes:[d.value,p(d.value)],velocity:le(v,t,d.value),damping:i,stiffness:r,restDelta:u,restSpeed:h}))};return M(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==T||(e=!0,b(t),M(t)),void 0!==T&&t>=T?w.next(t-T):(!e&&b(t),d)}}}function he(t,n,{clamp:s=!0,ease:a,mixer:o}={}){const l=t.length;if(i(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 d=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),n=[...n].reverse());const p=function(t,e,n){const s=[],i=n||r.mix||Ot,a=t.length-1;for(let n=0;n<a;n++){let r=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]||u:e;r=h(t,r)}s.push(r)}return s}(n,a,o),m=p.length,f=e=>{if(d&&e<t[0])return n[0];let s=0;if(m>1)for(;s<t.length-2&&!(e<t[s+1]);s++);const i=c(t[s],t[s+1],e);return p[s](i)};return s?n=>f(e(t[0],t[l-1],n)):f}function ce(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const i=c(0,e,s);t.push(At(n,1,i))}}function de(t){const e=[0];return ce(e,t.length-1),e}function pe({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const i=P(s)?s.map(D):D(s),r={done:!1,value:e[0]},a=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:de(e),t),o=he(a,e,{ease:Array.isArray(i)?i:(l=e,u=i,l.map(()=>u||F).splice(0,l.length-1))});var l,u;return{calculatedDuration:t,next:e=>(r.value=o(e),r.done=e>=t,r)}}const me=t=>null!==t;function fe(t,{repeat:e,repeatType:n="loop"},s,i=1){const r=t.filter(me),a=i<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return a&&void 0!==s?s:r[a]}const ge={decay:ue,inertia:ue,tween:pe,keyframes:pe,spring:oe};function ye(t){"string"==typeof t.type&&(t.type=ge[t.type])}class ve{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 Te extends ve{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options;t&&t.updatedAt!==L.now()&&this.tick(L.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){const{options:t}=this;ye(t);const{type:e=pe,repeat:n=0,repeatDelay:s=0,repeatType:i,velocity:r=0}=t;let{keyframes:a}=t;const o=e||pe;o!==pe&&"number"!=typeof a[0]&&(this.mixKeyframes=h(be,Ot(a[0],a[1])),a=[0,100]);const l=o({...t,keyframes:a});"mirror"===i&&(this.mirroredGenerator=o({...t,keyframes:[...a].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=jt(l));const{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(n+1)-s,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,n=!1){const{generator:s,totalDuration:i,mixKeyframes:r,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:l}=this;if(null===this.startTime)return s.next(0);const{delay:u=0,keyframes:h,repeat:c,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-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-u*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let b,T=this.currentTime,w=s;if(c){const t=Math.min(this.currentTime,i)/o;let n=Math.floor(t),s=t%1;!s&&t>=1&&(s=1),1===s&&n--,n=Math.min(n,c+1);Boolean(n%2)&&("reverse"===d?(s=1-s,p&&(s-=p/o)):"mirror"===d&&(w=a)),T=e(0,1,s)*o}v?(this.delayState.value=h[0],b=this.delayState):b=w.next(T),r&&!v&&(b.value=r(b.value));let{done:M}=b;v||null===l||(M=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&M);return S&&m!==ue&&(b.value=fe(h,this.options,g,this.speed)),f&&f(b.value),S&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return m(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+m(t)}get time(){return m(this.currentTime)}set time(t){t=p(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?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);return le(t=>this.generator.next(t).value,t,this.generator.next(t).value)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(L.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=m(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Nt,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(L.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}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)}}const we=t=>180*t/Math.PI,Me=t=>{const e=we(Math.atan2(t[1],t[0]));return xe(e)},Se={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Me,rotateZ:Me,skewX:t=>we(Math.atan(t[1])),skewY:t=>we(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},xe=t=>((t%=360)<0&&(t+=360),t),Ae=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),ke=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ve={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ae,scaleY:ke,scale:t=>(Ae(t)+ke(t))/2,rotateX:t=>xe(we(Math.atan2(t[6],t[5]))),rotateY:t=>xe(we(Math.atan2(-t[2],t[0]))),rotateZ:Me,rotate:Me,skewX:t=>we(Math.atan(t[4])),skewY:t=>we(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ce(t){return t.includes("scale")?1:0}function Fe(t,e){if(!t||"none"===t)return Ce(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,i;if(n)s=Ve,i=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=Se,i=e}if(!i)return Ce(e);const r=s[e],a=i[1].split(",").map(Pe);return"function"==typeof r?r(a):a[r]}function Pe(t){return parseFloat(t.trim())}const Be=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ee=(()=>new Set(Be))(),Re=t=>t===_||t===ut,De=new Set(["x","y","z"]),Ie=Be.filter(t=>!De.has(t));const Oe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:s})=>{const i=t.max-t.min;return"border-box"===s?i:i-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})=>Fe(e,"x"),y:(t,{transform:e})=>Fe(e,"y")};Oe.translateX=Oe.x,Oe.translateY=Oe.y;const Ne=new Set;let $e=!1,Ke=!1,je=!1;function We(){if(Ke){const t=Array.from(Ne).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 Ie.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.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)})}Ke=!1,$e=!1,Ne.forEach(t=>t.complete(je)),Ne.clear()}function Le(){Ne.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ke=!0)})}class Ye{constructor(t,e,n,s,i,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=s,this.element=i,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Ne.add(this),$e||($e=!0,N.read(Le),N.resolveKeyframes(We))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:s}=this;if(null===t[0]){const i=s?.get(),r=t[t.length-1];if(void 0!==i)t[0]=i;else if(n&&e){const s=n.readValue(e,r);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=r),s&&void 0===i&&s.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Ne.delete(this)}cancel(){"scheduled"===this.state&&(Ne.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function Ue(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}const Xe={};function qe(t,e){const n=l(t);return()=>Xe[e]??n()}const ze=qe(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),Ze=qe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),_e=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,He={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:_e([0,.65,.55,1]),circOut:_e([.55,0,1,.45]),backIn:_e([.31,.01,.66,-.59]),backOut:_e([.33,1.53,.69,.99])};function Ge(t,e){return t?"function"==typeof t?Ze()?$t(t,e):"ease-out":E(t)?_e(t):Array.isArray(t)?t.map(t=>Ge(t,e)||He.easeOut):He[t]:void 0}function Je(t,e,n,{delay:s=0,duration:i=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u=void 0){const h={[e]:n};l&&(h.offset=l);const c=Ge(o,i);Array.isArray(c)&&(h.easing=c);const d={delay:s,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};u&&(d.pseudoElement=u);return t.animate(h,d)}function Qe(t){return"function"==typeof t&&"applyToOptions"in t}class tn extends ve{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:s,pseudoElement:r,allowFlatten:a=!1,finalKeyframe:o,onComplete:l}=t;this.isPseudoElement=Boolean(r),this.allowFlatten=a,this.options=t,i("string"!=typeof t.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const u=function({type:t,...e}){return Qe(t)&&Ze()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=Je(e,n,s,u,r),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!r){const t=fe(s,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(t),Ue(e,n,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(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return m(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+m(t)}get time(){return m(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=p(t),e&&this.animation.pause()}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,rangeStart:e,rangeEnd:n,observe:s}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&ze()?(this.animation.timeline=t,e&&(this.animation.rangeStart=e),n&&(this.animation.rangeEnd=n),u):s(this)}}const en={anticipate:S,backInOut:M,circInOut:k};function nn(t){"string"==typeof t.ease&&t.ease in en&&(t.ease=en[t.ease])}class sn extends tn{constructor(t){nn(t),ye(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:s,onComplete:i,element:r,...a}=this.options;if(!n)return;if(void 0!==t)return void n.set(t);const o=new Te({...a,autoplay:!1}),l=Math.max(10,L.now()-this.startTime),u=e(0,10,l-10),h=o.sample(l).value,{name:c}=this.options;r&&c&&Ue(r,c,h),n.setWithVelocity(o.sample(Math.max(0,l-u)).value,h,u),o.stop()}}const rn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!Mt.test(t)&&"0"!==t||t.startsWith("url(")));function an(t){t.duration=0,t.type="keyframes"}const on=new Set(["opacity","clipPath","filter","transform"]),ln=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const un=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),hn=l(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function cn(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:i,damping:r,type:a,keyframes:o}=t,l=e?.owner?.current;if(!(l instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:h}=e.owner.getProps();return hn()&&n&&(on.has(n)||un.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&ln.test(t[e]))return!0;return!1}(o))&&("transform"!==n||!h)&&!u&&!s&&"mirror"!==i&&0!==r&&"inertia"!==a}class dn extends ve{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=L.now();const c={autoplay:t,delay:e,type:n,repeat:s,repeatDelay:i,repeatType:r,name:o,motionValue:l,element:u,...h},d=u?.KeyframeResolver||Ye;this.keyframeResolver=new d(a,(t,e,n)=>this.onKeyframesResolved(t,e,c,!n),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:a,type:o,velocity:l,delay:h,isHandoff:c,onUpdate:d}=n;this.resolvedAt=L.now();let p=!0;(function(t,e,n,i){const r=t[0];if(null===r)return!1;if("display"===e||"visibility"===e)return!0;const a=t[t.length-1],o=rn(r,e),l=rn(a,e);return s(o===l,`You are trying to animate ${e} from "${r}" to "${a}". "${o?a:r}" is not an animatable value.`,"value-not-animatable"),!(!o||!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}(t)||("spring"===n||Qe(n))&&i)})(t,a,o,l)||(p=!1,!r.instantAnimations&&h||d?.(fe(t,n,e)),t[0]=t[t.length-1],an(n),n.repeat=0);const m={startTime:i?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},f=p&&!c&&cn(m),g=m.motionValue?.owner?.current;let y;if(f)try{y=new sn({...m,element:g})}catch{y=new Te(m)}else y=new Te(m);y.finished.then(()=>{this.notifyFinished()}).catch(u),this.pendingTimeline&&(this.stopTimeline=y.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=y}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(),je=!0,Le(),We(),je=!1),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 pn{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 mn(this.animations,"duration")}get iterationDuration(){return mn(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 mn(t,e){let n=0;for(let s=0;s<t.length;s++){const i=t[s][e];null!==i&&i>n&&(n=i)}return n}class fn extends pn{then(t,e){return this.finished.finally(t).then(()=>{})}}const gn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function yn(t,e,n=1){i(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[s,r]=function(t){const e=gn.exec(t);if(!e)return[,];const[,n,s,i]=e;return[`--${n??s}`,i]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return a(t)?parseFloat(t):t}return q(r)?yn(r,e,n+1):r}const vn={type:"spring",stiffness:500,damping:25,restSpeed:10},bn={type:"keyframes",duration:.8},Tn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},wn=(t,{keyframes:e})=>e.length>2?bn:Ee.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:vn:Tn;function Mn(t,e){if(t?.inherit&&e){const{inherit:n,...s}=t;return{...e,...s}}return t}function Sn(t,e){const n=t?.[e]??t?.default??t;return n!==t?Mn(n,t):n}const xn=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);const An=(t,e,n,s={},i,a)=>o=>{const l=Sn(s,t)||{},u=l.delay||s.delay||0;let{elapsed:h=0}=s;h-=p(u);const c={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-h,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:a?void 0:i};(function(t){for(const e in t)if(!xn.has(e))return!0;return!1})(l)||Object.assign(c,wn(t,c)),c.duration&&(c.duration=p(c.duration)),c.repeatDelay&&(c.repeatDelay=p(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(an(c),0===c.delay&&(d=!0)),(r.instantAnimations||r.skipAnimations||i?.shouldSkipAnimations||l.skipAnimations)&&(d=!0,an(c),c.delay=0),c.allowFlatten=!l.type&&!l.ease,d&&!a&&void 0!==e.get()){const t=fe(c.keyframes,l);if(void 0!==t)return void N.update(()=>{c.onUpdate(t),c.onComplete()})}return l.isSync?new Te(c):new dn(c)};function kn(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}function Vn(t,e,n,s){if("function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}if("string"==typeof e&&(e=t.variants&&t.variants[e]),"function"==typeof e){const[i,r]=kn(s);e=e(void 0!==n?n:t.custom,i,r)}return e}const Cn=new Set(["width","height","top","left","right","bottom",...Be]);class Fn{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=L.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=L.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 d);const n=this.events[t].add(e);return"change"===t?()=>{n(),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 this.current}getPrevious(){return this.prev}getVelocity(){const t=L.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return f(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 Pn(t,e){return new Fn(t,e)}function Bn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Pn(n))}function En(t){return(t=>Array.isArray(t))(t)?t[t.length-1]||0:t}function Rn(t,e){const n=function(t,e){const n=t.getProps();return Vn(n,e,n.custom,t)}(t,e);let{transitionEnd:s={},transition:i={},...r}=n||{};r={...r,...s};for(const e in r){Bn(t,e,En(r[e]))}}const Dn=t=>Boolean(t&&t.getVelocity);function In(t,e){const n=t.getValue("willChange");if(s=n,Boolean(Dn(s)&&s.add))return n.add(e);if(!n&&r.WillChange){const n=new r.WillChange("auto");t.addValue("willChange",n),n.add(e)}var s}function On(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const Nn="data-"+On("framerAppearId");function $n(t){return t.props[Nn]}function Kn({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function jn(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:r,transitionEnd:a,...o}=e;const l=t.getDefaultTransition();r=r?Mn(r,l):l;const u=r?.reduceMotion,h=r?.skipAnimations;s&&(r=s);const c=[],d=i&&t.animationState&&t.animationState.getState()[i];for(const e in o){const s=t.getValue(e,t.latestValues[e]??null),i=o[e];if(void 0===i||d&&Kn(d,e))continue;const a={delay:n,...Sn(r||{},e)};h&&(a.skipAnimations=!0);const l=s.get();if(void 0!==l&&!s.isAnimating()&&!Array.isArray(i)&&i===l&&!a.velocity){N.update(()=>s.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){const n=$n(t);if(n){const t=window.MotionHandoffAnimation(n,e,N);null!==t&&(a.startTime=t,p=!0)}}In(t,e);const m=u??t.shouldReduceMotion;s.start(An(e,s,i,m&&Cn.has(e)?{type:!1}:a,t,p));const f=s.animation;f&&c.push(f)}if(a){const e=()=>N.update(()=>{a&&Rn(t,a)});c.length?Promise.all(c).then(e):e()}return c}const Wn=t=>e=>e.test(t),Ln=[_,ut,lt,ot,ct,ht,{test:t=>"auto"===t,parse:t=>t}],Yn=t=>Ln.find(Wn(t));function Un(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||o(t))}const Xn=new Set(["brightness","contrast","saturate","opacity"]);function qn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=n.match(Q)||[];if(!s)return t;const i=n.replace(s,"");let r=Xn.has(e)?1:0;return s!==n&&(r*=100),e+"("+r+i+")"}const zn=/\b([a-z-]*)\(.*?\)/gu,Zn={...Mt,getAnimatableNone:t=>{const e=t.match(zn);return e?e.map(qn).join(" "):t}},_n={...Mt,getAnimatableNone:t=>{const e=Mt.parse(t);return Mt.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},Hn={..._,transform:Math.round},Gn={borderWidth:ut,borderTopWidth:ut,borderRightWidth:ut,borderBottomWidth:ut,borderLeftWidth:ut,borderRadius:ut,borderTopLeftRadius:ut,borderTopRightRadius:ut,borderBottomRightRadius:ut,borderBottomLeftRadius:ut,width:ut,maxWidth:ut,height:ut,maxHeight:ut,top:ut,right:ut,bottom:ut,left:ut,inset:ut,insetBlock:ut,insetBlockStart:ut,insetBlockEnd:ut,insetInline:ut,insetInlineStart:ut,insetInlineEnd:ut,padding:ut,paddingTop:ut,paddingRight:ut,paddingBottom:ut,paddingLeft:ut,paddingBlock:ut,paddingBlockStart:ut,paddingBlockEnd:ut,paddingInline:ut,paddingInlineStart:ut,paddingInlineEnd:ut,margin:ut,marginTop:ut,marginRight:ut,marginBottom:ut,marginLeft:ut,marginBlock:ut,marginBlockStart:ut,marginBlockEnd:ut,marginInline:ut,marginInlineStart:ut,marginInlineEnd:ut,fontSize:ut,backgroundPositionX:ut,backgroundPositionY:ut,...{rotate:ot,rotateX:ot,rotateY:ot,rotateZ:ot,scale:G,scaleX:G,scaleY:G,scaleZ:G,skew:ot,skewX:ot,skewY:ot,distance:ut,translateX:ut,translateY:ut,translateZ:ut,x:ut,y:ut,z:ut,perspective:ut,transformPerspective:ut,opacity:H,originX:dt,originY:dt,originZ:ut},zIndex:Hn,fillOpacity:H,strokeOpacity:H,numOctaves:Hn},Jn={...Gn,color:mt,backgroundColor:mt,outlineColor:mt,fill:mt,stroke:mt,borderColor:mt,borderTopColor:mt,borderRightColor:mt,borderBottomColor:mt,borderLeftColor:mt,filter:Zn,WebkitFilter:Zn,mask:_n,WebkitMask:_n},Qn=t=>Jn[t],ts=new Set([Zn,_n]);function es(t,e){let n=Qn(t);return ts.has(n)||(n=Mt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ns=new Set(["auto","none","0"]);class ss extends Ye{constructor(t,e,n,s,i){super(t,e,n,s,i,!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 s=t[n];if("string"==typeof s&&(s=s.trim(),q(s))){const i=yn(s,e.current);void 0!==i&&(t[n]=i),n===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!Cn.has(n)||2!==t.length)return;const[s,i]=t,r=Yn(s),a=Yn(i);if(Z(s)!==Z(i)&&Oe[n])this.needsMeasurement=!0;else if(r!==a)if(Re(r)&&Re(a))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else Oe[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Un(t[e]))&&n.push(e);n.length&&function(t,e,n){let s,i=0;for(;i<t.length&&!s;){const e=t[i];"string"==typeof e&&!ns.has(e)&&bt(e).values.length&&(s=t[i]),i++}if(s&&n)for(const i of e)t[i]=es(n,s)}(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=Oe[n](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(n,s).jump(s,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(e);s&&s.jump(this.measuredOrigin,!1);const i=n.length-1,r=n[i];n[i]=Oe[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}const is=(t,e)=>e&&"number"==typeof t?e.transform(t):t,{schedule:rs}=O(queueMicrotask,!1);function as(t){return"object"==typeof(e=t)&&null!==e&&"ownerSVGElement"in t;var e}const os=[...Ln,mt,Mt],ls=()=>({x:{min:0,max:0},y:{min:0,max:0}}),us=new WeakMap;const hs=["initial","animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"];function cs(t){return null!==(e=t.animate)&&"object"==typeof e&&"function"==typeof e.start||hs.some(e=>function(t){return"string"==typeof t||Array.isArray(t)}(t[e]));var e}const ds={current:null},ps={current:!1},ms="undefined"!=typeof window;const fs=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let gs={};class ys{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:r,visualState:a},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Ye,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=L.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,N.render(this.render,!1,!0))};const{latestValues:l,renderState:u}=a;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=u,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=o,this.blockInitialAnimation=Boolean(r),this.isControllingVariants=cs(e),this.isVariantNode=function(t){return Boolean(cs(t)||t.variants)}(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...c}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in c){const e=c[t];void 0!==l[t]&&Dn(e)&&e.set(l[t])}}mount(t){if(this.hasBeenMounted)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];this.current=t,us.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(ps.current||function(){if(ps.current=!0,ms)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ds.current=t.matches;t.addEventListener("change",e),e()}else ds.current=!1}(),this.shouldReduceMotion=ds.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),$(this.notifyUpdate),$(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),e.accelerate&&on.has(t)&&this.current instanceof HTMLElement){const{factory:n,keyframes:s,times:i,ease:r,duration:a}=e.accelerate,o=new tn({element:this.current,name:t,keyframes:s,times:i,ease:r,duration:p(a)}),l=n(o);return void this.valueSubscriptions.set(t,()=>{l(),o.cancel()})}const n=Ee.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&N.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),i&&i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in gs){const e=gs[t];if(!e)continue;const{isEnabled:n,Feature:s}=e;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<fs.length;e++){const n=fs[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){for(const s in e){const i=e[s],r=n[s];if(Dn(i))t.addValue(s,i);else if(Dn(r))t.addValue(s,Pn(i,{owner:t}));else if(r!==i)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(i):e.hasAnimated||e.set(i)}else{const e=t.getStaticValue(s);t.addValue(s,Pn(void 0!==e?e:i,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add