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