framer-motion 7.7.2 → 7.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +3 -2
- package/dist/es/render/utils/motion-values.mjs +1 -1
- package/dist/es/value/index.mjs +1 -1
- package/dist/es/value/use-spring.mjs +1 -0
- package/dist/framer-motion.dev.js +3 -2
- package/dist/framer-motion.js +1 -1
- package/dist/projection.dev.js +2 -2
- package/dist/size-rollup-dom-animation.js +1 -1
- package/dist/size-rollup-dom-max.js +1 -1
- package/dist/size-rollup-motion.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useContext as t,useId as e,useEffect as n,useRef as r,createElement as o}from"react";import{P as s,q as i,t as a,u,v as l,w as c,x as p,y as d,z as h,A as f,B as m,C as v,D as g,E as y,F as b,G as V,H as w,r as A,d as S,I as M,n as C,c as x,i as E,J as T,f as P,b as F,m as I,a as k,K as O,g as N,p as D,L as R,M as U,N as B,s as j,h as z,o as L,j as q,k as H}from"./size-rollup-dom-animation-assets.js";function W(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const $=t=>1e3*t;const K=t=>t,Y=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function X(t,e,n,r){if(t===e&&n===r)return K;const o=e=>function(t,e,n,r,o){let s,i,a=0;do{i=e+(n-e)/2,s=Y(i,r,o)-t,s>0?n=i:e=i}while(Math.abs(s)>1e-7&&++a<12);return i}(e,0,1,t,n);return t=>0===t||1===t?t:Y(o(t),e,r)}const G=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Z=t=>e=>1-t(1-e),J=t=>t*t,_=Z(J),Q=G(J),tt=t=>1-Math.sin(Math.acos(t)),et=Z(tt),nt=G(et),rt=(t=1.525)=>e=>e*e*((t+1)*e-t),ot=rt(),st=Z(ot),it=G(ot),at=(t=>{const e=rt(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(),ut={linear:K,easeIn:J,easeInOut:Q,easeOut:_,circIn:tt,circInOut:nt,circOut:et,backIn:ot,backInOut:it,backOut:st,anticipate:at},lt=t=>{if(Array.isArray(t)){t.length;const[e,n,r,o]=t;return X(e,n,r,o)}return"string"==typeof t?ut[t]:t},ct=(t,e)=>n=>Boolean(i(n)&&a.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),pt=(t,e,n)=>r=>{if(!i(r))return r;const[o,s,a,l]=r.match(u);return{[t]:parseFloat(o),[e]:parseFloat(s),[n]:parseFloat(a),alpha:void 0!==l?parseFloat(l):1}},dt={...p,transform:t=>Math.round((t=>d(0,255,t))(t))},ht={test:ct("rgb","red"),parse:pt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+dt.transform(t)+", "+dt.transform(e)+", "+dt.transform(n)+", "+l(c.transform(r))+")"};const ft={test:ct("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:ht.transform},mt={test:ct("hsl","hue"),parse:pt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+h.transform(l(e))+", "+h.transform(l(n))+", "+l(c.transform(r))+")"},vt={test:t=>ht.test(t)||ft.test(t)||mt.test(t),parse:t=>ht.test(t)?ht.parse(t):mt.test(t)?mt.parse(t):ft.parse(t),transform:t=>i(t)?t:t.hasOwnProperty("red")?ht.transform(t):mt.transform(t)};function gt(t){"number"==typeof t&&(t=""+t);const e=[];let n=0,r=0;const o=t.match(f);o&&(n=o.length,t=t.replace(f,"${c}"),e.push(...o.map(vt.parse)));const s=t.match(u);return s&&(r=s.length,t=t.replace(u,"${n}"),e.push(...s.map(p.parse))),{values:e,numColors:n,numNumbers:r,tokenised:t}}function yt(t){return gt(t).values}function bt(t){const{values:e,numColors:n,tokenised:r}=gt(t),o=e.length;return t=>{let e=r;for(let r=0;r<o;r++)e=e.replace(r<n?"${c}":"${n}",r<n?vt.transform(t[r]):l(t[r]));return e}}const Vt=t=>"number"==typeof t?0:t;const wt={test:function(t){var e,n;return isNaN(t)&&i(t)&&((null===(e=t.match(u))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(f))||void 0===n?void 0:n.length)||0)>0},parse:yt,createTransformer:bt,getAnimatableNone:function(t){const e=yt(t);return bt(t)(e.map(Vt))}},At=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!wt.test(e)||e.startsWith("url("))),St=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Mt=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),Ct=()=>({type:"keyframes",ease:"linear",duration:.3}),xt=t=>({type:"keyframes",duration:.8,values:t}),Et={x:St,y:St,z:St,rotate:St,rotateX:St,rotateY:St,rotateZ:St,scaleX:Mt,scaleY:Mt,scale:Mt,opacity:Ct,backgroundColor:Ct,color:Ct,default:Mt},Tt=(t,e)=>{let n;return n=m(e)?xt:Et[t]||Et.default,{to:e,...n(e)}},Pt=new Set(["brightness","contrast","saturate","opacity"]);function Ft(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(u)||[];if(!r)return t;const o=n.replace(r,"");let s=Pt.has(e)?1:0;return r!==n&&(s*=100),e+"("+s+o+")"}const It=/([a-z-]*)\(.*?\)/g,kt={...wt,getAnimatableNone:t=>{const e=t.match(It);return e?e.map(Ft).join(" "):t}},Ot={...v,color:vt,backgroundColor:vt,outlineColor:vt,fill:vt,stroke:vt,borderColor:vt,borderTopColor:vt,borderRightColor:vt,borderBottomColor:vt,borderLeftColor:vt,filter:kt,WebkitFilter:kt},Nt=t=>Ot[t];function Dt(t,e){var n;let r=Nt(t);return r!==kt&&(r=wt),null===(n=r.getAnimatableNone)||void 0===n?void 0:n.call(r,e)}const Rt=!1,Ut="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),Bt="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Ut()),1/60*1e3);const jt={delta:0,timestamp:0};let zt=!0,Lt=!1,qt=!1;const Ht=["read","update","preRender","render","postRender"],Wt=Ht.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,a={schedule:(t,s=!1,a=!1)=>{const u=a&&o,l=u?e:n;return s&&i.add(t),-1===l.indexOf(t)&&(l.push(t),u&&o&&(r=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),i.delete(t)},process:u=>{if(o)s=!0;else{if(o=!0,[e,n]=[n,e],n.length=0,r=e.length,r)for(let n=0;n<r;n++){const r=e[n];r(u),i.has(r)&&(a.schedule(r),t())}o=!1,s&&(s=!1,a.process(u))}}};return a}(()=>Lt=!0),t),{}),$t=Ht.reduce((t,e)=>{const n=Wt[e];return t[e]=(t,e=!1,r=!1)=>(Lt||Gt(),n.schedule(t,e,r)),t},{}),Kt=Ht.reduce((t,e)=>(t[e]=Wt[e].cancel,t),{});Ht.reduce((t,e)=>(t[e]=()=>Wt[e].process(jt),t),{});const Yt=t=>Wt[t].process(jt),Xt=t=>{Lt=!1,jt.delta=zt?1/60*1e3:Math.max(Math.min(t-jt.timestamp,40),1),jt.timestamp=t,qt=!0,Ht.forEach(Yt),qt=!1,Lt&&(zt=!1,Bt(Xt))},Gt=()=>{Lt=!0,zt=!0,qt||Bt(Xt)};const Zt=(t,e,n)=>-n*t+n*e+t;function Jt(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 _t=(t,e,n)=>{const r=t*t;return Math.sqrt(Math.max(0,n*(e*e-r)+r))},Qt=[ft,ht,mt];function te(t){const e=(n=t,Qt.find(t=>t.test(n)));var n;let r=e.parse(t);return e===mt&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,s=0,i=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;o=Jt(a,r,t+1/3),s=Jt(a,r,t),i=Jt(a,r,t-1/3)}else o=s=i=n;return{red:Math.round(255*o),green:Math.round(255*s),blue:Math.round(255*i),alpha:r}}(r)),r}const ee=(t,e)=>{const n=te(t),r=te(e),o={...n};return t=>(o.red=_t(n.red,r.red,t),o.green=_t(n.green,r.green,t),o.blue=_t(n.blue,r.blue,t),o.alpha=Zt(n.alpha,r.alpha,t),ht.transform(o))},ne=(t,e)=>n=>e(t(n)),re=(...t)=>t.reduce(ne);function oe(t,e){return"number"==typeof t?n=>Zt(t,e,n):vt.test(t)?ee(t,e):ae(t,e)}const se=(t,e)=>{const n=[...t],r=n.length,o=t.map((t,n)=>oe(t,e[n]));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}},ie=(t,e)=>{const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=oe(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}},ae=(t,e)=>{const n=wt.createTransformer(e),r=gt(t),o=gt(e);return r.numColors===o.numColors&&r.numNumbers>=o.numNumbers?re(se(r.values,o.values),n):n=>""+(n>0?e:t)},ue=(t,e)=>n=>Zt(t,e,n);function le(t,e,n){const r=[],o=n||("number"==typeof(s=t[0])?ue:"string"==typeof s?vt.test(s)?ee:ae:Array.isArray(s)?se:"object"==typeof s?ie:ue);var s;const i=t.length-1;for(let n=0;n<i;n++){let s=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;s=re(t,s)}r.push(s)}return r}function ce(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const s=t.length;e.length,!r||!Array.isArray(r)||r.length,t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const i=le(e,r,o),a=i.length,u=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=((t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r})(t[n],t[n+1],e);return i[n](r)};return n?e=>u(d(t[0],t[s-1],e)):u}function pe(t,e){return t.map(()=>e||Q).splice(0,t.length-1)}function de({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,s,i=1-e;i=d(.05,1,i),t=d(.01,10,t/1e3),i<1?(o=e=>{const r=e*i,o=r*t;return.001-(r-n)/he(e,i)*Math.exp(-o)},s=e=>{const r=e*i*t,s=r*n+n,a=Math.pow(i,2)*Math.pow(e,2)*t,u=Math.exp(-r),l=he(Math.pow(e,2),i);return(.001-o(e)>0?-1:1)*((s-a)*u)/l}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,s=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<12;n++)r-=t(r)/e(r);return r}(o,s,5/t);if(t*=1e3,isNaN(a))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*i*Math.sqrt(r*e),duration:t}}}function he(t,e){return t*Math.sqrt(1-e*e)}const fe=["duration","bounce"],me=["stiffness","damping","mass"];function ve(t,e){return e.some(e=>void 0!==t[e])}function ge({from:t=0,to:e=1,restSpeed:n=2,restDelta:r=.01,...o}){const s={done:!1,value:t};let{stiffness:i,damping:a,mass:u,velocity:l,duration:c,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ve(t,me)&&ve(t,fe)){const n=de(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}(o),d=ye,h=ye;function f(){const n=l?-l/1e3:0,o=e-t,s=a/(2*Math.sqrt(i*u)),c=Math.sqrt(i/u)/1e3;if(void 0===r&&(r=Math.min(Math.abs(e-t)/100,.4)),s<1){const t=he(c,s);d=r=>{const i=Math.exp(-s*c*r);return e-i*((n+s*c*o)/t*Math.sin(t*r)+o*Math.cos(t*r))},h=e=>{const r=Math.exp(-s*c*e);return s*c*r*(Math.sin(t*e)*(n+s*c*o)/t+o*Math.cos(t*e))-r*(Math.cos(t*e)*(n+s*c*o)-t*o*Math.sin(t*e))}}else if(1===s)d=t=>e-Math.exp(-c*t)*(o+(n+c*o)*t);else{const t=c*Math.sqrt(s*s-1);d=r=>{const i=Math.exp(-s*c*r),a=Math.min(t*r,300);return e-i*((n+s*c*o)*Math.sinh(a)+t*o*Math.cosh(a))/t}}}return f(),{next:t=>{const o=d(t);if(p)s.done=t>=c;else{const i=1e3*h(t),a=Math.abs(i)<=n,u=Math.abs(e-o)<=r;s.done=a&&u}return s.value=s.done?e:o,s},flipTarget:()=>{l=-l,[t,e]=[e,t],f()}}}ge.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const ye=t=>0;const be={decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:r=350,restDelta:o=.5,modifyTarget:s}){const i={done:!1,value:e};let a=n*t;const u=e+a,l=void 0===s?u:s(u);return l!==u&&(a=l-e),{next:t=>{const e=-a*Math.exp(-t/r);return i.done=!(e>o||e<-o),i.value=i.done?l:l+e,i},flipTarget:()=>{}}},keyframes:function({from:t=0,to:e=1,ease:n,offset:r,duration:o=300}){const s={done:!1,value:t},i=Array.isArray(e)?e:[t,e],a=function(t,e){return t.map(t=>t*e)}(r&&r.length===i.length?r:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(i),o);function u(){return ce(a,i,{ease:Array.isArray(n)?n:pe(i,n)})}let l=u();return{next:t=>(s.value=l(t),s.done=t>=o,s),flipTarget:()=>{i.reverse(),l=u()}}},spring:ge};function Ve(t,e,n=0){return t-e-n}const we=t=>{const e=({delta:e})=>t(e);return{start:()=>$t.update(e,!0),stop:()=>Kt.update(e)}};function Ae({from:t,autoplay:e=!0,driver:n=we,elapsed:r=0,repeat:o=0,repeatType:s="loop",repeatDelay:i=0,onPlay:a,onStop:u,onComplete:l,onRepeat:c,onUpdate:p,type:d="keyframes",...h}){var f,m;let v,g,y,{to:b}=h,V=0,w=h.duration,A=!1,S=!0;const M=be[Array.isArray(b)?"keyframes":d];(null===(m=(f=M).needsInterpolation)||void 0===m?void 0:m.call(f,t,b))&&(y=ce([0,100],[t,b],{clamp:!1}),t=0,b=100);const C=M({...h,from:t,to:b});function x(){V++,"reverse"===s?(S=V%2==0,r=function(t,e=0,n=0,r=!0){return r?Ve(e+-t,e,n):e-(t-e)+n}(r,w,i,S)):(r=Ve(r,w,i),"mirror"===s&&C.flipTarget()),A=!1,c&&c()}function E(t){if(S||(t=-t),r+=t,!A){const t=C.next(Math.max(0,r));g=t.value,y&&(g=y(g)),A=S?t.done:r<=0}null==p||p(g),A&&(0===V&&(w=void 0!==w?w:r),V<o?function(t,e,n,r){return r?t>=e+n:t<=-n}(r,w,i,S)&&x():(v.stop(),l&&l()))}return e&&(null==a||a(),v=n(E),v.start()),{stop:()=>{null==u||u(),v.stop()}}}function Se(t,e){return e?t*(1e3/e):0}function Me({ease:t,times:e,...n}){const r={...n};return e&&(r.offset=e),n.duration&&(r.duration=$(n.duration)),n.repeatDelay&&(r.repeatDelay=$(n.repeatDelay)),t&&(r.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(lt):lt(t)),"tween"===n.type&&(r.type="keyframes"),"spring"!==n.type&&(r.type="keyframes"),r}function Ce(t,e,n){return Array.isArray(e.to)&&void 0===t.duration&&(t.duration=.8),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:s,repeatType:i,repeatDelay:a,from:u,...l}){return!!Object.keys(l).length}(t)||(t={...t,...Tt(n,e.to)}),{...e,...Me(t)}}function xe(t,e,n,r,o){const s=Pe(r,t)||{};let i=void 0!==s.from?s.from:e.get();const a=At(t,n);"none"===i&&a&&"string"==typeof n?i=Dt(t,n):Ee(i)&&"string"==typeof n?i=Te(n):!Array.isArray(n)&&Ee(n)&&"string"==typeof i&&(n=Te(i));return At(t,i)&&a&&!1!==s.type?function(){const r={from:i,to:n,velocity:e.getVelocity(),onComplete:o,onUpdate:t=>e.set(t)};return"inertia"===s.type||"decay"===s.type?function({from:t=0,velocity:e=0,min:n,max:r,power:o=.8,timeConstant:s=750,bounceStiffness:i=500,bounceDamping:a=10,restDelta:u=1,modifyTarget:l,driver:c,onUpdate:p,onComplete:d,onStop:h}){let f;function m(t){return void 0!==n&&t<n||void 0!==r&&t>r}function v(t){return void 0===n?r:void 0===r||Math.abs(n-t)<Math.abs(r-t)?n:r}function g(t){null==f||f.stop(),f=Ae({...t,driver:c,onUpdate:e=>{var n;null==p||p(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:d,onStop:h})}function y(t){g({type:"spring",stiffness:i,damping:a,restDelta:u,...t})}if(m(t))y({from:t,velocity:e,to:v(t)});else{let r=o*e+t;void 0!==l&&(r=l(r));const i=v(r),a=i===n?-1:1;let c,p;const d=t=>{c=p,p=t,e=Se(t-c,jt.delta),(1===a&&t>i||-1===a&&t<i)&&y({from:t,to:i,velocity:e})};g({type:"decay",from:t,velocity:e,timeConstant:s,power:o,restDelta:u,modifyTarget:l,onUpdate:m(r)?d:void 0})}return{stop:()=>null==f?void 0:f.stop()}}({...r,...s}):Ae({...Ce(s,r,t),onUpdate:t=>{r.onUpdate(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{r.onComplete(),s.onComplete&&s.onComplete()}})}:function(){const t=g(n);return e.set(t),o(),s.onUpdate&&s.onUpdate(t),s.onComplete&&s.onComplete(),{stop:()=>{}}}}function Ee(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Te(t){return"number"==typeof t?0:Dt("",t)}function Pe(t,e){return t[e]||t.default||t}function Fe(t,e,n,r={}){return Rt&&(r={type:!1}),e.start(o=>{let s;const i=xe(t,e,n,r,o),a=function(t,e){const n=Pe(t,e)||{};return void 0!==n.delay?n.delay:void 0!==t.delay?t.delay:0}(r,t),u=()=>s=i();let l;return a?l=function(t,e){const n=performance.now(),r=({timestamp:o})=>{const s=o-n;s>=e&&(Kt.read(r),t(s-e))};return $t.read(r,!0),()=>Kt.read(r)}(u,$(a)):u(),()=>{l&&l(),s&&s.stop()}})}const Ie=t=>/^0[^.\s]+$/.test(t);class ke{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 r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Oe{constructor(t){var e;this.version="7.7.2",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new ke,this.velocityUpdateSubscribers=new ke,this.renderSubscribers=new ke,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:r}=jt;this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,$t.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.updateSubscribers.notify(this.current),this.velocityUpdateSubscribers.getSize()&&this.velocityUpdateSubscribers.notify(this.getVelocity()),e&&this.renderSubscribers.notify(this.current)},this.scheduleVelocityCheck=()=>$t.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.velocityUpdateSubscribers.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e)))}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Se(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.stopAnimation=t(e)}).then(()=>this.clearAnimation())}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}}function Ne(t){return new Oe(t)}const De=t=>e=>e.test(t),Re=[p,y,h,b,V,w,{test:t=>"auto"===t,parse:t=>t}],Ue=t=>Re.find(De(t)),Be=[...Re,vt,wt],je=t=>Be.find(De(t));function ze(t,e,n){const r=t.getProps();return A(r,e,void 0!==n?n:r.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(t))}function Le(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ne(n))}function qe(t,e){if(!e)return;return(e[t]||e.default||e).from}function He(t){return Boolean(S(t)&&t.add)}function We(t,e,n={}){var r;const o=ze(t,e,n.custom);let{transition:s=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(s=n.transitionOverride);const i=o?()=>$e(t,o,n):()=>Promise.resolve(),a=(null===(r=t.variantChildren)||void 0===r?void 0:r.size)?(r=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:a}=s;return function(t,e,n=0,r=0,o=1,s){const i=[],a=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(Ke).forEach((t,r)=>{i.push(We(t,e,{...s,delay:n+u(r)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(i)}(t,e,o+r,i,a,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[t,e]="beforeChildren"===u?[i,a]:[a,i];return t().then(e)}return Promise.all([i(),a(n.delay)])}function $e(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var s;let{transition:i=t.getDefaultTransition(),transitionEnd:a,...u}=t.makeTargetAnimatable(e);const l=t.getValue("willChange");r&&(i=r);const c=[],p=o&&(null===(s=t.animationState)||void 0===s?void 0:s.getState()[o]);for(const e in u){const r=t.getValue(e),o=u[e];if(!r||void 0===o||p&&Ye(p,e))continue;let s={delay:n,...i};t.shouldReduceMotion&&M.has(e)&&(s={...s,type:!1,delay:0});let a=Fe(e,r,o,s);He(l)&&(l.add(e),a=a.then(()=>l.remove(e))),c.push(a)}return Promise.all(c).then(()=>{a&&function(t,e){const n=ze(t,e);let{transitionEnd:r={},transition:o={},...s}=n?t.makeTargetAnimatable(n,!1):{};s={...s,...r};for(const e in s){Le(t,e,g(s[e]))}}(t,a)})}function Ke(t,e){return t.sortNodePosition(e)}function Ye({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}var Xe;!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(Xe||(Xe={}));const Ge=[Xe.Animate,Xe.InView,Xe.Focus,Xe.Hover,Xe.Tap,Xe.Drag,Xe.Exit],Ze=[...Ge].reverse(),Je=Ge.length;function _e(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map(e=>We(t,e,n));r=Promise.all(o)}else if("string"==typeof e)r=We(t,e,n);else{const o="function"==typeof e?ze(t,e,n.custom):e;r=$e(t,o,n)}return r.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Qe(t){let e=_e(t);const n={[Xe.Animate]:en(!0),[Xe.InView]:en(),[Xe.Hover]:en(),[Xe.Tap]:en(),[Xe.Drag]:en(),[Xe.Focus]:en(),[Xe.Exit]:en()};let r=!0;const o=(e,n)=>{const r=ze(t,n);if(r){const{transition:t,transitionEnd:n,...o}=r;e={...e,...o,...n}}return e};function s(s,i){const a=t.getProps(),u=t.getVariantContext(!0)||{},l=[],c=new Set;let p={},d=1/0;for(let e=0;e<Je;e++){const h=Ze[e],f=n[h],v=void 0!==a[h]?a[h]:u[h],g=x(v),y=h===i?f.isActive:null;!1===y&&(d=e);let b=v===u[h]&&v!==a[h]&&g;if(b&&r&&t.manuallyAnimateOnMount&&(b=!1),f.protectedKeys={...p},!f.isActive&&null===y||!v&&!f.prevProp||C(v)||"boolean"==typeof v)continue;const V=tn(f.prevProp,v);let w=V||h===i&&f.isActive&&!b&&g||e>d&&g;const A=Array.isArray(v)?v:[v];let S=A.reduce(o,{});!1===y&&(S={});const{prevResolvedValues:M={}}=f,E={...M,...S},T=t=>{w=!0,c.delete(t),f.needsAnimating[t]=!0};for(const t in E){const e=S[t],n=M[t];p.hasOwnProperty(t)||(e!==n?m(e)&&m(n)?!W(e,n)||V?T(t):f.protectedKeys[t]=!0:void 0!==e?T(t):c.add(t):void 0!==e&&c.has(t)?T(t):f.protectedKeys[t]=!0)}f.prevProp=v,f.prevResolvedValues=S,f.isActive&&(p={...p,...S}),r&&t.blockInitialAnimation&&(w=!1),w&&!b&&l.push(...A.map(t=>({animation:t,options:{type:h,...s}})))}if(c.size){const e={};c.forEach(n=>{const r=t.getBaseTarget(n);void 0!==r&&(e[n]=r)}),l.push({animation:e})}let h=Boolean(l.length);return r&&!1===a.initial&&!t.manuallyAnimateOnMount&&(h=!1),r=!1,h?e(l):Promise.resolve()}return{animateChanges:s,setActive:function(e,r,o){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach(t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)}),n[e].isActive=r;const a=s(o,e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function tn(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!W(e,t)}function en(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const nn=t=>e=>(t(e),null),rn={animation:nn(({visualElement:t,animate:e})=>{t.animationState||(t.animationState=Qe(t)),C(e)&&n(()=>e.subscribe(t),[e])}),exit:nn(r=>{const{custom:o,visualElement:i}=r,[a,u]=function(){const r=t(s);if(null===r)return[!0,null];const{isPresent:o,onExitComplete:i,register:a}=r,u=e();return n(()=>a(u),[]),!o&&i?[!1,()=>i&&i(u)]:[!0]}(),l=t(s);n(()=>{i.isPresent=a;const t=i.animationState&&i.animationState.setActive(Xe.Exit,!a,{custom:l&&l.custom||o});t&&!a&&t.then(u)},[a])})};function on(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function sn(t,e,r,o){n(()=>{const n=t.current;if(r&&n)return on(n,e,r,o)},[t,e,r,o])}function an(t){return!!t.touches}const un={pageX:0,pageY:0};function ln(t,e="page"){const n=t.touches[0]||t.changedTouches[0]||un;return{x:n[e+"X"],y:n[e+"Y"]}}function cn(t,e="page"){return{x:t[e+"X"],y:t[e+"Y"]}}const pn=(t,e=!1)=>{const n=e=>t(e,function(t,e="page"){return{point:an(t)?ln(t,e):cn(t,e)}}(e));return e?(r=n,t=>{const e=t instanceof MouseEvent;(!e||e&&0===t.button)&&r(t)}):n;var r},dn={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},hn={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function fn(t){return E&&null===window.onpointerdown?t:E&&null===window.ontouchstart?hn[t]:E&&null===window.onmousedown?dn[t]:t}function mn(t,e,n,r){return on(t,fn(e),pn(n,"pointerdown"===e),r)}function vn(t,e,n,r){return sn(t,fn(e),n&&pn(n,"pointerdown"===e),r)}function gn(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const yn=gn("dragHorizontal"),bn=gn("dragVertical");function Vn(){const t=function(t){let e=!1;if("y"===t)e=bn();else if("x"===t)e=yn();else{const t=yn(),n=bn();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function wn(t,e,n){return(r,o)=>{(function(t){return"undefined"!=typeof PointerEvent&&t instanceof PointerEvent?!("mouse"!==t.pointerType):t instanceof MouseEvent})(r)&&!Vn()&&(t.animationState&&t.animationState.setActive(Xe.Hover,e),n&&n(r,o))}}const An=(t,e)=>!!e&&(t===e||An(t,e.parentElement));const Sn=("undefined"==typeof process||process.env,"production"),Mn=new Set;const Cn=new WeakMap,xn=new WeakMap,En=t=>{const e=Cn.get(t.target);e&&e(t)},Tn=t=>{t.forEach(En)};function Pn(t,e,n){const r=function({root:t,...e}){const n=t||document;xn.has(n)||xn.set(n,{});const r=xn.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Tn,{root:t,...e})),r[o]}(e);return Cn.set(t,n),r.observe(t),()=>{Cn.delete(t),r.unobserve(t)}}const Fn={some:0,all:1};function In(t,e,r,{root:o,margin:s,amount:i="some",once:a}){n(()=>{if(!t||!r.current)return;const n={root:null==o?void 0:o.current,rootMargin:s,threshold:"number"==typeof i?i:Fn[i]};return Pn(r.current,n,t=>{const{isIntersecting:n}=t;if(e.isInView===n)return;if(e.isInView=n,a&&!n&&e.hasEnteredView)return;n&&(e.hasEnteredView=!0),r.animationState&&r.animationState.setActive(Xe.InView,n);const o=r.getProps(),s=n?o.onViewportEnter:o.onViewportLeave;s&&s(t)})},[t,o,s,i])}function kn(t,e,r,{fallback:o=!0}){n(()=>{var n,s;t&&o&&("production"!==Sn&&(n="IntersectionObserver not available on this device. whileInView animations will trigger on mount.",!1||Mn.has(n)||(console.warn(n),s&&console.warn(s),Mn.add(n))),requestAnimationFrame(()=>{e.hasEnteredView=!0;const{onViewportEnter:t}=r.getProps();t&&t(null),r.animationState&&r.animationState.setActive(Xe.InView,!0)}))},[t])}const On={inView:nn((function({visualElement:t,whileInView:e,onViewportEnter:n,onViewportLeave:o,viewport:s={}}){const i=r({hasEnteredView:!1,isInView:!1});let a=Boolean(e||n||o);s.once&&i.current.hasEnteredView&&(a=!1),("undefined"==typeof IntersectionObserver?kn:In)(a,i.current,t,s)})),tap:nn((function({onTap:t,onTapStart:e,onTapCancel:o,whileTap:s,visualElement:i}){const a=t||e||o||s,u=r(!1),l=r(null),c={passive:!(e||t||o||m)};function p(){l.current&&l.current(),l.current=null}function d(){return p(),u.current=!1,i.animationState&&i.animationState.setActive(Xe.Tap,!1),!Vn()}function h(e,n){d()&&(An(i.current,e.target)?t&&t(e,n):o&&o(e,n))}function f(t,e){d()&&o&&o(t,e)}function m(t,n){p(),u.current||(u.current=!0,l.current=re(mn(window,"pointerup",h,c),mn(window,"pointercancel",f,c)),i.animationState&&i.animationState.setActive(Xe.Tap,!0),e&&e(t,n))}var v;vn(i,"pointerdown",a?m:void 0,c),v=p,n(()=>()=>v(),[])})),focus:nn((function({whileFocus:t,visualElement:e}){const{animationState:n}=e;sn(e,"focus",t?()=>{n&&n.setActive(Xe.Focus,!0)}:void 0),sn(e,"blur",t?()=>{n&&n.setActive(Xe.Focus,!1)}:void 0)})),hover:nn((function({onHoverStart:t,onHoverEnd:e,whileHover:n,visualElement:r}){vn(r,"pointerenter",t||n?wn(r,!0,t):void 0,{passive:!t}),vn(r,"pointerleave",e||n?wn(r,!1,e):void 0,{passive:!e})}))};function Nn(t){return"string"==typeof t&&t.startsWith("var(--")}const Dn=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Rn(t,e,n=1){const[r,o]=function(t){const e=Dn.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]}(t);if(!r)return;const s=window.getComputedStyle(e).getPropertyValue(r);return s?s.trim():Nn(o)?Rn(o,e,n+1):o}const Un=new Set(["width","height","top","left","right","bottom","x","y"]),Bn=t=>Un.has(t),jn=(t,e)=>{t.set(e,!1),t.set(e)},zn=t=>t===p||t===y;var Ln;!function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"}(Ln||(Ln={}));const qn=(t,e)=>parseFloat(t.split(", ")[e]),Hn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/);if(o)return qn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/);return e?qn(e[1],t):0}},Wn=new Set(["x","y","z"]),$n=T.filter(t=>!Wn.has(t));const Kn={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:Hn(4,13),y:Hn(5,14)},Yn=(t,e,n={},r={})=>{e={...e},r={...r};const o=Object.keys(e).filter(Bn);let s=[],i=!1;const a=[];if(o.forEach(o=>{const u=t.getValue(o);if(!t.hasValue(o))return;let l=n[o],c=Ue(l);const p=e[o];let d;if(m(p)){const t=p.length,e=null===p[0]?1:0;l=p[e],c=Ue(l);for(let n=e;n<t;n++)d?Ue(p[n]):d=Ue(p[n])}else d=Ue(p);if(c!==d)if(zn(c)&&zn(d)){const t=u.get();"string"==typeof t&&u.set(parseFloat(t)),"string"==typeof p?e[o]=parseFloat(p):Array.isArray(p)&&d===y&&(e[o]=p.map(parseFloat))}else(null==c?void 0:c.transform)&&(null==d?void 0:d.transform)&&(0===l||0===p)?0===l?u.set(d.transform(l)):e[o]=c.transform(p):(i||(s=function(t){const e=[];return $n.forEach(n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}(t),i=!0),a.push(o),r[o]=void 0!==r[o]?r[o]:e[o],jn(u,p))}),a.length){const n=a.indexOf("height")>=0?window.pageYOffset:null,o=((t,e,n)=>{const r=e.measureViewportBox(),o=e.current,s=getComputedStyle(o),{display:i}=s,a={};"none"===i&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=Kn[t](r,s)}),e.render();const u=e.measureViewportBox();return n.forEach(n=>{const r=e.getValue(n);jn(r,a[n]),t[n]=Kn[n](u,s)}),t})(e,t,a);return s.length&&s.forEach(([e,n])=>{t.getValue(e).set(n)}),t.render(),E&&null!==n&&window.scrollTo({top:n}),{target:o,transitionEnd:r}}return{target:e,transitionEnd:r}};function Xn(t,e,n,r){return(t=>Object.keys(t).some(Bn))(e)?Yn(t,e,n,r):{target:e,transitionEnd:r}}const Gn=(t,e,n,r)=>{const o=function(t,{...e},n){const r=t.current;if(!(r instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(t=>{const e=t.get();if(!Nn(e))return;const n=Rn(e,r);n&&t.set(n)});for(const t in e){const o=e[t];if(!Nn(o))continue;const s=Rn(o,r);s&&(e[t]=s,n&&void 0===n[t]&&(n[t]=o))}return{target:e,transitionEnd:n}}(t,e,r);return Xn(t,e=o.target,n,r=o.transitionEnd)},Zn={current:null},Jn={current:!1};const _n=Object.keys(P),Qn=_n.length,tr=["AnimationStart","AnimationComplete","Update","Unmount","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];const er=["initial",...Ge],nr=er.length;class rr extends class{constructor({parent:t,props:e,reducedMotionConfig:n,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.isPresent=!0,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.render(this.render,!1,!0);const{latestValues:s,renderState:i}=r;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=i,this.parent=t,this.props=e,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.options=o,this.isControllingVariants=F(e),this.isVariantNode=I(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:a,...u}=this.scrapeMotionValuesFromProps(e);for(const t in u){const e=u[t];void 0!==s[t]&&S(e)&&(e.set(s[t],!1),He(a)&&a.add(t))}}scrapeMotionValuesFromProps(t){return{}}mount(t){var e;this.current=t,this.projection&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=null===(e=this.parent)||void 0===e?void 0:e.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),Jn.current||function(){if(Jn.current=!0,E)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Zn.current=t.matches;t.addListener(e),e()}else Zn.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Zn.current),this.parent&&this.parent.children.add(this),this.setProps(this.props)}unmount(){var t,e,n;null===(t=this.projection)||void 0===t||t.unmount(),Kt.update(this.notifyUpdate),Kt.render(this.render),this.valueSubscriptions.forEach(t=>t()),null===(e=this.removeFromVariantTree)||void 0===e||e.call(this),null===(n=this.parent)||void 0===n||n.children.delete(this);for(const t in this.events)this.events[t].clear();this.current=null}bindToMotionValue(t,e){const n=M.has(t),r=e.onChange(e=>{this.latestValues[t]=e,this.props.onUpdate&&$t.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),o=e.onRenderRequest(this.scheduleRender);this.valueSubscriptions.set(t,()=>{r(),o()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures(t,e,n,r,s,i){const a=[];for(let e=0;e<Qn;e++){const n=_n[e],{isEnabled:r,Component:s}=P[n];r(t)&&s&&a.push(o(s,{key:n,...t,visualElement:this}))}if(!this.projection&&s){this.projection=new s(r,this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:n,drag:o,dragConstraints:a,layoutScroll:u}=t;this.projection.setOptions({layoutId:e,layout:n,alwaysMeasureLayout:Boolean(o)||a&&k(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:i,layoutScroll:u})}return a}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)}setProps(t){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.props=t;for(let e=0;e<tr.length;e++){const n=tr[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){const{willChange:r}=e;for(const o in e){const s=e[o],i=n[o];if(S(s))t.addValue(o,s),He(r)&&r.add(o);else if(S(i))t.addValue(o,Ne(s)),He(r)&&r.remove(o);else if(i!==s)if(t.hasValue(o)){const e=t.getValue(o);!e.hasAnimated&&e.set(s)}else{const e=t.getStaticValue(o);t.addValue(o,Ne(void 0!==e?e:s))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t),this.prevMotionValues)}getProps(){return this.props}getVariant(t){var e;return null===(e=this.props.variants)||void 0===e?void 0:e[t]}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){var t;return this.isVariantNode?this:null===(t=this.parent)||void 0===t?void 0:t.getClosestVariantNode()}getVariantContext(t=!1){var e,n;if(t)return null===(e=this.parent)||void 0===e?void 0:e.getVariantContext();if(!this.isControllingVariants){const t=(null===(n=this.parent)||void 0===n?void 0:n.getVariantContext())||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const r={};for(let t=0;t<nr;t++){const e=er[t],n=this.props[e];(x(n)||!1===n)&&(r[e]=n)}return r}addVariantChild(t){var e;const n=this.getClosestVariantNode();if(n)return null===(e=n.variantChildren)||void 0===e||e.add(t),()=>n.variantChildren.delete(t)}addValue(t,e){this.hasValue(t)&&this.removeValue(t),this.values.set(t,e),this.latestValues[t]=e.get(),this.bindToMotionValue(t,e)}removeValue(t){var e;this.values.delete(t),null===(e=this.valueSubscriptions.get(t))||void 0===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=Ne(e),this.addValue(t,n)),n}readValue(t){return void 0===this.latestValues[t]&&this.current?this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props,r="string"==typeof n||"object"==typeof n?null===(e=A(this.props,n))||void 0===e?void 0:e[t]:void 0;if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||S(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new ke),this.events[t].add(e)}notify(t,...e){var n;null===(n=this.events[t])||void 0===n||n.notify(...e)}}{sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){var n;return null===(n=t.style)||void 0===n?void 0:n[e]}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:r},o){let s=function(t,e,n){var r;const o={};for(const s in t){const t=qe(s,e);o[s]=void 0!==t?t:null===(r=n.getValue(s))||void 0===r?void 0:r.get()}return o}(n,t||{},this);if(r&&(e&&(e=r(e)),n&&(n=r(n)),s&&(s=r(s))),o){!function(t,e,n){var r,o;const s=Object.keys(e).filter(e=>!t.hasValue(e)),i=s.length;if(i)for(let a=0;a<i;a++){const i=s[a],u=e[i];let l=null;Array.isArray(u)&&(l=u[0]),null===l&&(l=null!==(o=null!==(r=n[i])&&void 0!==r?r:t.readValue(i))&&void 0!==o?o:e[i]),null!=l&&("string"==typeof l&&(/^\-?\d*\.?\d+$/.test(l)||Ie(l))?l=parseFloat(l):!je(l)&&wt.test(u)&&(l=Dt(i,u)),t.addValue(i,Ne(l)),void 0===n[i]&&(n[i]=l),null!==l&&t.setBaseTarget(i,l))}}(this,n,s);const t=Gn(this,n,s,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class or extends rr{readValueFromInstance(t,e){if(M.has(e)){const t=Nt(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(O(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n,r){N(t,e,n,r.transformTemplate)}scrapeMotionValuesFromProps(t){return D(t)}renderInstance(t,e,n,r){R(t,e,n,r)}}class sr extends rr{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){var n;return M.has(e)?(null===(n=Nt(e))||void 0===n?void 0:n.default)||0:(e=U.has(e)?e:B(e),t.getAttribute(e))}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(t){return j(t)}build(t,e,n,r){z(t,e,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,e,n,r){L(t,e,n,r)}mount(t){this.isSVGTag=q(t.tagName),super.mount(t)}}const ir={renderer:(t,e)=>H(t)?new sr(e,{enableHardwareAcceleration:!1}):new or(e,{enableHardwareAcceleration:!0}),...rn,...On};export{ir as domAnimation};
|
|
1
|
+
import{useContext as t,useId as e,useEffect as n,useRef as r,createElement as o}from"react";import{P as s,q as i,t as a,u,v as l,w as c,x as p,y as d,z as h,A as f,B as m,C as v,D as g,E as y,F as b,G as V,H as w,r as A,d as S,I as M,n as C,c as x,i as E,J as T,f as P,b as F,m as I,a as k,K as O,g as N,p as D,L as R,M as U,N as B,s as j,h as z,o as L,j as q,k as H}from"./size-rollup-dom-animation-assets.js";function W(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const $=t=>1e3*t;const K=t=>t,Y=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function X(t,e,n,r){if(t===e&&n===r)return K;const o=e=>function(t,e,n,r,o){let s,i,a=0;do{i=e+(n-e)/2,s=Y(i,r,o)-t,s>0?n=i:e=i}while(Math.abs(s)>1e-7&&++a<12);return i}(e,0,1,t,n);return t=>0===t||1===t?t:Y(o(t),e,r)}const G=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,Z=t=>e=>1-t(1-e),J=t=>t*t,_=Z(J),Q=G(J),tt=t=>1-Math.sin(Math.acos(t)),et=Z(tt),nt=G(et),rt=(t=1.525)=>e=>e*e*((t+1)*e-t),ot=rt(),st=Z(ot),it=G(ot),at=(t=>{const e=rt(t);return t=>(t*=2)<1?.5*e(t):.5*(2-Math.pow(2,-10*(t-1)))})(),ut={linear:K,easeIn:J,easeInOut:Q,easeOut:_,circIn:tt,circInOut:nt,circOut:et,backIn:ot,backInOut:it,backOut:st,anticipate:at},lt=t=>{if(Array.isArray(t)){t.length;const[e,n,r,o]=t;return X(e,n,r,o)}return"string"==typeof t?ut[t]:t},ct=(t,e)=>n=>Boolean(i(n)&&a.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),pt=(t,e,n)=>r=>{if(!i(r))return r;const[o,s,a,l]=r.match(u);return{[t]:parseFloat(o),[e]:parseFloat(s),[n]:parseFloat(a),alpha:void 0!==l?parseFloat(l):1}},dt={...p,transform:t=>Math.round((t=>d(0,255,t))(t))},ht={test:ct("rgb","red"),parse:pt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+dt.transform(t)+", "+dt.transform(e)+", "+dt.transform(n)+", "+l(c.transform(r))+")"};const ft={test:ct("#"),parse:function(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}},transform:ht.transform},mt={test:ct("hsl","hue"),parse:pt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+h.transform(l(e))+", "+h.transform(l(n))+", "+l(c.transform(r))+")"},vt={test:t=>ht.test(t)||ft.test(t)||mt.test(t),parse:t=>ht.test(t)?ht.parse(t):mt.test(t)?mt.parse(t):ft.parse(t),transform:t=>i(t)?t:t.hasOwnProperty("red")?ht.transform(t):mt.transform(t)};function gt(t){"number"==typeof t&&(t=""+t);const e=[];let n=0,r=0;const o=t.match(f);o&&(n=o.length,t=t.replace(f,"${c}"),e.push(...o.map(vt.parse)));const s=t.match(u);return s&&(r=s.length,t=t.replace(u,"${n}"),e.push(...s.map(p.parse))),{values:e,numColors:n,numNumbers:r,tokenised:t}}function yt(t){return gt(t).values}function bt(t){const{values:e,numColors:n,tokenised:r}=gt(t),o=e.length;return t=>{let e=r;for(let r=0;r<o;r++)e=e.replace(r<n?"${c}":"${n}",r<n?vt.transform(t[r]):l(t[r]));return e}}const Vt=t=>"number"==typeof t?0:t;const wt={test:function(t){var e,n;return isNaN(t)&&i(t)&&((null===(e=t.match(u))||void 0===e?void 0:e.length)||0)+((null===(n=t.match(f))||void 0===n?void 0:n.length)||0)>0},parse:yt,createTransformer:bt,getAnimatableNone:function(t){const e=yt(t);return bt(t)(e.map(Vt))}},At=(t,e)=>"zIndex"!==t&&(!("number"!=typeof e&&!Array.isArray(e))||!("string"!=typeof e||!wt.test(e)||e.startsWith("url("))),St=()=>({type:"spring",stiffness:500,damping:25,restSpeed:10}),Mt=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),Ct=()=>({type:"keyframes",ease:"linear",duration:.3}),xt=t=>({type:"keyframes",duration:.8,values:t}),Et={x:St,y:St,z:St,rotate:St,rotateX:St,rotateY:St,rotateZ:St,scaleX:Mt,scaleY:Mt,scale:Mt,opacity:Ct,backgroundColor:Ct,color:Ct,default:Mt},Tt=(t,e)=>{let n;return n=m(e)?xt:Et[t]||Et.default,{to:e,...n(e)}},Pt=new Set(["brightness","contrast","saturate","opacity"]);function Ft(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[r]=n.match(u)||[];if(!r)return t;const o=n.replace(r,"");let s=Pt.has(e)?1:0;return r!==n&&(s*=100),e+"("+s+o+")"}const It=/([a-z-]*)\(.*?\)/g,kt={...wt,getAnimatableNone:t=>{const e=t.match(It);return e?e.map(Ft).join(" "):t}},Ot={...v,color:vt,backgroundColor:vt,outlineColor:vt,fill:vt,stroke:vt,borderColor:vt,borderTopColor:vt,borderRightColor:vt,borderBottomColor:vt,borderLeftColor:vt,filter:kt,WebkitFilter:kt},Nt=t=>Ot[t];function Dt(t,e){var n;let r=Nt(t);return r!==kt&&(r=wt),null===(n=r.getAnimatableNone)||void 0===n?void 0:n.call(r,e)}const Rt=!1,Ut="undefined"!=typeof performance?()=>performance.now():()=>Date.now(),Bt="undefined"!=typeof window?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(Ut()),1/60*1e3);const jt={delta:0,timestamp:0};let zt=!0,Lt=!1,qt=!1;const Ht=["read","update","preRender","render","postRender"],Wt=Ht.reduce((t,e)=>(t[e]=function(t){let e=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,a={schedule:(t,s=!1,a=!1)=>{const u=a&&o,l=u?e:n;return s&&i.add(t),-1===l.indexOf(t)&&(l.push(t),u&&o&&(r=e.length)),t},cancel:t=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1),i.delete(t)},process:u=>{if(o)s=!0;else{if(o=!0,[e,n]=[n,e],n.length=0,r=e.length,r)for(let n=0;n<r;n++){const r=e[n];r(u),i.has(r)&&(a.schedule(r),t())}o=!1,s&&(s=!1,a.process(u))}}};return a}(()=>Lt=!0),t),{}),$t=Ht.reduce((t,e)=>{const n=Wt[e];return t[e]=(t,e=!1,r=!1)=>(Lt||Gt(),n.schedule(t,e,r)),t},{}),Kt=Ht.reduce((t,e)=>(t[e]=Wt[e].cancel,t),{});Ht.reduce((t,e)=>(t[e]=()=>Wt[e].process(jt),t),{});const Yt=t=>Wt[t].process(jt),Xt=t=>{Lt=!1,jt.delta=zt?1/60*1e3:Math.max(Math.min(t-jt.timestamp,40),1),jt.timestamp=t,qt=!0,Ht.forEach(Yt),qt=!1,Lt&&(zt=!1,Bt(Xt))},Gt=()=>{Lt=!0,zt=!0,qt||Bt(Xt)};const Zt=(t,e,n)=>-n*t+n*e+t;function Jt(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 _t=(t,e,n)=>{const r=t*t;return Math.sqrt(Math.max(0,n*(e*e-r)+r))},Qt=[ft,ht,mt];function te(t){const e=(n=t,Qt.find(t=>t.test(n)));var n;let r=e.parse(t);return e===mt&&(r=function({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,n/=100;let o=0,s=0,i=0;if(e/=100){const r=n<.5?n*(1+e):n+e-n*e,a=2*n-r;o=Jt(a,r,t+1/3),s=Jt(a,r,t),i=Jt(a,r,t-1/3)}else o=s=i=n;return{red:Math.round(255*o),green:Math.round(255*s),blue:Math.round(255*i),alpha:r}}(r)),r}const ee=(t,e)=>{const n=te(t),r=te(e),o={...n};return t=>(o.red=_t(n.red,r.red,t),o.green=_t(n.green,r.green,t),o.blue=_t(n.blue,r.blue,t),o.alpha=Zt(n.alpha,r.alpha,t),ht.transform(o))},ne=(t,e)=>n=>e(t(n)),re=(...t)=>t.reduce(ne);function oe(t,e){return"number"==typeof t?n=>Zt(t,e,n):vt.test(t)?ee(t,e):ae(t,e)}const se=(t,e)=>{const n=[...t],r=n.length,o=t.map((t,n)=>oe(t,e[n]));return t=>{for(let e=0;e<r;e++)n[e]=o[e](t);return n}},ie=(t,e)=>{const n={...t,...e},r={};for(const o in n)void 0!==t[o]&&void 0!==e[o]&&(r[o]=oe(t[o],e[o]));return t=>{for(const e in r)n[e]=r[e](t);return n}},ae=(t,e)=>{const n=wt.createTransformer(e),r=gt(t),o=gt(e);return r.numColors===o.numColors&&r.numNumbers>=o.numNumbers?re(se(r.values,o.values),n):n=>""+(n>0?e:t)},ue=(t,e)=>n=>Zt(t,e,n);function le(t,e,n){const r=[],o=n||("number"==typeof(s=t[0])?ue:"string"==typeof s?vt.test(s)?ee:ae:Array.isArray(s)?se:"object"==typeof s?ie:ue);var s;const i=t.length-1;for(let n=0;n<i;n++){let s=o(t[n],t[n+1]);if(e){const t=Array.isArray(e)?e[n]:e;s=re(t,s)}r.push(s)}return r}function ce(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const s=t.length;e.length,!r||!Array.isArray(r)||r.length,t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const i=le(e,r,o),a=i.length,u=e=>{let n=0;if(a>1)for(;n<t.length-2&&!(e<t[n+1]);n++);const r=((t,e,n)=>{const r=e-t;return 0===r?1:(n-t)/r})(t[n],t[n+1],e);return i[n](r)};return n?e=>u(d(t[0],t[s-1],e)):u}function pe(t,e){return t.map(()=>e||Q).splice(0,t.length-1)}function de({duration:t=800,bounce:e=.25,velocity:n=0,mass:r=1}){let o,s,i=1-e;i=d(.05,1,i),t=d(.01,10,t/1e3),i<1?(o=e=>{const r=e*i,o=r*t;return.001-(r-n)/he(e,i)*Math.exp(-o)},s=e=>{const r=e*i*t,s=r*n+n,a=Math.pow(i,2)*Math.pow(e,2)*t,u=Math.exp(-r),l=he(Math.pow(e,2),i);return(.001-o(e)>0?-1:1)*((s-a)*u)/l}):(o=e=>Math.exp(-e*t)*((e-n)*t+1)-.001,s=e=>Math.exp(-e*t)*(t*t*(n-e)));const a=function(t,e,n){let r=n;for(let n=1;n<12;n++)r-=t(r)/e(r);return r}(o,s,5/t);if(t*=1e3,isNaN(a))return{stiffness:100,damping:10,duration:t};{const e=Math.pow(a,2)*r;return{stiffness:e,damping:2*i*Math.sqrt(r*e),duration:t}}}function he(t,e){return t*Math.sqrt(1-e*e)}const fe=["duration","bounce"],me=["stiffness","damping","mass"];function ve(t,e){return e.some(e=>void 0!==t[e])}function ge({from:t=0,to:e=1,restSpeed:n=2,restDelta:r=.01,...o}){const s={done:!1,value:t};let{stiffness:i,damping:a,mass:u,velocity:l,duration:c,isResolvedFromDuration:p}=function(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!ve(t,me)&&ve(t,fe)){const n=de(t);e={...e,...n,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}(o),d=ye,h=ye;function f(){const n=l?-l/1e3:0,o=e-t,s=a/(2*Math.sqrt(i*u)),c=Math.sqrt(i/u)/1e3;if(void 0===r&&(r=Math.min(Math.abs(e-t)/100,.4)),s<1){const t=he(c,s);d=r=>{const i=Math.exp(-s*c*r);return e-i*((n+s*c*o)/t*Math.sin(t*r)+o*Math.cos(t*r))},h=e=>{const r=Math.exp(-s*c*e);return s*c*r*(Math.sin(t*e)*(n+s*c*o)/t+o*Math.cos(t*e))-r*(Math.cos(t*e)*(n+s*c*o)-t*o*Math.sin(t*e))}}else if(1===s)d=t=>e-Math.exp(-c*t)*(o+(n+c*o)*t);else{const t=c*Math.sqrt(s*s-1);d=r=>{const i=Math.exp(-s*c*r),a=Math.min(t*r,300);return e-i*((n+s*c*o)*Math.sinh(a)+t*o*Math.cosh(a))/t}}}return f(),{next:t=>{const o=d(t);if(p)s.done=t>=c;else{const i=1e3*h(t),a=Math.abs(i)<=n,u=Math.abs(e-o)<=r;s.done=a&&u}return s.value=s.done?e:o,s},flipTarget:()=>{l=-l,[t,e]=[e,t],f()}}}ge.needsInterpolation=(t,e)=>"string"==typeof t||"string"==typeof e;const ye=t=>0;const be={decay:function({velocity:t=0,from:e=0,power:n=.8,timeConstant:r=350,restDelta:o=.5,modifyTarget:s}){const i={done:!1,value:e};let a=n*t;const u=e+a,l=void 0===s?u:s(u);return l!==u&&(a=l-e),{next:t=>{const e=-a*Math.exp(-t/r);return i.done=!(e>o||e<-o),i.value=i.done?l:l+e,i},flipTarget:()=>{}}},keyframes:function({from:t=0,to:e=1,ease:n,offset:r,duration:o=300}){const s={done:!1,value:t},i=Array.isArray(e)?e:[t,e],a=function(t,e){return t.map(t=>t*e)}(r&&r.length===i.length?r:function(t){const e=t.length;return t.map((t,n)=>0!==n?n/(e-1):0)}(i),o);function u(){return ce(a,i,{ease:Array.isArray(n)?n:pe(i,n)})}let l=u();return{next:t=>(s.value=l(t),s.done=t>=o,s),flipTarget:()=>{i.reverse(),l=u()}}},spring:ge};function Ve(t,e,n=0){return t-e-n}const we=t=>{const e=({delta:e})=>t(e);return{start:()=>$t.update(e,!0),stop:()=>Kt.update(e)}};function Ae({from:t,autoplay:e=!0,driver:n=we,elapsed:r=0,repeat:o=0,repeatType:s="loop",repeatDelay:i=0,onPlay:a,onStop:u,onComplete:l,onRepeat:c,onUpdate:p,type:d="keyframes",...h}){var f,m;let v,g,y,{to:b}=h,V=0,w=h.duration,A=!1,S=!0;const M=be[Array.isArray(b)?"keyframes":d];(null===(m=(f=M).needsInterpolation)||void 0===m?void 0:m.call(f,t,b))&&(y=ce([0,100],[t,b],{clamp:!1}),t=0,b=100);const C=M({...h,from:t,to:b});function x(){V++,"reverse"===s?(S=V%2==0,r=function(t,e=0,n=0,r=!0){return r?Ve(e+-t,e,n):e-(t-e)+n}(r,w,i,S)):(r=Ve(r,w,i),"mirror"===s&&C.flipTarget()),A=!1,c&&c()}function E(t){if(S||(t=-t),r+=t,!A){const t=C.next(Math.max(0,r));g=t.value,y&&(g=y(g)),A=S?t.done:r<=0}null==p||p(g),A&&(0===V&&(w=void 0!==w?w:r),V<o?function(t,e,n,r){return r?t>=e+n:t<=-n}(r,w,i,S)&&x():(v.stop(),l&&l()))}return e&&(null==a||a(),v=n(E),v.start()),{stop:()=>{null==u||u(),v.stop()}}}function Se(t,e){return e?t*(1e3/e):0}function Me({ease:t,times:e,...n}){const r={...n};return e&&(r.offset=e),n.duration&&(r.duration=$(n.duration)),n.repeatDelay&&(r.repeatDelay=$(n.repeatDelay)),t&&(r.ease=(t=>Array.isArray(t)&&"number"!=typeof t[0])(t)?t.map(lt):lt(t)),"tween"===n.type&&(r.type="keyframes"),"spring"!==n.type&&(r.type="keyframes"),r}function Ce(t,e,n){return Array.isArray(e.to)&&void 0===t.duration&&(t.duration=.8),function(t){Array.isArray(t.to)&&null===t.to[0]&&(t.to=[...t.to],t.to[0]=t.from)}(e),function({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:s,repeatType:i,repeatDelay:a,from:u,...l}){return!!Object.keys(l).length}(t)||(t={...t,...Tt(n,e.to)}),{...e,...Me(t)}}function xe(t,e,n,r,o){const s=Pe(r,t)||{};let i=void 0!==s.from?s.from:e.get();const a=At(t,n);"none"===i&&a&&"string"==typeof n?i=Dt(t,n):Ee(i)&&"string"==typeof n?i=Te(n):!Array.isArray(n)&&Ee(n)&&"string"==typeof i&&(n=Te(i));return At(t,i)&&a&&!1!==s.type?function(){const r={from:i,to:n,velocity:e.getVelocity(),onComplete:o,onUpdate:t=>e.set(t)};return"inertia"===s.type||"decay"===s.type?function({from:t=0,velocity:e=0,min:n,max:r,power:o=.8,timeConstant:s=750,bounceStiffness:i=500,bounceDamping:a=10,restDelta:u=1,modifyTarget:l,driver:c,onUpdate:p,onComplete:d,onStop:h}){let f;function m(t){return void 0!==n&&t<n||void 0!==r&&t>r}function v(t){return void 0===n?r:void 0===r||Math.abs(n-t)<Math.abs(r-t)?n:r}function g(t){null==f||f.stop(),f=Ae({...t,driver:c,onUpdate:e=>{var n;null==p||p(e),null===(n=t.onUpdate)||void 0===n||n.call(t,e)},onComplete:d,onStop:h})}function y(t){g({type:"spring",stiffness:i,damping:a,restDelta:u,...t})}if(m(t))y({from:t,velocity:e,to:v(t)});else{let r=o*e+t;void 0!==l&&(r=l(r));const i=v(r),a=i===n?-1:1;let c,p;const d=t=>{c=p,p=t,e=Se(t-c,jt.delta),(1===a&&t>i||-1===a&&t<i)&&y({from:t,to:i,velocity:e})};g({type:"decay",from:t,velocity:e,timeConstant:s,power:o,restDelta:u,modifyTarget:l,onUpdate:m(r)?d:void 0})}return{stop:()=>null==f?void 0:f.stop()}}({...r,...s}):Ae({...Ce(s,r,t),onUpdate:t=>{r.onUpdate(t),s.onUpdate&&s.onUpdate(t)},onComplete:()=>{r.onComplete(),s.onComplete&&s.onComplete()}})}:function(){const t=g(n);return e.set(t),o(),s.onUpdate&&s.onUpdate(t),s.onComplete&&s.onComplete(),{stop:()=>{}}}}function Ee(t){return 0===t||"string"==typeof t&&0===parseFloat(t)&&-1===t.indexOf(" ")}function Te(t){return"number"==typeof t?0:Dt("",t)}function Pe(t,e){return t[e]||t.default||t}function Fe(t,e,n,r={}){return Rt&&(r={type:!1}),e.start(o=>{let s;const i=xe(t,e,n,r,o),a=function(t,e){const n=Pe(t,e)||{};return void 0!==n.delay?n.delay:void 0!==t.delay?t.delay:0}(r,t),u=()=>s=i();let l;return a?l=function(t,e){const n=performance.now(),r=({timestamp:o})=>{const s=o-n;s>=e&&(Kt.read(r),t(s-e))};return $t.read(r,!0),()=>Kt.read(r)}(u,$(a)):u(),()=>{l&&l(),s&&s.stop()}})}const Ie=t=>/^0[^.\s]+$/.test(t);class ke{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 r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](t,e,n);else for(let o=0;o<r;o++){const r=this.subscriptions[o];r&&r(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}class Oe{constructor(t){var e;this.version="7.7.3",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new ke,this.velocityUpdateSubscribers=new ke,this.renderSubscribers=new ke,this.canTrackVelocity=!1,this.updateAndNotify=(t,e=!0)=>{this.prev=this.current,this.current=t;const{delta:n,timestamp:r}=jt;this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,$t.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.updateSubscribers.notify(this.current),this.velocityUpdateSubscribers.getSize()&&this.velocityUpdateSubscribers.notify(this.getVelocity()),e&&this.renderSubscribers.notify(this.current)},this.scheduleVelocityCheck=()=>$t.postRender(this.velocityCheck),this.velocityCheck=({timestamp:t})=>{t!==this.lastUpdated&&(this.prev=this.current,this.velocityUpdateSubscribers.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e)))}onChange(t){return this.updateSubscribers.add(t)}clearListeners(){this.updateSubscribers.clear()}onRenderRequest(t){return t(this.get()),this.renderSubscribers.add(t)}attach(t){this.passiveEffect=t}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Se(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.stopAnimation=t(e)}).then(()=>this.clearAnimation())}stop(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()}isAnimating(){return!!this.stopAnimation}clearAnimation(){this.stopAnimation=null}destroy(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()}}function Ne(t){return new Oe(t)}const De=t=>e=>e.test(t),Re=[p,y,h,b,V,w,{test:t=>"auto"===t,parse:t=>t}],Ue=t=>Re.find(De(t)),Be=[...Re,vt,wt],je=t=>Be.find(De(t));function ze(t,e,n){const r=t.getProps();return A(r,e,void 0!==n?n:r.custom,function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.get()),e}(t),function(t){const e={};return t.values.forEach((t,n)=>e[n]=t.getVelocity()),e}(t))}function Le(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Ne(n))}function qe(t,e){if(!e)return;return(e[t]||e.default||e).from}function He(t){return Boolean(S(t)&&t.add)}function We(t,e,n={}){var r;const o=ze(t,e,n.custom);let{transition:s=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(s=n.transitionOverride);const i=o?()=>$e(t,o,n):()=>Promise.resolve(),a=(null===(r=t.variantChildren)||void 0===r?void 0:r.size)?(r=0)=>{const{delayChildren:o=0,staggerChildren:i,staggerDirection:a}=s;return function(t,e,n=0,r=0,o=1,s){const i=[],a=(t.variantChildren.size-1)*r,u=1===o?(t=0)=>t*r:(t=0)=>a-t*r;return Array.from(t.variantChildren).sort(Ke).forEach((t,r)=>{i.push(We(t,e,{...s,delay:n+u(r)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(i)}(t,e,o+r,i,a,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[t,e]="beforeChildren"===u?[i,a]:[a,i];return t().then(e)}return Promise.all([i(),a(n.delay)])}function $e(t,e,{delay:n=0,transitionOverride:r,type:o}={}){var s;let{transition:i=t.getDefaultTransition(),transitionEnd:a,...u}=t.makeTargetAnimatable(e);const l=t.getValue("willChange");r&&(i=r);const c=[],p=o&&(null===(s=t.animationState)||void 0===s?void 0:s.getState()[o]);for(const e in u){const r=t.getValue(e),o=u[e];if(!r||void 0===o||p&&Ye(p,e))continue;let s={delay:n,...i};t.shouldReduceMotion&&M.has(e)&&(s={...s,type:!1,delay:0});let a=Fe(e,r,o,s);He(l)&&(l.add(e),a=a.then(()=>l.remove(e))),c.push(a)}return Promise.all(c).then(()=>{a&&function(t,e){const n=ze(t,e);let{transitionEnd:r={},transition:o={},...s}=n?t.makeTargetAnimatable(n,!1):{};s={...s,...r};for(const e in s){Le(t,e,g(s[e]))}}(t,a)})}function Ke(t,e){return t.sortNodePosition(e)}function Ye({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&!0!==e[n];return e[n]=!1,r}var Xe;!function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"}(Xe||(Xe={}));const Ge=[Xe.Animate,Xe.InView,Xe.Focus,Xe.Hover,Xe.Tap,Xe.Drag,Xe.Exit],Ze=[...Ge].reverse(),Je=Ge.length;function _e(t){return e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){let r;if(t.notify("AnimationStart",e),Array.isArray(e)){const o=e.map(e=>We(t,e,n));r=Promise.all(o)}else if("string"==typeof e)r=We(t,e,n);else{const o="function"==typeof e?ze(t,e,n.custom):e;r=$e(t,o,n)}return r.then(()=>t.notify("AnimationComplete",e))}(t,e,n)))}function Qe(t){let e=_e(t);const n={[Xe.Animate]:en(!0),[Xe.InView]:en(),[Xe.Hover]:en(),[Xe.Tap]:en(),[Xe.Drag]:en(),[Xe.Focus]:en(),[Xe.Exit]:en()};let r=!0;const o=(e,n)=>{const r=ze(t,n);if(r){const{transition:t,transitionEnd:n,...o}=r;e={...e,...o,...n}}return e};function s(s,i){const a=t.getProps(),u=t.getVariantContext(!0)||{},l=[],c=new Set;let p={},d=1/0;for(let e=0;e<Je;e++){const h=Ze[e],f=n[h],v=void 0!==a[h]?a[h]:u[h],g=x(v),y=h===i?f.isActive:null;!1===y&&(d=e);let b=v===u[h]&&v!==a[h]&&g;if(b&&r&&t.manuallyAnimateOnMount&&(b=!1),f.protectedKeys={...p},!f.isActive&&null===y||!v&&!f.prevProp||C(v)||"boolean"==typeof v)continue;const V=tn(f.prevProp,v);let w=V||h===i&&f.isActive&&!b&&g||e>d&&g;const A=Array.isArray(v)?v:[v];let S=A.reduce(o,{});!1===y&&(S={});const{prevResolvedValues:M={}}=f,E={...M,...S},T=t=>{w=!0,c.delete(t),f.needsAnimating[t]=!0};for(const t in E){const e=S[t],n=M[t];p.hasOwnProperty(t)||(e!==n?m(e)&&m(n)?!W(e,n)||V?T(t):f.protectedKeys[t]=!0:void 0!==e?T(t):c.add(t):void 0!==e&&c.has(t)?T(t):f.protectedKeys[t]=!0)}f.prevProp=v,f.prevResolvedValues=S,f.isActive&&(p={...p,...S}),r&&t.blockInitialAnimation&&(w=!1),w&&!b&&l.push(...A.map(t=>({animation:t,options:{type:h,...s}})))}if(c.size){const e={};c.forEach(n=>{const r=t.getBaseTarget(n);void 0!==r&&(e[n]=r)}),l.push({animation:e})}let h=Boolean(l.length);return r&&!1===a.initial&&!t.manuallyAnimateOnMount&&(h=!1),r=!1,h?e(l):Promise.resolve()}return{animateChanges:s,setActive:function(e,r,o){var i;if(n[e].isActive===r)return Promise.resolve();null===(i=t.variantChildren)||void 0===i||i.forEach(t=>{var n;return null===(n=t.animationState)||void 0===n?void 0:n.setActive(e,r)}),n[e].isActive=r;const a=s(o,e);for(const t in n)n[t].protectedKeys={};return a},setAnimateFunction:function(n){e=n(t)},getState:()=>n}}function tn(t,e){return"string"==typeof e?e!==t:!!Array.isArray(e)&&!W(e,t)}function en(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}const nn=t=>e=>(t(e),null),rn={animation:nn(({visualElement:t,animate:e})=>{t.animationState||(t.animationState=Qe(t)),C(e)&&n(()=>e.subscribe(t),[e])}),exit:nn(r=>{const{custom:o,visualElement:i}=r,[a,u]=function(){const r=t(s);if(null===r)return[!0,null];const{isPresent:o,onExitComplete:i,register:a}=r,u=e();return n(()=>a(u),[]),!o&&i?[!1,()=>i&&i(u)]:[!0]}(),l=t(s);n(()=>{i.isPresent=a;const t=i.animationState&&i.animationState.setActive(Xe.Exit,!a,{custom:l&&l.custom||o});t&&!a&&t.then(u)},[a])})};function on(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function sn(t,e,r,o){n(()=>{const n=t.current;if(r&&n)return on(n,e,r,o)},[t,e,r,o])}function an(t){return!!t.touches}const un={pageX:0,pageY:0};function ln(t,e="page"){const n=t.touches[0]||t.changedTouches[0]||un;return{x:n[e+"X"],y:n[e+"Y"]}}function cn(t,e="page"){return{x:t[e+"X"],y:t[e+"Y"]}}const pn=(t,e=!1)=>{const n=e=>t(e,function(t,e="page"){return{point:an(t)?ln(t,e):cn(t,e)}}(e));return e?(r=n,t=>{const e=t instanceof MouseEvent;(!e||e&&0===t.button)&&r(t)}):n;var r},dn={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},hn={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function fn(t){return E&&null===window.onpointerdown?t:E&&null===window.ontouchstart?hn[t]:E&&null===window.onmousedown?dn[t]:t}function mn(t,e,n,r){return on(t,fn(e),pn(n,"pointerdown"===e),r)}function vn(t,e,n,r){return sn(t,fn(e),n&&pn(n,"pointerdown"===e),r)}function gn(t){let e=null;return()=>{const n=()=>{e=null};return null===e&&(e=t,n)}}const yn=gn("dragHorizontal"),bn=gn("dragVertical");function Vn(){const t=function(t){let e=!1;if("y"===t)e=bn();else if("x"===t)e=yn();else{const t=yn(),n=bn();t&&n?e=()=>{t(),n()}:(t&&t(),n&&n())}return e}(!0);return!t||(t(),!1)}function wn(t,e,n){return(r,o)=>{(function(t){return"undefined"!=typeof PointerEvent&&t instanceof PointerEvent?!("mouse"!==t.pointerType):t instanceof MouseEvent})(r)&&!Vn()&&(t.animationState&&t.animationState.setActive(Xe.Hover,e),n&&n(r,o))}}const An=(t,e)=>!!e&&(t===e||An(t,e.parentElement));const Sn=("undefined"==typeof process||process.env,"production"),Mn=new Set;const Cn=new WeakMap,xn=new WeakMap,En=t=>{const e=Cn.get(t.target);e&&e(t)},Tn=t=>{t.forEach(En)};function Pn(t,e,n){const r=function({root:t,...e}){const n=t||document;xn.has(n)||xn.set(n,{});const r=xn.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(Tn,{root:t,...e})),r[o]}(e);return Cn.set(t,n),r.observe(t),()=>{Cn.delete(t),r.unobserve(t)}}const Fn={some:0,all:1};function In(t,e,r,{root:o,margin:s,amount:i="some",once:a}){n(()=>{if(!t||!r.current)return;const n={root:null==o?void 0:o.current,rootMargin:s,threshold:"number"==typeof i?i:Fn[i]};return Pn(r.current,n,t=>{const{isIntersecting:n}=t;if(e.isInView===n)return;if(e.isInView=n,a&&!n&&e.hasEnteredView)return;n&&(e.hasEnteredView=!0),r.animationState&&r.animationState.setActive(Xe.InView,n);const o=r.getProps(),s=n?o.onViewportEnter:o.onViewportLeave;s&&s(t)})},[t,o,s,i])}function kn(t,e,r,{fallback:o=!0}){n(()=>{var n,s;t&&o&&("production"!==Sn&&(n="IntersectionObserver not available on this device. whileInView animations will trigger on mount.",!1||Mn.has(n)||(console.warn(n),s&&console.warn(s),Mn.add(n))),requestAnimationFrame(()=>{e.hasEnteredView=!0;const{onViewportEnter:t}=r.getProps();t&&t(null),r.animationState&&r.animationState.setActive(Xe.InView,!0)}))},[t])}const On={inView:nn((function({visualElement:t,whileInView:e,onViewportEnter:n,onViewportLeave:o,viewport:s={}}){const i=r({hasEnteredView:!1,isInView:!1});let a=Boolean(e||n||o);s.once&&i.current.hasEnteredView&&(a=!1),("undefined"==typeof IntersectionObserver?kn:In)(a,i.current,t,s)})),tap:nn((function({onTap:t,onTapStart:e,onTapCancel:o,whileTap:s,visualElement:i}){const a=t||e||o||s,u=r(!1),l=r(null),c={passive:!(e||t||o||m)};function p(){l.current&&l.current(),l.current=null}function d(){return p(),u.current=!1,i.animationState&&i.animationState.setActive(Xe.Tap,!1),!Vn()}function h(e,n){d()&&(An(i.current,e.target)?t&&t(e,n):o&&o(e,n))}function f(t,e){d()&&o&&o(t,e)}function m(t,n){p(),u.current||(u.current=!0,l.current=re(mn(window,"pointerup",h,c),mn(window,"pointercancel",f,c)),i.animationState&&i.animationState.setActive(Xe.Tap,!0),e&&e(t,n))}var v;vn(i,"pointerdown",a?m:void 0,c),v=p,n(()=>()=>v(),[])})),focus:nn((function({whileFocus:t,visualElement:e}){const{animationState:n}=e;sn(e,"focus",t?()=>{n&&n.setActive(Xe.Focus,!0)}:void 0),sn(e,"blur",t?()=>{n&&n.setActive(Xe.Focus,!1)}:void 0)})),hover:nn((function({onHoverStart:t,onHoverEnd:e,whileHover:n,visualElement:r}){vn(r,"pointerenter",t||n?wn(r,!0,t):void 0,{passive:!t}),vn(r,"pointerleave",e||n?wn(r,!1,e):void 0,{passive:!e})}))};function Nn(t){return"string"==typeof t&&t.startsWith("var(--")}const Dn=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Rn(t,e,n=1){const[r,o]=function(t){const e=Dn.exec(t);if(!e)return[,];const[,n,r]=e;return[n,r]}(t);if(!r)return;const s=window.getComputedStyle(e).getPropertyValue(r);return s?s.trim():Nn(o)?Rn(o,e,n+1):o}const Un=new Set(["width","height","top","left","right","bottom","x","y"]),Bn=t=>Un.has(t),jn=(t,e)=>{t.set(e,!1),t.set(e)},zn=t=>t===p||t===y;var Ln;!function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"}(Ln||(Ln={}));const qn=(t,e)=>parseFloat(t.split(", ")[e]),Hn=(t,e)=>(n,{transform:r})=>{if("none"===r||!r)return 0;const o=r.match(/^matrix3d\((.+)\)$/);if(o)return qn(o[1],e);{const e=r.match(/^matrix\((.+)\)$/);return e?qn(e[1],t):0}},Wn=new Set(["x","y","z"]),$n=T.filter(t=>!Wn.has(t));const Kn={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:Hn(4,13),y:Hn(5,14)},Yn=(t,e,n={},r={})=>{e={...e},r={...r};const o=Object.keys(e).filter(Bn);let s=[],i=!1;const a=[];if(o.forEach(o=>{const u=t.getValue(o);if(!t.hasValue(o))return;let l=n[o],c=Ue(l);const p=e[o];let d;if(m(p)){const t=p.length,e=null===p[0]?1:0;l=p[e],c=Ue(l);for(let n=e;n<t;n++)d?Ue(p[n]):d=Ue(p[n])}else d=Ue(p);if(c!==d)if(zn(c)&&zn(d)){const t=u.get();"string"==typeof t&&u.set(parseFloat(t)),"string"==typeof p?e[o]=parseFloat(p):Array.isArray(p)&&d===y&&(e[o]=p.map(parseFloat))}else(null==c?void 0:c.transform)&&(null==d?void 0:d.transform)&&(0===l||0===p)?0===l?u.set(d.transform(l)):e[o]=c.transform(p):(i||(s=function(t){const e=[];return $n.forEach(n=>{const r=t.getValue(n);void 0!==r&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e.length&&t.render(),e}(t),i=!0),a.push(o),r[o]=void 0!==r[o]?r[o]:e[o],jn(u,p))}),a.length){const n=a.indexOf("height")>=0?window.pageYOffset:null,o=((t,e,n)=>{const r=e.measureViewportBox(),o=e.current,s=getComputedStyle(o),{display:i}=s,a={};"none"===i&&e.setStaticValue("display",t.display||"block"),n.forEach(t=>{a[t]=Kn[t](r,s)}),e.render();const u=e.measureViewportBox();return n.forEach(n=>{const r=e.getValue(n);jn(r,a[n]),t[n]=Kn[n](u,s)}),t})(e,t,a);return s.length&&s.forEach(([e,n])=>{t.getValue(e).set(n)}),t.render(),E&&null!==n&&window.scrollTo({top:n}),{target:o,transitionEnd:r}}return{target:e,transitionEnd:r}};function Xn(t,e,n,r){return(t=>Object.keys(t).some(Bn))(e)?Yn(t,e,n,r):{target:e,transitionEnd:r}}const Gn=(t,e,n,r)=>{const o=function(t,{...e},n){const r=t.current;if(!(r instanceof Element))return{target:e,transitionEnd:n};n&&(n={...n}),t.values.forEach(t=>{const e=t.get();if(!Nn(e))return;const n=Rn(e,r);n&&t.set(n)});for(const t in e){const o=e[t];if(!Nn(o))continue;const s=Rn(o,r);s&&(e[t]=s,n&&void 0===n[t]&&(n[t]=o))}return{target:e,transitionEnd:n}}(t,e,r);return Xn(t,e=o.target,n,r=o.transitionEnd)},Zn={current:null},Jn={current:!1};const _n=Object.keys(P),Qn=_n.length,tr=["AnimationStart","AnimationComplete","Update","Unmount","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];const er=["initial",...Ge],nr=er.length;class rr extends class{constructor({parent:t,props:e,reducedMotionConfig:n,visualState:r},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.isPresent=!0,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.render(this.render,!1,!0);const{latestValues:s,renderState:i}=r;this.latestValues=s,this.baseTarget={...s},this.initialValues=e.initial?{...s}:{},this.renderState=i,this.parent=t,this.props=e,this.depth=t?t.depth+1:0,this.reducedMotionConfig=n,this.options=o,this.isControllingVariants=F(e),this.isVariantNode=I(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:a,...u}=this.scrapeMotionValuesFromProps(e);for(const t in u){const e=u[t];void 0!==s[t]&&S(e)&&(e.set(s[t],!1),He(a)&&a.add(t))}}scrapeMotionValuesFromProps(t){return{}}mount(t){var e;this.current=t,this.projection&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=null===(e=this.parent)||void 0===e?void 0:e.addVariantChild(this)),this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),Jn.current||function(){if(Jn.current=!0,E)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Zn.current=t.matches;t.addListener(e),e()}else Zn.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||Zn.current),this.parent&&this.parent.children.add(this),this.setProps(this.props)}unmount(){var t,e,n;null===(t=this.projection)||void 0===t||t.unmount(),Kt.update(this.notifyUpdate),Kt.render(this.render),this.valueSubscriptions.forEach(t=>t()),null===(e=this.removeFromVariantTree)||void 0===e||e.call(this),null===(n=this.parent)||void 0===n||n.children.delete(this);for(const t in this.events)this.events[t].clear();this.current=null}bindToMotionValue(t,e){const n=M.has(t),r=e.onChange(e=>{this.latestValues[t]=e,this.props.onUpdate&&$t.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),o=e.onRenderRequest(this.scheduleRender);this.valueSubscriptions.set(t,()=>{r(),o()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}loadFeatures(t,e,n,r,s,i){const a=[];for(let e=0;e<Qn;e++){const n=_n[e],{isEnabled:r,Component:s}=P[n];r(t)&&s&&a.push(o(s,{key:n,...t,visualElement:this}))}if(!this.projection&&s){this.projection=new s(r,this.latestValues,this.parent&&this.parent.projection);const{layoutId:e,layout:n,drag:o,dragConstraints:a,layoutScroll:u}=t;this.projection.setOptions({layoutId:e,layout:n,alwaysMeasureLayout:Boolean(o)||a&&k(a),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:"string"==typeof n?n:"both",initialPromotionConfig:i,layoutScroll:u})}return a}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)}setProps(t){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.props=t;for(let e=0;e<tr.length;e++){const n=tr[e];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);const r=t["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(t,e,n){const{willChange:r}=e;for(const o in e){const s=e[o],i=n[o];if(S(s))t.addValue(o,s),He(r)&&r.add(o);else if(S(i))t.addValue(o,Ne(s)),He(r)&&r.remove(o);else if(i!==s)if(t.hasValue(o)){const e=t.getValue(o);!e.hasAnimated&&e.set(s)}else{const e=t.getStaticValue(o);t.addValue(o,Ne(void 0!==e?e:s))}}for(const r in n)void 0===e[r]&&t.removeValue(r);return e}(this,this.scrapeMotionValuesFromProps(t),this.prevMotionValues)}getProps(){return this.props}getVariant(t){var e;return null===(e=this.props.variants)||void 0===e?void 0:e[t]}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){var t;return this.isVariantNode?this:null===(t=this.parent)||void 0===t?void 0:t.getClosestVariantNode()}getVariantContext(t=!1){var e,n;if(t)return null===(e=this.parent)||void 0===e?void 0:e.getVariantContext();if(!this.isControllingVariants){const t=(null===(n=this.parent)||void 0===n?void 0:n.getVariantContext())||{};return void 0!==this.props.initial&&(t.initial=this.props.initial),t}const r={};for(let t=0;t<nr;t++){const e=er[t],n=this.props[e];(x(n)||!1===n)&&(r[e]=n)}return r}addVariantChild(t){var e;const n=this.getClosestVariantNode();if(n)return null===(e=n.variantChildren)||void 0===e||e.add(t),()=>n.variantChildren.delete(t)}addValue(t,e){this.hasValue(t)&&this.removeValue(t),this.values.set(t,e),this.latestValues[t]=e.get(),this.bindToMotionValue(t,e)}removeValue(t){var e;this.values.delete(t),null===(e=this.valueSubscriptions.get(t))||void 0===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=Ne(e),this.addValue(t,n)),n}readValue(t){return void 0===this.latestValues[t]&&this.current?this.readValueFromInstance(this.current,t,this.options):this.latestValues[t]}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){var e;const{initial:n}=this.props,r="string"==typeof n||"object"==typeof n?null===(e=A(this.props,n))||void 0===e?void 0:e[t]:void 0;if(n&&void 0!==r)return r;const o=this.getBaseTargetFromProps(this.props,t);return void 0===o||S(o)?void 0!==this.initialValues[t]&&void 0===r?void 0:this.baseTarget[t]:o}on(t,e){return this.events[t]||(this.events[t]=new ke),this.events[t].add(e)}notify(t,...e){var n;null===(n=this.events[t])||void 0===n||n.notify(...e)}}{sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){var n;return null===(n=t.style)||void 0===n?void 0:n[e]}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:e,...n},{transformValues:r},o){let s=function(t,e,n){var r;const o={};for(const s in t){const t=qe(s,e);o[s]=void 0!==t?t:null===(r=n.getValue(s))||void 0===r?void 0:r.get()}return o}(n,t||{},this);if(r&&(e&&(e=r(e)),n&&(n=r(n)),s&&(s=r(s))),o){!function(t,e,n){var r,o;const s=Object.keys(e).filter(e=>!t.hasValue(e)),i=s.length;if(i)for(let a=0;a<i;a++){const i=s[a],u=e[i];let l=null;Array.isArray(u)&&(l=u[0]),null===l&&(l=null!==(o=null!==(r=n[i])&&void 0!==r?r:t.readValue(i))&&void 0!==o?o:e[i]),null!=l&&("string"==typeof l&&(/^\-?\d*\.?\d+$/.test(l)||Ie(l))?l=parseFloat(l):!je(l)&&wt.test(u)&&(l=Dt(i,u)),t.addValue(i,Ne(l)),void 0===n[i]&&(n[i]=l),null!==l&&t.setBaseTarget(i,l))}}(this,n,s);const t=Gn(this,n,s,e);e=t.transitionEnd,n=t.target}return{transition:t,transitionEnd:e,...n}}}class or extends rr{readValueFromInstance(t,e){if(M.has(e)){const t=Nt(e);return t&&t.default||0}{const r=(n=t,window.getComputedStyle(n)),o=(O(e)?r.getPropertyValue(e):r[e])||0;return"string"==typeof o?o.trim():o}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return function(t,e){return function({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(t.getBoundingClientRect(),e))}(t,e)}build(t,e,n,r){N(t,e,n,r.transformTemplate)}scrapeMotionValuesFromProps(t){return D(t)}renderInstance(t,e,n,r){R(t,e,n,r)}}class sr extends rr{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){var n;return M.has(e)?(null===(n=Nt(e))||void 0===n?void 0:n.default)||0:(e=U.has(e)?e:B(e),t.getAttribute(e))}measureInstanceViewportBox(){return{x:{min:0,max:0},y:{min:0,max:0}}}scrapeMotionValuesFromProps(t){return j(t)}build(t,e,n,r){z(t,e,n,this.isSVGTag,r.transformTemplate)}renderInstance(t,e,n,r){L(t,e,n,r)}mount(t){this.isSVGTag=q(t.tagName),super.mount(t)}}const ir={renderer:(t,e)=>H(t)?new sr(e,{enableHardwareAcceleration:!1}):new or(e,{enableHardwareAcceleration:!0}),...rn,...On};export{ir as domAnimation};
|