import{r as n,G as w,j as c,P as v,am as A,I as S,aJ as D,J as M,an as L,O as k}from"./index-C46kOBpe.js";var f="Collapsible",[F,$]=k(f),[G,g]=F(f),I=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,open:a,defaultOpen:t,disabled:l,onOpenChange:i,...C}=e,[p,d]=w({prop:a,defaultProp:t??!1,onChange:i,caller:f});return c.jsx(G,{scope:r,disabled:l,contentId:A(),open:p,onOpenToggle:n.useCallback(()=>d(b=>!b),[d]),children:c.jsx(v.div,{"data-state":R(p),"data-disabled":l?"":void 0,...C,ref:s})})});I.displayName=f;var O="CollapsibleTrigger",T=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,...a}=e,t=g(O,r);return c.jsx(v.button,{type:"button","aria-controls":t.contentId,"aria-expanded":t.open||!1,"data-state":R(t.open),"data-disabled":t.disabled?"":void 0,disabled:t.disabled,...a,ref:s,onClick:S(e.onClick,t.onOpenToggle)})});T.displayName=O;var x="CollapsibleContent",j=n.forwardRef((e,s)=>{const{forceMount:r,...a}=e,t=g(x,e.__scopeCollapsible);return c.jsx(D,{present:r||t.open,children:({present:l})=>c.jsx(B,{...a,ref:s,present:l})})});j.displayName=x;var B=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,present:a,children:t,...l}=e,i=g(x,r),[C,p]=n.useState(a),d=n.useRef(null),b=M(s,d),h=n.useRef(0),y=h.current,P=n.useRef(0),N=P.current,m=i.open||C,E=n.useRef(m),u=n.useRef(void 0);return n.useEffect(()=>{const o=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(o)},[]),L(()=>{const o=d.current;if(o){u.current=u.current||{transitionDuration:o.style.transitionDuration,animationName:o.style.animationName},o.style.transitionDuration="0s",o.style.animationName="none";const _=o.getBoundingClientRect();h.current=_.height,P.current=_.width,E.current||(o.style.transitionDuration=u.current.transitionDuration,o.style.animationName=u.current.animationName),p(a)}},[i.open,a]),c.jsx(v.div,{"data-state":R(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...l,ref:b,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":N?`${N}px`:void 0,...e.style},children:m&&t})});function R(e){return e?"open":"closed"}var q=I,H=T,z=j;export{z as C,q as R,H as T,T as a,j as b,$ as c};