import{n as t,p as e,q as n,t as i,u as s,v as r,w as o,x as a,y as u,z as l,A as h,B as c,C as d,D as p,E as m,F as f,G as y,H as v,r as g,b as w,o as T,I as b,a as S,J as A,j as V,K as M,l as x,i as C,h as k,m as P,L as E,d as F,s as D,M as O,k as I,e as R,f as K,g as B}from"./size-rollup-dom-animation-assets.js";import{Fragment as N}from"react";const L={},j=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);const U=t=>/^0[^.\s]+$/u.test(t);function q(t){let e;return()=>(void 0===e&&(e=t()),e)}const W=t=>t,Y=(t,e)=>n=>e(t(n)),z=(...t)=>t.reduce(Y),H=(t,e,n)=>{const i=e-t;return 0===i?1:(n-t)/i};class X{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>function(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s1e3*t,_=t=>t/1e3;function G(t,e){return e?t*(1e3/e):0}const Z=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function J(t,e,n,i){if(t===e&&n===i)return W;const s=e=>function(t,e,n,i,s){let r,o,a=0;do{o=e+(n-e)/2,r=Z(o,i,s)-t,r>0?n=o:e=o}while(Math.abs(r)>1e-7&&++a<12);return o}(e,0,1,t,n);return t=>0===t||1===t?t:Z(s(t),e,i)}const Q=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,tt=t=>e=>1-t(1-e),et=J(.33,1.53,.69,.99),nt=tt(et),it=Q(nt),st=t=>(t*=2)<1?.5*nt(t):.5*(2-Math.pow(2,-10*(t-1))),rt=t=>1-Math.sin(Math.acos(t)),ot=tt(rt),at=Q(rt),ut=J(.42,0,1,1),lt=J(0,0,.58,1),ht=J(.42,0,.58,1),ct=t=>Array.isArray(t)&&"number"==typeof t[0],dt={linear:W,easeIn:ut,easeInOut:ht,easeOut:lt,circIn:rt,circInOut:at,circOut:ot,backIn:nt,backInOut:it,backOut:et,anticipate:st},pt=t=>{if(ct(t)){t.length;const[e,n,i,s]=t;return J(e,n,i,s)}return"string"==typeof t?dt[t]:t},mt=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],ft={value:null,addProjectionMetrics:null};function yt(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},r=()=>n=!0,o=mt.reduce((t,n)=>(t[n]=function(t,e){let n=new Set,i=new Set,s=!1,r=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1},u=0;function l(e){o.has(e)&&(h.schedule(e),t()),u++,e(a)}const h={schedule:(t,e=!1,r=!1)=>{const a=r&&s?n:i;return e&&o.add(t),a.has(t)||a.add(t),t},cancel:t=>{i.delete(t),o.delete(t)},process:t=>{a=t,s?r=!0:(s=!0,[n,i]=[i,n],n.forEach(l),e&&ft.value&&ft.value.frameloop[e].push(u),u=0,n.clear(),s=!1,r&&(r=!1,h.process(t)))}};return h}(r,e?n:void 0),t),{}),{setup:a,read:u,resolveKeyframes:l,preUpdate:h,update:c,preRender:d,render:p,postRender:m}=o,f=()=>{const r=L.useManualTiming?s.timestamp:performance.now();n=!1,L.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(r-s.timestamp,40),1)),s.timestamp=r,s.isProcessing=!0,a.process(s),u.process(s),l.process(s),h.process(s),c.process(s),d.process(s),p.process(s),m.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(f))};return{schedule:mt.reduce((e,r)=>{const a=o[r];return e[r]=(e,r=!1,o=!1)=>(n||(n=!0,i=!0,s.isProcessing||t(f)),a.schedule(e,r,o)),e},{}),cancel:t=>{for(let e=0;e(void 0===bt&&At.set(wt.isProcessing||L.useManualTiming?wt.timestamp:performance.now()),bt),set:t=>{bt=t,queueMicrotask(St)}};function Vt(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 Mt(t,e){return n=>n>0?e:t}const xt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},Ct=[i,e,n];function kt(t){const e=(i=t,Ct.find(t=>t.test(i)));var i;if(!Boolean(e))return!1;let s=e.parse(t);return e===n&&(s=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,r=0,o=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Vt(a,i,t+1/3),r=Vt(a,i,t),o=Vt(a,i,t-1/3)}else s=r=o=n;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*o),alpha:i}}(s)),s}const Pt=(n,i)=>{const s=kt(n),r=kt(i);if(!s||!r)return Mt(n,i);const o={...s};return n=>(o.red=xt(s.red,r.red,n),o.green=xt(s.green,r.green,n),o.blue=xt(s.blue,r.blue,n),o.alpha=t(s.alpha,r.alpha,n),e.transform(o))},Et=new Set(["none","hidden"]);function Ft(e,n){return i=>t(e,n,i)}function Dt(t){return"number"==typeof t?Ft:"string"==typeof t?s(t)?Mt:r.test(t)?Pt:Rt:Array.isArray(t)?Ot:"object"==typeof t?r.test(t)?Pt:It:Mt}function Ot(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>Dt(t)(t,e[n]));return t=>{for(let e=0;e{for(const e in i)n[e]=i[e](t);return n}}const Rt=(t,e)=>{const n=o.createTransformer(e),i=a(t),s=a(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?Et.has(t)&&!s.values.length||Et.has(e)&&!i.values.length?function(t,e){return Et.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):z(Ot(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>vt.update(e,t),stop:()=>gt(e),now:()=>wt.isProcessing?wt.timestamp:At.now()}},Nt=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e=Lt?1/0:e}function Ut(t,e,n){const i=Math.max(e-5,0);return G(n-t(i),e-i)}const qt=100,Wt=10,Yt=1,zt=0,Ht=800,Xt=.3,$t=.3,_t={granular:.01,default:2},Gt={granular:.005,default:.5},Zt=.01,Jt=10,Qt=.05,te=1,ee=.001;function ne({duration:t=Ht,bounce:e=Xt,velocity:n=zt,mass:i=Yt}){let s,r,o=1-e;o=u(Qt,te,o),t=u(Zt,Jt,_(t)),o<1?(s=e=>{const i=e*o,s=i*t,r=i-n,a=se(e,o),u=Math.exp(-s);return ee-r/a*u},r=e=>{const i=e*o*t,r=i*n+n,a=Math.pow(o,2)*Math.pow(e,2)*t,u=Math.exp(-i),l=se(Math.pow(e,2),o);return(-s(e)+ee>0?-1:1)*((r-a)*u)/l}):(s=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let i=n;for(let n=1;nvoid 0!==t[e])}function ue(t=$t,e=Xt){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const r=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:r},{stiffness:l,damping:h,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:zt,stiffness:qt,damping:Wt,mass:Yt,isResolvedFromDuration:!1,...t};if(!ae(t,oe)&&ae(t,re))if(t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(1.2*n),s=i*i,r=2*u(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Yt,stiffness:s,damping:r}}else{const n=ne(t);e={...e,...n,mass:Yt},e.isResolvedFromDuration=!0}return e}({...n,velocity:-_(n.velocity||0)}),f=p||0,y=h/(2*Math.sqrt(l*c)),v=o-r,g=_(Math.sqrt(l/c)),w=Math.abs(v)<5;let T;if(i||(i=w?_t.granular:_t.default),s||(s=w?Gt.granular:Gt.default),y<1){const t=se(g,y);T=e=>{const n=Math.exp(-y*g*e);return o-n*((f+y*g*v)/t*Math.sin(t*e)+v*Math.cos(t*e))}}else if(1===y)T=t=>o-Math.exp(-g*t)*(v+(f+g*v)*t);else{const t=g*Math.sqrt(y*y-1);T=e=>{const n=Math.exp(-y*g*e),i=Math.min(t*e,300);return o-n*((f+y*g*v)*Math.sinh(i)+t*v*Math.cosh(i))/t}}const b={calculatedDuration:m&&d||null,next:t=>{const e=T(t);if(m)a.done=t>=d;else{let n=0===t?f:0;y<1&&(n=0===t?$(f):Ut(T,t,e));const r=Math.abs(n)<=i,u=Math.abs(o-e)<=s;a.done=r&&u}return a.value=a.done?o:e,a},toString:()=>{const t=Math.min(jt(b),Lt),e=Nt(e=>b.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return b}function le({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:h}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?u:void 0===u||Math.abs(a-t)-m*Math.exp(-t/i),g=t=>y+v(t),w=t=>{const e=v(t),n=g(t);d.done=Math.abs(e)<=l,d.value=d.done?y:n};let T,b;const S=t=>{var e;(e=d.value,void 0!==a&&eu)&&(T=t,b=ue({keyframes:[d.value,p(d.value)],velocity:Ut(g,t,d.value),damping:s,stiffness:r,restDelta:l,restSpeed:h}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return b||void 0!==T||(e=!0,w(t),S(t)),void 0!==T&&t>=T?b.next(t-T):(!e&&w(t),d)}}}function he(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const r=t.length;if(e.length,1===r)return()=>e[0];if(2===r&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=function(t,e,n){const i=[],s=n||L.mix||Kt,r=t.length-1;for(let n=0;n{if(o&&n1)for(;ih(u(t[0],t[r-1],e)):h}function ce(e){const n=[0];return function(e,n){const i=e[e.length-1];for(let s=1;s<=n;s++){const r=H(0,n,s);e.push(t(i,1,r))}}(n,e.length-1),n}function de({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=(t=>Array.isArray(t)&&"number"!=typeof t[0])(i)?i.map(pt):pt(i),r={done:!1,value:e[0]},o=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:ce(e),t),a=he(o,e,{ease:Array.isArray(s)?s:(u=e,l=s,u.map(()=>l||ht).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}ue.applyToOptions=t=>{const e=function(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(jt(i),Lt);return{type:"keyframes",ease:t=>i.next(s*t).value/e,duration:_(s)}}(t,100,ue);return t.ease=e.ease,t.duration=$(e.duration),t.type="keyframes",t};const pe=t=>null!==t;function me(t,{repeat:e,repeatType:n="loop"},i,s=1){const r=t.filter(pe),o=s<0||e&&"loop"!==n&&e%2==1?0:r.length-1;return o&&void 0!==i?i:r[o]}const fe={decay:le,inertia:le,tween:de,keyframes:de,spring:ue};function ye(t){"string"==typeof t.type&&(t.type=fe[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 ge=t=>t/100;class we extends ve{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!==At.now()&&this.tick(At.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=de,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:r=0}=t;let{keyframes:o}=t;const a=e||de;a!==de&&"number"!=typeof o[0]&&(this.mixKeyframes=z(ge,Kt(o[0],o[1])),o=[0,100]);const u=a({...t,keyframes:o});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...o].reverse(),velocity:-r})),null===u.calculatedDuration&&(u.calculatedDuration=jt(u));const{calculatedDuration:l}=u;this.calculatedDuration=l,this.resolvedDuration=l+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=u}updateTime(t){const e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){const{generator:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:o,calculatedDuration:a}=this;if(null===this.startTime)return n.next(0);const{delay:l=0,keyframes:h,repeat:c,repeatType:d,repeatDelay:p,type:m,onUpdate:f,finalKeyframe:y}=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)),e?this.currentTime=t:this.updateTime(t);const v=this.currentTime-l*(this.playbackSpeed>=0?1:-1),g=this.playbackSpeed>=0?v<0:v>i;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);let w=this.currentTime,T=n;if(c){const t=Math.min(this.currentTime,i)/o;let e=Math.floor(t),n=t%1;!n&&t>=1&&(n=1),1===n&&e--,e=Math.min(e,c+1);Boolean(e%2)&&("reverse"===d?(n=1-n,p&&(n-=p/o)):"mirror"===d&&(T=r)),w=u(0,1,n)*o}const b=g?{done:!1,value:h[0]}:T.next(w);s&&(b.value=s(b.value));let{done:S}=b;g||null===a||(S=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const A=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return A&&m!==le&&(b.value=me(h,this.options,y,this.speed)),f&&f(b.value),A&&this.finish(),b}then(t,e){return this.finished.then(t,e)}get duration(){return _(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_(t)}get time(){return _(this.currentTime)}set time(t){t=$(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(At.now());const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=_(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=Bt,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(At.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 Te=t=>180*t/Math.PI,be=t=>{const e=Te(Math.atan2(t[1],t[0]));return Ae(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:be,rotateZ:be,skewX:t=>Te(Math.atan(t[1])),skewY:t=>Te(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ae=t=>((t%=360)<0&&(t+=360),t),Ve=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Me=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),xe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ve,scaleY:Me,scale:t=>(Ve(t)+Me(t))/2,rotateX:t=>Ae(Te(Math.atan2(t[6],t[5]))),rotateY:t=>Ae(Te(Math.atan2(-t[2],t[0]))),rotateZ:be,rotate:be,skewX:t=>Te(Math.atan(t[4])),skewY:t=>Te(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 ke(t,e){if(!t||"none"===t)return Ce(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=xe,s=n;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=Se,s=e}if(!s)return Ce(e);const r=i[e],o=s[1].split(",").map(Pe);return"function"==typeof r?r(o):o[r]}function Pe(t){return parseFloat(t.trim())}const Ee=t=>t===l||t===h,Fe=new Set(["x","y","z"]),De=c.filter(t=>!Fe.has(t));const Oe={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>ke(e,"x"),y:(t,{transform:e})=>ke(e,"y")};Oe.translateX=Oe.x,Oe.translateY=Oe.y;const Ie=new Set;let Re=!1,Ke=!1,Be=!1;function Ne(){if(Ke){const t=Array.from(Ie).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 De.forEach(n=>{const i=t.getValue(n);void 0!==i&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}(t);e.length&&(n.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=n.get(t);e&&e.forEach(([e,n])=>{t.getValue(e)?.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Ke=!1,Re=!1,Ie.forEach(t=>t.complete(Be)),Ie.clear()}function Le(){Ie.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Ke=!0)})}class je{constructor(t,e,n,i,s,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(Ie.add(this),Re||(Re=!0,vt.read(Le),vt.resolveKeyframes(Ne))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),r=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=n.readValue(e,r);null!=i&&(t[0]=i)}void 0===t[0]&&(t[0]=r),i&&void 0===s&&i.set(t[0])}!function(t){for(let e=1;evoid 0!==window.ScrollTimeline),qe={};function We(t,e){const n=q(t);return()=>qe[e]??n()}const Ye=We(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),ze=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,He={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:ze([0,.65,.55,1]),circOut:ze([.55,0,1,.45]),backIn:ze([.31,.01,.66,-.59]),backOut:ze([.33,1.53,.69,.99])};function Xe(t,e){return t?"function"==typeof t?Ye()?Nt(t,e):"ease-out":ct(t)?ze(t):Array.isArray(t)?t.map(t=>Xe(t,e)||He.easeOut):He[t]:void 0}function $e(t,e,n,{delay:i=0,duration:s=300,repeat:r=0,repeatType:o="loop",ease:a="easeOut",times:u}={},l=void 0){const h={[e]:n};u&&(h.offset=u);const c=Xe(a,s);Array.isArray(c)&&(h.easing=c);const d={delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:r+1,direction:"reverse"===o?"alternate":"normal"};l&&(d.pseudoElement=l);return t.animate(h,d)}function _e(t){return"function"==typeof t&&"applyToOptions"in t}class Ge extends ve{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:s,allowFlatten:r=!1,finalKeyframe:o,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=r,this.options=t,t.type;const u=function({type:t,...e}){return _e(t)&&Ye()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=$e(e,n,i,u,s),!1===u.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const t=me(i,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(t):function(t,e,n){(t=>t.startsWith("--"))(e)?t.style.setProperty(e,n):t.style[e]=n}(e,n,t),this.animation.cancel()}a?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return _(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+_(t)}get time(){return _(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=$(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&Ue()?(this.animation.timeline=t,W):e(this)}}const Ze={anticipate:st,backInOut:it,circInOut:at};function Je(t){"string"==typeof t.ease&&t.ease in Ze&&(t.ease=Ze[t.ease])}class Qe extends Ge{constructor(t){Je(t),ye(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:e,onUpdate:n,onComplete:i,element:s,...r}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const o=new we({...r,autoplay:!1}),a=$(this.finishedTime??this.time);e.setWithVelocity(o.sample(a-10).value,o.sample(a).value,10),o.stop()}}const tn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!o.test(t)&&"0"!==t||t.startsWith("url(")));function en(t){t.duration=0,t.type="keyframes"}const nn=new Set(["opacity","clipPath","filter","transform"]),sn=q(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class rn extends ve{constructor({autoplay:t=!0,delay:e=0,type:n="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:r="loop",keyframes:o,name:a,motionValue:u,element:l,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=At.now();const c={autoplay:t,delay:e,type:n,repeat:i,repeatDelay:s,repeatType:r,name:a,motionValue:u,element:l,...h},d=l?.KeyframeResolver||je;this.keyframeResolver=new d(o,(t,e,n)=>this.onKeyframesResolved(t,e,c,!n),a,u,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:s,type:r,velocity:o,delay:a,isHandoff:u,onUpdate:l}=n;this.resolvedAt=At.now(),function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const r=t[t.length-1],o=tn(s,e),a=tn(r,e);return!(!o||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...n,keyframes:t},c=!u&&function(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:r,type:o}=t,a=e?.owner?.current;if(!(a instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:l}=e.owner.getProps();return sn()&&n&&nn.has(n)&&("transform"!==n||!l)&&!u&&!i&&"mirror"!==s&&0!==r&&"inertia"!==o}(h)?new Qe({...h,element:h.motionValue.owner.current}):new we(h);c.finished.then(()=>this.notifyFinished()).catch(W),this.pendingTimeline&&(this.stopTimeline=c.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=c}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(),Be=!0,Le(),Ne(),Be=!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()}}const on=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function an(t,e,n=1){const[i,r]=function(t){const e=on.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return j(t)?parseFloat(t):t}return s(r)?an(r,e,n+1):r}function un(t,e){return t?.[e]??t?.default??t}const ln=new Set(["width","height","top","left","right","bottom",...c]),hn=t=>e=>e.test(t),cn=[l,h,d,p,m,f,{test:t=>"auto"===t,parse:t=>t}],dn=t=>cn.find(hn(t));function pn(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||U(t))}const mn=new Set(["brightness","contrast","saturate","opacity"]);function fn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(y)||[];if(!i)return t;const s=n.replace(i,"");let r=mn.has(e)?1:0;return i!==n&&(r*=100),e+"("+r+s+")"}const yn=/\b([a-z-]*)\(.*?\)/gu,vn={...o,getAnimatableNone:t=>{const e=t.match(yn);return e?e.map(fn).join(" "):t}},gn={...v,color:r,backgroundColor:r,outlineColor:r,fill:r,stroke:r,borderColor:r,borderTopColor:r,borderRightColor:r,borderBottomColor:r,borderLeftColor:r,filter:vn,WebkitFilter:vn},wn=t=>gn[t];function Tn(t,e){let n=wn(t);return n!==vn&&(n=o),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const bn=new Set(["auto","none","0"]);class Sn extends je{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e||!e.current)return;super.readKeyframes();for(let n=0;n{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}class An{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=At.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=At.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 X);const n=this.events[t].add(e);return"change"===t?()=>{n(),vt.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=At.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return G(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 Vn(t,e){return new An(t,e)}const{schedule:Mn,cancel:xn}=yt(queueMicrotask,!1),Cn=!1;function kn(){return Cn}function Pn(t,e){const n=function(t){if(t instanceof EventTarget)return[t];if("string"==typeof t){const e=document.querySelectorAll(t);return e?Array.from(e):[]}return Array.from(t)}(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},()=>i.abort()]}function En(t){return!("touch"===t.pointerType||kn())}const Fn=(t,e)=>!!e&&(t===e||Fn(t,e.parentElement)),Dn=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const On=new WeakSet;function In(t){return e=>{"Enter"===e.key&&t(e)}}function Rn(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function Kn(t){return(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(t)&&!kn()}function Bn(t,e,n={}){const[i,s,r]=Pn(t,n),o=t=>{const i=t.currentTarget;if(!Kn(t))return;On.add(i);const r=e(i,t),o=(t,e)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",u),On.has(i)&&On.delete(i),Kn(t)&&"function"==typeof r&&r(t,{success:e})},a=t=>{o(t,i===window||i===document||n.useGlobalTarget||Fn(i,t.target))},u=t=>{o(t,!1)};window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",u,s)};return i.forEach(t=>{var e,i;(n.useGlobalTarget?window:t).addEventListener("pointerdown",o,s),"object"==typeof(i=e=t)&&null!==i&&"offsetHeight"in e&&(t.addEventListener("focus",t=>((t,e)=>{const n=t.currentTarget;if(!n)return;const i=In(()=>{if(On.has(n))return;Rn(n,"down");const t=In(()=>{Rn(n,"up")});n.addEventListener("keyup",t,e),n.addEventListener("blur",()=>Rn(n,"cancel"),e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)})(t,s)),function(t){return Dn.has(t.tagName)||-1!==t.tabIndex}(t)||t.hasAttribute("tabindex")||(t.tabIndex=0))}),r}const Nn=[...cn,r,o];function Ln(t,e,n){const i=t.getProps();return g(i,e,void 0!==n?n:i.custom,t)}const jn=t=>Array.isArray(t);function Un(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Vn(n))}function qn(t){return jn(t)?t[t.length-1]||0:t}function Wn(t,e){const n=t.getValue("willChange");if(i=n,Boolean(w(i)&&i.add))return n.add(e);if(!n&&L.WillChange){const n=new L.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function Yn(t){return t.props[T]}const zn=t=>null!==t;const Hn={type:"spring",stiffness:500,damping:25,restSpeed:10},Xn={type:"keyframes",duration:.8},$n={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},_n=(t,{keyframes:e})=>e.length>2?Xn:b.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:Hn:$n;const Gn=(t,e,n,i={},s,r)=>o=>{const a=un(i,t)||{},u=a.delay||i.delay||0;let{elapsed:l=0}=i;l-=$(u);const h={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-l,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:r?void 0:s};(function({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:r,repeatType:o,repeatDelay:a,from:u,elapsed:l,...h}){return!!Object.keys(h).length})(a)||Object.assign(h,_n(t,h)),h.duration&&(h.duration=$(h.duration)),h.repeatDelay&&(h.repeatDelay=$(h.repeatDelay)),void 0!==h.from&&(h.keyframes[0]=h.from);let c=!1;if((!1===h.type||0===h.duration&&!h.repeatDelay)&&(en(h),0===h.delay&&(c=!0)),(L.instantAnimations||L.skipAnimations)&&(c=!0,en(h),h.delay=0),h.allowFlatten=!a.type&&!a.ease,c&&!r&&void 0!==e.get()){const t=function(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(zn),r=e&&"loop"!==n&&e%2==1?0:s.length-1;return r&&void 0!==i?i:s[r]}(h.keyframes,a);if(void 0!==t)return void vt.update(()=>{h.onUpdate(t),h.onComplete()})}return a.isSync?new we(h):new rn(h)};function Zn({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,i}function Jn(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:o,...a}=e;i&&(r=i);const u=[],l=s&&t.animationState&&t.animationState.getState()[s];for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||l&&Zn(l,e))continue;const o={delay:n,...un(r||{},e)},h=i.get();if(void 0!==h&&!i.isAnimating&&!Array.isArray(s)&&s===h&&!o.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){const n=Yn(t);if(n){const t=window.MotionHandoffAnimation(n,e,vt);null!==t&&(o.startTime=t,c=!0)}}Wn(t,e),i.start(Gn(e,i,s,t.shouldReduceMotion&&ln.has(e)?{type:!1}:o,t,c));const d=i.animation;d&&u.push(d)}return o&&Promise.all(u).then(()=>{vt.update(()=>{o&&function(t,e){const n=Ln(t,e);let{transitionEnd:i={},transition:s={},...r}=n||{};r={...r,...i};for(const e in r)Un(t,e,qn(r[e]))}(t,o)})}),u}function Qn(t,e,n,i=0,s=1){const r=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),o=t.size,a=(o-1)*i;return"function"==typeof n?n(r,o):1===s?r*i:a-r*i}function ti(t,e,n={}){const i=Ln(t,e,"exit"===n.type?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const r=i?()=>Promise.all(Jn(t,i,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(i=0)=>{const{delayChildren:r=0,staggerChildren:o,staggerDirection:a}=s;return function(t,e,n=0,i=0,s=0,r=1,o){const a=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),a.push(ti(u,e,{...o,delay:n+("function"==typeof i?0:i)+Qn(t.variantChildren,u,i,s,r)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(a)}(t,e,i,r,o,a,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[t,e]="beforeChildren"===a?[r,o]:[o,r];return t().then(()=>e())}return Promise.all([r(),o(n.delay)])}function ei(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;iPromise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let i;if(t.notify("AnimationStart",e),Array.isArray(e)){const s=e.map(e=>ti(t,e,n));i=Promise.all(s)}else if("string"==typeof e)i=ti(t,e,n);else{const s="function"==typeof e?Ln(t,e,n.custom):e;i=Promise.all(Jn(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}(t,e,n)))}function ai(t){let e=oi(t),n=hi(),i=!0;const s=e=>(n,i)=>{const s=Ln(t,i,"exit"===e?t.presenceContext?.custom:void 0);if(s){const{transition:t,transitionEnd:e,...i}=s;n={...n,...i,...e}}return n};function r(r){const{props:o}=t,a=ii(t.parent)||{},u=[],l=new Set;let h={},c=1/0;for(let e=0;ec&&f,T=!1;const b=Array.isArray(m)?m:[m];let A=b.reduce(s(d),{});!1===y&&(A={});const{prevResolvedValues:M={}}=p,x={...M,...A},C=e=>{w=!0,l.has(e)&&(T=!0,l.delete(e)),p.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)};for(const t in x){const e=A[t],n=M[t];if(h.hasOwnProperty(t))continue;let i=!1;i=jn(e)&&jn(n)?!ei(e,n):e!==n,i?null!=e?C(t):l.add(t):void 0!==e&&l.has(t)?C(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=A,p.isActive&&(h={...h,...A}),i&&t.blockInitialAnimation&&(w=!1);const k=v&&g;w&&(!k||T)&&u.push(...b.map(e=>{const n={type:d};if("string"==typeof e&&i&&!k&&t.manuallyAnimateOnMount&&t.parent){const{parent:i}=t,s=Ln(i,e);if(i.enteringChildren&&s){const{delayChildren:e}=s.transition||{};n.delay=Qn(i.enteringChildren,t,e)}}return{animation:e,options:n}}))}if(l.size){const e={};if("boolean"!=typeof o.initial){const n=Ln(t,Array.isArray(o.initial)?o.initial[0]:o.initial);n&&n.transition&&(e.transition=n.transition)}l.forEach(n=>{const i=t.getBaseTarget(n),s=t.getValue(n);s&&(s.liveStyle=!0),e[n]=i??null}),u.push({animation:e})}let d=Boolean(u.length);return!i||!1!==o.initial&&o.initial!==o.animate||t.manuallyAnimateOnMount||(d=!1),i=!1,d?e(u):Promise.resolve()}return{animateChanges:r,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,i)),n[e].isActive=i;const s=r(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:function(n){e=n(t)},getState:()=>n,reset:()=>{n=hi()}}}function ui(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!ei(e,t)}function li(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function hi(){return{animate:li(!0),whileInView:li(),whileHover:li(),whileTap:li(),whileDrag:li(),whileFocus:li(),exit:li()}}class ci{constructor(t){this.isMounted=!1,this.node=t}update(){}}let di=0;const pi={animation:{Feature:class extends ci{constructor(t){super(t),t.animationState||(t.animationState=ai(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();V(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends ci{constructor(){super(...arguments),this.id=di++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const i=this.node.animationState.setActive("exit",!t);e&&!t&&i.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function mi(t){return{point:{x:t.pageX,y:t.pageY}}}function fi(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover","Start"===n);const s=i["onHover"+n];s&&vt.postRender(()=>s(e,mi(e)))}function yi(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function vi(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap","Start"===n);const s=i["onTap"+("End"===n?"":n)];s&&vt.postRender(()=>s(e,mi(e)))}const gi=new WeakMap,wi=new WeakMap,Ti=t=>{const e=gi.get(t.target);e&&e(t)},bi=t=>{t.forEach(Ti)};function Si(t,e,n){const i=function({root:t,...e}){const n=t||document;wi.has(n)||wi.set(n,{});const i=wi.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(bi,{root:t,...e})),i[s]}(e);return gi.set(t,n),i.observe(t),()=>{gi.delete(t),i.unobserve(t)}}const Ai={some:0,all:1};const Vi={inView:{Feature:class extends ci{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:i="some",once:s}=t,r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:Ai[i]};return Si(this.node.current,r,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),r=e?n:i;r&&r(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends ci{mount(){const{current:t}=this.node;t&&(this.unmount=Bn(t,(t,e)=>(vi(this.node,e,"Start"),(t,{success:e})=>vi(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends ci{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=z(yi(this.node.current,"focus",()=>this.onFocus()),yi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends ci{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,n={}){const[i,s,r]=Pn(t,n),o=t=>{if(!En(t))return;const{target:n}=t,i=e(n,t);if("function"!=typeof i||!n)return;const r=t=>{En(t)&&(i(t),n.removeEventListener("pointerleave",r))};n.addEventListener("pointerleave",r,s)};return i.forEach(t=>{t.addEventListener("pointerenter",o,s)}),r}(t,(t,e)=>(fi(this.node,e,"Start"),t=>fi(this.node,t,"End"))))}unmount(){}}}};const Mi=()=>({x:{min:0,max:0},y:{min:0,max:0}}),xi={current:null},Ci={current:!1};const ki=new WeakMap;const Pi=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Ei{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:i,blockInitialAnimation:s,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=je,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},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=At.now();this.renderScheduledAtthis.bindToMotionValue(e,t)),Ci.current||function(){if(Ci.current=!0,x)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>xi.current=t.matches;t.addEventListener("change",e),e()}else xi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||xi.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),gt(this.notifyUpdate),gt(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){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=b.has(t);n&&this.onBindTransform&&this.onBindTransform();const i=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&vt.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{i(),s&&s(),e.owner&&e.stop()})}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 P){const e=P[t];if(!e)continue;const{isEnabled:n,Feature:i}=e;if(!this.features[t]&&i&&n(this.props)&&(this.features[t]=new i(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;ee.variantChildren.delete(t)}addValue(t,e){const n=this.values.get(t);e!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=Vn(null===e?void 0:e,{owner:this}),this.addValue(t,n)),n}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var i;return null!=n&&("string"==typeof n&&(j(n)||U(n))?n=parseFloat(n):(i=n,!Nn.find(hn(i))&&o.test(e)&&(n=Tn(t,e))),this.setBaseTarget(t,w(n)?n.get():n)),w(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){const{initial:e}=this.props;let n;if("string"==typeof e||"object"==typeof e){const i=g(this.props,e,this.presenceContext?.custom);i&&(n=i[t])}if(e&&void 0!==n)return n;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||w(i)?void 0!==this.initialValues[t]&&void 0===n?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new X),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}scheduleRenderMicrotask(){Mn.render(this.render)}}class Fi extends Ei{constructor(){super(...arguments),this.KeyframeResolver=Sn}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;w(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function Di(t,{style:e,vars:n},i,s){const r=t.style;let o;for(o in e)r[o]=e[o];for(o in s?.applyProjectionStyles(r,i),n)r.setProperty(o,n[o])}class Oi extends Fi{constructor(){super(...arguments),this.type="html",this.renderInstance=Di}readValueFromInstance(t,e){if(b.has(e))return this.projection?.isProjecting?Ce(e):((t,e)=>{const{transform:n="none"}=getComputedStyle(t);return ke(n,e)})(t,e);{const i=(n=t,window.getComputedStyle(n)),s=(E(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n){F(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return D(t,e,n)}}const Ii=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 Ri extends Fi{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Mi}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(b.has(e)){const t=wn(e);return t&&t.default||0}return e=Ii.has(e)?e:O(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return I(t,e,n)}build(t,e,n){R(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,i){!function(t,e,n,i){Di(t,e,void 0,i);for(const n in e.attrs)t.setAttribute(Ii.has(n)?n:O(n),e.attrs[n])}(t,e,0,i)}mount(t){this.isSVGTag=K(t.tagName),super.mount(t)}}const Ki={renderer:(t,e)=>B(t)?new Ri(e):new Oi(e,{allowProjection:t!==N}),...pi,...Vi};export{Ki as domAnimation};