import{e as I,r as n,f as O,j as c,P as v,h as S,i as D,g as M,k}from"./index-6aWWvyNc.js";import{c as L}from"./Navigation-KKUTSq3z.js";var f="Collapsible",[F,H]=I(f),[B,g]=F(f),T=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,open:a,defaultOpen:t,disabled:l,onOpenChange:i,...C}=e,[p,d]=O({prop:a,defaultProp:t??!1,onChange:i,caller:f});return c.jsx(B,{scope:r,disabled:l,contentId:L(),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})})});T.displayName=f;var j="CollapsibleTrigger",w=n.forwardRef((e,s)=>{const{__scopeCollapsible:r,...a}=e,t=g(j,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)})});w.displayName=j;var x="CollapsibleContent",A=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(G,{...a,ref:s,present:l})})});A.displayName=x;var G=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)},[]),k(()=>{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 z=T,J=w,K=A;export{w as C,z as R,J as T,A as a,K as b,H as c};