ingeniuscliq-core 0.1.26 → 0.1.28

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.
@@ -1,841 +0,0 @@
1
- import * as At from "react";
2
- import a, { useEffect as Ht, useRef as Gt, useCallback as q } from "react";
3
- import Qt from "react-dom";
4
- import { u as Jt, C as Zt } from "./authStore-CBIJbSuH.js";
5
- import { useTranslation as te } from "react-i18next";
6
- function ee(s = "es") {
7
- const { t: n, i18n: e } = te(), o = () => {
8
- const N = e.language === "en" ? "es" : "en";
9
- e.changeLanguage(N);
10
- };
11
- return Ht(() => {
12
- e.changeLanguage(s);
13
- }, []), { t: n, i18n: e, toggleLanguage: o };
14
- }
15
- const Tt = 768;
16
- function Ce() {
17
- const [s, n] = At.useState(void 0);
18
- return At.useEffect(() => {
19
- const e = window.matchMedia(`(max-width: ${Tt - 1}px)`), o = () => {
20
- n(window.innerWidth < Tt);
21
- };
22
- return e.addEventListener("change", o), n(window.innerWidth < Tt), () => e.removeEventListener("change", o);
23
- }, []), !!s;
24
- }
25
- function ae(s) {
26
- if (typeof document > "u") return;
27
- let n = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
28
- e.type = "text/css", n.appendChild(e), e.styleSheet ? e.styleSheet.cssText = s : e.appendChild(document.createTextNode(s));
29
- }
30
- const ne = (s) => {
31
- switch (s) {
32
- case "success":
33
- return re;
34
- case "info":
35
- return le;
36
- case "warning":
37
- return ie;
38
- case "error":
39
- return de;
40
- default:
41
- return null;
42
- }
43
- }, oe = Array(12).fill(0), se = ({ visible: s, className: n }) => /* @__PURE__ */ a.createElement("div", {
44
- className: [
45
- "sonner-loading-wrapper",
46
- n
47
- ].filter(Boolean).join(" "),
48
- "data-visible": s
49
- }, /* @__PURE__ */ a.createElement("div", {
50
- className: "sonner-spinner"
51
- }, oe.map((e, o) => /* @__PURE__ */ a.createElement("div", {
52
- className: "sonner-loading-bar",
53
- key: `spinner-bar-${o}`
54
- })))), re = /* @__PURE__ */ a.createElement("svg", {
55
- xmlns: "http://www.w3.org/2000/svg",
56
- viewBox: "0 0 20 20",
57
- fill: "currentColor",
58
- height: "20",
59
- width: "20"
60
- }, /* @__PURE__ */ a.createElement("path", {
61
- fillRule: "evenodd",
62
- 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",
63
- clipRule: "evenodd"
64
- })), ie = /* @__PURE__ */ a.createElement("svg", {
65
- xmlns: "http://www.w3.org/2000/svg",
66
- viewBox: "0 0 24 24",
67
- fill: "currentColor",
68
- height: "20",
69
- width: "20"
70
- }, /* @__PURE__ */ a.createElement("path", {
71
- fillRule: "evenodd",
72
- 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",
73
- clipRule: "evenodd"
74
- })), le = /* @__PURE__ */ a.createElement("svg", {
75
- xmlns: "http://www.w3.org/2000/svg",
76
- viewBox: "0 0 20 20",
77
- fill: "currentColor",
78
- height: "20",
79
- width: "20"
80
- }, /* @__PURE__ */ a.createElement("path", {
81
- fillRule: "evenodd",
82
- 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",
83
- clipRule: "evenodd"
84
- })), de = /* @__PURE__ */ a.createElement("svg", {
85
- xmlns: "http://www.w3.org/2000/svg",
86
- viewBox: "0 0 20 20",
87
- fill: "currentColor",
88
- height: "20",
89
- width: "20"
90
- }, /* @__PURE__ */ a.createElement("path", {
91
- fillRule: "evenodd",
92
- 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",
93
- clipRule: "evenodd"
94
- })), ce = /* @__PURE__ */ a.createElement("svg", {
95
- xmlns: "http://www.w3.org/2000/svg",
96
- width: "12",
97
- height: "12",
98
- viewBox: "0 0 24 24",
99
- fill: "none",
100
- stroke: "currentColor",
101
- strokeWidth: "1.5",
102
- strokeLinecap: "round",
103
- strokeLinejoin: "round"
104
- }, /* @__PURE__ */ a.createElement("line", {
105
- x1: "18",
106
- y1: "6",
107
- x2: "6",
108
- y2: "18"
109
- }), /* @__PURE__ */ a.createElement("line", {
110
- x1: "6",
111
- y1: "6",
112
- x2: "18",
113
- y2: "18"
114
- })), ue = () => {
115
- const [s, n] = a.useState(document.hidden);
116
- return a.useEffect(() => {
117
- const e = () => {
118
- n(document.hidden);
119
- };
120
- return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
121
- }, []), s;
122
- };
123
- let kt = 1;
124
- class fe {
125
- constructor() {
126
- this.subscribe = (n) => (this.subscribers.push(n), () => {
127
- const e = this.subscribers.indexOf(n);
128
- this.subscribers.splice(e, 1);
129
- }), this.publish = (n) => {
130
- this.subscribers.forEach((e) => e(n));
131
- }, this.addToast = (n) => {
132
- this.publish(n), this.toasts = [
133
- ...this.toasts,
134
- n
135
- ];
136
- }, this.create = (n) => {
137
- var e;
138
- const { message: o, ...N } = n, c = typeof (n == null ? void 0 : n.id) == "number" || ((e = n.id) == null ? void 0 : e.length) > 0 ? n.id : kt++, v = this.toasts.find((p) => p.id === c), _ = n.dismissible === void 0 ? !0 : n.dismissible;
139
- return this.dismissedToasts.has(c) && this.dismissedToasts.delete(c), v ? this.toasts = this.toasts.map((p) => p.id === c ? (this.publish({
140
- ...p,
141
- ...n,
142
- id: c,
143
- title: o
144
- }), {
145
- ...p,
146
- ...n,
147
- id: c,
148
- dismissible: _,
149
- title: o
150
- }) : p) : this.addToast({
151
- title: o,
152
- ...N,
153
- dismissible: _,
154
- id: c
155
- }), c;
156
- }, this.dismiss = (n) => (n ? (this.dismissedToasts.add(n), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
157
- id: n,
158
- dismiss: !0
159
- })))) : this.toasts.forEach((e) => {
160
- this.subscribers.forEach((o) => o({
161
- id: e.id,
162
- dismiss: !0
163
- }));
164
- }), n), this.message = (n, e) => this.create({
165
- ...e,
166
- message: n
167
- }), this.error = (n, e) => this.create({
168
- ...e,
169
- message: n,
170
- type: "error"
171
- }), this.success = (n, e) => this.create({
172
- ...e,
173
- type: "success",
174
- message: n
175
- }), this.info = (n, e) => this.create({
176
- ...e,
177
- type: "info",
178
- message: n
179
- }), this.warning = (n, e) => this.create({
180
- ...e,
181
- type: "warning",
182
- message: n
183
- }), this.loading = (n, e) => this.create({
184
- ...e,
185
- type: "loading",
186
- message: n
187
- }), this.promise = (n, e) => {
188
- if (!e)
189
- return;
190
- let o;
191
- e.loading !== void 0 && (o = this.create({
192
- ...e,
193
- promise: n,
194
- type: "loading",
195
- message: e.loading,
196
- description: typeof e.description != "function" ? e.description : void 0
197
- }));
198
- const N = Promise.resolve(n instanceof Function ? n() : n);
199
- let c = o !== void 0, v;
200
- const _ = N.then(async (i) => {
201
- if (v = [
202
- "resolve",
203
- i
204
- ], a.isValidElement(i))
205
- c = !1, this.create({
206
- id: o,
207
- type: "default",
208
- message: i
209
- });
210
- else if (pe(i) && !i.ok) {
211
- c = !1;
212
- const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, f = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, g = typeof t == "object" && !a.isValidElement(t) ? t : {
213
- message: t
214
- };
215
- this.create({
216
- id: o,
217
- type: "error",
218
- description: f,
219
- ...g
220
- });
221
- } else if (i instanceof Error) {
222
- c = !1;
223
- const t = typeof e.error == "function" ? await e.error(i) : e.error, f = typeof e.description == "function" ? await e.description(i) : e.description, g = typeof t == "object" && !a.isValidElement(t) ? t : {
224
- message: t
225
- };
226
- this.create({
227
- id: o,
228
- type: "error",
229
- description: f,
230
- ...g
231
- });
232
- } else if (e.success !== void 0) {
233
- c = !1;
234
- const t = typeof e.success == "function" ? await e.success(i) : e.success, f = typeof e.description == "function" ? await e.description(i) : e.description, g = typeof t == "object" && !a.isValidElement(t) ? t : {
235
- message: t
236
- };
237
- this.create({
238
- id: o,
239
- type: "success",
240
- description: f,
241
- ...g
242
- });
243
- }
244
- }).catch(async (i) => {
245
- if (v = [
246
- "reject",
247
- i
248
- ], e.error !== void 0) {
249
- c = !1;
250
- const y = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, B = typeof y == "object" && !a.isValidElement(y) ? y : {
251
- message: y
252
- };
253
- this.create({
254
- id: o,
255
- type: "error",
256
- description: t,
257
- ...B
258
- });
259
- }
260
- }).finally(() => {
261
- c && (this.dismiss(o), o = void 0), e.finally == null || e.finally.call(e);
262
- }), p = () => new Promise((i, y) => _.then(() => v[0] === "reject" ? y(v[1]) : i(v[1])).catch(y));
263
- return typeof o != "string" && typeof o != "number" ? {
264
- unwrap: p
265
- } : Object.assign(o, {
266
- unwrap: p
267
- });
268
- }, this.custom = (n, e) => {
269
- const o = (e == null ? void 0 : e.id) || kt++;
270
- return this.create({
271
- jsx: n(o),
272
- id: o,
273
- ...e
274
- }), o;
275
- }, this.getActiveToasts = () => this.toasts.filter((n) => !this.dismissedToasts.has(n.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
276
- }
277
- }
278
- const R = new fe(), me = (s, n) => {
279
- const e = (n == null ? void 0 : n.id) || kt++;
280
- return R.addToast({
281
- title: s,
282
- ...n,
283
- id: e
284
- }), e;
285
- }, pe = (s) => s && typeof s == "object" && "ok" in s && typeof s.ok == "boolean" && "status" in s && typeof s.status == "number", ge = me, he = () => R.toasts, be = () => R.getActiveToasts(), Ae = Object.assign(ge, {
286
- success: R.success,
287
- info: R.info,
288
- warning: R.warning,
289
- error: R.error,
290
- custom: R.custom,
291
- message: R.message,
292
- promise: R.promise,
293
- dismiss: R.dismiss,
294
- loading: R.loading
295
- }, {
296
- getHistory: he,
297
- getToasts: be
298
- });
299
- ae("[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%)}");
300
- function vt(s) {
301
- return s.label !== void 0;
302
- }
303
- const ve = 3, ye = "24px", we = "16px", Lt = 4e3, xe = 356, Ee = 14, Te = 45, ke = 200;
304
- function z(...s) {
305
- return s.filter(Boolean).join(" ");
306
- }
307
- function Se(s) {
308
- const [n, e] = s.split("-"), o = [];
309
- return n && o.push(n), e && o.push(e), o;
310
- }
311
- const Ne = (s) => {
312
- var n, e, o, N, c, v, _, p, i;
313
- const { invert: y, toast: t, unstyled: f, interacting: B, setHeights: g, visibleToasts: G, heights: $, index: d, toasts: Q, expanded: F, removeToast: J, defaultRichColors: w, closeButton: k, style: P, cancelButtonStyle: j, actionButtonStyle: st, className: ct = "", descriptionClassName: yt = "", duration: rt, position: H, gap: ut, expandByDefault: it, classNames: u, icons: E, closeButtonAriaLabel: V = "Close toast" } = s, [W, A] = a.useState(null), [X, ft] = a.useState(null), [l, b] = a.useState(!1), [h, I] = a.useState(!1), [Z, m] = a.useState(!1), [tt, mt] = a.useState(!1), [pt, et] = a.useState(!1), [zt, wt] = a.useState(0), [Pt, St] = a.useState(0), lt = a.useRef(t.duration || rt || Lt), Nt = a.useRef(null), Y = a.useRef(null), jt = d === 0, Yt = d + 1 <= G, D = t.type, at = t.dismissible !== !1, $t = t.className || "", Ft = t.descriptionClassName || "", gt = a.useMemo(() => $.findIndex((r) => r.toastId === t.id) || 0, [
314
- $,
315
- t.id
316
- ]), Vt = a.useMemo(() => {
317
- var r;
318
- return (r = t.closeButton) != null ? r : k;
319
- }, [
320
- t.closeButton,
321
- k
322
- ]), _t = a.useMemo(() => t.duration || rt || Lt, [
323
- t.duration,
324
- rt
325
- ]), xt = a.useRef(0), nt = a.useRef(0), Rt = a.useRef(0), ot = a.useRef(null), [Ut, Wt] = H.split("-"), Bt = a.useMemo(() => $.reduce((r, x, S) => S >= gt ? r : r + x.height, 0), [
326
- $,
327
- gt
328
- ]), Dt = ue(), Xt = t.invert || y, Et = D === "loading";
329
- nt.current = a.useMemo(() => gt * ut + Bt, [
330
- gt,
331
- Bt
332
- ]), a.useEffect(() => {
333
- lt.current = _t;
334
- }, [
335
- _t
336
- ]), a.useEffect(() => {
337
- b(!0);
338
- }, []), a.useEffect(() => {
339
- const r = Y.current;
340
- if (r) {
341
- const x = r.getBoundingClientRect().height;
342
- return St(x), g((S) => [
343
- {
344
- toastId: t.id,
345
- height: x,
346
- position: t.position
347
- },
348
- ...S
349
- ]), () => g((S) => S.filter((M) => M.toastId !== t.id));
350
- }
351
- }, [
352
- g,
353
- t.id
354
- ]), a.useLayoutEffect(() => {
355
- if (!l) return;
356
- const r = Y.current, x = r.style.height;
357
- r.style.height = "auto";
358
- const S = r.getBoundingClientRect().height;
359
- r.style.height = x, St(S), g((M) => M.find((T) => T.toastId === t.id) ? M.map((T) => T.toastId === t.id ? {
360
- ...T,
361
- height: S
362
- } : T) : [
363
- {
364
- toastId: t.id,
365
- height: S,
366
- position: t.position
367
- },
368
- ...M
369
- ]);
370
- }, [
371
- l,
372
- t.title,
373
- t.description,
374
- g,
375
- t.id,
376
- t.jsx,
377
- t.action,
378
- t.cancel
379
- ]);
380
- const U = a.useCallback(() => {
381
- I(!0), wt(nt.current), g((r) => r.filter((x) => x.toastId !== t.id)), setTimeout(() => {
382
- J(t);
383
- }, ke);
384
- }, [
385
- t,
386
- J,
387
- g,
388
- nt
389
- ]);
390
- a.useEffect(() => {
391
- if (t.promise && D === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
392
- let r;
393
- return F || B || Dt ? (() => {
394
- if (Rt.current < xt.current) {
395
- const M = (/* @__PURE__ */ new Date()).getTime() - xt.current;
396
- lt.current = lt.current - M;
397
- }
398
- Rt.current = (/* @__PURE__ */ new Date()).getTime();
399
- })() : (() => {
400
- lt.current !== 1 / 0 && (xt.current = (/* @__PURE__ */ new Date()).getTime(), r = setTimeout(() => {
401
- t.onAutoClose == null || t.onAutoClose.call(t, t), U();
402
- }, lt.current));
403
- })(), () => clearTimeout(r);
404
- }, [
405
- F,
406
- B,
407
- t,
408
- D,
409
- Dt,
410
- U
411
- ]), a.useEffect(() => {
412
- t.delete && (U(), t.onDismiss == null || t.onDismiss.call(t, t));
413
- }, [
414
- U,
415
- t.delete
416
- ]);
417
- function Kt() {
418
- var r;
419
- if (E != null && E.loading) {
420
- var x;
421
- return /* @__PURE__ */ a.createElement("div", {
422
- className: z(u == null ? void 0 : u.loader, t == null || (x = t.classNames) == null ? void 0 : x.loader, "sonner-loader"),
423
- "data-visible": D === "loading"
424
- }, E.loading);
425
- }
426
- return /* @__PURE__ */ a.createElement(se, {
427
- className: z(u == null ? void 0 : u.loader, t == null || (r = t.classNames) == null ? void 0 : r.loader),
428
- visible: D === "loading"
429
- });
430
- }
431
- const qt = t.icon || (E == null ? void 0 : E[D]) || ne(D);
432
- var Mt, It;
433
- return /* @__PURE__ */ a.createElement("li", {
434
- tabIndex: 0,
435
- ref: Y,
436
- className: z(ct, $t, u == null ? void 0 : u.toast, t == null || (n = t.classNames) == null ? void 0 : n.toast, u == null ? void 0 : u.default, u == null ? void 0 : u[D], t == null || (e = t.classNames) == null ? void 0 : e[D]),
437
- "data-sonner-toast": "",
438
- "data-rich-colors": (Mt = t.richColors) != null ? Mt : w,
439
- "data-styled": !(t.jsx || t.unstyled || f),
440
- "data-mounted": l,
441
- "data-promise": !!t.promise,
442
- "data-swiped": pt,
443
- "data-removed": h,
444
- "data-visible": Yt,
445
- "data-y-position": Ut,
446
- "data-x-position": Wt,
447
- "data-index": d,
448
- "data-front": jt,
449
- "data-swiping": Z,
450
- "data-dismissible": at,
451
- "data-type": D,
452
- "data-invert": Xt,
453
- "data-swipe-out": tt,
454
- "data-swipe-direction": X,
455
- "data-expanded": !!(F || it && l),
456
- "data-testid": t.testId,
457
- style: {
458
- "--index": d,
459
- "--toasts-before": d,
460
- "--z-index": Q.length - d,
461
- "--offset": `${h ? zt : nt.current}px`,
462
- "--initial-height": it ? "auto" : `${Pt}px`,
463
- ...P,
464
- ...t.style
465
- },
466
- onDragEnd: () => {
467
- m(!1), A(null), ot.current = null;
468
- },
469
- onPointerDown: (r) => {
470
- r.button !== 2 && (Et || !at || (Nt.current = /* @__PURE__ */ new Date(), wt(nt.current), r.target.setPointerCapture(r.pointerId), r.target.tagName !== "BUTTON" && (m(!0), ot.current = {
471
- x: r.clientX,
472
- y: r.clientY
473
- })));
474
- },
475
- onPointerUp: () => {
476
- var r, x, S;
477
- if (tt || !at) return;
478
- ot.current = null;
479
- const M = Number(((r = Y.current) == null ? void 0 : r.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), ht = Number(((x = Y.current) == null ? void 0 : x.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), T = (/* @__PURE__ */ new Date()).getTime() - ((S = Nt.current) == null ? void 0 : S.getTime()), C = W === "x" ? M : ht, bt = Math.abs(C) / T;
480
- if (Math.abs(C) >= Te || bt > 0.11) {
481
- wt(nt.current), t.onDismiss == null || t.onDismiss.call(t, t), ft(W === "x" ? M > 0 ? "right" : "left" : ht > 0 ? "down" : "up"), U(), mt(!0);
482
- return;
483
- } else {
484
- var L, O;
485
- (L = Y.current) == null || L.style.setProperty("--swipe-amount-x", "0px"), (O = Y.current) == null || O.style.setProperty("--swipe-amount-y", "0px");
486
- }
487
- et(!1), m(!1), A(null);
488
- },
489
- onPointerMove: (r) => {
490
- var x, S, M;
491
- if (!ot.current || !at || ((x = window.getSelection()) == null ? void 0 : x.toString().length) > 0) return;
492
- const T = r.clientY - ot.current.y, C = r.clientX - ot.current.x;
493
- var bt;
494
- const L = (bt = s.swipeDirections) != null ? bt : Se(H);
495
- !W && (Math.abs(C) > 1 || Math.abs(T) > 1) && A(Math.abs(C) > Math.abs(T) ? "x" : "y");
496
- let O = {
497
- x: 0,
498
- y: 0
499
- };
500
- const Ct = (K) => 1 / (1.5 + Math.abs(K) / 20);
501
- if (W === "y") {
502
- if (L.includes("top") || L.includes("bottom"))
503
- if (L.includes("top") && T < 0 || L.includes("bottom") && T > 0)
504
- O.y = T;
505
- else {
506
- const K = T * Ct(T);
507
- O.y = Math.abs(K) < Math.abs(T) ? K : T;
508
- }
509
- } else if (W === "x" && (L.includes("left") || L.includes("right")))
510
- if (L.includes("left") && C < 0 || L.includes("right") && C > 0)
511
- O.x = C;
512
- else {
513
- const K = C * Ct(C);
514
- O.x = Math.abs(K) < Math.abs(C) ? K : C;
515
- }
516
- (Math.abs(O.x) > 0 || Math.abs(O.y) > 0) && et(!0), (S = Y.current) == null || S.style.setProperty("--swipe-amount-x", `${O.x}px`), (M = Y.current) == null || M.style.setProperty("--swipe-amount-y", `${O.y}px`);
517
- }
518
- }, Vt && !t.jsx && D !== "loading" ? /* @__PURE__ */ a.createElement("button", {
519
- "aria-label": V,
520
- "data-disabled": Et,
521
- "data-close-button": !0,
522
- onClick: Et || !at ? () => {
523
- } : () => {
524
- U(), t.onDismiss == null || t.onDismiss.call(t, t);
525
- },
526
- className: z(u == null ? void 0 : u.closeButton, t == null || (o = t.classNames) == null ? void 0 : o.closeButton)
527
- }, (It = E == null ? void 0 : E.close) != null ? It : ce) : null, (D || t.icon || t.promise) && t.icon !== null && ((E == null ? void 0 : E[D]) !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
528
- "data-icon": "",
529
- className: z(u == null ? void 0 : u.icon, t == null || (N = t.classNames) == null ? void 0 : N.icon)
530
- }, t.promise || t.type === "loading" && !t.icon ? t.icon || Kt() : null, t.type !== "loading" ? qt : null) : null, /* @__PURE__ */ a.createElement("div", {
531
- "data-content": "",
532
- className: z(u == null ? void 0 : u.content, t == null || (c = t.classNames) == null ? void 0 : c.content)
533
- }, /* @__PURE__ */ a.createElement("div", {
534
- "data-title": "",
535
- className: z(u == null ? void 0 : u.title, t == null || (v = t.classNames) == null ? void 0 : v.title)
536
- }, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
537
- "data-description": "",
538
- className: z(yt, Ft, u == null ? void 0 : u.description, t == null || (_ = t.classNames) == null ? void 0 : _.description)
539
- }, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && vt(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
540
- "data-button": !0,
541
- "data-cancel": !0,
542
- style: t.cancelButtonStyle || j,
543
- onClick: (r) => {
544
- vt(t.cancel) && at && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, r), U());
545
- },
546
- className: z(u == null ? void 0 : u.cancelButton, t == null || (p = t.classNames) == null ? void 0 : p.cancelButton)
547
- }, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && vt(t.action) ? /* @__PURE__ */ a.createElement("button", {
548
- "data-button": !0,
549
- "data-action": !0,
550
- style: t.actionButtonStyle || st,
551
- onClick: (r) => {
552
- vt(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, r), !r.defaultPrevented && U());
553
- },
554
- className: z(u == null ? void 0 : u.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
555
- }, t.action.label) : null);
556
- };
557
- function Ot() {
558
- if (typeof window > "u" || typeof document > "u") return "ltr";
559
- const s = document.documentElement.getAttribute("dir");
560
- return s === "auto" || !s ? window.getComputedStyle(document.documentElement).direction : s;
561
- }
562
- function _e(s, n) {
563
- const e = {};
564
- return [
565
- s,
566
- n
567
- ].forEach((o, N) => {
568
- const c = N === 1, v = c ? "--mobile-offset" : "--offset", _ = c ? we : ye;
569
- function p(i) {
570
- [
571
- "top",
572
- "right",
573
- "bottom",
574
- "left"
575
- ].forEach((y) => {
576
- e[`${v}-${y}`] = typeof i == "number" ? `${i}px` : i;
577
- });
578
- }
579
- typeof o == "number" || typeof o == "string" ? p(o) : typeof o == "object" ? [
580
- "top",
581
- "right",
582
- "bottom",
583
- "left"
584
- ].forEach((i) => {
585
- o[i] === void 0 ? e[`${v}-${i}`] = _ : e[`${v}-${i}`] = typeof o[i] == "number" ? `${o[i]}px` : o[i];
586
- }) : p(_);
587
- }), e;
588
- }
589
- const Le = /* @__PURE__ */ a.forwardRef(function(n, e) {
590
- const { id: o, invert: N, position: c = "bottom-right", hotkey: v = [
591
- "altKey",
592
- "KeyT"
593
- ], expand: _, closeButton: p, className: i, offset: y, mobileOffset: t, theme: f = "light", richColors: B, duration: g, style: G, visibleToasts: $ = ve, toastOptions: d, dir: Q = Ot(), gap: F = Ee, icons: J, containerAriaLabel: w = "Notifications" } = n, [k, P] = a.useState([]), j = a.useMemo(() => o ? k.filter((l) => l.toasterId === o) : k.filter((l) => !l.toasterId), [
594
- k,
595
- o
596
- ]), st = a.useMemo(() => Array.from(new Set([
597
- c
598
- ].concat(j.filter((l) => l.position).map((l) => l.position)))), [
599
- j,
600
- c
601
- ]), [ct, yt] = a.useState([]), [rt, H] = a.useState(!1), [ut, it] = a.useState(!1), [u, E] = a.useState(f !== "system" ? f : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), V = a.useRef(null), W = v.join("+").replace(/Key/g, "").replace(/Digit/g, ""), A = a.useRef(null), X = a.useRef(!1), ft = a.useCallback((l) => {
602
- P((b) => {
603
- var h;
604
- return (h = b.find((I) => I.id === l.id)) != null && h.delete || R.dismiss(l.id), b.filter(({ id: I }) => I !== l.id);
605
- });
606
- }, []);
607
- return a.useEffect(() => R.subscribe((l) => {
608
- if (l.dismiss) {
609
- requestAnimationFrame(() => {
610
- P((b) => b.map((h) => h.id === l.id ? {
611
- ...h,
612
- delete: !0
613
- } : h));
614
- });
615
- return;
616
- }
617
- setTimeout(() => {
618
- Qt.flushSync(() => {
619
- P((b) => {
620
- const h = b.findIndex((I) => I.id === l.id);
621
- return h !== -1 ? [
622
- ...b.slice(0, h),
623
- {
624
- ...b[h],
625
- ...l
626
- },
627
- ...b.slice(h + 1)
628
- ] : [
629
- l,
630
- ...b
631
- ];
632
- });
633
- });
634
- });
635
- }), [
636
- k
637
- ]), a.useEffect(() => {
638
- if (f !== "system") {
639
- E(f);
640
- return;
641
- }
642
- if (f === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? E("dark") : E("light")), typeof window > "u") return;
643
- const l = window.matchMedia("(prefers-color-scheme: dark)");
644
- try {
645
- l.addEventListener("change", ({ matches: b }) => {
646
- E(b ? "dark" : "light");
647
- });
648
- } catch {
649
- l.addListener(({ matches: h }) => {
650
- try {
651
- E(h ? "dark" : "light");
652
- } catch (I) {
653
- console.error(I);
654
- }
655
- });
656
- }
657
- }, [
658
- f
659
- ]), a.useEffect(() => {
660
- k.length <= 1 && H(!1);
661
- }, [
662
- k
663
- ]), a.useEffect(() => {
664
- const l = (b) => {
665
- var h;
666
- if (v.every((m) => b[m] || b.code === m)) {
667
- var Z;
668
- H(!0), (Z = V.current) == null || Z.focus();
669
- }
670
- b.code === "Escape" && (document.activeElement === V.current || (h = V.current) != null && h.contains(document.activeElement)) && H(!1);
671
- };
672
- return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
673
- }, [
674
- v
675
- ]), a.useEffect(() => {
676
- if (V.current)
677
- return () => {
678
- A.current && (A.current.focus({
679
- preventScroll: !0
680
- }), A.current = null, X.current = !1);
681
- };
682
- }, [
683
- V.current
684
- ]), // Remove item from normal navigation flow, only available via hotkey
685
- /* @__PURE__ */ a.createElement("section", {
686
- ref: e,
687
- "aria-label": `${w} ${W}`,
688
- tabIndex: -1,
689
- "aria-live": "polite",
690
- "aria-relevant": "additions text",
691
- "aria-atomic": "false",
692
- suppressHydrationWarning: !0
693
- }, st.map((l, b) => {
694
- var h;
695
- const [I, Z] = l.split("-");
696
- return j.length ? /* @__PURE__ */ a.createElement("ol", {
697
- key: l,
698
- dir: Q === "auto" ? Ot() : Q,
699
- tabIndex: -1,
700
- ref: V,
701
- className: i,
702
- "data-sonner-toaster": !0,
703
- "data-sonner-theme": u,
704
- "data-y-position": I,
705
- "data-x-position": Z,
706
- style: {
707
- "--front-toast-height": `${((h = ct[0]) == null ? void 0 : h.height) || 0}px`,
708
- "--width": `${xe}px`,
709
- "--gap": `${F}px`,
710
- ...G,
711
- ..._e(y, t)
712
- },
713
- onBlur: (m) => {
714
- X.current && !m.currentTarget.contains(m.relatedTarget) && (X.current = !1, A.current && (A.current.focus({
715
- preventScroll: !0
716
- }), A.current = null));
717
- },
718
- onFocus: (m) => {
719
- m.target instanceof HTMLElement && m.target.dataset.dismissible === "false" || X.current || (X.current = !0, A.current = m.relatedTarget);
720
- },
721
- onMouseEnter: () => H(!0),
722
- onMouseMove: () => H(!0),
723
- onMouseLeave: () => {
724
- ut || H(!1);
725
- },
726
- onDragEnd: () => H(!1),
727
- onPointerDown: (m) => {
728
- m.target instanceof HTMLElement && m.target.dataset.dismissible === "false" || it(!0);
729
- },
730
- onPointerUp: () => it(!1)
731
- }, j.filter((m) => !m.position && b === 0 || m.position === l).map((m, tt) => {
732
- var mt, pt;
733
- return /* @__PURE__ */ a.createElement(Ne, {
734
- key: m.id,
735
- icons: J,
736
- index: tt,
737
- toast: m,
738
- defaultRichColors: B,
739
- duration: (mt = d == null ? void 0 : d.duration) != null ? mt : g,
740
- className: d == null ? void 0 : d.className,
741
- descriptionClassName: d == null ? void 0 : d.descriptionClassName,
742
- invert: N,
743
- visibleToasts: $,
744
- closeButton: (pt = d == null ? void 0 : d.closeButton) != null ? pt : p,
745
- interacting: ut,
746
- position: l,
747
- style: d == null ? void 0 : d.style,
748
- unstyled: d == null ? void 0 : d.unstyled,
749
- classNames: d == null ? void 0 : d.classNames,
750
- cancelButtonStyle: d == null ? void 0 : d.cancelButtonStyle,
751
- actionButtonStyle: d == null ? void 0 : d.actionButtonStyle,
752
- closeButtonAriaLabel: d == null ? void 0 : d.closeButtonAriaLabel,
753
- removeToast: ft,
754
- toasts: j.filter((et) => et.position == m.position),
755
- heights: ct.filter((et) => et.position == m.position),
756
- setHeights: yt,
757
- expandByDefault: _,
758
- gap: F,
759
- expanded: rt,
760
- swipeDirections: n.swipeDirections
761
- });
762
- })) : null;
763
- }));
764
- }), dt = new Zt();
765
- function Oe() {
766
- const s = Gt(!0), { t: n } = ee(), {
767
- user: e,
768
- token: o,
769
- refreshToken: N,
770
- isAuthenticated: c,
771
- loading: v,
772
- error: _,
773
- setUser: p,
774
- setToken: i,
775
- setRefreshToken: y,
776
- setError: t,
777
- setLoading: f,
778
- reset: B
779
- } = Jt();
780
- Ht(() => {
781
- (s.current || !e) && (s.current = !1, G());
782
- }, [e, c]);
783
- const g = q(async (w) => {
784
- try {
785
- f(!0), t(null);
786
- const k = await w(), { user: P, token: j, refreshToken: st } = k.data;
787
- return p(P), i(j), y(st), k.data;
788
- } catch (k) {
789
- t(n("error.invalid")), console.error(k);
790
- } finally {
791
- f(!1);
792
- }
793
- }, []), G = q(async () => g(() => dt.getUser()), [g]), $ = q(async (w) => g(() => dt.login(w)), [g]), d = q(async (w) => g(() => dt.register(w)), [g]), Q = q(async () => {
794
- try {
795
- f(!0), await dt.logout();
796
- } catch (w) {
797
- t(n("error.invalid")), console.error(w);
798
- } finally {
799
- B(), f(!1);
800
- }
801
- }, [n, B, t, f]), F = q(async () => {
802
- try {
803
- f(!0), t(null);
804
- const w = await dt.refreshToken(), { token: k, refreshToken: P } = w.data;
805
- return i(k), y(P), w.data;
806
- } catch (w) {
807
- t(n("error.invalid")), console.error(w);
808
- } finally {
809
- f(!1);
810
- }
811
- }, [n, t, f, y, i]), J = q((w) => {
812
- e && p({ ...e, ...w });
813
- }, [e, p]);
814
- return {
815
- // State
816
- user: e,
817
- token: o,
818
- refreshToken: N,
819
- isAuthenticated: c,
820
- loading: v,
821
- error: _,
822
- // Actions
823
- getUser: G,
824
- login: $,
825
- register: d,
826
- logout: Q,
827
- refreshUserToken: F,
828
- updateUser: J,
829
- // Store actions
830
- setUser: p,
831
- setError: t,
832
- reset: B
833
- };
834
- }
835
- export {
836
- Le as T,
837
- ee as a,
838
- Oe as b,
839
- Ae as t,
840
- Ce as u
841
- };