UNPKG

reactdesk-core

Version:

A powerful React-based desktop environment library for creating Windows 11-like desktop interfaces with window management, taskbar, themes, and more

3 lines (2 loc) 46 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-B8LTnm77.js");function e(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function n(t,e="page"){return{point:{x:t[e+"X"],y:t[e+"Y"]}}}function s(t,s,r,i){return e(t,s,(t=>e=>(t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary)(e)&&t(e,n(e)))(r),i)}const r=(t,e)=>n=>e(t(n)),i=(...t)=>t.reduce(r);function o(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const a=o("dragHorizontal"),u=o("dragVertical");function l(){const t=function(){let t=!1;{const e=a(),n=u();e&&n?t=()=>{e(),n()}:(e&&e(),n&&n())}return t}();return!t||(t(),!1)}class c{constructor(t){this.isMounted=!1,this.node=t}update(){}}function h(e,n){const r="pointer"+(n?"enter":"leave"),i="onHover"+(n?"Start":"End");return s(e.current,r,(s,r)=>{if("touch"===s.pointerType||l())return;const o=e.getProps();e.animationState&&o.whileHover&&e.animationState.setActive("whileHover",n),o[i]&&t.frame.update(()=>o[i](s,r))},{passive:!e.getProps()[i]})}const p=(t,e)=>!!e&&(t===e||p(t,e.parentElement));function d(t,e){if(!e)return;const s=new PointerEvent("pointer"+t);e(s,n(s))}const m=new WeakMap,f=new WeakMap,v=t=>{const e=m.get(t.target);e&&e(t)},g=t=>{t.forEach(v)};function y(t,e,n){const s=function({root:t,...e}){const n=t||document;f.has(n)||f.set(n,{});const s=f.get(n),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(g,{root:t,...e})),s[r]}(e);return m.set(t,n),s.observe(t),()=>{m.delete(t),s.unobserve(t)}}const b={some:0,all:1};const V={inView:{Feature:class extends c{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:s="some",once:r}=t,i={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof s?s:b[s]};return y(this.node.current,i,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,r&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:s}=this.node.getProps(),i=e?n:s;i&&i(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends c{constructor(){super(...arguments),this.removeStartListeners=t.noop,this.removeEndListeners=t.noop,this.removeAccessibleListeners=t.noop,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),o=s(window,"pointerup",(e,n)=>{if(!this.checkPressEnd())return;const{onTap:s,onTapCancel:r,globalTapTarget:i}=this.node.getProps();t.frame.update(()=>{i||p(this.node.current,e.target)?s&&s(e,n):r&&r(e,n)})},{passive:!(r.onTap||r.onPointerUp)}),a=s(window,"pointercancel",(t,e)=>this.cancelPress(t,e),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=i(o,a),this.startPress(e,n)},this.startAccessiblePress=()=>{const n=e(this.node.current,"keydown",n=>{if("Enter"!==n.key||this.isPressing)return;this.removeEndListeners(),this.removeEndListeners=e(this.node.current,"keyup",e=>{"Enter"===e.key&&this.checkPressEnd()&&d("up",(e,n)=>{const{onTap:s}=this.node.getProps();s&&t.frame.update(()=>s(e,n))})}),d("down",(t,e)=>{this.startPress(t,e)})}),s=e(this.node.current,"blur",()=>{this.isPressing&&d("cancel",(t,e)=>this.cancelPress(t,e))});this.removeAccessibleListeners=i(n,s)}}startPress(e,n){this.isPressing=!0;const{onTapStart:s,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),s&&t.frame.update(()=>s(e,n))}checkPressEnd(){this.removeEndListeners(),this.isPressing=!1;return this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!l()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:s}=this.node.getProps();s&&t.frame.update(()=>s(e,n))}mount(){const t=this.node.getProps(),n=s(t.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=e(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=i(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}},focus:{Feature:class extends c{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=i(e(this.node.current,"focus",()=>this.onFocus()),e(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends c{mount(){this.unmount=i(h(this.node,!0),h(this.node,!1))}unmount(){}}}};function w(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}function P(e,n,s){const r=e.getProps();return t.resolveVariantFromProps(r,n,void 0!==s?s:r.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(e),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(e))}const A=t=>1e3*t,C=t=>t/1e3,S=!1,x=t=>Array.isArray(t)&&"number"==typeof t[0];function M(t){return Boolean(!t||"string"==typeof t&&k[t]||x(t)||Array.isArray(t)&&t.every(M))}const T=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,k={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:T([0,.65,.55,1]),circOut:T([.55,0,1,.45]),backIn:T([.31,.01,.66,-.59]),backOut:T([.33,1.53,.69,.99])};function E(t){if(t)return x(t)?T(t):Array.isArray(t)?t.map(E):k[t]}const F=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function O(e,n,s,r){if(e===n&&s===r)return t.noop;const i=t=>function(t,e,n,s,r){let i,o,a=0;do{o=e+(n-e)/2,i=F(o,s,r)-t,i>0?n=o:e=o}while(Math.abs(i)>1e-7&&++a<12);return o}(t,0,1,e,s);return t=>0===t||1===t?t:F(i(t),n,r)}const N=O(.42,0,1,1),D=O(0,0,.58,1),I=O(.42,0,.58,1),R=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,B=t=>e=>1-t(1-e),L=t=>1-Math.sin(Math.acos(t)),j=B(L),$=R(L),z=O(.33,1.53,.69,.99),U=B(z),H=R(U),K={linear:t.noop,easeIn:N,easeInOut:I,easeOut:D,circIn:L,circInOut:$,circOut:j,backIn:U,backInOut:H,backOut:z,anticipate:t=>(t*=2)<1?.5*U(t):.5*(2-Math.pow(2,-10*(t-1)))},q=e=>{if(Array.isArray(e)){t.invariant(4===e.length,"Cubic bezier arrays must contain four numerical values.");const[n,s,r,i]=e;return O(n,s,r,i)}return"string"==typeof e?(t.invariant(void 0!==K[e],`Invalid easing type '${e}'`),K[e]):e},W=(e,n)=>s=>Boolean(t.isString(s)&&t.singleColorRegex.test(s)&&s.startsWith(e)||n&&Object.prototype.hasOwnProperty.call(s,n)),G=(e,n,s)=>r=>{if(!t.isString(r))return r;const[i,o,a,u]=r.match(t.floatRegex);return{[e]:parseFloat(i),[n]:parseFloat(o),[s]:parseFloat(a),alpha:void 0!==u?parseFloat(u):1}},Y={...t.number,transform:e=>Math.round((e=>t.clamp(0,255,e))(e))},_={test:W("rgb","red"),parse:G("red","green","blue"),transform:({red:e,green:n,blue:s,alpha:r=1})=>"rgba("+Y.transform(e)+", "+Y.transform(n)+", "+Y.transform(s)+", "+t.sanitize(t.alpha.transform(r))+")"};const X={test:W("#"),parse:function(t){let e="",n="",s="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}},transform:_.transform},Z={test:W("hsl","hue"),parse:G("hue","saturation","lightness"),transform:({hue:e,saturation:n,lightness:s,alpha:r=1})=>"hsla("+Math.round(e)+", "+t.percent.transform(t.sanitize(n))+", "+t.percent.transform(t.sanitize(s))+", "+t.sanitize(t.alpha.transform(r))+")"},J={test:t=>_.test(t)||X.test(t)||Z.test(t),parse:t=>_.test(t)?_.parse(t):Z.test(t)?Z.parse(t):X.parse(t),transform:e=>t.isString(e)?e:e.hasOwnProperty("red")?_.transform(e):Z.transform(e)},Q=(t,e,n)=>-n*t+n*e+t;function tt(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}const et=(t,e,n)=>{const s=t*t;return Math.sqrt(Math.max(0,n*(e*e-s)+s))},nt=[X,_,Z];function st(e){const n=(s=e,nt.find(t=>t.test(s)));var s;t.invariant(Boolean(n),`'${e}' is not an animatable color. Use the equivalent color code instead.`);let r=n.parse(e);return n===Z&&(r=function({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,n/=100;let r=0,i=0,o=0;if(e/=100){const s=n<.5?n*(1+e):n+e-n*e,a=2*n-s;r=tt(a,s,t+1/3),i=tt(a,s,t),o=tt(a,s,t-1/3)}else r=i=o=n;return{red:Math.round(255*r),green:Math.round(255*i),blue:Math.round(255*o),alpha:s}}(r)),r}const rt=(t,e)=>{const n=st(t),s=st(e),r={...n};return t=>(r.red=et(n.red,s.red,t),r.green=et(n.green,s.green,t),r.blue=et(n.blue,s.blue,t),r.alpha=Q(n.alpha,s.alpha,t),_.transform(r))};const it={regex:t.cssVariableRegex,countKey:"Vars",token:"${v}",parse:t.noop},ot={regex:t.colorRegex,countKey:"Colors",token:"${c}",parse:J.parse},at={regex:t.floatRegex,countKey:"Numbers",token:"${n}",parse:t.number.parse};function ut(t,{regex:e,countKey:n,token:s,parse:r}){const i=t.tokenised.match(e);i&&(t["num"+n]=i.length,t.tokenised=t.tokenised.replace(e,s),t.values.push(...i.map(r)))}function lt(t){const e=t.toString(),n={value:e,tokenised:e,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&ut(n,it),ut(n,ot),ut(n,at),n}function ct(t){return lt(t).values}function ht(e){const{values:n,numColors:s,numVars:r,tokenised:i}=lt(e),o=n.length;return e=>{let n=i;for(let i=0;i<o;i++)n=i<r?n.replace(it.token,e[i]):i<r+s?n.replace(ot.token,J.transform(e[i])):n.replace(at.token,t.sanitize(e[i]));return n}}const pt=t=>"number"==typeof t?0:t;const dt={test:function(e){var n,s;return isNaN(e)&&t.isString(e)&&((null===(n=e.match(t.floatRegex))||void 0===n?void 0:n.length)||0)+((null===(s=e.match(t.colorRegex))||void 0===s?void 0:s.length)||0)>0},parse:ct,createTransformer:ht,getAnimatableNone:function(t){const e=ct(t);return ht(t)(e.map(pt))}},mt=(t,e)=>n=>`${n>0?e:t}`;function ft(t,e){return"number"==typeof t?n=>Q(t,e,n):J.test(t)?rt(t,e):t.startsWith("var(")?mt(t,e):yt(t,e)}const vt=(t,e)=>{const n=[...t],s=n.length,r=t.map((t,n)=>ft(t,e[n]));return t=>{for(let e=0;e<s;e++)n[e]=r[e](t);return n}},gt=(t,e)=>{const n={...t,...e},s={};for(const r in n)void 0!==t[r]&&void 0!==e[r]&&(s[r]=ft(t[r],e[r]));return t=>{for(const e in s)n[e]=s[e](t);return n}},yt=(e,n)=>{const s=dt.createTransformer(n),r=lt(e),o=lt(n);return r.numVars===o.numVars&&r.numColors===o.numColors&&r.numNumbers>=o.numNumbers?i(vt(r.values,o.values),s):(t.warning(!0,`Complex values '${e}' and '${n}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),mt(e,n))},bt=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s},Vt=(t,e)=>n=>Q(t,e,n);function wt(e,n,s){const r=[],o=s||("number"==typeof(a=e[0])?Vt:"string"==typeof a?J.test(a)?rt:yt:Array.isArray(a)?vt:"object"==typeof a?gt:Vt);var a;const u=e.length-1;for(let l=0;l<u;l++){let s=o(e[l],e[l+1]);if(n){const e=Array.isArray(n)?n[l]||t.noop:n;s=i(e,s)}r.push(s)}return r}function Pt(e,n,{clamp:s=!0,ease:r,mixer:i}={}){const o=e.length;if(t.invariant(o===n.length,"Both input and output ranges must be the same length"),1===o)return()=>n[0];e[0]>e[o-1]&&(e=[...e].reverse(),n=[...n].reverse());const a=wt(n,r,i),u=a.length,l=t=>{let n=0;if(u>1)for(;n<e.length-2&&!(t<e[n+1]);n++);const s=bt(e[n],e[n+1],t);return a[n](s)};return s?n=>l(t.clamp(e[0],e[o-1],n)):l}function At(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const r=bt(0,e,s);t.push(Q(n,1,r))}}(e,t.length-1),e}function Ct({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const r=(t=>Array.isArray(t)&&"number"!=typeof t[0])(s)?s.map(q):q(s),i={done:!1,value:e[0]},o=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:At(e),t),a=Pt(o,e,{ease:Array.isArray(r)?r:(u=e,l=r,u.map(()=>l||I).splice(0,u.length-1))});var u,l;return{calculatedDuration:t,next:e=>(i.value=a(e),i.done=e>=t,i)}}function St(t,e){return e?t*(1e3/e):0}function xt(t,e,n){const s=Math.max(e-5,0);return St(n-t(s),e-s)}const Mt=.001;function Tt({duration:e=800,bounce:n=.25,velocity:s=0,mass:r=1}){let i,o;t.warning(e<=A(10),"Spring duration must be 10 seconds or less");let a=1-n;a=t.clamp(.05,1,a),e=t.clamp(.01,10,C(e)),a<1?(i=t=>{const n=t*a,r=n*e,i=n-s,o=Et(t,a),u=Math.exp(-r);return Mt-i/o*u},o=t=>{const n=t*a*e,r=n*s+s,o=Math.pow(a,2)*Math.pow(t,2)*e,u=Math.exp(-n),l=Et(Math.pow(t,2),a);return(-i(t)+Mt>0?-1:1)*((r-o)*u)/l}):(i=t=>Math.exp(-t*e)*((t-s)*e+1)-.001,o=t=>Math.exp(-t*e)*(e*e*(s-t)));const u=function(t,e,n){let s=n;for(let r=1;r<kt;r++)s-=t(s)/e(s);return s}(i,o,5/e);if(e=A(e),isNaN(u))return{stiffness:100,damping:10,duration:e};{const t=Math.pow(u,2)*r;return{stiffness:t,damping:2*a*Math.sqrt(r*t),duration:e}}}const kt=12;function Et(t,e){return t*Math.sqrt(1-e*e)}const Ft=["duration","bounce"],Ot=["stiffness","damping","mass"];function Nt(t,e){return e.some(e=>void 0!==t[e])}function Dt({keyframes:t,restDelta:e,restSpeed:n,...s}){const r=t[0],i=t[t.length-1],o={done:!1,value:r},{stiffness:a,damping:u,mass:l,duration:c,velocity:h,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!Nt(t,Ot)&&Nt(t,Ft)){const n=Tt(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}({...s,velocity:-C(s.velocity||0)}),d=h||0,m=u/(2*Math.sqrt(a*l)),f=i-r,v=C(Math.sqrt(a/l)),g=Math.abs(f)<5;let y;if(n||(n=g?.01:2),e||(e=g?.005:.5),m<1){const t=Et(v,m);y=e=>{const n=Math.exp(-m*v*e);return i-n*((d+m*v*f)/t*Math.sin(t*e)+f*Math.cos(t*e))}}else if(1===m)y=t=>i-Math.exp(-v*t)*(f+(d+v*f)*t);else{const t=v*Math.sqrt(m*m-1);y=e=>{const n=Math.exp(-m*v*e),s=Math.min(t*e,300);return i-n*((d+m*v*f)*Math.sinh(s)+t*f*Math.cosh(s))/t}}return{calculatedDuration:p&&c||null,next:t=>{const s=y(t);if(p)o.done=t>=c;else{let r=d;0!==t&&(r=m<1?xt(y,t,s):0);const a=Math.abs(r)<=n,u=Math.abs(i-s)<=e;o.done=a&&u}return o.value=o.done?i:s,o}}}function It({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:u,restDelta:l=.5,restSpeed:c}){const h=t[0],p={done:!1,value:h},d=t=>void 0===a?u:void 0===u||Math.abs(a-t)<Math.abs(u-t)?a:u;let m=n*e;const f=h+m,v=void 0===o?f:o(f);v!==f&&(m=v-h);const g=t=>-m*Math.exp(-t/s),y=t=>v+g(t),b=t=>{const e=g(t),n=y(t);p.done=Math.abs(e)<=l,p.value=p.done?v:n};let V,w;const P=t=>{var e;(e=p.value,void 0!==a&&e<a||void 0!==u&&e>u)&&(V=t,w=Dt({keyframes:[p.value,d(p.value)],velocity:xt(y,t,p.value),damping:r,stiffness:i,restDelta:l,restSpeed:c}))};return P(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==V||(e=!0,b(t),P(t)),void 0!==V&&t>V?w.next(t-V):(!e&&b(t),p)}}}const Rt=e=>{const n=({timestamp:t})=>e(t);return{start:()=>t.frame.update(n,!0),stop:()=>t.cancelFrame(n),now:()=>t.frameData.isProcessing?t.frameData.timestamp:performance.now()}};function Bt(t){let e=0;let n=t.next(e);for(;!n.done&&e<2e4;)e+=50,n=t.next(e);return e>=2e4?1/0:e}const Lt={decay:It,inertia:It,tween:Ct,keyframes:Ct,spring:Dt};function jt({autoplay:e=!0,delay:n=0,driver:s=Rt,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:u="loop",onPlay:l,onStop:c,onComplete:h,onUpdate:p,...d}){let m,f,v=1,g=!1;const y=()=>{f=new Promise(t=>{m=t})};let b;y();const V=Lt[i]||Ct;let w;V!==Ct&&"number"!=typeof r[0]&&("production"!==process.env.NODE_ENV&&t.invariant(2===r.length,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${r}`),w=Pt([0,100],r,{clamp:!1}),r=[0,100]);const P=V({...d,keyframes:r});let S;"mirror"===u&&(S=V({...d,keyframes:[...r].reverse(),velocity:-(d.velocity||0)}));let x="idle",M=null,T=null,k=null;null===P.calculatedDuration&&o&&(P.calculatedDuration=Bt(P));const{calculatedDuration:E}=P;let F=1/0,O=1/0;null!==E&&(F=E+a,O=F*(o+1)-a);let N=0;const D=e=>{if(null===T)return;v>0&&(T=Math.min(T,e)),v<0&&(T=Math.min(e-O/v,T)),N=null!==M?M:Math.round(e-T)*v;const s=N-n*(v>=0?1:-1),i=v>=0?s<0:s>O;N=Math.max(s,0),"finished"===x&&null===M&&(N=O);let l=N,c=P;if(o){const e=Math.min(N,O)/F;let n=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&n--,n=Math.min(n,o+1);Boolean(n%2)&&("reverse"===u?(s=1-s,a&&(s-=a/F)):"mirror"===u&&(c=S)),l=t.clamp(0,1,s)*F}const h=i?{done:!1,value:r[0]}:c.next(l);w&&(h.value=w(h.value));let{done:d}=h;i||null===E||(d=v>=0?N>=O:N<=0);const m=null===M&&("finished"===x||"running"===x&&d);return p&&p(h.value),m&&B(),h},I=()=>{b&&b.stop(),b=void 0},R=()=>{x="idle",I(),m(),y(),T=k=null},B=()=>{x="finished",h&&h(),I(),m()},L=()=>{if(g)return;b||(b=s(D));const t=b.now();l&&l(),null!==M?T=t-M:T&&"finished"!==x||(T=t),"finished"===x&&y(),k=T,M=null,x="running",b.start()};e&&L();const j={then:(t,e)=>f.then(t,e),get time(){return C(N)},set time(t){t=A(t),N=t,null===M&&b&&0!==v?T=b.now()-t/v:M=t},get duration(){const t=null===P.calculatedDuration?Bt(P):P.calculatedDuration;return C(t)},get speed(){return v},set speed(t){t!==v&&b&&(v=t,j.time=C(N))},get state(){return x},play:L,pause:()=>{x="paused",M=N},stop:()=>{g=!0,"idle"!==x&&(x="idle",c&&c(),R())},cancel:()=>{null!==k&&D(k),R()},complete:()=>{x="finished"},sample:t=>(T=0,D(t))};return j}const $t=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),zt=new Set(["opacity","clipPath","filter","transform","backgroundColor"]);function Ut(e,n,{onUpdate:s,onComplete:r,...i}){if(!($t()&&zt.has(n)&&!i.repeatDelay&&"mirror"!==i.repeatType&&0!==i.damping&&"inertia"!==i.type))return!1;let o,a,u=!1,l=!1;const c=()=>{a=new Promise(t=>{o=t})};c();let{keyframes:h,duration:p=300,ease:d,times:m}=i;if(((t,e)=>"spring"===e.type||"backgroundColor"===t||!M(e.ease))(n,i)){const t=jt({...i,repeat:0,delay:0});let e={done:!1,value:h[0]};const n=[];let s=0;for(;!e.done&&s<2e4;)e=t.sample(s),n.push(e.value),s+=10;m=void 0,h=n,p=s-10,d="linear"}const f=function(t,e,n,{delay:s=0,duration:r,repeat:i=0,repeatType:o="loop",ease:a,times:u}={}){const l={[e]:n};u&&(l.offset=u);const c=E(a);return Array.isArray(c)&&(l.easing=c),t.animate(l,{delay:s,duration:r,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:i+1,direction:"reverse"===o?"alternate":"normal"})}(e.owner.current,n,h,{...i,duration:p,ease:d,times:m}),v=()=>{l=!1,f.cancel()},g=()=>{l=!0,t.frame.update(v),o(),c()};f.onfinish=()=>{l||(e.set(function(t,{repeat:e,repeatType:n="loop"}){return t[e&&"loop"!==n&&e%2==1?0:t.length-1]}(h,i)),r&&r(),g())};return{then:(t,e)=>a.then(t,e),attachTimeline:e=>(f.timeline=e,f.onfinish=null,t.noop),get time(){return C(f.currentTime||0)},set time(t){f.currentTime=A(t)},get speed(){return f.playbackRate},set speed(t){f.playbackRate=t},get duration(){return C(p)},play:()=>{u||(f.play(),t.cancelFrame(v))},pause:()=>f.pause(),stop:()=>{if(u=!0,"idle"===f.playState)return;const{currentTime:t}=f;if(t){const n=jt({...i,autoplay:!1});e.setWithVelocity(n.sample(t-10).value,n.sample(t).value,10)}g()},complete:()=>{l||f.finish()},cancel:g}}const Ht={type:"spring",stiffness:500,damping:25,restSpeed:10},Kt={type:"keyframes",duration:.8},qt={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Wt=(e,{keyframes:n})=>n.length>2?Kt:t.transformProps.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===n[1]?2*Math.sqrt(550):30,restSpeed:10}:Ht:qt,Gt=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!dt.test(e)&&"0"!==e||e.startsWith("url("))),Yt=new Set(["brightness","contrast","saturate","opacity"]);function _t(e){const[n,s]=e.slice(0,-1).split("(");if("drop-shadow"===n)return e;const[r]=s.match(t.floatRegex)||[];if(!r)return e;const i=s.replace(r,"");let o=Yt.has(n)?1:0;return r!==s&&(o*=100),n+"("+o+i+")"}const Xt=/([a-z-]*)\(.*?\)/g,Zt={...dt,getAnimatableNone:t=>{const e=t.match(Xt);return e?e.map(_t).join(" "):t}},Jt={...t.numberValueTypes,color:J,backgroundColor:J,outlineColor:J,fill:J,stroke:J,borderColor:J,borderTopColor:J,borderRightColor:J,borderBottomColor:J,borderLeftColor:J,filter:Zt,WebkitFilter:Zt},Qt=t=>Jt[t];function te(t,e){let n=Qt(t);return n!==Zt&&(n=dt),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const ee=t=>/^0[^.\s]+$/.test(t);function ne(t){return"number"==typeof t?0===t:null!==t?"none"===t||"0"===t||ee(t):void 0}function se(t,e){return t[e]||t.default||t}const re=!1,ie=(e,n,s,r={})=>i=>{const o=se(r,e)||{},a=o.delay||r.delay||0;let{elapsed:u=0}=r;u-=A(a);const l=function(t,e,n,s){const r=Gt(e,n);let i;i=Array.isArray(n)?[...n]:[null,n];const o=void 0!==s.from?s.from:t.get();let a;const u=[];for(let l=0;l<i.length;l++)null===i[l]&&(i[l]=0===l?o:i[l-1]),ne(i[l])&&u.push(l),"string"==typeof i[l]&&"none"!==i[l]&&"0"!==i[l]&&(a=i[l]);if(r&&u.length&&a)for(let l=0;l<u.length;l++)i[u[l]]=te(e,a);return i}(n,e,s,o),c=l[0],h=l[l.length-1],p=Gt(e,c),d=Gt(e,h);t.warning(p===d,`You are trying to animate ${e} from "${c}" to "${h}". ${c} is not an animatable value - to enable this animation set ${c} to a value animatable to ${h} via the \`style\` property.`);let m={keyframes:l,velocity:n.getVelocity(),ease:"easeOut",...o,delay:-u,onUpdate:t=>{n.set(t),o.onUpdate&&o.onUpdate(t)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(function({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:r,repeat:i,repeatType:o,repeatDelay:a,from:u,elapsed:l,...c}){return!!Object.keys(c).length}(o)||(m={...m,...Wt(e,m)}),m.duration&&(m.duration=A(m.duration)),m.repeatDelay&&(m.repeatDelay=A(m.repeatDelay)),!p||!d||S||!1===o.type||re)return function({keyframes:e,delay:n,onUpdate:s,onComplete:r}){const i=()=>(s&&s(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:t.noop,pause:t.noop,stop:t.noop,then:t=>(t(),Promise.resolve()),cancel:t.noop,complete:t.noop});return n?jt({keyframes:[0,1],duration:0,delay:n,onComplete:i}):i()}(m);if(!r.isHandoff&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate){const t=Ut(n,e,m);if(t)return t}return jt(m)};function oe(e){return Boolean(t.isMotionValue(e)&&e.add)}const ae=t=>/^\-?\d*\.?\d+$/.test(t);class ue{constructor(){this.subscriptions=[]}add(t){var e,n;return e=this.subscriptions,n=t,-1===e.indexOf(n)&&e.push(n),()=>function(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}(this.subscriptions,t)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let r=0;r<s;r++){const s=this.subscriptions[r];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const le=new Set;function ce(t,e,n){t||le.has(e)||(console.warn(e),le.add(e))}class he{constructor(e,n={}){var s;this.version="10.18.0",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,n=!0)=>{this.prev=this.current,this.current=e;const{delta:s,timestamp:r}=t.frameData;this.lastUpdated!==r&&(this.timeDelta=s,this.lastUpdated=r,t.frame.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),n&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>t.frame.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=(s=this.current,!isNaN(parseFloat(s))),this.owner=n.owner}onChange(t){return"production"!==process.env.NODE_ENV&&ce(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(e,n){this.events[e]||(this.events[e]=new ue);const s=this.events[e].add(n);return"change"===e?()=>{s(),t.frame.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,n){this.set(e),this.prev=t,this.timeDelta=n}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?St(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}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 pe(t,e){return new he(t,e)}const de=t=>e=>e.test(t),me=[t.number,t.px,t.percent,t.degrees,t.vw,t.vh,{test:t=>"auto"===t,parse:t=>t}],fe=t=>me.find(de(t)),ve=[...me,J,dt],ge=t=>ve.find(de(t));function ye(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,pe(n))}function be(t,e){if(!e)return;return(e[t]||e.default||e).from}function Ve({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,s}function we(t,e){const n=t.get();if(!Array.isArray(e))return n!==e;for(let s=0;s<e.length;s++)if(e[s]!==n)return!0}function Pe(e,n,{delay:s=0,transitionOverride:r,type:i}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:a,...u}=e.makeTargetAnimatable(n);const l=e.getValue("willChange");r&&(o=r);const c=[],h=i&&e.animationState&&e.animationState.getState()[i];for(const p in u){const n=e.getValue(p),r=u[p];if(!n||void 0===r||h&&Ve(h,p))continue;const i={delay:s,elapsed:0,...se(o||{},p)};if(window.HandoffAppearAnimations){const s=e.getProps()[t.optimizedAppearDataAttribute];if(s){const e=window.HandoffAppearAnimations(s,p,n,t.frame);null!==e&&(i.elapsed=e,i.isHandoff=!0)}}let a=!i.isHandoff&&!we(n,r);if("spring"===i.type&&(n.getVelocity()||i.velocity)&&(a=!1),n.animation&&(a=!1),a)continue;n.start(ie(p,n,r,e.shouldReduceMotion&&t.transformProps.has(p)?{type:!1}:i));const d=n.animation;oe(l)&&(l.add(p),d.then(()=>l.remove(p))),c.push(d)}return a&&Promise.all(c).then(()=>{a&&function(e,n){const s=P(e,n);let{transitionEnd:r={},transition:i={},...o}=s?e.makeTargetAnimatable(s,!1):{};o={...o,...r};for(const a in o)ye(e,a,t.resolveFinalValueInKeyframes(o[a]))}(e,a)}),c}function Ae(t,e,n={}){const s=P(t,e,n.custom);let{transition:r=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(r=n.transitionOverride);const i=s?()=>Promise.all(Pe(t,s,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(s=0)=>{const{delayChildren:i=0,staggerChildren:o,staggerDirection:a}=r;return function(t,e,n=0,s=0,r=1,i){const o=[],a=(t.variantChildren.size-1)*s,u=1===r?(t=0)=>t*s:(t=0)=>a-t*s;return Array.from(t.variantChildren).sort(Ce).forEach((t,s)=>{t.notify("AnimationStart",e),o.push(Ae(t,e,{...i,delay:n+u(s)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(o)}(t,e,i+s,o,a,n)}:()=>Promise.resolve(),{when:a}=r;if(a){const[t,e]="beforeChildren"===a?[i,o]:[o,i];return t().then(()=>e())}return Promise.all([i(),o(n.delay)])}function Ce(t,e){return t.sortNodePosition(e)}const Se=[...t.variantPriorityOrder].reverse(),xe=t.variantPriorityOrder.length;function Me(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let s;if(t.notify("AnimationStart",e),Array.isArray(e)){const r=e.map(e=>Ae(t,e,n));s=Promise.all(r)}else if("string"==typeof e)s=Ae(t,e,n);else{const r="function"==typeof e?P(t,e,n.custom):e;s=Promise.all(Pe(t,r,n))}return s.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Te(e){let n=Me(e);const s={animate:Ee(!0),whileInView:Ee(),whileHover:Ee(),whileTap:Ee(),whileDrag:Ee(),whileFocus:Ee(),exit:Ee()};let r=!0;const i=(t,n)=>{const s=P(e,n);if(s){const{transition:e,transitionEnd:n,...r}=s;t={...t,...r,...n}}return t};function o(o,a){const u=e.getProps(),l=e.getVariantContext(!0)||{},c=[],h=new Set;let p={},d=1/0;for(let n=0;n<xe;n++){const m=Se[n],f=s[m],v=void 0!==u[m]?u[m]:l[m],g=t.isVariantLabel(v),y=m===a?f.isActive:null;!1===y&&(d=n);let b=v===l[m]&&v!==u[m]&&g;if(b&&r&&e.manuallyAnimateOnMount&&(b=!1),f.protectedKeys={...p},!f.isActive&&null===y||!v&&!f.prevProp||t.isAnimationControls(v)||"boolean"==typeof v)continue;let V=ke(f.prevProp,v)||m===a&&f.isActive&&!b&&g||n>d&&g,P=!1;const A=Array.isArray(v)?v:[v];let C=A.reduce(i,{});!1===y&&(C={});const{prevResolvedValues:S={}}=f,x={...S,...C},M=t=>{V=!0,h.has(t)&&(P=!0,h.delete(t)),f.needsAnimating[t]=!0};for(const e in x){const n=C[e],s=S[e];if(p.hasOwnProperty(e))continue;let r=!1;r=t.isKeyframesTarget(n)&&t.isKeyframesTarget(s)?!w(n,s):n!==s,r?void 0!==n?M(e):h.add(e):void 0!==n&&h.has(e)?M(e):f.protectedKeys[e]=!0}f.prevProp=v,f.prevResolvedValues=C,f.isActive&&(p={...p,...C}),r&&e.blockInitialAnimation&&(V=!1),!V||b&&!P||c.push(...A.map(t=>({animation:t,options:{type:m,...o}})))}if(h.size){const t={};h.forEach(n=>{const s=e.getBaseTarget(n);void 0!==s&&(t[n]=s)}),c.push({animation:t})}let m=Boolean(c.length);return!r||!1!==u.initial&&u.initial!==u.animate||e.manuallyAnimateOnMount||(m=!1),r=!1,m?n(c):Promise.resolve()}return{animateChanges:o,setActive:function(t,n,r){var i;if(s[t].isActive===n)return Promise.resolve();null===(i=e.variantChildren)||void 0===i||i.forEach(e=>{var s;return null===(s=e.animationState)||void 0===s?void 0:s.setActive(t,n)}),s[t].isActive=n;const a=o(r,t);for(const e in s)s[e].protectedKeys={};return a},setAnimateFunction:function(t){n=t(e)},getState:()=>s}}function ke(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!w(e,t)}function Ee(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}let Fe=0;const Oe={animation:{Feature:class extends c{constructor(t){super(t),t.animationState||(t.animationState=Te(t))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),t.isAnimationControls(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){}}},exit:{Feature:class extends c{constructor(){super(...arguments),this.id=Fe++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:e,custom:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===s)return;const r=this.node.animationState.setActive("exit",!t,{custom:null!=n?n:this.node.getProps().custom});e&&!t&&r.then(()=>e(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}}};const Ne=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function De(e,n,s=1){t.invariant(s<=4,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`);const[r,i]=function(t){const e=Ne.exec(t);if(!e)return[,];const[,n,s]=e;return[n,s]}(e);if(!r)return;const o=window.getComputedStyle(n).getPropertyValue(r);if(o){const t=o.trim();return ae(t)?parseFloat(t):t}return t.isCSSVariableToken(i)?De(i,n,s+1):i}const Ie=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),Re=t=>Ie.has(t),Be=e=>e===t.number||e===t.px,Le=(t,e)=>parseFloat(t.split(", ")[e]),je=(t,e)=>(n,{transform:s})=>{if("none"===s||!s)return 0;const r=s.match(/^matrix3d\((.+)\)$/);if(r)return Le(r[1],e);{const e=s.match(/^matrix\((.+)\)$/);return e?Le(e[1],t):0}},$e=new Set(["x","y","z"]),ze=t.transformPropOrder.filter(t=>!$e.has(t));const Ue={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:je(4,13),y:je(5,14)};Ue.translateX=Ue.x,Ue.translateY=Ue.y;const He=(e,n,s={},r={})=>{n={...n},r={...r};const i=Object.keys(n).filter(Re);let o=[],a=!1;const u=[];if(i.forEach(i=>{const l=e.getValue(i);if(!e.hasValue(i))return;let c=s[i],h=fe(c);const p=n[i];let d;if(t.isKeyframesTarget(p)){const e=p.length,n=null===p[0]?1:0;c=p[n],h=fe(c);for(let s=n;s<e&&null!==p[s];s++)d?t.invariant(fe(p[s])===d,"All keyframes must be of the same type"):(d=fe(p[s]),t.invariant(d===h||Be(h)&&Be(d),"Keyframes must be of the same dimension as the current value"))}else d=fe(p);if(h!==d)if(Be(h)&&Be(d)){const e=l.get();"string"==typeof e&&l.set(parseFloat(e)),"string"==typeof p?n[i]=parseFloat(p):Array.isArray(p)&&d===t.px&&(n[i]=p.map(parseFloat))}else(null==h?void 0:h.transform)&&(null==d?void 0:d.transform)&&(0===c||0===p)?0===c?l.set(d.transform(c)):n[i]=h.transform(p):(a||(o=function(t){const e=[];return ze.forEach(n=>{const s=t.getValue(n);void 0!==s&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}(e),a=!0),u.push(i),r[i]=void 0!==r[i]?r[i]:n[i],l.jump(p))}),u.length){const s=u.indexOf("height")>=0?window.pageYOffset:null,i=((t,e,n)=>{const s=e.measureViewportBox(),r=e.current,i=getComputedStyle(r),{display:o}=i,a={};"none"===o&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=Ue[t](s,i)}),e.render();const u=e.measureViewportBox();return n.forEach(n=>{const s=e.getValue(n);s&&s.jump(a[n]),t[n]=Ue[n](u,i)}),t})(n,e,u);return o.length&&o.forEach(([t,n])=>{e.getValue(t).set(n)}),e.render(),t.isBrowser&&null!==s&&window.scrollTo({top:s}),{target:i,transitionEnd:r}}return{target:n,transitionEnd:r}};function Ke(t,e,n,s){return(t=>Object.keys(t).some(Re))(e)?He(t,e,n,s):{target:e,transitionEnd:s}}const qe=(e,n,s,r)=>{const i=function(e,{...n},s){const r=e.current;if(!(r instanceof Element))return{target:n,transitionEnd:s};s&&(s={...s}),e.values.forEach(e=>{const n=e.get();if(!t.isCSSVariableToken(n))return;const s=De(n,r);s&&e.set(s)});for(const i in n){const e=n[i];if(!t.isCSSVariableToken(e))continue;const o=De(e,r);o&&(n[i]=o,s||(s={}),void 0===s[i]&&(s[i]=e))}return{target:n,transitionEnd:s}}(e,n,r);return Ke(e,n=i.target,s,r=i.transitionEnd)},We={current:null},Ge={current:!1};const Ye=new WeakMap,_e=Object.keys(t.featureDefinitions),Xe=_e.length,Ze=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Je=t.variantProps.length;class Qe{constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:r,visualState:i},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>t.frame.render(this.render,!1,!0);const{latestValues:a,renderState:u}=i;this.latestValues=a,this.baseTarget={...a},this.initialValues=n.initial?{...a}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.isControllingVariants=t.isControllingVariants(n),this.isVariantNode=t.isVariantNode(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(e&&e.current);const{willChange:l,...c}=this.scrapeMotionValuesFromProps(n,{});for(const h in c){const e=c[h];void 0!==a[h]&&t.isMotionValue(e)&&(e.set(a[h],!1),oe(l)&&l.add(h))}}scrapeMotionValuesFromProps(t,e){return{}}mount(e){this.current=e,Ye.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),Ge.current||function(){if(Ge.current=!0,t.isBrowser)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>We.current=t.matches;t.addListener(e),e()}else We.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||We.current),"production"!==process.env.NODE_ENV&&ce(!0!==this.shouldReduceMotion,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Ye.delete(this.current),this.projection&&this.projection.unmount(),t.cancelFrame(this.notifyUpdate),t.cancelFrame(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(e,n){const s=t.transformProps.has(e),r=n.on("change",n=>{this.latestValues[e]=n,this.props.onUpdate&&t.frame.update(this.notifyUpdate,!1,!0),s&&this.projection&&(this.projection.isTransformDirty=!0)}),i=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{r(),i()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures({children:e,...n},s,r,i){let o,a;if("production"!==process.env.NODE_ENV&&r&&s){const e="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?t.warning(!1,e):t.invariant(!1,e)}for(let u=0;u<Xe;u++){const e=_e[u],{isEnabled:s,Feature:r,ProjectionNode:i,MeasureLayout:l}=t.featureDefinitions[e];i&&(o=i),s(n)&&(!this.features[e]&&r&&(this.features[e]=new r(this)),l&&(a=l))}if(("html"===this.type||"svg"===this.type)&&!this.projection&&o){this.projection=new o(this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:s,drag:r,dragConstraints:a,layoutScroll:u,layoutRoot:l}=n;this.projection.setOptions({layoutId:e,layout:s,alwaysMeasureLayout:Boolean(r)||a&&t.isRefObject(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof s?s:"both",initialPromotionConfig:i,layoutScroll:u,layoutRoot:l})}return a}updateFeatures(){for(const t in this.features){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}makeTargetAnimatable(t,e=!0){return this.makeTargetAnimatableFromInstance(t,this.props,e)}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let t=0;t<Ze.length;t++){const n=Ze[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const s=e["on"+n];s&&(this.propEventSubscriptions[n]=this.on(n,s))}this.prevMotionValues=function(e,n,s){const{willChange:r}=n;for(const i in n){const o=n[i],a=s[i];if(t.isMotionValue(o))e.addValue(i,o),oe(r)&&r.add(i),"development"===process.env.NODE_ENV&&ce("10.18.0"===o.version,`Attempting to mix Framer Motion versions ${o.version} with 10.18.0 may not work as expected.`);else if(t.isMotionValue(a))e.addValue(i,pe(o,{owner:e})),oe(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const t=e.getValue(i);!t.hasAnimated&&t.set(o)}else{const t=e.getStaticValue(i);e.addValue(i,pe(void 0!==t?t:o,{owner:e}))}}for(const t in s)void 0===n[t]&&e.removeValue(t);return n}(this,this.scrapeMotionValuesFromProps(e,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const t=this.parent&&this.parent.getVariantContext()||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const n={};for(let s=0;s<Je;s++){const e=t.variantProps[s],r=this.props[e];(t.isVariantLabel(r)||!1===r)&&(n[e]=r)}return n}addVariantChild(t){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(t),()=>e.variantChildren.delete(t)}addValue(t,e){e!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,e)),this.values.set(t,e),this.latestValues[t]=e.get()}removeValue(t){this.values.delete(t);const e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return void 0===n&&void 0!==e&&(n=pe(e,{owner:this}),this.addValue(t,n)),n}readValue(t){var e;return void 0===this.latestValues[t]&&this.current?null!==(e=this.getBaseTargetFromProps(this.props,t))&&void 0!==e?e:this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(e){var n;const{initial:s}=this.props,r="string"==typeof s||"object"==typeof s?null===(n=t.resolveVariantFromProps(this.props,s))||void 0===n?void 0:n[e]:void 0;if(s&&void 0!==r)return r;const i=this.getBaseTargetFromProps(this.props,e);return void 0===i||t.isMotionValue(i)?void 0!==this.initialValues[e]&&void 0===r?void 0:this.baseTarget[e]:i}on(t,e){return this.events[t]||(this.events[t]=new ue),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class tn extends Qe{sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:s},r){let i=function(t,e,n){const s={};for(const r in t){const t=be(r,e);if(void 0!==t)s[r]=t;else{const t=n.getValue(r);t&&(s[r]=t.get())}}return s}(n,t||{},this);if(s&&(e&&(e=s(e)),n&&(n=s(n)),i&&(i=s(i))),r){!function(t,e,n){var s,r;const i=Object.keys(e).filter(e=>!t.hasValue(e)),o=i.length;if(o)for(let a=0;a<o;a++){const o=i[a],u=e[o];let l=null;Array.isArray(u)&&(l=u[0]),null===l&&(l=null!==(r=null!==(s=n[o])&&void 0!==s?s:t.readValue(o))&&void 0!==r?r:e[o]),null!=l&&("string"==typeof l&&(ae(l)||ee(l))?l=parseFloat(l):!ge(l)&&dt.test(u)&&(l=te(o,u)),t.addValue(o,pe(l,{owner:t})),void 0===n[o]&&(n[o]=l),null!==l&&t.setBaseTarget(o,l))}}(this,n,i);const t=qe(this,n,i,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class en extends tn{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,n){if(t.transformProps.has(n)){const t=Qt(n);return t&&t.default||0}{const r=(s=e,window.getComputedStyle(s)),i=(t.isCSSVariableName(n)?r.getPropertyValue(n):r[n])||0;return"string"==typeof i?i.trim():i}var s}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}(t.getBoundingClientRect(),e))}(t,e)}build(e,n,s,r){t.buildHTMLStyles(e,n,s,r.transformTemplate)}scrapeMotionValuesFromProps(e,n){return t.scrapeMotionValuesFromProps(e,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;t.isMotionValue(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,n,s,r){t.renderHTML(e,n,s,r)}}class nn extends tn{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(e,n){if(t.transformProps.has(n)){const t=Qt(n);return t&&t.default||0}return n=t.camelCaseAttributes.has(n)?n:t.camelToDash(n),e.getAttribute(n)}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(e,n){return t.scrapeMotionValuesFromProps$1(e,n)}build(e,n,s,r){t.buildSVGAttrs(e,n,s,this.isSVGTag,r.transformTemplate)}renderInstance(e,n,s,r){t.renderSVG(e,n,s,r)}mount(e){this.isSVGTag=t.isSVGTag(e.tagName),super.mount(e)}}const sn={renderer:(e,n)=>t.isSVGComponent(e)?new nn(n,{enableHardwareAcceleration:!1}):new en(n,{enableHardwareAcceleration:!0}),...Oe,...V};exports.default=sn; //# sourceMappingURL=motionFeatures-D0uyJ3hE.js.map