import { w as writable } from "./index3.js"; function createToastStore() { const { subscribe, update } = writable([]); let counter = 0; function add(message, type = "info", duration = 5e3) { const id = `toast-${++counter}-${Date.now()}`; const toast = { id, message, type, duration }; update((toasts2) => [...toasts2, toast]); if (duration > 0) { setTimeout(() => remove(id), duration); } return id; } function remove(id) { update((toasts2) => toasts2.filter((t) => t.id !== id)); } function success(message, duration = 5e3) { return add(message, "success", duration); } function error(message, duration = 7e3) { return add(message, "error", duration); } function warning(message, duration = 5e3) { return add(message, "warning", duration); } function info(message, duration = 5e3) { return add(message, "info", duration); } return { subscribe, add, remove, success, error, warning, info }; } const toasts = createToastStore(); export { toasts as t };