import{X as L,H as q,a3 as x,a4 as z,a5 as B,d as M,a6 as P,Y as S,a7 as U,C as j,n as T,a8 as G,a9 as H}from"./BZ0BXH4m.js";import{a as K}from"./B98B7x2v.js";const W=()=>performance.now(),c={tick:t=>requestAnimationFrame(t),now:()=>W(),tasks:new Set};function g(){const t=c.now();c.tasks.forEach(r=>{r.c(t)||(c.tasks.delete(r),r.f())}),c.tasks.size!==0&&c.tick(g)}function X(t){let r;return c.tasks.size===0&&c.tick(g),{promise:new Promise(a=>{c.tasks.add(r={c:t,f:a})}),abort(){c.tasks.delete(r)}}}function E(t,r){S(()=>{t.dispatchEvent(new CustomEvent(r))})}function Y(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const r=t.split("-");return r.length===1?r[0]:r[0]+r.slice(1).map(a=>a[0].toUpperCase()+a.slice(1)).join("")}function R(t){const r={},a=t.split(";");for(const i of a){const[e,s]=i.split(":");if(!e||s===void 0)break;const f=Y(e.trim());r[f]=s.trim()}return r}const D=t=>t;function V(t,r,a,i){var e=(t&G)!==0,s=(t&H)!==0,f=e&&s,l=(t&P)!==0,N=f?"both":e?"in":"out",v,d=r.inert,m=r.style.overflow,u,p;function h(){return S(()=>v??=a()(r,i?.()??{},{direction:N}))}var n={is_global:l,in(){if(r.inert=d,!e){p?.abort(),p?.reset?.();return}s||u?.abort(),E(r,"introstart"),u=F(r,h(),p,1,()=>{E(r,"introend"),u?.abort(),u=v=void 0,r.style.overflow=m})},out(k){if(!s){k?.(),v=void 0;return}r.inert=!0,E(r,"outrostart"),p=F(r,h(),u,0,()=>{E(r,"outroend"),k?.()})},stop:()=>{u?.abort(),p?.abort()}},_=L;if((_.transitions??=[]).push(n),e&&K){var w=l;if(!w){for(var o=_.parent;o&&(o.f&q)!==0;)for(;(o=o.parent)&&(o.f&x)===0;);w=!o||(o.f&z)!==0}w&&B(()=>{M(()=>n.in())})}}function F(t,r,a,i,e){var s=i===1;if(U(r)){var f,l=!1;return j(()=>{if(!l){var _=r({direction:s?"in":"out"});f=F(t,_,a,i,e)}}),{abort:()=>{l=!0,f?.abort()},deactivate:()=>f.deactivate(),reset:()=>f.reset(),t:()=>f.t()}}if(a?.deactivate(),!r?.duration)return e(),{abort:T,deactivate:T,reset:T,t:()=>i};const{delay:N=0,css:v,tick:d,easing:m=D}=r;var u=[];if(s&&a===void 0&&(d&&d(0,1),v)){var p=R(v(0,1));u.push(p,p)}var h=()=>1-i,n=t.animate(u,{duration:N,fill:"forwards"});return n.onfinish=()=>{n.cancel();var _=a?.t()??1-i;a?.abort();var w=i-_,o=r.duration*Math.abs(w),k=[];if(o>0){var C=!1;if(v)for(var I=Math.ceil(o/16.666666666666668),A=0;A<=I;A+=1){var O=_+w*m(A/I),y=R(v(O,1-O));k.push(y),C||=y.overflow==="hidden"}C&&(t.style.overflow="hidden"),h=()=>{var b=n.currentTime;return _+w*m(b/o)},d&&X(()=>{if(n.playState!=="running")return!1;var b=h();return d(b,1-b),!0})}n=t.animate(k,{duration:o,fill:"forwards"}),n.onfinish=()=>{h=()=>i,d?.(i,1-i),e()}},{abort:()=>{n&&(n.cancel(),n.effect=null,n.onfinish=T)},deactivate:()=>{e=T},reset:()=>{i===0&&d?.(1,0)},t:()=>h()}}export{V as t};
