import{r as e,t}from"./jsx-runtime-DAs1UGHr.js";import{t as n}from"./react-DxF41JXl.js";import{A as r,j as i}from"./use-api-BAbm8GVs.js";import{t as a}from"./toast-context-val-CcPDsXTx.js";var o=e(n(),1),s=e(t(),1);const c=({isOpen:e,onClose:t,title:n,children:a,width:c=`max-w-xl`})=>((0,o.useEffect)(()=>(e&&(document.body.style.overflow=`hidden`),()=>{document.body.style.overflow=`unset`}),[e]),(0,o.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[e,t]),e?(0,s.jsx)(`div`,{className:`fixed inset-0 z-50 overflow-y-auto bg-ui-bg-dark/50 dark:bg-ui-bg-dark/70 transition-opacity flex justify-center items-start pt-16 sm:pt-24 md:items-center md:pt-0`,onClick:t,children:(0,s.jsxs)(`div`,{className:`relative bg-ui-bg dark:bg-ui-secondary-bg-dark rounded-lg shadow-xl w-full ${c} p-6`,onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(`div`,{className:`absolute top-0.5 right-1`,children:(0,s.jsx)(i,{onClick:t,"aria-label":`Close modal`,variant:`ghost`,icon:r})}),(0,s.jsx)(`div`,{className:`mb-6`,children:(0,s.jsx)(`h4`,{className:`text-xl text-ui-text dark:text-ui-text-dark font-semibold`,children:n})}),(0,s.jsx)(`div`,{className:`space-y-5`,children:a})]})}):null),l=({label:e,error:t,className:n=``,containerClassName:r=``,id:i,children:a,ref:o,reserveErrorSpace:c=!1,...l})=>{let u=t||(c?`\xA0`:null);return(0,s.jsxs)(`div`,{className:`${r} relative`,children:[e&&(0,s.jsxs)(`label`,{htmlFor:i,className:`block text-sm font-medium text-text-primary dark:text-text-primary-dark mb-1`,children:[e,l.required&&`*`]}),(0,s.jsx)(`input`,{ref:o,id:i,className:`w-full px-3 py-2 border rounded-md focus:outline-none 
            text-ui-text dark:text-ui-text-dark
            bg-ui-bg dark:bg-ui-bg-dark
            border-ui-border dark:border-ui-border-dark
            focus:border-btn-primary dark:focus:border-btn-primary-dark
            transition duration-150 ease-in-out
            disabled:opacity-70 disabled:cursor-not-allowed
            read-only:cursor-default read-only:focus:border-ui-secondary-bg dark:read-only:focus:border-ui-secondary-bg-dark
            ${t?`border-red-500 focus:border-red-500 dark:border-red-500 dark:focus:border-red-500`:``}
            ${n}`,...l}),a,u&&(0,s.jsx)(`p`,{className:`mt-1 text-sm ${t?`text-red-500`:`invisible`}`,children:u})]})};l.displayName=`Input`;const u=()=>{let e=(0,o.use)(a);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e};export{l as n,c as r,u as t};