sui-explorer-local
Version:
Local Sui Explorer
2 lines • 56.1 kB
JavaScript
import{r as g,R as pe}from"./index-76fb7be0.js";import{t as ge,w as Je,x as z,y as ye,z as dt,A as bt,j as Pt,B as Qe,C as ti,D as ve,E as Pe,F as ei,u as ii,G as si,I as xt,J as ni,K as oi,f as D,L as ri,M as ai,N as G,O as M,P as Tt,q as xe,Q as wt,R as Te,c as K,n as li,e as ui,T as L,h as A,p as mt,U as Se,V as S,W as ci,X as hi,Y as fi,Z as Q,_ as di,$ as Ae,a0 as Rt,a1 as mi,a2 as pi,a3 as Mt,a4 as De,r as Ce,a5 as gi,a as yi,a6 as vi,a7 as at,a8 as I,a9 as O,aa as Y,ab as Bt,ac as Pi,ad as xi,ae as Ti,af as U,o as Si,ag as jt,S as Ai,H as Di}from"./SVGVisualElement-4900b852.js";const Le=g.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),et=g.createContext({}),St=g.createContext(null),Ci=ge?g.useLayoutEffect:g.useEffect,Ee=g.createContext({strict:!1});function Li(t,e,i,s){const{visualElement:o}=g.useContext(et),h=g.useContext(Ee),n=g.useContext(St),r=g.useContext(Le).reducedMotion,a=g.useRef();s=s||h.renderer,!a.current&&s&&(a.current=s(t,{visualState:e,parent:o,props:i,presenceContext:n,blockInitialAnimation:n?n.initial===!1:!1,reducedMotionConfig:r}));const l=a.current;g.useInsertionEffect(()=>{l&&l.update(i,n)});const u=g.useRef(!!(i[Je]&&!window.HandoffComplete));return Ci(()=>{l&&(l.render(),u.current&&l.animationState&&l.animationState.animateChanges())}),g.useEffect(()=>{l&&(l.updateFeatures(),!u.current&&l.animationState&&l.animationState.animateChanges(),u.current&&(u.current=!1,window.HandoffComplete=!0))}),l}function Ei(t,e,i){return g.useCallback(s=>{s&&t.mount&&t.mount(s),e&&(s?e.mount(s):e.unmount()),i&&(typeof i=="function"?i(s):z(i)&&(i.current=s))},[e])}function Vi(t,e){if(ye(t)){const{initial:i,animate:s}=t;return{initial:i===!1||dt(i)?i:void 0,animate:dt(s)?s:void 0}}return t.inherit!==!1?e:{}}function bi(t){const{initial:e,animate:i}=Vi(t,g.useContext(et));return g.useMemo(()=>({initial:e,animate:i}),[kt(e),kt(i)])}function kt(t){return Array.isArray(t)?t.join(" "):t}function wi(t){for(const e in t)bt[e]={...bt[e],...t[e]}}const Ve=g.createContext({}),be=g.createContext({}),Ri=Symbol.for("motionComponentSymbol");function Mi({preloadedFeatures:t,createVisualElement:e,useRender:i,useVisualState:s,Component:o}){t&&wi(t);function h(r,a){let l;const u={...g.useContext(Le),...r,layoutId:Bi(r)},{isStatic:c}=u,f=bi(r),d=s(r,c);if(!c&&ge){f.visualElement=Li(o,d,u,e);const m=g.useContext(be),p=g.useContext(Ee).strict;f.visualElement&&(l=f.visualElement.loadFeatures(u,p,t,m))}return g.createElement(et.Provider,{value:f},l&&f.visualElement?g.createElement(l,{visualElement:f.visualElement,...u}):null,i(o,r,Ei(d,f.visualElement,a),d,c,f.visualElement))}const n=g.forwardRef(h);return n[Ri]=o,n}function Bi({layoutId:t}){const e=g.useContext(Ve).id;return e&&t!==void 0?e+"-"+t:t}function ji(t){function e(s,o={}){return Mi(t(s,o))}if(typeof Proxy>"u")return e;const i=new Map;return new Proxy(e,{get:(s,o)=>(i.has(o)||i.set(o,e(o)),i.get(o))})}const ki=["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 At(t){return typeof t!="string"||t.includes("-")?!1:!!(ki.indexOf(t)>-1||/[A-Z]/.test(t))}const Dt=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function we(t,e,i){for(const s in e)!Pt(e[s])&&!Qe(s,i)&&(t[s]=e[s])}function Fi({transformTemplate:t},e,i){return g.useMemo(()=>{const s=Dt();return ti(s,e,{enableHardwareAcceleration:!i},t),Object.assign({},s.vars,s.style)},[e])}function Ii(t,e,i){const s=t.style||{},o={};return we(o,s,t),Object.assign(o,Fi(t,e,i)),t.transformValues?t.transformValues(o):o}function Oi(t,e,i){const s={},o=Ii(t,e,i);return t.drag&&t.dragListener!==!1&&(s.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(s.tabIndex=0),s.style=o,s}const Ui=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function tt(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ui.has(t)}let Re=t=>!tt(t);function Gi(t){t&&(Re=e=>e.startsWith("on")?!tt(e):t(e))}try{Gi(require("@emotion/is-prop-valid").default)}catch{}function Hi(t,e,i){const s={};for(const o in t)o==="values"&&typeof t.values=="object"||(Re(o)||i===!0&&tt(o)||!e&&!tt(o)||t.draggable&&o.startsWith("onDrag"))&&(s[o]=t[o]);return s}const Me=()=>({...Dt(),attrs:{}});function Ni(t,e,i,s){const o=g.useMemo(()=>{const h=Me();return ve(h,e,{enableHardwareAcceleration:!1},Pe(s),t.transformTemplate),{...h.attrs,style:{...h.style}}},[e]);if(t.style){const h={};we(h,t.style,t),o.style={...h,...o.style}}return o}function Wi(t=!1){return(i,s,o,{latestValues:h},n)=>{const a=(At(i)?Ni:Oi)(s,h,n,i),u={...Hi(s,typeof i=="string",t),...a,ref:o},{children:c}=s,f=g.useMemo(()=>Pt(c)?c.get():c,[c]);return g.createElement(i,{...u,children:f})}}function Z(t){const e=Pt(t)?t.get():t;return ei(e)?e.toValue():e}function zi({scrapeMotionValuesFromProps:t,createRenderState:e,onMount:i},s,o,h){const n={latestValues:_i(s,o,h,t),renderState:e()};return i&&(n.mount=r=>i(s,r,n)),n}const Be=t=>(e,i)=>{const s=g.useContext(et),o=g.useContext(St),h=()=>zi(t,e,s,o);return i?h():ii(h)};function _i(t,e,i,s){const o={},h=s(t,{});for(const f in h)o[f]=Z(h[f]);let{initial:n,animate:r}=t;const a=ye(t),l=si(t);e&&l&&!a&&t.inherit!==!1&&(n===void 0&&(n=e.initial),r===void 0&&(r=e.animate));let u=i?i.initial===!1:!1;u=u||n===!1;const c=u?r:n;return c&&typeof c!="boolean"&&!xt(c)&&(Array.isArray(c)?c:[c]).forEach(d=>{const m=ni(t,d);if(!m)return;const{transitionEnd:p,transition:x,...P}=m;for(const v in P){let y=P[v];if(Array.isArray(y)){const T=u?y.length-1:0;y=y[T]}y!==null&&(o[v]=y)}for(const v in p)o[v]=p[v]}),o}const $i={useVisualState:Be({scrapeMotionValuesFromProps:oi,createRenderState:Me,onMount:(t,e,{renderState:i,latestValues:s})=>{D.read(()=>{try{i.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{i.dimensions={x:0,y:0,width:0,height:0}}}),D.render(()=>{ve(i,s,{enableHardwareAcceleration:!1},Pe(e.tagName),t.transformTemplate),ri(e,i)})}})},Ki={useVisualState:Be({scrapeMotionValuesFromProps:ai,createRenderState:Dt})};function Xi(t,{forwardMotionProps:e=!1},i,s){return{...At(t)?$i:Ki,preloadedFeatures:i,useRender:Wi(e),createVisualElement:s,Component:t}}function R(t,e,i,s={passive:!0}){return t.addEventListener(e,i,s),()=>t.removeEventListener(e,i)}const je=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function it(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}const Yi=t=>e=>je(e)&&t(e,it(e));function B(t,e,i,s){return R(t,e,Yi(i),s)}function ke(t){let e=null;return()=>{const i=()=>{e=null};return e===null?(e=t,i):!1}}const Ft=ke("dragHorizontal"),It=ke("dragVertical");function Fe(t){let e=!1;if(t==="y")e=It();else if(t==="x")e=Ft();else{const i=Ft(),s=It();i&&s?e=()=>{i(),s()}:(i&&i(),s&&s())}return e}function Ie(){const t=Fe(!0);return t?(t(),!1):!0}class j{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Ot(t,e){const i="pointer"+(e?"enter":"leave"),s="onHover"+(e?"Start":"End"),o=(h,n)=>{if(h.pointerType==="touch"||Ie())return;const r=t.getProps();t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",e),r[s]&&D.update(()=>r[s](h,n))};return B(t.current,i,o,{passive:!t.getProps()[s]})}class qi extends j{mount(){this.unmount=G(Ot(this.node,!0),Ot(this.node,!1))}unmount(){}}class Zi extends j{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=G(R(this.node.current,"focus",()=>this.onFocus()),R(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const Oe=(t,e)=>e?t===e?!0:Oe(t,e.parentElement):!1;function lt(t,e){if(!e)return;const i=new PointerEvent("pointer"+t);e(i,it(i))}class Ji extends j{constructor(){super(...arguments),this.removeStartListeners=M,this.removeEndListeners=M,this.removeAccessibleListeners=M,this.startPointerPress=(e,i)=>{if(this.isPressing)return;this.removeEndListeners();const s=this.node.getProps(),h=B(window,"pointerup",(r,a)=>{if(!this.checkPressEnd())return;const{onTap:l,onTapCancel:u,globalTapTarget:c}=this.node.getProps();D.update(()=>{!c&&!Oe(this.node.current,r.target)?u&&u(r,a):l&&l(r,a)})},{passive:!(s.onTap||s.onPointerUp)}),n=B(window,"pointercancel",(r,a)=>this.cancelPress(r,a),{passive:!(s.onTapCancel||s.onPointerCancel)});this.removeEndListeners=G(h,n),this.startPress(e,i)},this.startAccessiblePress=()=>{const e=h=>{if(h.key!=="Enter"||this.isPressing)return;const n=r=>{r.key!=="Enter"||!this.checkPressEnd()||lt("up",(a,l)=>{const{onTap:u}=this.node.getProps();u&&D.update(()=>u(a,l))})};this.removeEndListeners(),this.removeEndListeners=R(this.node.current,"keyup",n),lt("down",(r,a)=>{this.startPress(r,a)})},i=R(this.node.current,"keydown",e),s=()=>{this.isPressing&<("cancel",(h,n)=>this.cancelPress(h,n))},o=R(this.node.current,"blur",s);this.removeAccessibleListeners=G(i,o)}}startPress(e,i){this.isPressing=!0;const{onTapStart:s,whileTap:o}=this.node.getProps();o&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&D.update(()=>s(e,i))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Ie()}cancelPress(e,i){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&D.update(()=>s(e,i))}mount(){const e=this.node.getProps(),i=B(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),s=R(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=G(i,s)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const pt=new WeakMap,ut=new WeakMap,Qi=t=>{const e=pt.get(t.target);e&&e(t)},ts=t=>{t.forEach(Qi)};function es({root:t,...e}){const i=t||document;ut.has(i)||ut.set(i,{});const s=ut.get(i),o=JSON.stringify(e);return s[o]||(s[o]=new IntersectionObserver(ts,{root:t,...e})),s[o]}function is(t,e,i){const s=es(e);return pt.set(t,i),s.observe(t),()=>{pt.delete(t),s.unobserve(t)}}const ss={some:0,all:1};class ns extends j{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:i,margin:s,amount:o="some",once:h}=e,n={root:i?i.current:void 0,rootMargin:s,threshold:typeof o=="number"?o:ss[o]},r=a=>{const{isIntersecting:l}=a;if(this.isInView===l||(this.isInView=l,h&&!l&&this.hasEnteredView))return;l&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",l);const{onViewportEnter:u,onViewportLeave:c}=this.node.getProps(),f=l?u:c;f&&f(a)};return is(this.node.current,n,r)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:i}=this.node;["amount","margin","root"].some(os(e,i))&&this.startObserver()}unmount(){}}function os({viewport:t={}},{viewport:e={}}={}){return i=>t[i]!==e[i]}const rs={inView:{Feature:ns},tap:{Feature:Ji},focus:{Feature:Zi},hover:{Feature:qi}};function Ue(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}function gt(t,e,i={}){const s=Tt(t,e,i.custom);let{transition:o=t.getDefaultTransition()||{}}=s||{};i.transitionOverride&&(o=i.transitionOverride);const h=s?()=>Promise.all(xe(t,s,i)):()=>Promise.resolve(),n=t.variantChildren&&t.variantChildren.size?(a=0)=>{const{delayChildren:l=0,staggerChildren:u,staggerDirection:c}=o;return as(t,e,l+a,u,c,i)}:()=>Promise.resolve(),{when:r}=o;if(r){const[a,l]=r==="beforeChildren"?[h,n]:[n,h];return a().then(()=>l())}else return Promise.all([h(),n(i.delay)])}function as(t,e,i=0,s=0,o=1,h){const n=[],r=(t.variantChildren.size-1)*s,a=o===1?(l=0)=>l*s:(l=0)=>r-l*s;return Array.from(t.variantChildren).sort(ls).forEach((l,u)=>{l.notify("AnimationStart",e),n.push(gt(l,e,{...h,delay:i+a(u)}).then(()=>l.notify("AnimationComplete",e)))}),Promise.all(n)}function ls(t,e){return t.sortNodePosition(e)}function us(t,e,i={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const o=e.map(h=>gt(t,h,i));s=Promise.all(o)}else if(typeof e=="string")s=gt(t,e,i);else{const o=typeof e=="function"?Tt(t,e,i.custom):e;s=Promise.all(xe(t,o,i))}return s.then(()=>t.notify("AnimationComplete",e))}const cs=[...Te].reverse(),hs=Te.length;function fs(t){return e=>Promise.all(e.map(({animation:i,options:s})=>us(t,i,s)))}function ds(t){let e=fs(t);const i=ps();let s=!0;const o=(a,l)=>{const u=Tt(t,l);if(u){const{transition:c,transitionEnd:f,...d}=u;a={...a,...d,...f}}return a};function h(a){e=a(t)}function n(a,l){const u=t.getProps(),c=t.getVariantContext(!0)||{},f=[],d=new Set;let m={},p=1/0;for(let P=0;P<hs;P++){const v=cs[P],y=i[v],T=u[v]!==void 0?u[v]:c[v],w=dt(T),st=v===l?y.isActive:null;st===!1&&(p=P);let X=T===c[v]&&T!==u[v]&&w;if(X&&s&&t.manuallyAnimateOnMount&&(X=!1),y.protectedKeys={...m},!y.isActive&&st===null||!T&&!y.prevProp||xt(T)||typeof T=="boolean")continue;let nt=ms(y.prevProp,T)||v===l&&y.isActive&&!X&&w||P>p&&w,Ct=!1;const Lt=Array.isArray(T)?T:[T];let H=Lt.reduce(o,{});st===!1&&(H={});const{prevResolvedValues:Et={}}=y,Ze={...Et,...H},Vt=C=>{nt=!0,d.has(C)&&(Ct=!0,d.delete(C)),y.needsAnimating[C]=!0};for(const C in Ze){const N=H[C],ot=Et[C];if(m.hasOwnProperty(C))continue;let rt=!1;wt(N)&&wt(ot)?rt=!Ue(N,ot):rt=N!==ot,rt?N!==void 0?Vt(C):d.add(C):N!==void 0&&d.has(C)?Vt(C):y.protectedKeys[C]=!0}y.prevProp=T,y.prevResolvedValues=H,y.isActive&&(m={...m,...H}),s&&t.blockInitialAnimation&&(nt=!1),nt&&(!X||Ct)&&f.push(...Lt.map(C=>({animation:C,options:{type:v,...a}})))}if(d.size){const P={};d.forEach(v=>{const y=t.getBaseTarget(v);y!==void 0&&(P[v]=y)}),f.push({animation:P})}let x=!!f.length;return s&&(u.initial===!1||u.initial===u.animate)&&!t.manuallyAnimateOnMount&&(x=!1),s=!1,x?e(f):Promise.resolve()}function r(a,l,u){var c;if(i[a].isActive===l)return Promise.resolve();(c=t.variantChildren)===null||c===void 0||c.forEach(d=>{var m;return(m=d.animationState)===null||m===void 0?void 0:m.setActive(a,l)}),i[a].isActive=l;const f=n(u,a);for(const d in i)i[d].protectedKeys={};return f}return{animateChanges:n,setActive:r,setAnimateFunction:h,getState:()=>i}}function ms(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Ue(e,t):!1}function k(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ps(){return{animate:k(!0),whileInView:k(),whileHover:k(),whileTap:k(),whileDrag:k(),whileFocus:k(),exit:k()}}class gs extends j{constructor(e){super(e),e.animationState||(e.animationState=ds(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),xt(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:i}=this.node.prevProps||{};e!==i&&this.updateAnimationControlsSubscription()}unmount(){}}let ys=0;class vs extends j{constructor(){super(...arguments),this.id=ys++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:i,custom:s}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===o)return;const h=this.node.animationState.setActive("exit",!e,{custom:s??this.node.getProps().custom});i&&!e&&h.then(()=>i(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Ps={animation:{Feature:gs},exit:{Feature:vs}},Ut=(t,e)=>Math.abs(t-e);function xs(t,e){const i=Ut(t.x,e.x),s=Ut(t.y,e.y);return Math.sqrt(i**2+s**2)}class Ge{constructor(e,i,{transformPagePoint:s,contextWindow:o,dragSnapToOrigin:h=!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 c=ht(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,d=xs(c.offset,{x:0,y:0})>=3;if(!f&&!d)return;const{point:m}=c,{timestamp:p}=L;this.history.push({...m,timestamp:p});const{onStart:x,onMove:P}=this.handlers;f||(x&&x(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),P&&P(this.lastMoveEvent,c)},this.handlePointerMove=(c,f)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=ct(f,this.transformPagePoint),D.update(this.updatePoint,!0)},this.handlePointerUp=(c,f)=>{this.end();const{onEnd:d,onSessionEnd:m,resumeAnimation:p}=this.handlers;if(this.dragSnapToOrigin&&p&&p(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=ht(c.type==="pointercancel"?this.lastMoveEventInfo:ct(f,this.transformPagePoint),this.history);this.startEvent&&d&&d(c,x),m&&m(c,x)},!je(e))return;this.dragSnapToOrigin=h,this.handlers=i,this.transformPagePoint=s,this.contextWindow=o||window;const n=it(e),r=ct(n,this.transformPagePoint),{point:a}=r,{timestamp:l}=L;this.history=[{...a,timestamp:l}];const{onSessionStart:u}=i;u&&u(e,ht(r,this.history)),this.removeListeners=G(B(this.contextWindow,"pointermove",this.handlePointerMove),B(this.contextWindow,"pointerup",this.handlePointerUp),B(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),K(this.updatePoint)}}function ct(t,e){return e?{point:e(t.point)}:t}function Gt(t,e){return{x:t.x-e.x,y:t.y-e.y}}function ht({point:t},e){return{point:t,delta:Gt(t,He(e)),offset:Gt(t,Ts(e)),velocity:Ss(e,.1)}}function Ts(t){return t[0]}function He(t){return t[t.length-1]}function Ss(t,e){if(t.length<2)return{x:0,y:0};let i=t.length-1,s=null;const o=He(t);for(;i>=0&&(s=t[i],!(o.timestamp-s.timestamp>li(e)));)i--;if(!s)return{x:0,y:0};const h=ui(o.timestamp-s.timestamp);if(h===0)return{x:0,y:0};const n={x:(o.x-s.x)/h,y:(o.y-s.y)/h};return n.x===1/0&&(n.x=0),n.y===1/0&&(n.y=0),n}function E(t){return t.max-t.min}function yt(t,e=0,i=.01){return Math.abs(t-e)<=i}function Ht(t,e,i,s=.5){t.origin=s,t.originPoint=A(e.min,e.max,t.origin),t.scale=E(i)/E(e),(yt(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=A(i.min,i.max,t.origin)-t.originPoint,(yt(t.translate)||isNaN(t.translate))&&(t.translate=0)}function _(t,e,i,s){Ht(t.x,e.x,i.x,s?s.originX:void 0),Ht(t.y,e.y,i.y,s?s.originY:void 0)}function Nt(t,e,i){t.min=i.min+e.min,t.max=t.min+E(e)}function As(t,e,i){Nt(t.x,e.x,i.x),Nt(t.y,e.y,i.y)}function Wt(t,e,i){t.min=e.min-i.min,t.max=t.min+E(e)}function $(t,e,i){Wt(t.x,e.x,i.x),Wt(t.y,e.y,i.y)}function Ds(t,{min:e,max:i},s){return e!==void 0&&t<e?t=s?A(e,t,s.min):Math.max(t,e):i!==void 0&&t>i&&(t=s?A(i,t,s.max):Math.min(t,i)),t}function zt(t,e,i){return{min:e!==void 0?t.min+e:void 0,max:i!==void 0?t.max+i-(t.max-t.min):void 0}}function Cs(t,{top:e,left:i,bottom:s,right:o}){return{x:zt(t.x,i,o),y:zt(t.y,e,s)}}function _t(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}}function Ls(t,e){return{x:_t(t.x,e.x),y:_t(t.y,e.y)}}function Es(t,e){let i=.5;const s=E(t),o=E(e);return o>s?i=mt(e.min,e.max-s,t.min):s>o&&(i=mt(t.min,t.max-o,e.min)),Se(0,1,i)}function Vs(t,e){const i={};return e.min!==void 0&&(i.min=e.min-t.min),e.max!==void 0&&(i.max=e.max-t.min),i}const vt=.35;function bs(t=vt){return t===!1?t=0:t===!0&&(t=vt),{x:$t(t,"left","right"),y:$t(t,"top","bottom")}}function $t(t,e,i){return{min:Kt(t,e),max:Kt(t,i)}}function Kt(t,e){return typeof t=="number"?t:t[e]||0}function b(t){return[t("x"),t("y")]}const Ne=({current:t})=>t?t.ownerDocument.defaultView:null,ws=new WeakMap;class Rs{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=S(),this.visualElement=e}start(e,{snapToCursor:i=!1}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=u=>{const{dragSnapToOrigin:c}=this.getProps();c?this.pauseAnimation():this.stopAnimation(),i&&this.snapToCursor(it(u,"page").point)},h=(u,c)=>{const{drag:f,dragPropagation:d,onDragStart:m}=this.getProps();if(f&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=Fe(f),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),b(x=>{let P=this.getAxisMotionValue(x).get()||0;if(Q.test(P)){const{projection:v}=this.visualElement;if(v&&v.layout){const y=v.layout.layoutBox[x];y&&(P=E(y)*(parseFloat(P)/100))}}this.originPoint[x]=P}),m&&D.update(()=>m(u,c),!1,!0);const{animationState:p}=this.visualElement;p&&p.setActive("whileDrag",!0)},n=(u,c)=>{const{dragPropagation:f,dragDirectionLock:d,onDirectionLock:m,onDrag:p}=this.getProps();if(!f&&!this.openGlobalLock)return;const{offset:x}=c;if(d&&this.currentDirection===null){this.currentDirection=Ms(x),this.currentDirection!==null&&m&&m(this.currentDirection);return}this.updateAxis("x",c.point,x),this.updateAxis("y",c.point,x),this.visualElement.render(),p&&p(u,c)},r=(u,c)=>this.stop(u,c),a=()=>b(u=>{var c;return this.getAnimationState(u)==="paused"&&((c=this.getAxisMotionValue(u).animation)===null||c===void 0?void 0:c.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new Ge(e,{onSessionStart:o,onStart:h,onMove:n,onSessionEnd:r,resumeAnimation:a},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:Ne(this.visualElement)})}stop(e,i){const s=this.isDragging;if(this.cancel(),!s)return;const{velocity:o}=i;this.startAnimation(o);const{onDragEnd:h}=this.getProps();h&&D.update(()=>h(e,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:i}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:s}=this.getProps();!s&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),i&&i.setActive("whileDrag",!1)}updateAxis(e,i,s){const{drag:o}=this.getProps();if(!s||!q(e,o,this.currentDirection))return;const h=this.getAxisMotionValue(e);let n=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(n=Ds(n,this.constraints[e],this.elastic[e])),h.set(n)}resolveConstraints(){var e;const{dragConstraints:i,dragElastic:s}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,h=this.constraints;i&&z(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&o?this.constraints=Cs(o.layoutBox,i):this.constraints=!1,this.elastic=bs(s),h!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&b(n=>{this.getAxisMotionValue(n)&&(this.constraints[n]=Vs(o.layoutBox[n],this.constraints[n]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:i}=this.getProps();if(!e||!z(e))return!1;const s=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const h=ci(s,o.root,this.visualElement.getTransformPagePoint());let n=Ls(o.layout.layoutBox,h);if(i){const r=i(hi(n));this.hasMutatedConstraints=!!r,r&&(n=di(r))}return n}startAnimation(e){const{drag:i,dragMomentum:s,dragElastic:o,dragTransition:h,dragSnapToOrigin:n,onDragTransitionEnd:r}=this.getProps(),a=this.constraints||{},l=b(u=>{if(!q(u,i,this.currentDirection))return;let c=a&&a[u]||{};n&&(c={min:0,max:0});const f=o?200:1e6,d=o?40:1e7,m={type:"inertia",velocity:s?e[u]:0,bounceStiffness:f,bounceDamping:d,timeConstant:750,restDelta:1,restSpeed:10,...h,...c};return this.startAxisValueAnimation(u,m)});return Promise.all(l).then(r)}startAxisValueAnimation(e,i){const s=this.getAxisMotionValue(e);return s.start(fi(e,s,0,i))}stopAnimation(){b(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){b(e=>{var i;return(i=this.getAxisMotionValue(e).animation)===null||i===void 0?void 0:i.pause()})}getAnimationState(e){var i;return(i=this.getAxisMotionValue(e).animation)===null||i===void 0?void 0:i.state}getAxisMotionValue(e){const i="_drag"+e.toUpperCase(),s=this.visualElement.getProps(),o=s[i];return o||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){b(i=>{const{drag:s}=this.getProps();if(!q(i,s,this.currentDirection))return;const{projection:o}=this.visualElement,h=this.getAxisMotionValue(i);if(o&&o.layout){const{min:n,max:r}=o.layout.layoutBox[i];h.set(e[i]-A(n,r,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:i}=this.getProps(),{projection:s}=this.visualElement;if(!z(i)||!s||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};b(n=>{const r=this.getAxisMotionValue(n);if(r){const a=r.get();o[n]=Es({min:a,max:a},this.constraints[n])}});const{transformTemplate:h}=this.visualElement.getProps();this.visualElement.current.style.transform=h?h({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),b(n=>{if(!q(n,e,null))return;const r=this.getAxisMotionValue(n),{min:a,max:l}=this.constraints[n];r.set(A(a,l,o[n]))})}addListeners(){if(!this.visualElement.current)return;ws.set(this.visualElement,this);const e=this.visualElement.current,i=B(e,"pointerdown",a=>{const{drag:l,dragListener:u=!0}=this.getProps();l&&u&&this.start(a)}),s=()=>{const{dragConstraints:a}=this.getProps();z(a)&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,h=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),s();const n=R(window,"resize",()=>this.scalePositionWithinConstraints()),r=o.addEventListener("didUpdate",({delta:a,hasLayoutChanged:l})=>{this.isDragging&&l&&(b(u=>{const c=this.getAxisMotionValue(u);c&&(this.originPoint[u]+=a[u].translate,c.set(c.get()+a[u].translate))}),this.visualElement.render())});return()=>{n(),i(),h(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:i=!1,dragDirectionLock:s=!1,dragPropagation:o=!1,dragConstraints:h=!1,dragElastic:n=vt,dragMomentum:r=!0}=e;return{...e,drag:i,dragDirectionLock:s,dragPropagation:o,dragConstraints:h,dragElastic:n,dragMomentum:r}}}function q(t,e,i){return(e===!0||e===t)&&(i===null||i===t)}function Ms(t,e=10){let i=null;return Math.abs(t.y)>e?i="y":Math.abs(t.x)>e&&(i="x"),i}class Bs extends j{constructor(e){super(e),this.removeGroupControls=M,this.removeListeners=M,this.controls=new Rs(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||M}unmount(){this.removeGroupControls(),this.removeListeners()}}const Xt=t=>(e,i)=>{t&&D.update(()=>t(e,i))};class js extends j{constructor(){super(...arguments),this.removePointerDownListener=M}onPointerDown(e){this.session=new Ge(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Ne(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:i,onPan:s,onPanEnd:o}=this.node.getProps();return{onSessionStart:Xt(e),onStart:Xt(i),onMove:s,onEnd:(h,n)=>{delete this.session,o&&D.update(()=>o(h,n))}}}mount(){this.removePointerDownListener=B(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function ks(){const t=g.useContext(St);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:i,register:s}=t,o=g.useId();return g.useEffect(()=>s(o),[]),!e&&i?[!1,()=>i&&i(o)]:[!0]}const J={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Yt(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const W={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ae.test(t))t=parseFloat(t);else return t;const i=Yt(t,e.target.x),s=Yt(t,e.target.y);return`${i}% ${s}%`}},Fs={correct:(t,{treeScale:e,projectionDelta:i})=>{const s=t,o=Rt.parse(t);if(o.length>5)return s;const h=Rt.createTransformer(t),n=typeof o[0]!="number"?1:0,r=i.x.scale*e.x,a=i.y.scale*e.y;o[0+n]/=r,o[1+n]/=a;const l=A(r,a,.5);return typeof o[2+n]=="number"&&(o[2+n]/=l),typeof o[3+n]=="number"&&(o[3+n]/=l),h(o)}};class Is extends pe.Component{componentDidMount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:s,layoutId:o}=this.props,{projection:h}=e;mi(Os),h&&(i.group&&i.group.add(h),s&&s.register&&o&&s.register(h),h.root.didUpdate(),h.addEventListener("animationComplete",()=>{this.safeToRemove()}),h.setOptions({...h.options,onExitComplete:()=>this.safeToRemove()})),J.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:i,visualElement:s,drag:o,isPresent:h}=this.props,n=s.projection;return n&&(n.isPresent=h,o||e.layoutDependency!==i||i===void 0?n.willUpdate():this.safeToRemove(),e.isPresent!==h&&(h?n.promote():n.relegate()||D.postRender(()=>{const r=n.getStack();(!r||!r.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),queueMicrotask(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:i,switchLayoutGroup:s}=this.props,{projection:o}=e;o&&(o.scheduleCheckAfterUnmount(),i&&i.group&&i.group.remove(o),s&&s.deregister&&s.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function We(t){const[e,i]=ks(),s=g.useContext(Ve);return pe.createElement(Is,{...t,layoutGroup:s,switchLayoutGroup:g.useContext(be),isPresent:e,safeToRemove:i})}const Os={borderRadius:{...W,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomLeftRadius:W,borderBottomRightRadius:W,boxShadow:Fs},ze=["TopLeft","TopRight","BottomLeft","BottomRight"],Us=ze.length,qt=t=>typeof t=="string"?parseFloat(t):t,Zt=t=>typeof t=="number"||Ae.test(t);function Gs(t,e,i,s,o,h){o?(t.opacity=A(0,i.opacity!==void 0?i.opacity:1,Hs(s)),t.opacityExit=A(e.opacity!==void 0?e.opacity:1,0,Ns(s))):h&&(t.opacity=A(e.opacity!==void 0?e.opacity:1,i.opacity!==void 0?i.opacity:1,s));for(let n=0;n<Us;n++){const r=`border${ze[n]}Radius`;let a=Jt(e,r),l=Jt(i,r);if(a===void 0&&l===void 0)continue;a||(a=0),l||(l=0),a===0||l===0||Zt(a)===Zt(l)?(t[r]=Math.max(A(qt(a),qt(l),s),0),(Q.test(l)||Q.test(a))&&(t[r]+="%")):t[r]=l}(e.rotate||i.rotate)&&(t.rotate=A(e.rotate||0,i.rotate||0,s))}function Jt(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Hs=_e(0,.5,pi),Ns=_e(.5,.95,M);function _e(t,e,i){return s=>s<t?0:s>e?1:i(mt(t,e,s))}function Qt(t,e){t.min=e.min,t.max=e.max}function V(t,e){Qt(t.x,e.x),Qt(t.y,e.y)}function te(t,e,i,s,o){return t-=e,t=Mt(t,1/i,s),o!==void 0&&(t=Mt(t,1/o,s)),t}function Ws(t,e=0,i=1,s=.5,o,h=t,n=t){if(Q.test(e)&&(e=parseFloat(e),e=A(n.min,n.max,e/100)-n.min),typeof e!="number")return;let r=A(h.min,h.max,s);t===h&&(r-=e),t.min=te(t.min,e,i,r,o),t.max=te(t.max,e,i,r,o)}function ee(t,e,[i,s,o],h,n){Ws(t,e[i],e[s],e[o],e.scale,h,n)}const zs=["x","scaleX","originX"],_s=["y","scaleY","originY"];function ie(t,e,i,s){ee(t.x,e,zs,i?i.x:void 0,s?s.x:void 0),ee(t.y,e,_s,i?i.y:void 0,s?s.y:void 0)}function se(t){return t.translate===0&&t.scale===1}function $e(t){return se(t.x)&&se(t.y)}function $s(t,e){return t.x.min===e.x.min&&t.x.max===e.x.max&&t.y.min===e.y.min&&t.y.max===e.y.max}function Ke(t,e){return Math.round(t.x.min)===Math.round(e.x.min)&&Math.round(t.x.max)===Math.round(e.x.max)&&Math.round(t.y.min)===Math.round(e.y.min)&&Math.round(t.y.max)===Math.round(e.y.max)}function ne(t){return E(t.x)/E(t.y)}class Ks{constructor(){this.members=[]}add(e){De(this.members,e),e.scheduleRender()}remove(e){if(Ce(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const i=this.members[this.members.length-1];i&&this.promote(i)}}relegate(e){const i=this.members.findIndex(o=>e===o);if(i===0)return!1;let s;for(let o=i;o>=0;o--){const h=this.members[o];if(h.isPresent!==!1){s=h;break}}return s?(this.promote(s),!0):!1}promote(e,i){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,i&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:i,resumingFrom:s}=e;i.onExitComplete&&i.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function oe(t,e,i){let s="";const o=t.x.translate/e.x,h=t.y.translate/e.y;if((o||h)&&(s=`translate3d(${o}px, ${h}px, 0) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),i){const{rotate:a,rotateX:l,rotateY:u}=i;a&&(s+=`rotate(${a}deg) `),l&&(s+=`rotateX(${l}deg) `),u&&(s+=`rotateY(${u}deg) `)}const n=t.x.scale*e.x,r=t.y.scale*e.y;return(n!==1||r!==1)&&(s+=`scale(${n}, ${r})`),s||"none"}const Xs=(t,e)=>t.depth-e.depth;class Ys{constructor(){this.children=[],this.isDirty=!1}add(e){De(this.children,e),this.isDirty=!0}remove(e){Ce(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Xs),this.isDirty=!1,this.children.forEach(e)}}function qs(t,e){const i=performance.now(),s=({timestamp:o})=>{const h=o-i;h>=e&&(K(s),t(h-e))};return D.read(s,!0),()=>K(s)}function Zs(t){window.MotionDebug&&window.MotionDebug.record(t)}const re=["","X","Y","Z"],Js={visibility:"hidden"},ae=1e3;let Qs=0;const F={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function Xe({attachResizeListener:t,defaultParent:e,measureScroll:i,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(n={},r=e==null?void 0:e()){this.id=Qs++,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.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,F.totalNodes=F.resolvedTargetDeltas=F.recalculatedProjection=0,this.nodes.forEach(sn),this.nodes.forEach(ln),this.nodes.forEach(un),this.nodes.forEach(nn),Zs(F)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=n,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new Ys)}addEventListener(n,r){return this.eventHandlers.has(n)||this.eventHandlers.set(n,new gi),this.eventHandlers.get(n).add(r)}notifyListeners(n,...r){const a=this.eventHandlers.get(n);a&&a.notify(...r)}hasListeners(n){return this.eventHandlers.has(n)}mount(n,r=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=yi(n),this.instance=n;const{layoutId:a,layout:l,visualElement:u}=this.options;if(u&&!u.current&&u.mount(n),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),r&&(l||a)&&(this.isLayoutDirty=!0),t){let c;const f=()=>this.root.updateBlockedByResize=!1;t(n,()=>{this.root.updateBlockedByResize=!0,c&&c(),c=qs(f,250),J.hasAnimatedSinceResize&&(J.hasAnimatedSinceResize=!1,this.nodes.forEach(ue))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&u&&(a||l)&&this.addEventListener("didUpdate",({delta:c,hasLayoutChanged:f,hasRelativeTargetChanged:d,layout:m})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||u.getDefaultTransition()||mn,{onLayoutAnimationStart:x,onLayoutAnimationComplete:P}=u.getProps(),v=!this.targetLayout||!Ke(this.targetLayout,m)||d,y=!f&&d;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||y||f&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(c,y);const T={...vi(p,"layout"),onPlay:x,onComplete:P};(u.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T)}else f||ue(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=m})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const n=this.getStack();n&&n.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,K(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(cn),this.animationId++)}getTransformTemplate(){const{visualElement:n}=this.options;return n&&n.getProps().transformTemplate}willUpdate(n=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const c=this.path[u];c.shouldResetTransform=!0,c.updateScroll("snapshot"),c.options.layoutRoot&&c.willUpdate(!1)}const{layoutId:r,layout:a}=this.options;if(r===void 0&&!a)return;const l=this.getTransformTemplate();this.prevTransformTemplateValue=l?l(this.latestValues,""):void 0,this.updateSnapshot(),n&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(le);return}this.isUpdating||this.nodes.forEach(rn),this.isUpdating=!1,this.nodes.forEach(an),this.nodes.forEach(tn),this.nodes.forEach(en),this.clearAllSnapshots();const r=performance.now();L.delta=Se(0,1e3/60,r-L.timestamp),L.timestamp=r,L.isProcessing=!0,at.update.process(L),at.preRender.process(L),at.render.process(L),L.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,queueMicrotask(()=>this.update()))}clearAllSnapshots(){this.nodes.forEach(on),this.sharedNodes.forEach(hn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,D.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){D.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let a=0;a<this.path.length;a++)this.path[a].updateScroll();const n=this.layout;this.layout=this.measure(!1),this.layoutCorrected=S(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:r}=this.options;r&&r.notify("LayoutMeasure",this.layout.layoutBox,n?n.layoutBox:void 0)}updateScroll(n="measure"){let r=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===n&&(r=!1),r&&(this.scroll={animationId:this.root.animationId,phase:n,isRoot:s(this.instance),offset:i(this.instance)})}resetTransform(){if(!o)return;const n=this.isLayoutDirty||this.shouldResetTransform,r=this.projectionDelta&&!$e(this.projectionDelta),a=this.getTransformTemplate(),l=a?a(this.latestValues,""):void 0,u=l!==this.prevTransformTemplateValue;n&&(r||I(this.latestValues)||u)&&(o(this.instance,l),this.shouldResetTransform=!1,this.scheduleRender())}measure(n=!0){const r=this.measurePageBox();let a=this.removeElementScroll(r);return n&&(a=this.removeTransform(a)),pn(a),{animationId:this.root.animationId,measuredBox:r,layoutBox:a,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:n}=this.options;if(!n)return S();const r=n.measureViewportBox(),{scroll:a}=this.root;return a&&(O(r.x,a.offset.x),O(r.y,a.offset.y)),r}removeElementScroll(n){const r=S();V(r,n);for(let a=0;a<this.path.length;a++){const l=this.path[a],{scroll:u,options:c}=l;if(l!==this.root&&u&&c.layoutScroll){if(u.isRoot){V(r,n);const{scroll:f}=this.root;f&&(O(r.x,-f.offset.x),O(r.y,-f.offset.y))}O(r.x,u.offset.x),O(r.y,u.offset.y)}}return r}applyTransform(n,r=!1){const a=S();V(a,n);for(let l=0;l<this.path.length;l++){const u=this.path[l];!r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Y(a,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),I(u.latestValues)&&Y(a,u.latestValues)}return I(this.latestValues)&&Y(a,this.latestValues),a}removeTransform(n){const r=S();V(r,n);for(let a=0;a<this.path.length;a++){const l=this.path[a];if(!l.instance||!I(l.latestValues))continue;Bt(l.latestValues)&&l.updateSnapshot();const u=S(),c=l.measurePageBox();V(u,c),ie(r,l.latestValues,l.snapshot?l.snapshot.layoutBox:void 0,u)}return I(this.latestValues)&&ie(r,this.latestValues),r}setTargetDelta(n){this.targetDelta=n,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(n){this.options={...this.options,...n,crossfade:n.crossfade!==void 0?n.crossfade:!0}}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!==L.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(n=!1){var r;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(n||l&&this.isSharedProjectionDirty||this.isProjectionDirty||!((r=this.parent)===null||r===void 0)&&r.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:c,layoutId:f}=this.options;if(!(!this.layout||!(c||f))){if(this.resolvedRelativeTargetAt=L.timestamp,!this.targetDelta&&!this.relativeTarget){const d=this.getClosestProjectingParent();d&&d.layout&&this.animationProgress!==1?(this.relativeParent=d,this.forceRelativeParentToResolveTarget(),this.relativeTarget=S(),this.relativeTargetOrigin=S(),$(this.relativeTargetOrigin,this.layout.layoutBox,d.layout.layoutBox),V(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=S(),this.targetWithTransforms=S()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),As(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):V(this.target,this.layout.layoutBox),Pi(this.target,this.targetDelta)):V(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const d=this.getClosestProjectingParent();d&&!!d.resumingFrom==!!this.resumingFrom&&!d.options.layoutScroll&&d.target&&this.animationProgress!==1?(this.relativeParent=d,this.forceRelativeParentToResolveTarget(),this.relativeTarget=S(),this.relativeTargetOrigin=S(),$(this.relativeTargetOrigin,this.target,d.target),V(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}F.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||Bt(this.parent.latestValues)||xi(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var n;const r=this.getLead(),a=!!this.resumingFrom||this!==r;let l=!0;if((this.isProjectionDirty||!((n=this.parent)===null||n===void 0)&&n.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===L.timestamp&&(l=!1),l)return;const{layout:u,layoutId:c}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||c))return;V(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,d=this.treeScale.y;Ti(this.layoutCorrected,this.treeScale,this.path,a),r.layout&&!r.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(r.target=r.layout.layoutBox);const{target:m}=r;if(!m){this.projectionTransform&&(this.projectionDelta=U(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=U(),this.projectionDeltaWithTransform=U());const p=this.projectionTransform;_(this.projectionDelta,this.layoutCorrected,m,this.latestValues),this.projectionTransform=oe(this.projectionDelta,this.treeScale),(this.projectionTransform!==p||this.treeScale.x!==f||this.treeScale.y!==d)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",m)),F.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(n=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),n){const r=this.getStack();r&&r.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(n,r=!1){const a=this.snapshot,l=a?a.latestValues:{},u={...this.latestValues},c=U();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!r;const f=S(),d=a?a.source:void 0,m=this.layout?this.layout.source:void 0,p=d!==m,x=this.getStack(),P=!x||x.members.length<=1,v=!!(p&&!P&&this.options.crossfade===!0&&!this.path.some(dn));this.animationProgress=0;let y;this.mixTargetDelta=T=>{const w=T/1e3;ce(c.x,n.x,w),ce(c.y,n.y,w),this.setTargetDelta(c),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&($(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),fn(this.relativeTarget,this.relativeTargetOrigin,f,w),y&&$s(this.relativeTarget,y)&&(this.isProjectionDirty=!1),y||(y=S()),V(y,this.relativeTarget)),p&&(this.animationValues=u,Gs(u,l,this.latestValues,w,v,P)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(n){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(K(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=D.update(()=>{J.hasAnimatedSinceResize=!0,this.currentAnimation=Si(0,ae,{...n,onUpdate:r=>{this.mixTargetDelta(r),n.onUpdate&&n.onUpdate(r)},onComplete:()=>{n.onComplete&&n.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 n=this.getStack();n&&n.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(ae),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const n=this.getLead();let{targetWithTransforms:r,target:a,layout:l,latestValues:u}=n;if(!(!r||!a||!l)){if(this!==n&&this.layout&&l&&Ye(this.options.animationType,this.layout.layoutBox,l.layoutBox)){a=this.target||S();const c=E(this.layout.layoutBox.x);a.x.min=n.target.x.min,a.x.max=a.x.min+c;const f=E(this.layout.layoutBox.y);a.y.min=n.target.y.min,a.y.max=a.y.min+f}V(r,a),Y(r,u),_(this.projectionDeltaWithTransform,this.layoutCorrected,r,u)}}registerSharedNode(n,r){this.sharedNodes.has(n)||this.sharedNodes.set(n,new Ks),this.sharedNodes.get(n).add(r);const l=r.options.initialPromotionConfig;r.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(r):void 0})}isLead(){const n=this.getStack();return n?n.lead===this:!0}getLead(){var n;const{layoutId:r}=this.options;return r?((n=this.getStack())===null||n===void 0?void 0:n.lead)||this:this}getPrevLead(){var n;const{layoutId:r}=this.options;return r?(n=this.getStack())===null||n===void 0?void 0:n.prevLead:void 0}getStack(){const{layoutId:n}=this.options;if(n)return this.root.sharedNodes.get(n)}promote({needsReset:n,transition:r,preserveFollowOpacity:a}={}){const l=this.getStack();l&&l.promote(this,a),n&&(this.projectionDelta=void 0,this.needsReset=!0),r&&this.setOptions({transition:r})}relegate(){const n=this.getStack();return n?n.relegate(this):!1}resetRotation(){const{visualElement:n}=this.options;if(!n)return;let r=!1;const{latestValues:a}=n;if((a.rotate||a.rotateX||a.rotateY||a.rotateZ)&&(r=!0),!r)return;const l={};for(let u=0;u<re.length;u++){const c="rotate"+re[u];a[c]&&(l[c]=a[c],n.setStaticValue(c,0))}n.render();for(const u in l)n.setStaticValue(u,l[u]);n.scheduleRender()}getProjectionStyles(n){var r,a;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Js;const l={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,l.opacity="",l.pointerEvents=Z(n==null?void 0:n.pointerEvents)||"",l.transform=u?u(this.latestValues,""):"none",l;const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){const p={};return this.options.layoutId&&(p.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,p.pointerEvents=Z(n==null?void 0:n.pointerEvents)||""),this.hasProjected&&!I(this.latestValues)&&(p.transform=u?u({},""):"none",this.hasProjected=!1),p}const f=c.animationValues||c.latestValues;this.applyTransformsToTarget(),l.transform=oe(this.projectionDeltaWithTransform,this.treeScale,f),u&&(l.transform=u(f,l.transform));const{x:d,y:m}=this.projectionDelta;l.transformOrigin=`${d.origin*100}% ${m.origin*100}% 0`,c.animationValues?l.opacity=c===this?(a=(r=f.opacity)!==null&&r!==void 0?r:this.latestValues.opacity)!==null&&a!==void 0?a:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:l.opacity=c===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const p in jt){if(f[p]===void 0)continue;const{correct:x,applyTo:P}=jt[p],v=l.transform==="none"?f[p]:x(f[p],c);if(P){const y=P.length;for(let T=0;T<y;T++)l[P[T]]=v}else l[p]=v}return this.options.layoutId&&(l.pointerEvents=c===this?Z(n==null?void 0:n.pointerEvents)||"":"none"),l}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(n=>{var r;return(r=n.currentAnimation)===null||r===void 0?void 0:r.stop()}),this.root.nodes.forEach(le),this.root.sharedNodes.clear()}}}function tn(t){t.updateLayout()}function en(t){var e;const i=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&i&&t.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:o}=t.layout,{animationType:h}=t.options,n=i.source!==t.layout.source;h==="size"?b(c=>{const f=n?i.measuredBox[c]:i.layoutBox[c],d=E(f);f.min=s[c].min,f.max=f.min+d}):Ye(h,i.layoutBox,s)&&b(c=>{const f=n?i.measuredBox[c]:i.layoutBox[c],d=E(s[c]);f.max=f.min+d,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[c].max=t.relativeTarget[c].min+d)});const r=U();_(r,s,i.layoutBox);const a=U();n?_(a,t.applyTransform(o,!0),i.measuredBox):_(a,s,i.layoutBox);const l=!$e(r);let u=!1;if(!t.resumeFrom){const c=t.getClosestProjectingParent();if(c&&!c.resumeFrom){const{snapshot:f,layout:d}=c;if(f&&d){const m=S();$(m,i.layoutBox,f.layoutBox);const p=S();$(p,s,d.layoutBox),Ke(m,p)||(u=!0),c.options.layoutRoot&&(t.relativeTarget=p,t.relativeTargetOrigin=m,t.relativeParent=c)}}}t.notifyListeners("didUpdate",{layout:s,snapshot:i,delta:a,layoutDelta:r,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(t.isLead()){const{onExitComplete:s}=t.options;s&&s()}t.options.transition=void 0}function sn(t){F.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function nn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function on(t){t.clearSnapshot()}function le(t){t.clearMeasurements()}function rn(t){t.isLayoutDirty=!1}function an(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function ue(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function ln(t){t.resolveTargetDelta()}function un(t){t.calcProjection()}function cn(t){t.resetRotation()}function hn(t){t.removeLeadSnapshot()}function ce(t,e,i){t.translate=A(e.translate,0,i),t.scale=A(e.scale,1,i),t.origin=e.origin,t.originPoint=e.originPoint}function he(t,e,i,s){t.min=A(e.min,i.min,s),t.max=A(e.max,i.max,s)}function fn(t,e,i,s){he(t.x,e.x,i.x,s),he(t.y,e.y,i.y,s)}function dn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const mn={duration:.45,ease:[.4,0,.1,1]},fe=t=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(t),de=fe("applewebkit/")&&!fe("chrome/")?Math.round:M;function me(t){t.min=de(t.min),t.max=de(t.max)}function pn(t){me(t.x),me(t.y)}function Ye(t,e,i){return t==="position"||t==="preserve-aspect"&&!yt(ne(e),ne(i),.2)}const gn=Xe({attachResizeListener:(t,e)=>R(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ft={current:void 0},qe=Xe({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!ft.current){const t=new gn({});t.mount(window),t.setOptions({layoutScroll:!0}),ft.current=t}return ft.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),yn={pan:{Feature:js},drag:{Feature:Bs,ProjectionNode:qe,MeasureLayout:We}},vn=(t,e)=>At(t)?new Ai(e,{enableHardwareAcceleration:!1}):new Di(e,{enableHardwareAcceleration:!0}),Pn={layout:{ProjectionNode:qe,MeasureLayout:We}},xn={...Ps,...rs,...yn,...Pn},Cn=ji((t,e)=>Xi(t,e,xn,vn));export{Ve as L,St as P,Cn as m,Ci as u};