import"./jsx-runtime-D_zvdyIk.js";import{a as c}from"./chunk-QMGIS6GS-CBZUm-7V.js";import{u,r as d}from"./CloseButton-BDZlzHA2.js";function m(o,t){window.dispatchEvent(new CustomEvent(o,{detail:t}))}function E(o){function t(r){const n=Object.keys(r).reduce((e,a)=>(e[`${o}:${a}`]=i=>r[a](i.detail),e),{});u(()=>(Object.keys(n).forEach(e=>{window.removeEventListener(e,n[e]),window.addEventListener(e,n[e])}),()=>Object.keys(n).forEach(e=>{window.removeEventListener(e,n[e])})),[n])}function l(r){return(...n)=>m(`${o}:${String(r)}`,n[0])}return[t,l]}const p=c.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function b(){return c.useContext(p)}const[g,s]=E("mantine-modals"),M=o=>{const t=o.modalId||d();return s("openModal")({...o,modalId:t}),t},f=o=>{const t=o.modalId||d();return s("openConfirmModal")({...o,modalId:t}),t},x=o=>{const t=o.modalId||d();return s("openContextModal")({...o,modalId:t}),t},C=s("closeModal"),w=s("closeAllModals"),I=o=>s("updateModal")(o),v=o=>s("updateContextModal")(o),j={open:M,close:C,closeAll:w,openConfirmModal:f,openContextModal:x,updateModal:I,updateContextModal:v};export{b as a,j as m,g as u};
