import{Ot as e,kt as t}from"./BA99CCI5.js";import"./D7pSEO6W.js";import{t as n}from"./3-kIKBFx.js";var r=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],i={position:`top-center`,durationMs:8e3},a=`alertSettings`,o=new Set(r);function s(e){return typeof e==`string`&&o.has(e)}function c(e){if(!e)return null;try{let t=JSON.parse(e);if(!t||!s(t.position))return null;let n=Number(t.durationMs);return!Number.isFinite(n)||n<0?null:{position:t.position,durationMs:Math.round(n)}}catch{return null}}function l(e){localStorage.setItem(a,JSON.stringify(e))}function u(){let e=i;{let t=c(localStorage.getItem(a));t&&(e=t)}let{subscribe:n,set:r}=t(e);function o(e){r(e),l(e)}return{subscribe:n,setSettings:o}}var d=u();function f(){let{subscribe:r,update:i}=t([]);return{subscribe:r,add:(t,r,a)=>{let o=e(d).durationMs,s=typeof a==`number`?a:o,c=n(),l={id:c,type:t,message:r,duration:s};return i(e=>[...e,l]),s>0&&setTimeout(()=>{i(e=>e.filter(e=>e.id!==c))},s),c},remove:e=>{i(t=>t.filter(t=>t.id!==e))},clear:()=>{i(()=>[])}}}var p=f();export{i as n,d as r,p as t};