import{h as m,ac as x,ag as $,b0 as N,af as O,v,o as _,w as c,x as b,g as e,ae as R,ab as F,E as p,k as w,m as H,V as M,H as A,b1 as D,b as E,ad as B,I,b2 as P,aT as V}from"./BzhixHsn.js";const[T,S]=x("CollapsibleRoot");var j=m({__name:"CollapsibleRoot",props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["update:open"],setup(s,{expose:l,emit:i}){const n=s,o=$(n,"open",i,{defaultValue:n.defaultOpen,passive:n.open===void 0}),{disabled:r,unmountOnHide:u}=N(n);return S({contentId:"",disabled:r,open:o,unmountOnHide:u,onOpenToggle:()=>{r.value||(o.value=!o.value)}}),l({open:o}),O(),(d,h)=>(_(),v(e(R),{as:d.as,"as-child":n.asChild,"data-state":e(o)?"open":"closed","data-disabled":e(r)?"":void 0},{default:c(()=>[b(d.$slots,"default",{open:e(o)})]),_:3},8,["as","as-child","data-state","data-disabled"]))}}),L=j,z=m({inheritAttrs:!1,__name:"CollapsibleContent",props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["contentFound"],setup(s,{emit:l}){const i=s,n=l,a=T();a.contentId||=F(void 0,"reka-collapsible-content");const o=p(),{forwardRef:r,currentElement:u}=O(),d=p(0),h=p(0),g=w(()=>a.open.value),y=p(g.value),f=p();H(()=>[g.value,o.value?.present],async()=>{await M();const t=u.value;if(!t)return;f.value=f.value||{transitionDuration:t.style.transitionDuration,animationName:t.style.animationName},t.style.transitionDuration="0s",t.style.animationName="none";const C=t.getBoundingClientRect();h.value=C.height,d.value=C.width,y.value||(t.style.transitionDuration=f.value.transitionDuration,t.style.animationName=f.value.animationName)},{immediate:!0});const k=w(()=>y.value&&a.open.value);return A(()=>{requestAnimationFrame(()=>{y.value=!1})}),D(u,"beforematch",t=>{requestAnimationFrame(()=>{a.onOpenToggle(),n("contentFound")})}),(t,C)=>(_(),v(e(P),{ref_key:"presentRef",ref:o,present:t.forceMount||e(a).open.value,"force-mount":!0},{default:c(({present:q})=>[E(e(R),B(t.$attrs,{id:e(a).contentId,ref:e(r),"as-child":i.asChild,as:t.as,hidden:q?void 0:e(a).unmountOnHide.value?"":"until-found","data-state":k.value?void 0:e(a).open.value?"open":"closed","data-disabled":e(a).disabled?.value?"":void 0,style:{"--reka-collapsible-content-height":`${h.value}px`,"--reka-collapsible-content-width":`${d.value}px`}}),{default:c(()=>[!e(a).unmountOnHide.value||q?b(t.$slots,"default",{key:0}):I("v-if",!0)]),_:2},1040,["id","as-child","as","hidden","data-state","data-disabled","style"])]),_:3},8,["present"]))}}),G=z;const K=m({__name:"Collapsible",props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["update:open"],setup(s,{emit:l}){const a=V(s,l);return(o,r)=>(_(),v(e(L),B({"data-slot":"collapsible"},e(a)),{default:c(({open:u})=>[b(o.$slots,"default",{open:u})]),_:3},16))}}),Q=m({__name:"CollapsibleContent",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(s){const l=s;return(i,n)=>(_(),v(e(G),B({"data-slot":"collapsible-content"},l),{default:c(()=>[b(i.$slots,"default")]),_:3},16))}});export{Q as _,K as a,T as i};
