vetra-toast 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,54 +2,48 @@
2
2
 
3
3
  # Vetra Toast
4
4
 
5
- **Premium glassmorphism toast notifications for modern React and Next.js applications.**
5
+ **Glassmorphism toast notifications for React & Next.js — zero runtime dependencies.**
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/vetra-toast?color=38bdf8&style=flat-square)](https://www.npmjs.com/package/vetra-toast)
8
- [![Live Playground](https://img.shields.io/badge/Live-Playground-0ea5e9?style=flat-square&logo=vercel&logoColor=white)](https://vetra-toast.vercel.app/)
9
8
  [![npm downloads](https://img.shields.io/npm/dm/vetra-toast?color=818cf8&style=flat-square)](https://www.npmjs.com/package/vetra-toast)
10
- [![TypeScript](https://img.shields.io/badge/TypeScript-First-3178c6?style=flat-square&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
11
9
  [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-34d399?style=flat-square)](https://www.npmjs.com/package/vetra-toast)
10
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-3178c6?style=flat-square)](https://www.typescriptlang.org/)
12
11
  [![License: MIT](https://img.shields.io/badge/license-MIT-a78bfa?style=flat-square)](https://github.com/immobarok/vetra-toast/blob/main/LICENSE)
13
12
 
14
- **[Live Playground ↗](https://vetra-toast.vercel.app/)** • [Installation](#installation) • [Quick Start](#quick-start) • [API Reference](#api-reference) • [Customization](#customization) • [Next.js Setup](#nextjs-app-router) • [Accessibility](#accessibility)
13
+ **[Live Playground ↗](https://vetra-toast.vercel.app/)** · [Installation](#installation) · [Quick Start](#quick-start) · [API](#api) · [Configuration](#configuration) · [Customization](#customization) · [Accessibility](#accessibility)
15
14
 
16
15
  </div>
17
16
 
18
17
  ---
19
18
 
20
- ## Why Vetra Toast?
19
+ ## Highlights
21
20
 
22
- - **Signature Frosted Glass UI** — Layered `backdrop-filter` blur, prismatic top specular edge, semantic corner aura, and four glass presets (`subtle`, `frosted`, `crystal`, `solid`).
23
- - **Bespoke Animated SVG Icons** — Hand-crafted micro-animations per variant (spring-drawn success check with sparkles, dual-stroke error shield with micro-shake, warning prism, orbital info glint, and dual-ring gyroscope loader).
24
- - **Zero Runtime Dependencies** — No mandatory Tailwind CSS or animation libraries. Tree-shakeable ESM + CJS with standalone `vetra-toast/styles.css`.
25
- - **Framework-Agnostic Core** — Predictable external store (`useSyncExternalStore`) with FIFO queue promotion, reference-counted multi-reason pause/resume (`hover`, `focus`, `document-hidden`, `swipe`), and duplicate prevention.
26
- - **Next.js App Router & SSR Safe** — Ships `"use client"` on the React entry, defers portal mounting until client hydration, and keeps browser APIs out of module initialization.
27
- - **Accessibility First** — Semantic `role="alert"` / `role="status"`, `aria-live`, `Alt+T` focus hotkey, `Escape` dismissal, `prefers-reduced-motion`, and `prefers-reduced-transparency` fallbacks.
28
- - **Rich Sensory Feedback** — Optional subtle synthesized Web Audio chimes and mobile haptic vibration (`navigator.vibrate`), zero audio asset downloads.
21
+ - **Frosted Glass UI** — Layered `backdrop-filter` blur, prismatic specular edge, semantic glow, and 4 presets (`subtle`, `frosted`, `crystal`, `solid`).
22
+ - **Animated SVG Icons** — Hand-crafted micro-animations for `success`, `error`, `warning`, `info`, and `loading` (`default`, `subtle`, or `none`).
23
+ - **Next.js App Router & SSR Safe** — Ships `"use client"` on the React entry, mounts portals after hydration, and supports `vetra-toast/core` outside React.
24
+ - **Smart Lifecycle** — FIFO queue promotion, multi-reason pause/resume (`hover`, `focus`, `swipe`, `document-hidden`), and duplicate deduplication with count badges.
25
+ - **Rich Interactions** — Directional swipe-to-dismiss, optional progress bar, synthesized Web Audio chimes, and mobile haptic feedback.
26
+ - **Accessible by Default** — Semantic `role="status"` / `role="alert"`, `aria-live`, `Alt+T` focus hotkey, `Escape` dismiss, plus `prefers-reduced-motion` and `prefers-reduced-transparency` support.
29
27
 
30
28
  ---
31
29
 
32
30
  ## Installation
33
31
 
34
- ```bash
35
- pnpm add vetra-toast
36
- ```
37
-
38
32
  ```bash
39
33
  npm install vetra-toast
40
- ```
41
-
42
- ```bash
34
+ # or
35
+ pnpm add vetra-toast
36
+ # or
43
37
  yarn add vetra-toast
44
38
  ```
45
39
 
46
- > **Peer dependencies**: `react >= 18` and `react-dom >= 18` (built and tested with React 19.3+).
40
+ > Peer dependencies: `react >= 18` and `react-dom >= 18` (tested on React 18 & 19).
47
41
 
48
42
  ---
49
43
 
50
44
  ## Quick Start
51
45
 
52
- Import the stylesheet once in your app entry, mount `<Toaster />` near the root, and call `toast` from anywhere:
46
+ Import the stylesheet once, render `<Toaster />` at the root, and call `toast` anywhere:
53
47
 
54
48
  ```tsx
55
49
  import { Toaster, toast } from "vetra-toast";
@@ -59,28 +53,24 @@ export function App() {
59
53
  return (
60
54
  <>
61
55
  <Toaster position="top-right" theme="dark" />
62
-
63
56
  <button onClick={() => toast.success("Profile updated!")}>
64
- Save Profile
57
+ Save Changes
65
58
  </button>
66
59
  </>
67
60
  );
68
61
  }
69
62
  ```
70
63
 
71
- ---
72
-
73
- ## Next.js App Router
64
+ ### Next.js App Router
74
65
 
75
- Mount `<Toaster />` directly inside your Server Component root layout (`app/layout.tsx`) with zero hydration warnings:
66
+ Mount `<Toaster />` directly inside `app/layout.tsx` (Server Component) and trigger `toast()` from any Client Component:
76
67
 
77
68
  ```tsx
78
69
  // app/layout.tsx
79
- import type { ReactNode } from "react";
80
70
  import { Toaster } from "vetra-toast";
81
71
  import "vetra-toast/styles.css";
82
72
 
83
- export default function RootLayout({ children }: { children: ReactNode }) {
73
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
84
74
  return (
85
75
  <html lang="en">
86
76
  <body>
@@ -92,231 +82,127 @@ export default function RootLayout({ children }: { children: ReactNode }) {
92
82
  }
93
83
  ```
94
84
 
95
- Then trigger toasts from any Client Component (`"use client"`):
96
-
97
- ```tsx
98
- "use client";
99
-
100
- import { toast } from "vetra-toast";
101
-
102
- export function SaveButton() {
103
- return (
104
- <button onClick={() => toast.success("Saved to cloud!")}>
105
- Save Changes
106
- </button>
107
- );
108
- }
109
- ```
110
-
111
85
  ---
112
86
 
113
- ## API Reference
87
+ ## API
114
88
 
115
- ### Variants
89
+ ### Variants & Descriptions
116
90
 
117
91
  ```ts
118
92
  toast("Default notification");
119
- toast.success("Profile updated!", { description: "Your preferences are synced." });
120
- toast.error("Something went wrong!", { description: "Please check your connection." });
121
- toast.warning("Session expiring!", { description: "Sign in again within 2 minutes." });
122
- toast.info("New update available!");
123
- toast.loading("Uploading artifact...");
93
+ toast.success("Saved!", { description: "Your workspace settings are synced." });
94
+ toast.error("Upload failed", { description: "Please check your connection." });
95
+ toast.warning("Storage at 90%");
96
+ toast.info("New version available");
97
+ const id = toast.loading("Publishing package...");
124
98
  ```
125
99
 
126
- ### Promise Notifications
100
+ ### Promise Lifecycle
127
101
 
128
- Automatically transitions a single toast from `loading` → `success` or `error`. Rejections are handled internally so fire-and-forget usage never triggers unhandled promise rejections; call `.unwrap()` when you want the original promise result:
102
+ Automatically transitions from `loading` to `success` or `error`:
129
103
 
130
104
  ```ts
131
- const req = toast.promise(uploadFile(), {
132
- loading: "Uploading...",
133
- success: (file) => `Uploaded ${file.name}!`,
134
- error: (err) => `Upload failed: ${err.message}`,
105
+ const result = toast.promise(saveProfile(), {
106
+ loading: "Saving profile...",
107
+ success: (user) => ({
108
+ title: "Profile saved",
109
+ description: `Welcome back, ${user.name}`,
110
+ }),
111
+ error: (err) => `Failed: ${err instanceof Error ? err.message : "Unknown error"}`,
135
112
  });
136
113
 
137
- // Optional: await resolved data or catch rejection
138
- // const file = await req.unwrap();
114
+ const user = await result.unwrap();
139
115
  ```
140
116
 
141
- ### Update, Dismiss & Dismiss All
117
+ ### Actions, Updates & Dismissal
142
118
 
143
119
  ```ts
144
- const id = toast.loading("Deploying to production...");
145
-
146
- toast.update(id, {
147
- variant: "success",
148
- title: "Deployment live!",
149
- description: "All health checks passed.",
120
+ const id = toast("Message archived", {
121
+ action: { label: "Undo", onClick: () => restoreMessage() },
122
+ cancel: { label: "Dismiss", onClick: () => toast.dismiss(id) },
150
123
  });
151
124
 
125
+ toast.update(id, { variant: "success", title: "Message restored" });
152
126
  toast.dismiss(id);
153
127
  toast.dismissAll();
154
128
  ```
155
129
 
156
- ### Action Buttons, Custom Icons & Custom JSX
130
+ ### Custom Renderer
157
131
 
158
132
  ```tsx
159
- toast.warning("File moved to trash", {
160
- description: "Restore it within 30 days.",
161
- action: {
162
- label: "Undo",
163
- onClick: () => restoreFile(),
164
- },
165
- cancel: {
166
- label: "Dismiss",
167
- onClick: () => {},
168
- },
169
- });
170
-
171
133
  toast.custom(({ dismiss }) => (
172
- <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between", gap: 12 }}>
173
- <strong>Custom Glass Widget</strong>
174
- <button type="button" onClick={dismiss}>Close</button>
134
+ <div>
135
+ <strong>Custom Toast</strong>
136
+ <button onClick={dismiss}>Close</button>
175
137
  </div>
176
138
  ));
177
139
  ```
178
140
 
179
- ### Duplicate Prevention
141
+ ### Headless Core (`vetra-toast/core`)
142
+
143
+ Use the framework-agnostic store and API from non-React modules (API clients, workers, middleware):
180
144
 
181
145
  ```ts
182
- // Global: <Toaster preventDuplicates />
183
- // Or per-toast:
184
- toast.info("Connection restored", {
185
- dedupe: true,
186
- dedupeKey: "network-status",
187
- });
146
+ import { toast, createToastStore, createToastApi } from "vetra-toast/core";
188
147
  ```
189
148
 
190
- Repeated triggers increment a sleek `×2`, `×3` counter badge and reset the auto-dismiss timer instead of flooding the screen.
191
-
192
149
  ---
193
150
 
194
- ## `<Toaster />` Props
151
+ ## Configuration
152
+
153
+ Common `<Toaster />` props (most can also be overridden per toast):
195
154
 
196
155
  | Prop | Type | Default | Description |
197
- | :--- | :--- | :--- | :--- |
198
- | `position` | `"top-left" \| "top-center" \| "top-right" \| "bottom-left" \| "bottom-center" \| "bottom-right"` | `"top-right"` | Viewport anchor (auto-centered on mobile `<= 640px`) |
199
- | `theme` | `"dark" \| "light" \| "system"` | `"dark"` | Glassmorphism theme mode |
200
- | `glass` | `"subtle" \| "frosted" \| "crystal" \| "solid"` | `"frosted"` | Glass blur & surface intensity preset |
156
+ | --- | --- | --- | --- |
157
+ | `position` | `"top-left" \| "top-center" \| "top-right" \| "bottom-left" \| "bottom-center" \| "bottom-right"` | `"top-right"` | Viewport corner/edge |
158
+ | `theme` | `"dark" \| "light" \| "system"` | `"dark"` | Glass color scheme |
159
+ | `glass` | `"subtle" \| "frosted" \| "crystal" \| "solid"` | `"frosted"` | Glass blur & opacity preset |
201
160
  | `radius` | `"sm" \| "md" \| "lg" \| "pill"` | `"md"` | Corner radius preset |
202
- | `size` | `"compact" \| "default" \| "comfortable"` | `"default"` | Spacing & typography density |
203
- | `animation` | `"spring" \| "slide" \| "fade" \| "zoom" \| "bounce" \| "none"` | `"bounce"` | Entrance & exit animation style |
204
- | `iconAnimation` | `"default" \| "subtle" \| "none" \| boolean` | `"default"` | Control animated SVG icon motion |
205
- | `ambientGlow` | `boolean` | `true` | Semantic corner aura glow behind the icon |
206
- | `richColors` | `boolean` | `false` | Apply subtle semantic tint to glass surface & border |
207
- | `duration` | `number` | `4000` | Default auto-dismiss duration in ms (`Infinity` disables) |
208
- | `visibleToasts` | `number` | `4` | Max visible toasts; overflow queues in FIFO order |
209
- | `expand` | `boolean` | `false` | Stacked depth mode by default (fans open on hover/focus) |
210
- | `showProgress` | `boolean` | `false` | Synchronized countdown progress bar |
211
- | `progressPosition` | `"bottom" \| "top"` | `"bottom"` | Progress bar edge placement |
212
- | `progressHeight` | `number` | `3` | Progress bar height in px |
213
- | `closeButton` | `boolean` | `true` | Render accessible dismiss button |
214
- | `closeButtonPosition` | `"top-right" \| "top-left" \| "floating"` | `"floating"` | Close button placement |
215
- | `showCloseOnHover` | `boolean` | `true` | Reveal close button on hover or keyboard focus |
216
- | `pauseOnHover` | `boolean` | `true` | Pause auto-dismiss timer while hovered |
217
- | `pauseOnFocus` | `boolean` | `true` | Pause auto-dismiss timer while focused |
218
- | `swipeToDismiss` | `boolean` | `true` | Enable pointer/touch swipe dismissal |
219
- | `swipeDirections` | `Array<"left" \| "right" \| "up" \| "down">` | Position-based | Override allowed swipe directions |
220
- | `preventDuplicates` | `boolean` | `false` | Deduplicate matching active toasts globally |
221
- | `hotkey` | `string[]` | `["altKey", "KeyT"]` | Global keyboard shortcut to focus notifications |
222
- | `sound` | `boolean` | `true` | Subtle synthesized Web Audio chime |
223
- | `haptic` | `boolean` | `true` | Mobile `navigator.vibrate` haptic pulse |
224
- | `onToastShow` | `(toast: ToastRecord) => void` | — | Callback fired when a toast becomes visible |
225
- | `themeTokens` | `VetraThemeTokens` | — | Inline CSS custom property overrides |
226
- | `icons` | `ToastIcons` | — | Global custom icons (`success`, `error`, `warning`, `info`, `loading`, `close`) |
227
- | `classNames` | `ToastClassNames` | — | Granular slot class names (`toast`, `title`, `description`, `icon`, `actionButton`, `closeButton`, `progress`, etc.) |
228
- | `toastOptions` | `ToastDefaultOptions` | — | Global & per-variant default options |
229
- | `gap` / `offset` | `number` / `number \| string` | `12` / `20` | Stack gap and viewport offset |
230
- | `portalContainer` | `HTMLElement \| null` | `document.body` | Custom React Portal mount target |
161
+ | `size` | `"compact" \| "default" \| "comfortable"` | `"default"` | Card density |
162
+ | `animation` | `"slide" \| "fade" \| "zoom" \| "bounce" \| "none"` | `"bounce"` | Enter/exit motion preset |
163
+ | `iconAnimation` | `"default" \| "subtle" \| "none" \| false` | `"default"` | Variant icon choreography |
164
+ | `duration` | `number` | `4000` | Auto-dismiss delay in ms (`0` or `Infinity` disables) |
165
+ | `visibleToasts` | `number` | `4` | Max simultaneous visible toasts before queuing |
166
+ | `expand` | `boolean` | `false` | Always expand stack instead of compact depth mode |
167
+ | `showProgress` | `boolean` | `false` | Show synced countdown progress bar |
168
+ | `closeButtonPosition` | `"floating" \| "top-right" \| "top-left"` | `"floating"` | Close button placement |
169
+ | `preventDuplicates` | `boolean` | `false` | Dedupe identical toasts and show `×N` badge |
170
+ | `richColors` | `boolean` | `false` | Subtle semantic color tint on glass surface |
171
+ | `sound` / `haptic` | `boolean` | `true` | Web Audio chime & mobile vibration feedback |
231
172
 
232
173
  ---
233
174
 
234
175
  ## Customization
235
176
 
236
- ### Inline Theme Tokens & Per-Variant Defaults
177
+ Customize CSS tokens, slot class names, icons, and per-variant defaults without fighting specificity:
237
178
 
238
179
  ```tsx
239
180
  <Toaster
240
- theme="dark"
181
+ theme="system"
241
182
  glass="crystal"
242
- radius="lg"
243
- animation="spring"
183
+ richColors
244
184
  showProgress
245
- progressPosition="top"
246
- themeTokens={{
247
- blur: 28,
248
- width: 400,
249
- success: "#10b981",
250
- error: "#f43f5e",
251
- }}
185
+ themeTokens={{ blur: 26, radius: 16, width: 400, success: "#10b981" }}
186
+ classNames={{ toast: "my-toast", title: "my-title", actionButton: "my-btn" }}
252
187
  toastOptions={{
253
188
  success: { duration: 2500 },
254
- error: { duration: 6000 },
255
- }}
256
- />
257
- ```
258
-
259
- ### CSS Custom Properties
260
-
261
- Override any `--vt-*` variable directly in CSS:
262
-
263
- ```css
264
- :root {
265
- --vt-blur: 24px;
266
- --vt-saturate: 195%;
267
- --vt-radius: 18px;
268
- --vt-width: 390px;
269
- --vt-success: #34d399;
270
- --vt-error: #fb7185;
271
- --vt-warning: #fbbf24;
272
- --vt-info: #38bdf8;
273
- --vt-loading: #a78bfa;
274
- }
275
- ```
276
-
277
- ### Granular Slot Styling (`classNames`)
278
-
279
- Style any internal element with Tailwind CSS or CSS Modules:
280
-
281
- ```tsx
282
- <Toaster
283
- classNames={{
284
- toast: "shadow-2xl",
285
- title: "tracking-tight",
286
- description: "text-xs opacity-80",
287
- actionButton: "rounded-full",
288
- closeButton: "hover:scale-110",
189
+ error: { duration: 6000, glass: "solid" },
289
190
  }}
290
191
  />
291
192
  ```
292
193
 
293
194
  ---
294
195
 
295
- ## Framework-Agnostic Core (`vetra-toast/core`)
296
-
297
- Import the notification store and timer engine without pulling React into non-UI modules:
298
-
299
- ```ts
300
- import { createToastStore, createToastApi, defaultToastStore } from "vetra-toast/core";
301
-
302
- const store = createToastStore({ visibleToasts: 3, defaultDuration: 3500 });
303
- const api = createToastApi(store);
304
- api.success("Triggered outside React");
305
- ```
306
-
307
- ---
308
-
309
196
  ## Accessibility
310
197
 
311
- - **Semantic Live Regions**: `error` and `warning` use `role="alert"` (`aria-live="assertive"`); `success`, `info`, and `loading` use `role="status"` (`aria-live="polite"`).
312
- - **Keyboard Control**: Press `Alt+T` to focus active notifications, `Tab` through actions/close buttons with high-visibility focus rings, or press `Escape` to dismiss.
313
- - **Tab Visibility Awareness**: Timers pause automatically when the browser tab goes hidden (`document.visibilitychange`) and resume when returning.
314
- - **OS Preferences**: Automatic `@media (prefers-reduced-transparency: reduce)` solid surface fallback and `@media (prefers-reduced-motion: reduce)` gentle fade transitions.
198
+ - Uses `role="alert"` (`aria-live="assertive"`) for `error` / `warning` and `role="status"` (`aria-live="polite"`) for other variants.
199
+ - Press `Alt + T` (configurable via `hotkey`) to focus the active toast; press `Escape` to dismiss.
200
+ - Respects `prefers-reduced-motion` and `prefers-reduced-transparency` automatically.
315
201
 
316
202
  ---
317
203
 
318
- ## Author & License
319
-
320
- Created by **[Mobarok](https://www.mobarok.me)** ([GitHub @immobarok](https://github.com/immobarok)).
204
+ ## Links & License
321
205
 
322
- Licensed under the [MIT License](https://github.com/immobarok/vetra-toast/blob/main/LICENSE).
206
+ - **Live Playground**: https://vetra-toast.vercel.app/
207
+ - **Full Documentation & Source**: https://github.com/immobarok/vetra-toast
208
+ - **License**: [MIT](https://github.com/immobarok/vetra-toast/blob/main/LICENSE) © [Mobarok](https://www.mobarok.me)
@@ -32,4 +32,5 @@ export interface ToastItemProps {
32
32
  store: ToastStore;
33
33
  cfg: ToastItemDefaults;
34
34
  }
35
+ export declare const boolAttr: (v: boolean) => "true" | "false";
35
36
  export declare const ToastItem: import("react").MemoExoticComponent<({ toast, index, total, position, expanded, store, cfg, }: ToastItemProps) => ReactNode>;
@@ -5,4 +5,4 @@ export interface InternalToasterProps extends ToasterProps {
5
5
  /** Optional isolated store instance (defaults to global defaultToastStore). */
6
6
  store?: ToastStore;
7
7
  }
8
- export declare function Toaster({ position, theme, duration, visibleToasts, gap, offset, expand, glass, radius, size, ambientGlow, themeTokens, animation, iconAnimation, progressPosition, progressHeight, pauseOnHover, pauseOnFocus, swipeToDismiss, swipeDirections, showProgress, closeButton, closeButtonPosition, showCloseOnHover, preventDuplicates, richColors, icons, classNames, hotkey, sound, haptic, onToastShow, toastOptions, dir, className, toastClassName, style, containerAriaLabel, portalContainer, exitDuration, store, }: InternalToasterProps): ReactNode;
8
+ export declare function Toaster(rawProps: InternalToasterProps): ReactNode;
@@ -2,14 +2,7 @@ export interface Clock {
2
2
  now: () => number;
3
3
  }
4
4
  export declare class PauseableTimer {
5
- private readonly onComplete;
6
- private readonly clock;
7
- private timerId;
8
- private duration;
9
- private remaining;
10
- private startedAt;
11
- private paused;
12
- private completed;
5
+ #private;
13
6
  constructor(duration: number, onComplete: () => void, clock?: Clock);
14
7
  start(): void;
15
8
  pause(): number;
@@ -20,5 +13,4 @@ export declare class PauseableTimer {
20
13
  isPaused(): boolean;
21
14
  isRunning(): boolean;
22
15
  clear(): void;
23
- private clearHandle;
24
16
  }
@@ -0,0 +1 @@
1
+ function e(e){return e===`top-center`?[`up`]:e===`bottom-center`?[`down`]:e.endsWith(`left`)?[`left`]:[`right`]}var t=0;function n(e=`vt`){t+=1;let n=globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${e}-${t}-${n}`}function r(...e){return e.filter(Boolean).join(` `)}function i(e){return Number.isFinite(e)&&e>0}function a(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function o(...e){let t;for(let n of e)if(n){if(!t)t={...n};else for(let e of Object.keys(n)){let i=n[e];i&&(t[e]=r(t[e],i))}}return t}function s(e){return e===!1||e===`none`?`none`:e===`subtle`?`subtle`:`default`}var c=new Set([`width`,`radius`,`blur`]);function l(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){let e=n===`zIndex`?`z-index-root`:n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);t[`--vt-${e}`]=c.has(n)&&typeof r==`number`?`${r}px`:r}return t}var u={now:()=>Date.now()},d=class{#e;#t;#n=null;#r;#i;#a=null;#o=!1;#s=!1;constructor(e,t,n=u){this.#r=e,this.#i=e,this.#e=t,this.#t=n}start(){this.#s||!Number.isFinite(this.#i)||this.#i<=0||(this.#c(),this.#o=!1,this.#a=this.#t.now(),this.#n=setTimeout(()=>{this.#n=null,this.#a=null,this.#i=0,this.#s=!0,this.#e()},this.#i))}pause(){return this.#o||this.#s||(this.#c(),this.#a!==null&&(this.#i=Math.max(0,this.#i-Math.max(0,this.#t.now()-this.#a)),this.#a=null),this.#o=!0),this.#i}resume(){!this.#o||this.#s||(this.#i<=0?(this.#s=!0,this.#o=!1,this.#e()):this.start())}reset(e,t=!0){this.#c(),this.#r=e,this.#i=e,this.#a=null,this.#o=!1,this.#s=!1,t&&Number.isFinite(e)&&e>0&&this.start()}getRemaining(){return this.#s?0:!this.#o&&this.#a!==null?Math.max(0,this.#i-Math.max(0,this.#t.now()-this.#a)):this.#i}getDuration(){return this.#r}isPaused(){return this.#o}isRunning(){return this.#n!==null}clear(){this.#c(),this.#a=null,this.#s=!0}#c(){this.#n!==null&&(clearTimeout(this.#n),this.#n=null)}},f={defaultDuration:4e3,visibleToasts:4,exitDuration:240,preventDuplicates:!1},p=new Set([`default`,`success`,`error`,`warning`,`info`,`loading`,`custom`]),m=Object.freeze({toasts:Object.freeze([]),queue:Object.freeze([])});function h(e,t){return t??(e===`error`||e===`warning`?`alert`:`status`)}function g(e,t,n){let r=t===void 0?e===`loading`?0:n:t;return r<=0?1/0:r}function _(e,t,n,r){if(r)return r;let i=e=>typeof e==`string`||typeof e==`number`?String(e):``,a=i(t),o=i(n);return a||o?`${e}::${a}::${o}`:void 0}function v(e,t){return{...e,...t,className:r(e.className,t.className)||void 0,classNames:o(e.classNames,t.classNames),style:e.style||t.style?{...e.style,...t.style}:void 0}}function y(e,t){if(!e)return{};let n={};for(let[t,r]of Object.entries(e))p.has(t)||(n[t]=r);let r=n,i=e[t];return i?v(r,i):r}function b(e,t,n){let r=[...e];return r[t]=n,r}function x(e,t){return e.findIndex(e=>e.id===t)}function S(e,t){return e.filter(e=>e.id!==t)}var C=class{#e=[];#t=[];#n=m;#r;#i=new Set;#a=new Map;#o=new Map;#s;constructor(e,t={now:()=>Date.now()}){this.#r={...f,...e},this.#s=t}configure(e){let t=this.#r.visibleToasts;this.#r={...this.#r,...e},this.#r.visibleToasts>t&&this.#t.length>0&&this.#m()&&this.#_()}getConfig(){return this.#r}subscribe=e=>(this.#i.add(e),()=>{this.#i.delete(e)});getSnapshot=()=>this.#n;getServerSnapshot=()=>m;add(e){let t=this.#s.now(),r=e.variant??(e.customRender?`custom`:`default`),a=v(y(this.#r.toastOptions,r),{...e,variant:r});if(a.id&&this.#g(a.id))return this.update(a.id,a),a.id;let o=a.dedupe??(a.dedupeKey!==void 0||this.#r.preventDuplicates),s=_(r,a.title,a.description,a.dedupeKey);if(o&&s){let e=this.#e.find(e=>e.dedupeKey===s&&e.status!==`exiting`)??this.#t.find(e=>e.dedupeKey===s);if(e)return this.#l(e.id,t,a),e.id}let c=a.id??n(),l=g(r,a.duration,this.#r.defaultDuration),u=i(l),d={...a,id:c,variant:r,duration:l,remainingTime:l,startedAt:null,paused:!1,pauseReasons:new Set,status:`visible`,createdAt:t,updatedAt:t,dismissible:a.dismissible??!0,showProgress:a.showProgress??(u&&r!==`loading`),pauseOnHover:a.pauseOnHover??!0,pauseOnFocus:a.pauseOnFocus??!0,swipeToDismiss:a.swipeToDismiss??!0,role:h(r,a.role),dedupeKey:s,count:1};return this.#h()<Math.max(1,this.#r.visibleToasts)?(this.#e=[...this.#e,u?{...d,startedAt:t}:d],u&&this.#u(c,l)):this.#t=[...this.#t,d],this.#_(),c}update(e,t){let n=this.#s.now(),r=x(this.#e,e);if(r!==-1){let a=this.#e[r];if(!a||a.status===`exiting`)return!1;let o=this.#c(a,t,n,!0);return this.#e=b(this.#e,r,o),(a.duration!==o.duration||t.duration!==void 0||a.variant===`loading`&&o.variant!==`loading`)&&(this.#d(e),i(o.duration)&&this.#u(e,o.duration,!o.paused)),this.#_(),!0}let a=x(this.#t,e),o=this.#t[a];return o?(this.#t=b(this.#t,a,this.#c(o,t,n,!1)),this.#_(),!0):!1}dismiss(e,t=`user`){let n=x(this.#t,e);if(n!==-1){let t=this.#t[n];return this.#t=S(this.#t,e),this.#_(),t?.onDismiss?.(t),!0}let r=x(this.#e,e),i=this.#e[r];if(!i||i.status===`exiting`)return!1;this.#d(e);let a={...i,status:`exiting`,updatedAt:this.#s.now()};return this.#r.exitDuration<=0?(this.#e=S(this.#e,e),this.#m()):(this.#e=b(this.#e,r,a),this.#f(e)),this.#_(),t===`auto`&&a.onAutoClose?.(a),a.onDismiss?.(a),!0}dismissAll(){let e=[...this.#t];this.#t=[];for(let t of e)t.onDismiss?.(t);let t=this.#e.filter(e=>e.status!==`exiting`);if(t.length!==0||e.length!==0){for(let e of t)this.#d(e.id);if(this.#r.exitDuration<=0)this.#e=[];else{let e=this.#s.now();this.#e=this.#e.map(t=>t.status===`exiting`?t:(this.#f(t.id),{...t,status:`exiting`,updatedAt:e}))}this.#_();for(let e of t)e.onDismiss?.(e)}}pause(e,t=`manual`){let n=x(this.#e,e),r=this.#e[n];if(!r||r.status===`exiting`||t===`hover`&&!r.pauseOnHover||t===`focus`&&!r.pauseOnFocus||r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons).add(t),a=this.#a.get(e);this.#e=b(this.#e,n,{...r,paused:!0,pauseReasons:i,remainingTime:a?a.pause():r.remainingTime,startedAt:null}),this.#_()}resume(e,t=`manual`){let n=x(this.#e,e),r=this.#e[n];if(!r||r.status===`exiting`||!r.pauseReasons.has(t))return;let a=new Set(r.pauseReasons);a.delete(t);let o=a.size>0;this.#e=b(this.#e,n,{...r,paused:o,pauseReasons:a,startedAt:!o&&i(r.duration)?this.#s.now():null}),this.#_(),o||this.#a.get(e)?.resume()}pauseAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.pause(t.id,e)}resumeAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.resume(t.id,e)}getRemainingTime(e){return this.#a.get(e)?.getRemaining()??this.#g(e)?.remainingTime??0}removeImmediately(e){this.#d(e),this.#p(e);let t=this.#e.length,n=this.#t.length;this.#e=S(this.#e,e),this.#t=S(this.#t,e),this.#e.length!==t&&this.#m(),(this.#e.length!==t||this.#t.length!==n)&&this.#_()}clear(){for(let e of this.#a.values())e.clear();this.#a.clear();for(let e of this.#o.values())clearTimeout(e);this.#o.clear(),(this.#e.length>0||this.#t.length>0)&&(this.#e=[],this.#t=[],this.#_())}destroy(){this.clear(),this.#i.clear()}#c(e,t,n,r){let s=t.variant??e.variant,c=e.variant===`loading`,l=c&&s!==`loading`,u=t.duration===void 0?l?g(s,y(this.#r.toastOptions,s).duration,this.#r.defaultDuration):s===`loading`&&!c?1/0:e.duration:g(s,t.duration,this.#r.defaultDuration),d=i(u),f=u!==e.duration;return{...e,...a(t),variant:s,duration:u,remainingTime:f?u:e.remainingTime,startedAt:r&&f&&d&&!e.paused?n:e.startedAt,updatedAt:n,showProgress:t.showProgress??(f?d&&s!==`loading`:e.showProgress),classNames:t.classNames===void 0?e.classNames:o(e.classNames,t.classNames),role:h(s,t.role??(t.variant?void 0:e.role)),dedupeKey:t.dedupeKey??(t.title!==void 0||t.description!==void 0||t.variant!==void 0?_(s,t.title===void 0?e.title:t.title,t.description===void 0?e.description:t.description,e.dedupeKey):e.dedupeKey)}}#l(e,t,n){let r=x(this.#e,e);if(r!==-1){let a=this.#e[r];if(!a)return;let o=n.duration===void 0?a.duration:g(a.variant,n.duration,this.#r.defaultDuration),s=i(o);this.#e=b(this.#e,r,{...a,count:a.count+1,duration:o,remainingTime:o,startedAt:s&&!a.paused?t:null,updatedAt:t}),s&&this.#u(e,o,!a.paused),this.#_();return}let a=x(this.#t,e),o=this.#t[a];o&&(this.#t=b(this.#t,a,{...o,count:o.count+1,updatedAt:t}),this.#_())}#u(e,t,n=!0){this.#d(e);let r=new d(t,()=>{this.#a.delete(e),this.dismiss(e,`auto`)},this.#s);this.#a.set(e,r),n&&r.start()}#d(e){let t=this.#a.get(e);t&&(t.clear(),this.#a.delete(e))}#f(e){this.#p(e),this.#o.set(e,setTimeout(()=>{this.#o.delete(e),this.#e=S(this.#e,e),this.#m(),this.#_()},this.#r.exitDuration))}#p(e){let t=this.#o.get(e);t!==void 0&&(clearTimeout(t),this.#o.delete(e))}#m(){let e=Math.max(1,this.#r.visibleToasts),t=!1;for(;this.#h()<e&&this.#t.length>0;){let e=this.#t[0];if(!e)break;this.#t=this.#t.slice(1);let n=this.#s.now(),r=i(e.duration);this.#e=[...this.#e,{...e,status:`visible`,startedAt:r?n:null,remainingTime:e.duration,updatedAt:n}],r&&this.#u(e.id,e.duration),t=!0}return t}#h(){return this.#e.filter(e=>e.status!==`exiting`).length}#g(e){return this.#e.find(t=>t.id===e&&t.status!==`exiting`)??this.#t.find(t=>t.id===e)}#_(){this.#n=Object.freeze({toasts:Object.freeze([...this.#e]),queue:Object.freeze([...this.#t])});for(let e of this.#i)e()}};function w(e,t){return new C(e,t)}var T=w();function E(e){return typeof e==`object`&&!!e&&`title`in e&&!(`$$typeof`in e)}function D(e){return E(e)?{...e}:{title:e,description:void 0}}function O(e=T){let t=((t,n)=>e.add({...n,title:t}));for(let n of[`success`,`error`,`warning`,`info`,`loading`])t[n]=(t,r)=>e.add({...r,title:t,variant:n});return t.custom=(t,n)=>e.add({...n,variant:`custom`,customRender:t}),t.update=(t,n)=>e.update(t,n),t.dismiss=t=>e.dismiss(t,`user`),t.dismissAll=()=>e.dismissAll(),t.promise=(t,n,r)=>{let i=e.add({...r,...D(n.loading),variant:`loading`,duration:1/0,showProgress:!1}),a;try{a=typeof t==`function`?t():t}catch(e){a=Promise.reject(e)}let o=(t,n)=>{let a=D(n);e.update(i,{...a,variant:t,duration:a.duration??r?.duration,showProgress:a.showProgress??r?.showProgress})};return a.then(e=>o(`success`,typeof n.success==`function`?n.success(e):n.success),e=>o(`error`,typeof n.error==`function`?n.error(e):n.error)).finally(()=>{n.finally?.()}),{id:i,unwrap:()=>a}},t}var k=O(T);Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return .45}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return .35}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return o}});
@@ -0,0 +1 @@
1
+ var e=.45,t=.35;function n(e){return e===`top-center`?[`up`]:e===`bottom-center`?[`down`]:e.endsWith(`left`)?[`left`]:[`right`]}var r=0;function i(e=`vt`){r+=1;let t=globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${e}-${r}-${t}`}function a(...e){return e.filter(Boolean).join(` `)}function o(e){return Number.isFinite(e)&&e>0}function s(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function c(...e){let t;for(let n of e)if(n){if(!t)t={...n};else for(let e of Object.keys(n)){let r=n[e];r&&(t[e]=a(t[e],r))}}return t}function l(e){return e===!1||e===`none`?`none`:e===`subtle`?`subtle`:`default`}var u=/* @__PURE__ */ new Set([`width`,`radius`,`blur`]);function d(e){if(!e)return{};let t={};for(let[n,r]of Object.entries(e))if(r!==void 0){let e=n===`zIndex`?`z-index-root`:n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);t[`--vt-${e}`]=u.has(n)&&typeof r==`number`?`${r}px`:r}return t}var f={now:()=>Date.now()},p=class{#e;#t;#n=null;#r;#i;#a=null;#o=!1;#s=!1;constructor(e,t,n=f){this.#r=e,this.#i=e,this.#e=t,this.#t=n}start(){this.#s||!Number.isFinite(this.#i)||this.#i<=0||(this.#c(),this.#o=!1,this.#a=this.#t.now(),this.#n=setTimeout(()=>{this.#n=null,this.#a=null,this.#i=0,this.#s=!0,this.#e()},this.#i))}pause(){return this.#o||this.#s||(this.#c(),this.#a!==null&&(this.#i=Math.max(0,this.#i-Math.max(0,this.#t.now()-this.#a)),this.#a=null),this.#o=!0),this.#i}resume(){!this.#o||this.#s||(this.#i<=0?(this.#s=!0,this.#o=!1,this.#e()):this.start())}reset(e,t=!0){this.#c(),this.#r=e,this.#i=e,this.#a=null,this.#o=!1,this.#s=!1,t&&Number.isFinite(e)&&e>0&&this.start()}getRemaining(){return this.#s?0:!this.#o&&this.#a!==null?Math.max(0,this.#i-Math.max(0,this.#t.now()-this.#a)):this.#i}getDuration(){return this.#r}isPaused(){return this.#o}isRunning(){return this.#n!==null}clear(){this.#c(),this.#a=null,this.#s=!0}#c(){this.#n!==null&&(clearTimeout(this.#n),this.#n=null)}},m={defaultDuration:4e3,visibleToasts:4,exitDuration:240,preventDuplicates:!1},h=/* @__PURE__ */ new Set([`default`,`success`,`error`,`warning`,`info`,`loading`,`custom`]),g=Object.freeze({toasts:Object.freeze([]),queue:Object.freeze([])});function _(e,t){return t??(e===`error`||e===`warning`?`alert`:`status`)}function v(e,t,n){let r=t===void 0?e===`loading`?0:n:t;return r<=0?1/0:r}function y(e,t,n,r){if(r)return r;let i=e=>typeof e==`string`||typeof e==`number`?String(e):``,a=i(t),o=i(n);return a||o?`${e}::${a}::${o}`:void 0}function b(e,t){return{...e,...t,className:a(e.className,t.className)||void 0,classNames:c(e.classNames,t.classNames),style:e.style||t.style?{...e.style,...t.style}:void 0}}function x(e,t){if(!e)return{};let n={};for(let[t,r]of Object.entries(e))h.has(t)||(n[t]=r);let r=n,i=e[t];return i?b(r,i):r}function S(e,t,n){let r=[...e];return r[t]=n,r}function C(e,t){return e.findIndex(e=>e.id===t)}function w(e,t){return e.filter(e=>e.id!==t)}var T=class{#e=[];#t=[];#n=g;#r;#i=/* @__PURE__ */ new Set;#a=/* @__PURE__ */ new Map;#o=/* @__PURE__ */ new Map;#s;constructor(e,t={now:()=>Date.now()}){this.#r={...m,...e},this.#s=t}configure(e){let t=this.#r.visibleToasts;this.#r={...this.#r,...e},this.#r.visibleToasts>t&&this.#t.length>0&&this.#m()&&this.#_()}getConfig(){return this.#r}subscribe=e=>(this.#i.add(e),()=>{this.#i.delete(e)});getSnapshot=()=>this.#n;getServerSnapshot=()=>g;add(e){let t=this.#s.now(),n=e.variant??(e.customRender?`custom`:`default`),r=b(x(this.#r.toastOptions,n),{...e,variant:n});if(r.id&&this.#g(r.id))return this.update(r.id,r),r.id;let a=r.dedupe??(r.dedupeKey!==void 0||this.#r.preventDuplicates),s=y(n,r.title,r.description,r.dedupeKey);if(a&&s){let e=this.#e.find(e=>e.dedupeKey===s&&e.status!==`exiting`)??this.#t.find(e=>e.dedupeKey===s);if(e)return this.#l(e.id,t,r),e.id}let c=r.id??i(),l=v(n,r.duration,this.#r.defaultDuration),u=o(l),d={...r,id:c,variant:n,duration:l,remainingTime:l,startedAt:null,paused:!1,pauseReasons:/* @__PURE__ */ new Set,status:`visible`,createdAt:t,updatedAt:t,dismissible:r.dismissible??!0,showProgress:r.showProgress??(u&&n!==`loading`),pauseOnHover:r.pauseOnHover??!0,pauseOnFocus:r.pauseOnFocus??!0,swipeToDismiss:r.swipeToDismiss??!0,role:_(n,r.role),dedupeKey:s,count:1};return this.#h()<Math.max(1,this.#r.visibleToasts)?(this.#e=[...this.#e,u?{...d,startedAt:t}:d],u&&this.#u(c,l)):this.#t=[...this.#t,d],this.#_(),c}update(e,t){let n=this.#s.now(),r=C(this.#e,e);if(r!==-1){let i=this.#e[r];if(!i||i.status===`exiting`)return!1;let a=this.#c(i,t,n,!0);return this.#e=S(this.#e,r,a),(i.duration!==a.duration||t.duration!==void 0||i.variant===`loading`&&a.variant!==`loading`)&&(this.#d(e),o(a.duration)&&this.#u(e,a.duration,!a.paused)),this.#_(),!0}let i=C(this.#t,e),a=this.#t[i];return a?(this.#t=S(this.#t,i,this.#c(a,t,n,!1)),this.#_(),!0):!1}dismiss(e,t=`user`){let n=C(this.#t,e);if(n!==-1){let t=this.#t[n];return this.#t=w(this.#t,e),this.#_(),t?.onDismiss?.(t),!0}let r=C(this.#e,e),i=this.#e[r];if(!i||i.status===`exiting`)return!1;this.#d(e);let a={...i,status:`exiting`,updatedAt:this.#s.now()};return this.#r.exitDuration<=0?(this.#e=w(this.#e,e),this.#m()):(this.#e=S(this.#e,r,a),this.#f(e)),this.#_(),t===`auto`&&a.onAutoClose?.(a),a.onDismiss?.(a),!0}dismissAll(){let e=[...this.#t];this.#t=[];for(let t of e)t.onDismiss?.(t);let t=this.#e.filter(e=>e.status!==`exiting`);if(t.length!==0||e.length!==0){for(let e of t)this.#d(e.id);if(this.#r.exitDuration<=0)this.#e=[];else{let e=this.#s.now();this.#e=this.#e.map(t=>t.status===`exiting`?t:(this.#f(t.id),{...t,status:`exiting`,updatedAt:e}))}this.#_();for(let e of t)e.onDismiss?.(e)}}pause(e,t=`manual`){let n=C(this.#e,e),r=this.#e[n];if(!r||r.status===`exiting`||t===`hover`&&!r.pauseOnHover||t===`focus`&&!r.pauseOnFocus||r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons).add(t),a=this.#a.get(e);this.#e=S(this.#e,n,{...r,paused:!0,pauseReasons:i,remainingTime:a?a.pause():r.remainingTime,startedAt:null}),this.#_()}resume(e,t=`manual`){let n=C(this.#e,e),r=this.#e[n];if(!r||r.status===`exiting`||!r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons);i.delete(t);let a=i.size>0;this.#e=S(this.#e,n,{...r,paused:a,pauseReasons:i,startedAt:!a&&o(r.duration)?this.#s.now():null}),this.#_(),a||this.#a.get(e)?.resume()}pauseAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.pause(t.id,e)}resumeAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.resume(t.id,e)}getRemainingTime(e){return this.#a.get(e)?.getRemaining()??this.#g(e)?.remainingTime??0}removeImmediately(e){this.#d(e),this.#p(e);let t=this.#e.length,n=this.#t.length;this.#e=w(this.#e,e),this.#t=w(this.#t,e),this.#e.length!==t&&this.#m(),(this.#e.length!==t||this.#t.length!==n)&&this.#_()}clear(){for(let e of this.#a.values())e.clear();this.#a.clear();for(let e of this.#o.values())clearTimeout(e);this.#o.clear(),(this.#e.length>0||this.#t.length>0)&&(this.#e=[],this.#t=[],this.#_())}destroy(){this.clear(),this.#i.clear()}#c(e,t,n,r){let i=t.variant??e.variant,a=e.variant===`loading`,l=a&&i!==`loading`,u=t.duration===void 0?l?v(i,x(this.#r.toastOptions,i).duration,this.#r.defaultDuration):i===`loading`&&!a?1/0:e.duration:v(i,t.duration,this.#r.defaultDuration),d=o(u),f=u!==e.duration;return{...e,...s(t),variant:i,duration:u,remainingTime:f?u:e.remainingTime,startedAt:r&&f&&d&&!e.paused?n:e.startedAt,updatedAt:n,showProgress:t.showProgress??(f?d&&i!==`loading`:e.showProgress),classNames:t.classNames===void 0?e.classNames:c(e.classNames,t.classNames),role:_(i,t.role??(t.variant?void 0:e.role)),dedupeKey:t.dedupeKey??(t.title!==void 0||t.description!==void 0||t.variant!==void 0?y(i,t.title===void 0?e.title:t.title,t.description===void 0?e.description:t.description,e.dedupeKey):e.dedupeKey)}}#l(e,t,n){let r=C(this.#e,e);if(r!==-1){let i=this.#e[r];if(!i)return;let a=n.duration===void 0?i.duration:v(i.variant,n.duration,this.#r.defaultDuration),s=o(a);this.#e=S(this.#e,r,{...i,count:i.count+1,duration:a,remainingTime:a,startedAt:s&&!i.paused?t:null,updatedAt:t}),s&&this.#u(e,a,!i.paused),this.#_();return}let i=C(this.#t,e),a=this.#t[i];a&&(this.#t=S(this.#t,i,{...a,count:a.count+1,updatedAt:t}),this.#_())}#u(e,t,n=!0){this.#d(e);let r=new p(t,()=>{this.#a.delete(e),this.dismiss(e,`auto`)},this.#s);this.#a.set(e,r),n&&r.start()}#d(e){let t=this.#a.get(e);t&&(t.clear(),this.#a.delete(e))}#f(e){this.#p(e),this.#o.set(e,setTimeout(()=>{this.#o.delete(e),this.#e=w(this.#e,e),this.#m(),this.#_()},this.#r.exitDuration))}#p(e){let t=this.#o.get(e);t!==void 0&&(clearTimeout(t),this.#o.delete(e))}#m(){let e=Math.max(1,this.#r.visibleToasts),t=!1;for(;this.#h()<e&&this.#t.length>0;){let e=this.#t[0];if(!e)break;this.#t=this.#t.slice(1);let n=this.#s.now(),r=o(e.duration);this.#e=[...this.#e,{...e,status:`visible`,startedAt:r?n:null,remainingTime:e.duration,updatedAt:n}],r&&this.#u(e.id,e.duration),t=!0}return t}#h(){return this.#e.filter(e=>e.status!==`exiting`).length}#g(e){return this.#e.find(t=>t.id===e&&t.status!==`exiting`)??this.#t.find(t=>t.id===e)}#_(){this.#n=Object.freeze({toasts:Object.freeze([...this.#e]),queue:Object.freeze([...this.#t])});for(let e of this.#i)e()}};function E(e,t){return new T(e,t)}var D=E();function O(e){return typeof e==`object`&&!!e&&`title`in e&&!(`$$typeof`in e)}function k(e){return O(e)?{...e}:{title:e,description:void 0}}function A(e=D){let t=((t,n)=>e.add({...n,title:t}));for(let n of[`success`,`error`,`warning`,`info`,`loading`])t[n]=(t,r)=>e.add({...r,title:t,variant:n});return t.custom=(t,n)=>e.add({...n,variant:`custom`,customRender:t}),t.update=(t,n)=>e.update(t,n),t.dismiss=t=>e.dismiss(t,`user`),t.dismissAll=()=>e.dismissAll(),t.promise=(t,n,r)=>{let i=e.add({...r,...k(n.loading),variant:`loading`,duration:1/0,showProgress:!1}),a;try{a=typeof t==`function`?t():t}catch(e){a=Promise.reject(e)}let o=(t,n)=>{let a=k(n);e.update(i,{...a,variant:t,duration:a.duration??r?.duration,showProgress:a.showProgress??r?.showProgress})};return a.then(e=>o(`success`,typeof n.success==`function`?n.success(e):n.success),e=>o(`error`,typeof n.error==`function`?n.error(e):n.error)).finally(()=>{n.finally?.()}),{id:i,unwrap:()=>a}},t}var j=A(D);export{E as a,a as c,s as d,l as f,n as g,e as h,T as i,o as l,t as m,j as n,D as o,d as p,g as r,p as s,A as t,c as u};
package/dist/core.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-DWP-MMiI.cjs");exports.EMPTY_SNAPSHOT=e.r,exports.PauseableTimer=e.s,exports.ToastStore=e.i,exports.createToastApi=e.t,exports.createToastStore=e.a,exports.defaultToastStore=e.o,exports.toast=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-B8oarzUq.cjs");exports.EMPTY_SNAPSHOT=e.r,exports.PauseableTimer=e.s,exports.ToastStore=e.i,exports.createToastApi=e.t,exports.createToastStore=e.a,exports.defaultToastStore=e.o,exports.toast=e.n;
package/dist/core.js CHANGED
@@ -1 +1 @@
1
- export{r as EMPTY_SNAPSHOT,s as PauseableTimer,i as ToastStore,t as createToastApi,a as createToastStore,o as defaultToastStore,n as toast}from"./core-BikVsncn.js";
1
+ export{r as EMPTY_SNAPSHOT,s as PauseableTimer,i as ToastStore,t as createToastApi,a as createToastStore,o as defaultToastStore,n as toast}from"./core-BWb4DGqi.js";
@@ -1,26 +1,15 @@
1
1
  import { type PointerEvent as ReactPointerEvent } from "react";
2
2
  import type { SwipeDirection, ToastPosition } from "../types/index.js";
3
- export interface UseSwipeOptions {
4
- enabled: boolean;
5
- position: ToastPosition;
6
- directions?: readonly SwipeDirection[];
7
- onSwipeStart?: () => void;
8
- onSwipeCancel?: () => void;
9
- onDismiss: () => void;
3
+ export type SwipeTuple = readonly [
4
+ isSwiping: boolean,
5
+ offsetX: number,
6
+ offsetY: number,
7
+ opacity: number
8
+ ];
9
+ export interface SwipeHandlers {
10
+ onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;
11
+ onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;
12
+ onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;
13
+ onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;
10
14
  }
11
- export interface SwipeState {
12
- isSwiping: boolean;
13
- offsetX: number;
14
- offsetY: number;
15
- opacity: number;
16
- }
17
- export interface UseSwipeResult {
18
- swipeState: SwipeState;
19
- handlers: {
20
- onPointerDown: (event: ReactPointerEvent<HTMLElement>) => void;
21
- onPointerMove: (event: ReactPointerEvent<HTMLElement>) => void;
22
- onPointerUp: (event: ReactPointerEvent<HTMLElement>) => void;
23
- onPointerCancel: (event: ReactPointerEvent<HTMLElement>) => void;
24
- };
25
- }
26
- export declare function useSwipe({ enabled, position, directions, onSwipeStart, onSwipeCancel, onDismiss, }: UseSwipeOptions): UseSwipeResult;
15
+ export declare function useSwipe(enabled: boolean, position: ToastPosition, directions: readonly SwipeDirection[] | undefined, onStart: () => void, onCancel: () => void, onDismiss: () => void): readonly [SwipeTuple, SwipeHandlers];
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-DWP-MMiI.cjs");let t=require("react"),n=require("react-dom"),r=require("react/jsx-runtime");var i=()=>()=>{},a=()=>!0,o=()=>!1;function s(){return(0,t.useSyncExternalStore)(i,a,o)}function c(){return typeof window<`u`&&typeof document<`u`}function l(){return!c()||typeof window.matchMedia!=`function`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function u(e){let[n,r]=(0,t.useState)(()=>e===`system`?l():e);return(0,t.useEffect)(()=>{if(e!==`system`||!c()||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=()=>{r(t.matches?`dark`:`light`)};return n(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),()=>{t.removeEventListener(`change`,n)}):(t.addListener(n),()=>{t.removeListener(n)})},[e]),e===`system`?n:e}function d(n=e.o){return(0,t.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getServerSnapshot)}var f={success:[523.25,659.25],error:[311.13,246.94],warning:[440,392],info:[587.33],loading:[493.88],default:[523.25],custom:[523.25]},p={success:18,error:[28,36,28],warning:[22,28],info:12,loading:10,default:12,custom:12},m=null;function h(){if(!c())return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{return m&&m.state!==`closed`||(m=new e),m}catch{return null}}function g(e){let t=h();if(t)try{t.state===`suspended`&&t.resume().catch(()=>{});let n=f[e]??f.default,r=t.currentTime;n.forEach((n,i)=>{let a=t.createOscillator(),o=t.createGain(),s=r+i*.085,c=s+.14;a.type=e===`error`?`triangle`:`sine`,a.frequency.setValueAtTime(n,s),o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(.045,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,c),a.connect(o),o.connect(t.destination),a.start(s),a.stop(c+.01)})}catch{}}function _(e){if(c()&&typeof navigator<`u`&&typeof navigator.vibrate==`function`)try{navigator.vibrate(p[e]??12)}catch{}}var v={isSwiping:!1,offsetX:0,offsetY:0,opacity:1};function y(e){return e instanceof Element&&e.closest(`button, a, input, textarea, select, [data-vt-no-swipe]`)!==null}function b({enabled:n,position:r,directions:i,onSwipeStart:a,onSwipeCancel:o,onDismiss:s}){let[c,l]=(0,t.useState)(v),u=(0,t.useRef)(null),d=i&&i.length>0?i:e.h(r),f=d.includes(`left`),p=d.includes(`right`),m=d.includes(`up`),h=d.includes(`down`),g=f||p,_=m||h,b=(0,t.useCallback)((t,n,r)=>{if(r===`x`){let n=t>0&&p||t<0&&f;return{offsetX:n?t:t*e.p,offsetY:0,primaryDelta:n?Math.abs(t):0}}let i=n<0&&m||n>0&&h;return{offsetX:0,offsetY:i?n:n*e.p,primaryDelta:i?Math.abs(n):0}},[h,f,p,m]),x=(0,t.useCallback)(e=>{u.current=null,l(v),e&&o?.()},[o]);return{swipeState:c,handlers:{onPointerDown:(0,t.useCallback)(e=>{if(n&&e.button===0&&!y(e.target)&&(u.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startTime:Date.now(),active:!1,lockedAxis:null},typeof e.currentTarget.setPointerCapture==`function`))try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}},[n]),onPointerMove:(0,t.useCallback)(e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,i=Math.abs(n),o=Math.abs(r);if(!t.lockedAxis){if(Math.max(i,o)<6)return;t.lockedAxis=g&&_?i>=o?`x`:`y`:g?`x`:`y`}let s=t.lockedAxis===`x`?i:o;if(!t.active&&s<6)return;t.active||(t.active=!0,a?.());let{offsetX:c,offsetY:d,primaryDelta:f}=b(n,r,t.lockedAxis),p=Math.min(1,Math.max(0,f/126));l({isSwiping:!0,offsetX:c,offsetY:d,opacity:Math.max(.25,1-p*.7)})},[b,a,g,_]),onPointerUp:(0,t.useCallback)(e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;if(typeof e.currentTarget.releasePointerCapture==`function`)try{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(!t.active||!t.lockedAxis){u.current=null;return}let n=e.clientX-t.startX,r=e.clientY-t.startY,i=Math.max(1,Date.now()-t.startTime),{primaryDelta:a}=b(n,r,t.lockedAxis),o=a/i;a>=84||o>=.45?(u.current=null,l(v),s()):x(!0)},[b,s,x]),onPointerCancel:(0,t.useCallback)(e=>{let t=u.current;t&&t.pointerId===e.pointerId&&x(t.active)},[x])}}}var x=`M8.4 3.4H15.6L20.6 8.4V15.6L15.6 20.6H8.4L3.4 15.6V8.4L8.4 3.4Z`,S=`M10.42 4.65C11.12 3.43 12.88 3.43 13.58 4.65L20.38 16.45C21.08 17.67 20.2 19.2 18.8 19.2H5.2C3.8 19.2 2.92 17.67 3.62 16.45L10.42 4.65Z`,C=[[4.2,4.8,1.05],[19.8,4.8,.95],[20.2,18.8,.9],[4.2,18.8,.85]],w={success:[4,4,20,20,`currentColor`,`#a7f3d0`,1,.95],error:[4,4,20,20,`#fda4af`,`currentColor`],warning:[12,3,12,21,`#fde68a`,`currentColor`],info:[4,4,20,20,`#bae6fd`,`currentColor`],loading:[2,2,22,22,`currentColor`,`currentColor`,1,.08]};function T({variant:n,icon:i,animationMode:a=`default`,className:o}){let s=(0,t.useId)();if(i===null)return null;if(i!==void 0)return(0,r.jsx)(`span`,{className:e.c(`vt-icon-badge vt-icon-badge-custom`,o),"data-vt-icon":``,"data-vt-icon-animation":a,"aria-hidden":`true`,children:(0,r.jsx)(`span`,{className:`vt-icon-inner`,children:i})});if(n==="default"||n===`custom`)return null;let c=`vt-grad-${s}`,l=`vt-glow-${s}`,u=`url(#${c})`,[d,f,p,m,h,g,_=1,v=1]=w[n];return(0,r.jsxs)(`span`,{className:e.c(`vt-icon-badge`,o),"data-vt-icon":``,"data-vt-variant":n,"data-vt-icon-animation":a,"aria-hidden":`true`,children:[(0,r.jsx)(`span`,{className:`vt-icon-pulse`,"aria-hidden":`true`}),(0,r.jsx)(`span`,{className:`vt-icon-inner`,children:(0,r.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`vt-svg vt-svg-${n}`,focusable:`false`,"aria-hidden":`true`,children:[(0,r.jsxs)(`defs`,{children:[(0,r.jsxs)(`linearGradient`,{id:c,x1:d,y1:f,x2:p,y2:m,gradientUnits:`userSpaceOnUse`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:h,stopOpacity:_}),n===`loading`&&(0,r.jsx)(`stop`,{offset:`65%`,stopColor:`#c4b5fd`,stopOpacity:`0.85`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:g,stopOpacity:v})]}),n===`loading`&&(0,r.jsxs)(`linearGradient`,{id:l,x1:`20`,y1:`4`,x2:`4`,y2:`20`,gradientUnits:`userSpaceOnUse`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#fff`,stopOpacity:`0.85`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.1`})]})]}),n===`success`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.75`,fill:`currentColor`,className:`vt-success-fill`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:u,strokeWidth:`1.75`,strokeLinecap:`round`,pathLength:100,className:`vt-success-ring`}),(0,r.jsx)(`path`,{d:`M8.1 12.35L10.75 15L16.1 9.35`,stroke:u,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:100,className:`vt-success-check`}),C.map(([e,t,n],i)=>(0,r.jsx)(`circle`,{cx:e,cy:t,r:n,fill:`currentColor`,className:`vt-spark vt-spark-${i+1}`},i))]}),n===`error`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`path`,{d:x,fill:`currentColor`,className:`vt-error-fill`}),(0,r.jsx)(`path`,{d:x,stroke:u,strokeWidth:`1.75`,strokeLinejoin:`round`,pathLength:100,className:`vt-error-frame`}),(0,r.jsx)(`path`,{d:`M9.1 9.1L14.9 14.9`,stroke:u,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-error-line-1`}),(0,r.jsx)(`path`,{d:`M14.9 9.1L9.1 14.9`,stroke:u,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-error-line-2`})]}),n===`warning`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`path`,{d:S,fill:`currentColor`,className:`vt-warning-fill`}),(0,r.jsx)(`path`,{d:S,stroke:u,strokeWidth:`1.75`,strokeLinejoin:`round`,pathLength:100,className:`vt-warning-frame`}),(0,r.jsx)(`path`,{d:`M12 9.1V13.15`,stroke:u,strokeWidth:`2.1`,strokeLinecap:`round`,pathLength:100,className:`vt-warning-stem`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`16.1`,r:`1.2`,fill:u,className:`vt-warning-dot`})]}),n===`info`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.75`,fill:`currentColor`,className:`vt-info-fill`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:u,strokeWidth:`1.75`,pathLength:100,className:`vt-info-ring`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:`#fff`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeDasharray:`16 84`,pathLength:100,className:`vt-info-glint`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`8.25`,r:`1.25`,fill:u,className:`vt-info-dot`}),(0,r.jsx)(`path`,{d:`M12 11.2V16.1`,stroke:u,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-info-stem`})]}),n===`loading`&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:`0.18`,strokeWidth:`1.8`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:u,strokeWidth:`2.1`,strokeLinecap:`round`,pathLength:100,className:`vt-loader-outer`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`5.3`,stroke:`url(#${l})`,strokeWidth:`1.65`,strokeLinecap:`round`,strokeDasharray:`34 66`,pathLength:100,className:`vt-loader-inner`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2.1`,fill:`currentColor`,className:`vt-loader-core`})]})]})})]},n)}function E({duration:t,paused:n,variant:i,resetKey:a,position:o=`bottom`,height:s=3,trackClassName:c,barClassName:l}){if(!e.l(t))return null;let u={height:`${Math.max(1,s)}px`},d={animationDuration:`${t}ms`,animationPlayState:n?`paused`:`running`};return(0,r.jsx)(`div`,{className:e.c(`vt-progress-track`,c),style:u,"aria-hidden":`true`,"data-vt-progress":``,"data-vt-progress-position":o,children:(0,r.jsx)(`div`,{className:e.c(`vt-progress-bar`,l),"data-vt-variant":i,style:d},a)})}var ee=(0,t.memo)(function({toast:n,index:i,total:a,position:o,expanded:s,store:c,cfg:l}){let u=l.pauseOnHover&&n.pauseOnHover,d=l.pauseOnFocus&&n.pauseOnFocus,f=l.showProgress&&n.showProgress&&n.status!==`exiting`,p=(n.closeButton??l.closeButton)&&n.dismissible,m=n.closeButtonPosition??l.closeButtonPosition,h=e.u(l.classNames,n.classNames),g=n.icon===void 0?l.icons&&n.variant!=="default"&&n.variant!==`custom`?l.icons[n.variant]:void 0:n.icon,_=(0,t.useCallback)(()=>{c.dismiss(n.id,`user`)},[c,n.id]),{swipeState:v,handlers:y}=b({enabled:l.swipeToDismiss&&n.swipeToDismiss&&n.dismissible,position:o,directions:n.swipeDirections??l.swipeDirections,onSwipeStart:(0,t.useCallback)(()=>c.pause(n.id,`swipe`),[c,n.id]),onSwipeCancel:(0,t.useCallback)(()=>c.resume(n.id,`swipe`),[c,n.id]),onDismiss:_}),x=e=>{!d||e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||c.resume(n.id,`focus`)},S=e=>{e.key===`Escape`&&n.dismissible&&(e.stopPropagation(),_())},C={...n.style,"--vt-index":String(i),"--vt-z-index":String(Math.max(1,a-i)),"--vt-swipe-x":`${v.offsetX}px`,"--vt-swipe-y":`${v.offsetY}px`,"--vt-swipe-opacity":String(v.opacity)},w=p?(0,r.jsx)(`button`,{type:`button`,className:e.c(`vt-close`,m===`floating`&&`vt-close-floating`,m===`top-left`&&`vt-close-left`,(n.showCloseOnHover??l.showCloseOnHover)&&`vt-close-hover-only`,h?.closeButton),"aria-label":`Dismiss notification`,"data-vt-close":``,"data-vt-close-position":m,onClick:_,children:l.icons?.close===void 0?(0,r.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`vt-close-svg`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M4.5 4.5L11.5 11.5M11.5 4.5L4.5 11.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`})}):l.icons.close}):null;return(0,r.jsx)(`li`,{className:e.c(`vt-toast-slot`,s&&`vt-toast-slot-expanded`),"data-vt-slot":``,"data-vt-index":i,"data-vt-front":i===0?`true`:`false`,"data-vt-status":n.status,style:C,children:(0,r.jsxs)(`div`,{className:e.c(`vt-toast`,l.richColors&&`vt-toast-rich`,v.isSwiping&&`vt-toast-swiping`,m===`floating`&&`vt-toast-floating-close`,l.toastClassName,h?.toast,n.className),role:n.role,"aria-live":n.role===`alert`?`assertive`:`polite`,"aria-atomic":`true`,"aria-label":n.ariaLabel,tabIndex:0,"data-vt-toast":``,"data-vt-id":n.id,"data-vt-variant":n.variant,"data-vt-status":n.status,"data-vt-paused":n.paused?`true`:`false`,"data-vt-swiping":v.isSwiping?`true`:`false`,"data-vt-position":o,"data-vt-glass":n.glass??l.glass,"data-vt-radius":n.radius??l.radius,"data-vt-size":n.size??l.size,"data-vt-glow":n.ambientGlow??l.ambientGlow?`true`:`false`,"data-vt-animation":n.animation??l.animation,onMouseEnter:()=>u&&c.pause(n.id,`hover`),onMouseLeave:()=>u&&c.resume(n.id,`hover`),onFocus:()=>d&&c.pause(n.id,`focus`),onBlur:x,onKeyDown:S,...y,children:[m===`floating`&&w,n.variant===`custom`&&typeof n.customRender==`function`?(0,r.jsx)(`div`,{className:`vt-custom-content`,children:n.customRender({id:n.id,toast:n,dismiss:_,pause:()=>c.pause(n.id,`manual`),resume:()=>c.resume(n.id,`manual`)})}):(0,r.jsxs)(`div`,{className:e.c(`vt-body`,h?.body),children:[m===`top-left`&&w,(0,r.jsx)(T,{variant:n.variant,icon:g,animationMode:e.d(n.iconAnimation??l.iconAnimation),className:h?.icon}),(0,r.jsxs)(`div`,{className:e.c(`vt-content`,h?.content),children:[(0,r.jsxs)(`div`,{className:`vt-header`,children:[n.title!=null&&(0,r.jsx)(`div`,{className:e.c(`vt-title`,h?.title),"data-vt-title":``,children:n.title}),n.count>1&&(0,r.jsxs)(`span`,{className:e.c(`vt-count-badge`,h?.countBadge),title:`${n.count} occurrences`,"data-vt-count":n.count,children:[`×`,n.count]})]}),n.description!=null&&(0,r.jsx)(`div`,{className:e.c(`vt-description`,h?.description),"data-vt-description":``,children:n.description}),(n.action||n.cancel)&&(0,r.jsxs)(`div`,{className:e.c(`vt-actions`,h?.actions),"data-vt-actions":``,children:[n.action&&(0,r.jsx)(`button`,{type:`button`,className:e.c(`vt-btn vt-btn-primary`,h?.actionButton),"aria-label":n.action.ariaLabel,onClick:e=>n.action?.onClick(e),children:n.action.label}),n.cancel&&(0,r.jsx)(`button`,{type:`button`,className:e.c(`vt-btn vt-btn-secondary`,h?.cancelButton),"aria-label":n.cancel.ariaLabel,onClick:e=>n.cancel?.onClick(e),children:n.cancel.label})]})]}),m===`top-right`&&w]}),f&&(0,r.jsx)(E,{duration:n.duration,paused:n.paused,variant:n.variant,position:n.progressPosition??l.progressPosition,height:n.progressHeight??l.progressHeight,trackClassName:h?.progress,barClassName:h?.progressBar,resetKey:`${n.id}-${n.duration}-${n.count}-${n.variant}`})]})})}),te=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],ne=[`altKey`,`KeyT`];function re(e,t){return t.length!==0&&t.every(t=>t===`altKey`?e.altKey:t===`ctrlKey`?e.ctrlKey:t===`metaKey`?e.metaKey:t===`shiftKey`?e.shiftKey:e.code===t||e.key.toLowerCase()===t.toLowerCase())}function D({position:i=`top-right`,theme:a=`dark`,duration:o=4e3,visibleToasts:l=4,gap:f=12,offset:p=20,expand:m=!1,glass:h=`frosted`,radius:v=`md`,size:y=`default`,ambientGlow:b=!0,themeTokens:x,animation:S=`bounce`,iconAnimation:C=`default`,progressPosition:w=`bottom`,progressHeight:T=3,pauseOnHover:E=!0,pauseOnFocus:D=!0,swipeToDismiss:O=!0,swipeDirections:k,showProgress:A=!1,closeButton:j=!0,closeButtonPosition:M=`floating`,showCloseOnHover:N=!0,preventDuplicates:P=!1,richColors:F=!1,icons:I,classNames:L,hotkey:R=ne,sound:z=!0,haptic:B=!0,onToastShow:V,toastOptions:H,dir:ie=`ltr`,className:ae,toastClassName:U,style:oe,containerAriaLabel:se=`Notifications`,portalContainer:ce,exitDuration:W=240,store:G=e.o}){let le=s(),ue=u(a),{toasts:K}=d(G),[de,q]=(0,t.useState)(null),[fe,J]=(0,t.useState)(null),Y=(0,t.useRef)(new Set),X=S===`none`?0:W;(0,t.useEffect)(()=>{G.configure({defaultDuration:o,visibleToasts:l,exitDuration:X,preventDuplicates:P,toastOptions:H})},[o,X,P,G,H,l]),(0,t.useEffect)(()=>{if(!c())return;let e=()=>{document.hidden?G.pauseAll(`document-hidden`):G.resumeAll(`document-hidden`)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[G]),(0,t.useEffect)(()=>{if(!c()||R.length===0)return;let e=e=>{if(!re(e,R))return;let t=document.querySelector(`[data-vt-toast]`);t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[R]),(0,t.useEffect)(()=>{let e=new Set;for(let t of K)e.add(t.id),t.status!==`exiting`&&!Y.current.has(t.id)&&(Y.current.add(t.id),V?.(t),(t.sound??z)&&g(t.variant),(t.haptic??B)&&_(t.variant));for(let t of Y.current)e.has(t)||Y.current.delete(t)},[B,V,z,K]);let pe=(0,t.useMemo)(()=>e.f(x),[x]),Z=(0,t.useMemo)(()=>{let e=new Map;for(let t of K){let n=t.position??i,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[i,K]),me=(0,t.useMemo)(()=>({glass:h,radius:v,size:y,ambientGlow:b,animation:S,iconAnimation:C,closeButton:j,closeButtonPosition:M,showCloseOnHover:N,showProgress:A,progressPosition:w,progressHeight:T,pauseOnHover:E,pauseOnFocus:D,swipeToDismiss:O,swipeDirections:k,richColors:F,icons:I,classNames:L,toastClassName:U}),[h,v,y,b,S,C,j,M,N,A,w,T,E,D,O,k,F,I,L,U]);if(!le||!c())return null;let Q=ce??document.body;if(!Q)return null;let he=typeof p==`number`?`${p}px`:p,$=te.filter(e=>{let t=Z.get(e);return t&&t.length>0});if($.length===0)return null;let ge=(0,r.jsx)(r.Fragment,{children:$.map(t=>{let n=[...Z.get(t)??[]].reverse(),i=m||de===t||fe===t,a={...pe,...oe,"--vt-gap":`${f}px`,"--vt-offset":he};return(0,r.jsx)(`section`,{"aria-label":se,dir:ie,className:e.c(`vt-toaster`,L?.toaster,ae),"data-vt-toaster":``,"data-vt-theme":ue,"data-vt-position":t,"data-vt-expanded":i?`true`:`false`,style:a,onMouseEnter:()=>q(t),onMouseLeave:()=>q(e=>e===t?null:e),onFocus:()=>J(t),onBlur:e=>{e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||J(e=>e===t?null:e)},children:(0,r.jsx)(`ol`,{className:e.c(`vt-list`,L?.list),"data-vt-list":``,children:n.map((e,a)=>(0,r.jsx)(ee,{toast:e,index:a,total:n.length,position:t,expanded:i,store:G,cfg:me},e.id))})},t)})});return(0,n.createPortal)(ge,Q)}exports.EMPTY_SNAPSHOT=e.r,exports.PauseableTimer=e.s,exports.ToastStore=e.i,exports.Toaster=D,exports.createToastApi=e.t,exports.createToastStore=e.a,exports.defaultToastStore=e.o,exports.playToastSound=g,exports.toast=e.n,exports.tokensToCssVars=e.f,exports.triggerToastHaptic=_,exports.useMounted=s,exports.useResolvedTheme=u,exports.useToasts=d;
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./core-B8oarzUq.cjs");let t=require("react"),n=require("react-dom"),r=require("react/jsx-runtime");var i=()=>()=>{},a=()=>!0,o=()=>!1;function s(){return(0,t.useSyncExternalStore)(i,a,o)}function c(){return typeof window<`u`&&typeof document<`u`}function l(){return c()&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):null}function u(){let e=l();return!e||e.matches?`dark`:`light`}function d(e){let[n,r]=(0,t.useState)(()=>e===`system`?u():e);return(0,t.useEffect)(()=>{let t=e===`system`?l():null;if(!t)return;let n=()=>r(t.matches?`dark`:`light`);return n(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)):(t.addListener(n),()=>t.removeListener(n))},[e]),e===`system`?n:e}function f(n=e.o){return(0,t.useSyncExternalStore)(n.subscribe,n.getSnapshot,n.getServerSnapshot)}var p={success:[523.25,659.25],error:[311.13,246.94],warning:[440,392],info:[587.33],loading:[493.88]},m={success:18,error:[28,36,28],warning:[22,28],loading:10},h=null;function g(){if(!c())return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{return h&&h.state!==`closed`||(h=new e),h}catch{return null}}function _(e){let t=g();if(t)try{t.state===`suspended`&&t.resume().catch(()=>{});let n=t.currentTime;(p[e]??[523.25]).forEach((r,i)=>{let a=t.createOscillator(),o=t.createGain(),s=n+i*.085,c=s+.14;a.type=e===`error`?`triangle`:`sine`,a.frequency.setValueAtTime(r,s),o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(.045,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,c),a.connect(o),o.connect(t.destination),a.start(s),a.stop(c+.01)})}catch{}}function v(e){if(c()&&typeof navigator<`u`&&typeof navigator.vibrate==`function`)try{navigator.vibrate(m[e]??12)}catch{}}var y=[!1,0,0,1];function b(n,r,i,a,o,s){let[c,l]=(0,t.useState)(y),u=(0,t.useRef)(null),d=i?.length?i:e.g(r),f=d.includes(`left`),p=d.includes(`right`),m=d.includes(`up`),h=d.includes(`down`),g=f||p,_=m||h,v=(t,n,r)=>{if(r===`x`){let n=t>0&&p||t<0&&f;return[n?t:t*e.m,0,n?Math.abs(t):0]}let i=n<0&&m||n>0&&h;return[0,i?n:n*e.m,i?Math.abs(n):0]},b=e=>{u.current=null,l(y),e&&o()};return[c,{onPointerDown(e){if(!(!n||e.button!==0||e.target instanceof Element&&e.target.closest(`button,a,input,textarea,select,[data-vt-no-swipe]`))){u.current=[e.pointerId,e.clientX,e.clientY,Date.now(),!1,null];try{e.currentTarget.setPointerCapture?.(e.pointerId)}catch{}}},onPointerMove(e){let t=u.current;if(!t||t[0]!==e.pointerId)return;let n=e.clientX-t[1],r=e.clientY-t[2],i=Math.abs(n),o=Math.abs(r);if(!t[5]){if(Math.max(i,o)<6)return;t[5]=g&&_?i>=o?`x`:`y`:g?`x`:`y`}if(!t[4]){if((t[5]===`x`?i:o)<6)return;t[4]=!0,a()}let[s,c,d]=v(n,r,t[5]),f=Math.min(1,Math.max(0,d/126));l([!0,s,c,Math.max(.25,1-f*.7)])},onPointerUp(e){let t=u.current;if(!t||t[0]!==e.pointerId)return;try{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}if(!t[4]||!t[5]){u.current=null;return}let n=v(e.clientX-t[1],e.clientY-t[2],t[5])[2];n>=84||n/Math.max(1,Date.now()-t[3])>=.45?(u.current=null,l(y),s()):b(!0)},onPointerCancel(e){let t=u.current;t&&t[0]===e.pointerId&&b(t[4])}}]}var x=`M8.4 3.4H15.6L20.6 8.4V15.6L15.6 20.6H8.4L3.4 15.6V8.4L8.4 3.4Z`,S=`M10.42 4.65C11.12 3.43 12.88 3.43 13.58 4.65L20.38 16.45C21.08 17.67 20.2 19.2 18.8 19.2H5.2C3.8 19.2 2.92 17.67 3.62 16.45L10.42 4.65Z`,C=[[4.2,4.8,1.05],[19.8,4.8,.95],[20.2,18.8,.9],[4.2,18.8,.85]],w={success:[4,4,20,20,`currentColor`,`#a7f3d0`,1,.95],error:[4,4,20,20,`#fda4af`,`currentColor`],warning:[12,3,12,21,`#fde68a`,`currentColor`],info:[4,4,20,20,`#bae6fd`,`currentColor`],loading:[2,2,22,22,`currentColor`,`currentColor`,1,.08]};function T(e,t,n){return(0,r.jsx)(`circle`,{cx:`12`,cy:`12`,r:t,...n},e)}function E({variant:n,icon:i,animationMode:a=`default`,className:o}){let s=(0,t.useId)();if(i===null)return null;if(i!==void 0)return(0,r.jsx)(`span`,{className:e.c(`vt-icon-badge vt-icon-badge-custom`,o),"data-vt-icon":``,"data-vt-icon-animation":a,"aria-hidden":`true`,children:(0,r.jsx)(`span`,{className:`vt-icon-inner`,children:i})});if(n==="default"||n===`custom`)return null;let c=`vt-grad-${s}`,l=`vt-glow-${s}`,u=`url(#${c})`,[d,f,p,m,h,g,_=1,v=1]=w[n],y=(e,t,n,i,a,o=!a)=>(0,r.jsx)(`path`,{d:t,stroke:u,strokeWidth:i,strokeLinecap:o?`round`:void 0,strokeLinejoin:a,pathLength:100,className:n},e);return(0,r.jsxs)(`span`,{className:e.c(`vt-icon-badge`,o),"data-vt-icon":``,"data-vt-variant":n,"data-vt-icon-animation":a,"aria-hidden":`true`,children:[(0,r.jsx)(`span`,{className:`vt-icon-pulse`,"aria-hidden":`true`}),(0,r.jsx)(`span`,{className:`vt-icon-inner`,children:(0,r.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`vt-svg vt-svg-${n}`,focusable:`false`,"aria-hidden":`true`,children:[(0,r.jsxs)(`defs`,{children:[(0,r.jsxs)(`linearGradient`,{id:c,x1:d,y1:f,x2:p,y2:m,gradientUnits:`userSpaceOnUse`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:h,stopOpacity:_}),n===`loading`&&(0,r.jsx)(`stop`,{offset:`65%`,stopColor:`#c4b5fd`,stopOpacity:`.85`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:g,stopOpacity:v})]}),n===`loading`&&(0,r.jsxs)(`linearGradient`,{id:l,x1:`20`,y1:`4`,x2:`4`,y2:`20`,gradientUnits:`userSpaceOnUse`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`#fff`,stopOpacity:`.85`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`.1`})]})]}),n===`success`&&[T(0,8.75,{fill:`currentColor`,className:`vt-success-fill`}),T(1,8.75,{stroke:u,strokeWidth:1.75,strokeLinecap:`round`,pathLength:100,className:`vt-success-ring`}),y(2,`M8.1 12.35L10.75 15L16.1 9.35`,`vt-success-check`,2.2,`round`,!0),...C.map(([e,t,n],i)=>(0,r.jsx)(`circle`,{cx:e,cy:t,r:n,fill:`currentColor`,className:`vt-spark vt-spark-${i+1}`},e+t))],n===`error`&&[(0,r.jsx)(`path`,{d:x,fill:`currentColor`,className:`vt-error-fill`},0),y(1,x,`vt-error-frame`,1.75,`round`),y(2,`M9.1 9.1L14.9 14.9`,`vt-error-line-1`,2.15),y(3,`M14.9 9.1L9.1 14.9`,`vt-error-line-2`,2.15)],n===`warning`&&[(0,r.jsx)(`path`,{d:S,fill:`currentColor`,className:`vt-warning-fill`},0),y(1,S,`vt-warning-frame`,1.75,`round`),y(2,`M12 9.1V13.15`,`vt-warning-stem`,2.1),(0,r.jsx)(`circle`,{cx:`12`,cy:`16.1`,r:`1.2`,fill:u,className:`vt-warning-dot`},3)],n===`info`&&[T(0,8.75,{fill:`currentColor`,className:`vt-info-fill`}),T(1,8.75,{stroke:u,strokeWidth:1.75,pathLength:100,className:`vt-info-ring`}),T(2,8.75,{stroke:`#fff`,strokeWidth:1.75,strokeLinecap:`round`,strokeDasharray:`16 84`,pathLength:100,className:`vt-info-glint`}),(0,r.jsx)(`circle`,{cx:`12`,cy:`8.25`,r:`1.25`,fill:u,className:`vt-info-dot`},3),y(4,`M12 11.2V16.1`,`vt-info-stem`,2.15)],n===`loading`&&[T(0,9,{stroke:`currentColor`,strokeOpacity:.18,strokeWidth:1.8}),T(1,9,{stroke:u,strokeWidth:2.1,strokeLinecap:`round`,pathLength:100,className:`vt-loader-outer`}),T(2,5.3,{stroke:`url(#${l})`,strokeWidth:1.65,strokeLinecap:`round`,strokeDasharray:`34 66`,pathLength:100,className:`vt-loader-inner`}),T(3,2.1,{fill:`currentColor`,className:`vt-loader-core`})]]})})]},n)}var D=e=>e?`true`:`false`;function O(t,n,i){return t?(0,r.jsx)(`button`,{type:`button`,className:e.c(n,i),"aria-label":t.ariaLabel,onClick:e=>t.onClick(e),children:t.label}):null}var k=(0,t.memo)(function({toast:t,index:n,total:i,position:a,expanded:o,store:s,cfg:c}){let l=c.pauseOnHover&&t.pauseOnHover,u=c.pauseOnFocus&&t.pauseOnFocus,d=t.closeButtonPosition??c.closeButtonPosition,f=e.u(c.classNames,t.classNames),p=t.icon===void 0?c.icons&&t.variant!=="default"&&t.variant!==`custom`?c.icons[t.variant]:void 0:t.icon,m=()=>s.dismiss(t.id,`user`),[[h,g,_,v],y]=b(c.swipeToDismiss&&t.swipeToDismiss&&t.dismissible,a,t.swipeDirections??c.swipeDirections,()=>s.pause(t.id,`swipe`),()=>s.resume(t.id,`swipe`),m),x=e=>{!u||e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||s.resume(t.id,`focus`)},S=e=>{e.key===`Escape`&&t.dismissible&&(e.stopPropagation(),m())},C=(t.closeButton??c.closeButton)&&t.dismissible?(0,r.jsx)(`button`,{type:`button`,className:e.c(`vt-close`,d===`floating`&&`vt-close-floating`,d===`top-left`&&`vt-close-left`,(t.showCloseOnHover??c.showCloseOnHover)&&`vt-close-hover-only`,f?.closeButton),"aria-label":`Dismiss notification`,"data-vt-close":``,"data-vt-close-position":d,onClick:m,children:c.icons?.close===void 0?(0,r.jsx)(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`vt-close-svg`,"aria-hidden":`true`,children:(0,r.jsx)(`path`,{d:`M4.5 4.5L11.5 11.5M11.5 4.5L4.5 11.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`})}):c.icons.close}):null;return(0,r.jsx)(`li`,{className:e.c(`vt-toast-slot`,o&&`vt-toast-slot-expanded`),"data-vt-slot":``,"data-vt-index":n,"data-vt-front":D(n===0),"data-vt-status":t.status,style:{...t.style,"--vt-index":String(n),"--vt-z-index":String(Math.max(1,i-n)),"--vt-swipe-x":`${g}px`,"--vt-swipe-y":`${_}px`,"--vt-swipe-opacity":String(v)},children:(0,r.jsxs)(`div`,{className:e.c(`vt-toast`,c.richColors&&`vt-toast-rich`,h&&`vt-toast-swiping`,d===`floating`&&`vt-toast-floating-close`,c.toastClassName,f?.toast,t.className),role:t.role,"aria-live":t.role===`alert`?`assertive`:`polite`,"aria-atomic":`true`,"aria-label":t.ariaLabel,tabIndex:0,"data-vt-toast":``,"data-vt-id":t.id,"data-vt-variant":t.variant,"data-vt-status":t.status,"data-vt-paused":D(t.paused),"data-vt-swiping":D(h),"data-vt-position":a,"data-vt-glass":t.glass??c.glass,"data-vt-radius":t.radius??c.radius,"data-vt-size":t.size??c.size,"data-vt-glow":D(t.ambientGlow??c.ambientGlow),"data-vt-animation":t.animation??c.animation,onMouseEnter:()=>l&&s.pause(t.id,`hover`),onMouseLeave:()=>l&&s.resume(t.id,`hover`),onFocus:()=>u&&s.pause(t.id,`focus`),onBlur:x,onKeyDown:S,...y,children:[d===`floating`&&C,t.variant===`custom`&&typeof t.customRender==`function`?(0,r.jsx)(`div`,{className:`vt-custom-content`,children:t.customRender({id:t.id,toast:t,dismiss:m,pause:()=>s.pause(t.id,`manual`),resume:()=>s.resume(t.id,`manual`)})}):(0,r.jsxs)(`div`,{className:e.c(`vt-body`,f?.body),children:[d===`top-left`&&C,(0,r.jsx)(E,{variant:t.variant,icon:p,animationMode:e.f(t.iconAnimation??c.iconAnimation),className:f?.icon}),(0,r.jsxs)(`div`,{className:e.c(`vt-content`,f?.content),children:[(0,r.jsxs)(`div`,{className:`vt-header`,children:[t.title!=null&&(0,r.jsx)(`div`,{className:e.c(`vt-title`,f?.title),"data-vt-title":``,children:t.title}),t.count>1&&(0,r.jsxs)(`span`,{className:e.c(`vt-count-badge`,f?.countBadge),title:`${t.count} occurrences`,"data-vt-count":t.count,children:[`×`,t.count]})]}),t.description!=null&&(0,r.jsx)(`div`,{className:e.c(`vt-description`,f?.description),"data-vt-description":``,children:t.description}),(t.action||t.cancel)&&(0,r.jsxs)(`div`,{className:e.c(`vt-actions`,f?.actions),"data-vt-actions":``,children:[O(t.action,`vt-btn vt-btn-primary`,f?.actionButton),O(t.cancel,`vt-btn vt-btn-secondary`,f?.cancelButton)]})]}),d===`top-right`&&C]}),c.showProgress&&t.showProgress&&t.status!==`exiting`&&e.l(t.duration)&&(0,r.jsx)(`div`,{className:e.c(`vt-progress-track`,f?.progress),style:{height:`${Math.max(1,t.progressHeight??c.progressHeight)}px`},"aria-hidden":`true`,"data-vt-progress":``,"data-vt-progress-position":t.progressPosition??c.progressPosition,children:(0,r.jsx)(`div`,{className:e.c(`vt-progress-bar`,f?.progressBar),"data-vt-variant":t.variant,style:{animationDuration:`${t.duration}ms`,animationPlayState:t.paused?`paused`:`running`}},`${t.id}-${t.duration}-${t.count}-${t.variant}`)})]})})}),A=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],j={position:`top-right`,theme:`dark`,duration:4e3,visibleToasts:4,gap:12,offset:20,expand:!1,glass:`frosted`,radius:`md`,size:`default`,ambientGlow:!0,animation:`bounce`,iconAnimation:`default`,progressPosition:`bottom`,progressHeight:3,pauseOnHover:!0,pauseOnFocus:!0,swipeToDismiss:!0,showProgress:!1,closeButton:!0,closeButtonPosition:`floating`,showCloseOnHover:!0,preventDuplicates:!1,richColors:!1,hotkey:[`altKey`,`KeyT`],sound:!0,haptic:!0,dir:`ltr`,containerAriaLabel:`Notifications`,exitDuration:240,store:e.o};function M(e,t){return t.length>0&&t.every(t=>t===`altKey`||t===`ctrlKey`||t===`metaKey`||t===`shiftKey`?e[t]:e.code===t||e.key.toLowerCase()===t.toLowerCase())}function N(i){let a={...j,...e.d(i)},o=s(),l=d(a.theme),{toasts:u}=f(a.store),[p,m]=(0,t.useState)(null),[h,g]=(0,t.useState)(null),y=(0,t.useRef)(new Set),b=a.animation===`none`?0:a.exitDuration;(0,t.useEffect)(()=>{a.store.configure({defaultDuration:a.duration,visibleToasts:a.visibleToasts,exitDuration:b,preventDuplicates:a.preventDuplicates,toastOptions:a.toastOptions})},[a.duration,b,a.preventDuplicates,a.store,a.toastOptions,a.visibleToasts]),(0,t.useEffect)(()=>{if(!c())return;let e=()=>document.hidden?a.store.pauseAll(`document-hidden`):a.store.resumeAll(`document-hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[a.store]),(0,t.useEffect)(()=>{if(!c()||a.hotkey.length===0)return;let e=e=>{if(!M(e,a.hotkey))return;let t=document.querySelector(`[data-vt-toast]`);t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a.hotkey]),(0,t.useEffect)(()=>{let e=new Set;for(let t of u)e.add(t.id),t.status!==`exiting`&&!y.current.has(t.id)&&(y.current.add(t.id),a.onToastShow?.(t),(t.sound??a.sound)&&_(t.variant),(t.haptic??a.haptic)&&v(t.variant));for(let t of y.current)e.has(t)||y.current.delete(t)},[a.haptic,a.onToastShow,a.sound,u]);let x=(0,t.useMemo)(()=>e.p(a.themeTokens),[a.themeTokens]),S=(0,t.useMemo)(()=>{let e=new Map;for(let t of u){let n=t.position??a.position,r=e.get(n);r?r.push(t):e.set(n,[t])}return e},[a.position,u]);if(!o||!c())return null;let C=a.portalContainer??document.body;if(!C)return null;let w=A.filter(e=>(S.get(e)?.length??0)>0);if(w.length===0)return null;let T=typeof a.offset==`number`?`${a.offset}px`:a.offset;return(0,n.createPortal)(w.map(t=>{let n=[...S.get(t)??[]].reverse(),i=a.expand||p===t||h===t;return(0,r.jsx)(`section`,{"aria-label":a.containerAriaLabel,dir:a.dir,className:e.c(`vt-toaster`,a.classNames?.toaster,a.className),"data-vt-toaster":``,"data-vt-theme":l,"data-vt-position":t,"data-vt-expanded":D(i),style:{...x,...a.style,"--vt-gap":`${a.gap}px`,"--vt-offset":T},onMouseEnter:()=>m(t),onMouseLeave:()=>m(e=>e===t?null:e),onFocus:()=>g(t),onBlur:e=>{e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||g(e=>e===t?null:e)},children:(0,r.jsx)(`ol`,{className:e.c(`vt-list`,a.classNames?.list),"data-vt-list":``,children:n.map((e,o)=>(0,r.jsx)(k,{toast:e,index:o,total:n.length,position:t,expanded:i,store:a.store,cfg:a},e.id))})},t)}),C)}exports.EMPTY_SNAPSHOT=e.r,exports.PauseableTimer=e.s,exports.ToastStore=e.i,exports.Toaster=N,exports.createToastApi=e.t,exports.createToastStore=e.a,exports.defaultToastStore=e.o,exports.playToastSound=_,exports.toast=e.n,exports.tokensToCssVars=e.p,exports.triggerToastHaptic=v,exports.useMounted=s,exports.useResolvedTheme=d,exports.useToasts=f;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use client";import{a as e,c as t,d as n,f as r,h as i,i as a,l as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./core-BikVsncn.js";import{memo as m,useCallback as h,useEffect as g,useId as _,useMemo as v,useRef as y,useState as b,useSyncExternalStore as x}from"react";import{createPortal as S}from"react-dom";import{Fragment as C,jsx as w,jsxs as T}from"react/jsx-runtime";var E=()=>()=>{},D=()=>!0,O=()=>!1;function ee(){return x(E,D,O)}function k(){return typeof window<`u`&&typeof document<`u`}function A(){return!k()||typeof window.matchMedia!=`function`||window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function j(e){let[t,n]=b(()=>e===`system`?A():e);return g(()=>{if(e!==`system`||!k()||typeof window.matchMedia!=`function`)return;let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>{n(t.matches?`dark`:`light`)};return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>{t.removeEventListener(`change`,r)}):(t.addListener(r),()=>{t.removeListener(r)})},[e]),e===`system`?t:e}function te(e=c){return x(e.subscribe,e.getSnapshot,e.getServerSnapshot)}var M={success:[523.25,659.25],error:[311.13,246.94],warning:[440,392],info:[587.33],loading:[493.88],default:[523.25],custom:[523.25]},N={success:18,error:[28,36,28],warning:[22,28],info:12,loading:10,default:12,custom:12},P=null;function F(){if(!k())return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{return P&&P.state!==`closed`||(P=new e),P}catch{return null}}function I(e){let t=F();if(t)try{t.state===`suspended`&&t.resume().catch(()=>{});let n=M[e]??M.default,r=t.currentTime;n.forEach((n,i)=>{let a=t.createOscillator(),o=t.createGain(),s=r+i*.085,c=s+.14;a.type=e===`error`?`triangle`:`sine`,a.frequency.setValueAtTime(n,s),o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(.045,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,c),a.connect(o),o.connect(t.destination),a.start(s),a.stop(c+.01)})}catch{}}function L(e){if(k()&&typeof navigator<`u`&&typeof navigator.vibrate==`function`)try{navigator.vibrate(N[e]??12)}catch{}}var R={isSwiping:!1,offsetX:0,offsetY:0,opacity:1};function z(e){return e instanceof Element&&e.closest(`button, a, input, textarea, select, [data-vt-no-swipe]`)!==null}function B({enabled:e,position:t,directions:n,onSwipeStart:r,onSwipeCancel:a,onDismiss:o}){let[s,c]=b(R),u=y(null),d=n&&n.length>0?n:i(t),f=d.includes(`left`),p=d.includes(`right`),m=d.includes(`up`),g=d.includes(`down`),_=f||p,v=m||g,x=h((e,t,n)=>{if(n===`x`){let t=e>0&&p||e<0&&f;return{offsetX:t?e:e*l,offsetY:0,primaryDelta:t?Math.abs(e):0}}let r=t<0&&m||t>0&&g;return{offsetX:0,offsetY:r?t:t*l,primaryDelta:r?Math.abs(t):0}},[g,f,p,m]),S=h(e=>{u.current=null,c(R),e&&a?.()},[a]);return{swipeState:s,handlers:{onPointerDown:h(t=>{if(e&&t.button===0&&!z(t.target)&&(u.current={pointerId:t.pointerId,startX:t.clientX,startY:t.clientY,startTime:Date.now(),active:!1,lockedAxis:null},typeof t.currentTarget.setPointerCapture==`function`))try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}},[e]),onPointerMove:h(e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,i=e.clientY-t.startY,a=Math.abs(n),o=Math.abs(i);if(!t.lockedAxis){if(Math.max(a,o)<6)return;t.lockedAxis=_&&v?a>=o?`x`:`y`:_?`x`:`y`}let s=t.lockedAxis===`x`?a:o;if(!t.active&&s<6)return;t.active||(t.active=!0,r?.());let{offsetX:l,offsetY:d,primaryDelta:f}=x(n,i,t.lockedAxis),p=Math.min(1,Math.max(0,f/126));c({isSwiping:!0,offsetX:l,offsetY:d,opacity:Math.max(.25,1-p*.7)})},[x,r,_,v]),onPointerUp:h(e=>{let t=u.current;if(!t||t.pointerId!==e.pointerId)return;if(typeof e.currentTarget.releasePointerCapture==`function`)try{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}if(!t.active||!t.lockedAxis){u.current=null;return}let n=e.clientX-t.startX,r=e.clientY-t.startY,i=Math.max(1,Date.now()-t.startTime),{primaryDelta:a}=x(n,r,t.lockedAxis),s=a/i;a>=84||s>=.45?(u.current=null,c(R),o()):S(!0)},[x,o,S]),onPointerCancel:h(e=>{let t=u.current;t&&t.pointerId===e.pointerId&&S(t.active)},[S])}}}var V=`M8.4 3.4H15.6L20.6 8.4V15.6L15.6 20.6H8.4L3.4 15.6V8.4L8.4 3.4Z`,H=`M10.42 4.65C11.12 3.43 12.88 3.43 13.58 4.65L20.38 16.45C21.08 17.67 20.2 19.2 18.8 19.2H5.2C3.8 19.2 2.92 17.67 3.62 16.45L10.42 4.65Z`,U=[[4.2,4.8,1.05],[19.8,4.8,.95],[20.2,18.8,.9],[4.2,18.8,.85]],W={success:[4,4,20,20,`currentColor`,`#a7f3d0`,1,.95],error:[4,4,20,20,`#fda4af`,`currentColor`],warning:[12,3,12,21,`#fde68a`,`currentColor`],info:[4,4,20,20,`#bae6fd`,`currentColor`],loading:[2,2,22,22,`currentColor`,`currentColor`,1,.08]};function G({variant:e,icon:n,animationMode:r=`default`,className:i}){let a=_();if(n===null)return null;if(n!==void 0)return/* @__PURE__ */ w(`span`,{className:t(`vt-icon-badge vt-icon-badge-custom`,i),"data-vt-icon":``,"data-vt-icon-animation":r,"aria-hidden":`true`,children:/* @__PURE__ */ w(`span`,{className:`vt-icon-inner`,children:n})});if(e==="default"||e===`custom`)return null;let o=`vt-grad-${a}`,s=`vt-glow-${a}`,c=`url(#${o})`,[l,u,d,f,p,m,h=1,g=1]=W[e];return/* @__PURE__ */ T(`span`,{className:t(`vt-icon-badge`,i),"data-vt-icon":``,"data-vt-variant":e,"data-vt-icon-animation":r,"aria-hidden":`true`,children:[/* @__PURE__ */ w(`span`,{className:`vt-icon-pulse`,"aria-hidden":`true`}),/* @__PURE__ */ w(`span`,{className:`vt-icon-inner`,children:/* @__PURE__ */ T(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`vt-svg vt-svg-${e}`,focusable:`false`,"aria-hidden":`true`,children:[/* @__PURE__ */ T(`defs`,{children:[/* @__PURE__ */ T(`linearGradient`,{id:o,x1:l,y1:u,x2:d,y2:f,gradientUnits:`userSpaceOnUse`,children:[/* @__PURE__ */ w(`stop`,{offset:`0%`,stopColor:p,stopOpacity:h}),e===`loading`&&/* @__PURE__ */ w(`stop`,{offset:`65%`,stopColor:`#c4b5fd`,stopOpacity:`0.85`}),/* @__PURE__ */ w(`stop`,{offset:`100%`,stopColor:m,stopOpacity:g})]}),e===`loading`&&/* @__PURE__ */ T(`linearGradient`,{id:s,x1:`20`,y1:`4`,x2:`4`,y2:`20`,gradientUnits:`userSpaceOnUse`,children:[/* @__PURE__ */ w(`stop`,{offset:`0%`,stopColor:`#fff`,stopOpacity:`0.85`}),/* @__PURE__ */ w(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`0.1`})]})]}),e===`success`&&/* @__PURE__ */ T(C,{children:[/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`8.75`,fill:`currentColor`,className:`vt-success-fill`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:c,strokeWidth:`1.75`,strokeLinecap:`round`,pathLength:100,className:`vt-success-ring`}),/* @__PURE__ */ w(`path`,{d:`M8.1 12.35L10.75 15L16.1 9.35`,stroke:c,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,pathLength:100,className:`vt-success-check`}),U.map(([e,t,n],r)=>/* @__PURE__ */ w(`circle`,{cx:e,cy:t,r:n,fill:`currentColor`,className:`vt-spark vt-spark-${r+1}`},r))]}),e===`error`&&/* @__PURE__ */ T(C,{children:[/* @__PURE__ */ w(`path`,{d:V,fill:`currentColor`,className:`vt-error-fill`}),/* @__PURE__ */ w(`path`,{d:V,stroke:c,strokeWidth:`1.75`,strokeLinejoin:`round`,pathLength:100,className:`vt-error-frame`}),/* @__PURE__ */ w(`path`,{d:`M9.1 9.1L14.9 14.9`,stroke:c,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-error-line-1`}),/* @__PURE__ */ w(`path`,{d:`M14.9 9.1L9.1 14.9`,stroke:c,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-error-line-2`})]}),e===`warning`&&/* @__PURE__ */ T(C,{children:[/* @__PURE__ */ w(`path`,{d:H,fill:`currentColor`,className:`vt-warning-fill`}),/* @__PURE__ */ w(`path`,{d:H,stroke:c,strokeWidth:`1.75`,strokeLinejoin:`round`,pathLength:100,className:`vt-warning-frame`}),/* @__PURE__ */ w(`path`,{d:`M12 9.1V13.15`,stroke:c,strokeWidth:`2.1`,strokeLinecap:`round`,pathLength:100,className:`vt-warning-stem`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`16.1`,r:`1.2`,fill:c,className:`vt-warning-dot`})]}),e===`info`&&/* @__PURE__ */ T(C,{children:[/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`8.75`,fill:`currentColor`,className:`vt-info-fill`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:c,strokeWidth:`1.75`,pathLength:100,className:`vt-info-ring`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`8.75`,stroke:`#fff`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeDasharray:`16 84`,pathLength:100,className:`vt-info-glint`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`8.25`,r:`1.25`,fill:c,className:`vt-info-dot`}),/* @__PURE__ */ w(`path`,{d:`M12 11.2V16.1`,stroke:c,strokeWidth:`2.15`,strokeLinecap:`round`,pathLength:100,className:`vt-info-stem`})]}),e===`loading`&&/* @__PURE__ */ T(C,{children:[/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:`currentColor`,strokeOpacity:`0.18`,strokeWidth:`1.8`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`9`,stroke:c,strokeWidth:`2.1`,strokeLinecap:`round`,pathLength:100,className:`vt-loader-outer`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`5.3`,stroke:`url(#${s})`,strokeWidth:`1.65`,strokeLinecap:`round`,strokeDasharray:`34 66`,pathLength:100,className:`vt-loader-inner`}),/* @__PURE__ */ w(`circle`,{cx:`12`,cy:`12`,r:`2.1`,fill:`currentColor`,className:`vt-loader-core`})]})]})})]},e)}function K({duration:e,paused:n,variant:r,resetKey:i,position:a=`bottom`,height:s=3,trackClassName:c,barClassName:l}){if(!o(e))return null;let u={height:`${Math.max(1,s)}px`},d={animationDuration:`${e}ms`,animationPlayState:n?`paused`:`running`};return/* @__PURE__ */ w(`div`,{className:t(`vt-progress-track`,c),style:u,"aria-hidden":`true`,"data-vt-progress":``,"data-vt-progress-position":a,children:/* @__PURE__ */ w(`div`,{className:t(`vt-progress-bar`,l),"data-vt-variant":r,style:d},i)})}var ne=m(function({toast:e,index:r,total:i,position:a,expanded:o,store:s,cfg:c}){let l=c.pauseOnHover&&e.pauseOnHover,u=c.pauseOnFocus&&e.pauseOnFocus,d=c.showProgress&&e.showProgress&&e.status!==`exiting`,f=(e.closeButton??c.closeButton)&&e.dismissible,m=e.closeButtonPosition??c.closeButtonPosition,g=p(c.classNames,e.classNames),_=e.icon===void 0?c.icons&&e.variant!=="default"&&e.variant!==`custom`?c.icons[e.variant]:void 0:e.icon,v=h(()=>{s.dismiss(e.id,`user`)},[s,e.id]),{swipeState:y,handlers:b}=B({enabled:c.swipeToDismiss&&e.swipeToDismiss&&e.dismissible,position:a,directions:e.swipeDirections??c.swipeDirections,onSwipeStart:h(()=>s.pause(e.id,`swipe`),[s,e.id]),onSwipeCancel:h(()=>s.resume(e.id,`swipe`),[s,e.id]),onDismiss:v}),x=t=>{!u||t.relatedTarget&&t.currentTarget.contains(t.relatedTarget)||s.resume(e.id,`focus`)},S=t=>{t.key===`Escape`&&e.dismissible&&(t.stopPropagation(),v())},C={...e.style,"--vt-index":String(r),"--vt-z-index":String(Math.max(1,i-r)),"--vt-swipe-x":`${y.offsetX}px`,"--vt-swipe-y":`${y.offsetY}px`,"--vt-swipe-opacity":String(y.opacity)},E=f?/* @__PURE__ */ w(`button`,{type:`button`,className:t(`vt-close`,m===`floating`&&`vt-close-floating`,m===`top-left`&&`vt-close-left`,(e.showCloseOnHover??c.showCloseOnHover)&&`vt-close-hover-only`,g?.closeButton),"aria-label":`Dismiss notification`,"data-vt-close":``,"data-vt-close-position":m,onClick:v,children:c.icons?.close===void 0?/* @__PURE__ */ w(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`vt-close-svg`,"aria-hidden":`true`,children:/* @__PURE__ */ w(`path`,{d:`M4.5 4.5L11.5 11.5M11.5 4.5L4.5 11.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`})}):c.icons.close}):null;return/* @__PURE__ */ w(`li`,{className:t(`vt-toast-slot`,o&&`vt-toast-slot-expanded`),"data-vt-slot":``,"data-vt-index":r,"data-vt-front":r===0?`true`:`false`,"data-vt-status":e.status,style:C,children:/* @__PURE__ */ T(`div`,{className:t(`vt-toast`,c.richColors&&`vt-toast-rich`,y.isSwiping&&`vt-toast-swiping`,m===`floating`&&`vt-toast-floating-close`,c.toastClassName,g?.toast,e.className),role:e.role,"aria-live":e.role===`alert`?`assertive`:`polite`,"aria-atomic":`true`,"aria-label":e.ariaLabel,tabIndex:0,"data-vt-toast":``,"data-vt-id":e.id,"data-vt-variant":e.variant,"data-vt-status":e.status,"data-vt-paused":e.paused?`true`:`false`,"data-vt-swiping":y.isSwiping?`true`:`false`,"data-vt-position":a,"data-vt-glass":e.glass??c.glass,"data-vt-radius":e.radius??c.radius,"data-vt-size":e.size??c.size,"data-vt-glow":e.ambientGlow??c.ambientGlow?`true`:`false`,"data-vt-animation":e.animation??c.animation,onMouseEnter:()=>l&&s.pause(e.id,`hover`),onMouseLeave:()=>l&&s.resume(e.id,`hover`),onFocus:()=>u&&s.pause(e.id,`focus`),onBlur:x,onKeyDown:S,...b,children:[m===`floating`&&E,e.variant===`custom`&&typeof e.customRender==`function`?/* @__PURE__ */ w(`div`,{className:`vt-custom-content`,children:e.customRender({id:e.id,toast:e,dismiss:v,pause:()=>s.pause(e.id,`manual`),resume:()=>s.resume(e.id,`manual`)})}):/* @__PURE__ */ T(`div`,{className:t(`vt-body`,g?.body),children:[m===`top-left`&&E,/* @__PURE__ */ w(G,{variant:e.variant,icon:_,animationMode:n(e.iconAnimation??c.iconAnimation),className:g?.icon}),/* @__PURE__ */ T(`div`,{className:t(`vt-content`,g?.content),children:[/* @__PURE__ */ T(`div`,{className:`vt-header`,children:[e.title!=null&&/* @__PURE__ */ w(`div`,{className:t(`vt-title`,g?.title),"data-vt-title":``,children:e.title}),e.count>1&&/* @__PURE__ */ T(`span`,{className:t(`vt-count-badge`,g?.countBadge),title:`${e.count} occurrences`,"data-vt-count":e.count,children:[`×`,e.count]})]}),e.description!=null&&/* @__PURE__ */ w(`div`,{className:t(`vt-description`,g?.description),"data-vt-description":``,children:e.description}),(e.action||e.cancel)&&/* @__PURE__ */ T(`div`,{className:t(`vt-actions`,g?.actions),"data-vt-actions":``,children:[e.action&&/* @__PURE__ */ w(`button`,{type:`button`,className:t(`vt-btn vt-btn-primary`,g?.actionButton),"aria-label":e.action.ariaLabel,onClick:t=>e.action?.onClick(t),children:e.action.label}),e.cancel&&/* @__PURE__ */ w(`button`,{type:`button`,className:t(`vt-btn vt-btn-secondary`,g?.cancelButton),"aria-label":e.cancel.ariaLabel,onClick:t=>e.cancel?.onClick(t),children:e.cancel.label})]})]}),m===`top-right`&&E]}),d&&/* @__PURE__ */ w(K,{duration:e.duration,paused:e.paused,variant:e.variant,position:e.progressPosition??c.progressPosition,height:e.progressHeight??c.progressHeight,trackClassName:g?.progress,barClassName:g?.progressBar,resetKey:`${e.id}-${e.duration}-${e.count}-${e.variant}`})]})})}),re=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],ie=[`altKey`,`KeyT`];function ae(e,t){return t.length!==0&&t.every(t=>t===`altKey`?e.altKey:t===`ctrlKey`?e.ctrlKey:t===`metaKey`?e.metaKey:t===`shiftKey`?e.shiftKey:e.code===t||e.key.toLowerCase()===t.toLowerCase())}function q({position:e=`top-right`,theme:n=`dark`,duration:i=4e3,visibleToasts:a=4,gap:o=12,offset:s=20,expand:l=!1,glass:u=`frosted`,radius:d=`md`,size:f=`default`,ambientGlow:p=!0,themeTokens:m,animation:h=`bounce`,iconAnimation:_=`default`,progressPosition:x=`bottom`,progressHeight:T=3,pauseOnHover:E=!0,pauseOnFocus:D=!0,swipeToDismiss:O=!0,swipeDirections:A,showProgress:M=!1,closeButton:N=!0,closeButtonPosition:P=`floating`,showCloseOnHover:F=!0,preventDuplicates:R=!1,richColors:z=!1,icons:B,classNames:V,hotkey:H=ie,sound:U=!0,haptic:W=!0,onToastShow:G,toastOptions:K,dir:q=`ltr`,className:oe,toastClassName:J,style:se,containerAriaLabel:ce=`Notifications`,portalContainer:le,exitDuration:ue=240,store:Y=c}){let de=ee(),fe=j(n),{toasts:X}=te(Y),[pe,Z]=b(null),[me,he]=b(null),Q=y(/* @__PURE__ */ new Set),$=h===`none`?0:ue;g(()=>{Y.configure({defaultDuration:i,visibleToasts:a,exitDuration:$,preventDuplicates:R,toastOptions:K})},[i,$,R,Y,K,a]),g(()=>{if(!k())return;let e=()=>{document.hidden?Y.pauseAll(`document-hidden`):Y.resumeAll(`document-hidden`)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e)}},[Y]),g(()=>{if(!k()||H.length===0)return;let e=e=>{if(!ae(e,H))return;let t=document.querySelector(`[data-vt-toast]`);t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[H]),g(()=>{let e=/* @__PURE__ */ new Set;for(let t of X)e.add(t.id),t.status!==`exiting`&&!Q.current.has(t.id)&&(Q.current.add(t.id),G?.(t),(t.sound??U)&&I(t.variant),(t.haptic??W)&&L(t.variant));for(let t of Q.current)e.has(t)||Q.current.delete(t)},[W,G,U,X]);let ge=v(()=>r(m),[m]),_e=v(()=>{let t=/* @__PURE__ */ new Map;for(let n of X){let r=n.position??e,i=t.get(r);i?i.push(n):t.set(r,[n])}return t},[e,X]),ve=v(()=>({glass:u,radius:d,size:f,ambientGlow:p,animation:h,iconAnimation:_,closeButton:N,closeButtonPosition:P,showCloseOnHover:F,showProgress:M,progressPosition:x,progressHeight:T,pauseOnHover:E,pauseOnFocus:D,swipeToDismiss:O,swipeDirections:A,richColors:z,icons:B,classNames:V,toastClassName:J}),[u,d,f,p,h,_,N,P,F,M,x,T,E,D,O,A,z,B,V,J]);if(!de||!k())return null;let ye=le??document.body;if(!ye)return null;let be=typeof s==`number`?`${s}px`:s,xe=re.filter(e=>{let t=_e.get(e);return t&&t.length>0});if(xe.length===0)return null;let Se=/* @__PURE__ */ w(C,{children:xe.map(e=>{let n=[..._e.get(e)??[]].reverse(),r=l||pe===e||me===e,i={...ge,...se,"--vt-gap":`${o}px`,"--vt-offset":be};return/* @__PURE__ */ w(`section`,{"aria-label":ce,dir:q,className:t(`vt-toaster`,V?.toaster,oe),"data-vt-toaster":``,"data-vt-theme":fe,"data-vt-position":e,"data-vt-expanded":r?`true`:`false`,style:i,onMouseEnter:()=>Z(e),onMouseLeave:()=>Z(t=>t===e?null:t),onFocus:()=>he(e),onBlur:t=>{t.relatedTarget&&t.currentTarget.contains(t.relatedTarget)||he(t=>t===e?null:t)},children:/* @__PURE__ */ w(`ol`,{className:t(`vt-list`,V?.list),"data-vt-list":``,children:n.map((t,i)=>/* @__PURE__ */ w(ne,{toast:t,index:i,total:n.length,position:e,expanded:r,store:Y,cfg:ve},t.id))})},e)})});return S(Se,ye)}export{u as EMPTY_SNAPSHOT,d as PauseableTimer,a as ToastStore,q as Toaster,f as createToastApi,e as createToastStore,c as defaultToastStore,I as playToastSound,s as toast,r as tokensToCssVars,L as triggerToastHaptic,ee as useMounted,j as useResolvedTheme,te as useToasts};
1
+ "use client";import{a as e,c as t,d as n,f as r,g as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./core-BWb4DGqi.js";import{memo as h,useEffect as g,useId as _,useMemo as v,useRef as y,useState as b,useSyncExternalStore as x}from"react";import{createPortal as S}from"react-dom";import{jsx as C,jsxs as w}from"react/jsx-runtime";var T=()=>()=>{},E=()=>!0,D=()=>!1;function O(){return x(T,E,D)}function k(){return typeof window<`u`&&typeof document<`u`}function A(){return k()&&typeof window.matchMedia==`function`?window.matchMedia(`(prefers-color-scheme: dark)`):null}function j(){let e=A();return!e||e.matches?`dark`:`light`}function M(e){let[t,n]=b(()=>e===`system`?j():e);return g(()=>{let t=e===`system`?A():null;if(!t)return;let r=()=>n(t.matches?`dark`:`light`);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),e===`system`?t:e}function N(e=l){return x(e.subscribe,e.getSnapshot,e.getServerSnapshot)}var P={success:[523.25,659.25],error:[311.13,246.94],warning:[440,392],info:[587.33],loading:[493.88]},F={success:18,error:[28,36,28],warning:[22,28],loading:10},I=null;function L(){if(!k())return null;let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;try{return I&&I.state!==`closed`||(I=new e),I}catch{return null}}function R(e){let t=L();if(t)try{t.state===`suspended`&&t.resume().catch(()=>{});let n=t.currentTime;(P[e]??[523.25]).forEach((r,i)=>{let a=t.createOscillator(),o=t.createGain(),s=n+i*.085,c=s+.14;a.type=e===`error`?`triangle`:`sine`,a.frequency.setValueAtTime(r,s),o.gain.setValueAtTime(1e-4,s),o.gain.exponentialRampToValueAtTime(.045,s+.015),o.gain.exponentialRampToValueAtTime(1e-4,c),a.connect(o),o.connect(t.destination),a.start(s),a.stop(c+.01)})}catch{}}function z(e){if(k()&&typeof navigator<`u`&&typeof navigator.vibrate==`function`)try{navigator.vibrate(F[e]??12)}catch{}}var B=[!1,0,0,1];function V(e,t,n,r,a,o){let[c,l]=b(B),u=y(null),d=n?.length?n:i(t),f=d.includes(`left`),p=d.includes(`right`),m=d.includes(`up`),h=d.includes(`down`),g=f||p,_=m||h,v=(e,t,n)=>{if(n===`x`){let t=e>0&&p||e<0&&f;return[t?e:e*s,0,t?Math.abs(e):0]}let r=t<0&&m||t>0&&h;return[0,r?t:t*s,r?Math.abs(t):0]},x=e=>{u.current=null,l(B),e&&a()};return[c,{onPointerDown(t){if(!(!e||t.button!==0||t.target instanceof Element&&t.target.closest(`button,a,input,textarea,select,[data-vt-no-swipe]`))){u.current=[t.pointerId,t.clientX,t.clientY,Date.now(),!1,null];try{t.currentTarget.setPointerCapture?.(t.pointerId)}catch{}}},onPointerMove(e){let t=u.current;if(!t||t[0]!==e.pointerId)return;let n=e.clientX-t[1],i=e.clientY-t[2],a=Math.abs(n),o=Math.abs(i);if(!t[5]){if(Math.max(a,o)<6)return;t[5]=g&&_?a>=o?`x`:`y`:g?`x`:`y`}if(!t[4]){if((t[5]===`x`?a:o)<6)return;t[4]=!0,r()}let[s,c,d]=v(n,i,t[5]),f=Math.min(1,Math.max(0,d/126));l([!0,s,c,Math.max(.25,1-f*.7)])},onPointerUp(e){let t=u.current;if(!t||t[0]!==e.pointerId)return;try{e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId)}catch{}if(!t[4]||!t[5]){u.current=null;return}let n=v(e.clientX-t[1],e.clientY-t[2],t[5])[2];n>=84||n/Math.max(1,Date.now()-t[3])>=.45?(u.current=null,l(B),o()):x(!0)},onPointerCancel(e){let t=u.current;t&&t[0]===e.pointerId&&x(t[4])}}]}var H=`M8.4 3.4H15.6L20.6 8.4V15.6L15.6 20.6H8.4L3.4 15.6V8.4L8.4 3.4Z`,U=`M10.42 4.65C11.12 3.43 12.88 3.43 13.58 4.65L20.38 16.45C21.08 17.67 20.2 19.2 18.8 19.2H5.2C3.8 19.2 2.92 17.67 3.62 16.45L10.42 4.65Z`,W=[[4.2,4.8,1.05],[19.8,4.8,.95],[20.2,18.8,.9],[4.2,18.8,.85]],G={success:[4,4,20,20,`currentColor`,`#a7f3d0`,1,.95],error:[4,4,20,20,`#fda4af`,`currentColor`],warning:[12,3,12,21,`#fde68a`,`currentColor`],info:[4,4,20,20,`#bae6fd`,`currentColor`],loading:[2,2,22,22,`currentColor`,`currentColor`,1,.08]};function K(e,t,n){return/* @__PURE__ */ C(`circle`,{cx:`12`,cy:`12`,r:t,...n},e)}function q({variant:e,icon:n,animationMode:r=`default`,className:i}){let a=_();if(n===null)return null;if(n!==void 0)return/* @__PURE__ */ C(`span`,{className:t(`vt-icon-badge vt-icon-badge-custom`,i),"data-vt-icon":``,"data-vt-icon-animation":r,"aria-hidden":`true`,children:/* @__PURE__ */ C(`span`,{className:`vt-icon-inner`,children:n})});if(e==="default"||e===`custom`)return null;let o=`vt-grad-${a}`,s=`vt-glow-${a}`,c=`url(#${o})`,[l,u,d,f,p,m,h=1,g=1]=G[e],v=(e,t,n,r,i,a=!i)=>/* @__PURE__ */ C(`path`,{d:t,stroke:c,strokeWidth:r,strokeLinecap:a?`round`:void 0,strokeLinejoin:i,pathLength:100,className:n},e);return/* @__PURE__ */ w(`span`,{className:t(`vt-icon-badge`,i),"data-vt-icon":``,"data-vt-variant":e,"data-vt-icon-animation":r,"aria-hidden":`true`,children:[/* @__PURE__ */ C(`span`,{className:`vt-icon-pulse`,"aria-hidden":`true`}),/* @__PURE__ */ C(`span`,{className:`vt-icon-inner`,children:/* @__PURE__ */ w(`svg`,{viewBox:`0 0 24 24`,fill:`none`,className:`vt-svg vt-svg-${e}`,focusable:`false`,"aria-hidden":`true`,children:[/* @__PURE__ */ w(`defs`,{children:[/* @__PURE__ */ w(`linearGradient`,{id:o,x1:l,y1:u,x2:d,y2:f,gradientUnits:`userSpaceOnUse`,children:[/* @__PURE__ */ C(`stop`,{offset:`0%`,stopColor:p,stopOpacity:h}),e===`loading`&&/* @__PURE__ */ C(`stop`,{offset:`65%`,stopColor:`#c4b5fd`,stopOpacity:`.85`}),/* @__PURE__ */ C(`stop`,{offset:`100%`,stopColor:m,stopOpacity:g})]}),e===`loading`&&/* @__PURE__ */ w(`linearGradient`,{id:s,x1:`20`,y1:`4`,x2:`4`,y2:`20`,gradientUnits:`userSpaceOnUse`,children:[/* @__PURE__ */ C(`stop`,{offset:`0%`,stopColor:`#fff`,stopOpacity:`.85`}),/* @__PURE__ */ C(`stop`,{offset:`100%`,stopColor:`currentColor`,stopOpacity:`.1`})]})]}),e===`success`&&[K(0,8.75,{fill:`currentColor`,className:`vt-success-fill`}),K(1,8.75,{stroke:c,strokeWidth:1.75,strokeLinecap:`round`,pathLength:100,className:`vt-success-ring`}),v(2,`M8.1 12.35L10.75 15L16.1 9.35`,`vt-success-check`,2.2,`round`,!0),...W.map(([e,t,n],r)=>/* @__PURE__ */ C(`circle`,{cx:e,cy:t,r:n,fill:`currentColor`,className:`vt-spark vt-spark-${r+1}`},e+t))],e===`error`&&[/* @__PURE__ */ C(`path`,{d:H,fill:`currentColor`,className:`vt-error-fill`},0),v(1,H,`vt-error-frame`,1.75,`round`),v(2,`M9.1 9.1L14.9 14.9`,`vt-error-line-1`,2.15),v(3,`M14.9 9.1L9.1 14.9`,`vt-error-line-2`,2.15)],e===`warning`&&[/* @__PURE__ */ C(`path`,{d:U,fill:`currentColor`,className:`vt-warning-fill`},0),v(1,U,`vt-warning-frame`,1.75,`round`),v(2,`M12 9.1V13.15`,`vt-warning-stem`,2.1),/* @__PURE__ */ C(`circle`,{cx:`12`,cy:`16.1`,r:`1.2`,fill:c,className:`vt-warning-dot`},3)],e===`info`&&[K(0,8.75,{fill:`currentColor`,className:`vt-info-fill`}),K(1,8.75,{stroke:c,strokeWidth:1.75,pathLength:100,className:`vt-info-ring`}),K(2,8.75,{stroke:`#fff`,strokeWidth:1.75,strokeLinecap:`round`,strokeDasharray:`16 84`,pathLength:100,className:`vt-info-glint`}),/* @__PURE__ */ C(`circle`,{cx:`12`,cy:`8.25`,r:`1.25`,fill:c,className:`vt-info-dot`},3),v(4,`M12 11.2V16.1`,`vt-info-stem`,2.15)],e===`loading`&&[K(0,9,{stroke:`currentColor`,strokeOpacity:.18,strokeWidth:1.8}),K(1,9,{stroke:c,strokeWidth:2.1,strokeLinecap:`round`,pathLength:100,className:`vt-loader-outer`}),K(2,5.3,{stroke:`url(#${s})`,strokeWidth:1.65,strokeLinecap:`round`,strokeDasharray:`34 66`,pathLength:100,className:`vt-loader-inner`}),K(3,2.1,{fill:`currentColor`,className:`vt-loader-core`})]]})})]},e)}var J=e=>e?`true`:`false`;function Y(e,n,r){return e?/* @__PURE__ */ C(`button`,{type:`button`,className:t(n,r),"aria-label":e.ariaLabel,onClick:t=>e.onClick(t),children:e.label}):null}var X=h(function({toast:e,index:n,total:i,position:a,expanded:s,store:c,cfg:l}){let u=l.pauseOnHover&&e.pauseOnHover,d=l.pauseOnFocus&&e.pauseOnFocus,f=e.closeButtonPosition??l.closeButtonPosition,p=m(l.classNames,e.classNames),h=e.icon===void 0?l.icons&&e.variant!=="default"&&e.variant!==`custom`?l.icons[e.variant]:void 0:e.icon,g=()=>c.dismiss(e.id,`user`),[[_,v,y,b],x]=V(l.swipeToDismiss&&e.swipeToDismiss&&e.dismissible,a,e.swipeDirections??l.swipeDirections,()=>c.pause(e.id,`swipe`),()=>c.resume(e.id,`swipe`),g),S=t=>{!d||t.relatedTarget&&t.currentTarget.contains(t.relatedTarget)||c.resume(e.id,`focus`)},T=t=>{t.key===`Escape`&&e.dismissible&&(t.stopPropagation(),g())},E=(e.closeButton??l.closeButton)&&e.dismissible?/* @__PURE__ */ C(`button`,{type:`button`,className:t(`vt-close`,f===`floating`&&`vt-close-floating`,f===`top-left`&&`vt-close-left`,(e.showCloseOnHover??l.showCloseOnHover)&&`vt-close-hover-only`,p?.closeButton),"aria-label":`Dismiss notification`,"data-vt-close":``,"data-vt-close-position":f,onClick:g,children:l.icons?.close===void 0?/* @__PURE__ */ C(`svg`,{viewBox:`0 0 16 16`,fill:`none`,className:`vt-close-svg`,"aria-hidden":`true`,children:/* @__PURE__ */ C(`path`,{d:`M4.5 4.5L11.5 11.5M11.5 4.5L4.5 11.5`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`})}):l.icons.close}):null;return/* @__PURE__ */ C(`li`,{className:t(`vt-toast-slot`,s&&`vt-toast-slot-expanded`),"data-vt-slot":``,"data-vt-index":n,"data-vt-front":J(n===0),"data-vt-status":e.status,style:{...e.style,"--vt-index":String(n),"--vt-z-index":String(Math.max(1,i-n)),"--vt-swipe-x":`${v}px`,"--vt-swipe-y":`${y}px`,"--vt-swipe-opacity":String(b)},children:/* @__PURE__ */ w(`div`,{className:t(`vt-toast`,l.richColors&&`vt-toast-rich`,_&&`vt-toast-swiping`,f===`floating`&&`vt-toast-floating-close`,l.toastClassName,p?.toast,e.className),role:e.role,"aria-live":e.role===`alert`?`assertive`:`polite`,"aria-atomic":`true`,"aria-label":e.ariaLabel,tabIndex:0,"data-vt-toast":``,"data-vt-id":e.id,"data-vt-variant":e.variant,"data-vt-status":e.status,"data-vt-paused":J(e.paused),"data-vt-swiping":J(_),"data-vt-position":a,"data-vt-glass":e.glass??l.glass,"data-vt-radius":e.radius??l.radius,"data-vt-size":e.size??l.size,"data-vt-glow":J(e.ambientGlow??l.ambientGlow),"data-vt-animation":e.animation??l.animation,onMouseEnter:()=>u&&c.pause(e.id,`hover`),onMouseLeave:()=>u&&c.resume(e.id,`hover`),onFocus:()=>d&&c.pause(e.id,`focus`),onBlur:S,onKeyDown:T,...x,children:[f===`floating`&&E,e.variant===`custom`&&typeof e.customRender==`function`?/* @__PURE__ */ C(`div`,{className:`vt-custom-content`,children:e.customRender({id:e.id,toast:e,dismiss:g,pause:()=>c.pause(e.id,`manual`),resume:()=>c.resume(e.id,`manual`)})}):/* @__PURE__ */ w(`div`,{className:t(`vt-body`,p?.body),children:[f===`top-left`&&E,/* @__PURE__ */ C(q,{variant:e.variant,icon:h,animationMode:r(e.iconAnimation??l.iconAnimation),className:p?.icon}),/* @__PURE__ */ w(`div`,{className:t(`vt-content`,p?.content),children:[/* @__PURE__ */ w(`div`,{className:`vt-header`,children:[e.title!=null&&/* @__PURE__ */ C(`div`,{className:t(`vt-title`,p?.title),"data-vt-title":``,children:e.title}),e.count>1&&/* @__PURE__ */ w(`span`,{className:t(`vt-count-badge`,p?.countBadge),title:`${e.count} occurrences`,"data-vt-count":e.count,children:[`×`,e.count]})]}),e.description!=null&&/* @__PURE__ */ C(`div`,{className:t(`vt-description`,p?.description),"data-vt-description":``,children:e.description}),(e.action||e.cancel)&&/* @__PURE__ */ w(`div`,{className:t(`vt-actions`,p?.actions),"data-vt-actions":``,children:[Y(e.action,`vt-btn vt-btn-primary`,p?.actionButton),Y(e.cancel,`vt-btn vt-btn-secondary`,p?.cancelButton)]})]}),f===`top-right`&&E]}),l.showProgress&&e.showProgress&&e.status!==`exiting`&&o(e.duration)&&/* @__PURE__ */ C(`div`,{className:t(`vt-progress-track`,p?.progress),style:{height:`${Math.max(1,e.progressHeight??l.progressHeight)}px`},"aria-hidden":`true`,"data-vt-progress":``,"data-vt-progress-position":e.progressPosition??l.progressPosition,children:/* @__PURE__ */ C(`div`,{className:t(`vt-progress-bar`,p?.progressBar),"data-vt-variant":e.variant,style:{animationDuration:`${e.duration}ms`,animationPlayState:e.paused?`paused`:`running`}},`${e.id}-${e.duration}-${e.count}-${e.variant}`)})]})})}),Z=[`top-left`,`top-center`,`top-right`,`bottom-left`,`bottom-center`,`bottom-right`],Q={position:`top-right`,theme:`dark`,duration:4e3,visibleToasts:4,gap:12,offset:20,expand:!1,glass:`frosted`,radius:`md`,size:`default`,ambientGlow:!0,animation:`bounce`,iconAnimation:`default`,progressPosition:`bottom`,progressHeight:3,pauseOnHover:!0,pauseOnFocus:!0,swipeToDismiss:!0,showProgress:!1,closeButton:!0,closeButtonPosition:`floating`,showCloseOnHover:!0,preventDuplicates:!1,richColors:!1,hotkey:[`altKey`,`KeyT`],sound:!0,haptic:!0,dir:`ltr`,containerAriaLabel:`Notifications`,exitDuration:240,store:l};function $(e,t){return t.length>0&&t.every(t=>t===`altKey`||t===`ctrlKey`||t===`metaKey`||t===`shiftKey`?e[t]:e.code===t||e.key.toLowerCase()===t.toLowerCase())}function ee(e){let r={...Q,...n(e)},i=O(),a=M(r.theme),{toasts:o}=N(r.store),[s,c]=b(null),[l,d]=b(null),f=y(/* @__PURE__ */ new Set),p=r.animation===`none`?0:r.exitDuration;g(()=>{r.store.configure({defaultDuration:r.duration,visibleToasts:r.visibleToasts,exitDuration:p,preventDuplicates:r.preventDuplicates,toastOptions:r.toastOptions})},[r.duration,p,r.preventDuplicates,r.store,r.toastOptions,r.visibleToasts]),g(()=>{if(!k())return;let e=()=>document.hidden?r.store.pauseAll(`document-hidden`):r.store.resumeAll(`document-hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[r.store]),g(()=>{if(!k()||r.hotkey.length===0)return;let e=e=>{if(!$(e,r.hotkey))return;let t=document.querySelector(`[data-vt-toast]`);t&&(e.preventDefault(),t.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r.hotkey]),g(()=>{let e=/* @__PURE__ */ new Set;for(let t of o)e.add(t.id),t.status!==`exiting`&&!f.current.has(t.id)&&(f.current.add(t.id),r.onToastShow?.(t),(t.sound??r.sound)&&R(t.variant),(t.haptic??r.haptic)&&z(t.variant));for(let t of f.current)e.has(t)||f.current.delete(t)},[r.haptic,r.onToastShow,r.sound,o]);let m=v(()=>u(r.themeTokens),[r.themeTokens]),h=v(()=>{let e=/* @__PURE__ */ new Map;for(let t of o){let n=t.position??r.position,i=e.get(n);i?i.push(t):e.set(n,[t])}return e},[r.position,o]);if(!i||!k())return null;let _=r.portalContainer??document.body;if(!_)return null;let x=Z.filter(e=>(h.get(e)?.length??0)>0);if(x.length===0)return null;let w=typeof r.offset==`number`?`${r.offset}px`:r.offset;return S(x.map(e=>{let n=[...h.get(e)??[]].reverse(),i=r.expand||s===e||l===e;return/* @__PURE__ */ C(`section`,{"aria-label":r.containerAriaLabel,dir:r.dir,className:t(`vt-toaster`,r.classNames?.toaster,r.className),"data-vt-toaster":``,"data-vt-theme":a,"data-vt-position":e,"data-vt-expanded":J(i),style:{...m,...r.style,"--vt-gap":`${r.gap}px`,"--vt-offset":w},onMouseEnter:()=>c(e),onMouseLeave:()=>c(t=>t===e?null:t),onFocus:()=>d(e),onBlur:t=>{t.relatedTarget&&t.currentTarget.contains(t.relatedTarget)||d(t=>t===e?null:t)},children:/* @__PURE__ */ C(`ol`,{className:t(`vt-list`,r.classNames?.list),"data-vt-list":``,children:n.map((t,a)=>/* @__PURE__ */ C(X,{toast:t,index:a,total:n.length,position:e,expanded:i,store:r.store,cfg:r},t.id))})},e)}),_)}export{d as EMPTY_SNAPSHOT,f as PauseableTimer,a as ToastStore,ee as Toaster,p as createToastApi,e as createToastStore,l as defaultToastStore,R as playToastSound,c as toast,u as tokensToCssVars,z as triggerToastHaptic,O as useMounted,M as useResolvedTheme,N as useToasts};
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- :root{--vt-font-family:"Inter",-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;--vt-width:376px;--vt-radius:18px;--vt-gap:12px;--vt-offset:20px;--vt-z-index-root:9999;--vt-blur:22px;--vt-saturate:185%;--vt-enter-duration:340ms;--vt-exit-duration:240ms;--vt-ease-spring:cubic-bezier(0.22,1,0.36,1);--vt-ease-exit:cubic-bezier(0.4,0,1,1);--vt-success:#34d399;--vt-error:#fb7185;--vt-warning:#fbbf24;--vt-info:#38bdf8;--vt-loading:#a78bfa;--vt-default:#94a3b8}[data-vt-toaster][data-vt-theme="dark"]{--vt-bg:rgba(14,18,30,0.72);--vt-bg-solid:#111625;--vt-bg-sheen:linear-gradient( 140deg,rgba(255,255,255,0.14) 0%,rgba(255,255,255,0.04) 38%,rgba(255,255,255,0.01) 100% );--vt-border:rgba(255,255,255,0.13);--vt-border-hover:rgba(255,255,255,0.22);--vt-specular:rgba(255,255,255,0.18);--vt-text:#f8fafc;--vt-text-muted:rgba(226,232,240,0.78);--vt-shadow:0 24px 48px -18px rgba(2,6,23,0.68),0 10px 24px -10px rgba(2,6,23,0.45),0 1px 0 0 var(--vt-specular) inset;--vt-close-bg:rgba(255,255,255,0.06);--vt-close-bg-hover:rgba(255,255,255,0.14);--vt-close-color:rgba(226,232,240,0.76);--vt-close-color-hover:#ffffff;--vt-btn-primary-bg:rgba(255,255,255,0.92);--vt-btn-primary-text:#0f172a;--vt-btn-primary-bg-hover:#ffffff;--vt-btn-secondary-bg:rgba(255,255,255,0.08);--vt-btn-secondary-text:#e2e8f0;--vt-btn-secondary-bg-hover:rgba(255,255,255,0.15);--vt-progress-track:rgba(255,255,255,0.09);--vt-focus-ring:rgba(56,189,248,0.75);--vt-count-bg:rgba(255,255,255,0.12);--vt-count-text:#f1f5f9}[data-vt-toaster][data-vt-theme="light"]{--vt-bg:rgba(255,255,255,0.76);--vt-bg-solid:#ffffff;--vt-bg-sheen:linear-gradient( 140deg,rgba(255,255,255,0.75) 0%,rgba(241,245,249,0.35) 45%,rgba(255,255,255,0.08) 100% );--vt-border:rgba(15,23,42,0.1);--vt-border-hover:rgba(15,23,42,0.18);--vt-specular:rgba(255,255,255,0.95);--vt-text:#0f172a;--vt-text-muted:#475569;--vt-shadow:0 22px 44px -16px rgba(15,23,42,0.18),0 6px 16px -4px rgba(15,23,42,0.08),0 1px 0 0 var(--vt-specular) inset;--vt-close-bg:rgba(15,23,42,0.05);--vt-close-bg-hover:rgba(15,23,42,0.11);--vt-close-color:#475569;--vt-close-color-hover:#0f172a;--vt-btn-primary-bg:#0f172a;--vt-btn-primary-text:#ffffff;--vt-btn-primary-bg-hover:#1e293b;--vt-btn-secondary-bg:rgba(15,23,42,0.06);--vt-btn-secondary-text:#1e293b;--vt-btn-secondary-bg-hover:rgba(15,23,42,0.12);--vt-progress-track:rgba(15,23,42,0.08);--vt-focus-ring:rgba(14,116,144,0.65);--vt-count-bg:rgba(15,23,42,0.08);--vt-count-text:#0f172a;--vt-success:#059669;--vt-error:#e11d48;--vt-warning:#d97706;--vt-info:#0284c7;--vt-loading:#6366f1}.vt-toaster{position:fixed;z-index:var(--vt-z-index-root);pointer-events:none;box-sizing:border-box;width:min(var(--vt-width),calc(100vw - 24px));font-family:var(--vt-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.vt-toaster *,.vt-toaster *::before,.vt-toaster *::after{box-sizing:border-box}.vt-toaster[data-vt-position="top-left"]{top:var(--vt-offset);left:var(--vt-offset)}.vt-toaster[data-vt-position="top-center"]{top:var(--vt-offset);left:50%;transform:translateX(-50%)}.vt-toaster[data-vt-position="top-right"]{top:var(--vt-offset);right:var(--vt-offset)}.vt-toaster[data-vt-position="bottom-left"]{bottom:var(--vt-offset);left:var(--vt-offset)}.vt-toaster[data-vt-position="bottom-center"]{bottom:var(--vt-offset);left:50%;transform:translateX(-50%)}.vt-toaster[data-vt-position="bottom-right"]{bottom:var(--vt-offset);right:var(--vt-offset)}.vt-list{display:flex;flex-direction:column;gap:var(--vt-gap);margin:0;padding:0;list-style:none;pointer-events:none}.vt-toaster[data-vt-position^="bottom"] .vt-list{flex-direction:column-reverse}.vt-toast-slot{position:relative;z-index:var(--vt-z-index,1);pointer-events:auto;width:100%;transition:transform 260ms var(--vt-ease-spring),opacity 220ms ease}.vt-toaster[data-vt-expanded="false"] .vt-list{gap:0;position:relative}.vt-toaster[data-vt-expanded="false"] .vt-toast-slot{transition:transform 280ms var(--vt-ease-spring),opacity 240ms ease}.vt-toaster[data-vt-expanded="false"] .vt-toast-slot:not([data-vt-front="true"]){position:absolute;inset-inline:0;transform:translateY(calc(var(--vt-index,0) * 10px)) scale(calc(1 - var(--vt-index,0) * 0.045));opacity:calc(1 - var(--vt-index,0) * 0.22)}.vt-toaster[data-vt-expanded="false"][data-vt-position^="bottom"] .vt-toast-slot:not([data-vt-front="true"]){bottom:0;transform:translateY(calc(var(--vt-index,0) * -10px)) scale(calc(1 - var(--vt-index,0) * 0.045))}.vt-toaster[data-vt-expanded="false"][data-vt-position^="top"] .vt-toast-slot:not([data-vt-front="true"]){top:0}.vt-toast{--vt-accent:var(--vt-default);position:relative;isolation:isolate;overflow:hidden;width:100%;border-radius:var(--vt-radius);background-color:var(--vt-bg);background-image:var(--vt-bg-sheen);background-clip:padding-box;-webkit-backdrop-filter:blur(var(--vt-blur)) saturate(var(--vt-saturate));backdrop-filter:blur(var(--vt-blur)) saturate(var(--vt-saturate));border:1px solid var(--vt-border);box-shadow:var(--vt-shadow);color:var(--vt-text);padding:14px 15px;outline:none;touch-action:pan-y;user-select:none;transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0);opacity:var(--vt-swipe-opacity,1);transition:border-color 180ms ease,box-shadow 220ms ease,transform 220ms var(--vt-ease-spring),opacity 180ms ease;animation:vt-enter var(--vt-enter-duration) var(--vt-ease-spring) both}.vt-toast::before{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:radial-gradient( 220px circle at 18px 18px,color-mix(in srgb,var(--vt-accent) 18%,transparent) 0%,transparent 70% );opacity:0.9}.vt-toast::after{content:"";position:absolute;top:0;left:var(--vt-sheen-inset,18px);right:var(--vt-sheen-inset,18px);height:1px;pointer-events:none;background:linear-gradient( 90deg,transparent 0%,color-mix(in srgb,var(--vt-accent) 45%,var(--vt-specular)) 30%,var(--vt-specular) 50%,transparent 100% );opacity:0.7}.vt-toast:hover{border-color:var(--vt-border-hover)}.vt-toast:focus-visible{border-color:var(--vt-focus-ring);box-shadow:var(--vt-shadow),0 0 0 3px color-mix(in srgb,var(--vt-focus-ring) 35%,transparent)}.vt-toast.vt-toast-swiping{transition:none;cursor:grabbing}.vt-toast[data-vt-variant="success"]{--vt-accent:var(--vt-success)}.vt-toast[data-vt-variant="error"]{--vt-accent:var(--vt-error)}.vt-toast[data-vt-variant="warning"]{--vt-accent:var(--vt-warning)}.vt-toast[data-vt-variant="info"]{--vt-accent:var(--vt-info)}.vt-toast[data-vt-variant="loading"]{--vt-accent:var(--vt-loading)}.vt-toast-rich[data-vt-variant="success"],.vt-toast-rich[data-vt-variant="error"],.vt-toast-rich[data-vt-variant="warning"],.vt-toast-rich[data-vt-variant="info"],.vt-toast-rich[data-vt-variant="loading"]{border-color:color-mix(in srgb,var(--vt-accent) 36%,var(--vt-border));background-color:color-mix(in srgb,var(--vt-accent) 13%,var(--vt-bg))}.vt-toast[data-vt-glass="subtle"]{--vt-blur:14px;--vt-saturate:150%;background-color:color-mix(in srgb,var(--vt-bg) 72%,transparent)}.vt-toast[data-vt-glass="crystal"]{--vt-blur:30px;--vt-saturate:215%;border-color:color-mix(in srgb,var(--vt-specular) 42%,var(--vt-border));box-shadow:var(--vt-shadow),0 0 0 1px color-mix(in srgb,var(--vt-specular) 18%,transparent) inset}.vt-toast[data-vt-glass="solid"]{background-color:var(--vt-bg-solid);background-image:none;-webkit-backdrop-filter:none;backdrop-filter:none}.vt-toast[data-vt-radius="sm"]{border-radius:10px;--vt-sheen-inset:12px}.vt-toast[data-vt-radius="md"]{border-radius:14px;--vt-sheen-inset:16px}.vt-toast[data-vt-radius="lg"]{border-radius:var(--vt-radius);--vt-sheen-inset:18px}.vt-toast[data-vt-radius="pill"]{border-radius:28px;--vt-sheen-inset:28px}.vt-toast[data-vt-size="compact"]{padding:10px 12px}.vt-toast[data-vt-size="comfortable"]{padding:18px 19px}.vt-toast[data-vt-glow="false"]::before{opacity:0}.vt-toast.vt-toast-floating-close{overflow:visible}.vt-toast[data-vt-position="top-left"]{--vt-enter-x:-24px;--vt-enter-y:-8px}.vt-toast[data-vt-position="top-center"]{--vt-enter-x:0px;--vt-enter-y:-18px}.vt-toast[data-vt-position="top-right"]{--vt-enter-x:24px;--vt-enter-y:-8px}.vt-toast[data-vt-position="bottom-left"]{--vt-enter-x:-24px;--vt-enter-y:8px}.vt-toast[data-vt-position="bottom-center"]{--vt-enter-x:0px;--vt-enter-y:18px}.vt-toast[data-vt-position="bottom-right"]{--vt-enter-x:24px;--vt-enter-y:8px}.vt-toast[data-vt-animation="slide"]{animation:vt-enter-slide 280ms cubic-bezier(0.16,1,0.3,1) both}.vt-toast[data-vt-animation="fade"]{animation:vt-enter-fade 220ms ease-out both}.vt-toast[data-vt-animation="zoom"]{animation:vt-enter-zoom 300ms var(--vt-ease-spring) both}.vt-toast[data-vt-animation="bounce"]{animation:vt-enter-bounce 460ms cubic-bezier(0.34,1.56,0.64,1) both}.vt-toast[data-vt-animation="none"]{animation:none;transition:none}.vt-toast[data-vt-status="exiting"]{pointer-events:none;animation:vt-exit var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="slide"][data-vt-status="exiting"]{animation:vt-exit-slide var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="fade"][data-vt-status="exiting"]{animation:vt-exit-fade 180ms ease-in forwards}.vt-toast[data-vt-animation="zoom"][data-vt-status="exiting"]{animation:vt-exit-zoom var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="none"][data-vt-status="exiting"]{animation:none;opacity:0}@keyframes vt-enter{0%{opacity:0;transform:translate3d(var(--vt-enter-x,16px),var(--vt-enter-y,0px),0) scale(0.95)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}@keyframes vt-exit{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0) scale(1)}100%{opacity:0;transform:translate3d(var(--vt-enter-x,18px),var(--vt-enter-y,0px),0) scale(0.94)}}@keyframes vt-enter-slide{0%{opacity:0;transform:translate3d( calc(var(--vt-enter-x,24px) * 1.6),calc(var(--vt-enter-y,0px) * 1.4),0 )}100%{opacity:1;transform:translate3d(0,0,0)}}@keyframes vt-exit-slide{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0)}100%{opacity:0;transform:translate3d( calc(var(--vt-enter-x,24px) * 1.8),calc(var(--vt-enter-y,0px) * 1.4),0 )}}@keyframes vt-enter-fade{from{opacity:0}to{opacity:1}}@keyframes vt-exit-fade{from{opacity:var(--vt-swipe-opacity,1)}to{opacity:0}}@keyframes vt-enter-zoom{0%{opacity:0;transform:scale(0.84)}100%{opacity:1;transform:scale(1)}}@keyframes vt-exit-zoom{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0) scale(1)}100%{opacity:0;transform:scale(0.82)}}@keyframes vt-enter-bounce{0%{opacity:0;transform:translate3d(var(--vt-enter-x,20px),var(--vt-enter-y,0px),0) scale(0.88)}60%{opacity:1;transform:translate3d(0,0,0) scale(1.035)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}.vt-body{position:relative;z-index:1;display:flex;align-items:flex-start;gap:12px}.vt-custom-content{position:relative;z-index:1}.vt-icon-badge{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-top:0;border-radius:11px;color:var(--vt-accent);background:linear-gradient( 145deg,color-mix(in srgb,var(--vt-accent) 26%,rgba(255,255,255,0.14)) 0%,color-mix(in srgb,var(--vt-accent) 10%,transparent) 100% );border:1px solid color-mix(in srgb,var(--vt-accent) 34%,rgba(255,255,255,0.12));box-shadow:0 0 22px -4px color-mix(in srgb,var(--vt-accent) 52%,transparent),0 1px 0 0 rgba(255,255,255,0.24) inset;overflow:visible;animation:vt-badge-pop 520ms var(--vt-ease-spring) both}.vt-icon-inner{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px}.vt-icon-pulse{position:absolute;inset:-1px;border-radius:inherit;border:1.5px solid color-mix(in srgb,var(--vt-accent) 72%,#ffffff);pointer-events:none;opacity:0;animation:vt-sonar-ring 780ms cubic-bezier(0.16,1,0.3,1) 70ms both}.vt-icon-badge[data-vt-variant="loading"] .vt-icon-pulse{animation:vt-sonar-breathe 2.2s ease-in-out infinite}.vt-svg{width:21px;height:21px;display:block;overflow:visible}.vt-success-fill{opacity:0;transform-origin:12px 12px;animation:vt-fill-bloom 460ms var(--vt-ease-spring) 80ms both}.vt-success-ring{stroke-dasharray:100;stroke-dashoffset:100;transform-origin:12px 12px;transform:rotate(-90deg);animation:vt-stroke-draw 520ms cubic-bezier(0.32,0.95,0.45,1) 60ms both}.vt-success-check{stroke-dasharray:100;stroke-dashoffset:100;transform-origin:12px 12px;animation:vt-stroke-draw 420ms cubic-bezier(0.22,1,0.36,1) 210ms both,vt-check-bounce 420ms var(--vt-ease-spring) 340ms both}.vt-spark{opacity:0;transform-origin:12px 12px}.vt-spark-1{animation:vt-spark-burst-1 620ms cubic-bezier(0.16,1,0.3,1) 300ms both}.vt-spark-2{animation:vt-spark-burst-2 640ms cubic-bezier(0.16,1,0.3,1) 330ms both}.vt-spark-3{animation:vt-spark-burst-3 620ms cubic-bezier(0.16,1,0.3,1) 360ms both}.vt-spark-4{animation:vt-spark-burst-4 640ms cubic-bezier(0.16,1,0.3,1) 390ms both}.vt-svg-error{transform-origin:12px 12px;animation:vt-error-shake 480ms cubic-bezier(0.36,0.07,0.19,0.97) 290ms both}.vt-error-fill{opacity:0;transform-origin:12px 12px;animation:vt-fill-bloom 420ms var(--vt-ease-spring) 70ms both}.vt-error-frame{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 460ms cubic-bezier(0.25,1,0.5,1) 40ms both}.vt-error-line-1{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 260ms cubic-bezier(0.22,1,0.36,1) 170ms both}.vt-error-line-2{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 260ms cubic-bezier(0.22,1,0.36,1) 250ms both}.vt-svg-warning{transform-origin:12px 13px;animation:vt-warning-wobble 620ms var(--vt-ease-spring) 220ms both}.vt-warning-fill{opacity:0;transform-origin:12px 13px;animation:vt-fill-bloom 440ms var(--vt-ease-spring) 90ms both}.vt-warning-frame{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 520ms cubic-bezier(0.22,1,0.36,1) 50ms both}.vt-warning-stem{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 300ms var(--vt-ease-spring) 230ms both}.vt-warning-dot{transform-origin:12px 16.1px;animation:vt-dot-pop 380ms var(--vt-ease-spring) 340ms both}.vt-info-fill{opacity:0;transform-origin:12px 12px;animation:vt-fill-bloom 440ms var(--vt-ease-spring) 70ms both}.vt-info-ring{stroke-dasharray:100;stroke-dashoffset:100;transform-origin:12px 12px;transform:rotate(-90deg);animation:vt-stroke-draw 480ms cubic-bezier(0.22,1,0.36,1) 50ms both}.vt-info-glint{opacity:0;transform-origin:12px 12px;animation:vt-info-orbit 1100ms cubic-bezier(0.4,0,0.2,1) 280ms both}.vt-info-dot{transform-origin:12px 8.25px;animation:vt-dot-pop 380ms var(--vt-ease-spring) 220ms both}.vt-info-stem{stroke-dasharray:100;stroke-dashoffset:100;animation:vt-stroke-draw 340ms var(--vt-ease-spring) 260ms both}.vt-loader-outer{transform-origin:12px 12px;animation:vt-spin 1.15s linear infinite,vt-orbit-dash 1.65s ease-in-out infinite}.vt-loader-inner{transform-origin:12px 12px;animation:vt-spin-reverse 0.9s linear infinite}.vt-loader-core{transform-origin:12px 12px;animation:vt-core-breathe 1.4s ease-in-out infinite}@keyframes vt-badge-pop{0%{opacity:0;transform:scale(0.62) rotate(-8deg)}65%{opacity:1;transform:scale(1.07) rotate(1.5deg)}100%{opacity:1;transform:scale(1) rotate(0deg)}}@keyframes vt-sonar-ring{0%{opacity:0.7;transform:scale(0.88)}100%{opacity:0;transform:scale(1.52)}}@keyframes vt-sonar-breathe{0%,100%{opacity:0.15;transform:scale(0.98)}50%{opacity:0.45;transform:scale(1.14)}}@keyframes vt-stroke-draw{to{stroke-dashoffset:0}}@keyframes vt-fill-bloom{0%{opacity:0;transform:scale(0.65)}100%{opacity:0.15;transform:scale(1)}}@keyframes vt-check-bounce{0%{transform:scale(1)}45%{transform:scale(1.12)}100%{transform:scale(1)}}@keyframes vt-spark-burst-1{0%{opacity:0;transform:translate(3px,3px) scale(0.2)}35%{opacity:0.95;transform:translate(-1.5px,-1.5px) scale(1.1)}100%{opacity:0;transform:translate(-3.5px,-3.5px) scale(0.3)}}@keyframes vt-spark-burst-2{0%{opacity:0;transform:translate(-3px,3px) scale(0.2)}35%{opacity:0.95;transform:translate(1.5px,-1.5px) scale(1.1)}100%{opacity:0;transform:translate(3.5px,-3.5px) scale(0.3)}}@keyframes vt-spark-burst-3{0%{opacity:0;transform:translate(-3px,-3px) scale(0.2)}35%{opacity:0.9;transform:translate(1.5px,1.5px) scale(1.05)}100%{opacity:0;transform:translate(3.2px,3.2px) scale(0.3)}}@keyframes vt-spark-burst-4{0%{opacity:0;transform:translate(3px,-3px) scale(0.2)}35%{opacity:0.9;transform:translate(-1.5px,1.5px) scale(1.05)}100%{opacity:0;transform:translate(-3.2px,3.2px) scale(0.3)}}@keyframes vt-error-shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-2.2px) rotate(-3deg)}45%{transform:translateX(2px) rotate(2.5deg)}70%{transform:translateX(-1.1px) rotate(-1.2deg)}88%{transform:translateX(0.6px) rotate(0.5deg)}}@keyframes vt-warning-wobble{0%,100%{transform:rotate(0deg) scale(1)}25%{transform:rotate(-6deg) scale(1.05)}55%{transform:rotate(4.5deg) scale(1.02)}80%{transform:rotate(-2deg) scale(1)}}@keyframes vt-dot-pop{0%{opacity:0;transform:scale(0)}65%{opacity:1;transform:scale(1.3)}100%{opacity:1;transform:scale(1)}}@keyframes vt-info-orbit{0%{opacity:0;transform:rotate(-90deg)}20%{opacity:0.85}80%{opacity:0.6}100%{opacity:0;transform:rotate(270deg)}}@keyframes vt-spin{to{transform:rotate(360deg)}}@keyframes vt-spin-reverse{to{transform:rotate(-360deg)}}@keyframes vt-orbit-dash{0%{stroke-dasharray:18 82;stroke-dashoffset:0}50%{stroke-dasharray:64 36;stroke-dashoffset:-18}100%{stroke-dasharray:18 82;stroke-dashoffset:-100}}@keyframes vt-core-breathe{0%,100%{opacity:0.55;transform:scale(0.78)}50%{opacity:1;transform:scale(1.18)}}.vt-content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:3px}.vt-header{display:flex;align-items:center;gap:8px}.vt-title{font-size:0.895rem;font-weight:600;line-height:1.38;letter-spacing:-0.011em;color:var(--vt-text);word-break:break-word}.vt-count-badge{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:999px;font-size:0.72rem;font-weight:600;line-height:1.4;background:var(--vt-count-bg);color:var(--vt-count-text)}.vt-description{font-size:0.815rem;line-height:1.45;color:var(--vt-text-muted);word-break:break-word}.vt-toast[data-vt-size="compact"] .vt-title{font-size:0.835rem}.vt-toast[data-vt-size="compact"] .vt-description{font-size:0.765rem}.vt-toast[data-vt-size="compact"] .vt-icon-badge{width:28px;height:28px;border-radius:9px}.vt-toast[data-vt-size="comfortable"] .vt-title{font-size:0.96rem}.vt-toast[data-vt-size="comfortable"] .vt-description{font-size:0.86rem}.vt-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}.vt-btn{appearance:none;border:none;border-radius:9px;padding:5px 11px;font-family:inherit;font-size:0.78rem;font-weight:600;line-height:1.35;cursor:pointer;transition:background-color 150ms ease,transform 120ms ease,box-shadow 150ms ease}.vt-btn:active{transform:scale(0.97)}.vt-btn:focus-visible{outline:2px solid var(--vt-focus-ring);outline-offset:2px}.vt-btn-primary{background:var(--vt-btn-primary-bg);color:var(--vt-btn-primary-text)}.vt-btn-primary:hover{background:var(--vt-btn-primary-bg-hover)}.vt-btn-secondary{background:var(--vt-btn-secondary-bg);color:var(--vt-btn-secondary-text)}.vt-btn-secondary:hover{background:var(--vt-btn-secondary-bg-hover)}.vt-close{flex:0 0 auto;appearance:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;margin:-2px -3px 0 0;border:1px solid transparent;border-radius:8px;background:var(--vt-close-bg);color:var(--vt-close-color);cursor:pointer;transition:background-color 150ms ease,color 150ms ease,opacity 160ms ease,transform 120ms ease}.vt-close.vt-close-left{margin:-2px 0 0 -3px}.vt-close.vt-close-floating{position:absolute;top:-9px;right:-9px;z-index:4;margin:0;width:24px;height:24px;border-radius:999px;background:var(--vt-bg-solid);border:1px solid var(--vt-border);box-shadow:0 4px 12px rgba(2,6,23,0.28)}.vt-close.vt-close-hover-only{opacity:0;transform:scale(0.88)}.vt-toast:hover .vt-close.vt-close-hover-only,.vt-toast:focus-within .vt-close.vt-close-hover-only{opacity:1;transform:scale(1)}.vt-close:hover{background:var(--vt-close-bg-hover);color:var(--vt-close-color-hover)}.vt-close:active{transform:scale(0.94)}.vt-close:focus-visible{outline:2px solid var(--vt-focus-ring);outline-offset:2px}.vt-close-svg{width:14px;height:14px;display:block}.vt-icon-badge[data-vt-icon-animation="subtle"]{animation:vt-enter-fade 220ms ease-out both}.vt-icon-badge[data-vt-icon-animation="subtle"] .vt-icon-pulse,.vt-icon-badge[data-vt-icon-animation="subtle"] .vt-spark,.vt-icon-badge[data-vt-icon-animation="subtle"] .vt-info-glint{animation:none;opacity:0}.vt-icon-badge[data-vt-icon-animation="subtle"] .vt-svg-error,.vt-icon-badge[data-vt-icon-animation="subtle"] .vt-svg-warning{animation:none}.vt-icon-badge[data-vt-icon-animation="none"],.vt-icon-badge[data-vt-icon-animation="none"] .vt-svg-error,.vt-icon-badge[data-vt-icon-animation="none"] .vt-svg-warning,.vt-icon-badge[data-vt-icon-animation="none"] .vt-success-check,.vt-icon-badge[data-vt-icon-animation="none"] .vt-success-ring,.vt-icon-badge[data-vt-icon-animation="none"] .vt-error-frame,.vt-icon-badge[data-vt-icon-animation="none"] .vt-error-line-1,.vt-icon-badge[data-vt-icon-animation="none"] .vt-error-line-2,.vt-icon-badge[data-vt-icon-animation="none"] .vt-warning-frame,.vt-icon-badge[data-vt-icon-animation="none"] .vt-warning-stem,.vt-icon-badge[data-vt-icon-animation="none"] .vt-warning-dot,.vt-icon-badge[data-vt-icon-animation="none"] .vt-info-ring,.vt-icon-badge[data-vt-icon-animation="none"] .vt-info-dot,.vt-icon-badge[data-vt-icon-animation="none"] .vt-info-stem,.vt-icon-badge[data-vt-icon-animation="none"] .vt-loader-inner,.vt-icon-badge[data-vt-icon-animation="none"] .vt-loader-core{animation:none;stroke-dashoffset:0}.vt-icon-badge[data-vt-icon-animation="none"] .vt-success-fill,.vt-icon-badge[data-vt-icon-animation="none"] .vt-error-fill,.vt-icon-badge[data-vt-icon-animation="none"] .vt-warning-fill,.vt-icon-badge[data-vt-icon-animation="none"] .vt-info-fill{animation:none;opacity:0.15}.vt-icon-badge[data-vt-icon-animation="none"] .vt-icon-pulse,.vt-icon-badge[data-vt-icon-animation="none"] .vt-spark,.vt-icon-badge[data-vt-icon-animation="none"] .vt-info-glint{animation:none;opacity:0}.vt-progress-track{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--vt-progress-track);overflow:hidden;pointer-events:none}.vt-progress-track[data-vt-progress-position="top"]{top:0;bottom:auto}.vt-toast.vt-toast-floating-close .vt-progress-track{left:var(--vt-sheen-inset,14px);right:var(--vt-sheen-inset,14px);bottom:2px;border-radius:999px}.vt-toast.vt-toast-floating-close .vt-progress-track[data-vt-progress-position="top"]{top:2px;bottom:auto}.vt-progress-bar{width:100%;height:100%;transform-origin:left center;background:linear-gradient( 90deg,var(--vt-accent) 0%,color-mix(in srgb,var(--vt-accent) 68%,#ffffff) 100% );animation-name:vt-progress-shrink;animation-timing-function:linear;animation-fill-mode:forwards;will-change:transform}[dir="rtl"] .vt-progress-bar{transform-origin:right center}@keyframes vt-progress-shrink{from{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-transparency:reduce){.vt-toast{background-color:var(--vt-bg-solid);background-image:none;-webkit-backdrop-filter:none;backdrop-filter:none}.vt-toast::before{opacity:0.25}}@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.vt-toast{background-color:var(--vt-bg-solid)}}@media(prefers-reduced-motion:reduce){.vt-toast{animation-name:vt-fade-in;animation-duration:140ms;transition:opacity 140ms ease}.vt-toast[data-vt-status="exiting"]{animation-name:vt-fade-out;animation-duration:120ms}.vt-toast-slot{transition:opacity 140ms ease}.vt-icon-badge,.vt-svg-error,.vt-svg-warning,.vt-success-check,.vt-success-ring,.vt-error-frame,.vt-error-line-1,.vt-error-line-2,.vt-warning-frame,.vt-warning-stem,.vt-warning-dot,.vt-info-ring,.vt-info-dot,.vt-info-stem{animation:none;stroke-dashoffset:0}.vt-success-fill,.vt-error-fill,.vt-warning-fill,.vt-info-fill{animation:none;opacity:0.15}.vt-icon-pulse,.vt-spark,.vt-info-glint{animation:none;opacity:0}.vt-loader-outer{animation:vt-spin 2.2s linear infinite;stroke-dasharray:55 45}.vt-loader-inner,.vt-loader-core{animation:none}@keyframes vt-fade-in{from{opacity:0}to{opacity:1}}@keyframes vt-fade-out{from{opacity:1}to{opacity:0}}}@media(max-width:640px){.vt-toaster[data-vt-position]{width:calc(100vw - 24px);left:12px;right:12px;transform:none}.vt-toaster[data-vt-position^="top"]{top:max(12px,env(safe-area-inset-top))}.vt-toaster[data-vt-position^="bottom"]{bottom:max(12px,env(safe-area-inset-bottom))}}
1
+ :root{--vt-font-family:"Inter",-apple-system,BlinkMacSystemFont,"SF Pro Text","Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;--vt-width:376px;--vt-radius:18px;--vt-gap:12px;--vt-offset:20px;--vt-z-index-root:9999;--vt-blur:22px;--vt-saturate:185%;--vt-enter-duration:340ms;--vt-exit-duration:240ms;--vt-ease-spring:cubic-bezier(.22,1,.36,1);--vt-ease-exit:cubic-bezier(.4,0,1,1);--vt-success:#34d399;--vt-error:#fb7185;--vt-warning:#fbbf24;--vt-info:#38bdf8;--vt-loading:#a78bfa;--vt-default:#94a3b8}[data-vt-toaster][data-vt-theme="dark"]{--vt-bg:rgba(14,18,30,.72);--vt-bg-solid:#111625;--vt-bg-sheen:linear-gradient( 140deg,rgba(255,255,255,.14) 0%,rgba(255,255,255,.04) 38%,rgba(255,255,255,.01) 100% );--vt-border:rgba(255,255,255,.13);--vt-border-hover:rgba(255,255,255,.22);--vt-specular:rgba(255,255,255,.18);--vt-text:#f8fafc;--vt-text-muted:rgba(226,232,240,.78);--vt-shadow:0 24px 48px -18px rgba(2,6,23,.68),0 10px 24px -10px rgba(2,6,23,.45),0 1px 0 0 var(--vt-specular) inset;--vt-close-bg:rgba(255,255,255,.06);--vt-close-bg-hover:rgba(255,255,255,.14);--vt-close-color:rgba(226,232,240,.76);--vt-close-color-hover:#fff;--vt-btn-primary-bg:rgba(255,255,255,.92);--vt-btn-primary-text:#0f172a;--vt-btn-primary-bg-hover:#fff;--vt-btn-secondary-bg:rgba(255,255,255,.08);--vt-btn-secondary-text:#e2e8f0;--vt-btn-secondary-bg-hover:rgba(255,255,255,.15);--vt-progress-track:rgba(255,255,255,.09);--vt-focus-ring:rgba(56,189,248,.75);--vt-count-bg:rgba(255,255,255,.12);--vt-count-text:#f1f5f9}[data-vt-toaster][data-vt-theme="light"]{--vt-bg:rgba(255,255,255,.76);--vt-bg-solid:#fff;--vt-bg-sheen:linear-gradient( 140deg,rgba(255,255,255,.75) 0%,rgba(241,245,249,.35) 45%,rgba(255,255,255,.08) 100% );--vt-border:rgba(15,23,42,.1);--vt-border-hover:rgba(15,23,42,.18);--vt-specular:rgba(255,255,255,.95);--vt-text:#0f172a;--vt-text-muted:#475569;--vt-shadow:0 22px 44px -16px rgba(15,23,42,.18),0 6px 16px -4px rgba(15,23,42,.08),0 1px 0 0 var(--vt-specular) inset;--vt-close-bg:rgba(15,23,42,.05);--vt-close-bg-hover:rgba(15,23,42,.11);--vt-close-color:#475569;--vt-close-color-hover:#0f172a;--vt-btn-primary-bg:#0f172a;--vt-btn-primary-text:#fff;--vt-btn-primary-bg-hover:#1e293b;--vt-btn-secondary-bg:rgba(15,23,42,.06);--vt-btn-secondary-text:#1e293b;--vt-btn-secondary-bg-hover:rgba(15,23,42,.12);--vt-progress-track:rgba(15,23,42,.08);--vt-focus-ring:rgba(14,116,144,.65);--vt-count-bg:rgba(15,23,42,.08);--vt-count-text:#0f172a;--vt-success:#059669;--vt-error:#e11d48;--vt-warning:#d97706;--vt-info:#0284c7;--vt-loading:#6366f1}.vt-toaster{position:fixed;z-index:var(--vt-z-index-root);pointer-events:none;box-sizing:border-box;width:min(var(--vt-width),calc(100vw - 24px));font-family:var(--vt-font-family);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.vt-toaster *,.vt-toaster *::before,.vt-toaster *::after{box-sizing:border-box}.vt-toaster[data-vt-position="top-left"]{top:var(--vt-offset);left:var(--vt-offset)}.vt-toaster[data-vt-position="top-center"]{top:var(--vt-offset);left:50%;transform:translateX(-50%)}.vt-toaster[data-vt-position="top-right"]{top:var(--vt-offset);right:var(--vt-offset)}.vt-toaster[data-vt-position="bottom-left"]{bottom:var(--vt-offset);left:var(--vt-offset)}.vt-toaster[data-vt-position="bottom-center"]{bottom:var(--vt-offset);left:50%;transform:translateX(-50%)}.vt-toaster[data-vt-position="bottom-right"]{bottom:var(--vt-offset);right:var(--vt-offset)}.vt-list{display:flex;flex-direction:column;gap:var(--vt-gap);margin:0;padding:0;list-style:none;pointer-events:none}.vt-toaster[data-vt-position^="bottom"] .vt-list{flex-direction:column-reverse}.vt-toast-slot{position:relative;z-index:var(--vt-z-index,1);pointer-events:auto;width:100%;transition:transform 260ms var(--vt-ease-spring),opacity 220ms ease}.vt-toaster[data-vt-expanded="false"] .vt-list{gap:0;position:relative}.vt-toaster[data-vt-expanded="false"] .vt-toast-slot{transition:transform 280ms var(--vt-ease-spring),opacity 240ms ease}.vt-toaster[data-vt-expanded="false"] .vt-toast-slot:not([data-vt-front="true"]){position:absolute;inset-inline:0;transform:translateY(calc(var(--vt-index,0) * 10px)) scale(calc(1 - var(--vt-index,0) * .045));opacity:calc(1 - var(--vt-index,0) * .22)}.vt-toaster[data-vt-expanded="false"][data-vt-position^="bottom"] .vt-toast-slot:not([data-vt-front="true"]){bottom:0;transform:translateY(calc(var(--vt-index,0) * -10px)) scale(calc(1 - var(--vt-index,0) * .045))}.vt-toaster[data-vt-expanded="false"][data-vt-position^="top"] .vt-toast-slot:not([data-vt-front="true"]){top:0}.vt-toast{--vt-accent:var(--vt-default);position:relative;isolation:isolate;overflow:hidden;width:100%;border-radius:var(--vt-radius);background-color:var(--vt-bg);background-image:var(--vt-bg-sheen);background-clip:padding-box;-webkit-backdrop-filter:blur(var(--vt-blur)) saturate(var(--vt-saturate));backdrop-filter:blur(var(--vt-blur)) saturate(var(--vt-saturate));border:1px solid var(--vt-border);box-shadow:var(--vt-shadow);color:var(--vt-text);padding:14px 15px;outline:none;touch-action:pan-y;user-select:none;transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0);opacity:var(--vt-swipe-opacity,1);transition:border-color 180ms ease,box-shadow 220ms ease,transform 220ms var(--vt-ease-spring),opacity 180ms ease;animation:vt-enter var(--vt-enter-duration) var(--vt-ease-spring) both}.vt-toast::before{content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:radial-gradient( 220px circle at 18px 18px,color-mix(in srgb,var(--vt-accent) 18%,transparent) 0%,transparent 70% );opacity:.9}.vt-toast::after{content:"";position:absolute;top:0;left:var(--vt-sheen-inset,18px);right:var(--vt-sheen-inset,18px);height:1px;pointer-events:none;background:linear-gradient( 90deg,transparent 0%,color-mix(in srgb,var(--vt-accent) 45%,var(--vt-specular)) 30%,var(--vt-specular) 50%,transparent 100% );opacity:.7}.vt-toast:hover{border-color:var(--vt-border-hover)}.vt-toast:focus-visible{border-color:var(--vt-focus-ring);box-shadow:var(--vt-shadow),0 0 0 3px color-mix(in srgb,var(--vt-focus-ring) 35%,transparent)}.vt-toast.vt-toast-swiping{transition:none;cursor:grabbing}.vt-toast[data-vt-variant="success"]{--vt-accent:var(--vt-success)}.vt-toast[data-vt-variant="error"]{--vt-accent:var(--vt-error)}.vt-toast[data-vt-variant="warning"]{--vt-accent:var(--vt-warning)}.vt-toast[data-vt-variant="info"]{--vt-accent:var(--vt-info)}.vt-toast[data-vt-variant="loading"]{--vt-accent:var(--vt-loading)}.vt-toast-rich:not([data-vt-variant="default"]):not([data-vt-variant="custom"]){border-color:color-mix(in srgb,var(--vt-accent) 36%,var(--vt-border));background-color:color-mix(in srgb,var(--vt-accent) 13%,var(--vt-bg))}.vt-toast[data-vt-glass="subtle"]{--vt-blur:14px;--vt-saturate:150%;background-color:color-mix(in srgb,var(--vt-bg) 72%,transparent)}.vt-toast[data-vt-glass="crystal"]{--vt-blur:30px;--vt-saturate:215%;border-color:color-mix(in srgb,var(--vt-specular) 42%,var(--vt-border));box-shadow:var(--vt-shadow),0 0 0 1px color-mix(in srgb,var(--vt-specular) 18%,transparent) inset}.vt-toast[data-vt-glass="solid"]{background-color:var(--vt-bg-solid);background-image:none;-webkit-backdrop-filter:none;backdrop-filter:none}.vt-toast[data-vt-radius="sm"]{border-radius:10px;--vt-sheen-inset:12px}.vt-toast[data-vt-radius="md"]{border-radius:14px;--vt-sheen-inset:16px}.vt-toast[data-vt-radius="lg"]{border-radius:var(--vt-radius);--vt-sheen-inset:18px}.vt-toast[data-vt-radius="pill"]{border-radius:28px;--vt-sheen-inset:28px}.vt-toast[data-vt-size="compact"]{padding:10px 12px}.vt-toast[data-vt-size="comfortable"]{padding:18px 19px}.vt-toast[data-vt-glow="false"]::before{opacity:0}.vt-toast.vt-toast-floating-close{overflow:visible}.vt-toast[data-vt-position="top-left"]{--vt-enter-x:-24px;--vt-enter-y:-8px}.vt-toast[data-vt-position="top-center"]{--vt-enter-x:0px;--vt-enter-y:-18px}.vt-toast[data-vt-position="top-right"]{--vt-enter-x:24px;--vt-enter-y:-8px}.vt-toast[data-vt-position="bottom-left"]{--vt-enter-x:-24px;--vt-enter-y:8px}.vt-toast[data-vt-position="bottom-center"]{--vt-enter-x:0px;--vt-enter-y:18px}.vt-toast[data-vt-position="bottom-right"]{--vt-enter-x:24px;--vt-enter-y:8px}.vt-toast[data-vt-animation="slide"]{animation:vt-enter-slide 280ms cubic-bezier(.16,1,.3,1) both}.vt-toast[data-vt-animation="fade"]{animation:vt-enter-fade 220ms ease-out both}.vt-toast[data-vt-animation="zoom"]{animation:vt-enter-zoom 300ms var(--vt-ease-spring) both}.vt-toast[data-vt-animation="bounce"]{animation:vt-enter-bounce 460ms cubic-bezier(.34,1.56,.64,1) both}.vt-toast[data-vt-animation="none"]{animation:none;transition:none}.vt-toast[data-vt-status="exiting"]{pointer-events:none;animation:vt-exit var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="slide"][data-vt-status="exiting"]{animation:vt-exit-slide var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="fade"][data-vt-status="exiting"]{animation:vt-exit-fade 180ms ease-in forwards}.vt-toast[data-vt-animation="zoom"][data-vt-status="exiting"]{animation:vt-exit-zoom var(--vt-exit-duration) var(--vt-ease-exit) forwards}.vt-toast[data-vt-animation="none"][data-vt-status="exiting"]{animation:none;opacity:0}@keyframes vt-enter{0%{opacity:0;transform:translate3d(var(--vt-enter-x,16px),var(--vt-enter-y,0px),0) scale(.95)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}@keyframes vt-exit{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0) scale(1)}100%{opacity:0;transform:translate3d(var(--vt-enter-x,18px),var(--vt-enter-y,0px),0) scale(.94)}}@keyframes vt-enter-slide{0%{opacity:0;transform:translate3d( calc(var(--vt-enter-x,24px) * 1.6),calc(var(--vt-enter-y,0px) * 1.4),0 )}100%{opacity:1;transform:translate3d(0,0,0)}}@keyframes vt-exit-slide{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0)}100%{opacity:0;transform:translate3d( calc(var(--vt-enter-x,24px) * 1.8),calc(var(--vt-enter-y,0px) * 1.4),0 )}}@keyframes vt-enter-fade{from{opacity:0}to{opacity:1}}@keyframes vt-exit-fade{from{opacity:var(--vt-swipe-opacity,1)}to{opacity:0}}@keyframes vt-enter-zoom{0%{opacity:0;transform:scale(.84)}100%{opacity:1;transform:scale(1)}}@keyframes vt-exit-zoom{0%{opacity:var(--vt-swipe-opacity,1);transform:translate3d(var(--vt-swipe-x,0px),var(--vt-swipe-y,0px),0) scale(1)}100%{opacity:0;transform:scale(.82)}}@keyframes vt-enter-bounce{0%{opacity:0;transform:translate3d(var(--vt-enter-x,20px),var(--vt-enter-y,0px),0) scale(.88)}60%{opacity:1;transform:translate3d(0,0,0) scale(1.035)}100%{opacity:1;transform:translate3d(0,0,0) scale(1)}}.vt-body{position:relative;z-index:1;display:flex;align-items:flex-start;gap:12px}.vt-custom-content{position:relative;z-index:1}.vt-icon-badge{position:relative;flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;margin-top:0;border-radius:11px;color:var(--vt-accent);background:linear-gradient( 145deg,color-mix(in srgb,var(--vt-accent) 26%,rgba(255,255,255,.14)) 0%,color-mix(in srgb,var(--vt-accent) 10%,transparent) 100% );border:1px solid color-mix(in srgb,var(--vt-accent) 34%,rgba(255,255,255,.12));box-shadow:0 0 22px -4px color-mix(in srgb,var(--vt-accent) 52%,transparent),0 1px 0 0 rgba(255,255,255,.24) inset;overflow:visible;animation:vt-badge-pop 520ms var(--vt-ease-spring) both}.vt-icon-inner{position:relative;z-index:2;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px}.vt-icon-pulse{position:absolute;inset:-1px;border-radius:inherit;border:1.5px solid color-mix(in srgb,var(--vt-accent) 72%,#fff);pointer-events:none;opacity:0;animation:vt-sonar-ring 780ms cubic-bezier(.16,1,.3,1) 70ms both}.vt-icon-badge[data-vt-variant="loading"] .vt-icon-pulse{animation:vt-sonar-breathe 2.2s ease-in-out infinite}.vt-svg{width:21px;height:21px;display:block;overflow:visible}.vt-success-fill,.vt-error-fill,.vt-warning-fill,.vt-info-fill,.vt-spark,.vt-info-glint{opacity:0}.vt-success-fill,.vt-success-ring,.vt-success-check,.vt-spark,.vt-svg-error,.vt-error-fill,.vt-info-fill,.vt-info-ring,.vt-info-glint,.vt-loader-outer,.vt-loader-inner,.vt-loader-core{transform-origin:12px 12px}.vt-success-ring,.vt-success-check,.vt-error-frame,.vt-error-line-1,.vt-error-line-2,.vt-warning-frame,.vt-warning-stem,.vt-info-ring,.vt-info-stem{stroke-dasharray:100;stroke-dashoffset:100}.vt-success-fill{animation:vt-fill-bloom 460ms var(--vt-ease-spring) 80ms both}.vt-success-ring{transform:rotate(-90deg);animation:vt-stroke-draw 520ms cubic-bezier(.32,.95,.45,1) 60ms both}.vt-success-check{animation:vt-stroke-draw 420ms cubic-bezier(.22,1,.36,1) 210ms both,vt-check-bounce 420ms var(--vt-ease-spring) 340ms both}.vt-spark-1{--sx:-1;--sy:-1;animation:vt-spark-burst 620ms cubic-bezier(.16,1,.3,1) 300ms both}.vt-spark-2{--sx:1;--sy:-1;animation:vt-spark-burst 640ms cubic-bezier(.16,1,.3,1) 330ms both}.vt-spark-3{--sx:1;--sy:1;animation:vt-spark-burst 620ms cubic-bezier(.16,1,.3,1) 360ms both}.vt-spark-4{--sx:-1;--sy:1;animation:vt-spark-burst 640ms cubic-bezier(.16,1,.3,1) 390ms both}.vt-svg-error{animation:vt-error-shake 480ms cubic-bezier(.36,.07,.19,.97) 290ms both}.vt-error-fill{animation:vt-fill-bloom 420ms var(--vt-ease-spring) 70ms both}.vt-error-frame{animation:vt-stroke-draw 460ms cubic-bezier(.25,1,.5,1) 40ms both}.vt-error-line-1{animation:vt-stroke-draw 260ms cubic-bezier(.22,1,.36,1) 170ms both}.vt-error-line-2{animation:vt-stroke-draw 260ms cubic-bezier(.22,1,.36,1) 250ms both}.vt-svg-warning,.vt-warning-fill{transform-origin:12px 13px}.vt-svg-warning{animation:vt-warning-wobble 620ms var(--vt-ease-spring) 220ms both}.vt-warning-fill{animation:vt-fill-bloom 440ms var(--vt-ease-spring) 90ms both}.vt-warning-frame{animation:vt-stroke-draw 520ms cubic-bezier(.22,1,.36,1) 50ms both}.vt-warning-stem{animation:vt-stroke-draw 300ms var(--vt-ease-spring) 230ms both}.vt-warning-dot{transform-origin:12px 16.1px;animation:vt-dot-pop 380ms var(--vt-ease-spring) 340ms both}.vt-info-fill{animation:vt-fill-bloom 440ms var(--vt-ease-spring) 70ms both}.vt-info-ring{transform:rotate(-90deg);animation:vt-stroke-draw 480ms cubic-bezier(.22,1,.36,1) 50ms both}.vt-info-glint{animation:vt-info-orbit 1100ms cubic-bezier(.4,0,.2,1) 280ms both}.vt-info-dot{transform-origin:12px 8.25px;animation:vt-dot-pop 380ms var(--vt-ease-spring) 220ms both}.vt-info-stem{animation:vt-stroke-draw 340ms var(--vt-ease-spring) 260ms both}.vt-loader-outer{animation:vt-spin 1.15s linear infinite,vt-orbit-dash 1.65s ease-in-out infinite}.vt-loader-inner{animation:vt-spin-reverse .9s linear infinite}.vt-loader-core{animation:vt-core-breathe 1.4s ease-in-out infinite}@keyframes vt-badge-pop{0%{opacity:0;transform:scale(.62) rotate(-8deg)}65%{opacity:1;transform:scale(1.07) rotate(1.5deg)}100%{opacity:1;transform:scale(1) rotate(0deg)}}@keyframes vt-sonar-ring{0%{opacity:.7;transform:scale(.88)}100%{opacity:0;transform:scale(1.52)}}@keyframes vt-sonar-breathe{0%,100%{opacity:.15;transform:scale(.98)}50%{opacity:.45;transform:scale(1.14)}}@keyframes vt-stroke-draw{to{stroke-dashoffset:0}}@keyframes vt-fill-bloom{0%{opacity:0;transform:scale(.65)}100%{opacity:.15;transform:scale(1)}}@keyframes vt-check-bounce{0%{transform:scale(1)}45%{transform:scale(1.12)}100%{transform:scale(1)}}@keyframes vt-spark-burst{0%{opacity:0;transform:translate(calc(var(--sx) * -3px),calc(var(--sy) * -3px)) scale(.2)}35%{opacity:.92;transform:translate(calc(var(--sx) * 1.5px),calc(var(--sy) * 1.5px)) scale(1.08)}100%{opacity:0;transform:translate(calc(var(--sx) * 3.4px),calc(var(--sy) * 3.4px)) scale(.3)}}@keyframes vt-error-shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-2.2px) rotate(-3deg)}45%{transform:translateX(2px) rotate(2.5deg)}70%{transform:translateX(-1.1px) rotate(-1.2deg)}88%{transform:translateX(.6px) rotate(.5deg)}}@keyframes vt-warning-wobble{0%,100%{transform:rotate(0deg) scale(1)}25%{transform:rotate(-6deg) scale(1.05)}55%{transform:rotate(4.5deg) scale(1.02)}80%{transform:rotate(-2deg) scale(1)}}@keyframes vt-dot-pop{0%{opacity:0;transform:scale(0)}65%{opacity:1;transform:scale(1.3)}100%{opacity:1;transform:scale(1)}}@keyframes vt-info-orbit{0%{opacity:0;transform:rotate(-90deg)}20%{opacity:.85}80%{opacity:.6}100%{opacity:0;transform:rotate(270deg)}}@keyframes vt-spin{to{transform:rotate(360deg)}}@keyframes vt-spin-reverse{to{transform:rotate(-360deg)}}@keyframes vt-orbit-dash{0%{stroke-dasharray:18 82;stroke-dashoffset:0}50%{stroke-dasharray:64 36;stroke-dashoffset:-18}100%{stroke-dasharray:18 82;stroke-dashoffset:-100}}@keyframes vt-core-breathe{0%,100%{opacity:.55;transform:scale(.78)}50%{opacity:1;transform:scale(1.18)}}.vt-content{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:3px}.vt-header{display:flex;align-items:center;gap:8px}.vt-title{font-size:.895rem;font-weight:600;line-height:1.38;letter-spacing:-0.011em;color:var(--vt-text);word-break:break-word}.vt-count-badge{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;padding:1px 6px;border-radius:999px;font-size:.72rem;font-weight:600;line-height:1.4;background:var(--vt-count-bg);color:var(--vt-count-text)}.vt-description{font-size:.815rem;line-height:1.45;color:var(--vt-text-muted);word-break:break-word}.vt-toast[data-vt-size="compact"] .vt-title{font-size:.835rem}.vt-toast[data-vt-size="compact"] .vt-description{font-size:.765rem}.vt-toast[data-vt-size="compact"] .vt-icon-badge{width:28px;height:28px;border-radius:9px}.vt-toast[data-vt-size="comfortable"] .vt-title{font-size:.96rem}.vt-toast[data-vt-size="comfortable"] .vt-description{font-size:.86rem}.vt-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}.vt-btn{appearance:none;border:none;border-radius:9px;padding:5px 11px;font-family:inherit;font-size:.78rem;font-weight:600;line-height:1.35;cursor:pointer;transition:background-color 150ms ease,transform 120ms ease,box-shadow 150ms ease}.vt-btn:active{transform:scale(.97)}.vt-btn:focus-visible{outline:2px solid var(--vt-focus-ring);outline-offset:2px}.vt-btn-primary{background:var(--vt-btn-primary-bg);color:var(--vt-btn-primary-text)}.vt-btn-primary:hover{background:var(--vt-btn-primary-bg-hover)}.vt-btn-secondary{background:var(--vt-btn-secondary-bg);color:var(--vt-btn-secondary-text)}.vt-btn-secondary:hover{background:var(--vt-btn-secondary-bg-hover)}.vt-close{flex:0 0 auto;appearance:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;margin:-2px -3px 0 0;border:1px solid transparent;border-radius:8px;background:var(--vt-close-bg);color:var(--vt-close-color);cursor:pointer;transition:background-color 150ms ease,color 150ms ease,opacity 160ms ease,transform 120ms ease}.vt-close.vt-close-left{margin:-2px 0 0 -3px}.vt-close.vt-close-floating{position:absolute;top:-9px;right:-9px;z-index:4;margin:0;width:24px;height:24px;border-radius:999px;background:var(--vt-bg-solid);border:1px solid var(--vt-border);box-shadow:0 4px 12px rgba(2,6,23,.28)}.vt-close.vt-close-hover-only{opacity:0;transform:scale(.88)}.vt-toast:hover .vt-close.vt-close-hover-only,.vt-toast:focus-within .vt-close.vt-close-hover-only{opacity:1;transform:scale(1)}.vt-close:hover{background:var(--vt-close-bg-hover);color:var(--vt-close-color-hover)}.vt-close:active{transform:scale(.94)}.vt-close:focus-visible{outline:2px solid var(--vt-focus-ring);outline-offset:2px}.vt-close-svg{width:14px;height:14px;display:block}.vt-icon-badge[data-vt-icon-animation="subtle"]{animation:vt-enter-fade 220ms ease-out both}.vt-icon-badge[data-vt-icon-animation="subtle"]:is(.vt-icon-pulse,.vt-spark,.vt-info-glint),.vt-icon-badge[data-vt-icon-animation="none"]:is(.vt-icon-pulse,.vt-spark,.vt-info-glint){animation:none;opacity:0}.vt-icon-badge[data-vt-icon-animation="subtle"]:is(.vt-svg-error,.vt-svg-warning){animation:none}.vt-icon-badge[data-vt-icon-animation="none"],.vt-icon-badge[data-vt-icon-animation="none"]:is( .vt-svg-error,.vt-svg-warning,.vt-success-check,.vt-success-ring,.vt-error-frame,.vt-error-line-1,.vt-error-line-2,.vt-warning-frame,.vt-warning-stem,.vt-warning-dot,.vt-info-ring,.vt-info-dot,.vt-info-stem,.vt-loader-inner,.vt-loader-core ){animation:none;stroke-dashoffset:0}.vt-icon-badge[data-vt-icon-animation="none"]:is(.vt-success-fill,.vt-error-fill,.vt-warning-fill,.vt-info-fill){animation:none;opacity:.15}.vt-progress-track{position:absolute;left:0;right:0;bottom:0;height:3px;background:var(--vt-progress-track);overflow:hidden;pointer-events:none}.vt-progress-track[data-vt-progress-position="top"]{top:0;bottom:auto}.vt-toast.vt-toast-floating-close .vt-progress-track{left:var(--vt-sheen-inset,14px);right:var(--vt-sheen-inset,14px);bottom:2px;border-radius:999px}.vt-toast.vt-toast-floating-close .vt-progress-track[data-vt-progress-position="top"]{top:2px;bottom:auto}.vt-progress-bar{width:100%;height:100%;transform-origin:left center;background:linear-gradient( 90deg,var(--vt-accent) 0%,color-mix(in srgb,var(--vt-accent) 68%,#fff) 100% );animation-name:vt-progress-shrink;animation-timing-function:linear;animation-fill-mode:forwards;will-change:transform}[dir="rtl"] .vt-progress-bar{transform-origin:right center}@keyframes vt-progress-shrink{from{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-transparency:reduce){.vt-toast{background-color:var(--vt-bg-solid);background-image:none;-webkit-backdrop-filter:none;backdrop-filter:none}.vt-toast::before{opacity:.25}}@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.vt-toast{background-color:var(--vt-bg-solid)}}@media(prefers-reduced-motion:reduce){.vt-toast{animation-name:vt-enter-fade;animation-duration:140ms;transition:opacity 140ms ease}.vt-toast[data-vt-status="exiting"]{animation-name:vt-exit-fade;animation-duration:120ms}.vt-toast-slot{transition:opacity 140ms ease}:is( .vt-icon-badge,.vt-svg-error,.vt-svg-warning,.vt-success-check,.vt-success-ring,.vt-error-frame,.vt-error-line-1,.vt-error-line-2,.vt-warning-frame,.vt-warning-stem,.vt-warning-dot,.vt-info-ring,.vt-info-dot,.vt-info-stem ){animation:none;stroke-dashoffset:0}:is(.vt-success-fill,.vt-error-fill,.vt-warning-fill,.vt-info-fill){animation:none;opacity:.15}:is(.vt-icon-pulse,.vt-spark,.vt-info-glint){animation:none;opacity:0}.vt-loader-outer{animation:vt-spin 2.2s linear infinite;stroke-dasharray:55 45}.vt-loader-inner,.vt-loader-core{animation:none}}@media(max-width:640px){.vt-toaster[data-vt-position]{width:calc(100vw - 24px);left:12px;right:12px;transform:none}.vt-toaster[data-vt-position^="top"]{top:max(12px,env(safe-area-inset-top))}.vt-toaster[data-vt-position^="bottom"]{bottom:max(12px,env(safe-area-inset-bottom))}}
@@ -1,3 +1,3 @@
1
1
  export declare function isBrowser(): boolean;
2
- export declare function prefersReducedMotion(): boolean;
3
- export declare function getSystemColorScheme(): "light" | "dark";
2
+ export declare function getDarkMediaQuery(): MediaQueryList | null;
3
+ export declare function getSystemColorScheme(): "dark" | "light";
@@ -2,6 +2,7 @@ import type { CSSProperties } from "react";
2
2
  import type { ToastClassNames, ToastIconAnimation, ToastIconAnimationMode, VetraThemeTokens } from "../types/index.js";
3
3
  export declare function cx(...values: Array<string | false | null | undefined>): string;
4
4
  export declare function isFiniteDuration(duration: number): boolean;
5
+ export declare function pickDefined<T extends object>(obj: T): Partial<T>;
5
6
  export declare function mergeClassNames(...maps: Array<ToastClassNames | undefined>): ToastClassNames | undefined;
6
7
  export declare function resolveIconAnimationMode(value: ToastIconAnimation | undefined): ToastIconAnimationMode;
7
8
  export declare function tokensToCssVars(tokens?: VetraThemeTokens): CSSProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vetra-toast",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Premium glassmorphism toast notification library for modern React and Next.js applications.",
5
5
  "keywords": [
6
6
  "react",
@@ -1,13 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { ToastProgressPosition, ToastVariant } from "../types/index.js";
3
- export interface ToastProgressProps {
4
- duration: number;
5
- paused: boolean;
6
- variant: ToastVariant;
7
- resetKey: string;
8
- position?: ToastProgressPosition;
9
- height?: number;
10
- trackClassName?: string;
11
- barClassName?: string;
12
- }
13
- export declare function ToastProgress({ duration, paused, variant, resetKey, position, height, trackClassName, barClassName, }: ToastProgressProps): ReactNode;
@@ -1 +0,0 @@
1
- var e=.45,t=.35;function n(e){return e===`top-center`?[`up`]:e===`bottom-center`?[`down`]:e.endsWith(`left`)?[`left`]:[`right`]}var r=0;function i(e=`vt`){r+=1;let t=globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${e}-${r}-${t}`}function a(...e){return e.filter(Boolean).join(` `)}function o(e){return Number.isFinite(e)&&e>0}function s(...e){let t;for(let n of e)if(n){if(!t)t={...n};else for(let e of Object.keys(n)){let r=n[e];r&&(t[e]=a(t[e],r))}}return t}function c(e){return e===!1||e===`none`?`none`:e===`subtle`?`subtle`:`default`}var l=[[`fontFamily`,`font-family`],[`width`,`width`,1],[`radius`,`radius`,1],[`blur`,`blur`,1],[`saturate`,`saturate`],[`bg`,`bg`],[`bgSolid`,`bg-solid`],[`border`,`border`],[`text`,`text`],[`textMuted`,`text-muted`],[`shadow`,`shadow`],[`success`,`success`],[`error`,`error`],[`warning`,`warning`],[`info`,`info`],[`loading`,`loading`],[`default`,`default`],[`zIndex`,`z-index-root`]];function u(e){if(!e)return{};let t={};for(let[n,r,i]of l){let a=e[n];a!==void 0&&(t[`--vt-${r}`]=i&&typeof a==`number`?`${a}px`:a)}return t}var d={now:()=>Date.now()},f=class{onComplete;clock;timerId=null;duration;remaining;startedAt=null;paused=!1;completed=!1;constructor(e,t,n=d){this.duration=e,this.remaining=e,this.onComplete=t,this.clock=n}start(){this.completed||!Number.isFinite(this.remaining)||this.remaining<=0||(this.clearHandle(),this.paused=!1,this.startedAt=this.clock.now(),this.timerId=setTimeout(()=>{this.timerId=null,this.startedAt=null,this.remaining=0,this.completed=!0,this.onComplete()},this.remaining))}pause(){if(this.paused||this.completed)return this.remaining;if(this.clearHandle(),this.startedAt!==null){let e=Math.max(0,this.clock.now()-this.startedAt);this.remaining=Math.max(0,this.remaining-e),this.startedAt=null}return this.paused=!0,this.remaining}resume(){this.paused&&!this.completed&&(this.remaining<=0?(this.completed=!0,this.paused=!1,this.onComplete()):this.start())}reset(e,t=!0){this.clearHandle(),this.duration=e,this.remaining=e,this.startedAt=null,this.paused=!1,this.completed=!1,t&&Number.isFinite(e)&&e>0&&this.start()}getRemaining(){if(this.completed)return 0;if(!this.paused&&this.startedAt!==null){let e=Math.max(0,this.clock.now()-this.startedAt);return Math.max(0,this.remaining-e)}return this.remaining}getDuration(){return this.duration}isPaused(){return this.paused}isRunning(){return this.timerId!==null}clear(){this.clearHandle(),this.startedAt=null,this.completed=!0}clearHandle(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}},p={defaultDuration:4e3,visibleToasts:4,exitDuration:240,preventDuplicates:!1,toastOptions:void 0},m=/* @__PURE__ */ new Set([`default`,`success`,`error`,`warning`,`info`,`loading`,`custom`]),h=Object.freeze({toasts:Object.freeze([]),queue:Object.freeze([])});function g(e,t){return t??(e===`error`||e===`warning`?`alert`:`status`)}function _(e,t,n){let r=t===void 0?e===`loading`?0:n:t;return r<=0?1/0:r}function v(e,t,n,r){if(r)return r;let i=typeof t==`string`||typeof t==`number`?String(t):``,a=typeof n==`string`||typeof n==`number`?String(n):``;return i||a?`${e}::${i}::${a}`:void 0}function y(e,t){if(!e)return{};let n={};for(let[t,r]of Object.entries(e))m.has(t)||(n[t]=r);let r=n,i=e[t];return i?{...r,...i,className:a(r.className,i.className)||void 0,classNames:s(r.classNames,i.classNames),style:r.style||i.style?{...r.style,...i.style}:void 0}:r}function b(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function x(e,t,n){let r=[...e];return r[t]=n,r}var S=class{#e=[];#t=[];#n=h;#r;#i=/* @__PURE__ */ new Set;#a=/* @__PURE__ */ new Map;#o=/* @__PURE__ */ new Map;#s;constructor(e,t={now:()=>Date.now()}){this.#r={...p,...e},this.#s=t}configure(e){let t=this.#r.visibleToasts;this.#r={...this.#r,...e},this.#r.visibleToasts>t&&this.#t.length>0&&this.#m()&&this.#_()}getConfig(){return this.#r}subscribe=e=>(this.#i.add(e),()=>{this.#i.delete(e)});getSnapshot=()=>this.#n;getServerSnapshot=()=>h;add(e){let t=this.#s.now(),n=e.variant??(e.customRender?`custom`:`default`),r=y(this.#r.toastOptions,n),c={...r,...e,variant:n,className:a(r.className,e.className)||void 0,classNames:s(r.classNames,e.classNames),style:r.style||e.style?{...r.style,...e.style}:void 0};if(c.id&&this.#g(c.id))return this.update(c.id,c),c.id;let l=c.dedupe??(c.dedupeKey!==void 0||this.#r.preventDuplicates),u=v(n,c.title,c.description,c.dedupeKey);if(l&&u){let e=this.#e.find(e=>e.dedupeKey===u&&e.status!==`exiting`)??this.#t.find(e=>e.dedupeKey===u);if(e)return this.#l(e.id,t,c),e.id}let d=c.id??i(),f=_(n,c.duration,this.#r.defaultDuration),p=o(f),m={...c,id:d,variant:n,duration:f,remainingTime:f,startedAt:null,paused:!1,pauseReasons:/* @__PURE__ */ new Set,status:`visible`,createdAt:t,updatedAt:t,dismissible:c.dismissible??!0,showProgress:c.showProgress??(p&&n!==`loading`),pauseOnHover:c.pauseOnHover??!0,pauseOnFocus:c.pauseOnFocus??!0,swipeToDismiss:c.swipeToDismiss??!0,role:g(n,c.role),dedupeKey:u,count:1};if(this.#h()<Math.max(1,this.#r.visibleToasts)){let e=p?{...m,startedAt:t}:m;this.#e=[...this.#e,e],p&&this.#u(e.id,f)}else this.#t=[...this.#t,m];return this.#_(),d}update(e,t){let n=this.#s.now(),r=this.#e.findIndex(t=>t.id===e);if(r!==-1){let e=this.#e[r];if(!e||e.status===`exiting`)return!1;let i=this.#c(e,t,n,!0);return this.#e=x(this.#e,r,i),(e.duration!==i.duration||t.duration!==void 0||e.variant===`loading`&&i.variant!==`loading`)&&(this.#d(i.id),o(i.duration)&&this.#u(i.id,i.duration,!i.paused)),this.#_(),!0}let i=this.#t.findIndex(t=>t.id===e);if(i!==-1){let e=this.#t[i];return e?(this.#t=x(this.#t,i,this.#c(e,t,n,!1)),this.#_(),!0):!1}return!1}dismiss(e,t=`user`){let n=this.#t.findIndex(t=>t.id===e);if(n!==-1){let t=this.#t[n];return this.#t=this.#t.filter(t=>t.id!==e),this.#_(),t?.onDismiss?.(t),!0}let r=this.#e.findIndex(t=>t.id===e),i=this.#e[r];if(!i||i.status===`exiting`)return!1;this.#d(e);let a={...i,status:`exiting`,updatedAt:this.#s.now()};return this.#r.exitDuration<=0?(this.#e=this.#e.filter(t=>t.id!==e),this.#m()):(this.#e=x(this.#e,r,a),this.#f(e)),this.#_(),t===`auto`&&a.onAutoClose?.(a),a.onDismiss?.(a),!0}dismissAll(){let e=[...this.#t];this.#t=[];for(let t of e)t.onDismiss?.(t);let t=this.#e.filter(e=>e.status!==`exiting`);if(t.length!==0||e.length!==0){for(let e of t)this.#d(e.id);if(this.#r.exitDuration<=0)this.#e=[];else{let e=this.#s.now();this.#e=this.#e.map(t=>t.status===`exiting`?t:(this.#f(t.id),{...t,status:`exiting`,updatedAt:e}))}this.#_();for(let e of t)e.onDismiss?.(e)}}pause(e,t=`manual`){let n=this.#e.findIndex(t=>t.id===e),r=this.#e[n];if(!r||r.status===`exiting`||t===`hover`&&!r.pauseOnHover||t===`focus`&&!r.pauseOnFocus||r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons).add(t),a=this.#a.get(e);this.#e=x(this.#e,n,{...r,paused:!0,pauseReasons:i,remainingTime:a?a.pause():r.remainingTime,startedAt:null}),this.#_()}resume(e,t=`manual`){let n=this.#e.findIndex(t=>t.id===e),r=this.#e[n];if(!r||r.status===`exiting`||!r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons);i.delete(t);let a=i.size>0;this.#e=x(this.#e,n,{...r,paused:a,pauseReasons:i,startedAt:!a&&o(r.duration)?this.#s.now():null}),this.#_(),a||this.#a.get(e)?.resume()}pauseAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.pause(t.id,e)}resumeAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.resume(t.id,e)}getRemainingTime(e){let t=this.#a.get(e);return t?t.getRemaining():this.#g(e)?.remainingTime??0}removeImmediately(e){this.#d(e),this.#p(e);let t=this.#e.length,n=this.#t.length;this.#e=this.#e.filter(t=>t.id!==e),this.#t=this.#t.filter(t=>t.id!==e),this.#e.length!==t&&this.#m(),(this.#e.length!==t||this.#t.length!==n)&&this.#_()}clear(){for(let e of this.#a.values())e.clear();this.#a.clear();for(let e of this.#o.values())clearTimeout(e);this.#o.clear(),(this.#e.length>0||this.#t.length>0)&&(this.#e=[],this.#t=[],this.#_())}destroy(){this.clear(),this.#i.clear()}#c(e,t,n,r){let i=t.variant??e.variant,a=e.variant===`loading`,c=a&&i!==`loading`,l=c?y(this.#r.toastOptions,i):void 0,u=e.duration;if(t.duration!==void 0)u=t.duration<=0?1/0:t.duration;else if(c){let e=l?.duration??this.#r.defaultDuration;u=e<=0?1/0:e}else i===`loading`&&!a&&(u=1/0);let d=o(u),f=u!==e.duration;return{...e,...b(t),variant:i,duration:u,remainingTime:f?u:e.remainingTime,startedAt:r&&f&&d&&!e.paused?n:e.startedAt,updatedAt:n,showProgress:t.showProgress??(f?d&&i!==`loading`:e.showProgress),classNames:t.classNames===void 0?e.classNames:s(e.classNames,t.classNames),role:g(i,t.role??(t.variant?void 0:e.role)),dedupeKey:t.dedupeKey??(t.title!==void 0||t.description!==void 0||t.variant!==void 0?v(i,t.title===void 0?e.title:t.title,t.description===void 0?e.description:t.description,e.dedupeKey):e.dedupeKey)}}#l(e,t,n){let r=this.#e.findIndex(t=>t.id===e);if(r!==-1){let i=this.#e[r];if(!i)return;let a=n.duration===void 0?i.duration:_(i.variant,n.duration,this.#r.defaultDuration),s=o(a);this.#e=x(this.#e,r,{...i,count:i.count+1,duration:a,remainingTime:a,startedAt:s&&!i.paused?t:null,updatedAt:t}),s&&(this.#d(e),this.#u(e,a,!i.paused)),this.#_();return}let i=this.#t.findIndex(t=>t.id===e),a=this.#t[i];a&&(this.#t=x(this.#t,i,{...a,count:a.count+1,updatedAt:t}),this.#_())}#u(e,t,n=!0){this.#d(e);let r=new f(t,()=>{this.#a.delete(e),this.dismiss(e,`auto`)},this.#s);this.#a.set(e,r),n&&r.start()}#d(e){let t=this.#a.get(e);t&&(t.clear(),this.#a.delete(e))}#f(e){this.#p(e);let t=setTimeout(()=>{this.#o.delete(e),this.#e=this.#e.filter(t=>t.id!==e),this.#m(),this.#_()},this.#r.exitDuration);this.#o.set(e,t)}#p(e){let t=this.#o.get(e);t!==void 0&&(clearTimeout(t),this.#o.delete(e))}#m(){let e=Math.max(1,this.#r.visibleToasts),t=!1;for(;this.#h()<e&&this.#t.length>0;){let e=this.#t[0];if(!e)break;this.#t=this.#t.slice(1);let n=this.#s.now(),r=o(e.duration),i={...e,status:`visible`,startedAt:r?n:null,remainingTime:e.duration,updatedAt:n};this.#e=[...this.#e,i],r&&this.#u(i.id,i.duration),t=!0}return t}#h(){let e=0;for(let t of this.#e)t.status!==`exiting`&&(e+=1);return e}#g(e){return this.#e.find(t=>t.id===e&&t.status!==`exiting`)??this.#t.find(t=>t.id===e)}#_(){this.#n=Object.freeze({toasts:Object.freeze([...this.#e]),queue:Object.freeze([...this.#t])});for(let e of this.#i)e()}};function C(e,t){return new S(e,t)}var w=C();function T(e){return typeof e==`object`&&!!e&&`title`in e&&!(`$$typeof`in e)}function E(e){return T(e)?{...e}:{title:e,description:void 0}}function D(e=w){let t=((t,n)=>e.add({...n,title:t}));for(let n of[`success`,`error`,`warning`,`info`,`loading`])t[n]=(t,r)=>e.add({...r,title:t,variant:n});return t.custom=(t,n)=>e.add({...n,variant:`custom`,customRender:t}),t.update=(t,n)=>e.update(t,n),t.dismiss=t=>e.dismiss(t,`user`),t.dismissAll=()=>e.dismissAll(),t.promise=(t,n,r)=>{let i=e.add({...r,...E(n.loading),variant:`loading`,duration:1/0,showProgress:!1}),a;try{a=typeof t==`function`?t():t}catch(e){a=Promise.reject(e)}let o=(t,n)=>{let a=E(n);e.update(i,{...a,variant:t,duration:a.duration??r?.duration,showProgress:a.showProgress??r?.showProgress})};return a.then(e=>o(`success`,typeof n.success==`function`?n.success(e):n.success),e=>o(`error`,typeof n.error==`function`?n.error(e):n.error)).finally(()=>{n.finally?.()}),{id:i,unwrap:()=>a}},t}var O=D(w);export{C as a,a as c,c as d,u as f,n as h,S as i,o as l,e as m,O as n,w as o,t as p,h as r,f as s,D as t,s as u};
@@ -1 +0,0 @@
1
- function e(e){return e===`top-center`?[`up`]:e===`bottom-center`?[`down`]:e.endsWith(`left`)?[`left`]:[`right`]}var t=0;function n(e=`vt`){t+=1;let n=globalThis.crypto!==void 0&&typeof globalThis.crypto.randomUUID==`function`?globalThis.crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${e}-${t}-${n}`}function r(...e){return e.filter(Boolean).join(` `)}function i(e){return Number.isFinite(e)&&e>0}function a(...e){let t;for(let n of e)if(n){if(!t)t={...n};else for(let e of Object.keys(n)){let i=n[e];i&&(t[e]=r(t[e],i))}}return t}function o(e){return e===!1||e===`none`?`none`:e===`subtle`?`subtle`:`default`}var s=[[`fontFamily`,`font-family`],[`width`,`width`,1],[`radius`,`radius`,1],[`blur`,`blur`,1],[`saturate`,`saturate`],[`bg`,`bg`],[`bgSolid`,`bg-solid`],[`border`,`border`],[`text`,`text`],[`textMuted`,`text-muted`],[`shadow`,`shadow`],[`success`,`success`],[`error`,`error`],[`warning`,`warning`],[`info`,`info`],[`loading`,`loading`],[`default`,`default`],[`zIndex`,`z-index-root`]];function c(e){if(!e)return{};let t={};for(let[n,r,i]of s){let a=e[n];a!==void 0&&(t[`--vt-${r}`]=i&&typeof a==`number`?`${a}px`:a)}return t}var l={now:()=>Date.now()},u=class{onComplete;clock;timerId=null;duration;remaining;startedAt=null;paused=!1;completed=!1;constructor(e,t,n=l){this.duration=e,this.remaining=e,this.onComplete=t,this.clock=n}start(){this.completed||!Number.isFinite(this.remaining)||this.remaining<=0||(this.clearHandle(),this.paused=!1,this.startedAt=this.clock.now(),this.timerId=setTimeout(()=>{this.timerId=null,this.startedAt=null,this.remaining=0,this.completed=!0,this.onComplete()},this.remaining))}pause(){if(this.paused||this.completed)return this.remaining;if(this.clearHandle(),this.startedAt!==null){let e=Math.max(0,this.clock.now()-this.startedAt);this.remaining=Math.max(0,this.remaining-e),this.startedAt=null}return this.paused=!0,this.remaining}resume(){this.paused&&!this.completed&&(this.remaining<=0?(this.completed=!0,this.paused=!1,this.onComplete()):this.start())}reset(e,t=!0){this.clearHandle(),this.duration=e,this.remaining=e,this.startedAt=null,this.paused=!1,this.completed=!1,t&&Number.isFinite(e)&&e>0&&this.start()}getRemaining(){if(this.completed)return 0;if(!this.paused&&this.startedAt!==null){let e=Math.max(0,this.clock.now()-this.startedAt);return Math.max(0,this.remaining-e)}return this.remaining}getDuration(){return this.duration}isPaused(){return this.paused}isRunning(){return this.timerId!==null}clear(){this.clearHandle(),this.startedAt=null,this.completed=!0}clearHandle(){this.timerId!==null&&(clearTimeout(this.timerId),this.timerId=null)}},d={defaultDuration:4e3,visibleToasts:4,exitDuration:240,preventDuplicates:!1,toastOptions:void 0},f=new Set([`default`,`success`,`error`,`warning`,`info`,`loading`,`custom`]),p=Object.freeze({toasts:Object.freeze([]),queue:Object.freeze([])});function m(e,t){return t??(e===`error`||e===`warning`?`alert`:`status`)}function h(e,t,n){let r=t===void 0?e===`loading`?0:n:t;return r<=0?1/0:r}function g(e,t,n,r){if(r)return r;let i=typeof t==`string`||typeof t==`number`?String(t):``,a=typeof n==`string`||typeof n==`number`?String(n):``;return i||a?`${e}::${i}::${a}`:void 0}function _(e,t){if(!e)return{};let n={};for(let[t,r]of Object.entries(e))f.has(t)||(n[t]=r);let i=n,o=e[t];return o?{...i,...o,className:r(i.className,o.className)||void 0,classNames:a(i.classNames,o.classNames),style:i.style||o.style?{...i.style,...o.style}:void 0}:i}function v(e){let t={};for(let[n,r]of Object.entries(e))r!==void 0&&(t[n]=r);return t}function y(e,t,n){let r=[...e];return r[t]=n,r}var b=class{#e=[];#t=[];#n=p;#r;#i=new Set;#a=new Map;#o=new Map;#s;constructor(e,t={now:()=>Date.now()}){this.#r={...d,...e},this.#s=t}configure(e){let t=this.#r.visibleToasts;this.#r={...this.#r,...e},this.#r.visibleToasts>t&&this.#t.length>0&&this.#m()&&this.#_()}getConfig(){return this.#r}subscribe=e=>(this.#i.add(e),()=>{this.#i.delete(e)});getSnapshot=()=>this.#n;getServerSnapshot=()=>p;add(e){let t=this.#s.now(),o=e.variant??(e.customRender?`custom`:`default`),s=_(this.#r.toastOptions,o),c={...s,...e,variant:o,className:r(s.className,e.className)||void 0,classNames:a(s.classNames,e.classNames),style:s.style||e.style?{...s.style,...e.style}:void 0};if(c.id&&this.#g(c.id))return this.update(c.id,c),c.id;let l=c.dedupe??(c.dedupeKey!==void 0||this.#r.preventDuplicates),u=g(o,c.title,c.description,c.dedupeKey);if(l&&u){let e=this.#e.find(e=>e.dedupeKey===u&&e.status!==`exiting`)??this.#t.find(e=>e.dedupeKey===u);if(e)return this.#l(e.id,t,c),e.id}let d=c.id??n(),f=h(o,c.duration,this.#r.defaultDuration),p=i(f),v={...c,id:d,variant:o,duration:f,remainingTime:f,startedAt:null,paused:!1,pauseReasons:new Set,status:`visible`,createdAt:t,updatedAt:t,dismissible:c.dismissible??!0,showProgress:c.showProgress??(p&&o!==`loading`),pauseOnHover:c.pauseOnHover??!0,pauseOnFocus:c.pauseOnFocus??!0,swipeToDismiss:c.swipeToDismiss??!0,role:m(o,c.role),dedupeKey:u,count:1};if(this.#h()<Math.max(1,this.#r.visibleToasts)){let e=p?{...v,startedAt:t}:v;this.#e=[...this.#e,e],p&&this.#u(e.id,f)}else this.#t=[...this.#t,v];return this.#_(),d}update(e,t){let n=this.#s.now(),r=this.#e.findIndex(t=>t.id===e);if(r!==-1){let e=this.#e[r];if(!e||e.status===`exiting`)return!1;let a=this.#c(e,t,n,!0);return this.#e=y(this.#e,r,a),(e.duration!==a.duration||t.duration!==void 0||e.variant===`loading`&&a.variant!==`loading`)&&(this.#d(a.id),i(a.duration)&&this.#u(a.id,a.duration,!a.paused)),this.#_(),!0}let a=this.#t.findIndex(t=>t.id===e);if(a!==-1){let e=this.#t[a];return e?(this.#t=y(this.#t,a,this.#c(e,t,n,!1)),this.#_(),!0):!1}return!1}dismiss(e,t=`user`){let n=this.#t.findIndex(t=>t.id===e);if(n!==-1){let t=this.#t[n];return this.#t=this.#t.filter(t=>t.id!==e),this.#_(),t?.onDismiss?.(t),!0}let r=this.#e.findIndex(t=>t.id===e),i=this.#e[r];if(!i||i.status===`exiting`)return!1;this.#d(e);let a={...i,status:`exiting`,updatedAt:this.#s.now()};return this.#r.exitDuration<=0?(this.#e=this.#e.filter(t=>t.id!==e),this.#m()):(this.#e=y(this.#e,r,a),this.#f(e)),this.#_(),t===`auto`&&a.onAutoClose?.(a),a.onDismiss?.(a),!0}dismissAll(){let e=[...this.#t];this.#t=[];for(let t of e)t.onDismiss?.(t);let t=this.#e.filter(e=>e.status!==`exiting`);if(t.length!==0||e.length!==0){for(let e of t)this.#d(e.id);if(this.#r.exitDuration<=0)this.#e=[];else{let e=this.#s.now();this.#e=this.#e.map(t=>t.status===`exiting`?t:(this.#f(t.id),{...t,status:`exiting`,updatedAt:e}))}this.#_();for(let e of t)e.onDismiss?.(e)}}pause(e,t=`manual`){let n=this.#e.findIndex(t=>t.id===e),r=this.#e[n];if(!r||r.status===`exiting`||t===`hover`&&!r.pauseOnHover||t===`focus`&&!r.pauseOnFocus||r.pauseReasons.has(t))return;let i=new Set(r.pauseReasons).add(t),a=this.#a.get(e);this.#e=y(this.#e,n,{...r,paused:!0,pauseReasons:i,remainingTime:a?a.pause():r.remainingTime,startedAt:null}),this.#_()}resume(e,t=`manual`){let n=this.#e.findIndex(t=>t.id===e),r=this.#e[n];if(!r||r.status===`exiting`||!r.pauseReasons.has(t))return;let a=new Set(r.pauseReasons);a.delete(t);let o=a.size>0;this.#e=y(this.#e,n,{...r,paused:o,pauseReasons:a,startedAt:!o&&i(r.duration)?this.#s.now():null}),this.#_(),o||this.#a.get(e)?.resume()}pauseAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.pause(t.id,e)}resumeAll(e=`manual`){for(let t of this.#e)t.status!==`exiting`&&this.resume(t.id,e)}getRemainingTime(e){let t=this.#a.get(e);return t?t.getRemaining():this.#g(e)?.remainingTime??0}removeImmediately(e){this.#d(e),this.#p(e);let t=this.#e.length,n=this.#t.length;this.#e=this.#e.filter(t=>t.id!==e),this.#t=this.#t.filter(t=>t.id!==e),this.#e.length!==t&&this.#m(),(this.#e.length!==t||this.#t.length!==n)&&this.#_()}clear(){for(let e of this.#a.values())e.clear();this.#a.clear();for(let e of this.#o.values())clearTimeout(e);this.#o.clear(),(this.#e.length>0||this.#t.length>0)&&(this.#e=[],this.#t=[],this.#_())}destroy(){this.clear(),this.#i.clear()}#c(e,t,n,r){let o=t.variant??e.variant,s=e.variant===`loading`,c=s&&o!==`loading`,l=c?_(this.#r.toastOptions,o):void 0,u=e.duration;if(t.duration!==void 0)u=t.duration<=0?1/0:t.duration;else if(c){let e=l?.duration??this.#r.defaultDuration;u=e<=0?1/0:e}else o===`loading`&&!s&&(u=1/0);let d=i(u),f=u!==e.duration;return{...e,...v(t),variant:o,duration:u,remainingTime:f?u:e.remainingTime,startedAt:r&&f&&d&&!e.paused?n:e.startedAt,updatedAt:n,showProgress:t.showProgress??(f?d&&o!==`loading`:e.showProgress),classNames:t.classNames===void 0?e.classNames:a(e.classNames,t.classNames),role:m(o,t.role??(t.variant?void 0:e.role)),dedupeKey:t.dedupeKey??(t.title!==void 0||t.description!==void 0||t.variant!==void 0?g(o,t.title===void 0?e.title:t.title,t.description===void 0?e.description:t.description,e.dedupeKey):e.dedupeKey)}}#l(e,t,n){let r=this.#e.findIndex(t=>t.id===e);if(r!==-1){let a=this.#e[r];if(!a)return;let o=n.duration===void 0?a.duration:h(a.variant,n.duration,this.#r.defaultDuration),s=i(o);this.#e=y(this.#e,r,{...a,count:a.count+1,duration:o,remainingTime:o,startedAt:s&&!a.paused?t:null,updatedAt:t}),s&&(this.#d(e),this.#u(e,o,!a.paused)),this.#_();return}let a=this.#t.findIndex(t=>t.id===e),o=this.#t[a];o&&(this.#t=y(this.#t,a,{...o,count:o.count+1,updatedAt:t}),this.#_())}#u(e,t,n=!0){this.#d(e);let r=new u(t,()=>{this.#a.delete(e),this.dismiss(e,`auto`)},this.#s);this.#a.set(e,r),n&&r.start()}#d(e){let t=this.#a.get(e);t&&(t.clear(),this.#a.delete(e))}#f(e){this.#p(e);let t=setTimeout(()=>{this.#o.delete(e),this.#e=this.#e.filter(t=>t.id!==e),this.#m(),this.#_()},this.#r.exitDuration);this.#o.set(e,t)}#p(e){let t=this.#o.get(e);t!==void 0&&(clearTimeout(t),this.#o.delete(e))}#m(){let e=Math.max(1,this.#r.visibleToasts),t=!1;for(;this.#h()<e&&this.#t.length>0;){let e=this.#t[0];if(!e)break;this.#t=this.#t.slice(1);let n=this.#s.now(),r=i(e.duration),a={...e,status:`visible`,startedAt:r?n:null,remainingTime:e.duration,updatedAt:n};this.#e=[...this.#e,a],r&&this.#u(a.id,a.duration),t=!0}return t}#h(){let e=0;for(let t of this.#e)t.status!==`exiting`&&(e+=1);return e}#g(e){return this.#e.find(t=>t.id===e&&t.status!==`exiting`)??this.#t.find(t=>t.id===e)}#_(){this.#n=Object.freeze({toasts:Object.freeze([...this.#e]),queue:Object.freeze([...this.#t])});for(let e of this.#i)e()}};function x(e,t){return new b(e,t)}var S=x();function C(e){return typeof e==`object`&&!!e&&`title`in e&&!(`$$typeof`in e)}function w(e){return C(e)?{...e}:{title:e,description:void 0}}function T(e=S){let t=((t,n)=>e.add({...n,title:t}));for(let n of[`success`,`error`,`warning`,`info`,`loading`])t[n]=(t,r)=>e.add({...r,title:t,variant:n});return t.custom=(t,n)=>e.add({...n,variant:`custom`,customRender:t}),t.update=(t,n)=>e.update(t,n),t.dismiss=t=>e.dismiss(t,`user`),t.dismissAll=()=>e.dismissAll(),t.promise=(t,n,r)=>{let i=e.add({...r,...w(n.loading),variant:`loading`,duration:1/0,showProgress:!1}),a;try{a=typeof t==`function`?t():t}catch(e){a=Promise.reject(e)}let o=(t,n)=>{let a=w(n);e.update(i,{...a,variant:t,duration:a.duration??r?.duration,showProgress:a.showProgress??r?.showProgress})};return a.then(e=>o(`success`,typeof n.success==`function`?n.success(e):n.success),e=>o(`error`,typeof n.error==`function`?n.error(e):n.error)).finally(()=>{n.finally?.()}),{id:i,unwrap:()=>a}},t}var E=T(S);Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return .45}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return .35}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}});