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