"use strict";const u=require("./jsx-runtime-nZSsnGb7.cjs"),n=require("./Animated-B_N04fe6.cjs"),j=require("react-dom");require("@synnaxlabs/x");const e=require("./css-CloSmhZB.cjs"),q=require("./Box-CNUz5BsV.cjs"),b=(i="root")=>document.getElementById(i)??document.body,f=({style:i,background:d=0,className:g,bordered:S=!0,rounded:m=1,passthrough:l=!1,children:x,...C})=>{const{ref:y,targetCorner:a,dialogCorner:s,style:c,modalPosition:B}=n.useInternalContext("Dialog.Dialog"),{visible:r,variant:t}=n.useContext();if(!r&&!l)return null;const E=r&&(Object.keys(c).length>0||t==="modal");let o=u.jsxRuntimeExports.jsx(q.Box$1,{pack:!0,ref:y,y:!0,background:d,className:e.CSS(e.CSS.BE("dialog","dialog"),e.CSS.loc(a.x),e.CSS.loc(a.y),e.CSS.BEM("dialog","dialog",s.x),e.CSS.BEM("dialog","dialog",s.y),e.CSS.visible(E),l&&e.CSS.BM("dialog","passthrough"),e.CSS.M(t),t==="modal"&&e.CSS.BM("dialog","modal","position",B.toString()),g),rounded:m,role:"dialog",empty:!0,bordered:S,align:"stretch",style:{...c,...i},...C,children:x});return t==="modal"&&(o=u.jsxRuntimeExports.jsx(n.Background,{empty:!0,align:"center",visible:r,children:o})),l?o:j.createPortal(o,b())};exports.Dialog=f;
