framer-motion 9.0.4 → 9.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{t,u as e,v as n,w as s,x as i,y as o,z as r,A as a,B as l,C as h,a as u,d as c,D as p,g as d,r as m,E as f,F as g,G as y,H as v,o as x,I as P,J as T,K as b,i as V,M as A,N as E,n as S,c as w,b as C,m as M,f as D,O as L,h as k,q as R,Q as B,P as F,R as j,L as I,S as U,T as O,s as N,j as z,p as $,k as G,l as H}from"./size-rollup-dom-max-assets.js";import W,{useContext as q,useId as Y,useEffect as X}from"react";class K{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Z=t=>t;const _=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary;function J(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const Q="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),tt="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Q()),1/60*1e3);const et={delta:0,timestamp:0};let nt=!0,st=!1,it=!1;const ot=["read","update","preRender","render","postRender"],rt=ot.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],s=0,i=!1,o=!1;const r=new WeakSet,a={schedule:(t,o=!1,a=!1)=>{const l=a&&i,h=l?e:n;return o&&r.add(t),-1===h.indexOf(t)&&(h.push(t),l&&i&&(s=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),r.delete(t)},process:l=>{if(i)o=!0;else{if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let n=0;n<s;n++){const s=e[n];s(l),r.has(s)&&(a.schedule(s),t())}i=!1,o&&(o=!1,a.process(l))}}};return a}(()=>st=!0),t),{}),at=ot.reduce((t,e)=>{const n=rt[e];return t[e]=(t,e=!1,s=!1)=>(st||pt(),n.schedule(t,e,s)),t},{}),lt=ot.reduce((t,e)=>(t[e]=rt[e].cancel,t),{}),ht=ot.reduce((t,e)=>(t[e]=()=>rt[e].process(et),t),{}),ut=t=>rt[t].process(et),ct=t=>{st=!1,et.delta=nt?1/60*1e3:Math.max(Math.min(t-et.timestamp,40),1),et.timestamp=t,it=!0,ot.forEach(ut),it=!1,st&&(nt=!1,tt(ct))},pt=()=>{st=!0,nt=!0,it||tt(ct)},dt=t=>1e3*t;function mt(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function ft(t,e,n,s){return mt(t,e,(t=>e=>_(e)&&t(e,J(e)))(n),s)}const gt=(t,e)=>n=>e(t(n)),yt=(...t)=>t.reduce(gt),vt=(t,e)=>Math.abs(t-e);class xt{constructor(t,e,{transformPagePoint:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=bt(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=vt(t.x,e.x),s=vt(t.y,e.y);return Math.sqrt(n**2+s**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:s}=t,{timestamp:i}=et;this.history.push({...s,timestamp:i});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=Pt(e,this.transformPagePoint),at.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{if(this.end(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const{onEnd:n,onSessionEnd:s}=this.handlers,i=bt("pointercancel"===t.type?this.lastMoveEventInfo:Pt(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),s&&s(t,i)},!_(t))return;this.handlers=e,this.transformPagePoint=n;const s=Pt(J(t),this.transformPagePoint),{point:i}=s,{timestamp:o}=et;this.history=[{...i,timestamp:o}];const{onSessionStart:r}=e;r&&r(t,bt(s,this.history)),this.removeListeners=yt(ft(window,"pointermove",this.handlePointerMove),ft(window,"pointerup",this.handlePointerUp),ft(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),lt.update(this.updatePoint)}}function Pt(t,e){return e?{point:e(t.point)}:t}function Tt(t,e){return{x:t.x-e.x,y:t.y-e.y}}function bt({point:t},e){return{point:t,delta:Tt(t,At(e)),offset:Tt(t,Vt(e)),velocity:Et(e,.1)}}function Vt(t){return t[0]}function At(t){return t[t.length-1]}function Et(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=At(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>dt(e)));)n--;if(!s)return{x:0,y:0};const o=(i.timestamp-s.timestamp)/1e3;if(0===o)return{x:0,y:0};const r={x:(i.x-s.x)/o,y:(i.y-s.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function St(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const wt=St("dragHorizontal"),Ct=St("dragVertical");function Mt(t){let e=!1;if("y"===t)e=Ct();else if("x"===t)e=wt();else{const t=wt(),n=Ct();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}function Dt(){const t=Mt(!0);return!t||(t(),!1)}const Lt=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s},kt=(t,e,n)=>-n*t+n*e+t;function Rt(t){return t.max-t.min}function Bt(t,e=0,n=.01){return Math.abs(t-e)<=n}function Ft(t,e,n,s=.5){t.origin=s,t.originPoint=kt(e.min,e.max,t.origin),t.scale=Rt(n)/Rt(e),(Bt(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=kt(n.min,n.max,t.origin)-t.originPoint,(Bt(t.translate)||isNaN(t.translate))&&(t.translate=0)}function jt(t,e,n,s){Ft(t.x,e.x,n.x,s?s.originX:void 0),Ft(t.y,e.y,n.y,s?s.originY:void 0)}function It(t,e,n){t.min=n.min+e.min,t.max=t.min+Rt(e)}function Ut(t,e,n){t.min=e.min-n.min,t.max=t.min+Rt(e)}function Ot(t,e,n){Ut(t.x,e.x,n.x),Ut(t.y,e.y,n.y)}function Nt(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function zt(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}const $t=.35;function Gt(t,e,n){return{min:Ht(t,e),max:Ht(t,n)}}function Ht(t,e){return"number"==typeof t?t:t[e]||0}var Wt;!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(Wt||(Wt={}));function qt(t){return[t("x"),t("y")]}function Yt({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function Xt(t){return void 0===t||1===t}function Kt({scale:t,scaleX:e,scaleY:n}){return!Xt(t)||!Xt(e)||!Xt(n)}function Zt(t){return Kt(t)||_t(t)||t.z||t.rotate||t.rotateX||t.rotateY}function _t(t){return Jt(t.x)||Jt(t.y)}function Jt(t){return t&&"0%"!==t}function Qt(t,e,n){return n+e*(t-n)}function te(t,e,n,s,i){return void 0!==i&&(t=Qt(t,i,s)),Qt(t,n,s)+e}function ee(t,e=0,n=1,s,i){t.min=te(t.min,e,n,s,i),t.max=te(t.max,e,n,s,i)}function ne(t,{x:e,y:n}){ee(t.x,e.translate,e.scale,e.originPoint),ee(t.y,n.translate,n.scale,n.originPoint)}function se(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function ie(t,e){t.min=t.min+e,t.max=t.max+e}function oe(t,e,[n,s,i]){const o=void 0!==e[i]?e[i]:.5,r=kt(t.min,t.max,o);ee(t,e[n],e[s],r,e.scale)}const re=["x","scaleX","originX"],ae=["y","scaleY","originY"];function le(t,e){oe(t.x,e,re),oe(t.y,e,ae)}function he(t,e){return Yt(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const ue=!1,ce=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,pe=t=>e=>1-t(1-e),de=t=>t*t,me=pe(de),fe=ce(de),ge=(t,s)=>i=>Boolean(e(i)&&n.test(i)&&i.startsWith(t)||s&&Object.prototype.hasOwnProperty.call(i,s)),ye=(t,n,i)=>o=>{if(!e(o))return o;const[r,a,l,h]=o.match(s);return{[t]:parseFloat(r),[n]:parseFloat(a),[i]:parseFloat(l),alpha:void 0!==h?parseFloat(h):1}},ve={...r,transform:e=>Math.round((e=>t(0,255,e))(e))},xe={test:ge("rgb","red"),parse:ye("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ve.transform(t)+", "+ve.transform(e)+", "+ve.transform(n)+", "+i(o.transform(s))+")"};const Pe={test:ge("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:xe.transform},Te={test:ge("hsl","hue"),parse:ye("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+a.transform(i(e))+", "+a.transform(i(n))+", "+i(o.transform(s))+")"},be={test:t=>xe.test(t)||Pe.test(t)||Te.test(t),parse:t=>xe.test(t)?xe.parse(t):Te.test(t)?Te.parse(t):Pe.parse(t),transform:t=>e(t)?t:t.hasOwnProperty("red")?xe.transform(t):Te.transform(t)};function Ve(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}const Ae=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Ee=[Pe,xe,Te];function Se(t){const e=(n=t,Ee.find(t=>t.test(n)));var n;let s=e.parse(t);return e===Te&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,o=0,r=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=Ve(a,s,t+1/3),o=Ve(a,s,t),r=Ve(a,s,t-1/3)}else i=o=r=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*r),alpha:s}}(s)),s}const we=(t,e)=>{const n=Se(t),s=Se(e),i={...n};return t=>(i.red=Ae(n.red,s.red,t),i.green=Ae(n.green,s.green,t),i.blue=Ae(n.blue,s.blue,t),i.alpha=kt(n.alpha,s.alpha,t),xe.transform(i))};function Ce(t){"number"==typeof t&&(t=""+t);const e=[];let n=0,i=0;const o=t.match(l);o&&(n=o.length,t=t.replace(l,"${c}"),e.push(...o.map(be.parse)));const a=t.match(s);return a&&(i=a.length,t=t.replace(s,"${n}"),e.push(...a.map(r.parse))),{values:e,numColors:n,numNumbers:i,tokenised:t}}function Me(t){return Ce(t).values}function De(t){const{values:e,numColors:n,tokenised:s}=Ce(t),o=e.length;return t=>{let e=s;for(let s=0;s<o;s++)e=e.replace(s<n?"${c}":"${n}",s<n?be.transform(t[s]):i(t[s]));return e}}const Le=t=>"number"==typeof t?0:t;const ke={test:function(t){var n,i;return isNaN(t)&&e(t)&&((null===(n=t.match(s))||void 0===n?void 0:n.length)||0)+((null===(i=t.match(l))||void 0===i?void 0:i.length)||0)>0},parse:Me,createTransformer:De,getAnimatableNone:function(t){const e=Me(t);return De(t)(e.map(Le))}};function Re(t,e){return"number"==typeof t?n=>kt(t,e,n):be.test(t)?we(t,e):je(t,e)}const Be=(t,e)=>{const n=[...t],s=n.length,i=t.map((t,n)=>Re(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}},Fe=(t,e)=>{const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=Re(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}},je=(t,e)=>{const n=ke.createTransformer(e),s=Ce(t),i=Ce(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?yt(Be(s.values,i.values),n):n=>""+(n>0?e:t)},Ie=(t,e)=>n=>kt(t,e,n);function Ue(t,e,n){const s=[],i=n||("number"==typeof(o=t[0])?Ie:"string"==typeof o?be.test(o)?we:je:Array.isArray(o)?Be:"object"==typeof o?Fe:Ie);var o;const r=t.length-1;for(let n=0;n<r;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;o=yt(t,o)}s.push(o)}return s}function Oe(e,n,{clamp:s=!0,ease:i,mixer:o}={}){const r=e.length;n.length,!i||!Array.isArray(i)||i.length,e[0]>e[r-1]&&(e=[...e].reverse(),n=[...n].reverse());const a=Ue(n,i,o),l=a.length,h=t=>{let n=0;if(l>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=Lt(e[n],e[n+1],t);return a[n](s)};return s?n=>h(t(e[0],e[r-1],n)):h}const Ne=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function ze(t,e,n,s){if(t===e&&n===s)return Z;const i=e=>function(t,e,n,s,i){let o,r,a=0;do{r=e+(n-e)/2,o=Ne(r,s,i)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:Ne(i(t),e,s)}const $e=t=>1-Math.sin(Math.acos(t)),Ge=pe($e),He=ce(Ge),We=ze(.33,1.53,.69,.99),qe=pe(We),Ye=ce(qe),Xe={linear:Z,easeIn:de,easeInOut:fe,easeOut:me,circIn:$e,circInOut:He,circOut:Ge,backIn:qe,backInOut:Ye,backOut:We,anticipate:t=>(t*=2)<1?.5*qe(t):.5*(2-Math.pow(2,-10*(t-1)))},Ke=t=>{if(Array.isArray(t)){t.length;const[e,n,s,i]=t;return ze(e,n,s,i)}return"string"==typeof t?Xe[t]:t};function Ze({keyframes:t,ease:e=fe,times:n,duration:s=300}){t=[...t];const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(e)?e.map(Ke):Ke(e),o={done:!1,value:t[0]},r=function(t,e){return t.map(t=>t*e)}(n&&n.length===t.length?n:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(t),s);function a(){return Oe(r,t,{ease:Array.isArray(i)?i:(e=t,n=i,e.map(()=>n||fe).splice(0,e.length-1))});var e,n}let l=a();return{next:t=>(o.value=l(t),o.done=t>=s,o),flipTarget:()=>{t.reverse(),l=a()}}}function _e({duration:e=800,bounce:n=.25,velocity:s=0,mass:i=1}){let o,r,a=1-n;a=t(.05,1,a),e=t(.01,10,e/1e3),a<1?(o=t=>{const n=t*a,i=n*e;return.001-(n-s)/Je(t,a)*Math.exp(-i)},r=t=>{const n=t*a*e,i=n*s+s,r=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-n),h=Je(Math.pow(t,2),a);return(.001-o(t)>0?-1:1)*((i-r)*l)/h}):(o=t=>Math.exp(-t*e)*((t-s)*e+1)-.001,r=t=>Math.exp(-t*e)*(e*e*(s-t)));const l=function(t,e,n){let s=n;for(let n=1;n<12;n++)s-=t(s)/e(s);return s}(o,r,5/e);if(e*=1e3,isNaN(l))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(l,2)*i;return{stiffness:t,damping:2*a*Math.sqrt(i*t),duration:e}}}function Je(t,e){return t*Math.sqrt(1-e*e)}function Qe(t,e){return e?t*(1e3/e):0}const tn=["duration","bounce"],en=["stiffness","damping","mass"];function nn(t,e){return e.some(e=>void 0!==t[e])}function sn({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],o=t[t.length-1];const r={done:!1,value:i},{stiffness:a,damping:l,mass:h,velocity:u,duration:c,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!nn(t,en)&&nn(t,tn)){const n=_e(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}(s);let d=on,m=u?-u/1e3:0;const f=l/(2*Math.sqrt(a*h));function g(){const t=o-i,s=Math.sqrt(a/h)/1e3,r=Math.abs(t)<5;if(n||(n=r?.01:2),e||(e=r?.005:.5),f<1){const e=Je(s,f);d=n=>{const i=Math.exp(-f*s*n);return o-i*((m+f*s*t)/e*Math.sin(e*n)+t*Math.cos(e*n))}}else if(1===f)d=e=>o-Math.exp(-s*e)*(t+(m+s*t)*e);else{const e=s*Math.sqrt(f*f-1);d=n=>{const i=Math.exp(-f*s*n),r=Math.min(e*n,300);return o-i*((m+f*s*t)*Math.sinh(r)+e*t*Math.cosh(r))/e}}}return g(),{next:t=>{const s=d(t);if(p)r.done=t>=c;else{let i=m;if(0!==t)if(f<1){const e=Math.max(0,t-5);i=Qe(s-d(e),t-e)}else i=0;const a=Math.abs(i)<=n,l=Math.abs(o-s)<=e;r.done=a&&l}return r.value=r.done?o:s,r},flipTarget:()=>{m=-m,[i,o]=[o,i],g()}}}sn.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const on=t=>0;const rn={decay:function({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:o}){const r=t[0],a={done:!1,value:r};let l=n*e;const h=r+l,u=void 0===o?h:o(h);return u!==h&&(l=u-r),{next:t=>{const e=-l*Math.exp(-t/s);return a.done=!(e>i||e<-i),a.value=a.done?u:u+e,a},flipTarget:()=>{}}},keyframes:Ze,tween:Ze,spring:sn};function an(t,e,n=0){return t-e-n}const ln=t=>{const e=({delta:e})=>t(e);return{start:()=>at.update(e,!0),stop:()=>lt.update(e)}};function hn({duration:t,driver:e=ln,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:o=0,keyframes:r,autoplay:a=!0,onPlay:l,onStop:h,onComplete:u,onRepeat:c,onUpdate:p,type:d="keyframes",...m}){const f=n;let g,y,v=0,x=t,P=!1,T=!0;const b=rn[r.length>2?"keyframes":d]||Ze,V=r[0],A=r[r.length-1];let E={done:!1,value:V};const{needsInterpolation:S}=b;S&&S(V,A)&&(y=Oe([0,100],[V,A],{clamp:!1}),r=[0,100]);const w=b({...m,duration:t,keyframes:r});function C(){v++,"reverse"===i?(T=v%2==0,n=function(t,e=0,n=0,s=!0){return s?an(e+-t,e,n):e-(t-e)+n}(n,x,o,T)):(n=an(n,x,o),"mirror"===i&&w.flipTarget()),P=!1,c&&c()}function M(t){T||(t=-t),n+=t,P||(E=w.next(Math.max(0,n)),y&&(E.value=y(E.value)),P=T?E.done:n<=0),p&&p(E.value),P&&(0===v&&(x=void 0!==x?x:n),v<s?function(t,e,n,s){return s?t>=e+n:t<=-n}(n,x,o,T)&&C():(g&&g.stop(),u&&u()))}return a&&(l&&l(),g=e(M),g.start()),{stop:()=>{h&&h(),g&&g.stop()},set currentTime(t){n=f,M(t)},sample:e=>{n=f;const s=t&&"number"==typeof t?Math.max(.5*t,50):50;let i=0;for(M(0);i<=e;){const t=e-i;M(Math.min(t,s)),i+=s}return E}}}const un=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,cn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:un([0,.65,.55,1]),circOut:un([.55,0,1,.45]),backIn:un([.31,.01,.66,-.59]),backOut:un([.33,1.53,.69,.99])};function pn(t){if(t)return Array.isArray(t)?un(t):cn[t]}const dn={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},mn={},fn={};for(const t in dn)fn[t]=()=>(void 0===mn[t]&&(mn[t]=dn[t]()),mn[t]);const gn=new Set(["opacity"]);function yn(t,e,{onUpdate:n,onComplete:s,...i}){if(!(fn.waapi()&&gn.has(e)&&!i.repeatDelay&&"mirror"!==i.repeatType&&0!==i.damping))return!1;let{keyframes:o,duration:r=300,elapsed:a=0,ease:l}=i;if("spring"===i.type||!(!(h=i.ease)||Array.isArray(h)||"string"==typeof h&&cn[h])){if(i.repeat===1/0)return;const t=hn({...i,elapsed:0});let e={done:!1,value:o[0]};const n=[];let s=0;for(;!e.done&&s<2e4;)e=t.sample(s),n.push(e.value),s+=10;o=n,r=s-10,l="linear"}var h;const u=function(t,e,n,{delay:s=0,duration:i,repeat:o=0,repeatType:r="loop",ease:a,times:l}={}){return t.animate({[e]:n,offset:l},{delay:s,duration:i,easing:pn(a),fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"})}(t.owner.current,e,o,{...i,delay:-a,duration:r,ease:l});return u.onfinish=()=>{t.set(function(t,{repeat:e,repeatType:n="loop"}){return t[e&&"loop"!==n&&e%2==1?0:t.length-1]}(o,i)),at.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(t){u.currentTime=t},stop:()=>{const{currentTime:e}=u;if(e){const n=hn({...i,autoplay:!1});t.setWithVelocity(n.sample(e-10).value,n.sample(e).value,10)}at.update(()=>u.cancel())}}}function vn(t,e){const n=performance.now(),s=({timestamp:i})=>{const o=i-n;o>=e&&(lt.read(s),t(o-e))};return at.read(s,!0),()=>lt.read(s)}function xn({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:vn(i,-e)}:i()}const Pn=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Tn=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),bn=()=>({type:"keyframes",ease:"linear",duration:.3}),Vn={type:"keyframes",duration:.8},An={x:Pn,y:Pn,z:Pn,rotate:Pn,rotateX:Pn,rotateY:Pn,rotateZ:Pn,scaleX:Tn,scaleY:Tn,scale:Tn,opacity:bn,backgroundColor:bn,color:bn,default:Tn},En=(t,{keyframes:e})=>{if(e.length>2)return Vn;return(An[t]||An.default)(e[1])},Sn=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!ke.test(e)||e.startsWith("url("))),wn=new Set(["brightness","contrast","saturate","opacity"]);function Cn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(s)||[];if(!i)return t;const o=n.replace(i,"");let r=wn.has(e)?1:0;return i!==n&&(r*=100),e+"("+r+o+")"}const Mn=/([a-z-]*)\(.*?\)/g,Dn={...ke,getAnimatableNone:t=>{const e=t.match(Mn);return e?e.map(Cn).join(" "):t}},Ln={...h,color:be,backgroundColor:be,outlineColor:be,fill:be,stroke:be,borderColor:be,borderTopColor:be,borderRightColor:be,borderBottomColor:be,borderLeftColor:be,filter:Dn,WebkitFilter:Dn},kn=t=>Ln[t];function Rn(t,e){let n=kn(t);return n!==Dn&&(n=ke),n.getAnimatableNone?n.getAnimatableNone(e):void 0}function Bn(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Fn(t){return"number"==typeof t?0:Rn("",t)}function jn(t,e){return t[e]||t.default||t}const In=(t,e,n,s={})=>i=>{const o=jn(s,t)||{},r=o.delay||s.delay||0;let{elapsed:a=0}=s;a-=dt(r);const l=function(t,e,n,s){const i=Sn(e,n);let o=void 0!==s.from?s.from:t.get();return"none"===o&&i&&"string"==typeof n?o=Rn(e,n):Bn(o)&&"string"==typeof n?o=Fn(n):!Array.isArray(n)&&Bn(n)&&"string"==typeof o&&(n=Fn(o)),Array.isArray(n)?(null===n[0]&&(n[0]=o),n):[o,n]}(e,t,n,o),h=l[0],u=l[l.length-1],c=Sn(t,h),p=Sn(t,u);let d={keyframes:l,velocity:e.getVelocity(),...o,elapsed:a,onUpdate:t=>{e.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(!c||!p||ue||!1===o.type)return xn(d);if("inertia"===o.type)return function({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:o=750,bounceStiffness:r=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:h,driver:u,onUpdate:c,onComplete:p,onStop:d}){const m=t[0];let f;function g(t){return void 0!==n&&t<n||void 0!==s&&t>s}function y(t){return void 0===n?s:void 0===s||Math.abs(n-t)<Math.abs(s-t)?n:s}function v(t){f&&f.stop(),f=hn({keyframes:[0,1],velocity:0,...t,driver:u,onUpdate:e=>{c&&c(e),t.onUpdate&&t.onUpdate(e)},onComplete:p,onStop:d})}function x(t){v({type:"spring",stiffness:r,damping:a,restDelta:l,...t})}if(g(m))x({velocity:e,keyframes:[m,y(m)]});else{let t=i*e+m;void 0!==h&&(t=h(t));const s=y(t),r=s===n?-1:1;let a,u;const c=t=>{a=u,u=t,e=Qe(t-a,et.delta),(1===r&&t>s||-1===r&&t<s)&&x({keyframes:[t,s],velocity:e})};v({type:"decay",keyframes:[m,0],velocity:e,timeConstant:o,power:i,restDelta:l,modifyTarget:h,onUpdate:g(t)?c:void 0})}return{stop:()=>f&&f.stop()}}(d);if(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length}(o)||(d={...d,...En(t,d)}),d.duration&&(d.duration=dt(d.duration)),d.repeatDelay&&(d.repeatDelay=dt(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const n=yn(e,t,d);if(n)return n}return hn(d)},Un=new WeakMap;class On{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;this.panSession=new xt(t,{onSessionStart:t=>{this.stopAnimation(),e&&this.snapToCursor(J(t,"page").point)},onStart:(t,e)=>{const{drag:n,dragPropagation:s,onDragStart:i}=this.getProps();if(n&&!s&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Mt(n),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),qt(t=>{let e=this.getAxisMotionValue(t).get()||0;if(a.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const s=n.layout.layoutBox[t];if(s){e=Rt(s)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),i&&i(t,e);const{animationState:o}=this.visualElement;o&&o.setActive(Wt.Drag,!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:s,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:r}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(r),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e)},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:s}=e;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&i(t,e)}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),e&&e.setActive(Wt.Drag,!1)}updateAxis(t,e,n){const{drag:s}=this.getProps();if(!n||!Nn(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},s){return void 0!==e&&t<e?t=s?kt(e,t,s.min):Math.max(t,e):void 0!==n&&t>n&&(t=s?kt(n,t,s.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),{layout:n}=this.visualElement.projection||{},s=this.constraints;t&&u(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!n)&&function(t,{top:e,left:n,bottom:s,right:i}){return{x:Nt(t.x,n,i),y:Nt(t.y,e,s)}}(n.layoutBox,t),this.elastic=function(t=$t){return!1===t?t=0:!0===t&&(t=$t),{x:Gt(t,"left","right"),y:Gt(t,"top","bottom")}}(e),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&qt(t=>{this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(n.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!u(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=function(t,e,n){const s=he(t,n),{scroll:i}=e;return i&&(ie(s.x,i.offset.x),ie(s.y,i.offset.y)),s}(n,s.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:zt(t.x,e.x),y:zt(t.y,e.y)}}(s.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=Yt(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=qt(r=>{if(!Nn(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=s?200:1e6,u=s?40:1e7,c={type:"inertia",velocity:n?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return n.start(In(t,n,0,e))}stopAnimation(){qt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const e="_drag"+t.toUpperCase(),n=this.visualElement.getProps(),s=n[e];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){qt(e=>{const{drag:n}=this.getProps();if(!Nn(e,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(e);if(s&&s.layout){const{min:n,max:o}=s.layout.layoutBox[e];i.set(t[e]-kt(n,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!u(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};qt(e=>{const n=this.getAxisMotionValue(e);if(n){const s=n.get();i[e]=function(e,n){let s=.5;const i=Rt(e),o=Rt(n);return o>i?s=Lt(n.min,n.max-i,e.min):i>o&&(s=Lt(e.min,e.max-o,n.min)),t(0,1,s)}({min:s,max:s},this.constraints[e])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),qt(t=>{if(!Nn(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:o}=this.constraints[t];n.set(kt(s,o,i[t]))})}addListeners(){if(!this.visualElement.current)return;Un.set(this.visualElement,this);const t=ft(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();u(t)&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,s=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),e();const i=mt(window,"resize",()=>this.scalePositionWithinConstraints()),o=n.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(qt(e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))}),this.visualElement.render())});return()=>{i(),t(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=$t,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:r}}}function Nn(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}function zn(t,e){-1===t.indexOf(e)&&t.push(e)}function $n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Gn{constructor(){this.subscriptions=[]}add(t){return zn(this.subscriptions,t),()=>$n(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Hn{constructor(t,e={}){var n;this.version="9.0.4",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:s}=et;this.lastUpdated!==s&&(this.timeDelta=n,this.lastUpdated=s,at.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>at.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(n=this.current,!isNaN(parseFloat(n))),this.owner=e.owner}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Gn);const n=this.events[t].add(e);return"change"===t?()=>{n(),at.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,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Qe(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wn(t,e){return new Hn(t,e)}const qn=["TopLeft","TopRight","BottomLeft","BottomRight"],Yn=qn.length,Xn=t=>"string"==typeof t?parseFloat(t):t,Kn=t=>"number"==typeof t||p.test(t);function Zn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const _n=Qn(0,.5,Ge),Jn=Qn(.5,.95,Z);function Qn(t,e,n){return s=>s<t?0:s>e?1:n(Lt(t,e,s))}function ts(t,e){t.min=e.min,t.max=e.max}function es(t,e){ts(t.x,e.x),ts(t.y,e.y)}function ns(t,e,n,s,i){return t=Qt(t-=e,1/n,s),void 0!==i&&(t=Qt(t,1/i,s)),t}function ss(t,e,[n,s,i],o,r){!function(t,e=0,n=1,s=.5,i,o=t,r=t){if(a.test(e)){e=parseFloat(e);e=kt(r.min,r.max,e/100)-r.min}if("number"!=typeof e)return;let l=kt(o.min,o.max,s);t===o&&(l-=e),t.min=ns(t.min,e,n,l,i),t.max=ns(t.max,e,n,l,i)}(t,e[n],e[s],e[i],e.scale,o,r)}const is=["x","scaleX","originX"],os=["y","scaleY","originY"];function rs(t,e,n,s){ss(t.x,e,is,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,os,n?n.y:void 0,s?s.y:void 0)}function as(t){return 0===t.translate&&1===t.scale}function ls(t){return as(t.x)&&as(t.y)}function hs(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function us(t){return Rt(t.x)/Rt(t.y)}class cs{constructor(){this.members=[]}add(t){zn(this.members,t),t.scheduleRender()}remove(t){if($n(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 n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;!1===s&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function ps(t,e,n){let s="";const i=t.x.translate/e.x,o=t.y.translate/e.y;if((i||o)&&(s=`translate3d(${i}px, ${o}px, 0) `),1===e.x&&1===e.y||(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:t,rotateX:e,rotateY:i}=n;t&&(s+=`rotate(${t}deg) `),e&&(s+=`rotateX(${e}deg) `),i&&(s+=`rotateY(${i}deg) `)}const r=t.x.scale*e.x,a=t.y.scale*e.y;return 1===r&&1===a||(s+=`scale(${r}, ${a})`),s||"none"}const ds=(t,e)=>t.depth-e.depth;class ms{constructor(){this.children=[],this.isDirty=!1}add(t){zn(this.children,t),this.isDirty=!0}remove(t){$n(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ds),this.isDirty=!1,this.children.forEach(t)}}const fs=["","X","Y","Z"];let gs=0;function ys({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(t,n={},s=(null==e?void 0:e())){this.id=gs++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isTransformDirty=!1,this.isProjectionDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.nodes.forEach(Ps),this.nodes.forEach(Es),this.nodes.forEach(Ss)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=t,this.latestValues=n,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0,t&&this.root.registerPotentialNode(t,this);for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new ms)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Gn),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}registerPotentialNode(t,e){this.potentialNodes.set(t,e)}mount(e,n=!1){if(this.instance)return;this.isSVG=e instanceof SVGElement&&"svg"!==e.tagName,this.instance=e;const{layoutId:s,layout:i,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.elementId&&this.root.potentialNodes.delete(this.elementId),n&&(i||s)&&(this.isLayoutDirty=!0),t){let n;const s=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=vn(s,250),d.hasAnimatedSinceResize&&(d.hasAnimatedSinceResize=!1,this.nodes.forEach(As))})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&o&&(s||i)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||o.getDefaultTransition()||ks,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!hs(this.targetLayout,s)||n,h=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,h);const e={...jn(i,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||0!==this.animationProgress||As(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=s})}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,lt.preRender(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(ws),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(!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:n}=this.options;if(void 0===e&&!n)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}didUpdate(){if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(bs);this.isUpdating&&(this.isUpdating=!1,this.potentialNodes.size&&(this.potentialNodes.forEach(Rs),this.potentialNodes.clear()),this.nodes.forEach(Vs),this.nodes.forEach(vs),this.nodes.forEach(xs),this.clearAllSnapshots(),ht.update(),ht.preRender(),ht.render())}clearAllSnapshots(){this.nodes.forEach(Ts),this.sharedNodes.forEach(Cs)}scheduleUpdateProjection(){at.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){at.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}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.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},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);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&(this.scroll={animationId:this.root.animationId,phase:t,isRoot:s(this.instance),offset:n(this.instance)})}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform,e=this.projectionDelta&&!ls(this.projectionDelta),n=this.getTransformTemplate(),s=n?n(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&(e||Zt(this.latestValues)||o)&&(i(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var s;return t&&(n=this.removeTransform(n)),Bs((s=n).x),Bs(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const e=t.measureViewportBox(),{scroll:n}=this.root;return n&&(ie(e.x,n.offset.x),ie(e.y,n.offset.y)),e}removeElementScroll(t){const e={x:{min:0,max:0},y:{min:0,max:0}};es(e,t);for(let n=0;n<this.path.length;n++){const s=this.path[n],{scroll:i,options:o}=s;if(s!==this.root&&i&&o.layoutScroll){if(i.isRoot){es(e,t);const{scroll:n}=this.root;n&&(ie(e.x,-n.offset.x),ie(e.y,-n.offset.y))}ie(e.x,i.offset.x),ie(e.y,i.offset.y)}}return e}applyTransform(t,e=!1){const n={x:{min:0,max:0},y:{min:0,max:0}};es(n,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&le(n,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),Zt(s.latestValues)&&le(n,s.latestValues)}return Zt(this.latestValues)&&le(n,this.latestValues),n}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};es(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Zt(n.latestValues))continue;Kt(n.latestValues)&&n.updateSnapshot();const s={x:{min:0,max:0},y:{min:0,max:0}};es(s,n.measurePageBox()),rs(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,s)}return Zt(this.latestValues)&&rs(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.isProjectionDirty=!0,this.root.scheduleUpdateProjection()}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}resolveTargetDelta(){const t=this.getLead();if(this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),!this.isProjectionDirty&&!this.attemptToResolveRelativeTarget)return;const{layout:e,layoutId:n}=this.options;if(this.layout&&(e||n)){if(!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout?(this.relativeParent=t,this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Ot(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),es(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}var s,i,o;if(this.relativeTarget||this.targetDelta)if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(s=this.target,i=this.relativeTarget,o=this.relativeParent.target,It(s.x,i.x,o.x),It(s.y,i.y,o.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):es(this.target,this.layout.layoutBox),ne(this.target,this.targetDelta)):es(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target?(this.relativeParent=t,this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Ot(this.relativeTargetOrigin,this.target,t.target),es(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(this.parent&&!Kt(this.parent.latestValues)&&!_t(this.parent.latestValues))return(this.parent.relativeTarget||this.parent.targetDelta||this.parent.options.layoutRoot)&&this.parent.layout?this.parent:this.parent.getClosestProjectingParent()}calcProjection(){const{isProjectionDirty:t,isTransformDirty:e}=this;this.isProjectionDirty=this.isTransformDirty=!1;const n=this.getLead(),s=Boolean(this.resumingFrom)||this!==n;let i=!0;if(t&&(i=!1),s&&e&&(i=!1),i)return;const{layout:o,layoutId:r}=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||!o&&!r)return;es(this.layoutCorrected,this.layout.layoutBox),function(t,e,n,s=!1){const i=n.length;if(!i)return;let o,r;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],r=o.projectionDelta;const i=o.instance;i&&i.style&&"contents"===i.style.display||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&le(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,ne(t,r)),s&&Zt(o.latestValues)&&le(t,o.latestValues))}e.x=se(e.x),e.y=se(e.y)}(this.layoutCorrected,this.treeScale,this.path,s);const{target:a}=n;if(!a)return;this.projectionDelta||(this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}});const l=this.treeScale.x,h=this.treeScale.y,u=this.projectionTransform;jt(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.projectionTransform=ps(this.projectionDelta,this.treeScale),this.projectionTransform===u&&this.treeScale.x===l&&this.treeScale.y===h||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(t,e=!1){const n=this.snapshot,s=n?n.latestValues:{},i={...this.latestValues},o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const r={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),h=this.getStack(),u=!h||h.members.length<=1,c=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(Ls));this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;var h,p,d,m;Ms(o.x,t.x,n),Ms(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ot(r,this.layout.layoutBox,this.relativeParent.layout.layoutBox),h=this.relativeTarget,p=this.relativeTargetOrigin,d=r,m=n,Ds(h.x,p.x,d.x,m),Ds(h.y,p.y,d.y,m)),l&&(this.animationValues=i,function(t,e,n,s,i,o){i?(t.opacity=kt(0,void 0!==n.opacity?n.opacity:1,_n(s)),t.opacityExit=kt(void 0!==e.opacity?e.opacity:1,0,Jn(s))):o&&(t.opacity=kt(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,s));for(let i=0;i<Yn;i++){const o=`border${qn[i]}Radius`;let r=Zn(e,o),l=Zn(n,o);if(void 0===r&&void 0===l)continue;r||(r=0),l||(l=0);0===r||0===l||Kn(r)===Kn(l)?(t[o]=Math.max(kt(Xn(r),Xn(l),s),0),(a.test(l)||a.test(r))&&(t[o]+="%")):t[o]=l}(e.rotate||n.rotate)&&(t.rotate=kt(e.rotate||0,n.rotate||0,s))}(i,s,this.latestValues,n,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(lt.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=at.update(()=>{d.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n={}){const s=c(t)?t:Wn(t);return s.start(In("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},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:n,layout:s,latestValues:i}=t;if(e&&n&&s){if(this!==t&&this.layout&&s&&Fs(this.options.animationType,this.layout.layoutBox,s.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=Rt(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const s=Rt(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+s}es(e,n),le(e,i),jt(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new cs);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const s=this.getStack();s&&s.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.rotate||n.rotateX||n.rotateY||n.rotateZ)&&(e=!0),!e)return;const s={};for(let e=0;e<fs.length;e++){const i="rotate"+fs[e];n[i]&&(s[i]=n[i],t.setStaticValue(i,0))}t.render();for(const e in s)t.setStaticValue(e,s[e]);t.scheduleRender()}getProjectionStyles(t={}){var e,n;const s={};if(!this.instance||this.isSVG)return s;if(!this.isVisible)return{visibility:"hidden"};s.visibility="";const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=m(t.pointerEvents)||"",s.transform=i?i(this.latestValues,""):"none",s;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=m(t.pointerEvents)||""),this.hasProjected&&!Zt(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const r=o.animationValues||o.latestValues;this.applyTransformsToTarget(),s.transform=ps(this.projectionDeltaWithTransform,this.treeScale,r),i&&(s.transform=i(r,s.transform));const{x:a,y:l}=this.projectionDelta;s.transformOrigin=`${100*a.origin}% ${100*l.origin}% 0`,o.animationValues?s.opacity=o===this?null!==(n=null!==(e=r.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:r.opacityExit:s.opacity=o===this?void 0!==r.opacity?r.opacity:"":void 0!==r.opacityExit?r.opacityExit:0;for(const t in f){if(void 0===r[t])continue;const{correct:e,applyTo:n}=f[t],i="none"===s.transform?r[t]:e(r[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)s[n[e]]=i}else s[t]=i}return this.options.layoutId&&(s.pointerEvents=o===this?m(t.pointerEvents)||"":"none"),s}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()}),this.root.nodes.forEach(bs),this.root.sharedNodes.clear()}}}function vs(t){t.updateLayout()}function xs(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?qt(t=>{const s=o?n.measuredBox[t]:n.layoutBox[t],i=Rt(s);s.min=e[t].min,s.max=s.min+i}):Fs(i,n.layoutBox,e)&&qt(t=>{const s=o?n.measuredBox[t]:n.layoutBox[t],i=Rt(e[t]);s.max=s.min+i});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};jt(r,e,n.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?jt(a,t.applyTransform(s,!0),n.measuredBox):jt(a,e,n.layoutBox);const l=!ls(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:i,layout:o}=s;if(i&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};Ot(r,n.layoutBox,i.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};Ot(a,e,o.layoutBox),hs(r,a)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeTargetChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Ps(t){t.isProjectionDirty||(t.isProjectionDirty=Boolean(t.parent&&t.parent.isProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=Boolean(t.parent&&t.parent.isTransformDirty))}function Ts(t){t.clearSnapshot()}function bs(t){t.clearMeasurements()}function Vs(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function As(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function Es(t){t.resolveTargetDelta()}function Ss(t){t.calcProjection()}function ws(t){t.resetRotation()}function Cs(t){t.removeLeadSnapshot()}function Ms(t,e,n){t.translate=kt(e.translate,0,n),t.scale=kt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ds(t,e,n,s){t.min=kt(e.min,n.min,s),t.max=kt(e.max,n.max,s)}function Ls(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const ks={duration:.45,ease:[.4,0,.1,1]};function Rs(t,e){let n=t.root;for(let e=t.path.length-1;e>=0;e--)if(Boolean(t.path[e].instance)){n=t.path[e];break}const s=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);s&&t.mount(s,!0)}function Bs(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function Fs(t,e,n){return"position"===t||"preserve-aspect"===t&&!Bt(us(e),us(n),.2)}const js=ys({attachResizeListener:(t,e)=>mt(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Is={current:void 0},Us=ys({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Is.current){const t=new js(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),Is.current=t}return Is.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function Os(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ns={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!p.test(t))return t;t=parseFloat(t)}return`${Os(t,e.target.x)}% ${Os(t,e.target.y)}%`}};function zs(t){return"string"==typeof t&&t.startsWith("var(--")}const $s=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Gs(t,e,n=1){const[s,i]=function(t){const e=$s.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);return o?o.trim():zs(i)?Gs(i,e,n+1):i}const Hs={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),o=[];i&&(t=t.replace($s,t=>(o.push(t),"_$css")));const r=ke.parse(t);if(r.length>5)return s;const a=ke.createTransformer(t),l="number"!=typeof r[0]?1:0,h=n.x.scale*e.x,u=n.y.scale*e.y;r[0+l]/=h,r[1+l]/=u;const c=kt(h,u,.5);"number"==typeof r[2+l]&&(r[2+l]/=c),"number"==typeof r[3+l]&&(r[3+l]/=c);let p=a(r);if(i){let t=0;p=p.replace("_$css",()=>{const e=o[t];return t++,e})}return p}},Ws=t=>/^0[^.\s]+$/.test(t),qs=t=>e=>e.test(t),Ys=[r,p,a,g,y,v,{test:t=>"auto"===t,parse:t=>t}],Xs=t=>Ys.find(qs(t)),Ks=[...Ys,be,ke],Zs=t=>Ks.find(qs(t));function _s(t,e,n){const s=t.getProps();return x(s,e,void 0!==n?n:s.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(t))}function Js(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Wn(n))}function Qs(t,e){if(!e)return;return(e[t]||e.default||e).from}const ti=new Set(["width","height","top","left","right","bottom","x","y"]),ei=t=>ti.has(t),ni=t=>t===r||t===p;var si;!function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"}(si||(si={}));const ii=(t,e)=>parseFloat(t.split(", ")[e]),oi=(t,e)=>(n,{transform:s})=>{if("none"===s||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return ii(i[1],e);{const e=s.match(/^matrix\((.+)\)$/);return e?ii(e[1],t):0}},ri=new Set(["x","y","z"]),ai=T.filter(t=>!ri.has(t));const li={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:oi(4,13),y:oi(5,14)},hi=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(ei);let o=[],r=!1;const a=[];if(i.forEach(i=>{const l=t.getValue(i);if(!t.hasValue(i))return;let h=n[i],u=Xs(h);const c=e[i];let d;if(b(c)){const t=c.length,e=null===c[0]?1:0;h=c[e],u=Xs(h);for(let n=e;n<t;n++)d?Xs(c[n]):d=Xs(c[n])}else d=Xs(c);if(u!==d)if(ni(u)&&ni(d)){const t=l.get();"string"==typeof t&&l.set(parseFloat(t)),"string"==typeof c?e[i]=parseFloat(c):Array.isArray(c)&&d===p&&(e[i]=c.map(parseFloat))}else(null==u?void 0:u.transform)&&(null==d?void 0:d.transform)&&(0===h||0===c)?0===h?l.set(d.transform(h)):e[i]=u.transform(c):(r||(o=function(t){const e=[];return ai.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}(t),r=!0),a.push(i),s[i]=void 0!==s[i]?s[i]:e[i],l.jump(c))}),a.length){const n=a.indexOf("height")>=0?window.pageYOffset:null,i=((t,e,n)=>{const s=e.measureViewportBox(),i=e.current,o=getComputedStyle(i),{display:r}=o,a={};"none"===r&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=li[t](s,o)}),e.render();const l=e.measureViewportBox();return n.forEach(n=>{const s=e.getValue(n);s&&s.jump(a[n]),t[n]=li[n](l,o)}),t})(e,t,a);return o.length&&o.forEach(([e,n])=>{t.getValue(e).set(n)}),t.render(),V&&null!==n&&window.scrollTo({top:n}),{target:i,transitionEnd:s}}return{target:e,transitionEnd:s}};function ui(t,e,n,s){return(t=>Object.keys(t).some(ei))(e)?hi(t,e,n,s):{target:e,transitionEnd:s}}const ci=(t,e,n,s)=>{const i=function(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(t=>{const e=t.get();if(!zs(e))return;const n=Gs(e,s);n&&t.set(n)});for(const t in e){const i=e[t];if(!zs(i))continue;const o=Gs(i,s);o&&(e[t]=o,n&&void 0===n[t]&&(n[t]=i))}return{target:e,transitionEnd:n}}(t,e,s);return ui(t,e=i.target,n,s=i.transitionEnd)},pi={current:null},di={current:!1};function mi(t){return Boolean(c(t)&&t.add)}function fi(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const gi="data-"+A("framerAppearId");function yi(t,e,n={}){const s=_s(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>vi(t,s,n):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=i;return function(t,e,n=0,s=0,i=1,o){const r=[],a=(t.variantChildren.size-1)*s,l=1===i?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(xi).forEach((t,s)=>{t.notify("AnimationStart",e),r.push(yi(t,e,{...o,delay:n+l(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(r)}(t,e,o+s,r,a,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[t,e]="beforeChildren"===a?[o,r]:[r,o];return t().then(e)}return Promise.all([o(),r(n.delay)])}function vi(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=t.makeTargetAnimatable(e);const l=t.getValue("willChange");s&&(o=s);const h=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in a){const s=t.getValue(e),i=a[e];if(!s||void 0===i||u&&Pi(u,e))continue;const r={delay:n,elapsed:0,...o};if(window.HandoffAppearAnimations&&!s.hasAnimated){const n=t.getProps()[gi];n&&(r.elapsed=window.HandoffAppearAnimations(n,e,s,at))}let c=s.start(In(e,s,i,t.shouldReduceMotion&&E.has(e)?{type:!1}:r));mi(l)&&(l.add(e),c=c.then(()=>l.remove(e))),h.push(c)}return Promise.all(h).then(()=>{r&&function(t,e){const n=_s(t,e);let{transitionEnd:s={},transition:i={},...o}=n?t.makeTargetAnimatable(n,!1):{};o={...o,...s};for(const e in o){Js(t,e,P(o[e]))}}(t,r)})}function xi(t,e){return t.sortNodePosition(e)}function Pi({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}const Ti=[Wt.Animate,Wt.InView,Wt.Focus,Wt.Hover,Wt.Tap,Wt.Drag,Wt.Exit],bi=[...Ti].reverse(),Vi=Ti.length;function Ai(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map(e=>yi(t,e,n));s=Promise.all(i)}else if("string"==typeof e)s=yi(t,e,n);else{const i="function"==typeof e?_s(t,e,n.custom):e;s=vi(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Ei(t){let e=Ai(t);const n={[Wt.Animate]:wi(!0),[Wt.InView]:wi(),[Wt.Hover]:wi(),[Wt.Tap]:wi(),[Wt.Drag]:wi(),[Wt.Focus]:wi(),[Wt.Exit]:wi()};let s=!0;const i=(e,n)=>{const s=_s(t,n);if(s){const{transition:t,transitionEnd:n,...i}=s;e={...e,...i,...n}}return e};function o(o,r){const a=t.getProps(),l=t.getVariantContext(!0)||{},h=[],u=new Set;let c={},p=1/0;for(let e=0;e<Vi;e++){const d=bi[e],m=n[d],f=void 0!==a[d]?a[d]:l[d],g=w(f),y=d===r?m.isActive:null;!1===y&&(p=e);let v=f===l[d]&&f!==a[d]&&g;if(v&&s&&t.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...c},!m.isActive&&null===y||!f&&!m.prevProp||S(f)||"boolean"==typeof f)continue;const x=Si(m.prevProp,f);let P=x||d===r&&m.isActive&&!v&&g||e>p&&g;const T=Array.isArray(f)?f:[f];let V=T.reduce(i,{});!1===y&&(V={});const{prevResolvedValues:A={}}=m,E={...A,...V},C=t=>{P=!0,u.delete(t),m.needsAnimating[t]=!0};for(const t in E){const e=V[t],n=A[t];c.hasOwnProperty(t)||(e!==n?b(e)&&b(n)?!fi(e,n)||x?C(t):m.protectedKeys[t]=!0:void 0!==e?C(t):u.add(t):void 0!==e&&u.has(t)?C(t):m.protectedKeys[t]=!0)}m.prevProp=f,m.prevResolvedValues=V,m.isActive&&(c={...c,...V}),s&&t.blockInitialAnimation&&(P=!1),P&&!v&&h.push(...T.map(t=>({animation:t,options:{type:d,...o}})))}if(u.size){const e={};u.forEach(n=>{const s=t.getBaseTarget(n);void 0!==s&&(e[n]=s)}),h.push({animation:e})}let d=Boolean(h.length);return s&&!1===a.initial&&!t.manuallyAnimateOnMount&&(d=!1),s=!1,d?e(h):Promise.resolve()}return{animateChanges:o,setActive:function(e,s,i){if(n[e].isActive===s)return Promise.resolve();t.variantChildren&&t.variantChildren.forEach(t=>{t.animationState&&t.animationState.setActive(e,s)}),n[e].isActive=s;const r=o(i,e);for(const t in n)n[t].protectedKeys={};return r},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function Si(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!fi(e,t)}function wi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const Ci=Object.keys(D),Mi=Ci.length,Di=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];const Li=["initial",...Ti],ki=Li.length;class Ri extends class{constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,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.scheduleRender=()=>at.render(this.render,!1,!0);const{latestValues:r,renderState:a}=i;this.latestValues=r,this.baseTarget={...r},this.initialValues=e.initial?{...r}:{},this.renderState=a,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=o,this.isControllingVariants=C(e),this.isVariantNode=M(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...h}=this.scrapeMotionValuesFromProps(e,{});for(const t in h){const e=h[t];void 0!==r[t]&&c(e)&&(e.set(r[t],!1),mi(l)&&l.add(t))}}scrapeMotionValuesFromProps(t,e){return{}}mount(t){this.current=t,this.projection&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),di.current||function(){if(di.current=!0,V)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>pi.current=t.matches;t.addListener(e),e()}else pi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||pi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),lt.update(this.notifyUpdate),lt.render(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,e){const n=E.has(t),s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&at.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=e.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{s(),i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures({children:t,...e},n,s,i,o){let r,a;for(let t=0;t<Mi;t++){const n=Ci[t],{isEnabled:s,Feature:i,ProjectionNode:o,MeasureLayout:l}=D[n];o&&(r=o),s(e)&&(!this.features[n]&&i&&(this.features[n]=new i(this)),l&&(a=l))}if(!this.projection&&r){this.projection=new r(i,this.latestValues,this.parent&&this.parent.projection);const{layoutId:t,layout:n,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:h}=e;this.projection.setOptions({layoutId:t,layout:n,alwaysMeasureLayout:Boolean(s)||a&&u(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:o,layoutScroll:l,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const e=this.features[t];e.isMounted?e.update(this.props,this.prevProps):(e.mount(),e.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,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}makeTargetAnimatable(t,e=!0){return this.makeTargetAnimatableFromInstance(t,this.props,e)}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Di.length;e++){const n=Di[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){const{willChange:s}=e;for(const i in e){const o=e[i],r=n[i];if(c(o))t.addValue(i,o),mi(s)&&s.add(i);else if(c(r))t.addValue(i,Wn(o,{owner:t})),mi(s)&&s.remove(i);else if(r!==o)if(t.hasValue(i)){const e=t.getValue(i);!e.hasAnimated&&e.set(o)}else{const e=t.getStaticValue(i);t.addValue(i,Wn(void 0!==e?e:o,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<ki;t++){const n=Li[t],s=this.props[n];(w(s)||!1===s)&&(e[n]=s)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){e!==this.values.get(t)&&(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=Wn(e,{owner:this}),this.addValue(t,n)),n}readValue(t){return void 0===this.latestValues[t]&&this.current?this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props,s="string"==typeof n||"object"==typeof n?null===(e=x(this.props,n))||void 0===e?void 0:e[t]:void 0;if(n&&void 0!==s)return s;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||c(i)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new Gn),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}{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]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:s},i){let o=function(t,e,n){const s={};for(const i in t){const t=Qs(i,e);if(void 0!==t)s[i]=t;else{const t=n.getValue(i);t&&(s[i]=t.get())}}return s}(n,t||{},this);if(s&&(e&&(e=s(e)),n&&(n=s(n)),o&&(o=s(o))),i){!function(t,e,n){var s,i;const o=Object.keys(e).filter(e=>!t.hasValue(e)),r=o.length;if(r)for(let a=0;a<r;a++){const r=o[a],l=e[r];let h=null;Array.isArray(l)&&(h=l[0]),null===h&&(h=null!==(i=null!==(s=n[r])&&void 0!==s?s:t.readValue(r))&&void 0!==i?i:e[r]),null!=h&&("string"==typeof h&&(/^\-?\d*\.?\d+$/.test(h)||Ws(h))?h=parseFloat(h):!Zs(h)&&ke.test(l)&&(h=Rn(r,l)),t.addValue(r,Wn(h,{owner:t})),void 0===n[r]&&(n[r]=h),null!==h&&t.setBaseTarget(r,h))}}(this,n,o);const t=ci(this,n,o,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class Bi extends Ri{readValueFromInstance(t,e){if(E.has(e)){const t=kn(e);return t&&t.default||0}{const s=(n=t,window.getComputedStyle(n)),i=(L(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return he(t,e)}build(t,e,n,s){k(t,e,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,e){return R(t,e)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;c(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=""+t)}))}renderInstance(t,e,n,s){B(t,e,n,s)}}class Fi extends W.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=t;j(Ii),i&&(e.group&&e.group.add(i),n&&n.register&&s&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),d.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:s,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,s||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||at.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),!t.currentAnimation&&t.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function ji(t){const[e,n]=function(){const t=q(F);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=Y();return X(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}(),s=q(I);return W.createElement(Fi,{...t,layoutGroup:s,switchLayoutGroup:q(U),isPresent:e,safeToRemove:n})}const Ii={borderRadius:{...Ns,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ns,borderTopRightRadius:Ns,borderBottomLeftRadius:Ns,borderBottomRightRadius:Ns,boxShadow:Hs},Ui={pan:{Feature:class extends K{constructor(){super(...arguments),this.removePointerDownListener=Z}onPointerDown(t){this.session=new xt(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:t,onStart:e,onMove:n,onEnd:(t,e)=>{delete this.session,s&&s(t,e)}}}mount(){this.removePointerDownListener=ft(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 K{constructor(t){super(t),this.removeGroupControls=Z,this.removeListeners=Z,this.controls=new On(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Z}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Us,MeasureLayout:ji}},Oi={layout:{ProjectionNode:Us,MeasureLayout:ji}};let Ni=0;const zi={animation:{Feature:class extends K{constructor(t){super(t),t.animationState||(t.animationState=Ei(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),S(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends K{constructor(){super(...arguments),this.id=Ni++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e,custom:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive(Wt.Exit,!t,{custom:null!=n?n:this.node.getProps().custom});e&&!t&&i.then(()=>e(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function $i(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End");return ft(t.current,n,(n,i)=>{if("touch"===n.type||Dt())return;const o=t.getProps();t.animationState&&o.whileHover&&t.animationState.setActive(Wt.Hover,e),o[s]&&o[s](n,i)},{passive:!t.getProps()[s]})}const Gi=(t,e)=>!!e&&(t===e||Gi(t,e.parentElement));function Hi(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,J(n))}const Wi=new WeakMap,qi=new WeakMap,Yi=t=>{const e=Wi.get(t.target);e&&e(t)},Xi=t=>{t.forEach(Yi)};function Ki(t,e,n){const s=function({root:t,...e}){const n=t||document;qi.has(n)||qi.set(n,{});const s=qi.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(Xi,{root:t,...e})),s[i]}(e);return Wi.set(t,n),s.observe(t),()=>{Wi.delete(t),s.unobserve(t)}}const Zi={some:0,all:1};const _i={inView:{Feature:class extends K{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:t}=this.node.getProps();t&&t(null),this.node.animationState&&this.node.animationState.setActive(Wt.InView,!0)})}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:s="some",once:i,fallback:o=!0}=t;if("undefined"==typeof IntersectionObserver)return void(o&&this.viewportFallback());const r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof s?s:Zi[s]};return Ki(this.node.current,r,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(Wt.InView,e);const{onViewportEnter:n,onViewportLeave:s}=this.node.getProps(),o=e?n:s;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 n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends K{constructor(){super(...arguments),this.removeStartListeners=Z,this.removeEndListeners=Z,this.removeAccessibleListeners=Z,this.startPointerPress=(t,e)=>{if(this.removeEndListeners(),this.isPressing)return;const n=this.node.getProps(),s=ft(window,"pointerup",(t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:s}=this.node.getProps();Gi(this.node.current,t.target)?n&&n(t,e):s&&s(t,e)},{passive:!(n.onTap||n.onPointerUp)}),i=ft(window,"pointercancel",(t,e)=>this.cancelPress(t,e),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=yt(s,i),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=mt(this.node.current,"keydown",t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=mt(this.node.current,"keyup",t=>{"Enter"===t.key&&this.checkPressEnd()&&Hi("up",this.node.getProps().onTap)}),Hi("down",(t,e)=>{this.startPress(t,e)})}),e=mt(this.node.current,"blur",()=>{this.isPressing&&Hi("cancel",(t,e)=>this.cancelPress(t,e))});this.removeAccessibleListeners=yt(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive(Wt.Tap,!0),n&&n(t,e)}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive(Wt.Tap,!1),!Dt()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&n(t,e)}mount(){const t=this.node.getProps(),e=ft(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=mt(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=yt(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends K{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(Wt.Focus,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(Wt.Focus,!1),this.isActive=!1)}mount(){this.unmount=yt(mt(this.node.current,"focus",()=>this.onFocus()),mt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends K{mount(){this.unmount=yt($i(this.node,!0),$i(this.node,!1))}unmount(){}}}};class Ji extends Ri{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(E.has(e)){const t=kn(e);return t&&t.default||0}return e=O.has(e)?e:A(e),t.getAttribute(e)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(t,e){return N(t,e)}build(t,e,n,s){z(t,e,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,e,n,s){$(t,e,n,s)}mount(t){this.isSVGTag=G(t.tagName),super.mount(t)}}const Qi={...{renderer:(t,e)=>H(t)?new Ji(e,{enableHardwareAcceleration:!1}):new Bi(e,{enableHardwareAcceleration:!0}),...zi,..._i},...Ui,...Oi};export{Qi as domMax};
1
+ import{t,u as e,v as n,w as s,x as i,y as o,z as r,A as a,B as l,C as h,a as u,d as c,D as p,g as d,r as m,E as f,F as g,G as y,H as v,o as x,I as P,J as T,K as b,i as V,M as A,N as E,n as S,c as w,b as C,m as M,f as D,O as L,h as k,q as R,Q as B,P as F,R as j,L as I,S as U,T as O,s as N,j as z,p as $,k as G,l as H}from"./size-rollup-dom-max-assets.js";import W,{useContext as q,useId as Y,useEffect as X}from"react";class K{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Z=t=>t;const _=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary;function J(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const Q="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),tt="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Q()),1/60*1e3);const et={delta:0,timestamp:0};let nt=!0,st=!1,it=!1;const ot=["read","update","preRender","render","postRender"],rt=ot.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],s=0,i=!1,o=!1;const r=new WeakSet,a={schedule:(t,o=!1,a=!1)=>{const l=a&&i,h=l?e:n;return o&&r.add(t),-1===h.indexOf(t)&&(h.push(t),l&&i&&(s=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),r.delete(t)},process:l=>{if(i)o=!0;else{if(i=!0,[e,n]=[n,e],n.length=0,s=e.length,s)for(let n=0;n<s;n++){const s=e[n];s(l),r.has(s)&&(a.schedule(s),t())}i=!1,o&&(o=!1,a.process(l))}}};return a}(()=>st=!0),t),{}),at=ot.reduce((t,e)=>{const n=rt[e];return t[e]=(t,e=!1,s=!1)=>(st||pt(),n.schedule(t,e,s)),t},{}),lt=ot.reduce((t,e)=>(t[e]=rt[e].cancel,t),{}),ht=ot.reduce((t,e)=>(t[e]=()=>rt[e].process(et),t),{}),ut=t=>rt[t].process(et),ct=t=>{st=!1,et.delta=nt?1/60*1e3:Math.max(Math.min(t-et.timestamp,40),1),et.timestamp=t,it=!0,ot.forEach(ut),it=!1,st&&(nt=!1,tt(ct))},pt=()=>{st=!0,nt=!0,it||tt(ct)},dt=t=>1e3*t;function mt(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function ft(t,e,n,s){return mt(t,e,(t=>e=>_(e)&&t(e,J(e)))(n),s)}const gt=(t,e)=>n=>e(t(n)),yt=(...t)=>t.reduce(gt),vt=(t,e)=>Math.abs(t-e);class xt{constructor(t,e,{transformPagePoint:n}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=bt(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=vt(t.x,e.x),s=vt(t.y,e.y);return Math.sqrt(n**2+s**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!n)return;const{point:s}=t,{timestamp:i}=et;this.history.push({...s,timestamp:i});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=Pt(e,this.transformPagePoint),at.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{if(this.end(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const{onEnd:n,onSessionEnd:s}=this.handlers,i=bt("pointercancel"===t.type?this.lastMoveEventInfo:Pt(e,this.transformPagePoint),this.history);this.startEvent&&n&&n(t,i),s&&s(t,i)},!_(t))return;this.handlers=e,this.transformPagePoint=n;const s=Pt(J(t),this.transformPagePoint),{point:i}=s,{timestamp:o}=et;this.history=[{...i,timestamp:o}];const{onSessionStart:r}=e;r&&r(t,bt(s,this.history)),this.removeListeners=yt(ft(window,"pointermove",this.handlePointerMove),ft(window,"pointerup",this.handlePointerUp),ft(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),lt.update(this.updatePoint)}}function Pt(t,e){return e?{point:e(t.point)}:t}function Tt(t,e){return{x:t.x-e.x,y:t.y-e.y}}function bt({point:t},e){return{point:t,delta:Tt(t,At(e)),offset:Tt(t,Vt(e)),velocity:Et(e,.1)}}function Vt(t){return t[0]}function At(t){return t[t.length-1]}function Et(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const i=At(t);for(;n>=0&&(s=t[n],!(i.timestamp-s.timestamp>dt(e)));)n--;if(!s)return{x:0,y:0};const o=(i.timestamp-s.timestamp)/1e3;if(0===o)return{x:0,y:0};const r={x:(i.x-s.x)/o,y:(i.y-s.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function St(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const wt=St("dragHorizontal"),Ct=St("dragVertical");function Mt(t){let e=!1;if("y"===t)e=Ct();else if("x"===t)e=wt();else{const t=wt(),n=Ct();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}function Dt(){const t=Mt(!0);return!t||(t(),!1)}const Lt=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s},kt=(t,e,n)=>-n*t+n*e+t;function Rt(t){return t.max-t.min}function Bt(t,e=0,n=.01){return Math.abs(t-e)<=n}function Ft(t,e,n,s=.5){t.origin=s,t.originPoint=kt(e.min,e.max,t.origin),t.scale=Rt(n)/Rt(e),(Bt(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=kt(n.min,n.max,t.origin)-t.originPoint,(Bt(t.translate)||isNaN(t.translate))&&(t.translate=0)}function jt(t,e,n,s){Ft(t.x,e.x,n.x,s?s.originX:void 0),Ft(t.y,e.y,n.y,s?s.originY:void 0)}function It(t,e,n){t.min=n.min+e.min,t.max=t.min+Rt(e)}function Ut(t,e,n){t.min=e.min-n.min,t.max=t.min+Rt(e)}function Ot(t,e,n){Ut(t.x,e.x,n.x),Ut(t.y,e.y,n.y)}function Nt(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function zt(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}const $t=.35;function Gt(t,e,n){return{min:Ht(t,e),max:Ht(t,n)}}function Ht(t,e){return"number"==typeof t?t:t[e]||0}var Wt;!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(Wt||(Wt={}));function qt(t){return[t("x"),t("y")]}function Yt({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function Xt(t){return void 0===t||1===t}function Kt({scale:t,scaleX:e,scaleY:n}){return!Xt(t)||!Xt(e)||!Xt(n)}function Zt(t){return Kt(t)||_t(t)||t.z||t.rotate||t.rotateX||t.rotateY}function _t(t){return Jt(t.x)||Jt(t.y)}function Jt(t){return t&&"0%"!==t}function Qt(t,e,n){return n+e*(t-n)}function te(t,e,n,s,i){return void 0!==i&&(t=Qt(t,i,s)),Qt(t,n,s)+e}function ee(t,e=0,n=1,s,i){t.min=te(t.min,e,n,s,i),t.max=te(t.max,e,n,s,i)}function ne(t,{x:e,y:n}){ee(t.x,e.translate,e.scale,e.originPoint),ee(t.y,n.translate,n.scale,n.originPoint)}function se(t){return Number.isInteger(t)||t>1.0000000000001||t<.999999999999?t:1}function ie(t,e){t.min=t.min+e,t.max=t.max+e}function oe(t,e,[n,s,i]){const o=void 0!==e[i]?e[i]:.5,r=kt(t.min,t.max,o);ee(t,e[n],e[s],r,e.scale)}const re=["x","scaleX","originX"],ae=["y","scaleY","originY"];function le(t,e){oe(t.x,e,re),oe(t.y,e,ae)}function he(t,e){return Yt(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const ue=!1,ce=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,pe=t=>e=>1-t(1-e),de=t=>t*t,me=pe(de),fe=ce(de),ge=(t,s)=>i=>Boolean(e(i)&&n.test(i)&&i.startsWith(t)||s&&Object.prototype.hasOwnProperty.call(i,s)),ye=(t,n,i)=>o=>{if(!e(o))return o;const[r,a,l,h]=o.match(s);return{[t]:parseFloat(r),[n]:parseFloat(a),[i]:parseFloat(l),alpha:void 0!==h?parseFloat(h):1}},ve={...r,transform:e=>Math.round((e=>t(0,255,e))(e))},xe={test:ge("rgb","red"),parse:ye("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+ve.transform(t)+", "+ve.transform(e)+", "+ve.transform(n)+", "+i(o.transform(s))+")"};const Pe={test:ge("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:xe.transform},Te={test:ge("hsl","hue"),parse:ye("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+a.transform(i(e))+", "+a.transform(i(n))+", "+i(o.transform(s))+")"},be={test:t=>xe.test(t)||Pe.test(t)||Te.test(t),parse:t=>xe.test(t)?xe.parse(t):Te.test(t)?Te.parse(t):Pe.parse(t),transform:t=>e(t)?t:t.hasOwnProperty("red")?xe.transform(t):Te.transform(t)};function Ve(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}const Ae=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},Ee=[Pe,xe,Te];function Se(t){const e=(n=t,Ee.find(t=>t.test(n)));var n;let s=e.parse(t);return e===Te&&(s=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let i=0,o=0,r=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;i=Ve(a,s,t+1/3),o=Ve(a,s,t),r=Ve(a,s,t-1/3)}else i=o=r=n;return{red:Math.round(255*i),green:Math.round(255*o),blue:Math.round(255*r),alpha:s}}(s)),s}const we=(t,e)=>{const n=Se(t),s=Se(e),i={...n};return t=>(i.red=Ae(n.red,s.red,t),i.green=Ae(n.green,s.green,t),i.blue=Ae(n.blue,s.blue,t),i.alpha=kt(n.alpha,s.alpha,t),xe.transform(i))};function Ce(t){"number"==typeof t&&(t=""+t);const e=[];let n=0,i=0;const o=t.match(l);o&&(n=o.length,t=t.replace(l,"${c}"),e.push(...o.map(be.parse)));const a=t.match(s);return a&&(i=a.length,t=t.replace(s,"${n}"),e.push(...a.map(r.parse))),{values:e,numColors:n,numNumbers:i,tokenised:t}}function Me(t){return Ce(t).values}function De(t){const{values:e,numColors:n,tokenised:s}=Ce(t),o=e.length;return t=>{let e=s;for(let s=0;s<o;s++)e=e.replace(s<n?"${c}":"${n}",s<n?be.transform(t[s]):i(t[s]));return e}}const Le=t=>"number"==typeof t?0:t;const ke={test:function(t){var n,i;return isNaN(t)&&e(t)&&((null===(n=t.match(s))||void 0===n?void 0:n.length)||0)+((null===(i=t.match(l))||void 0===i?void 0:i.length)||0)>0},parse:Me,createTransformer:De,getAnimatableNone:function(t){const e=Me(t);return De(t)(e.map(Le))}};function Re(t,e){return"number"==typeof t?n=>kt(t,e,n):be.test(t)?we(t,e):je(t,e)}const Be=(t,e)=>{const n=[...t],s=n.length,i=t.map((t,n)=>Re(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=i[e](t);return n}},Fe=(t,e)=>{const n={...t,...e},s={};for(const i in n)void 0!==t[i]&&void 0!==e[i]&&(s[i]=Re(t[i],e[i]));return t=>{for(const e in s)n[e]=s[e](t);return n}},je=(t,e)=>{const n=ke.createTransformer(e),s=Ce(t),i=Ce(e);return s.numColors===i.numColors&&s.numNumbers>=i.numNumbers?yt(Be(s.values,i.values),n):n=>""+(n>0?e:t)},Ie=(t,e)=>n=>kt(t,e,n);function Ue(t,e,n){const s=[],i=n||("number"==typeof(o=t[0])?Ie:"string"==typeof o?be.test(o)?we:je:Array.isArray(o)?Be:"object"==typeof o?Fe:Ie);var o;const r=t.length-1;for(let n=0;n<r;n++){let o=i(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;o=yt(t,o)}s.push(o)}return s}function Oe(e,n,{clamp:s=!0,ease:i,mixer:o}={}){const r=e.length;n.length,!i||!Array.isArray(i)||i.length,e[0]>e[r-1]&&(e=[...e].reverse(),n=[...n].reverse());const a=Ue(n,i,o),l=a.length,h=t=>{let n=0;if(l>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=Lt(e[n],e[n+1],t);return a[n](s)};return s?n=>h(t(e[0],e[r-1],n)):h}const Ne=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function ze(t,e,n,s){if(t===e&&n===s)return Z;const i=e=>function(t,e,n,s,i){let o,r,a=0;do{r=e+(n-e)/2,o=Ne(r,s,i)-t,o>0?n=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(e,0,1,t,n);return t=>0===t||1===t?t:Ne(i(t),e,s)}const $e=t=>1-Math.sin(Math.acos(t)),Ge=pe($e),He=ce(Ge),We=ze(.33,1.53,.69,.99),qe=pe(We),Ye=ce(qe),Xe={linear:Z,easeIn:de,easeInOut:fe,easeOut:me,circIn:$e,circInOut:He,circOut:Ge,backIn:qe,backInOut:Ye,backOut:We,anticipate:t=>(t*=2)<1?.5*qe(t):.5*(2-Math.pow(2,-10*(t-1)))},Ke=t=>{if(Array.isArray(t)){t.length;const[e,n,s,i]=t;return ze(e,n,s,i)}return"string"==typeof t?Xe[t]:t};function Ze({keyframes:t,ease:e=fe,times:n,duration:s=300}){t=[...t];const i=(t=>Array.isArray(t)&&"number"!=typeof t[0])(e)?e.map(Ke):Ke(e),o={done:!1,value:t[0]},r=function(t,e){return t.map(t=>t*e)}(n&&n.length===t.length?n:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(t),s);function a(){return Oe(r,t,{ease:Array.isArray(i)?i:(e=t,n=i,e.map(()=>n||fe).splice(0,e.length-1))});var e,n}let l=a();return{next:t=>(o.value=l(t),o.done=t>=s,o),flipTarget:()=>{t.reverse(),l=a()}}}function _e({duration:e=800,bounce:n=.25,velocity:s=0,mass:i=1}){let o,r,a=1-n;a=t(.05,1,a),e=t(.01,10,e/1e3),a<1?(o=t=>{const n=t*a,i=n*e;return.001-(n-s)/Je(t,a)*Math.exp(-i)},r=t=>{const n=t*a*e,i=n*s+s,r=Math.pow(a,2)*Math.pow(t,2)*e,l=Math.exp(-n),h=Je(Math.pow(t,2),a);return(.001-o(t)>0?-1:1)*((i-r)*l)/h}):(o=t=>Math.exp(-t*e)*((t-s)*e+1)-.001,r=t=>Math.exp(-t*e)*(e*e*(s-t)));const l=function(t,e,n){let s=n;for(let n=1;n<12;n++)s-=t(s)/e(s);return s}(o,r,5/e);if(e*=1e3,isNaN(l))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(l,2)*i;return{stiffness:t,damping:2*a*Math.sqrt(i*t),duration:e}}}function Je(t,e){return t*Math.sqrt(1-e*e)}function Qe(t,e){return e?t*(1e3/e):0}const tn=["duration","bounce"],en=["stiffness","damping","mass"];function nn(t,e){return e.some(e=>void 0!==t[e])}function sn({keyframes:t,restDelta:e,restSpeed:n,...s}){let i=t[0],o=t[t.length-1];const r={done:!1,value:i},{stiffness:a,damping:l,mass:h,velocity:u,duration:c,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!nn(t,en)&&nn(t,tn)){const n=_e(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}(s);let d=on,m=u?-u/1e3:0;const f=l/(2*Math.sqrt(a*h));function g(){const t=o-i,s=Math.sqrt(a/h)/1e3,r=Math.abs(t)<5;if(n||(n=r?.01:2),e||(e=r?.005:.5),f<1){const e=Je(s,f);d=n=>{const i=Math.exp(-f*s*n);return o-i*((m+f*s*t)/e*Math.sin(e*n)+t*Math.cos(e*n))}}else if(1===f)d=e=>o-Math.exp(-s*e)*(t+(m+s*t)*e);else{const e=s*Math.sqrt(f*f-1);d=n=>{const i=Math.exp(-f*s*n),r=Math.min(e*n,300);return o-i*((m+f*s*t)*Math.sinh(r)+e*t*Math.cosh(r))/e}}}return g(),{next:t=>{const s=d(t);if(p)r.done=t>=c;else{let i=m;if(0!==t)if(f<1){const e=Math.max(0,t-5);i=Qe(s-d(e),t-e)}else i=0;const a=Math.abs(i)<=n,l=Math.abs(o-s)<=e;r.done=a&&l}return r.value=r.done?o:s,r},flipTarget:()=>{m=-m,[i,o]=[o,i],g()}}}sn.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const on=t=>0;const rn={decay:function({keyframes:t=[0],velocity:e=0,power:n=.8,timeConstant:s=350,restDelta:i=.5,modifyTarget:o}){const r=t[0],a={done:!1,value:r};let l=n*e;const h=r+l,u=void 0===o?h:o(h);return u!==h&&(l=u-r),{next:t=>{const e=-l*Math.exp(-t/s);return a.done=!(e>i||e<-i),a.value=a.done?u:u+e,a},flipTarget:()=>{}}},keyframes:Ze,tween:Ze,spring:sn};function an(t,e,n=0){return t-e-n}const ln=t=>{const e=({delta:e})=>t(e);return{start:()=>at.update(e,!0),stop:()=>lt.update(e)}};function hn({duration:t,driver:e=ln,elapsed:n=0,repeat:s=0,repeatType:i="loop",repeatDelay:o=0,keyframes:r,autoplay:a=!0,onPlay:l,onStop:h,onComplete:u,onRepeat:c,onUpdate:p,type:d="keyframes",...m}){const f=n;let g,y,v=0,x=t,P=!1,T=!0;const b=rn[r.length>2?"keyframes":d]||Ze,V=r[0],A=r[r.length-1];let E={done:!1,value:V};const{needsInterpolation:S}=b;S&&S(V,A)&&(y=Oe([0,100],[V,A],{clamp:!1}),r=[0,100]);const w=b({...m,duration:t,keyframes:r});function C(){v++,"reverse"===i?(T=v%2==0,n=function(t,e=0,n=0,s=!0){return s?an(e+-t,e,n):e-(t-e)+n}(n,x,o,T)):(n=an(n,x,o),"mirror"===i&&w.flipTarget()),P=!1,c&&c()}function M(t){T||(t=-t),n+=t,P||(E=w.next(Math.max(0,n)),y&&(E.value=y(E.value)),P=T?E.done:n<=0),p&&p(E.value),P&&(0===v&&(x=void 0!==x?x:n),v<s?function(t,e,n,s){return s?t>=e+n:t<=-n}(n,x,o,T)&&C():(g&&g.stop(),u&&u()))}return a&&(l&&l(),g=e(M),g.start()),{stop:()=>{h&&h(),g&&g.stop()},set currentTime(t){n=f,M(t)},sample:e=>{n=f;const s=t&&"number"==typeof t?Math.max(.5*t,50):50;let i=0;for(M(0);i<=e;){const t=e-i;M(Math.min(t,s)),i+=s}return E}}}const un=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,cn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:un([0,.65,.55,1]),circOut:un([.55,0,1,.45]),backIn:un([.31,.01,.66,-.59]),backOut:un([.33,1.53,.69,.99])};function pn(t){if(t)return Array.isArray(t)?un(t):cn[t]}const dn={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},mn={},fn={};for(const t in dn)fn[t]=()=>(void 0===mn[t]&&(mn[t]=dn[t]()),mn[t]);const gn=new Set(["opacity"]);function yn(t,e,{onUpdate:n,onComplete:s,...i}){if(!(fn.waapi()&&gn.has(e)&&!i.repeatDelay&&"mirror"!==i.repeatType&&0!==i.damping))return!1;let{keyframes:o,duration:r=300,elapsed:a=0,ease:l}=i;if("spring"===i.type||!(!(h=i.ease)||Array.isArray(h)||"string"==typeof h&&cn[h])){if(i.repeat===1/0)return;const t=hn({...i,elapsed:0});let e={done:!1,value:o[0]};const n=[];let s=0;for(;!e.done&&s<2e4;)e=t.sample(s),n.push(e.value),s+=10;o=n,r=s-10,l="linear"}var h;const u=function(t,e,n,{delay:s=0,duration:i,repeat:o=0,repeatType:r="loop",ease:a,times:l}={}){return t.animate({[e]:n,offset:l},{delay:s,duration:i,easing:pn(a),fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"})}(t.owner.current,e,o,{...i,delay:-a,duration:r,ease:l});return u.onfinish=()=>{t.set(function(t,{repeat:e,repeatType:n="loop"}){return t[e&&"loop"!==n&&e%2==1?0:t.length-1]}(o,i)),at.update(()=>u.cancel()),s&&s()},{get currentTime(){return u.currentTime||0},set currentTime(t){u.currentTime=t},stop:()=>{const{currentTime:e}=u;if(e){const n=hn({...i,autoplay:!1});t.setWithVelocity(n.sample(e-10).value,n.sample(e).value,10)}at.update(()=>u.cancel())}}}function vn(t,e){const n=performance.now(),s=({timestamp:i})=>{const o=i-n;o>=e&&(lt.read(s),t(o-e))};return at.read(s,!0),()=>lt.read(s)}function xn({keyframes:t,elapsed:e,onUpdate:n,onComplete:s}){const i=()=>{n&&n(t[t.length-1]),s&&s()};return e?{stop:vn(i,-e)}:i()}const Pn=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Tn=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),bn=()=>({type:"keyframes",ease:"linear",duration:.3}),Vn={type:"keyframes",duration:.8},An={x:Pn,y:Pn,z:Pn,rotate:Pn,rotateX:Pn,rotateY:Pn,rotateZ:Pn,scaleX:Tn,scaleY:Tn,scale:Tn,opacity:bn,backgroundColor:bn,color:bn,default:Tn},En=(t,{keyframes:e})=>{if(e.length>2)return Vn;return(An[t]||An.default)(e[1])},Sn=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!ke.test(e)||e.startsWith("url("))),wn=new Set(["brightness","contrast","saturate","opacity"]);function Cn(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(s)||[];if(!i)return t;const o=n.replace(i,"");let r=wn.has(e)?1:0;return i!==n&&(r*=100),e+"("+r+o+")"}const Mn=/([a-z-]*)\(.*?\)/g,Dn={...ke,getAnimatableNone:t=>{const e=t.match(Mn);return e?e.map(Cn).join(" "):t}},Ln={...h,color:be,backgroundColor:be,outlineColor:be,fill:be,stroke:be,borderColor:be,borderTopColor:be,borderRightColor:be,borderBottomColor:be,borderLeftColor:be,filter:Dn,WebkitFilter:Dn},kn=t=>Ln[t];function Rn(t,e){let n=kn(t);return n!==Dn&&(n=ke),n.getAnimatableNone?n.getAnimatableNone(e):void 0}function Bn(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Fn(t){return"number"==typeof t?0:Rn("",t)}function jn(t,e){return t[e]||t.default||t}const In=(t,e,n,s={})=>i=>{const o=jn(s,t)||{},r=o.delay||s.delay||0;let{elapsed:a=0}=s;a-=dt(r);const l=function(t,e,n,s){const i=Sn(e,n);let o=void 0!==s.from?s.from:t.get();return"none"===o&&i&&"string"==typeof n?o=Rn(e,n):Bn(o)&&"string"==typeof n?o=Fn(n):!Array.isArray(n)&&Bn(n)&&"string"==typeof o&&(n=Fn(o)),Array.isArray(n)?(null===n[0]&&(n[0]=o),n):[o,n]}(e,t,n,o),h=l[0],u=l[l.length-1],c=Sn(t,h),p=Sn(t,u);let d={keyframes:l,velocity:e.getVelocity(),...o,elapsed:a,onUpdate:t=>{e.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(!c||!p||ue||!1===o.type)return xn(d);if("inertia"===o.type)return function({keyframes:t,velocity:e=0,min:n,max:s,power:i=.8,timeConstant:o=750,bounceStiffness:r=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:h,driver:u,onUpdate:c,onComplete:p,onStop:d}){const m=t[0];let f;function g(t){return void 0!==n&&t<n||void 0!==s&&t>s}function y(t){return void 0===n?s:void 0===s||Math.abs(n-t)<Math.abs(s-t)?n:s}function v(t){f&&f.stop(),f=hn({keyframes:[0,1],velocity:0,...t,driver:u,onUpdate:e=>{c&&c(e),t.onUpdate&&t.onUpdate(e)},onComplete:p,onStop:d})}function x(t){v({type:"spring",stiffness:r,damping:a,restDelta:l,...t})}if(g(m))x({velocity:e,keyframes:[m,y(m)]});else{let t=i*e+m;void 0!==h&&(t=h(t));const s=y(t),r=s===n?-1:1;let a,u;const c=t=>{a=u,u=t,e=Qe(t-a,et.delta),(1===r&&t>s||-1===r&&t<s)&&x({keyframes:[t,s],velocity:e})};v({type:"decay",keyframes:[m,0],velocity:e,timeConstant:o,power:i,restDelta:l,modifyTarget:h,onUpdate:g(t)?c:void 0})}return{stop:()=>f&&f.stop()}}(d);if(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:i,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length}(o)||(d={...d,...En(t,d)}),d.duration&&(d.duration=dt(d.duration)),d.repeatDelay&&(d.repeatDelay=dt(d.repeatDelay)),e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const n=yn(e,t,d);if(n)return n}return hn(d)},Un=new WeakMap;class On{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;this.panSession=new xt(t,{onSessionStart:t=>{this.stopAnimation(),e&&this.snapToCursor(J(t,"page").point)},onStart:(t,e)=>{const{drag:n,dragPropagation:s,onDragStart:i}=this.getProps();if(n&&!s&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Mt(n),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),qt(t=>{let e=this.getAxisMotionValue(t).get()||0;if(a.test(e)){const{projection:n}=this.visualElement;if(n&&n.layout){const s=n.layout.layoutBox[t];if(s){e=Rt(s)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),i&&i(t,e);const{animationState:o}=this.visualElement;o&&o.setActive(Wt.Drag,!0)},onMove:(t,e)=>{const{dragPropagation:n,dragDirectionLock:s,onDirectionLock:i,onDrag:o}=this.getProps();if(!n&&!this.openGlobalLock)return;const{offset:r}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(r),void(null!==this.currentDirection&&i&&i(this.currentDirection));this.updateAxis("x",e.point,r),this.updateAxis("y",e.point,r),this.visualElement.render(),o&&o(t,e)},onSessionEnd:(t,e)=>this.stop(t,e)},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,e){const n=this.isDragging;if(this.cancel(),!n)return;const{velocity:s}=e;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&i(t,e)}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),e&&e.setActive(Wt.Drag,!1)}updateAxis(t,e,n){const{drag:s}=this.getProps();if(!n||!Nn(t,s,this.currentDirection))return;const i=this.getAxisMotionValue(t);let o=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:n},s){return void 0!==e&&t<e?t=s?kt(e,t,s.min):Math.max(t,e):void 0!==n&&t>n&&(t=s?kt(n,t,s.max):Math.min(t,n)),t}(o,this.constraints[t],this.elastic[t])),i.set(o)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),{layout:n}=this.visualElement.projection||{},s=this.constraints;t&&u(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!n)&&function(t,{top:e,left:n,bottom:s,right:i}){return{x:Nt(t.x,n,i),y:Nt(t.y,e,s)}}(n.layoutBox,t),this.elastic=function(t=$t){return!1===t?t=0:!0===t&&(t=$t),{x:Gt(t,"left","right"),y:Gt(t,"top","bottom")}}(e),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&qt(t=>{this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(n.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!u(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=function(t,e,n){const s=he(t,n),{scroll:i}=e;return i&&(ie(s.x,i.offset.x),ie(s.y,i.offset.y)),s}(n,s.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:zt(t.x,e.x),y:zt(t.y,e.y)}}(s.layout.layoutBox,i);if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=Yt(t))}return o}startAnimation(t){const{drag:e,dragMomentum:n,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=qt(r=>{if(!Nn(r,e,this.currentDirection))return;let l=a&&a[r]||{};o&&(l={min:0,max:0});const h=s?200:1e6,u=s?40:1e7,c={type:"inertia",velocity:n?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return n.start(In(t,n,0,e))}stopAnimation(){qt(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const e="_drag"+t.toUpperCase(),n=this.visualElement.getProps(),s=n[e];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){qt(e=>{const{drag:n}=this.getProps();if(!Nn(e,n,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(e);if(s&&s.layout){const{min:n,max:o}=s.layout.layoutBox[e];i.set(t[e]-kt(n,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!u(n)||!s||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};qt(e=>{const n=this.getAxisMotionValue(e);if(n){const s=n.get();i[e]=function(e,n){let s=.5;const i=Rt(e),o=Rt(n);return o>i?s=Lt(n.min,n.max-i,e.min):i>o&&(s=Lt(e.min,e.max-o,n.min)),t(0,1,s)}({min:s,max:s},this.constraints[e])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),qt(t=>{if(!Nn(t,e,null))return;const n=this.getAxisMotionValue(t),{min:s,max:o}=this.constraints[t];n.set(kt(s,o,i[t]))})}addListeners(){if(!this.visualElement.current)return;Un.set(this.visualElement,this);const t=ft(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:n=!0}=this.getProps();e&&n&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();u(t)&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,s=n.addEventListener("measure",e);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),e();const i=mt(window,"resize",()=>this.scalePositionWithinConstraints()),o=n.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(qt(e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))}),this.visualElement.render())});return()=>{i(),t(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=$t,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:n,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:r}}}function Nn(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}function zn(t,e){-1===t.indexOf(e)&&t.push(e)}function $n(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class Gn{constructor(){this.subscriptions=[]}add(t){return zn(this.subscriptions,t),()=>$n(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Hn{constructor(t,e={}){var n;this.version="9.0.6",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:s}=et;this.lastUpdated!==s&&(this.timeDelta=n,this.lastUpdated=s,at.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>at.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(n=this.current,!isNaN(parseFloat(n))),this.owner=e.owner}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Gn);const n=this.events[t].add(e);return"change"===t?()=>{n(),at.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,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,n){this.set(e),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Qe(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e)||null,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(){this.animation=null}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Wn(t,e){return new Hn(t,e)}const qn=["TopLeft","TopRight","BottomLeft","BottomRight"],Yn=qn.length,Xn=t=>"string"==typeof t?parseFloat(t):t,Kn=t=>"number"==typeof t||p.test(t);function Zn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const _n=Qn(0,.5,Ge),Jn=Qn(.5,.95,Z);function Qn(t,e,n){return s=>s<t?0:s>e?1:n(Lt(t,e,s))}function ts(t,e){t.min=e.min,t.max=e.max}function es(t,e){ts(t.x,e.x),ts(t.y,e.y)}function ns(t,e,n,s,i){return t=Qt(t-=e,1/n,s),void 0!==i&&(t=Qt(t,1/i,s)),t}function ss(t,e,[n,s,i],o,r){!function(t,e=0,n=1,s=.5,i,o=t,r=t){if(a.test(e)){e=parseFloat(e);e=kt(r.min,r.max,e/100)-r.min}if("number"!=typeof e)return;let l=kt(o.min,o.max,s);t===o&&(l-=e),t.min=ns(t.min,e,n,l,i),t.max=ns(t.max,e,n,l,i)}(t,e[n],e[s],e[i],e.scale,o,r)}const is=["x","scaleX","originX"],os=["y","scaleY","originY"];function rs(t,e,n,s){ss(t.x,e,is,n?n.x:void 0,s?s.x:void 0),ss(t.y,e,os,n?n.y:void 0,s?s.y:void 0)}function as(t){return 0===t.translate&&1===t.scale}function ls(t){return as(t.x)&&as(t.y)}function hs(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function us(t){return Rt(t.x)/Rt(t.y)}class cs{constructor(){this.members=[]}add(t){zn(this.members,t),t.scheduleRender()}remove(t){if($n(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 n;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,e&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;!1===s&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:n}=t;e.onExitComplete&&e.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function ps(t,e,n){let s="";const i=t.x.translate/e.x,o=t.y.translate/e.y;if((i||o)&&(s=`translate3d(${i}px, ${o}px, 0) `),1===e.x&&1===e.y||(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{rotate:t,rotateX:e,rotateY:i}=n;t&&(s+=`rotate(${t}deg) `),e&&(s+=`rotateX(${e}deg) `),i&&(s+=`rotateY(${i}deg) `)}const r=t.x.scale*e.x,a=t.y.scale*e.y;return 1===r&&1===a||(s+=`scale(${r}, ${a})`),s||"none"}const ds=(t,e)=>t.depth-e.depth;class ms{constructor(){this.children=[],this.isDirty=!1}add(t){zn(this.children,t),this.isDirty=!0}remove(t){$n(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(ds),this.isDirty=!1,this.children.forEach(t)}}const fs=["","X","Y","Z"];let gs=0;function ys({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:i}){return class{constructor(t,n={},s=(null==e?void 0:e())){this.id=gs++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isTransformDirty=!1,this.isProjectionDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.nodes.forEach(Ps),this.nodes.forEach(Es),this.nodes.forEach(Ss)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=t,this.latestValues=n,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0,t&&this.root.registerPotentialNode(t,this);for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new ms)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Gn),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const n=this.eventHandlers.get(t);n&&n.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}registerPotentialNode(t,e){this.potentialNodes.set(t,e)}mount(e,n=!1){if(this.instance)return;this.isSVG=e instanceof SVGElement&&"svg"!==e.tagName,this.instance=e;const{layoutId:s,layout:i,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.elementId&&this.root.potentialNodes.delete(this.elementId),n&&(i||s)&&(this.isLayoutDirty=!0),t){let n;const s=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=vn(s,250),d.hasAnimatedSinceResize&&(d.hasAnimatedSinceResize=!1,this.nodes.forEach(As))})}s&&this.root.registerSharedNode(s,this),!1!==this.options.animate&&o&&(s||i)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeTargetChanged:n,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const i=this.options.transition||o.getDefaultTransition()||ks,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=o.getProps(),l=!this.targetLayout||!hs(this.targetLayout,s)||n,h=!e&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,h);const e={...jn(i,"layout"),onPlay:r,onComplete:a};(o.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||0!==this.animationProgress||As(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=s})}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,lt.preRender(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(ws),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(!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:n}=this.options;if(void 0===e&&!n)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}didUpdate(){if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(bs);this.isUpdating&&(this.isUpdating=!1,this.potentialNodes.size&&(this.potentialNodes.forEach(Rs),this.potentialNodes.clear()),this.nodes.forEach(Vs),this.nodes.forEach(vs),this.nodes.forEach(xs),this.clearAllSnapshots(),ht.update(),ht.preRender(),ht.render())}clearAllSnapshots(){this.nodes.forEach(Ts),this.sharedNodes.forEach(Cs)}scheduleUpdateProjection(){at.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){at.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}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.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}},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);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e&&(this.scroll={animationId:this.root.animationId,phase:t,isRoot:s(this.instance),offset:n(this.instance)})}resetTransform(){if(!i)return;const t=this.isLayoutDirty||this.shouldResetTransform,e=this.projectionDelta&&!ls(this.projectionDelta),n=this.getTransformTemplate(),s=n?n(this.latestValues,""):void 0,o=s!==this.prevTransformTemplateValue;t&&(e||Zt(this.latestValues)||o)&&(i(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var s;return t&&(n=this.removeTransform(n)),Bs((s=n).x),Bs(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const e=t.measureViewportBox(),{scroll:n}=this.root;return n&&(ie(e.x,n.offset.x),ie(e.y,n.offset.y)),e}removeElementScroll(t){const e={x:{min:0,max:0},y:{min:0,max:0}};es(e,t);for(let n=0;n<this.path.length;n++){const s=this.path[n],{scroll:i,options:o}=s;if(s!==this.root&&i&&o.layoutScroll){if(i.isRoot){es(e,t);const{scroll:n}=this.root;n&&(ie(e.x,-n.offset.x),ie(e.y,-n.offset.y))}ie(e.x,i.offset.x),ie(e.y,i.offset.y)}}return e}applyTransform(t,e=!1){const n={x:{min:0,max:0},y:{min:0,max:0}};es(n,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&le(n,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),Zt(s.latestValues)&&le(n,s.latestValues)}return Zt(this.latestValues)&&le(n,this.latestValues),n}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};es(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!n.instance)continue;if(!Zt(n.latestValues))continue;Kt(n.latestValues)&&n.updateSnapshot();const s={x:{min:0,max:0},y:{min:0,max:0}};es(s,n.measurePageBox()),rs(e,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,s)}return Zt(this.latestValues)&&rs(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.isProjectionDirty=!0,this.root.scheduleUpdateProjection()}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}resolveTargetDelta(){const t=this.getLead();if(this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),!this.isProjectionDirty&&!this.attemptToResolveRelativeTarget)return;const{layout:e,layoutId:n}=this.options;if(this.layout&&(e||n)){if(!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout?(this.relativeParent=t,this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Ot(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),es(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}var s,i,o;if(this.relativeTarget||this.targetDelta)if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(s=this.target,i=this.relativeTarget,o=this.relativeParent.target,It(s.x,i.x,o.x),It(s.y,i.y,o.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):es(this.target,this.layout.layoutBox),ne(this.target,this.targetDelta)):es(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const t=this.getClosestProjectingParent();t&&Boolean(t.resumingFrom)===Boolean(this.resumingFrom)&&!t.options.layoutScroll&&t.target?(this.relativeParent=t,this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Ot(this.relativeTargetOrigin,this.target,t.target),es(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(this.parent&&!Kt(this.parent.latestValues)&&!_t(this.parent.latestValues))return(this.parent.relativeTarget||this.parent.targetDelta||this.parent.options.layoutRoot)&&this.parent.layout?this.parent:this.parent.getClosestProjectingParent()}calcProjection(){const{isProjectionDirty:t,isTransformDirty:e}=this;this.isProjectionDirty=this.isTransformDirty=!1;const n=this.getLead(),s=Boolean(this.resumingFrom)||this!==n;let i=!0;if(t&&(i=!1),s&&e&&(i=!1),i)return;const{layout:o,layoutId:r}=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||!o&&!r)return;es(this.layoutCorrected,this.layout.layoutBox),function(t,e,n,s=!1){const i=n.length;if(!i)return;let o,r;e.x=e.y=1;for(let a=0;a<i;a++){o=n[a],r=o.projectionDelta;const i=o.instance;i&&i.style&&"contents"===i.style.display||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&le(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,ne(t,r)),s&&Zt(o.latestValues)&&le(t,o.latestValues))}e.x=se(e.x),e.y=se(e.y)}(this.layoutCorrected,this.treeScale,this.path,s);const{target:a}=n;if(!a)return;this.projectionDelta||(this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}});const l=this.treeScale.x,h=this.treeScale.y,u=this.projectionTransform;jt(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.projectionTransform=ps(this.projectionDelta,this.treeScale),this.projectionTransform===u&&this.treeScale.x===l&&this.treeScale.y===h||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(t,e=!1){const n=this.snapshot,s=n?n.latestValues:{},i={...this.latestValues},o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const r={x:{min:0,max:0},y:{min:0,max:0}},l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),h=this.getStack(),u=!h||h.members.length<=1,c=Boolean(l&&!u&&!0===this.options.crossfade&&!this.path.some(Ls));this.animationProgress=0,this.mixTargetDelta=e=>{const n=e/1e3;var h,p,d,m;Ms(o.x,t.x,n),Ms(o.y,t.y,n),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ot(r,this.layout.layoutBox,this.relativeParent.layout.layoutBox),h=this.relativeTarget,p=this.relativeTargetOrigin,d=r,m=n,Ds(h.x,p.x,d.x,m),Ds(h.y,p.y,d.y,m)),l&&(this.animationValues=i,function(t,e,n,s,i,o){i?(t.opacity=kt(0,void 0!==n.opacity?n.opacity:1,_n(s)),t.opacityExit=kt(void 0!==e.opacity?e.opacity:1,0,Jn(s))):o&&(t.opacity=kt(void 0!==e.opacity?e.opacity:1,void 0!==n.opacity?n.opacity:1,s));for(let i=0;i<Yn;i++){const o=`border${qn[i]}Radius`;let r=Zn(e,o),l=Zn(n,o);if(void 0===r&&void 0===l)continue;r||(r=0),l||(l=0);0===r||0===l||Kn(r)===Kn(l)?(t[o]=Math.max(kt(Xn(r),Xn(l),s),0),(a.test(l)||a.test(r))&&(t[o]+="%")):t[o]=l}(e.rotate||n.rotate)&&(t.rotate=kt(e.rotate||0,n.rotate||0,s))}(i,s,this.latestValues,n,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(lt.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=at.update(()=>{d.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,n={}){const s=c(t)?t:Wn(t);return s.start(In("",s,e,n)),{stop:()=>s.stop(),isAnimating:()=>s.isAnimating()}}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},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:n,layout:s,latestValues:i}=t;if(e&&n&&s){if(this!==t&&this.layout&&s&&Fs(this.options.animationType,this.layout.layoutBox,s.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=Rt(this.layout.layoutBox.x);n.x.min=t.target.x.min,n.x.max=n.x.min+e;const s=Rt(this.layout.layoutBox.y);n.y.min=t.target.y.min,n.y.max=n.y.min+s}es(e,n),le(e,i),jt(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new cs);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){var t;const{layoutId:e}=this.options;return e&&(null===(t=this.getStack())||void 0===t?void 0:t.lead)||this}getPrevLead(){var t;const{layoutId:e}=this.options;return e?null===(t=this.getStack())||void 0===t?void 0:t.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){const s=this.getStack();s&&s.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:n}=t;if((n.rotate||n.rotateX||n.rotateY||n.rotateZ)&&(e=!0),!e)return;const s={};for(let e=0;e<fs.length;e++){const i="rotate"+fs[e];n[i]&&(s[i]=n[i],t.setStaticValue(i,0))}t.render();for(const e in s)t.setStaticValue(e,s[e]);t.scheduleRender()}getProjectionStyles(t={}){var e,n;const s={};if(!this.instance||this.isSVG)return s;if(!this.isVisible)return{visibility:"hidden"};s.visibility="";const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=m(t.pointerEvents)||"",s.transform=i?i(this.latestValues,""):"none",s;const o=this.getLead();if(!this.projectionDelta||!this.layout||!o.target){const e={};return this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=m(t.pointerEvents)||""),this.hasProjected&&!Zt(this.latestValues)&&(e.transform=i?i({},""):"none",this.hasProjected=!1),e}const r=o.animationValues||o.latestValues;this.applyTransformsToTarget(),s.transform=ps(this.projectionDeltaWithTransform,this.treeScale,r),i&&(s.transform=i(r,s.transform));const{x:a,y:l}=this.projectionDelta;s.transformOrigin=`${100*a.origin}% ${100*l.origin}% 0`,o.animationValues?s.opacity=o===this?null!==(n=null!==(e=r.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==n?n:1:this.preserveOpacity?this.latestValues.opacity:r.opacityExit:s.opacity=o===this?void 0!==r.opacity?r.opacity:"":void 0!==r.opacityExit?r.opacityExit:0;for(const t in f){if(void 0===r[t])continue;const{correct:e,applyTo:n}=f[t],i="none"===s.transform?r[t]:e(r[t],o);if(n){const t=n.length;for(let e=0;e<t;e++)s[n[e]]=i}else s[t]=i}return this.options.layoutId&&(s.pointerEvents=o===this?m(t.pointerEvents)||"":"none"),s}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(t=>{var e;return null===(e=t.currentAnimation)||void 0===e?void 0:e.stop()}),this.root.nodes.forEach(bs),this.root.sharedNodes.clear()}}}function vs(t){t.updateLayout()}function xs(t){var e;const n=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:i}=t.options,o=n.source!==t.layout.source;"size"===i?qt(t=>{const s=o?n.measuredBox[t]:n.layoutBox[t],i=Rt(s);s.min=e[t].min,s.max=s.min+i}):Fs(i,n.layoutBox,e)&&qt(t=>{const s=o?n.measuredBox[t]:n.layoutBox[t],i=Rt(e[t]);s.max=s.min+i});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};jt(r,e,n.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?jt(a,t.applyTransform(s,!0),n.measuredBox):jt(a,e,n.layoutBox);const l=!ls(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:i,layout:o}=s;if(i&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};Ot(r,n.layoutBox,i.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};Ot(a,e,o.layoutBox),hs(r,a)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:n,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeTargetChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Ps(t){t.isProjectionDirty||(t.isProjectionDirty=Boolean(t.parent&&t.parent.isProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=Boolean(t.parent&&t.parent.isTransformDirty))}function Ts(t){t.clearSnapshot()}function bs(t){t.clearMeasurements()}function Vs(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function As(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function Es(t){t.resolveTargetDelta()}function Ss(t){t.calcProjection()}function ws(t){t.resetRotation()}function Cs(t){t.removeLeadSnapshot()}function Ms(t,e,n){t.translate=kt(e.translate,0,n),t.scale=kt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ds(t,e,n,s){t.min=kt(e.min,n.min,s),t.max=kt(e.max,n.max,s)}function Ls(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const ks={duration:.45,ease:[.4,0,.1,1]};function Rs(t,e){let n=t.root;for(let e=t.path.length-1;e>=0;e--)if(Boolean(t.path[e].instance)){n=t.path[e];break}const s=(n&&n!==t.root?n.instance:document).querySelector(`[data-projection-id="${e}"]`);s&&t.mount(s,!0)}function Bs(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function Fs(t,e,n){return"position"===t||"preserve-aspect"===t&&!Bt(us(e),us(n),.2)}const js=ys({attachResizeListener:(t,e)=>mt(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Is={current:void 0},Us=ys({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Is.current){const t=new js(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),Is.current=t}return Is.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function Os(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ns={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!p.test(t))return t;t=parseFloat(t)}return`${Os(t,e.target.x)}% ${Os(t,e.target.y)}%`}};function zs(t){return"string"==typeof t&&t.startsWith("var(--")}const $s=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Gs(t,e,n=1){const[s,i]=function(t){const e=$s.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);return o?o.trim():zs(i)?Gs(i,e,n+1):i}const Hs={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,i=t.includes("var("),o=[];i&&(t=t.replace($s,t=>(o.push(t),"_$css")));const r=ke.parse(t);if(r.length>5)return s;const a=ke.createTransformer(t),l="number"!=typeof r[0]?1:0,h=n.x.scale*e.x,u=n.y.scale*e.y;r[0+l]/=h,r[1+l]/=u;const c=kt(h,u,.5);"number"==typeof r[2+l]&&(r[2+l]/=c),"number"==typeof r[3+l]&&(r[3+l]/=c);let p=a(r);if(i){let t=0;p=p.replace("_$css",()=>{const e=o[t];return t++,e})}return p}},Ws=t=>/^0[^.\s]+$/.test(t),qs=t=>e=>e.test(t),Ys=[r,p,a,g,y,v,{test:t=>"auto"===t,parse:t=>t}],Xs=t=>Ys.find(qs(t)),Ks=[...Ys,be,ke],Zs=t=>Ks.find(qs(t));function _s(t,e,n){const s=t.getProps();return x(s,e,void 0!==n?n:s.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(t))}function Js(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Wn(n))}function Qs(t,e){if(!e)return;return(e[t]||e.default||e).from}const ti=new Set(["width","height","top","left","right","bottom","x","y"]),ei=t=>ti.has(t),ni=t=>t===r||t===p;var si;!function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"}(si||(si={}));const ii=(t,e)=>parseFloat(t.split(", ")[e]),oi=(t,e)=>(n,{transform:s})=>{if("none"===s||!s)return 0;const i=s.match(/^matrix3d\((.+)\)$/);if(i)return ii(i[1],e);{const e=s.match(/^matrix\((.+)\)$/);return e?ii(e[1],t):0}},ri=new Set(["x","y","z"]),ai=T.filter(t=>!ri.has(t));const li={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:oi(4,13),y:oi(5,14)},hi=(t,e,n={},s={})=>{e={...e},s={...s};const i=Object.keys(e).filter(ei);let o=[],r=!1;const a=[];if(i.forEach(i=>{const l=t.getValue(i);if(!t.hasValue(i))return;let h=n[i],u=Xs(h);const c=e[i];let d;if(b(c)){const t=c.length,e=null===c[0]?1:0;h=c[e],u=Xs(h);for(let n=e;n<t;n++)d?Xs(c[n]):d=Xs(c[n])}else d=Xs(c);if(u!==d)if(ni(u)&&ni(d)){const t=l.get();"string"==typeof t&&l.set(parseFloat(t)),"string"==typeof c?e[i]=parseFloat(c):Array.isArray(c)&&d===p&&(e[i]=c.map(parseFloat))}else(null==u?void 0:u.transform)&&(null==d?void 0:d.transform)&&(0===h||0===c)?0===h?l.set(d.transform(h)):e[i]=u.transform(c):(r||(o=function(t){const e=[];return ai.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}(t),r=!0),a.push(i),s[i]=void 0!==s[i]?s[i]:e[i],l.jump(c))}),a.length){const n=a.indexOf("height")>=0?window.pageYOffset:null,i=((t,e,n)=>{const s=e.measureViewportBox(),i=e.current,o=getComputedStyle(i),{display:r}=o,a={};"none"===r&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=li[t](s,o)}),e.render();const l=e.measureViewportBox();return n.forEach(n=>{const s=e.getValue(n);s&&s.jump(a[n]),t[n]=li[n](l,o)}),t})(e,t,a);return o.length&&o.forEach(([e,n])=>{t.getValue(e).set(n)}),t.render(),V&&null!==n&&window.scrollTo({top:n}),{target:i,transitionEnd:s}}return{target:e,transitionEnd:s}};function ui(t,e,n,s){return(t=>Object.keys(t).some(ei))(e)?hi(t,e,n,s):{target:e,transitionEnd:s}}const ci=(t,e,n,s)=>{const i=function(t,{...e},n){const s=t.current;if(!(s instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(t=>{const e=t.get();if(!zs(e))return;const n=Gs(e,s);n&&t.set(n)});for(const t in e){const i=e[t];if(!zs(i))continue;const o=Gs(i,s);o&&(e[t]=o,n&&void 0===n[t]&&(n[t]=i))}return{target:e,transitionEnd:n}}(t,e,s);return ui(t,e=i.target,n,s=i.transitionEnd)},pi={current:null},di={current:!1};function mi(t){return Boolean(c(t)&&t.add)}function fi(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const gi="data-"+A("framerAppearId");function yi(t,e,n={}){const s=_s(t,e,n.custom);let{transition:i=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(i=n.transitionOverride);const o=s?()=>vi(t,s,n):()=>Promise.resolve(),r=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:o=0,staggerChildren:r,staggerDirection:a}=i;return function(t,e,n=0,s=0,i=1,o){const r=[],a=(t.variantChildren.size-1)*s,l=1===i?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(xi).forEach((t,s)=>{t.notify("AnimationStart",e),r.push(yi(t,e,{...o,delay:n+l(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(r)}(t,e,o+s,r,a,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[t,e]="beforeChildren"===a?[o,r]:[r,o];return t().then(e)}return Promise.all([o(),r(n.delay)])}function vi(t,e,{delay:n=0,transitionOverride:s,type:i}={}){let{transition:o=t.getDefaultTransition(),transitionEnd:r,...a}=t.makeTargetAnimatable(e);const l=t.getValue("willChange");s&&(o=s);const h=[],u=i&&t.animationState&&t.animationState.getState()[i];for(const e in a){const s=t.getValue(e),i=a[e];if(!s||void 0===i||u&&Pi(u,e))continue;const r={delay:n,elapsed:0,...o};if(window.HandoffAppearAnimations&&!s.hasAnimated){const n=t.getProps()[gi];n&&(r.elapsed=window.HandoffAppearAnimations(n,e,s,at))}let c=s.start(In(e,s,i,t.shouldReduceMotion&&E.has(e)?{type:!1}:r));mi(l)&&(l.add(e),c=c.then(()=>l.remove(e))),h.push(c)}return Promise.all(h).then(()=>{r&&function(t,e){const n=_s(t,e);let{transitionEnd:s={},transition:i={},...o}=n?t.makeTargetAnimatable(n,!1):{};o={...o,...s};for(const e in o){Js(t,e,P(o[e]))}}(t,r)})}function xi(t,e){return t.sortNodePosition(e)}function Pi({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}const Ti=[Wt.Animate,Wt.InView,Wt.Focus,Wt.Hover,Wt.Tap,Wt.Drag,Wt.Exit],bi=[...Ti].reverse(),Vi=Ti.length;function Ai(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const i=e.map(e=>yi(t,e,n));s=Promise.all(i)}else if("string"==typeof e)s=yi(t,e,n);else{const i="function"==typeof e?_s(t,e,n.custom):e;s=vi(t,i,n)}return s.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Ei(t){let e=Ai(t);const n={[Wt.Animate]:wi(!0),[Wt.InView]:wi(),[Wt.Hover]:wi(),[Wt.Tap]:wi(),[Wt.Drag]:wi(),[Wt.Focus]:wi(),[Wt.Exit]:wi()};let s=!0;const i=(e,n)=>{const s=_s(t,n);if(s){const{transition:t,transitionEnd:n,...i}=s;e={...e,...i,...n}}return e};function o(o,r){const a=t.getProps(),l=t.getVariantContext(!0)||{},h=[],u=new Set;let c={},p=1/0;for(let e=0;e<Vi;e++){const d=bi[e],m=n[d],f=void 0!==a[d]?a[d]:l[d],g=w(f),y=d===r?m.isActive:null;!1===y&&(p=e);let v=f===l[d]&&f!==a[d]&&g;if(v&&s&&t.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...c},!m.isActive&&null===y||!f&&!m.prevProp||S(f)||"boolean"==typeof f)continue;const x=Si(m.prevProp,f);let P=x||d===r&&m.isActive&&!v&&g||e>p&&g;const T=Array.isArray(f)?f:[f];let V=T.reduce(i,{});!1===y&&(V={});const{prevResolvedValues:A={}}=m,E={...A,...V},C=t=>{P=!0,u.delete(t),m.needsAnimating[t]=!0};for(const t in E){const e=V[t],n=A[t];c.hasOwnProperty(t)||(e!==n?b(e)&&b(n)?!fi(e,n)||x?C(t):m.protectedKeys[t]=!0:void 0!==e?C(t):u.add(t):void 0!==e&&u.has(t)?C(t):m.protectedKeys[t]=!0)}m.prevProp=f,m.prevResolvedValues=V,m.isActive&&(c={...c,...V}),s&&t.blockInitialAnimation&&(P=!1),P&&!v&&h.push(...T.map(t=>({animation:t,options:{type:d,...o}})))}if(u.size){const e={};u.forEach(n=>{const s=t.getBaseTarget(n);void 0!==s&&(e[n]=s)}),h.push({animation:e})}let d=Boolean(h.length);return s&&!1===a.initial&&!t.manuallyAnimateOnMount&&(d=!1),s=!1,d?e(h):Promise.resolve()}return{animateChanges:o,setActive:function(e,s,i){if(n[e].isActive===s)return Promise.resolve();t.variantChildren&&t.variantChildren.forEach(t=>{t.animationState&&t.animationState.setActive(e,s)}),n[e].isActive=s;const r=o(i,e);for(const t in n)n[t].protectedKeys={};return r},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function Si(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!fi(e,t)}function wi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const Ci=Object.keys(D),Mi=Ci.length,Di=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];const Li=["initial",...Ti],ki=Li.length;class Ri extends class{constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:s,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,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.scheduleRender=()=>at.render(this.render,!1,!0);const{latestValues:r,renderState:a}=i;this.latestValues=r,this.baseTarget={...r},this.initialValues=e.initial?{...r}:{},this.renderState=a,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=o,this.isControllingVariants=C(e),this.isVariantNode=M(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:l,...h}=this.scrapeMotionValuesFromProps(e,{});for(const t in h){const e=h[t];void 0!==r[t]&&c(e)&&(e.set(r[t],!1),mi(l)&&l.add(t))}}scrapeMotionValuesFromProps(t,e){return{}}mount(t){this.current=t,this.projection&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),di.current||function(){if(di.current=!0,V)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>pi.current=t.matches;t.addListener(e),e()}else pi.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||pi.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),lt.update(this.notifyUpdate),lt.render(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,e){const n=E.has(t),s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&at.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=e.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{s(),i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures({children:t,...e},n,s,i,o){let r,a;for(let t=0;t<Mi;t++){const n=Ci[t],{isEnabled:s,Feature:i,ProjectionNode:o,MeasureLayout:l}=D[n];o&&(r=o),s(e)&&(!this.features[n]&&i&&(this.features[n]=new i(this)),l&&(a=l))}if(!this.projection&&r){this.projection=new r(i,this.latestValues,this.parent&&this.parent.projection);const{layoutId:t,layout:n,drag:s,dragConstraints:a,layoutScroll:l,layoutRoot:h}=e;this.projection.setOptions({layoutId:t,layout:n,alwaysMeasureLayout:Boolean(s)||a&&u(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:o,layoutScroll:l,layoutRoot:h})}return a}updateFeatures(){for(const t in this.features){const e=this.features[t];e.isMounted?e.update(this.props,this.prevProps):(e.mount(),e.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,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}makeTargetAnimatable(t,e=!0){return this.makeTargetAnimatableFromInstance(t,this.props,e)}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<Di.length;e++){const n=Di[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=t["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(t,e,n){const{willChange:s}=e;for(const i in e){const o=e[i],r=n[i];if(c(o))t.addValue(i,o),mi(s)&&s.add(i);else if(c(r))t.addValue(i,Wn(o,{owner:t})),mi(s)&&s.remove(i);else if(r!==o)if(t.hasValue(i)){const e=t.getValue(i);!e.hasAnimated&&e.set(o)}else{const e=t.getStaticValue(i);t.addValue(i,Wn(void 0!==e?e:o,{owner:t}))}}for(const s in n)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(t=!1){if(t)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const e={};for(let t=0;t<ki;t++){const n=Li[t],s=this.props[n];(w(s)||!1===s)&&(e[n]=s)}return e}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){e!==this.values.get(t)&&(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=Wn(e,{owner:this}),this.addValue(t,n)),n}readValue(t){return void 0===this.latestValues[t]&&this.current?this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props,s="string"==typeof n||"object"==typeof n?null===(e=x(this.props,n))||void 0===e?void 0:e[t]:void 0;if(n&&void 0!==s)return s;const i=this.getBaseTargetFromProps(this.props,t);return void 0===i||c(i)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:i}on(t,e){return this.events[t]||(this.events[t]=new Gn),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}{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]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:s},i){let o=function(t,e,n){const s={};for(const i in t){const t=Qs(i,e);if(void 0!==t)s[i]=t;else{const t=n.getValue(i);t&&(s[i]=t.get())}}return s}(n,t||{},this);if(s&&(e&&(e=s(e)),n&&(n=s(n)),o&&(o=s(o))),i){!function(t,e,n){var s,i;const o=Object.keys(e).filter(e=>!t.hasValue(e)),r=o.length;if(r)for(let a=0;a<r;a++){const r=o[a],l=e[r];let h=null;Array.isArray(l)&&(h=l[0]),null===h&&(h=null!==(i=null!==(s=n[r])&&void 0!==s?s:t.readValue(r))&&void 0!==i?i:e[r]),null!=h&&("string"==typeof h&&(/^\-?\d*\.?\d+$/.test(h)||Ws(h))?h=parseFloat(h):!Zs(h)&&ke.test(l)&&(h=Rn(r,l)),t.addValue(r,Wn(h,{owner:t})),void 0===n[r]&&(n[r]=h),null!==h&&t.setBaseTarget(r,h))}}(this,n,o);const t=ci(this,n,o,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class Bi extends Ri{readValueFromInstance(t,e){if(E.has(e)){const t=kn(e);return t&&t.default||0}{const s=(n=t,window.getComputedStyle(n)),i=(L(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof i?i.trim():i}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return he(t,e)}build(t,e,n,s){k(t,e,n,s.transformTemplate)}scrapeMotionValuesFromProps(t,e){return R(t,e)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;c(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=""+t)}))}renderInstance(t,e,n,s){B(t,e,n,s)}}class Fi extends W.Component{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n,layoutId:s}=this.props,{projection:i}=t;j(Ii),i&&(e.group&&e.group.add(i),n&&n.register&&s&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),d.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:n,drag:s,isPresent:i}=this.props,o=n.projection;return o?(o.isPresent=i,s||t.layoutDependency!==e||void 0===e?o.willUpdate():this.safeToRemove(),t.isPresent!==i&&(i?o.promote():o.relegate()||at.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),!t.currentAnimation&&t.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:n}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function ji(t){const[e,n]=function(){const t=q(F);if(null===t)return[!0,null];const{isPresent:e,onExitComplete:n,register:s}=t,i=Y();return X(()=>s(i),[]),!e&&n?[!1,()=>n&&n(i)]:[!0]}(),s=q(I);return W.createElement(Fi,{...t,layoutGroup:s,switchLayoutGroup:q(U),isPresent:e,safeToRemove:n})}const Ii={borderRadius:{...Ns,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ns,borderTopRightRadius:Ns,borderBottomLeftRadius:Ns,borderBottomRightRadius:Ns,boxShadow:Hs},Ui={pan:{Feature:class extends K{constructor(){super(...arguments),this.removePointerDownListener=Z}onPointerDown(t){this.session=new xt(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:t,onStart:e,onMove:n,onEnd:(t,e)=>{delete this.session,s&&s(t,e)}}}mount(){this.removePointerDownListener=ft(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 K{constructor(t){super(t),this.removeGroupControls=Z,this.removeListeners=Z,this.controls=new On(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Z}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Us,MeasureLayout:ji}},Oi={layout:{ProjectionNode:Us,MeasureLayout:ji}};let Ni=0;const zi={animation:{Feature:class extends K{constructor(t){super(t),t.animationState||(t.animationState=Ei(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),S(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends K{constructor(){super(...arguments),this.id=Ni++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e,custom:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const i=this.node.animationState.setActive(Wt.Exit,!t,{custom:null!=n?n:this.node.getProps().custom});e&&!t&&i.then(()=>e(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};function $i(t,e){const n="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End");return ft(t.current,n,(n,i)=>{if("touch"===n.type||Dt())return;const o=t.getProps();t.animationState&&o.whileHover&&t.animationState.setActive(Wt.Hover,e),o[s]&&o[s](n,i)},{passive:!t.getProps()[s]})}const Gi=(t,e)=>!!e&&(t===e||Gi(t,e.parentElement));function Hi(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,J(n))}const Wi=new WeakMap,qi=new WeakMap,Yi=t=>{const e=Wi.get(t.target);e&&e(t)},Xi=t=>{t.forEach(Yi)};function Ki(t,e,n){const s=function({root:t,...e}){const n=t||document;qi.has(n)||qi.set(n,{});const s=qi.get(n),i=JSON.stringify(e);return s[i]||(s[i]=new IntersectionObserver(Xi,{root:t,...e})),s[i]}(e);return Wi.set(t,n),s.observe(t),()=>{Wi.delete(t),s.unobserve(t)}}const Zi={some:0,all:1};const _i={inView:{Feature:class extends K{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}viewportFallback(){requestAnimationFrame(()=>{this.hasEnteredView=!0;const{onViewportEnter:t}=this.node.getProps();t&&t(null),this.node.animationState&&this.node.animationState.setActive(Wt.InView,!0)})}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:s="some",once:i,fallback:o=!0}=t;if("undefined"==typeof IntersectionObserver)return void(o&&this.viewportFallback());const r={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof s?s:Zi[s]};return Ki(this.node.current,r,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,i&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(Wt.InView,e);const{onViewportEnter:n,onViewportLeave:s}=this.node.getProps(),o=e?n:s;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 n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends K{constructor(){super(...arguments),this.removeStartListeners=Z,this.removeEndListeners=Z,this.removeAccessibleListeners=Z,this.startPointerPress=(t,e)=>{if(this.removeEndListeners(),this.isPressing)return;const n=this.node.getProps(),s=ft(window,"pointerup",(t,e)=>{if(!this.checkPressEnd())return;const{onTap:n,onTapCancel:s}=this.node.getProps();Gi(this.node.current,t.target)?n&&n(t,e):s&&s(t,e)},{passive:!(n.onTap||n.onPointerUp)}),i=ft(window,"pointercancel",(t,e)=>this.cancelPress(t,e),{passive:!(n.onTapCancel||n.onPointerCancel)});this.removeEndListeners=yt(s,i),this.startPress(t,e)},this.startAccessiblePress=()=>{const t=mt(this.node.current,"keydown",t=>{if("Enter"!==t.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=mt(this.node.current,"keyup",t=>{"Enter"===t.key&&this.checkPressEnd()&&Hi("up",this.node.getProps().onTap)}),Hi("down",(t,e)=>{this.startPress(t,e)})}),e=mt(this.node.current,"blur",()=>{this.isPressing&&Hi("cancel",(t,e)=>this.cancelPress(t,e))});this.removeAccessibleListeners=yt(t,e)}}startPress(t,e){this.isPressing=!0;const{onTapStart:n,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive(Wt.Tap,!0),n&&n(t,e)}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive(Wt.Tap,!1),!Dt()}cancelPress(t,e){if(!this.checkPressEnd())return;const{onTapCancel:n}=this.node.getProps();n&&n(t,e)}mount(){const t=this.node.getProps(),e=ft(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),n=mt(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=yt(e,n)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends K{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(Wt.Focus,!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive(Wt.Focus,!1),this.isActive=!1)}mount(){this.unmount=yt(mt(this.node.current,"focus",()=>this.onFocus()),mt(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends K{mount(){this.unmount=yt($i(this.node,!0),$i(this.node,!1))}unmount(){}}}};class Ji extends Ri{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(E.has(e)){const t=kn(e);return t&&t.default||0}return e=O.has(e)?e:A(e),t.getAttribute(e)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(t,e){return N(t,e)}build(t,e,n,s){z(t,e,n,this.isSVGTag,s.transformTemplate)}renderInstance(t,e,n,s){$(t,e,n,s)}mount(t){this.isSVGTag=G(t.tagName),super.mount(t)}}const Qi={...{renderer:(t,e)=>H(t)?new Ji(e,{enableHardwareAcceleration:!1}):new Bi(e,{enableHardwareAcceleration:!0}),...zi,..._i},...Ui,...Oi};export{Qi as domMax};