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