import{r as o,j as f}from"./main.js";import{u as $,a as I,c as A,e as T}from"./Combination-B6GbgrNn.js";import{a as D,u as M}from"./button-D4VgS8ri.js";import{P as L}from"./index-BoCNxazq.js";function V(e,n=[]){let r=[];function s(a,i){const l=o.createContext(i),c=r.length;r=[...r,i];const p=u=>{const{scope:b,children:x,...C}=u,v=b?.[e]?.[c]||l,g=o.useMemo(()=>C,Object.values(C));return f.jsx(v.Provider,{value:g,children:x})};p.displayName=a+"Provider";function m(u,b){const x=b?.[e]?.[c]||l,C=o.useContext(x);if(C)return C;if(i!==void 0)return i;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[p,m]}const t=()=>{const a=r.map(i=>o.createContext(i));return function(l){const c=l?.[e]||a;return o.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return t.scopeName=e,[s,B(t,...n)]}function B(...e){const n=e[0];if(e.length===1)return n;const r=()=>{const s=e.map(t=>({useScope:t(),scopeName:t.scopeName}));return function(a){const i=s.reduce((l,{useScope:c,scopeName:p})=>{const u=c(a)[`__scope${p}`];return{...l,...u}},{});return o.useMemo(()=>({[`__scope${n.scopeName}`]:i}),[i])}};return r.scopeName=n.scopeName,r}function F(e){const n=W(e),r=o.forwardRef((s,t)=>{const{children:a,...i}=s,l=o.Children.toArray(a),c=l.find(H);if(c){const p=c.props.children,m=l.map(u=>u===c?o.Children.count(p)>1?o.Children.only(null):o.isValidElement(p)?p.props.children:null:u);return f.jsx(n,{...i,ref:t,children:o.isValidElement(p)?o.cloneElement(p,void 0,m):null})}return f.jsx(n,{...i,ref:t,children:a})});return r.displayName=`${e}.Slot`,r}function W(e){const n=o.forwardRef((r,s)=>{const{children:t,...a}=r;if(o.isValidElement(t)){const i=q(t),l=G(a,t.props);return t.type!==o.Fragment&&(l.ref=s?D(s,i):i),o.cloneElement(t,l)}return o.Children.count(t)>1?o.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var k=Symbol("radix.slottable");function H(e){return o.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===k}function G(e,n){const r={...n};for(const s in n){const t=e[s],a=n[s];/^on[A-Z]/.test(s)?t&&a?r[s]=(...l)=>{const c=a(...l);return t(...l),c}:t&&(r[s]=t):s==="style"?r[s]={...t,...a}:s==="className"&&(r[s]=[t,a].filter(Boolean).join(" "))}return{...e,...r}}function q(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],R=Z.reduce((e,n)=>{const r=F(`Primitive.${n}`),s=o.forwardRef((t,a)=>{const{asChild:i,...l}=t,c=i?r:n;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(c,{...l,ref:a})});return s.displayName=`Primitive.${n}`,{...e,[n]:s}},{}),y="Collapsible",[z]=V(y),[J,P]=z(y),N=o.forwardRef((e,n)=>{const{__scopeCollapsible:r,open:s,defaultOpen:t,disabled:a,onOpenChange:i,...l}=e,[c,p]=$({prop:s,defaultProp:t??!1,onChange:i,caller:y});return f.jsx(J,{scope:r,disabled:a,contentId:I(),open:c,onOpenToggle:o.useCallback(()=>p(m=>!m),[p]),children:f.jsx(R.div,{"data-state":E(c),"data-disabled":a?"":void 0,...l,ref:n})})});N.displayName=y;var w="CollapsibleTrigger",j=o.forwardRef((e,n)=>{const{__scopeCollapsible:r,...s}=e,t=P(w,r);return f.jsx(R.button,{type:"button","aria-controls":t.contentId,"aria-expanded":t.open||!1,"data-state":E(t.open),"data-disabled":t.disabled?"":void 0,disabled:t.disabled,...s,ref:n,onClick:A(e.onClick,t.onOpenToggle)})});j.displayName=w;var S="CollapsibleContent",O=o.forwardRef((e,n)=>{const{forceMount:r,...s}=e,t=P(S,e.__scopeCollapsible);return f.jsx(L,{present:r||t.open,children:({present:a})=>f.jsx(K,{...s,ref:n,present:a})})});O.displayName=S;var K=o.forwardRef((e,n)=>{const{__scopeCollapsible:r,present:s,children:t,...a}=e,i=P(S,r),[l,c]=o.useState(s),p=o.useRef(null),m=M(n,p),u=o.useRef(0),b=u.current,x=o.useRef(0),C=x.current,v=i.open||l,g=o.useRef(v),h=o.useRef(void 0);return o.useEffect(()=>{const d=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(d)},[]),T(()=>{const d=p.current;if(d){h.current=h.current||{transitionDuration:d.style.transitionDuration,animationName:d.style.animationName},d.style.transitionDuration="0s",d.style.animationName="none";const _=d.getBoundingClientRect();u.current=_.height,x.current=_.width,g.current||(d.style.transitionDuration=h.current.transitionDuration,d.style.animationName=h.current.animationName),c(s)}},[i.open,s]),f.jsx(R.div,{"data-state":E(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!v,...a,ref:m,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...e.style},children:v&&t})});function E(e){return e?"open":"closed"}var Q=N;const te=Q,ne=j,oe=O;export{te as C,ne as a,oe as b};
