UNPKG

react-night-toggle

Version:

A modern dark mode toggle for ReactJs with smooth animations.

1 lines 118 kB
"use client";var Na=(t=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(t,{get:(e,r)=>(typeof require!="undefined"?require:e)[r]}):t)(function(t){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});import{useEffect as Ec}from"react";import{createContext as Ga}from"react";var nr=Ga({});import{useRef as Ua}from"react";function Ci(t){let e=Ua(null);return e.current===null&&(e.current=t()),e.current}import{useLayoutEffect as Ka,useEffect as Wa}from"react";var Qt=typeof window!="undefined";var Di=Qt?Ka:Wa;import{createContext as za}from"react";var te=za(null);function Lt(t,e){t.indexOf(e)===-1&&t.push(e)}function Bt(t,e){let r=t.indexOf(e);r>-1&&t.splice(r,1)}var O=(t,e,r)=>r>e?e:r<t?t:r;function Pe(t,e){return e?`${t}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${e}`:t}var Q=()=>{},G=()=>{};process.env.NODE_ENV!=="production"&&(Q=(t,e,r)=>{!t&&typeof console!="undefined"&&console.warn(Pe(e,r))},G=(t,e,r)=>{if(!t)throw new Error(Pe(e,r))});var K={};var Ae=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function we(t){return typeof t=="object"&&t!==null}var Me=t=>/^0[^.\s]+$/u.test(t);function It(t){let e;return()=>(e===void 0&&(e=t()),e)}var R=t=>t;var $a=(t,e)=>r=>e(t(r)),rt=(...t)=>t.reduce($a);var st=(t,e,r)=>{let o=e-t;return o===0?1:(r-t)/o};var ct=class{constructor(){this.subscriptions=[]}add(e){return Lt(this.subscriptions,e),()=>Bt(this.subscriptions,e)}notify(e,r,o){let i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,r,o);else for(let s=0;s<i;s++){let n=this.subscriptions[s];n&&n(e,r,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}};var k=t=>t*1e3,U=t=>t/1e3;function Ce(t,e){return e?t*(1e3/e):0}var Ei=new Set;function kt(t,e,r){t||Ei.has(e)||(console.warn(Pe(e,r)),Ei.add(e))}var Ri=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,Ha=1e-7,_a=12;function Ya(t,e,r,o,i){let s,n,a=0;do n=e+(r-e)/2,s=Ri(n,o,i)-t,s>0?r=n:e=n;while(Math.abs(s)>Ha&&++a<_a);return n}function Tt(t,e,r,o){if(t===e&&r===o)return R;let i=s=>Ya(s,0,1,t,r);return s=>s===0||s===1?s:Ri(i(s),e,o)}var sr=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2;var ar=t=>e=>1-t(1-e);var lr=Tt(.33,1.53,.69,.99),ee=ar(lr),De=sr(ee);var Ee=t=>(t*=2)<1?.5*ee(t):.5*(2-Math.pow(2,-10*(t-1)));var Re=t=>1-Math.sin(Math.acos(t)),Le=ar(Re),Be=sr(Re);var vo=Tt(.42,0,1,1),To=Tt(0,0,.58,1),Ie=Tt(.42,0,.58,1);var Vo=t=>Array.isArray(t)&&typeof t[0]!="number";var ke=t=>Array.isArray(t)&&typeof t[0]=="number";var Li={linear:R,easeIn:vo,easeInOut:Ie,easeOut:To,circIn:Re,circInOut:Be,circOut:Le,backIn:ee,backInOut:De,backOut:lr,anticipate:Ee},Xa=t=>typeof t=="string",mr=t=>{if(ke(t)){G(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[e,r,o,i]=t;return Tt(e,r,o,i)}else if(Xa(t))return G(Li[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),Li[t];return t};var Fe=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];var H={value:null,addProjectionMetrics:null};function Bi(t,e){let r=new Set,o=new Set,i=!1,s=!1,n=new WeakSet,a={delta:0,timestamp:0,isProcessing:!1},l=0;function c(u){n.has(u)&&(m.schedule(u),t()),l++,u(a)}let m={schedule:(u,f=!1,p=!1)=>{let d=p&&i?r:o;return f&&n.add(u),d.has(u)||d.add(u),u},cancel:u=>{o.delete(u),n.delete(u)},process:u=>{if(a=u,i){s=!0;return}i=!0,[r,o]=[o,r],r.forEach(c),e&&H.value&&H.value.frameloop[e].push(l),l=0,r.clear(),i=!1,s&&(s=!1,m.process(u))}};return m}var qa=40;function cr(t,e){let r=!1,o=!0,i={delta:0,timestamp:0,isProcessing:!1},s=()=>r=!0,n=Fe.reduce((x,A)=>(x[A]=Bi(s,e?A:void 0),x),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:m,update:u,preRender:f,render:p,postRender:h}=n,d=()=>{let x=K.useManualTiming?i.timestamp:performance.now();r=!1,K.useManualTiming||(i.delta=o?1e3/60:Math.max(Math.min(x-i.timestamp,qa),1)),i.timestamp=x,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),m.process(i),u.process(i),f.process(i),p.process(i),h.process(i),i.isProcessing=!1,r&&e&&(o=!1,t(d))},y=()=>{r=!0,o=!0,i.isProcessing||t(d)};return{schedule:Fe.reduce((x,A)=>{let V=n[A];return x[A]=(w,I=!1,b=!1)=>(r||y(),V.schedule(w,I,b)),x},{}),cancel:x=>{for(let A=0;A<Fe.length;A++)n[Fe[A]].cancel(x)},state:i,steps:n}}var{schedule:S,cancel:_,state:L,steps:Oe}=cr(typeof requestAnimationFrame!="undefined"?requestAnimationFrame:R,!0);var ur;function Za(){ur=void 0}var B={now:()=>(ur===void 0&&B.set(L.isProcessing||K.useManualTiming?L.timestamp:performance.now()),ur),set:t=>{ur=t,queueMicrotask(Za)}};var ot={layout:0,mainThread:0,waapi:0};var Ii=t=>e=>typeof e=="string"&&e.startsWith(t),Ft=Ii("--"),Ja=Ii("var(--"),Ot=t=>Ja(t)?Qa.test(t.split("/*")[0].trim()):!1,Qa=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;var at={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ut={...at,transform:t=>O(0,1,t)},je={...at,default:1};var Vt=t=>Math.round(t*1e5)/1e5;var re=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ki(t){return t==null}var Fi=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;var oe=(t,e)=>r=>!!(typeof r=="string"&&Fi.test(r)&&r.startsWith(t)||e&&!ki(r)&&Object.prototype.hasOwnProperty.call(r,e)),fr=(t,e,r)=>o=>{if(typeof o!="string")return o;let[i,s,n,a]=o.match(re);return{[t]:parseFloat(i),[e]:parseFloat(s),[r]:parseFloat(n),alpha:a!==void 0?parseFloat(a):1}};var tl=t=>O(0,255,t),So={...at,transform:t=>Math.round(tl(t))},lt={test:oe("rgb","red"),parse:fr("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:o=1})=>"rgba("+So.transform(t)+", "+So.transform(e)+", "+So.transform(r)+", "+Vt(ut.transform(o))+")"};function el(t){let e="",r="",o="",i="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),o=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),o=t.substring(3,4),i=t.substring(4,5),e+=e,r+=r,o+=o,i+=i),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(o,16),alpha:i?parseInt(i,16)/255:1}}var Ne={test:oe("#"),parse:el,transform:lt.transform};var Ge=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),it=Ge("deg"),W=Ge("%"),v=Ge("px"),bo=Ge("vh"),Po=Ge("vw"),pr={...W,parse:t=>W.parse(t)/100,transform:t=>W.transform(t*100)};var St={test:oe("hsl","hue"),parse:fr("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:o=1})=>"hsla("+Math.round(t)+", "+W.transform(Vt(e))+", "+W.transform(Vt(r))+", "+Vt(ut.transform(o))+")"};var E={test:t=>lt.test(t)||Ne.test(t)||St.test(t),parse:t=>lt.test(t)?lt.parse(t):St.test(t)?St.parse(t):Ne.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?lt.transform(t):St.transform(t),getAnimatableNone:t=>{let e=E.parse(t);return e.alpha=0,E.transform(e)}};var Oi=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function rl(t){var e,r;return isNaN(t)&&typeof t=="string"&&(((e=t.match(re))==null?void 0:e.length)||0)+(((r=t.match(Oi))==null?void 0:r.length)||0)>0}var Ni="number",Gi="color",ol="var",il="var(",ji="${}",nl=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function bt(t){let e=t.toString(),r=[],o={color:[],number:[],var:[]},i=[],s=0,a=e.replace(nl,l=>(E.test(l)?(o.color.push(s),i.push(Gi),r.push(E.parse(l))):l.startsWith(il)?(o.var.push(s),i.push(ol),r.push(l)):(o.number.push(s),i.push(Ni),r.push(parseFloat(l))),++s,ji)).split(ji);return{values:r,split:a,indexes:o,types:i}}function Ui(t){return bt(t).values}function Ki(t){let{split:e,types:r}=bt(t),o=e.length;return i=>{let s="";for(let n=0;n<o;n++)if(s+=e[n],i[n]!==void 0){let a=r[n];a===Ni?s+=Vt(i[n]):a===Gi?s+=E.transform(i[n]):s+=i[n]}return s}}var sl=t=>typeof t=="number"?0:E.test(t)?E.getAnimatableNone(t):t;function al(t){let e=Ui(t);return Ki(t)(e.map(sl))}var z={test:rl,parse:Ui,createTransformer:Ki,getAnimatableNone:al};function Ao(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Wi({hue:t,saturation:e,lightness:r,alpha:o}){t/=360,e/=100,r/=100;let i=0,s=0,n=0;if(!e)i=s=n=r;else{let a=r<.5?r*(1+e):r+e-r*e,l=2*r-a;i=Ao(l,a,t+1/3),s=Ao(l,a,t),n=Ao(l,a,t-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(n*255),alpha:o}}function ie(t,e){return r=>r>0?e:t}var P=(t,e,r)=>t+(e-t)*r;var wo=(t,e,r)=>{let o=t*t,i=r*(e*e-o)+o;return i<0?0:Math.sqrt(i)},ll=[Ne,lt,St],ml=t=>ll.find(e=>e.test(t));function zi(t){let e=ml(t);if(Q(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let r=e.parse(t);return e===St&&(r=Wi(r)),r}var Mo=(t,e)=>{let r=zi(t),o=zi(e);if(!r||!o)return ie(t,e);let i={...r};return s=>(i.red=wo(r.red,o.red,s),i.green=wo(r.green,o.green,s),i.blue=wo(r.blue,o.blue,s),i.alpha=P(r.alpha,o.alpha,s),lt.transform(i))};var hr=new Set(["none","hidden"]);function $i(t,e){return hr.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function cl(t,e){return r=>P(t,e,r)}function dr(t){return typeof t=="number"?cl:typeof t=="string"?Ot(t)?ie:E.test(t)?Mo:pl:Array.isArray(t)?Hi:typeof t=="object"?E.test(t)?Mo:ul:ie}function Hi(t,e){let r=[...t],o=r.length,i=t.map((s,n)=>dr(s)(s,e[n]));return s=>{for(let n=0;n<o;n++)r[n]=i[n](s);return r}}function ul(t,e){let r={...t,...e},o={};for(let i in r)t[i]!==void 0&&e[i]!==void 0&&(o[i]=dr(t[i])(t[i],e[i]));return i=>{for(let s in o)r[s]=o[s](i);return r}}function fl(t,e){var i;let r=[],o={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){let n=e.types[s],a=t.indexes[n][o[n]],l=(i=t.values[a])!=null?i:0;r[s]=l,o[n]++}return r}var pl=(t,e)=>{let r=z.createTransformer(e),o=bt(t),i=bt(e);return o.indexes.var.length===i.indexes.var.length&&o.indexes.color.length===i.indexes.color.length&&o.indexes.number.length>=i.indexes.number.length?hr.has(t)&&!i.values.length||hr.has(e)&&!o.values.length?$i(t,e):rt(Hi(fl(o,i),i.values),r):(Q(!0,`Complex values '${t}' and '${e}' 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.`,"complex-values-different"),ie(t,e))};function gr(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?P(t,e,r):dr(t)(t,e)}var _i=t=>{let e=({timestamp:r})=>t(r);return{start:(r=!0)=>S.update(e,r),stop:()=>_(e),now:()=>L.isProcessing?L.timestamp:B.now()}};var yr=(t,e,r=10)=>{let o="",i=Math.max(Math.round(e/r),2);for(let s=0;s<i;s++)o+=Math.round(t(s/(i-1))*1e4)/1e4+", ";return`linear(${o.substring(0,o.length-2)})`};function ne(t){let e=0,r=50,o=t.next(e);for(;!o.done&&e<2e4;)e+=r,o=t.next(e);return e>=2e4?1/0:e}function Yi(t,e=100,r){let o=r({...t,keyframes:[0,e]}),i=Math.min(ne(o),2e4);return{type:"keyframes",ease:s=>o.next(i*s).value/e,duration:U(i)}}var hl=5;function xr(t,e,r){let o=Math.max(e-hl,0);return Ce(r-t(o),e-o)}var C={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};var Do=.001;function Xi({duration:t=C.duration,bounce:e=C.bounce,velocity:r=C.velocity,mass:o=C.mass}){let i,s;Q(t<=k(C.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let n=1-e;n=O(C.minDamping,C.maxDamping,n),t=O(C.minDuration,C.maxDuration,U(t)),n<1?(i=c=>{let m=c*n,u=m*t,f=m-r,p=vr(c,n),h=Math.exp(-u);return Do-f/p*h},s=c=>{let u=c*n*t,f=u*r+r,p=Math.pow(n,2)*Math.pow(c,2)*t,h=Math.exp(-u),d=vr(Math.pow(c,2),n);return(-i(c)+Do>0?-1:1)*((f-p)*h)/d}):(i=c=>{let m=Math.exp(-c*t),u=(c-r)*t+1;return-Do+m*u},s=c=>{let m=Math.exp(-c*t),u=(r-c)*(t*t);return m*u});let a=5/t,l=gl(i,s,a);if(t=k(t),isNaN(l))return{stiffness:C.stiffness,damping:C.damping,duration:t};{let c=Math.pow(l,2)*o;return{stiffness:c,damping:n*2*Math.sqrt(o*c),duration:t}}}var dl=12;function gl(t,e,r){let o=r;for(let i=1;i<dl;i++)o=o-t(o)/e(o);return o}function vr(t,e){return t*Math.sqrt(1-e*e)}var yl=["duration","bounce"],xl=["stiffness","damping","mass"];function qi(t,e){return e.some(r=>t[r]!==void 0)}function vl(t){let e={velocity:C.velocity,stiffness:C.stiffness,damping:C.damping,mass:C.mass,isResolvedFromDuration:!1,...t};if(!qi(t,xl)&&qi(t,yl))if(t.visualDuration){let r=t.visualDuration,o=2*Math.PI/(r*1.2),i=o*o,s=2*O(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:C.mass,stiffness:i,damping:s}}else{let r=Xi(t);e={...e,...r,mass:C.mass},e.isResolvedFromDuration=!0}return e}function se(t=C.visualDuration,e=C.bounce){let r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t,{restSpeed:o,restDelta:i}=r,s=r.keyframes[0],n=r.keyframes[r.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:c,mass:m,duration:u,velocity:f,isResolvedFromDuration:p}=vl({...r,velocity:-U(r.velocity||0)}),h=f||0,d=c/(2*Math.sqrt(l*m)),y=n-s,g=U(Math.sqrt(l/m)),T=Math.abs(y)<5;o||(o=T?C.restSpeed.granular:C.restSpeed.default),i||(i=T?C.restDelta.granular:C.restDelta.default);let x;if(d<1){let V=vr(g,d);x=w=>{let I=Math.exp(-d*g*w);return n-I*((h+d*g*y)/V*Math.sin(V*w)+y*Math.cos(V*w))}}else if(d===1)x=V=>n-Math.exp(-g*V)*(y+(h+g*y)*V);else{let V=g*Math.sqrt(d*d-1);x=w=>{let I=Math.exp(-d*g*w),b=Math.min(V*w,300);return n-I*((h+d*g*y)*Math.sinh(b)+V*y*Math.cosh(b))/V}}let A={calculatedDuration:p&&u||null,next:V=>{let w=x(V);if(p)a.done=V>=u;else{let I=V===0?h:0;d<1&&(I=V===0?k(h):xr(x,V,w));let b=Math.abs(I)<=o,$=Math.abs(n-w)<=i;a.done=b&&$}return a.value=a.done?n:w,a},toString:()=>{let V=Math.min(ne(A),2e4),w=yr(I=>A.next(V*I).value,V,30);return V+"ms "+w},toTransition:()=>{}};return A}se.applyToOptions=t=>{let e=Yi(t,100,se);return t.ease=e.ease,t.duration=k(e.duration),t.type="keyframes",t};function Ue({keyframes:t,velocity:e=0,power:r=.8,timeConstant:o=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:n,min:a,max:l,restDelta:c=.5,restSpeed:m}){let u=t[0],f={done:!1,value:u},p=b=>a!==void 0&&b<a||l!==void 0&&b>l,h=b=>a===void 0?l:l===void 0||Math.abs(a-b)<Math.abs(l-b)?a:l,d=r*e,y=u+d,g=n===void 0?y:n(y);g!==y&&(d=g-u);let T=b=>-d*Math.exp(-b/o),x=b=>g+T(b),A=b=>{let $=T(b),Z=x(b);f.done=Math.abs($)<=c,f.value=f.done?g:Z},V,w,I=b=>{p(f.value)&&(V=b,w=se({keyframes:[f.value,h(f.value)],velocity:xr(x,b,f.value),damping:i,stiffness:s,restDelta:c,restSpeed:m}))};return I(0),{calculatedDuration:null,next:b=>{let $=!1;return!w&&V===void 0&&($=!0,A(b),I(b)),V!==void 0&&b>=V?w.next(b-V):(!$&&A(b),f)}}}function Tl(t,e,r){let o=[],i=r||K.mix||gr,s=t.length-1;for(let n=0;n<s;n++){let a=i(t[n],t[n+1]);if(e){let l=Array.isArray(e)?e[n]||R:e;a=rt(l,a)}o.push(a)}return o}function Zi(t,e,{clamp:r=!0,ease:o,mixer:i}={}){let s=t.length;if(G(s===e.length,"Both input and output ranges must be the same length","range-length"),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];let n=t[0]===t[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());let a=Tl(e,o,i),l=a.length,c=m=>{if(n&&m<t[0])return e[0];let u=0;if(l>1)for(;u<t.length-2&&!(m<t[u+1]);u++);let f=st(t[u],t[u+1],m);return a[u](f)};return r?m=>c(O(t[0],t[s-1],m)):c}function Ji(t,e){let r=t[t.length-1];for(let o=1;o<=e;o++){let i=st(0,e,o);t.push(P(r,1,i))}}function Qi(t){let e=[0];return Ji(e,t.length-1),e}function tn(t,e){return t.map(r=>r*e)}function Vl(t,e){return t.map(()=>e||Ie).splice(0,t.length-1)}function Pt({duration:t=300,keyframes:e,times:r,ease:o="easeInOut"}){let i=Vo(o)?o.map(mr):mr(o),s={done:!1,value:e[0]},n=tn(r&&r.length===e.length?r:Qi(e),t),a=Zi(n,e,{ease:Array.isArray(i)?i:Vl(e,i)});return{calculatedDuration:t,next:l=>(s.value=a(l),s.done=l>=t,s)}}var Sl=t=>t!==null;function ae(t,{repeat:e,repeatType:r="loop"},o,i=1){let s=t.filter(Sl),a=i<0||e&&r!=="loop"&&e%2===1?0:s.length-1;return!a||o===void 0?s[a]:o}var bl={decay:Ue,inertia:Ue,tween:Pt,keyframes:Pt,spring:se};function Tr(t){typeof t.type=="string"&&(t.type=bl[t.type])}var At=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}};var Pl=t=>t/100,ft=class extends At{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var o,i;let{motionValue:r}=this.options;r&&r.updatedAt!==B.now()&&this.tick(B.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(o=this.options).onStop)==null||i.call(o))},ot.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;Tr(e);let{type:r=Pt,repeat:o=0,repeatDelay:i=0,repeatType:s,velocity:n=0}=e,{keyframes:a}=e,l=r||Pt;process.env.NODE_ENV!=="production"&&l!==Pt&&G(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),l!==Pt&&typeof a[0]!="number"&&(this.mixKeyframes=rt(Pl,gr(a[0],a[1])),a=[0,100]);let c=l({...e,keyframes:a});s==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-n})),c.calculatedDuration===null&&(c.calculatedDuration=ne(c));let{calculatedDuration:m}=c;this.calculatedDuration=m,this.resolvedDuration=m+i,this.totalDuration=this.resolvedDuration*(o+1)-i,this.generator=c}updateTime(e){let r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){let{generator:o,totalDuration:i,mixKeyframes:s,mirroredGenerator:n,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return o.next(0);let{delay:c=0,keyframes:m,repeat:u,repeatType:f,repeatDelay:p,type:h,onUpdate:d,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),T=this.playbackSpeed>=0?g<0:g>i;this.currentTime=Math.max(g,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let x=this.currentTime,A=o;if(u){let b=Math.min(this.currentTime,i)/a,$=Math.floor(b),Z=b%1;!Z&&b>=1&&(Z=1),Z===1&&$--,$=Math.min($,u+1),!!($%2)&&(f==="reverse"?(Z=1-Z,p&&(Z-=p/a)):f==="mirror"&&(A=n)),x=O(0,1,Z)*a}let V=T?{done:!1,value:m[0]}:A.next(x);s&&(V.value=s(V.value));let{done:w}=V;!T&&l!==null&&(w=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);let I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&w);return I&&h!==Ue&&(V.value=ae(m,this.options,y,this.speed)),d&&d(V.value),I&&this.finish(),V}then(e,r){return this.finished.then(e,r)}get duration(){return U(this.calculatedDuration)}get time(){return U(this.currentTime)}set time(e){var r;e=k(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(r=this.driver)==null||r.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(B.now());let r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=U(this.currentTime))}play(){var i,s;if(this.isStopped)return;let{driver:e=_i,startTime:r}=this.options;this.driver||(this.driver=e(n=>this.tick(n))),(s=(i=this.options).onPlay)==null||s.call(i);let o=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=o):this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime||(this.startTime=r!=null?r:o),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(B.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(e=this.options).onComplete)==null||r.call(e)}cancel(){var e,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(e=this.options).onCancel)==null||r.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,ot.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),e.observe(this)}};function en(t){var e;for(let r=1;r<t.length;r++)(e=t[r])!=null||(t[r]=t[r-1])}var jt=t=>t*180/Math.PI,Eo=t=>{let e=jt(Math.atan2(t[1],t[0]));return Ro(e)},Al={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Eo,rotateZ:Eo,skewX:t=>jt(Math.atan(t[1])),skewY:t=>jt(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ro=t=>(t=t%360,t<0&&(t+=360),t),rn=Eo,on=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),nn=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),wl={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:on,scaleY:nn,scale:t=>(on(t)+nn(t))/2,rotateX:t=>Ro(jt(Math.atan2(t[6],t[5]))),rotateY:t=>Ro(jt(Math.atan2(-t[2],t[0]))),rotateZ:rn,rotate:rn,skewX:t=>jt(Math.atan(t[4])),skewY:t=>jt(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ke(t){return t.includes("scale")?1:0}function We(t,e){if(!t||t==="none")return Ke(e);let r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),o,i;if(r)o=wl,i=r;else{let a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);o=Al,i=a}if(!i)return Ke(e);let s=o[e],n=i[1].split(",").map(Ml);return typeof s=="function"?s(n):n[s]}var Lo=(t,e)=>{let{transform:r="none"}=getComputedStyle(t);return We(r,e)};function Ml(t){return parseFloat(t.trim())}var nt=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],X=new Set(nt);var Bo=t=>t===at||t===v,Cl=new Set(["x","y","z"]),Dl=nt.filter(t=>!Cl.has(t));function sn(t){let e=[];return Dl.forEach(r=>{let o=t.getValue(r);o!==void 0&&(e.push([r,o.get()]),o.set(r.startsWith("scale")?1:0))}),e}var wt={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>We(e,"x"),y:(t,{transform:e})=>We(e,"y")};wt.translateX=wt.x;wt.translateY=wt.y;var Nt=new Set,Io=!1,ko=!1,Fo=!1;function an(){if(ko){let t=Array.from(Nt).filter(o=>o.needsMeasurement),e=new Set(t.map(o=>o.element)),r=new Map;e.forEach(o=>{let i=sn(o);i.length&&(r.set(o,i),o.render())}),t.forEach(o=>o.measureInitialState()),e.forEach(o=>{o.render();let i=r.get(o);i&&i.forEach(([s,n])=>{var a;(a=o.getValue(s))==null||a.set(n)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}ko=!1,Io=!1,Nt.forEach(t=>t.complete(Fo)),Nt.clear()}function ln(){Nt.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(ko=!0)})}function Oo(){Fo=!0,ln(),an(),Fo=!1}var pt=class{constructor(e,r,o,i,s,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=o,this.motionValue=i,this.element=s,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(Nt.add(this),Io||(Io=!0,S.read(ln),S.resolveKeyframes(an))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:r,element:o,motionValue:i}=this;if(e[0]===null){let s=i==null?void 0:i.get(),n=e[e.length-1];if(s!==void 0)e[0]=s;else if(o&&r){let a=o.readValue(r,n);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=n),i&&s===void 0&&i.set(e[0])}en(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Nt.delete(this)}cancel(){this.state==="scheduled"&&(Nt.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}};var mn=t=>t.startsWith("--");function cn(t,e,r){mn(e)?t.style.setProperty(e,r):t.style[e]=r}var un=It(()=>window.ScrollTimeline!==void 0);var fn={};function pn(t,e){let r=It(t);return()=>{var o;return(o=fn[e])!=null?o:r()}}var Vr=pn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");var Gt=([t,e,r,o])=>`cubic-bezier(${t}, ${e}, ${r}, ${o})`;var jo={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Gt([0,.65,.55,1]),circOut:Gt([.55,0,1,.45]),backIn:Gt([.31,.01,.66,-.59]),backOut:Gt([.33,1.53,.69,.99])};function No(t,e){if(t)return typeof t=="function"?Vr()?yr(t,e):"ease-out":ke(t)?Gt(t):Array.isArray(t)?t.map(r=>No(r,e)||jo.easeOut):jo[t]}function hn(t,e,r,{delay:o=0,duration:i=300,repeat:s=0,repeatType:n="loop",ease:a="easeOut",times:l}={},c=void 0){let m={[e]:r};l&&(m.offset=l);let u=No(a,i);Array.isArray(u)&&(m.easing=u),H.value&&ot.waapi++;let f={delay:o,duration:i,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:n==="reverse"?"alternate":"normal"};c&&(f.pseudoElement=c);let p=t.animate(m,f);return H.value&&p.finished.finally(()=>{ot.waapi--}),p}function Sr(t){return typeof t=="function"&&"applyToOptions"in t}function dn({type:t,...e}){var r,o;return Sr(t)&&Vr()?t.applyToOptions(e):((r=e.duration)!=null||(e.duration=300),(o=e.ease)!=null||(e.ease="easeOut"),e)}var br=class extends At{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;let{element:r,name:o,keyframes:i,pseudoElement:s,allowFlatten:n=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!s,this.allowFlatten=n,this.options=e,G(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");let c=dn(e);this.animation=hn(r,o,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){let m=ae(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(m):cn(r,o,m),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,r;(r=(e=this.animation).finish)==null||r.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var e,r;this.isPseudoElement||(r=(e=this.animation).commitStyles)==null||r.call(e)}get duration(){var r,o;let e=((o=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:o.call(r).duration)||0;return U(Number(e))}get time(){return U(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=k(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){var o;return this.allowFlatten&&((o=this.animation.effect)==null||o.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&un()?(this.animation.timeline=e,R):r(this)}};var gn={anticipate:Ee,backInOut:De,circInOut:Be};function El(t){return t in gn}function yn(t){typeof t.ease=="string"&&El(t.ease)&&(t.ease=gn[t.ease])}var xn=10,Pr=class extends br{constructor(e){yn(e),Tr(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){var c;let{motionValue:r,onUpdate:o,onComplete:i,element:s,...n}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}let a=new ft({...n,autoplay:!1}),l=k((c=this.finishedTime)!=null?c:this.time);r.setWithVelocity(a.sample(l-xn).value,a.sample(l).value,xn),a.stop()}};var Go=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(z.test(t)||t==="0")&&!t.startsWith("url("));function Rl(t){let e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function vn(t,e,r,o){let i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;let s=t[t.length-1],n=Go(i,e),a=Go(s,e);return Q(n===a,`You are trying to animate ${e} from "${i}" to "${s}". "${n?s:i}" is not an animatable value.`,"value-not-animatable"),!n||!a?!1:Rl(t)||(r==="spring"||Sr(r))&&o}function le(t){t.duration=0,t.type}var Ll=new Set(["opacity","clipPath","filter","transform"]),Bl=It(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Tn(t){var m;let{motionValue:e,name:r,repeatDelay:o,repeatType:i,damping:s,type:n}=t;if(!(((m=e==null?void 0:e.owner)==null?void 0:m.current)instanceof HTMLElement))return!1;let{onUpdate:l,transformTemplate:c}=e.owner.getProps();return Bl()&&r&&Ll.has(r)&&(r!=="transform"||!c)&&!l&&!o&&i!=="mirror"&&s!==0&&n!=="inertia"}var Il=40,ze=class extends At{constructor({autoplay:e=!0,delay:r=0,type:o="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:n="loop",keyframes:a,name:l,motionValue:c,element:m,...u}){var h;super(),this.stop=()=>{var d,y;this._animation&&(this._animation.stop(),(d=this.stopTimeline)==null||d.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=B.now();let f={autoplay:e,delay:r,type:o,repeat:i,repeatDelay:s,repeatType:n,name:l,motionValue:c,element:m,...u},p=(m==null?void 0:m.KeyframeResolver)||pt;this.keyframeResolver=new p(a,(d,y,g)=>this.onKeyframesResolved(d,y,f,!g),l,c,m),(h=this.keyframeResolver)==null||h.scheduleResolve()}onKeyframesResolved(e,r,o,i){this.keyframeResolver=void 0;let{name:s,type:n,velocity:a,delay:l,isHandoff:c,onUpdate:m}=o;this.resolvedAt=B.now(),vn(e,s,n,a)||((K.instantAnimations||!l)&&(m==null||m(ae(e,o,r))),e[0]=e[e.length-1],le(o),o.repeat=0);let f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>Il?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...o,keyframes:e},p=!c&&Tn(f)?new Pr({...f,element:f.motionValue.owner.current}):new ft(f);p.finished.then(()=>this.notifyFinished()).catch(R),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Oo()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}};var kl=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Fl(t){let e=kl.exec(t);if(!e)return[,];let[,r,o,i]=e;return[`--${r!=null?r:o}`,i]}var Ol=4;function Uo(t,e,r=1){G(r<=Ol,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[o,i]=Fl(t);if(!o)return;let s=window.getComputedStyle(e).getPropertyValue(o);if(s){let n=s.trim();return Ae(n)?parseFloat(n):n}return Ot(i)?Uo(i,e,r+1):i}function Ut(t,e){var r,o;return(o=(r=t==null?void 0:t[e])!=null?r:t==null?void 0:t.default)!=null?o:t}var $e=new Set(["width","height","top","left","right","bottom",...nt]);var Vn={test:t=>t==="auto",parse:t=>t};var Ar=t=>e=>e.test(t);var Ko=[at,v,W,it,Po,bo,Vn],Wo=t=>Ko.find(Ar(t));function Sn(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Me(t):!0}var jl=new Set(["brightness","contrast","saturate","opacity"]);function Nl(t){let[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;let[o]=r.match(re)||[];if(!o)return t;let i=r.replace(o,""),s=jl.has(e)?1:0;return o!==r&&(s*=100),e+"("+s+i+")"}var Gl=/\b([a-z-]*)\(.*?\)/gu,He={...z,getAnimatableNone:t=>{let e=t.match(Gl);return e?e.map(Nl).join(" "):t}};var zo={...at,transform:Math.round};var bn={rotate:it,rotateX:it,rotateY:it,rotateZ:it,scale:je,scaleX:je,scaleY:je,scaleZ:je,skew:it,skewX:it,skewY:it,distance:v,translateX:v,translateY:v,translateZ:v,x:v,y:v,z:v,perspective:v,transformPerspective:v,opacity:ut,originX:pr,originY:pr,originZ:v};var Kt={borderWidth:v,borderTopWidth:v,borderRightWidth:v,borderBottomWidth:v,borderLeftWidth:v,borderRadius:v,radius:v,borderTopLeftRadius:v,borderTopRightRadius:v,borderBottomRightRadius:v,borderBottomLeftRadius:v,width:v,maxWidth:v,height:v,maxHeight:v,top:v,right:v,bottom:v,left:v,padding:v,paddingTop:v,paddingRight:v,paddingBottom:v,paddingLeft:v,margin:v,marginTop:v,marginRight:v,marginBottom:v,marginLeft:v,backgroundPositionX:v,backgroundPositionY:v,...bn,zIndex:zo,fillOpacity:ut,strokeOpacity:ut,numOctaves:zo};var Pn={...Kt,color:E,backgroundColor:E,outlineColor:E,fill:E,stroke:E,borderColor:E,borderTopColor:E,borderRightColor:E,borderBottomColor:E,borderLeftColor:E,filter:He,WebkitFilter:He},_e=t=>Pn[t];function Ye(t,e){let r=_e(t);return r!==He&&(r=z),r.getAnimatableNone?r.getAnimatableNone(e):void 0}var Ul=new Set(["auto","none","0"]);function An(t,e,r){let o=0,i;for(;o<t.length&&!i;){let s=t[o];typeof s=="string"&&!Ul.has(s)&&bt(s).values.length&&(i=t[o]),o++}if(i&&r)for(let s of e)t[s]=Ye(r,i)}var Xe=class extends pt{constructor(e,r,o,i,s){super(e,r,o,i,s,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:r,name:o}=this;if(!r||!r.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),Ot(c))){let m=Uo(c,r.current);m!==void 0&&(e[l]=m),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!$e.has(o)||e.length!==2)return;let[i,s]=e,n=Wo(i),a=Wo(s);if(n!==a)if(Bo(n)&&Bo(a))for(let l=0;l<e.length;l++){let c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else wt[o]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:r}=this,o=[];for(let i=0;i<e.length;i++)(e[i]===null||Sn(e[i]))&&o.push(i);o.length&&An(e,o,r)}measureInitialState(){let{element:e,unresolvedKeyframes:r,name:o}=this;if(!e||!e.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=wt[o](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;let i=r[r.length-1];i!==void 0&&e.getValue(o,i).jump(i,!1)}measureEndState(){var a;let{element:e,name:r,unresolvedKeyframes:o}=this;if(!e||!e.current)return;let i=e.getValue(r);i&&i.jump(this.measuredOrigin,!1);let s=o.length-1,n=o[s];o[s]=wt[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=n),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,c])=>{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}};function wn(t,e,r){var o;if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;e&&(i=e.current);let s=(o=r==null?void 0:r[t])!=null?o:i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t)}var qe=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Mn(t){return we(t)&&"offsetHeight"in t}var Cn=30,Kl=t=>!isNaN(parseFloat(t)),$o={current:void 0},wr=class{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=o=>{var s;let i=B.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(let n of this.dependents)n.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=B.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Kl(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&kt(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new ct);let o=this.events[e].add(r);return e==="change"?()=>{o(),S.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,o){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-o}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return $o.current&&$o.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=B.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Cn)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,Cn);return Ce(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),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(){var e,r;(e=this.dependents)==null||e.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function tt(t,e){return new wr(t,e)}var{schedule:Wt,cancel:Wl}=cr(queueMicrotask,!1);var et={x:!1,y:!1};function Mr(){return et.x||et.y}function Ho(t){return t==="x"||t==="y"?et[t]?null:(et[t]=!0,()=>{et[t]=!1}):et.x||et.y?null:(et.x=et.y=!0,()=>{et.x=et.y=!1})}function Cr(t,e){let r=wn(t),o=new AbortController,i={passive:!0,...e,signal:o.signal};return[r,i,()=>o.abort()]}function Dn(t){return!(t.pointerType==="touch"||Mr())}function _o(t,e,r={}){let[o,i,s]=Cr(t,r),n=a=>{if(!Dn(a))return;let{target:l}=a,c=e(l,a);if(typeof c!="function"||!l)return;let m=u=>{Dn(u)&&(c(u),l.removeEventListener("pointerleave",m))};l.addEventListener("pointerleave",m,i)};return o.forEach(a=>{a.addEventListener("pointerenter",n,i)}),s}var Yo=(t,e)=>e?t===e?!0:Yo(t,e.parentElement):!1;var zt=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;var zl=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function En(t){return zl.has(t.tagName)||t.tabIndex!==-1}var me=new WeakSet;function Rn(t){return e=>{e.key==="Enter"&&t(e)}}function Xo(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}var Ln=(t,e)=>{let r=t.currentTarget;if(!r)return;let o=Rn(()=>{if(me.has(r))return;Xo(r,"down");let i=Rn(()=>{Xo(r,"up")}),s=()=>Xo(r,"cancel");r.addEventListener("keyup",i,e),r.addEventListener("blur",s,e)});r.addEventListener("keydown",o,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",o),e)};function Bn(t){return zt(t)&&!Mr()}function qo(t,e,r={}){let[o,i,s]=Cr(t,r),n=a=>{let l=a.currentTarget;if(!Bn(a))return;me.add(l);let c=e(l,a),m=(p,h)=>{window.removeEventListener("pointerup",u),window.removeEventListener("pointercancel",f),me.has(l)&&me.delete(l),Bn(p)&&typeof c=="function"&&c(p,{success:h})},u=p=>{m(p,l===window||l===document||r.useGlobalTarget||Yo(l,p.target))},f=p=>{m(p,!1)};window.addEventListener("pointerup",u,i),window.addEventListener("pointercancel",f,i)};return o.forEach(a=>{(r.useGlobalTarget?window:a).addEventListener("pointerdown",n,i),Mn(a)&&(a.addEventListener("focus",c=>Ln(c,i)),!En(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function Ze(t){return we(t)&&"ownerSVGElement"in t}function Zo(t){return Ze(t)&&t.tagName==="svg"}var M=t=>!!(t&&t.getVelocity);var $l=[...Ko,E,z],Jo=t=>$l.find(Ar(t));import{createContext as Hl}from"react";var Dr=Hl({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});import{useContext as _l,useId as Yl,useEffect as Xl,useCallback as ql}from"react";function In(t=!0){let e=_l(te);if(e===null)return[!0,null];let{isPresent:r,onExitComplete:o,register:i}=e,s=Yl();Xl(()=>{if(t)return i(s)},[t]);let n=ql(()=>t&&o&&o(s),[s,o,t]);return!r&&o?[!1,n]:[!0]}import{createContext as Zl}from"react";var Er=Zl({strict:!1});var kn={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ht={};for(let t in kn)ht[t]={isEnabled:e=>kn[t].some(r=>!!e[r])};function Fn(t){for(let e in t)ht[e]={...ht[e],...t[e]}}var Jl=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Je(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Jl.has(t)}var On=t=>!Je(t);function Ql(t){typeof t=="function"&&(On=e=>e.startsWith("on")?!Je(e):t(e))}try{Ql(Na("@emotion/is-prop-valid").default)}catch{}function jn(t,e,r){let o={};for(let i in t)i==="values"&&typeof t.values=="object"||(On(i)||r===!0&&Je(i)||!e&&!Je(i)||t.draggable&&i.startsWith("onDrag"))&&(o[i]=t[i]);return o}import{jsxs as Sm,jsx as bm}from"react/jsx-runtime";import{forwardRef as Pm,useContext as ei}from"react";import{createContext as tm}from"react";var Mt=tm({});import{useContext as em,useMemo as rm}from"react";function Ct(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function dt(t){return typeof t=="string"||Array.isArray(t)}var Rr=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Qe=["initial",...Rr];function $t(t){return Ct(t.animate)||Qe.some(e=>dt(t[e]))}function Lr(t){return!!($t(t)||t.variants)}function Nn(t,e){if($t(t)){let{initial:r,animate:o}=t;return{initial:r===!1||dt(r)?r:void 0,animate:dt(o)?o:void 0}}return t.inherit!==!1?e:{}}function Un(t){let{initial:e,animate:r}=Nn(t,em(Mt));return rm(()=>({initial:e,animate:r}),[Gn(e),Gn(r)])}function Gn(t){return Array.isArray(t)?t.join(" "):t}import{Fragment as um,useMemo as fm,createElement as pm}from"react";import{useMemo as nm}from"react";var Ht={};function Kn(t){for(let e in t)Ht[e]=t[e],Ft(e)&&(Ht[e].isCSSVariable=!0)}function Br(t,{layout:e,layoutId:r}){return X.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Ht[t]||t==="opacity")}var om={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},im=nt.length;function Wn(t,e,r){let o="",i=!0;for(let s=0;s<im;s++){let n=nt[s],a=t[n];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(n.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||r){let c=qe(a,Kt[n]);if(!l){i=!1;let m=om[n]||n;o+=`${m}(${c}) `}r&&(e[n]=c)}}return o=o.trim(),r?o=r(e,i?"":o):i&&(o="none"),o}function ce(t,e,r){let{style:o,vars:i,transformOrigin:s}=t,n=!1,a=!1;for(let l in e){let c=e[l];if(X.has(l)){n=!0;continue}else if(Ft(l)){i[l]=c;continue}else{let m=qe(c,Kt[l]);l.startsWith("origin")?(a=!0,s[l]=m):o[l]=m}}if(e.transform||(n||r?o.transform=Wn(e,t.transform,r):o.transform&&(o.transform="none")),a){let{originX:l="50%",originY:c="50%",originZ:m=0}=s;o.transformOrigin=`${l} ${c} ${m}`}}var ue=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Qo(t,e,r){for(let o in e)!M(e[o])&&!Br(o,r)&&(t[o]=e[o])}function sm({transformTemplate:t},e){return nm(()=>{let r=ue();return ce(r,e,t),Object.assign({},r.vars,r.style)},[e])}function am(t,e){let r=t.style||{},o={};return Qo(o,r,t),Object.assign(o,sm(t,e)),o}function zn(t,e){let r={},o=am(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=o,r}import{useMemo as cm}from"react";var lm={offset:"stroke-dashoffset",array:"stroke-dasharray"},mm={offset:"strokeDashoffset",array:"strokeDasharray"};function $n(t,e,r=1,o=0,i=!0){t.pathLength=1;let s=i?lm:mm;t[s.offset]=v.transform(-o);let n=v.transform(e),a=v.transform(r);t[s.array]=`${n} ${a}`}function Ir(t,{attrX:e,attrY:r,attrScale:o,pathLength:i,pathSpacing:s=1,pathOffset:n=0,...a},l,c,m){var p,h;if(ce(t,a,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};let{attrs:u,style:f}=t;u.transform&&(f.transform=u.transform,delete u.transform),(f.transform||u.transformOrigin)&&(f.transformOrigin=(p=u.transformOrigin)!=null?p:"50% 50%",delete u.transformOrigin),f.transform&&(f.transformBox=(h=m==null?void 0:m.transformBox)!=null?h:"fill-box",delete u.transformBox),e!==void 0&&(u.x=e),r!==void 0&&(u.y=r),o!==void 0&&(u.scale=o),i!==void 0&&$n(u,i,s,n,!1)}var kr=()=>({...ue(),attrs:{}});var Fr=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Hn(t,e,r,o){let i=cm(()=>{let s=kr();return Ir(s,e,Fr(o),t.transformTemplate,t.style),{...s.attrs,style:{...s.style}}},[e]);if(t.style){let s={};Qo(s,t.style,t),i.style={...s,...i.style}}return i}var _n=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function fe(t){return typeof t!="string"||t.includes("-")?!1:!!(_n.indexOf(t)>-1||/[A-Z]/u.test(t))}function Yn(t,e,r,{latestValues:o},i,s=!1){let a=(fe(t)?Hn:zn)(e,o,i,t),l=jn(e,typeof t=="string",s),c=t!==um?{...l,...a,ref:r}:{},{children:m}=e,u=fm(()=>M(m)?m.get():m,[m]);return pm(t,{...c,children:u})}import{useContext as qn}from"react";function Xn(t){let e=[{},{}];return t==null||t.values.forEach((r,o)=>{e[0][o]=r.get(),e[1][o]=r.getVelocity()}),e}function pe(t,e,r,o){if(typeof e=="function"){let[i,s]=Xn(o);e=e(r!==void 0?r:t.custom,i,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){let[i,s]=Xn(o);e=e(r!==void 0?r:t.custom,i,s)}return e}function he(t){return M(t)?t.get():t}function hm({scrapeMotionValuesFromProps:t,createRenderState:e},r,o,i){return{latestValues:dm(r,o,i,t),renderState:e()}}function dm(t,e,r,o){let i={},s=o(t,{});for(let f in s)i[f]=he(s[f]);let{initial:n,animate:a}=t,l=$t(t),c=Lr(t);e&&c&&!l&&t.inherit!==!1&&(n===void 0&&(n=e.initial),a===void 0&&(a=e.animate));let m=r?r.initial===!1:!1;m=m||n===!1;let u=m?a:n;if(u&&typeof u!="boolean"&&!Ct(u)){let f=Array.isArray(u)?u:[u];for(let p=0;p<f.length;p++){let h=pe(t,f[p]);if(h){let{transitionEnd:d,transition:y,...g}=h;for(let T in g){let x=g[T];if(Array.isArray(x)){let A=m?x.length-1:0;x=x[A]}x!==null&&(i[T]=x)}for(let T in d)i[T]=d[T]}}}return i}var Or=t=>(e,r)=>{let o=qn(Mt),i=qn(te),s=()=>hm(t,e,o,i);return r?s():Ci(s)};function de(t,e,r){var s;let{style:o}=t,i={};for(let n in o)(M(o[n])||e.style&&M(e.style[n])||Br(n,t)||((s=r==null?void 0:r.getValue(n))==null?void 0:s.liveStyle)!==void 0)&&(i[n]=o[n]);return i}var Zn=Or({scrapeMotionValuesFromProps:de,createRenderState:ue});function jr(t,e,r){let o=de(t,e,r);for(let i in t)if(M(t[i])||M(e[i])){let s=nt.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;o[s]=t[i]}return o}var Jn=Or({scrapeMotionValuesFromProps:jr,createRenderState:kr});var Qn=Symbol.for("motionComponentSymbol");import{useCallback as gm}from"react";function gt(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function ts(t,e,r){return gm(o=>{o&&t.onMount&&t.onMount(o),e&&(o?e.mount(o):e.unmount()),r&&(typeof r=="function"?r(o):gt(r)&&(r.current=o))},[e])}import{useContext as tr,useRef as ti,useInsertionEffect as vm,useEffect as Tm}from"react";var ge=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase();var ym="framerAppearId",Nr="data-"+ge(ym);import{createContext as xm}from"react";var Gr=xm({});function es(t,e,r,o,i){var d,y;let{visualElement:s}=tr(Mt),n=tr(Er),a=tr(te),l=tr(Dr).reducedMotion,c=ti(null);o=o||n.renderer,!c.current&&o&&(c.current=o(t,{visualState:e,parent:s,props:r,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));let m=c.current,u=tr(Gr);m&&!m.projection&&i&&(m.type==="html"||m.type==="svg")&&Vm(c.current,r,i,u);let f=ti(!1);vm(()=>{m&&f.current&&m.update(r,a)});let p=r[Nr],h=ti(!!p&&!((d=window.MotionHandoffIsComplete)!=null&&d.call(window,p))&&((y=window.MotionHasOptimisedAnimation)==null?void