@cuongtran001/kanna 0.56.3 → 0.57.0

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.
Files changed (46) hide show
  1. package/README.md +104 -43
  2. package/dist/client/assets/{index-DZs2QDFW.js → index-D5YZE5sU.js} +1 -1
  3. package/dist/client/assets/{index-DdJ8y1Sx.js → index-D6kQbrcz.js} +232 -232
  4. package/dist/client/assets/index-DglLa3SU.css +32 -0
  5. package/dist/client/index.html +2 -2
  6. package/dist/export-viewer/assets/index-B60zOmQk.css +1 -0
  7. package/dist/export-viewer/assets/{index-3rm8yWdF.js → index-B6NqwibA.js} +1 -1
  8. package/dist/export-viewer/assets/{index-DDyZw7KP.js → index-_81r2Tyd.js} +1 -1
  9. package/dist/export-viewer/index.html +2 -2
  10. package/package.json +2 -1
  11. package/src/server/agent.pty-rotation.test.ts +331 -0
  12. package/src/server/agent.ts +78 -13
  13. package/src/server/claude-pty/auth.test.ts +34 -1
  14. package/src/server/claude-pty/auth.ts +26 -1
  15. package/src/server/claude-pty/driver.test.ts +177 -1
  16. package/src/server/claude-pty/driver.ts +281 -56
  17. package/src/server/claude-pty/jsonl-reader.ts +8 -3
  18. package/src/server/claude-pty/jsonl-to-event.test.ts +178 -1
  19. package/src/server/claude-pty/jsonl-to-event.ts +137 -1
  20. package/src/server/claude-pty/parity-matrix.test.ts +201 -0
  21. package/src/server/claude-pty/preflight/cache.test.ts +17 -2
  22. package/src/server/claude-pty/preflight/cache.ts +6 -1
  23. package/src/server/claude-pty/preflight/gate.test.ts +100 -0
  24. package/src/server/claude-pty/preflight/gate.ts +52 -11
  25. package/src/server/claude-pty/preflight/probe.ts +36 -1
  26. package/src/server/claude-pty/preflight/types.test.ts +4 -2
  27. package/src/server/claude-pty/preflight/types.ts +12 -0
  28. package/src/server/claude-pty/sandbox/platform.test.ts +1 -16
  29. package/src/server/claude-pty/sandbox/platform.ts +21 -10
  30. package/src/server/claude-pty/sandbox/preflight.ts +2 -2
  31. package/src/server/claude-pty/sandbox/profile-linux.test.ts +69 -18
  32. package/src/server/claude-pty/sandbox/profile-linux.ts +54 -15
  33. package/src/server/claude-pty/sandbox/profile-macos.test.ts +22 -0
  34. package/src/server/claude-pty/sandbox/profile-macos.ts +9 -2
  35. package/src/server/claude-pty/sandbox/wrap.ts +13 -2
  36. package/src/server/codex-app-server.test.ts +6 -3
  37. package/src/server/codex-app-server.ts +2 -2
  38. package/src/server/kanna-mcp-http.test.ts +122 -0
  39. package/src/server/kanna-mcp-http.ts +150 -0
  40. package/src/server/oauth-pool/oauth-token-pool.test.ts +131 -0
  41. package/src/server/oauth-pool/oauth-token-pool.ts +74 -19
  42. package/src/shared/kanna-system-prompt.ts +13 -0
  43. package/src/shared/projectFileUrl.test.ts +70 -1
  44. package/src/shared/projectFileUrl.ts +25 -0
  45. package/dist/client/assets/index-CvabLpkC.css +0 -32
  46. package/dist/export-viewer/assets/index-pbfUT22T.css +0 -1
package/README.md CHANGED
@@ -49,19 +49,51 @@ That's it. Kanna opens in your browser at [`localhost:3210`](http://localhost:32
49
49
 
50
50
  ## Features
51
51
 
52
- - **Multi-provider support** — switch between Claude and Codex (OpenAI) from the chat input, with per-provider model selection, reasoning effort controls, and Codex fast mode
52
+ **Providers & models**
53
+
54
+ - **Multi-provider support** — switch between Claude and Codex (OpenAI) from the chat input, with per-provider model selection, reasoning-effort controls, and Codex fast mode
55
+ - **OAuth token pool** — register multiple Claude OAuth tokens; Kanna rotates across them per chat
56
+ - **Subscription-billing PTY driver** — optional `KANNA_CLAUDE_DRIVER=pty` runs the `claude` CLI under a pseudo-terminal so Pro/Max subscription billing is preserved instead of API rates
57
+
58
+ **Chat & transcript**
59
+
60
+ - **Rich transcript rendering** — hydrated tool calls, collapsible tool groups, plan-mode dialogs, and interactive prompts with full result display
61
+ - **Inline diff viewer** — file and commit diffs rendered directly in the transcript
62
+ - **Embedded terminal** — per-project xterm terminal in a resizable side panel (macOS/Linux)
63
+ - **File & image uploads** — drag-and-drop attachments into the composer
64
+ - **Slash commands & @-mentions** — in-composer pickers for slash commands, file mentions, and subagents
65
+ - **Plan mode** — review and approve agent plans before execution
66
+ - **Subagent orchestration** — run and track parallel subagents within a turn
67
+ - **Background tasks** — long-running tasks tracked out-of-band with a status indicator
68
+ - **Auto-continue** — optionally continue a turn automatically when the agent stops short
69
+ - **Proactive compaction** — context-window meter with automatic transcript compaction before limits are hit
70
+
71
+ **Projects & sessions**
72
+
53
73
  - **Project-first sidebar** — chats grouped under projects, with live status indicators (idle, running, waiting, failed)
54
74
  - **Drag-and-drop project ordering** — reorder project groups in the sidebar with persistent ordering
55
75
  - **Local project discovery** — auto-discovers projects from both Claude and Codex local history
56
76
  - **Bulk import Claude Code sessions** — one-click import of existing `~/.claude/projects/` sessions with full transcript and seamless resume via the Claude Agent SDK
57
- - **Rich transcript rendering** — hydrated tool calls, collapsible tool groups, plan mode dialogs, and interactive prompts with full result display
58
- - **Quick responses** — lightweight structured queries (e.g. title generation) via Haiku with automatic Codex fallback
59
- - **Plan mode** — review and approve agent plans before execution
60
- - **Persistent local history** — refresh-safe routes backed by JSONL event logs and compacted snapshots
61
- - **Auto-generated titles** — chat titles generated in the background via Claude Haiku
77
+ - **Git worktree isolation** — run a chat in an isolated worktree without disturbing your working tree
62
78
  - **Session resumption** — resume agent sessions with full context preservation
79
+ - **Auto-generated titles** — chat titles generated in the background via Claude Haiku
80
+ - **Quick responses** — lightweight structured queries (e.g. title generation) via Haiku with automatic Codex fallback
81
+
82
+ **Persistence & realtime**
83
+
84
+ - **Persistent local history** — refresh-safe routes backed by append-only JSONL event logs and compacted snapshots
63
85
  - **WebSocket-driven** — real-time subscription model with reactive state broadcasting
86
+ - **Standalone transcript export** — export a chat as a self-contained HTML viewer
87
+
88
+ **Access & notifications**
89
+
90
+ - **Password protection** — optional launch password gating the app, WebSocket, and API routes
91
+ - **Public share link** — `--share` creates a temporary `trycloudflare.com` URL with a terminal QR code
64
92
  - **Cloudflare tunnel via `expose_port` tool** — opt-in; the agent proactively calls the Kanna `expose_port` MCP tool with a port. In `always-ask` mode Kanna shows an inline "expose via Cloudflare" card for you to accept; in `auto-expose` mode `cloudflared tunnel --url` spawns immediately. Both modes are gated by the Cloudflare Tunnel setting
93
+ - **Web push & sound notifications** — browser push and sound alerts when a chat needs attention
94
+ - **Customizable keybindings** — user-editable keyboard shortcuts
95
+ - **In-app self-update** — one-click update that pulls, rebuilds, and hot-reloads (host-agnostic supervisor or pm2)
96
+ - **Mobile-friendly** — responsive layout, installable as a standalone PWA
65
97
 
66
98
  ## Architecture
67
99
 
@@ -69,14 +101,22 @@ That's it. Kanna opens in your browser at [`localhost:3210`](http://localhost:32
69
101
  Browser (React + Zustand)
70
102
  ↕ WebSocket
71
103
  Bun Server (HTTP + WS)
72
- ├── WSRouter ─── subscription & command routing
73
- ├── AgentCoordinator ─── multi-provider turn management
74
- ├── ProviderCatalog ─── provider/model/effort normalization
75
- ├── QuickResponseAdapter ─── structured queries with provider fallback
76
- ├── EventStore ─── JSONL persistence + snapshot compaction
77
- └── ReadModels ─── derived views (sidebar, chat, projects)
78
- ↕ stdio
79
- Claude Agent SDK / Codex App Server (local processes)
104
+ ├── Auth ───────────── optional password gate (HTTP/WS/API)
105
+ ├── WSRouter ───────── subscription & command routing
106
+ ├── AgentCoordinator multi-provider turn management
107
+ ├── ProviderCatalog ── provider/model/effort normalization
108
+ ├── QuickResponse ──── structured queries with provider fallback
109
+ ├── EventStore ─────── append-only JSONL + snapshot compaction
110
+ ├── ReadModels ─────── derived views (sidebar, chat, projects)
111
+ ├── DiffStore ──────── per-chat diff hydration
112
+ ├── TerminalManager ── PTY sessions for the embedded terminal
113
+ ├── Uploads ────────── drag-drop attachment intake
114
+ ├── Discovery ──────── scan Claude/Codex local history
115
+ ├── Push ───────────── web-push notifications
116
+ ├── Share / Tunnel ─── trycloudflare + cloudflared
117
+ └── UpdateManager ──── self-update + reload strategy
118
+ ↕ stdio / PTY
119
+ Claude Agent SDK · Claude CLI (PTY) · Codex App Server
80
120
 
81
121
  Local File System (~/.kanna/data/, project dirs)
82
122
  ```
@@ -85,7 +125,7 @@ Local File System (~/.kanna/data/, project dirs)
85
125
 
86
126
  ## Requirements
87
127
 
88
- - [Bun](https://bun.sh) v1.3.5+
128
+ - [Bun](https://bun.sh) v1.3.11+
89
129
  - A working [Claude Code](https://docs.anthropic.com/en/docs/claude-code) environment
90
130
  - _(Optional)_ [Codex CLI](https://github.com/openai/codex) for Codex provider support
91
131
 
@@ -119,6 +159,7 @@ bun run build
119
159
  ```bash
120
160
  kanna # start with defaults (localhost only)
121
161
  kanna --port 4000 # custom port
162
+ kanna --strict-port # fail instead of trying another port
122
163
  kanna --no-open # don't open browser
123
164
  kanna --password <secret> # require a password before loading the app
124
165
  kanna --share # create a public quick tunnel + terminal QR
@@ -223,43 +264,63 @@ bun run dev:server # http://localhost:5175
223
264
 
224
265
  ## Scripts
225
266
 
226
- | Command | Description |
227
- | -------------------- | ---------------------------- |
228
- | `bun run build` | Build for production |
229
- | `bun run check` | Typecheck + build |
230
- | `bun run dev` | Run client + server together |
231
- | `bun run dev:client` | Vite dev server only |
232
- | `bun run dev:server` | Bun backend only |
233
- | `bun run start` | Start production server |
267
+ | Command | Description |
268
+ | -------------------- | ------------------------------------ |
269
+ | `bun run build` | Build client + standalone export viewer |
270
+ | `bun run check` | Typecheck, lint, and build |
271
+ | `bun run lint` | ESLint over `src/` (zero-warning gate) |
272
+ | `bun run dev` | Run client + server together |
273
+ | `bun run dev:client` | Vite dev server only (`:5174`) |
274
+ | `bun run dev:server` | Bun backend only (`:5175`) |
275
+ | `bun run start` | Start production server |
276
+ | `bun test` | Run the test suite |
234
277
 
235
278
  ## Project Structure
236
279
 
280
+ Abridged — the actual tree has more modules, each with co-located `*.test.ts`:
281
+
237
282
  ```
238
283
  src/
239
284
  ├── client/ React UI layer
240
285
  │ ├── app/ App router, pages, central state hook, socket client
241
- │ ├── components/ Messages, chat chrome, dialogs, buttons, inputs
242
- │ ├── hooks/ Theme, standalone mode detection
243
- │ ├── stores/ Zustand stores (chat input, preferences, project order)
244
- │ └── lib/ Formatters, path utils, transcript parsing
286
+ │ ├── components/ chat-ui, messages, settings, ui primitives, modals
287
+ │ ├── hooks/ mobile/standalone detection, theme, mention/slash suggestions
288
+ │ ├── stores/ Zustand stores (chat input, preferences, terminal, tasks…)
289
+ │ └── lib/ formatters, path utils, transcript parsing, keybindings
245
290
  ├── server/ Bun backend
246
- │ ├── cli.ts CLI entry point & browser launcher
247
- │ ├── server.ts HTTP/WS server setup & static serving
248
- │ ├── agent.ts AgentCoordinator (multi-provider turn management)
249
- │ ├── codex-app-server.ts Codex App Server JSON-RPC client
250
- │ ├── provider-catalog.ts Provider/model/effort normalization
251
- │ ├── quick-response.ts Structured queries with provider fallback
252
- │ ├── ws-router.ts WebSocket message routing & subscriptions
253
- │ ├── event-store.ts JSONL persistence, replay & compaction
254
- │ ├── discovery.ts Auto-discover projects from Claude and Codex local state
255
- │ ├── read-models.ts Derive view models from event state
256
- └── events.ts Event type definitions
291
+ │ ├── cli.ts · cli-runtime.ts CLI entry, flag parsing, supervisor
292
+ │ ├── server.ts HTTP/WS server + static serving
293
+ │ ├── auth.ts password gate for HTTP/WS/API
294
+ │ ├── ws-router.ts WebSocket routing & subscriptions
295
+ │ ├── agent.ts AgentCoordinator (multi-provider turns)
296
+ │ ├── codex-app-server.ts Codex App Server JSON-RPC client
297
+ │ ├── claude-pty/ PTY driver (subscription billing)
298
+ │ ├── oauth-pool/ Claude OAuth token rotation
299
+ │ ├── provider-catalog.ts provider/model/effort normalization
300
+ │ ├── quick-response.ts structured queries w/ provider fallback
301
+ ├── event-store.ts JSONL persistence, replay & compaction
302
+ │ ├── read-models.ts derived view models
303
+ │ ├── events.ts event type definitions
304
+ │ ├── discovery.ts auto-discover Claude/Codex projects
305
+ │ ├── claude-session-importer.ts bulk import existing sessions
306
+ │ ├── diff-store.ts per-chat diff hydration
307
+ │ ├── terminal-manager.ts embedded-terminal PTY sessions
308
+ │ ├── uploads.ts attachment intake
309
+ │ ├── subagent-orchestrator.ts parallel subagent runs
310
+ │ ├── background-tasks.ts out-of-band task tracking
311
+ │ ├── worktree-store.ts git worktree isolation
312
+ │ ├── push/ web-push notifications
313
+ │ ├── share.ts · cloudflare-tunnel/ trycloudflare / expose_port tunnels
314
+ │ ├── update-manager.ts · update-strategy.ts self-update
315
+ │ ├── kanna-mcp.ts Kanna MCP tools (built-in shims)
316
+ │ └── keybindings.ts persisted keybindings
257
317
  └── shared/ Shared between client & server
258
- ├── types.ts Core data types, provider catalog, transcript entries
259
- ├── tools.ts Tool call normalization and hydration
260
- ├── protocol.ts WebSocket message protocol
261
- ├── ports.ts Port configuration
262
- └── branding.ts App name, data directory paths
318
+ ├── types.ts core domain types, provider catalog, transcript entries
319
+ ├── tools.ts tool-call normalization & hydration
320
+ ├── protocol.ts WebSocket wire envelopes
321
+ ├── ports.ts default ports & dev-mode offsets
322
+ ├── share.ts share/tunnel shared types
323
+ └── branding.ts app name & data-directory paths
263
324
  ```
264
325
 
265
326
  ## Data Storage
@@ -1 +1 @@
1
- import{R as a,a as wt}from"./index-DdJ8y1Sx.js";function Xt(r){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",s.appendChild(e),e.styleSheet?e.styleSheet.cssText=r:e.appendChild(document.createTextNode(r))}const Wt=r=>{switch(r){case"success":return Gt;case"info":return Jt;case"warning":return Qt;case"error":return Zt;default:return null}},Kt=Array(12).fill(0),qt=({visible:r,className:s})=>a.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":r},a.createElement("div",{className:"sonner-spinner"},Kt.map((e,o)=>a.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),Gt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Qt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Jt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Zt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),te=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ee=()=>{const[r,s]=a.useState(document.hidden);return a.useEffect(()=>{const e=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),r};let Et=1;class ae{constructor(){this.subscribe=s=>(this.subscribers.push(s),()=>{const e=this.subscribers.indexOf(s);this.subscribers.splice(e,1)}),this.publish=s=>{this.subscribers.forEach(e=>e(s))},this.addToast=s=>{this.publish(s),this.toasts=[...this.toasts,s]},this.create=s=>{var e;const{message:o,...b}=s,c=typeof(s==null?void 0:s.id)=="number"||((e=s.id)==null?void 0:e.length)>0?s.id:Et++,g=this.toasts.find(v=>v.id===c),D=s.dismissible===void 0?!0:s.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),g?this.toasts=this.toasts.map(v=>v.id===c?(this.publish({...v,...s,id:c,title:o}),{...v,...s,id:c,dismissible:D,title:o}):v):this.addToast({title:o,...b,dismissible:D,id:c}),c},this.dismiss=s=>(s?(this.dismissedToasts.add(s),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:s,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(o=>o({id:e.id,dismiss:!0}))}),s),this.message=(s,e)=>this.create({...e,message:s}),this.error=(s,e)=>this.create({...e,message:s,type:"error"}),this.success=(s,e)=>this.create({...e,type:"success",message:s}),this.info=(s,e)=>this.create({...e,type:"info",message:s}),this.warning=(s,e)=>this.create({...e,type:"warning",message:s}),this.loading=(s,e)=>this.create({...e,type:"loading",message:s}),this.promise=(s,e)=>{if(!e)return;let o;e.loading!==void 0&&(o=this.create({...e,promise:s,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));const b=Promise.resolve(s instanceof Function?s():s);let c=o!==void 0,g;const D=b.then(async i=>{if(g=["resolve",i],a.isValidElement(i))c=!1,this.create({id:o,type:"default",message:i});else if(oe(i)&&!i.ok){c=!1;const t=typeof e.error=="function"?await e.error(`HTTP error! status: ${i.status}`):e.error,E=typeof e.description=="function"?await e.description(`HTTP error! status: ${i.status}`):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"error",description:E,...T})}else if(i instanceof Error){c=!1;const t=typeof e.error=="function"?await e.error(i):e.error,E=typeof e.description=="function"?await e.description(i):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"error",description:E,...T})}else if(e.success!==void 0){c=!1;const t=typeof e.success=="function"?await e.success(i):e.success,E=typeof e.description=="function"?await e.description(i):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"success",description:E,...T})}}).catch(async i=>{if(g=["reject",i],e.error!==void 0){c=!1;const N=typeof e.error=="function"?await e.error(i):e.error,t=typeof e.description=="function"?await e.description(i):e.description,O=typeof N=="object"&&!a.isValidElement(N)?N:{message:N};this.create({id:o,type:"error",description:t,...O})}}).finally(()=>{c&&(this.dismiss(o),o=void 0),e.finally==null||e.finally.call(e)}),v=()=>new Promise((i,N)=>D.then(()=>g[0]==="reject"?N(g[1]):i(g[1])).catch(N));return typeof o!="string"&&typeof o!="number"?{unwrap:v}:Object.assign(o,{unwrap:v})},this.custom=(s,e)=>{const o=(e==null?void 0:e.id)||Et++;return this.create({jsx:s(o),id:o,...e}),o},this.getActiveToasts=()=>this.toasts.filter(s=>!this.dismissedToasts.has(s.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const S=new ae,se=(r,s)=>{const e=(s==null?void 0:s.id)||Et++;return S.addToast({title:r,...s,id:e}),e},oe=r=>r&&typeof r=="object"&&"ok"in r&&typeof r.ok=="boolean"&&"status"in r&&typeof r.status=="number",ne=se,re=()=>S.toasts,ie=()=>S.getActiveToasts(),xe=Object.assign(ne,{success:S.success,info:S.info,warning:S.warning,error:S.error,custom:S.custom,message:S.message,promise:S.promise,dismiss:S.dismiss,loading:S.loading},{getHistory:re,getToasts:ie});Xt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function mt(r){return r.label!==void 0}const le=3,de="24px",ce="16px",It=4e3,ue=356,fe=14,me=45,pe=200;function H(...r){return r.filter(Boolean).join(" ")}function ge(r){const[s,e]=r.split("-"),o=[];return s&&o.push(s),e&&o.push(e),o}const he=r=>{var s,e,o,b,c,g,D,v,i;const{invert:N,toast:t,unstyled:E,interacting:O,setHeights:T,visibleToasts:pt,heights:U,index:d,toasts:st,expanded:X,removeToast:ot,defaultRichColors:gt,closeButton:z,style:Z,cancelButtonStyle:Y,actionButtonStyle:ht,className:nt="",descriptionClassName:bt="",duration:tt,position:A,gap:rt,expandByDefault:et,classNames:u,icons:y,closeButtonAriaLabel:j="Close toast"}=r,[$,M]=a.useState(null),[F,it]=a.useState(null),[l,p]=a.useState(!1),[m,R]=a.useState(!1),[W,f]=a.useState(!1),[K,lt]=a.useState(!1),[dt,q]=a.useState(!1),[At,vt]=a.useState(0),[Ht,Tt]=a.useState(0),at=a.useRef(t.duration||tt||It),St=a.useRef(null),P=a.useRef(null),Ot=d===0,zt=d+1<=pt,k=t.type,G=t.dismissible!==!1,Pt=t.className||"",jt=t.descriptionClassName||"",ct=a.useMemo(()=>U.findIndex(n=>n.toastId===t.id)||0,[U,t.id]),Lt=a.useMemo(()=>{var n;return(n=t.closeButton)!=null?n:z},[t.closeButton,z]),Nt=a.useMemo(()=>t.duration||tt||It,[t.duration,tt]),yt=a.useRef(0),Q=a.useRef(0),kt=a.useRef(0),J=a.useRef(null),[Yt,$t]=A.split("-"),_t=a.useMemo(()=>U.reduce((n,h,w)=>w>=ct?n:n+h.height,0),[U,ct]),Dt=ee(),Ft=t.invert||N,xt=k==="loading";Q.current=a.useMemo(()=>ct*rt+_t,[ct,_t]),a.useEffect(()=>{at.current=Nt},[Nt]),a.useEffect(()=>{p(!0)},[]),a.useEffect(()=>{const n=P.current;if(n){const h=n.getBoundingClientRect().height;return Tt(h),T(w=>[{toastId:t.id,height:h,position:t.position},...w]),()=>T(w=>w.filter(_=>_.toastId!==t.id))}},[T,t.id]),a.useLayoutEffect(()=>{if(!l)return;const n=P.current,h=n.style.height;n.style.height="auto";const w=n.getBoundingClientRect().height;n.style.height=h,Tt(w),T(_=>_.find(x=>x.toastId===t.id)?_.map(x=>x.toastId===t.id?{...x,height:w}:x):[{toastId:t.id,height:w,position:t.position},..._])},[l,t.title,t.description,T,t.id,t.jsx,t.action,t.cancel]);const L=a.useCallback(()=>{R(!0),vt(Q.current),T(n=>n.filter(h=>h.toastId!==t.id)),setTimeout(()=>{ot(t)},pe)},[t,ot,T,Q]);a.useEffect(()=>{if(t.promise&&k==="loading"||t.duration===1/0||t.type==="loading")return;let n;return X||O||Dt?(()=>{if(kt.current<yt.current){const _=new Date().getTime()-yt.current;at.current=at.current-_}kt.current=new Date().getTime()})():(()=>{at.current!==1/0&&(yt.current=new Date().getTime(),n=setTimeout(()=>{t.onAutoClose==null||t.onAutoClose.call(t,t),L()},at.current))})(),()=>clearTimeout(n)},[X,O,t,k,Dt,L]),a.useEffect(()=>{t.delete&&(L(),t.onDismiss==null||t.onDismiss.call(t,t))},[L,t.delete]);function Vt(){var n;if(y!=null&&y.loading){var h;return a.createElement("div",{className:H(u==null?void 0:u.loader,t==null||(h=t.classNames)==null?void 0:h.loader,"sonner-loader"),"data-visible":k==="loading"},y.loading)}return a.createElement(qt,{className:H(u==null?void 0:u.loader,t==null||(n=t.classNames)==null?void 0:n.loader),visible:k==="loading"})}const Ut=t.icon||(y==null?void 0:y[k])||Wt(k);var Rt,Bt;return a.createElement("li",{tabIndex:0,ref:P,className:H(nt,Pt,u==null?void 0:u.toast,t==null||(s=t.classNames)==null?void 0:s.toast,u==null?void 0:u.default,u==null?void 0:u[k],t==null||(e=t.classNames)==null?void 0:e[k]),"data-sonner-toast":"","data-rich-colors":(Rt=t.richColors)!=null?Rt:gt,"data-styled":!(t.jsx||t.unstyled||E),"data-mounted":l,"data-promise":!!t.promise,"data-swiped":dt,"data-removed":m,"data-visible":zt,"data-y-position":Yt,"data-x-position":$t,"data-index":d,"data-front":Ot,"data-swiping":W,"data-dismissible":G,"data-type":k,"data-invert":Ft,"data-swipe-out":K,"data-swipe-direction":F,"data-expanded":!!(X||et&&l),"data-testid":t.testId,style:{"--index":d,"--toasts-before":d,"--z-index":st.length-d,"--offset":`${m?At:Q.current}px`,"--initial-height":et?"auto":`${Ht}px`,...Z,...t.style},onDragEnd:()=>{f(!1),M(null),J.current=null},onPointerDown:n=>{n.button!==2&&(xt||!G||(St.current=new Date,vt(Q.current),n.target.setPointerCapture(n.pointerId),n.target.tagName!=="BUTTON"&&(f(!0),J.current={x:n.clientX,y:n.clientY})))},onPointerUp:()=>{var n,h,w;if(K||!G)return;J.current=null;const _=Number(((n=P.current)==null?void 0:n.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ut=Number(((h=P.current)==null?void 0:h.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),x=new Date().getTime()-((w=St.current)==null?void 0:w.getTime()),B=$==="x"?_:ut,ft=Math.abs(B)/x;if(Math.abs(B)>=me||ft>.11){vt(Q.current),t.onDismiss==null||t.onDismiss.call(t,t),it($==="x"?_>0?"right":"left":ut>0?"down":"up"),L(),lt(!0);return}else{var I,C;(I=P.current)==null||I.style.setProperty("--swipe-amount-x","0px"),(C=P.current)==null||C.style.setProperty("--swipe-amount-y","0px")}q(!1),f(!1),M(null)},onPointerMove:n=>{var h,w,_;if(!J.current||!G||((h=window.getSelection())==null?void 0:h.toString().length)>0)return;const x=n.clientY-J.current.y,B=n.clientX-J.current.x;var ft;const I=(ft=r.swipeDirections)!=null?ft:ge(A);!$&&(Math.abs(B)>1||Math.abs(x)>1)&&M(Math.abs(B)>Math.abs(x)?"x":"y");let C={x:0,y:0};const Mt=V=>1/(1.5+Math.abs(V)/20);if($==="y"){if(I.includes("top")||I.includes("bottom"))if(I.includes("top")&&x<0||I.includes("bottom")&&x>0)C.y=x;else{const V=x*Mt(x);C.y=Math.abs(V)<Math.abs(x)?V:x}}else if($==="x"&&(I.includes("left")||I.includes("right")))if(I.includes("left")&&B<0||I.includes("right")&&B>0)C.x=B;else{const V=B*Mt(B);C.x=Math.abs(V)<Math.abs(B)?V:B}(Math.abs(C.x)>0||Math.abs(C.y)>0)&&q(!0),(w=P.current)==null||w.style.setProperty("--swipe-amount-x",`${C.x}px`),(_=P.current)==null||_.style.setProperty("--swipe-amount-y",`${C.y}px`)}},Lt&&!t.jsx&&k!=="loading"?a.createElement("button",{"aria-label":j,"data-disabled":xt,"data-close-button":!0,onClick:xt||!G?()=>{}:()=>{L(),t.onDismiss==null||t.onDismiss.call(t,t)},className:H(u==null?void 0:u.closeButton,t==null||(o=t.classNames)==null?void 0:o.closeButton)},(Bt=y==null?void 0:y.close)!=null?Bt:te):null,(k||t.icon||t.promise)&&t.icon!==null&&((y==null?void 0:y[k])!==null||t.icon)?a.createElement("div",{"data-icon":"",className:H(u==null?void 0:u.icon,t==null||(b=t.classNames)==null?void 0:b.icon)},t.promise||t.type==="loading"&&!t.icon?t.icon||Vt():null,t.type!=="loading"?Ut:null):null,a.createElement("div",{"data-content":"",className:H(u==null?void 0:u.content,t==null||(c=t.classNames)==null?void 0:c.content)},a.createElement("div",{"data-title":"",className:H(u==null?void 0:u.title,t==null||(g=t.classNames)==null?void 0:g.title)},t.jsx?t.jsx:typeof t.title=="function"?t.title():t.title),t.description?a.createElement("div",{"data-description":"",className:H(bt,jt,u==null?void 0:u.description,t==null||(D=t.classNames)==null?void 0:D.description)},typeof t.description=="function"?t.description():t.description):null),a.isValidElement(t.cancel)?t.cancel:t.cancel&&mt(t.cancel)?a.createElement("button",{"data-button":!0,"data-cancel":!0,style:t.cancelButtonStyle||Y,onClick:n=>{mt(t.cancel)&&G&&(t.cancel.onClick==null||t.cancel.onClick.call(t.cancel,n),L())},className:H(u==null?void 0:u.cancelButton,t==null||(v=t.classNames)==null?void 0:v.cancelButton)},t.cancel.label):null,a.isValidElement(t.action)?t.action:t.action&&mt(t.action)?a.createElement("button",{"data-button":!0,"data-action":!0,style:t.actionButtonStyle||ht,onClick:n=>{mt(t.action)&&(t.action.onClick==null||t.action.onClick.call(t.action,n),!n.defaultPrevented&&L())},className:H(u==null?void 0:u.actionButton,t==null||(i=t.classNames)==null?void 0:i.actionButton)},t.action.label):null)};function Ct(){if(typeof window>"u"||typeof document>"u")return"ltr";const r=document.documentElement.getAttribute("dir");return r==="auto"||!r?window.getComputedStyle(document.documentElement).direction:r}function be(r,s){const e={};return[r,s].forEach((o,b)=>{const c=b===1,g=c?"--mobile-offset":"--offset",D=c?ce:de;function v(i){["top","right","bottom","left"].forEach(N=>{e[`${g}-${N}`]=typeof i=="number"?`${i}px`:i})}typeof o=="number"||typeof o=="string"?v(o):typeof o=="object"?["top","right","bottom","left"].forEach(i=>{o[i]===void 0?e[`${g}-${i}`]=D:e[`${g}-${i}`]=typeof o[i]=="number"?`${o[i]}px`:o[i]}):v(D)}),e}function we(){const[r,s]=a.useState([]);return a.useEffect(()=>S.subscribe(e=>{if(e.dismiss){setTimeout(()=>{wt.flushSync(()=>{s(o=>o.filter(b=>b.id!==e.id))})});return}setTimeout(()=>{wt.flushSync(()=>{s(o=>{const b=o.findIndex(c=>c.id===e.id);return b!==-1?[...o.slice(0,b),{...o[b],...e},...o.slice(b+1)]:[e,...o]})})})}),[]),{toasts:r}}const Ee=a.forwardRef(function(s,e){const{id:o,invert:b,position:c="bottom-right",hotkey:g=["altKey","KeyT"],expand:D,closeButton:v,className:i,offset:N,mobileOffset:t,theme:E="light",richColors:O,duration:T,style:pt,visibleToasts:U=le,toastOptions:d,dir:st=Ct(),gap:X=fe,icons:ot,containerAriaLabel:gt="Notifications"}=s,[z,Z]=a.useState([]),Y=a.useMemo(()=>o?z.filter(l=>l.toasterId===o):z.filter(l=>!l.toasterId),[z,o]),ht=a.useMemo(()=>Array.from(new Set([c].concat(Y.filter(l=>l.position).map(l=>l.position)))),[Y,c]),[nt,bt]=a.useState([]),[tt,A]=a.useState(!1),[rt,et]=a.useState(!1),[u,y]=a.useState(E!=="system"?E:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=a.useRef(null),$=g.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=a.useRef(null),F=a.useRef(!1),it=a.useCallback(l=>{Z(p=>{var m;return(m=p.find(R=>R.id===l.id))!=null&&m.delete||S.dismiss(l.id),p.filter(({id:R})=>R!==l.id)})},[]);return a.useEffect(()=>S.subscribe(l=>{if(l.dismiss){requestAnimationFrame(()=>{Z(p=>p.map(m=>m.id===l.id?{...m,delete:!0}:m))});return}setTimeout(()=>{wt.flushSync(()=>{Z(p=>{const m=p.findIndex(R=>R.id===l.id);return m!==-1?[...p.slice(0,m),{...p[m],...l},...p.slice(m+1)]:[l,...p]})})})}),[z]),a.useEffect(()=>{if(E!=="system"){y(E);return}if(E==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?y("dark"):y("light")),typeof window>"u")return;const l=window.matchMedia("(prefers-color-scheme: dark)");try{l.addEventListener("change",({matches:p})=>{y(p?"dark":"light")})}catch{l.addListener(({matches:m})=>{try{y(m?"dark":"light")}catch(R){console.error(R)}})}},[E]),a.useEffect(()=>{z.length<=1&&A(!1)},[z]),a.useEffect(()=>{const l=p=>{var m;if(g.every(f=>p[f]||p.code===f)){var W;A(!0),(W=j.current)==null||W.focus()}p.code==="Escape"&&(document.activeElement===j.current||(m=j.current)!=null&&m.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[g]),a.useEffect(()=>{if(j.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,F.current=!1)}},[j.current]),a.createElement("section",{ref:e,"aria-label":`${gt} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ht.map((l,p)=>{var m;const[R,W]=l.split("-");return Y.length?a.createElement("ol",{key:l,dir:st==="auto"?Ct():st,tabIndex:-1,ref:j,className:i,"data-sonner-toaster":!0,"data-sonner-theme":u,"data-y-position":R,"data-x-position":W,style:{"--front-toast-height":`${((m=nt[0])==null?void 0:m.height)||0}px`,"--width":`${ue}px`,"--gap":`${X}px`,...pt,...be(N,t)},onBlur:f=>{F.current&&!f.currentTarget.contains(f.relatedTarget)&&(F.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:f=>{f.target instanceof HTMLElement&&f.target.dataset.dismissible==="false"||F.current||(F.current=!0,M.current=f.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{rt||A(!1)},onDragEnd:()=>A(!1),onPointerDown:f=>{f.target instanceof HTMLElement&&f.target.dataset.dismissible==="false"||et(!0)},onPointerUp:()=>et(!1)},Y.filter(f=>!f.position&&p===0||f.position===l).map((f,K)=>{var lt,dt;return a.createElement(he,{key:f.id,icons:ot,index:K,toast:f,defaultRichColors:O,duration:(lt=d==null?void 0:d.duration)!=null?lt:T,className:d==null?void 0:d.className,descriptionClassName:d==null?void 0:d.descriptionClassName,invert:b,visibleToasts:U,closeButton:(dt=d==null?void 0:d.closeButton)!=null?dt:v,interacting:rt,position:l,style:d==null?void 0:d.style,unstyled:d==null?void 0:d.unstyled,classNames:d==null?void 0:d.classNames,cancelButtonStyle:d==null?void 0:d.cancelButtonStyle,actionButtonStyle:d==null?void 0:d.actionButtonStyle,closeButtonAriaLabel:d==null?void 0:d.closeButtonAriaLabel,removeToast:it,toasts:Y.filter(q=>q.position==f.position),heights:nt.filter(q=>q.position==f.position),setHeights:bt,expandByDefault:D,gap:X,expanded:tt,swipeDirections:s.swipeDirections})})):null}))});export{Ee as Toaster,xe as toast,we as useSonner};
1
+ import{R as a,a as wt}from"./index-D6kQbrcz.js";function Xt(r){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css",s.appendChild(e),e.styleSheet?e.styleSheet.cssText=r:e.appendChild(document.createTextNode(r))}const Wt=r=>{switch(r){case"success":return Gt;case"info":return Jt;case"warning":return Qt;case"error":return Zt;default:return null}},Kt=Array(12).fill(0),qt=({visible:r,className:s})=>a.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":r},a.createElement("div",{className:"sonner-spinner"},Kt.map((e,o)=>a.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${o}`})))),Gt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Qt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Jt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Zt=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},a.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),te=a.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},a.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),ee=()=>{const[r,s]=a.useState(document.hidden);return a.useEffect(()=>{const e=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),r};let Et=1;class ae{constructor(){this.subscribe=s=>(this.subscribers.push(s),()=>{const e=this.subscribers.indexOf(s);this.subscribers.splice(e,1)}),this.publish=s=>{this.subscribers.forEach(e=>e(s))},this.addToast=s=>{this.publish(s),this.toasts=[...this.toasts,s]},this.create=s=>{var e;const{message:o,...b}=s,c=typeof(s==null?void 0:s.id)=="number"||((e=s.id)==null?void 0:e.length)>0?s.id:Et++,g=this.toasts.find(v=>v.id===c),D=s.dismissible===void 0?!0:s.dismissible;return this.dismissedToasts.has(c)&&this.dismissedToasts.delete(c),g?this.toasts=this.toasts.map(v=>v.id===c?(this.publish({...v,...s,id:c,title:o}),{...v,...s,id:c,dismissible:D,title:o}):v):this.addToast({title:o,...b,dismissible:D,id:c}),c},this.dismiss=s=>(s?(this.dismissedToasts.add(s),requestAnimationFrame(()=>this.subscribers.forEach(e=>e({id:s,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(o=>o({id:e.id,dismiss:!0}))}),s),this.message=(s,e)=>this.create({...e,message:s}),this.error=(s,e)=>this.create({...e,message:s,type:"error"}),this.success=(s,e)=>this.create({...e,type:"success",message:s}),this.info=(s,e)=>this.create({...e,type:"info",message:s}),this.warning=(s,e)=>this.create({...e,type:"warning",message:s}),this.loading=(s,e)=>this.create({...e,type:"loading",message:s}),this.promise=(s,e)=>{if(!e)return;let o;e.loading!==void 0&&(o=this.create({...e,promise:s,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));const b=Promise.resolve(s instanceof Function?s():s);let c=o!==void 0,g;const D=b.then(async i=>{if(g=["resolve",i],a.isValidElement(i))c=!1,this.create({id:o,type:"default",message:i});else if(oe(i)&&!i.ok){c=!1;const t=typeof e.error=="function"?await e.error(`HTTP error! status: ${i.status}`):e.error,E=typeof e.description=="function"?await e.description(`HTTP error! status: ${i.status}`):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"error",description:E,...T})}else if(i instanceof Error){c=!1;const t=typeof e.error=="function"?await e.error(i):e.error,E=typeof e.description=="function"?await e.description(i):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"error",description:E,...T})}else if(e.success!==void 0){c=!1;const t=typeof e.success=="function"?await e.success(i):e.success,E=typeof e.description=="function"?await e.description(i):e.description,T=typeof t=="object"&&!a.isValidElement(t)?t:{message:t};this.create({id:o,type:"success",description:E,...T})}}).catch(async i=>{if(g=["reject",i],e.error!==void 0){c=!1;const N=typeof e.error=="function"?await e.error(i):e.error,t=typeof e.description=="function"?await e.description(i):e.description,O=typeof N=="object"&&!a.isValidElement(N)?N:{message:N};this.create({id:o,type:"error",description:t,...O})}}).finally(()=>{c&&(this.dismiss(o),o=void 0),e.finally==null||e.finally.call(e)}),v=()=>new Promise((i,N)=>D.then(()=>g[0]==="reject"?N(g[1]):i(g[1])).catch(N));return typeof o!="string"&&typeof o!="number"?{unwrap:v}:Object.assign(o,{unwrap:v})},this.custom=(s,e)=>{const o=(e==null?void 0:e.id)||Et++;return this.create({jsx:s(o),id:o,...e}),o},this.getActiveToasts=()=>this.toasts.filter(s=>!this.dismissedToasts.has(s.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const S=new ae,se=(r,s)=>{const e=(s==null?void 0:s.id)||Et++;return S.addToast({title:r,...s,id:e}),e},oe=r=>r&&typeof r=="object"&&"ok"in r&&typeof r.ok=="boolean"&&"status"in r&&typeof r.status=="number",ne=se,re=()=>S.toasts,ie=()=>S.getActiveToasts(),xe=Object.assign(ne,{success:S.success,info:S.info,warning:S.warning,error:S.error,custom:S.custom,message:S.message,promise:S.promise,dismiss:S.dismiss,loading:S.loading},{getHistory:re,getToasts:ie});Xt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function mt(r){return r.label!==void 0}const le=3,de="24px",ce="16px",It=4e3,ue=356,fe=14,me=45,pe=200;function H(...r){return r.filter(Boolean).join(" ")}function ge(r){const[s,e]=r.split("-"),o=[];return s&&o.push(s),e&&o.push(e),o}const he=r=>{var s,e,o,b,c,g,D,v,i;const{invert:N,toast:t,unstyled:E,interacting:O,setHeights:T,visibleToasts:pt,heights:U,index:d,toasts:st,expanded:X,removeToast:ot,defaultRichColors:gt,closeButton:z,style:Z,cancelButtonStyle:Y,actionButtonStyle:ht,className:nt="",descriptionClassName:bt="",duration:tt,position:A,gap:rt,expandByDefault:et,classNames:u,icons:y,closeButtonAriaLabel:j="Close toast"}=r,[$,M]=a.useState(null),[F,it]=a.useState(null),[l,p]=a.useState(!1),[m,R]=a.useState(!1),[W,f]=a.useState(!1),[K,lt]=a.useState(!1),[dt,q]=a.useState(!1),[At,vt]=a.useState(0),[Ht,Tt]=a.useState(0),at=a.useRef(t.duration||tt||It),St=a.useRef(null),P=a.useRef(null),Ot=d===0,zt=d+1<=pt,k=t.type,G=t.dismissible!==!1,Pt=t.className||"",jt=t.descriptionClassName||"",ct=a.useMemo(()=>U.findIndex(n=>n.toastId===t.id)||0,[U,t.id]),Lt=a.useMemo(()=>{var n;return(n=t.closeButton)!=null?n:z},[t.closeButton,z]),Nt=a.useMemo(()=>t.duration||tt||It,[t.duration,tt]),yt=a.useRef(0),Q=a.useRef(0),kt=a.useRef(0),J=a.useRef(null),[Yt,$t]=A.split("-"),_t=a.useMemo(()=>U.reduce((n,h,w)=>w>=ct?n:n+h.height,0),[U,ct]),Dt=ee(),Ft=t.invert||N,xt=k==="loading";Q.current=a.useMemo(()=>ct*rt+_t,[ct,_t]),a.useEffect(()=>{at.current=Nt},[Nt]),a.useEffect(()=>{p(!0)},[]),a.useEffect(()=>{const n=P.current;if(n){const h=n.getBoundingClientRect().height;return Tt(h),T(w=>[{toastId:t.id,height:h,position:t.position},...w]),()=>T(w=>w.filter(_=>_.toastId!==t.id))}},[T,t.id]),a.useLayoutEffect(()=>{if(!l)return;const n=P.current,h=n.style.height;n.style.height="auto";const w=n.getBoundingClientRect().height;n.style.height=h,Tt(w),T(_=>_.find(x=>x.toastId===t.id)?_.map(x=>x.toastId===t.id?{...x,height:w}:x):[{toastId:t.id,height:w,position:t.position},..._])},[l,t.title,t.description,T,t.id,t.jsx,t.action,t.cancel]);const L=a.useCallback(()=>{R(!0),vt(Q.current),T(n=>n.filter(h=>h.toastId!==t.id)),setTimeout(()=>{ot(t)},pe)},[t,ot,T,Q]);a.useEffect(()=>{if(t.promise&&k==="loading"||t.duration===1/0||t.type==="loading")return;let n;return X||O||Dt?(()=>{if(kt.current<yt.current){const _=new Date().getTime()-yt.current;at.current=at.current-_}kt.current=new Date().getTime()})():(()=>{at.current!==1/0&&(yt.current=new Date().getTime(),n=setTimeout(()=>{t.onAutoClose==null||t.onAutoClose.call(t,t),L()},at.current))})(),()=>clearTimeout(n)},[X,O,t,k,Dt,L]),a.useEffect(()=>{t.delete&&(L(),t.onDismiss==null||t.onDismiss.call(t,t))},[L,t.delete]);function Vt(){var n;if(y!=null&&y.loading){var h;return a.createElement("div",{className:H(u==null?void 0:u.loader,t==null||(h=t.classNames)==null?void 0:h.loader,"sonner-loader"),"data-visible":k==="loading"},y.loading)}return a.createElement(qt,{className:H(u==null?void 0:u.loader,t==null||(n=t.classNames)==null?void 0:n.loader),visible:k==="loading"})}const Ut=t.icon||(y==null?void 0:y[k])||Wt(k);var Rt,Bt;return a.createElement("li",{tabIndex:0,ref:P,className:H(nt,Pt,u==null?void 0:u.toast,t==null||(s=t.classNames)==null?void 0:s.toast,u==null?void 0:u.default,u==null?void 0:u[k],t==null||(e=t.classNames)==null?void 0:e[k]),"data-sonner-toast":"","data-rich-colors":(Rt=t.richColors)!=null?Rt:gt,"data-styled":!(t.jsx||t.unstyled||E),"data-mounted":l,"data-promise":!!t.promise,"data-swiped":dt,"data-removed":m,"data-visible":zt,"data-y-position":Yt,"data-x-position":$t,"data-index":d,"data-front":Ot,"data-swiping":W,"data-dismissible":G,"data-type":k,"data-invert":Ft,"data-swipe-out":K,"data-swipe-direction":F,"data-expanded":!!(X||et&&l),"data-testid":t.testId,style:{"--index":d,"--toasts-before":d,"--z-index":st.length-d,"--offset":`${m?At:Q.current}px`,"--initial-height":et?"auto":`${Ht}px`,...Z,...t.style},onDragEnd:()=>{f(!1),M(null),J.current=null},onPointerDown:n=>{n.button!==2&&(xt||!G||(St.current=new Date,vt(Q.current),n.target.setPointerCapture(n.pointerId),n.target.tagName!=="BUTTON"&&(f(!0),J.current={x:n.clientX,y:n.clientY})))},onPointerUp:()=>{var n,h,w;if(K||!G)return;J.current=null;const _=Number(((n=P.current)==null?void 0:n.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ut=Number(((h=P.current)==null?void 0:h.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),x=new Date().getTime()-((w=St.current)==null?void 0:w.getTime()),B=$==="x"?_:ut,ft=Math.abs(B)/x;if(Math.abs(B)>=me||ft>.11){vt(Q.current),t.onDismiss==null||t.onDismiss.call(t,t),it($==="x"?_>0?"right":"left":ut>0?"down":"up"),L(),lt(!0);return}else{var I,C;(I=P.current)==null||I.style.setProperty("--swipe-amount-x","0px"),(C=P.current)==null||C.style.setProperty("--swipe-amount-y","0px")}q(!1),f(!1),M(null)},onPointerMove:n=>{var h,w,_;if(!J.current||!G||((h=window.getSelection())==null?void 0:h.toString().length)>0)return;const x=n.clientY-J.current.y,B=n.clientX-J.current.x;var ft;const I=(ft=r.swipeDirections)!=null?ft:ge(A);!$&&(Math.abs(B)>1||Math.abs(x)>1)&&M(Math.abs(B)>Math.abs(x)?"x":"y");let C={x:0,y:0};const Mt=V=>1/(1.5+Math.abs(V)/20);if($==="y"){if(I.includes("top")||I.includes("bottom"))if(I.includes("top")&&x<0||I.includes("bottom")&&x>0)C.y=x;else{const V=x*Mt(x);C.y=Math.abs(V)<Math.abs(x)?V:x}}else if($==="x"&&(I.includes("left")||I.includes("right")))if(I.includes("left")&&B<0||I.includes("right")&&B>0)C.x=B;else{const V=B*Mt(B);C.x=Math.abs(V)<Math.abs(B)?V:B}(Math.abs(C.x)>0||Math.abs(C.y)>0)&&q(!0),(w=P.current)==null||w.style.setProperty("--swipe-amount-x",`${C.x}px`),(_=P.current)==null||_.style.setProperty("--swipe-amount-y",`${C.y}px`)}},Lt&&!t.jsx&&k!=="loading"?a.createElement("button",{"aria-label":j,"data-disabled":xt,"data-close-button":!0,onClick:xt||!G?()=>{}:()=>{L(),t.onDismiss==null||t.onDismiss.call(t,t)},className:H(u==null?void 0:u.closeButton,t==null||(o=t.classNames)==null?void 0:o.closeButton)},(Bt=y==null?void 0:y.close)!=null?Bt:te):null,(k||t.icon||t.promise)&&t.icon!==null&&((y==null?void 0:y[k])!==null||t.icon)?a.createElement("div",{"data-icon":"",className:H(u==null?void 0:u.icon,t==null||(b=t.classNames)==null?void 0:b.icon)},t.promise||t.type==="loading"&&!t.icon?t.icon||Vt():null,t.type!=="loading"?Ut:null):null,a.createElement("div",{"data-content":"",className:H(u==null?void 0:u.content,t==null||(c=t.classNames)==null?void 0:c.content)},a.createElement("div",{"data-title":"",className:H(u==null?void 0:u.title,t==null||(g=t.classNames)==null?void 0:g.title)},t.jsx?t.jsx:typeof t.title=="function"?t.title():t.title),t.description?a.createElement("div",{"data-description":"",className:H(bt,jt,u==null?void 0:u.description,t==null||(D=t.classNames)==null?void 0:D.description)},typeof t.description=="function"?t.description():t.description):null),a.isValidElement(t.cancel)?t.cancel:t.cancel&&mt(t.cancel)?a.createElement("button",{"data-button":!0,"data-cancel":!0,style:t.cancelButtonStyle||Y,onClick:n=>{mt(t.cancel)&&G&&(t.cancel.onClick==null||t.cancel.onClick.call(t.cancel,n),L())},className:H(u==null?void 0:u.cancelButton,t==null||(v=t.classNames)==null?void 0:v.cancelButton)},t.cancel.label):null,a.isValidElement(t.action)?t.action:t.action&&mt(t.action)?a.createElement("button",{"data-button":!0,"data-action":!0,style:t.actionButtonStyle||ht,onClick:n=>{mt(t.action)&&(t.action.onClick==null||t.action.onClick.call(t.action,n),!n.defaultPrevented&&L())},className:H(u==null?void 0:u.actionButton,t==null||(i=t.classNames)==null?void 0:i.actionButton)},t.action.label):null)};function Ct(){if(typeof window>"u"||typeof document>"u")return"ltr";const r=document.documentElement.getAttribute("dir");return r==="auto"||!r?window.getComputedStyle(document.documentElement).direction:r}function be(r,s){const e={};return[r,s].forEach((o,b)=>{const c=b===1,g=c?"--mobile-offset":"--offset",D=c?ce:de;function v(i){["top","right","bottom","left"].forEach(N=>{e[`${g}-${N}`]=typeof i=="number"?`${i}px`:i})}typeof o=="number"||typeof o=="string"?v(o):typeof o=="object"?["top","right","bottom","left"].forEach(i=>{o[i]===void 0?e[`${g}-${i}`]=D:e[`${g}-${i}`]=typeof o[i]=="number"?`${o[i]}px`:o[i]}):v(D)}),e}function we(){const[r,s]=a.useState([]);return a.useEffect(()=>S.subscribe(e=>{if(e.dismiss){setTimeout(()=>{wt.flushSync(()=>{s(o=>o.filter(b=>b.id!==e.id))})});return}setTimeout(()=>{wt.flushSync(()=>{s(o=>{const b=o.findIndex(c=>c.id===e.id);return b!==-1?[...o.slice(0,b),{...o[b],...e},...o.slice(b+1)]:[e,...o]})})})}),[]),{toasts:r}}const Ee=a.forwardRef(function(s,e){const{id:o,invert:b,position:c="bottom-right",hotkey:g=["altKey","KeyT"],expand:D,closeButton:v,className:i,offset:N,mobileOffset:t,theme:E="light",richColors:O,duration:T,style:pt,visibleToasts:U=le,toastOptions:d,dir:st=Ct(),gap:X=fe,icons:ot,containerAriaLabel:gt="Notifications"}=s,[z,Z]=a.useState([]),Y=a.useMemo(()=>o?z.filter(l=>l.toasterId===o):z.filter(l=>!l.toasterId),[z,o]),ht=a.useMemo(()=>Array.from(new Set([c].concat(Y.filter(l=>l.position).map(l=>l.position)))),[Y,c]),[nt,bt]=a.useState([]),[tt,A]=a.useState(!1),[rt,et]=a.useState(!1),[u,y]=a.useState(E!=="system"?E:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),j=a.useRef(null),$=g.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=a.useRef(null),F=a.useRef(!1),it=a.useCallback(l=>{Z(p=>{var m;return(m=p.find(R=>R.id===l.id))!=null&&m.delete||S.dismiss(l.id),p.filter(({id:R})=>R!==l.id)})},[]);return a.useEffect(()=>S.subscribe(l=>{if(l.dismiss){requestAnimationFrame(()=>{Z(p=>p.map(m=>m.id===l.id?{...m,delete:!0}:m))});return}setTimeout(()=>{wt.flushSync(()=>{Z(p=>{const m=p.findIndex(R=>R.id===l.id);return m!==-1?[...p.slice(0,m),{...p[m],...l},...p.slice(m+1)]:[l,...p]})})})}),[z]),a.useEffect(()=>{if(E!=="system"){y(E);return}if(E==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?y("dark"):y("light")),typeof window>"u")return;const l=window.matchMedia("(prefers-color-scheme: dark)");try{l.addEventListener("change",({matches:p})=>{y(p?"dark":"light")})}catch{l.addListener(({matches:m})=>{try{y(m?"dark":"light")}catch(R){console.error(R)}})}},[E]),a.useEffect(()=>{z.length<=1&&A(!1)},[z]),a.useEffect(()=>{const l=p=>{var m;if(g.every(f=>p[f]||p.code===f)){var W;A(!0),(W=j.current)==null||W.focus()}p.code==="Escape"&&(document.activeElement===j.current||(m=j.current)!=null&&m.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[g]),a.useEffect(()=>{if(j.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,F.current=!1)}},[j.current]),a.createElement("section",{ref:e,"aria-label":`${gt} ${$}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ht.map((l,p)=>{var m;const[R,W]=l.split("-");return Y.length?a.createElement("ol",{key:l,dir:st==="auto"?Ct():st,tabIndex:-1,ref:j,className:i,"data-sonner-toaster":!0,"data-sonner-theme":u,"data-y-position":R,"data-x-position":W,style:{"--front-toast-height":`${((m=nt[0])==null?void 0:m.height)||0}px`,"--width":`${ue}px`,"--gap":`${X}px`,...pt,...be(N,t)},onBlur:f=>{F.current&&!f.currentTarget.contains(f.relatedTarget)&&(F.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:f=>{f.target instanceof HTMLElement&&f.target.dataset.dismissible==="false"||F.current||(F.current=!0,M.current=f.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{rt||A(!1)},onDragEnd:()=>A(!1),onPointerDown:f=>{f.target instanceof HTMLElement&&f.target.dataset.dismissible==="false"||et(!0)},onPointerUp:()=>et(!1)},Y.filter(f=>!f.position&&p===0||f.position===l).map((f,K)=>{var lt,dt;return a.createElement(he,{key:f.id,icons:ot,index:K,toast:f,defaultRichColors:O,duration:(lt=d==null?void 0:d.duration)!=null?lt:T,className:d==null?void 0:d.className,descriptionClassName:d==null?void 0:d.descriptionClassName,invert:b,visibleToasts:U,closeButton:(dt=d==null?void 0:d.closeButton)!=null?dt:v,interacting:rt,position:l,style:d==null?void 0:d.style,unstyled:d==null?void 0:d.unstyled,classNames:d==null?void 0:d.classNames,cancelButtonStyle:d==null?void 0:d.cancelButtonStyle,actionButtonStyle:d==null?void 0:d.actionButtonStyle,closeButtonAriaLabel:d==null?void 0:d.closeButtonAriaLabel,removeToast:it,toasts:Y.filter(q=>q.position==f.position),heights:nt.filter(q=>q.position==f.position),setHeights:bt,expandByDefault:D,gap:X,expanded:tt,swipeDirections:s.swipeDirections})})):null}))});export{Ee as Toaster,xe as toast,we as useSonner};