2 lines
80 KiB
JavaScript
2 lines
80 KiB
JavaScript
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.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!s)return;En(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,r=this.treeScale.y;!function(t,e,i,n=!1){const s=i.length;if(!s)return;let o,r;e.x=e.y=1;for(let a=0;a<s;a++){o=i[a],r=o.projectionDelta;const{visualElement:s}=o.options;s&&s.props.style&&"contents"===s.props.style.display||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&an(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,en(t,r)),n&&qi(o.latestValues)&&an(t,o.latestValues))}e.x<sn&&e.x>nn&&(e.x=1),e.y<sn&&e.y>nn&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,e),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms=q());const{target:a}=t;a?(this.projectionDelta&&this.prevProjectionDelta?(Dn(this.prevProjectionDelta.x,this.projectionDelta.x),Dn(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),kn(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===r&&Nn(this.projectionDelta.x,this.prevProjectionDelta.x)&&Nn(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){if(this.options.visualElement?.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ut(),this.projectionDelta=ut(),this.projectionDeltaWithTransform=ut()}setAnimationOrigin(t,e=!1){const i=this.snapshot,s=i?i.latestValues:{},o={...this.latestValues},r=ut();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const a=q(),l=(i?i.source:void 0)!==(this.layout?this.layout.source:void 0),h=this.getStack(),c=!h||h.members.length<=1,u=Boolean(l&&!c&&!0===this.options.crossfade&&!this.path.some(Es));let d;this.animationProgress=0,this.mixTargetDelta=e=>{const i=e/1e3;var h,m,p,f,y,g;ws(r.x,t.x,i),ws(r.y,t.y,i),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ln(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),p=this.relativeTarget,f=this.relativeTargetOrigin,y=a,g=i,Ss(p.x,f.x,y.x,g),Ss(p.y,f.y,y.y,g),d&&(h=this.relativeTarget,m=d,Un(h.x,m.x)&&Un(h.y,m.y))&&(this.isProjectionDirty=!1),d||(d=q()),En(d,this.relativeTarget)),l&&(this.animationValues=o,function(t,e,i,s,o,r){o?(t.opacity=n(0,i.opacity??1,_n(s)),t.opacityExit=n(e.opacity??1,0,Zn(s))):r&&(t.opacity=n(e.opacity??1,i.opacity??1,s));for(let o=0;o<Gn;o++){const r=`border${Kn[o]}Radius`;let a=qn(e,r),l=qn(i,r);void 0===a&&void 0===l||(a||(a=0),l||(l=0),0===a||0===l||Xn(a)===Xn(l)?(t[r]=Math.max(n(Yn(a),Yn(l),s),0),(st.test(l)||st.test(a))&&(t[r]+="%")):t[r]=l)}(e.rotate||i.rotate)&&(t.rotate=n(e.rotate||0,i.rotate||0,s))}(o,s,this.latestValues,i,u,c)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(m(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=d.update(()=>{ns.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=R(0)),this.motionValue.jump(0,!1),this.currentAnimation=function(t,e,i){const n=j(t)?t:R(t);return n.start(ii("",n,e,i)),n.animation}(this.motionValue,[0,1e3],{...t,velocity:0,isSync:!0,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:n,latestValues:s}=t;if(e&&i&&n){if(this!==t&&this.layout&&n&&Cs(this.options.animationType,this.layout.layoutBox,n.layoutBox)){i=this.target||q();const e=An(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const n=An(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+n}En(e,i),an(e,s),kn(this.projectionDeltaWithTransform,this.layoutCorrected,e,s)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new is);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:i}={}){const n=this.getStack();n&&n.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const n={};i.z&&rs("z",t,n,this.animationValues);for(let e=0;e<ss.length;e++)rs(`rotate${ss[e]}`,t,n,this.animationValues),rs(`skew${ss[e]}`,t,n,this.animationValues);t.render();for(const e in n)t.setStaticValue(e,n[e]),this.animationValues&&(this.animationValues[e]=n[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;if(!this.isVisible)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=dt(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");const n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target)return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=dt(e?.pointerEvents)||""),void(this.hasProjected&&!qi(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(t,e,i){let n="";const s=t.x.translate/e.x,o=t.y.translate/e.y,r=i?.z||0;if((s||o||r)&&(n=`translate3d(${s}px, ${o}px, ${r}px) `),1===e.x&&1===e.y||(n+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:s,rotateY:o,skewX:r,skewY:a}=i;t&&(n=`perspective(${t}px) ${n}`),e&&(n+=`rotate(${e}deg) `),s&&(n+=`rotateX(${s}deg) `),o&&(n+=`rotateY(${o}deg) `),r&&(n+=`skewX(${r}deg) `),a&&(n+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return 1===a&&1===l||(n+=`scale(${a}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);i&&(o=i(s,o)),t.transform=o;const{x:r,y:a}=this.projectionDelta;t.transformOrigin=`${100*r.origin}% ${100*a.origin}% 0`,n.animationValues?t.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:t.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const e in mt){if(void 0===s[e])continue;const{correct:i,applyTo:r,isCSSVariable:a}=mt[e],l="none"===o?s[e]:i(s[e],n);if(r){const e=r.length;for(let i=0;i<e;i++)t[r[i]]=l}else a?this.options.visualElement.renderState.vars[e]=l:t[e]=l}this.options.layoutId&&(t.pointerEvents=n===this?dt(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>t.currentAnimation?.stop()),this.root.nodes.forEach(ps),this.root.sharedNodes.clear()}}}function hs(t){t.updateLayout()}function cs(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:n}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source;"size"===s?Hn(t=>{const n=o?e.measuredBox[t]:e.layoutBox[t],s=An(n);n.min=i[t].min,n.max=n.min+s}):Cs(s,e.layoutBox,i)&&Hn(n=>{const s=o?e.measuredBox[n]:e.layoutBox[n],r=An(i[n]);s.max=s.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[n].max=t.relativeTarget[n].min+r)});const r=ut();kn(r,i,e.layoutBox);const a=ut();o?kn(a,t.applyTransform(n,!0),e.measuredBox):kn(a,i,e.layoutBox);const l=!Fn(r);let h=!1;if(!t.resumeFrom){const n=t.getClosestProjectingParent();if(n&&!n.resumeFrom){const{snapshot:s,layout:o}=n;if(s&&o){const r=q();Ln(r,e.layoutBox,s.layoutBox);const a=q();Ln(a,i,o.layoutBox),zn(r,a)||(h=!0),n.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=n)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:e,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function us(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ds(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function ms(t){t.clearSnapshot()}function ps(t){t.clearMeasurements()}function fs(t){t.isLayoutDirty=!1}function ys(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function gs(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function vs(t){t.resolveTargetDelta()}function xs(t){t.calcProjection()}function Ts(t){t.resetSkewAndRotation()}function Ps(t){t.removeLeadSnapshot()}function ws(t,e,i){t.translate=n(e.translate,0,i),t.scale=n(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function Ss(t,e,i,s){t.min=n(e.min,i.min,s),t.max=n(e.max,i.max,s)}function Es(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const Ds={duration:.45,ease:[.4,0,.1,1]},As=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),bs=As("applewebkit/")&&!As("chrome/")?Math.round:t;function ks(t){t.min=bs(t.min),t.max=bs(t.max)}function Cs(t,e,i){return"position"===t||"preserve-aspect"===t&&(n=$n(e),s=$n(i),o=.2,!(Math.abs(n-s)<=o));var n,s,o}function Ms(t){return t!==t.root&&t.scroll?.wasRoot}const Ls=ls({attachResizeListener:(t,e)=>Qn(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Vs={current:void 0},Rs=ls({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Vs.current){const t=new Ls({});t.mount(window),t.setOptions({layoutScroll:!0}),Vs.current=t}return Vs.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function js(t){return{point:{x:t.pageX,y:t.pageY}}}function Bs(t,e,i,n){return Qn(t,e,(t=>e=>wi(e)&&t(e,js(e)))(i),n)}const Is=({current:t})=>t?t.ownerDocument.defaultView:null,Os=(t,e)=>Math.abs(t-e);const Fs=new Set(["auto","scroll"]);class Us{constructor(t,e,{transformPagePoint:i,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=t=>{this.handleScroll(t.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=$s(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=Os(t.x,e.x),n=Os(t.y,e.y);return Math.sqrt(i**2+n**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!i)return;const{point:n}=t,{timestamp:s}=p;this.history.push({...n,timestamp:s});const{onStart:o,onMove:r}=this.handlers;e||(o&&o(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),r&&r(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.lastMoveEvent=t,this.lastMoveEventInfo=Ws(e,this.transformPagePoint),d.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:n,resumeAnimation:s}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||s&&s(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=$s("pointercancel"===t.type?this.lastMoveEventInfo:Ws(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),n&&n(t,o)},!wi(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=i,this.distanceThreshold=o,this.contextWindow=n||window;const a=Ws(js(t),this.transformPagePoint),{point:l}=a,{timestamp:h}=p;this.history=[{...l,timestamp:h}];const{onSessionStart:c}=e;c&&c(t,$s(a,this.history)),this.removeListeners=kt(Bs(this.contextWindow,"pointermove",this.handlePointerMove),Bs(this.contextWindow,"pointerup",this.handlePointerUp),Bs(this.contextWindow,"pointercancel",this.handlePointerUp)),r&&this.startScrollTracking(r)}startScrollTracking(t){let e=t.parentElement;for(;e;){const t=getComputedStyle(e);(Fs.has(t.overflowX)||Fs.has(t.overflowY))&&this.scrollPositions.set(e,{x:e.scrollLeft,y:e.scrollTop}),e=e.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(t){const e=this.scrollPositions.get(t);if(!e)return;const i=t===window,n=i?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop},s=n.x-e.x,o=n.y-e.y;0===s&&0===o||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=s,this.history[0].y-=o),this.scrollPositions.set(t,n),d.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),m(this.updatePoint)}}function Ws(t,e){return e?{point:e(t.point)}:t}function zs(t,e){return{x:t.x-e.x,y:t.y-e.y}}function $s({point:t},e){return{point:t,delta:zs(t,Hs(e)),offset:zs(t,Ns(e)),velocity:Ks(e,.1)}}function Ns(t){return t[0]}function Hs(t){return t[t.length-1]}function Ks(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,n=null;const s=Hs(t);for(;i>=0&&(n=t[i],!(s.timestamp-n.timestamp>v(e)));)i--;if(!n)return{x:0,y:0};n===t[0]&&t.length>2&&s.timestamp-n.timestamp>2*v(e)&&(n=t[1]);const o=y(s.timestamp-n.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-n.x)/o,y:(s.y-n.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function Gs(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function Ys(t,e){let i=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,n]=[n,i]),{min:i,max:n}}const Xs=.35;function qs(t,e,i){return{min:_s(t,e),max:_s(t,i)}}function _s(t,e){return"number"==typeof t?t:t[e]||0}const Zs=new WeakMap;class Js{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=q(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:e=!1,distanceThreshold:i}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new Us(t,{onSessionStart:t=>{e&&this.snapToCursor(js(t).point),this.stopAnimation()},onStart:(t,e)=>{const{drag:i,dragPropagation:n,onDragStart:s}=this.getProps();if(i&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(o=i)||"y"===o?gi[o]?null:(gi[o]=!0,()=>{gi[o]=!1}):gi.x||gi.y?null:(gi.x=gi.y=!0,()=>{gi.x=gi.y=!1}),!this.openDragLock))return;var o;this.latestPointerEvent=t,this.latestPanInfo=e,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Hn(t=>{let e=this.getAxisMotionValue(t).get()||0;if(st.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const n=i.layout.layoutBox[t];if(n){e=An(n)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),s&&d.update(()=>s(t,e),!1,!0),li(this.visualElement,"transform");const{animationState:r}=this.visualElement;r&&r.setActive("whileDrag",!0)},onMove:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e;const{dragPropagation:i,dragDirectionLock:n,onDirectionLock:s,onDrag:o}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:r}=e;if(n&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(r),void(null!==this.currentDirection&&s&&s(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&d.update(()=>o(t,e),!1,!0)},onSessionEnd:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e,this.stop(t,e),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:t}=this.getProps();(t||this.constraints)&&this.startAnimation({x:0,y:0})}},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:i,contextWindow:Is(this.visualElement),element:this.visualElement.current})}stop(t,e){const i=t||this.latestPointerEvent,n=e||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!i)return;const{velocity:o}=n;this.startAnimation(o);const{onDragEnd:r}=this.getProps();r&&d.postRender(()=>r(i,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(t,e,i){const{drag:s}=this.getProps();if(!i||!to(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let r=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(r=function(t,{min:e,max:i},s){return void 0!==e&&t<e?t=s?n(e,t,s.min):Math.max(t,e):void 0!==i&&t>i&&(t=s?n(i,t,s.max):Math.min(t,i)),t}(r,this.constraints[t],this.elastic[t])),o.set(r)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;t&&pt(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i)&&function(t,{top:e,left:i,bottom:n,right:s}){return{x:Gs(t.x,i,s),y:Gs(t.y,e,n)}}(i.layoutBox,t),this.elastic=function(t=Xs){return!1===t?t=0:!0===t&&(t=Xs),{x:qs(t,"left","right"),y:qs(t,"top","bottom")}}(e),n!==this.constraints&&!pt(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&Hn(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(i.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!pt(t))return!1;const n=t.current;i(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=function(t,e,i){const n=ln(t,i),{scroll:s}=e;return s&&(on(n.x,s.offset.x),on(n.y,s.offset.y)),n}(n,s.root,this.visualElement.getTransformPagePoint());let r=function(t,e){return{x:Ys(t.x,e.x),y:Ys(t.y,e.y)}}(s.layout.layoutBox,o);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(r));this.hasMutatedConstraints=!!t,t&&(r=Gi(t))}return r}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:n,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=Hn(r=>{if(!to(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=n?200:1e6,c=n?40:1e7,u={type:"inertia",velocity:i?t[r]:0,bounceStiffness:h,bounceDamping:c,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(r,u)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return li(this.visualElement,t),i.start(ii(t,i,0,e,this.visualElement,!1))}stopAnimation(){Hn(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,i=this.visualElement.getProps(),n=i[e];return n||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){Hn(e=>{const{drag:i}=this.getProps();if(!to(e,i,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(e);if(s&&s.layout){const{min:i,max:r}=s.layout.layoutBox[e],a=o.get()||0;o.set(t[e]-n(i,r,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:i}=this.visualElement;if(!pt(e)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Hn(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const n=An(t),s=An(e);return s>n?i=Ct(e.min,e.max-n,t.min):n>s&&(i=Ct(t.min,t.max-s,e.min)),x(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),Hn(e=>{if(!to(e,t,null))return;const i=this.getAxisMotionValue(e),{min:o,max:r}=this.constraints[e];i.set(n(o,r,s[e]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Zs.set(this.visualElement,this);const t=this.visualElement.current,e=Bs(t,"pointerdown",e=>{const{drag:i,dragListener:n=!0}=this.getProps(),s=e.target,o=s!==t&&function(t){return Ei.has(t.tagName)||!0===t.isContentEditable}(s);i&&n&&!o&&this.start(e)});let i;const n=()=>{const{dragConstraints:e}=this.getProps();pt(e)&&e.current&&(this.constraints=this.resolveRefConstraints(),i||(i=function(t,e,i){const n=Ni(t,Qs(i)),s=Ni(e,Qs(i));return()=>{n(),s()}}(t,e.current,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),d.read(n);const r=Qn(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(Hn(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{r(),e(),o(),a&&a(),i&&i()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:o=Xs,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:n,dragConstraints:s,dragElastic:o,dragMomentum:r}}}function Qs(t){let e=!0;return()=>{e?e=!1:t()}}function to(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const eo=t=>(e,i)=>{t&&d.update(()=>t(e,i),!1,!0)};let io=!1;class no extends Et{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:n}=this.props,{projection:s}=t;s&&(e.group&&e.group.add(s),i&&i.register&&n&&i.register(s),io&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ns.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:n,isPresent:s}=this.props,{projection:o}=i;return o?(o.isPresent=s,t.layoutDependency!==e&&o.setOptions({...o.options,layoutDependency:e}),io=!0,n||t.layoutDependency!==e||void 0===e||t.isPresent!==s?o.willUpdate():this.safeToRemove(),t.isPresent!==s&&(s?o.promote():o.relegate()||d.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),ct.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:n}=t;io=!0,n&&(n.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(n),i&&i.deregister&&i.deregister(n))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function so(t){const[e,i]=function(t=!0){const e=Tt(ft);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:n,register:s}=e,o=Pt();wt(()=>{if(t)return s(o)},[t]);const r=St(()=>t&&n&&n(o),[o,n,t]);return!i&&n?[!1,r]:[!0]}(),n=Tt(yt);return xt(no,{...t,layoutGroup:n,switchLayoutGroup:Tt(gt),isPresent:e,safeToRemove:i})}const oo={pan:{Feature:class extends Ki{constructor(){super(...arguments),this.removePointerDownListener=t}onPointerDown(t){this.session=new Us(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Is(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:n}=this.node.getProps();return{onSessionStart:eo(t),onStart:eo(e),onMove:eo(i),onEnd:(t,e)=>{delete this.session,n&&d.postRender(()=>n(t,e))}}}mount(){this.removePointerDownListener=Bs(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends Ki{constructor(e){super(e),this.removeGroupControls=t,this.removeListeners=t,this.controls=new Js(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||t}update(){const{dragControls:t}=this.node.getProps(),{dragControls:e}=this.node.prevProps||{};t!==e&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:Rs,MeasureLayout:so}},ro={layout:{ProjectionNode:Rs,MeasureLayout:so}};let ao=0;const lo={animation:{Feature:class extends Ki{constructor(t){super(t),t.animationState||(t.animationState=xn(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();it(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 Ki{constructor(){super(...arguments),this.id=ao++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const n=this.node.animationState.setActive("exit",!t);e&&!t&&n.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 ho(t,e,i){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover","Start"===i);const s=n["onHover"+i];s&&d.postRender(()=>s(e,js(e)))}function co(t,e,i){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap","Start"===i);const s=n["onTap"+("End"===i?"":i)];s&&d.postRender(()=>s(e,js(e)))}const uo=new WeakMap,mo=new WeakMap,po=t=>{const e=uo.get(t.target);e&&e(t)},fo=t=>{t.forEach(po)};function yo(t,e,i){const n=function({root:t,...e}){const i=t||document;mo.has(i)||mo.set(i,{});const n=mo.get(i),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(fo,{root:t,...e})),n[s]}(e);return uo.set(t,i),n.observe(t),()=>{uo.delete(t),n.unobserve(t)}}const go={some:0,all:1};const vo={renderer:(t,e)=>e.isSVG??vt(t)?new dn(e):new cn(e,{allowProjection:t!==Dt}),...lo,...{inView:{Feature:class extends Ki{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:n="some",once:s}=t,o={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:go[n]};return yo(this.node.current,o,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:i,onViewportLeave:n}=this.node.getProps(),o=e?i:n;o&&o(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 i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends Ki{mount(){const{current:t}=this.node;if(!t)return;const{globalTapTarget:e,propagate:i}=this.node.props;this.unmount=Mi(t,(t,e)=>(co(this.node,e,"Start"),(t,{success:e})=>co(this.node,t,e?"End":"Cancel")),{useGlobalTarget:e,stopPropagation:!1===i?.tap})}unmount(){}}},focus:{Feature:class extends Ki{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=kt(Qn(this.node.current,"focus",()=>this.onFocus()),Qn(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Ki{mount(){const{current:t}=this.node;t&&(this.unmount=Ti(t,(t,e)=>(ho(this.node,e,"Start"),t=>ho(this.node,t,"End"))))}unmount(){}}}}},xo={...vo,...oo,...ro};export{xo as domMax};
|