import{R as $,aR as S,j as e,d as n,A as T,bn as X,r as c,bb as Y,bW as Z,o as _}from"./main-D6SjkSWq.js";const P={variants:{open:{height:"auto",visibility:"visible",transitionEnd:{overflow:"auto"}},closed:{height:0,overflow:"hidden",transitionEnd:{visibility:"hidden"}}},transition:{type:"tween",duration:.2}},ee=$.forwardRef(({variant:a="default",mode:h="single",children:x,className:t,isLazy:w,gap:N="space-y-10",size:j,...u},m)=>{const[p,r]=S(u.expandedValues,u.defaultExpandedValues||[],u.onExpandedChange),y=$.Children.count(x);return e.jsx("div",{className:n(a==="outline"&&N,t),ref:m,role:"presentation",children:e.jsx(T,{children:e.jsx(X,{children:$.Children.map(x,(o,d)=>c.isValidElement(o)?c.cloneElement(o,{key:o.key||d,value:o.props.value||d,isFirst:d===0,isLast:d===y-1,mode:h,variant:a,expandedValues:p,setExpandedValues:r,isLazy:w,size:j}):null)})})})});function se(a){var z;const{children:h,label:x,disabled:t,bodyClassName:w,className:N,bodyPadding:j="p-16",labelClassName:u,fontClassName:m,buttonPadding:p,startIcon:r,startIconColor:y="text-muted",description:o,descriptionClassName:d="text-xs text-muted",endAppend:g,chevronPosition:k="right",isFirst:D,mode:F,isLazy:H,size:V,variant:l,footerContent:K,onHeaderMouseEnter:O,onHeaderMouseLeave:U,onOpen:E,ref:W}=a,f=a.expandedValues||[],b=a.value||0,A=a.setExpandedValues||(()=>{}),q=c.useRef(null),i=!t&&f.includes(b),R=c.useRef(!1);i&&(R.current=!0);const s=Y(),C=c.useId(),B=`${C}-button`,G=`${C}-panel`,J=v=>{switch(v.key){case"ArrowDown":s==null||s.focusNext();break;case"ArrowUp":s==null||s.focusPrevious();break;case"Home":s==null||s.focusFirst();break;case"End":s==null||s.focusLast();break}},Q=()=>{const v=f.indexOf(b);if(v>-1){const L=[...f];L.splice(v,1),A(L);return}A(F==="single"?[b]:[...f,b]),E==null||E()},I=e.jsx("div",{children:e.jsx(Z,{"aria-hidden":"true",size:"md",className:n(t?"text-disabled":"text-muted",i&&"rotate-180 transition-transform")})});return e.jsxs("div",{"data-value":b,ref:W,className:n("transition-button",l==="default"&&"border-b",l==="outline"&&"rounded-panel border",l==="outline"&&i&&"border-divider-darker shadow",t&&"text-disabled",N),children:[e.jsxs("h3",{className:n("flex w-full items-center justify-between",t&&"pointer-events-none",D&&l==="default"&&"border-t",i&&l!=="minimal"&&V!=="lg"?"border-b":"border-b border-b-transparent",l==="outline"?i?"rounded-panel-t":"rounded-panel":void 0),onMouseEnter:O,onMouseLeave:U,children:[e.jsxs("button",{disabled:t,"aria-expanded":i,id:B,"aria-controls":G,type:"button",ref:q,onKeyDown:J,onClick:()=>{t||Q()},className:n("flex min-w-0 flex-auto items-center gap-12 text-left outline-none transition-button hover:bg-hover focus-visible:bg-primary/focus",p||"px-16 py-12"),children:[k==="left"&&I,r&&c.cloneElement(r,{size:((z=r.props)==null?void 0:z.size)??"md",className:n(r.props.className,t?"text-disabled":y)}),e.jsxs("div",{className:"flex-auto overflow-hidden overflow-ellipsis",children:[e.jsx("div",{className:n(m||(V==="lg"?"text-md font-semibold":"text-sm"),u),children:x}),o&&e.jsx("div",{className:d,children:o})]}),k==="right"&&I]}),g&&e.jsx("div",{className:"flex-shrink-0 px-4 text-sm text-muted",children:g})]}),e.jsxs(_.div,{"aria-labelledby":C,role:"region",variants:P.variants,transition:P.transition,initial:!1,animate:i?"open":"closed",children:[e.jsx("div",{className:n(j,w),children:!H||R?h:null}),K]})]})}export{ee as A,se as a};
