import{X as S,Q as z,av as B,aw as W,W as L,u as M,ax as U,ay as q,az as P,at as j,B as G,aA as F,aB as O}from"./CNnnUJHC.mjs";import{a as K}from"./DhVU3Ruq.mjs";const Q=()=>performance.now(),w={tick:r=>requestAnimationFrame(r),now:()=>Q(),tasks:new Set};function R(){const r=w.now();w.tasks.forEach(a=>{a.c(r)||(w.tasks.delete(a),a.f())}),w.tasks.size!==0&&w.tick(R)}function X(r){let a;return w.tasks.size===0&&w.tick(R),{promise:new Promise(t=>{w.tasks.add(a={c:r,f:t})}),abort(){w.tasks.delete(a)}}}function N(r,a){O(()=>{r.dispatchEvent(new CustomEvent(a))})}function D(r){if(r==="float")return"cssFloat";if(r==="offset")return"cssOffset";if(r.startsWith("--"))return r;const a=r.split("-");return a.length===1?a[0]:a[0]+a.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function I(r){const a={},t=r.split(";");for(const n of t){const[c,i]=n.split(":");if(!c||i===void 0)break;const _=D(c.trim());a[_]=i.trim()}return a}const H=r=>r;function Z(r,a,t,n){var b,g;var c=(r&q)!==0,i=(r&P)!==0,_=c&&i,h=(r&U)!==0,m=_?"both":c?"in":"out",o,e=a.inert,y=a.style.overflow,d,f;function $(){return O(()=>{var u;return o!=null?o:o=t()(a,(u=n==null?void 0:n())!=null?u:{},{direction:m})})}var v={is_global:h,in(){var u;if(a.inert=e,!c){f==null||f.abort(),(u=f==null?void 0:f.reset)==null||u.call(f);return}i||d==null||d.abort(),d=k(a,$(),f,1,()=>{N(a,"introend"),d==null||d.abort(),d=o=void 0,a.style.overflow=y})},out(u){if(!i){u==null||u(),o=void 0;return}a.inert=!0,f=k(a,$(),d,0,()=>{N(a,"outroend"),u==null||u()})},stop:()=>{d==null||d.abort(),f==null||f.abort()}},l=S;if(((g=(b=l.nodes).t)!=null?g:b.t=[]).push(v),c&&K){var s=h;if(!s){for(var p=l.parent;p&&(p.f&z)!==0;)for(;(p=p.parent)&&(p.f&B)===0;);s=!p||(p.f&W)!==0}s&&L(()=>{M(()=>v.in())})}}function k(r,a,t,n,c){var i=n===1;if(j(a)){var _,h=!1;return G(()=>{if(!h){var l=a({direction:i?"in":"out"});_=k(r,l,t,n,c)}}),{abort:()=>{h=!0,_==null||_.abort()},deactivate:()=>_.deactivate(),reset:()=>_.reset(),t:()=>_.t()}}if(t==null||t.deactivate(),!(a!=null&&a.duration)&&!(a!=null&&a.delay))return N(r,i?"introstart":"outrostart"),c(),{abort:F,deactivate:F,reset:F,t:()=>n};const{delay:m=0,css:o,tick:e,easing:y=H}=a;var d=[];if(i&&t===void 0&&(e&&e(0,1),o)){var f=I(o(0,1));d.push(f,f)}var $=()=>1-n,v=r.animate(d,{duration:m,fill:"forwards"});return v.onfinish=()=>{var C;v.cancel(),N(r,i?"introstart":"outrostart");var l=(C=t==null?void 0:t.t())!=null?C:1-n;t==null||t.abort();var s=n-l,p=a.duration*Math.abs(s),b=[];if(p>0){var g=!1;if(o)for(var u=Math.ceil(p/16.666666666666668),A=0;A<=u;A+=1){var x=l+s*y(A/u),E=I(o(x,1-x));b.push(E),g||(g=E.overflow==="hidden")}g&&(r.style.overflow="hidden"),$=()=>{var T=v.currentTime;return l+s*y(T/p)},e&&X(()=>{if(v.playState!=="running")return!1;var T=$();return e(T,1-T),!0})}v=r.animate(b,{duration:p,fill:"forwards"}),v.onfinish=()=>{$=()=>n,e==null||e(n,1-n),c()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=F)},deactivate:()=>{c=F},reset:()=>{n===0&&(e==null||e(1,0))},t:()=>$()}}function J(r){const a=r-1;return a*a*a+1}function aa(r,{delay:a=0,duration:t=400,easing:n=J,axis:c="y"}={}){const i=getComputedStyle(r),_=+i.opacity,h=c==="y"?"height":"width",m=parseFloat(i[h]),o=c==="y"?["top","bottom"]:["left","right"],e=o.map(s=>`${s[0].toUpperCase()}${s.slice(1)}`),y=parseFloat(i[`padding${e[0]}`]),d=parseFloat(i[`padding${e[1]}`]),f=parseFloat(i[`margin${e[0]}`]),$=parseFloat(i[`margin${e[1]}`]),v=parseFloat(i[`border${e[0]}Width`]),l=parseFloat(i[`border${e[1]}Width`]);return{delay:a,duration:t,easing:n,css:s=>`overflow: hidden;opacity: ${Math.min(s*20,1)*_};${h}: ${s*m}px;padding-${o[0]}: ${s*y}px;padding-${o[1]}: ${s*d}px;margin-${o[0]}: ${s*f}px;margin-${o[1]}: ${s*$}px;border-${o[0]}-width: ${s*v}px;border-${o[1]}-width: ${s*l}px;min-${h}: 0`}}export{aa as s,Z as t};
