@commentkit/comment-kit 0.7.4 → 0.7.5

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 (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +2 -2
  3. package/SECURITY.md +1 -1
  4. package/dist/angular.es.js +2 -2
  5. package/dist/comment-kit.es.js +3 -3
  6. package/dist/demo.es.js +24 -15
  7. package/dist/headless.es.js +2 -2
  8. package/dist/preact.es.js +2 -2
  9. package/dist/qwik.qwik.mjs +2 -2
  10. package/dist/react.es.js +2 -2
  11. package/dist/shared/ShadowRootContext-DD6a0QaI.js +11 -0
  12. package/dist/shared/annotation-toolbar-DgqxkHy8.js +1085 -0
  13. package/dist/shared/{attachment-refresh-DmVkfPtl.js → attachment-refresh-DRX7dKDI.js} +3 -3
  14. package/dist/shared/{button-By0hGrJK.js → button-D4GHW6oZ.js} +133 -164
  15. package/dist/shared/{button-group-C285iSkZ.js → button-group-BVR7iT-S.js} +13 -13
  16. package/dist/shared/{comment-drawing-canvas-zIPS1dnW.js → comment-drawing-canvas-hSdcLShI.js} +2 -2
  17. package/dist/shared/{comment-icon-4SQd3nlz.js → comment-icon-D8JTCEJ7.js} +109 -110
  18. package/dist/shared/{comment-image-lightbox-CdMNf0_y.js → comment-image-lightbox-4zroOCCG.js} +7 -7
  19. package/dist/shared/{comment-images-content-DqeqmQnb.js → comment-images-content-D4hTya6e.js} +28 -28
  20. package/dist/shared/{comment-kit-core-C-0JJS2i.js → comment-kit-core-D068rcdY.js} +467 -503
  21. package/dist/shared/{comment-kit-ui-CBaz7L3u.js → comment-kit-ui-BDzNt0jv.js} +5077 -5253
  22. package/dist/shared/{comment-screenshot-annotator-CuYmKafz.js → comment-screenshot-annotator-BGnu_NgP.js} +2 -2
  23. package/dist/shared/{comment-screenshot-overlay-Dw81osel.js → comment-screenshot-overlay-BCRmojWB.js} +4 -4
  24. package/dist/shared/{dev-export-panel-D08M2LKD.js → dev-export-panel-CYmUKmIV.js} +3 -3
  25. package/dist/shared/{dev-grab-BJLZZ2xU.js → dev-grab-BYsCpsGI.js} +48 -47
  26. package/dist/shared/dist-D9A5k-N4.js +617 -0
  27. package/dist/shared/{element-selector-Biyn2cpR.js → element-selector-79Oo5pit.js} +4 -4
  28. package/dist/shared/{mount-ui-DXdL3p9b.js → mount-ui-DuHk132g.js} +4 -4
  29. package/dist/shared/{pusher-D4M5K6Dk.js → pusher-3jyUauYd.js} +1 -1
  30. package/dist/shared/{realtime-BTqYEy8s.js → realtime-DspH16g5.js} +41 -28
  31. package/dist/shared/{realtime-recovery-BSVMwsXJ.js → realtime-recovery-BjlV-ewc.js} +57 -30
  32. package/dist/shared/screenshot-BIuEaRiu.js +199 -0
  33. package/dist/shared/{separator-aphZiRoJ.js → separator-UhJb0Row.js} +1222 -1288
  34. package/dist/shared/{shadow-root-C58Ap5Nu.js → shadow-root-3-yGIhMs.js} +3 -5
  35. package/dist/shared/{token-session-D0Y_HZw0.js → token-session-_Pi4fOEi.js} +1 -1
  36. package/dist/shared/{useRender-D1z_X_BY.js → useRender-Uxk1OPK-.js} +1 -1
  37. package/dist/shared/{useValueChanged-CrzfD8l-.js → useValueChanged-DKq5cMot.js} +13 -13
  38. package/dist/shared/{websocket-manager-BFKa95TO.js → websocket-manager-CvgZSo_L.js} +2 -2
  39. package/dist/solid.es.js +2 -2
  40. package/dist/svelte.es.js +2 -2
  41. package/dist/types/core/api-client.d.ts +17 -9
  42. package/dist/types/core/comment-kit-core.d.ts +4 -2
  43. package/dist/types/core/types.d.ts +37 -4
  44. package/dist/vue.es.js +2 -2
  45. package/docs/api-reference.md +29 -17
  46. package/package.json +1 -1
  47. package/dist/shared/ShadowRootContext-CjciYxVN.js +0 -13
  48. package/dist/shared/annotation-toolbar-CpPKy0oq.js +0 -1094
  49. package/dist/shared/dist-De294MVF.js +0 -623
@@ -1,623 +0,0 @@
1
- import e from "react";
2
- import t from "react-dom";
3
- function n(e) {
4
- if (!e || typeof document > "u") return;
5
- let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
6
- n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
7
- }
8
- var r = (e) => {
9
- switch (e) {
10
- case "success": return o;
11
- case "info": return c;
12
- case "warning": return s;
13
- case "error": return l;
14
- default: return null;
15
- }
16
- }, i = Array(12).fill(0), a = ({ visible: t, className: n }) => /*#__PURE__*/ e.createElement("div", {
17
- className: ["sonner-loading-wrapper", n].filter(Boolean).join(" "),
18
- "data-visible": t
19
- }, /*#__PURE__*/ e.createElement("div", { className: "sonner-spinner" }, i.map((t, n) => /*#__PURE__*/ e.createElement("div", {
20
- className: "sonner-loading-bar",
21
- key: `spinner-bar-${n}`
22
- })))), o = /*#__PURE__*/ e.createElement("svg", {
23
- xmlns: "http://www.w3.org/2000/svg",
24
- viewBox: "0 0 20 20",
25
- fill: "currentColor",
26
- height: "20",
27
- width: "20",
28
- "aria-hidden": "true"
29
- }, /*#__PURE__*/ e.createElement("path", {
30
- fillRule: "evenodd",
31
- 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",
32
- clipRule: "evenodd"
33
- })), s = /*#__PURE__*/ e.createElement("svg", {
34
- xmlns: "http://www.w3.org/2000/svg",
35
- viewBox: "0 0 24 24",
36
- fill: "currentColor",
37
- height: "20",
38
- width: "20",
39
- "aria-hidden": "true"
40
- }, /*#__PURE__*/ e.createElement("path", {
41
- fillRule: "evenodd",
42
- 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",
43
- clipRule: "evenodd"
44
- })), c = /*#__PURE__*/ e.createElement("svg", {
45
- xmlns: "http://www.w3.org/2000/svg",
46
- viewBox: "0 0 20 20",
47
- fill: "currentColor",
48
- height: "20",
49
- width: "20",
50
- "aria-hidden": "true"
51
- }, /*#__PURE__*/ e.createElement("path", {
52
- fillRule: "evenodd",
53
- 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",
54
- clipRule: "evenodd"
55
- })), l = /*#__PURE__*/ e.createElement("svg", {
56
- xmlns: "http://www.w3.org/2000/svg",
57
- viewBox: "0 0 20 20",
58
- fill: "currentColor",
59
- height: "20",
60
- width: "20",
61
- "aria-hidden": "true"
62
- }, /*#__PURE__*/ e.createElement("path", {
63
- fillRule: "evenodd",
64
- 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",
65
- clipRule: "evenodd"
66
- })), u = /*#__PURE__*/ e.createElement("svg", {
67
- xmlns: "http://www.w3.org/2000/svg",
68
- width: "12",
69
- height: "12",
70
- viewBox: "0 0 24 24",
71
- fill: "none",
72
- stroke: "currentColor",
73
- strokeWidth: "1.5",
74
- strokeLinecap: "round",
75
- strokeLinejoin: "round",
76
- "aria-hidden": "true"
77
- }, /*#__PURE__*/ e.createElement("line", {
78
- x1: "18",
79
- y1: "6",
80
- x2: "6",
81
- y2: "18"
82
- }), /*#__PURE__*/ e.createElement("line", {
83
- x1: "6",
84
- y1: "6",
85
- x2: "18",
86
- y2: "18"
87
- })), ee = () => {
88
- let [t, n] = e.useState(document.hidden);
89
- return e.useEffect(() => {
90
- let e = () => {
91
- n(document.hidden);
92
- };
93
- return document.addEventListener("visibilitychange", e), () => document.removeEventListener("visibilitychange", e);
94
- }, []), t;
95
- }, d = 1, f = 100, p = (e) => typeof e?.id == "number" || e?.id?.length > 0 ? e.id : d++, m = new class {
96
- constructor() {
97
- this.subscribe = (e) => (this.subscribers.push(e), this.getActiveToasts().forEach((t) => e(t)), () => {
98
- let t = this.subscribers.indexOf(e);
99
- this.subscribers.splice(t, 1);
100
- }), this.publish = (e) => {
101
- this.subscribers.forEach((t) => t(e));
102
- }, this.addToast = (e) => {
103
- this.publish(e), this.toasts = [...this.toasts, e], this.trimHistory();
104
- }, this.trimHistory = () => {
105
- let e = this.toasts.length - f;
106
- e <= 0 || (this.toasts = this.toasts.filter((t) => e > 0 && this.dismissedToasts.has(t.id) ? (this.dismissedToasts.delete(t.id), e--, !1) : !0));
107
- }, this.create = (e) => {
108
- let { message: t, ...n } = e, r = p(e), i = this.pendingDismissals.get(r);
109
- i !== void 0 && (cancelAnimationFrame(i), this.pendingDismissals.delete(r), this.dismissedToasts.delete(r));
110
- let a = this.dismissedToasts.has(r), o = e.dismissible === void 0 || e.dismissible;
111
- return a && (this.dismissedToasts.delete(r), this.toasts = this.toasts.filter((e) => e.id !== r)), !a && this.toasts.find((e) => e.id === r) ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
112
- ...n,
113
- ...e,
114
- id: r,
115
- title: t
116
- }), {
117
- ...n,
118
- ...e,
119
- id: r,
120
- dismissible: o,
121
- title: t
122
- }) : n) : this.addToast({
123
- title: t,
124
- ...n,
125
- dismissible: o,
126
- id: r
127
- }), r;
128
- }, this.dismiss = (e) => {
129
- if (e == null) return this.getActiveToasts().forEach((e) => {
130
- this.dismissedToasts.add(e.id), this.subscribers.forEach((t) => t({
131
- id: e.id,
132
- dismiss: !0
133
- }));
134
- }), e;
135
- this.dismissedToasts.add(e);
136
- let t = this.pendingDismissals.get(e);
137
- return t !== void 0 && cancelAnimationFrame(t), this.pendingDismissals.set(e, requestAnimationFrame(() => {
138
- this.pendingDismissals.delete(e), this.subscribers.forEach((t) => t({
139
- id: e,
140
- dismiss: !0
141
- }));
142
- })), e;
143
- }, this.message = (e, t) => this.create({
144
- ...t,
145
- message: e,
146
- type: void 0
147
- }), this.error = (e, t) => this.create({
148
- ...t,
149
- message: e,
150
- type: "error"
151
- }), this.success = (e, t) => this.create({
152
- ...t,
153
- type: "success",
154
- message: e
155
- }), this.info = (e, t) => this.create({
156
- ...t,
157
- type: "info",
158
- message: e
159
- }), this.warning = (e, t) => this.create({
160
- ...t,
161
- type: "warning",
162
- message: e
163
- }), this.loading = (e, t) => this.create({
164
- ...t,
165
- type: "loading",
166
- message: e
167
- }), this.promise = (t, n) => {
168
- if (!n) return;
169
- let r;
170
- n.loading !== void 0 && (r = this.create({
171
- ...n,
172
- promise: t,
173
- type: "loading",
174
- message: n.loading,
175
- description: typeof n.description == "function" ? void 0 : n.description
176
- }));
177
- let i = Promise.resolve(t instanceof Function ? t() : t), a = r !== void 0, o, s = i.then(async (t) => {
178
- if (o = ["resolve", t], e.isValidElement(t)) a = !1, this.create({
179
- id: r,
180
- type: "default",
181
- message: t
182
- });
183
- else if (g(t) && !t.ok) {
184
- a = !1;
185
- let i = typeof n.error == "function" ? await n.error(`HTTP error! status: ${t.status}`) : n.error, o = typeof n.description == "function" ? await n.description(`HTTP error! status: ${t.status}`) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
186
- this.create({
187
- id: r,
188
- type: "error",
189
- description: o,
190
- ...s
191
- });
192
- } else if (t instanceof Error) {
193
- a = !1;
194
- let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
195
- this.create({
196
- id: r,
197
- type: "error",
198
- description: o,
199
- ...s
200
- });
201
- } else if (n.success !== void 0) {
202
- a = !1;
203
- let i = typeof n.success == "function" ? await n.success(t) : n.success, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
204
- this.create({
205
- id: r,
206
- type: "success",
207
- description: o,
208
- ...s
209
- });
210
- }
211
- }).catch(async (t) => {
212
- if (o = ["reject", t], n.error !== void 0) {
213
- a = !1;
214
- let i = typeof n.error == "function" ? await n.error(t) : n.error, o = typeof n.description == "function" ? await n.description(t) : n.description, s = typeof i == "object" && !e.isValidElement(i) ? i : { message: i };
215
- this.create({
216
- id: r,
217
- type: "error",
218
- description: o,
219
- ...s
220
- });
221
- }
222
- }).finally(() => {
223
- a && (this.dismiss(r), r = void 0), n.finally == null || n.finally.call(n);
224
- }), c = () => new Promise((e, t) => s.then(() => o[0] === "reject" ? t(o[1]) : e(o[1])).catch(t));
225
- return typeof r != "string" && typeof r != "number" ? { unwrap: c } : Object.assign(r, { unwrap: c });
226
- }, this.custom = (e, t) => {
227
- let n = p(t);
228
- return this.create({
229
- ...t,
230
- jsx: e(n),
231
- id: n,
232
- type: void 0
233
- }), n;
234
- }, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set(), this.pendingDismissals = /* @__PURE__ */ new Map();
235
- }
236
- }(), h = (e, t) => m.message(e, t), g = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", _ = Object.assign(h, {
237
- success: m.success,
238
- info: m.info,
239
- warning: m.warning,
240
- error: m.error,
241
- custom: m.custom,
242
- message: m.message,
243
- promise: m.promise,
244
- dismiss: m.dismiss,
245
- loading: m.loading
246
- }, {
247
- getHistory: () => m.toasts,
248
- getToasts: () => m.getActiveToasts()
249
- });
250
- n("[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;flex:1;min-width:0}[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(--normal-text);background:var(--normal-bg);border:1px solid var(--normal-border);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]{-webkit-user-select:none;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%)}");
251
- function v(e) {
252
- return e.label !== void 0;
253
- }
254
- var y = 3, b = "24px", x = "16px", S = 4e3, te = 356, ne = 14, re = 45, ie = 200;
255
- function C(...e) {
256
- return e.filter(Boolean).join(" ");
257
- }
258
- function w(e) {
259
- let [t, n] = e.split("-"), r = [];
260
- return t && r.push(t), n && r.push(n), r;
261
- }
262
- var T = (t) => {
263
- let { invert: n, toast: i, unstyled: o, interacting: s, setHeights: c, visibleToasts: l, heights: d, index: f, toasts: p, expanded: m, removeToast: h, defaultRichColors: g, closeButton: _, style: y, cancelButtonStyle: b, actionButtonStyle: x, className: te = "", descriptionClassName: ne = "", duration: T, position: E, gap: ae, expandByDefault: D, classNames: O, icons: k, closeButtonAriaLabel: A = "Close toast" } = t, [j, M] = e.useState(null), [N, P] = e.useState(null), [F, I] = e.useState(!1), [L, oe] = e.useState(!1), [R, z] = e.useState(!1), [B, se] = e.useState(!1), [ce, le] = e.useState(!1), [ue, V] = e.useState(0), [de, H] = e.useState(0), U = e.useRef(i.duration || T || S), fe = e.useRef(null), W = e.useRef(null), pe = f === 0, me = f + 1 <= l, G = i.type, he = G ?? "default", K = i.dismissible !== !1, ge = i.className || "", _e = i.descriptionClassName || "", q = e.useMemo(() => d.findIndex((e) => e.toastId === i.id) || 0, [d, i.id]), ve = e.useMemo(() => i.closeButton ?? _, [i.closeButton, _]), ye = e.useMemo(() => i.duration || T || S, [i.duration, T]), J = e.useRef(0), Y = e.useRef(0), be = e.useRef(0), X = e.useRef(null), [xe, Se] = E.split("-"), Ce = e.useMemo(() => d.reduce((e, t, n) => n >= q ? e : e + t.height, 0), [d, q]), we = ee(), Z = e.useMemo(() => t.swipeDirections ?? w(E), [t.swipeDirections, E]), Te = i.invert || n, Q = G === "loading";
264
- Y.current = e.useMemo(() => q * ae + Ce, [q, Ce]), e.useEffect(() => {
265
- U.current = ye;
266
- }, [ye]), e.useEffect(() => {
267
- I(!0);
268
- }, []), e.useEffect(() => {
269
- let e = W.current;
270
- if (e) {
271
- let t = e.getBoundingClientRect().height;
272
- return H(t), c((e) => [{
273
- toastId: i.id,
274
- height: t,
275
- position: i.position
276
- }, ...e]), () => c((e) => e.filter((e) => e.toastId !== i.id));
277
- }
278
- }, [c, i.id]), e.useLayoutEffect(() => {
279
- if (!F) return;
280
- let e = W.current, t = e.style.height;
281
- e.style.height = "auto";
282
- let n = e.getBoundingClientRect().height;
283
- e.style.height = t, H(n), c((e) => e.find((e) => e.toastId === i.id) ? e.map((e) => e.toastId === i.id ? {
284
- ...e,
285
- height: n
286
- } : e) : [{
287
- toastId: i.id,
288
- height: n,
289
- position: i.position
290
- }, ...e]);
291
- }, [
292
- F,
293
- i.title,
294
- i.description,
295
- c,
296
- i.id,
297
- i.jsx,
298
- i.action,
299
- i.cancel
300
- ]);
301
- let $ = e.useCallback(() => {
302
- oe(!0), V(Y.current), c((e) => e.filter((e) => e.toastId !== i.id)), setTimeout(() => {
303
- h(i);
304
- }, ie);
305
- }, [
306
- i,
307
- h,
308
- c,
309
- Y
310
- ]);
311
- e.useEffect(() => {
312
- if (i.promise && G === "loading" || i.duration === Infinity || i.type === "loading") return;
313
- let e;
314
- return m || s || we ? (() => {
315
- if (be.current < J.current) {
316
- let e = (/* @__PURE__ */ new Date()).getTime() - J.current;
317
- U.current -= e;
318
- }
319
- be.current = (/* @__PURE__ */ new Date()).getTime();
320
- })() : U.current !== Infinity && (J.current = (/* @__PURE__ */ new Date()).getTime(), e = setTimeout(() => {
321
- i.onAutoClose == null || i.onAutoClose.call(i, i), $();
322
- }, U.current)), () => clearTimeout(e);
323
- }, [
324
- m,
325
- s,
326
- i,
327
- G,
328
- we,
329
- $
330
- ]), e.useEffect(() => {
331
- i.delete && ($(), i.onDismiss == null || i.onDismiss.call(i, i));
332
- }, [$, i.delete]);
333
- function Ee() {
334
- return k?.loading ? /*#__PURE__*/ e.createElement("div", {
335
- className: C(O?.loader, i?.classNames?.loader, "sonner-loader"),
336
- "data-visible": G === "loading"
337
- }, k.loading) : /*#__PURE__*/ e.createElement(a, {
338
- className: C(O?.loader, i?.classNames?.loader),
339
- visible: G === "loading"
340
- });
341
- }
342
- let De = i.icon || k?.[G] || r(G);
343
- return /*#__PURE__*/ e.createElement("li", {
344
- tabIndex: 0,
345
- ref: W,
346
- className: C(te, ge, O?.toast, i?.classNames?.toast, O?.[he], i?.classNames?.[he]),
347
- "data-sonner-toast": "",
348
- "data-rich-colors": i.richColors ?? g,
349
- "data-styled": !(i.jsx || i.unstyled || o),
350
- "data-mounted": F,
351
- "data-promise": !!i.promise,
352
- "data-swiped": ce,
353
- "data-removed": L,
354
- "data-visible": me,
355
- "data-y-position": xe,
356
- "data-x-position": Se,
357
- "data-index": f,
358
- "data-front": pe,
359
- "data-swiping": R,
360
- "data-dismissible": K,
361
- "data-type": G,
362
- "data-invert": Te,
363
- "data-swipe-out": B,
364
- "data-swipe-direction": N,
365
- "data-expanded": !!(m || D && F),
366
- "data-testid": i.testId,
367
- style: {
368
- "--index": f,
369
- "--toasts-before": f,
370
- "--z-index": p.length - f,
371
- "--offset": `${L ? ue : Y.current}px`,
372
- "--initial-height": D ? "auto" : `${de}px`,
373
- ...y,
374
- ...i.style
375
- },
376
- onDragEnd: () => {
377
- z(!1), M(null), X.current = null;
378
- },
379
- onPointerDown: (e) => {
380
- e.button !== 2 && !Q && K && (fe.current = /* @__PURE__ */ new Date(), V(Y.current), e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (z(!0), X.current = {
381
- x: e.clientX,
382
- y: e.clientY
383
- }));
384
- },
385
- onPointerUp: () => {
386
- if (B || !K) return;
387
- X.current = null;
388
- let e = Number(W.current?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0), t = Number(W.current?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0), n = (/* @__PURE__ */ new Date()).getTime() - fe.current?.getTime(), r = j === "x" ? e : t, a = Math.abs(r) / n;
389
- if ((j === "x" ? Z.includes(e > 0 ? "right" : "left") : Z.includes(t > 0 ? "bottom" : "top")) && (Math.abs(r) >= re || a > .11)) V(Y.current), i.onDismiss == null || i.onDismiss.call(i, i), P(j === "x" ? e > 0 ? "right" : "left" : t > 0 ? "down" : "up"), $(), se(!0);
390
- else {
391
- var o, s;
392
- (o = W.current) == null || o.style.setProperty("--swipe-amount-x", "0px"), (s = W.current) == null || s.style.setProperty("--swipe-amount-y", "0px"), le(!1), z(!1), M(null);
393
- }
394
- },
395
- onPointerMove: (e) => {
396
- var t, n;
397
- if (!X.current || !K || window.getSelection()?.toString().length > 0) return;
398
- let r = e.clientY - X.current.y, i = e.clientX - X.current.x;
399
- !j && (Math.abs(i) > 1 || Math.abs(r) > 1) && M(Math.abs(i) > Math.abs(r) ? "x" : "y");
400
- let a = {
401
- x: 0,
402
- y: 0
403
- }, o = (e) => 1 / (1.5 + Math.abs(e) / 20);
404
- if (j === "y") {
405
- if (Z.includes("top") || Z.includes("bottom")) {
406
- if (Z.includes("top") && r < 0 || Z.includes("bottom") && r > 0) a.y = r;
407
- else {
408
- let e = r * o(r);
409
- a.y = Math.abs(e) < Math.abs(r) ? e : r;
410
- }
411
- }
412
- } else if (j === "x" && (Z.includes("left") || Z.includes("right"))) {
413
- if (Z.includes("left") && i < 0 || Z.includes("right") && i > 0) a.x = i;
414
- else {
415
- let e = i * o(i);
416
- a.x = Math.abs(e) < Math.abs(i) ? e : i;
417
- }
418
- }
419
- (Math.abs(a.x) > 0 || Math.abs(a.y) > 0) && le(!0), (t = W.current) == null || t.style.setProperty("--swipe-amount-x", `${a.x}px`), (n = W.current) == null || n.style.setProperty("--swipe-amount-y", `${a.y}px`);
420
- }
421
- }, ve && !i.jsx && G !== "loading" ? /*#__PURE__*/ e.createElement("button", {
422
- "aria-label": A,
423
- "data-disabled": Q,
424
- "data-close-button": !0,
425
- onClick: Q || !K ? () => {} : () => {
426
- $(), i.onDismiss == null || i.onDismiss.call(i, i);
427
- },
428
- className: C(O?.closeButton, i?.classNames?.closeButton)
429
- }, k?.close ?? u) : null, (G || i.icon || i.promise) && i.icon !== null && (k?.[G] !== null || i.icon) ? /*#__PURE__*/ e.createElement("div", {
430
- "data-icon": "",
431
- className: C(O?.icon, i?.classNames?.icon)
432
- }, G === "loading" ? i.icon || Ee() : i.promise ? Ee() : null, G === "loading" ? null : De) : null, /*#__PURE__*/ e.createElement("div", {
433
- "data-content": "",
434
- className: C(O?.content, i?.classNames?.content)
435
- }, /*#__PURE__*/ e.createElement("div", {
436
- "data-title": "",
437
- className: C(O?.title, i?.classNames?.title)
438
- }, i.jsx ? i.jsx : typeof i.title == "function" ? i.title() : i.title), i.description ? /*#__PURE__*/ e.createElement("div", {
439
- "data-description": "",
440
- className: C(ne, _e, O?.description, i?.classNames?.description)
441
- }, typeof i.description == "function" ? i.description() : i.description) : null), /*#__PURE__*/ e.isValidElement(i.cancel) ? i.cancel : i.cancel && v(i.cancel) ? /*#__PURE__*/ e.createElement("button", {
442
- "data-button": !0,
443
- "data-cancel": !0,
444
- style: i.cancelButtonStyle || b,
445
- onClick: (e) => {
446
- v(i.cancel) && K && (i.cancel.onClick == null || i.cancel.onClick.call(i.cancel, e), $());
447
- },
448
- className: C(O?.cancelButton, i?.classNames?.cancelButton)
449
- }, i.cancel.label) : null, /*#__PURE__*/ e.isValidElement(i.action) ? i.action : i.action && v(i.action) ? /*#__PURE__*/ e.createElement("button", {
450
- "data-button": !0,
451
- "data-action": !0,
452
- style: i.actionButtonStyle || x,
453
- onClick: (e) => {
454
- v(i.action) && (i.action.onClick == null || i.action.onClick.call(i.action, e), !e.defaultPrevented && $());
455
- },
456
- className: C(O?.actionButton, i?.classNames?.actionButton)
457
- }, i.action.label) : null);
458
- };
459
- function E() {
460
- if (typeof window > "u" || typeof document > "u") return "ltr";
461
- let e = document.documentElement.getAttribute("dir");
462
- return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
463
- }
464
- function ae(e, t) {
465
- let n = {};
466
- return [e, t].forEach((e, t) => {
467
- let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ? x : b;
468
- function o(e) {
469
- [
470
- "top",
471
- "right",
472
- "bottom",
473
- "left"
474
- ].forEach((t) => {
475
- n[`${i}-${t}`] = typeof e == "number" ? `${e}px` : e;
476
- });
477
- }
478
- typeof e == "number" || typeof e == "string" ? o(e) : typeof e == "object" ? [
479
- "top",
480
- "right",
481
- "bottom",
482
- "left"
483
- ].forEach((t) => {
484
- e[t] === void 0 ? n[`${i}-${t}`] = a : n[`${i}-${t}`] = typeof e[t] == "number" ? `${e[t]}px` : e[t];
485
- }) : o(a);
486
- }), n;
487
- }
488
- var D = /*#__PURE__*/ e.forwardRef(function(n, r) {
489
- let { id: i, invert: a, position: o = "bottom-right", hotkey: s = ["altKey", "KeyT"], expand: c, closeButton: l, className: u, offset: ee, mobileOffset: d, theme: f = "light", richColors: p, duration: h, style: g, visibleToasts: _ = y, toastOptions: v, dir: b = E(), gap: x = ne, icons: S, customAriaLabel: re, containerAriaLabel: ie = "Notifications" } = n, [C, w] = e.useState([]), D = e.useMemo(() => i ? C.filter((e) => e.toasterId === i) : C.filter((e) => !e.toasterId), [C, i]), O = e.useMemo(() => Array.from(new Set([o].concat(D.filter((e) => e.position).map((e) => e.position)))), [D, o]), [k, A] = e.useState([]), [j, M] = e.useState(!1), [N, P] = e.useState(!1), [F, I] = e.useState(f === "system" ? typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : f), L = e.useRef(null), oe = s.join("+").replace(/Key/g, "").replace(/Digit/g, ""), R = e.useRef(null), z = e.useRef(!1), B = e.useCallback((e) => {
490
- w((t) => (t.find((t) => t.id === e.id)?.delete || m.dismiss(e.id), t.filter(({ id: t }) => t !== e.id)));
491
- }, []);
492
- return e.useEffect(() => m.subscribe((e) => {
493
- e.dismiss ? requestAnimationFrame(() => {
494
- w((t) => t.map((t) => t.id === e.id ? {
495
- ...t,
496
- delete: !0
497
- } : t));
498
- }) : setTimeout(() => {
499
- t.flushSync(() => {
500
- w((t) => {
501
- let n = t.findIndex((t) => t.id === e.id);
502
- return n === -1 ? [e, ...t] : [
503
- ...t.slice(0, n),
504
- {
505
- ...t[n],
506
- ...e
507
- },
508
- ...t.slice(n + 1)
509
- ];
510
- });
511
- });
512
- });
513
- }), []), e.useEffect(() => {
514
- if (f !== "system") {
515
- I(f);
516
- return;
517
- }
518
- if (f === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? I("dark") : I("light")), typeof window > "u") return;
519
- let e = window.matchMedia("(prefers-color-scheme: dark)");
520
- try {
521
- e.addEventListener("change", ({ matches: e }) => {
522
- I(e ? "dark" : "light");
523
- });
524
- } catch {
525
- e.addListener(({ matches: e }) => {
526
- try {
527
- I(e ? "dark" : "light");
528
- } catch (e) {
529
- console.error(e);
530
- }
531
- });
532
- }
533
- }, [f]), e.useEffect(() => {
534
- C.length <= 1 && M(!1);
535
- }, [C]), e.useEffect(() => {
536
- let e = (e) => {
537
- if (s.length > 0 && s.every((t) => e[t] || e.code === t)) {
538
- var t;
539
- M(!0), (t = L.current) == null || t.focus();
540
- }
541
- e.code === "Escape" && (document.activeElement === L.current || L.current?.contains(document.activeElement)) && M(!1);
542
- };
543
- return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
544
- }, [s]), e.useEffect(() => {
545
- if (L.current) return () => {
546
- R.current && (R.current.focus({ preventScroll: !0 }), R.current = null, z.current = !1);
547
- };
548
- }, [L.current]), /*#__PURE__*/ e.createElement("section", {
549
- ref: r,
550
- "aria-label": re ?? `${ie} ${oe}`,
551
- tabIndex: -1,
552
- "aria-live": "polite",
553
- "aria-relevant": "additions text",
554
- "aria-atomic": "false",
555
- suppressHydrationWarning: !0,
556
- "data-react-aria-top-layer": !0
557
- }, O.map((t, r) => {
558
- let [i, o] = t.split("-");
559
- return D.length ? /*#__PURE__*/ e.createElement("ol", {
560
- key: t,
561
- dir: b === "auto" ? E() : b,
562
- tabIndex: -1,
563
- ref: L,
564
- className: u,
565
- "data-sonner-toaster": !0,
566
- "data-sonner-theme": F,
567
- "data-y-position": i,
568
- "data-x-position": o,
569
- style: {
570
- "--front-toast-height": `${k[0]?.height || 0}px`,
571
- "--width": `${te}px`,
572
- "--gap": `${x}px`,
573
- ...g,
574
- ...ae(ee, d)
575
- },
576
- onBlur: (e) => {
577
- z.current && !e.currentTarget.contains(e.relatedTarget) && (z.current = !1, R.current &&= (R.current.focus({ preventScroll: !0 }), null));
578
- },
579
- onFocus: (e) => {
580
- e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || z.current || (z.current = !0, R.current = e.relatedTarget);
581
- },
582
- onMouseEnter: () => M(!0),
583
- onMouseMove: () => M(!0),
584
- onMouseLeave: () => {
585
- N || M(!1);
586
- },
587
- onDragEnd: () => M(!1),
588
- onPointerDown: (e) => {
589
- e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || P(!0);
590
- },
591
- onPointerUp: () => P(!1)
592
- }, D.filter((e) => !e.position && r === 0 || e.position === t).map((r, i) => /*#__PURE__*/ e.createElement(T, {
593
- key: r.id,
594
- icons: S,
595
- index: i,
596
- toast: r,
597
- defaultRichColors: p,
598
- duration: v?.duration ?? h,
599
- className: v?.className,
600
- descriptionClassName: v?.descriptionClassName,
601
- invert: a,
602
- visibleToasts: _,
603
- closeButton: v?.closeButton ?? l,
604
- interacting: N,
605
- position: t,
606
- style: v?.style,
607
- unstyled: v?.unstyled,
608
- classNames: v?.classNames,
609
- cancelButtonStyle: v?.cancelButtonStyle,
610
- actionButtonStyle: v?.actionButtonStyle,
611
- closeButtonAriaLabel: v?.closeButtonAriaLabel,
612
- removeToast: B,
613
- toasts: D.filter((e) => e.position == r.position),
614
- heights: k.filter((e) => e.position == r.position),
615
- setHeights: A,
616
- expandByDefault: c,
617
- gap: x,
618
- expanded: j,
619
- swipeDirections: n.swipeDirections
620
- }))) : null;
621
- }));
622
- });
623
- export { _ as n, D as t };