import{j as u,E as k,z as B,p as C,q as E,r as S,e as z,v as l,G as n,b as a,a as c,w as f,T as y,n as T,o as p,c as L,t as V,i as v,f as $,R as D,y as N}from"./app-CYVHboi-.js";const W={class:"fixed inset-0 z-50 overflow-y-auto px-4 py-6 sm:px-0 print:static","scroll-region":""},j={class:"flex min-h-full items-center justify-center sm:px-4 lg:px-0 print:items-start sm:print:items-start"},q={key:0,class:"absolute end-0 top-0 pe-4 pt-4 print:hidden"},I={class:"sr-only"},A={__name:"Modal",props:{show:{type:Boolean,default:!1},maxWidth:{type:String,default:"2xl"},closeable:{type:Boolean,default:!0},backdrop:{type:Boolean,default:!0},round:{type:Boolean,default:!1},transparent:{type:Boolean,default:!1},overflow:{type:Boolean,default:!1}},emits:["close"],setup(t,{emit:w}){const o=t,d=w,x=u(null),r=u(o.show);k(()=>o.show,async()=>{if(o.show)document.body.classList.add("modal-open"),document.body.style.overflow="hidden",r.value=!0;else{await B();let e=0;document.querySelectorAll("body .modal").forEach(s=>{s.checkVisibility()&&e++}),e<=0&&(document.body.style.overflow=null,document.body.classList.remove("modal-open")),setTimeout(()=>{r.value=!1},200)}});const i=e=>{(e&&o.backdrop||!e&&o.closeable)&&d("close")},m=e=>{e.key==="Escape"&&(e.preventDefault(),o.show&&i())};C(()=>document.addEventListener("keydown",m)),E(()=>{document.removeEventListener("keydown",m),document.body.style.overflow=null});const h=N(()=>({sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl","3xl":"sm:max-w-3xl","4xl":"sm:max-w-4xl"})[o.maxWidth]);return(e,s)=>{const b=S("Icon");return p(),z(D,{to:"body"},[l(a("div",{class:"modal m-0 min-h-full min-w-full overflow-y-auto bg-transparent backdrop:bg-transparent",ref_key:"dialog",ref:x},[a("div",W,[c(y,{"enter-active-class":"ease-out duration-300","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"ease-in duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:f(()=>[l(a("div",{class:"fixed inset-0 transform backdrop-blur-xs transition-all print:hidden",onClick:s[0]||(s[0]=g=>i(!0))},[...s[2]||(s[2]=[a("div",{class:"absolute inset-0 bg-gray-100 opacity-75 dark:bg-gray-900"},null,-1)])],512),[[n,t.show]])]),_:1}),c(y,{"enter-active-class":"ease-out duration-300","enter-from-class":"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-50","enter-to-class":"opacity-100 translate-y-0 sm:scale-100","leave-active-class":"ease-in duration-200","leave-from-class":"opacity-100 translate-y-0 sm:scale-100","leave-to-class":"opacity-0 translate-y-4 sm:translate-y-0 sm:scale-50"},{default:f(()=>[l(a("div",j,[l(a("div",{class:T([[{"overflow-hidden":!t.overflow},t.round?"rounded-2xl":"rounded-lg",t.transparent?"max-w-fit bg-transparent":"bg-white shadow-xl dark:bg-gray-800 "+h.value],"relative w-full transform transition-all sm:mx-auto print:shadow-none sm:print:w-full sm:print:max-w-full"])},[t.closeable?(p(),L("div",q,[a("button",{type:"button",onClick:s[1]||(s[1]=g=>i(!1)),class:"text-mute rounded-md hover:text-gray-700 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:outline-hidden dark:hover:text-gray-300"},[a("span",I,V(e.$t("Close")),1),c(b,{name:"x",size:"size-6"})])])):v("",!0),r.value?$(e.$slots,"default",{key:1}):v("",!0)],2),[[n,t.show]])],512),[[n,t.show]])]),_:3})])],512),[[n,t.show]])])}}};export{A as _};
