import{j as e}from"./fields-wnm5Jtc6.js";import{a as r,r as j}from"./vendor-D21mNUGX.js";import{P as a,B as g,I as v,J as y}from"./index-pmrLY__j.js";import{u as N}from"./Layout-CFk9FOHT.js";const E=({title:f,size:p="medium",visible:n=!1,setVisible:t=null,textAlign:u="left",padding:x=24,buttons:c=[],testId:d,children:h})=>{const i=r.useRef(!1),[s,l]=r.useState(!n),m=r.useRef();return r.useEffect(()=>{i.current?l(!s):i.current=!0},[n]),N([m],()=>{l(!0),t&&t(!1)}),s?null:j.createPortal(e.jsx("div",{className:"acpt-overlay",children:e.jsxs("div",{ref:m,className:`acpt-modal ${p} ${s?"modal-hidden":"modal-open"}`,"data-cy":d?"modal-"+d:null,children:[e.jsxs("div",{className:"acpt-modal-header flex-between",children:[e.jsx("h3",{children:f}),e.jsx("a",{className:"modal-close-icon",href:"#",onClick:o=>{o.preventDefault(),l(!s),t&&t(s)},children:e.jsx(v,{icon:"bx:bx-x",color:y(),width:24})})]}),e.jsx("div",{className:`acpt-modal-body p-${x} text-${u}`,children:h}),c.length>0&&e.jsx("div",{className:"acpt-modal-footer",children:e.jsx("div",{className:"i-flex-center s-8",children:c.map(o=>o)})})]})}),document.getElementById("acpt-admin-app-wrapper"))};E.propTypes={title:a.string.isRequired,visible:a.bool,setVisible:a.func,padding:a.number,testId:a.string,buttons:a.arrayOf(g),textAlign:a.oneOf(["center","left","right"]),size:a.oneOf(["small","medium","large"])};export{E as M};
