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