import{L as T,M as k,O as _,Q as B,ax as E,e as b,ay as N,W as O,V as z,r as C,U as A,k as L,az as $,Z as D,aA as P,m as I,v as H,y as M,R as j,a0 as K,aB as Q,aC as U}from"./index-BDh_pN-M.js";import{C as W,c as S}from"./index-Dgm5--V8.js";const[w,Y]=_("collapse"),V=Symbol(w),Z={border:k,accordion:Boolean,modelValue:{type:[String,Number,Array],default:""}};var q=T({name:w,props:Z,emits:["change","update:modelValue"],setup(n,{emit:c,slots:l}){const{linkChildren:v,children:p}=B(V),o=e=>{c("change",e),c("update:modelValue",e)},m=(e,s)=>{const{accordion:r,modelValue:u}=n;o(r?e===u?"":e:s?u.concat(e):u.filter(h=>h!==e))},t=(e={})=>{if(n.accordion)return;typeof e=="boolean"&&(e={expanded:e});const{expanded:s,skipDisabled:r}=e,h=p.filter(d=>d.disabled&&r?d.expanded.value:s??!d.expanded.value).map(d=>d.itemName.value);o(h)},i=e=>{const{accordion:s,modelValue:r}=n;return s?r===e:r.includes(e)};return E({toggleAll:t}),v({toggle:m,isExpanded:i}),()=>{var e;return b("div",{class:[Y(),{[N]:n.border}]},[(e=l.default)==null?void 0:e.call(l)])}}});const ne=O(q),[F,x]=_("collapse-item"),G=["icon","title","value","label","right-icon"],J=z({},S,{name:j,isLink:k,disabled:Boolean,readonly:Boolean,lazyRender:k});var X=T({name:F,props:J,setup(n,{slots:c}){const l=C(),v=C(),{parent:p,index:o}=A(V);if(!p)return;const m=L(()=>{var a;return(a=n.name)!=null?a:o.value}),t=L(()=>p.isExpanded(m.value)),i=C(t.value),e=$(()=>i.value||!n.lazyRender),s=()=>{t.value?l.value&&(l.value.style.height=""):i.value=!1};D(t,(a,g)=>{if(g===null)return;a&&(i.value=!0),(a?K:Q)(()=>{if(!v.value||!l.value)return;const{offsetHeight:f}=v.value;if(f){const R=`${f}px`;l.value.style.height=a?"0":R,U(()=>{l.value&&(l.value.style.height=a?R:"0")})}else s()})});const r=(a=!t.value)=>{p.toggle(m.value,a)},u=()=>{!n.disabled&&!n.readonly&&r()},h=()=>{const{border:a,disabled:g,readonly:y}=n,f=P(n,Object.keys(S));return y&&(f.isLink=!1),(g||y)&&(f.clickable=!1),b(W,I({role:"button",class:x("title",{disabled:g,expanded:t.value,borderless:!a}),"aria-expanded":String(t.value),onClick:u},f),P(c,G))},d=e(()=>{var a;return H(b("div",{ref:l,class:x("wrapper"),onTransitionend:s},[b("div",{ref:v,class:x("content")},[(a=c.default)==null?void 0:a.call(c)])]),[[M,i.value]])});return E({toggle:r,expanded:t,itemName:m}),()=>b("div",{class:[x({border:o.value&&n.border})]},[h(),d()])}});const le=O(X);export{ne as C,le as a};
