import{a as e}from"./rolldown-runtime-COnpUsM8.js";import{At as t,Ht as n}from"./vendor-react-N_fu9J_Y.js";import{n as r}from"./vendor-i18n-Bp74-ivj.js";var i=e(n()),a=t(),o=(0,i.createContext)(null),s=e=>{let{children:t}=e,[n,s]=(0,i.useState)([]),c=(0,i.useCallback)(e=>{let t=[`notice`,`error`,`warning`].includes(e.type)?e.type:`notice`,i=r(`${t}.${e.message}`,e.message),a=n.find(e=>e.message===i);if(a)return a.id;let o=String(Math.floor(Math.random()*1e3)),c={id:o,message:i,type:t,duration:e.duration||void 0};return s(e=>[...e,c]),o},[n]),l=(0,i.useCallback)(e=>{s(t=>t.filter(t=>t.id!==e))},[s]),u=(0,i.useMemo)(()=>({addNotification:c,notifications:n,removeNotification:l}),[c,n,l]);return(0,a.jsx)(o.Provider,{value:u,children:t})},c=()=>(0,i.useContext)(o);export{c as n,s as t};