import{U as l,j as n,r as y}from"./app-Bup04Qnx.js";import{m as oe,f as V,g as re,r as H,h as te,R as ne,P as K,T as ae,s as ce,u as se,n as ie,b as le,a as E,q as de}from"./index-DdNKWgRS.js";var d="Accordion",pe=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[S,fe,ue]=oe(d),[g,Pe]=re(d,[ue,H]),k=H(),$=l.forwardRef((o,a)=>{const{type:e,...t}=o,c=t,r=t;return n.jsx(S.Provider,{scope:o.__scopeAccordion,children:e==="multiple"?n.jsx(Ae,{...r,ref:a}):n.jsx(ve,{...c,ref:a})})});$.displayName=d;var[L,me]=g(d),[U,xe]=g(d,{collapsible:!1}),ve=l.forwardRef((o,a)=>{const{value:e,defaultValue:t,onValueChange:c=()=>{},collapsible:r=!1,...i}=o,[s,p]=V({prop:e,defaultProp:t??"",onChange:c,caller:d});return n.jsx(L,{scope:o.__scopeAccordion,value:l.useMemo(()=>s?[s]:[],[s]),onItemOpen:p,onItemClose:l.useCallback(()=>r&&p(""),[r,p]),children:n.jsx(U,{scope:o.__scopeAccordion,collapsible:r,children:n.jsx(z,{...i,ref:a})})})}),Ae=l.forwardRef((o,a)=>{const{value:e,defaultValue:t,onValueChange:c=()=>{},...r}=o,[i,s]=V({prop:e,defaultProp:t??[],onChange:c,caller:d}),p=l.useCallback(x=>s((u=[])=>[...u,x]),[s]),m=l.useCallback(x=>s((u=[])=>u.filter(b=>b!==x)),[s]);return n.jsx(L,{scope:o.__scopeAccordion,value:i,onItemOpen:p,onItemClose:m,children:n.jsx(U,{scope:o.__scopeAccordion,collapsible:!0,children:n.jsx(z,{...r,ref:a})})})}),[Ce,h]=g(d),z=l.forwardRef((o,a)=>{const{__scopeAccordion:e,disabled:t,dir:c,orientation:r="vertical",...i}=o,s=l.useRef(null),p=se(s,a),m=fe(e),u=ie(c)==="ltr",b=le(o.onKeyDown,v=>{var O;if(!pe.includes(v.key))return;const Z=v.target,I=m().filter(_=>{var M;return!((M=_.ref.current)!=null&&M.disabled)}),A=I.findIndex(_=>_.ref.current===Z),T=I.length;if(A===-1)return;v.preventDefault();let f=A;const w=0,j=T-1,N=()=>{f=A+1,f>j&&(f=w)},R=()=>{f=A-1,f<w&&(f=j)};switch(v.key){case"Home":f=w;break;case"End":f=j;break;case"ArrowRight":r==="horizontal"&&(u?N():R());break;case"ArrowDown":r==="vertical"&&N();break;case"ArrowLeft":r==="horizontal"&&(u?R():N());break;case"ArrowUp":r==="vertical"&&R();break}const ee=f%T;(O=I[ee].ref.current)==null||O.focus()});return n.jsx(Ce,{scope:e,disabled:t,direction:c,orientation:r,children:n.jsx(S.Slot,{scope:e,children:n.jsx(K.div,{...i,"data-orientation":r,ref:p,onKeyDown:t?void 0:b})})})}),C="AccordionItem",[ge,D]=g(C),G=l.forwardRef((o,a)=>{const{__scopeAccordion:e,value:t,...c}=o,r=h(C,e),i=me(C,e),s=k(e),p=te(),m=t&&i.value.includes(t)||!1,x=r.disabled||o.disabled;return n.jsx(ge,{scope:e,open:m,disabled:x,triggerId:p,children:n.jsx(ne,{"data-orientation":r.orientation,"data-state":Q(m),...s,...c,ref:a,disabled:x,open:m,onOpenChange:u=>{u?i.onItemOpen(t):i.onItemClose(t)}})})});G.displayName=C;var q="AccordionHeader",Y=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=h(d,e),r=D(q,e);return n.jsx(K.h3,{"data-orientation":c.orientation,"data-state":Q(r.open),"data-disabled":r.disabled?"":void 0,...t,ref:a})});Y.displayName=q;var P="AccordionTrigger",B=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=h(d,e),r=D(P,e),i=xe(P,e),s=k(e);return n.jsx(S.ItemSlot,{scope:e,children:n.jsx(ae,{"aria-disabled":r.open&&!i.collapsible||void 0,"data-orientation":c.orientation,id:r.triggerId,...s,...t,ref:a})})});B.displayName=P;var F="AccordionContent",J=l.forwardRef((o,a)=>{const{__scopeAccordion:e,...t}=o,c=h(d,e),r=D(F,e),i=k(e);return n.jsx(ce,{role:"region","aria-labelledby":r.triggerId,"data-orientation":c.orientation,...i,...t,ref:a,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...o.style}})});J.displayName=F;function Q(o){return o?"open":"closed"}var he=$,be=G,Ie=Y,W=B,X=J;const ye=he,we=y.forwardRef(({className:o,...a},e)=>n.jsx(be,{ref:e,className:E("border-b",o),...a}));we.displayName="AccordionItem";const je=y.forwardRef(({className:o,children:a,...e},t)=>n.jsx(Ie,{className:"flex",children:n.jsxs(W,{ref:t,className:E("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",o),...e,children:[a,n.jsx(de,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));je.displayName=W.displayName;const Ne=y.forwardRef(({className:o,children:a,...e},t)=>n.jsx(X,{ref:t,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...e,children:n.jsx("div",{className:E("pb-4 pt-0",o),children:a})}));Ne.displayName=X.displayName;export{ye as A,we as a,je as b,Ne as c};
