import{d as S,bv as H,bw as K,J as j,o as d,a as f,p,q as b,s as a,P as z,Q as B,a0 as P,a1 as V,a2 as D,a3 as F,e as x,F as N,r as O,bx as U,ac as r,Z as q,B as C,by as E,ab as $,f as I,ah as k,ag as w,bz as R,af as T,m as J,bA as L,c as A,am as _,bt as M,ay as Q,v as W,W as Z}from"./B3fabVUf.js";var G=S({__name:"AccordionHeader",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:"h3"}},setup(i){const u=i,o=H(),y=K();return j(),(n,g)=>(d(),f(a(z),{as:u.as,"as-child":u.asChild,"data-orientation":a(o).orientation,"data-state":a(y).dataState.value,"data-disabled":a(y).dataDisabled.value},{default:p(()=>[b(n.$slots,"default")]),_:3},8,["as","as-child","data-orientation","data-state","data-disabled"]))}}),X=G;const Y={slots:{root:"w-full",item:"border-b border-default last:border-b-0",header:"flex",trigger:"group flex-1 flex items-center gap-1.5 font-medium text-sm py-3.5 focus-visible:outline-primary min-w-0",content:"data-[state=open]:animate-[accordion-down_200ms_ease-out] data-[state=closed]:animate-[accordion-up_200ms_ease-out] overflow-hidden focus:outline-none",body:"text-sm pb-3.5",leadingIcon:"shrink-0 size-5",trailingIcon:"shrink-0 size-5 ms-auto group-data-[state=open]:rotate-180 transition-transform duration-200",label:"text-start break-words"},variants:{disabled:{true:{trigger:"cursor-not-allowed opacity-75"}}}},ee={__name:"UAccordion",props:{as:{type:null,required:!1},items:{type:Array,required:!1},trailingIcon:{type:null,required:!1},valueKey:{type:null,required:!1,default:"value"},labelKey:{type:null,required:!1,default:"label"},class:{type:null,required:!1},ui:{type:Object,required:!1},collapsible:{type:Boolean,required:!1,default:!0},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1},type:{type:String,required:!1,default:"single"},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0}},emits:["update:modelValue"],setup(i,{emit:u}){const o=i,y=u,n=B(),g=P(),l=V("accordion",o),h=D(F(o,"as","collapsible","defaultValue","disabled","modelValue","unmountOnHide"),y),t=A(()=>_({extend:_(Y),...g.ui?.accordion||{}})({disabled:o.disabled}));return(s,v)=>(d(),f(a(L),J(a(h),{type:i.type,"data-slot":"root",class:t.value.root({class:[a(l)?.root,o.class]})}),{default:p(()=>[(d(!0),x(N,null,O(o.items,(e,c)=>(d(),f(a(U),{key:c,value:a(q)(e,o.valueKey)??String(c),disabled:e.disabled,"data-slot":"item",class:r(t.value.item({class:[a(l)?.item,e.ui?.item,e.class]}))},{default:p(({open:m})=>[C(a(X),{as:"div","data-slot":"header",class:r(t.value.header({class:[a(l)?.header,e.ui?.header]}))},{default:p(()=>[C(a(E),{"data-slot":"trigger",class:r(t.value.trigger({class:[a(l)?.trigger,e.ui?.trigger],disabled:e.disabled}))},{default:p(()=>[b(s.$slots,"leading",{item:e,index:c,open:m,ui:t.value},()=>[e.icon?(d(),f($,{key:0,name:e.icon,"data-slot":"leadingIcon",class:r(t.value.leadingIcon({class:[a(l)?.leadingIcon,e?.ui?.leadingIcon]}))},null,8,["name","class"])):I("",!0)]),a(q)(e,o.labelKey)||n.default?(d(),x("span",{key:0,"data-slot":"label",class:r(t.value.label({class:[a(l)?.label,e.ui?.label]}))},[b(s.$slots,"default",{item:e,index:c,open:m},()=>[k(w(a(q)(e,o.labelKey)),1)])],2)):I("",!0),b(s.$slots,"trailing",{item:e,index:c,open:m,ui:t.value},()=>[C($,{name:e.trailingIcon||i.trailingIcon||a(g).ui.icons.chevronDown,"data-slot":"trailingIcon",class:r(t.value.trailingIcon({class:[a(l)?.trailingIcon,e.ui?.trailingIcon]}))},null,8,["name","class"])])]),_:2},1032,["class"])]),_:2},1032,["class"]),e.content||n.content||e.slot&&n[e.slot]||n.body||e.slot&&n[`${e.slot}-body`]?(d(),f(a(R),{key:0,"data-slot":"content",class:r(t.value.content({class:[a(l)?.content,e.ui?.content]}))},{default:p(()=>[b(s.$slots,e.slot||"content",{item:e,index:c,open:m,ui:t.value},()=>[T("div",{"data-slot":"body",class:r(t.value.body({class:[a(l)?.body,e.ui?.body]}))},[b(s.$slots,e.slot?`${e.slot}-body`:"body",{item:e,index:c,open:m,ui:t.value},()=>[k(w(e.content),1)])],2)])]),_:2},1032,["class"])):I("",!0)]),_:2},1032,["value","disabled","class"]))),128))]),_:3},16,["type","class"]))}},ae={slots:{root:"my-5",trigger:"text-base"}},se={__name:"ProseAccordion",props:{type:{type:String,required:!1,default:"multiple"},class:{type:null,required:!1},ui:{type:Object,required:!1}},setup(i){const u=i,o=B(),y=P(),n=V("prose.accordion",u),g=A(()=>_({extend:_(ae),...y.ui?.prose?.accordion||{}})),l=W(1),h=A(()=>(l.value,o.default?.()?.flatMap(t).filter(Boolean)||[]));function t(s,v){return typeof s.type=="symbol"?s.children?.map(t):{index:v,label:s.props?.label||`${v}`,description:s.props?.description,icon:s.props?.icon,component:s}}return M(()=>l.value++),(s,v)=>(d(),f(ee,{type:i.type,items:h.value,"unmount-on-hide":!1,class:r(u.class),ui:a(Q)(g.value(),a(n))},{content:p(({item:e})=>[(d(),f(Z(e.component)))]),_:1},8,["type","items","class","ui"]))}};export{se as default};
