import{b as V,d as S,cu as M,cv as A,cw as T,i as O,cn as z,cx as W,x as K,Q as q,y as G,u as w,c as r,a as _,o as B,g as D,r as N,n as m,l as e,_ as H,z as J,cy as L,k as I,q as Q,t as U,h as E,w as g,cz as R,J as X,ch as Y,aa as Z,j as ee,v as se,p as ae,K as te}from"./post-2433f428.js";import{b as x}from"./formvibes-4c4994e4.js";import{_ as le}from"./index-fb3a1e53.js";const $=s=>O(s)||z(s)||W(s),oe=V({accordion:Boolean,modelValue:{type:S([Array,String,Number]),default:()=>M([])}}),ne={[A]:$,[T]:$},F=Symbol("collapseContextKey"),ie=(s,n)=>{const t=K(x(s.modelValue)),i=l=>{t.value=l;const o=s.accordion?t.value[0]:t.value;n(A,o),n(T,o)},a=l=>{if(s.accordion)i([t.value[0]===l?"":l]);else{const o=[...t.value],c=o.indexOf(l);c>-1?o.splice(c,1):o.push(l),i(o)}};return q(()=>s.modelValue,()=>t.value=x(s.modelValue),{deep:!0}),G(F,{activeNames:t,handleItemClick:a}),{activeNames:t,setActiveNames:i}},ce=()=>{const s=w("collapse");return{rootKls:r(()=>s.b())}},re=_({name:"ElCollapse"}),de=_({...re,props:oe,emits:ne,setup(s,{expose:n,emit:t}){const i=s,{activeNames:a,setActiveNames:l}=ie(i,t),{rootKls:o}=ce();return n({activeNames:a,setActiveNames:l}),(c,u)=>(B(),D("div",{class:m(e(o))},[N(c.$slots,"default")],2))}});var ue=H(de,[["__file","collapse.vue"]]);const pe=V({title:{type:String,default:""},name:{type:S([String,Number]),default:void 0},disabled:Boolean}),me=s=>{const n=J(F),{namespace:t}=w("collapse"),i=K(!1),a=K(!1),l=L(),o=r(()=>l.current++),c=r(()=>{var C;return(C=s.name)!=null?C:`${t.value}-id-${l.prefix}-${e(o)}`}),u=r(()=>n?.activeNames.value.includes(e(c)));return{focusing:i,id:o,isActive:u,handleFocus:()=>{setTimeout(()=>{a.value?a.value=!1:i.value=!0},50)},handleHeaderClick:()=>{s.disabled||(n?.handleItemClick(e(c)),i.value=!1,a.value=!0)},handleEnterClick:()=>{n?.handleItemClick(e(c))}}},ve=(s,{focusing:n,isActive:t,id:i})=>{const a=w("collapse"),l=r(()=>[a.b("item"),a.is("active",e(t)),a.is("disabled",s.disabled)]),o=r(()=>[a.be("item","header"),a.is("active",e(t)),{focusing:e(n)&&!s.disabled}]),c=r(()=>[a.be("item","arrow"),a.is("active",e(t))]),u=r(()=>a.be("item","wrap")),v=r(()=>a.be("item","content")),f=r(()=>a.b(`content-${e(i)}`)),b=r(()=>a.b(`head-${e(i)}`));return{arrowKls:c,headKls:o,rootKls:l,itemWrapperKls:u,itemContentKls:v,scopedContentId:f,scopedHeadId:b}},fe=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],be=["id","aria-hidden","aria-labelledby"],Ce=_({name:"ElCollapseItem"}),he=_({...Ce,props:pe,setup(s,{expose:n}){const t=s,{focusing:i,id:a,isActive:l,handleFocus:o,handleHeaderClick:c,handleEnterClick:u}=me(t),{arrowKls:v,headKls:f,rootKls:b,itemWrapperKls:C,itemContentKls:j,scopedContentId:y,scopedHeadId:k}=ve(t,{focusing:i,isActive:l,id:a});return n({isActive:l}),(h,d)=>(B(),D("div",{class:m(e(b))},[I("button",{id:e(k),class:m(e(f)),"aria-expanded":e(l),"aria-controls":e(y),"aria-describedby":e(y),tabindex:h.disabled?-1:0,type:"button",onClick:d[0]||(d[0]=(...p)=>e(c)&&e(c)(...p)),onKeydown:d[1]||(d[1]=Y(Z((...p)=>e(u)&&e(u)(...p),["stop","prevent"]),["space","enter"])),onFocus:d[2]||(d[2]=(...p)=>e(o)&&e(o)(...p)),onBlur:d[3]||(d[3]=p=>i.value=!1)},[N(h.$slots,"title",{},()=>[Q(U(h.title),1)]),E(e(X),{class:m(e(v))},{default:g(()=>[E(e(R))]),_:1},8,["class"])],42,fe),E(e(le),null,{default:g(()=>[ee(I("div",{id:e(y),role:"region",class:m(e(C)),"aria-hidden":!e(l),"aria-labelledby":e(k)},[I("div",{class:m(e(j))},[N(h.$slots,"default")],2)],10,be),[[se,e(l)]])]),_:3})],2))}});var P=H(he,[["__file","collapse-item.vue"]]);const Ee=ae(ue,{CollapseItem:P}),Ke=te(P);export{Ke as E,Ee as a};
//# sourceMappingURL=collapse-item-ac72ec57.js.map
