import{f as I,c as p,q as E,h2 as L,b$ as K,ca as N,b as A,dy as O,J as $,i as b,k as q,a as P,p as G,fA as H,t as W}from"./index-6Jqoo2rk.js";import{r as _}from"./transition-DuxZkCEv.js";const R=()=>{};function D(e,n){const h=I(e),{onChange:g}=n;let S=new Set(n.appear?void 0:h);const r=new WeakSet,[l,x]=p([],{equals:!1}),[u]=K(),v=n.exitMethod==="remove"?R:t=>{x(s=>(s.push(...t),s));for(const s of t)r.delete(s)};let c;return n.exitMethod==="remove"?c=R:n.exitMethod==="keep-index"?c=t=>t.elements.splice(t.previousIndex,0,t.element):n.exitMethod==="keep-relative"?c=t=>{let s;t.side==="start"?s=t.previousIndex:s=t.elements.length,t.elements.splice(s,0,t.element)}:c=t=>t.elements.push(t.element),E(t=>{const s=l(),d=e();if(d[L],I(u))return u(),t;if(s.length){const a=t.filter(o=>!s.includes(o));return s.length=0,g({list:a,added:[],removed:[],unchanged:a,finishRemoved:v}),a}return I(()=>{const a=new Set(d),o=d.slice(),i=[],C=[],M=[];for(const m of d)(S.has(m)?M:i).push(m);const w={elements:o,previousElements:t,side:"start"};let k=!i.length;for(let m=0;m<t.length;++m){const f=t[m];a.has(f)?w.side="end":(r.has(f)||(C.push(f),r.add(f)),w.element=f,w.previousIndex=m,c(w)),k&&f!==o[m]&&(k=!1)}return!C.length&&k?t:(g({list:o,added:i,removed:C,unchanged:M,finishRemoved:v}),S=a,o)})},n.appear?[]:h.slice())}function J(e){return typeof e!="function"?()=>e:e}function j(e){const n=_(()=>e.children).toArray,h=e.itemClass?.split(" "),g=h?.length&&h[0].trim()?r=>{r.forEach(l=>{l.classList.add(...h)})}:void 0;return g?.(n()),D(n,{exitMethod:"keep-index",appear:e.appear,onChange:({added:r,removed:l,finishRemoved:x})=>{const u=e.animationOptions;N.isAvailable("animations")||(u.duration=0),g?.(r);const v=J(e.keyframes);let c=!1,y=!1;e.mode==="replacement"?(c=!!l.length,y=!!r.length):e.mode==="remove"?y=!!l.length:e.mode==="add-remove"&&(c=!!r.length,y=!!l.length),queueMicrotask(()=>{if(c){const a=r.filter(i=>i.isConnected),o=a.map(i=>v(i,!1));a.forEach((i,C)=>{i.animate(o[C],u)})}if(!y){x(l);return}const t=l.filter(a=>a.isConnected),s=t.map(a=>v(a,!0).slice().reverse()),d=[];t.forEach((a,o)=>{const i=a.animate(s[o],u);d.push(i.finished)}),Promise.all(d).then(()=>x(l))})}})}const z=W("<div>"),T=(e,n)=>[{[e]:0,opacity:0},{[e]:n+"px",opacity:1}],B={"cross-fade":[{opacity:0},{opacity:1}],"grow-width":e=>T("width",e.clientWidth),"grow-height":e=>T("height",e.clientHeight)};function F(e){return A(j,{get animationOptions(){return{duration:200,easing:H("standard").easing}},get keyframes(){return e.keyframes},get mode(){return e.mode||"replacement"},get itemClass(){return G(!e.noItemClass&&"animated-item",e.itemClass)},get appear(){return e.appear},get children(){return e.children}})}function Q(e){return A(O,{component:F,get keyframes(){return B[e.type]},get mode(){return e.mode},get appear(){return e.appear},get noItemClass(){return e.noItemClass},get itemClass(){return e.itemClass},get children(){return e.children}})}function X(e){return A(Q,{type:"grow-height",noItemClass:!0,mode:"add-remove",get appear(){return e.appear??!0},get children(){return A($,{get when(){return e.when},get children(){const n=z();return n.style.setProperty("overflow","hidden"),b(n,()=>e.children),q(()=>P(n,e.class)),n}})}})}export{Q as A,X as G,F as S,j as a,D as c};
//# sourceMappingURL=animations-O3syBkMX.js.map
