import{j as e,al as M,I as k,ce as C,aP as P,a4 as T,M as b,aM as v,aN as z,an as A,X as u}from"./vendor-mui-core-CDEc-eG6.js";import{r as m}from"./vendor-react-DX7tU9aY.js";function B({actions:d=[],size:s="small",...f}){const[r,i]=m.useState(null),h=!!r,x=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(t.currentTarget)},a=t=>{try{t.stopPropagation(),t.preventDefault()}catch{}i(null)};return e.jsxs(M,{...f,children:[e.jsx(k,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"actions-menu-icon",onClick:x,size:s,children:e.jsx(C,{fontSize:s})}),e.jsx(P,{id:"actions-menu","data-cy":"actions-menu",anchorEl:r,keepMounted:!0,open:h,onClose:a,slotProps:{paper:{}},children:d.map((t,o)=>{if(typeof t=="function")return t({close:a});if(t.separator)return e.jsx(T,{},`separator-${o}`);const{icon:y,text:j,render:n,onClick:g,disabled:I=!1,tip:c,...E}=t,l=n&&typeof n=="function"?n({close:a}):m.createElement(b,{...E,disabled:I,dense:!0,onClick:async p=>{p.stopPropagation(),await g?.(p),a()},key:o,"data-cy":`actions-menu-${o}`},e.jsx(v,{style:{minWidth:24,marginRight:8},children:y}),e.jsx(z,{primary:j}));return c?e.jsx(A,{title:c,children:e.jsx("span",{children:l})}):l})})]})}B.propTypes={actions:u.array,size:u.oneOf(["small","medium","large"])};export{B as A};
