import{r as n,a as d,j as t}from"./sikshya-admin-sikshya-react-E_TY_un4.js";import{m as l,N as c}from"./sikshya-admin.js";import{ad as m}from"./sikshya-admin-sikshya-vendor-BVAk_Gwu.js";function u(s=3800){const[e,a]=n.useState(null);return n.useEffect(()=>{if(!(e!=null&&e.open))return;const r=e.ttlMs??s;if(!r||r<=0)return;const o=window.setTimeout(()=>a(null),r);return()=>window.clearTimeout(o)},[e,s]),n.useMemo(()=>({toast:e,clear:()=>a(null),show:r=>a({ttlMs:s,...r,open:r.open??!0}),success:(r,o)=>a({open:!0,kind:"success",title:r,message:o,ttlMs:s}),error:(r,o)=>a({open:!0,kind:"error",title:r,message:o,ttlMs:s}),info:(r,o)=>a({open:!0,kind:"info",title:r,message:o,ttlMs:s})}),[e,s])}function g(s){const{toast:e,onDismiss:a}=s;if(!(e!=null&&e.open)||typeof document>"u")return null;const i=e.kind==="success"?{border:"border-emerald-200 dark:border-emerald-900/50",bg:"bg-emerald-50/95 text-emerald-900 dark:bg-emerald-950/60 dark:text-emerald-100",iconBg:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-200",icon:"badge"}:e.kind==="error"?{border:"border-rose-200 dark:border-rose-900/50",bg:"bg-rose-50/95 text-rose-900 dark:bg-rose-950/60 dark:text-rose-100",iconBg:"bg-rose-100 text-rose-700 dark:bg-rose-900/40 dark:text-rose-200",icon:"helpCircle"}:{border:"border-slate-200 dark:border-slate-800",bg:"bg-white/95 text-slate-900 dark:bg-slate-900/90 dark:text-slate-100",iconBg:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200",icon:"helpCircle"};return d.createPortal(t.jsx("div",{className:"sikshya-admin-theme fixed right-6 top-6 w-[360px] max-w-[calc(100vw-48px)]",style:{zIndex:l},children:t.jsx("div",{className:`rounded-2xl border ${i.border} px-4 py-3 shadow-lg backdrop-blur dark:backdrop-blur ${i.bg}`,role:"status","aria-live":"polite",children:t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("span",{className:`mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl ${i.iconBg}`,"aria-hidden":!0,children:t.jsx(c,{name:i.icon,className:"h-5 w-5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm font-semibold",children:e.title}),e.message?t.jsx("div",{className:"mt-0.5 whitespace-pre-line text-xs leading-snug opacity-90",children:e.message}):null]}),t.jsx("button",{type:"button",onClick:a,className:"shrink-0 rounded-lg px-2 py-1 text-xs font-semibold opacity-70 hover:opacity-100","aria-label":m("Dismiss","sikshya"),children:"✕"})]})})}),document.body)}export{g as T,u};
