framer-motion 12.4.12 → 12.4.13
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.
- package/dist/cjs/client.js +1 -1
- package/dist/cjs/{create-Da6xW2BP.js → create-DkTZDHiS.js} +87 -24
- package/dist/cjs/dom.js +85 -22
- package/dist/cjs/index.js +1 -1
- package/dist/dom.js +1 -1
- package/dist/es/render/dom/utils/unit-conversion.mjs +3 -20
- package/dist/es/render/html/HTMLVisualElement.mjs +2 -3
- package/dist/es/render/html/utils/parse-transform.mjs +83 -0
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/framer-motion.dev.js +85 -22
- package/dist/framer-motion.js +1 -1
- package/dist/size-rollup-animate.js +1 -1
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as t,y as e,z as i,A as s,B as n,C as o,D as r,E as a,u as l,F as h,G as u,H as c,I as d,J as p,K as m,t as f,d as v,b as g,o as y,p as x,M as P,c as T,i as S,l as A,f as w,v as b,N as E,O as V,q as D,h as M,w as C,j as R,Q as k,R as L,g as B,s as j,T as F,m as O,r as I,U,P as N,L as K,S as W,V as z,a as $,W as G,n as Y,X as H,Y as X,k as q}from"./size-rollup-dom-max-assets.js";import{jsx as _}from"react/jsx-runtime";import{useContext as Z,useId as J,useEffect as Q,useCallback as tt,Component as et,Fragment as it}from"react";let st=t;function nt(t){let e;return()=>(void 0===e&&(e=t()),e)}const ot=(t,e,i)=>{const s=e-t;return 0===s?1:(i-t)/s},rt=t=>1e3*t,at=t=>t/1e3,lt=!1;class ht{constructor(t){this.isMounted=!1,this.node=t}update(){}}const ut=nt(()=>void 0!==window.ScrollTimeline);class ct extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=e}attachTimeline(t,e){const i=this.animations.map(i=>ut()&&i.attachTimeline?i.attachTimeline(t):"function"==typeof e?e(i):void 0);return()=>{i.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}function dt(t,e){return t?t[e]||t.default||t:void 0}function pt(t){let e=0;let i=t.next(e);for(;!i.done&&e<2e4;)e+=50,i=t.next(e);return e>=2e4?1/0:e}function mt(t){return"function"==typeof t}function ft(t,e){t.timeline=e,t.onfinish=null}const vt=t=>Array.isArray(t)&&"number"==typeof t[0],gt={linearEasing:void 0};function yt(t,e){const i=nt(t);return()=>{var t;return null!==(t=gt[e])&&void 0!==t?t:i()}}const xt=yt(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),Pt=(t,e,i=10)=>{let s="";const n=Math.max(Math.round(e/i),2);for(let e=0;e<n;e++)s+=t(ot(0,n-1,e))+", ";return`linear(${s.substring(0,s.length-2)})`};function Tt(t){return Boolean("function"==typeof t&&xt()||!t||"string"==typeof t&&(t in At||xt())||vt(t)||Array.isArray(t)&&t.every(Tt))}const St=([t,e,i,s])=>`cubic-bezier(${t}, ${e}, ${i}, ${s})`,At={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:St([0,.65,.55,1]),circOut:St([.55,0,1,.45]),backIn:St([.31,.01,.66,-.59]),backOut:St([.33,1.53,.69,.99])};const wt={x:!1,y:!1};function bt(){return wt.x||wt.y}function Et(t,e){const i=function(t,e,i){var s;if(t instanceof EventTarget)return[t];if("string"==typeof t){let n=document;e&&(n=e.current);const o=null!==(s=null==i?void 0:i[t])&&void 0!==s?s:n.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),s=new AbortController;return[i,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function Vt(t){return!("touch"===t.pointerType||bt())}function Dt(t,e){const i=e+"PointerCapture";if(t.target instanceof Element&&i in t.target&&void 0!==t.pointerId)try{t.target[i](t.pointerId)}catch(t){}}const Mt=(t,e)=>!!e&&(t===e||Mt(t,e.parentElement)),Ct=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Rt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const kt=new WeakSet;function Lt(t){return e=>{"Enter"===e.key&&t(e)}}function Bt(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function jt(t){return Ct(t)&&!bt()}function Ft(t,e,i={}){const[s,n,o]=Et(t,i),r=t=>{const i=t.currentTarget;if(!i||!jt(t)||kt.has(i))return;kt.add(i),Dt(t,"set");const s=e(i,t),o=(t,e)=>{i.removeEventListener("pointerup",r),i.removeEventListener("pointercancel",a),Dt(t,"release"),jt(t)&&kt.has(i)&&(kt.delete(i),"function"==typeof s&&s(t,{success:e}))},r=t=>{const e=!!t.isTrusted&&(s=t,n=i instanceof Element?i.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight},s.clientX<n.left||s.clientX>n.right||s.clientY<n.top||s.clientY>n.bottom);var s,n;o(t,!e&&(!(i instanceof Element)||Mt(i,t.target)))},a=t=>{o(t,!1)};i.addEventListener("pointerup",r,n),i.addEventListener("pointercancel",a,n),i.addEventListener("lostpointercapture",a,n)};return s.forEach(t=>{let e=!1;var s;(t=i.useGlobalTarget?window:t)instanceof HTMLElement&&(e=!0,s=t,Rt.has(s.tagName)||-1!==s.tabIndex||null!==t.getAttribute("tabindex")||(t.tabIndex=0)),t.addEventListener("pointerdown",r,n),e&&t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const s=Lt(()=>{if(kt.has(i))return;Bt(i,"down");const t=Lt(()=>{Bt(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>Bt(i,"cancel"),e)});i.addEventListener("keydown",s,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",s),e)})(t,n),n)}),o}const Ot=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function It(e,i,s,n){if(e===i&&s===n)return t;const o=t=>function(t,e,i,s,n){let o,r,a=0;do{r=e+(i-e)/2,o=Ot(r,s,n)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,s);return t=>0===t||1===t?t:Ot(o(t),i,n)}const Ut=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Nt=t=>e=>1-t(1-e),Kt=It(.33,1.53,.69,.99),Wt=Nt(Kt),zt=Ut(Wt),$t=t=>(t*=2)<1?.5*Wt(t):.5*(2-Math.pow(2,-10*(t-1))),Gt=t=>1-Math.sin(Math.acos(t)),Yt=Nt(Gt),Ht=Ut(Gt),Xt=t=>/^0[^.\s]+$/u.test(t);const qt=new Set(["width","height","top","left","right","bottom",...e]),_t=t=>Math.round(1e5*t)/1e5,Zt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Jt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qt=(t,e)=>i=>Boolean("string"==typeof i&&Jt.test(i)&&i.startsWith(t)||e&&!function(t){return null==t}(i)&&Object.prototype.hasOwnProperty.call(i,e)),te=(t,e,i)=>s=>{if("string"!=typeof s)return s;const[n,o,r,a]=s.match(Zt);return{[t]:parseFloat(n),[e]:parseFloat(o),[i]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},ee={...i,transform:t=>Math.round((t=>n(0,255,t))(t))},ie={test:Qt("rgb","red"),parse:te("red","green","blue"),transform:({red:t,green:e,blue:i,alpha:n=1})=>"rgba("+ee.transform(t)+", "+ee.transform(e)+", "+ee.transform(i)+", "+_t(s.transform(n))+")"};const se={test:Qt("#"),parse:function(t){let e="",i="",s="",n="";return t.length>5?(e=t.substring(1,3),i=t.substring(3,5),s=t.substring(5,7),n=t.substring(7,9)):(e=t.substring(1,2),i=t.substring(2,3),s=t.substring(3,4),n=t.substring(4,5),e+=e,i+=i,s+=s,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:n?parseInt(n,16)/255:1}},transform:ie.transform},ne={test:Qt("hsl","hue"),parse:te("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:i,alpha:n=1})=>"hsla("+Math.round(t)+", "+o.transform(_t(e))+", "+o.transform(_t(i))+", "+_t(s.transform(n))+")"},oe={test:t=>ie.test(t)||se.test(t)||ne.test(t),parse:t=>ie.test(t)?ie.parse(t):ne.test(t)?ne.parse(t):se.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ie.transform(t):ne.transform(t)},re=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const ae=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function le(t){const e=t.toString(),i=[],s={color:[],number:[],var:[]},n=[];let o=0;const r=e.replace(ae,t=>(oe.test(t)?(s.color.push(o),n.push("color"),i.push(oe.parse(t))):t.startsWith("var(")?(s.var.push(o),n.push("var"),i.push(t)):(s.number.push(o),n.push("number"),i.push(parseFloat(t))),++o,"${}")).split("${}");return{values:i,split:r,indexes:s,types:n}}function he(t){return le(t).values}function ue(t){const{split:e,types:i}=le(t),s=e.length;return t=>{let n="";for(let o=0;o<s;o++)if(n+=e[o],void 0!==t[o]){const e=i[o];n+="number"===e?_t(t[o]):"color"===e?oe.transform(t[o]):t[o]}return n}}const ce=t=>"number"==typeof t?0:t;const de={test:function(t){var e,i;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Zt))||void 0===e?void 0:e.length)||0)+((null===(i=t.match(re))||void 0===i?void 0:i.length)||0)>0},parse:he,createTransformer:ue,getAnimatableNone:function(t){const e=he(t);return ue(t)(e.map(ce))}},pe=new Set(["brightness","contrast","saturate","opacity"]);function me(t){const[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=i.match(Zt)||[];if(!s)return t;const n=i.replace(s,"");let o=pe.has(e)?1:0;return s!==i&&(o*=100),e+"("+o+n+")"}const fe=/\b([a-z-]*)\(.*?\)/gu,ve={...de,getAnimatableNone:t=>{const e=t.match(fe);return e?e.map(me).join(" "):t}},ge={...r,color:oe,backgroundColor:oe,outlineColor:oe,fill:oe,stroke:oe,borderColor:oe,borderTopColor:oe,borderRightColor:oe,borderBottomColor:oe,borderLeftColor:oe,filter:ve,WebkitFilter:ve},ye=t=>ge[t];function xe(t,e){let i=ye(t);return i!==ve&&(i=de),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const Pe=new Set(["auto","none","0"]);const Te=t=>t===i||t===a,Se=(t,e)=>parseFloat(t.split(", ")[e]),Ae=(t,e)=>(i,{transform:s})=>{if("none"===s||!s)return 0;const n=s.match(/^matrix3d\((.+)\)$/u);if(n)return Se(n[1],e);{const e=s.match(/^matrix\((.+)\)$/u);return e?Se(e[1],t):0}},we=new Set(["x","y","z"]),be=e.filter(t=>!we.has(t));const Ee={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),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:Ae(4,13),y:Ae(5,14)};Ee.translateX=Ee.x,Ee.translateY=Ee.y;const Ve=new Set;let De=!1,Me=!1;function Ce(){if(Me){const t=Array.from(Ve).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{const e=function(t){const e=[];return be.forEach(i=>{const s=t.getValue(i);void 0!==s&&(e.push([i,s.get()]),s.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,i])=>{var s;null===(s=t.getValue(e))||void 0===s||s.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Me=!1,De=!1,Ve.forEach(t=>t.complete()),Ve.clear()}function Re(){Ve.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Me=!0)})}class ke{constructor(t,e,i,s,n,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=s,this.element=n,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Ve.add(this),De||(De=!0,l.read(Re),l.resolveKeyframes(Ce))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:i,motionValue:s}=this;for(let n=0;n<t.length;n++)if(null===t[n])if(0===n){const n=null==s?void 0:s.get(),o=t[t.length-1];if(void 0!==n)t[0]=n;else if(i&&e){const s=i.readValue(e,o);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=o),s&&void 0===n&&s.set(t[0])}else t[n]=t[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Ve.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Ve.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Le=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),Be=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function je(t,e,i=1){const[s,n]=function(t){const e=Be.exec(t);if(!e)return[,];const[,i,s,n]=e;return["--"+(null!=i?i:s),n]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return Le(t)?parseFloat(t):t}return h(n)?je(n,e,i+1):n}const Fe=t=>e=>e.test(t),Oe=[i,a,o,u,c,d,{test:t=>"auto"===t,parse:t=>t}],Ie=t=>Oe.find(Fe(t));class Ue extends ke{constructor(t,e,i,s,n){super(t,e,i,s,n,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i<t.length;i++){let s=t[i];if("string"==typeof s&&(s=s.trim(),h(s))){const n=je(s,e.current);void 0!==n&&(t[i]=n),i===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!qt.has(i)||2!==t.length)return;const[s,n]=t,o=Ie(s),r=Ie(n);if(o!==r)if(Te(o)&&Te(r))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)("number"==typeof(s=t[e])?0===s:null===s||"none"===s||"0"===s||Xt(s))&&i.push(e);var s;i.length&&function(t,e,i){let s=0,n=void 0;for(;s<t.length&&!n;){const e=t[s];"string"==typeof e&&!Pe.has(e)&&le(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=xe(i,n)}(t,i,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ee[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(i,s).jump(s,!1)}measureEndState(){var t;const{element:e,name:i,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const n=e.getValue(i);n&&n.jump(this.measuredOrigin,!1);const o=s.length-1,r=s[o];s[o]=Ee[i](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach(([t,i])=>{e.getValue(t).set(i)}),this.resolveNoneKeyframes()}}let Ne;function Ke(){Ne=void 0}const We={now:()=>(void 0===Ne&&We.set(p.isProcessing||lt?p.timestamp:performance.now()),Ne),set:t=>{Ne=t,queueMicrotask(Ke)}},ze=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!de.test(t)&&"0"!==t||t.startsWith("url(")));function $e(t,e,i,s){const n=t[0];if(null===n)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=ze(n,e),a=ze(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||mt(i))&&s)}const Ge=t=>null!==t;function Ye(t,{repeat:e,repeatType:i="loop"},s){const n=t.filter(Ge),o=e&&"loop"!==i&&e%2==1?0:n.length-1;return o&&void 0!==s?s:n[o]}class He{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:s=0,repeatDelay:n=0,repeatType:o="loop",...r}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=We.now(),this.options={autoplay:t,delay:e,type:i,repeat:s,repeatDelay:n,repeatType:o,...r},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Re(),Ce()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=We.now(),this.hasAttemptedResolve=!0;const{name:i,type:s,velocity:n,delay:o,onComplete:r,onUpdate:a,isGenerator:l}=this.options;if(!l&&!$e(t,i,s,n)){if(!o)return a&&a(Ye(t,this.options,e)),r&&r(),void this.resolveFinishedPromise();this.options.duration=0}const h=this.initPlayback(t,e);!1!==h&&(this._resolved={keyframes:t,finalKeyframe:e,...h},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const Xe=(t,e,i)=>t+(e-t)*i;function qe(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function _e(t,e){return i=>i>0?e:t}const Ze=(t,e,i)=>{const s=t*t,n=i*(e*e-s)+s;return n<0?0:Math.sqrt(n)},Je=[se,ie,ne];function Qe(t){const e=(i=t,Je.find(t=>t.test(i)));var i;if(!Boolean(e))return!1;let s=e.parse(t);return e===ne&&(s=function({hue:t,saturation:e,lightness:i,alpha:s}){t/=360,i/=100;let n=0,o=0,r=0;if(e/=100){const s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=qe(a,s,t+1/3),o=qe(a,s,t),r=qe(a,s,t-1/3)}else n=o=r=i;return{red:Math.round(255*n),green:Math.round(255*o),blue:Math.round(255*r),alpha:s}}(s)),s}const ti=(t,e)=>{const i=Qe(t),s=Qe(e);if(!i||!s)return _e(t,e);const n={...i};return t=>(n.red=Ze(i.red,s.red,t),n.green=Ze(i.green,s.green,t),n.blue=Ze(i.blue,s.blue,t),n.alpha=Xe(i.alpha,s.alpha,t),ie.transform(n))},ei=(t,e)=>i=>e(t(i)),ii=(...t)=>t.reduce(ei),si=new Set(["none","hidden"]);function ni(t,e){return i=>Xe(t,e,i)}function oi(t){return"number"==typeof t?ni:"string"==typeof t?h(t)?_e:oe.test(t)?ti:li:Array.isArray(t)?ri:"object"==typeof t?oe.test(t)?ti:ai:_e}function ri(t,e){const i=[...t],s=i.length,n=t.map((t,i)=>oi(t)(t,e[i]));return t=>{for(let e=0;e<s;e++)i[e]=n[e](t);return i}}function ai(t,e){const i={...t,...e},s={};for(const n in i)void 0!==t[n]&&void 0!==e[n]&&(s[n]=oi(t[n])(t[n],e[n]));return t=>{for(const e in s)i[e]=s[e](t);return i}}const li=(t,e)=>{const i=de.createTransformer(e),s=le(t),n=le(e);return s.indexes.var.length===n.indexes.var.length&&s.indexes.color.length===n.indexes.color.length&&s.indexes.number.length>=n.indexes.number.length?si.has(t)&&!n.values.length||si.has(e)&&!s.values.length?function(t,e){return si.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):ii(ri(function(t,e){var i;const s=[],n={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const r=e.types[o],a=t.indexes[r][n[r]],l=null!==(i=t.values[a])&&void 0!==i?i:0;s[o]=l,n[r]++}return s}(s,n),n.values),i):_e(t,e)};function hi(t,e,i){if("number"==typeof t&&"number"==typeof e&&"number"==typeof i)return Xe(t,e,i);return oi(t)(t,e)}function ui(t,e){return e?t*(1e3/e):0}function ci(t,e,i){const s=Math.max(e-5,0);return ui(i-t(s),e-s)}const di=100,pi=10,mi=1,fi=0,vi=800,gi=.3,yi=.3,xi={granular:.01,default:2},Pi={granular:.005,default:.5},Ti=.01,Si=10,Ai=.05,wi=1;function bi({duration:t=vi,bounce:e=gi,velocity:i=fi,mass:s=mi}){let o,r,a=1-e;a=n(Ai,wi,a),t=n(Ti,Si,at(t)),a<1?(o=e=>{const s=e*a,n=s*t;return.001-(s-i)/Ei(e,a)*Math.exp(-n)},r=e=>{const s=e*a*t,n=s*i+i,r=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-s),h=Ei(Math.pow(e,2),a);return(.001-o(e)>0?-1:1)*((n-r)*l)/h}):(o=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(i-e)));const l=function(t,e,i){let s=i;for(let i=1;i<12;i++)s-=t(s)/e(s);return s}(o,r,5/t);if(t=rt(t),isNaN(l))return{stiffness:di,damping:pi,duration:t};{const e=Math.pow(l,2)*s;return{stiffness:e,damping:2*a*Math.sqrt(s*e),duration:t}}}function Ei(t,e){return t*Math.sqrt(1-e*e)}const Vi=["duration","bounce"],Di=["stiffness","damping","mass"];function Mi(t,e){return e.some(e=>void 0!==t[e])}function Ci(t=yi,e=gi){const i="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:o}=i;const r=i.keyframes[0],a=i.keyframes[i.keyframes.length-1],l={done:!1,value:r},{stiffness:h,damping:u,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:fi,stiffness:di,damping:pi,mass:mi,isResolvedFromDuration:!1,...t};if(!Mi(t,Di)&&Mi(t,Vi))if(t.visualDuration){const i=t.visualDuration,s=2*Math.PI/(1.2*i),o=s*s,r=2*n(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:mi,stiffness:o,damping:r}}else{const i=bi(t);e={...e,...i,mass:mi},e.isResolvedFromDuration=!0}return e}({...i,velocity:-at(i.velocity||0)}),f=p||0,v=u/(2*Math.sqrt(h*c)),g=a-r,y=at(Math.sqrt(h/c)),x=Math.abs(g)<5;let P;if(s||(s=x?xi.granular:xi.default),o||(o=x?Pi.granular:Pi.default),v<1){const t=Ei(y,v);P=e=>{const i=Math.exp(-v*y*e);return a-i*((f+v*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===v)P=t=>a-Math.exp(-y*t)*(g+(f+y*g)*t);else{const t=y*Math.sqrt(v*v-1);P=e=>{const i=Math.exp(-v*y*e),s=Math.min(t*e,300);return a-i*((f+v*y*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const T={calculatedDuration:m&&d||null,next:t=>{const e=P(t);if(m)l.done=t>=d;else{let i=0;v<1&&(i=0===t?rt(f):ci(P,t,e));const n=Math.abs(i)<=s,r=Math.abs(a-e)<=o;l.done=n&&r}return l.value=l.done?a:e,l},toString:()=>{const t=Math.min(pt(T),2e4),e=Pt(e=>T.next(t*e).value,t,30);return t+"ms "+e}};return T}function Ri({keyframes:t,velocity:e=0,power:i=.8,timeConstant:s=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:u}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=i*e;const f=c+m,v=void 0===r?f:r(f);v!==f&&(m=v-c);const g=t=>-m*Math.exp(-t/s),y=t=>v+g(t),x=t=>{const e=g(t),i=y(t);d.done=Math.abs(e)<=h,d.value=d.done?v:i};let P,T;const S=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(P=t,T=Ci({keyframes:[d.value,p(d.value)],velocity:ci(y,t,d.value),damping:n,stiffness:o,restDelta:h,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==P||(e=!0,x(t),S(t)),void 0!==P&&t>=P?T.next(t-P):(!e&&x(t),d)}}}const ki=It(.42,0,1,1),Li=It(0,0,.58,1),Bi=It(.42,0,.58,1),ji={linear:t,easeIn:ki,easeInOut:Bi,easeOut:Li,circIn:Gt,circInOut:Ht,circOut:Yt,backIn:Wt,backInOut:zt,backOut:Kt,anticipate:$t},Fi=t=>{if(vt(t)){st(4===t.length);const[e,i,s,n]=t;return It(e,i,s,n)}return"string"==typeof t?ji[t]:t};function Oi(e,i,{clamp:s=!0,ease:o,mixer:r}={}){const a=e.length;if(st(a===i.length),1===a)return()=>i[0];if(2===a&&i[0]===i[1])return()=>i[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),i=[...i].reverse());const h=function(e,i,s){const n=[],o=s||hi,r=e.length-1;for(let s=0;s<r;s++){let r=o(e[s],e[s+1]);if(i){const e=Array.isArray(i)?i[s]||t:i;r=ii(e,r)}n.push(r)}return n}(i,o,r),u=h.length,c=t=>{if(l&&t<e[0])return i[0];let s=0;if(u>1)for(;s<e.length-2&&!(t<e[s+1]);s++);const n=ot(e[s],e[s+1],t);return h[s](n)};return s?t=>c(n(e[0],e[a-1],t)):c}function Ii(t){const e=[0];return function(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const n=ot(0,e,s);t.push(Xe(i,1,n))}}(e,t.length-1),e}function Ui({duration:t=300,keyframes:e,times:i,ease:s="easeInOut"}){const n=(t=>Array.isArray(t)&&"number"!=typeof t[0])(s)?s.map(Fi):Fi(s),o={done:!1,value:e[0]},r=Oi(function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:Ii(e),t),e,{ease:Array.isArray(n)?n:(a=e,l=n,a.map(()=>l||Bi).splice(0,a.length-1))});var a,l;return{calculatedDuration:t,next:e=>(o.value=r(e),o.done=e>=t,o)}}const Ni=t=>{const e=({timestamp:e})=>t(e);return{start:()=>l.update(e,!0),stop:()=>m(e),now:()=>p.isProcessing?p.timestamp:We.now()}},Ki={decay:Ri,inertia:Ri,tween:Ui,keyframes:Ui,spring:Ci},Wi=t=>t/100;class zi extends He{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:i,element:s,keyframes:n}=this.options,o=(null==s?void 0:s.KeyframeResolver)||ke;this.resolver=new o(n,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:n,velocity:o=0}=this.options,r=mt(e)?e:Ki[e]||Ui;let a,l;r!==Ui&&"number"!=typeof t[0]&&(a=ii(Wi,hi(t[0],t[1])),t=[0,100]);const h=r({...this.options,keyframes:t});"mirror"===n&&(l=r({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===h.calculatedDuration&&(h.calculatedDuration=pt(h));const{calculatedDuration:u}=h,c=u+s;return{generator:h,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:c,totalDuration:c*(i+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:i}=this;if(!i){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:o,mirroredGenerator:r,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:h,totalDuration:u,resolvedDuration:c}=i;if(null===this.startTime)return o.next(0);const{delay:d,repeat:p,repeatType:m,repeatDelay:f,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let x=this.currentTime,P=o;if(p){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===m?(i=1-i,f&&(i-=f/c)):"mirror"===m&&(P=r)),x=n(0,1,i)*c}const T=y?{done:!1,value:l[0]}:P.next(x);a&&(T.value=a(T.value));let{done:S}=T;y||null===h||(S=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const A=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return A&&void 0!==s&&(T.value=Ye(l,this.options,s)),v&&v(T.value),A&&this.finish(),T}get duration(){const{resolved:t}=this;return t?at(t.calculatedDuration):0}get time(){return at(this.currentTime)}set time(t){t=rt(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=at(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Ni,onPlay:e,startTime:i}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=null!=i?i:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const $i=new Set(["opacity","clipPath","filter","transform"]);function Gi(t,e,i,{delay:s=0,duration:n=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:l}={}){const h={[e]:i};l&&(h.offset=l);const u=function t(e,i){return e?"function"==typeof e&&xt()?Pt(e,i):vt(e)?St(e):Array.isArray(e)?e.map(e=>t(e,i)||At.easeOut):At[e]:void 0}(a,n);Array.isArray(u)&&(h.easing=u);return t.animate(h,{delay:s,duration:n,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"})}const Yi=nt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));const Hi={anticipate:$t,backInOut:zt,circInOut:Ht};class Xi extends He{constructor(t){super(t);const{name:e,motionValue:i,element:s,keyframes:n}=this.options;this.resolver=new Ue(n,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:i=300,times:s,ease:n,type:o,motionValue:r,name:a,startTime:l}=this.options;if(!r.owner||!r.owner.current)return!1;var h;if("string"==typeof n&&xt()&&n in Hi&&(n=Hi[n]),mt((h=this.options).type)||"spring"===h.type||!Tt(h.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:l,...h}=this.options,u=function(t,e){const i=new zi({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const n=[];let o=0;for(;!s.done&&o<2e4;)s=i.sample(o),n.push(s.value),o+=10;return{times:void 0,keyframes:n,duration:o-10,ease:"linear"}}(t,h);1===(t=u.keyframes).length&&(t[1]=t[0]),i=u.duration,s=u.times,n=u.ease,o="keyframes"}const u=Gi(r.owner.current,a,t,{...this.options,duration:i,times:s,ease:n});return u.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(ft(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:i}=this.options;r.set(Ye(t,this.options,e)),i&&i(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:o,ease:n,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return at(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return at(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.currentTime=rt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(e){if(this._resolved){const{resolved:i}=this;if(!i)return t;const{animation:s}=i;ft(s,e)}else this.pendingTimeline=e;return t}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:i,duration:s,type:n,ease:o,times:r}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...h}=this.options,u=new zi({...h,keyframes:i,duration:s,type:n,ease:o,times:r,isGenerator:!0}),c=rt(this.time);t.setWithVelocity(u.sample(c-10).value,u.sample(c).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:i,repeatDelay:s,repeatType:n,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return Yi()&&i&&$i.has(i)&&!a&&!l&&!s&&"mirror"!==n&&0!==o&&"inertia"!==r}}const qi={type:"spring",stiffness:500,damping:25,restSpeed:10},_i={type:"keyframes",duration:.8},Zi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Ji=(t,{keyframes:e})=>e.length>2?_i:f.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:qi:Zi;const Qi=(t,e,i,s={},n,o)=>r=>{const a=dt(s,t)||{},h=a.delay||s.delay||0;let{elapsed:u=0}=s;u-=rt(h);let c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:n};(function({when:t,delay:e,delayChildren:i,staggerChildren:s,staggerDirection:n,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||(c={...c,...Ji(t,c)}),c.duration&&(c.duration=rt(c.duration)),c.repeatDelay&&(c.repeatDelay=rt(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(d=!0)),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=Ye(c.keyframes,a);if(void 0!==t)return l.update(()=>{c.onUpdate(t),c.onComplete()}),new ct([])}return!o&&Xi.supports(c)?new Xi(c):new zi(c)};function ts(t,e,i,s={passive:!0}){return t.addEventListener(e,i,s),()=>t.removeEventListener(e,i)}function es(t){return{point:{x:t.pageX,y:t.pageY}}}function is(t,e,i,s){return ts(t,e,(t=>e=>Ct(e)&&t(e,es(e)))(i),s)}function ss({top:t,left:e,right:i,bottom:s}){return{x:{min:e,max:i},y:{min:t,max:s}}}function ns(t){return t.max-t.min}function os(t,e,i,s=.5){t.origin=s,t.originPoint=Xe(e.min,e.max,t.origin),t.scale=ns(i)/ns(e),t.translate=Xe(i.min,i.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function rs(t,e,i,s){os(t.x,e.x,i.x,s?s.originX:void 0),os(t.y,e.y,i.y,s?s.originY:void 0)}function as(t,e,i){t.min=i.min+e.min,t.max=t.min+ns(e)}function ls(t,e,i){t.min=e.min-i.min,t.max=t.min+ns(e)}function hs(t,e,i){ls(t.x,e.x,i.x),ls(t.y,e.y,i.y)}const us=()=>({x:{min:0,max:0},y:{min:0,max:0}});function cs(t){return[t("x"),t("y")]}function ds(t){return void 0===t||1===t}function ps({scale:t,scaleX:e,scaleY:i}){return!ds(t)||!ds(e)||!ds(i)}function ms(t){return ps(t)||fs(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function fs(t){return vs(t.x)||vs(t.y)}function vs(t){return t&&"0%"!==t}function gs(t,e,i){return i+e*(t-i)}function ys(t,e,i,s,n){return void 0!==n&&(t=gs(t,n,s)),gs(t,i,s)+e}function xs(t,e=0,i=1,s,n){t.min=ys(t.min,e,i,s,n),t.max=ys(t.max,e,i,s,n)}function Ps(t,{x:e,y:i}){xs(t.x,e.translate,e.scale,e.originPoint),xs(t.y,i.translate,i.scale,i.originPoint)}function Ts(t,e){t.min=t.min+e,t.max=t.max+e}function Ss(t,e,i,s,n=.5){xs(t,e,i,Xe(t.min,t.max,n),s)}function As(t,e){Ss(t.x,e.x,e.scaleX,e.scale,e.originX),Ss(t.y,e.y,e.scaleY,e.scale,e.originY)}function ws(t,e){return ss(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const bs=({current:t})=>t?t.ownerDocument.defaultView:null;function Es(t,e){const i=t.getValue("willChange");if(s=i,Boolean(v(s)&&s.add))return i.add(e);var s}const Vs=(t,e)=>Math.abs(t-e);class Ds{constructor(t,e,{transformPagePoint:i,contextWindow:s,dragSnapToOrigin:n=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Rs(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=Vs(t.x,e.x),s=Vs(t.y,e.y);return Math.sqrt(i**2+s**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!i)return;const{point:s}=t,{timestamp:n}=p;this.history.push({...s,timestamp:n});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=Ms(e,this.transformPagePoint),l.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:s,resumeAnimation:n}=this.handlers;if(this.dragSnapToOrigin&&n&&n(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Rs("pointercancel"===t.type?this.lastMoveEventInfo:Ms(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),s&&s(t,o)},!Ct(t))return;this.dragSnapToOrigin=n,this.handlers=e,this.transformPagePoint=i,this.contextWindow=s||window;const o=Ms(es(t),this.transformPagePoint),{point:r}=o,{timestamp:a}=p;this.history=[{...r,timestamp:a}];const{onSessionStart:h}=e;h&&h(t,Rs(o,this.history)),this.removeListeners=ii(is(this.contextWindow,"pointermove",this.handlePointerMove),is(this.contextWindow,"pointerup",this.handlePointerUp),is(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),m(this.updatePoint)}}function Ms(t,e){return e?{point:e(t.point)}:t}function Cs(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Rs({point:t},e){return{point:t,delta:Cs(t,Ls(e)),offset:Cs(t,ks(e)),velocity:Bs(e,.1)}}function ks(t){return t[0]}function Ls(t){return t[t.length-1]}function Bs(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,s=null;const n=Ls(t);for(;i>=0&&(s=t[i],!(n.timestamp-s.timestamp>rt(e)));)i--;if(!s)return{x:0,y:0};const o=at(n.timestamp-s.timestamp);if(0===o)return{x:0,y:0};const r={x:(n.x-s.x)/o,y:(n.y-s.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function js(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function Fs(t,e){let i=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,s]=[s,i]),{min:i,max:s}}const Os=.35;function Is(t,e,i){return{min:Us(t,e),max:Us(t,i)}}function Us(t,e){return"number"==typeof t?t:t[e]||0}const Ns=new WeakMap;class Ks{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new Ds(t,{onSessionStart:t=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(es(t).point)},onStart:(t,e)=>{const{drag:i,dragPropagation:s,onDragStart:n}=this.getProps();if(i&&!s&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=i)||"y"===r?wt[r]?null:(wt[r]=!0,()=>{wt[r]=!1}):wt.x||wt.y?null:(wt.x=wt.y=!0,()=>{wt.x=wt.y=!1}),!this.openDragLock))return;var r;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),cs(t=>{let e=this.getAxisMotionValue(t).get()||0;if(o.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const s=i.layout.layoutBox[t];if(s){e=ns(s)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),n&&l.postRender(()=>n(t,e)),Es(this.visualElement,"transform");const{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:i,dragDirectionLock:s,onDirectionLock:n,onDrag:o}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:r}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(r),void(null!==this.currentDirection&&n&&n(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),resumeAnimation:()=>cs(t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,contextWindow:bs(this.visualElement)})}stop(t,e){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=e;this.startAnimation(s);const{onDragEnd:n}=this.getProps();n&&l.postRender(()=>n(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:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,i){const{drag:s}=this.getProps();if(!i||!Ws(t,s,this.currentDirection))return;const n=this.getAxisMotionValue(t);let o=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:i},s){return void 0!==e&&t<e?t=s?Xe(e,t,s.min):Math.max(t,e):void 0!==i&&t>i&&(t=s?Xe(i,t,s.max):Math.min(t,i)),t}(o,this.constraints[t],this.elastic[t])),n.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:i}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,n=this.constraints;e&&g(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!s)&&function(t,{top:e,left:i,bottom:s,right:n}){return{x:js(t.x,i,n),y:js(t.y,e,s)}}(s.layoutBox,e),this.elastic=function(t=Os){return!1===t?t=0:!0===t&&(t=Os),{x:Is(t,"left","right"),y:Is(t,"top","bottom")}}(i),n!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&cs(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(s.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!g(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const n=function(t,e,i){const s=ws(t,i),{scroll:n}=e;return n&&(Ts(s.x,n.offset.x),Ts(s.y,n.offset.y)),s}(i,s.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Fs(t.x,e.x),y:Fs(t.y,e.y)}}(s.layout.layoutBox,n);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=ss(t))}return o}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:s,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=cs(r=>{if(!Ws(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:i?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...n,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return Es(this.visualElement,t),i.start(Qi(t,i,0,e,this.visualElement,!1))}stopAnimation(){cs(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){cs(t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()})}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e="_drag"+t.toUpperCase(),i=this.visualElement.getProps(),s=i[e];return s||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){cs(e=>{const{drag:i}=this.getProps();if(!Ws(e,i,this.currentDirection))return;const{projection:s}=this.visualElement,n=this.getAxisMotionValue(e);if(s&&s.layout){const{min:i,max:o}=s.layout.layoutBox[e];n.set(t[e]-Xe(i,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:i}=this.visualElement;if(!g(e)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};cs(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const s=ns(t),o=ns(e);return o>s?i=ot(e.min,e.max-s,t.min):s>o&&(i=ot(t.min,t.max-o,e.min)),n(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),cs(e=>{if(!Ws(e,t,null))return;const i=this.getAxisMotionValue(e),{min:n,max:o}=this.constraints[e];i.set(Xe(n,o,s[e]))})}addListeners(){if(!this.visualElement.current)return;Ns.set(this.visualElement,this);const t=is(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();g(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",e);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),l.read(e);const n=ts(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(cs(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{n(),t(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:n=!1,dragElastic:o=Os,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:s,dragConstraints:n,dragElastic:o,dragMomentum:r}}}function Ws(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const zs=t=>(e,i)=>{t&&l.postRender(()=>t(e,i))};function $s(t,e){-1===t.indexOf(e)&&t.push(e)}function Gs(t,e){const i=t.indexOf(e);i>-1&&t.splice(i,1)}class Ys{constructor(){this.subscriptions=[]}add(t){return $s(this.subscriptions,t),()=>Gs(this.subscriptions,t)}notify(t,e,i){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,i);else for(let n=0;n<s;n++){const s=this.subscriptions[n];s&&s(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Hs{constructor(t,e={}){this.version="12.4.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const i=We.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=We.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new Ys);const i=this.events[t].add(e);return"change"===t?()=>{i(),l.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=We.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return ui(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xs(t,e){return new Hs(t,e)}function qs(t){return t.props[y]}const _s=new WeakMap;function Zs(t,e,i){const s=t.getProps();return x(s,e,void 0!==i?i:s.custom,t)}function Js(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,Xs(i))}function Qs({protectedKeys:t,needsAnimating:e},i){const s=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,s}function tn(t,e,{delay:i=0,transitionOverride:s,type:n}={}){var o;let{transition:r=t.getDefaultTransition(),transitionEnd:a,...h}=e;s&&(r=s);const u=[],c=n&&t.animationState&&t.animationState.getState()[n];for(const e in h){const s=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),n=h[e];if(void 0===n||c&&Qs(c,e))continue;const a={delay:i,...dt(r||{},e)};let d=!1;if(window.MotionHandoffAnimation){const i=qs(t);if(i){const t=window.MotionHandoffAnimation(i,e,l);null!==t&&(a.startTime=t,d=!0)}}Es(t,e),s.start(Qi(e,s,n,t.shouldReduceMotion&&qt.has(e)?{type:!1}:a,t,d));const p=s.animation;p&&u.push(p)}return a&&Promise.all(u).then(()=>{l.update(()=>{a&&function(t,e){const i=Zs(t,e);let{transitionEnd:s={},transition:n={},...o}=i||{};o={...o,...s};for(const e in o){Js(t,e,P(o[e]))}}(t,a)})}),u}const en={current:null},sn={current:!1};const nn=[...Oe,oe,de];const on=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class rn extends class{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:s,blockInitialAnimation:n,visualState:o},r={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=ke,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=We.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,l.render(this.render,!1,!0))};const{latestValues:a,renderState:h,onUpdate:u}=o;this.onUpdate=u,this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=h,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=r,this.blockInitialAnimation=Boolean(n),this.isControllingVariants=S(e),this.isVariantNode=A(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in d){const e=d[t];void 0!==a[t]&&v(e)&&e.set(a[t],!1)}}mount(t){this.current=t,_s.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),sn.current||function(){if(sn.current=!0,T)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>en.current=t.matches;t.addListener(e),e()}else en.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||en.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),m(this.notifyUpdate),m(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),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){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=f.has(t);i&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&l.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),n=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),n(),o&&o(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in w){const e=w[t];if(!e)continue;const{isEnabled:i,Feature:s}=e;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<on.length;e++){const i=on[e];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s=t["on"+i];s&&(this.propEventSubscriptions[i]=this.on(i,s))}this.prevMotionValues=function(t,e,i){for(const s in e){const n=e[s],o=i[s];if(v(n))t.addValue(s,n);else if(v(o))t.addValue(s,Xs(n,{owner:t}));else if(o!==n)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(n):e.hasAnimated||e.set(n)}else{const e=t.getStaticValue(s);t.addValue(s,Xs(void 0!==e?e:n,{owner:t}))}}for(const s in i)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const i=this.values.get(t);e!==i&&(i&&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 i=this.values.get(t);return void 0===i&&void 0!==e&&(i=Xs(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){var i;let s=void 0===this.latestValues[t]&&this.current?null!==(i=this.getBaseTargetFromProps(this.props,t))&&void 0!==i?i:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(Le(s)||Xt(s))?s=parseFloat(s):(n=s,!nn.find(Fe(n))&&de.test(e)&&(s=xe(t,e))),this.setBaseTarget(t,v(s)?s.get():s)),v(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:i}=this.props;let s;if("string"==typeof i||"object"==typeof i){const n=x(this.props,i,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);n&&(s=n[t])}if(i&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||v(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new Ys),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}{constructor(){super(...arguments),this.KeyframeResolver=Ue}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:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;v(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=""+t)}))}}class an extends rn{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=us,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&b(this.current,this.renderState)}}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(f.has(e)){const t=ye(e);return t&&t.default||0}return e=E.has(e)?e:V(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return D(t,e,i)}onBindTransform(){this.current&&!this.renderState.dimensions&&l.postRender(this.updateDimensions)}build(t,e,i){M(t,e,this.isSVGTag,i.transformTemplate)}renderInstance(t,e,i,s){C(t,e,i,s)}mount(t){this.isSVGTag=R(t.tagName),super.mount(t)}}class ln extends rn{constructor(){super(...arguments),this.type="html",this.renderInstance=k}readValueFromInstance(t,e){if(f.has(e)){const t=ye(e);return t&&t.default||0}{const s=(i=t,window.getComputedStyle(i)),n=(L(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof n?n.trim():n}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return ws(t,e)}build(t,e,i){B(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return j(t,e,i)}}const hn=(t,e)=>t.depth-e.depth;class un{constructor(){this.children=[],this.isDirty=!1}add(t){$s(this.children,t),this.isDirty=!0}remove(t){Gs(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(hn),this.isDirty=!1,this.children.forEach(t)}}const cn=["TopLeft","TopRight","BottomLeft","BottomRight"],dn=cn.length,pn=t=>"string"==typeof t?parseFloat(t):t,mn=t=>"number"==typeof t||a.test(t);function fn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const vn=yn(0,.5,Yt),gn=yn(.5,.95,t);function yn(t,e,i){return s=>s<t?0:s>e?1:i(ot(t,e,s))}function xn(t,e){t.min=e.min,t.max=e.max}function Pn(t,e){xn(t.x,e.x),xn(t.y,e.y)}function Tn(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Sn(t,e,i,s,n){return t=gs(t-=e,1/i,s),void 0!==n&&(t=gs(t,1/n,s)),t}function An(t,e,[i,s,n],r,a){!function(t,e=0,i=1,s=.5,n,r=t,a=t){if(o.test(e)){e=parseFloat(e);e=Xe(a.min,a.max,e/100)-a.min}if("number"!=typeof e)return;let l=Xe(r.min,r.max,s);t===r&&(l-=e),t.min=Sn(t.min,e,i,l,n),t.max=Sn(t.max,e,i,l,n)}(t,e[i],e[s],e[n],e.scale,r,a)}const wn=["x","scaleX","originX"],bn=["y","scaleY","originY"];function En(t,e,i,s){An(t.x,e,wn,i?i.x:void 0,s?s.x:void 0),An(t.y,e,bn,i?i.y:void 0,s?s.y:void 0)}function Vn(t){return 0===t.translate&&1===t.scale}function Dn(t){return Vn(t.x)&&Vn(t.y)}function Mn(t,e){return t.min===e.min&&t.max===e.max}function Cn(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Rn(t,e){return Cn(t.x,e.x)&&Cn(t.y,e.y)}function kn(t){return ns(t.x)/ns(t.y)}function Ln(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Bn{constructor(){this.members=[]}add(t){$s(this.members,t),t.scheduleRender()}remove(t){if(Gs(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;!1===s&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const jn={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Fn=["","X","Y","Z"],On={visibility:"hidden"};let In=0;function Un(t,e,i,s){const{latestValues:n}=e;n[t]&&(i[t]=n[t],e.setStaticValue(t,0),s&&(s[t]=0))}function Nn({attachResizeListener:t,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(t={},i=(null==e?void 0:e())){this.id=In++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(zn),this.nodes.forEach(_n),this.nodes.forEach(Zn),this.nodes.forEach($n)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new un)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new Ys),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,i=this.root.hasTreeAnimated){if(this.instance)return;var s;this.isSVG=(s=e)instanceof SVGElement&&"svg"!==s.tagName,this.instance=e;const{layoutId:n,layout:o,visualElement:r}=this.options;if(r&&!r.current&&r.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(o||n)&&(this.isLayoutDirty=!0),t){let i;const s=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=We.now(),s=({timestamp:n})=>{const o=n-i;o>=e&&(m(s),t(o-e))};return l.read(s,!0),()=>m(s)}(s,250),jn.hasAnimatedSinceResize&&(jn.hasAnimatedSinceResize=!1,this.nodes.forEach(qn))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&r&&(n||o)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:i,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||r.getDefaultTransition()||so,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=r.getProps(),l=!this.targetLayout||!Rn(this.targetLayout,s),h=!e&&i;if(this.options.layoutRoot||this.resumeFrom||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,h);const e={...dt(n,"layout"),onPlay:o,onComplete:a};(r.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||qn(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,m(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Jn),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function t(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:i}=e.options;if(!i)return;const s=qs(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:t,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",l,!(t||i))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&t(n)}(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(Yn);this.isUpdating||this.nodes.forEach(Hn),this.isUpdating=!1,this.nodes.forEach(Xn),this.nodes.forEach(Kn),this.nodes.forEach(Wn),this.clearAllSnapshots();const t=We.now();p.delta=n(0,1e3/60,t-p.timestamp),p.timestamp=t,p.isProcessing=!0,F.update.process(p),F.preRender.process(p),F.render.process(p),p.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,O.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Gn),this.sharedNodes.forEach(Qn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,l.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){l.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||ns(this.snapshot.measuredBox.x)||ns(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.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);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=s(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!r)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Dn(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,n=s!==this.prevTransformTemplateValue;t&&(e||ms(this.latestValues)||n)&&(r(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),ro((s=i).x),ro(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const i=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(lo))){const{scroll:t}=this.root;t&&(Ts(i.x,t.offset.x),Ts(i.y,t.offset.y))}return i}removeElementScroll(t){var e;const i={x:{min:0,max:0},y:{min:0,max:0}};if(Pn(i,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return i;for(let e=0;e<this.path.length;e++){const s=this.path[e],{scroll:n,options:o}=s;s!==this.root&&n&&o.layoutScroll&&(n.wasRoot&&Pn(i,t),Ts(i.x,n.offset.x),Ts(i.y,n.offset.y))}return i}applyTransform(t,e=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};Pn(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&As(i,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),ms(s.latestValues)&&As(i,s.latestValues)}return ms(this.latestValues)&&As(i,this.latestValues),i}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};Pn(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!ms(i.latestValues))continue;ps(i.latestValues)&&i.updateSnapshot();const s={x:{min:0,max:0},y:{min:0,max:0}};Pn(s,i.measurePageBox()),En(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,s)}return ms(this.latestValues)&&En(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==p.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const s=Boolean(this.resumingFrom)||this!==i;if(!(t||s&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:o}=this.options;if(this.layout&&(n||o)){if(this.resolvedRelativeTargetAt=p.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},hs(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}var r,a,l;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?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,as(r.x,a.x,l.x),as(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Pn(this.target,this.layout.layoutBox),Ps(this.target,this.targetDelta)):Pn(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&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},hs(this.relativeTargetOrigin,this.target,t.target),Pn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(this.parent&&!ps(this.parent.latestValues)&&!fs(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),i=Boolean(this.resumingFrom)||this!==e;let s=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(s=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===p.timestamp&&(s=!1),s)return;const{layout:n,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!o)return;Pn(this.layoutCorrected,this.layout.layoutBox);const r=this.treeScale.x,a=this.treeScale.y;!function(t,e,i,s=!1){const n=i.length;if(!n)return;let o,r;e.x=e.y=1;for(let a=0;a<n;a++){o=i[a],r=o.projectionDelta;const{visualElement:n}=o.options;n&&n.props.style&&"contents"===n.props.style.display||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&As(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,Ps(t,r)),s&&ms(o.latestValues)&&As(t,o.latestValues))}e.x<1.0000000000001&&e.x>.999999999999&&(e.x=1),e.y<1.0000000000001&&e.y>.999999999999&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,i),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=e;l?(this.projectionDelta&&this.prevProjectionDelta?(Tn(this.prevProjectionDelta.x,this.projectionDelta.x),Tn(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),rs(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===r&&this.treeScale.y===a&&Ln(this.projectionDelta.x,this.prevProjectionDelta.x)&&Ln(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},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}}}setAnimationOrigin(t,e=!1){const i=this.snapshot,s=i?i.latestValues:{},n={...this.latestValues},r={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 a={x:{min:0,max:0},y:{min:0,max:0}},l=(i?i.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(io));let d;this.animationProgress=0,this.mixTargetDelta=e=>{const i=e/1e3;var h,p,m,f,v,g;to(r.x,t.x,i),to(r.y,t.y,i),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(hs(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,f=this.relativeTargetOrigin,v=a,g=i,eo(m.x,f.x,v.x,g),eo(m.y,f.y,v.y,g),d&&(h=this.relativeTarget,p=d,Mn(h.x,p.x)&&Mn(h.y,p.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Pn(d,this.relativeTarget)),l&&(this.animationValues=n,function(t,e,i,s,n,r){n?(t.opacity=Xe(0,void 0!==i.opacity?i.opacity:1,vn(s)),t.opacityExit=Xe(void 0!==e.opacity?e.opacity:1,0,gn(s))):r&&(t.opacity=Xe(void 0!==e.opacity?e.opacity:1,void 0!==i.opacity?i.opacity:1,s));for(let n=0;n<dn;n++){const r=`border${cn[n]}Radius`;let a=fn(e,r),l=fn(i,r);if(void 0===a&&void 0===l)continue;a||(a=0),l||(l=0);0===a||0===l||mn(a)===mn(l)?(t[r]=Math.max(Xe(pn(a),pn(l),s),0),(o.test(l)||o.test(a))&&(t[r]+="%")):t[r]=l}(e.rotate||i.rotate)&&(t.rotate=Xe(e.rotate||0,i.rotate||0,s))}(n,s,this.latestValues,i,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},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&&(m(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=l.update(()=>{jn.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,i){const s=v(t)?t:Xs(t);return s.start(Qi("",s,e,i)),s.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:n}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&ao(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=ns(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=ns(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}Pn(e,i),As(e,n),rs(this.projectionDeltaWithTransform,this.layoutCorrected,e,n)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new Bn);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){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:i}={}){const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&Un("z",t,s,this.animationValues);for(let e=0;e<Fn.length;e++)Un("rotate"+Fn[e],t,s,this.animationValues),Un("skew"+Fn[e],t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}getProjectionStyles(t){var e,i;if(!this.instance||this.isSVG)return;if(!this.isVisible)return On;const s={visibility:""},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=I(null==t?void 0:t.pointerEvents)||"",s.transform=n?n(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=I(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!ms(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1),e}const r=o.animationValues||o.latestValues;this.applyTransformsToTarget(),s.transform=function(t,e,i){let s="";const n=t.x.translate/e.x,o=t.y.translate/e.y,r=(null==i?void 0:i.z)||0;if((n||o||r)&&(s=`translate3d(${n}px, ${o}px, ${r}px) `),1===e.x&&1===e.y||(s+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:n,rotateY:o,skewX:r,skewY:a}=i;t&&(s=`perspective(${t}px) ${s}`),e&&(s+=`rotate(${e}deg) `),n&&(s+=`rotateX(${n}deg) `),o&&(s+=`rotateY(${o}deg) `),r&&(s+=`skewX(${r}deg) `),a&&(s+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return 1===a&&1===l||(s+=`scale(${a}, ${l})`),s||"none"}(this.projectionDeltaWithTransform,this.treeScale,r),n&&(s.transform=n(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!==(i=null!==(e=r.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==i?i: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 U){if(void 0===r[t])continue;const{correct:e,applyTo:i,isCSSVariable:n}=U[t],a="none"===s.transform?r[t]:e(r[t],o);if(i){const t=i.length;for(let e=0;e<t;e++)s[i[e]]=a}else n?this.options.visualElement.renderState.vars[t]=a:s[t]=a}return this.options.layoutId&&(s.pointerEvents=o===this?I(null==t?void 0: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(Yn),this.root.sharedNodes.clear()}}}function Kn(t){t.updateLayout()}function Wn(t){var e;const i=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:n}=t.options,o=i.source!==t.layout.source;"size"===n?cs(t=>{const s=o?i.measuredBox[t]:i.layoutBox[t],n=ns(s);s.min=e[t].min,s.max=s.min+n}):ao(n,i.layoutBox,e)&&cs(s=>{const n=o?i.measuredBox[s]:i.layoutBox[s],r=ns(e[s]);n.max=n.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};rs(r,e,i.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?rs(a,t.applyTransform(s,!0),i.measuredBox):rs(a,e,i.layoutBox);const l=!Dn(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:n,layout:o}=s;if(n&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};hs(r,i.layoutBox,n.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};hs(a,e,o.layoutBox),Rn(r,a)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:i,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function zn(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function $n(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Gn(t){t.clearSnapshot()}function Yn(t){t.clearMeasurements()}function Hn(t){t.isLayoutDirty=!1}function Xn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function qn(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function _n(t){t.resolveTargetDelta()}function Zn(t){t.calcProjection()}function Jn(t){t.resetSkewAndRotation()}function Qn(t){t.removeLeadSnapshot()}function to(t,e,i){t.translate=Xe(e.translate,0,i),t.scale=Xe(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function eo(t,e,i,s){t.min=Xe(e.min,i.min,s),t.max=Xe(e.max,i.max,s)}function io(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const so={duration:.45,ease:[.4,0,.1,1]},no=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),oo=no("applewebkit/")&&!no("chrome/")?Math.round:t;function ro(t){t.min=oo(t.min),t.max=oo(t.max)}function ao(t,e,i){return"position"===t||"preserve-aspect"===t&&(s=kn(e),n=kn(i),o=.2,!(Math.abs(s-n)<=o));var s,n,o}function lo(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const ho=Nn({attachResizeListener:(t,e)=>ts(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),uo={current:void 0},co=Nn({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!uo.current){const t=new ho({});t.mount(window),t.setOptions({layoutScroll:!0}),uo.current=t}return uo.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function po(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const mo={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!a.test(t))return t;t=parseFloat(t)}return`${po(t,e.target.x)}% ${po(t,e.target.y)}%`}},fo={correct:(t,{treeScale:e,projectionDelta:i})=>{const s=t,n=de.parse(t);if(n.length>5)return s;const o=de.createTransformer(t),r="number"!=typeof n[0]?1:0,a=i.x.scale*e.x,l=i.y.scale*e.y;n[0+r]/=a,n[1+r]/=l;const h=Xe(a,l,.5);return"number"==typeof n[2+r]&&(n[2+r]/=h),"number"==typeof n[3+r]&&(n[3+r]/=h),o(n)}};class vo extends et{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:s}=this.props,{projection:n}=t;z(yo),n&&(e.group&&e.group.add(n),i&&i.register&&s&&i.register(n),n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,onExitComplete:()=>this.safeToRemove()})),jn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:s,isPresent:n}=this.props,o=i.projection;return o?(o.isPresent=n,s||t.layoutDependency!==e||void 0===e||t.isPresent!==n?o.willUpdate():this.safeToRemove(),t.isPresent!==n&&(n?o.promote():o.relegate()||l.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),O.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function go(t){const[e,i]=function(t=!0){const e=Z(N);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:s,register:n}=e,o=J();Q(()=>{if(t)return n(o)},[t]);const r=tt(()=>t&&s&&s(o),[o,s,t]);return!i&&s?[!1,r]:[!0]}(),s=Z(K);return _(vo,{...t,layoutGroup:s,switchLayoutGroup:Z(W),isPresent:e,safeToRemove:i})}const yo={borderRadius:{...mo,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:mo,borderTopRightRadius:mo,borderBottomLeftRadius:mo,borderBottomRightRadius:mo,boxShadow:fo},xo={pan:{Feature:class extends ht{constructor(){super(...arguments),this.removePointerDownListener=t}onPointerDown(t){this.session=new Ds(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:bs(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:zs(t),onStart:zs(e),onMove:i,onEnd:(t,e)=>{delete this.session,s&&l.postRender(()=>s(t,e))}}}mount(){this.removePointerDownListener=is(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 ht{constructor(e){super(e),this.removeGroupControls=t,this.removeListeners=t,this.controls=new Ks(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||t}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:co,MeasureLayout:go}},Po={layout:{ProjectionNode:co,MeasureLayout:go}};function To(t,e,i={}){var s;const n=Zs(t,e,"exit"===i.type?null===(s=t.presenceContext)||void 0===s?void 0:s.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=n||{};i.transitionOverride&&(o=i.transitionOverride);const r=n?()=>Promise.all(tn(t,n,i)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:n=0,staggerChildren:r,staggerDirection:a}=o;return function(t,e,i=0,s=0,n=1,o){const r=[],a=(t.variantChildren.size-1)*s,l=1===n?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(So).forEach((t,s)=>{t.notify("AnimationStart",e),r.push(To(t,e,{...o,delay:i+l(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(r)}(t,e,n+s,r,a,i)}:()=>Promise.resolve(),{when:l}=o;if(l){const[t,e]="beforeChildren"===l?[r,a]:[a,r];return t().then(()=>e())}return Promise.all([r(),a(i.delay)])}function So(t,e){return t.sortNodePosition(e)}function Ao(t,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==t.length)return!1;for(let s=0;s<i;s++)if(e[s]!==t[s])return!1;return!0}const wo=G.length;const bo=[...X].reverse(),Eo=X.length;function Vo(t){return e=>Promise.all(e.map(({animation:e,options:i})=>function(t,e,i={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const n=e.map(e=>To(t,e,i));s=Promise.all(n)}else if("string"==typeof e)s=To(t,e,i);else{const n="function"==typeof e?Zs(t,e,i.custom):e;s=Promise.all(tn(t,n,i))}return s.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function Do(t){let e=Vo(t),i=Ro(),s=!0;const n=e=>(i,s)=>{var n;const o=Zs(t,s,"exit"===e?null===(n=t.presenceContext)||void 0===n?void 0:n.custom:void 0);if(o){const{transition:t,transitionEnd:e,...s}=o;i={...i,...s,...e}}return i};function o(o){const{props:r}=t,a=function t(e){if(!e)return;if(!e.isControllingVariants){const i=e.parent&&t(e.parent)||{};return void 0!==e.props.initial&&(i.initial=e.props.initial),i}const i={};for(let t=0;t<wo;t++){const s=G[t],n=e.props[s];($(n)||!1===n)&&(i[s]=n)}return i}(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<Eo;e++){const d=bo[e],p=i[d],m=void 0!==r[d]?r[d]:a[d],f=$(m),v=d===o?p.isActive:null;!1===v&&(c=e);let g=m===a[d]&&m!==r[d]&&f;if(g&&s&&t.manuallyAnimateOnMount&&(g=!1),p.protectedKeys={...u},!p.isActive&&null===v||!m&&!p.prevProp||Y(m)||"boolean"==typeof m)continue;const y=Mo(p.prevProp,m);let x=y||d===o&&p.isActive&&!g&&f||e>c&&f,P=!1;const T=Array.isArray(m)?m:[m];let S=T.reduce(n(d),{});!1===v&&(S={});const{prevResolvedValues:A={}}=p,w={...A,...S},b=e=>{x=!0,h.has(e)&&(P=!0,h.delete(e)),p.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in w){const e=S[t],i=A[t];if(u.hasOwnProperty(t))continue;let s=!1;s=H(e)&&H(i)?!Ao(e,i):e!==i,s?null!=e?b(t):h.add(t):void 0!==e&&h.has(t)?b(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),s&&t.blockInitialAnimation&&(x=!1);const E=!(g&&y)||P;x&&E&&l.push(...T.map(t=>({animation:t,options:{type:d}})))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=Zs(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const s=t.getBaseTarget(i),n=t.getValue(i);n&&(n.liveStyle=!0),e[i]=null!=s?s:null}),l.push({animation:e})}let d=Boolean(l.length);return!s||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),s=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,s){var n;if(i[e].isActive===s)return Promise.resolve();null===(n=t.variantChildren)||void 0===n||n.forEach(t=>{var i;return null===(i=t.animationState)||void 0===i?void 0:i.setActive(e,s)}),i[e].isActive=s;const r=o(e);for(const t in i)i[t].protectedKeys={};return r},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=Ro(),s=!0}}}function Mo(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Ao(e,t)}function Co(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ro(){return{animate:Co(!0),whileInView:Co(),whileHover:Co(),whileTap:Co(),whileDrag:Co(),whileFocus:Co(),exit:Co()}}let ko=0;const Lo={animation:{Feature:class extends ht{constructor(t){super(t),t.animationState||(t.animationState=Do(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Y(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends ht{constructor(){super(...arguments),this.id=ko++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const s=this.node.animationState.setActive("exit",!t);e&&!t&&s.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function Bo(t,e,i){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover","Start"===i);const n=s["onHover"+i];n&&l.postRender(()=>n(e,es(e)))}function jo(t,e,i){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap","Start"===i);const n=s["onTap"+("End"===i?"":i)];n&&l.postRender(()=>n(e,es(e)))}const Fo=new WeakMap,Oo=new WeakMap,Io=t=>{const e=Fo.get(t.target);e&&e(t)},Uo=t=>{t.forEach(Io)};function No(t,e,i){const s=function({root:t,...e}){const i=t||document;Oo.has(i)||Oo.set(i,{});const s=Oo.get(i),n=JSON.stringify(e);return s[n]||(s[n]=new IntersectionObserver(Uo,{root:t,...e})),s[n]}(e);return Fo.set(t,i),s.observe(t),()=>{Fo.delete(t),s.unobserve(t)}}const Ko={some:0,all:1};const Wo={...{renderer:(t,e)=>q(t)?new an(e):new ln(e,{allowProjection:t!==it}),...Lo,...{inView:{Feature:class extends ht{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:s="some",once:n}=t,o={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof s?s:Ko[s]};return No(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,n&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:i,onViewportLeave:s}=this.node.getProps(),o=e?i: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 i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends ht{mount(){const{current:t}=this.node;t&&(this.unmount=Ft(t,(t,e)=>(jo(this.node,e,"Start"),(t,{success:e})=>jo(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends ht{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ii(ts(this.node.current,"focus",()=>this.onFocus()),ts(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends ht{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[s,n,o]=Et(t,i),r=t=>{if(!Vt(t))return;const{target:i}=t,s=e(i,t);if("function"!=typeof s||!i)return;const o=t=>{Vt(t)&&(s(t),i.removeEventListener("pointerleave",o))};i.addEventListener("pointerleave",o,n)};return s.forEach(t=>{t.addEventListener("pointerenter",r,n)}),o}(t,(t,e)=>(Bo(this.node,e,"Start"),t=>Bo(this.node,t,"End"))))}unmount(){}}}}},...xo,...Po};export{Wo as domMax};
|
|
1
|
+
import{x as t,y as e,z as i,A as s,B as n,C as o,D as r,E as a,u as l,F as h,G as u,H as c,I as d,J as p,K as m,t as f,d as v,b as g,o as y,p as x,M as P,c as T,i as S,l as w,f as A,v as b,N as E,O as V,q as M,h as D,w as C,j as R,Q as k,R as L,g as B,s as j,T as F,m as O,r as I,U,P as N,L as K,S as z,V as W,a as Y,W as $,n as X,X as G,Y as H,k as q}from"./size-rollup-dom-max-assets.js";import{jsx as _}from"react/jsx-runtime";import{useContext as Z,useId as J,useEffect as Q,useCallback as tt,Component as et,Fragment as it}from"react";let st=t;function nt(t){let e;return()=>(void 0===e&&(e=t()),e)}const ot=(t,e,i)=>{const s=e-t;return 0===s?1:(i-t)/s},rt=t=>1e3*t,at=t=>t/1e3,lt=!1;class ht{constructor(t){this.isMounted=!1,this.node=t}update(){}}const ut=nt(()=>void 0!==window.ScrollTimeline);class ct extends class{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>"finished"in t?t.finished:t))}getAll(t){return this.animations[0][t]}setAll(t,e){for(let i=0;i<this.animations.length;i++)this.animations[i][t]=e}attachTimeline(t,e){const i=this.animations.map(i=>ut()&&i.attachTimeline?i.attachTimeline(t):"function"==typeof e?e(i):void 0);return()=>{i.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get startTime(){return this.getAll("startTime")}get duration(){let t=0;for(let e=0;e<this.animations.length;e++)t=Math.max(t,this.animations[e].duration);return t}runAll(t){this.animations.forEach(e=>e[t]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}{then(t,e){return Promise.all(this.animations).then(t).catch(e)}}function dt(t,e){return t?t[e]||t.default||t:void 0}function pt(t){let e=0;let i=t.next(e);for(;!i.done&&e<2e4;)e+=50,i=t.next(e);return e>=2e4?1/0:e}function mt(t){return"function"==typeof t}function ft(t,e){t.timeline=e,t.onfinish=null}const vt=t=>Array.isArray(t)&&"number"==typeof t[0],gt={linearEasing:void 0};function yt(t,e){const i=nt(t);return()=>{var t;return null!==(t=gt[e])&&void 0!==t?t:i()}}const xt=yt(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),Pt=(t,e,i=10)=>{let s="";const n=Math.max(Math.round(e/i),2);for(let e=0;e<n;e++)s+=t(ot(0,n-1,e))+", ";return`linear(${s.substring(0,s.length-2)})`};function Tt(t){return Boolean("function"==typeof t&&xt()||!t||"string"==typeof t&&(t in wt||xt())||vt(t)||Array.isArray(t)&&t.every(Tt))}const St=([t,e,i,s])=>`cubic-bezier(${t}, ${e}, ${i}, ${s})`,wt={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:St([0,.65,.55,1]),circOut:St([.55,0,1,.45]),backIn:St([.31,.01,.66,-.59]),backOut:St([.33,1.53,.69,.99])};const At={x:!1,y:!1};function bt(){return At.x||At.y}function Et(t,e){const i=function(t,e,i){var s;if(t instanceof EventTarget)return[t];if("string"==typeof t){let n=document;e&&(n=e.current);const o=null!==(s=null==i?void 0:i[t])&&void 0!==s?s:n.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}(t),s=new AbortController;return[i,{passive:!0,...e,signal:s.signal},()=>s.abort()]}function Vt(t){return!("touch"===t.pointerType||bt())}function Mt(t,e){const i=e+"PointerCapture";if(t.target instanceof Element&&i in t.target&&void 0!==t.pointerId)try{t.target[i](t.pointerId)}catch(t){}}const Dt=(t,e)=>!!e&&(t===e||Dt(t,e.parentElement)),Ct=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,Rt=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const kt=new WeakSet;function Lt(t){return e=>{"Enter"===e.key&&t(e)}}function Bt(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}function jt(t){return Ct(t)&&!bt()}function Ft(t,e,i={}){const[s,n,o]=Et(t,i),r=t=>{const i=t.currentTarget;if(!i||!jt(t)||kt.has(i))return;kt.add(i),Mt(t,"set");const s=e(i,t),o=(t,e)=>{i.removeEventListener("pointerup",r),i.removeEventListener("pointercancel",a),Mt(t,"release"),jt(t)&&kt.has(i)&&(kt.delete(i),"function"==typeof s&&s(t,{success:e}))},r=t=>{const e=!!t.isTrusted&&(s=t,n=i instanceof Element?i.getBoundingClientRect():{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight},s.clientX<n.left||s.clientX>n.right||s.clientY<n.top||s.clientY>n.bottom);var s,n;o(t,!e&&(!(i instanceof Element)||Dt(i,t.target)))},a=t=>{o(t,!1)};i.addEventListener("pointerup",r,n),i.addEventListener("pointercancel",a,n),i.addEventListener("lostpointercapture",a,n)};return s.forEach(t=>{let e=!1;var s;(t=i.useGlobalTarget?window:t)instanceof HTMLElement&&(e=!0,s=t,Rt.has(s.tagName)||-1!==s.tabIndex||null!==t.getAttribute("tabindex")||(t.tabIndex=0)),t.addEventListener("pointerdown",r,n),e&&t.addEventListener("focus",t=>((t,e)=>{const i=t.currentTarget;if(!i)return;const s=Lt(()=>{if(kt.has(i))return;Bt(i,"down");const t=Lt(()=>{Bt(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>Bt(i,"cancel"),e)});i.addEventListener("keydown",s,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",s),e)})(t,n),n)}),o}const Ot=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function It(e,i,s,n){if(e===i&&s===n)return t;const o=t=>function(t,e,i,s,n){let o,r,a=0;do{r=e+(i-e)/2,o=Ot(r,s,n)-t,o>0?i=r:e=r}while(Math.abs(o)>1e-7&&++a<12);return r}(t,0,1,e,s);return t=>0===t||1===t?t:Ot(o(t),i,n)}const Ut=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Nt=t=>e=>1-t(1-e),Kt=It(.33,1.53,.69,.99),zt=Nt(Kt),Wt=Ut(zt),Yt=t=>(t*=2)<1?.5*zt(t):.5*(2-Math.pow(2,-10*(t-1))),$t=t=>1-Math.sin(Math.acos(t)),Xt=Nt($t),Gt=Ut($t),Ht=t=>/^0[^.\s]+$/u.test(t);const qt=new Set(["width","height","top","left","right","bottom",...e]),_t=t=>Math.round(1e5*t)/1e5,Zt=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Jt=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qt=(t,e)=>i=>Boolean("string"==typeof i&&Jt.test(i)&&i.startsWith(t)||e&&!function(t){return null==t}(i)&&Object.prototype.hasOwnProperty.call(i,e)),te=(t,e,i)=>s=>{if("string"!=typeof s)return s;const[n,o,r,a]=s.match(Zt);return{[t]:parseFloat(n),[e]:parseFloat(o),[i]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},ee={...i,transform:t=>Math.round((t=>n(0,255,t))(t))},ie={test:Qt("rgb","red"),parse:te("red","green","blue"),transform:({red:t,green:e,blue:i,alpha:n=1})=>"rgba("+ee.transform(t)+", "+ee.transform(e)+", "+ee.transform(i)+", "+_t(s.transform(n))+")"};const se={test:Qt("#"),parse:function(t){let e="",i="",s="",n="";return t.length>5?(e=t.substring(1,3),i=t.substring(3,5),s=t.substring(5,7),n=t.substring(7,9)):(e=t.substring(1,2),i=t.substring(2,3),s=t.substring(3,4),n=t.substring(4,5),e+=e,i+=i,s+=s,n+=n),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(s,16),alpha:n?parseInt(n,16)/255:1}},transform:ie.transform},ne={test:Qt("hsl","hue"),parse:te("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:i,alpha:n=1})=>"hsla("+Math.round(t)+", "+o.transform(_t(e))+", "+o.transform(_t(i))+", "+_t(s.transform(n))+")"},oe={test:t=>ie.test(t)||se.test(t)||ne.test(t),parse:t=>ie.test(t)?ie.parse(t):ne.test(t)?ne.parse(t):se.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?ie.transform(t):ne.transform(t)},re=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;const ae=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function le(t){const e=t.toString(),i=[],s={color:[],number:[],var:[]},n=[];let o=0;const r=e.replace(ae,t=>(oe.test(t)?(s.color.push(o),n.push("color"),i.push(oe.parse(t))):t.startsWith("var(")?(s.var.push(o),n.push("var"),i.push(t)):(s.number.push(o),n.push("number"),i.push(parseFloat(t))),++o,"${}")).split("${}");return{values:i,split:r,indexes:s,types:n}}function he(t){return le(t).values}function ue(t){const{split:e,types:i}=le(t),s=e.length;return t=>{let n="";for(let o=0;o<s;o++)if(n+=e[o],void 0!==t[o]){const e=i[o];n+="number"===e?_t(t[o]):"color"===e?oe.transform(t[o]):t[o]}return n}}const ce=t=>"number"==typeof t?0:t;const de={test:function(t){var e,i;return isNaN(t)&&"string"==typeof t&&((null===(e=t.match(Zt))||void 0===e?void 0:e.length)||0)+((null===(i=t.match(re))||void 0===i?void 0:i.length)||0)>0},parse:he,createTransformer:ue,getAnimatableNone:function(t){const e=he(t);return ue(t)(e.map(ce))}},pe=new Set(["brightness","contrast","saturate","opacity"]);function me(t){const[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[s]=i.match(Zt)||[];if(!s)return t;const n=i.replace(s,"");let o=pe.has(e)?1:0;return s!==i&&(o*=100),e+"("+o+n+")"}const fe=/\b([a-z-]*)\(.*?\)/gu,ve={...de,getAnimatableNone:t=>{const e=t.match(fe);return e?e.map(me).join(" "):t}},ge={...r,color:oe,backgroundColor:oe,outlineColor:oe,fill:oe,stroke:oe,borderColor:oe,borderTopColor:oe,borderRightColor:oe,borderBottomColor:oe,borderLeftColor:oe,filter:ve,WebkitFilter:ve},ye=t=>ge[t];function xe(t,e){let i=ye(t);return i!==ve&&(i=de),i.getAnimatableNone?i.getAnimatableNone(e):void 0}const Pe=new Set(["auto","none","0"]);const Te=t=>180*t/Math.PI,Se=t=>{const e=Te(Math.atan2(t[1],t[0]));return Ae(e)},we={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Se,rotateZ:Se,skewX:t=>Te(Math.atan(t[1])),skewY:t=>Te(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ae=t=>((t%=360)<0&&(t+=360),t),be=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Ee=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),Ve={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:be,scaleY:Ee,scale:t=>(be(t)+Ee(t))/2,rotateX:t=>Ae(Te(Math.atan2(t[6],t[5]))),rotateY:t=>Ae(Te(Math.atan2(-t[2],t[0]))),rotateZ:Se,rotate:Se,skewX:t=>Te(Math.atan(t[4])),skewY:t=>Te(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Me(t){return t.includes("scale")?1:0}function De(t,e){if(!t||"none"===t)return Me(e);const i=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,n;if(i)s=Ve,n=i;else{const e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=we,n=e}if(!n)return Me(e);const o=s[e],r=n[1].split(",").map(Ce);return"function"==typeof o?o(r):r[o]}function Ce(t){return parseFloat(t.trim())}const Re=t=>t===i||t===a,ke=new Set(["x","y","z"]),Le=e.filter(t=>!ke.has(t));const Be={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>De(e,"x"),y:(t,{transform:e})=>De(e,"y")};Be.translateX=Be.x,Be.translateY=Be.y;const je=new Set;let Fe=!1,Oe=!1;function Ie(){if(Oe){const t=Array.from(je).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{const e=function(t){const e=[];return Le.forEach(i=>{const s=t.getValue(i);void 0!==s&&(e.push([i,s.get()]),s.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,i])=>{var s;null===(s=t.getValue(e))||void 0===s||s.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}Oe=!1,Fe=!1,je.forEach(t=>t.complete()),je.clear()}function Ue(){je.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Oe=!0)})}class Ne{constructor(t,e,i,s,n,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=s,this.element=n,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(je.add(this),Fe||(Fe=!0,l.read(Ue),l.resolveKeyframes(Ie))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:i,motionValue:s}=this;for(let n=0;n<t.length;n++)if(null===t[n])if(0===n){const n=null==s?void 0:s.get(),o=t[t.length-1];if(void 0!==n)t[0]=n;else if(i&&e){const s=i.readValue(e,o);null!=s&&(t[0]=s)}void 0===t[0]&&(t[0]=o),s&&void 0===n&&s.set(t[0])}else t[n]=t[n-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),je.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,je.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ke=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),ze=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function We(t,e,i=1){const[s,n]=function(t){const e=ze.exec(t);if(!e)return[,];const[,i,s,n]=e;return["--"+(null!=i?i:s),n]}(t);if(!s)return;const o=window.getComputedStyle(e).getPropertyValue(s);if(o){const t=o.trim();return Ke(t)?parseFloat(t):t}return h(n)?We(n,e,i+1):n}const Ye=t=>e=>e.test(t),$e=[i,a,o,u,c,d,{test:t=>"auto"===t,parse:t=>t}],Xe=t=>$e.find(Ye(t));class Ge extends Ne{constructor(t,e,i,s,n){super(t,e,i,s,n,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i<t.length;i++){let s=t[i];if("string"==typeof s&&(s=s.trim(),h(s))){const n=We(s,e.current);void 0!==n&&(t[i]=n),i===t.length-1&&(this.finalKeyframe=s)}}if(this.resolveNoneKeyframes(),!qt.has(i)||2!==t.length)return;const[s,n]=t,o=Xe(s),r=Xe(n);if(o!==r)if(Re(o)&&Re(r))for(let e=0;e<t.length;e++){const i=t[e];"string"==typeof i&&(t[e]=parseFloat(i))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,i=[];for(let e=0;e<t.length;e++)("number"==typeof(s=t[e])?0===s:null===s||"none"===s||"0"===s||Ht(s))&&i.push(e);var s;i.length&&function(t,e,i){let s=0,n=void 0;for(;s<t.length&&!n;){const e=t[s];"string"==typeof e&&!Pe.has(e)&&le(e).values.length&&(n=t[s]),s++}if(n&&i)for(const s of e)t[s]=xe(i,n)}(t,i,e)}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:i}=this;if(!t||!t.current)return;"height"===i&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Be[i](t.measureViewportBox(),window.getComputedStyle(t.current)),e[0]=this.measuredOrigin;const s=e[e.length-1];void 0!==s&&t.getValue(i,s).jump(s,!1)}measureEndState(){var t;const{element:e,name:i,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const n=e.getValue(i);n&&n.jump(this.measuredOrigin,!1);const o=s.length-1,r=s[o];s[o]=Be[i](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==r&&void 0===this.finalKeyframe&&(this.finalKeyframe=r),(null===(t=this.removedTransforms)||void 0===t?void 0:t.length)&&this.removedTransforms.forEach(([t,i])=>{e.getValue(t).set(i)}),this.resolveNoneKeyframes()}}let He;function qe(){He=void 0}const _e={now:()=>(void 0===He&&_e.set(p.isProcessing||lt?p.timestamp:performance.now()),He),set:t=>{He=t,queueMicrotask(qe)}},Ze=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!de.test(t)&&"0"!==t||t.startsWith("url(")));function Je(t,e,i,s){const n=t[0];if(null===n)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=Ze(n,e),a=Ze(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let i=0;i<t.length;i++)if(t[i]!==e)return!0}(t)||("spring"===i||mt(i))&&s)}const Qe=t=>null!==t;function ti(t,{repeat:e,repeatType:i="loop"},s){const n=t.filter(Qe),o=e&&"loop"!==i&&e%2==1?0:n.length-1;return o&&void 0!==s?s:n[o]}class ei{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:s=0,repeatDelay:n=0,repeatType:o="loop",...r}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=_e.now(),this.options={autoplay:t,delay:e,type:i,repeat:s,repeatDelay:n,repeatType:o,...r},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(Ue(),Ie()),this._resolved}onKeyframesResolved(t,e){this.resolvedAt=_e.now(),this.hasAttemptedResolve=!0;const{name:i,type:s,velocity:n,delay:o,onComplete:r,onUpdate:a,isGenerator:l}=this.options;if(!l&&!Je(t,i,s,n)){if(!o)return a&&a(ti(t,this.options,e)),r&&r(),void this.resolveFinishedPromise();this.options.duration=0}const h=this.initPlayback(t,e);!1!==h&&(this._resolved={keyframes:t,finalKeyframe:e,...h},this.onPostResolved())}onPostResolved(){}then(t,e){return this.currentFinishedPromise.then(t,e)}flatten(){this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear")}updateFinishedPromise(){this.currentFinishedPromise=new Promise(t=>{this.resolveFinishedPromise=t})}}const ii=(t,e,i)=>t+(e-t)*i;function si(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function ni(t,e){return i=>i>0?e:t}const oi=(t,e,i)=>{const s=t*t,n=i*(e*e-s)+s;return n<0?0:Math.sqrt(n)},ri=[se,ie,ne];function ai(t){const e=(i=t,ri.find(t=>t.test(i)));var i;if(!Boolean(e))return!1;let s=e.parse(t);return e===ne&&(s=function({hue:t,saturation:e,lightness:i,alpha:s}){t/=360,i/=100;let n=0,o=0,r=0;if(e/=100){const s=i<.5?i*(1+e):i+e-i*e,a=2*i-s;n=si(a,s,t+1/3),o=si(a,s,t),r=si(a,s,t-1/3)}else n=o=r=i;return{red:Math.round(255*n),green:Math.round(255*o),blue:Math.round(255*r),alpha:s}}(s)),s}const li=(t,e)=>{const i=ai(t),s=ai(e);if(!i||!s)return ni(t,e);const n={...i};return t=>(n.red=oi(i.red,s.red,t),n.green=oi(i.green,s.green,t),n.blue=oi(i.blue,s.blue,t),n.alpha=ii(i.alpha,s.alpha,t),ie.transform(n))},hi=(t,e)=>i=>e(t(i)),ui=(...t)=>t.reduce(hi),ci=new Set(["none","hidden"]);function di(t,e){return i=>ii(t,e,i)}function pi(t){return"number"==typeof t?di:"string"==typeof t?h(t)?ni:oe.test(t)?li:vi:Array.isArray(t)?mi:"object"==typeof t?oe.test(t)?li:fi:ni}function mi(t,e){const i=[...t],s=i.length,n=t.map((t,i)=>pi(t)(t,e[i]));return t=>{for(let e=0;e<s;e++)i[e]=n[e](t);return i}}function fi(t,e){const i={...t,...e},s={};for(const n in i)void 0!==t[n]&&void 0!==e[n]&&(s[n]=pi(t[n])(t[n],e[n]));return t=>{for(const e in s)i[e]=s[e](t);return i}}const vi=(t,e)=>{const i=de.createTransformer(e),s=le(t),n=le(e);return s.indexes.var.length===n.indexes.var.length&&s.indexes.color.length===n.indexes.color.length&&s.indexes.number.length>=n.indexes.number.length?ci.has(t)&&!n.values.length||ci.has(e)&&!s.values.length?function(t,e){return ci.has(t)?i=>i<=0?t:e:i=>i>=1?e:t}(t,e):ui(mi(function(t,e){var i;const s=[],n={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const r=e.types[o],a=t.indexes[r][n[r]],l=null!==(i=t.values[a])&&void 0!==i?i:0;s[o]=l,n[r]++}return s}(s,n),n.values),i):ni(t,e)};function gi(t,e,i){if("number"==typeof t&&"number"==typeof e&&"number"==typeof i)return ii(t,e,i);return pi(t)(t,e)}function yi(t,e){return e?t*(1e3/e):0}function xi(t,e,i){const s=Math.max(e-5,0);return yi(i-t(s),e-s)}const Pi=100,Ti=10,Si=1,wi=0,Ai=800,bi=.3,Ei=.3,Vi={granular:.01,default:2},Mi={granular:.005,default:.5},Di=.01,Ci=10,Ri=.05,ki=1;function Li({duration:t=Ai,bounce:e=bi,velocity:i=wi,mass:s=Si}){let o,r,a=1-e;a=n(Ri,ki,a),t=n(Di,Ci,at(t)),a<1?(o=e=>{const s=e*a,n=s*t;return.001-(s-i)/Bi(e,a)*Math.exp(-n)},r=e=>{const s=e*a*t,n=s*i+i,r=Math.pow(a,2)*Math.pow(e,2)*t,l=Math.exp(-s),h=Bi(Math.pow(e,2),a);return(.001-o(e)>0?-1:1)*((n-r)*l)/h}):(o=e=>Math.exp(-e*t)*((e-i)*t+1)-.001,r=e=>Math.exp(-e*t)*(t*t*(i-e)));const l=function(t,e,i){let s=i;for(let i=1;i<12;i++)s-=t(s)/e(s);return s}(o,r,5/t);if(t=rt(t),isNaN(l))return{stiffness:Pi,damping:Ti,duration:t};{const e=Math.pow(l,2)*s;return{stiffness:e,damping:2*a*Math.sqrt(s*e),duration:t}}}function Bi(t,e){return t*Math.sqrt(1-e*e)}const ji=["duration","bounce"],Fi=["stiffness","damping","mass"];function Oi(t,e){return e.some(e=>void 0!==t[e])}function Ii(t=Ei,e=bi){const i="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:o}=i;const r=i.keyframes[0],a=i.keyframes[i.keyframes.length-1],l={done:!1,value:r},{stiffness:h,damping:u,mass:c,duration:d,velocity:p,isResolvedFromDuration:m}=function(t){let e={velocity:wi,stiffness:Pi,damping:Ti,mass:Si,isResolvedFromDuration:!1,...t};if(!Oi(t,Fi)&&Oi(t,ji))if(t.visualDuration){const i=t.visualDuration,s=2*Math.PI/(1.2*i),o=s*s,r=2*n(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:Si,stiffness:o,damping:r}}else{const i=Li(t);e={...e,...i,mass:Si},e.isResolvedFromDuration=!0}return e}({...i,velocity:-at(i.velocity||0)}),f=p||0,v=u/(2*Math.sqrt(h*c)),g=a-r,y=at(Math.sqrt(h/c)),x=Math.abs(g)<5;let P;if(s||(s=x?Vi.granular:Vi.default),o||(o=x?Mi.granular:Mi.default),v<1){const t=Bi(y,v);P=e=>{const i=Math.exp(-v*y*e);return a-i*((f+v*y*g)/t*Math.sin(t*e)+g*Math.cos(t*e))}}else if(1===v)P=t=>a-Math.exp(-y*t)*(g+(f+y*g)*t);else{const t=y*Math.sqrt(v*v-1);P=e=>{const i=Math.exp(-v*y*e),s=Math.min(t*e,300);return a-i*((f+v*y*g)*Math.sinh(s)+t*g*Math.cosh(s))/t}}const T={calculatedDuration:m&&d||null,next:t=>{const e=P(t);if(m)l.done=t>=d;else{let i=0;v<1&&(i=0===t?rt(f):xi(P,t,e));const n=Math.abs(i)<=s,r=Math.abs(a-e)<=o;l.done=n&&r}return l.value=l.done?a:e,l},toString:()=>{const t=Math.min(pt(T),2e4),e=Pt(e=>T.next(t*e).value,t,30);return t+"ms "+e}};return T}function Ui({keyframes:t,velocity:e=0,power:i=.8,timeConstant:s=325,bounceDamping:n=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:h=.5,restSpeed:u}){const c=t[0],d={done:!1,value:c},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=i*e;const f=c+m,v=void 0===r?f:r(f);v!==f&&(m=v-c);const g=t=>-m*Math.exp(-t/s),y=t=>v+g(t),x=t=>{const e=g(t),i=y(t);d.done=Math.abs(e)<=h,d.value=d.done?v:i};let P,T;const S=t=>{var e;(e=d.value,void 0!==a&&e<a||void 0!==l&&e>l)&&(P=t,T=Ii({keyframes:[d.value,p(d.value)],velocity:xi(y,t,d.value),damping:n,stiffness:o,restDelta:h,restSpeed:u}))};return S(0),{calculatedDuration:null,next:t=>{let e=!1;return T||void 0!==P||(e=!0,x(t),S(t)),void 0!==P&&t>=P?T.next(t-P):(!e&&x(t),d)}}}const Ni=It(.42,0,1,1),Ki=It(0,0,.58,1),zi=It(.42,0,.58,1),Wi={linear:t,easeIn:Ni,easeInOut:zi,easeOut:Ki,circIn:$t,circInOut:Gt,circOut:Xt,backIn:zt,backInOut:Wt,backOut:Kt,anticipate:Yt},Yi=t=>{if(vt(t)){st(4===t.length);const[e,i,s,n]=t;return It(e,i,s,n)}return"string"==typeof t?Wi[t]:t};function $i(e,i,{clamp:s=!0,ease:o,mixer:r}={}){const a=e.length;if(st(a===i.length),1===a)return()=>i[0];if(2===a&&i[0]===i[1])return()=>i[1];const l=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),i=[...i].reverse());const h=function(e,i,s){const n=[],o=s||gi,r=e.length-1;for(let s=0;s<r;s++){let r=o(e[s],e[s+1]);if(i){const e=Array.isArray(i)?i[s]||t:i;r=ui(e,r)}n.push(r)}return n}(i,o,r),u=h.length,c=t=>{if(l&&t<e[0])return i[0];let s=0;if(u>1)for(;s<e.length-2&&!(t<e[s+1]);s++);const n=ot(e[s],e[s+1],t);return h[s](n)};return s?t=>c(n(e[0],e[a-1],t)):c}function Xi(t){const e=[0];return function(t,e){const i=t[t.length-1];for(let s=1;s<=e;s++){const n=ot(0,e,s);t.push(ii(i,1,n))}}(e,t.length-1),e}function Gi({duration:t=300,keyframes:e,times:i,ease:s="easeInOut"}){const n=(t=>Array.isArray(t)&&"number"!=typeof t[0])(s)?s.map(Yi):Yi(s),o={done:!1,value:e[0]},r=$i(function(t,e){return t.map(t=>t*e)}(i&&i.length===e.length?i:Xi(e),t),e,{ease:Array.isArray(n)?n:(a=e,l=n,a.map(()=>l||zi).splice(0,a.length-1))});var a,l;return{calculatedDuration:t,next:e=>(o.value=r(e),o.done=e>=t,o)}}const Hi=t=>{const e=({timestamp:e})=>t(e);return{start:()=>l.update(e,!0),stop:()=>m(e),now:()=>p.isProcessing?p.timestamp:_e.now()}},qi={decay:Ui,inertia:Ui,tween:Gi,keyframes:Gi,spring:Ii},_i=t=>t/100;class Zi extends ei{constructor(t){super(t),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const{onStop:t}=this.options;t&&t()};const{name:e,motionValue:i,element:s,keyframes:n}=this.options,o=(null==s?void 0:s.KeyframeResolver)||Ne;this.resolver=new o(n,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(t){const{type:e="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:n,velocity:o=0}=this.options,r=mt(e)?e:qi[e]||Gi;let a,l;r!==Gi&&"number"!=typeof t[0]&&(a=ui(_i,gi(t[0],t[1])),t=[0,100]);const h=r({...this.options,keyframes:t});"mirror"===n&&(l=r({...this.options,keyframes:[...t].reverse(),velocity:-o})),null===h.calculatedDuration&&(h.calculatedDuration=pt(h));const{calculatedDuration:u}=h,c=u+s;return{generator:h,mirroredGenerator:l,mapPercentToKeyframes:a,calculatedDuration:u,resolvedDuration:c,totalDuration:c*(i+1)-s}}onPostResolved(){const{autoplay:t=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(t,e=!1){const{resolved:i}=this;if(!i){const{keyframes:t}=this.options;return{done:!0,value:t[t.length-1]}}const{finalKeyframe:s,generator:o,mirroredGenerator:r,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:h,totalDuration:u,resolvedDuration:c}=i;if(null===this.startTime)return o.next(0);const{delay:d,repeat:p,repeatType:m,repeatDelay:f,onUpdate:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-u/this.speed,this.startTime)),e?this.currentTime=t:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(t-this.startTime)*this.speed;const g=this.currentTime-d*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let x=this.currentTime,P=o;if(p){const t=Math.min(this.currentTime,u)/c;let e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,e=Math.min(e,p+1);Boolean(e%2)&&("reverse"===m?(i=1-i,f&&(i-=f/c)):"mirror"===m&&(P=r)),x=n(0,1,i)*c}const T=y?{done:!1,value:l[0]}:P.next(x);a&&(T.value=a(T.value));let{done:S}=T;y||null===h||(S=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return w&&void 0!==s&&(T.value=ti(l,this.options,s)),v&&v(T.value),w&&this.finish(),T}get duration(){const{resolved:t}=this;return t?at(t.calculatedDuration):0}get time(){return at(this.currentTime)}set time(t){t=rt(t),this.currentTime=t,null!==this.holdTime||0===this.speed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.speed)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=at(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const{driver:t=Hi,onPlay:e,startTime:i}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),e&&e();const s=this.driver.now();null!==this.holdTime?this.startTime=s-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=s):this.startTime=null!=i?i:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var t;this._resolved?(this.state="paused",this.holdTime=null!==(t=this.currentTime)&&void 0!==t?t:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:t}=this.options;t&&t()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}}const Ji=new Set(["opacity","clipPath","filter","transform"]);function Qi(t,e,i,{delay:s=0,duration:n=300,repeat:o=0,repeatType:r="loop",ease:a="easeInOut",times:l}={}){const h={[e]:i};l&&(h.offset=l);const u=function t(e,i){return e?"function"==typeof e&&xt()?Pt(e,i):vt(e)?St(e):Array.isArray(e)?e.map(e=>t(e,i)||wt.easeOut):wt[e]:void 0}(a,n);Array.isArray(u)&&(h.easing=u);return t.animate(h,{delay:s,duration:n,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"})}const ts=nt(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));const es={anticipate:Yt,backInOut:Wt,circInOut:Gt};class is extends ei{constructor(t){super(t);const{name:e,motionValue:i,element:s,keyframes:n}=this.options;this.resolver=new Ge(n,(t,e)=>this.onKeyframesResolved(t,e),e,i,s),this.resolver.scheduleResolve()}initPlayback(t,e){let{duration:i=300,times:s,ease:n,type:o,motionValue:r,name:a,startTime:l}=this.options;if(!r.owner||!r.owner.current)return!1;var h;if("string"==typeof n&&xt()&&n in es&&(n=es[n]),mt((h=this.options).type)||"spring"===h.type||!Tt(h.ease)){const{onComplete:e,onUpdate:r,motionValue:a,element:l,...h}=this.options,u=function(t,e){const i=new Zi({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let s={done:!1,value:t[0]};const n=[];let o=0;for(;!s.done&&o<2e4;)s=i.sample(o),n.push(s.value),o+=10;return{times:void 0,keyframes:n,duration:o-10,ease:"linear"}}(t,h);1===(t=u.keyframes).length&&(t[1]=t[0]),i=u.duration,s=u.times,n=u.ease,o="keyframes"}const u=Qi(r.owner.current,a,t,{...this.options,duration:i,times:s,ease:n});return u.startTime=null!=l?l:this.calcStartTime(),this.pendingTimeline?(ft(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:i}=this.options;r.set(ti(t,this.options,e)),i&&i(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:s,type:o,ease:n,keyframes:t}}get duration(){const{resolved:t}=this;if(!t)return 0;const{duration:e}=t;return at(e)}get time(){const{resolved:t}=this;if(!t)return 0;const{animation:e}=t;return at(e.currentTime||0)}set time(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.currentTime=rt(t)}get speed(){const{resolved:t}=this;if(!t)return 1;const{animation:e}=t;return e.playbackRate}set speed(t){const{resolved:e}=this;if(!e)return;const{animation:i}=e;i.playbackRate=t}get state(){const{resolved:t}=this;if(!t)return"idle";const{animation:e}=t;return e.playState}get startTime(){const{resolved:t}=this;if(!t)return null;const{animation:e}=t;return e.startTime}attachTimeline(e){if(this._resolved){const{resolved:i}=this;if(!i)return t;const{animation:s}=i;ft(s,e)}else this.pendingTimeline=e;return t}play(){if(this.isStopped)return;const{resolved:t}=this;if(!t)return;const{animation:e}=t;"finished"===e.playState&&this.updateFinishedPromise(),e.play()}pause(){const{resolved:t}=this;if(!t)return;const{animation:e}=t;e.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:t}=this;if(!t)return;const{animation:e,keyframes:i,duration:s,type:n,ease:o,times:r}=t;if("idle"===e.playState||"finished"===e.playState)return;if(this.time){const{motionValue:t,onUpdate:e,onComplete:a,element:l,...h}=this.options,u=new Zi({...h,keyframes:i,duration:s,type:n,ease:o,times:r,isGenerator:!0}),c=rt(this.time);t.setWithVelocity(u.sample(c-10).value,u.sample(c).value,10)}const{onStop:a}=this.options;a&&a(),this.cancel()}complete(){const{resolved:t}=this;t&&t.animation.finish()}cancel(){const{resolved:t}=this;t&&t.animation.cancel()}static supports(t){const{motionValue:e,name:i,repeatDelay:s,repeatType:n,damping:o,type:r}=t;if(!(e&&e.owner&&e.owner.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:l}=e.owner.getProps();return ts()&&i&&Ji.has(i)&&!a&&!l&&!s&&"mirror"!==n&&0!==o&&"inertia"!==r}}const ss={type:"spring",stiffness:500,damping:25,restSpeed:10},ns={type:"keyframes",duration:.8},os={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},rs=(t,{keyframes:e})=>e.length>2?ns:f.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ss:os;const as=(t,e,i,s={},n,o)=>r=>{const a=dt(s,t)||{},h=a.delay||s.delay||0;let{elapsed:u=0}=s;u-=rt(h);let c={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-u,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:n};(function({when:t,delay:e,delayChildren:i,staggerChildren:s,staggerDirection:n,repeat:o,repeatType:r,repeatDelay:a,from:l,elapsed:h,...u}){return!!Object.keys(u).length})(a)||(c={...c,...rs(t,c)}),c.duration&&(c.duration=rt(c.duration)),c.repeatDelay&&(c.repeatDelay=rt(c.repeatDelay)),void 0!==c.from&&(c.keyframes[0]=c.from);let d=!1;if((!1===c.type||0===c.duration&&!c.repeatDelay)&&(c.duration=0,0===c.delay&&(d=!0)),c.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=ti(c.keyframes,a);if(void 0!==t)return l.update(()=>{c.onUpdate(t),c.onComplete()}),new ct([])}return!o&&is.supports(c)?new is(c):new Zi(c)};function ls(t,e,i,s={passive:!0}){return t.addEventListener(e,i,s),()=>t.removeEventListener(e,i)}function hs(t){return{point:{x:t.pageX,y:t.pageY}}}function us(t,e,i,s){return ls(t,e,(t=>e=>Ct(e)&&t(e,hs(e)))(i),s)}function cs({top:t,left:e,right:i,bottom:s}){return{x:{min:e,max:i},y:{min:t,max:s}}}function ds(t){return t.max-t.min}function ps(t,e,i,s=.5){t.origin=s,t.originPoint=ii(e.min,e.max,t.origin),t.scale=ds(i)/ds(e),t.translate=ii(i.min,i.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function ms(t,e,i,s){ps(t.x,e.x,i.x,s?s.originX:void 0),ps(t.y,e.y,i.y,s?s.originY:void 0)}function fs(t,e,i){t.min=i.min+e.min,t.max=t.min+ds(e)}function vs(t,e,i){t.min=e.min-i.min,t.max=t.min+ds(e)}function gs(t,e,i){vs(t.x,e.x,i.x),vs(t.y,e.y,i.y)}const ys=()=>({x:{min:0,max:0},y:{min:0,max:0}});function xs(t){return[t("x"),t("y")]}function Ps(t){return void 0===t||1===t}function Ts({scale:t,scaleX:e,scaleY:i}){return!Ps(t)||!Ps(e)||!Ps(i)}function Ss(t){return Ts(t)||ws(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function ws(t){return As(t.x)||As(t.y)}function As(t){return t&&"0%"!==t}function bs(t,e,i){return i+e*(t-i)}function Es(t,e,i,s,n){return void 0!==n&&(t=bs(t,n,s)),bs(t,i,s)+e}function Vs(t,e=0,i=1,s,n){t.min=Es(t.min,e,i,s,n),t.max=Es(t.max,e,i,s,n)}function Ms(t,{x:e,y:i}){Vs(t.x,e.translate,e.scale,e.originPoint),Vs(t.y,i.translate,i.scale,i.originPoint)}function Ds(t,e){t.min=t.min+e,t.max=t.max+e}function Cs(t,e,i,s,n=.5){Vs(t,e,i,ii(t.min,t.max,n),s)}function Rs(t,e){Cs(t.x,e.x,e.scaleX,e.scale,e.originX),Cs(t.y,e.y,e.scaleY,e.scale,e.originY)}function ks(t,e){return cs(function(t,e){if(!e)return t;const i=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}const Ls=({current:t})=>t?t.ownerDocument.defaultView:null;function Bs(t,e){const i=t.getValue("willChange");if(s=i,Boolean(v(s)&&s.add))return i.add(e);var s}const js=(t,e)=>Math.abs(t-e);class Fs{constructor(t,e,{transformPagePoint:i,contextWindow:s,dragSnapToOrigin:n=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const t=Us(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,i=function(t,e){const i=js(t.x,e.x),s=js(t.y,e.y);return Math.sqrt(i**2+s**2)}(t.offset,{x:0,y:0})>=3;if(!e&&!i)return;const{point:s}=t,{timestamp:n}=p;this.history.push({...s,timestamp:n});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=Os(e,this.transformPagePoint),l.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.end();const{onEnd:i,onSessionEnd:s,resumeAnimation:n}=this.handlers;if(this.dragSnapToOrigin&&n&&n(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Us("pointercancel"===t.type?this.lastMoveEventInfo:Os(e,this.transformPagePoint),this.history);this.startEvent&&i&&i(t,o),s&&s(t,o)},!Ct(t))return;this.dragSnapToOrigin=n,this.handlers=e,this.transformPagePoint=i,this.contextWindow=s||window;const o=Os(hs(t),this.transformPagePoint),{point:r}=o,{timestamp:a}=p;this.history=[{...r,timestamp:a}];const{onSessionStart:h}=e;h&&h(t,Us(o,this.history)),this.removeListeners=ui(us(this.contextWindow,"pointermove",this.handlePointerMove),us(this.contextWindow,"pointerup",this.handlePointerUp),us(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),m(this.updatePoint)}}function Os(t,e){return e?{point:e(t.point)}:t}function Is(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Us({point:t},e){return{point:t,delta:Is(t,Ks(e)),offset:Is(t,Ns(e)),velocity:zs(e,.1)}}function Ns(t){return t[0]}function Ks(t){return t[t.length-1]}function zs(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,s=null;const n=Ks(t);for(;i>=0&&(s=t[i],!(n.timestamp-s.timestamp>rt(e)));)i--;if(!s)return{x:0,y:0};const o=at(n.timestamp-s.timestamp);if(0===o)return{x:0,y:0};const r={x:(n.x-s.x)/o,y:(n.y-s.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}function Ws(t,e,i){return{min:void 0!==e?t.min+e:void 0,max:void 0!==i?t.max+i-(t.max-t.min):void 0}}function Ys(t,e){let i=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([i,s]=[s,i]),{min:i,max:s}}const $s=.35;function Xs(t,e,i){return{min:Gs(t,e),max:Gs(t,i)}}function Gs(t,e){return"number"==typeof t?t:t[e]||0}const Hs=new WeakMap;class qs{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=t}start(t,{snapToCursor:e=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&!1===i.isPresent)return;const{dragSnapToOrigin:s}=this.getProps();this.panSession=new Fs(t,{onSessionStart:t=>{const{dragSnapToOrigin:i}=this.getProps();i?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(hs(t).point)},onStart:(t,e)=>{const{drag:i,dragPropagation:s,onDragStart:n}=this.getProps();if(i&&!s&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(r=i)||"y"===r?At[r]?null:(At[r]=!0,()=>{At[r]=!1}):At.x||At.y?null:(At.x=At.y=!0,()=>{At.x=At.y=!1}),!this.openDragLock))return;var r;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),xs(t=>{let e=this.getAxisMotionValue(t).get()||0;if(o.test(e)){const{projection:i}=this.visualElement;if(i&&i.layout){const s=i.layout.layoutBox[t];if(s){e=ds(s)*(parseFloat(e)/100)}}}this.originPoint[t]=e}),n&&l.postRender(()=>n(t,e)),Bs(this.visualElement,"transform");const{animationState:a}=this.visualElement;a&&a.setActive("whileDrag",!0)},onMove:(t,e)=>{const{dragPropagation:i,dragDirectionLock:s,onDirectionLock:n,onDrag:o}=this.getProps();if(!i&&!this.openDragLock)return;const{offset:r}=e;if(s&&null===this.currentDirection)return this.currentDirection=function(t,e=10){let i=null;Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x");return i}(r),void(null!==this.currentDirection&&n&&n(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),resumeAnimation:()=>xs(t=>{var e;return"paused"===this.getAnimationState(t)&&(null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,contextWindow:Ls(this.visualElement)})}stop(t,e){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:s}=e;this.startAnimation(s);const{onDragEnd:n}=this.getProps();n&&l.postRender(()=>n(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:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(t,e,i){const{drag:s}=this.getProps();if(!i||!_s(t,s,this.currentDirection))return;const n=this.getAxisMotionValue(t);let o=this.originPoint[t]+i[t];this.constraints&&this.constraints[t]&&(o=function(t,{min:e,max:i},s){return void 0!==e&&t<e?t=s?ii(e,t,s.min):Math.max(t,e):void 0!==i&&t>i&&(t=s?ii(i,t,s.max):Math.min(t,i)),t}(o,this.constraints[t],this.elastic[t])),n.set(o)}resolveConstraints(){var t;const{dragConstraints:e,dragElastic:i}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(t=this.visualElement.projection)||void 0===t?void 0:t.layout,n=this.constraints;e&&g(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!e||!s)&&function(t,{top:e,left:i,bottom:s,right:n}){return{x:Ws(t.x,i,n),y:Ws(t.y,e,s)}}(s.layoutBox,e),this.elastic=function(t=$s){return!1===t?t=0:!0===t&&(t=$s),{x:Xs(t,"left","right"),y:Xs(t,"top","bottom")}}(i),n!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&xs(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const i={};return void 0!==e.min&&(i.min=e.min-t.min),void 0!==e.max&&(i.max=e.max-t.min),i}(s.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!t||!g(t))return!1;const i=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const n=function(t,e,i){const s=ks(t,i),{scroll:n}=e;return n&&(Ds(s.x,n.offset.x),Ds(s.y,n.offset.y)),s}(i,s.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:Ys(t.x,e.x),y:Ys(t.y,e.y)}}(s.layout.layoutBox,n);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=cs(t))}return o}startAnimation(t){const{drag:e,dragMomentum:i,dragElastic:s,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=xs(r=>{if(!_s(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:i?t[r]:0,bounceStiffness:h,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...n,...l};return this.startAxisValueAnimation(r,c)});return Promise.all(l).then(r)}startAxisValueAnimation(t,e){const i=this.getAxisMotionValue(t);return Bs(this.visualElement,t),i.start(as(t,i,0,e,this.visualElement,!1))}stopAnimation(){xs(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){xs(t=>{var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.pause()})}getAnimationState(t){var e;return null===(e=this.getAxisMotionValue(t).animation)||void 0===e?void 0:e.state}getAxisMotionValue(t){const e="_drag"+t.toUpperCase(),i=this.visualElement.getProps(),s=i[e];return s||this.visualElement.getValue(t,(i.initial?i.initial[t]:void 0)||0)}snapToCursor(t){xs(e=>{const{drag:i}=this.getProps();if(!_s(e,i,this.currentDirection))return;const{projection:s}=this.visualElement,n=this.getAxisMotionValue(e);if(s&&s.layout){const{min:i,max:o}=s.layout.layoutBox[e];n.set(t[e]-ii(i,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:i}=this.visualElement;if(!g(e)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};xs(t=>{const e=this.getAxisMotionValue(t);if(e&&!1!==this.constraints){const i=e.get();s[t]=function(t,e){let i=.5;const s=ds(t),o=ds(e);return o>s?i=ot(e.min,e.max-s,t.min):s>o&&(i=ot(t.min,t.max-o,e.min)),n(0,1,i)}({min:i,max:i},this.constraints[t])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),xs(e=>{if(!_s(e,t,null))return;const i=this.getAxisMotionValue(e),{min:n,max:o}=this.constraints[e];i.set(ii(n,o,s[e]))})}addListeners(){if(!this.visualElement.current)return;Hs.set(this.visualElement,this);const t=us(this.visualElement.current,"pointerdown",t=>{const{drag:e,dragListener:i=!0}=this.getProps();e&&i&&this.start(t)}),e=()=>{const{dragConstraints:t}=this.getProps();g(t)&&t.current&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",e);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),l.read(e);const n=ls(window,"resize",()=>this.scalePositionWithinConstraints()),o=i.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(xs(e=>{const i=this.getAxisMotionValue(e);i&&(this.originPoint[e]+=t[e].translate,i.set(i.get()+t[e].translate))}),this.visualElement.render())});return()=>{n(),t(),s(),o&&o()}}getProps(){const t=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:n=!1,dragElastic:o=$s,dragMomentum:r=!0}=t;return{...t,drag:e,dragDirectionLock:i,dragPropagation:s,dragConstraints:n,dragElastic:o,dragMomentum:r}}}function _s(t,e,i){return!(!0!==e&&e!==t||null!==i&&i!==t)}const Zs=t=>(e,i)=>{t&&l.postRender(()=>t(e,i))};function Js(t,e){-1===t.indexOf(e)&&t.push(e)}function Qs(t,e){const i=t.indexOf(e);i>-1&&t.splice(i,1)}class tn{constructor(){this.subscriptions=[]}add(t){return Js(this.subscriptions,t),()=>Qs(this.subscriptions,t)}notify(t,e,i){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,i);else for(let n=0;n<s;n++){const s=this.subscriptions[n];s&&s(t,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class en{constructor(t,e={}){this.version="12.4.13",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{const i=_e.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),e&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=_e.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new tn);const i=this.events[t].add(e);return"change"===t?()=>{i(),l.read(()=>{this.events.change.getSize()||this.stop()})}:i}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,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=_e.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return yi(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sn(t,e){return new en(t,e)}function nn(t){return t.props[y]}const on=new WeakMap;function rn(t,e,i){const s=t.getProps();return x(s,e,void 0!==i?i:s.custom,t)}function an(t,e,i){t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,sn(i))}function ln({protectedKeys:t,needsAnimating:e},i){const s=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,s}function hn(t,e,{delay:i=0,transitionOverride:s,type:n}={}){var o;let{transition:r=t.getDefaultTransition(),transitionEnd:a,...h}=e;s&&(r=s);const u=[],c=n&&t.animationState&&t.animationState.getState()[n];for(const e in h){const s=t.getValue(e,null!==(o=t.latestValues[e])&&void 0!==o?o:null),n=h[e];if(void 0===n||c&&ln(c,e))continue;const a={delay:i,...dt(r||{},e)};let d=!1;if(window.MotionHandoffAnimation){const i=nn(t);if(i){const t=window.MotionHandoffAnimation(i,e,l);null!==t&&(a.startTime=t,d=!0)}}Bs(t,e),s.start(as(e,s,n,t.shouldReduceMotion&&qt.has(e)?{type:!1}:a,t,d));const p=s.animation;p&&u.push(p)}return a&&Promise.all(u).then(()=>{l.update(()=>{a&&function(t,e){const i=rn(t,e);let{transitionEnd:s={},transition:n={},...o}=i||{};o={...o,...s};for(const e in o){an(t,e,P(o[e]))}}(t,a)})}),u}const un={current:null},cn={current:!1};const dn=[...$e,oe,de];const pn=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class mn extends class{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:s,blockInitialAnimation:n,visualState:o},r={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Ne,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=_e.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,l.render(this.render,!1,!0))};const{latestValues:a,renderState:h,onUpdate:u}=o;this.onUpdate=u,this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=h,this.parent=t,this.props=e,this.presenceContext=i,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=r,this.blockInitialAnimation=Boolean(n),this.isControllingVariants=S(e),this.isVariantNode=w(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:c,...d}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in d){const e=d[t];void 0!==a[t]&&v(e)&&e.set(a[t],!1)}}mount(t){this.current=t,on.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),cn.current||function(){if(cn.current=!0,T)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>un.current=t.matches;t.addListener(e),e()}else un.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||un.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),m(this.notifyUpdate),m(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),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){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const i=f.has(t);i&&this.onBindTransform&&this.onBindTransform();const s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&l.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),n=e.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),n(),o&&o(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in A){const e=A[t];if(!e)continue;const{isEnabled:i,Feature:s}=e;if(!this.features[t]&&s&&i(this.props)&&(this.features[t]=new s(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<pn.length;e++){const i=pn[e];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s=t["on"+i];s&&(this.propEventSubscriptions[i]=this.on(i,s))}this.prevMotionValues=function(t,e,i){for(const s in e){const n=e[s],o=i[s];if(v(n))t.addValue(s,n);else if(v(o))t.addValue(s,sn(n,{owner:t}));else if(o!==n)if(t.hasValue(s)){const e=t.getValue(s);!0===e.liveStyle?e.jump(n):e.hasAnimated||e.set(n)}else{const e=t.getStaticValue(s);t.addValue(s,sn(void 0!==e?e:n,{owner:t}))}}for(const s in i)void 0===e[s]&&t.removeValue(s);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){const i=this.values.get(t);e!==i&&(i&&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 i=this.values.get(t);return void 0===i&&void 0!==e&&(i=sn(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){var i;let s=void 0===this.latestValues[t]&&this.current?null!==(i=this.getBaseTargetFromProps(this.props,t))&&void 0!==i?i:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];var n;return null!=s&&("string"==typeof s&&(Ke(s)||Ht(s))?s=parseFloat(s):(n=s,!dn.find(Ye(n))&&de.test(e)&&(s=xe(t,e))),this.setBaseTarget(t,v(s)?s.get():s)),v(s)?s.get():s}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:i}=this.props;let s;if("string"==typeof i||"object"==typeof i){const n=x(this.props,i,null===(e=this.presenceContext)||void 0===e?void 0:e.custom);n&&(s=n[t])}if(i&&void 0!==s)return s;const n=this.getBaseTargetFromProps(this.props,t);return void 0===n||v(n)?void 0!==this.initialValues[t]&&void 0===s?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new tn),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}{constructor(){super(...arguments),this.KeyframeResolver=Ge}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:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;v(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=""+t)}))}}class fn extends mn{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ys,this.updateDimensions=()=>{this.current&&!this.renderState.dimensions&&b(this.current,this.renderState)}}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(f.has(e)){const t=ye(e);return t&&t.default||0}return e=E.has(e)?e:V(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return M(t,e,i)}onBindTransform(){this.current&&!this.renderState.dimensions&&l.postRender(this.updateDimensions)}build(t,e,i){D(t,e,this.isSVGTag,i.transformTemplate)}renderInstance(t,e,i,s){C(t,e,i,s)}mount(t){this.isSVGTag=R(t.tagName),super.mount(t)}}class vn extends mn{constructor(){super(...arguments),this.type="html",this.renderInstance=k}readValueFromInstance(t,e){if(f.has(e))return((t,e)=>{const{transform:i="none"}=getComputedStyle(t);return De(i,e)})(t,e);{const s=(i=t,window.getComputedStyle(i)),n=(L(e)?s.getPropertyValue(e):s[e])||0;return"string"==typeof n?n.trim():n}var i}measureInstanceViewportBox(t,{transformPagePoint:e}){return ks(t,e)}build(t,e,i){B(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return j(t,e,i)}}const gn=(t,e)=>t.depth-e.depth;class yn{constructor(){this.children=[],this.isDirty=!1}add(t){Js(this.children,t),this.isDirty=!0}remove(t){Qs(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(gn),this.isDirty=!1,this.children.forEach(t)}}const xn=["TopLeft","TopRight","BottomLeft","BottomRight"],Pn=xn.length,Tn=t=>"string"==typeof t?parseFloat(t):t,Sn=t=>"number"==typeof t||a.test(t);function wn(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const An=En(0,.5,Xt),bn=En(.5,.95,t);function En(t,e,i){return s=>s<t?0:s>e?1:i(ot(t,e,s))}function Vn(t,e){t.min=e.min,t.max=e.max}function Mn(t,e){Vn(t.x,e.x),Vn(t.y,e.y)}function Dn(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Cn(t,e,i,s,n){return t=bs(t-=e,1/i,s),void 0!==n&&(t=bs(t,1/n,s)),t}function Rn(t,e,[i,s,n],r,a){!function(t,e=0,i=1,s=.5,n,r=t,a=t){if(o.test(e)){e=parseFloat(e);e=ii(a.min,a.max,e/100)-a.min}if("number"!=typeof e)return;let l=ii(r.min,r.max,s);t===r&&(l-=e),t.min=Cn(t.min,e,i,l,n),t.max=Cn(t.max,e,i,l,n)}(t,e[i],e[s],e[n],e.scale,r,a)}const kn=["x","scaleX","originX"],Ln=["y","scaleY","originY"];function Bn(t,e,i,s){Rn(t.x,e,kn,i?i.x:void 0,s?s.x:void 0),Rn(t.y,e,Ln,i?i.y:void 0,s?s.y:void 0)}function jn(t){return 0===t.translate&&1===t.scale}function Fn(t){return jn(t.x)&&jn(t.y)}function On(t,e){return t.min===e.min&&t.max===e.max}function In(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Un(t,e){return In(t.x,e.x)&&In(t.y,e.y)}function Nn(t){return ds(t.x)/ds(t.y)}function Kn(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class zn{constructor(){this.members=[]}add(t){Js(this.members,t),t.scheduleRender()}remove(t){if(Qs(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){const e=this.members.findIndex(e=>t===e);if(0===e)return!1;let i;for(let t=e;t>=0;t--){const e=this.members[t];if(!1!==e.isPresent){i=e;break}}return!!i&&(this.promote(i),!0)}promote(t,e){const i=this.lead;if(t!==i&&(this.prevLead=i,this.lead=t,t.show(),i)){i.instance&&i.scheduleRender(),t.scheduleRender(),t.resumeFrom=i,e&&(t.resumeFrom.preserveOpacity=!0),i.snapshot&&(t.snapshot=i.snapshot,t.snapshot.latestValues=i.animationValues||i.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;!1===s&&i.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:e,resumingFrom:i}=t;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Wn={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Yn=["","X","Y","Z"],$n={visibility:"hidden"};let Xn=0;function Gn(t,e,i,s){const{latestValues:n}=e;n[t]&&(i[t]=n[t],e.setStaticValue(t,0),s&&(s[t]=0))}function Hn({attachResizeListener:t,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(t={},i=(null==e?void 0:e())){this.id=Xn++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Zn),this.nodes.forEach(no),this.nodes.forEach(oo),this.nodes.forEach(Jn)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=i?i.root||i:this,this.path=i?[...i.path,i]:[],this.parent=i,this.depth=i?i.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new yn)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new tn),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){const i=this.eventHandlers.get(t);i&&i.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e,i=this.root.hasTreeAnimated){if(this.instance)return;var s;this.isSVG=(s=e)instanceof SVGElement&&"svg"!==s.tagName,this.instance=e;const{layoutId:n,layout:o,visualElement:r}=this.options;if(r&&!r.current&&r.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),i&&(o||n)&&(this.isLayoutDirty=!0),t){let i;const s=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,i&&i(),i=function(t,e){const i=_e.now(),s=({timestamp:n})=>{const o=n-i;o>=e&&(m(s),t(o-e))};return l.read(s,!0),()=>m(s)}(s,250),Wn.hasAnimatedSinceResize&&(Wn.hasAnimatedSinceResize=!1,this.nodes.forEach(so))})}n&&this.root.registerSharedNode(n,this),!1!==this.options.animate&&r&&(n||o)&&this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:i,layout:s})=>{if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const n=this.options.transition||r.getDefaultTransition()||co,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=r.getProps(),l=!this.targetLayout||!Un(this.targetLayout,s),h=!e&&i;if(this.options.layoutRoot||this.resumeFrom||h||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,h);const e={...dt(n,"layout"),onPlay:o,onComplete:a};(r.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else e||so(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,m(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(ro),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function t(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:i}=e.options;if(!i)return;const s=nn(i);if(window.MotionHasOptimisedAnimation(s,"transform")){const{layout:t,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(s,"transform",l,!(t||i))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&t(n)}(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1)}const{layoutId:e,layout:i}=this.options;if(void 0===e&&!i)return;const s=this.getTransformTemplate();this.prevTransformTemplateValue=s?s(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked())return this.unblockUpdate(),this.clearAllSnapshots(),void this.nodes.forEach(to);this.isUpdating||this.nodes.forEach(eo),this.isUpdating=!1,this.nodes.forEach(io),this.nodes.forEach(qn),this.nodes.forEach(_n),this.clearAllSnapshots();const t=_e.now();p.delta=n(0,1e3/60,t-p.timestamp),p.timestamp=t,p.isProcessing=!0,F.update.process(p),F.preRender.process(p),F.render.process(p),p.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,O.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Qn),this.sharedNodes.forEach(ao)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,l.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){l.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||ds(this.snapshot.measuredBox.x)||ds(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.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);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===t&&(e=!1),e){const e=s(this.instance);this.scroll={animationId:this.root.animationId,phase:t,isRoot:e,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:e}}}resetTransform(){if(!r)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,e=this.projectionDelta&&!Fn(this.projectionDelta),i=this.getTransformTemplate(),s=i?i(this.latestValues,""):void 0,n=s!==this.prevTransformTemplateValue;t&&(e||Ss(this.latestValues)||n)&&(r(this.instance,s),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let i=this.removeElementScroll(e);var s;return t&&(i=this.removeTransform(i)),fo((s=i).x),fo(s.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:i,latestValues:{},source:this.id}}measurePageBox(){var t;const{visualElement:e}=this.options;if(!e)return{x:{min:0,max:0},y:{min:0,max:0}};const i=e.measureViewportBox();if(!((null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)||this.path.some(go))){const{scroll:t}=this.root;t&&(Ds(i.x,t.offset.x),Ds(i.y,t.offset.y))}return i}removeElementScroll(t){var e;const i={x:{min:0,max:0},y:{min:0,max:0}};if(Mn(i,t),null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)return i;for(let e=0;e<this.path.length;e++){const s=this.path[e],{scroll:n,options:o}=s;s!==this.root&&n&&o.layoutScroll&&(n.wasRoot&&Mn(i,t),Ds(i.x,n.offset.x),Ds(i.y,n.offset.y))}return i}applyTransform(t,e=!1){const i={x:{min:0,max:0},y:{min:0,max:0}};Mn(i,t);for(let t=0;t<this.path.length;t++){const s=this.path[t];!e&&s.options.layoutScroll&&s.scroll&&s!==s.root&&Rs(i,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),Ss(s.latestValues)&&Rs(i,s.latestValues)}return Ss(this.latestValues)&&Rs(i,this.latestValues),i}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};Mn(e,t);for(let t=0;t<this.path.length;t++){const i=this.path[t];if(!i.instance)continue;if(!Ss(i.latestValues))continue;Ts(i.latestValues)&&i.updateSnapshot();const s={x:{min:0,max:0},y:{min:0,max:0}};Mn(s,i.measurePageBox()),Bn(e,i.latestValues,i.snapshot?i.snapshot.layoutBox:void 0,s)}return Ss(this.latestValues)&&Bn(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==p.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){var e;const i=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=i.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=i.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=i.isSharedProjectionDirty);const s=Boolean(this.resumingFrom)||this!==i;if(!(t||s&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:n,layoutId:o}=this.options;if(this.layout&&(n||o)){if(this.resolvedRelativeTargetAt=p.timestamp,!this.targetDelta&&!this.relativeTarget){const t=this.getClosestProjectingParent();t&&t.layout&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},gs(this.relativeTargetOrigin,this.layout.layoutBox,t.layout.layoutBox),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}var r,a,l;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?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,fs(r.x,a.x,l.x),fs(r.y,a.y,l.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Mn(this.target,this.layout.layoutBox),Ms(this.target,this.targetDelta)):Mn(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&&1!==this.animationProgress?(this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},gs(this.relativeTargetOrigin,this.target,t.target),Mn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(this.parent&&!Ts(this.parent.latestValues)&&!ws(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var t;const e=this.getLead(),i=Boolean(this.resumingFrom)||this!==e;let s=!0;if((this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty))&&(s=!1),i&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(s=!1),this.resolvedRelativeTargetAt===p.timestamp&&(s=!1),s)return;const{layout:n,layoutId:o}=this.options;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!n&&!o)return;Mn(this.layoutCorrected,this.layout.layoutBox);const r=this.treeScale.x,a=this.treeScale.y;!function(t,e,i,s=!1){const n=i.length;if(!n)return;let o,r;e.x=e.y=1;for(let a=0;a<n;a++){o=i[a],r=o.projectionDelta;const{visualElement:n}=o.options;n&&n.props.style&&"contents"===n.props.style.display||(s&&o.options.layoutScroll&&o.scroll&&o!==o.root&&Rs(t,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),r&&(e.x*=r.x.scale,e.y*=r.y.scale,Ms(t,r)),s&&Ss(o.latestValues)&&Rs(t,o.latestValues))}e.x<1.0000000000001&&e.x>.999999999999&&(e.x=1),e.y<1.0000000000001&&e.y>.999999999999&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,i),!e.layout||e.target||1===this.treeScale.x&&1===this.treeScale.y||(e.target=e.layout.layoutBox,e.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:l}=e;l?(this.projectionDelta&&this.prevProjectionDelta?(Dn(this.prevProjectionDelta.x,this.projectionDelta.x),Dn(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),ms(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===r&&this.treeScale.y===a&&Kn(this.projectionDelta.x,this.prevProjectionDelta.x)&&Kn(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){var e;if(null===(e=this.options.visualElement)||void 0===e||e.scheduleRender(),t){const t=this.getStack();t&&t.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},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}}}setAnimationOrigin(t,e=!1){const i=this.snapshot,s=i?i.latestValues:{},n={...this.latestValues},r={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 a={x:{min:0,max:0},y:{min:0,max:0}},l=(i?i.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(uo));let d;this.animationProgress=0,this.mixTargetDelta=e=>{const i=e/1e3;var h,p,m,f,v,g;lo(r.x,t.x,i),lo(r.y,t.y,i),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gs(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,f=this.relativeTargetOrigin,v=a,g=i,ho(m.x,f.x,v.x,g),ho(m.y,f.y,v.y,g),d&&(h=this.relativeTarget,p=d,On(h.x,p.x)&&On(h.y,p.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Mn(d,this.relativeTarget)),l&&(this.animationValues=n,function(t,e,i,s,n,r){n?(t.opacity=ii(0,void 0!==i.opacity?i.opacity:1,An(s)),t.opacityExit=ii(void 0!==e.opacity?e.opacity:1,0,bn(s))):r&&(t.opacity=ii(void 0!==e.opacity?e.opacity:1,void 0!==i.opacity?i.opacity:1,s));for(let n=0;n<Pn;n++){const r=`border${xn[n]}Radius`;let a=wn(e,r),l=wn(i,r);if(void 0===a&&void 0===l)continue;a||(a=0),l||(l=0);0===a||0===l||Sn(a)===Sn(l)?(t[r]=Math.max(ii(Tn(a),Tn(l),s),0),(o.test(l)||o.test(a))&&(t[r]+="%")):t[r]=l}(e.rotate||i.rotate)&&(t.rotate=ii(e.rotate||0,i.rotate||0,s))}(n,s,this.latestValues,i,c,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=i},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&&(m(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=l.update(()=>{Wn.hasAnimatedSinceResize=!0,this.currentAnimation=function(t,e,i){const s=v(t)?t:sn(t);return s.start(as("",s,e,i)),s.animation}(0,1e3,{...t,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onStop:()=>{},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead();let{targetWithTransforms:e,target:i,layout:s,latestValues:n}=t;if(e&&i&&s){if(this!==t&&this.layout&&s&&vo(this.options.animationType,this.layout.layoutBox,s.layoutBox)){i=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const e=ds(this.layout.layoutBox.x);i.x.min=t.target.x.min,i.x.max=i.x.min+e;const s=ds(this.layout.layoutBox.y);i.y.min=t.target.y.min,i.y.max=i.y.min+s}Mn(e,i),Rs(e,n),ms(this.projectionDeltaWithTransform,this.layoutCorrected,e,n)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new zn);this.sharedNodes.get(t).add(e);const i=e.options.initialPromotionConfig;e.promote({transition:i?i.transition:void 0,preserveFollowOpacity:i&&i.shouldPreserveFollowOpacity?i.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){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:i}={}){const s=this.getStack();s&&s.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){const t=this.getStack();return!!t&&t.relegate(this)}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;let e=!1;const{latestValues:i}=t;if((i.z||i.rotate||i.rotateX||i.rotateY||i.rotateZ||i.skewX||i.skewY)&&(e=!0),!e)return;const s={};i.z&&Gn("z",t,s,this.animationValues);for(let e=0;e<Yn.length;e++)Gn("rotate"+Yn[e],t,s,this.animationValues),Gn("skew"+Yn[e],t,s,this.animationValues);t.render();for(const e in s)t.setStaticValue(e,s[e]),this.animationValues&&(this.animationValues[e]=s[e]);t.scheduleRender()}getProjectionStyles(t){var e,i;if(!this.instance||this.isSVG)return;if(!this.isVisible)return $n;const s={visibility:""},n=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,s.opacity="",s.pointerEvents=I(null==t?void 0:t.pointerEvents)||"",s.transform=n?n(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=I(null==t?void 0:t.pointerEvents)||""),this.hasProjected&&!Ss(this.latestValues)&&(e.transform=n?n({},""):"none",this.hasProjected=!1),e}const r=o.animationValues||o.latestValues;this.applyTransformsToTarget(),s.transform=function(t,e,i){let s="";const n=t.x.translate/e.x,o=t.y.translate/e.y,r=(null==i?void 0:i.z)||0;if((n||o||r)&&(s=`translate3d(${n}px, ${o}px, ${r}px) `),1===e.x&&1===e.y||(s+=`scale(${1/e.x}, ${1/e.y}) `),i){const{transformPerspective:t,rotate:e,rotateX:n,rotateY:o,skewX:r,skewY:a}=i;t&&(s=`perspective(${t}px) ${s}`),e&&(s+=`rotate(${e}deg) `),n&&(s+=`rotateX(${n}deg) `),o&&(s+=`rotateY(${o}deg) `),r&&(s+=`skewX(${r}deg) `),a&&(s+=`skewY(${a}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return 1===a&&1===l||(s+=`scale(${a}, ${l})`),s||"none"}(this.projectionDeltaWithTransform,this.treeScale,r),n&&(s.transform=n(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!==(i=null!==(e=r.opacity)&&void 0!==e?e:this.latestValues.opacity)&&void 0!==i?i: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 U){if(void 0===r[t])continue;const{correct:e,applyTo:i,isCSSVariable:n}=U[t],a="none"===s.transform?r[t]:e(r[t],o);if(i){const t=i.length;for(let e=0;e<t;e++)s[i[e]]=a}else n?this.options.visualElement.renderState.vars[t]=a:s[t]=a}return this.options.layoutId&&(s.pointerEvents=o===this?I(null==t?void 0: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(to),this.root.sharedNodes.clear()}}}function qn(t){t.updateLayout()}function _n(t){var e;const i=(null===(e=t.resumeFrom)||void 0===e?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:s}=t.layout,{animationType:n}=t.options,o=i.source!==t.layout.source;"size"===n?xs(t=>{const s=o?i.measuredBox[t]:i.layoutBox[t],n=ds(s);s.min=e[t].min,s.max=s.min+n}):vo(n,i.layoutBox,e)&&xs(s=>{const n=o?i.measuredBox[s]:i.layoutBox[s],r=ds(e[s]);n.max=n.min+r,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+r)});const r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};ms(r,e,i.layoutBox);const a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};o?ms(a,t.applyTransform(s,!0),i.measuredBox):ms(a,e,i.layoutBox);const l=!Fn(r);let h=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:n,layout:o}=s;if(n&&o){const r={x:{min:0,max:0},y:{min:0,max:0}};gs(r,i.layoutBox,n.layoutBox);const a={x:{min:0,max:0},y:{min:0,max:0}};gs(a,e,o.layoutBox),Un(r,a)||(h=!0),s.options.layoutRoot&&(t.relativeTarget=a,t.relativeTargetOrigin=r,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:i,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function Zn(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Jn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Qn(t){t.clearSnapshot()}function to(t){t.clearMeasurements()}function eo(t){t.isLayoutDirty=!1}function io(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function so(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function no(t){t.resolveTargetDelta()}function oo(t){t.calcProjection()}function ro(t){t.resetSkewAndRotation()}function ao(t){t.removeLeadSnapshot()}function lo(t,e,i){t.translate=ii(e.translate,0,i),t.scale=ii(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function ho(t,e,i,s){t.min=ii(e.min,i.min,s),t.max=ii(e.max,i.max,s)}function uo(t){return t.animationValues&&void 0!==t.animationValues.opacityExit}const co={duration:.45,ease:[.4,0,.1,1]},po=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),mo=po("applewebkit/")&&!po("chrome/")?Math.round:t;function fo(t){t.min=mo(t.min),t.max=mo(t.max)}function vo(t,e,i){return"position"===t||"preserve-aspect"===t&&(s=Nn(e),n=Nn(i),o=.2,!(Math.abs(s-n)<=o));var s,n,o}function go(t){var e;return t!==t.root&&(null===(e=t.scroll)||void 0===e?void 0:e.wasRoot)}const yo=Hn({attachResizeListener:(t,e)=>ls(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),xo={current:void 0},Po=Hn({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!xo.current){const t=new yo({});t.mount(window),t.setOptions({layoutScroll:!0}),xo.current=t}return xo.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>Boolean("fixed"===window.getComputedStyle(t).position)});function To(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const So={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!a.test(t))return t;t=parseFloat(t)}return`${To(t,e.target.x)}% ${To(t,e.target.y)}%`}},wo={correct:(t,{treeScale:e,projectionDelta:i})=>{const s=t,n=de.parse(t);if(n.length>5)return s;const o=de.createTransformer(t),r="number"!=typeof n[0]?1:0,a=i.x.scale*e.x,l=i.y.scale*e.y;n[0+r]/=a,n[1+r]/=l;const h=ii(a,l,.5);return"number"==typeof n[2+r]&&(n[2+r]/=h),"number"==typeof n[3+r]&&(n[3+r]/=h),o(n)}};class Ao extends et{componentDidMount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i,layoutId:s}=this.props,{projection:n}=t;W(Eo),n&&(e.group&&e.group.add(n),i&&i.register&&s&&i.register(n),n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,onExitComplete:()=>this.safeToRemove()})),Wn.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:e,visualElement:i,drag:s,isPresent:n}=this.props,o=i.projection;return o?(o.isPresent=n,s||t.layoutDependency!==e||void 0===e||t.isPresent!==n?o.willUpdate():this.safeToRemove(),t.isPresent!==n&&(n?o.promote():o.relegate()||l.postRender(()=>{const t=o.getStack();t&&t.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),O.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:s}=t;s&&(s.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function bo(t){const[e,i]=function(t=!0){const e=Z(N);if(null===e)return[!0,null];const{isPresent:i,onExitComplete:s,register:n}=e,o=J();Q(()=>{if(t)return n(o)},[t]);const r=tt(()=>t&&s&&s(o),[o,s,t]);return!i&&s?[!1,r]:[!0]}(),s=Z(K);return _(Ao,{...t,layoutGroup:s,switchLayoutGroup:Z(z),isPresent:e,safeToRemove:i})}const Eo={borderRadius:{...So,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:So,borderTopRightRadius:So,borderBottomLeftRadius:So,borderBottomRightRadius:So,boxShadow:wo},Vo={pan:{Feature:class extends ht{constructor(){super(...arguments),this.removePointerDownListener=t}onPointerDown(t){this.session=new Fs(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ls(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:Zs(t),onStart:Zs(e),onMove:i,onEnd:(t,e)=>{delete this.session,s&&l.postRender(()=>s(t,e))}}}mount(){this.removePointerDownListener=us(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 ht{constructor(e){super(e),this.removeGroupControls=t,this.removeListeners=t,this.controls=new qs(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||t}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:Po,MeasureLayout:bo}},Mo={layout:{ProjectionNode:Po,MeasureLayout:bo}};function Do(t,e,i={}){var s;const n=rn(t,e,"exit"===i.type?null===(s=t.presenceContext)||void 0===s?void 0:s.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=n||{};i.transitionOverride&&(o=i.transitionOverride);const r=n?()=>Promise.all(hn(t,n,i)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:n=0,staggerChildren:r,staggerDirection:a}=o;return function(t,e,i=0,s=0,n=1,o){const r=[],a=(t.variantChildren.size-1)*s,l=1===n?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(Co).forEach((t,s)=>{t.notify("AnimationStart",e),r.push(Do(t,e,{...o,delay:i+l(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(r)}(t,e,n+s,r,a,i)}:()=>Promise.resolve(),{when:l}=o;if(l){const[t,e]="beforeChildren"===l?[r,a]:[a,r];return t().then(()=>e())}return Promise.all([r(),a(i.delay)])}function Co(t,e){return t.sortNodePosition(e)}function Ro(t,e){if(!Array.isArray(e))return!1;const i=e.length;if(i!==t.length)return!1;for(let s=0;s<i;s++)if(e[s]!==t[s])return!1;return!0}const ko=$.length;const Lo=[...H].reverse(),Bo=H.length;function jo(t){return e=>Promise.all(e.map(({animation:e,options:i})=>function(t,e,i={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const n=e.map(e=>Do(t,e,i));s=Promise.all(n)}else if("string"==typeof e)s=Do(t,e,i);else{const n="function"==typeof e?rn(t,e,i.custom):e;s=Promise.all(hn(t,n,i))}return s.then(()=>{t.notify("AnimationComplete",e)})}(t,e,i)))}function Fo(t){let e=jo(t),i=Uo(),s=!0;const n=e=>(i,s)=>{var n;const o=rn(t,s,"exit"===e?null===(n=t.presenceContext)||void 0===n?void 0:n.custom:void 0);if(o){const{transition:t,transitionEnd:e,...s}=o;i={...i,...s,...e}}return i};function o(o){const{props:r}=t,a=function t(e){if(!e)return;if(!e.isControllingVariants){const i=e.parent&&t(e.parent)||{};return void 0!==e.props.initial&&(i.initial=e.props.initial),i}const i={};for(let t=0;t<ko;t++){const s=$[t],n=e.props[s];(Y(n)||!1===n)&&(i[s]=n)}return i}(t.parent)||{},l=[],h=new Set;let u={},c=1/0;for(let e=0;e<Bo;e++){const d=Lo[e],p=i[d],m=void 0!==r[d]?r[d]:a[d],f=Y(m),v=d===o?p.isActive:null;!1===v&&(c=e);let g=m===a[d]&&m!==r[d]&&f;if(g&&s&&t.manuallyAnimateOnMount&&(g=!1),p.protectedKeys={...u},!p.isActive&&null===v||!m&&!p.prevProp||X(m)||"boolean"==typeof m)continue;const y=Oo(p.prevProp,m);let x=y||d===o&&p.isActive&&!g&&f||e>c&&f,P=!1;const T=Array.isArray(m)?m:[m];let S=T.reduce(n(d),{});!1===v&&(S={});const{prevResolvedValues:w={}}=p,A={...w,...S},b=e=>{x=!0,h.has(e)&&(P=!0,h.delete(e)),p.needsAnimating[e]=!0;const i=t.getValue(e);i&&(i.liveStyle=!1)};for(const t in A){const e=S[t],i=w[t];if(u.hasOwnProperty(t))continue;let s=!1;s=G(e)&&G(i)?!Ro(e,i):e!==i,s?null!=e?b(t):h.add(t):void 0!==e&&h.has(t)?b(t):p.protectedKeys[t]=!0}p.prevProp=m,p.prevResolvedValues=S,p.isActive&&(u={...u,...S}),s&&t.blockInitialAnimation&&(x=!1);const E=!(g&&y)||P;x&&E&&l.push(...T.map(t=>({animation:t,options:{type:d}})))}if(h.size){const e={};if("boolean"!=typeof r.initial){const i=rn(t,Array.isArray(r.initial)?r.initial[0]:r.initial);i&&i.transition&&(e.transition=i.transition)}h.forEach(i=>{const s=t.getBaseTarget(i),n=t.getValue(i);n&&(n.liveStyle=!0),e[i]=null!=s?s:null}),l.push({animation:e})}let d=Boolean(l.length);return!s||!1!==r.initial&&r.initial!==r.animate||t.manuallyAnimateOnMount||(d=!1),s=!1,d?e(l):Promise.resolve()}return{animateChanges:o,setActive:function(e,s){var n;if(i[e].isActive===s)return Promise.resolve();null===(n=t.variantChildren)||void 0===n||n.forEach(t=>{var i;return null===(i=t.animationState)||void 0===i?void 0:i.setActive(e,s)}),i[e].isActive=s;const r=o(e);for(const t in i)i[t].protectedKeys={};return r},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=Uo(),s=!0}}}function Oo(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!Ro(e,t)}function Io(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Uo(){return{animate:Io(!0),whileInView:Io(),whileHover:Io(),whileTap:Io(),whileDrag:Io(),whileFocus:Io(),exit:Io()}}let No=0;const Ko={animation:{Feature:class extends ht{constructor(t){super(t),t.animationState||(t.animationState=Fo(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();X(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),null===(t=this.unmountControls)||void 0===t||t.call(this)}}},exit:{Feature:class extends ht{constructor(){super(...arguments),this.id=No++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const s=this.node.animationState.setActive("exit",!t);e&&!t&&s.then(()=>{e(this.id)})}mount(){const{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}}};function zo(t,e,i){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover","Start"===i);const n=s["onHover"+i];n&&l.postRender(()=>n(e,hs(e)))}function Wo(t,e,i){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap","Start"===i);const n=s["onTap"+("End"===i?"":i)];n&&l.postRender(()=>n(e,hs(e)))}const Yo=new WeakMap,$o=new WeakMap,Xo=t=>{const e=Yo.get(t.target);e&&e(t)},Go=t=>{t.forEach(Xo)};function Ho(t,e,i){const s=function({root:t,...e}){const i=t||document;$o.has(i)||$o.set(i,{});const s=$o.get(i),n=JSON.stringify(e);return s[n]||(s[n]=new IntersectionObserver(Go,{root:t,...e})),s[n]}(e);return Yo.set(t,i),s.observe(t),()=>{Yo.delete(t),s.unobserve(t)}}const qo={some:0,all:1};const _o={...{renderer:(t,e)=>q(t)?new fn(e):new vn(e,{allowProjection:t!==it}),...Ko,...{inView:{Feature:class extends ht{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:s="some",once:n}=t,o={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof s?s:qo[s]};return Ho(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,n&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:i,onViewportLeave:s}=this.node.getProps(),o=e?i: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 i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends ht{mount(){const{current:t}=this.node;t&&(this.unmount=Ft(t,(t,e)=>(Wo(this.node,e,"Start"),(t,{success:e})=>Wo(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends ht{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ui(ls(this.node.current,"focus",()=>this.onFocus()),ls(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends ht{mount(){const{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){const[s,n,o]=Et(t,i),r=t=>{if(!Vt(t))return;const{target:i}=t,s=e(i,t);if("function"!=typeof s||!i)return;const o=t=>{Vt(t)&&(s(t),i.removeEventListener("pointerleave",o))};i.addEventListener("pointerleave",o,n)};return s.forEach(t=>{t.addEventListener("pointerenter",r,n)}),o}(t,(t,e)=>(zo(this.node,e,"Start"),t=>zo(this.node,t,"End"))))}unmount(){}}}}},...Vo,...Mo};export{_o as domMax};
|