@epilot/volt-ui 1.1.2 → 1.1.3

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 (214) hide show
  1. package/dist/components/spinner/spinner.d.ts +12 -0
  2. package/dist/index.cjs.js +51 -1
  3. package/dist/index.d.ts +1 -0
  4. package/dist/index.es.js +11793 -133
  5. package/dist/style.css +1 -1
  6. package/package.json +1 -1
  7. package/dist/index.cjs10.js +0 -1
  8. package/dist/index.cjs100.js +0 -1
  9. package/dist/index.cjs101.js +0 -1
  10. package/dist/index.cjs102.js +0 -1
  11. package/dist/index.cjs103.js +0 -1
  12. package/dist/index.cjs104.js +0 -1
  13. package/dist/index.cjs105.js +0 -1
  14. package/dist/index.cjs106.js +0 -1
  15. package/dist/index.cjs107.js +0 -1
  16. package/dist/index.cjs11.js +0 -1
  17. package/dist/index.cjs12.js +0 -1
  18. package/dist/index.cjs13.js +0 -1
  19. package/dist/index.cjs14.js +0 -1
  20. package/dist/index.cjs15.js +0 -1
  21. package/dist/index.cjs16.js +0 -1
  22. package/dist/index.cjs17.js +0 -1
  23. package/dist/index.cjs18.js +0 -1
  24. package/dist/index.cjs19.js +0 -1
  25. package/dist/index.cjs20.js +0 -1
  26. package/dist/index.cjs21.js +0 -1
  27. package/dist/index.cjs22.js +0 -1
  28. package/dist/index.cjs23.js +0 -1
  29. package/dist/index.cjs24.js +0 -1
  30. package/dist/index.cjs25.js +0 -1
  31. package/dist/index.cjs26.js +0 -1
  32. package/dist/index.cjs27.js +0 -1
  33. package/dist/index.cjs28.js +0 -1
  34. package/dist/index.cjs29.js +0 -1
  35. package/dist/index.cjs30.js +0 -1
  36. package/dist/index.cjs31.js +0 -1
  37. package/dist/index.cjs32.js +0 -1
  38. package/dist/index.cjs33.js +0 -1
  39. package/dist/index.cjs34.js +0 -1
  40. package/dist/index.cjs35.js +0 -1
  41. package/dist/index.cjs36.js +0 -1
  42. package/dist/index.cjs37.js +0 -1
  43. package/dist/index.cjs38.js +0 -1
  44. package/dist/index.cjs39.js +0 -1
  45. package/dist/index.cjs4.js +0 -1
  46. package/dist/index.cjs40.js +0 -1
  47. package/dist/index.cjs41.js +0 -5
  48. package/dist/index.cjs42.js +0 -1
  49. package/dist/index.cjs43.js +0 -1
  50. package/dist/index.cjs44.js +0 -1
  51. package/dist/index.cjs45.js +0 -7
  52. package/dist/index.cjs46.js +0 -1
  53. package/dist/index.cjs47.js +0 -1
  54. package/dist/index.cjs48.js +0 -1
  55. package/dist/index.cjs49.js +0 -1
  56. package/dist/index.cjs5.js +0 -1
  57. package/dist/index.cjs50.js +0 -1
  58. package/dist/index.cjs51.js +0 -1
  59. package/dist/index.cjs52.js +0 -1
  60. package/dist/index.cjs53.js +0 -1
  61. package/dist/index.cjs54.js +0 -1
  62. package/dist/index.cjs55.js +0 -1
  63. package/dist/index.cjs56.js +0 -1
  64. package/dist/index.cjs57.js +0 -1
  65. package/dist/index.cjs58.js +0 -1
  66. package/dist/index.cjs59.js +0 -1
  67. package/dist/index.cjs6.js +0 -1
  68. package/dist/index.cjs60.js +0 -1
  69. package/dist/index.cjs61.js +0 -1
  70. package/dist/index.cjs62.js +0 -1
  71. package/dist/index.cjs63.js +0 -1
  72. package/dist/index.cjs64.js +0 -1
  73. package/dist/index.cjs65.js +0 -1
  74. package/dist/index.cjs66.js +0 -1
  75. package/dist/index.cjs67.js +0 -1
  76. package/dist/index.cjs68.js +0 -1
  77. package/dist/index.cjs69.js +0 -1
  78. package/dist/index.cjs7.js +0 -1
  79. package/dist/index.cjs70.js +0 -1
  80. package/dist/index.cjs71.js +0 -1
  81. package/dist/index.cjs72.js +0 -1
  82. package/dist/index.cjs73.js +0 -1
  83. package/dist/index.cjs74.js +0 -1
  84. package/dist/index.cjs75.js +0 -1
  85. package/dist/index.cjs76.js +0 -1
  86. package/dist/index.cjs77.js +0 -1
  87. package/dist/index.cjs78.js +0 -1
  88. package/dist/index.cjs79.js +0 -1
  89. package/dist/index.cjs8.js +0 -1
  90. package/dist/index.cjs80.js +0 -1
  91. package/dist/index.cjs81.js +0 -1
  92. package/dist/index.cjs82.js +0 -1
  93. package/dist/index.cjs83.js +0 -1
  94. package/dist/index.cjs84.js +0 -1
  95. package/dist/index.cjs85.js +0 -1
  96. package/dist/index.cjs86.js +0 -1
  97. package/dist/index.cjs87.js +0 -1
  98. package/dist/index.cjs88.js +0 -1
  99. package/dist/index.cjs89.js +0 -1
  100. package/dist/index.cjs9.js +0 -1
  101. package/dist/index.cjs90.js +0 -1
  102. package/dist/index.cjs91.js +0 -1
  103. package/dist/index.cjs92.js +0 -4
  104. package/dist/index.cjs93.js +0 -1
  105. package/dist/index.cjs94.js +0 -1
  106. package/dist/index.cjs95.js +0 -1
  107. package/dist/index.cjs96.js +0 -1
  108. package/dist/index.cjs97.js +0 -1
  109. package/dist/index.cjs98.js +0 -38
  110. package/dist/index.cjs99.js +0 -1
  111. package/dist/index.es10.js +0 -29
  112. package/dist/index.es100.js +0 -16
  113. package/dist/index.es101.js +0 -68
  114. package/dist/index.es102.js +0 -6
  115. package/dist/index.es103.js +0 -25
  116. package/dist/index.es104.js +0 -25
  117. package/dist/index.es105.js +0 -15
  118. package/dist/index.es106.js +0 -30
  119. package/dist/index.es107.js +0 -7
  120. package/dist/index.es11.js +0 -250
  121. package/dist/index.es12.js +0 -230
  122. package/dist/index.es13.js +0 -34
  123. package/dist/index.es14.js +0 -43
  124. package/dist/index.es15.js +0 -43
  125. package/dist/index.es16.js +0 -115
  126. package/dist/index.es17.js +0 -24
  127. package/dist/index.es18.js +0 -36
  128. package/dist/index.es19.js +0 -137
  129. package/dist/index.es20.js +0 -50
  130. package/dist/index.es21.js +0 -54
  131. package/dist/index.es22.js +0 -74
  132. package/dist/index.es23.js +0 -172
  133. package/dist/index.es24.js +0 -89
  134. package/dist/index.es25.js +0 -113
  135. package/dist/index.es26.js +0 -85
  136. package/dist/index.es27.js +0 -61
  137. package/dist/index.es28.js +0 -73
  138. package/dist/index.es29.js +0 -746
  139. package/dist/index.es30.js +0 -17
  140. package/dist/index.es31.js +0 -2763
  141. package/dist/index.es32.js +0 -62
  142. package/dist/index.es33.js +0 -35
  143. package/dist/index.es34.js +0 -126
  144. package/dist/index.es35.js +0 -862
  145. package/dist/index.es36.js +0 -20
  146. package/dist/index.es37.js +0 -331
  147. package/dist/index.es38.js +0 -132
  148. package/dist/index.es39.js +0 -24
  149. package/dist/index.es4.js +0 -6
  150. package/dist/index.es40.js +0 -243
  151. package/dist/index.es41.js +0 -262
  152. package/dist/index.es42.js +0 -251
  153. package/dist/index.es43.js +0 -238
  154. package/dist/index.es44.js +0 -239
  155. package/dist/index.es45.js +0 -127
  156. package/dist/index.es46.js +0 -163
  157. package/dist/index.es47.js +0 -29
  158. package/dist/index.es48.js +0 -9
  159. package/dist/index.es49.js +0 -70
  160. package/dist/index.es5.js +0 -52
  161. package/dist/index.es50.js +0 -127
  162. package/dist/index.es51.js +0 -17
  163. package/dist/index.es52.js +0 -137
  164. package/dist/index.es53.js +0 -13
  165. package/dist/index.es54.js +0 -221
  166. package/dist/index.es55.js +0 -16
  167. package/dist/index.es56.js +0 -71
  168. package/dist/index.es57.js +0 -36
  169. package/dist/index.es58.js +0 -50
  170. package/dist/index.es59.js +0 -54
  171. package/dist/index.es6.js +0 -66
  172. package/dist/index.es60.js +0 -52
  173. package/dist/index.es61.js +0 -11
  174. package/dist/index.es62.js +0 -11
  175. package/dist/index.es63.js +0 -32
  176. package/dist/index.es64.js +0 -32
  177. package/dist/index.es65.js +0 -48
  178. package/dist/index.es66.js +0 -120
  179. package/dist/index.es67.js +0 -10
  180. package/dist/index.es68.js +0 -183
  181. package/dist/index.es69.js +0 -8
  182. package/dist/index.es7.js +0 -167
  183. package/dist/index.es70.js +0 -27
  184. package/dist/index.es71.js +0 -312
  185. package/dist/index.es72.js +0 -6
  186. package/dist/index.es73.js +0 -50
  187. package/dist/index.es74.js +0 -13
  188. package/dist/index.es75.js +0 -6
  189. package/dist/index.es76.js +0 -50
  190. package/dist/index.es77.js +0 -32
  191. package/dist/index.es78.js +0 -11
  192. package/dist/index.es79.js +0 -50
  193. package/dist/index.es8.js +0 -39
  194. package/dist/index.es80.js +0 -14
  195. package/dist/index.es81.js +0 -208
  196. package/dist/index.es82.js +0 -24
  197. package/dist/index.es83.js +0 -402
  198. package/dist/index.es84.js +0 -17
  199. package/dist/index.es85.js +0 -32
  200. package/dist/index.es86.js +0 -27
  201. package/dist/index.es87.js +0 -31
  202. package/dist/index.es88.js +0 -7
  203. package/dist/index.es89.js +0 -7
  204. package/dist/index.es9.js +0 -33
  205. package/dist/index.es90.js +0 -5
  206. package/dist/index.es91.js +0 -26
  207. package/dist/index.es92.js +0 -112
  208. package/dist/index.es93.js +0 -18
  209. package/dist/index.es94.js +0 -527
  210. package/dist/index.es95.js +0 -130
  211. package/dist/index.es96.js +0 -136
  212. package/dist/index.es97.js +0 -67
  213. package/dist/index.es98.js +0 -71
  214. package/dist/index.es99.js +0 -11
@@ -1,746 +0,0 @@
1
- import a from "react";
2
- import Ut from "react-dom";
3
- function Xt(r) {
4
- if (typeof document > "u") return;
5
- let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
6
- e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
7
- }
8
- const Wt = (r) => {
9
- switch (r) {
10
- case "success":
11
- return Gt;
12
- case "info":
13
- return Jt;
14
- case "warning":
15
- return Qt;
16
- case "error":
17
- return Zt;
18
- default:
19
- return null;
20
- }
21
- }, Kt = Array(12).fill(0), qt = ({ visible: r, className: o }) => /* @__PURE__ */ a.createElement("div", {
22
- className: [
23
- "sonner-loading-wrapper",
24
- o
25
- ].filter(Boolean).join(" "),
26
- "data-visible": r
27
- }, /* @__PURE__ */ a.createElement("div", {
28
- className: "sonner-spinner"
29
- }, Kt.map((e, s) => /* @__PURE__ */ a.createElement("div", {
30
- className: "sonner-loading-bar",
31
- key: `spinner-bar-${s}`
32
- })))), Gt = /* @__PURE__ */ a.createElement("svg", {
33
- xmlns: "http://www.w3.org/2000/svg",
34
- viewBox: "0 0 20 20",
35
- fill: "currentColor",
36
- height: "20",
37
- width: "20"
38
- }, /* @__PURE__ */ a.createElement("path", {
39
- fillRule: "evenodd",
40
- 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",
41
- clipRule: "evenodd"
42
- })), Qt = /* @__PURE__ */ a.createElement("svg", {
43
- xmlns: "http://www.w3.org/2000/svg",
44
- viewBox: "0 0 24 24",
45
- fill: "currentColor",
46
- height: "20",
47
- width: "20"
48
- }, /* @__PURE__ */ a.createElement("path", {
49
- fillRule: "evenodd",
50
- 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",
51
- clipRule: "evenodd"
52
- })), Jt = /* @__PURE__ */ a.createElement("svg", {
53
- xmlns: "http://www.w3.org/2000/svg",
54
- viewBox: "0 0 20 20",
55
- fill: "currentColor",
56
- height: "20",
57
- width: "20"
58
- }, /* @__PURE__ */ a.createElement("path", {
59
- fillRule: "evenodd",
60
- 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",
61
- clipRule: "evenodd"
62
- })), Zt = /* @__PURE__ */ a.createElement("svg", {
63
- xmlns: "http://www.w3.org/2000/svg",
64
- viewBox: "0 0 20 20",
65
- fill: "currentColor",
66
- height: "20",
67
- width: "20"
68
- }, /* @__PURE__ */ a.createElement("path", {
69
- fillRule: "evenodd",
70
- 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",
71
- clipRule: "evenodd"
72
- })), te = /* @__PURE__ */ a.createElement("svg", {
73
- xmlns: "http://www.w3.org/2000/svg",
74
- width: "12",
75
- height: "12",
76
- viewBox: "0 0 24 24",
77
- fill: "none",
78
- stroke: "currentColor",
79
- strokeWidth: "1.5",
80
- strokeLinecap: "round",
81
- strokeLinejoin: "round"
82
- }, /* @__PURE__ */ a.createElement("line", {
83
- x1: "18",
84
- y1: "6",
85
- x2: "6",
86
- y2: "18"
87
- }), /* @__PURE__ */ a.createElement("line", {
88
- x1: "6",
89
- y1: "6",
90
- x2: "18",
91
- y2: "18"
92
- })), ee = () => {
93
- const [r, o] = a.useState(document.hidden);
94
- return a.useEffect(() => {
95
- const e = () => {
96
- o(document.hidden);
97
- };
98
- return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
99
- }, []), r;
100
- };
101
- let xt = 1;
102
- class ae {
103
- constructor() {
104
- this.subscribe = (o) => (this.subscribers.push(o), () => {
105
- const e = this.subscribers.indexOf(o);
106
- this.subscribers.splice(e, 1);
107
- }), this.publish = (o) => {
108
- this.subscribers.forEach((e) => e(o));
109
- }, this.addToast = (o) => {
110
- this.publish(o), this.toasts = [
111
- ...this.toasts,
112
- o
113
- ];
114
- }, this.create = (o) => {
115
- var e;
116
- const { message: s, ...C } = o, u = typeof (o == null ? void 0 : o.id) == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : xt++, g = this.toasts.find((b) => b.id === u), _ = o.dismissible === void 0 ? !0 : o.dismissible;
117
- return this.dismissedToasts.has(u) && this.dismissedToasts.delete(u), g ? this.toasts = this.toasts.map((b) => b.id === u ? (this.publish({
118
- ...b,
119
- ...o,
120
- id: u,
121
- title: s
122
- }), {
123
- ...b,
124
- ...o,
125
- id: u,
126
- dismissible: _,
127
- title: s
128
- }) : b) : this.addToast({
129
- title: s,
130
- ...C,
131
- dismissible: _,
132
- id: u
133
- }), u;
134
- }, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
135
- id: o,
136
- dismiss: !0
137
- })))) : this.toasts.forEach((e) => {
138
- this.subscribers.forEach((s) => s({
139
- id: e.id,
140
- dismiss: !0
141
- }));
142
- }), o), this.message = (o, e) => this.create({
143
- ...e,
144
- message: o
145
- }), this.error = (o, e) => this.create({
146
- ...e,
147
- message: o,
148
- type: "error"
149
- }), this.success = (o, e) => this.create({
150
- ...e,
151
- type: "success",
152
- message: o
153
- }), this.info = (o, e) => this.create({
154
- ...e,
155
- type: "info",
156
- message: o
157
- }), this.warning = (o, e) => this.create({
158
- ...e,
159
- type: "warning",
160
- message: o
161
- }), this.loading = (o, e) => this.create({
162
- ...e,
163
- type: "loading",
164
- message: o
165
- }), this.promise = (o, e) => {
166
- if (!e)
167
- return;
168
- let s;
169
- e.loading !== void 0 && (s = this.create({
170
- ...e,
171
- promise: o,
172
- type: "loading",
173
- message: e.loading,
174
- description: typeof e.description != "function" ? e.description : void 0
175
- }));
176
- const C = Promise.resolve(o instanceof Function ? o() : o);
177
- let u = s !== void 0, g;
178
- const _ = C.then(async (i) => {
179
- if (g = [
180
- "resolve",
181
- i
182
- ], a.isValidElement(i))
183
- u = !1, this.create({
184
- id: s,
185
- type: "default",
186
- message: i
187
- });
188
- else if (se(i) && !i.ok) {
189
- u = !1;
190
- const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, x = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
191
- message: t
192
- };
193
- this.create({
194
- id: s,
195
- type: "error",
196
- description: x,
197
- ...E
198
- });
199
- } else if (i instanceof Error) {
200
- u = !1;
201
- const t = typeof e.error == "function" ? await e.error(i) : e.error, x = typeof e.description == "function" ? await e.description(i) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
202
- message: t
203
- };
204
- this.create({
205
- id: s,
206
- type: "error",
207
- description: x,
208
- ...E
209
- });
210
- } else if (e.success !== void 0) {
211
- u = !1;
212
- const t = typeof e.success == "function" ? await e.success(i) : e.success, x = typeof e.description == "function" ? await e.description(i) : e.description, E = typeof t == "object" && !a.isValidElement(t) ? t : {
213
- message: t
214
- };
215
- this.create({
216
- id: s,
217
- type: "success",
218
- description: x,
219
- ...E
220
- });
221
- }
222
- }).catch(async (i) => {
223
- if (g = [
224
- "reject",
225
- i
226
- ], e.error !== void 0) {
227
- u = !1;
228
- const T = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, O = typeof T == "object" && !a.isValidElement(T) ? T : {
229
- message: T
230
- };
231
- this.create({
232
- id: s,
233
- type: "error",
234
- description: t,
235
- ...O
236
- });
237
- }
238
- }).finally(() => {
239
- u && (this.dismiss(s), s = void 0), e.finally == null || e.finally.call(e);
240
- }), b = () => new Promise((i, T) => _.then(() => g[0] === "reject" ? T(g[1]) : i(g[1])).catch(T));
241
- return typeof s != "string" && typeof s != "number" ? {
242
- unwrap: b
243
- } : Object.assign(s, {
244
- unwrap: b
245
- });
246
- }, this.custom = (o, e) => {
247
- const s = (e == null ? void 0 : e.id) || xt++;
248
- return this.create({
249
- jsx: o(s),
250
- id: s,
251
- ...e
252
- }), s;
253
- }, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
254
- }
255
- }
256
- const S = new ae(), oe = (r, o) => {
257
- const e = (o == null ? void 0 : o.id) || xt++;
258
- return S.addToast({
259
- title: r,
260
- ...o,
261
- id: e
262
- }), e;
263
- }, se = (r) => r && typeof r == "object" && "ok" in r && typeof r.ok == "boolean" && "status" in r && typeof r.status == "number", ne = oe, re = () => S.toasts, ie = () => S.getActiveToasts(), xe = Object.assign(ne, {
264
- success: S.success,
265
- info: S.info,
266
- warning: S.warning,
267
- error: S.error,
268
- custom: S.custom,
269
- message: S.message,
270
- promise: S.promise,
271
- dismiss: S.dismiss,
272
- loading: S.loading
273
- }, {
274
- getHistory: re,
275
- getToasts: ie
276
- });
277
- 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%)}");
278
- function mt(r) {
279
- return r.label !== void 0;
280
- }
281
- const le = 3, de = "24px", ce = "16px", Mt = 4e3, ue = 356, fe = 14, me = 45, pe = 200;
282
- function H(...r) {
283
- return r.filter(Boolean).join(" ");
284
- }
285
- function ge(r) {
286
- const [o, e] = r.split("-"), s = [];
287
- return o && s.push(o), e && s.push(e), s;
288
- }
289
- const he = (r) => {
290
- var o, e, s, C, u, g, _, b, i;
291
- const { invert: T, toast: t, unstyled: x, interacting: O, setHeights: E, visibleToasts: pt, heights: U, index: d, toasts: ot, expanded: X, removeToast: st, defaultRichColors: gt, closeButton: z, style: Z, cancelButtonStyle: Y, actionButtonStyle: ht, className: nt = "", descriptionClassName: bt = "", duration: tt, position: A, gap: rt, expandByDefault: et, classNames: c, icons: v, closeButtonAriaLabel: j = "Close toast" } = r, [$, B] = a.useState(null), [F, it] = a.useState(null), [l, p] = a.useState(!1), [m, D] = a.useState(!1), [W, f] = a.useState(!1), [K, lt] = a.useState(!1), [dt, q] = a.useState(!1), [Ct, vt] = a.useState(0), [At, Et] = a.useState(0), at = a.useRef(t.duration || tt || Mt), Tt = a.useRef(null), P = a.useRef(null), Ht = d === 0, Ot = d + 1 <= pt, N = t.type, G = t.dismissible !== !1, zt = t.className || "", Pt = t.descriptionClassName || "", ct = a.useMemo(() => U.findIndex((n) => n.toastId === t.id) || 0, [
292
- U,
293
- t.id
294
- ]), jt = a.useMemo(() => {
295
- var n;
296
- return (n = t.closeButton) != null ? n : z;
297
- }, [
298
- t.closeButton,
299
- z
300
- ]), St = a.useMemo(() => t.duration || tt || Mt, [
301
- t.duration,
302
- tt
303
- ]), yt = a.useRef(0), Q = a.useRef(0), Nt = a.useRef(0), J = a.useRef(null), [Lt, Yt] = A.split("-"), kt = a.useMemo(() => U.reduce((n, h, w) => w >= ct ? n : n + h.height, 0), [
304
- U,
305
- ct
306
- ]), _t = ee(), $t = t.invert || T, wt = N === "loading";
307
- Q.current = a.useMemo(() => ct * rt + kt, [
308
- ct,
309
- kt
310
- ]), a.useEffect(() => {
311
- at.current = St;
312
- }, [
313
- St
314
- ]), a.useEffect(() => {
315
- p(!0);
316
- }, []), a.useEffect(() => {
317
- const n = P.current;
318
- if (n) {
319
- const h = n.getBoundingClientRect().height;
320
- return Et(h), E((w) => [
321
- {
322
- toastId: t.id,
323
- height: h,
324
- position: t.position
325
- },
326
- ...w
327
- ]), () => E((w) => w.filter((k) => k.toastId !== t.id));
328
- }
329
- }, [
330
- E,
331
- t.id
332
- ]), a.useLayoutEffect(() => {
333
- if (!l) return;
334
- const n = P.current, h = n.style.height;
335
- n.style.height = "auto";
336
- const w = n.getBoundingClientRect().height;
337
- n.style.height = h, Et(w), E((k) => k.find((y) => y.toastId === t.id) ? k.map((y) => y.toastId === t.id ? {
338
- ...y,
339
- height: w
340
- } : y) : [
341
- {
342
- toastId: t.id,
343
- height: w,
344
- position: t.position
345
- },
346
- ...k
347
- ]);
348
- }, [
349
- l,
350
- t.title,
351
- t.description,
352
- E,
353
- t.id,
354
- t.jsx,
355
- t.action,
356
- t.cancel
357
- ]);
358
- const L = a.useCallback(() => {
359
- D(!0), vt(Q.current), E((n) => n.filter((h) => h.toastId !== t.id)), setTimeout(() => {
360
- st(t);
361
- }, pe);
362
- }, [
363
- t,
364
- st,
365
- E,
366
- Q
367
- ]);
368
- a.useEffect(() => {
369
- if (t.promise && N === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
370
- let n;
371
- return X || O || _t ? (() => {
372
- if (Nt.current < yt.current) {
373
- const k = (/* @__PURE__ */ new Date()).getTime() - yt.current;
374
- at.current = at.current - k;
375
- }
376
- Nt.current = (/* @__PURE__ */ new Date()).getTime();
377
- })() : (() => {
378
- at.current !== 1 / 0 && (yt.current = (/* @__PURE__ */ new Date()).getTime(), n = setTimeout(() => {
379
- t.onAutoClose == null || t.onAutoClose.call(t, t), L();
380
- }, at.current));
381
- })(), () => clearTimeout(n);
382
- }, [
383
- X,
384
- O,
385
- t,
386
- N,
387
- _t,
388
- L
389
- ]), a.useEffect(() => {
390
- t.delete && (L(), t.onDismiss == null || t.onDismiss.call(t, t));
391
- }, [
392
- L,
393
- t.delete
394
- ]);
395
- function Ft() {
396
- var n;
397
- if (v != null && v.loading) {
398
- var h;
399
- return /* @__PURE__ */ a.createElement("div", {
400
- className: H(c == null ? void 0 : c.loader, t == null || (h = t.classNames) == null ? void 0 : h.loader, "sonner-loader"),
401
- "data-visible": N === "loading"
402
- }, v.loading);
403
- }
404
- return /* @__PURE__ */ a.createElement(qt, {
405
- className: H(c == null ? void 0 : c.loader, t == null || (n = t.classNames) == null ? void 0 : n.loader),
406
- visible: N === "loading"
407
- });
408
- }
409
- const Vt = t.icon || (v == null ? void 0 : v[N]) || Wt(N);
410
- var Dt, Rt;
411
- return /* @__PURE__ */ a.createElement("li", {
412
- tabIndex: 0,
413
- ref: P,
414
- className: H(nt, zt, c == null ? void 0 : c.toast, t == null || (o = t.classNames) == null ? void 0 : o.toast, c == null ? void 0 : c.default, c == null ? void 0 : c[N], t == null || (e = t.classNames) == null ? void 0 : e[N]),
415
- "data-sonner-toast": "",
416
- "data-rich-colors": (Dt = t.richColors) != null ? Dt : gt,
417
- "data-styled": !(t.jsx || t.unstyled || x),
418
- "data-mounted": l,
419
- "data-promise": !!t.promise,
420
- "data-swiped": dt,
421
- "data-removed": m,
422
- "data-visible": Ot,
423
- "data-y-position": Lt,
424
- "data-x-position": Yt,
425
- "data-index": d,
426
- "data-front": Ht,
427
- "data-swiping": W,
428
- "data-dismissible": G,
429
- "data-type": N,
430
- "data-invert": $t,
431
- "data-swipe-out": K,
432
- "data-swipe-direction": F,
433
- "data-expanded": !!(X || et && l),
434
- "data-testid": t.testId,
435
- style: {
436
- "--index": d,
437
- "--toasts-before": d,
438
- "--z-index": ot.length - d,
439
- "--offset": `${m ? Ct : Q.current}px`,
440
- "--initial-height": et ? "auto" : `${At}px`,
441
- ...Z,
442
- ...t.style
443
- },
444
- onDragEnd: () => {
445
- f(!1), B(null), J.current = null;
446
- },
447
- onPointerDown: (n) => {
448
- n.button !== 2 && (wt || !G || (Tt.current = /* @__PURE__ */ new Date(), vt(Q.current), n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (f(!0), J.current = {
449
- x: n.clientX,
450
- y: n.clientY
451
- })));
452
- },
453
- onPointerUp: () => {
454
- var n, h, w;
455
- if (K || !G) return;
456
- J.current = null;
457
- const k = 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), y = (/* @__PURE__ */ new Date()).getTime() - ((w = Tt.current) == null ? void 0 : w.getTime()), R = $ === "x" ? k : ut, ft = Math.abs(R) / y;
458
- if (Math.abs(R) >= me || ft > 0.11) {
459
- vt(Q.current), t.onDismiss == null || t.onDismiss.call(t, t), it($ === "x" ? k > 0 ? "right" : "left" : ut > 0 ? "down" : "up"), L(), lt(!0);
460
- return;
461
- } else {
462
- var M, I;
463
- (M = P.current) == null || M.style.setProperty("--swipe-amount-x", "0px"), (I = P.current) == null || I.style.setProperty("--swipe-amount-y", "0px");
464
- }
465
- q(!1), f(!1), B(null);
466
- },
467
- onPointerMove: (n) => {
468
- var h, w, k;
469
- if (!J.current || !G || ((h = window.getSelection()) == null ? void 0 : h.toString().length) > 0) return;
470
- const y = n.clientY - J.current.y, R = n.clientX - J.current.x;
471
- var ft;
472
- const M = (ft = r.swipeDirections) != null ? ft : ge(A);
473
- !$ && (Math.abs(R) > 1 || Math.abs(y) > 1) && B(Math.abs(R) > Math.abs(y) ? "x" : "y");
474
- let I = {
475
- x: 0,
476
- y: 0
477
- };
478
- const Bt = (V) => 1 / (1.5 + Math.abs(V) / 20);
479
- if ($ === "y") {
480
- if (M.includes("top") || M.includes("bottom"))
481
- if (M.includes("top") && y < 0 || M.includes("bottom") && y > 0)
482
- I.y = y;
483
- else {
484
- const V = y * Bt(y);
485
- I.y = Math.abs(V) < Math.abs(y) ? V : y;
486
- }
487
- } else if ($ === "x" && (M.includes("left") || M.includes("right")))
488
- if (M.includes("left") && R < 0 || M.includes("right") && R > 0)
489
- I.x = R;
490
- else {
491
- const V = R * Bt(R);
492
- I.x = Math.abs(V) < Math.abs(R) ? V : R;
493
- }
494
- (Math.abs(I.x) > 0 || Math.abs(I.y) > 0) && q(!0), (w = P.current) == null || w.style.setProperty("--swipe-amount-x", `${I.x}px`), (k = P.current) == null || k.style.setProperty("--swipe-amount-y", `${I.y}px`);
495
- }
496
- }, jt && !t.jsx && N !== "loading" ? /* @__PURE__ */ a.createElement("button", {
497
- "aria-label": j,
498
- "data-disabled": wt,
499
- "data-close-button": !0,
500
- onClick: wt || !G ? () => {
501
- } : () => {
502
- L(), t.onDismiss == null || t.onDismiss.call(t, t);
503
- },
504
- className: H(c == null ? void 0 : c.closeButton, t == null || (s = t.classNames) == null ? void 0 : s.closeButton)
505
- }, (Rt = v == null ? void 0 : v.close) != null ? Rt : te) : null, (N || t.icon || t.promise) && t.icon !== null && ((v == null ? void 0 : v[N]) !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
506
- "data-icon": "",
507
- className: H(c == null ? void 0 : c.icon, t == null || (C = t.classNames) == null ? void 0 : C.icon)
508
- }, t.promise || t.type === "loading" && !t.icon ? t.icon || Ft() : null, t.type !== "loading" ? Vt : null) : null, /* @__PURE__ */ a.createElement("div", {
509
- "data-content": "",
510
- className: H(c == null ? void 0 : c.content, t == null || (u = t.classNames) == null ? void 0 : u.content)
511
- }, /* @__PURE__ */ a.createElement("div", {
512
- "data-title": "",
513
- className: H(c == null ? void 0 : c.title, t == null || (g = t.classNames) == null ? void 0 : g.title)
514
- }, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
515
- "data-description": "",
516
- className: H(bt, Pt, c == null ? void 0 : c.description, t == null || (_ = t.classNames) == null ? void 0 : _.description)
517
- }, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && mt(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
518
- "data-button": !0,
519
- "data-cancel": !0,
520
- style: t.cancelButtonStyle || Y,
521
- onClick: (n) => {
522
- mt(t.cancel) && G && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, n), L());
523
- },
524
- className: H(c == null ? void 0 : c.cancelButton, t == null || (b = t.classNames) == null ? void 0 : b.cancelButton)
525
- }, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && mt(t.action) ? /* @__PURE__ */ a.createElement("button", {
526
- "data-button": !0,
527
- "data-action": !0,
528
- style: t.actionButtonStyle || ht,
529
- onClick: (n) => {
530
- mt(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, n), !n.defaultPrevented && L());
531
- },
532
- className: H(c == null ? void 0 : c.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
533
- }, t.action.label) : null);
534
- };
535
- function It() {
536
- if (typeof window > "u" || typeof document > "u") return "ltr";
537
- const r = document.documentElement.getAttribute("dir");
538
- return r === "auto" || !r ? window.getComputedStyle(document.documentElement).direction : r;
539
- }
540
- function be(r, o) {
541
- const e = {};
542
- return [
543
- r,
544
- o
545
- ].forEach((s, C) => {
546
- const u = C === 1, g = u ? "--mobile-offset" : "--offset", _ = u ? ce : de;
547
- function b(i) {
548
- [
549
- "top",
550
- "right",
551
- "bottom",
552
- "left"
553
- ].forEach((T) => {
554
- e[`${g}-${T}`] = typeof i == "number" ? `${i}px` : i;
555
- });
556
- }
557
- typeof s == "number" || typeof s == "string" ? b(s) : typeof s == "object" ? [
558
- "top",
559
- "right",
560
- "bottom",
561
- "left"
562
- ].forEach((i) => {
563
- s[i] === void 0 ? e[`${g}-${i}`] = _ : e[`${g}-${i}`] = typeof s[i] == "number" ? `${s[i]}px` : s[i];
564
- }) : b(_);
565
- }), e;
566
- }
567
- const Ee = /* @__PURE__ */ a.forwardRef(function(o, e) {
568
- const { id: s, invert: C, position: u = "bottom-right", hotkey: g = [
569
- "altKey",
570
- "KeyT"
571
- ], expand: _, closeButton: b, className: i, offset: T, mobileOffset: t, theme: x = "light", richColors: O, duration: E, style: pt, visibleToasts: U = le, toastOptions: d, dir: ot = It(), gap: X = fe, icons: st, containerAriaLabel: gt = "Notifications" } = o, [z, Z] = a.useState([]), Y = a.useMemo(() => s ? z.filter((l) => l.toasterId === s) : z.filter((l) => !l.toasterId), [
572
- z,
573
- s
574
- ]), ht = a.useMemo(() => Array.from(new Set([
575
- u
576
- ].concat(Y.filter((l) => l.position).map((l) => l.position)))), [
577
- Y,
578
- u
579
- ]), [nt, bt] = a.useState([]), [tt, A] = a.useState(!1), [rt, et] = a.useState(!1), [c, v] = a.useState(x !== "system" ? x : 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, ""), B = a.useRef(null), F = a.useRef(!1), it = a.useCallback((l) => {
580
- Z((p) => {
581
- var m;
582
- return (m = p.find((D) => D.id === l.id)) != null && m.delete || S.dismiss(l.id), p.filter(({ id: D }) => D !== l.id);
583
- });
584
- }, []);
585
- return a.useEffect(() => S.subscribe((l) => {
586
- if (l.dismiss) {
587
- requestAnimationFrame(() => {
588
- Z((p) => p.map((m) => m.id === l.id ? {
589
- ...m,
590
- delete: !0
591
- } : m));
592
- });
593
- return;
594
- }
595
- setTimeout(() => {
596
- Ut.flushSync(() => {
597
- Z((p) => {
598
- const m = p.findIndex((D) => D.id === l.id);
599
- return m !== -1 ? [
600
- ...p.slice(0, m),
601
- {
602
- ...p[m],
603
- ...l
604
- },
605
- ...p.slice(m + 1)
606
- ] : [
607
- l,
608
- ...p
609
- ];
610
- });
611
- });
612
- });
613
- }), [
614
- z
615
- ]), a.useEffect(() => {
616
- if (x !== "system") {
617
- v(x);
618
- return;
619
- }
620
- if (x === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? v("dark") : v("light")), typeof window > "u") return;
621
- const l = window.matchMedia("(prefers-color-scheme: dark)");
622
- try {
623
- l.addEventListener("change", ({ matches: p }) => {
624
- v(p ? "dark" : "light");
625
- });
626
- } catch {
627
- l.addListener(({ matches: m }) => {
628
- try {
629
- v(m ? "dark" : "light");
630
- } catch (D) {
631
- console.error(D);
632
- }
633
- });
634
- }
635
- }, [
636
- x
637
- ]), a.useEffect(() => {
638
- z.length <= 1 && A(!1);
639
- }, [
640
- z
641
- ]), a.useEffect(() => {
642
- const l = (p) => {
643
- var m;
644
- if (g.every((f) => p[f] || p.code === f)) {
645
- var W;
646
- A(!0), (W = j.current) == null || W.focus();
647
- }
648
- p.code === "Escape" && (document.activeElement === j.current || (m = j.current) != null && m.contains(document.activeElement)) && A(!1);
649
- };
650
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
651
- }, [
652
- g
653
- ]), a.useEffect(() => {
654
- if (j.current)
655
- return () => {
656
- B.current && (B.current.focus({
657
- preventScroll: !0
658
- }), B.current = null, F.current = !1);
659
- };
660
- }, [
661
- j.current
662
- ]), // Remove item from normal navigation flow, only available via hotkey
663
- /* @__PURE__ */ a.createElement("section", {
664
- ref: e,
665
- "aria-label": `${gt} ${$}`,
666
- tabIndex: -1,
667
- "aria-live": "polite",
668
- "aria-relevant": "additions text",
669
- "aria-atomic": "false",
670
- suppressHydrationWarning: !0
671
- }, ht.map((l, p) => {
672
- var m;
673
- const [D, W] = l.split("-");
674
- return Y.length ? /* @__PURE__ */ a.createElement("ol", {
675
- key: l,
676
- dir: ot === "auto" ? It() : ot,
677
- tabIndex: -1,
678
- ref: j,
679
- className: i,
680
- "data-sonner-toaster": !0,
681
- "data-sonner-theme": c,
682
- "data-y-position": D,
683
- "data-x-position": W,
684
- style: {
685
- "--front-toast-height": `${((m = nt[0]) == null ? void 0 : m.height) || 0}px`,
686
- "--width": `${ue}px`,
687
- "--gap": `${X}px`,
688
- ...pt,
689
- ...be(T, t)
690
- },
691
- onBlur: (f) => {
692
- F.current && !f.currentTarget.contains(f.relatedTarget) && (F.current = !1, B.current && (B.current.focus({
693
- preventScroll: !0
694
- }), B.current = null));
695
- },
696
- onFocus: (f) => {
697
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || F.current || (F.current = !0, B.current = f.relatedTarget);
698
- },
699
- onMouseEnter: () => A(!0),
700
- onMouseMove: () => A(!0),
701
- onMouseLeave: () => {
702
- rt || A(!1);
703
- },
704
- onDragEnd: () => A(!1),
705
- onPointerDown: (f) => {
706
- f.target instanceof HTMLElement && f.target.dataset.dismissible === "false" || et(!0);
707
- },
708
- onPointerUp: () => et(!1)
709
- }, Y.filter((f) => !f.position && p === 0 || f.position === l).map((f, K) => {
710
- var lt, dt;
711
- return /* @__PURE__ */ a.createElement(he, {
712
- key: f.id,
713
- icons: st,
714
- index: K,
715
- toast: f,
716
- defaultRichColors: O,
717
- duration: (lt = d == null ? void 0 : d.duration) != null ? lt : E,
718
- className: d == null ? void 0 : d.className,
719
- descriptionClassName: d == null ? void 0 : d.descriptionClassName,
720
- invert: C,
721
- visibleToasts: U,
722
- closeButton: (dt = d == null ? void 0 : d.closeButton) != null ? dt : b,
723
- interacting: rt,
724
- position: l,
725
- style: d == null ? void 0 : d.style,
726
- unstyled: d == null ? void 0 : d.unstyled,
727
- classNames: d == null ? void 0 : d.classNames,
728
- cancelButtonStyle: d == null ? void 0 : d.cancelButtonStyle,
729
- actionButtonStyle: d == null ? void 0 : d.actionButtonStyle,
730
- closeButtonAriaLabel: d == null ? void 0 : d.closeButtonAriaLabel,
731
- removeToast: it,
732
- toasts: Y.filter((q) => q.position == f.position),
733
- heights: nt.filter((q) => q.position == f.position),
734
- setHeights: bt,
735
- expandByDefault: _,
736
- gap: X,
737
- expanded: tt,
738
- swipeDirections: o.swipeDirections
739
- });
740
- })) : null;
741
- }));
742
- });
743
- export {
744
- Ee as Toaster,
745
- xe as toast
746
- };