import{r as d,d as x,j as e}from"./index-DiwDH9aE.js";import{X as m}from"./x-D4vgwdOf.js";const y=({isOpen:t,onClose:r,title:l,subtitle:a,children:n,footer:s,closeOnEscape:o=!0})=>(d.useEffect(()=>(t&&(document.body.style.overflow="hidden"),()=>{document.body.style.overflow="unset"}),[t]),d.useEffect(()=>{if(!o||!t)return;const c=i=>{i.key==="Escape"&&r()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,r,o]),t?x.createPortal(e.jsxs("div",{className:"fixed inset-0 z-50 bg-white",children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 py-4 bg-white border-b border-gray-200 shadow-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-800 truncate",children:l}),a&&e.jsx("p",{className:"text-sm text-gray-600 mt-1 truncate",children:a})]}),e.jsx("button",{type:"button",onClick:r,className:"ml-4 p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors flex-shrink-0","aria-label":"Cerrar modal",children:e.jsx(m,{className:"w-5 h-5"})})]}),e.jsx("div",{className:`overflow-y-auto px-6 py-6 ${s?"h-[calc(100vh-73px-73px)]":"h-[calc(100vh-73px)]"}`,children:n}),s&&e.jsx("div",{className:"sticky bottom-0 z-10 px-6 py-4 bg-white border-t border-gray-200 shadow-lg",children:s})]}),document.body):null);export{y as F};
