@spear-ai/spectral 1.9.1 → 1.10.1

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 (241) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +113 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -275
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +1 -1
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -141
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -66
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputNumeric.d.ts +14 -0
  128. package/dist/InputNumeric.js +137 -0
  129. package/dist/InputOTP-cVn5Bzyp.js +461 -0
  130. package/dist/InputOTP.js +2 -382
  131. package/dist/Kbd.d.ts +1 -1
  132. package/dist/Kbd.js +182 -86
  133. package/dist/Label.js +12 -14
  134. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  135. package/dist/MultiSelect.d.ts +1 -1
  136. package/dist/MultiSelect.js +23 -23
  137. package/dist/Popover.js +28 -32
  138. package/dist/RadioButton.d.ts +17 -0
  139. package/dist/RadioButton.js +33 -0
  140. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  141. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  142. package/dist/RadioButtonGroup.d.ts +1 -1
  143. package/dist/RadioButtonGroup.js +11 -8
  144. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  145. package/dist/RadioGroup.js +2 -505
  146. package/dist/Select.js +163 -186
  147. package/dist/Separator.js +16 -19
  148. package/dist/Skeleton.js +10 -6
  149. package/dist/Slider-BzzZT3Zm.js +490 -0
  150. package/dist/Slider.js +2 -562
  151. package/dist/SpectralProvider.js +8 -5
  152. package/dist/Switch/SwitchBase.js +91 -95
  153. package/dist/Switch-CVzRJ-0n.js +126 -0
  154. package/dist/Switch.d.ts +1 -1
  155. package/dist/Switch.js +2 -134
  156. package/dist/Tabs/TabsBase.js +242 -250
  157. package/dist/Tabs/tabsUtils.js +65 -73
  158. package/dist/Tabs.d.ts +1 -1
  159. package/dist/Tabs.js +73 -103
  160. package/dist/Textarea/TextareaUtils.js +35 -46
  161. package/dist/Textarea.js +83 -160
  162. package/dist/Toast-9zqXxKKO.js +711 -0
  163. package/dist/Toast.js +2 -885
  164. package/dist/Toggle/ToggleBase.js +46 -56
  165. package/dist/Toggle.d.ts +1 -1
  166. package/dist/Toggle.js +52 -62
  167. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  168. package/dist/ToggleGroup.d.ts +1 -1
  169. package/dist/ToggleGroup.js +52 -63
  170. package/dist/Tooltip-D1K8kY1y.js +389 -0
  171. package/dist/Tooltip.js +2 -365
  172. package/dist/Tray.js +174 -217
  173. package/dist/chunk-h9knIhTc.js +20 -0
  174. package/dist/clsx-jM1GlMvB.js +16 -0
  175. package/dist/dist-3Af8168y.js +913 -0
  176. package/dist/dist-7HRQ5IKN.js +249 -0
  177. package/dist/dist-B2k1iWFp.js +129 -0
  178. package/dist/dist-B4FgboI8.js +122 -0
  179. package/dist/dist-B4g6zpUF.js +33 -0
  180. package/dist/dist-B9tup-4O.js +216 -0
  181. package/dist/dist-BK1K0g9W.js +29 -0
  182. package/dist/dist-Bfjk-jx9.js +28 -0
  183. package/dist/dist-Bft31cJh.js +65 -0
  184. package/dist/dist-BtdmHAzK.js +190 -0
  185. package/dist/dist-C0Hifjgh.js +1287 -0
  186. package/dist/dist-CGzgmYB9.js +68 -0
  187. package/dist/dist-ClmepHp4.js +10 -0
  188. package/dist/dist-D8Wb_MX9.js +6 -0
  189. package/dist/dist-Dtvmk11N.js +12 -0
  190. package/dist/dist-fW81qjVl.js +677 -0
  191. package/dist/dist-s1uWaZYZ.js +11 -0
  192. package/dist/es2015-YHaMV-St.js +701 -0
  193. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  194. package/dist/hooks/useControllableState.js +14 -13
  195. package/dist/hooks/useConvertToOklch.d.ts +3 -0
  196. package/dist/hooks/useConvertToOklch.d.ts.map +1 -0
  197. package/dist/hooks/useConvertToOklch.js +51 -0
  198. package/dist/hooks/useTheme.js +21 -17
  199. package/dist/index.d.ts +3 -1
  200. package/dist/index.d.ts.map +1 -1
  201. package/dist/main.js +18954 -27224
  202. package/dist/primitives/button.js +39 -41
  203. package/dist/primitives/input-group.js +57 -73
  204. package/dist/primitives/input.js +11 -20
  205. package/dist/primitives/popover.js +34 -28
  206. package/dist/primitives/select.js +70 -138
  207. package/dist/primitives/slot.js +32 -31
  208. package/dist/primitives/textarea.js +10 -16
  209. package/dist/proxy-Dn10Pl_g.js +4920 -0
  210. package/dist/styles/main.css +2 -1
  211. package/dist/styles/spectral.css +1 -1
  212. package/dist/twUtils-VNWgstKL.js +1673 -0
  213. package/dist/use-animation-CBUDycyW.js +57 -0
  214. package/dist/utils/constants.js +4 -4
  215. package/dist/utils/formFieldUtils.js +136 -148
  216. package/dist/utils/sharedUtils.js +26 -7
  217. package/dist/utils/twUtils.js +2 -2919
  218. package/package.json +24 -28
  219. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  220. package/dist/clsx-OuTLNxxd.js +0 -16
  221. package/dist/index-0ioNhtNM.js +0 -10
  222. package/dist/index-6oYKCvIn.js +0 -677
  223. package/dist/index-BFOf48AQ.js +0 -69
  224. package/dist/index-BZPx6jYI.js +0 -8
  225. package/dist/index-BlHU_t18.js +0 -142
  226. package/dist/index-Bm1RbF6w.js +0 -1037
  227. package/dist/index-Bv2OIg5P.js +0 -225
  228. package/dist/index-CKEI0pDv.js +0 -56
  229. package/dist/index-CM_hWgfC.js +0 -32
  230. package/dist/index-C_YVr64u.js +0 -1538
  231. package/dist/index-Cl8VeY0o.js +0 -149
  232. package/dist/index-CwSyIPrv.js +0 -13
  233. package/dist/index-D29mdTf5.js +0 -34
  234. package/dist/index-DEYs15GP.js +0 -66
  235. package/dist/index-Dc0No4pV.js +0 -233
  236. package/dist/index-T6XEa11q.js +0 -822
  237. package/dist/index-pBCLb6Gr.js +0 -240
  238. package/dist/index-psiVrsnE.js +0 -27
  239. package/dist/index-rKs9bXHr.js +0 -6
  240. package/dist/proxy-CO_-Vget.js +0 -4975
  241. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -0,0 +1,711 @@
1
+ import "./styles/main.css";
2
+ import { CheckSquareIcon as e } from "./Icons/CheckSquareIcon.js";
3
+ import { CloseCircleIcon as t } from "./Icons/CloseCircleIcon.js";
4
+ import { InfoIcon as n } from "./Icons/InfoIcon.js";
5
+ import { WarningIcon as r } from "./Icons/WarningIcon.js";
6
+ import { t as i } from "./twUtils-VNWgstKL.js";
7
+ import { t as a } from "./dist-B4g6zpUF.js";
8
+ import o from "react";
9
+ import s from "react-dom";
10
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
11
+ //#region node_modules/.pnpm/sonner@2.0.7_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/sonner/dist/index.mjs
12
+ function u(e) {
13
+ if (!e || typeof document > "u") return;
14
+ let t = document.head || document.getElementsByTagName("head")[0], n = document.createElement("style");
15
+ n.type = "text/css", t.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e));
16
+ }
17
+ var ee = (e) => {
18
+ switch (e) {
19
+ case "success": return p;
20
+ case "info": return h;
21
+ case "warning": return m;
22
+ case "error": return g;
23
+ default: return null;
24
+ }
25
+ }, d = Array(12).fill(0), f = ({ visible: e, className: t }) => /* @__PURE__ */ o.createElement("div", {
26
+ className: ["sonner-loading-wrapper", t].filter(Boolean).join(" "),
27
+ "data-visible": e
28
+ }, /* @__PURE__ */ o.createElement("div", { className: "sonner-spinner" }, d.map((e, t) => /* @__PURE__ */ o.createElement("div", {
29
+ className: "sonner-loading-bar",
30
+ key: `spinner-bar-${t}`
31
+ })))), p = /* @__PURE__ */ o.createElement("svg", {
32
+ xmlns: "http://www.w3.org/2000/svg",
33
+ viewBox: "0 0 20 20",
34
+ fill: "currentColor",
35
+ height: "20",
36
+ width: "20"
37
+ }, /* @__PURE__ */ o.createElement("path", {
38
+ fillRule: "evenodd",
39
+ 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",
40
+ clipRule: "evenodd"
41
+ })), m = /* @__PURE__ */ o.createElement("svg", {
42
+ xmlns: "http://www.w3.org/2000/svg",
43
+ viewBox: "0 0 24 24",
44
+ fill: "currentColor",
45
+ height: "20",
46
+ width: "20"
47
+ }, /* @__PURE__ */ o.createElement("path", {
48
+ fillRule: "evenodd",
49
+ 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",
50
+ clipRule: "evenodd"
51
+ })), h = /* @__PURE__ */ o.createElement("svg", {
52
+ xmlns: "http://www.w3.org/2000/svg",
53
+ viewBox: "0 0 20 20",
54
+ fill: "currentColor",
55
+ height: "20",
56
+ width: "20"
57
+ }, /* @__PURE__ */ o.createElement("path", {
58
+ fillRule: "evenodd",
59
+ 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",
60
+ clipRule: "evenodd"
61
+ })), g = /* @__PURE__ */ o.createElement("svg", {
62
+ xmlns: "http://www.w3.org/2000/svg",
63
+ viewBox: "0 0 20 20",
64
+ fill: "currentColor",
65
+ height: "20",
66
+ width: "20"
67
+ }, /* @__PURE__ */ o.createElement("path", {
68
+ fillRule: "evenodd",
69
+ 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",
70
+ clipRule: "evenodd"
71
+ })), _ = /* @__PURE__ */ o.createElement("svg", {
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ width: "12",
74
+ height: "12",
75
+ viewBox: "0 0 24 24",
76
+ fill: "none",
77
+ stroke: "currentColor",
78
+ strokeWidth: "1.5",
79
+ strokeLinecap: "round",
80
+ strokeLinejoin: "round"
81
+ }, /* @__PURE__ */ o.createElement("line", {
82
+ x1: "18",
83
+ y1: "6",
84
+ x2: "6",
85
+ y2: "18"
86
+ }), /* @__PURE__ */ o.createElement("line", {
87
+ x1: "6",
88
+ y1: "6",
89
+ x2: "18",
90
+ y2: "18"
91
+ })), v = () => {
92
+ let [e, t] = o.useState(document.hidden);
93
+ return o.useEffect(() => {
94
+ let e = () => {
95
+ t(document.hidden);
96
+ };
97
+ return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
98
+ }, []), e;
99
+ }, y = 1, b = new class {
100
+ constructor() {
101
+ this.subscribe = (e) => (this.subscribers.push(e), () => {
102
+ let t = this.subscribers.indexOf(e);
103
+ this.subscribers.splice(t, 1);
104
+ }), this.publish = (e) => {
105
+ this.subscribers.forEach((t) => t(e));
106
+ }, this.addToast = (e) => {
107
+ this.publish(e), this.toasts = [...this.toasts, e];
108
+ }, this.create = (e) => {
109
+ let { message: t, ...n } = e, r = typeof e?.id == "number" || e.id?.length > 0 ? e.id : y++, i = this.toasts.find((e) => e.id === r), a = e.dismissible === void 0 ? !0 : e.dismissible;
110
+ return this.dismissedToasts.has(r) && this.dismissedToasts.delete(r), i ? this.toasts = this.toasts.map((n) => n.id === r ? (this.publish({
111
+ ...n,
112
+ ...e,
113
+ id: r,
114
+ title: t
115
+ }), {
116
+ ...n,
117
+ ...e,
118
+ id: r,
119
+ dismissible: a,
120
+ title: t
121
+ }) : n) : this.addToast({
122
+ title: t,
123
+ ...n,
124
+ dismissible: a,
125
+ id: r
126
+ }), r;
127
+ }, this.dismiss = (e) => (e ? (this.dismissedToasts.add(e), requestAnimationFrame(() => this.subscribers.forEach((t) => t({
128
+ id: e,
129
+ dismiss: !0
130
+ })))) : this.toasts.forEach((e) => {
131
+ this.subscribers.forEach((t) => t({
132
+ id: e.id,
133
+ dismiss: !0
134
+ }));
135
+ }), e), this.message = (e, t) => this.create({
136
+ ...t,
137
+ message: e
138
+ }), this.error = (e, t) => this.create({
139
+ ...t,
140
+ message: e,
141
+ type: "error"
142
+ }), this.success = (e, t) => this.create({
143
+ ...t,
144
+ type: "success",
145
+ message: e
146
+ }), this.info = (e, t) => this.create({
147
+ ...t,
148
+ type: "info",
149
+ message: e
150
+ }), this.warning = (e, t) => this.create({
151
+ ...t,
152
+ type: "warning",
153
+ message: e
154
+ }), this.loading = (e, t) => this.create({
155
+ ...t,
156
+ type: "loading",
157
+ message: e
158
+ }), this.promise = (e, t) => {
159
+ if (!t) return;
160
+ let n;
161
+ t.loading !== void 0 && (n = this.create({
162
+ ...t,
163
+ promise: e,
164
+ type: "loading",
165
+ message: t.loading,
166
+ description: typeof t.description == "function" ? void 0 : t.description
167
+ }));
168
+ let r = Promise.resolve(e instanceof Function ? e() : e), i = n !== void 0, a, s = r.then(async (e) => {
169
+ if (a = ["resolve", e], o.isValidElement(e)) i = !1, this.create({
170
+ id: n,
171
+ type: "default",
172
+ message: e
173
+ });
174
+ else if (S(e) && !e.ok) {
175
+ i = !1;
176
+ let r = typeof t.error == "function" ? await t.error(`HTTP error! status: ${e.status}`) : t.error, a = typeof t.description == "function" ? await t.description(`HTTP error! status: ${e.status}`) : t.description, s = typeof r == "object" && !o.isValidElement(r) ? r : { message: r };
177
+ this.create({
178
+ id: n,
179
+ type: "error",
180
+ description: a,
181
+ ...s
182
+ });
183
+ } else if (e instanceof Error) {
184
+ i = !1;
185
+ let r = typeof t.error == "function" ? await t.error(e) : t.error, a = typeof t.description == "function" ? await t.description(e) : t.description, s = typeof r == "object" && !o.isValidElement(r) ? r : { message: r };
186
+ this.create({
187
+ id: n,
188
+ type: "error",
189
+ description: a,
190
+ ...s
191
+ });
192
+ } else if (t.success !== void 0) {
193
+ i = !1;
194
+ let r = typeof t.success == "function" ? await t.success(e) : t.success, a = typeof t.description == "function" ? await t.description(e) : t.description, s = typeof r == "object" && !o.isValidElement(r) ? r : { message: r };
195
+ this.create({
196
+ id: n,
197
+ type: "success",
198
+ description: a,
199
+ ...s
200
+ });
201
+ }
202
+ }).catch(async (e) => {
203
+ if (a = ["reject", e], t.error !== void 0) {
204
+ i = !1;
205
+ let r = typeof t.error == "function" ? await t.error(e) : t.error, a = typeof t.description == "function" ? await t.description(e) : t.description, s = typeof r == "object" && !o.isValidElement(r) ? r : { message: r };
206
+ this.create({
207
+ id: n,
208
+ type: "error",
209
+ description: a,
210
+ ...s
211
+ });
212
+ }
213
+ }).finally(() => {
214
+ i && (this.dismiss(n), n = void 0), t.finally == null || t.finally.call(t);
215
+ }), c = () => new Promise((e, t) => s.then(() => a[0] === "reject" ? t(a[1]) : e(a[1])).catch(t));
216
+ return typeof n != "string" && typeof n != "number" ? { unwrap: c } : Object.assign(n, { unwrap: c });
217
+ }, this.custom = (e, t) => {
218
+ let n = t?.id || y++;
219
+ return this.create({
220
+ jsx: e(n),
221
+ id: n,
222
+ ...t
223
+ }), n;
224
+ }, this.getActiveToasts = () => this.toasts.filter((e) => !this.dismissedToasts.has(e.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
225
+ }
226
+ }(), x = (e, t) => {
227
+ let n = t?.id || y++;
228
+ return b.addToast({
229
+ title: e,
230
+ ...t,
231
+ id: n
232
+ }), n;
233
+ }, S = (e) => e && typeof e == "object" && "ok" in e && typeof e.ok == "boolean" && "status" in e && typeof e.status == "number", C = Object.assign(x, {
234
+ success: b.success,
235
+ info: b.info,
236
+ warning: b.warning,
237
+ error: b.error,
238
+ custom: b.custom,
239
+ message: b.message,
240
+ promise: b.promise,
241
+ dismiss: b.dismiss,
242
+ loading: b.loading
243
+ }, {
244
+ getHistory: () => b.toasts,
245
+ getToasts: () => b.getActiveToasts()
246
+ });
247
+ u("[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%)}");
248
+ function w(e) {
249
+ return e.label !== void 0;
250
+ }
251
+ var te = 3, T = "24px", E = "16px", D = 4e3, O = 356, k = 14, ne = 45, re = 200;
252
+ function A(...e) {
253
+ return e.filter(Boolean).join(" ");
254
+ }
255
+ function j(e) {
256
+ let [t, n] = e.split("-"), r = [];
257
+ return t && r.push(t), n && r.push(n), r;
258
+ }
259
+ var ie = (e) => {
260
+ let { invert: t, toast: n, unstyled: r, interacting: i, setHeights: a, visibleToasts: s, heights: c, index: l, toasts: u, expanded: d, removeToast: p, defaultRichColors: m, closeButton: h, style: g, cancelButtonStyle: y, actionButtonStyle: b, className: x = "", descriptionClassName: S = "", duration: C, position: te, gap: T, expandByDefault: E, classNames: O, icons: k, closeButtonAriaLabel: ie = "Close toast" } = e, [M, N] = o.useState(null), [P, F] = o.useState(null), [I, L] = o.useState(!1), [R, z] = o.useState(!1), [B, V] = o.useState(!1), [H, ae] = o.useState(!1), [oe, se] = o.useState(!1), [ce, U] = o.useState(0), [le, ue] = o.useState(0), W = o.useRef(n.duration || C || D), de = o.useRef(null), G = o.useRef(null), fe = l === 0, pe = l + 1 <= s, K = n.type, q = n.dismissible !== !1, me = n.className || "", he = n.descriptionClassName || "", J = o.useMemo(() => c.findIndex((e) => e.toastId === n.id) || 0, [c, n.id]), ge = o.useMemo(() => n.closeButton ?? h, [n.closeButton, h]), _e = o.useMemo(() => n.duration || C || D, [n.duration, C]), Y = o.useRef(0), X = o.useRef(0), ve = o.useRef(0), Z = o.useRef(null), [ye, be] = te.split("-"), xe = o.useMemo(() => c.reduce((e, t, n) => n >= J ? e : e + t.height, 0), [c, J]), Se = v(), Ce = n.invert || t, Q = K === "loading";
261
+ X.current = o.useMemo(() => J * T + xe, [J, xe]), o.useEffect(() => {
262
+ W.current = _e;
263
+ }, [_e]), o.useEffect(() => {
264
+ L(!0);
265
+ }, []), o.useEffect(() => {
266
+ let e = G.current;
267
+ if (e) {
268
+ let t = e.getBoundingClientRect().height;
269
+ return ue(t), a((e) => [{
270
+ toastId: n.id,
271
+ height: t,
272
+ position: n.position
273
+ }, ...e]), () => a((e) => e.filter((e) => e.toastId !== n.id));
274
+ }
275
+ }, [a, n.id]), o.useLayoutEffect(() => {
276
+ if (!I) return;
277
+ let e = G.current, t = e.style.height;
278
+ e.style.height = "auto";
279
+ let r = e.getBoundingClientRect().height;
280
+ e.style.height = t, ue(r), a((e) => e.find((e) => e.toastId === n.id) ? e.map((e) => e.toastId === n.id ? {
281
+ ...e,
282
+ height: r
283
+ } : e) : [{
284
+ toastId: n.id,
285
+ height: r,
286
+ position: n.position
287
+ }, ...e]);
288
+ }, [
289
+ I,
290
+ n.title,
291
+ n.description,
292
+ a,
293
+ n.id,
294
+ n.jsx,
295
+ n.action,
296
+ n.cancel
297
+ ]);
298
+ let $ = o.useCallback(() => {
299
+ z(!0), U(X.current), a((e) => e.filter((e) => e.toastId !== n.id)), setTimeout(() => {
300
+ p(n);
301
+ }, re);
302
+ }, [
303
+ n,
304
+ p,
305
+ a,
306
+ X
307
+ ]);
308
+ o.useEffect(() => {
309
+ if (n.promise && K === "loading" || n.duration === Infinity || n.type === "loading") return;
310
+ let e;
311
+ return d || i || Se ? (() => {
312
+ if (ve.current < Y.current) {
313
+ let e = (/* @__PURE__ */ new Date()).getTime() - Y.current;
314
+ W.current -= e;
315
+ }
316
+ ve.current = (/* @__PURE__ */ new Date()).getTime();
317
+ })() : W.current !== Infinity && (Y.current = (/* @__PURE__ */ new Date()).getTime(), e = setTimeout(() => {
318
+ n.onAutoClose == null || n.onAutoClose.call(n, n), $();
319
+ }, W.current)), () => clearTimeout(e);
320
+ }, [
321
+ d,
322
+ i,
323
+ n,
324
+ K,
325
+ Se,
326
+ $
327
+ ]), o.useEffect(() => {
328
+ n.delete && ($(), n.onDismiss == null || n.onDismiss.call(n, n));
329
+ }, [$, n.delete]);
330
+ function we() {
331
+ return k?.loading ? /* @__PURE__ */ o.createElement("div", {
332
+ className: A(O?.loader, n?.classNames?.loader, "sonner-loader"),
333
+ "data-visible": K === "loading"
334
+ }, k.loading) : /* @__PURE__ */ o.createElement(f, {
335
+ className: A(O?.loader, n?.classNames?.loader),
336
+ visible: K === "loading"
337
+ });
338
+ }
339
+ let Te = n.icon || k?.[K] || ee(K);
340
+ return /* @__PURE__ */ o.createElement("li", {
341
+ tabIndex: 0,
342
+ ref: G,
343
+ className: A(x, me, O?.toast, n?.classNames?.toast, O?.default, O?.[K], n?.classNames?.[K]),
344
+ "data-sonner-toast": "",
345
+ "data-rich-colors": n.richColors ?? m,
346
+ "data-styled": !(n.jsx || n.unstyled || r),
347
+ "data-mounted": I,
348
+ "data-promise": !!n.promise,
349
+ "data-swiped": oe,
350
+ "data-removed": R,
351
+ "data-visible": pe,
352
+ "data-y-position": ye,
353
+ "data-x-position": be,
354
+ "data-index": l,
355
+ "data-front": fe,
356
+ "data-swiping": B,
357
+ "data-dismissible": q,
358
+ "data-type": K,
359
+ "data-invert": Ce,
360
+ "data-swipe-out": H,
361
+ "data-swipe-direction": P,
362
+ "data-expanded": !!(d || E && I),
363
+ "data-testid": n.testId,
364
+ style: {
365
+ "--index": l,
366
+ "--toasts-before": l,
367
+ "--z-index": u.length - l,
368
+ "--offset": `${R ? ce : X.current}px`,
369
+ "--initial-height": E ? "auto" : `${le}px`,
370
+ ...g,
371
+ ...n.style
372
+ },
373
+ onDragEnd: () => {
374
+ V(!1), N(null), Z.current = null;
375
+ },
376
+ onPointerDown: (e) => {
377
+ e.button !== 2 && (Q || !q || (de.current = /* @__PURE__ */ new Date(), U(X.current), e.target.setPointerCapture(e.pointerId), e.target.tagName !== "BUTTON" && (V(!0), Z.current = {
378
+ x: e.clientX,
379
+ y: e.clientY
380
+ })));
381
+ },
382
+ onPointerUp: () => {
383
+ if (H || !q) return;
384
+ Z.current = null;
385
+ let e = Number(G.current?.style.getPropertyValue("--swipe-amount-x").replace("px", "") || 0), t = Number(G.current?.style.getPropertyValue("--swipe-amount-y").replace("px", "") || 0), r = (/* @__PURE__ */ new Date()).getTime() - de.current?.getTime(), i = M === "x" ? e : t, a = Math.abs(i) / r;
386
+ if (Math.abs(i) >= ne || a > .11) {
387
+ U(X.current), n.onDismiss == null || n.onDismiss.call(n, n), F(M === "x" ? e > 0 ? "right" : "left" : t > 0 ? "down" : "up"), $(), ae(!0);
388
+ return;
389
+ } else {
390
+ var o, s;
391
+ (o = G.current) == null || o.style.setProperty("--swipe-amount-x", "0px"), (s = G.current) == null || s.style.setProperty("--swipe-amount-y", "0px");
392
+ }
393
+ se(!1), V(!1), N(null);
394
+ },
395
+ onPointerMove: (t) => {
396
+ var n, r;
397
+ if (!Z.current || !q || window.getSelection()?.toString().length > 0) return;
398
+ let i = t.clientY - Z.current.y, a = t.clientX - Z.current.x, o = e.swipeDirections ?? j(te);
399
+ !M && (Math.abs(a) > 1 || Math.abs(i) > 1) && N(Math.abs(a) > Math.abs(i) ? "x" : "y");
400
+ let s = {
401
+ x: 0,
402
+ y: 0
403
+ }, c = (e) => 1 / (1.5 + Math.abs(e) / 20);
404
+ if (M === "y") {
405
+ if (o.includes("top") || o.includes("bottom")) if (o.includes("top") && i < 0 || o.includes("bottom") && i > 0) s.y = i;
406
+ else {
407
+ let e = i * c(i);
408
+ s.y = Math.abs(e) < Math.abs(i) ? e : i;
409
+ }
410
+ } else if (M === "x" && (o.includes("left") || o.includes("right"))) if (o.includes("left") && a < 0 || o.includes("right") && a > 0) s.x = a;
411
+ else {
412
+ let e = a * c(a);
413
+ s.x = Math.abs(e) < Math.abs(a) ? e : a;
414
+ }
415
+ (Math.abs(s.x) > 0 || Math.abs(s.y) > 0) && se(!0), (n = G.current) == null || n.style.setProperty("--swipe-amount-x", `${s.x}px`), (r = G.current) == null || r.style.setProperty("--swipe-amount-y", `${s.y}px`);
416
+ }
417
+ }, ge && !n.jsx && K !== "loading" ? /* @__PURE__ */ o.createElement("button", {
418
+ "aria-label": ie,
419
+ "data-disabled": Q,
420
+ "data-close-button": !0,
421
+ onClick: Q || !q ? () => {} : () => {
422
+ $(), n.onDismiss == null || n.onDismiss.call(n, n);
423
+ },
424
+ className: A(O?.closeButton, n?.classNames?.closeButton)
425
+ }, k?.close ?? _) : null, (K || n.icon || n.promise) && n.icon !== null && (k?.[K] !== null || n.icon) ? /* @__PURE__ */ o.createElement("div", {
426
+ "data-icon": "",
427
+ className: A(O?.icon, n?.classNames?.icon)
428
+ }, n.promise || n.type === "loading" && !n.icon ? n.icon || we() : null, n.type === "loading" ? null : Te) : null, /* @__PURE__ */ o.createElement("div", {
429
+ "data-content": "",
430
+ className: A(O?.content, n?.classNames?.content)
431
+ }, /* @__PURE__ */ o.createElement("div", {
432
+ "data-title": "",
433
+ className: A(O?.title, n?.classNames?.title)
434
+ }, n.jsx ? n.jsx : typeof n.title == "function" ? n.title() : n.title), n.description ? /* @__PURE__ */ o.createElement("div", {
435
+ "data-description": "",
436
+ className: A(S, he, O?.description, n?.classNames?.description)
437
+ }, typeof n.description == "function" ? n.description() : n.description) : null), /* @__PURE__ */ o.isValidElement(n.cancel) ? n.cancel : n.cancel && w(n.cancel) ? /* @__PURE__ */ o.createElement("button", {
438
+ "data-button": !0,
439
+ "data-cancel": !0,
440
+ style: n.cancelButtonStyle || y,
441
+ onClick: (e) => {
442
+ w(n.cancel) && q && (n.cancel.onClick == null || n.cancel.onClick.call(n.cancel, e), $());
443
+ },
444
+ className: A(O?.cancelButton, n?.classNames?.cancelButton)
445
+ }, n.cancel.label) : null, /* @__PURE__ */ o.isValidElement(n.action) ? n.action : n.action && w(n.action) ? /* @__PURE__ */ o.createElement("button", {
446
+ "data-button": !0,
447
+ "data-action": !0,
448
+ style: n.actionButtonStyle || b,
449
+ onClick: (e) => {
450
+ w(n.action) && (n.action.onClick == null || n.action.onClick.call(n.action, e), !e.defaultPrevented && $());
451
+ },
452
+ className: A(O?.actionButton, n?.classNames?.actionButton)
453
+ }, n.action.label) : null);
454
+ };
455
+ function M() {
456
+ if (typeof window > "u" || typeof document > "u") return "ltr";
457
+ let e = document.documentElement.getAttribute("dir");
458
+ return e === "auto" || !e ? window.getComputedStyle(document.documentElement).direction : e;
459
+ }
460
+ function N(e, t) {
461
+ let n = {};
462
+ return [e, t].forEach((e, t) => {
463
+ let r = t === 1, i = r ? "--mobile-offset" : "--offset", a = r ? E : T;
464
+ function o(e) {
465
+ [
466
+ "top",
467
+ "right",
468
+ "bottom",
469
+ "left"
470
+ ].forEach((t) => {
471
+ n[`${i}-${t}`] = typeof e == "number" ? `${e}px` : e;
472
+ });
473
+ }
474
+ typeof e == "number" || typeof e == "string" ? o(e) : typeof e == "object" ? [
475
+ "top",
476
+ "right",
477
+ "bottom",
478
+ "left"
479
+ ].forEach((t) => {
480
+ e[t] === void 0 ? n[`${i}-${t}`] = a : n[`${i}-${t}`] = typeof e[t] == "number" ? `${e[t]}px` : e[t];
481
+ }) : o(a);
482
+ }), n;
483
+ }
484
+ var P = /* @__PURE__ */ o.forwardRef(function(e, t) {
485
+ let { id: n, invert: r, position: i = "bottom-right", hotkey: a = ["altKey", "KeyT"], expand: c, closeButton: l, className: u, offset: ee, mobileOffset: d, theme: f = "light", richColors: p, duration: m, style: h, visibleToasts: g = te, toastOptions: _, dir: v = M(), gap: y = k, icons: x, containerAriaLabel: S = "Notifications" } = e, [C, w] = o.useState([]), T = o.useMemo(() => n ? C.filter((e) => e.toasterId === n) : C.filter((e) => !e.toasterId), [C, n]), E = o.useMemo(() => Array.from(new Set([i].concat(T.filter((e) => e.position).map((e) => e.position)))), [T, i]), [D, ne] = o.useState([]), [re, A] = o.useState(!1), [j, P] = o.useState(!1), [F, I] = o.useState(f === "system" ? typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : f), L = o.useRef(null), R = a.join("+").replace(/Key/g, "").replace(/Digit/g, ""), z = o.useRef(null), B = o.useRef(!1), V = o.useCallback((e) => {
486
+ w((t) => (t.find((t) => t.id === e.id)?.delete || b.dismiss(e.id), t.filter(({ id: t }) => t !== e.id)));
487
+ }, []);
488
+ return o.useEffect(() => b.subscribe((e) => {
489
+ if (e.dismiss) {
490
+ requestAnimationFrame(() => {
491
+ w((t) => t.map((t) => t.id === e.id ? {
492
+ ...t,
493
+ delete: !0
494
+ } : t));
495
+ });
496
+ return;
497
+ }
498
+ setTimeout(() => {
499
+ s.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
+ }), [C]), o.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]), o.useEffect(() => {
534
+ C.length <= 1 && A(!1);
535
+ }, [C]), o.useEffect(() => {
536
+ let e = (e) => {
537
+ if (a.every((t) => e[t] || e.code === t)) {
538
+ var t;
539
+ A(!0), (t = L.current) == null || t.focus();
540
+ }
541
+ e.code === "Escape" && (document.activeElement === L.current || L.current?.contains(document.activeElement)) && A(!1);
542
+ };
543
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
544
+ }, [a]), o.useEffect(() => {
545
+ if (L.current) return () => {
546
+ z.current && (z.current.focus({ preventScroll: !0 }), z.current = null, B.current = !1);
547
+ };
548
+ }, [L.current]), /* @__PURE__ */ o.createElement("section", {
549
+ ref: t,
550
+ "aria-label": `${S} ${R}`,
551
+ tabIndex: -1,
552
+ "aria-live": "polite",
553
+ "aria-relevant": "additions text",
554
+ "aria-atomic": "false",
555
+ suppressHydrationWarning: !0
556
+ }, E.map((t, n) => {
557
+ let [i, a] = t.split("-");
558
+ return T.length ? /* @__PURE__ */ o.createElement("ol", {
559
+ key: t,
560
+ dir: v === "auto" ? M() : v,
561
+ tabIndex: -1,
562
+ ref: L,
563
+ className: u,
564
+ "data-sonner-toaster": !0,
565
+ "data-sonner-theme": F,
566
+ "data-y-position": i,
567
+ "data-x-position": a,
568
+ style: {
569
+ "--front-toast-height": `${D[0]?.height || 0}px`,
570
+ "--width": `${O}px`,
571
+ "--gap": `${y}px`,
572
+ ...h,
573
+ ...N(ee, d)
574
+ },
575
+ onBlur: (e) => {
576
+ B.current && !e.currentTarget.contains(e.relatedTarget) && (B.current = !1, z.current &&= (z.current.focus({ preventScroll: !0 }), null));
577
+ },
578
+ onFocus: (e) => {
579
+ e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || B.current || (B.current = !0, z.current = e.relatedTarget);
580
+ },
581
+ onMouseEnter: () => A(!0),
582
+ onMouseMove: () => A(!0),
583
+ onMouseLeave: () => {
584
+ j || A(!1);
585
+ },
586
+ onDragEnd: () => A(!1),
587
+ onPointerDown: (e) => {
588
+ e.target instanceof HTMLElement && e.target.dataset.dismissible === "false" || P(!0);
589
+ },
590
+ onPointerUp: () => P(!1)
591
+ }, T.filter((e) => !e.position && n === 0 || e.position === t).map((n, i) => /* @__PURE__ */ o.createElement(ie, {
592
+ key: n.id,
593
+ icons: x,
594
+ index: i,
595
+ toast: n,
596
+ defaultRichColors: p,
597
+ duration: _?.duration ?? m,
598
+ className: _?.className,
599
+ descriptionClassName: _?.descriptionClassName,
600
+ invert: r,
601
+ visibleToasts: g,
602
+ closeButton: _?.closeButton ?? l,
603
+ interacting: j,
604
+ position: t,
605
+ style: _?.style,
606
+ unstyled: _?.unstyled,
607
+ classNames: _?.classNames,
608
+ cancelButtonStyle: _?.cancelButtonStyle,
609
+ actionButtonStyle: _?.actionButtonStyle,
610
+ closeButtonAriaLabel: _?.closeButtonAriaLabel,
611
+ removeToast: V,
612
+ toasts: T.filter((e) => e.position == n.position),
613
+ heights: D.filter((e) => e.position == n.position),
614
+ setHeights: ne,
615
+ expandByDefault: c,
616
+ gap: y,
617
+ expanded: re,
618
+ swipeDirections: e.swipeDirections
619
+ }))) : null;
620
+ }));
621
+ }), F = a("rounded-md px-4 py-3 text-sm gap-3 shadow-lg flex max-w-[420px] min-w-[300px] items-start border", {
622
+ variants: { variant: {
623
+ default: "border-toast-border bg-toast-bg text-toast-text",
624
+ success: "border-toast-success-border bg-toast-success-bg text-toast-success-text",
625
+ error: "border-toast-danger-border bg-toast-danger-bg text-toast-danger-text",
626
+ info: "border-toast-info-border bg-toast-info-bg text-toast-info-text",
627
+ warning: "border-toast-warning-border bg-toast-warning-bg text-toast-warning-text"
628
+ } },
629
+ defaultVariants: { variant: "default" }
630
+ }), I = a("mt-1 text-sm opacity-90", {
631
+ variants: { variant: {
632
+ default: "text-toast-text",
633
+ success: "text-toast-success-text",
634
+ error: "text-toast-danger-text",
635
+ info: "text-toast-info-text",
636
+ warning: "text-toast-warning-text"
637
+ } },
638
+ defaultVariants: { variant: "default" }
639
+ }), L = {
640
+ default: null,
641
+ success: /* @__PURE__ */ c(e, { className: "size-5 shrink-0 text-toast-success-icon" }),
642
+ info: /* @__PURE__ */ c(n, { className: "size-5 shrink-0 text-toast-info-icon" }),
643
+ warning: /* @__PURE__ */ c(r, { className: "size-5 shrink-0 text-toast-warning-icon" }),
644
+ error: /* @__PURE__ */ c(t, { className: "size-5 shrink-0 text-toast-danger-icon" })
645
+ }, R = ({ gap: e = 14, offset: t = 32, position: n = "bottom-right", visibleToasts: r = 3, ...i }) => /* @__PURE__ */ c(P, {
646
+ position: n,
647
+ visibleToasts: r,
648
+ offset: t,
649
+ gap: e,
650
+ toastOptions: {
651
+ unstyled: !0,
652
+ classNames: { toast: "spectral-toast" }
653
+ },
654
+ ...i
655
+ });
656
+ R.displayName = "Toast.Provider";
657
+ var z = ({ className: e, containerAriaLabel: t = "Notification", dataTestId: n, icon: r, message: a, variant: o = "default" }) => {
658
+ let s = o ?? "default", u = r ?? L[s];
659
+ return /* @__PURE__ */ l("div", {
660
+ "aria-label": t,
661
+ className: i(F({ variant: s }), e),
662
+ "data-variant": s,
663
+ "data-testid": n ?? `spectral-toast-${s}`,
664
+ role: "status",
665
+ "aria-live": "polite",
666
+ children: [u && /* @__PURE__ */ c("div", {
667
+ className: "mt-0.5",
668
+ "aria-hidden": "true",
669
+ children: u
670
+ }), /* @__PURE__ */ c("div", {
671
+ className: "flex flex-col",
672
+ children: /* @__PURE__ */ c("p", {
673
+ className: I({ variant: s }),
674
+ children: a
675
+ })
676
+ })]
677
+ });
678
+ };
679
+ z.displayName = "Toast";
680
+ var B = ({ className: e, containerAriaLabel: t, dataTestId: n, duration: r = 4e3, icon: i, message: a, onAutoClose: o, position: s, variant: l = "default" }) => C.custom((r) => /* @__PURE__ */ c(z, {
681
+ className: e,
682
+ containerAriaLabel: t,
683
+ dataTestId: n,
684
+ icon: i,
685
+ id: r,
686
+ message: a,
687
+ variant: l
688
+ }), {
689
+ duration: r,
690
+ onAutoClose: o,
691
+ position: s
692
+ }), V = Object.assign(z, { Provider: R }), H = Object.assign(B, {
693
+ success: (e) => B({
694
+ ...e,
695
+ variant: "success"
696
+ }),
697
+ error: (e) => B({
698
+ ...e,
699
+ variant: "error"
700
+ }),
701
+ info: (e) => B({
702
+ ...e,
703
+ variant: "info"
704
+ }),
705
+ warning: (e) => B({
706
+ ...e,
707
+ variant: "warning"
708
+ })
709
+ });
710
+ //#endregion
711
+ export { H as n, V as t };