UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

1 lines • 81.4 kB
import{q as t,t as e,u as i,v as n,w as s,x as o,y as r,z as a,A as l,B as h,C as c,D as u,E as d,F as m,G as p,H as f,I as y,J as g,K as v,M as x,N as T,O as P,W as w,Q as S,R as E,T as D,U as A,V as b,X as k,Y as C,Z as M,k as L,_ as V,$ as R,b as j,o as B,a0 as I,a1 as O,a2 as F,a3 as U,a4 as W,a5 as z,a6 as $,a7 as N,a8 as H,a9 as K,d as G,s as Y,aa as X,ab as q,l as _,e as Z,f as J,ac as Q,a as tt,ad as et,j as it,ae as nt,af as st,ag as ot,ah as rt,ai as at,aj as lt,ak as ht,al as ct,am as ut,r as dt,an as mt,p as pt,P as ft,L as yt,S as gt,g as vt}from"./size-rollup-dom-max-assets.js";import{jsx as xt}from"react/jsx-runtime";import{useContext as Tt,useId as Pt,useEffect as wt,useCallback as St,Component as Et,Fragment as Dt}from"react";function At(t){return"object"==typeof t&&null!==t}const bt=(t,e)=>i=>e(t(i)),kt=(...t)=>t.reduce(bt),Ct=(t,e,i)=>{const n=e-t;return 0===n?1:(i-t)/n},Mt=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function Lt(e,i,n,s){if(e===i&&n===s)return t;const o=t=>function(t,e,i,n,s){let o,r,a=0;do{r=e+(i-e)/2,o=Mt(r,n,s)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,n);return t=>0===t||1===t?t:Mt(o(t),i,s)}const Vt=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Rt=t=>e=>1-t(1-e),jt=Lt(.33,1.53,.69,.99),Bt=Rt(jt),It=Vt(Bt),Ot=t=>(t*=2)<1?.5*Bt(t):.5*(2-Math.pow(2,-10*(t-1))),Ft=t=>1-Math.sin(Math.acos(t)),Ut=Rt(Ft),Wt=Vt(Ft),zt=Lt(.42,0,1,1),$t=Lt(0,0,.58,1),Nt=Lt(.42,0,.58,1),Ht={linear:t,easeIn:zt,easeInOut:Nt,easeOut:$t,circIn:Ft,circInOut:Wt,circOut:Ut,backIn:Bt,backInOut:It,backOut:jt,anticipate:Ot},Kt=t=>{if(e(t)){i(4===t.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,s,o]=t;return Lt(e,n,s,o)}return"string"==typeof t?(i(void 0!==Ht[t],`Invalid easing type '${t}'`,"invalid-easing-type"),Ht[t]):t};function Gt(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function Yt(t,e){return i=>i>0?e:t}const Xt=(t,e,i)=>{const n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},qt=[a,s,r];function _t(t){const e=(i=t,qt.find(t=>t.test(i)));var i;if(o(Boolean(e),`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!Boolean(e))return!1;let n=e.parse(t);return e===r&&(n=function({hue:t,saturation:e,lightness:i,alpha:n}){t/=360,i/=100;let s=0,o=0,r=0;if(e/=100){const n=i<.5?i*(1+e):i+e-i*e,a=2*i-n;s=Gt(a,n,t+1/3),o=Gt(a,n,t),r=Gt(a,n,t-1/3)}else s=o=r=i;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:n}}(n)),n}const Zt=(t,e)=>{const i=_t(t),o=_t(e);if(!i||!o)return Yt(t,e);const r={...i};return t=>(r.red=Xt(i.red,o.red,t),r.green=Xt(i.green,o.green,t),r.blue=Xt(i.blue,o.blue,t),r.alpha=n(i.alpha,o.alpha,t),s.transform(r))},Jt=new Set(["none","hidden"]);function Qt(t,e){return i=>n(t,e,i)}function te(t){return"number"==typeof t?Qt:"string"==typeof t?l(t)?Yt:h.test(t)?Zt:ne:Array.isArray(t)?ee:"object"==typeof t?h.test(t)?Zt:ie:Yt}function ee(t,e){const i=[...t],n=i.length,s=t.map((t,i)=>te(t)(t,e[i]));return t=>{for(let e=0;e<n;e++)i[e]=s[e](t);return i}}function ie(t,e){const i={...t,...e},n={};for(const s in i)void 0!==t[s]&&void 0!==e[s]&&(n[s]=te(t[s])(t[s],e[s]));return t=>{for(const e in n)i[e]=n[e](t);return i}}const ne=(t,e)=>{const i=c.createTransformer(e),n=u(t),s=u(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?Jt.has(t)&&!s.values.length||Jt.has(e)&&!n.values.length?function(t,e){return Jt.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):kt(ee(function(t,e){const i=[],n={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][n[o]],a=t.values[r]??0;i[s]=a,n[o]++}return i}(n,s),s.values),i):(o(!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"),Yt(t,e))};function se(t,e,i){if("number"==typeof t&&"number"==typeof e&&"number"==typeof i)return n(t,e,i);return te(t)(t,e)}const oe=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>d.update(e,t),stop:()=>m(e),now:()=>p.isProcessing?p.timestamp:f.now()}},re=2e4;function ae(t){let e=0;let i=t.next(e);for(;!i.done&&e<re;)e+=50,i=t.next(e);return e>=re?1/0:e}function le(t,e,i){const n=Math.max(e-5,0);return g(i-t(n),e-n)}const he=100,ce=10,ue=1,de=0,me=800,pe=.3,fe=.3,ye={granular:.01,default:2},ge={granular:.005,default:.5},ve=.01,xe=10,Te=.05,Pe=1,we=.001;function Se({duration:t=me,bounce:e=pe,velocity:i=de,mass:n=ue}){let s,r;o(t<=v(xe),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-e;a=x(Te,Pe,a),t=x(ve,xe,y(t)),a<1?(s=e=>{const n=e*a,s=n*t,o=n-i,r=De(e,a),l=Math.exp(-s);return we-o/r*l},r=e=>{const n=e*a*t,o=n*i+i,r=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-n),h=De(Math.pow(e,2),a);return(-s(e)+we>0?-1:1)*((o-r)*l)/h}):(s=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(i-e)));const l=function(t,e,i){let n=i;for(let i=1;i<Ee;i++)n-=t(n)/e(n);return n}(s,r,5/t);if(t=v(t),isNaN(l))return{stiffness:he,damping:ce,duration:t};{const e=Math.pow(l,2)*n;return{stiffness:e,damping:2*a*Math.sqrt(n*e),duration:t}}}const Ee=12;function De(t,e){return t*Math.sqrt(1-e*e)}const Ae=["duration","bounce"],be=["stiffness","damping","mass"];function ke(t,e){return e.some(e=>void 0!==t[e])}function Ce(t=fe,e=pe){const i="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:s}=i;const o=i.keyframes[0],r=i.keyframes[i.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:h,mass:c,duration:u,velocity:d,isResolvedFromDuration:m}=function(t){let e={velocity:de,stiffness:he,damping:ce,mass:ue,isResolvedFromDuration:!1,...t};if(!ke(t,be)&&ke(t,Ae))if(t.visualDuration){const i=t.visualDuration,n=2*Math.PI/(1.2*i),s=n*n,o=2*x(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:ue,stiffness:s,damping:o}}else{const i=Se(t);e={...e,...i,mass:ue},e.isResolvedFromDuration=!0}return e}({...i,velocity:-y(i.velocity||0)}),p=d||0,f=h/(2*Math.sqrt(l*c)),g=r-o,P=y(Math.sqrt(l/c)),w=Math.abs(g)<5;let S;if(n||(n=w?ye.granular:ye.default),s||(s=w?ge.granular:ge.default),f<1){const t=De(P,f);S=e=>{const i=Math.exp(-f*P*e);return r-i*((p+f*P*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===f)S=t=>r-Math.exp(-P*t)*(g+(p+P*g)*t);else{const t=P*Math.sqrt(f*f-1);S=e=>{const i=Math.exp(-f*P*e),n=Math.min(t*e,300);return r-i*((p+f*P*g)*Math.sinh(n)+t*g*Math.cosh(n))/t}}const E={calculatedDuration:m&&u||null,next:t=>{const e=S(t);if(m)a.done=t>=u;else{let i=0===t?p:0;f<1&&(i=0===t?v(p):le(S,t,e));const o=Math.abs(i)<=n,l=Math.abs(r-e)<=s;a.done=o&&l}return a.value=a.done?r:e,a},toString:()=>{const t=Math.min(ae(E),re),e=T(e=>E.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return E}function Me({keyframes:t,velocity:e=0,power:i=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:c}){const u=t[0],d={done:!1,value:u},m=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let p=i*e;const f=u+p,y=void 0===r?f:r(f);y!==f&&(p=y-u);const g=t=>-p*Math.exp(-t/n),v=t=>y+g(t),x=t=>{const e=g(t),i=v(t);d.done=Math.abs(e)<=h,d.value=d.done?y:i};let T,P;const w=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(T=t,P=Ce({keyframes:[d.value,m(d.value)],velocity:le(v,t,d.value),damping:s,stiffness:o,restDelta:h,restSpeed:c}))};return w(0),{calculatedDuration:null,next:t=>{let e=!1;return P||void 0!==T||(e=!0,x(t),w(t)),void 0!==T&&t>=T?P.next(t-T):(!e&&x(t),d)}}}function Le(e,n,{clamp:s=!0,ease:o,mixer:r}={}){const a=e.length;if(i(a===n.length,"Both input and output ranges must be the same length","range-length"),1===a)return()=>n[0];if(2===a&&n[0]===n[1])return()=>n[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),n=[...n].reverse());const h=function(e,i,n){const s=[],o=n||P.mix||se,r=e.length-1;for(let n=0;n<r;n++){let r=o(e[n],e[n+1]);if(i){const e=Array.isArray(i)?i[n]||t:i;r=kt(e,r)}s.push(r)}return s}(n,o,r),c=h.length,u=t=>{if(l&&t<e[0])return n[0];let i=0;if(c>1)for(;i<e.length-2&&!(t<e[i+1]);i++);const s=Ct(e[i],e[i+1],t);return h[i](s)};return s?t=>u(x(e[0],e[a-1],t)):u}function Ve(t){const e=[0];return function(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const o=Ct(0,e,s);t.push(n(i,1,o))}}(e,t.length-1),e}function Re({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(n)?n.map(Kt):Kt(n),o={done:!1,value:e[0]},r=function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:Ve(e),t),a=Le(r,e,{ease:Array.isArray(s)?s:(l=e,h=s,l.map(()=>h||Nt).splice(0,l.length-1))});var l,h;return{calculatedDuration:t,next:e=>(o.value=a(e),o.done=e>=t,o)}}Ce.applyToOptions=t=>{const e=function(t,e=100,i){const n=i({...t,keyframes:[0,e]}),s=Math.min(ae(n),re);return{type:"keyframes",ease:t=>n.next(s*t).value/e,duration:y(s)}}(t,100,Ce);return t.ease=e.ease,t.duration=v(e.duration),t.type="keyframes",t};const je={decay:Me,inertia:Me,tween:Re,keyframes:Re,spring:Ce};function Be(t){"string"==typeof t.type&&(t.type=je[t.type])}const Ie=t=>t/100;class Oe extends w{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!==f.now()&&this.tick(f.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;Be(t);const{type:e=Re,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||Re;a!==Re&&"number"!=typeof r[0]&&(this.mixKeyframes=kt(Ie,se(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=ae(l));const{calculatedDuration:h}=l;this.calculatedDuration=h,this.resolvedDuration=h+n,this.totalDuration=this.resolvedDuration*(i+1)-n,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:i,totalDuration:n,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:r,calculatedDuration:a}=this;if(null===this.startTime)return i.next(0);const{delay:l=0,keyframes:h,repeat:c,repeatType:u,repeatDelay:d,type:m,onUpdate:p,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const y=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?y<0:y>n;this.currentTime=Math.max(y,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let v=this.currentTime,T=i;if(c){const t=Math.min(this.currentTime,n)/r;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,c+1);Boolean(e%2)&&("reverse"===u?(i=1-i,d&&(i-=d/r)):"mirror"===u&&(T=o)),v=x(0,1,i)*r}const P=g?{done:!1,value:h[0]}:T.next(v);s&&(P.value=s(P.value));let{done:w}=P;g||null===a||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);const E=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return E&&m!==Me&&(P.value=S(h,this.options,f,this.speed)),p&&p(P.value),E&&this.finish(),P}then(t,e){return this.finished.then(t,e)}get duration(){return y(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+y(t)}get time(){return y(this.currentTime)}set time(t){t=v(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(f.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=y(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=oe,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=e??i),"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(f.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 Fe={anticipate:Ot,backInOut:It,circInOut:Wt};function Ue(t){"string"==typeof t.ease&&t.ease in Fe&&(t.ease=Fe[t.ease])}class We extends E{constructor(t){Ue(t),Be(t),super(t),void 0!==t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:i,onComplete:n,element:s,...o}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const r=new Oe({...o,autoplay:!1}),a=Math.max(10,f.now()-this.startTime),l=x(0,10,a-10);e.setWithVelocity(r.sample(Math.max(0,a-l)).value,r.sample(a).value,l),r.stop()}}const ze=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!c.test(t)&&"0"!==t||t.startsWith("url(")));function $e(t){t.duration=0,t.type="keyframes"}const Ne=new Set(["opacity","clipPath","filter","transform"]),He=A(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class Ke extends w{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:o="loop",keyframes:r,name:a,motionValue:l,element:h,...c}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=f.now();const u={autoplay:t,delay:e,type:i,repeat:n,repeatDelay:s,repeatType:o,name:a,motionValue:l,element:h,...c},d=h?.KeyframeResolver||b;this.keyframeResolver=new d(r,(t,e,i)=>this.onKeyframesResolved(t,e,u,!i),a,l,h),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,i,n,s){this.keyframeResolver=void 0;const{name:r,type:a,velocity:l,delay:h,isHandoff:c,onUpdate:u}=n;this.resolvedAt=f.now(),function(t,e,i,n){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],a=ze(s,e),l=ze(r,e);return o(a===l,`You are trying to animate ${e} from "${s}" to "${r}". "${a?r:s}" is not an animatable value.`,"value-not-animatable"),!(!a||!l)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||D(i))&&n)}(e,r,a,l)||(!P.instantAnimations&&h||u?.(S(e,n,i)),e[0]=e[e.length-1],$e(n),n.repeat=0);const d={startTime:s?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:i,...n,keyframes:e},m=!c&&function(t){const{motionValue:e,name:i,repeatDelay:n,repeatType:s,damping:o,type:r}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:h}=e.owner.getProps();return He()&&i&&Ne.has(i)&&("transform"!==i||!h)&&!l&&!n&&"mirror"!==s&&0!==o&&"inertia"!==r}(d),p=d.motionValue?.owner?.current,y=m?new We({...d,element:p}):new Oe(d);y.finished.then(()=>{this.notifyFinished()}).catch(t),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(),k()),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()}}function Ge(t,e,i,n=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*n;return"function"==typeof i?i(o,r):1===s?o*n:a-o*n}const Ye=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xe(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,o]=function(t){const e=Ye.exec(t);if(!e)return[,];const[,i,n,s]=e;return[`--${i??n}`,s]}(t);if(!s)return;const r=window.getComputedStyle(e).getPropertyValue(s);if(r){const t=r.trim();return C(t)?parseFloat(t):t}return l(o)?Xe(o,e,n+1):o}const qe={type:"spring",stiffness:500,damping:25,restSpeed:10},_e={type:"keyframes",duration:.8},Ze={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Je=(t,{keyframes:e})=>e.length>2?_e:M.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:qe:Ze,Qe=t=>null!==t;function ti(t,e){if(t?.inherit&&e){const{inherit:i,...n}=t;return{...e,...n}}return t}function ei(t,e){const i=t?.[e]??t?.default??t;return i!==t?ti(i,t):i}const ii=(t,e,i,n={},s,o)=>r=>{const a=ei(n,t)||{},l=a.delay||n.delay||0;let{elapsed:h=0}=n;h-=v(l);const c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-h,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:s};(function({when:t,delay:e,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...c}){return!!Object.keys(c).length})(a)||Object.assign(c,Je(t,c)),c.duration&&(c.duration=v(c.duration)),c.repeatDelay&&(c.repeatDelay=v(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let u=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&($e(c),0===c.delay&&(u=!0)),(P.instantAnimations||P.skipAnimations||s?.shouldSkipAnimations)&&(u=!0,$e(c),c.delay=0),c.allowFlatten=!a.type&&!a.ease,u&&!o&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:i="loop"},n){const s=t.filter(Qe),o=e&&"loop"!==i&&e%2==1?0:s.length-1;return o&&void 0!==n?n:s[o]}(c.keyframes,a);if(void 0!==t)return void d.update(()=>{c.onUpdate(t),c.onComplete()})}return a.isSync?new Oe(c):new Ke(c)};function ni(t,e,i){const n=t.getProps();return L(n,e,void 0!==i?i:n.custom,t)}const si=new Set(["width","height","top","left","right","bottom",...V]),oi=t=>Array.isArray(t);function ri(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,R(i))}function ai(t){return oi(t)?t[t.length-1]||0:t}function li(t,e){const i=t.getValue("willChange");if(n=i,Boolean(j(n)&&n.add))return i.add(e);if(!i&&P.WillChange){const i=new P.WillChange("auto");t.addValue("willChange",i),i.add(e)}var n}function hi(t){return t.props[B]}function ci({protectedKeys:t,needsAnimating:e},i){const n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}function ui(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:o,transitionEnd:r,...a}=e;const l=t.getDefaultTransition();o=o?ti(o,l):l;const h=o?.reduceMotion;n&&(o=n);const c=[],u=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const n=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||u&&ci(u,e))continue;const r={delay:i,...ei(o||{},e)},l=n.get();if(void 0!==l&&!n.isAnimating&&!Array.isArray(s)&&s===l&&!r.velocity)continue;let m=!1;if(window.MotionHandoffAnimation){const i=hi(t);if(i){const t=window.MotionHandoffAnimation(i,e,d);null!==t&&(r.startTime=t,m=!0)}}li(t,e);const p=h??t.shouldReduceMotion;n.start(ii(e,n,s,p&&si.has(e)?{type:!1}:r,t,m));const f=n.animation;f&&c.push(f)}if(r){const e=()=>d.update(()=>{r&&function(t,e){const i=ni(t,e);let{transitionEnd:n={},transition:s={},...o}=i||{};o={...o,...n};for(const e in o)ri(t,e,ai(o[e]))}(t,r)});c.length?Promise.all(c).then(e):e()}return c}function di(t,e,i={}){const n=ni(t,e,"exit"===i.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=n||{};i.transitionOverride&&(s=i.transitionOverride);const o=n?()=>Promise.all(ui(t,n,i)):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(n=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=s;return function(t,e,i=0,n=0,s=0,o=1,r){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(di(l,e,{...r,delay:i+("function"==typeof n?0:n)+Ge(t.variantChildren,l,n,s,o)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,n,o,r,a,i)}:()=>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(i.delay)])}function mi(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||I(t))}const pi=new Set(["auto","none","0"]);class fi extends b{constructor(t,e,i,n,s){super(t,e,i,n,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i<t.length;i++){let n=t[i];if("string"==typeof n&&(n=n.trim(),l(n))){const s=Xe(n,e.current);void 0!==s&&(t[i]=s),i===t.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!si.has(i)||2!==t.length)return;const[n,s]=t,o=F(n),r=F(s);if(U(n)!==U(s)&&W[i])this.needsMeasurement=!0;else if(o!==r)if(z(o)&&z(r))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else W[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)(null===t[e]||mi(t[e]))&&i.push(e);i.length&&function(t,e,i){let n,s=0;for(;s<t.length&&!n;){const e=t[s];"string"==typeof e&&!pi.has(e)&&u(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=O(i,n)}(t,i,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=W[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const n=e[e.length-1];void 0!==n&&t.getValue(i,n).jump(n,!1)}measureEndState(){const{element:t,name:e,unresolvedKeyframes:i}=this;if(!t||!t.current)return;const n=t.getValue(e);n&&n.jump(this.measuredOrigin,!1);const s=i.length-1,o=i[s];i[s]=W[e](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([e,i])=>{t.getValue(e).set(i)}),this.resolveNoneKeyframes()}}function yi(t,e,i){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t).filter(t=>null!=t)}const gi={x:!1,y:!1};function vi(){return gi.x||gi.y}function xi(t,e){const i=yi(t),n=new AbortController;return[i,{passive:!0,...e,signal:n.signal},()=>n.abort()]}function Ti(t,e,i={}){const[n,s,o]=xi(t,i);return n.forEach(t=>{let i,n=!1,o=!1;const r=e=>{i&&(i(e),i=void 0),t.removeEventListener("pointerleave",l)},a=t=>{n=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),o&&(o=!1,r(t))},l=t=>{"touch"!==t.pointerType&&(n?o=!0:r(t))};t.addEventListener("pointerenter",n=>{if("touch"===n.pointerType||vi())return;o=!1;const r=e(t,n);"function"==typeof r&&(i=r,t.addEventListener("pointerleave",l,s))},s),t.addEventListener("pointerdown",()=>{n=!0,window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",a,s)},s)}),o}const Pi=(t,e)=>!!e&&(t===e||Pi(t,e.parentElement)),wi=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Si=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Ei=new Set(["INPUT","SELECT","TEXTAREA"]);const Di=new WeakSet;function Ai(t){return e=>{"Enter"===e.key&&t(e)}}function bi(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function ki(t){return wi(t)&&!vi()}const Ci=new WeakSet;function Mi(t,e,i={}){const[n,s,o]=xi(t,i),r=t=>{const n=t.currentTarget;if(!ki(t))return;if(Ci.has(t))return;Di.add(n),i.stopPropagation&&Ci.add(t);const o=e(n,t),r=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),Di.has(n)&&Di.delete(n),ki(t)&&"function"==typeof o&&o(t,{success:e})},a=t=>{r(t,n===window||n===document||i.useGlobalTarget||Pi(n,t.target))},l=t=>{r(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",l,s)};return n.forEach(t=>{var e;(i.useGlobalTarget?window:t).addEventListener("pointerdown",r,s),At(e=t)&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const n=Ai(()=>{if(Di.has(i))return;bi(i,"down");const t=Ai(()=>{bi(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>bi(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)})(t,s)),function(t){return Si.has(t.tagName)||!0===t.isContentEditable}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}function Li(t){return At(t)&&"ownerSVGElement"in t}const Vi=new WeakMap;let Ri;const ji=(t,e,i)=>(n,s)=>s&&s[0]?s[0][t+"Size"]:Li(n)&&"getBBox"in n?n.getBBox()[e]:n[i],Bi=ji("inline","width","offsetWidth"),Ii=ji("block","height","offsetHeight");function Oi({target:t,borderBoxSize:e}){Vi.get(t)?.forEach(i=>{i(t,{get width(){return Bi(t,e)},get height(){return Ii(t,e)}})})}function Fi(t){t.forEach(Oi)}function Ui(t,e){Ri||"undefined"!=typeof ResizeObserver&&(Ri=new ResizeObserver(Fi));const i=yi(t);return i.forEach(t=>{let i=Vi.get(t);i||(i=new Set,Vi.set(t,i)),i.add(e),Ri?.observe(t)}),()=>{i.forEach(t=>{const i=Vi.get(t);i?.delete(e),i?.size||Ri?.unobserve(t)})}}const Wi=new Set;let zi;function $i(t){return Wi.add(t),zi||(zi=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Wi.forEach(e=>e(t))},window.addEventListener("resize",zi)),()=>{Wi.delete(t),Wi.size||"function"!=typeof zi||(window.removeEventListener("resize",zi),zi=void 0)}}function Ni(t,e){return"function"==typeof t?$i(t):Ui(t,e)}class Hi extends ${constructor(){super(...arguments),this.KeyframeResolver=fi}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const i=t.style;return i?i[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;j(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class Ki{constructor(t){this.isMounted=!1,this.node=t}update(){}}function Gi({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}function Yi(t){return void 0===t||1===t}function Xi({scale:t,scaleX:e,scaleY:i}){return!Yi(t)||!Yi(e)||!Yi(i)}function qi(t){return Xi(t)||_i(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function _i(t){return Zi(t.x)||Zi(t.y)}function Zi(t){return t&&"0%"!==t}function Ji(t,e,i){return i+e*(t-i)}function Qi(t,e,i,n,s){return void 0!==s&&(t=Ji(t,s,n)),Ji(t,i,n)+e}function tn(t,e=0,i=1,n,s){t.min=Qi(t.min,e,i,n,s),t.max=Qi(t.max,e,i,n,s)}function en(t,{x:e,y:i}){tn(t.x,e.translate,e.scale,e.originPoint),tn(t.y,i.translate,i.scale,i.originPoint)}const nn=.999999999999,sn=1.0000000000001;function on(t,e){t.min=t.min+e,t.max=t.max+e}function rn(t,e,i,s,o=.5){tn(t,e,i,n(t.min,t.max,o),s)}function an(t,e){rn(t.x,e.x,e.scaleX,e.scale,e.originX),rn(t.y,e.y,e.scaleY,e.scale,e.originY)}function ln(t,e){return Gi(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(t.getBoundingClientRect(),e))}function hn(t,{style:e,vars:i},n,s){const o=t.style;let r;for(r in e)o[r]=e[r];for(r in s?.applyProjectionStyles(o,n),i)o.setProperty(r,i[r])}class cn extends Hi{constructor(){super(...arguments),this.type="html",this.renderInstance=hn}readValueFromInstance(t,e){if(M.has(e))return this.projection?.isProjecting?N(e):H(t,e);{const n=(i=t,window.getComputedStyle(i)),s=(K(e)?n.getPropertyValue(e):n[e])||0;return"string"==typeof s?s.trim():s}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return ln(t,e)}build(t,e,i){G(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return Y(t,e,i)}}const un=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);class dn extends Hi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=q}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(M.has(e)){const t=Q(e);return t&&t.default||0}return e=un.has(e)?e:X(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return _(t,e,i)}build(t,e,i){Z(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){hn(t,e,void 0,n);for(const i in e.attrs)t.setAttribute(un.has(i)?i:X(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=J(t.tagName),super.mount(t)}}const mn=et.length;function pn(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent&&pn(t.parent)||{};return void 0!==t.props.initial&&(e.initial=t.props.initial),e}const e={};for(let i=0;i<mn;i++){const n=et[i],s=t.props[n];(tt(s)||!1===s)&&(e[n]=s)}return e}function fn(t,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==t.length)return!1;for(let n=0;n<i;n++)if(e[n]!==t[n])return!1;return!0}const yn=[...nt].reverse(),gn=nt.length;function vn(t){return e=>Promise.all(e.map(({animation:e,options:i})=>function(t,e,i={}){let n;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>di(t,e,i));n=Promise.all(s)}else if("string"==typeof e)n=di(t,e,i);else{const s="function"==typeof e?ni(t,e,i.custom):e;n=Promise.all(ui(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function xn(t){let e=vn(t),i=wn(),n=!0;const s=e=>(i,n)=>{const s=ni(t,n,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...n}=s;i={...i,...n,...e}}return i};function o(o){const{props:r}=t,a=pn(t.parent)||{},l=[],h=new Set;let c={},u=1/0;for(let e=0;e<gn;e++){const d=yn[e],m=i[d],p=void 0!==r[d]?r[d]:a[d],f=tt(p),y=d===o?m.isActive:null;!1===y&&(u=e);let g=p===a[d]&&p!==r[d]&&f;if(g&&n&&t.manuallyAnimateOnMount&&(g=!1),m.protectedKeys={...c},!m.isActive&&null===y||!p&&!m.prevProp||it(p)||"boolean"==typeof p)continue;if("exit"===d&&m.isActive&&!0!==y){m.prevResolvedValues&&(c={...c,...m.prevResolvedValues});continue}const v=Tn(m.prevProp,p);let x=v||d===o&&m.isActive&&!g&&f||e>u&&f,T=!1;const P=Array.isArray(p)?p:[p];let w=P.reduce(s(d),{});!1===y&&(w={});const{prevResolvedValues:S={}}=m,E={...S,...w},D=e=>{x=!0,h.has(e)&&(T=!0,h.delete(e)),m.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in E){const e=w[t],i=S[t];if(c.hasOwnProperty(t))continue;let n=!1;n=oi(e)&&oi(i)?!fn(e,i):e!==i,n?null!=e?D(t):h.add(t):void 0!==e&&h.has(t)?D(t):m.protectedKeys[t]=!0}m.prevProp=p,m.prevResolvedValues=w,m.isActive&&(c={...c,...w}),n&&t.blockInitialAnimation&&(x=!1);const A=g&&v;x&&(!A||T)&&l.push(...P.map(e=>{const i={type:d};if("string"==typeof e&&n&&!A&&t.manuallyAnimateOnMount&&t.parent){const{parent:n}=t,s=ni(n,e);if(n.enteringChildren&&s){const{delayChildren:e}=s.transition||{};i.delay=Ge(n.enteringChildren,t,e)}}return{animation:e,options:i}}))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=ni(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const n=t.getBaseTarget(i),s=t.getValue(i);s&&(s.liveStyle=!0),e[i]=n??null}),l.push({animation:e})}let d=Boolean(l.length);return!n||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),n=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,n){if(i[e].isActive===n)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,n)),i[e].isActive=n;const s=o(e);for(const t in i)i[t].protectedKeys={};return s},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=wn()}}}function Tn(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!fn(e,t)}function Pn(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wn(){return{animate:Pn(!0),whileInView:Pn(),whileHover:Pn(),whileTap:Pn(),whileDrag:Pn(),whileFocus:Pn(),exit:Pn()}}function Sn(t,e){t.min=e.min,t.max=e.max}function En(t,e){Sn(t.x,e.x),Sn(t.y,e.y)}function Dn(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function An(t){return t.max-t.min}function bn(t,e,i,s=.5){t.origin=s,t.originPoint=n(e.min,e.max,t.origin),t.scale=An(i)/An(e),t.translate=n(i.min,i.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function kn(t,e,i,n){bn(t.x,e.x,i.x,n?n.originX:void 0),bn(t.y,e.y,i.y,n?n.originY:void 0)}function Cn(t,e,i){t.min=i.min+e.min,t.max=t.min+An(e)}function Mn(t,e,i){t.min=e.min-i.min,t.max=t.min+An(e)}function Ln(t,e,i){Mn(t.x,e.x,i.x),Mn(t.y,e.y,i.y)}function Vn(t,e,i,n,s){return t=Ji(t-=e,1/i,n),void 0!==s&&(t=Ji(t,1/s,n)),t}function Rn(t,e,[i,s,o],r,a){!function(t,e=0,i=1,s=.5,o,r=t,a=t){st.test(e)&&(e=parseFloat(e),e=n(a.min,a.max,e/100)-a.min);if("number"!=typeof e)return;let l=n(r.min,r.max,s);t===r&&(l-=e),t.min=Vn(t.min,e,i,l,o),t.max=Vn(t.max,e,i,l,o)}(t,e[i],e[s],e[o],e.scale,r,a)}const jn=["x","scaleX","originX"],Bn=["y","scaleY","originY"];function In(t,e,i,n){Rn(t.x,e,jn,i?i.x:void 0,n?n.x:void 0),Rn(t.y,e,Bn,i?i.y:void 0,n?n.y:void 0)}function On(t){return 0===t.translate&&1===t.scale}function Fn(t){return On(t.x)&&On(t.y)}function Un(t,e){return t.min===e.min&&t.max===e.max}function Wn(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function zn(t,e){return Wn(t.x,e.x)&&Wn(t.y,e.y)}function $n(t){return An(t.x)/An(t.y)}function Nn(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function Hn(t){return[t("x"),t("y")]}const Kn=["TopLeft","TopRight","BottomLeft","BottomRight"],Gn=Kn.length,Yn=t=>"string"==typeof t?parseFloat(t):t,Xn=t=>"number"==typeof t||ot.test(t);function qn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const _n=Jn(0,.5,Ut),Zn=Jn(.5,.95,t);function Jn(t,e,i){return n=>n<t?0:n>e?1:i(Ct(t,e,n))}function Qn(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}const ts=(t,e)=>t.depth-e.depth;class es{constructor(){this.children=[],this.isDirty=!1}add(t){rt(this.children,t),this.isDirty=!0}remove(t){at(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ts),this.isDirty=!1,this.children.forEach(t)}}class is{constructor(){this.members=[]}add(t){rt(this.members,t);for(let e=this.members.length-1;e>=0;e--){const i=this.members[e];if(i===t||i===this.lead||i===this.prevLead)continue;const n=i.instance;n&&!1===n.isConnected&&!1!==i.isPresent&&!i.snapshot&&at(this.members,i)}t.scheduleRender()}remove(t){if(at(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t],n=e.instance;if(!1!==e.isPresent&&(!n||!1!==n.isConnected)){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender();const n=i.options.layoutDependency,s=t.options.layoutDependency;if(!(void 0!==n&&void 0!==s&&n===s)){const n=i.instance;n&&!1===n.isConnected&&!i.snapshot||(t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0))}const{crossfade:o}=t.options;!1===o&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const ns={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ss=["","X","Y","Z"];let os=0;function rs(t,e,i,n){const{latestValues:s}=e;s[t]&&(i[t]=s[t],e.setStaticValue(t,0),n&&(n[t]=0))}function as(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const i=hi(e);if(window.MotionHasOptimisedAnimation(i,"transform")){const{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(i,"transform",d,!(e||n))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&as(n)}function ls({attachResizeListener:t,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(t={},i=e?.()){this.id=os++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(us),this.nodes.forEach(vs),this.nodes.forEach(xs),this.nodes.forEach(ds)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new es)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new lt),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e){if(this.instance)return;var i;this.isSVG=Li(e)&&!(Li(i=e)&&"svg"===i.tagName),this.instance=e;const{layoutId:n,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(s||n)&&(this.isLayoutDirty=!0),t){let i,n=0;const s=()=>this.root.updateBlockedByResize=!1;d.read(()=>{n=window.innerWidth}),t(e,()=>{const t=window.innerWidth;t!==n&&(n=t,this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=f.now(),n=({timestamp:s})=>{const o=s-i;o>=e&&(m(n),t(o-e))};return d.setup(n,!0),()=>m(n)}(s,250),ns.hasAnimatedSinceResize&&(ns.hasAnimatedSinceResize=!1,this.nodes.forEach(gs)))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&o&&(n||s)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:i,layout:n})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const s=this.options.transition||o.getDefaultTransition()||Ds,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!zn(this.targetLayout,n),h=!e&&i;if(this.options.layoutRoot||this.resumeFrom||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const e={...ei(s,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e),this.setAnimationOrigin(t,h)}else e||gs(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const t=this.getStack();t&&t.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),m(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Ts),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&as(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(ps);if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(fs);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(ys),this.nodes.forEach(hs),this.nodes.forEach(cs)):this.nodes.forEach(fs),this.clearAllSnapshots();const t=f.now();p.delta=x(0,1e3/60,t-p.timestamp),p.timestamp=t,p.isProcessing=!0,ht.update.process(p),ht.preRender.process(p),ht.render.process(p),p.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ct.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ms),this.sharedNodes.forEach(Ps)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,d.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){d.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||An(this.snapshot.measuredBox.x)||An(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=q(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e&&e.notify("LayoutMeasure",this.layout.layoutBox,t?t.layoutBox:void 0)}updateScroll(t="measure"){let e=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&this.instance){const e=s(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!o)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Fn(this.projectionDelta),i=this.getTransformTemplate(),n=i?i(this.latestValues,""):void 0,s=n!==this.prevTransformTemplateValue;t&&this.instance&&(e||qi(this.latestValues)||s)&&(o(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let i=this.removeElementScroll(e);var n;return t&&(i=this.removeTransform(i)),ks((n=i).x),ks(n.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return q();const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Ms))){const{scroll:t}=this.root;t&&(on(e.x,t.offset.x),on(e.y,t.offset.y))}return e}removeElementScroll(t){const e=q();if(En(e,t),this.scroll?.wasRoot)return e;for(let i=0;i<this.path.length;i++){const n=this.path[i],{scroll:s,options:o}=n;n!==this.root&&s&&o.layoutScroll&&(s.wasRoot&&En(e,t),on(e.x,s.offset.x),on(e.y,s.offset.y))}return e}applyTransform(t,e=!1){const i=q();En(i,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];!e&&n.options.layoutScroll&&n.scroll&&n!==n.root&&an(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),qi(n.latestValues)&&an(i,n.latestValues)}return qi(this.latestValues)&&an(i,this.latestValues),i}removeTransform(t){const e=q();En(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!qi(i.latestValues))continue;Xi(i.latestValues)&&i.updateSnapshot();const n=q();En(n,i.measurePageBox()),In(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,n)}return qi(this.latestValues)&&In(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==p.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==e;if(!(t||i&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:s}=this.options;if(!this.layout||!n&&!s)return;this.resolvedRelativeTargetAt=p.timestamp;const o=this.getClosestProjectingParent();var r,a,l;(o&&this.linkedParentVersion!==o.layoutVersion&&!o.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target=q(),this.targetWithTransforms=q()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,Cn(r.x,a.x,l.x),Cn(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):En(this.target,this.layout.layoutBox),en(this.target,this.targetDelta)):En(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,o&&Boolean(o.resumingFrom)===Boolean(this.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!Xi(this.parent.latestValues)&&!_i(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,i){this.relativeParent=t,this.linkedParentVersion=t.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=q(),this.relativeTargetOrigin=q(),Ln(this.relativeTargetOrigin,e,i),En(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(i=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===p.timestamp&&(i=!1),i)return;const{layout:n,layoutId:s}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.