framer-motion
Version:
A simple and powerful JavaScript animation library
3 lines • 159 kB
JavaScript
import{createElement as t,ref as e,on as n,createMixin as i}from"remix/component";function s(t,e){-1===t.indexOf(e)&&t.push(e)}function o(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function r([...t],e,n){const i=e<0?t.length+e:e;if(i>=0&&i<t.length){const i=n<0?t.length+n:n,[s]=t.splice(e,1);t.splice(i,0,s)}return t}const a=(t,e,n)=>n>e?e:n<t?t:n,l={},c=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),h=t=>"object"==typeof t&&null!==t,u=t=>/^0[^.\s]+$/u.test(t);const d=t=>t,p=(...t)=>t.reduce((t,e)=>n=>e(t(n))),m=(t,e,n)=>{const i=e-t;return i?(n-t)/i:1};class f{constructor(){this.subscriptions=[]}add(t){return s(this.subscriptions,t),()=>this.remove(t)}remove(t){o(this.subscriptions,t)}notify(t,e,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](t,e,n);else for(let s=0;s<i;s++){const i=this.subscriptions[s];i&&i(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const g=t=>1e3*t,y=t=>t/1e3,v=(t,e)=>e?t*(1e3/e):0,x=(t,e,n)=>t*(3*(1-t)*((1-t)*e+t*n)+t*t);function w(t,e,n,i){return t===e&&n===i?d:s=>{let o=0,r=1,a=s;for(let e=0;;e++){a>=o&&a<=r||(a=(o+r)/2);const i=x(a,t,n)-s;if(i*i<1e-28||40===e)break;i>0?r=a:o=a,a-=1e-7*i/(x(a+1e-7,t,n)-s-i)}return x(a,e,i)}}const b=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,T=t=>e=>1-t(1-e),S=w(.33,1.53,.69,.99),P=T(S),A=b(P),E=t=>t>=1?1:(t*=2)<1?.5*P(t):.5*(2-Math.pow(2,-10*(t-1))),M=t=>1-Math.sin(Math.acos(t)),k=T(M),V=b(M),D=w(.42,0,1,1),C=w(0,0,.58,1),R=w(.42,0,.58,1),L=t=>Array.isArray(t)&&"number"!=typeof t[0],O=t=>Array.isArray(t)&&"number"==typeof t[0],B={linear:d,easeIn:D,easeInOut:R,easeOut:C,circIn:M,circInOut:V,circOut:k,backIn:P,backInOut:A,backOut:S,anticipate:E},F=t=>{if(O(t)){const[e,n,i,s]=t;return w(e,n,i,s)}return"string"==typeof t?B[t]:t},j={delta:0,timestamp:0,isProcessing:!1};let I;function U(){I=void 0}const W={now:()=>(void 0===I&&W.set(j.isProcessing||l.useManualTiming?j.timestamp:performance.now()),I),set:t=>{I=t,queueMicrotask(U)}},N=t=>Math.round(1e5*t)/1e5,K=t=>e=>"string"==typeof e&&e.startsWith(t),$=K("--"),z=K("var(--"),Y=t=>!!z(t)&&X.test(t.split("/*")[0].trim()),X=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function H(t){return"string"==typeof t&&t.split("/*")[0].includes("var(--")}const q={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},_={...q,transform:t=>a(0,1,t)},Z={...q,default:1},G=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const J=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Q=(t,e)=>n=>Boolean("string"==typeof n&&J.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),tt=(t,e,n)=>i=>{if("string"!=typeof i)return i;const[s,o,r,a]=i.match(G);return{[t]:parseFloat(s),[e]:parseFloat(o),[n]:parseFloat(r),alpha:void 0!==a?parseFloat(a):1}},et={...q,transform:t=>Math.round((t=>a(0,255,t))(t))},nt={test:Q("rgb","red"),parse:tt("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+et.transform(t)+", "+et.transform(e)+", "+et.transform(n)+", "+N(_.transform(i))+")"},it=(t,e,n)=>{const i=t.substring(1+e*n,1+(e+1)*n);return n>1?i:i+i};const st={test:Q("#"),parse:function(t){const e=t.length>5?2:1,n=it(t,3,e);return{red:parseInt(it(t,0,e),16),green:parseInt(it(t,1,e),16),blue:parseInt(it(t,2,e),16),alpha:n?parseInt(n,16)/255:1}},transform:nt.transform},ot=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),rt=ot("deg"),at=ot("%"),lt=ot("px"),ct=ot("vh"),ht=ot("vw"),ut=(()=>({...at,parse:t=>at.parse(t)/100,transform:t=>at.transform(100*t)}))(),dt={test:Q("hsl","hue"),parse:tt("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+at.transform(N(e))+", "+at.transform(N(n))+", "+N(_.transform(i))+")"},pt={test:t=>nt.test(t)||st.test(t)||dt.test(t),parse:t=>nt.test(t)?nt.parse(t):dt.test(t)?dt.parse(t):st.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?nt.transform(t):dt.transform(t),getAnimatableNone:t=>{const e=pt.parse(t);return e.alpha=0,pt.transform(e)}},mt=new RegExp(G.source),ft=new RegExp(/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu.source,"i");const gt="number",yt="color",vt=/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+)(?![a-z]*\()/giu;function xt(t){const e=t.toString();return mt.test(e)||ft.test(e)}function wt(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let o=0;const r=e.replace(vt,t=>(pt.test(t)?(i.color.push(o),s.push(yt),n.push(pt.parse(t))):t.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(t)):(i.number.push(o),s.push(gt),n.push(parseFloat(t))),++o,"${}")).split("${}");return{values:n,split:r,indexes:i,types:s}}function bt({split:t,types:e}){const n=t.length;return i=>{let s="";for(let o=0;o<n;o++)if(s+=t[o],void 0!==i[o]){const t=e[o];s+=t===gt?N(i[o]):t===yt?pt.transform(i[o]):i[o]}return s}}const Tt=(t,e)=>{return"number"==typeof t?e?.trim().endsWith("/")?t:0:"number"==typeof(n=t)?0:pt.test(n)?pt.getAnimatableNone(n):n;var n};const St={test:function(t){return isNaN(t)&&"string"==typeof t&&(mt.test(t)||ft.test(t))},parse:function(t){return wt(t).values},createTransformer:function(t){return bt(wt(t))},getAnimatableNone:function(t){const e=wt(t);return bt(e)(e.values.map((t,n)=>Tt(t,e.split[n])))}};function Pt(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}function At(t,e){return n=>n>0?e:t}const Et=(t,e,n)=>t+(e-t)*n,Mt=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},kt=[st,nt,dt];function Vt(t){const e=(n=t,kt.find(t=>t.test(n)));var n;if(!e)return!1;let i=e.parse(t);return e===dt&&(i=function({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,n/=100;let s=0,o=0,r=0;if(e/=100){const i=n<.5?n*(1+e):n+e-n*e,a=2*n-i;s=Pt(a,i,t+1/3),o=Pt(a,i,t),r=Pt(a,i,t-1/3)}else s=o=r=n;return{red:Math.round(255*s),green:Math.round(255*o),blue:Math.round(255*r),alpha:i}}(i)),i}const Dt=(t,e)=>{const n=Vt(t),i=Vt(e);if(!n||!i)return At(t,e);const s={...n};return t=>(s.red=Mt(n.red,i.red,t),s.green=Mt(n.green,i.green,t),s.blue=Mt(n.blue,i.blue,t),s.alpha=Et(n.alpha,i.alpha,t),nt.transform(s))},Ct=new Set(["none","hidden"]);function Rt(t,e){return n=>Et(t,e,n)}function Lt(t){return"number"==typeof t?Rt:"string"==typeof t?Y(t)?At:pt.test(t)?Dt:Ft:Array.isArray(t)?Ot:"object"==typeof t?pt.test(t)?Dt:Bt:At}function Ot(t,e){const n=[...t],i=n.length,s=t.map((t,n)=>Lt(t)(t,e[n]));return t=>{for(let e=0;e<i;e++)n[e]=s[e](t);return n}}function Bt(t,e){const n={...t,...e},i={};for(const s in n)void 0!==t[s]&&void 0!==e[s]&&(i[s]=Lt(t[s])(t[s],e[s]));return t=>{for(const e in i)n[e]=i[e](t);return n}}const Ft=(t,e)=>{const n=wt(t),i=wt(e);return n.indexes.var.length===i.indexes.var.length&&n.indexes.color.length===i.indexes.color.length&&n.indexes.number.length>=i.indexes.number.length?Ct.has(t)&&!i.values.length||Ct.has(e)&&!n.values.length?function(t,e){return Ct.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}(t,e):p(Ot(function(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],r=t.indexes[o][i[o]],a=t.values[r]??0;n[s]=a,i[o]++}return n}(n,i),i.values),bt(i)):At(t,e)},jt=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/iu;function It(t,e,n){if("number"==typeof t&&"number"==typeof e&&"number"==typeof n)return Et(t,e,n);if("string"==typeof t&&"string"==typeof e){const n=function(t,e){const n=jt.exec(t);if(!n)return;const i=jt.exec(e);if(!i||n[2]!==i[2])return;const s=n[2],o=parseFloat(n[1]),r=parseFloat(i[1]);return t=>N(Et(o,r,t))+s}(t,e);if(n)return n}return Lt(t)(t,e)}const Ut=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Wt(t,e,n={delta:0,timestamp:0,isProcessing:!1}){let i=!1,s=!0;const o=()=>i=!0,r=Ut.reduce((t,e)=>(t[e]=function(t){let e,n=new Set,i=new Set,s=!1,o=!1;const r=new Set;let a={delta:0,timestamp:0,isProcessing:!1};function l(n){r.has(n)&&(i.add(n),t()),(e=n)(a)}const c={schedule:(t,o=!1,a=!1)=>{const l=a&&s,c=l?n:i;return o&&r.add(t),l&&t!==e&&c.delete(t),c.add(t),t},cancel:t=>{i.delete(t),r.delete(t)},process:t=>{if(a=t,s)return void(o=!0);s=!0;const r=n;n=i,i=r,n.forEach(l),n.clear(),e=void 0,s=!1,o&&(o=!1,c.process(t))}};return c}(o),t),{}),{setup:a,read:c,resolveKeyframes:h,preUpdate:u,update:d,preRender:p,render:m,postRender:f}=r,g=()=>{const o=l.useManualTiming,r=o?n.timestamp:performance.now();i=!1,o||(n.delta=s?1e3/60:Math.max(Math.min(r-n.timestamp,40),1)),n.timestamp=r,n.isProcessing=!0,a.process(n),c.process(n),h.process(n),u.process(n),d.process(n),p.process(n),m.process(n),f.process(n),n.isProcessing=!1,i&&e&&(s=!1,t(g))};return{schedule:Ut.reduce((e,o)=>{const a=r[o];return e[o]=(e,o=!1,r=!1)=>(i||(i=!0,s=!0,n.isProcessing||t(g)),a.schedule(e,o,r)),e},{}),cancel:t=>{for(let e=0;e<Ut.length;e++)r[Ut[e]].cancel(t)},state:n,steps:r}}const{schedule:Nt,cancel:Kt,steps:$t}=Wt("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:d,!0,j),zt=t=>{const e=({timestamp:e})=>t(e);return{start:(t=!0)=>Nt.update(e,t),stop:()=>Kt(e),now:()=>j.isProcessing?j.timestamp:W.now()}},Yt=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let e=0;e<s;e++)i+=Math.round(1e4*t(e/(s-1)))/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Xt=2e4;function Ht(t,e=50,n=2e4,i){let s=0,o=t.next(s);for(;!o.done&&s<n;)s+=e,o=t.next(s);return s>=n?1/0:s}const qt=t=>t<0?1/Math.max(1+t,.05):Math.max(1-t,.05);function _t(t,e){if(!(t>1))return 1;const n=Math.sqrt(t*t-1),i=t-n,s=t+n,o=2*n*Math.exp(-e)*(1+e);return Jt(t=>s*Math.exp(-i*t)-i*Math.exp(-s*t)-o,t=>Math.exp(-s*t)-Math.exp(-i*t),e)/e}function Zt(t,e){return t*Math.sqrt(1-e*e)}const Gt=12;function Jt(t,e,n){let i=n;for(let n=1;n<Gt;n++)i-=t(i)/e(i);return i}const Qt=.001;const te=(t,e)=>(e?t>=0:t>0)&&t<1/0;function ee(t,e){if(te(t,e))return t}function ne(t){const e=ee(t.stiffness),n=ee(t.damping,!0),i=ee(t.mass),s={...t,stiffness:e??100,damping:n??10,mass:i??1,isResolvedFromDuration:!1,isTimeDefined:void 0===(e??n??i)&&(void 0!==t.duration||void 0!==t.bounce)};if(s.isTimeDefined){if(t.visualDuration){const e=qt(t.bounce||0),n=2*Math.PI/(1.2*t.visualDuration)*_t(e,2*Math.PI/1.2);s.stiffness=n*n,s.damping=2*e*Math.sqrt(s.stiffness)}else Object.assign(s,function({duration:t=800,bounce:e=.3}){let n,i;const s=qt(e);t=a(.01,10,y(t)),s<1?(n=e=>{const n=e*s,i=n*t,o=Zt(e,s),r=Math.exp(-i);return Qt-n/o*r},i=e=>{const i=e*s*t,o=s*s*e*e*t,r=Math.exp(-i),a=Zt(e*e,s);return(-n(e)+Qt>0?-1:1)*-o*r/a}):(n=e=>Math.exp(-e*t)*(e*t+1)-.001,i=e=>Math.exp(-e*t)*(t*t*-e));const o=Jt(n,i,5/t),r=o*_t(s,o*t),l=r*r;return{stiffness:l,damping:2*s*Math.sqrt(l),duration:g(t)}}(s)),s.isResolvedFromDuration=!0;te(s.stiffness)&&te(s.damping,!0)||(s.stiffness=100,s.damping=10)}return s}function ie(t=.3,e=.3){const n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t,i=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],o={done:!1,value:i},{stiffness:r,damping:a,mass:l,duration:c,isResolvedFromDuration:h,isTimeDefined:u}=ne({...n}),d=t=>h?0:-y(t),p=a/(2*Math.sqrt(r*l)),m=y(Math.sqrt(r/l)),f=p*m,v={target:s,delta:s-i,velocity:d(n.velocity)||0,restSpeed:0,restDelta:0},x=()=>{const t=Math.abs(v.delta)<5;v.restSpeed=n.restSpeed||(t?.01:2),v.restDelta=n.restDelta||(t?.005:.5)};let w,b,T;if(x(),p<1){const t=Zt(m,p),e={A:0,sinC:0,cosC:0,t:-1,env:0,sin:0,cos:0};T=()=>{e.A=(v.velocity+f*v.delta)/t,e.sinC=f*e.A+v.delta*t,e.cosC=f*v.delta-e.A*t};const n=n=>{n!==e.t&&(e.t=n,e.env=Math.exp(-f*n),e.sin=Math.sin(t*n),e.cos=Math.cos(t*n))};w=t=>(n(t),v.target-e.env*(e.A*e.sin+v.delta*e.cos)),b=t=>(n(t),e.env*(e.sinC*e.sin+e.cosC*e.cos))}else if(1===p){w=t=>v.target-Math.exp(-m*t)*(v.delta+(v.velocity+m*v.delta)*t);const t={C:0};T=()=>{t.C=v.velocity+m*v.delta},b=e=>Math.exp(-m*e)*(m*t.C*e-v.velocity)}else{const t=m*Math.sqrt(p*p-1),e=f-t,n=f+t,i=t<1||u?1/0:300/t,s=(t,e)=>Math.exp(e>i?(f-t)*i-f*e:-t*e),o={S:0,F:0};T=()=>{const e=(v.velocity+f*v.delta)/t;o.S=(v.delta+e)/2,o.F=(v.delta-e)/2},w=t=>v.target-o.S*s(e,t)-o.F*s(n,t),b=t=>e*o.S*s(e,t)+n*o.F*s(n,t)}T();const S=h&&c||null,P={calculatedDuration:S,retarget:(t,e)=>{v.target=t[t.length-1],v.delta=v.target-t[0],v.velocity=d(e),n.restSpeed&&n.restDelta||x(),P.calculatedDuration=S,o.done=!1,T()},velocity:t=>g(b(t)),next:t=>{const e=w(t);if(h)o.done=t>=c;else{const n=g(b(t));o.done=Math.abs(n)<=v.restSpeed&&Math.abs(v.target-e)<=v.restDelta}return o.value=o.done?v.target:e,o},toString:()=>{const t=Math.min(Ht(P),Xt),e=Yt(e=>P.next(t*e).value,t,30);return t+"ms "+e}};return P}const se=Object.assign(ie,{applyToOptions:t=>{const e=function(t,e=100,n){const{keyframes:i,velocity:s}=t,o=i&&i[i.length-1]-i[0],r=n({...t,velocity:s&&o?s*e/o:s,keyframes:[0,e]}),a=Math.min(Ht(r),Xt);return{type:"keyframes",ease:t=>r.next(a*t).value/e,duration:y(a)}}(t,100,ie);return t.ease=e.ease,t.duration=g(e.duration),t.type="keyframes",t}});function oe({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:r,min:a,max:l,restDelta:c=.5,restSpeed:h}){const u=t[0],d={done:!1,value:u},p=t=>void 0===a?l:void 0===l||Math.abs(a-t)<Math.abs(l-t)?a:l;let m=n*e;const f=u+m,g=r?r(f):f;g!==f&&(m=g-u);const y=t=>-m*Math.exp(-t/i),v=t=>{const e=y(t);d.done=Math.abs(e)<=c,d.value=d.done?g:t?g+e:u};let x,w;const b=t=>{var e;((e=d.value)<a||e>l)&&(x=t,w=se({keyframes:[d.value,p(d.value)],velocity:-y(t)/i*1e3,damping:s,stiffness:o,restDelta:c,restSpeed:h}))};return b(0),{calculatedDuration:null,next:t=>{let e=!1;return w||void 0!==x||(e=!0,v(t),b(t)),void 0!==x&&t>=x?w.next(t-x):(!e&&v(t),d)}}}function re(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const o=t.length;if(1===o)return()=>e[0];if(2===o&&e[0]===e[1])return()=>e[1];const r=t[0]===t[1];t[0]>t[o-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=function(t,e,n){const i=[],s=l.mix||It,o=t.length-1;for(let r=0;r<o;r++){let o=n?.(t[r],t[r+1])||s(t[r],t[r+1]);if(e){const t=Array.isArray(e)?e[r]||d:e;o=p(t,o)}i.push(o)}return i}(e,i,s),h=c.length,u=n=>{if(r&&n<t[0])return e[0];let i=0;if(h>1)for(;i<t.length-2&&!(n<t[i+1]);i++);const s=m(t[i],t[i+1],n);return c[i](s)};return n?e=>u(a(t[0],t[o-1],e)):u}function ae(t){const e=[0];return function(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=m(0,e,i);t.push(Et(n,1,s))}}(e,t.length-1),e}function le({duration:t=300,keyframes:e,times:n,ease:i="easeInOut",mixer:s}){const o="number"==typeof e[0]?void 0:s,r=L(i)?i.map(F):F(i)||R,a={done:!1,value:e[0]};let c=-1;if(!o)for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]){if(c>=0){c=-2;break}c=t-1}if(c>=0){const i=n&&n.length===e.length?n:ae(e),s=i[c]*t,o=i[c+1]*t,h=e[c],u=e[c+1],d=Array.isArray(r)?r[c]:r,p=(l.mix||It)(h,u),m=e.length-2;return{calculatedDuration:t,next:e=>(a.value=c&&e<s?p(0):c<m&&(e>=o||!t)?"number"==typeof u?u:p(1):p(d(e>=o||!t?1:e<=s?0:(e-s)/(o-s))),a.done=e>=t,a)}}const h=function(t,e){return t.map(t=>t*e)}(n&&n.length===e.length?n:ae(e),t),u=re(h,e,{ease:Array.isArray(r)?r:(d=e,p=r,d.map(()=>p||R).splice(0,d.length-1)),mixer:o});var d,p;return{calculatedDuration:t,next:e=>(a.value=u(e),a.done=e>=t,a)}}function ce(t,e,n=0){return e<=0?n:t.velocity?t.velocity(e):function(t,e,n){const i=Math.max(e-5,0);return v(n-t(i),e-i)}(e=>t.next(e).value,e,t.next(e).value)}function he(t,{repeat:e,repeatType:n="loop"},i,s=1){let o,r,a=0;for(let e=0;e<t.length;e++){const n=t[e];null!==n&&(a++||(o=n),r=n)}const l=s<0||e&&"loop"!==n&&e%2==1?0:a-1;return l&&void 0!==i?i:l?r:o}const ue={decay:oe,inertia:oe,tween:le,keyframes:le,spring:se};function de(t){"string"==typeof t.type&&(t.type=ue[t.type])}const pe=(t,e)=>e-t>40&&!l.useManualTiming?e:t;function me(t,e){return{kind:t,animation:e,timestamp:W.now(),frameTimestamp:j.timestamp,frameIsProcessing:j.isProcessing}}function fe(t,e,n){const i=globalThis.__MOTION_INSPECT__;if(i)try{i({...me("animation-start",t),options:n?{...e,...n}:e})}catch{}}class ge{constructor(){this.isResolved=!1}get finished(){return this._finished||(this._finished=this.isResolved?Promise.resolve():new Promise(t=>{this._resolve=t})),this._finished}updateFinished(){this._finished=this._resolve=void 0,this.isResolved=!1}notifyFinished(){this.isResolved=!0,this._resolve?.()}then(t,e){return this.finished.then(t,e)}}const ye=t=>t/100,ve=t=>Math.round(1e4*t)/1e4;class xe extends ge{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:t}=this.options,e=W.now();t&&t.updatedAt!==e&&this.tick(t.updatedAt=e),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause(),fe(this,this.options)}initAnimation(){const{options:t}=this;de(t);const{type:e=le,repeat:n=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:r}=t;const a=e||le;this.mixKeyframes=void 0,a!==le&&"number"!=typeof r[0]&&(this.mixKeyframes=p(ye,t.mixer?.(r[0],r[1])||It(r[0],r[1])),r=[0,100]);const l=a(r===t.keyframes?t:{...t,keyframes:r});"mirror"===s&&(this.mirroredGenerator=a({...t,keyframes:[...r].reverse(),velocity:-o})),null===l.calculatedDuration&&(l.calculatedDuration=Ht(l));const{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+i,this.totalDuration=this.resolvedDuration*(n+1)-i,this.generator=l}updateTime(t){this.currentTime=this.holdTime??Math.round(t-this.startTime)*this.playbackSpeed}tick(t,e=!1){const{generator:n,totalDuration:i,calculatedDuration:s}=this;if(null===this.startTime)return n.next(0);const{delay:o=0,keyframes:r,type:a,onUpdate:l,finalKeyframe:c}=this.options;this.startTime===this.pendingStartTime&&(this.startTime=pe(this.startTime,t)),this.pendingStartTime=void 0,this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);const h=this.currentTime-o*(this.playbackSpeed>=0?1:-1),u=this.playbackSpeed>=0?h<0:h>i;this.currentTime=Math.max(h,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=i);const d=this.generate(this.currentTime,u);let{done:p}=d;u||(p=this.playbackSpeed>=0?s<1/0?this.currentTime>=i:p:this.currentTime<=0);const m=null===this.holdTime&&("finished"===this.state||"running"===this.state&&p);return m&&a!==oe&&(d.value=he(r,this.options,c,this.speed)),l&&l(d.value),m&&this.finish(),d}at(t){return this.holdTime??ve((t-this.startTime)*this.playbackSpeed)}sampleAt(t,e){const{options:n,totalDuration:i}=this,s=this.at(t)-(n.delay||0);return s>=i&&n.type!==oe?he(n.keyframes,n,e?void 0:n.finalKeyframe):this.generate(Math.max(s,0),s<0).value}generate(t,e){const{generator:n,totalDuration:i,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:r}=this,{keyframes:l,repeat:c,repeatType:h,repeatDelay:u}=this.options;let d,p=t,m=n;if(c){const e=Math.min(t,i)/r;let n=Math.floor(e),s=e%1;!s&&e>=1&&(s=1),1===s&&n--,n=Math.min(n,c+1);Boolean(n%2)&&("reverse"===h?(s=1-s,u&&(s-=u/r)):"mirror"===h&&(m=o)),p=a(0,1,s)*r}return e?(this.delayState.value=l[0],d=this.delayState):d=m.next(p),s&&!e&&(d.value=s(d.value)),d}get duration(){return y(this.calculatedDuration)}get iterationDuration(){return this.duration+y(this.options.delay??0)}get time(){return y(this.currentTime)}set time(t){"finished"===this.state&&this.updateFinished(),t=g(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){return ce(this.generator,this.currentTime,this.options.velocity)}get speed(){return this.playbackSpeed}set speed(t){const e=this.playbackSpeed!==t;e&&this.driver&&this.updateTime(W.now()),this.playbackSpeed=t,e&&this.driver&&(this.time=y(this.currentTime))}play(){if(this.isStopped)return;const{driver:t=zt,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();const n=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=n):null!==this.holdTime?this.startTime=n-this.holdTime/(this.playbackSpeed||1):this.startTime||(this.startTime=e??(this.pendingStartTime=n)),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(W.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.driver?.stop(),this.driver=void 0,this.startTime=this.holdTime=null}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}const we=new Set(["brightness","contrast","saturate","opacity"]);function be(t){const[e,n]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;const[i]=n.match(G)||[];if(!i)return t;const s=n.replace(i,"");let o=we.has(e)?1:0;return i!==n&&(o*=100),e+"("+o+s+")"}const Te=/\b([a-z-]*)\(.*?\)/gu,Se={...St,getAnimatableNone:t=>{const e=t.match(Te);return e?e.map(be).join(" "):t}},Pe={...St,getAnimatableNone:t=>{const e=St.parse(t);return St.createTransformer(t)(e.map(t=>"number"==typeof t?0:"object"==typeof t?{...t,alpha:1}:t))}},Ae={...q,transform:Math.round},Ee={rotate:rt,pathRotation:rt,rotateX:rt,rotateY:rt,rotateZ:rt,scale:Z,scaleX:Z,scaleY:Z,scaleZ:Z,skew:rt,skewX:rt,skewY:rt,distance:lt,translateX:lt,translateY:lt,translateZ:lt,x:lt,y:lt,z:lt,perspective:lt,transformPerspective:lt,opacity:_,originX:ut,originY:ut,originZ:lt},Me={borderWidth:lt,borderTopWidth:lt,borderRightWidth:lt,borderBottomWidth:lt,borderLeftWidth:lt,borderRadius:lt,borderTopLeftRadius:lt,borderTopRightRadius:lt,borderBottomRightRadius:lt,borderBottomLeftRadius:lt,width:lt,maxWidth:lt,height:lt,maxHeight:lt,top:lt,right:lt,bottom:lt,left:lt,inset:lt,insetBlock:lt,insetBlockStart:lt,insetBlockEnd:lt,insetInline:lt,insetInlineStart:lt,insetInlineEnd:lt,padding:lt,paddingTop:lt,paddingRight:lt,paddingBottom:lt,paddingLeft:lt,paddingBlock:lt,paddingBlockStart:lt,paddingBlockEnd:lt,paddingInline:lt,paddingInlineStart:lt,paddingInlineEnd:lt,margin:lt,marginTop:lt,marginRight:lt,marginBottom:lt,marginLeft:lt,marginBlock:lt,marginBlockStart:lt,marginBlockEnd:lt,marginInline:lt,marginInlineStart:lt,marginInlineEnd:lt,fontSize:lt,backgroundPositionX:lt,backgroundPositionY:lt,...Ee,zIndex:Ae,fillOpacity:_,strokeOpacity:_,numOctaves:Ae},ke={...Me,color:pt,backgroundColor:pt,outlineColor:pt,fill:pt,stroke:pt,borderColor:pt,borderTopColor:pt,borderRightColor:pt,borderBottomColor:pt,borderLeftColor:pt,filter:Se,WebkitFilter:Se,mask:Pe,WebkitMask:Pe},Ve=t=>ke[t],De=new Set([Se,Pe]);let Ce,Re,Le;function Oe(t,e){if(t===Ce&&e===Re)return Le;let n=Ve(t);return De.has(n)||(n=St),Le=n.getAnimatableNone?n.getAnimatableNone(e):void 0,Ce=t,Re=e,Le}const Be=t=>180*t/Math.PI,Fe=t=>{const e=Be(Math.atan2(t[1],t[0]));return Ie(e)},je={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scaleZ:()=>1,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Fe,rotateZ:Fe,skewX:t=>Be(Math.atan(t[1])),skewY:t=>Be(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Ie=t=>((t%=360)<0&&(t+=360),t),Ue=t=>Math.hypot(t[0],t[1]),We=t=>Math.hypot(t[4],t[5]),Ne={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Ue,scaleY:We,scaleZ:t=>Math.hypot(t[8],t[9],t[10]),scale:t=>(Ue(t)+We(t))/2,rotateX:t=>Ie(Be(Math.atan2(t[6],t[5]))),rotateY:t=>Ie(Be(Math.atan2(-t[2],t[0]))),rotateZ:Fe,rotate:Fe,skewX:t=>Be(Math.atan(t[4])),skewY:t=>Be(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ke(t){return t.includes("scale")?1:0}function $e(t,e){if(!t||"none"===t)return Ke(e);const n=t.match(/^matrix(3d)?\(([-\d.e\s,]+)\)$/u);if(!n)return Ke(e);const i=(n[1]?Ne:je)[e],s=n[2].split(",").map(t=>parseFloat(t));return"function"==typeof i?i(s):s[i]}const ze=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return $e(n,e)},Ye=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","scaleZ","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Xe=(()=>new Set([...Ye,"pathRotation"]))(),He=t=>t===q||t===lt,qe=new Set(["x","y","z"]),_e=Ye.filter(t=>!qe.has(t));const Ze=new Set(["bottom","right"]);function Ge(t,e,n,i,s,o){const r=parseFloat(t);if(!isNaN(r))return r;const{min:a,max:l}=e()[n],c=l-a;return"border-box"===o?c:c-parseFloat(i)-parseFloat(s)}const Je=({transform:t})=>$e(t,"x"),Qe=({transform:t})=>$e(t,"y"),tn={width:({width:t,paddingLeft:e="0",paddingRight:n="0",boxSizing:i},s)=>Ge(t,s,"x",e,n,i),height:({height:t,paddingTop:e="0",paddingBottom:n="0",boxSizing:i},s)=>Ge(t,s,"y",e,n,i),top:({top:t})=>parseFloat(t),left:({left:t})=>parseFloat(t),bottom:({top:t},e)=>{const{y:n}=e();return parseFloat(t)+(n.max-n.min)},right:({left:t},e)=>{const{x:n}=e();return parseFloat(t)+(n.max-n.min)},x:Je,y:Qe,translateX:Je,translateY:Qe},en=new Set;let nn=!1,sn=!1,on=!1;function rn(){if(sn){const t=[],e=new Set,n=new Set;en.forEach(i=>{i.needsMeasurement&&(t.push(i),e.add(i.element),Ze.has(i.name)&&n.add(i.element))});const i=new Map;n.forEach(t=>{const e=function(t){const e=[];return _e.forEach(n=>{const i=t.getValue(n);if(void 0!==i){const t=i.get(),s=n.startsWith("scale")?1:0;if(t===s)return;e.push([n,t]),i.set(s)}}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();const e=i.get(t);e&&e.forEach(([e,n])=>{t.getValue(e)?.set(n)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}sn=!1,nn=!1,en.forEach(t=>t.complete(on)),en.clear()}function an(){en.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(sn=!0)})}class ln{constructor(t,e,n,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=n,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(en.add(this),nn||(nn=!0,Nt.read(an),Nt.resolveKeyframes(rn))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:e,element:n,motionValue:i}=this;if(null===t[0]){const s=i?.get(),o=t[t.length-1];if(void 0!==s)t[0]=s;else if(n&&e){const i=function(t,e,n){if("string"==typeof t){if(c(t)||u(t))return parseFloat(t);if(!St.test(t)&&St.test(n))return Oe(e,n)}return t??void 0}(n.readValue(e,o),e,o);void 0!==i&&(t[0]=i)}void 0===t[0]&&(t[0]=o),i&&void 0===s&&i.set(t[0])}!function(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),en.delete(this)}cancel(){"scheduled"===this.state&&(en.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}const cn=t=>t.startsWith("--");function hn(t,e,n){cn(e)?t.style.setProperty(e,n):t.style[e]=n}const un={};function dn(t,e){const n=function(t){let e;return()=>(void 0===e&&(e=t()),e)}(t);return()=>un[e]??n()}const pn=dn(()=>void 0!==window.ScrollTimeline,"scrollTimeline"),mn=dn(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),fn=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,gn={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:fn([0,.65,.55,1]),circOut:fn([.55,0,1,.45]),backIn:fn([.31,.01,.66,-.59]),backOut:fn([.33,1.53,.69,.99])};function yn(t,e){return t?"function"==typeof t?mn()?Yt(t,e):"ease-out":O(t)?fn(t):Array.isArray(t)?t.map(t=>yn(t,e)||gn.easeOut):gn[t]:void 0}function vn(t,e,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:r="loop",ease:a="easeOut",times:l}={},c=void 0){const h={[e]:n};l&&(h.offset=l);const u=yn(a,s);Array.isArray(u)&&(h.easing=u);const d={delay:i,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:o+1,direction:"reverse"===r?"alternate":"normal"};return c&&(d.pseudoElement=c),t.animate(h,d)}function xn(t){return"function"==typeof t&&"applyToOptions"in t}class wn extends ge{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:e,name:n,keyframes:i,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:r,onComplete:a}=t;this.isPseudoElement=Boolean(s),this.allowFlatten=o,this.options=t;const l=function({type:t,...e}){return xn(t)&&mn()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=vn(e,n,i,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=this.onFinish=()=>{if(this.animation.onfinish=null,this.finishedTime=this.time,!s){const t=he(i,this.options,r,this.speed);this.updateMotionValue?.(t),hn(e,n,t),this.animation.cancel()}a?.(),this.notifyFinished()},fe(this,t,l)}play(){this.isStopped||(this.manualStartTime=null,this.animation.onfinish=this.onFinish,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.isStopped||(this.animation.onfinish=this.onFinish),this.animation.finish?.()}cancel(){this.animation.onfinish=null;try{this.animation.cancel()}catch(t){}}stop(){this.isStopped||(this.isStopped=!0,"idle"!==this.state&&null===this.finishedTime&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel()))}commitStyles(){const t=this.options?.element;!this.isPseudoElement&&t?.isConnected&&this.animation.commitStyles?.()}get duration(){const t=this.animation.effect?.getComputedTiming?.().duration||0;return y(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+y(t)}get time(){return y(Number(this.animation.currentTime)||0)}set time(t){const e=null!==this.finishedTime;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=g(t),e&&(this.animation.pause(),this.updateFinished())}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,onAttach:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=this.onFinish=null,t&&pn()?(this.animation.timeline=t,e?.(this.animation),d):n(this)}}const bn={anticipate:E,backInOut:A,circInOut:V};function Tn(t){"string"==typeof t.ease&&t.ease in bn&&(t.ease=bn[t.ease])}class Sn extends wn{constructor(t){Tn(t),de(t),super(t),void 0!==t.startTime&&!1!==t.autoplay&&(this.startTime=t.startTime),this.options=t}elapsed(){return"running"===this.state?(W.now()-this.startTime)*this.speed:1e3*this.time}sample(t){if(!this.sampler){const{motionValue:t,onUpdate:e,onComplete:n,onPlay:i,onStop:s,element:o,...r}=this.options;this.sampler=new xe({...r,autoplay:!1}),this.sampler.stop()}return this.sampler.sample(Math.max(0,t)).value}liveValue(){const{state:t}=this;if("running"===t||"paused"===t)return this.sample(this.elapsed())}updateMotionValue(t){const{motionValue:e,element:n,name:i}=this.options;if(!e)return;if(void 0!==t)return void e.set(t);const{speed:s}=this,o=this.elapsed(),r="running"===this.state&&s?a(0,10,o):0,l=this.sample(o);n&&i&&hn(n,i,l),e.setWithVelocity(this.sample(o-r*Math.sign(s)),l,r/Math.abs(s||1))}}const Pn=(t,e)=>"zIndex"!==e&&(!("number"!=typeof t&&!Array.isArray(t))||!("string"!=typeof t||!St.test(t)&&"0"!==t||t.startsWith("url(")));function An(t){t.duration=0,t.type="keyframes"}const En=new Set(["opacity","clipPath","filter","transform"]),Mn=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;const kn=({mixer:t,keyframes:e})=>t&&"number"!=typeof e[0]&&e.some((n,i)=>i&&t(e[i-1],n)),Vn=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),Dn=()=>!l.useManualTiming&&Object.hasOwnProperty.call(Element.prototype,"animate");function Cn(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:o,type:r,keyframes:a}=t;if(!n||!En.has(n)&&!Vn.has(n))return!1;const l=e?.owner?.current;if(!(l instanceof HTMLElement||l instanceof SVGElement))return!1;const{onUpdate:c,transformTemplate:h}=e.owner.getProps();return Dn()&&(En.has(n)||Vn.has(n)&&function(t){for(let e=0;e<t.length;e++)if("string"==typeof t[e]&&Mn.test(t[e]))return!0;return!1}(a))&&("transform"!==n||!h)&&!c&&!i&&"mirror"!==s&&0!==o&&"inertia"!==r&&!kn(t)}const Rn=(t,e)=>e&&"number"==typeof t?e.transform(t):t,Ln={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},On=Ye.length,Bn={},Fn=(t,e,n=Rn(e,Ee[t]))=>(Bn[t]||(Bn[t]=(Ln[t]||t)+"("))+n+")",jn=(t,e)=>("number"==typeof e?e:parseFloat(e))===(t.startsWith("scale")?1:0);const In=new WeakMap,Un=.001,Wn=100,Nn=new Set(["linear","easeIn","easeOut","easeInOut"]),Kn=new WeakMap,$n=(t,e)=>Math.min(200,Math.max(2,Math.ceil((e-t)/10))),zn=(t,e)=>Math.abs(t-e)<=.001,Yn=(t,e)=>t-e,Xn=(t,e,n)=>ae(Array(n+1)).map(n=>Et(t,e,n)),Hn=t=>t.motionValue.owner,qn=t=>In.get(t),_n=({state:t})=>"idle"===t||"finished"===t,Zn=(t,e)=>t.latestValues?t.latestValues[e]:t.getValue(e)?.get();class Gn{constructor(t,e,n,i){this.element=t,this.update=e,this.makeDriver=n,this.animation=i}get js(){return this.driver||(this.driver=this.makeDriver(this.update))}now(){return this.driver||this.makeDriver!==zt?this.js.now():j.isProcessing?j.timestamp:W.now()}start(t=!0){const e=qn(this.element);!e||e.isJS?this.js.start(t):e.schedule(!1,!t)}stopJS(){this.driver?.stop()}stop(){this.stopJS();const t=qn(this.element);t&&!t.isFinishing&&t.release(this.animation)}}let Jn,Qn;class ti extends xe{constructor(t){const e=Hn(t).current,{driver:n=zt}=t;let i;const s=function(t){const e=Hn(t),{onUpdate:n,transformTemplate:i}=e.getProps();return!(t.isHandoff||n||t.hasOnUpdate||i||"inertia"===t.type||"none"!==(Zn(e,"transform")||"none")||Zn(e,"pathRotation")||e.projection?.isProjecting()||kn(t))}(t);t.driver=t=>new Gn(e,t,n,i),super(t),i=this;const o=this.driver;o&&(o.animation=this),this.canAccelerate=s;const{stop:r}=this;this.stop=()=>{this.isAccelerated()&&this.sync(),r()}}offsets(){const{keyframes:t,times:e}=this.options;return e||(this.offsetsOf!==t&&(this.offsetsOf=t,this.cachedOffsets=ae(t)),this.cachedOffsets)}get group(){return qn(Hn(this.options).current)}get js(){return this.driver?.js}stopJS(){this.driver?.stopJS()}get name(){return this.options.name}timing(){const{startTime:t,speed:e,totalDuration:n}=this,{delay:i=0,repeatType:s}=this.options;return null!==this.holdTime?[1/0,0]:n===1/0?[t+i/e,this.resolvedDuration*("loop"===s?1:2)/e||1]:[t+(i+n)/e,0]}isAccelerated(){const{group:t,state:e}=this;return t?.tracks.has(this)&&!t.isJS&&this.canAccelerate&&("running"===e||"paused"===e)}liveValue(){return this.isAccelerated()?this.sampleAt(W.now()):void 0}tween(){const{keyframes:t,type:e,repeat:n,delay:i=0}=this.options;let s=-1;if(n||e!==le||null!==this.holdTime)return;for(let e=1;e<t.length;e++)if(t[e]!==t[e-1]){if(s>=0)return;s=e-1}let{ease:o}=this.options;L(o)&&(o=o[s]);const r=this.offsets(),a=t=>this.startTime+(i+r[t]*this.totalDuration)/this.speed;if(s>=0){const t=O(o)?fn(o):(t=>Nn.has(t))(o)?gn[o]:F(o);return[a(s),a(s+1),"string"==typeof t||zn(t(0),0)&&zn(t(1),1)?t:void 0]}}boundaries(t,e){const{startTime:n,speed:i,resolvedDuration:s,options:o}=this,{delay:r=0,repeat:a=0,repeatDelay:l=0,repeatType:c,type:h}=o,u=(h||le)===le?this.offsets():[0,1],d=n+r/i,p=[];if(null!==this.holdTime||!(s>0))return p;for(let n=Math.max(0,Math.floor((t-d)*i/s));n<=a;n++){const o=d+n*s/i;if(o>e)break;for(const r of u){const a=o+(n%2&&c&&"loop"!==c?1-r:r)*(s-l)/i;a>t&&a<e&&p.push(a)}}return p}numberAt(t){return parseFloat(this.sampleAt(t,!0))}sync(){const t=W.now(),e=this.sampleAt(t,!0);this.options.motionValue.setWithVelocity(null===this.holdTime?this.sampleAt(t-10,!0):e,e,10)}play(){this.isStopped||((this.group||function(t){const e=t.current,n=new Set,i=new Map;let s,o,r={},a=[],l=new Map,c=[],h=!1,u=!1,d=!1,p=!1,f=-1/0,g=1/0;const y=t=>{for(const e of n)if(e.name===t)return!0},v=(e,n)=>{const s={};for(const o of void 0===e?Ye:a){const a=i.get(o),l=void 0===e?Zn(t,o):a?a.sampleAt(n>e&&!a.timing()[1]?n:e):r[o];void 0!==l&&(s[o]=l)}return s},x=(t,e)=>{let n="";for(const i in t){const s=t[i];e&&jn(i,s)||(n+=Fn(i,s)+" ")}return(e?n.trim():n)||"none"},w=(t,e)=>x(v(t,e)),b=(t=v())=>{e.style.transform=x(t,!0)},T=t=>{t.onfinish=t.oncancel=null,t.cancel()},S=(t=!0)=>{clearTimeout(s),g=1/0,o=void 0,t&&b(),c.forEach(({animation:t})=>T(t)),c=[]},P=(t,n)=>new Animation(new KeyframeEffect(e,t,n)),A=(t,e,n=1/0)=>{const i={animation:t,offset:e,end:n};t.startTime=W.now()+e,n<1/0&&(t.onfinish=()=>{i.isDone=!0,c.some(t=>t.end===1/0)&&(T(t),c=c.filter(t=>t!==i)),F.schedule(!1)}),t.oncancel=()=>c.includes(i)&&F.demote(),c.push(i)},E=(t,e,n)=>{const i=(e,n)=>Math.abs(t(n)-t(e)),s=i(e,n);for(;n-e>.01;){const t=(e+n)/2;i(e,t)>i(t,n)?n=t:e=t}return i(e,n)>s/2?[e,n]:[]},M=(t,e,n,i)=>{const s=$n(e,n);if(4*i.length>s)return;let o;for(const i of t){const t=i.numberAt(e),s=(i.numberAt((e+n)/2)-t)/(i.numberAt(n)-t);if(s==s)if(void 0===o)o=s;else if(!zn(s,o))return}const r=Xn(e,n,s).concat(i).sort(Yn),a=t=>m(e,n,t);let l,c;for(const n of t){const t=n.numberAt(e),i=r.map(e=>n.numberAt(e)-t),s=i[i.length-1],o=i.some(t=>Math.abs(t)*Un>Math.abs(s))?0:s,a=i.map(t=>o?t/o:t);if(o&&!l)l=a,c=e=>(n.numberAt(e)-t)/o;else if(a.some((t,e)=>!zn(t,o&&l[e])))return}if(!l||l.every((t,e)=>zn(t,a(r[e]))))return"linear";const h=[],u=(t,e=c(t))=>h.push(ve(e)+" "+ve(100*a(t))+"%");return l.forEach((t,e)=>{e&&Math.abs(t-l[e-1])>.2&&E(c,r[e-1],r[e]).forEach(t=>u(t)),u(r[e],t)}),"linear("+h+")"},k=(t,e,n,i)=>{const s=[e],o=[];let r=n,a=e;for(const i of t){const t=i.tween();if("linear"!==t?.[2]){const[s,l]=i.timing(),[c,h]=t||[e,l?n:s];r=Math.min(r,c),a=Math.max(a,h),o.push(i)}}r=Math.max(e,r),a=Math.min(n,a);const l=(t,e)=>o.every(n=>!(Math.abs(n.numberAt((t+e)/2)-(n.numberAt(t)+n.numberAt(e))/2)>(n.name.startsWith("scale")?.001:.1))),c=(e,n,i)=>{if(n-e<1||l(e,n))s.push(n);else if(i<4)c(e,(e+n)/2,i+1),c((e+n)/2,n,i+1);else{for(const i of t)s.push(...E(t=>i.numberAt(t),e,n));s.push(n)}},h=a>r?Xn(r,a,Math.ceil((a-r)/100)):[];h.push(n);for(const t of i)h.push(t,Math.min(t+.01,n));let u=e;for(const t of h.sort(Yn))t>u&&c(u,t,0),u=t;return s.sort(Yn)},V=t=>{let e;for(const n of t){const t=n.tween();if(!t||e&&(Math.abs(t[0]-e[0])>1||Math.abs(t[1]-e[1])>1))return;e=[t[0],t[1],e&&t[2]!==e[2]?void 0:t[2]]}return e},D=(t,e,n,i,s={fill:"both"},o)=>{const r=i?[]:t.flatMap(t=>t.boundaries(e,n)),a=i||M(t,e,n,r),l=a?[e,n]:k(t,e,n,r),c=l.map(t=>w(t,o));let h={transform:c};return a||(h.offset=l.map(t=>m(e,n,t))),c.every(t=>t===c[0])&&(b(v(e,o)),h=null),P(h,{...s,duration:n-e,easing:a||"linear"})},C=t=>{const e=W.now()+t;e<g&&(clearTimeout(s),g=e,s=setTimeout(()=>{g=1/0,F.schedule(!1)},t))},R=e=>{let s=e,h=0,u=0;const d=[],p=[],m=new Set;i.clear(),l=new Map;for(const t of n){i.set(t.name,t);const[n,o]=t.timing(),r=n===1/0;if(l.set(t,[t.at(e),t.speed,r]),!r){if(t.speed<0)return;if(o){if(h){const t=(n-u)/o;if(Math.abs(o-h)>1||Math.abs(t-Math.round(t))*h>1)return}else h=o,u=n;p.push(t)}else m.add(n);d.push(t),s=Math.max(s,n)}}r={},a=Ye.filter(e=>{if(i.has(e))return!0;const n=r[e]=Zn(t,e);return void 0!==n&&!jn(e,n)}),S(!1);const f=!h&&V(d);try{if(s>e){let t;if(f&&f[1]>e){const[n,i,r]=f;if(n-e>Wn)return d.forEach(t=>t.sync()),C(o=n-e-Wn),!0;t="string"==typeof r?r:r?((t,e)=>{let n=Kn.get(t);return n?.[0]!==e&&(n=[e,"linear("+ae(Array(e+1)).map(e=>ve(t(e))+" "+ve(100*e)+"%")+")"],Kn.set(t,n)),n[1]})(r,$n(n,i)):M(d,n,i,[]),t&&A(D(d,n,i,t,{fill:"both",endDelay:s-i}),n-e,s-n)}t||A(D(d,e,s),0,s-e),m.forEach(t=>t<s-1&&A(P(null,{duration:t-e}),0,t-e))}if(h){const t=u+Math.floor((s-u)/h)*h;A(D(p,t,t+h,void 0,{iterations:1/0,iterationStart:(s-t)/h,fill:"forwards"},s),s-e)}}catch{return}return c.length||S(),!0},L=(t,e)=>{let i,s=0;for(const e of n){const n=l.get(e);if(!n)return!1;const[o,r,a]=n,h=e.at(t),u=e.timing()[0]===1/0;if(a){if(u&&(h===o||!c.length))continue;return!1}const d=(h-o)/r,p=u?0:e.speed/r;if(void 0===i)i=d,s=p;else if(Math.abs(d-i)>1||p!==s)return!1}if(void 0===i)return!0;if(!c.length){if(void 0===o||e&&s)return!1;if(s){const t=(o-i)/s;if(t<1)return!1;C(t)}return!0}for(const{offset:t,end:n,isDone:s}of c){const o=i-t;if(n<1/0&&(s?o<n-1:o<0&&(e||t<=0)||o>=n))return!1}for(const{animation:e,offset:n,isDone:o}of c){if(o)continue;const r=i-n;s&&e.updatePlaybackRate&&"running"===e.playState&&Math.abs(Number(e.currentTime)-r)<20?e.playbackRate!==s&&e.updatePlaybackRate(s):s?(e.playbackRate!==s&&(e.playbackRate=s),e.startTime=t-r/s):(e.startTime=null,e.currentTime=r)}return!0},O=()=>!n.size&&(d=!0,qn(e)===F&&In.delete(e),F.isJS||S(),!0),B=()=>{const e=W.now();if(F.isJS||(F.isFinishing=!0,n.forEach(n=>{const[i,s]=n.timing();"running"===n.state&&n.speed>0&&!s&&i<=e+1&&(n.complete(),r[n.name]=Zn(t,n.name),l.has(n)||(h=!0))}),F.isFinishing=!1),u=!1,d)return;if(n.forEach(t=>_n(t)&&n.delete(t)),O())return;for(const t of n)if(!t.canAccelerate)return F.demote(!0);F.isJS&&(F.isJS=!1,h=!0,n.forEach(t=>t.stopJS()));const i=h,s=p;if(h=p=!1,i||!L(e,s)){if(s){if(e-f<100)return F.demote();f=e}if(!R(e))return F.demote()}else if(void 0!==o&&!s)return;n.forEach(t=>t.timing()[0]===1/0&&t.sync())},F={tracks:n,isJS:!1,isFinishing:!1,schedule(t,e){d||(h||(h=t),p||(p=!!e),u||(u=!0,j.isProcessing?Nt.render(B,!1,!0):ei(B)))},release(t){_n(t)&&n.delete(t),O()||F.schedule(!0)},check(){if(!F.isJS)for(const e in r)if(Zn(t,e)!==r[e]&&!y(e))return F.schedule(!0,!0)},demote(t){if(!F.isJS&&!d)return n.forEach(e=>{e.isAccelerated()&&e.sync(),t||(e.canAccelerate=!1)}),F.isJS=!0,l=new Map,S(),n.forEach(t=>"running"===t.state&&t.js?.start()),!0}};return In.set(e,F),F}(Hn(this.options))).tracks.add(this),super.play())}pause(){super.pause(),this.isAccelerated()&&this.group.schedule(!1)}complete(){super.complete();const{group:t}=this;t&&!t.isJS&&this.tick(W.now())}get time(){return this.isAccelerated()?y(a(0,this.totalDuration,this.at(W.now())-(this.options.delay||0))):super.time}set time(t){(Jn??(Jn=Object.getOwnPropertyDescriptor(xe.prototype,"time").set)).call(this,t)}attachTimeline(t){return this.canAccelerate=!1,this.group?.demote(!0),super.attachTimeline(t)}}const ei=t=>{Qn||queueMicrotask(()=>{const t=Qn;Qn=void 0,t.forEach(t=>t())}),(Qn||(Qn=[])).push(t)};class ni extends ge{constructor(t){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=W.now();const{keyframes:e,name:n,motionValue:i,element:s}=t,o=t;o.autoplay??(o.autoplay=!0),o.delay??(o.delay=0),o.type??(o.type="keyframes"),o.repeat??(o.repeat=0),o.repeatDelay??(o.repeatDelay=0),o.repeatType??(o.repeatType="loop");const r=s?.KeyframeResolver||ln;this.keyframeResolver=new r(e,(t,e,n)=>this.onKeyframesResolved(t,e,o,!n),n,i,s),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,n,i){this.keyframeResolver=void 0;const{name:s,type:o,velocity:r,delay:a,isHandoff:c,onUpdate:h}=n;this.resolvedAt=W.now();const u=function(t,e,n,i){const s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;const o=t[t.length-1],r=Pn(s,e),a=Pn(o,e);return!(!r||!a)&&(function(t){const e=t[0];if(1===t.length)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}(t)||("spring"===n||xn(n))&&i)}(t,s,o,r);u||(!l.instantAnimations&&a||h?.(he(t,n,e)),t[0]=t[t.length-1],An(n),n.repeat=0);const{onComplete:d}=n;n.finalKeyframe=e,n.keyframes=t,n.onComplete=()=>{d?.(),this.notifyFinished()};const p=u&&!c&&Cn(n),m=!p&&(({name:t,motionValue:e})=>t&&Ye.includes(t)&&e?.owner?.current instanceof HTMLElement&&Dn()&&mn())(n);let f;if(i&&(p||m||this.resolvedAt!==this.createdAt)&&(n.startTime??(n.startTime=pe(this.createdAt,this.resolvedAt))),p){n.element=n.motionValue?.owner?.current;try{f=new Sn(n)}catch{f=new xe(n)}}else f=m?new ti(n):new xe(n);this.pendingTimeline&&(this.stopTimeline=f.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=f}get finished(){return this._animation?this._animation.finished:super.finished}then(t,e){return this.finished.finally(t).then(()=>{})}liveValue(){return this._animation?.liveValue?.()}get animation(){return this._animation||(this.keyframeResolver?.resume(),on=!0,an(),rn(),on=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation?.cancel(),this.keyframeResolver?.cancel()}}class ii{constructor(t){this.stop=()=>{for(const t of this.animations)t.stop()},this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}attachTimeline(t){const e=this.animations.map(e=>e.attachTimeline(t));return()=>{e.forEach((t,e)=>{t&&t(),this.animations[e].stop()})}}get time(){return this.getAll("time")}set time(t){for(const e of this.animations)e.time=t}get speed(){return this.getAll("speed")}set speed(t){for(const e of this.animations)e.speed=t}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return si(this.animations,"duration")}get iterationDuration(){return si(this.animations,"iterationDuration")}play(){for(const t of this.animations)t.play()}pause(){for(const t of this.animations)t.pause()}cancel(){for(const t of this.animations)t.cancel()}complete(){for(const t of this.animations)t.complete()}}function si(t,e){let n=0;for(let i=0;i<t.length;i++){const s=t[i][e];null!==s&&s>n&&(n=s)}return n}function oi(t,e,n,i=0,s=1){const o=Array.from(t).sort((t,e)=>t.sortNodePosition(e)).indexOf(e),r=t.size,a=(r-1)*i;return"function"==typeof n?n(o,r):1===s?o*i:a-o*i}const ri={current:void 0};class ai{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=t=>{const e=W.now();if(this.updatedAt!==e&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.dirty(),this.dependents))for(const t of this.dependents)t.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){var e;this.current=t,this.updatedAt=W.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=(e=this.current,!isNaN(parseFloat(e))))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){var n;return"change"===t?this.onChangeSubscribe(e):((n=this.events)[t]||(n[t]=new f)).add(e)}onChangeSubscribe(t){const{events:e}=this;return e.change||this.changeSubscriber?(e.change||(e.change=new f,e.change.add(this.changeSubscriber),this.changeSubscriber=void 0),e.change.add(t)):this.changeSubscriber=t,()=>{this.changeSubscriber===t?this.changeSubscriber=void 0:e.change?.remove(t),this.stopIfUnobserved()}}stopIfUnobserved(){Nt.read(()=>{this.changeSubscriber||this.events.change?.getSize()||this.stop()})}clearListeners(){this.changeSubscriber=void 0;for(const t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,e,n){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,e=!0){e&&(this.updatedAt=W.now(),this.stop()),this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,this.stopPassiveEffect?.()}dirty(){const{current:t,changeSubscriber:e}=this;e?e(t):this.events.change?.notify(t)}addDependent(t){(this.dependents||(this.dependents=new Set)).add(t)}removeDependent(t){this.dependents?.delete(t)}get(){ri.current?.push(this);const t=this.animation?.liveValue?.();return void 0===t?this.current:t}getCurrent(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=W.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,30);return v(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(t){return new Promise(e=>this.run(t,e))}run(t,e){this.stop(),this.hasAnimated=!0;let n,i=!1;n=t(()=>{i=!0,this.events.animationComplete?.notify(),this.animation===n&&(this.animation=void 0),e?.()}),i||(this.animation=n),this.events.animationStart?.notify()}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel?.notify()),this.animation=void 0}isAnimating(){return!!this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect?.()}}function li(t,e){return new ai(t,e)}function ci(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function hi(t,e){const n=t?.[e]??t?.default??t;return n!==t?ci(n,t):n}const ui={type:"spring",stiffness:500,damping:25,restSpeed:10},di={type:"keyframes",duration:.8},pi={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},mi=(t,{keyframes:e})=>e.length>2?di:Xe.has(t)?t.startsWith("scale")?{type:"spring",stiffness:550,damping:0===e[1]?2*Math.sqrt(550):30,restSpeed:10}:ui:pi,fi=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed","out","mixer"]);const gi=(t,e,n,i={},s,o)=>r=>{const a=hi(i,t)||{},c=a.delay||i.delay||0;let{elapsed:h=0}=i;h-=g(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-h,onUpdate:t=>{e.set(t),a.onUpdate&&a.onUpdate(t)},onComplete:()=>{r(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:o?void 0:s,hasOnUpdate:!!a.onUpdate};(function(t){for(const e in t)if(!fi.has(e))return!0;return!1})(a)||Object.assign(u,mi(t,u)),u.duration&&(u.duration=g(u.duration)),u.repeatDelay&&(u.repeatDelay=g(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if((!1===u.type||0===u.duration&&!u.repeatDelay)&&(An(u),0===u.delay&&(d=!0)),(l.instantAnimations||l.skipAnimations||s?.shouldSkipAnimations||a.skipAnimations)&&(d=!0,An(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!o&&void 0!==e.get()){const t=he(u.keyframes,a);if(void 0!==t)return void Nt.update(()=>{u.onUpdate(t),u.onComplete()})}return a.isSync?new xe(u):new ni(u)},yi=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function vi(t,e,n=1){const[i,s]=function(t){const e=yi.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}(t);if(!i)return;const o=window.getComputedStyle(e).getPropertyValue(i);if(o){const t=o.trim();return c(t)?parseFloat(t):t}return Y(s)?vi(s,e,n+1):s}function xi(t,e,n,i){const s=e=>"function"==typeof e?e(void 0!==n?n:t.custom,...function(t){const e=[{},{}];return t?.values.forEach((t,n)=>{e[0][n]=t.get(),e[1][n]=t.getVelocity()}),e}(i)):e;return"string"==typeof(e=s(e))&&(e=t.variants&&t.variants[e]),s(e)}function wi(t,e,n){return xi(t.getProps(),e,n,t)}const bi=(t,e)=>"exit"===e?t.presenceContext?.custom:void 0,Ti=new Set(["width","height","top","left","right","bottom",...Ye]);function Si(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,li(n))}function Pi(t){return(t=>Array.isArray(t))(t)?t[t.length-1]||0:t}const Ai=t=>Boolean(t&&t.getVelocity);function Ei(t,e){const n=t.getValue("willChange");if(i=n,Boolean(Ai(i)&&i.add))return n.add(e);if(!n&&l.WillChange){const n=new l.WillChange("auto");t.addValue("willChange",n),n.add(e)}var i}function Mi(t){return t.props["data-framer-appear-id"]}const ki="undefined"!=typeof window;function Vi({protectedKeys:t,needsAnimating:e},n){const i=n in t&&!e[n];return e[n]=!1,i}function Di(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:o,transitionEnd:r,...a}=e;const l=t.getDefaultTransition();o=o?ci(o,l):l;const c=o?.reduceMotion,h=o?.skipAnimations;i&&(o=i);const u=[],d=s&&t.animationState?.getState()[s],p=o?.path;p&&(p.animateValues?p.animateValues(e=>t.getValue(e,t.latestValues[e]??0),a,o,n,u):p.animateVisualElement?.(t,a,o,n,u));for(const e in a){const i=t.getValue(e,t.latestValues[e]??null),s=a[e];if(void 0===s||d&&Vi(d,e))continue;const r={delay:n,...hi(d?.out[e]||o||{},e)};h&&(r.skipAnimations=!0);const l=i.get();if(void 0!==l&&!i.isAnimating()&&!Array.isArray(s)&&s===l&&!r.velocity){Nt.update(()=>i.set(s));continue}let p=!1;if(ki&&window.MotionHandoffAnimation){const n=Mi(t);if(n){const t=window.MotionHandoffAnimation(n,e,Nt);null!==t&&(r.startTime=t,p=!0)}}Ei(t,e);const m=c??t.shouldReduceMotion;i.run(gi(e,i,s,m&&Ti.has(e)?{type:!1}:r,t,p));const f=i.animation;f&&u.push(f)}if(r){const e=()=>Nt.update(()=>{r&&function(t,e){const n=wi(t,e);let{transitionEnd:i={},transition:s={},...o}=n||{};o={...o,...i};for(const e in o)Si(t,e,Pi(o[e]))}(t,r)});u.length?Promise.all(u).then(e):e()}return u}function Ci(t,e,n={}){const i=wi(t,e,bi(t,n.type)),s=n.transitionOverride||(i?.transition??(t.getDefaultTransition()||{})),o=()=>Promise.all(i?Di(t,i,n):[]),r=(i=0)=>{const{variantChildren:o}=t,{delayChildren:r=0,staggerChildren:a,staggerDirection:l}=s,c=[];return o?.forEach(t=>{t.notify("AnimationStart",e),c.push(Ci(t,e,{...n,delay:i+("function"==typeof r?0:r)+oi(o,t,r,a,l)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(c)},{when:a}=s;return a?"beforeChildren"===a?o().then(()=>r()):r().then(o):Promise.all([o(),r(n.delay)])}const Ri=[q,lt,at,rt,ht,ct,{test:t=>"auto"===t,parse:t=>t}],Li=t=>Ri.find((t=>e=>e.test(t))(t));function Oi(t){return"number"==typeof t?0===t:null===t||("none"===t||"0"===t||u(t))}const Bi=new Set(["auto","none","0"]);class Fi extends ln{constructor(t,e,n,i,s){super(t,e,n,i,s,!0)}scheduleResolve(){if(this.canReadNow()&&(this.readKeyframes(),!this.needsMeasurement))return this.complete();super.scheduleResolve()}canReadNow(){const{unresolvedKeyframes:t,element:e,motionValue:n}=this,i=t[0]??n?.get();if(!e?.current||void 0===i)return!1;for(let e=0;e<t.length;e++)if(H(e?t[e]:i))return!1;return!0}readKeyframes(){const{unresolvedKeyframes:t,element:e,name:n}=this;if(!e?.current)return;super.readKeyframes();for(let n=0;n<t.length;n++){let i=t[n];if("string"==typeof i&&(i=i.trim(),Y(i))){const s=vi(i,e.current);void 0!==s&&(t[n]=s),n===t.length-1&&(this.finalKeyframe=i)}}if(this.resolveNoneKeyframes(),!Ti.has(n)||2!==t.length)return;const[i,s]=t;if("number"==typeof i&&"number"==typeof s)return;const o=Li(i),r=Li(s);if(H(i)!==H(s)&&tn[n])this.needsMeasurement=!0;else if(o!==r)if(He(o)&&He(r))for(let e=0;e<t.length;e++){const n=t[e];"string"==typeof n&&(t[e]=parseFloat(n))}else tn[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:e}=this,n=[];for(let e=0;e<t.length;e++)(null===t[e]||Oi(t[e]))&&n.push(e);n.length&&function(t,e,n){let i,s=0;for(;s<t.length&&!i;){const e=t[s];"string"==typeof e&&!Bi.has(e)&&xt(e)&&(i=t[s]),s++}if(i&&n)for(const s of e)t[s]!==i&&(t[s]=Oe(n,i))}(t,n,e)}measure(){const{element:t,name:e}=this;return tn[e](window.getComputedStyle(t.current),()=>t.measureViewportBox())}measureInitialState(){const{element:t,unresolvedKeyframes:e,name:n}=this;if(!t?.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=this.measure(),e[0]=this.measuredOrigin;const i=e[e.length-1];void 0!==i&&this.motionValue?.jump(i,!1)}measureEndState(){const{element:t,unresolvedKeyframes:e}=this;if(!t?.current)return;this.motionValue?.jump(this.measuredOrigin,!1);const n=e.length-1,i=e[n];e[n]=this.measure(),null!==i&&void 0===this.finalKeyframe&&(this.finalKeyframe=i),this.resolveNoneKeyframes()}}const ji=["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"];function Ii(t){return h(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}function Ui(t){return h(t)&&"ownerSVGElement"in t}const Wi={};function Ni(t){return Wi.current?.add(t),t}const Ki=t=>Wi.current?Wi.current.bind(t):t;function $i(t,e,n){if(null==t)return[];if(t instanceof EventTarget)return[t];if("string"==typeof t){const i=e?e.current:Wi.current?.root||document,s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(t=>null!=t)}class zi{constructor(t=Nt.render){this.step=t,this.values=new Map,this.pending=[],this.numPending=0,this.flush=()=>{const{pending:t,numPending:e}=this;this.numPending=0;for(let n=0;n<e;n++)t[n]()}}set(t,e,n,i){if(this.values.get(t)?.onRemove(),i)for(const t of this.values.values())t.value===i&&(n=t.render);const s=()=>n&&this.schedule(n);void 0!==e.get()&&s();const o=e.on("change",s),r=()=>{o(),n&&!i&&this.cancel(n),this.values.get(t)?.onRemove===r&&this.values.delete(t)};return this.values.set(t,{value:e,render:i?void 0:n,onRemove:r}),r}get(t){return this.values.get(t)?.value}release(){const t=new Map;return this.values.forEach((e,n)=>{t.set(n,e.value),e.onRemove()}),this.transformKeys=this.transformValues=void 0,t}schedule(t){const{pending:e,numPending:n}=this;for(let i=0;i<n;i++)if(e[i]===t)return;n||this.step(this.flush),e[this.numPending++]=t}cancel(t){const{pending:e}=this;for(let n=0;n<this.numPending;n++)if(e[n]===t)return void(e[n]=e[--this.numPending])}}function Yi(t,{step:e,...n}={}){const i=new WeakMap;return Object.assign((n,s)=>{const o=i.get(n)??new zi(e);i.set(n,o);const r=[];for(const e in s){const i=s[e],a=t(n,o,e,i);r.push(a)}return()=>{for(const t of r)t()}},n,{get:(t,e)=>i.get(t)?.get(e),flush:t=>i.get(t)?.flush(),state:t=>i.get(t)})}const Xi=new Set(["originX","originY","originZ"]),Hi=(t,e)=>Rn(t.get(e)?.get(),Me[e]),qi=(t,e,n,i)=>{let s,o;if(Xe.has(n)){if("pathRotation"!==n){const t=e.transformKeys??(e.transformKeys=[]);(e.transformValues??(e.transformValues={}))[n]=i,t.includes(n)||(t.push(n),t.sort((t,e)=>Ye.indexOf(t)-Ye.indexOf(e)))}e.get("transform")||(Ii(t)||e.get("transformBox")||qi(t,e,"transformBox",new ai("fill-box")),e.set("transform",new ai("none"),()=>{In.get(t)?.check(),t.style.transform=function(t){let e="";const{transformKeys:n=[],transformValues:i={}}=t;for(let t=0;t<n.length;t++){const s=n[t],o=i[s].getCurrent();void 0!==o&&(jn(s,o)||(e+=(e&&" ")+Fn(s,o)))}const s=t.get("pathRotation")?.get();return s&&(e+=(e&&" ")+Fn("rotate",s)),e||"none"}(e)})),o=e.get("transform")}else Xi.has(n)?(e.get("transformOrigin")||e.set("transformOrigin",new ai(""),()=>{const n=Hi(e,"originX")??"50%",i=Hi(e,"originY")??"50%",s=Hi(e,"originZ")??0;t.style.transformOrigin=`${n} ${i} ${s}`}),o=e.get("transformOrigin")):s=cn(n)?()=>{t.style.setProperty(n,i.getCurrent())}:()=>{t.style[n]=Rn(i.getCurrent(),Me[n])};return e.set(n,i,s,o)},_i=(t,e)=>{if(Xe.has(e))return ze(t,e);const n=getComputedStyle(t),i=cn(e)?n.getPropertyValue(e):n[e];return"string"==typeof i&&i.trim()||0},Zi=Yi(qi,{test:t=>Ii(t)||Ui(t),read:_i});function Gi(t){return t.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}function Ji(t,e,n){const{style:i,vars:s,transformOrigin:o}=t;let r=!1,a=!1;for(const t in e){const n=e[t];if(Xe.has(t))r=!0;else if($(t))s[t]=n;else{const e=Rn(n,Me[t]);t.startsWith("origin")?(a=!0,o[t]=e):i[t]=e}}if(e.transform||(r||n?i.transform=function(t,e,n){let i="";for(let s=0;s<On;s++){const o=Ye[s],r=t[o];if(void 0===r)continue;const a=n&&(e[o]=Rn(r,Me[o]));jn(o,r)||(i+=Fn(o,r,a||void 0)+" ")}const s=t.pathRotation;return s&&(i+=Fn("rotate",s)),i=i.trim(),n?n(e,i):i||"none"}(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:t="50%",originY:e="50%",originZ:n=0}=o;i.transformOrigin=`${t} ${e} ${n}`}}const Qi={offset:"stroke-dashoffset",array:"stroke-dasharray"},ts={offset:"strokeDashoffset",array:"strokeDasharray"};const es=["transform","opacity","clipPath","filter","offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function ns(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:o=1,pathOffset:r=0,...a},l,c,h){if(Ji(t,a,c),l)return void(t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox));t.attrs=t.style,t.style={};const{attrs:u,style:d}=t;for(const t of es)void 0!==u[t]&&(d[t]=u[t],delete u[t]);(d.transform||u.transformOrigin)&&(d.transformOrigin=u.transformOrigin??"50% 50%",delete u.transformOrigin),d.transform&&(d.transformBox=h?.transformBox??"fill-box",delete u.transformBox),void 0!==e&&(u.x=e),void 0!==n&&(u.y=n),void 0!==i&&(u.scale=i),void 0!==s&&function(t,e,n=1,i=0,s=!0){t.pathLength=1;const o=s?Qi:ts;t[o.offset]=""+-i,t[o.array]=`${e} ${n}`}(u,s,o,r,!1)}const is=(t,e,n,i,s=n)=>{const o=function(t,e){if(!(e in t))return!1;const n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),e)||Object.getOwnPropertyDescriptor(t,e);return n&&"function"==typeof n.set}(t,s);o||!s.startsWith("data")&&!s.startsWith("aria")||(s=Gi(s));const r=Me[n]||Me[s],a=o?()=>{t[s]=Rn(i.get(),Me[n])}:()=>{const e=Rn(i.get(),r);null==e?t.removeAttribute(s):t.setAttribute(s,String(e))};return e.set(n,i,a)};const ss=Yi((t,e,n,i)=>{if(n.startsWith("path")&&!Xe.has(n))return function(t,e,n,i){return Nt.render(()=>t.setAttribute("pathLength","1")),"pathOffset"===n?e.set(n,i,()=>{const e=i.get();t.setAttribute("stroke-dashoffset",""+-e)}):(e.get("stroke-dasharray")||e.set("stroke-dasharray",new ai("1 1"),()=>{const n=e.get("pathLength")?.get()??1,i=e.get("pathSpacing")?.get();t.setAttribute("stroke-dasharray",`${n} ${i??1-Number(n)}`)}),e.set(n,i,void 0,e.get("stroke-dasharray")))}(t,e,n,i);if(n.startsWith("attr"))return is(t,e,n,i,os(n));if("d"===n)return e.set(n,i,()=>{const e=i.get()?.replace(/path\(|["')]/g,"");void 0===e?t.removeAttribute(n):t.setAttribute(n,e)});return(Xe.has(n)||Xi.has(n)||cn(n)||n in t.style?qi:is)(t,e,n,i)},{test:Ui,read:(t,e)=>Xe.has(e)?Me[e]?.default||0:cn(e)||es.includes(e)?_i(t,e)||t.getAttribute(Gi(e))||0:(e=os(e),t.getAttribute(Gi(e))??t.getAttribute(e)??void 0)});function os(t){return t.replace(/^attr([A-Z])/,(t,e)=>e.toLowerCase())}function rs({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function as(t){return void 0===t||1===t}function ls({scale:t,scaleX:e,scaleY:n}){return!as(t)||!as(e)||!as(n)}const cs=["rotate","rotateX","rotateY","rotateZ","skewX","skewY"];function hs(t){return ls(t)||ds(t)||us(t)}function us(t){return t.z||t.rotate||t.rotateX||t.rotateY||t.rotateZ||t.skewX||t.skewY}function ds(t){return ps(t.x)||ps(t.y)}function ps(t){return t&&"0%"!==t}function ms(t,e,n){return n+e*(t-n)}function fs(t,e,n,i,s){return void 0!==s&&(t=ms(t,s,i)),ms(t,n,i)+e}function gs(t,e=0,n=1,i,s){t.min=fs(t.min,e,n,i,s),t.max=fs(t.max,e,n,i,s)}function ys(t,{x:e,y:n}){gs(t.x,e.translate,e.scale,e.originPoint),gs(t.y,n.translate,n.scale,n.originPoint)}const vs=.999999999999,xs=1.0000000000001;function ws(t,e){t.min+=e,t.max+=e}function bs(t,e,n,i,s=.5){gs(t,e,n,Et(t.min,t.max,s),i)}function Ts(t,e){return"string"==typeof t?parseFloat(t)/100*(e.max-e.min):t}function Ss(t,e,n){const i=n??t;bs(t.x,Ts(e.x,i.x),e.scaleX,e.scale,e.originX),bs(t.y,Ts(e.y,i.y),e.scaleY,e.scale,e.originY)}function Ps(t,e){return rs(function(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(t.getBoundingClientRect(),e))}const As=t=>Ui(t)?ss:Zi;const{schedule:Es}=Wt(queueMicrotask,!1);const Ms={};function ks(t){return t&&"object"==typeof t&&Object.prototype.hasOwnProperty.call(t,"current")}function Vs(t){return Ai(t)?t.get():t}const Ds=t=>"number"==typeof t?t:parseFloat(t),Cs=ji.length,Rs=t=>"number"==typeof t||lt.test(t);function Ls(t,e){return void 0!==t[e]?t[e]:t.borderRadius}const Os=Fs(0,.5,k),Bs=Fs(.5,.95,d);function Fs(t,e,n){return i=>i<t?0:i>e?1:n(m(t,e,i))}function js(t,e){t.min=e.min,t.max=e.max}function Is(t,e){js(t.x,e.x),js(t.y,e.y)}function Us(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Ws(t){return t.max-t.min}function Ns(t,e,n,i=.5){t.origin=i,t.originPoint=Et(e.min,e.max,t.origin),t.scale=Ws(n)/Ws(e),t.translate=Et(n.min,n.max,t.origin)-t.originPoint,(t.scale>=.9999&&t.scale<=1.0001||isNaN(t.scale))&&(t.scale=1),(t.translate>=-.01&&t.translate<=.01||isNaN(t.translate))&&(t.translate=0)}function Ks(t,e,n,i){Ns(t.x,e.x,n.x,i?.originX),Ns(t.y,e.y,n.y,i?.originY)}function $s(t,e,n,i=0){const s=i?Et(n.min,n.max,i):n.min;t.min=s+e.min,t.max=t.min+Ws(e)}function zs(t,e,n,i=0){const s=i?Et(n.min,n.max,i):n.min;t.min=e.min-s,t.max=t.min+Ws(e)}function Ys(t,e,n,i){zs(t.x,e.x,n.x,i?.x),zs(t.y,e.y,n.y,i?.y)}function Xs(t,e,n,i,s){return t=ms(t-=e,1/n,i),void 0!==s&&(t=ms(t,1/s,i)),t}function Hs(t,e,[n,i,s],o,r){!function(t,e=0,n=1,i=.5,s,o=t,r=t){at.test(e)&&(e=parseFloat(e),e=Et(r.min,r.max,e/100)-r.min);if("number"!=typeof e)return;let a=Et(o.min,o.max,i);t===o&&(a-=e),t.min=Xs(t.min,e,n,a,s),t.max=Xs(t.max,e,n,a,s)}(t,e[n],e[i],e[s],e.scale,o,r)}const qs=["x","scaleX","originX"],_s=["y","scaleY","originY"];function Zs(t,e,n,i){Hs(t.x,e,qs,n?.x,i?.x),Hs(t.y,e,_s,n?.y,i?.y)}const Gs=t=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),Js=Gs("applewebkit/")&&!Gs("chrome/")?Math.round:d;function Qs(t){t.min=Js(t.min),t.max=Js(t.max)}const to=()=>({x:{min:0,max:0},y:{min:0,max:0}});function eo(t){return 0===t.translate&&1===t.scale}function no(t){return eo(t.x)&&eo(t.y)}function io(t,e){return t.min===e.min&&t.max===e.max}function so(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function oo(t,e){return so(t.x,e.x)&&so(t.y,e.y)}function ro(t){return Ws(t.x)/Ws(t.y)}function ao(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class lo{constructor(){this.members=[]}add(t){s(this.members,t);for(let e=this.members.length-1;e>=0;e--){const n=this.members[e];if(n===t||n===this.lead||n===this.prevLead)continue;const i=n.instance;i&&!1!==i.isConnected||n.snapshot||(o(this.members,n),n.unmount())}t.scheduleRender()}remove(t){if(o(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(t){for(let e=this.members.indexOf(t)-1;e>=0;e--){const t=this.members[e];if(!1!==t.isPresent&&!1!==t.instance?.isConnected)return this.promote(t),!0}return!1}promote(t,e){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.updateSnapshot(),t.scheduleRender();const{layoutDependency:i}=n.options,{layoutDependency:s}=t.options;void 0!==i&&i===s||(t.resumeFrom=n,e&&(n.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root?.isUpdating&&(t.isLayoutDirty=!0)),!1===t.options.crossfade&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{t.options.onExitComplete?.(),t.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}function co(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ho={correct:(t,e)=>{if(!e.target)return t;if("string"==typeof t){if(!lt.test(t))return t;t=parseFloat(t)}return`${co(t,e.target.x)}% ${co(t,e.target.y)}%`}},uo={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,s=St.parse(t);if(s.length>5)return i;const o=St.createTransformer(t),r="number"!=typeof s[0]?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+r]/=a,s[1+r]/=l;const c=Et(a,l,.5);return"number"==typeof s[2+r]&&(s[2+r]/=c),"number"==typeof s[3+r]&&(s[3+r]/=c),o(s)}},po={borderRadius:Object.assign({},ho,{applyTo:ji.slice()}),borderTopLeftRadius:ho,borderTopRightRadius:ho,borderBottomLeftRadius:ho,borderBottomRightRadius:ho,boxShadow:uo};function mo(t){return[t("x"),t("y")]}const fo=(t,e)=>t.depth-e.depth;class go{constructor(){this.children=[],this.isDirty=!1}add(t){s(this.children,t),this.isDirty=!0}remove(t){o(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(fo),this.isDirty=!1,this.children.forEach(t)}}const yo={hasAnimatedSinceResize:!0},vo=["z","skew","skewZ"];let xo=0;function wo(t,e,n,i){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),i&&(i[t]=0))}const bo=t=>t.instance&&In.get(t.instance)?.demote()&&t.resetSkewAndRotation();function To(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Mi(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:e,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Nt,!(e||i))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&To(i)}function So(t){if(t)return!1!==t.options.allowProjection?t.projection:So(t.parent)}function Po({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return Object.assign(Ms,{...po,...Ms}),class{static create(t,e,n){const{layoutId:i,layout:s,drag:o,dragConstraints:r,layoutScroll:a,layoutRoot:l,layoutAnchor:c,layoutCrossfade:h}=e,u=t.projection=new this(t.latestValues,e["data-framer-portal-id"]?void 0:So(t.parent));u.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:Boolean(o)||r&&ks(r),visualElement:t,animationType:"string"==typeof s?s:"both",initialPromotionConfig:n,crossfade:h,layoutScroll:a,layoutRoot:l,layoutAnchor:c});const d=u.getStack()?.lead;d&&!u.root.isUpdateBlocked()&&(d.willUpdate(),d.scheduleCheckAfterUnmount())}constructor(t={},n=e?.()){this.id=xo++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Mo),this.nodes.forEach(jo),this.nodes.forEach(Io),this.nodes.forEach(ko)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=t,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let t=0;t<this.path.length;t++)this.path[t].shouldResetTransform=!0;this.root===this&&(this.nodes=new go)}addEventListener(t,e){return this.eventHandlers.has(t)||this.eventHandlers.set(t,new f),this.eventHandlers.get(t).add(e)}notifyListeners(t,...e){this.eventHandlers.get(t)?.notify(...e)}hasListeners(t){return this.eventHandlers.has(t)}mount(e){if(this.instance)return;var n;this.isSVG=Ui(e)&&!(Ui(n=e)&&"svg"===n.tagName),this.instance=e;const{layoutId:i,layout:s,visualElement:o}=this.options;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent?.children.add(this),this.root.hasTreeAnimated&&(s||i)&&(this.isLayoutDirty=!0),t){let n,i=0;const s=()=>this.root.updateBlockedByResize=!1;Nt.read(()=>{i=window.innerWidth}),t(e,()=>{const t=window.innerWidth;t!==i&&(i=t,this.root.updateBlockedByResize=!0,n?.(),n=function(t,e){const n=W.now();t=Ki(t);const i=({timestamp:s})=>{const o=s-n;o>=e&&(Kt(i),t(o-e))};return Nt.setup(i,!0),Ni(()=>Kt(i))}(s,250),yo.hasAnimatedSinceResize&&(yo.hasAnimatedSinceResize=!1,this.nodes.forEach(Fo)))})}i&&this.root.registerSharedNode(i,this),this.addLayoutListener()}addLayoutListener(){const{layoutId:t,layout:e,visualElement:n,animate:i}=this.options;this.instance&&!this.hasLayoutListener&&!1!==i&&n&&(t||e)&&(this.hasLayoutListener=!0,this.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e,hasRelativeLayoutChanged:i,layout:s})=>{if(this.isAnimationBlocked)return this.target=void 0,void(this.relativeTarget=void 0);const o=this.options.transition||n.getDefaultTransition()||zo,{onLayoutAnimationStart:r,onLayoutAnimationComplete:a}=n.getProps(),l=!this.targetLayout||!oo(this.targetLayout,s),c=!e&&i;if(this.options.layoutRoot||this.resumeFrom||c||e&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const e={...hi(o,"layout"),onPlay:r,onComplete:a};(n.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e),this.setAnimationOrigin(t,c,e.path)}else e||Fo(this),this.isLead()&&this.options.onExitComplete?.();this.targetLayout=s}))}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),this.getStack()?.remove(this),this.parent?.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),this.hasLayoutListener=!1,Kt(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes?.forEach(Uo),this.animationId++)}getTransformTemplate(){const{visualElement:t}=this.options;return t&&t.getProps().transformTemplate}willUpdate(t=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void this.options.onExitComplete?.();if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&To(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;bo(this),this.isLayoutDirty=!0;for(let t=0;t<this.path.length;t++){const e=this.path[t];e.shouldResetTransform=!0,bo(e),"string"!=typeof e.latestValues.x&&"string"!=typeof e.latestValues.y||(e.isLayoutDirty=!0),e.updateScroll("snapshot"),e.options.layoutRoot&&e.willUpdate(!1),e.isAnimationBlocked&&(e.dragSnapshot||(e.dragSnapshot=e.measure()),this.dragAncestor=e)}const{layoutId:e,layout:n}=this.options;if(void 0===e&&!n)return;const i=this.getTransformTemplate();this.prevTransformTemplateValue=i?i(this.latestValues,""):void 0,this.updateSnapshot(),t&&this.notifyListeners("willUpdate")}update(){this.updateScheduled=!1;if(this.isUpdateBlocked()){const t=this.updateBlockedByResize;return this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),t&&this.nodes.forEach(Co),void this.nodes.forEach(Do)}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(Ro);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Lo),this.nodes.forEach(Oo),this.nodes.forEach(Bo),this.nodes.forEach(Ao),this.nodes.forEach(Eo)):this.nodes.forEach(Ro),this.clearAllSnapshots();const t=W.now();j.delta=a(0,1e3/60,t-j.timestamp),j.timestamp=t,j.isProcessing=!0,$t.update.process(j),$t.preRender.process(j),$t.render.process(j),j.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Es.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Vo),this.sharedNodes.forEach((t,e)=>t.members.length?t.removeLeadSnapshot():this.sharedNodes.delete(e))}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Nt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Nt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){if(!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||Ws(this.snapshot.measuredBox.x)||Ws(this.snapshot.measuredBox.y)||(this.snapshot=void 0),this.snapshot)){const{visualElement:t}=this.options,e="running"===this.currentAnimation?.state,n=e&&this.animationEdges;e&&this.relativeTarget&&(this.snapshot.relativeVelocity=this.relativeVelocity?.slice()||[]);const i=n&&this.motionValue?.getVelocity()||0,s=[0,1,2,3,4,5].map(e=>(e<4?n&&(this.edgeValues?this.edgeVelocity(e):-n[e]*i/1e3):t?.getValue(e<5?"x":"y")?.getVelocity())||0);s.some(Boolean)&&(this.snapshot.velocity=s)}}updateLayout(){if(!this.instance)return;if(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead()||this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let t=0;t<this.path.length;t++){this.path[t].updateScroll()}const t=this.layout;this.layout=this.measure(!1),this.layoutCorrected||(this.layoutCorrected={x:{min:0,max:0},y:{min:0,max:0}}),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:e}=this.options;e?.notify("LayoutMeasure",this.layout.layoutBox,t?.layoutBox)}updateScroll(t="measure"){const{scroll:e,instance:s}=this,{animationId:o}=this.root;if(this.options.layoutScroll&&s&&(!e||e.animationId!==o||e.phase!==t)){const r=i(s);this.scroll={animationId:o,phase:t,isRoot:r,offset:n(s),wasRoot:e?e.isRoot:r}}}resetTransform(){if(!s)return;const t=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout;t&&bo(this);const e=this.projectionDelta&&!no(this.projectionDelta),n=this.getTransformTemplate(),i=n?n(this.latestValues,""):void 0,o=i!==this.prevTransformTemplateValue;t&&this.instance&&(e||hs(this.latestValues)||o)&&(s(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}measure(t=!0){const e=this.measurePageBox();let n=this.removeElementScroll(e);var i;return t&&(n=this.removeTransform(n)),Qs((i=n).x),Qs(i.y),{animationId:this.root.animationId,measuredBox:e,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:t}=this.options;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const e=t.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Ho))){const{scroll:t}=this.root;t&&(ws(e.x,t.offset.x),ws(e.y,t.offset.y))}return e}removeElementScroll(t){const e={x:{min:0,max:0},y:{min:0,max:0}};if(Is(e,t),this.scroll?.wasRoot)return e;for(let n=0;n<this.path.length;n++){const i=this.path[n],{scroll:s,options:o}=i;i!==this.root&&s&&o.layoutScroll&&(s.wasRoot&&Is(e,t),ws(e.x,s.offset.x),ws(e.y,s.offset.y))}return e}applyTransform(t,e=!1,n,i,s=0){const o=n||{x:{min:0,max:0},y:{min:0,max:0}};Is(o,t);for(let t=s;t<this.path.length;t++){const n=this.path[t];!e&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(ws(o.x,-n.scroll.offset.x),ws(o.y,-n.scroll.offset.y)),hs(n.latestValues)&&Ss(o,n.latestValues,n.layout?.layoutBox)}return!i&&hs(this.latestValues)&&Ss(o,this.latestValues,this.layout?.layoutBox),o}removeTransform(t){const e={x:{min:0,max:0},y:{min:0,max:0}};Is(e,t);for(let t=0;t<this.path.length;t++){const n=this.path[t];if(!hs(n.latestValues))continue;let i;n.instance&&(ls(n.latestValues)&&n.updateSnapshot(),i=to(),Is(i,n.measurePageBox())),Zs(e,n.latestValues,n.snapshot?.layoutBox,i)}return hs(this.latestValues)&&Zs(e,this.latestValues),e}setTargetDelta(t){this.targetDelta=t,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(t){this.options={...this.options,...t,crossfade:void 0===t.crossfade||t.crossfade},this.addLayoutListener()}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==j.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(t=!1){const e=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=e.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=e.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=e.isSharedProjectionDirty);const n=Boolean(this.resumingFrom)||this!==e;if(!(t||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:i,layoutId:s}=this.options;if(!this.layout||!i&&!s)return;this.resolvedRelativeTargetAt=j.timestamp;const o=this.getClosestProjectingParent();var r,a,l,c;(this.targetDelta||this.relativeTarget||(!1!==this.options.layoutAnchor&&o&&o.layout?this.createRelativeTarget(o,this.layout.layoutBox,o.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta)&&(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),r=this.target,a=this.relativeTarget,l=this.relativeParent.target,c=this.options.layoutAnchor||void 0,$s(r.x,a.x,l.x,c?.x),$s(r.y,a.y,l.y,c?.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.applyTransform(this.layout.layoutBox,!1,this.target,!0):Is(this.target,this.layout.layoutBox),ys(this.target,this.targetDelta)):Is(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,!1!==this.options.layoutAnchor&&o&&(!o.resumingFrom==!this.resumingFrom||o.options.layoutRoot&&!o.resumingFrom)&&!o.options.layoutScroll&&o.target&&1!==this.animationProgress?this.createRelativeTarget(o,this.target,o.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(this.parent&&!ls(this.parent.latestValues)&&!ds(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(t,e,n){this.relativeParent=t,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},Ys(this.relativeTargetOrigin,e,n,this.options.layoutAnchor||void 0),Is(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const t=this.getLead(),e=Boolean(this.resumingFrom)||this!==t;let n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),e&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===j.timestamp&&(n=!1),n)return;const{layout:i,layoutId:s}=this.options;if(this.isTreeAnimating=Boolean(this.parent?.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!i&&!s)return;Is(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,r=this.treeScale.y;!function(t,e,n,i=!1){const s=n.length;if(!s)return;let o,r;e.x=e.y=1;for(let a=0;a<s;a++)o=n[a],r=o.projectionDelta,"contents"!==o.options.visualElement?.props.style?.display&&(!0===i&&o.options.layoutScroll&&o.scroll&&o!==o.root&&(ws(t.x,-o.scroll.offset.x),ws(t.y,-o.scroll.offset.y)),r&&(e.x*=r.x.scale,e.y*=r.y.scale,ys(t,r)),i&&(i.path?.[a]||i)!==o&&hs(o.latestValues)&&Ss(t,o.latestValues,o.layout?.layoutBox));e.x<xs&&e.x>vs&&(e.x=1),e.y<xs&&e.y>vs&&(e.y=1)}(this.layoutCorrected,this.treeScale,this.path,e&&(!(t.relativeTarget&&!t.relativeParent.resumingFrom)||t.relativeParent)),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const{target:a}=t;a?(this.projectionDelta&&this.prevProjectionDelta?(Us(this.prevProjectionDelta.x,this.projectionDelta.x),Us(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),Ks(this.projectionDelta,this.layoutCorrected,a,this.latestValues),this.treeScale.x===o&&this.treeScale.y===r&&ao(this.projectionDelta.x,this.prevProjectionDelta.x)&&ao(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",a))):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(t=!0){this.options.visualElement?.scheduleRender(),t&&this.getStack()?.scheduleRender(),this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(t,e=!1,n){const i=this.snapshot,s=i?i.latestValues:{},o={...this.latestValues},r={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!e;const a={x:{min:0,max:0},y:{min:0,max:0}},l=i?.source!==this.layout?.source,c=this.getStack(),h=!c||c.members.length<=1,u=Boolean(l&&!h&&!0===this.options.crossfade&&!this.path.some($o));let d;this.animationProgress=0;const p=n?.interpolateProjection(t),m=this.layout?.layoutBox;let f=m&&[m.x.min,m.x.max,m.y.min,m.y.max].map((e,n)=>{const{translate:i,scale:s,originPoint:o}=t[n<2?"x":"y"];return(e-o)*(s-1)+i});f?.every(isFinite)||(f=void 0),this.animationEdges=f,this.edgeValues=this.startVelocity=this.impulse=this.relativeVelocity=this.relativeStart=void 0;const g=i?.velocity,y=i?.relativeVelocity||g;if(y?.slice(0,4).some(Boolean)&&this.getClosestProjectingParent()&&(this.relativeStart=y),g&&f){const e=g.slice(0,4).map((t,e)=>t+(l?g[4+(e>>1)]:0));e.some(Boolean)&&(this.startVelocity=p?((t,e,{x:n,y:i})=>{const s=t*t+e*e;return s<1?0:-1e3*(n*t+i*e)/s})(t.x.translate,t.y.translate,{x:(e[0]+e[1])/2,y:(e[2]+e[3])/2}):e)}this.mixTargetDelta=e=>{const n=e/1e3,i=p?.(n),c=this.edgeValues;for(let e=0;e<2;e++){const i=e?"y":"x";c?Wo(r[i],t[i],this.layout.layoutBox[i],c[2*e],c[2*e+1]):No(r[i],t[i],n)}if(i&&(r.x.translate=i.x,r.y.translate=i.y),this.setTargetDelta(r),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){Ys(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0);const t=this.relativeTargetOrigin,e=a;if(function(t,e,n,i){Ko(t.x,e.x,n.x,i),Ko(t.y,e.y,n.y,i)}(this.relativeTarget,t,e,n),this.isSpringLayout){const t=this.relativeTarget,e=this.impulse||0,n=this.relativeStart,i=W.now(),s=(i-this.relativeTime)/1e3;this.relativeTime=i;const o=this.relativeVelocity||(this.relativeVelocity=[0,0,0,0]);for(let i=0;i<4;i++){const r=i<2?"x":"y",a=1&i?"max":"min";n&&(t[r][a]+=n[i]*e),d&&s>0&&(o[i]=(t[r][a]-d[r][a])/s)}}d&&(m=this.relativeTarget,f=d,io(m.x,f.x)&&io(m.y,f.y))&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Is(d,this.relativeTarget)}var m,f;l&&(this.animationValues=o,function(t,e,n,i,s,o){s?(t.opacity=Et(0,n.opacity??1,Os(i)),t.opacityExit=Et(e.opacity??1,0,Bs(i))):o&&(t.opacity=Et(e.opacity??1,n.opacity??1,i));for(let s=0;s<Cs;s++){const o=ji[s];let r=Ls(e,o),a=Ls(n,o);void 0===r&&void 0===a||(r||(r=0),a||(a=0),0===r||0===a||Rs(r)===Rs(a)?(t[o]=Math.max(Et(Ds(r),Ds(a),i),0),(at.test(a)||at.test(r))&&(t[o]+="%")):t[o]=a)}for(let s=0;s<cs.length;s++){const o=cs[s];(e[o]||n[o])&&(t[o]=Et(e[o]||0,n[o]||0,i))}}(o,s,this.latestValues,n,u,h)),void 0!==i?.rotate&&(this.animationValues||(this.animationValues=o),this.animationValues.pathRotation=i.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(t){this.notifyListeners("animationStart");const e=this.isSpringLayout="spring"===t.type;this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.resumingFrom&&(this.resumingFrom.edgeValues=void 0),this.pendingAnimation&&(Kt(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Nt.update(()=>{yo.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=li(0)),this.motionValue.jump(0,!1);const n=this.startVelocity;this.startVelocity=void 0;let i=t,s=0;if(e){if("auto"===t.mass){const e=this.layout?.layoutBox;i=((t,e=300)=>{const n=a(.25,2,e/300),{stiffness:i,damping:s}=ne({...t,duration:t.duration&&g(t.duration)});return{...t,stiffness:i,damping:s*Math.sqrt(n),mass:n}})(t,e&&Math.sqrt(Ws(e.x)*Ws(e.y)))}const e=this.relativeStart;if((n||e)&&!t.repeat)if("number"==typeof n)s=n;else{const t=n&&this.animationEdges;i={...i,type:i=>{const s=[i.velocity,...n||[]].map((e,n)=>se({...i,keyframes:n?[t[n-1],0]:i.keyframes,velocity:e})),o=s.length;e&&s.push(se({...i,keyframes:[0,0],velocity:1e3,restDelta:.5,restSpeed:5}));let r=0;const a=[],l={calculatedDuration:null,next:e=>{r=e;const n=s[0].next(e);let i=n.done;for(let t=1;t<s.length;t++){const{value:n,done:r}=s[t].next(e);t<o?a[t-1]=n:this.impulse=n/1e3,i=i&&r}return t&&(this.edgeValues=a),n.done=i,n}};return l.calculatedDuration=Ht(l),l.next(0),this.edgeVelocity=t=>s[t+1].velocity(r),l}}}}const o=function(t,e,n){const i=Ai(t)?t:li(t);return i.run(gi("",i,e,n)),i.animation}(this.motionValue,[0,1e3],{...i,velocity:s,isSync:!0,onUpdate:e=>{this.mixTargetDelta(e),t.onUpdate&&t.onUpdate(e)},onComplete:()=>{t.onComplete&&t.onComplete(),this.completeAnimation()}});this.currentAnimation=o,function(t,e){const n=globalThis.__MOTION_INSPECT__;if(n)try{n({...me("layout-animation-start",t),node:e})}catch{}}(this.currentAnimation,this),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const t=this.getStack();t&&t.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=this.edgeValues=this.edgeVelocity=this.impulse=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.edgeValues=this.impulse=void 0,this.mixTargetDelta?.(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const t=this.getLead(),{targetWithTransforms:e,layout:n,latestValues:i}=t;let{target:s}=t;if(e&&s&&n){if(this!==t&&this.layout&&n&&Xo(this.options.animationType,this.layout.layoutBox,n.layoutBox)){const{layoutBox:t}=this.layout,e=s;s=this.target||{x:{min:0,max:0},y:{min:0,max:0}},Yo(s.x,e.x,t.x),Yo(s.y,e.y,t.y)}Is(e,s),Ss(e,i),Ks(this.projectionDeltaWithTransform,this.layoutCorrected,e,i)}}registerSharedNode(t,e){this.sharedNodes.has(t)||this.sharedNodes.set(t,new lo);this.sharedNodes.get(t).add(e);const n=e.options.initialPromotionConfig;e.promote({transition:n?.transition,preserveFollowOpacity:n?.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(e):void 0})}isLead(){const t=this.getStack();return!t||t.lead===this}getLead(){const{layoutId:t}=this.options;return t&&this.getStack()?.lead||this}getPrevLead(){const{layoutId:t}=this.options;return t?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:t}=this.options;if(t)return this.root.sharedNodes.get(t)}promote({needsReset:t,transition:e,preserveFollowOpacity:n}={}){this.getStack()?.promote(this,n),t&&(this.projectionDelta=void 0,this.needsReset=!0),e&&this.setOptions({transition:e})}relegate(){return this.getStack()?.relegate(this)||!1}resetSkewAndRotation(){const{visualElement:t}=this.options;if(!t)return;const{latestValues:e}=t;if(!us(e))return;const n={};for(let e=0;e<vo.length;e++)wo(vo[e],t,n,this.animationValues);for(let e=0;e<cs.length;e++)wo(cs[e],t,n,this.animationValues);t.render();for(const e in n)t.setStaticValue(e,n[e]),this.animationValues&&(this.animationValues[e]=n[e]);t.scheduleRender()}applyProjectionStyles(t,e){if(!this.instance||this.isSVG)return;const n=this.getLead();if(!this.isVisible&&n!==this)return void(t.visibility="hidden");const i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,t.visibility="",t.opacity="",t.pointerEvents=Vs(e?.pointerEvents)||"",void(t.transform=i?i(this.latestValues,""):"none");if(!this.projectionDelta||!this.layout||!n.target)return(this.options.layoutId||this.needsShow)&&(this.needsShow=!1,t.visibility="",t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=Vs(e?.pointerEvents)||""),void(this.hasProjected&&!hs(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1));t.visibility="";const s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let o=function(t,e,n){let i="";const s=t.x.translate/e.x,o=t.y.translate/e.y,r=n?.z||0;(s||o||r)&&(i=`translate3d(${s}px, ${o}px, ${r}px) `);let a="";if(n){const{transformPerspective:t}=n;t&&(i=`perspective(${t}px) ${i}`);for(let t=0;t<cs.length;t++){const e=cs[t],i=n[e];i&&(a+=`${e}(${i}deg) `),!t&&n.pathRotation&&(a+=`rotate(${n.pathRotation}deg) `)}}if(a){1===e.x&&1===e.y||(i+=`scale(${1/e.x}, ${1/e.y}) `),i+=a;const n=t.x.scale*e.x,s=t.y.scale*e.y;1===n&&1===s||(i+=`scale(${n}, ${s})`)}else 1!==t.x.scale||1!==t.y.scale?i+=`scale(${t.x.scale}, ${t.y.scale})`:i||1===e.x&&1===e.y||(i="scale(1, 1)");return i||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);i&&(o=i(s,o)),t.transform=o;const{x:r,y:a}=this.projectionDelta;t.transformOrigin=`${100*r.origin}% ${100*a.origin}% 0`,n.animationValues?t.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:t.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0;for(const e in Ms){if(void 0===s[e])continue;const{correct:i,applyTo:r,isCSSVariable:a}=Ms[e],l="none"===o?s[e]:i(s[e],n);if(r){const e=r.length;for(let n=0;n<e;n++)t[r[n]]=l}else a?this.options.visualElement.renderState.vars[e]=l:t[e]=l}this.options.layoutId&&(t.pointerEvents=n===this?Vs(e?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=this.dragSnapshot=this.dragAncestor=void 0}resetTree(){this.root.nodes.forEach(t=>t.currentAnimation?.stop()),this.root.nodes.forEach(Do),this.root.sharedNodes.clear()}}}function Ao(t){t.updateLayout(),function(t){const{snapshot:e,dragAncestor:n}=t,i=n?.isAnimationBlocked&&n.layout;if(!e||!i||t.resumeFrom||t.isAnimationBlocked)return;const s=n.dragSnapshot;mo(t=>ws(e.layoutBox[t],i.layoutBox[t].min-s.layoutBox[t].min))}(t)}function Eo(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,o=e.source!==t.layout.source,r=(i,o)=>{if("size"===s)mo(t=>{const e=Ws(i[t]);i[t].min=o[t].min,i[t].max=i[t].min+e});else if("x"===s||"y"===s){const t="x"===s?"y":"x";js(i[t],o[t])}else Xo(s,e.layoutBox,n)&&mo(e=>{const n=Ws(o[e]);i[e].max=i[e].min+n,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[e].max=t.relativeTarget[e].min+n)})},a=o?e.measuredBox:e.layoutBox;r(a,n);const l={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};Ks(l,n,e.layoutBox);const c={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};Ks(c,o?t.applyTransform(i,!0):n,a);const h=!no(l);let u=!1;const d=t.getClosestProjectingParent();if((!o||d?.options.layoutRoot&&t.resumeFrom?.path.includes(d))&&d&&!d.resumeFrom){const{snapshot:i,layout:s}=d;if(i&&s){const a=t.options.layoutAnchor||void 0,l={x:{min:0,max:0},y:{min:0,max:0}};Ys(l,o?t.resumeFrom.applyTransform(e.layoutBox,!0,void 0,!0,d.depth+1):e.layoutBox,i.layoutBox,a);const c={x:{min:0,max:0},y:{min:0,max:0}};Ys(c,n,s.layoutBox,a),o&&r(l,c),oo(l,c)||(u=!0),d.options.layoutRoot&&(t.relativeTarget=c,t.relativeTargetOrigin=l,t.relativeParent=d)}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:h,hasRelativeLayoutChanged:u})}else t.isLead()&&t.options.onExitComplete?.();t.options.transition=void 0}function Mo(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=Boolean(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function ko(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Vo(t){t.clearSnapshot()}function Do(t){t.clearMeasurements()}function Co(t){t.isLayoutDirty=!0,t.updateLayout()}function Ro(t){t.isLayoutDirty=!1}function Lo(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.dragSnapshot||t.layout,t.isLayoutDirty=!0)}function Oo(t){t.relativeTarget&&t.relativeParent?.isLayoutDirty&&(t.currentAnimation?t.isLayoutDirty=!0:(t.targetDelta=void 0,t.removeRelativeTarget()))}function Bo(t){const{visualElement:e}=t.options;e?.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Fo(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function jo(t){t.resolveTargetDelta()}function Io(t){t.calcProjection()}function Uo(t){t.resetSkewAndRotation()}function Wo(t,e,n,i,s){const o=n.max-n.min,r=o?Math.max(0,(o+s-i)/o):1,a=t.originPoint=e.originPoint;t.origin=e.origin,t.scale=r,t.translate=n.min+i-(a+(n.min-a)*r)}function No(t,e,n){t.translate=Et(e.translate,0,n),t.scale=Et(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ko(t,e,n,i){t.min=Et(e.min,n.min,i),t.max=Et(e.max,n.max,i)}function $o(t){return void 0!==t.animationValues?.opacityExit}const zo={duration:.45,ease:[.4,0,.1,1]};function Yo(t,e,n){t.max=Ws(n)+(t.min=e.min)}function Xo(t,e,n){return"position"===t||"preserve-aspect"===t&&(i=ro(e),s=ro(n),o=.2,!(Math.abs(i-s)<=o));var i,s,o}function Ho(t){return t!==t.root&&t.scroll?.wasRoot}function qo(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}const _o=Po({attachResizeListener:(t,e)=>qo(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Zo={current:void 0},Go=Po({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Zo.current){const t=new _o({});t.mount(window),t.setOptions({layoutScroll:!0}),Zo.current=t}return Zo.current},resetTransform:(t,e)=>{t.style.transform=void 0!==e?e:"none"},checkIsScrollRoot:t=>"fixed"===window.getComputedStyle(t).position}),Jo=new WeakMap;function Qo(t){return null!==t&&"object"==typeof t&&"function"==typeof t.start}function tr(t){return"string"==typeof t||Array.isArray(t)}const er=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","whilePinch","exit"],nr=["initial"].concat(er);function ir(t){if(Qo(t.animate))return!0;for(let e=0;e<nr.length;e++)if(tr(t[nr[e]]))return!0;return!1}function sr(t){return Boolean(ir(t)||t.variants)}const or={current:null},rr={current:!1},ar="undefined"!=typeof window;const lr=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let cr={};function hr(t){cr=t}class ur{scrapeMotionValuesFromProps(t,e,n){return{}}constructor({parent:t,props:e,presenceContext:n,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:o,visualState:r},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=ln,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const t=W.now();this.renderScheduledAt<t&&(this.renderScheduledAt=t,Nt.render(this.render,!1,!0))};const{latestValues:l,renderState:c}=r;this.latestValues=l,this.baseTarget={...l},this.initialValues=e.initial?{...l}:{},this.renderState=c,this.parent=t,this.props=e,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=a,this.blockInitialAnimation=Boolean(o),this.isControllingVariants=ir(e),this.isVariantNode=sr(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=Boolean(t&&t.current);const{willChange:h,...u}=this.scrapeMotionValuesFromProps(e,{},this);for(const t in u){const e=u[t];void 0!==l[t]&&Ai(e)&&e.set(l[t])}}mount(t){const e=this.presenceContext;if(this.hasBeenMounted&&!1!==e?.isPresent&&!e?.keepValuesOnRemount)for(const t in this.initialValues)this.values.get(t)?.jump(this.initialValues[t]),this.latestValues[t]=this.initialValues[t];if(this.current=t,Jo.set(t,this),this.projection?.instance||this.projection?.mount(t),this.isVariantNode&&!this.isControllingVariants){let t=this;do{t=!1!==t.props.inherit&&t.parent}while(t&&!t.isVariantNode);if(t){const{variantChildren:e}=t;e.add(this),this.removeFromVariantTree=()=>e.delete(this)}}this.values.forEach((t,e)=>this.bindToMotionValue(e,t)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(rr.current||function(){if(rr.current=!0,ar)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>or.current=t.matches;t.addEventListener("change",e),e()}else or.current=!1}(),this.shouldReduceMotion=or.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection?.unmount(),Kt(this.notifyUpdate),Kt(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree?.(),this.parent?.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),(this.enteringChildren||(this.enteringChildren=new Set)).add(t)}removeChild(t){this.children.delete(t),this.enteringChildren?.delete(t)}bindToMotionValue(t,e){if(this.valueSubscriptions.get(t)?.(),e.accelerate&&En.has(t)&&this.current instanceof HTMLElement){const{factory:n,keyframes:i,times:s,ease:o,duration:r}=e.accelerate,a=new wn({element:this.current,name:t,keyframes:i,times:s,ease:o,duration:g(r)}),l=n(a);return void this.valueSubscriptions.set(t,()=>{l(),a.cancel()})}const n=Xe.has(t);n&&this.onBindTransform&&this.onBindTransform();const i=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&Nt.preRender(this.notifyUpdate),n&&(this.projection&&(this.projection.isTransformDirty=!0),In.get(this.current)?.check()),this.scheduleRender()});let s;"undefined"!=typeof window&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{i(),s?.()})}sortNodePosition(t){return this.current&&t.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in cr){const e=cr[t];if(!e)continue;const{isEnabled:n,Feature:i}=e;if(!this.features[t]&&i&&n(this.props)&&(this.features[t]=new i(this)),this.features[t]){const e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){const{transformTemplate:n,onUpdate:i}=this.props;(t.transformTemplate||n)&&this.scheduleRender(),(t.transformTemplate&&!n||t.onUpdate&&!i)&&In.get(this.current)?.demote(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;e<lr.length;e++){const n=lr[e];this.propEventSubscriptions[n]?.(),delete this.propEventSubscriptions[n];const i=t["on"+n];i&&(this.propEventSubscriptions[n]=this.on(n,i))}this.prevMotionValues=function(t,e,n){for(const i in e){const s=e[i],o=n[i];if(Ai(s))t.addValue(i,s);else if(Ai(o))t.addValue(i,li(s,{owner:t}));else if(o!==s)if(t.hasValue(i)){const e=t.getValue(i);!0===e.liveStyle?e.jump(s):e.hasAnimated||e.set(s)}else{const e=t.getStaticValue(i);t.addValue(i,li(void 0!==e?e:s,{owner:t}))}}for(const i in n)void 0===e[i]&&t.removeValue(i);return e}(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue?.()}getProps(){return this.props}getVariant(t){return this.props.variants?.[t]}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}addValue(t,e){const n=this.values.get(t);if(e!==n){n&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e);const i=e.get();void 0!==i&&(this.latestValues[t]=i)}}removeValue(t){this.values.delete(t),this.valueSubscriptions.get(t)?.(),this.valueSubscriptions.delete(t),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){let n=this.props.values?.[t];return n||(n=this.values.get(t),void 0===n&&void 0!==e&&(n=li(e??this.getDefaultValue?.(t),{owner:this}),this.addValue(t,n)),n)}readValue(t,e){let n=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=n&&("string"==typeof n&&(c(n)||u(n))?n=parseFloat(n):"number"!=typeof n&&!St.test(n)&&St.test(e)&&(n=Oe(t,e)),this.setBaseTarget(t,Ai(n)?n.get():n)),Ai(n)?n.get():n}setBaseTarget(t,e){this.baseTarget[t]=e}on(t,e){return(this.events[t]||(this.events[t]=new f)).add(e)}notify(t,...e){this.events[t]?.notify(...e)}scheduleRenderMicrotask(){Es.render(this.render)}}class dr extends ur{constructor(){super(...arguments),this.KeyframeResolver=Fi}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){const n=t.style;return n?n[e]:void 0}removeValueFromRenderState(t,{vars:e,style:n}){delete e[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Ai(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function pr(t,{style:e,vars:n},i,s){const o=t.style;let r;for(r in e)o[r]=e[r];for(r in s?.applyProjectionStyles(o,i),n)o.setProperty(r,n[r])}function mr(t,{layout:e,layoutId:n}){return Xe.has(t)||t.startsWith("origin")||(e||void 0!==n)&&(!!Ms[t]||"opacity"===t)}function fr(t,e,n){const i=t.style,s=e?.style,o={};if(!i)return o;for(const e in i)(Ai(i[e])||s&&Ai(s[e])||mr(e,t)||void 0!==n?.getValue(e)?.liveStyle)&&(o[e]=i[e]);return o}class gr extends dr{constructor(){super(...arguments),this.type="html",this.renderInstance=pr}mount(t){super.mount(t)}readValueFromInstance(t,e){if(Xe.has(e))return this.projection?.isProjecting?Ke(e):ze(t,e);{const i=(n=t,window.getComputedStyle(n)),s=($(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof s?s.trim():s}var n}measureInstanceViewportBox(t,{transformPagePoint:e}){return Ps(t,e)}build(t,e,n){Ji(t,e,n.transformTemplate)}scrapeMotionValuesFromProps(t,e,n){return fr(t,e,n)}}function yr(t){let e=Jo.get(t);return e||(e=new gr({props:{},presenceContext:null,visualState:{latestValues:{},renderState:{transform:{},transformOrigin:{},style:{},vars:{}}}},{allowProjection:!0}),function(t,e){const n=As(t).state(t);if(!n)return;const i=In.get(t);i&&(i.demote(),In.delete(t));const{transformKeys:s}=n;n.release().forEach((t,n)=>{"transformBox"===n||"transform"===n&&s?.length||(t.owner=e,e.addValue(n,t))})}(t,e)),t.style.transform&&!hs(e.latestValues)&&(t.style.transform=""),e}const vr="[data-layout],[data-layout-id]",xr=new WeakMap;let wr;function br(t){const e=[];return t instanceof HTMLElement&&t.matches(vr)&&e.push(t),t.querySelectorAll(vr).forEach(t=>{t instanceof HTMLElement&&e.push(t)}),e}function Tr(t,e){const n=t.getAttribute("data-layout");return{layoutId:t.getAttribute("data-layout-id")??void 0,layout:null!==n||void 0,animationType:n&&"true"!==n?n:"both",transition:e}}function Sr(t,e){let n=xr.get(t);if(n)n.setOptions(Tr(t,e));else{const i=yr(t);n=new Go(i.latestValues,function(t){let e=t.parentElement;for(;e;){const t=xr.get(e);if(t?.instance)return t;e=e.parentElement}}(t)),i.projection=n,n.setOptions({...Tr(t,e),visualElement:i}),n.mount(t),xr.set(t,n)}return n.isPresent=!0,n.options.onExitComplete&&n.setOptions({onExitComplete:void 0}),n}function Pr(t){const e=xr.get(t)||Jo.get(t)?.projection;return e?.instance?[e,()=>{}]:function(t){const e=Sr(t);return[e,()=>xr.get(t)===e&&Ar(t,e)]}(t)}function Ar(t,e){e.setOptions({onExitComplete:void 0});e.getStack()&&!e.isLead()||e.currentAnimation?.stop(),e.unmount(),xr.delete(t)}function Er(){const t=wr;if(!t)return;wr=void 0,function(){if(j.isProcessing)return;const t=W.now();j.delta=a(0,1e3/60,t-j.timestamp),j.timestamp=t,j.isProcessing=!0,$t.update.process(j),$t.preRender.process(j),$t.render.process(j),j.isProcessing=!1}();const e=new Map;for(const n of t)for(const t of n.collectTargets()){const i=e.get(t);i?i.push(n):e.set(t,[n])}const n=new Map;for(const t of(i=e.keys(),[...i].sort((t,e)=>t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1))){const i=e.get(t),s=Sr(t,i[i.length-1].transitionFor(t));for(const e of i)e.adopt(t,s);n.set(t,s)}var i;n.forEach(t=>{t.isLayoutDirty=!1,t.willUpdate()});const s=[];for(const e of t){const t=e.runUpdate();t&&s.push(t)}const o=()=>{const e=new Set;for(const n of t)n.reconcileAdditions(e);for(const n of t)n.reconcileRemovals(e);let i;n.forEach(t=>i||(i=t.root));for(const e of t)i||(i=e.getRoot());i?.didUpdate(),Es.render(()=>{for(const e of t)e.finalize()})};s.length?Promise.all(s).then(o):o()}const Mr=Er;class kr{constructor(t,e,n){this.scope=t,this.updateDom=e,this.defaultOptions=n,this.sharedTransitions=new Map,this.notifyReady=()=>{},this.rejectReady=()=>{},this.tracked=new Map,this.restorePoints=new Map,this.readyPromise=new Promise((t,e)=>{this.notifyReady=t,this.rejectReady=e}),wr||(wr=[],queueMicrotask(Er)),wr.push(this)}shared(t,e){return this.sharedTransitions.set(t,e),this}then(t,e){return this.readyPromise.then(t,e)}transitionFor(t){const e=t.getAttribute("data-layout-id");return e&&this.sharedTransitions.get(e)||this.defaultOptions}adopt(t,e){this.tracked.set(t,e),this.restorePoints.set(t,{parent:t.parentElement,next:t.nextSibling})}collectTargets(){return br(this.scope)}runUpdate(){try{const t=this.updateDom();if(t&&"function"==typeof t.then)return t.then(void 0,t=>{this.updateError=t})}catch(t){this.updateError=t}}reconcileAdditions(t){for(const e of br(this.scope)){if(this.tracked.has(e))continue;const n=Sr(e,this.transitionFor(e));this.adopt(e,n),n.options.layoutId&&t.add(n.options.layoutId)}}reconcileRemovals(t){this.tracked.forEach((e,n)=>{if(n.isConnected)return;const i=this.restorePoints.get(n);this.restorePoints.delete(n);const{layoutId:s}=e.options,o=e.getStack(),r=o&&o.members.some(t=>t!==e&&t.instance?.isConnected);if(s&&e.isLead()&&r&&!t.has(s)&&i&&i.parent.isConnected){if(i.parent.insertBefore(n,i.next?.parentNode===i.parent?i.next:null),e.isPresent=!1,e.setOptions({onExitComplete:()=>{n.remove(),Ar(n,e)}}),e.relegate())return;n.remove()}Ar(n,e),this.tracked.delete(n)})}getRoot(){let t;return this.tracked.forEach(e=>t||(t=e.root)),t}finalize(){if(this.updateError)return void this.rejectReady(this.updateError);const t=new Set;this.tracked.forEach(e=>{e.instance&&e.currentAnimation&&t.add(e.currentAnimation)}),this.notifyReady(new ii([...t]))}}const Vr=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary;function Dr(t){return{point:{x:t.pageX,y:t.pageY}}}function Cr(t,e,n,i){return qo(t,e,(t=>e=>Vr(e)&&t(e,Dr(e)))(n),i)}const Rr=new WeakMap;let Lr;const Or=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:Ui(i)&&"getBBox"in i?i.getBBox()[e]:i[n],Br=Or("inline","width","offsetWidth"),Fr=Or("block","height","offsetHeight");function jr({target:t,borderBoxSize:e}){Rr.get(t)?.forEach(n=>{n(t,{get width(){return Br(t,e)},get height(){return Fr(t,e)}})})}function Ir(t){t.forEach(jr)}function Ur(t,e){Lr||"undefined"!=typeof ResizeObserver&&(Lr=new ResizeObserver(Ir));const n=$i(t);return n.forEach(t=>{let n=Rr.get(t);n||(n=new Set,Rr.set(t,n)),n.add(e),Lr?.observe(t)}),()=>{n.forEach(t=>{const n=Rr.get(t);n?.delete(e),n?.size||Lr?.unobserve(t)})}}const Wr=new Set;let Nr;function Kr(t){return Wr.add(t),Nr||(Nr=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Wr.forEach(e=>e(t))},window.addEventListener("resize",Nr)),()=>{Wr.delete(t),Wr.size||"function"!=typeof Nr||(window.removeEventListener("resize",Nr),Nr=void 0)}}function $r(t,e){return Ni("function"==typeof t?Kr(t):Ur(t,e))}const zr=(t,e)=>Math.abs(t-e);const Yr=new Set(["auto","scroll"]);class Xr{constructor(t,e,{transformPagePoint:n,contextWindow:i=window,dragSnapToOrigin:s=!1,distanceThreshold:o=3,element:r,immediate:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.onElementScroll=t=>{this.handleScroll(t.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;this.hasPendingMove=!1,this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=qr(this.lastRawMoveEventInfo,this.transformPagePoint));const t=Zr(this.lastMoveEventInfo,this.history),e=null!==this.startEvent,n=function(t,e){const n=zr(t.x,e.x),i=zr(t.y,e.y);return Math.sqrt(n**2+i**2)}(t.offset,{x:0,y:0})>=this.distanceThreshold;if(!e&&!n)return;const{point:i}=t;this.history.push({...i,timestamp:W.now()});const{onStart:s,onMove:o}=this.handlers;e||(s?.(this.lastMoveEvent,t),this.startEvent=this.lastMoveEvent),o?.(this.lastMoveEvent,t)},this.handlePointerMove=(t,e)=>{this.handleScroll(window),this.lastMoveEvent=t,this.lastRawMoveEventInfo=e,this.lastMoveEventInfo=qr(e,this.transformPagePoint),this.hasPendingMove=!0,Nt.update(this.updatePoint,!0)},this.handlePointerUp=(t,e)=>{this.hasPendingMove&&this.updatePoint(),this.end();const{onEnd:n,onSessionEnd:i,resumeAnimation:s}=this.handlers;if(!this.dragSnapToOrigin&&this.startEvent||s?.(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const o=Zr("pointercancel"===t.type?this.lastMoveEventInfo:qr(e,this.transformPagePoint),this.history);this.startEvent&&n?.(t,o),i?.(t,o)},!Vr(t))return;this.dragSnapToOrigin=s,this.handlers=e,this.transformPagePoint=n,this.distanceThreshold=a?0:o,this.contextWindow=i||window;const l=Dr(t),c=qr(l,this.transformPagePoint),{point:h}=c;this.history=[{...h,timestamp:W.now()}];const{onSessionStart:u}=e;u&&u(t,Zr(c,this.history));const d={passive:!0,capture:!0};this.removeListeners=p(Cr(this.contextWindow,"pointermove",this.handlePointerMove,d),Cr(this.contextWindow,"pointerup",this.handlePointerUp,d),Cr(this.contextWindow,"pointercancel",this.handlePointerUp,d)),r&&this.startScrollTracking(r),a&&(this.handlePointerMove(t,l),this.updatePoint())}startScrollTracking(t){let e=t.parentElement;for(;e;){const t=getComputedStyle(e);(Yr.has(t.overflowX)||Yr.has(t.overflowY))&&this.scrollPositions.set(e,Hr(e)),e=e.parentElement}this.scrollPositions.set(window,Hr(window)),this.removeScrollListeners=p(qo(window,"scroll",this.onElementScroll,{capture:!0}),qo(window,"scroll",this.onWindowScroll,{}))}handleScroll(t){const e=this.scrollPositions.get(t);if(!e)return;const n=t===window,i=Hr(t),s=i.x-e.x,o=i.y-e.y;0===s&&0===o||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s,this.lastMoveEventInfo.point.y+=o):this.history.length>0&&(this.history[0].x-=s,this.history[0].y-=o),this.scrollPositions.set(t,i),Nt.update(this.updatePoint,!0))}updateHandlers(t){this.handlers=t}end(){this.removeListeners?.(),this.removeScrollListeners?.(),this.scrollPositions.clear(),Kt(this.updatePoint)}}const Hr=t=>t===window?{x:window.scrollX,y:window.scrollY}:{x:t.scrollLeft,y:t.scrollTop};function qr(t,e){return e?{point:e(t.point)}:t}function _r(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Zr({point:t},e){return{point:t,delta:_r(t,Jr(e)),offset:_r(t,Gr(e)),velocity:Qr(e,.1)}}function Gr(t){return t[0]}function Jr(t){return t[t.length-1]}function Qr(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=Jr(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>g(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&s.timestamp-i.timestamp>2*g(e)&&(i=t[1]);const o=y(s.timestamp-i.timestamp);if(0===o)return{x:0,y:0};const r={x:(s.x-i.x)/o,y:(s.y-i.y)/o};return r.x===1/0&&(r.x=0),r.y===1/0&&(r.y=0),r}const ta=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const ea=new Set(["INPUT","SELECT","TEXTAREA"]);const na={x:!1,y:!1};function ia(){return na.x||na.y}function sa(t,e,n){return{min:void 0!==e?t.min+e:void 0,max:void 0!==n?t.max+n-(t.max-t.min):void 0}}function oa(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}const ra=.35;function aa(t,e,n){return{min:la(t,e),max:la(t,n)}}function la(t,e){return"number"==typeof t?t:t[e]||0}function ca(t){let e="";for(const n of t.path){n.scroll=void 0,n.updateScroll();const{scroll:i}=n;n!==t.root&&i&&(e+=i.offset.x+","+i.offset.y+",")}return e}const ha=new WeakMap;class ua{constructor(t,e=()=>t.getProps()){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t,this.readProps=e}start(t,e={}){if(!1===this.visualElement.presenceContext?.isPresent)return;const{dragSnapToOrigin:n}=this.getProps();this.panSession=new Xr(t,{onSessionStart:t=>{e.snapToCursor&&this.snapToCursor(t),this.stopAnimation()},onStart:(t,e)=>{const{drag:n,dragConstraints:i,dragPropagation:s,onDragStart:o}=this.getProps();if(n&&!s&&(this.openDragLock?.(),this.openDragLock="x"===(r=n)||"y"===r?na[r]?null:(na[r]=!0,()=>{na[r]=!1}):na.x||na.y?null:(na.x=na.y=!0,()=>{na.x=na.y=!1}),!this.openDragLock))return;var r;this.latestPointerEvent=t,this.latestPanInfo=e,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints();const{projection:a}=this.visualElement;a&&(a.isAnimationBlocked=!0,a.target=void 0),mo(t=>{let e=this.getAxisMotionValue(t).get()||0;if(Y(e)&&(e=vi(e,this.visualElement.current)||0),lt.test(e))e=parseFloat(e);else if(at.test(e)){const n=a?.layout?.layoutBox[t];n&&(e=Ws(n)*(parseFloat(e)/100))}this.originPoint[t]=e}),this.point="function"==typeof i&&i(this),o&&Nt.update(()=>o(t,e),!1,!0),Ei(this.visualElement,"transform"),this.visualElement.animationState?.setActive("whileDrag",!0)},onMove:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e;const{dragPropagation:n,dragDirectionLock:i,onDirectionLock:s,onDrag:o}=this.getProps();if(!n&&!this.openDragLock)return;const{offset:r}=e;if(i&&null===this.currentDirection){if(this.currentDirection=function(t,e=10){let n=null;Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x");return n}(r),null===this.currentDirection)return;s&&s(this.currentDirection)}this.updateAxis("x",r),this.updateAxis("y",r),this.point&&this.point.move(),this.visualElement.render(),o&&Nt.update(()=>o(t,e),!1,!0)},onSessionEnd:(t,e)=>{this.latestPointerEvent=t,this.latestPanInfo=e,this.stop(t,e),this.latestPointerEvent=null,this.latestPanInfo=null},resumeAnimation:()=>{const{dragSnapToOrigin:t}=this.getProps();(t||this.constraints||this.point)&&this.startAnimation({x:0,y:0})}},{...e,transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:n,contextWindow:this.visualElement.current?.ownerDocument.defaultView,element:this.visualElement.current})}stop(t,e,n){const i=t||this.latestPointerEvent,s=e||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!i)return;const{velocity:r}=s;this.startAnimation(r,n);const{onDragEnd:a}=this.getProps();a&&Nt.postRender(()=>a(i,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:e}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.endPanSession(),!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e?.setActive("whileDrag",!1)}endPanSession(){this.panSession?.end(),this.panSession=void 0}updateAxis(t,e){const{drag:n}=this.readProps();if(!e||!fa(t,n,this.currentDirection))return;const i=this.getAxisMotionValue(t);let s=this.originPoint[t]+e[t];const o=this.constraints&&this.constraints[t];o&&(s=function(t,{min:e,max:n},i){return void 0!==e&&t<e?t=i?Et(e,t,i.min):Math.max(t,e):void 0!==n&&t>n&&(t=i?Et(n,t,i.max):Math.min(t,n)),t}(s,o,this.elastic[t])),this.point?this.point[t]=s:i.set(s)}resolveConstraints(){const{dragConstraints:t,dragElastic:e}=this.getProps(),{projection:n}=this.visualElement,i=n&&(n.layout||n.measure(!1)),s=this.constraints;da(t)?this.constraints&&this.scroll===ca(n)||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!t||!i||"object"!=typeof t)&&function(t,{top:e,left:n,bottom:i,right:s}){return{x:sa(t.x,n,s),y:sa(t.y,e,i)}}(i.layoutBox,t),this.elastic=function(t=ra){return!1===t?t=0:!0===t&&(t=ra),{x:aa(t,"left","right"),y:aa(t,"top","bottom")}}(e),s!==this.constraints&&!da(t)&&i&&this.constraints&&!this.hasMutatedConstraints&&mo(t=>{!1!==this.constraints&&this.getAxisMotionValue(t)&&(this.constraints[t]=function(t,e){const n={};return void 0!==e.min&&(n.min=e.min-t.min),void 0!==e.max&&(n.max=e.max-t.min),n}(i.layoutBox[t],this.constraints[t]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:e}=this.getProps();if(!da(t))return!1;const n=pa(t),{projection:i}=this.visualElement;if(!i||!i.layout)return!1;this.scroll=ca(i);const s=function(t,e,n){const i=Ps(t,n),{scroll:s}=e;return s&&(ws(i.x,s.offset.x),ws(i.y,s.offset.y)),i}(n,i.root,this.visualElement.getTransformPagePoint());let o=function(t,e){return{x:oa(t.x,e.x),y:oa(t.y,e.y)}}(i.layout.layoutBox,i.removeElementScroll(s));if(e){const t=e(function({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}(o));this.hasMutatedConstraints=!!t,t&&(o=rs(t))}return o}startAnimation(t,e){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:o,dragSnapToOrigin:r,onDragTransitionEnd:a}=this.getProps(),l={bounceStiffness:s?200:1e6,bounceDamping:s?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...o},c=s=>!i||this.point&&r||!fa(s,e||n,this.currentDirection)?0:t[s];if(this.point&&!r)return this.point.release({x:c("x"),y:c("y")},l).then(a);const h=this.constraints||{},u=mo(t=>{if(!fa(t,e||n,this.currentDirection))return;let i=h[t]||{};!0!==r&&r!==t||(i={min:0,max:0});const s={type:"inertia",velocity:c(t),...l,...i};return this.startAxisValueAnimation(t,s)});return Promise.all(u).then(a)}startAxisValueAnimation(t,e){const n=this.getAxisMotionValue(t);return Ei(this.visualElement,t),n.start(gi(t,n,0,e,this.visualElement,!1))}stopAnimation(){mo(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const e=`_drag${t.toUpperCase()}`,n=this.readProps()[e];return n||this.visualElement.getValue(t,this.visualElement.latestValues[t]??0)}snapToCursor({clientX:t,clientY:e}){const{drag:n}=this.getProps(),i={x:t,y:e},s=this.visualElement.getTransformPagePoint()?.(i)||i,o=this.visualElement.measureViewportBox();mo(t=>{if(!fa(t,n,this.currentDirection))return;const e=this.getAxisMotionValue(t),{min:i,max:r}=o[t];e.set((e.get()||0)+s[t]-Et(i,r,.5))})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:e}=this.getProps(),{projection:n}=this.visualElement;if(!da(e)||!n||!this.constraints)return;this.stopAnimation();const i=this.constraints,s={x:0,y:0};mo(t=>{const e=this.getAxisMotionValue(t).get();s[t]=function(t,e){let n=.5;const i=Ws(t),s=Ws(e);return s>i?n=m(e.min,e.max-i,t.min):i>s&&(n=m(t.min,t.max-s,e.min)),a(0,1,n)}({min:e,max:e},i[t])});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root?.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),mo(e=>{const n=this.getAxisMotionValue(e);if(!fa(e,t,null)||!n.get())return;const{min:i,max:o}=this.constraints[e];n.set(Et(i,o,s[e]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;ha.set(this.visualElement,this);const t=this.visualElement.current,e=Cr(t,"pointerdown",e=>{const{drag:n,dragListener:i=!0}=this.getProps(),s=e.target,o=s!==t&&function(t){return ea.has(t.tagName)||!0===t.isContentEditable}(s);n&&i&&!o&&this.start(e)});let n;const i=()=>{const{dragConstraints:e}=this.getProps(),i=da(e)&&pa(e);i&&(this.constraints=this.resolveRefConstraints(),n||(n=function(t,e,n){const i=$r(t,ma(n)),s=$r(e,ma(n));return()=>{i(),s()}}(t,i,()=>this.scalePositionWithinConstraints())))},{projection:s}=this.visualElement,o=s.addEventListener("measure",i);s.layout||(s.root?.updateScroll(),s.updateLayout()),Nt.read(i);const r=qo(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:t,hasLayoutChanged:e})=>{this.isDragging&&e&&(mo(e=>{if(!fa(e,this.getProps().drag,this.currentDirection))return;const n=this.getAxisMotionValue(e);this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate)}),this.visualElement.render())});return()=>{r(),e(),o(),a(),n?.()}}getProps(){const t=this.readProps(),{dragElastic:e=ra,dragMomentum:n=!0}=t;return{...t,dragElastic:e,dragMomentum:n}}}function da(t){return!!t&&"object"==typeof t&&("current"in t||"nodeType"in t)}const pa=t=>"current"in t?t.current:t;function ma(t){let e=!0;return()=>{e?e=!1:t()}}function fa(t,e,n){return!(!0!==e&&e!==t||null!==n&&n!==t)}function ga(t,e){const n=$i(t),i=new AbortController;return[n,{passive:!0,...e,signal:i.signal},Ni(()=>i.abort())]}function ya(t,e,n={}){e=Ki(e);const[i,s,o]=ga(t,n);return i.forEach(t=>{let n,i=!1,o=!1;const r=e=>{n&&(n(e),n=void 0),t.removeEventListener("pointerleave",l)},a=t=>{i=!1,window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",a),o&&(o=!1,r(t))},l=t=>{"touch"!==t.pointerType&&(i?o=!0:r(t))};t.addEventListener("pointerenter",i=>{if("touch"===i.pointerType||ia())return;o=!1;const r=e(t,i);"function"==typeof r&&(n=r,t.addEventListener("pointerleave",l,s))},s),t.addEventListener("pointerdown",()=>{i=!0,window.addEventListener("pointerup",a,s),window.addEventListener("pointercancel",a,s)},s)}),o}const va=(t,e)=>!!e&&(t===e||va(t,e.parentElement)),xa=new WeakSet;function wa(t){return e=>{"Enter"===e.key&&t(e)}}function ba(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Ta=new WeakSet,Sa=(t,e,n)=>Math.hypot(t.clientX-e.clientX,t.clientY-e.clientY)>n,Pa=t=>t.preventDefault();function Aa(t,e,n={}){e=Ki(e);const[i,s,o]=ga(t,n),r=new WeakMap,a=t=>{const i=t.currentTarget;if(!Vr(t)||ia())return;if(Ta.has(t))return;n.stopPropagation&&Ta.add(t);const{count:o=1,countTimeout:a=.3,hold:l=0,repeat:c}=n,h=W.now(),u=g(l),d=g(a);let p=r.get(i);p?.expire(Sa(p.event,t,100))?p=void 0:p&&(Kt(p.expire),r.delete(i));const m=p?p.count+1:1,f=m>=o,y=f&&(l||c);let v,x=!l,w=0;if(xa.add(i),p)v=p.handlers;else{const n=e(i,t);v="function"==typeof n?{onComplete:n}:n||{}}f&&x&&v.onActive?.();const b=g(c);let T=u||b,S=h+T,P=!0;const A=()=>{if(s.signal.aborted)return Kt(A);let t=Math.min(1-(S-W.now())/T,1);P&&t<1&&(t=0),P=!1,v.onHold?.(t),t<1||(x?v.onRepeat?.(++w):(x=!0,v.onActive?.()),c?(P=!0,S+=T=b):Kt(A))},E={...s,capture:!0},M=(e,n)=>{if(Vr(e))if(window.removeEventListener("pointerup",k,E),window.removeEventListener("pointercancel",V,E),window.removeEventListener("pointermove",D,E),i.removeEventListener("contextmenu",Pa),Kt(A),xa.delete(i),ia()&&(n=!1),n&&!f){const n=W.now(),o=t=>{const a=s.signal.aborted;if(a||!0===t||W.now()-n>d)return Kt(o),r.delete(i),a||v.onComplete?.(e,{success:!1}),!0};r.set(i,{count:m,event:t,handlers:v,expire:o}),Nt.update(o,!0)}else v.onComplete?.(e,{success:n&&x})},k=t=>{M(t,i===window||i===document||n.useGlobalTarget||va(i,t.target))},V=t=>{M(t,!1)},D=e=>{Vr(e)&&((c||!x)&&Sa(t,e,8)||o>1&&ia())&&V(e)};window.addEventListener("pointerup",k,E),window.addEventListener("pointercancel",V,E),(y||o>1)&&window.addEventListener("pointermove",D,E),y&&(Nt.update(A,!0),i.addEventListener("contextmenu",Pa,{...s,passive:!1}))};return i.forEach(t=>{var e;(n.useGlobalTarget?window:t).addEventListener("pointerdown",a,s),Ii(t)&&(t.addEventListener("focus",()=>((t,e)=>{let n=!1;const i=wa(()=>{n||xa.has(t)||(n=!0,ba(t,"down"))}),s=wa(()=>{n&&(n=!1,ba(t,"up"))});t.addEventListener("keydown",i,e),t.addEventListener("keyup",s,e),t.addEventListener("blur",()=>{t.removeEventListener("keydown",i),t.removeEventListener("keyup",s),n&&ba(t,"cancel")},{...e,once:!0})})(t,s),s),e=t,ta.has(e.tagName)||!0===e.isContentEditable||t.hasAttribute("tabindex")||(t.tabIndex=0))}),o}const Ea={reducedMotion:"(prefers-reduced-motion: reduce)",motion:"(prefers-reduced-motion: no-preference)",dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)",hover:"(hover: hover) and (pointer: fine)",touch:"(pointer: coarse)",portrait:"(orientation: portrait)",landscape:"(orientation: landscape)"};function Ma(t){return t.includes("(")?t:t.replace(/([<>!]=?)\s+/g,"$1").trim().split(/\s+/).map(t=>{const e="!"===t[0];e&&(t=t.slice(1));const n=/^([<>]=?)([\d.]+)([a-z]*)$/.exec(t),i=n?`(width ${n[1]} ${n[2]}${n[3]||"px"})`:Ea[t]||t;return e?`(not (${i}))`:i}).join(" and ")}function ka(...t){const e="function"==typeof t[0]?void 0:t.shift(),[n,i={}]=t,{transition:s,matchMedia:r}=i,a=[],l=new Map;let c=[],h=!1;const u={root:$i(e)[0],transition:s,add:t=>(c.push(t),()=>o(c,t)),bind:t=>(...e)=>{const n=y.run(()=>t(...e));return"function"==typeof n?u.bind(n):n},track(t){l.has(t)||l.set(t,t.getAttribute("style"))}},d=t=>{const e=c;c=[];for(let t=e.length-1;t>=0;t--)e[t]();t&&l.forEach((t,e)=>{(t=>{As(t).state(t)?.release()})(e),null===t?e.removeAttribute("style"):e.setAttribute("style",t)}),l.clear()},p=()=>{y.state="active";let t=!a.length;y.media={};for(const[e,n]of a)t=(y.media[e]=n.matches)||t;if(t&&n){const t=y.run(()=>n(y));"function"==typeof t&&u.add(t)}},m=()=>{h||(h=!0,queueMicrotask(()=>{h=!1,a.length&&y.refresh()}))},f=t=>{y.state=t?"cancelled":"stopped";for(const[,t]of a)t.removeEventListener("change",m);a.length=0,d(t)},g=(t,e)=>{const n=Wi.current;Wi.current=t;try{return e()}finally{Wi.current=n}},y={state:"active",media:{},run:t=>g(u,t),ignore:t=>g(void 0,t),bind:u.bind,stop:()=>f(),cancel:()=>f(!0),refresh(){d(!0),p()}};if(r&&"undefined"!=typeof window){const t="string"==typeof r?{matches:r}:r;for(const e in t){const n=window.matchMedia(Ma(t[e]));n.addEventListener("change",m),a.push([e,n])}}return Ni(y.cancel),p(),y}function Va(t){const e=[];ri.current=e;const n=t();ri.current=void 0;const i=li(n);return function(t,e,n){const i=()=>e.set(n()),s=()=>Nt.preRender(i,!1,!0),o=t.map(t=>t.on("change",s));e.on("destroy",()=>{o.forEach(t=>t()),Kt(i)})}(e,i,t),i}class Da{constructor(t){this.isMounted=!1,this.node=t}update(){}}const Ca=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),Ra=t=>"string"==typeof t&&"svg"===t.toLowerCase();function La(t,e,n){const i=fr(t,e,n);for(const n in t)if("children"!==n&&(Ai(t[n])||Ai(e[n]))){i[-1!==Ye.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=t[n]}return i}class Oa extends dr{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=to}getBaseTargetFromProps(t,e){return Xe.has(e)?super.getBaseTargetFromProps(t,e)??Ke(e):t[e]}getDefaultValue(t){return Xe.has(t)?this.latestValues[t]??Ke(t):void 0}readValueFromInstance(t,e){if(Xe.has(e)){const t=Ve(e);return t&&t.default||0}if(es.includes(e)){const n=getComputedStyle(t)[e];if("string"==typeof n&&n)return n.trim()}return e=Ca.has(e)?e:Gi(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,n){return La(t,e,n)}build(t,e,n){ns(t,e,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,e,n,i){!function(t,e,n,i){pr(t,e,void 0,i);for(const n in e.attrs)t.setAttribute(Ca.has(n)?n:Gi(n),e.attrs[n])}(t,e,0,i)}mount(t){this.isSVGTag=Ra(t.tagName),super.mount(t)}}function Ba(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const Fa=[...er].reverse(),ja=t=>!0===t?.out?t:t?.out;function Ia(t){let e=e=>Promise.all(e.map(({animation:e,options:n})=>function(t,e,n={}){return t.notify("AnimationStart",e),(Array.isArray(e)?Promise.all(e.map(e=>Ci(t,e,n))):"string"==typeof e?Ci(t,e,n):Promise.all(Di(t,wi(t,e,n.custom),n))).then(()=>{t.notify("AnimationComplete",e)})}(t,e,n))),n=Ua(),i=!0,s=!1;function o(o){const{props:r,parent:a,manuallyAnimateOnMount:l}=t,{initial:c}=r,h=i||s,u=[],d=(e=c)=>"boolean"!=typeof e&&wi(t,Array.isArray(e)?e[0]:e,t.presenceContext?.custom)||void 0,p=new Map;let m={},f=1/0,g=t;do{g=!1!==g.props.inherit&&g.parent}while(g&&!g.isControllingVariants);const y=h&&ja(d(c??(g&&g.props.initial))?.transition);if(Fa.forEach((e,i)=>{const s=n[e],c=r[e],d=g&&g.props[e],v=void 0!==c?c:tr(d)||!1===d?d:void 0,x=tr(v),w=e===o?s.isActive:null,b=x&&void 0===c&&!(h&&l);if(s.protectedKeys={...m},!s.isActive&&null===w||!v&&!s.prevProp||Qo(v)||"boolean"==typeof v)return;if(!1===w&&(f=i),"exit"===e&&s.isActive&&!0!==w)return void(m={...m,...s.prevResolvedValues});const T=function(t,e){if("string"==typeof e)return e!==t;if(Array.isArray(e))return!Ba(e,t);return!1}(s.prevProp,v);let S=T||x&&(w&&!b||i>f),P=!1;const A=Array.isArray(v)?v:[v];let E,M={};if(!1!==w)for(const n of A){const{transition:i,transitionEnd:s,...o}=wi(t,n,bi(t,e))||{};M={...M,...o,...s},E=ja(i)||E}const{prevResolvedValues:k}=s;for(const e in{...k,...M}){if(e in m)continue;const n=M[e],i=k[e],o=Array.isArray(n)&&Array.isArray(i)?!Ba(n,i)||T:n!==i;let r;if(o&&null==n)p.has(e)||p.set(e,s.prevOut);else if(o||void 0!==n&&p.has(e)){S=!0,r=p.get(e)||y,p.delete(e)&&(P=!0),s.needsAnimating[e]=!0;const n=t.getValue(e);n&&(n.liveStyle=!1)}else s.protectedKeys[e]=!0;s.out[e]=r}if(s.prevProp=v,s.prevResolvedValues=M,s.prevOut=E,s.isActive&&(m={...m,...M}),S&&(!b||!T||P))for(const n of A){const i={type:e};if("string"==typeof n&&h&&l&&a?.enteringChildren){const e=wi(a,n)?.transition?.delayChildren;i.delay=oi(a.enteringChildren,t,e)}u.push({animation:n,options:i})}}),p.size){const e={},n=d();let i=n?.transition;p.forEach((s,o)=>{s&&(i={...i||t.getDefaultTransition(),[o]:s});const a=t.getValue(o);a&&(a.liveStyle=!0);const l=n&&!Array.isArray(c)?n[o]:void 0,h=t.getBaseTargetFromProps(r,o);e[o]=(void 0!==l?l:void 0===h||Ai(h)?void 0===t.initialValues[o]?t.baseTarget[o]:void 0:h)??null}),i&&(e.transition=i),u.push({animation:e})}const v=h&&t.blockInitialAnimation||i&&!l&&(!1===r.initial||r.initial===r.animate);return i=s=!1,!v&&u.length?e(u):Promise.resolve()}return{animateChanges:o,setActive:function(e,i){if(n[e].isActive===i)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,i)),n[e].isActive=i;const s=o(e);for(const t in n)n[t].protectedKeys={};return s},setAnimateFunction:n=>{e=n(t)},getState:()=>n,reset:()=>{n=Ua(),s=!0}}}function Ua(){const t={};for(const e of er)t[e]={isActive:"animate"===e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{},out:{}};return t}function Wa(t,e,n){const{scope:i,updateDom:s,defaultOptions:o}=function(t,e,n){return"function"==typeof t?{scope:Wi.current?.root||document,updateDom:t,defaultOptions:e}:{scope:t instanceof Document?t:$i(t)[0]??document,updateDom:e,defaultOptions:n}}(t,e,n),r=new kr(i,s,{...Wi.current?.transition,...o});return function(t){const e=Wi.current;if(!e)return;let n,i=!1;const s=e.add(()=>{i=!0,n?.()});t.then(t=>{t&&(n=()=>t.stop(),i?n():t.finished.then(s))},s)}(r),r}class Na extends Da{constructor(t){super(t),this.removeGroupControls=d,this.removeListeners=d,this.controls=new ua(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||d}update(){const{dragControls:t,drag:e}=this.node.getProps(),{dragControls:n,drag:i}=this.node.prevProps||{};t!==n&&(this.removeGroupControls(),t&&(this.removeGroupControls=t.subscribe(this.controls))),i&&!e&&this.controls.stop(void 0,void 0,i)}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Ka=t=>(e,n)=>{t&&Nt.update(()=>t(e,n),!1,!0)};class $a extends Da{constructor(){super(...arguments),this.removePointerDownListener=d}onPointerDown(t){this.session=new Xr(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:this.node.current?.ownerDocument.defaultView})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:e,onPan:n,onPanEnd:i}=this.node.getProps();return{onSessionStart:Ka(t),onStart:Ka(e),onMove:Ka(n),onEnd:(t,e)=>{delete this.session,i&&Nt.postRender(()=>i(t,e))}}}mount(){this.removePointerDownListener=Cr(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session?.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session?.end()}}let za=0;const Ya={animation:{Feature:class extends Da{constructor(t){super(t),t.animationState||(t.animationState=Ia(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Qo(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==this.node.prevProps?.animate&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends Da{constructor(){super(...arguments),this.id=za++}update(){const{presenceContext:t,animationState:e}=this.node;if(!t||!e)return;const{isPresent:n,onExitComplete:i}=t;if(n===!this.exit)return;if(n){if(!0===this.exit){const{initial:t}=this.node.getProps();if(t&&!Array.isArray(t)){const{transition:e,transitionEnd:n,...i}=wi(this.node,t)||{};for(const t in i)this.node.getValue(t)?.jump(i[t])}this.node.blockInitialAnimation=!1,e.reset(),e.animateChanges()}else e.setActive("exit",!1);return void(this.exit=void 0)}const s=this.exit=e.setActive("exit",!0);i&&s.then(()=>{this.exit===s&&(this.exit=!0,i(this.id))})}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id,this.node)),this.update()}unmount(){}}}};function Xa(t,e,n,i,s){const{props:o}=t,r="while"+n;!s&&t.animationState&&o[r]&&t.animationState.setActive(r,"Start"===i);const a=o["on"+n+i];a&&Nt.postRender(()=>a(e,Dr(e)))}function Ha(t,e,n,i){t.current instanceof HTMLButtonElement&&t.current.disabled||Xa(t,e,"Tap",n,i)}const qa=new WeakMap,_a=new WeakMap,Za=t=>{const e=qa.get(t.target);e&&e(t)},Ga=t=>{t.forEach(Za)};function Ja(t,e,n){const i=function({root:t,...e}){const n=t||document;_a.has(n)||_a.set(n,{});const i=_a.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(Ga,{root:t,...e})),i[s]}(e);return qa.set(t,n),i.observe(t),()=>{qa.delete(t),i.unobserve(t)}}const Qa={some:0,all:1};const tl={inView:{Feature:class extends Da{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:t={}}=this.node.getProps(),{root:e,margin:n,amount:i="some",once:s}=t,o={root:e?e.current:void 0,rootMargin:n,threshold:"number"==typeof i?i:Qa[i]};this.stopObserver=Ja(this.node.current,o,t=>{const{isIntersecting:e}=t;if(this.isInView===e)return;if(this.isInView=e,s&&!e&&this.hasEnteredView)return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);const{onViewportEnter:n,onViewportLeave:i}=this.node.getProps(),o=e?n:i;o&&o(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;const{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}(t,e))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}},tap:{Feature:class extends Da{constructor(){super(...arguments),this.options={}}mount(){const{current:t}=this.node;t&&(this.update(),this.unmount=Aa(t,(t,e)=>(Ha(this.node,e,"Start"),{onComplete:(t,{success:e})=>Ha(this.node,t,e?"":"Cancel"),onRepeat:()=>Ha(this.node,e,"",!0)}),this.options))}update(){const{options:t,node:e}=this,{globalTapTarget:n,propagate:i,tap:s}=e.props;for(const e in t)delete t[e];Object.assign(t,s,{useGlobalTarget:n,stopPropagation:!1===i?.tap})}unmount(){}}},focus:{Feature:class extends Da{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=p(qo(this.node.current,"focus",()=>this.onFocus()),qo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends Da{mount(){const{current:t}=this.node;t&&(this.unmount=ya(t,(t,e)=>(Xa(this.node,e,"Hover","Start"),t=>Xa(this.node,t,"Hover","End"))))}unmount(){}}}},el={animation:["variants",...er],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"]};let nl=!1;function il(){return function(){if(nl)return;const t={};for(const e in el)t[e]={isEnabled:t=>el[e].some(e=>!!t[e])};hr(t),nl=!0}(),cr}const sl=new Set(["animate","exit","variants","initial","style","values","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","tap","propagate","ignoreStrict","viewport","pinch"]);function ol(t){return t.startsWith("while")||t.startsWith("drag")&&"draggable"!==t||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||sl.has(t)}const rl=["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"],al=new Set(["auto","scroll"]),ll={x:new Map,y:new Map};function cl(t,e){const n=getComputedStyle(t),i="x"===e?n.overflowX:n.overflowY;return t===document.body||t===document.documentElement||al.has(i)&&("x"===e?t.scrollWidth>t.clientWidth:t.scrollHeight>t.clientHeight)}function hl(t){const e=Math.min(1,1-t/50);return 1.5*e*e*j.delta}function ul(t,e,n,i){if(!t)return;const s=function(t,e){let n=t?.parentElement;for(;n;){if(cl(n,e))return n;n=n.parentElement}return null}(t,n);if(!s)return;const o=e-("x"===n?window.scrollX:window.scrollY),{amount:r,edge:a}=function(t,e,n){const i=e.getBoundingClientRect(),s=t-("x"===n?Math.max(0,i.left):Math.max(0,i.top)),o=("x"===n?Math.min(window.innerWidth,i.right):Math.min(window.innerHeight,i.bottom))-t;return s<50?{amount:-hl(s),edge:"start"}:o<50?{amount:hl(o),edge:"end"}:{amount:0,edge:null}}(o,s,n),l=ll[n];if(null===a)return void l.delete(s);let c=l.get(s);const h=s===document.body||s===document.documentElement;if(c?.edge!==a){if(!("start"===a&&i<0||"end"===a&&i>0))return;c={edge:a,limit:"x"===n?s.scrollWidth-(h?window.innerWidth:s.clientWidth):s.scrollHeight-(h?window.innerHeight:s.clientHeight)},l.set(s,c)}if(r>0){if(("x"===n?h?window.scrollX:s.scrollLeft:h?window.scrollY:s.scrollTop)>=c.limit)return}"x"===n?h?window.scrollBy({left:r}):s.scrollLeft+=r:h?window.scrollBy({top:r}):s.scrollTop+=r}function dl(t,e,n,i,s,o="ltr"){const a=t.findIndex(t=>t.value===e);if(-1===a)return t;if("xy"===s){const{layout:e}=t[a],i={x:pl(e.x)+n.x,y:pl(e.y)+n.y},s=ml(t),l=s.find(e=>e.items.includes(t[a])),c=s.reduce((t,e)=>fl(i.y,e)<fl(i.y,t)?e:t);if(c!==l)return function(t,e,n,i,s){const o=t.filter((t,n)=>n!==e),r=i.items.find(t=>{const e=pl(t.layout.x);return"ltr"===s?n<e:n>e}),a=r?o.indexOf(r):o.indexOf(i.items[i.items.length-1])+1,l=[...o];return l.splice(a,0,t[e]),l.every((e,n)=>e===t[n])?t:l}(t,a,i.x,c,o);const h=gl(i,e);let u=-1,d=h;return t.forEach((t,e)=>{if(e===a)return;const n=gl(i,t.layout);n<d&&(u=e,d=n)}),-1===u?t:r(t,a,a+Math.sign(u-a))}if(!i[s])return t;const l=i[s]>0?1:-1,c=t[a+l];if(!c)return t;const h=t[a].layout[s],u=c.layout[s],d=pl(u);return 1===l&&h.max+n[s]>d||-1===l&&h.min+n[s]<d?r(t,a,a+l):t}const pl=({min:t,max:e})=>Et(t,e,.5);function ml(t){const e=[];return t.forEach(t=>{const{min:n,max:i}=t.layout.y,s=e[e.length-1];!s||n>=s.max||i<=s.min?e.push({items:[t],min:n,max:i}):(s.items.push(t),s.min=Math.min(s.min,n),s.max=Math.max(s.max,i))}),e}function fl(t,e){return t<e.min?e.min-t:t>e.max?t-e.max:0}function gl(t,e){const n=Math.max(e.x.min-t.x,0,t.x-e.x.max),i=Math.max(e.y.min-t.y,0,t.y-e.y.max);return n*n+i*i}const yl=(t,e)=>t.max<=e.min||e.max<=t.min;const vl=["ArrowUp","ArrowLeft","ArrowDown","ArrowRight","Home","End"];function xl(i){function s(s){const o=new Map,a=new Map;let l,c,h,u="y",d=!1;const p=()=>s.props.values.flatMap(t=>{const e=o.get(t);return e?[{value:t,layout:e}]:[]}),m=()=>!!c&&"rtl"===getComputedStyle(c).direction,f=(t,e)=>{const{values:n,onReorder:i}=s.props;let r=0;const a=n.map(e=>o.has(e)?t[r++].value:e);a.some((t,e)=>t!==n[e])&&i(a,e)},g=()=>{const{values:t}=s.props;return t.includes(l)?l:t[0]},y=t=>a.get(t)?.element?.isConnected,v=()=>{y(g())||x.setActive(s.props.values.find(y))},x={axis:"y",hasReordered:!1,getElement:()=>c,items:a,isTabStop:t=>t===g()||!s.props.values.includes(t),checkTabStop:v,setActive:t=>{const e=g();s.props.values.includes(t)&&(l=t,t!==e&&(a.get(e)?.update(),a.get(t)?.update()))},onKeyDown:(t,e,n,i)=>{const{key:o,currentTarget:l}=t;if(t.defaultPrevented||t.target!==l||t.altKey||t.ctrlKey||t.metaKey)return;const{axis:c}=x,h=p(),u=vl.indexOf(o),d=u%2;if(" "===o)t.repeat||i(l,n?void 0:s.props.values);else if("Escape"===o&&n){const t=n.flatMap(t=>h.filter(e=>e.value===t));f(h.map(e=>n.includes(e.value)?t.shift():e),e),i(l)}else{if(u<0||u<4&&"xy"!==c&&c!==(d?"x":"y"))return;{const t=n?h:h.filter(({value:t})=>y(t)),i=t.findIndex(({value:t})=>t===e),s=function(t,e,n,i,s){const o=n>1!=!!(n%2&&s)?1:-1;let r=n>3?(n-4)*(t.length-1):e+o;if("xy"===i&&n<4&&!(n%2)&&e>-1){const n=ml(t).sort((t,e)=>t.min-e.min),i=n[n.findIndex(({items:n})=>n.includes(t[e]))+o],s=n=>Math.abs(pl(n.layout.x)-pl(t[e].layout.x));r=i?t.indexOf(i.items.reduce((t,e)=>s(e)<s(t)?e:t)):-1}return e>-1&&r!==e&&t[r]?r:-1}(t,i,u,c,!!d&&m());s>-1&&(n?f(r(h,i,s),e):a.get(t[s].value)?.element?.focus())}}t.preventDefault()},registerItem:(t,e)=>{if(o.set(t,e),!s.props.axis){const t=function(t){let e=!1,n=!1;for(let i=0;i<t.length;i++)for(let s=i+1;s<t.length;s++)if(e||(e=yl(t[i].x,t[s].x)),n||(n=yl(t[i].y,t[s].y)),e&&n)return"xy";return e?"x":"y"}(s.props.values.flatMap(t=>{const e=o.get(t);return e?[e]:[]}));t!==u&&(u=t,s.update())}},updateOrder:(t,e,n)=>{if(d)return;const i=p(),s=dl(i,t,e,n,x.axis,m()?"rtl":"ltr");i!==s&&(d=x.hasReordered=!0,f(s,t))}};return()=>{const{as:r="ul",axis:l,values:p,onReorder:m,style:f,mix:g,children:y,...w}=s.props,b=new Set(p);for(const t of[o,a])t.forEach((e,n)=>b.has(n)||t.delete(n));return p!==h&&(h=p,s.queueTask(()=>d=!1)),s.queueTask(v),x.axis=l||u,s.context.set(x),t(i[r],{...w,style:{overflowAnchor:"none",...f},mix:[e(t=>c=t),n("pointerdown",()=>{x.hasReordered=!1},!0),n("click",t=>{x.hasReordered&&t.detail&&(x.hasReordered=!1,t.stopPropagation(),t.preventDefault())},!0),g]},y)}}return{Group:s,Item:function(o){let r;const a=li(0),l=li(0);let c;const h={update:()=>o.update()},u=(t,e)=>{r=e,Jo.get(t)?.animationState?.setActive("whileDrag",!!e)};return()=>{const{as:d="li",value:p,style:m={},layout:f=!0,onDrag:g,onDragEnd:y,mix:v,children:x,...w}=o.props,b=o.context.get(s),{axis:T}=b;b.items.set(p,h);const S=Ai(m.x)?m.x:a,P=Ai(m.y)?m.y:l;return c?.x===S&&c.y===P||(c={x:S,y:P,value:Va(()=>S.get()||P.get()?1:"unset")}),t(i[d],{drag:"xy"===T||T,tabIndex:b.isTabStop(p)?0:-1,...w,dragSnapToOrigin:!0,style:{...m,x:S,y:P,zIndex:c.value},layout:f,onDrag:(t,e)=>{const{velocity:n,point:i}=e;b.updateOrder(o.props.value,{x:S.get(),y:P.get()},n);const s="xy"===b.axis?Math.abs(n.x)>Math.abs(n.y)?"x":"y":b.axis;ul(b.getElement()||null,i[s],s,n[s]),g?.(t,e)},onDragEnd:(t,e)=>{b.hasReordered=!1,ll.x.clear(),ll.y.clear(),y?.(t,e)},onLayoutMeasure:t=>b.registerItem(o.props.value,t),mix:[v,e((t,e)=>{h.element=t,e.addEventListener("abort",()=>queueMicrotask(b.checkTabStop))}),n("focusin",()=>b.setActive(o.props.value)),n("keydown",t=>b.onKeyDown(t,o.props.value,r,u)),n("blur",({currentTarget:t})=>queueMicrotask(()=>r&&t.ownerDocument.activeElement!==t&&u(t)))]},x)}}}}let wl=!1;function bl(){wl||(wl=!0,function(t){const e=il();for(const n in t)e[n]={...e[n],...t[n]};hr(e)}({...Ya,...tl,pan:{Feature:$a},drag:{Feature:Na}}))}function Tl(t){return()=>{const{children:e,...n}=t.props;return t.context.set({...t.context.get(Tl),...n}),e}}function Sl(t){let e=0,n=!1,i=[];return()=>{const{isPresent:s,children:o}=t.props;s&&(i=[]);const r={...t.props,exits:i,popped:n};t.context.set(r);const a=++e;return s?n=!1:t.queueTask(()=>{n||(n=!!r.popped),Promise.all([...i]).then(()=>{a===e&&t.props.onExitComplete()})}),o}}const Pl=(t,e)=>t?.key??"__i"+e;function Al(e){let n=[];const i=new Set,s={props:e.props,isFirstRender:!0};return()=>{e.context.set(s),s.isFirstRender&&e.queueTask(()=>s.isFirstRender=!1);const{mode:o,custom:r}=e.props,a=(l=e.props.children,Array.isArray(l)?l.flat(1/0):[l]).filter(t=>null!=t&&!1!==t&&!0!==t);var l;const c=new Map(a.map((t,e)=>[Pl(t,e),t])),h=a.map((t,e)=>({key:Pl(t,e),child:t,isPresent:!0}));n.forEach((t,e)=>{c.has(t.key)||i.has(t.key)||h.splice(Math.min(e,h.length),0,{...t,isPresent:!1})});const u=i.size>0;i.clear(),n=h;const d=h.some(t=>!t.isPresent);u&&!d&&e.queueTask(()=>e.props.onExitComplete?.());return("wait"===o&&d?h.filter(t=>!t.isPresent):h).map(({key:n,child:s,isPresent:a})=>t(Sl,{key:n,isPresent:a,custom:r,popLayout:"popLayout"===o,anchorX:e.props.anchorX,anchorY:e.props.anchorY,onExitComplete:()=>(t=>{i.add(t),e.update()})(n)},(t=>null!=t?.key&&Gl.has(t.type)?{...t,props:{...t.props,presenceKey:t.key}}:t)(s)))}}function El(t,e){const n=t.context.get(Sl);n&&!n.isPresent&&n.exits.push(e)}function Ml(t){const e=t.context.get(Sl);return e?.isPresent??!0}function kl(t){return t.context.get(Sl)?.custom}function Vl(t){return()=>{const e=t.context.get(Vl)?.id,{id:n}=t.props;return t.context.set({id:e&&n?e+"-"+n:n||e}),t.props.children}}function Dl(t){return()=>(t.context.set(t.props.value),t.props.children)}const Cl=t=>"string"==typeof t||Array.isArray(t);function Rl(t,e){return ir(t)?{initial:!1===t.initial||Cl(t.initial)?t.initial:void 0,animate:Cl(t.animate)?t.animate:void 0}:!1===t.inherit?void 0:e}function Ll(t,e,n,i){const s={},o=(n?La:fr)(t,{},void 0);for(const t in o)s[t]=Vs(o[t]);let{initial:r,animate:a}=t;e&&sr(t)&&!ir(t)&&!1!==t.inherit&&(void 0===r&&(r=e.initial),void 0===a&&(a=e.animate));const l=i||!1===r,c=l?a:r;if(!c||"boolean"==typeof c)return s;for(const e of Array.isArray(c)?c:[c]){const n=xi(t,e);if(!n)continue;const{transitionEnd:i,transition:o,...r}=n;for(const t in r){let e=r[t];Array.isArray(e)&&(e=e[l?e.length-1:0]),null!==e&&(s[t]=e)}Object.assign(s,i)}return s}function Ol(t,e){const n={};for(const i in t){const s=t[i];Ai(s)||mr(i,e)||(n[i]=s)}return n}const Bl=t=>{try{t()}catch(t){queueMicrotask(()=>{throw t})}};let Fl,jl;function Il(){const t=Fl;if(t){Fl=void 0;for(let e=t.length-1;e>=0;e--)Bl(t[e][0]);for(let e=t.length-1;e>=0;e--)Bl(t[e][1]);for(const[,,e]of t)Bl(e)}}const Ul=new WeakMap;function Wl(t){for(let e=t.parentElement;e;e=e.parentElement){const t=Ul.get(e)||Jo.get(e);if(t)return t}}const Nl=new WeakMap;function Kl(t){if(!(t instanceof HTMLElement))return;const e=t.offsetParent,{offsetTop:n,offsetLeft:i}=t,{width:s,height:o}=getComputedStyle(t),r=parseFloat(s),a=parseFloat(o);return{top:n,left:i,right:(e?.offsetWidth||0)-r-i,bottom:(e?.offsetHeight||0)-a-n,width:s,height:o}}const $l=t=>Pr(t)[0],zl=new Map;function Yl(t){const e=$l(t);return e.isPresent=!1,e.resumeFrom=void 0,e.setOptions({onExitComplete:zl.get(t)}),e}let Xl;function Hl(){if(Xl)return;let t;Il();const e=new Promise(e=>{t=()=>{Xl?.commit===t&&(Xl=void 0),e()}});Xl={builder:Wa(document.documentElement,()=>e),commit:t},Mr(),zl.forEach((t,e)=>Yl(e)),requestAnimationFrame(t)}function ql(t){t&&(t.animationState?.animateChanges(),t.enteringChildren=void 0)}let _l=0;const Zl=i((e,n)=>{const i=(t=>!t.includes("-")&&(rl.includes(t)||/[A-Z]/u.test(t)))(n);let s,o,r,a,l,c={},h=null,u=!1;const d=String(_l++),p=()=>e.context.get(Tl),m=()=>e.context.get(Dl),f=()=>e.context.get(Sl);let g,y,v,x,w=[];const b=()=>{const t=c.transition??p()?.transition;return t?{...c,transition:t}:c},T=()=>{const t=e.context.get(Vl)?.id,{layoutId:n}=c;return t&&n?t+"-"+n:n},S=(t,e)=>{const n=f()?.custom;h={id:d,isPresent:t,register:()=>()=>{},onExitComplete:e,custom:void 0===n?c.custom:n},o.update(b(),h),o.updateFeatures()},P=t=>{(c.drag||T())&&(r||(r=Pr(t)[1]),c.drag&&$l(t).setOptions({alwaysMeasureLayout:!0}))};e.addEventListener("insert",({node:t})=>{var e,n,r;s=t,bl(),Nl.set(t,{exit:()=>{if(c.exit&&o&&!u)return u=!0,new Promise(t=>S(!1,t))},enter:()=>{u&&o&&(u=!1,S(!0))}}),e=()=>{if(s!==t)return;const e=b();o=new(i?Oa:gr)({parent:Wl(t),props:e,presenceContext:h,blockInitialAnimation:l,reducedMotionConfig:p()?.reducedMotion,visualState:{latestValues:Ll(e,m(),i,l),renderState:{style:{},vars:{},transform:{},transformOrigin:{},attrs:{}}}}),Ul.set(t,o)},n=()=>{Ul.delete(t),s===t&&o&&(o.mount(t),o.scheduleRenderMicrotask(),P(t),o.updateFeatures())},r=()=>{s===t&&ql(o)},Fl||(Fl=[],queueMicrotask(Il)),Fl.push([e,n,r])}),e.addEventListener("beforeRemove",t=>{const e=s;if(!e||u||f())return;const n=[e,...e.querySelectorAll("*")].map(t=>Nl.get(t)).filter(Boolean),i=n.map(t=>t.exit()).filter(Boolean);if(!i.length)return;let o;const r=new Promise(t=>{o=t,Promise.all(i).then(()=>t())});t.persistNode(t=>{const e=()=>{n.forEach(t=>t.enter()),o()};return t.aborted&&e(),t.addEventListener("abort",e),r})}),e.addEventListener("remove",()=>{s&&(Nl.delete(s),zl.get(s)?.()),w.forEach(t=>t()),w=[],r?.(),o?.unmount(),r=o=s=void 0,h=null});const A=()=>{y?.(),y=void 0};return e.addEventListener("beforeUpdate",({node:t})=>{f()?.popLayout&&!g&&(v=Kl(t));const e=c.layout||c.layoutId;if(e)Hl();else if(!f()?.popLayout)return;queueMicrotask(()=>{A(),e&&s===t&&$l(t).setOptions({transition:b().transition,animationType:"string"==typeof c.layout?c.layout:"both",layoutAnchor:c.layoutAnchor,crossfade:c.layoutCrossfade})})}),e.addEventListener("commit",()=>Xl?.commit()),(r,d)=>{c={...r,style:d.style??r.style};const p={};for(const t in d){const e=d[t];"style"!==t&&Ai(e)&&(c[t]=e,p[t]=void 0)}const{layout:E}=c,M=T(),k=f();if(k&&o&&s)if(k.isPresent){if(g&&(g=y=void 0,w=[],x?.(),x=void 0,u&&(u=!1,S(!0)),zl.delete(s))){const t=$l(s);t.isPresent=!0,t.setOptions({onExitComplete:void 0}),t.promote()}}else{if(!g&&(g=(t=>{const n=o,i=[];c.exit&&(u=!0,i.push(new Promise(t=>{w.push(t),e.queueTask(()=>{o===n&&u?S(!1,t):t()})})));const r=s;return t&&i.push(new Promise(t=>{zl.set(r,()=>{zl.delete(r),t()}),Hl();const e=Yl(r);e.relegate()||Nt.postRender(()=>{const t=e.getStack();t&&t.lead!==e||zl.get(r)?.()})})),e.queueTask(A),t&&e.queueTask(()=>Xl?.commit()),Promise.all(i).then(()=>{})})(M),k.popLayout&&!k.popped)){k.popped=!0;const t=s,{anchorX:e,anchorY:n}=k,i=v;y=()=>x=function(t,e=Kl(t),n="left",i="top"){if(!(t instanceof HTMLElement&&e))return;const{style:s}=t,o={position:"absolute",width:e.width,height:e.height,[n]:e[n]+"px",[i]:e[i]+"px"},r={};for(const t in o)r[t]=s[t];return Object.assign(s,o),()=>Object.assign(s,r)}(t,i,e,n)}k.exits.push(g)}if(M&&Xl&&!s&&Xl.builder.shared(M,b().transition||{}),o){const t=o;e.queueTask(()=>{return e=()=>{o===t&&(t.update(b(),h),P(s),t.updateFeatures())},n=()=>o===t&&ql(t),jl||(jl=[],queueMicrotask(()=>{const t=jl;jl=void 0;for(const[e]of t)Bl(e);for(let e=t.length-1;e>=0;e--)Bl(t[e][1])})),void jl.push([e,n]);var e,n})}if(!a){const t=e.context.get(Al);l=t?.isFirstRender&&!1===t.props.initial,a=function(t,e,n,i){const s={style:{},vars:{},transform:{},transformOrigin:{},attrs:{}};return i?ns(s,t,Ra(n),e.transformTemplate,e.style):Ji(s,t,e.transformTemplate),{...s.attrs,style:{...s.vars,...s.style}}}(Ll(b(),m(),i,l),c,n,i)}const{style:V,...D}=a,C={...p,...D},R={...Ol(c.style,c),...V};if(!i){const{drag:t}=c;t&&!1!==c.dragListener&&(C.draggable=!1,R.userSelect=R.WebkitUserSelect=R.WebkitTouchCallout="none",R.touchAction=!0===t?"none":"pan-"+("x"===t?"y":"x")),void 0===d.tabIndex&&(c.onTap||c.onTapStart||c.whileTap)&&(C.tabIndex=0)}return Object.keys(R).length&&(C.style=R),E&&(C["data-layout"]=!0===E?"":E),M&&(C["data-layout-id"]=M),t(e.element,{...d,...C})}}),Gl=new WeakSet;const Jl=new Map,Ql=new Proxy(Zl,{get(e,n,i){if("string"!=typeof n||n in e)return Reflect.get(e,n,i);let s=Jl.get(n);return s||(s=function(e){const n=n=>{let i;return()=>{let{children:s,mix:o,presenceKey:r,...a}=n.props;const l={},c={};for(const t in a)"style"!==t&&ol(t)||(c[t]=a[t]),ol(t)&&(l[t]=a[t]);Ai(s)&&(l.children=s,i?.value!==s&&(i={value:s,initial:String(s.get())}),s=i.initial);const h=n.context.get(Dl);return t(e,{...c,...null!=r&&{key:r},mix:[Zl(l),o]},t(Dl,{value:Rl(l,h)},s))}};return Gl.add(n),n}(n),Jl.set(n,s)),s}}),tc=i(t=>{let e,n,i=()=>{};return t.addEventListener("insert",({node:t})=>{n=ka(t,t=>i(t),e)}),t.addEventListener("remove",()=>{n?.cancel(),n=void 0}),(n,s)=>(i=n,e=s,t.element)},{ssr:!1}),ec=xl(Ql);export{Al as AnimatePresence,Vl as LayoutGroup,Tl as MotionConfig,ec as Reorder,kl as getPresenceData,El as holdPresence,Ml as isPresent,Ql as motion,tc as scopeMotion};
//# sourceMappingURL=size-rollup-remix.js.map