@myxtra/authentication-green 2.7.0 → 2.8.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.
@@ -1,3291 +0,0 @@
1
- var ht = (e, t, s) => {
2
- if (!t.has(e))
3
- throw TypeError("Cannot " + s);
4
- };
5
- var a = (e, t, s) => (ht(e, t, "read from private field"), s ? s.call(e) : t.get(e)), g = (e, t, s) => {
6
- if (t.has(e))
7
- throw TypeError("Cannot add the same private member more than once");
8
- t instanceof WeakSet ? t.add(e) : t.set(e, s);
9
- }, f = (e, t, s, r) => (ht(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s);
10
- var tt = (e, t, s, r) => ({
11
- set _(n) {
12
- f(e, t, n, s);
13
- },
14
- get _() {
15
- return a(e, t, r);
16
- }
17
- }), b = (e, t, s) => (ht(e, t, "access private method"), s);
18
- import { r as h, j as i, u as $s, a as Ks, b as be, P as Rt, c as ns, d as qs, e as Gs, E as Vs, C as Ws } from "./index-ja2JZ7Im.mjs";
19
- var Ue = class {
20
- constructor() {
21
- this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
22
- }
23
- subscribe(e) {
24
- return this.listeners.add(e), this.onSubscribe(), () => {
25
- this.listeners.delete(e), this.onUnsubscribe();
26
- };
27
- }
28
- hasListeners() {
29
- return this.listeners.size > 0;
30
- }
31
- onSubscribe() {
32
- }
33
- onUnsubscribe() {
34
- }
35
- }, Te = typeof window > "u" || "Deno" in globalThis;
36
- function V() {
37
- }
38
- function Zs(e, t) {
39
- return typeof e == "function" ? e(t) : e;
40
- }
41
- function ft(e) {
42
- return typeof e == "number" && e >= 0 && e !== 1 / 0;
43
- }
44
- function as(e, t) {
45
- return Math.max(e + (t || 0) - Date.now(), 0);
46
- }
47
- function Dt(e, t) {
48
- const {
49
- type: s = "all",
50
- exact: r,
51
- fetchStatus: n,
52
- predicate: l,
53
- queryKey: o,
54
- stale: c
55
- } = e;
56
- if (o) {
57
- if (r) {
58
- if (t.queryHash !== At(o, t.options))
59
- return !1;
60
- } else if (!He(t.queryKey, o))
61
- return !1;
62
- }
63
- if (s !== "all") {
64
- const m = t.isActive();
65
- if (s === "active" && !m || s === "inactive" && m)
66
- return !1;
67
- }
68
- return !(typeof c == "boolean" && t.isStale() !== c || n && n !== t.state.fetchStatus || l && !l(t));
69
- }
70
- function Tt(e, t) {
71
- const { exact: s, status: r, predicate: n, mutationKey: l } = e;
72
- if (l) {
73
- if (!t.options.mutationKey)
74
- return !1;
75
- if (s) {
76
- if (Ce(t.options.mutationKey) !== Ce(l))
77
- return !1;
78
- } else if (!He(t.options.mutationKey, l))
79
- return !1;
80
- }
81
- return !(r && t.state.status !== r || n && !n(t));
82
- }
83
- function At(e, t) {
84
- return ((t == null ? void 0 : t.queryKeyHashFn) || Ce)(e);
85
- }
86
- function Ce(e) {
87
- return JSON.stringify(
88
- e,
89
- (t, s) => pt(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
90
- );
91
- }
92
- function He(e, t) {
93
- return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((s) => !He(e[s], t[s])) : !1;
94
- }
95
- function os(e, t) {
96
- if (e === t)
97
- return e;
98
- const s = Ut(e) && Ut(t);
99
- if (s || pt(e) && pt(t)) {
100
- const r = s ? e : Object.keys(e), n = r.length, l = s ? t : Object.keys(t), o = l.length, c = s ? [] : {};
101
- let m = 0;
102
- for (let y = 0; y < o; y++) {
103
- const d = s ? y : l[y];
104
- (!s && r.includes(d) || s) && e[d] === void 0 && t[d] === void 0 ? (c[d] = void 0, m++) : (c[d] = os(e[d], t[d]), c[d] === e[d] && e[d] !== void 0 && m++);
105
- }
106
- return n === o && m === n ? e : c;
107
- }
108
- return t;
109
- }
110
- function it(e, t) {
111
- if (!t || Object.keys(e).length !== Object.keys(t).length)
112
- return !1;
113
- for (const s in e)
114
- if (e[s] !== t[s])
115
- return !1;
116
- return !0;
117
- }
118
- function Ut(e) {
119
- return Array.isArray(e) && e.length === Object.keys(e).length;
120
- }
121
- function pt(e) {
122
- if (!Qt(e))
123
- return !1;
124
- const t = e.constructor;
125
- if (t === void 0)
126
- return !0;
127
- const s = t.prototype;
128
- return !(!Qt(s) || !s.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
129
- }
130
- function Qt(e) {
131
- return Object.prototype.toString.call(e) === "[object Object]";
132
- }
133
- function Ys(e) {
134
- return new Promise((t) => {
135
- setTimeout(t, e);
136
- });
137
- }
138
- function mt(e, t, s) {
139
- return typeof s.structuralSharing == "function" ? s.structuralSharing(e, t) : s.structuralSharing !== !1 ? os(e, t) : t;
140
- }
141
- function zs(e, t, s = 0) {
142
- const r = [...e, t];
143
- return s && r.length > s ? r.slice(1) : r;
144
- }
145
- function Js(e, t, s = 0) {
146
- const r = [t, ...e];
147
- return s && r.length > s ? r.slice(0, -1) : r;
148
- }
149
- var Nt = Symbol(), he, re, je, zt, Xs = (zt = class extends Ue {
150
- constructor() {
151
- super();
152
- g(this, he, void 0);
153
- g(this, re, void 0);
154
- g(this, je, void 0);
155
- f(this, je, (t) => {
156
- if (!Te && window.addEventListener) {
157
- const s = () => t();
158
- return window.addEventListener("visibilitychange", s, !1), () => {
159
- window.removeEventListener("visibilitychange", s);
160
- };
161
- }
162
- });
163
- }
164
- onSubscribe() {
165
- a(this, re) || this.setEventListener(a(this, je));
166
- }
167
- onUnsubscribe() {
168
- var t;
169
- this.hasListeners() || ((t = a(this, re)) == null || t.call(this), f(this, re, void 0));
170
- }
171
- setEventListener(t) {
172
- var s;
173
- f(this, je, t), (s = a(this, re)) == null || s.call(this), f(this, re, t((r) => {
174
- typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
175
- }));
176
- }
177
- setFocused(t) {
178
- a(this, he) !== t && (f(this, he, t), this.onFocus());
179
- }
180
- onFocus() {
181
- const t = this.isFocused();
182
- this.listeners.forEach((s) => {
183
- s(t);
184
- });
185
- }
186
- isFocused() {
187
- var t;
188
- return typeof a(this, he) == "boolean" ? a(this, he) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
189
- }
190
- }, he = new WeakMap(), re = new WeakMap(), je = new WeakMap(), zt), kt = new Xs(), _e, ie, Se, Jt, Is = (Jt = class extends Ue {
191
- constructor() {
192
- super();
193
- g(this, _e, !0);
194
- g(this, ie, void 0);
195
- g(this, Se, void 0);
196
- f(this, Se, (t) => {
197
- if (!Te && window.addEventListener) {
198
- const s = () => t(!0), r = () => t(!1);
199
- return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
200
- window.removeEventListener("online", s), window.removeEventListener("offline", r);
201
- };
202
- }
203
- });
204
- }
205
- onSubscribe() {
206
- a(this, ie) || this.setEventListener(a(this, Se));
207
- }
208
- onUnsubscribe() {
209
- var t;
210
- this.hasListeners() || ((t = a(this, ie)) == null || t.call(this), f(this, ie, void 0));
211
- }
212
- setEventListener(t) {
213
- var s;
214
- f(this, Se, t), (s = a(this, ie)) == null || s.call(this), f(this, ie, t(this.setOnline.bind(this)));
215
- }
216
- setOnline(t) {
217
- a(this, _e) !== t && (f(this, _e, t), this.listeners.forEach((r) => {
218
- r(t);
219
- }));
220
- }
221
- isOnline() {
222
- return a(this, _e);
223
- }
224
- }, _e = new WeakMap(), ie = new WeakMap(), Se = new WeakMap(), Jt), nt = new Is();
225
- function Bs(e) {
226
- return Math.min(1e3 * 2 ** e, 3e4);
227
- }
228
- function ls(e) {
229
- return (e ?? "online") === "online" ? nt.isOnline() : !0;
230
- }
231
- var cs = class {
232
- constructor(e) {
233
- this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
234
- }
235
- };
236
- function dt(e) {
237
- return e instanceof cs;
238
- }
239
- function us(e) {
240
- let t = !1, s = 0, r = !1, n, l, o;
241
- const c = new Promise((x, C) => {
242
- l = x, o = C;
243
- }), m = (x) => {
244
- var C;
245
- r || (E(new cs(x)), (C = e.abort) == null || C.call(e));
246
- }, y = () => {
247
- t = !0;
248
- }, d = () => {
249
- t = !1;
250
- }, v = () => kt.isFocused() && (e.networkMode === "always" || nt.isOnline()) && e.canRun(), u = () => ls(e.networkMode) && e.canRun(), p = (x) => {
251
- var C;
252
- r || (r = !0, (C = e.onSuccess) == null || C.call(e, x), n == null || n(), l(x));
253
- }, E = (x) => {
254
- var C;
255
- r || (r = !0, (C = e.onError) == null || C.call(e, x), n == null || n(), o(x));
256
- }, S = () => new Promise((x) => {
257
- var C;
258
- n = (_) => {
259
- (r || v()) && x(_);
260
- }, (C = e.onPause) == null || C.call(e);
261
- }).then(() => {
262
- var x;
263
- n = void 0, r || (x = e.onContinue) == null || x.call(e);
264
- }), j = () => {
265
- if (r)
266
- return;
267
- let x;
268
- try {
269
- x = e.fn();
270
- } catch (C) {
271
- x = Promise.reject(C);
272
- }
273
- Promise.resolve(x).then(p).catch((C) => {
274
- var z;
275
- if (r)
276
- return;
277
- const _ = e.retry ?? (Te ? 0 : 3), O = e.retryDelay ?? Bs, F = typeof O == "function" ? O(s, C) : O, Y = _ === !0 || typeof _ == "number" && s < _ || typeof _ == "function" && _(s, C);
278
- if (t || !Y) {
279
- E(C);
280
- return;
281
- }
282
- s++, (z = e.onFail) == null || z.call(e, s, C), Ys(F).then(() => v() ? void 0 : S()).then(() => {
283
- t ? E(C) : j();
284
- });
285
- });
286
- };
287
- return {
288
- promise: c,
289
- cancel: m,
290
- continue: () => (n == null || n(), c),
291
- cancelRetry: y,
292
- continueRetry: d,
293
- canStart: u,
294
- start: () => (u() ? j() : S().then(j), c)
295
- };
296
- }
297
- function er() {
298
- let e = [], t = 0, s = (u) => {
299
- u();
300
- }, r = (u) => {
301
- u();
302
- }, n = (u) => setTimeout(u, 0);
303
- const l = (u) => {
304
- n = u;
305
- }, o = (u) => {
306
- let p;
307
- t++;
308
- try {
309
- p = u();
310
- } finally {
311
- t--, t || y();
312
- }
313
- return p;
314
- }, c = (u) => {
315
- t ? e.push(u) : n(() => {
316
- s(u);
317
- });
318
- }, m = (u) => (...p) => {
319
- c(() => {
320
- u(...p);
321
- });
322
- }, y = () => {
323
- const u = e;
324
- e = [], u.length && n(() => {
325
- r(() => {
326
- u.forEach((p) => {
327
- s(p);
328
- });
329
- });
330
- });
331
- };
332
- return {
333
- batch: o,
334
- batchCalls: m,
335
- schedule: c,
336
- setNotifyFunction: (u) => {
337
- s = u;
338
- },
339
- setBatchNotifyFunction: (u) => {
340
- r = u;
341
- },
342
- setScheduler: l
343
- };
344
- }
345
- var R = er(), de, Xt, hs = (Xt = class {
346
- constructor() {
347
- g(this, de, void 0);
348
- }
349
- destroy() {
350
- this.clearGcTimeout();
351
- }
352
- scheduleGc() {
353
- this.clearGcTimeout(), ft(this.gcTime) && f(this, de, setTimeout(() => {
354
- this.optionalRemove();
355
- }, this.gcTime));
356
- }
357
- updateGcTime(e) {
358
- this.gcTime = Math.max(
359
- this.gcTime || 0,
360
- e ?? (Te ? 1 / 0 : 5 * 60 * 1e3)
361
- );
362
- }
363
- clearGcTimeout() {
364
- a(this, de) && (clearTimeout(a(this, de)), f(this, de, void 0));
365
- }
366
- }, de = new WeakMap(), Xt), Ee, Pe, G, D, $e, fe, Z, ee, It, tr = (It = class extends hs {
367
- constructor(t) {
368
- super();
369
- g(this, Z);
370
- g(this, Ee, void 0);
371
- g(this, Pe, void 0);
372
- g(this, G, void 0);
373
- g(this, D, void 0);
374
- g(this, $e, void 0);
375
- g(this, fe, void 0);
376
- f(this, fe, !1), f(this, $e, t.defaultOptions), this.setOptions(t.options), this.observers = [], f(this, G, t.cache), this.queryKey = t.queryKey, this.queryHash = t.queryHash, f(this, Ee, t.state || sr(this.options)), this.state = a(this, Ee), this.scheduleGc();
377
- }
378
- get meta() {
379
- return this.options.meta;
380
- }
381
- setOptions(t) {
382
- this.options = { ...a(this, $e), ...t }, this.updateGcTime(this.options.gcTime);
383
- }
384
- optionalRemove() {
385
- !this.observers.length && this.state.fetchStatus === "idle" && a(this, G).remove(this);
386
- }
387
- setData(t, s) {
388
- const r = mt(this.state.data, t, this.options);
389
- return b(this, Z, ee).call(this, {
390
- data: r,
391
- type: "success",
392
- dataUpdatedAt: s == null ? void 0 : s.updatedAt,
393
- manual: s == null ? void 0 : s.manual
394
- }), r;
395
- }
396
- setState(t, s) {
397
- b(this, Z, ee).call(this, { type: "setState", state: t, setStateOptions: s });
398
- }
399
- cancel(t) {
400
- var r, n;
401
- const s = (r = a(this, D)) == null ? void 0 : r.promise;
402
- return (n = a(this, D)) == null || n.cancel(t), s ? s.then(V).catch(V) : Promise.resolve();
403
- }
404
- destroy() {
405
- super.destroy(), this.cancel({ silent: !0 });
406
- }
407
- reset() {
408
- this.destroy(), this.setState(a(this, Ee));
409
- }
410
- isActive() {
411
- return this.observers.some((t) => t.options.enabled !== !1);
412
- }
413
- isDisabled() {
414
- return this.getObserversCount() > 0 && !this.isActive();
415
- }
416
- isStale() {
417
- return this.state.isInvalidated ? !0 : this.getObserversCount() > 0 ? this.observers.some(
418
- (t) => t.getCurrentResult().isStale
419
- ) : this.state.data === void 0;
420
- }
421
- isStaleByTime(t = 0) {
422
- return this.state.isInvalidated || this.state.data === void 0 || !as(this.state.dataUpdatedAt, t);
423
- }
424
- onFocus() {
425
- var s;
426
- const t = this.observers.find((r) => r.shouldFetchOnWindowFocus());
427
- t == null || t.refetch({ cancelRefetch: !1 }), (s = a(this, D)) == null || s.continue();
428
- }
429
- onOnline() {
430
- var s;
431
- const t = this.observers.find((r) => r.shouldFetchOnReconnect());
432
- t == null || t.refetch({ cancelRefetch: !1 }), (s = a(this, D)) == null || s.continue();
433
- }
434
- addObserver(t) {
435
- this.observers.includes(t) || (this.observers.push(t), this.clearGcTimeout(), a(this, G).notify({ type: "observerAdded", query: this, observer: t }));
436
- }
437
- removeObserver(t) {
438
- this.observers.includes(t) && (this.observers = this.observers.filter((s) => s !== t), this.observers.length || (a(this, D) && (a(this, fe) ? a(this, D).cancel({ revert: !0 }) : a(this, D).cancelRetry()), this.scheduleGc()), a(this, G).notify({ type: "observerRemoved", query: this, observer: t }));
439
- }
440
- getObserversCount() {
441
- return this.observers.length;
442
- }
443
- invalidate() {
444
- this.state.isInvalidated || b(this, Z, ee).call(this, { type: "invalidate" });
445
- }
446
- fetch(t, s) {
447
- var y, d, v;
448
- if (this.state.fetchStatus !== "idle") {
449
- if (this.state.data !== void 0 && (s != null && s.cancelRefetch))
450
- this.cancel({ silent: !0 });
451
- else if (a(this, D))
452
- return a(this, D).continueRetry(), a(this, D).promise;
453
- }
454
- if (t && this.setOptions(t), !this.options.queryFn) {
455
- const u = this.observers.find((p) => p.options.queryFn);
456
- u && this.setOptions(u.options);
457
- }
458
- const r = new AbortController(), n = {
459
- queryKey: this.queryKey,
460
- meta: this.meta
461
- }, l = (u) => {
462
- Object.defineProperty(u, "signal", {
463
- enumerable: !0,
464
- get: () => (f(this, fe, !0), r.signal)
465
- });
466
- };
467
- l(n);
468
- const o = () => !this.options.queryFn || this.options.queryFn === Nt ? Promise.reject(
469
- new Error(`Missing queryFn: '${this.options.queryHash}'`)
470
- ) : (f(this, fe, !1), this.options.persister ? this.options.persister(
471
- this.options.queryFn,
472
- n,
473
- this
474
- ) : this.options.queryFn(
475
- n
476
- )), c = {
477
- fetchOptions: s,
478
- options: this.options,
479
- queryKey: this.queryKey,
480
- state: this.state,
481
- fetchFn: o
482
- };
483
- l(c), (y = this.options.behavior) == null || y.onFetch(
484
- c,
485
- this
486
- ), f(this, Pe, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((d = c.fetchOptions) == null ? void 0 : d.meta)) && b(this, Z, ee).call(this, { type: "fetch", meta: (v = c.fetchOptions) == null ? void 0 : v.meta });
487
- const m = (u) => {
488
- var p, E, S, j;
489
- dt(u) && u.silent || b(this, Z, ee).call(this, {
490
- type: "error",
491
- error: u
492
- }), dt(u) || ((E = (p = a(this, G).config).onError) == null || E.call(
493
- p,
494
- u,
495
- this
496
- ), (j = (S = a(this, G).config).onSettled) == null || j.call(
497
- S,
498
- this.state.data,
499
- u,
500
- this
501
- )), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
502
- };
503
- return f(this, D, us({
504
- fn: c.fetchFn,
505
- abort: r.abort.bind(r),
506
- onSuccess: (u) => {
507
- var p, E, S, j;
508
- if (u === void 0) {
509
- m(new Error(`${this.queryHash} data is undefined`));
510
- return;
511
- }
512
- this.setData(u), (E = (p = a(this, G).config).onSuccess) == null || E.call(p, u, this), (j = (S = a(this, G).config).onSettled) == null || j.call(
513
- S,
514
- u,
515
- this.state.error,
516
- this
517
- ), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
518
- },
519
- onError: m,
520
- onFail: (u, p) => {
521
- b(this, Z, ee).call(this, { type: "failed", failureCount: u, error: p });
522
- },
523
- onPause: () => {
524
- b(this, Z, ee).call(this, { type: "pause" });
525
- },
526
- onContinue: () => {
527
- b(this, Z, ee).call(this, { type: "continue" });
528
- },
529
- retry: c.options.retry,
530
- retryDelay: c.options.retryDelay,
531
- networkMode: c.options.networkMode,
532
- canRun: () => !0
533
- })), a(this, D).start();
534
- }
535
- }, Ee = new WeakMap(), Pe = new WeakMap(), G = new WeakMap(), D = new WeakMap(), $e = new WeakMap(), fe = new WeakMap(), Z = new WeakSet(), ee = function(t) {
536
- const s = (r) => {
537
- switch (t.type) {
538
- case "failed":
539
- return {
540
- ...r,
541
- fetchFailureCount: t.failureCount,
542
- fetchFailureReason: t.error
543
- };
544
- case "pause":
545
- return {
546
- ...r,
547
- fetchStatus: "paused"
548
- };
549
- case "continue":
550
- return {
551
- ...r,
552
- fetchStatus: "fetching"
553
- };
554
- case "fetch":
555
- return {
556
- ...r,
557
- ...ds(r.data, this.options),
558
- fetchMeta: t.meta ?? null
559
- };
560
- case "success":
561
- return {
562
- ...r,
563
- data: t.data,
564
- dataUpdateCount: r.dataUpdateCount + 1,
565
- dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
566
- error: null,
567
- isInvalidated: !1,
568
- status: "success",
569
- ...!t.manual && {
570
- fetchStatus: "idle",
571
- fetchFailureCount: 0,
572
- fetchFailureReason: null
573
- }
574
- };
575
- case "error":
576
- const n = t.error;
577
- return dt(n) && n.revert && a(this, Pe) ? { ...a(this, Pe), fetchStatus: "idle" } : {
578
- ...r,
579
- error: n,
580
- errorUpdateCount: r.errorUpdateCount + 1,
581
- errorUpdatedAt: Date.now(),
582
- fetchFailureCount: r.fetchFailureCount + 1,
583
- fetchFailureReason: n,
584
- fetchStatus: "idle",
585
- status: "error"
586
- };
587
- case "invalidate":
588
- return {
589
- ...r,
590
- isInvalidated: !0
591
- };
592
- case "setState":
593
- return {
594
- ...r,
595
- ...t.state
596
- };
597
- }
598
- };
599
- this.state = s(this.state), R.batch(() => {
600
- this.observers.forEach((r) => {
601
- r.onQueryUpdate();
602
- }), a(this, G).notify({ query: this, type: "updated", action: t });
603
- });
604
- }, It);
605
- function ds(e, t) {
606
- return {
607
- fetchFailureCount: 0,
608
- fetchFailureReason: null,
609
- fetchStatus: ls(t.networkMode) ? "fetching" : "paused",
610
- ...e === void 0 && {
611
- error: null,
612
- status: "pending"
613
- }
614
- };
615
- }
616
- function sr(e) {
617
- const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = t !== void 0, r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
618
- return {
619
- data: t,
620
- dataUpdateCount: 0,
621
- dataUpdatedAt: s ? r ?? Date.now() : 0,
622
- error: null,
623
- errorUpdateCount: 0,
624
- errorUpdatedAt: 0,
625
- fetchFailureCount: 0,
626
- fetchFailureReason: null,
627
- fetchMeta: null,
628
- isInvalidated: !1,
629
- status: s ? "success" : "pending",
630
- fetchStatus: "idle"
631
- };
632
- }
633
- var J, Bt, rr = (Bt = class extends Ue {
634
- constructor(t = {}) {
635
- super();
636
- g(this, J, void 0);
637
- this.config = t, f(this, J, /* @__PURE__ */ new Map());
638
- }
639
- build(t, s, r) {
640
- const n = s.queryKey, l = s.queryHash ?? At(n, s);
641
- let o = this.get(l);
642
- return o || (o = new tr({
643
- cache: this,
644
- queryKey: n,
645
- queryHash: l,
646
- options: t.defaultQueryOptions(s),
647
- state: r,
648
- defaultOptions: t.getQueryDefaults(n)
649
- }), this.add(o)), o;
650
- }
651
- add(t) {
652
- a(this, J).has(t.queryHash) || (a(this, J).set(t.queryHash, t), this.notify({
653
- type: "added",
654
- query: t
655
- }));
656
- }
657
- remove(t) {
658
- const s = a(this, J).get(t.queryHash);
659
- s && (t.destroy(), s === t && a(this, J).delete(t.queryHash), this.notify({ type: "removed", query: t }));
660
- }
661
- clear() {
662
- R.batch(() => {
663
- this.getAll().forEach((t) => {
664
- this.remove(t);
665
- });
666
- });
667
- }
668
- get(t) {
669
- return a(this, J).get(t);
670
- }
671
- getAll() {
672
- return [...a(this, J).values()];
673
- }
674
- find(t) {
675
- const s = { exact: !0, ...t };
676
- return this.getAll().find(
677
- (r) => Dt(s, r)
678
- );
679
- }
680
- findAll(t = {}) {
681
- const s = this.getAll();
682
- return Object.keys(t).length > 0 ? s.filter((r) => Dt(t, r)) : s;
683
- }
684
- notify(t) {
685
- R.batch(() => {
686
- this.listeners.forEach((s) => {
687
- s(t);
688
- });
689
- });
690
- }
691
- onFocus() {
692
- R.batch(() => {
693
- this.getAll().forEach((t) => {
694
- t.onFocus();
695
- });
696
- });
697
- }
698
- onOnline() {
699
- R.batch(() => {
700
- this.getAll().forEach((t) => {
701
- t.onOnline();
702
- });
703
- });
704
- }
705
- }, J = new WeakMap(), Bt), X, T, pe, I, se, es, ir = (es = class extends hs {
706
- constructor(t) {
707
- super();
708
- g(this, I);
709
- g(this, X, void 0);
710
- g(this, T, void 0);
711
- g(this, pe, void 0);
712
- this.mutationId = t.mutationId, f(this, T, t.mutationCache), f(this, X, []), this.state = t.state || fs(), this.setOptions(t.options), this.scheduleGc();
713
- }
714
- setOptions(t) {
715
- this.options = t, this.updateGcTime(this.options.gcTime);
716
- }
717
- get meta() {
718
- return this.options.meta;
719
- }
720
- addObserver(t) {
721
- a(this, X).includes(t) || (a(this, X).push(t), this.clearGcTimeout(), a(this, T).notify({
722
- type: "observerAdded",
723
- mutation: this,
724
- observer: t
725
- }));
726
- }
727
- removeObserver(t) {
728
- f(this, X, a(this, X).filter((s) => s !== t)), this.scheduleGc(), a(this, T).notify({
729
- type: "observerRemoved",
730
- mutation: this,
731
- observer: t
732
- });
733
- }
734
- optionalRemove() {
735
- a(this, X).length || (this.state.status === "pending" ? this.scheduleGc() : a(this, T).remove(this));
736
- }
737
- continue() {
738
- var t;
739
- return ((t = a(this, pe)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
740
- this.execute(this.state.variables);
741
- }
742
- async execute(t) {
743
- var n, l, o, c, m, y, d, v, u, p, E, S, j, x, C, _, O, F, Y, z;
744
- f(this, pe, us({
745
- fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
746
- onFail: (P, W) => {
747
- b(this, I, se).call(this, { type: "failed", failureCount: P, error: W });
748
- },
749
- onPause: () => {
750
- b(this, I, se).call(this, { type: "pause" });
751
- },
752
- onContinue: () => {
753
- b(this, I, se).call(this, { type: "continue" });
754
- },
755
- retry: this.options.retry ?? 0,
756
- retryDelay: this.options.retryDelay,
757
- networkMode: this.options.networkMode,
758
- canRun: () => a(this, T).canRun(this)
759
- }));
760
- const s = this.state.status === "pending", r = !a(this, pe).canStart();
761
- try {
762
- if (!s) {
763
- b(this, I, se).call(this, { type: "pending", variables: t, isPaused: r }), await ((l = (n = a(this, T).config).onMutate) == null ? void 0 : l.call(
764
- n,
765
- t,
766
- this
767
- ));
768
- const W = await ((c = (o = this.options).onMutate) == null ? void 0 : c.call(o, t));
769
- W !== this.state.context && b(this, I, se).call(this, {
770
- type: "pending",
771
- context: W,
772
- variables: t,
773
- isPaused: r
774
- });
775
- }
776
- const P = await a(this, pe).start();
777
- return await ((y = (m = a(this, T).config).onSuccess) == null ? void 0 : y.call(
778
- m,
779
- P,
780
- t,
781
- this.state.context,
782
- this
783
- )), await ((v = (d = this.options).onSuccess) == null ? void 0 : v.call(d, P, t, this.state.context)), await ((p = (u = a(this, T).config).onSettled) == null ? void 0 : p.call(
784
- u,
785
- P,
786
- null,
787
- this.state.variables,
788
- this.state.context,
789
- this
790
- )), await ((S = (E = this.options).onSettled) == null ? void 0 : S.call(E, P, null, t, this.state.context)), b(this, I, se).call(this, { type: "success", data: P }), P;
791
- } catch (P) {
792
- try {
793
- throw await ((x = (j = a(this, T).config).onError) == null ? void 0 : x.call(
794
- j,
795
- P,
796
- t,
797
- this.state.context,
798
- this
799
- )), await ((_ = (C = this.options).onError) == null ? void 0 : _.call(
800
- C,
801
- P,
802
- t,
803
- this.state.context
804
- )), await ((F = (O = a(this, T).config).onSettled) == null ? void 0 : F.call(
805
- O,
806
- void 0,
807
- P,
808
- this.state.variables,
809
- this.state.context,
810
- this
811
- )), await ((z = (Y = this.options).onSettled) == null ? void 0 : z.call(
812
- Y,
813
- void 0,
814
- P,
815
- t,
816
- this.state.context
817
- )), P;
818
- } finally {
819
- b(this, I, se).call(this, { type: "error", error: P });
820
- }
821
- } finally {
822
- a(this, T).runNext(this);
823
- }
824
- }
825
- }, X = new WeakMap(), T = new WeakMap(), pe = new WeakMap(), I = new WeakSet(), se = function(t) {
826
- const s = (r) => {
827
- switch (t.type) {
828
- case "failed":
829
- return {
830
- ...r,
831
- failureCount: t.failureCount,
832
- failureReason: t.error
833
- };
834
- case "pause":
835
- return {
836
- ...r,
837
- isPaused: !0
838
- };
839
- case "continue":
840
- return {
841
- ...r,
842
- isPaused: !1
843
- };
844
- case "pending":
845
- return {
846
- ...r,
847
- context: t.context,
848
- data: void 0,
849
- failureCount: 0,
850
- failureReason: null,
851
- error: null,
852
- isPaused: t.isPaused,
853
- status: "pending",
854
- variables: t.variables,
855
- submittedAt: Date.now()
856
- };
857
- case "success":
858
- return {
859
- ...r,
860
- data: t.data,
861
- failureCount: 0,
862
- failureReason: null,
863
- error: null,
864
- status: "success",
865
- isPaused: !1
866
- };
867
- case "error":
868
- return {
869
- ...r,
870
- data: void 0,
871
- error: t.error,
872
- failureCount: r.failureCount + 1,
873
- failureReason: t.error,
874
- isPaused: !1,
875
- status: "error"
876
- };
877
- }
878
- };
879
- this.state = s(this.state), R.batch(() => {
880
- a(this, X).forEach((r) => {
881
- r.onMutationUpdate(t);
882
- }), a(this, T).notify({
883
- mutation: this,
884
- type: "updated",
885
- action: t
886
- });
887
- });
888
- }, es);
889
- function fs() {
890
- return {
891
- context: void 0,
892
- data: void 0,
893
- error: null,
894
- failureCount: 0,
895
- failureReason: null,
896
- isPaused: !1,
897
- status: "idle",
898
- variables: void 0,
899
- submittedAt: 0
900
- };
901
- }
902
- var K, Ke, ts, nr = (ts = class extends Ue {
903
- constructor(t = {}) {
904
- super();
905
- g(this, K, void 0);
906
- g(this, Ke, void 0);
907
- this.config = t, f(this, K, /* @__PURE__ */ new Map()), f(this, Ke, Date.now());
908
- }
909
- build(t, s, r) {
910
- const n = new ir({
911
- mutationCache: this,
912
- mutationId: ++tt(this, Ke)._,
913
- options: t.defaultMutationOptions(s),
914
- state: r
915
- });
916
- return this.add(n), n;
917
- }
918
- add(t) {
919
- const s = st(t), r = a(this, K).get(s) ?? [];
920
- r.push(t), a(this, K).set(s, r), this.notify({ type: "added", mutation: t });
921
- }
922
- remove(t) {
923
- var r;
924
- const s = st(t);
925
- if (a(this, K).has(s)) {
926
- const n = (r = a(this, K).get(s)) == null ? void 0 : r.filter((l) => l !== t);
927
- n && (n.length === 0 ? a(this, K).delete(s) : a(this, K).set(s, n));
928
- }
929
- this.notify({ type: "removed", mutation: t });
930
- }
931
- canRun(t) {
932
- var r;
933
- const s = (r = a(this, K).get(st(t))) == null ? void 0 : r.find((n) => n.state.status === "pending");
934
- return !s || s === t;
935
- }
936
- runNext(t) {
937
- var r;
938
- const s = (r = a(this, K).get(st(t))) == null ? void 0 : r.find((n) => n !== t && n.state.isPaused);
939
- return (s == null ? void 0 : s.continue()) ?? Promise.resolve();
940
- }
941
- clear() {
942
- R.batch(() => {
943
- this.getAll().forEach((t) => {
944
- this.remove(t);
945
- });
946
- });
947
- }
948
- getAll() {
949
- return [...a(this, K).values()].flat();
950
- }
951
- find(t) {
952
- const s = { exact: !0, ...t };
953
- return this.getAll().find(
954
- (r) => Tt(s, r)
955
- );
956
- }
957
- findAll(t = {}) {
958
- return this.getAll().filter((s) => Tt(t, s));
959
- }
960
- notify(t) {
961
- R.batch(() => {
962
- this.listeners.forEach((s) => {
963
- s(t);
964
- });
965
- });
966
- }
967
- resumePausedMutations() {
968
- const t = this.getAll().filter((s) => s.state.isPaused);
969
- return R.batch(
970
- () => Promise.all(
971
- t.map((s) => s.continue().catch(V))
972
- )
973
- );
974
- }
975
- }, K = new WeakMap(), Ke = new WeakMap(), ts);
976
- function st(e) {
977
- var t;
978
- return ((t = e.options.scope) == null ? void 0 : t.id) ?? String(e.mutationId);
979
- }
980
- function ar(e) {
981
- return {
982
- onFetch: (t, s) => {
983
- const r = async () => {
984
- var E, S, j, x, C;
985
- const n = t.options, l = (j = (S = (E = t.fetchOptions) == null ? void 0 : E.meta) == null ? void 0 : S.fetchMore) == null ? void 0 : j.direction, o = ((x = t.state.data) == null ? void 0 : x.pages) || [], c = ((C = t.state.data) == null ? void 0 : C.pageParams) || [], m = { pages: [], pageParams: [] };
986
- let y = !1;
987
- const d = (_) => {
988
- Object.defineProperty(_, "signal", {
989
- enumerable: !0,
990
- get: () => (t.signal.aborted ? y = !0 : t.signal.addEventListener("abort", () => {
991
- y = !0;
992
- }), t.signal)
993
- });
994
- }, v = t.options.queryFn && t.options.queryFn !== Nt ? t.options.queryFn : () => Promise.reject(
995
- new Error(`Missing queryFn: '${t.options.queryHash}'`)
996
- ), u = async (_, O, F) => {
997
- if (y)
998
- return Promise.reject();
999
- if (O == null && _.pages.length)
1000
- return Promise.resolve(_);
1001
- const Y = {
1002
- queryKey: t.queryKey,
1003
- pageParam: O,
1004
- direction: F ? "backward" : "forward",
1005
- meta: t.options.meta
1006
- };
1007
- d(Y);
1008
- const z = await v(
1009
- Y
1010
- ), { maxPages: P } = t.options, W = F ? Js : zs;
1011
- return {
1012
- pages: W(_.pages, z, P),
1013
- pageParams: W(_.pageParams, O, P)
1014
- };
1015
- };
1016
- let p;
1017
- if (l && o.length) {
1018
- const _ = l === "backward", O = _ ? or : Ht, F = {
1019
- pages: o,
1020
- pageParams: c
1021
- }, Y = O(n, F);
1022
- p = await u(F, Y, _);
1023
- } else {
1024
- p = await u(
1025
- m,
1026
- c[0] ?? n.initialPageParam
1027
- );
1028
- const _ = e ?? o.length;
1029
- for (let O = 1; O < _; O++) {
1030
- const F = Ht(n, p);
1031
- p = await u(p, F);
1032
- }
1033
- }
1034
- return p;
1035
- };
1036
- t.options.persister ? t.fetchFn = () => {
1037
- var n, l;
1038
- return (l = (n = t.options).persister) == null ? void 0 : l.call(
1039
- n,
1040
- r,
1041
- {
1042
- queryKey: t.queryKey,
1043
- meta: t.options.meta,
1044
- signal: t.signal
1045
- },
1046
- s
1047
- );
1048
- } : t.fetchFn = r;
1049
- }
1050
- };
1051
- }
1052
- function Ht(e, { pages: t, pageParams: s }) {
1053
- const r = t.length - 1;
1054
- return e.getNextPageParam(
1055
- t[r],
1056
- t,
1057
- s[r],
1058
- s
1059
- );
1060
- }
1061
- function or(e, { pages: t, pageParams: s }) {
1062
- var r;
1063
- return (r = e.getPreviousPageParam) == null ? void 0 : r.call(
1064
- e,
1065
- t[0],
1066
- t,
1067
- s[0],
1068
- s
1069
- );
1070
- }
1071
- var M, ne, ae, Ae, Ne, oe, ke, Oe, ss, ps = (ss = class {
1072
- constructor(e = {}) {
1073
- g(this, M, void 0);
1074
- g(this, ne, void 0);
1075
- g(this, ae, void 0);
1076
- g(this, Ae, void 0);
1077
- g(this, Ne, void 0);
1078
- g(this, oe, void 0);
1079
- g(this, ke, void 0);
1080
- g(this, Oe, void 0);
1081
- f(this, M, e.queryCache || new rr()), f(this, ne, e.mutationCache || new nr()), f(this, ae, e.defaultOptions || {}), f(this, Ae, /* @__PURE__ */ new Map()), f(this, Ne, /* @__PURE__ */ new Map()), f(this, oe, 0);
1082
- }
1083
- mount() {
1084
- tt(this, oe)._++, a(this, oe) === 1 && (f(this, ke, kt.subscribe(async (e) => {
1085
- e && (await this.resumePausedMutations(), a(this, M).onFocus());
1086
- })), f(this, Oe, nt.subscribe(async (e) => {
1087
- e && (await this.resumePausedMutations(), a(this, M).onOnline());
1088
- })));
1089
- }
1090
- unmount() {
1091
- var e, t;
1092
- tt(this, oe)._--, a(this, oe) === 0 && ((e = a(this, ke)) == null || e.call(this), f(this, ke, void 0), (t = a(this, Oe)) == null || t.call(this), f(this, Oe, void 0));
1093
- }
1094
- isFetching(e) {
1095
- return a(this, M).findAll({ ...e, fetchStatus: "fetching" }).length;
1096
- }
1097
- isMutating(e) {
1098
- return a(this, ne).findAll({ ...e, status: "pending" }).length;
1099
- }
1100
- getQueryData(e) {
1101
- var s;
1102
- const t = this.defaultQueryOptions({ queryKey: e });
1103
- return (s = a(this, M).get(t.queryHash)) == null ? void 0 : s.state.data;
1104
- }
1105
- ensureQueryData(e) {
1106
- const t = this.getQueryData(e.queryKey);
1107
- if (t === void 0)
1108
- return this.fetchQuery(e);
1109
- {
1110
- const s = this.defaultQueryOptions(e), r = a(this, M).build(this, s);
1111
- return e.revalidateIfStale && r.isStaleByTime(s.staleTime) && this.prefetchQuery(s), Promise.resolve(t);
1112
- }
1113
- }
1114
- getQueriesData(e) {
1115
- return a(this, M).findAll(e).map(({ queryKey: t, state: s }) => {
1116
- const r = s.data;
1117
- return [t, r];
1118
- });
1119
- }
1120
- setQueryData(e, t, s) {
1121
- const r = this.defaultQueryOptions({ queryKey: e }), n = a(this, M).get(
1122
- r.queryHash
1123
- ), l = n == null ? void 0 : n.state.data, o = Zs(t, l);
1124
- if (o !== void 0)
1125
- return a(this, M).build(this, r).setData(o, { ...s, manual: !0 });
1126
- }
1127
- setQueriesData(e, t, s) {
1128
- return R.batch(
1129
- () => a(this, M).findAll(e).map(({ queryKey: r }) => [
1130
- r,
1131
- this.setQueryData(r, t, s)
1132
- ])
1133
- );
1134
- }
1135
- getQueryState(e) {
1136
- var s;
1137
- const t = this.defaultQueryOptions({ queryKey: e });
1138
- return (s = a(this, M).get(t.queryHash)) == null ? void 0 : s.state;
1139
- }
1140
- removeQueries(e) {
1141
- const t = a(this, M);
1142
- R.batch(() => {
1143
- t.findAll(e).forEach((s) => {
1144
- t.remove(s);
1145
- });
1146
- });
1147
- }
1148
- resetQueries(e, t) {
1149
- const s = a(this, M), r = {
1150
- type: "active",
1151
- ...e
1152
- };
1153
- return R.batch(() => (s.findAll(e).forEach((n) => {
1154
- n.reset();
1155
- }), this.refetchQueries(r, t)));
1156
- }
1157
- cancelQueries(e = {}, t = {}) {
1158
- const s = { revert: !0, ...t }, r = R.batch(
1159
- () => a(this, M).findAll(e).map((n) => n.cancel(s))
1160
- );
1161
- return Promise.all(r).then(V).catch(V);
1162
- }
1163
- invalidateQueries(e = {}, t = {}) {
1164
- return R.batch(() => {
1165
- if (a(this, M).findAll(e).forEach((r) => {
1166
- r.invalidate();
1167
- }), e.refetchType === "none")
1168
- return Promise.resolve();
1169
- const s = {
1170
- ...e,
1171
- type: e.refetchType ?? e.type ?? "active"
1172
- };
1173
- return this.refetchQueries(s, t);
1174
- });
1175
- }
1176
- refetchQueries(e = {}, t) {
1177
- const s = {
1178
- ...t,
1179
- cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
1180
- }, r = R.batch(
1181
- () => a(this, M).findAll(e).filter((n) => !n.isDisabled()).map((n) => {
1182
- let l = n.fetch(void 0, s);
1183
- return s.throwOnError || (l = l.catch(V)), n.state.fetchStatus === "paused" ? Promise.resolve() : l;
1184
- })
1185
- );
1186
- return Promise.all(r).then(V);
1187
- }
1188
- fetchQuery(e) {
1189
- const t = this.defaultQueryOptions(e);
1190
- t.retry === void 0 && (t.retry = !1);
1191
- const s = a(this, M).build(this, t);
1192
- return s.isStaleByTime(t.staleTime) ? s.fetch(t) : Promise.resolve(s.state.data);
1193
- }
1194
- prefetchQuery(e) {
1195
- return this.fetchQuery(e).then(V).catch(V);
1196
- }
1197
- fetchInfiniteQuery(e) {
1198
- return e.behavior = ar(e.pages), this.fetchQuery(e);
1199
- }
1200
- prefetchInfiniteQuery(e) {
1201
- return this.fetchInfiniteQuery(e).then(V).catch(V);
1202
- }
1203
- resumePausedMutations() {
1204
- return nt.isOnline() ? a(this, ne).resumePausedMutations() : Promise.resolve();
1205
- }
1206
- getQueryCache() {
1207
- return a(this, M);
1208
- }
1209
- getMutationCache() {
1210
- return a(this, ne);
1211
- }
1212
- getDefaultOptions() {
1213
- return a(this, ae);
1214
- }
1215
- setDefaultOptions(e) {
1216
- f(this, ae, e);
1217
- }
1218
- setQueryDefaults(e, t) {
1219
- a(this, Ae).set(Ce(e), {
1220
- queryKey: e,
1221
- defaultOptions: t
1222
- });
1223
- }
1224
- getQueryDefaults(e) {
1225
- const t = [...a(this, Ae).values()];
1226
- let s = {};
1227
- return t.forEach((r) => {
1228
- He(e, r.queryKey) && (s = { ...s, ...r.defaultOptions });
1229
- }), s;
1230
- }
1231
- setMutationDefaults(e, t) {
1232
- a(this, Ne).set(Ce(e), {
1233
- mutationKey: e,
1234
- defaultOptions: t
1235
- });
1236
- }
1237
- getMutationDefaults(e) {
1238
- const t = [...a(this, Ne).values()];
1239
- let s = {};
1240
- return t.forEach((r) => {
1241
- He(e, r.mutationKey) && (s = { ...s, ...r.defaultOptions });
1242
- }), s;
1243
- }
1244
- defaultQueryOptions(e) {
1245
- if (e._defaulted)
1246
- return e;
1247
- const t = {
1248
- ...a(this, ae).queries,
1249
- ...this.getQueryDefaults(e.queryKey),
1250
- ...e,
1251
- _defaulted: !0
1252
- };
1253
- return t.queryHash || (t.queryHash = At(
1254
- t.queryKey,
1255
- t
1256
- )), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.enabled !== !0 && t.queryFn === Nt && (t.enabled = !1), t;
1257
- }
1258
- defaultMutationOptions(e) {
1259
- return e != null && e._defaulted ? e : {
1260
- ...a(this, ae).mutations,
1261
- ...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
1262
- ...e,
1263
- _defaulted: !0
1264
- };
1265
- }
1266
- clear() {
1267
- a(this, M).clear(), a(this, ne).clear();
1268
- }
1269
- }, M = new WeakMap(), ne = new WeakMap(), ae = new WeakMap(), Ae = new WeakMap(), Ne = new WeakMap(), oe = new WeakMap(), ke = new WeakMap(), Oe = new WeakMap(), ss), Q, k, qe, U, me, Me, B, Ge, Le, Fe, ve, ge, le, Re, ye, Qe, Ve, vt, We, gt, Ze, yt, Ye, Ct, ze, xt, Je, bt, Xe, wt, ct, ms, rs, lr = (rs = class extends Ue {
1270
- constructor(t, s) {
1271
- super();
1272
- g(this, ye);
1273
- g(this, Ve);
1274
- g(this, We);
1275
- g(this, Ze);
1276
- g(this, Ye);
1277
- g(this, ze);
1278
- g(this, Je);
1279
- g(this, Xe);
1280
- g(this, ct);
1281
- g(this, Q, void 0);
1282
- g(this, k, void 0);
1283
- g(this, qe, void 0);
1284
- g(this, U, void 0);
1285
- g(this, me, void 0);
1286
- g(this, Me, void 0);
1287
- g(this, B, void 0);
1288
- g(this, Ge, void 0);
1289
- g(this, Le, void 0);
1290
- // This property keeps track of the last query with defined data.
1291
- // It will be used to pass the previous data and query to the placeholder function between renders.
1292
- g(this, Fe, void 0);
1293
- g(this, ve, void 0);
1294
- g(this, ge, void 0);
1295
- g(this, le, void 0);
1296
- g(this, Re, /* @__PURE__ */ new Set());
1297
- this.options = s, f(this, Q, t), f(this, B, null), this.bindMethods(), this.setOptions(s);
1298
- }
1299
- bindMethods() {
1300
- this.refetch = this.refetch.bind(this);
1301
- }
1302
- onSubscribe() {
1303
- this.listeners.size === 1 && (a(this, k).addObserver(this), $t(a(this, k), this.options) ? b(this, ye, Qe).call(this) : this.updateResult(), b(this, Ye, Ct).call(this));
1304
- }
1305
- onUnsubscribe() {
1306
- this.hasListeners() || this.destroy();
1307
- }
1308
- shouldFetchOnReconnect() {
1309
- return jt(
1310
- a(this, k),
1311
- this.options,
1312
- this.options.refetchOnReconnect
1313
- );
1314
- }
1315
- shouldFetchOnWindowFocus() {
1316
- return jt(
1317
- a(this, k),
1318
- this.options,
1319
- this.options.refetchOnWindowFocus
1320
- );
1321
- }
1322
- destroy() {
1323
- this.listeners = /* @__PURE__ */ new Set(), b(this, ze, xt).call(this), b(this, Je, bt).call(this), a(this, k).removeObserver(this);
1324
- }
1325
- setOptions(t, s) {
1326
- const r = this.options, n = a(this, k);
1327
- if (this.options = a(this, Q).defaultQueryOptions(t), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean")
1328
- throw new Error("Expected enabled to be a boolean");
1329
- b(this, Xe, wt).call(this), a(this, k).setOptions(this.options), r._defaulted && !it(this.options, r) && a(this, Q).getQueryCache().notify({
1330
- type: "observerOptionsUpdated",
1331
- query: a(this, k),
1332
- observer: this
1333
- });
1334
- const l = this.hasListeners();
1335
- l && Kt(
1336
- a(this, k),
1337
- n,
1338
- this.options,
1339
- r
1340
- ) && b(this, ye, Qe).call(this), this.updateResult(s), l && (a(this, k) !== n || this.options.enabled !== r.enabled || this.options.staleTime !== r.staleTime) && b(this, Ve, vt).call(this);
1341
- const o = b(this, We, gt).call(this);
1342
- l && (a(this, k) !== n || this.options.enabled !== r.enabled || o !== a(this, le)) && b(this, Ze, yt).call(this, o);
1343
- }
1344
- getOptimisticResult(t) {
1345
- const s = a(this, Q).getQueryCache().build(a(this, Q), t), r = this.createResult(s, t);
1346
- return ur(this, r) && (f(this, U, r), f(this, Me, this.options), f(this, me, a(this, k).state)), r;
1347
- }
1348
- getCurrentResult() {
1349
- return a(this, U);
1350
- }
1351
- trackResult(t, s) {
1352
- const r = {};
1353
- return Object.keys(t).forEach((n) => {
1354
- Object.defineProperty(r, n, {
1355
- configurable: !1,
1356
- enumerable: !0,
1357
- get: () => (this.trackProp(n), s == null || s(n), t[n])
1358
- });
1359
- }), r;
1360
- }
1361
- trackProp(t) {
1362
- a(this, Re).add(t);
1363
- }
1364
- getCurrentQuery() {
1365
- return a(this, k);
1366
- }
1367
- refetch({ ...t } = {}) {
1368
- return this.fetch({
1369
- ...t
1370
- });
1371
- }
1372
- fetchOptimistic(t) {
1373
- const s = a(this, Q).defaultQueryOptions(t), r = a(this, Q).getQueryCache().build(a(this, Q), s);
1374
- return r.isFetchingOptimistic = !0, r.fetch().then(() => this.createResult(r, s));
1375
- }
1376
- fetch(t) {
1377
- return b(this, ye, Qe).call(this, {
1378
- ...t,
1379
- cancelRefetch: t.cancelRefetch ?? !0
1380
- }).then(() => (this.updateResult(), a(this, U)));
1381
- }
1382
- createResult(t, s) {
1383
- var z;
1384
- const r = a(this, k), n = this.options, l = a(this, U), o = a(this, me), c = a(this, Me), y = t !== r ? t.state : a(this, qe), { state: d } = t;
1385
- let v = { ...d }, u = !1, p;
1386
- if (s._optimisticResults) {
1387
- const P = this.hasListeners(), W = !P && $t(t, s), Hs = P && Kt(t, r, s, n);
1388
- (W || Hs) && (v = {
1389
- ...v,
1390
- ...ds(d.data, t.options)
1391
- }), s._optimisticResults === "isRestoring" && (v.fetchStatus = "idle");
1392
- }
1393
- let { error: E, errorUpdatedAt: S, status: j } = v;
1394
- if (s.select && v.data !== void 0)
1395
- if (l && v.data === (o == null ? void 0 : o.data) && s.select === a(this, Ge))
1396
- p = a(this, Le);
1397
- else
1398
- try {
1399
- f(this, Ge, s.select), p = s.select(v.data), p = mt(l == null ? void 0 : l.data, p, s), f(this, Le, p), f(this, B, null);
1400
- } catch (P) {
1401
- f(this, B, P);
1402
- }
1403
- else
1404
- p = v.data;
1405
- if (s.placeholderData !== void 0 && p === void 0 && j === "pending") {
1406
- let P;
1407
- if (l != null && l.isPlaceholderData && s.placeholderData === (c == null ? void 0 : c.placeholderData))
1408
- P = l.data;
1409
- else if (P = typeof s.placeholderData == "function" ? s.placeholderData(
1410
- (z = a(this, Fe)) == null ? void 0 : z.state.data,
1411
- a(this, Fe)
1412
- ) : s.placeholderData, s.select && P !== void 0)
1413
- try {
1414
- P = s.select(P), f(this, B, null);
1415
- } catch (W) {
1416
- f(this, B, W);
1417
- }
1418
- P !== void 0 && (j = "success", p = mt(
1419
- l == null ? void 0 : l.data,
1420
- P,
1421
- s
1422
- ), u = !0);
1423
- }
1424
- a(this, B) && (E = a(this, B), p = a(this, Le), S = Date.now(), j = "error");
1425
- const x = v.fetchStatus === "fetching", C = j === "pending", _ = j === "error", O = C && x, F = p !== void 0;
1426
- return {
1427
- status: j,
1428
- fetchStatus: v.fetchStatus,
1429
- isPending: C,
1430
- isSuccess: j === "success",
1431
- isError: _,
1432
- isInitialLoading: O,
1433
- isLoading: O,
1434
- data: p,
1435
- dataUpdatedAt: v.dataUpdatedAt,
1436
- error: E,
1437
- errorUpdatedAt: S,
1438
- failureCount: v.fetchFailureCount,
1439
- failureReason: v.fetchFailureReason,
1440
- errorUpdateCount: v.errorUpdateCount,
1441
- isFetched: v.dataUpdateCount > 0 || v.errorUpdateCount > 0,
1442
- isFetchedAfterMount: v.dataUpdateCount > y.dataUpdateCount || v.errorUpdateCount > y.errorUpdateCount,
1443
- isFetching: x,
1444
- isRefetching: x && !C,
1445
- isLoadingError: _ && !F,
1446
- isPaused: v.fetchStatus === "paused",
1447
- isPlaceholderData: u,
1448
- isRefetchError: _ && F,
1449
- isStale: Ot(t, s),
1450
- refetch: this.refetch
1451
- };
1452
- }
1453
- updateResult(t) {
1454
- const s = a(this, U), r = this.createResult(a(this, k), this.options);
1455
- if (f(this, me, a(this, k).state), f(this, Me, this.options), a(this, me).data !== void 0 && f(this, Fe, a(this, k)), it(r, s))
1456
- return;
1457
- f(this, U, r);
1458
- const n = {}, l = () => {
1459
- if (!s)
1460
- return !0;
1461
- const { notifyOnChangeProps: o } = this.options, c = typeof o == "function" ? o() : o;
1462
- if (c === "all" || !c && !a(this, Re).size)
1463
- return !0;
1464
- const m = new Set(
1465
- c ?? a(this, Re)
1466
- );
1467
- return this.options.throwOnError && m.add("error"), Object.keys(a(this, U)).some((y) => {
1468
- const d = y;
1469
- return a(this, U)[d] !== s[d] && m.has(d);
1470
- });
1471
- };
1472
- (t == null ? void 0 : t.listeners) !== !1 && l() && (n.listeners = !0), b(this, ct, ms).call(this, { ...n, ...t });
1473
- }
1474
- onQueryUpdate() {
1475
- this.updateResult(), this.hasListeners() && b(this, Ye, Ct).call(this);
1476
- }
1477
- }, Q = new WeakMap(), k = new WeakMap(), qe = new WeakMap(), U = new WeakMap(), me = new WeakMap(), Me = new WeakMap(), B = new WeakMap(), Ge = new WeakMap(), Le = new WeakMap(), Fe = new WeakMap(), ve = new WeakMap(), ge = new WeakMap(), le = new WeakMap(), Re = new WeakMap(), ye = new WeakSet(), Qe = function(t) {
1478
- b(this, Xe, wt).call(this);
1479
- let s = a(this, k).fetch(
1480
- this.options,
1481
- t
1482
- );
1483
- return t != null && t.throwOnError || (s = s.catch(V)), s;
1484
- }, Ve = new WeakSet(), vt = function() {
1485
- if (b(this, ze, xt).call(this), Te || a(this, U).isStale || !ft(this.options.staleTime))
1486
- return;
1487
- const s = as(
1488
- a(this, U).dataUpdatedAt,
1489
- this.options.staleTime
1490
- ) + 1;
1491
- f(this, ve, setTimeout(() => {
1492
- a(this, U).isStale || this.updateResult();
1493
- }, s));
1494
- }, We = new WeakSet(), gt = function() {
1495
- return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(a(this, k)) : this.options.refetchInterval) ?? !1;
1496
- }, Ze = new WeakSet(), yt = function(t) {
1497
- b(this, Je, bt).call(this), f(this, le, t), !(Te || this.options.enabled === !1 || !ft(a(this, le)) || a(this, le) === 0) && f(this, ge, setInterval(() => {
1498
- (this.options.refetchIntervalInBackground || kt.isFocused()) && b(this, ye, Qe).call(this);
1499
- }, a(this, le)));
1500
- }, Ye = new WeakSet(), Ct = function() {
1501
- b(this, Ve, vt).call(this), b(this, Ze, yt).call(this, b(this, We, gt).call(this));
1502
- }, ze = new WeakSet(), xt = function() {
1503
- a(this, ve) && (clearTimeout(a(this, ve)), f(this, ve, void 0));
1504
- }, Je = new WeakSet(), bt = function() {
1505
- a(this, ge) && (clearInterval(a(this, ge)), f(this, ge, void 0));
1506
- }, Xe = new WeakSet(), wt = function() {
1507
- const t = a(this, Q).getQueryCache().build(a(this, Q), this.options);
1508
- if (t === a(this, k))
1509
- return;
1510
- const s = a(this, k);
1511
- f(this, k, t), f(this, qe, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
1512
- }, ct = new WeakSet(), ms = function(t) {
1513
- R.batch(() => {
1514
- t.listeners && this.listeners.forEach((s) => {
1515
- s(a(this, U));
1516
- }), a(this, Q).getQueryCache().notify({
1517
- query: a(this, k),
1518
- type: "observerResultsUpdated"
1519
- });
1520
- });
1521
- }, rs);
1522
- function cr(e, t) {
1523
- return t.enabled !== !1 && e.state.data === void 0 && !(e.state.status === "error" && t.retryOnMount === !1);
1524
- }
1525
- function $t(e, t) {
1526
- return cr(e, t) || e.state.data !== void 0 && jt(e, t, t.refetchOnMount);
1527
- }
1528
- function jt(e, t, s) {
1529
- if (t.enabled !== !1) {
1530
- const r = typeof s == "function" ? s(e) : s;
1531
- return r === "always" || r !== !1 && Ot(e, t);
1532
- }
1533
- return !1;
1534
- }
1535
- function Kt(e, t, s, r) {
1536
- return (e !== t || r.enabled === !1) && (!s.suspense || e.state.status !== "error") && Ot(e, s);
1537
- }
1538
- function Ot(e, t) {
1539
- return t.enabled !== !1 && e.isStaleByTime(t.staleTime);
1540
- }
1541
- function ur(e, t) {
1542
- return !it(e.getCurrentResult(), t);
1543
- }
1544
- var ce, ue, H, te, De, rt, Ie, _t, is, hr = (is = class extends Ue {
1545
- constructor(t, s) {
1546
- super();
1547
- g(this, De);
1548
- g(this, Ie);
1549
- g(this, ce, void 0);
1550
- g(this, ue, void 0);
1551
- g(this, H, void 0);
1552
- g(this, te, void 0);
1553
- f(this, ce, t), this.setOptions(s), this.bindMethods(), b(this, De, rt).call(this);
1554
- }
1555
- bindMethods() {
1556
- this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1557
- }
1558
- setOptions(t) {
1559
- var r;
1560
- const s = this.options;
1561
- this.options = a(this, ce).defaultMutationOptions(t), it(this.options, s) || a(this, ce).getMutationCache().notify({
1562
- type: "observerOptionsUpdated",
1563
- mutation: a(this, H),
1564
- observer: this
1565
- }), s != null && s.mutationKey && this.options.mutationKey && Ce(s.mutationKey) !== Ce(this.options.mutationKey) ? this.reset() : ((r = a(this, H)) == null ? void 0 : r.state.status) === "pending" && a(this, H).setOptions(this.options);
1566
- }
1567
- onUnsubscribe() {
1568
- var t;
1569
- this.hasListeners() || (t = a(this, H)) == null || t.removeObserver(this);
1570
- }
1571
- onMutationUpdate(t) {
1572
- b(this, De, rt).call(this), b(this, Ie, _t).call(this, t);
1573
- }
1574
- getCurrentResult() {
1575
- return a(this, ue);
1576
- }
1577
- reset() {
1578
- var t;
1579
- (t = a(this, H)) == null || t.removeObserver(this), f(this, H, void 0), b(this, De, rt).call(this), b(this, Ie, _t).call(this);
1580
- }
1581
- mutate(t, s) {
1582
- var r;
1583
- return f(this, te, s), (r = a(this, H)) == null || r.removeObserver(this), f(this, H, a(this, ce).getMutationCache().build(a(this, ce), this.options)), a(this, H).addObserver(this), a(this, H).execute(t);
1584
- }
1585
- }, ce = new WeakMap(), ue = new WeakMap(), H = new WeakMap(), te = new WeakMap(), De = new WeakSet(), rt = function() {
1586
- var s;
1587
- const t = ((s = a(this, H)) == null ? void 0 : s.state) ?? fs();
1588
- f(this, ue, {
1589
- ...t,
1590
- isPending: t.status === "pending",
1591
- isSuccess: t.status === "success",
1592
- isError: t.status === "error",
1593
- isIdle: t.status === "idle",
1594
- mutate: this.mutate,
1595
- reset: this.reset
1596
- });
1597
- }, Ie = new WeakSet(), _t = function(t) {
1598
- R.batch(() => {
1599
- var s, r, n, l, o, c, m, y;
1600
- if (a(this, te) && this.hasListeners()) {
1601
- const d = a(this, ue).variables, v = a(this, ue).context;
1602
- (t == null ? void 0 : t.type) === "success" ? ((r = (s = a(this, te)).onSuccess) == null || r.call(s, t.data, d, v), (l = (n = a(this, te)).onSettled) == null || l.call(n, t.data, null, d, v)) : (t == null ? void 0 : t.type) === "error" && ((c = (o = a(this, te)).onError) == null || c.call(o, t.error, d, v), (y = (m = a(this, te)).onSettled) == null || y.call(
1603
- m,
1604
- void 0,
1605
- t.error,
1606
- d,
1607
- v
1608
- ));
1609
- }
1610
- this.listeners.forEach((d) => {
1611
- d(a(this, ue));
1612
- });
1613
- });
1614
- }, is), vs = h.createContext(
1615
- void 0
1616
- ), Mt = (e) => {
1617
- const t = h.useContext(vs);
1618
- if (!t)
1619
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
1620
- return t;
1621
- }, dr = ({
1622
- client: e,
1623
- children: t
1624
- }) => (h.useEffect(() => (e.mount(), () => {
1625
- e.unmount();
1626
- }), [e]), /* @__PURE__ */ i.jsx(vs.Provider, { value: e, children: t })), gs = h.createContext(!1), fr = () => h.useContext(gs);
1627
- gs.Provider;
1628
- function pr() {
1629
- let e = !1;
1630
- return {
1631
- clearReset: () => {
1632
- e = !1;
1633
- },
1634
- reset: () => {
1635
- e = !0;
1636
- },
1637
- isReset: () => e
1638
- };
1639
- }
1640
- var mr = h.createContext(pr()), vr = () => h.useContext(mr);
1641
- function ys(e, t) {
1642
- return typeof e == "function" ? e(...t) : !!e;
1643
- }
1644
- function gr() {
1645
- }
1646
- var yr = (e, t) => {
1647
- (e.suspense || e.throwOnError) && (t.isReset() || (e.retryOnMount = !1));
1648
- }, Cr = (e) => {
1649
- h.useEffect(() => {
1650
- e.clearReset();
1651
- }, [e]);
1652
- }, xr = ({
1653
- result: e,
1654
- errorResetBoundary: t,
1655
- throwOnError: s,
1656
- query: r
1657
- }) => e.isError && !t.isReset() && !e.isFetching && r && ys(s, [e.error, r]), br = (e) => {
1658
- e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
1659
- }, wr = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, jr = (e, t, s) => t.fetchOptimistic(e).catch(() => {
1660
- s.clearReset();
1661
- });
1662
- function _r(e, t, s) {
1663
- const r = Mt(), n = fr(), l = vr(), o = r.defaultQueryOptions(e);
1664
- o._optimisticResults = n ? "isRestoring" : "optimistic", br(o), yr(o, l), Cr(l);
1665
- const [c] = h.useState(
1666
- () => new t(
1667
- r,
1668
- o
1669
- )
1670
- ), m = c.getOptimisticResult(o);
1671
- if (h.useSyncExternalStore(
1672
- h.useCallback(
1673
- (y) => {
1674
- const d = n ? () => {
1675
- } : c.subscribe(R.batchCalls(y));
1676
- return c.updateResult(), d;
1677
- },
1678
- [c, n]
1679
- ),
1680
- () => c.getCurrentResult(),
1681
- () => c.getCurrentResult()
1682
- ), h.useEffect(() => {
1683
- c.setOptions(o, { listeners: !1 });
1684
- }, [o, c]), wr(o, m))
1685
- throw jr(o, c, l);
1686
- if (xr({
1687
- result: m,
1688
- errorResetBoundary: l,
1689
- throwOnError: o.throwOnError,
1690
- query: r.getQueryCache().get(o.queryHash)
1691
- }))
1692
- throw m.error;
1693
- return o.notifyOnChangeProps ? m : c.trackResult(m);
1694
- }
1695
- function Cs(e, t) {
1696
- return _r(e, lr);
1697
- }
1698
- function Sr(e, t) {
1699
- const s = Mt(), [r] = h.useState(
1700
- () => new hr(
1701
- s,
1702
- e
1703
- )
1704
- );
1705
- h.useEffect(() => {
1706
- r.setOptions(e);
1707
- }, [r, e]);
1708
- const n = h.useSyncExternalStore(
1709
- h.useCallback(
1710
- (o) => r.subscribe(R.batchCalls(o)),
1711
- [r]
1712
- ),
1713
- () => r.getCurrentResult(),
1714
- () => r.getCurrentResult()
1715
- ), l = h.useCallback(
1716
- (o, c) => {
1717
- r.mutate(o, c).catch(gr);
1718
- },
1719
- [r]
1720
- );
1721
- if (n.error && ys(r.options.throwOnError, [n.error]))
1722
- throw n.error;
1723
- return { ...n, mutate: l, mutateAsync: n.mutate };
1724
- }
1725
- function xs(e) {
1726
- var t, s, r = "";
1727
- if (typeof e == "string" || typeof e == "number")
1728
- r += e;
1729
- else if (typeof e == "object")
1730
- if (Array.isArray(e)) {
1731
- var n = e.length;
1732
- for (t = 0; t < n; t++)
1733
- e[t] && (s = xs(e[t])) && (r && (r += " "), r += s);
1734
- } else
1735
- for (s in e)
1736
- e[s] && (r && (r += " "), r += s);
1737
- return r;
1738
- }
1739
- function N() {
1740
- for (var e, t, s = 0, r = "", n = arguments.length; s < n; s++)
1741
- (e = arguments[s]) && (t = xs(e)) && (r && (r += " "), r += t);
1742
- return r;
1743
- }
1744
- var Er = Object.defineProperty, Pr = Object.defineProperties, Ar = Object.getOwnPropertyDescriptors, at = Object.getOwnPropertySymbols, bs = Object.prototype.hasOwnProperty, ws = Object.prototype.propertyIsEnumerable, qt = (e, t, s) => t in e ? Er(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, w = (e, t) => {
1745
- for (var s in t || (t = {}))
1746
- bs.call(t, s) && qt(e, s, t[s]);
1747
- if (at)
1748
- for (var s of at(t))
1749
- ws.call(t, s) && qt(e, s, t[s]);
1750
- return e;
1751
- }, A = (e, t) => Pr(e, Ar(t)), L = (e, t) => {
1752
- var s = {};
1753
- for (var r in e)
1754
- bs.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]);
1755
- if (e != null && at)
1756
- for (var r of at(e))
1757
- t.indexOf(r) < 0 && ws.call(e, r) && (s[r] = e[r]);
1758
- return s;
1759
- };
1760
- function ot() {
1761
- return ot = Object.assign ? Object.assign.bind() : function(e) {
1762
- for (var t = 1; t < arguments.length; t++) {
1763
- var s = arguments[t];
1764
- for (var r in s)
1765
- Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
1766
- }
1767
- return e;
1768
- }, ot.apply(this, arguments);
1769
- }
1770
- function Nr(e, t) {
1771
- typeof e == "function" ? e(t) : e != null && (e.current = t);
1772
- }
1773
- function kr(...e) {
1774
- return (t) => e.forEach(
1775
- (s) => Nr(s, t)
1776
- );
1777
- }
1778
- var Or = /* @__PURE__ */ h.forwardRef((e, t) => {
1779
- const s = e, { children: r } = s, n = L(s, ["children"]), l = h.Children.toArray(r), o = l.find(Lr);
1780
- if (o) {
1781
- const c = o.props.children, m = l.map((y) => y === o ? h.Children.count(c) > 1 ? h.Children.only(null) : /* @__PURE__ */ h.isValidElement(c) ? c.props.children : null : y);
1782
- return /* @__PURE__ */ h.createElement(St, ot({}, n, {
1783
- ref: t
1784
- }), /* @__PURE__ */ h.isValidElement(c) ? /* @__PURE__ */ h.cloneElement(c, void 0, m) : null);
1785
- }
1786
- return /* @__PURE__ */ h.createElement(St, ot({}, n, {
1787
- ref: t
1788
- }), r);
1789
- });
1790
- Or.displayName = "Slot";
1791
- var St = /* @__PURE__ */ h.forwardRef((e, t) => {
1792
- const s = e, { children: r } = s, n = L(s, ["children"]);
1793
- return /* @__PURE__ */ h.isValidElement(r) ? /* @__PURE__ */ h.cloneElement(r, A(w({}, Fr(n, r.props)), {
1794
- ref: t ? kr(t, r.ref) : r.ref
1795
- })) : h.Children.count(r) > 1 ? h.Children.only(null) : null;
1796
- });
1797
- St.displayName = "SlotClone";
1798
- var Mr = ({ children: e }) => /* @__PURE__ */ h.createElement(h.Fragment, null, e);
1799
- function Lr(e) {
1800
- return /* @__PURE__ */ h.isValidElement(e) && e.type === Mr;
1801
- }
1802
- function Fr(e, t) {
1803
- const s = w({}, t);
1804
- for (const r in t) {
1805
- const n = e[r], l = t[r];
1806
- /^on[A-Z]/.test(r) ? n && l ? s[r] = (...c) => {
1807
- l(...c), n(...c);
1808
- } : n && (s[r] = n) : r === "style" ? s[r] = w(w({}, n), l) : r === "className" && (s[r] = [
1809
- n,
1810
- l
1811
- ].filter(Boolean).join(" "));
1812
- }
1813
- return w(w({}, e), s);
1814
- }
1815
- var Rr = ({ firstName: e, lastName: t, variant: s = "small" }) => {
1816
- const r = `${e.charAt(0)}${t.charAt(0)}`;
1817
- return /* @__PURE__ */ i.jsx(
1818
- "span",
1819
- {
1820
- className: `avatar avatar--${s}`,
1821
- "aria-label": `${e} ${t}`,
1822
- role: "img",
1823
- children: /* @__PURE__ */ i.jsx("span", { className: "avatar__initials", children: r })
1824
- }
1825
- );
1826
- }, Be = h.forwardRef(
1827
- (e, t) => {
1828
- var s = e, {
1829
- iconLeft: r,
1830
- iconRight: n,
1831
- isPending: l = !1,
1832
- isFilled: o = !1,
1833
- variant: c,
1834
- className: m,
1835
- children: y
1836
- } = s, d = L(s, [
1837
- "iconLeft",
1838
- "iconRight",
1839
- "isPending",
1840
- "isFilled",
1841
- "variant",
1842
- "className",
1843
- "children"
1844
- ]);
1845
- const v = !!r || !!n;
1846
- return /* @__PURE__ */ i.jsxs(
1847
- "button",
1848
- A(w({
1849
- ref: t
1850
- }, d), {
1851
- className: N(
1852
- "button",
1853
- c && `button--${c}`,
1854
- c && o && `button--${c}--filled`,
1855
- v && "button--with-icon",
1856
- l && "button--pending",
1857
- m
1858
- ),
1859
- children: [
1860
- r && /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: r }),
1861
- !!y && /* @__PURE__ */ i.jsx("span", { className: "button__label", children: y }),
1862
- n && /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: n })
1863
- ]
1864
- })
1865
- );
1866
- }
1867
- );
1868
- Be.displayName = "Button";
1869
- h.createContext(void 0);
1870
- var Dr = h.forwardRef(
1871
- (e, t) => {
1872
- var s = e, { prefix: r, suffix: n, className: l } = s, o = L(s, ["prefix", "suffix", "className"]);
1873
- return /* @__PURE__ */ i.jsxs("div", { className: "input__wrapper", children: [
1874
- r && /* @__PURE__ */ i.jsx("span", { className: "input__prefix", children: r }),
1875
- /* @__PURE__ */ i.jsx(
1876
- "input",
1877
- w({
1878
- ref: t,
1879
- className: N(
1880
- "input",
1881
- r && "input--with-prefix",
1882
- n && "input--with-suffix",
1883
- l
1884
- )
1885
- }, o)
1886
- ),
1887
- n && /* @__PURE__ */ i.jsx("span", { className: "input__suffix", children: n })
1888
- ] });
1889
- }
1890
- );
1891
- Dr.displayName = "TextField";
1892
- h.createContext(void 0);
1893
- var Tr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__header__action", children: e }), Ur = (e) => {
1894
- var t = e, { children: s, className: r } = t, n = L(t, ["children", "className"]);
1895
- return /* @__PURE__ */ i.jsx("div", A(w({ className: N("card__body", r) }, n), { children: s }));
1896
- }, Qr = (e) => /* @__PURE__ */ i.jsx(
1897
- "svg",
1898
- A(w({
1899
- width: "24",
1900
- height: "24",
1901
- viewBox: "0 0 24 24",
1902
- fill: "none",
1903
- xmlns: "http://www.w3.org/2000/svg"
1904
- }, e), {
1905
- children: /* @__PURE__ */ i.jsx(
1906
- "path",
1907
- {
1908
- d: "M8 10L12 14L16 10",
1909
- stroke: "currentColor",
1910
- strokeWidth: "1.5",
1911
- strokeLinecap: "round",
1912
- strokeLinejoin: "round"
1913
- }
1914
- )
1915
- })
1916
- ), Lt = Qr, Hr = (e) => /* @__PURE__ */ i.jsx(
1917
- "svg",
1918
- A(w({
1919
- width: "24",
1920
- height: "24",
1921
- viewBox: "0 0 24 24",
1922
- fill: "none",
1923
- xmlns: "http://www.w3.org/2000/svg"
1924
- }, e), {
1925
- children: /* @__PURE__ */ i.jsx(
1926
- "path",
1927
- {
1928
- d: "M20 6.5L9 17.5L4 12.5",
1929
- stroke: "currentColor",
1930
- strokeWidth: "1.5",
1931
- strokeLinecap: "round",
1932
- strokeLinejoin: "round"
1933
- }
1934
- )
1935
- })
1936
- ), $r = Hr, Kr = (e) => /* @__PURE__ */ i.jsx(
1937
- "svg",
1938
- A(w({
1939
- width: "24",
1940
- height: "24",
1941
- viewBox: "0 0 24 24",
1942
- fill: "none",
1943
- xmlns: "http://www.w3.org/2000/svg"
1944
- }, e), {
1945
- children: /* @__PURE__ */ i.jsx(
1946
- "path",
1947
- {
1948
- fillRule: "evenodd",
1949
- clipRule: "evenodd",
1950
- fill: "currentColor",
1951
- d: "M5.53033 4.46967C5.23744 4.17678 4.76256 4.17678 4.46967 4.46967C4.17678 4.76256 4.17678 5.23744 4.46967 5.53033L10.9393 12L4.46967 18.4697C4.17678 18.7626 4.17678 19.2374 4.46967 19.5303C4.76256 19.8232 5.23744 19.8232 5.53033 19.5303L12 13.0607L18.4697 19.5303C18.7626 19.8232 19.2374 19.8232 19.5303 19.5303C19.8232 19.2374 19.8232 18.7626 19.5303 18.4697L13.0607 12L19.5303 5.53033C19.8232 5.23744 19.8232 4.76256 19.5303 4.46967C19.2374 4.17678 18.7626 4.17678 18.4697 4.46967L12 10.9393L5.53033 4.46967Z"
1952
- }
1953
- )
1954
- })
1955
- ), qr = Kr, Gr = (e) => /* @__PURE__ */ i.jsx(
1956
- "svg",
1957
- A(w({
1958
- width: "24",
1959
- height: "24",
1960
- viewBox: "0 0 24 24",
1961
- fill: "none",
1962
- xmlns: "http://www.w3.org/2000/svg"
1963
- }, e), {
1964
- children: /* @__PURE__ */ i.jsx(
1965
- "path",
1966
- {
1967
- fillRule: "evenodd",
1968
- clipRule: "evenodd",
1969
- d: "M10.25 2.25C9.83579 2.25 9.5 2.58579 9.5 3C9.5 3.41421 9.83579 3.75 10.25 3.75H15.25C16.112 3.75 16.9386 4.09241 17.5481 4.7019C18.1576 5.3114 18.5 6.13805 18.5 7V17C18.5 17.862 18.1576 18.6886 17.5481 19.2981C16.9386 19.9076 16.112 20.25 15.25 20.25H10.25C9.83579 20.25 9.5 20.5858 9.5 21C9.5 21.4142 9.83579 21.75 10.25 21.75H15.25C16.5098 21.75 17.718 21.2496 18.6088 20.3588C19.4996 19.468 20 18.2598 20 17V7C20 5.74022 19.4996 4.53204 18.6088 3.64124C17.718 2.75044 16.5098 2.25 15.25 2.25H10.25ZM9.71967 9.53033C9.42678 9.23744 9.42678 8.76256 9.71967 8.46967C10.0126 8.17678 10.4874 8.17678 10.7803 8.46967L13.7803 11.4697C14.0732 11.7626 14.0732 12.2374 13.7803 12.5303L10.7803 15.5303C10.4874 15.8232 10.0126 15.8232 9.71967 15.5303C9.42678 15.2374 9.42678 14.7626 9.71967 14.4697L11.4393 12.75L4.25 12.75C3.83579 12.75 3.5 12.4142 3.5 12C3.5 11.5858 3.83579 11.25 4.25 11.25L11.4393 11.25L9.71967 9.53033Z",
1970
- fill: "#323232"
1971
- }
1972
- )
1973
- })
1974
- ), Vr = Gr, Wr = (e) => /* @__PURE__ */ i.jsx(
1975
- "svg",
1976
- A(w({
1977
- width: "24",
1978
- height: "24",
1979
- viewBox: "0 0 24 24",
1980
- fill: "none",
1981
- xmlns: "http://www.w3.org/2000/svg"
1982
- }, e), {
1983
- children: /* @__PURE__ */ i.jsx(
1984
- "path",
1985
- {
1986
- fillRule: "evenodd",
1987
- clipRule: "evenodd",
1988
- d: "M13.25 2.25C13.6642 2.25 14 2.58579 14 3C14 3.41421 13.6642 3.75 13.25 3.75H8.25C7.38805 3.75 6.5614 4.09241 5.9519 4.7019C5.34241 5.3114 5 6.13805 5 7V17C5 17.862 5.34241 18.6886 5.9519 19.2981C6.5614 19.9076 7.38805 20.25 8.25 20.25H13.25C13.6642 20.25 14 20.5858 14 21C14 21.4142 13.6642 21.75 13.25 21.75H8.25C6.99022 21.75 5.78204 21.2496 4.89124 20.3588C4.00045 19.468 3.5 18.2598 3.5 17V7C3.5 5.74022 4.00045 4.53204 4.89124 3.64124C5.78204 2.75044 6.99022 2.25 8.25 2.25H13.25ZM15.7197 8.46967C16.0126 8.17678 16.4874 8.17678 16.7803 8.46967L19.7803 11.4697C20.0732 11.7626 20.0732 12.2374 19.7803 12.5303L16.7803 15.5303C16.4874 15.8232 16.0126 15.8232 15.7197 15.5303C15.4268 15.2374 15.4268 14.7626 15.7197 14.4697L17.4393 12.75L10.25 12.75C9.83579 12.75 9.5 12.4142 9.5 12C9.5 11.5858 9.83579 11.25 10.25 11.25L17.4393 11.25L15.7197 9.53033C15.4268 9.23744 15.4268 8.76256 15.7197 8.46967Z",
1989
- fill: "currentColor"
1990
- }
1991
- )
1992
- })
1993
- ), Zr = Wr, Yr = (e) => /* @__PURE__ */ i.jsxs(
1994
- "svg",
1995
- A(w({
1996
- width: "24",
1997
- height: "24",
1998
- fill: "none",
1999
- viewBox: "0 0 24 24",
2000
- xmlns: "http://www.w3.org/2000/svg"
2001
- }, e), {
2002
- children: [
2003
- /* @__PURE__ */ i.jsxs("g", { clipPath: "url(#clip0_19_444)", children: [
2004
- /* @__PURE__ */ i.jsx(
2005
- "path",
2006
- {
2007
- d: "M17 21H7V21C5.89543 21 5 20.1046 5 19V12V12C5 10.8954 5.89543 10 7 10H17V10C18.1046 10 19 10.8954 19 12V19V19C19 20.1046 18.1046 21 17 21C17 21 17 21 17 21V21Z",
2008
- stroke: "currentColor",
2009
- strokeWidth: "1.5",
2010
- strokeLinecap: "round",
2011
- strokeLinejoin: "round"
2012
- }
2013
- ),
2014
- /* @__PURE__ */ i.jsx("circle", { cx: "10.3", cy: "15.5", r: "0.8", fill: "currentColor" }),
2015
- /* @__PURE__ */ i.jsx("circle", { cx: "13.7", cy: "15.5", r: "0.8", fill: "currentColor" }),
2016
- /* @__PURE__ */ i.jsx(
2017
- "path",
2018
- {
2019
- d: "M8 10V7V7C8 4.79086 9.79086 3 12 3V3C14.2091 3 16 4.79086 16 7V10",
2020
- stroke: "currentColor",
2021
- strokeWidth: "1.5",
2022
- strokeLinecap: "round",
2023
- strokeLinejoin: "round"
2024
- }
2025
- )
2026
- ] }),
2027
- /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2028
- ]
2029
- })
2030
- ), zr = Yr, Jr = (e) => /* @__PURE__ */ i.jsxs(
2031
- "svg",
2032
- A(w({
2033
- width: "24",
2034
- height: "24",
2035
- viewBox: "0 0 24 24",
2036
- fill: "none",
2037
- xmlns: "http://www.w3.org/2000/svg"
2038
- }, e), {
2039
- children: [
2040
- /* @__PURE__ */ i.jsx(
2041
- "path",
2042
- {
2043
- d: "M14.4749 4.52513C15.8418 5.89197 15.8418 8.10804 14.4749 9.47488C13.1081 10.8417 10.892 10.8417 9.52516 9.47488C8.15832 8.10804 8.15832 5.89197 9.52516 4.52513C10.892 3.15829 13.1081 3.15829 14.4749 4.52513",
2044
- stroke: "currentColor",
2045
- strokeWidth: "1.5",
2046
- strokeLinecap: "round",
2047
- strokeLinejoin: "round"
2048
- }
2049
- ),
2050
- /* @__PURE__ */ i.jsx(
2051
- "path",
2052
- {
2053
- d: "M4 18.5V19.5C4 20.052 4.448 20.5 5 20.5H19C19.552 20.5 20 20.052 20 19.5V18.5C20 15.474 16.048 13.508 12 13.508C7.952 13.508 4 15.474 4 18.5Z",
2054
- stroke: "currentColor",
2055
- strokeWidth: "1.5",
2056
- strokeLinecap: "round",
2057
- strokeLinejoin: "round"
2058
- }
2059
- )
2060
- ]
2061
- })
2062
- ), Xr = Jr, Ir = (e) => /* @__PURE__ */ i.jsxs(
2063
- "svg",
2064
- A(w({
2065
- width: "24",
2066
- height: "24",
2067
- viewBox: "0 0 24 24",
2068
- fill: "none",
2069
- xmlns: "http://www.w3.org/2000/svg"
2070
- }, e), {
2071
- children: [
2072
- /* @__PURE__ */ i.jsx(
2073
- "path",
2074
- {
2075
- d: "M14.4749 4.52513C15.8418 5.89197 15.8418 8.10804 14.4749 9.47488C13.1081 10.8417 10.892 10.8417 9.52516 9.47488C8.15832 8.10804 8.15832 5.89197 9.52516 4.52513C10.892 3.15829 13.1081 3.15829 14.4749 4.52513",
2076
- stroke: "currentColor",
2077
- strokeWidth: "1.5",
2078
- strokeLinecap: "round",
2079
- strokeLinejoin: "round"
2080
- }
2081
- ),
2082
- /* @__PURE__ */ i.jsx(
2083
- "path",
2084
- {
2085
- d: "M13.5 20.5H10H5C4.448 20.5 4 20.052 4 19.5V18.5C4 15.9788 6.7434 14.1935 10 13.6679C10.6521 13.5627 11.3247 13.508 12 13.508C13.0272 13.508 14.0482 13.6346 15 13.873",
2086
- stroke: "currentColor",
2087
- strokeWidth: "1.5",
2088
- strokeLinecap: "round",
2089
- strokeLinejoin: "round"
2090
- }
2091
- ),
2092
- /* @__PURE__ */ i.jsx(
2093
- "path",
2094
- {
2095
- d: "M17.5 16V18.0164V20",
2096
- stroke: "currentColor",
2097
- strokeWidth: "1.5",
2098
- strokeLinecap: "round",
2099
- strokeLinejoin: "round"
2100
- }
2101
- ),
2102
- /* @__PURE__ */ i.jsx(
2103
- "path",
2104
- {
2105
- d: "M19.5 18L17.4836 18L15.5 18",
2106
- stroke: "currentColor",
2107
- strokeWidth: "1.5",
2108
- strokeLinecap: "round",
2109
- strokeLinejoin: "round"
2110
- }
2111
- )
2112
- ]
2113
- })
2114
- ), Br = Ir, ei = (e) => {
2115
- var t = e, { className: s } = t, r = L(t, ["className"]);
2116
- return /* @__PURE__ */ i.jsxs(
2117
- "svg",
2118
- A(w({
2119
- width: "20",
2120
- height: "20",
2121
- viewBox: "0 0 20 20",
2122
- fill: "none",
2123
- xmlns: "http://www.w3.org/2000/svg",
2124
- className: N("spinner", s)
2125
- }, r), {
2126
- children: [
2127
- /* @__PURE__ */ i.jsx("circle", { cx: "10", cy: "10", r: "9", stroke: "currentColor", strokeOpacity: "0.2", strokeWidth: "1.5" }),
2128
- /* @__PURE__ */ i.jsx(
2129
- "circle",
2130
- {
2131
- cx: "10",
2132
- cy: "10",
2133
- r: "9",
2134
- stroke: "currentColor",
2135
- strokeWidth: "1.5",
2136
- strokeLinecap: "round",
2137
- strokeDasharray: "42.42 14.14"
2138
- }
2139
- )
2140
- ]
2141
- })
2142
- );
2143
- }, ti = ei, si = (e) => /* @__PURE__ */ i.jsxs(
2144
- "svg",
2145
- A(w({
2146
- width: "24",
2147
- height: "24",
2148
- fill: "none",
2149
- viewBox: "0 0 24 24",
2150
- xmlns: "http://www.w3.org/2000/svg"
2151
- }, e), {
2152
- children: [
2153
- /* @__PURE__ */ i.jsxs("g", { clipPath: "url(#clip0_762_2934)", children: [
2154
- /* @__PURE__ */ i.jsx(
2155
- "path",
2156
- {
2157
- fillRule: "evenodd",
2158
- clipRule: "evenodd",
2159
- d: "M12.75 8.39996C12.75 7.98575 12.4142 7.64996 12 7.64996C11.5858 7.64996 11.25 7.98575 11.25 8.39996V11.669C11.25 12.0832 11.5858 12.419 12 12.419C12.4142 12.419 12.75 12.0832 12.75 11.669V8.39996ZM12.005 16.35C12.5159 16.35 12.93 15.9359 12.93 15.425C12.93 14.9141 12.5159 14.5 12.005 14.5C11.4942 14.5 11.08 14.9141 11.08 15.425C11.08 15.9359 11.4942 16.35 12.005 16.35Z",
2160
- fill: "currentColor"
2161
- }
2162
- ),
2163
- /* @__PURE__ */ i.jsx(
2164
- "path",
2165
- {
2166
- d: "M12 21C7.029 21 3 16.971 3 12C3 7.029 7.029 3 12 3C16.971 3 21 7.029 21 12C21 16.971 16.971 21 12 21Z",
2167
- stroke: "currentColor",
2168
- strokeWidth: "1.5",
2169
- strokeLinecap: "round",
2170
- strokeLinejoin: "round"
2171
- }
2172
- )
2173
- ] }),
2174
- /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_762_2934", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2175
- ]
2176
- })
2177
- ), ri = si, ii = (e) => {
2178
- const t = (s) => `${s}${e.suffix ? `_${e.suffix}` : ""}`;
2179
- return /* @__PURE__ */ i.jsxs(
2180
- "svg",
2181
- A(w({
2182
- width: "24",
2183
- height: "24",
2184
- viewBox: "0 0 24 24",
2185
- fill: "none",
2186
- xmlns: "http://www.w3.org/2000/svg"
2187
- }, e), {
2188
- children: [
2189
- /* @__PURE__ */ i.jsx(
2190
- "path",
2191
- {
2192
- d: "M17.6214 11.1549C20.4161 8.33951 21.712 5.41047 20.6067 3.876C19.1586 1.85988 14.1278 2.98841 9.3766 6.39936C8.31103 7.15864 7.31229 8.00725 6.39122 8.93598L17.6214 11.1549Z",
2193
- fill: t("url(#paint0")
2194
- }
2195
- ),
2196
- /* @__PURE__ */ i.jsx(
2197
- "path",
2198
- {
2199
- opacity: "0.9",
2200
- d: "M17.6214 11.1548C17.1178 9.955 16.5189 8.79735 15.8301 7.693C12.6925 2.58286 8.41126 -0.498612 6.30132 0.794902C4.66377 1.79657 4.80319 5.119 6.39145 8.93562L17.6214 11.1548Z",
2201
- fill: t("url(#paint1")
2202
- }
2203
- ),
2204
- /* @__PURE__ */ i.jsx(
2205
- "path",
2206
- {
2207
- d: "M6.39122 8.93591C6.89474 10.1357 7.49373 11.2934 8.18245 12.3977C11.3329 17.5079 15.6006 20.5894 17.7229 19.2958C19.3616 18.2942 19.221 14.9718 17.6339 11.1549L6.39122 8.93591Z",
2208
- fill: t("url(#paint2")
2209
- }
2210
- ),
2211
- /* @__PURE__ */ i.jsx(
2212
- "path",
2213
- {
2214
- opacity: "0.85",
2215
- d: "M6.39113 8.93591C3.5836 11.7637 2.28796 14.6927 3.39319 16.2272C4.8413 18.2433 9.87186 17.1147 14.6224 13.7038C15.6888 12.9404 16.6916 12.0922 17.6213 11.1677L6.39113 8.93591Z",
2216
- fill: t("url(#paint3")
2217
- }
2218
- ),
2219
- /* @__PURE__ */ i.jsx(
2220
- "path",
2221
- {
2222
- opacity: "0.87",
2223
- d: "M6.39113 8.93591C3.5836 11.7509 2.28796 14.6801 3.39319 16.2272C4.8413 18.2433 9.87186 17.1147 14.6224 13.7038C15.6888 12.9404 16.6916 12.0922 17.6213 11.1677L6.39113 8.93591Z",
2224
- fill: t("url(#paint4")
2225
- }
2226
- ),
2227
- /* @__PURE__ */ i.jsx(
2228
- "path",
2229
- {
2230
- d: "M12.0064 23.2897C16.2652 23.2897 19.7177 22.9093 19.7177 22.4402C19.7177 21.971 16.2652 21.5907 12.0064 21.5907C7.74761 21.5907 4.29517 21.971 4.29517 22.4402C4.29517 22.9093 7.74761 23.2897 12.0064 23.2897Z",
2231
- fill: t("url(#paint5")
2232
- }
2233
- ),
2234
- /* @__PURE__ */ i.jsxs("defs", { children: [
2235
- /* @__PURE__ */ i.jsxs(
2236
- "linearGradient",
2237
- {
2238
- id: t("paint0"),
2239
- x1: "10.6862",
2240
- y1: "11.0225",
2241
- x2: "14.9751",
2242
- y2: "0.707188",
2243
- gradientUnits: "userSpaceOnUse",
2244
- children: [
2245
- /* @__PURE__ */ i.jsx("stop", { offset: "0.413", stopColor: "#90B117" }),
2246
- /* @__PURE__ */ i.jsx("stop", { offset: "0.501", stopColor: "#8BAF19" }),
2247
- /* @__PURE__ */ i.jsx("stop", { offset: "0.601", stopColor: "#7DAB1E" }),
2248
- /* @__PURE__ */ i.jsx("stop", { offset: "0.706", stopColor: "#67A325" }),
2249
- /* @__PURE__ */ i.jsx("stop", { offset: "0.815", stopColor: "#479830" }),
2250
- /* @__PURE__ */ i.jsx("stop", { offset: "0.925", stopColor: "#1F8A3E" }),
2251
- /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#007F48" })
2252
- ]
2253
- }
2254
- ),
2255
- /* @__PURE__ */ i.jsxs(
2256
- "linearGradient",
2257
- {
2258
- id: t("paint1"),
2259
- x1: "11.5281",
2260
- y1: "8.85339",
2261
- x2: "12.4519",
2262
- y2: "1.60772",
2263
- gradientUnits: "userSpaceOnUse",
2264
- children: [
2265
- /* @__PURE__ */ i.jsx("stop", { stopColor: "#36BCEE" }),
2266
- /* @__PURE__ */ i.jsx("stop", { offset: "0.201", stopColor: "#31ACE3" }),
2267
- /* @__PURE__ */ i.jsx("stop", { offset: "0.59", stopColor: "#2583C5" }),
2268
- /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#1652A1" })
2269
- ]
2270
- }
2271
- ),
2272
- /* @__PURE__ */ i.jsxs(
2273
- "linearGradient",
2274
- {
2275
- id: t("paint2"),
2276
- x1: "15.0651",
2277
- y1: "18.7384",
2278
- x2: "12.9747",
2279
- y2: "8.0336",
2280
- gradientUnits: "userSpaceOnUse",
2281
- children: [
2282
- /* @__PURE__ */ i.jsx("stop", { stopColor: "#E42313" }),
2283
- /* @__PURE__ */ i.jsx("stop", { offset: "0.071", stopColor: "#E73611" }),
2284
- /* @__PURE__ */ i.jsx("stop", { offset: "0.312", stopColor: "#F0710B" }),
2285
- /* @__PURE__ */ i.jsx("stop", { offset: "0.534", stopColor: "#F6A006" }),
2286
- /* @__PURE__ */ i.jsx("stop", { offset: "0.73", stopColor: "#FBC103" }),
2287
- /* @__PURE__ */ i.jsx("stop", { offset: "0.891", stopColor: "#FED601" }),
2288
- /* @__PURE__ */ i.jsx("stop", { offset: "0.999", stopColor: "#FFDD00" })
2289
- ]
2290
- }
2291
- ),
2292
- /* @__PURE__ */ i.jsxs(
2293
- "linearGradient",
2294
- {
2295
- id: t("paint3"),
2296
- x1: "13.9806",
2297
- y1: "8.29749",
2298
- x2: "10.8203",
2299
- y2: "18.1127",
2300
- gradientUnits: "userSpaceOnUse",
2301
- children: [
2302
- /* @__PURE__ */ i.jsx("stop", { stopColor: "#FFC832" }),
2303
- /* @__PURE__ */ i.jsx("stop", { offset: "0.354", stopColor: "#F8A220" }),
2304
- /* @__PURE__ */ i.jsx("stop", { offset: "0.779", stopColor: "#F07A0D" }),
2305
- /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2306
- ]
2307
- }
2308
- ),
2309
- /* @__PURE__ */ i.jsxs(
2310
- "linearGradient",
2311
- {
2312
- id: t("paint4"),
2313
- x1: "13.9806",
2314
- y1: "8.2892",
2315
- x2: "10.8212",
2316
- y2: "18.1113",
2317
- gradientUnits: "userSpaceOnUse",
2318
- children: [
2319
- /* @__PURE__ */ i.jsx("stop", { offset: "0.461", stopColor: "#F3C636", stopOpacity: "0" }),
2320
- /* @__PURE__ */ i.jsx("stop", { offset: "0.645", stopColor: "#F1A223", stopOpacity: "0.341" }),
2321
- /* @__PURE__ */ i.jsx("stop", { offset: "0.879", stopColor: "#EE7A0E", stopOpacity: "0.776" }),
2322
- /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2323
- ]
2324
- }
2325
- ),
2326
- /* @__PURE__ */ i.jsxs(
2327
- "radialGradient",
2328
- {
2329
- id: t("paint5"),
2330
- cx: "0",
2331
- cy: "0",
2332
- r: "1",
2333
- gradientUnits: "userSpaceOnUse",
2334
- gradientTransform: "translate(11.9404 22.4736) scale(7.73227 0.851796)",
2335
- children: [
2336
- /* @__PURE__ */ i.jsx("stop", { stopColor: "#C9C9C9" }),
2337
- /* @__PURE__ */ i.jsx("stop", { offset: "0.302", stopColor: "#CCCCCC", stopOpacity: "0.698" }),
2338
- /* @__PURE__ */ i.jsx("stop", { offset: "0.554", stopColor: "#D7D7D7", stopOpacity: "0.447" }),
2339
- /* @__PURE__ */ i.jsx("stop", { offset: "0.787", stopColor: "#E8E8E8", stopOpacity: "0.212" }),
2340
- /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
2341
- ]
2342
- }
2343
- )
2344
- ] })
2345
- ]
2346
- })
2347
- );
2348
- }, js = ii, ni = (e) => /* @__PURE__ */ i.jsxs(
2349
- "svg",
2350
- A(w({
2351
- fill: "none",
2352
- xmlns: "http://www.w3.org/2000/svg",
2353
- viewBox: "0 0 24 24",
2354
- width: "24",
2355
- height: "24"
2356
- }, e), {
2357
- children: [
2358
- /* @__PURE__ */ i.jsx(
2359
- "path",
2360
- {
2361
- d: "M16 3H8C5.23858 3 3 5.23858 3 8V16C3 18.7614 5.23858 21 8 21H16C18.7614 21 21 18.7614 21 16V8C21 5.23858 18.7614 3 16 3Z",
2362
- stroke: "currentColor",
2363
- strokeWidth: "1.5",
2364
- strokeLinecap: "round",
2365
- strokeLinejoin: "round"
2366
- }
2367
- ),
2368
- /* @__PURE__ */ i.jsx(
2369
- "path",
2370
- {
2371
- d: "M12.001 11.258C12.001 8.906 13.634 7 15.648 7C16.515 7 17.218 7.703 17.218 8.57C17.218 10.464 14.881 12 11.999 12C9.117 12 6.78 10.465 6.78 8.57C6.78 7.703 7.483 7 8.351 7C10.365 7 11.998 8.906 11.998 11.258",
2372
- stroke: "currentColor",
2373
- strokeWidth: "1.5",
2374
- strokeLinecap: "round",
2375
- strokeLinejoin: "round"
2376
- }
2377
- ),
2378
- /* @__PURE__ */ i.jsx(
2379
- "path",
2380
- {
2381
- d: "M8 15.854C10.208 15.854 11.998 13.764 11.998 11.186L12.002 11.2C12.002 13.778 13.792 15.868 16 15.868",
2382
- stroke: "currentColor",
2383
- strokeWidth: "1.5",
2384
- strokeLinecap: "round",
2385
- strokeLinejoin: "round"
2386
- }
2387
- ),
2388
- /* @__PURE__ */ i.jsx(
2389
- "path",
2390
- {
2391
- d: "M12 3V21",
2392
- stroke: "currentColor",
2393
- strokeWidth: "1.5",
2394
- strokeLinecap: "round",
2395
- strokeLinejoin: "round"
2396
- }
2397
- ),
2398
- /* @__PURE__ */ i.jsx(
2399
- "path",
2400
- {
2401
- d: "M21 12H3",
2402
- stroke: "currentColor",
2403
- strokeWidth: "1.5",
2404
- strokeLinecap: "round",
2405
- strokeLinejoin: "round"
2406
- }
2407
- )
2408
- ]
2409
- })
2410
- ), ai = ni, oi = (e) => /* @__PURE__ */ i.jsx(
2411
- "svg",
2412
- A(w({
2413
- fill: "none",
2414
- xmlns: "http://www.w3.org/2000/svg",
2415
- viewBox: "0 0 21 16",
2416
- width: "21",
2417
- height: "16"
2418
- }, e), {
2419
- children: /* @__PURE__ */ i.jsx(
2420
- "path",
2421
- {
2422
- d: "M1.5 5h18M8.07 9H5.5M16.5 15h-12a3 3 0 0 1-3-3V4a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3Z",
2423
- stroke: "currentcolor",
2424
- strokeWidth: "1.5",
2425
- strokeLinecap: "round",
2426
- strokeLinejoin: "round"
2427
- }
2428
- )
2429
- })
2430
- ), li = oi, ci = (e) => /* @__PURE__ */ i.jsxs(
2431
- "svg",
2432
- A(w({
2433
- width: "24",
2434
- height: "24",
2435
- fill: "none",
2436
- xmlns: "http://www.w3.org/2000/svg",
2437
- viewBox: "0 0 24 24"
2438
- }, e), {
2439
- children: [
2440
- /* @__PURE__ */ i.jsx(
2441
- "path",
2442
- {
2443
- d: "M3 3h6v6H3V3ZM2.8 14.8h6v6h-6v-6ZM20.8 8.8h-6v-6h6v6Z",
2444
- strokeWidth: "1.5",
2445
- strokeLinecap: "round",
2446
- strokeLinejoin: "round",
2447
- stroke: "currentColor"
2448
- }
2449
- ),
2450
- /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 14.7)", fill: "currentColor" }),
2451
- /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 14.7)", fill: "currentColor" }),
2452
- /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 17.8 17.7)", fill: "currentColor" }),
2453
- /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 20.7)", fill: "currentColor" }),
2454
- /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 20.7)", fill: "currentColor" })
2455
- ]
2456
- })
2457
- ), ui = ci, hi = (e) => {
2458
- var t = e, {
2459
- variant: s,
2460
- icon: r,
2461
- isStandalone: n,
2462
- title: l,
2463
- description: o,
2464
- className: c
2465
- } = t, m = L(t, [
2466
- "variant",
2467
- "icon",
2468
- "isStandalone",
2469
- "title",
2470
- "description",
2471
- "className"
2472
- ]);
2473
- return /* @__PURE__ */ i.jsx(
2474
- "div",
2475
- A(w({}, m), {
2476
- className: N(
2477
- "card__empty-state",
2478
- s === "error" && "card__empty-state--error",
2479
- n && "card__empty-state--standalone",
2480
- c
2481
- ),
2482
- children: /* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__wrapper", children: [
2483
- /* @__PURE__ */ i.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ i.jsx(ri, {}) : r }),
2484
- /* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__content", children: [
2485
- /* @__PURE__ */ i.jsx("p", { className: "card__empty-state__title", children: l }),
2486
- /* @__PURE__ */ i.jsx("p", { className: "card__empty-state__description", children: o })
2487
- ] })
2488
- ] })
2489
- })
2490
- );
2491
- }, di = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__footer", children: e }), fi = (e) => {
2492
- var t = e, {
2493
- variant: s = "default",
2494
- sticky: r,
2495
- className: n,
2496
- children: l
2497
- } = t, o = L(t, [
2498
- "variant",
2499
- "sticky",
2500
- "className",
2501
- "children"
2502
- ]);
2503
- return /* @__PURE__ */ i.jsx(
2504
- "div",
2505
- A(w({}, o), {
2506
- className: N(
2507
- "card__header",
2508
- s && `card__header--${s}`,
2509
- r && "card__header--sticky",
2510
- n
2511
- ),
2512
- children: l
2513
- })
2514
- );
2515
- }, pi = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__image", children: e }), mi = ({ children: e, className: t }) => /* @__PURE__ */ i.jsx("div", { className: N("card__body__item", t), children: e }), vi = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__body__subtitle", children: e }), gi = ({ icon: e, children: t }) => /* @__PURE__ */ i.jsxs("div", { className: "card__header__title", children: [
2516
- e && /* @__PURE__ */ i.jsx("span", { className: "card__header__title__icon", children: e }),
2517
- t
2518
- ] }), _s = h.forwardRef(
2519
- (e, t) => {
2520
- var s = e, { type: r, children: n, className: l, variant: o = "default", disabled: c = !1 } = s, m = L(s, ["type", "children", "className", "variant", "disabled"]);
2521
- return h.createElement(
2522
- r,
2523
- w({
2524
- className: N(
2525
- "card",
2526
- c && "card--disabled",
2527
- o && `card--${o}`,
2528
- l
2529
- ),
2530
- ref: t
2531
- }, m),
2532
- n
2533
- );
2534
- }
2535
- );
2536
- _s.displayName = "Card";
2537
- Object.assign(_s, {
2538
- Header: fi,
2539
- Action: Tr,
2540
- Title: gi,
2541
- Subtitle: vi,
2542
- Body: Ur,
2543
- Image: pi,
2544
- Item: mi,
2545
- Footer: di,
2546
- EmptyState: hi
2547
- });
2548
- var yi = (e) => {
2549
- var t = e, { className: s, children: r } = t, n = L(t, ["className", "children"]);
2550
- return /* @__PURE__ */ i.jsx("div", A(w({ className: N("checkbox__content", s) }, n), { children: r }));
2551
- }, Ci = (e) => {
2552
- var t = e, { className: s, children: r } = t, n = L(t, ["className", "children"]);
2553
- return /* @__PURE__ */ i.jsx("span", A(w({ className: N("checkbox__hint", s) }, n), { children: r }));
2554
- }, Ss = h.createContext(void 0), xi = ({ id: e, name: t, children: s }) => /* @__PURE__ */ i.jsx(Ss.Provider, { value: { id: e, name: t }, children: s }), bi = () => {
2555
- const e = h.useContext(Ss);
2556
- if (!e)
2557
- throw new Error("Checkbox compound components can not be rendered outside of Checkbox");
2558
- return e;
2559
- }, wi = (e) => {
2560
- var t = e, { className: s, children: r } = t, n = L(t, ["className", "children"]);
2561
- const { id: l } = bi();
2562
- return /* @__PURE__ */ i.jsx("label", A(w({ htmlFor: l, className: N("checkbox__label", s) }, n), { children: r }));
2563
- }, xe = (e) => {
2564
- var t = e, {
2565
- id: s,
2566
- name: r,
2567
- isPending: n = !1,
2568
- variant: l = "neutral",
2569
- hasError: o = !1,
2570
- single: c,
2571
- className: m,
2572
- children: y
2573
- } = t, d = L(t, [
2574
- "id",
2575
- "name",
2576
- "isPending",
2577
- "variant",
2578
- "hasError",
2579
- "single",
2580
- "className",
2581
- "children"
2582
- ]);
2583
- const v = h.useRef(null);
2584
- return h.useEffect(() => {
2585
- v.current && (n ? v.current.indeterminate = !0 : v.current.indeterminate = !1);
2586
- }, [n]), /* @__PURE__ */ i.jsxs(
2587
- "div",
2588
- {
2589
- className: N("checkbox", l && `checkbox--${l}`, o && "checkbox--error"),
2590
- children: [
2591
- /* @__PURE__ */ i.jsx(
2592
- "input",
2593
- w({
2594
- id: s,
2595
- name: r,
2596
- type: "checkbox",
2597
- ref: v,
2598
- className: N("checkbox__input", m),
2599
- value: c ? "true" : ""
2600
- }, d)
2601
- ),
2602
- n ? /* @__PURE__ */ i.jsx(ti, { className: "checkbox__spinner", "aria-hidden": !0 }) : /* @__PURE__ */ i.jsx($r, { className: "checkbox__check", "aria-hidden": !0, strokeDasharray: "75" }),
2603
- /* @__PURE__ */ i.jsx(xi, { id: s, name: r, children: y })
2604
- ]
2605
- }
2606
- );
2607
- };
2608
- xe.Content = yi;
2609
- xe.Label = wi;
2610
- xe.Hint = Ci;
2611
- xe.Error = Error;
2612
- var ji = (e) => {
2613
- var t = e, { type: s = "div", className: r, children: n } = t, l = L(t, ["type", "className", "children"]);
2614
- return h.createElement(s, w({ className: N("dialog__body", r) }, l), n);
2615
- }, Et = () => document.body.style.removeProperty("overflow"), Gt = (e) => e.preventDefault(), _i = 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])', Si = (e) => {
2616
- var t = e, { className: s, children: r, shouldAnimate: n = !0 } = t, l = L(t, ["className", "children", "shouldAnimate"]);
2617
- const { ref: o, defaultOpen: c, isModal: m, onClose: y } = et();
2618
- return h.useEffect(() => {
2619
- const d = o == null ? void 0 : o.current;
2620
- if (d != null && d.open) {
2621
- const v = d.querySelectorAll(_i), u = v[0], p = v[v.length - 1], E = (S) => {
2622
- if (!(S.key === "Tab"))
2623
- return;
2624
- S.shiftKey ? document.activeElement === u && (p.focus(), S.preventDefault()) : document.activeElement === p && (u.focus(), S.preventDefault());
2625
- };
2626
- return document.body.style.overflow = "hidden", d.addEventListener("keydown", E), window.addEventListener("popstate", () => Et()), () => {
2627
- d.removeEventListener("keydown", E), window.removeEventListener("popstate", () => Et());
2628
- };
2629
- }
2630
- }, [o]), h.useEffect(() => {
2631
- const d = o == null ? void 0 : o.current;
2632
- if (!d)
2633
- return;
2634
- if (c && (d.removeAttribute("open"), d.showModal(), d.focus()), m)
2635
- return d.addEventListener("cancel", Gt), () => d.removeEventListener("cancel", Gt);
2636
- const v = ({ clientX: u, clientY: p }) => {
2637
- const { top: E, right: S, bottom: j, left: x } = d.getBoundingClientRect(), C = 0 < p && 0 < u, _ = E < p && p < j, O = x < u && u < S;
2638
- C && !(_ && O) && y();
2639
- };
2640
- return d.addEventListener("cancel", y), d.addEventListener("mousedown", v), () => {
2641
- d.removeEventListener("cancel", y), d.removeEventListener("mousedown", v);
2642
- };
2643
- }, [o, m, y, c]), /* @__PURE__ */ i.jsx(
2644
- "dialog",
2645
- A(w({
2646
- ref: o,
2647
- open: c,
2648
- "aria-modal": !!m,
2649
- "aria-labelledby": "dialogTitle",
2650
- className: N("dialog", n && "dialog--animated", s)
2651
- }, l), {
2652
- children: r
2653
- })
2654
- );
2655
- }, Es = h.createContext(void 0), Ei = ({ defaultOpen: e, onClose: t, isModal: s, children: r }) => {
2656
- const n = h.useRef(null), l = h.useRef(t), o = h.useCallback(() => {
2657
- var c;
2658
- Et(), (c = n.current) == null || c.close(), l.current && (l == null || l.current());
2659
- }, [n]);
2660
- return /* @__PURE__ */ i.jsx(Es.Provider, { value: { ref: n, defaultOpen: e, isModal: s, onClose: o }, children: r });
2661
- }, et = () => {
2662
- const e = h.useContext(Es);
2663
- if (!e)
2664
- throw new Error("Dialog compound components can not be rendered outside of Dialog");
2665
- return e;
2666
- }, Pi = (e) => {
2667
- var t = e, { children: s } = t, r = L(t, ["children"]);
2668
- const { onClose: n } = et();
2669
- return /* @__PURE__ */ i.jsx(Be, A(w({ onClick: n }, r), { children: s }));
2670
- }, Ps = h.forwardRef((e, t) => {
2671
- var s = e, { className: r } = s, n = L(s, ["className"]);
2672
- const { onClose: l } = et();
2673
- return /* @__PURE__ */ i.jsx(
2674
- Be,
2675
- w({
2676
- type: "submit",
2677
- ref: t,
2678
- formMethod: "dialog",
2679
- onClick: l,
2680
- iconLeft: /* @__PURE__ */ i.jsx(qr, {}),
2681
- variant: "icon--secondary",
2682
- className: N("dialog__close button--icon", r)
2683
- }, n)
2684
- );
2685
- });
2686
- Ps.displayName = "Close";
2687
- var Ai = (e) => {
2688
- var t = e, { className: s, children: r } = t, n = L(t, ["className", "children"]);
2689
- return /* @__PURE__ */ i.jsx("div", A(w({ className: N("dialog__footer", s) }, n), { children: r }));
2690
- }, Ni = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "dialog__header", children: e }), ki = (e) => {
2691
- var t = e, { icon: s, children: r, className: n } = t, l = L(t, ["icon", "children", "className"]);
2692
- const { ref: o } = et(), c = h.useRef(null);
2693
- return h.useEffect(() => {
2694
- o != null && o.current && o.current.focus();
2695
- }, [o]), /* @__PURE__ */ i.jsxs(
2696
- "div",
2697
- A(w({
2698
- tabIndex: 0,
2699
- ref: c,
2700
- id: "dialogTitle",
2701
- className: N("dialog__header__title", n)
2702
- }, l), {
2703
- children: [
2704
- s && /* @__PURE__ */ i.jsx("span", { className: "dialog__header__icon", children: s }),
2705
- r
2706
- ]
2707
- })
2708
- );
2709
- }, Oi = (e) => {
2710
- var t = e, { children: s } = t, r = L(t, ["children"]);
2711
- const { ref: n } = et();
2712
- return /* @__PURE__ */ i.jsx(Be, A(w({ onClick: () => {
2713
- var l;
2714
- return (l = n == null ? void 0 : n.current) == null ? void 0 : l.showModal();
2715
- } }, r), { children: s }));
2716
- }, $ = ({ defaultOpen: e, isModal: t, children: s, onClose: r }) => /* @__PURE__ */ i.jsx(Ei, { defaultOpen: !!e, isModal: t, onClose: r, children: s });
2717
- $.Trigger = Oi;
2718
- $.Root = Si;
2719
- $.Title = ki;
2720
- $.Header = Ni;
2721
- $.Body = ji;
2722
- $.Footer = Ai;
2723
- $.Button = Pi;
2724
- $.Close = Ps;
2725
- var As = h.createContext(void 0), Mi = ({
2726
- id: e,
2727
- position: t,
2728
- isOpen: s,
2729
- setIsOpen: r,
2730
- activeItemIndex: n,
2731
- setActiveItemIndex: l,
2732
- clearActiveItemIndex: o,
2733
- triggerRef: c,
2734
- contentRef: m,
2735
- children: y
2736
- }) => /* @__PURE__ */ i.jsx(
2737
- As.Provider,
2738
- {
2739
- value: {
2740
- id: e,
2741
- position: t,
2742
- isOpen: s,
2743
- setIsOpen: r,
2744
- activeItemIndex: n,
2745
- setActiveItemIndex: l,
2746
- clearActiveItemIndex: o,
2747
- triggerRef: c,
2748
- contentRef: m
2749
- },
2750
- children: y
2751
- }
2752
- ), Ns = () => {
2753
- const e = h.useContext(As);
2754
- if (e === void 0)
2755
- throw new Error("useMenu must be used within a MenuProvider");
2756
- return e;
2757
- }, Li = ({ as: e, children: t }) => {
2758
- const {
2759
- id: s,
2760
- position: r,
2761
- isOpen: n,
2762
- setIsOpen: l,
2763
- activeItemIndex: o,
2764
- setActiveItemIndex: c,
2765
- clearActiveItemIndex: m,
2766
- triggerRef: y,
2767
- contentRef: d
2768
- } = Ns(), v = (u) => {
2769
- var p;
2770
- if (!n)
2771
- return;
2772
- if (u.key === "Escape")
2773
- return m(), l(!1), (p = y.current) == null ? void 0 : p.focus();
2774
- const E = u.shiftKey, S = Os(d.current).length - 1;
2775
- switch (u.key) {
2776
- case "Tab": {
2777
- if (E && o !== 0)
2778
- return u.preventDefault(), c(o ? Math.max(0, o - 1) : 0);
2779
- if (!E && o !== S) {
2780
- u.preventDefault();
2781
- const j = o !== void 0 ? o + 1 : 0;
2782
- return c(Math.min(S, j));
2783
- }
2784
- break;
2785
- }
2786
- case "ArrowUp":
2787
- case "ArrowLeft":
2788
- return u.preventDefault(), c(o ? Math.max(0, o - 1) : 0);
2789
- case "ArrowDown":
2790
- case "ArrowRight": {
2791
- u.preventDefault();
2792
- const j = o !== void 0 ? o + 1 : 0;
2793
- return c(Math.min(S, j));
2794
- }
2795
- case "Home":
2796
- return u.preventDefault(), c(0);
2797
- case "End":
2798
- return u.preventDefault(), c(S);
2799
- }
2800
- };
2801
- return e ? h.createElement(
2802
- e,
2803
- {
2804
- id: `${s}-content`,
2805
- ref: d,
2806
- className: N("menu__list", `menu__list--${r}`, n && "menu__list--active"),
2807
- onKeyDown: v
2808
- },
2809
- t
2810
- ) : (
2811
- // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
2812
- /* @__PURE__ */ i.jsx(
2813
- "ul",
2814
- {
2815
- id: `${s}-content`,
2816
- ref: d,
2817
- className: N("menu__list", `menu__list--${r}`, n && "menu__list--active"),
2818
- onKeyDown: v,
2819
- children: t
2820
- }
2821
- )
2822
- );
2823
- }, Fi = (e) => {
2824
- var t = e, { children: s, className: r } = t, n = L(t, ["children", "className"]);
2825
- return /* @__PURE__ */ i.jsx("li", A(w({}, n), { className: N("menu__list-item", r), children: s }));
2826
- }, ks = ({ children: e, className: t }) => {
2827
- const { id: s, isOpen: r, setIsOpen: n, clearActiveItemIndex: l, setActiveItemIndex: o, triggerRef: c } = Ns(), m = () => {
2828
- l(), n((d) => !d), r || o(0);
2829
- }, y = (d) => {
2830
- if (r) {
2831
- if (d.key === "Escape")
2832
- return l(), n(!1);
2833
- d.key === "ArrowDown" && (d.preventDefault(), o(0));
2834
- }
2835
- };
2836
- return h.cloneElement(e, {
2837
- id: `${s}-trigger`,
2838
- ref: c,
2839
- className: N("menu__trigger", t),
2840
- onClick: m,
2841
- onKeyDown: y,
2842
- "aria-expanded": r,
2843
- "aria-controls": `${s}-content`
2844
- });
2845
- };
2846
- ks.displayName = "Trigger";
2847
- var Os = (e) => e ? e.tagName === "UL" ? e.children : Array.from(e.getElementsByTagName("ul")).reduce((s, r) => [...s, ...Array.from(r.getElementsByTagName("li"))], []) : [], q = (e) => {
2848
- var t = e, { type: s, id: r, position: n = "bottom-end", children: l, className: o } = t, c = L(t, ["type", "id", "position", "children", "className"]);
2849
- const m = h.useRef(null), y = h.useRef(null), d = h.useRef(null), [v, u] = h.useState(!1), [p, E] = h.useState(), [S, j] = h.useState(p);
2850
- p !== S && p !== void 0 && d.current && (Os(d.current)[p].firstChild.focus(), j(p));
2851
- const x = () => {
2852
- E(void 0), j(void 0);
2853
- }, C = (_) => {
2854
- var O;
2855
- ((O = m.current) == null ? void 0 : O.contains(_.relatedTarget)) || (x(), u(!1));
2856
- };
2857
- return /* @__PURE__ */ i.jsx(
2858
- Mi,
2859
- {
2860
- id: r,
2861
- position: n,
2862
- isOpen: v,
2863
- setIsOpen: u,
2864
- activeItemIndex: p,
2865
- setActiveItemIndex: E,
2866
- clearActiveItemIndex: x,
2867
- triggerRef: y,
2868
- contentRef: d,
2869
- children: h.createElement(
2870
- s,
2871
- A(w({}, c), {
2872
- id: r,
2873
- ref: m,
2874
- className: `menu ${o || ""}`,
2875
- onBlur: C
2876
- }),
2877
- l
2878
- )
2879
- }
2880
- );
2881
- };
2882
- q.Trigger = ks;
2883
- q.Content = Li;
2884
- q.Item = Fi;
2885
- h.createContext(void 0);
2886
- var Ri = (/* @__PURE__ */ new Map()).set("BE", "32").set("FR", "33").set("NL", "31").set("LU", "352").set("DE", "49").set("CA", "1").set("PR", "1").set("TC", "1").set("US", "1").set("BS", "1242").set("BB", "1246").set("AI", "1264").set("AG", "1268").set("KY", "1345").set("BM", "1441").set("GD", "1473").set("MS", "1664").set("GU", "1671").set("LC", "1758").set("DM", "1767").set("VC", "1784").set("DO", "1809").set("TT", "1868").set("KN", "1869").set("JM", "1876").set("EG", "20").set("SS", "211").set("MA", "212").set("DZ", "213").set("TN", "216").set("LY", "218").set("GM", "220").set("SN", "221").set("MR", "222").set("ML", "223").set("GN", "224").set("CI", "225").set("BF", "226").set("NE", "227").set("TG", "228").set("BJ", "229").set("MU", "230").set("LR", "231").set("SL", "232").set("GH", "233").set("NG", "234").set("TD", "235").set("CF", "236").set("CM", "237").set("CV", "238").set("ST", "239").set("GQ", "240").set("GA", "241").set("CG", "242").set("CD", "243").set("AO", "244").set("GW", "245").set("SC", "248").set("SD", "249").set("RW", "250").set("ET", "251").set("SO", "252").set("DJ", "253").set("KE", "254").set("TZ", "255").set("UG", "256").set("BI", "257").set("MZ", "258").set("ZM", "260").set("MG", "261").set("RE", "262").set("ZW", "263").set("NA", "264").set("MW", "265").set("LS", "266").set("BW", "267").set("SZ", "268").set("KM", "269").set("ZA", "27").set("VG", "284").set("ER", "291").set("AW", "297").set("FO", "298").set("GL", "299").set("GR", "30").set("ES", "34").set("GI", "350").set("PT", "351").set("IE", "353").set("IS", "354").set("AL", "355").set("MT", "356").set("CY", "357").set("FI", "358").set("BG", "359").set("HU", "36").set("LT", "370").set("LV", "371").set("EE", "372").set("MD", "373").set("AM", "374").set("BY", "375").set("AD", "376").set("MC", "377").set("SM", "378").set("UA", "380").set("RS", "381").set("ME", "382").set("HR", "385").set("SI", "386").set("BA", "387").set("MK", "389").set("IT", "39").set("RO", "40").set("CH", "41").set("CZ", "420").set("SK", "421").set("LI", "423").set("AT", "43").set("GB", "44").set("DK", "45").set("SE", "46").set("NO", "47").set("PL", "48").set("FK", "500").set("BZ", "501").set("GT", "502").set("SV", "503").set("HN", "504").set("NI", "505").set("CR", "506").set("PA", "507").set("PM", "508").set("HT", "509").set("PE", "51").set("MX", "52").set("CU", "53").set("AR", "54").set("BR", "55").set("CL", "56").set("CO", "57").set("VE", "58").set("GP", "590").set("BO", "591").set("GY", "592").set("EC", "593").set("FG", "594").set("PY", "595").set("MQ", "596").set("SR", "597").set("UY", "598").set("CW", "599").set("AN", "599").set("MY", "60").set("AU", "61").set("ID", "62").set("PH", "63").set("NZ", "64").set("SG", "65").set("TH", "66").set("TP", "670").set("BN", "673").set("PG", "675").set("TO", "676").set("SB", "677").set("VU", "678").set("FJ", "679").set("PW", "680").set("CK", "682").set("NU", "683").set("AS", "684").set("WS", "685").set("KI", "686").set("NC", "687").set("TV", "688").set("PF", "689").set("FM", "691").set("KZ", "7").set("RU", "7").set("JP", "81").set("KR", "82").set("VN", "84").set("KP", "850").set("HK", "852").set("MO", "853").set("KH", "855").set("LA", "856").set("CN", "86").set("BD", "880").set("TW", "886").set("TR", "90").set("IN", "91").set("PK", "92").set("AF", "93").set("LK", "94").set("MM", "95").set("MV", "960").set("LB", "961").set("JO", "962").set("SY", "963").set("IQ", "964").set("KW", "965").set("SA", "966").set("YE", "967").set("OM", "968").set("PS", "970").set("AE", "971").set("IL", "972").set("BH", "973").set("QA", "974").set("BT", "975").set("MN", "976").set("NP", "977").set("IR", "98").set("TK", "992").set("TM", "993").set("AZ", "994").set("GE", "995").set("KG", "996").set("UZ", "998");
2887
- [...new Set(Ri.values())].map((e) => ({
2888
- label: `+${e}`,
2889
- value: e
2890
- }));
2891
- h.createContext(void 0);
2892
- h.createContext(void 0);
2893
- var lt = /* @__PURE__ */ ((e) => (e[e.categoriesVegetables = 0] = "categoriesVegetables", e[e.categoriesMeat = 1] = "categoriesMeat", e[e.categoriesFish = 2] = "categoriesFish", e[e.categoriesDairy = 3] = "categoriesDairy", e[e.categoriesBreakfast = 4] = "categoriesBreakfast", e[e.categoriesSnacks = 5] = "categoriesSnacks", e[e.categoriesCandy = 6] = "categoriesCandy", e[e.categoriesNonFood = 7] = "categoriesNonFood", e[e.categoriesDryFood = 8] = "categoriesDryFood", e[e.categoriesTins = 9] = "categoriesTins", e[e.categoriesGrid = 10] = "categoriesGrid", e[e.categoriesSoda = 11] = "categoriesSoda", e[e.categoriesBakery = 12] = "categoriesBakery", e[e.categoriesWine = 13] = "categoriesWine", e[e.categoriesBaby = 14] = "categoriesBaby", e[e.categoriesDiet = 15] = "categoriesDiet", e[e.categoriesHygiene = 16] = "categoriesHygiene", e[e.categoriesCleaning = 17] = "categoriesCleaning", e[e.categoriesPets = 18] = "categoriesPets", e[e.categoriesFreezer = 19] = "categoriesFreezer", e[e.categoriesBbq = 20] = "categoriesBbq", e[e.categoriesMealbox = 21] = "categoriesMealbox", e[e.categoriesBrik = 22] = "categoriesBrik", e[e.categoriesGranen = 23] = "categoriesGranen", e[e.categoriesConserve = 24] = "categoriesConserve", e[e.categoriesHome = 25] = "categoriesHome", e[e.categoriesEaster = 26] = "categoriesEaster", e[e.categoriesOnlinePromo = 27] = "categoriesOnlinePromo", e[e.categoriesSportFood = 28] = "categoriesSportFood", e[e.categoriesClothing = 29] = "categoriesClothing", e[e.categoriesEnergy = 30] = "categoriesEnergy", e[e.categoriesDeskAndTravel = 31] = "categoriesDeskAndTravel", e[e.categoriesCigarette = 32] = "categoriesCigarette", e[e.categoriesFood = 33] = "categoriesFood", e[e.categoriesChild = 34] = "categoriesChild", e[e.categoriesPuzzle = 35] = "categoriesPuzzle", e[e.categoriesToys = 36] = "categoriesToys", e[e.categoriesCar = 37] = "categoriesCar", e[e.categoriesPlaceholder = 38] = "categoriesPlaceholder", e[e.categoriesFuel = 39] = "categoriesFuel", e[e.categoriesCarAndBike = 40] = "categoriesCarAndBike", e[e.categoriesToyAndHobby = 41] = "categoriesToyAndHobby", e[e.categoriesMultimedia = 42] = "categoriesMultimedia", e[e.categoriesParty = 43] = "categoriesParty", e[e.toolsPay = 44] = "toolsPay", e[e.toolsReceipt = 45] = "toolsReceipt", e[e.toolsFuel = 46] = "toolsFuel", e[e.toolsStoreLocator = 47] = "toolsStoreLocator", e[e.toolsStats = 48] = "toolsStats", e[e.toolsShowXtraOld = 49] = "toolsShowXtraOld", e[e.toolsShowXtraNew = 50] = "toolsShowXtraNew", e[e.toolsScan2 = 51] = "toolsScan2", e[e.toolsRecipes2 = 52] = "toolsRecipes2", e[e.toolsWarranty = 53] = "toolsWarranty", e[e.toolsCoupons = 54] = "toolsCoupons", e[e.toolsFavoriteInactive = 55] = "toolsFavoriteInactive", e[e.toolsFavoriteActive = 56] = "toolsFavoriteActive", e[e.toolsAssortment = 57] = "toolsAssortment", e[e.toolsPromo = 58] = "toolsPromo", e[e.fuelCng = 59] = "fuelCng", e[e.fuelE5 = 60] = "fuelE5", e[e.fuelAdblue = 61] = "fuelAdblue", e[e.fuelB7 = 62] = "fuelB7", e[e.fuelH2 = 63] = "fuelH2", e[e.fuelE10 = 64] = "fuelE10", e[e.fuelFreeTireInflation = 65] = "fuelFreeTireInflation", e[e.functionalClose = 66] = "functionalClose", e[e.functionalBack = 67] = "functionalBack", e[e.functionalSearch = 68] = "functionalSearch", e[e.functionalEdit = 69] = "functionalEdit", e[e.functionalShare = 70] = "functionalShare", e[e.functionalLocation = 71] = "functionalLocation", e[e.functionalTrash = 72] = "functionalTrash", e[e.functionalCamera = 73] = "functionalCamera", e[e.functionalPhone = 74] = "functionalPhone", e[e.functionalPushNotifications = 75] = "functionalPushNotifications", e[e.functionalMail = 76] = "functionalMail", e[e.functionalGift = 77] = "functionalGift", e[e.functionalPresent = 78] = "functionalPresent", e[e.functionalLoading = 79] = "functionalLoading", e[e.functionalChevronRight = 80] = "functionalChevronRight", e[e.functionalCheck = 81] = "functionalCheck", e[e.functionalChevronDown = 82] = "functionalChevronDown", e[e.functionalChevronUp = 83] = "functionalChevronUp", e[e.functionalPlus = 84] = "functionalPlus", e[e.functionalReset = 85] = "functionalReset", e[e.functionalDownload = 86] = "functionalDownload", e[e.functionalExport = 87] = "functionalExport", e[e.functionalCustomerService = 88] = "functionalCustomerService", e[e.functionalTruck = 89] = "functionalTruck", e[e.functionalBox = 90] = "functionalBox", e[e.functionalEllipsis = 91] = "functionalEllipsis", e[e.functionalLocationHome = 92] = "functionalLocationHome", e[e.functionalLocationPickup = 93] = "functionalLocationPickup", e[e.functionalAccount = 94] = "functionalAccount", e[e.functionalPrivacy = 95] = "functionalPrivacy", e[e.functionalSettings = 96] = "functionalSettings", e[e.functionalUserInfo = 97] = "functionalUserInfo", e[e.functionalPinOutlines = 98] = "functionalPinOutlines", e[e.functionalCalendar = 99] = "functionalCalendar", e[e.functionalMinus = 100] = "functionalMinus", e[e.functionalLifestyle = 101] = "functionalLifestyle", e[e.functionalSms = 102] = "functionalSms", e[e.functionalSwitch = 103] = "functionalSwitch", e[e.functionalSorting = 104] = "functionalSorting", e[e.functionalWarningCircle = 105] = "functionalWarningCircle", e[e.functionalQuestionCircle = 106] = "functionalQuestionCircle", e[e.functionalErrorCircle = 107] = "functionalErrorCircle", e[e.functionalSuccessCircle = 108] = "functionalSuccessCircle", e[e.functionalMessage = 109] = "functionalMessage", e[e.functionalExternalLink = 110] = "functionalExternalLink", e[e.functionalAddToList = 111] = "functionalAddToList", e[e.functionalShoppingcart = 112] = "functionalShoppingcart", e[e.functionalFilter = 113] = "functionalFilter", e[e.functionalLocate = 114] = "functionalLocate", e[e.functionalBarcode = 115] = "functionalBarcode", e[e.functionalClock = 116] = "functionalClock", e[e.functionalHistory = 117] = "functionalHistory", e[e.functionalShops = 118] = "functionalShops", e[e.functionalAddUser = 119] = "functionalAddUser", e[e.functionalOther = 120] = "functionalOther", e[e.functionalInAppNotifications = 121] = "functionalInAppNotifications", e[e.functionalExit = 122] = "functionalExit", e[e.functionalShared = 123] = "functionalShared", e[e.functionalThumbsup = 124] = "functionalThumbsup", e[e.functionalDiscount = 125] = "functionalDiscount", e[e.functionalPercentage = 126] = "functionalPercentage", e[e.functionalList = 127] = "functionalList", e[e.functionalMapLocation = 128] = "functionalMapLocation", e[e.functionalNoConnection = 129] = "functionalNoConnection", e[e.functionalSwap = 130] = "functionalSwap", e[e.functionalPiece = 131] = "functionalPiece", e[e.functionalWeight = 132] = "functionalWeight", e[e.functionalPack = 133] = "functionalPack", e[e.functionalCommunications = 134] = "functionalCommunications", e[e.functionalDeliveryAddresses = 135] = "functionalDeliveryAddresses", e[e["functional18+"] = 136] = "functional18+", e[e.functionalReadtime = 137] = "functionalReadtime", e[e.functionalCopy = 138] = "functionalCopy", e[e.functionalMessageField = 139] = "functionalMessageField", e[e.functionalNext = 140] = "functionalNext", e[e.functionalSave = 141] = "functionalSave", e[e.functionalLogin = 142] = "functionalLogin", e[e.functionalLogout = 143] = "functionalLogout", e[e.functionalWebsite = 144] = "functionalWebsite", e[e.functionalMenu = 145] = "functionalMenu", e[e.functionalRegister = 146] = "functionalRegister", e[e.functionalNews = 147] = "functionalNews", e[e.functionalTimer = 148] = "functionalTimer", e[e.functionalEyeShow = 149] = "functionalEyeShow", e[e.functionalMobilePay = 150] = "functionalMobilePay", e[e.functionalConnectionCable = 151] = "functionalConnectionCable", e[e.functionalDryCleaning = 152] = "functionalDryCleaning", e[e.functionalKiosk = 153] = "functionalKiosk", e[e.functionalConnectedDevice = 154] = "functionalConnectedDevice", e[e.functionalCookies = 155] = "functionalCookies", e[e.functionalViewFile = 156] = "functionalViewFile", e[e.functionalLastAdded = 157] = "functionalLastAdded", e[e.functionalFirstAdded = 158] = "functionalFirstAdded", e[e.functionalStoreLayout = 159] = "functionalStoreLayout", e[e.functionalBlock = 160] = "functionalBlock", e[e.functionalChecklist = 161] = "functionalChecklist", e[e.functionalCartCheckout = 162] = "functionalCartCheckout", e[e.functionalCartEdit = 163] = "functionalCartEdit", e[e.functionalEyeHidden = 164] = "functionalEyeHidden", e[e.functionalWarningCircleFilled = 165] = "functionalWarningCircleFilled", e[e.functionalErrorCircleFilled = 166] = "functionalErrorCircleFilled", e[e.functionalSuccessCircleFilled = 167] = "functionalSuccessCircleFilled", e[e.functionalPlusCircle = 168] = "functionalPlusCircle", e[e.functionalSpinner = 169] = "functionalSpinner", e[e.functionalEcoEarth = 170] = "functionalEcoEarth", e[e.functionalAlphaBeta = 171] = "functionalAlphaBeta", e[e.functionalEuro = 172] = "functionalEuro", e[e.functionalNumber = 173] = "functionalNumber", e[e.functionalIdea = 174] = "functionalIdea", e[e.functionalMultifactorAuthenticator = 175] = "functionalMultifactorAuthenticator", e[e.functionalPassword = 176] = "functionalPassword", e[e.functionalDiscountCode = 177] = "functionalDiscountCode", e))(lt || {});
2894
- const Di = "/icons/bouMenuIcons.svg", Ti = ({
2895
- bouIconId: e,
2896
- ...t
2897
- }) => /* @__PURE__ */ i.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i.jsx("use", { href: `${Di}#${lt[e]}` }) }), Pt = (e) => typeof e.icon == "string" && e.icon in lt ? /* @__PURE__ */ i.jsx(Ti, { bouIconId: lt[e.icon] }) : e.icon, Ui = ({
2898
- label: e,
2899
- className: t,
2900
- onClick: s,
2901
- icon: r
2902
- }) => /* @__PURE__ */ i.jsx(q.Item, { className: t, children: /* @__PURE__ */ i.jsxs("button", { onClick: s, children: [
2903
- /* @__PURE__ */ i.jsx(Pt, { icon: r }),
2904
- e
2905
- ] }) }), we = (e) => {
2906
- const t = $s(), { className: s, label: r, mobileUrl: n, desktopUrl: l, icon: o } = e;
2907
- return /* @__PURE__ */ i.jsxs(q.Item, { className: s, children: [
2908
- (!t || t && !l) && /* @__PURE__ */ i.jsxs("a", { href: n, referrerPolicy: "no-referrer-when-downgrade", children: [
2909
- /* @__PURE__ */ i.jsx(Pt, { icon: o }),
2910
- r
2911
- ] }),
2912
- !!l && /* @__PURE__ */ i.jsxs("a", { href: l, referrerPolicy: "no-referrer-when-downgrade", children: [
2913
- /* @__PURE__ */ i.jsx(Pt, { icon: o }),
2914
- r
2915
- ] })
2916
- ] });
2917
- }, Ms = h.createContext(void 0), Qi = ({ position: e, bouMenuItems: t, children: s }) => /* @__PURE__ */ i.jsx(Ms.Provider, { value: { position: e, bouMenuItems: t }, children: s }), Ls = () => {
2918
- const e = h.useContext(Ms);
2919
- if (!e)
2920
- throw new Error("Authentication context can not be rendered outside of Authentication");
2921
- return e;
2922
- }, Fs = h.createContext(void 0), Hi = ({ apiUrl: e, redirectUrl: t, children: s }) => /* @__PURE__ */ i.jsx(Fs.Provider, { value: { apiUrl: e, redirectUrl: t }, children: s }), Ft = () => {
2923
- const e = h.useContext(Fs);
2924
- if (!e)
2925
- throw new Error("Api context can not be rendered outside of Api");
2926
- return e;
2927
- }, Rs = ({ apiUrl: e, redirectUrl: t, trackingInfo: s }) => {
2928
- const r = new URLSearchParams({ redirectUrl: t });
2929
- s && r.append("trackingInfo", s);
2930
- const n = `${e}/login?${r.toString()}`, l = `${e}/logout?${r.toString()}`;
2931
- return { loginUrl: n, logoutUrl: l };
2932
- }, ut = () => {
2933
- const { apiUrl: e, redirectUrl: t } = Ft(), s = Ks();
2934
- return Rs({ apiUrl: e, redirectUrl: t, trackingInfo: s });
2935
- }, $i = () => {
2936
- const { apiUrl: e } = Ft();
2937
- return `${`${e}/xtra`}/authentication/v1/user/profile`;
2938
- }, Vt = (e) => e ? `+${e.countryCode} ${e.number}` : "", Wt = (e, t) => t == null ? void 0 : t.find((s) => s.type === e), Zt = ({ apiUrl: e, redirectUrl: t }) => {
2939
- const { loginUrl: s } = Rs({ apiUrl: e, redirectUrl: t });
2940
- window.location.replace(s);
2941
- }, Yt = (e) => {
2942
- var l;
2943
- if (!e)
2944
- return { user: { state: () => "NotAuthenticated" }, tryToLogon: Zt };
2945
- const t = new Date(e.dateOfBirth), s = Wt(Rt.Mobile, e.phone), r = Wt(Rt.Fixed, e.phone), n = Vt(s) ?? Vt(r) ?? "";
2946
- return {
2947
- user: {
2948
- ...(l = window.XTRA) == null ? void 0 : l.user,
2949
- firstName: () => e.firstName,
2950
- lastName: () => e.lastName,
2951
- dob: () => t.getDate(),
2952
- mob: () => t.getMonth() + 1,
2953
- yob: () => t.getFullYear(),
2954
- gender: () => e.genderCode,
2955
- phone: () => n,
2956
- streetName: () => {
2957
- var o;
2958
- return (o = e.address) == null ? void 0 : o.streetName;
2959
- },
2960
- houseNr: () => {
2961
- var o;
2962
- return (o = e.address) == null ? void 0 : o.houseNumber;
2963
- },
2964
- box: () => {
2965
- var o;
2966
- return (o = e.address) == null ? void 0 : o.letterBoxName;
2967
- },
2968
- zip: () => {
2969
- var o;
2970
- return (o = e.address) == null ? void 0 : o.postalCode;
2971
- },
2972
- city: () => {
2973
- var o;
2974
- return (o = e.address) == null ? void 0 : o.locationName;
2975
- },
2976
- country: () => {
2977
- var o;
2978
- return (o = e.address) == null ? void 0 : o.countryCode;
2979
- },
2980
- email: () => e.email,
2981
- cbh: () => e.customerIdentifier,
2982
- state: () => "Authenticated"
2983
- },
2984
- tryToLogon: Zt
2985
- };
2986
- }, Ds = ["profile"], Ts = () => {
2987
- const { i18n: e } = be(), t = $i(), s = sessionStorage.getItem("profile"), r = !!s;
2988
- return Cs({
2989
- queryKey: Ds,
2990
- queryFn: async () => {
2991
- const l = await fetch(t, {
2992
- credentials: "include",
2993
- mode: "cors",
2994
- headers: { "Accept-Language": e.language }
2995
- });
2996
- if (!l.ok) {
2997
- if (l.status === 401)
2998
- return window.XTRA = { ...window.XTRA, ...Yt() }, window.postMessage(
2999
- { source: "xtra-authentication", isAuthenticated: !1 },
3000
- new URL(window.location.href).origin
3001
- ), sessionStorage.removeItem("profile"), { authenticationStatus: "NotAuthenticated" };
3002
- if (r)
3003
- return { authenticationStatus: "Authenticated", profile: JSON.parse(s) };
3004
- throw new Error("Failed to retrieve profile");
3005
- }
3006
- const o = await l.json(), { firstName: c, lastName: m } = o;
3007
- return sessionStorage.setItem("profile", JSON.stringify({ firstName: c, lastName: m })), window.postMessage(
3008
- { source: "xtra-authentication", isAuthenticated: !0 },
3009
- new URL(window.location.href).origin
3010
- ), window.XTRA = { ...window.XTRA, ...Yt(o) }, {
3011
- authenticationStatus: "Authenticated",
3012
- profile: { firstName: o.firstName, lastName: o.lastName }
3013
- };
3014
- },
3015
- initialData: r ? {
3016
- authenticationStatus: "Authenticated",
3017
- profile: JSON.parse(s)
3018
- } : void 0,
3019
- placeholderData: { authenticationStatus: "Pending" },
3020
- refetchOnWindowFocus: !1
3021
- });
3022
- }, Ki = () => {
3023
- const { t: e } = be(), t = ns(), { position: s, bouMenuItems: r } = Ls(), { logoutUrl: n } = ut(), o = Mt().getQueryData(Ds), c = (o == null ? void 0 : o.profile.firstName) ?? "", m = (o == null ? void 0 : o.profile.lastName) ?? "", y = () => {
3024
- sessionStorage.removeItem("profile"), window.location.href = n;
3025
- };
3026
- return /* @__PURE__ */ i.jsxs(q, { type: "nav", id: "xtra-menu", position: s, children: [
3027
- /* @__PURE__ */ i.jsx(
3028
- q.Trigger,
3029
- {
3030
- className: N(
3031
- "button",
3032
- "button--neutral",
3033
- "button--authentication",
3034
- "button--authentication--authenticated"
3035
- ),
3036
- children: /* @__PURE__ */ i.jsxs("button", { children: [
3037
- /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Rr, { variant: "small", firstName: c, lastName: m }) }),
3038
- /* @__PURE__ */ i.jsx("span", { className: "button__label", children: c }),
3039
- /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Lt, {}) })
3040
- ] })
3041
- }
3042
- ),
3043
- /* @__PURE__ */ i.jsxs(q.Content, { as: "div", children: [
3044
- !!r && r.length > 0 && /* @__PURE__ */ i.jsx("ul", { className: "bou-menu__list", children: r.map(({ label: d, icon: v, url: u }, p) => /* @__PURE__ */ i.jsx(
3045
- we,
3046
- {
3047
- className: "bou-menu-item",
3048
- mobileUrl: u,
3049
- icon: v,
3050
- label: d
3051
- },
3052
- p
3053
- )) }),
3054
- /* @__PURE__ */ i.jsxs("ul", { children: [
3055
- /* @__PURE__ */ i.jsx(
3056
- we,
3057
- {
3058
- className: "manage-profile",
3059
- mobileUrl: `${t}/manage-profile`,
3060
- desktopUrl: `${t}/manage-profile/personal-data`,
3061
- icon: /* @__PURE__ */ i.jsx(Xr, {}),
3062
- label: e("manageProfile")
3063
- }
3064
- ),
3065
- /* @__PURE__ */ i.jsx(
3066
- we,
3067
- {
3068
- className: "payment",
3069
- mobileUrl: `${t}/payment`,
3070
- icon: /* @__PURE__ */ i.jsx(li, {}),
3071
- label: e("payment")
3072
- }
3073
- ),
3074
- /* @__PURE__ */ i.jsx(
3075
- we,
3076
- {
3077
- className: "gift-cards",
3078
- mobileUrl: `${t}/gift-cards`,
3079
- icon: /* @__PURE__ */ i.jsx(ai, {}),
3080
- label: e("giftCards")
3081
- }
3082
- ),
3083
- /* @__PURE__ */ i.jsx(
3084
- we,
3085
- {
3086
- mobileUrl: `${t}/identifiers`,
3087
- icon: /* @__PURE__ */ i.jsx(ui, {}),
3088
- label: e("qrCode")
3089
- }
3090
- ),
3091
- /* @__PURE__ */ i.jsx(
3092
- we,
3093
- {
3094
- className: "manage-privacy",
3095
- mobileUrl: `${t}/manage-privacy`,
3096
- desktopUrl: `${t}/manage-privacy/permissions`,
3097
- icon: /* @__PURE__ */ i.jsx(zr, {}),
3098
- label: e("privacy")
3099
- }
3100
- ),
3101
- /* @__PURE__ */ i.jsx(Ui, { onClick: y, icon: /* @__PURE__ */ i.jsx(Zr, {}), label: e("logout") })
3102
- ] })
3103
- ] })
3104
- ] });
3105
- }, qi = () => {
3106
- const { t: e } = be();
3107
- return /* @__PURE__ */ i.jsxs("button", { className: N("button", "button--neutral", "button--authentication"), children: [
3108
- /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx("i", { className: "spinner" }) }),
3109
- /* @__PURE__ */ i.jsxs("span", { className: "button__label", children: [
3110
- e("loading"),
3111
- "..."
3112
- ] })
3113
- ] });
3114
- }, Gi = ({ className: e }) => {
3115
- const { t } = be(), { loginUrl: s } = ut();
3116
- return /* @__PURE__ */ i.jsxs(
3117
- "a",
3118
- {
3119
- href: s,
3120
- className: N(
3121
- "button",
3122
- "button--neutral",
3123
- "button--authentication",
3124
- "button--authentication--unauthenticated",
3125
- e
3126
- ),
3127
- children: [
3128
- /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(js, { width: 24, height: 24, suffix: "desktop" }) }),
3129
- /* @__PURE__ */ i.jsx("span", { className: "button__label", children: t("login") }),
3130
- /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Lt, {}) })
3131
- ]
3132
- }
3133
- );
3134
- }, Vi = () => {
3135
- const { t: e } = be(), { loginUrl: t } = ut(), s = ns(), { position: r } = Ls();
3136
- return /* @__PURE__ */ i.jsxs(
3137
- q,
3138
- {
3139
- type: "nav",
3140
- id: "xtra-menu",
3141
- position: r,
3142
- className: "menu--unauthenticated",
3143
- "aria-label": e("xtraMenuAriaLabel"),
3144
- children: [
3145
- /* @__PURE__ */ i.jsx(q.Trigger, { className: N("button", "button--neutral", "button--authentication"), children: /* @__PURE__ */ i.jsxs("button", { children: [
3146
- /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(js, { width: 24, height: 24, suffix: "mobile" }) }),
3147
- /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Lt, {}) })
3148
- ] }) }),
3149
- /* @__PURE__ */ i.jsxs(q.Content, { children: [
3150
- /* @__PURE__ */ i.jsx(q.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: t, className: "button button--with-icon", children: [
3151
- /* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Vr, {}) }),
3152
- /* @__PURE__ */ i.jsx("span", { className: "button__label", children: e("login") })
3153
- ] }) }),
3154
- /* @__PURE__ */ i.jsx(q.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: `${s}/onboarding/register`, className: "button button--with-icon", children: [
3155
- /* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Br, {}) }),
3156
- /* @__PURE__ */ i.jsx("span", { className: "button__label", children: e("register") })
3157
- ] }) })
3158
- ] })
3159
- ]
3160
- }
3161
- );
3162
- }, Wi = () => {
3163
- var t, s;
3164
- const e = Ts();
3165
- return ((t = e.data) == null ? void 0 : t.authenticationStatus) === "Authenticated" ? /* @__PURE__ */ i.jsx(Ki, {}) : ((s = e.data) == null ? void 0 : s.authenticationStatus) === "NotAuthenticated" || e.isError ? /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
3166
- /* @__PURE__ */ i.jsx(Gi, {}),
3167
- /* @__PURE__ */ i.jsx(Vi, {})
3168
- ] }) : /* @__PURE__ */ i.jsx(qi, {});
3169
- }, Us = () => {
3170
- const { apiUrl: e } = Ft();
3171
- return `${`${e}/xtra`}/authentication/v1/gdpr`;
3172
- }, Zi = () => {
3173
- const e = Us(), t = new ps();
3174
- return Sr({
3175
- mutationFn: async (r) => {
3176
- const n = await fetch(`${e}/tc`, {
3177
- body: JSON.stringify({ acceptedTC: r }),
3178
- credentials: "include",
3179
- method: "POST",
3180
- mode: "cors"
3181
- });
3182
- if (!n.ok)
3183
- throw new Error("Network response was not ok");
3184
- return n;
3185
- },
3186
- onSuccess: async () => {
3187
- await t.invalidateQueries({ queryKey: ["gdpr"] });
3188
- }
3189
- });
3190
- }, Yi = () => {
3191
- var l;
3192
- const { i18n: e } = be(), t = Us(), r = ((l = Ts().data) == null ? void 0 : l.authenticationStatus) === "Authenticated";
3193
- return Cs({
3194
- queryKey: ["gdpr"],
3195
- queryFn: async () => {
3196
- const o = await fetch(`${t}/tc/check`, {
3197
- credentials: "include",
3198
- mode: "cors",
3199
- headers: { "Accept-Language": e.language }
3200
- });
3201
- if (!o.ok)
3202
- throw new Error("Network response was not ok");
3203
- return o.status === 204 ? [] : await o.json();
3204
- },
3205
- enabled: r
3206
- });
3207
- }, zi = () => {
3208
- var j;
3209
- const { t: e } = be();
3210
- qs({ element: "xtra-authentication" });
3211
- const { logoutUrl: t } = ut(), s = h.useRef(null), [r, n] = h.useState(0), [l, o] = h.useState({}), { mutate: c, isError: m } = Zi(), { AccessibleFormMessage: y, formRef: d } = Gs({ submitCount: r, errors: l }), v = Yi(), u = !!((j = v.data) != null && j.length), p = e("termsAndConditions.error.required"), E = () => {
3212
- var x;
3213
- (x = s == null ? void 0 : s.current) == null || x.click(), document.body.style.removeProperty("overflow");
3214
- };
3215
- h.useEffect(() => {
3216
- u && document.body.style.setProperty("overflow", "hidden");
3217
- }, [u]), h.useEffect(() => {
3218
- m && o({ acceptedTC: p });
3219
- }, [p, m]);
3220
- const S = (x) => {
3221
- x.preventDefault(), n(r + 1);
3222
- const { acceptedTC: C } = x.target;
3223
- if (C instanceof RadioNodeList) {
3224
- const _ = Object.values(C);
3225
- _.every((F) => F.checked) ? (o({}), c(_.map((F) => F.value)), E()) : o({ acceptedTC: p });
3226
- } else
3227
- C != null && C.checked ? (o({}), c([C.value]), E()) : o({ acceptedTC: p });
3228
- };
3229
- return u ? /* @__PURE__ */ i.jsxs($, { defaultOpen: u, isModal: !0, children: [
3230
- y,
3231
- /* @__PURE__ */ i.jsxs($.Root, { children: [
3232
- /* @__PURE__ */ i.jsx($.Header, { children: /* @__PURE__ */ i.jsx($.Title, { icon: /* @__PURE__ */ i.jsx("i", { className: "commerce__icon" }), children: /* @__PURE__ */ i.jsx(Bi, { children: e("termsAndConditions.title") }) }) }),
3233
- /* @__PURE__ */ i.jsx($.Body, { children: /* @__PURE__ */ i.jsxs(Qs, { ref: d, id: "tc-form", onSubmit: S, children: [
3234
- /* @__PURE__ */ i.jsxs(Xi, { children: [
3235
- e("termsAndConditions.description"),
3236
- l.acceptedTC && /* @__PURE__ */ i.jsx(en, { children: p })
3237
- ] }),
3238
- v.data.map(({ tcCode: x, title: C, URL: _ }) => /* @__PURE__ */ i.jsx(
3239
- xe,
3240
- {
3241
- id: x,
3242
- value: x,
3243
- name: "acceptedTC",
3244
- variant: "primary",
3245
- children: /* @__PURE__ */ i.jsxs(xe.Content, { children: [
3246
- /* @__PURE__ */ i.jsx(Ji, { children: C }),
3247
- /* @__PURE__ */ i.jsx(Ii, { href: _, children: e("termsAndConditions.action", { title: C }) })
3248
- ] })
3249
- },
3250
- x
3251
- ))
3252
- ] }) }),
3253
- /* @__PURE__ */ i.jsxs($.Footer, { children: [
3254
- /* @__PURE__ */ i.jsx(
3255
- "a",
3256
- {
3257
- className: N("button", "button--secondary", "button--terms-and-conditions"),
3258
- href: t,
3259
- children: e("logout")
3260
- }
3261
- ),
3262
- /* @__PURE__ */ i.jsx(Be, { form: "tc-form", type: "submit", variant: "primary", children: e("confirm") })
3263
- ] })
3264
- ] })
3265
- ] }) : /* @__PURE__ */ i.jsx(i.Fragment, {});
3266
- }, Ji = ({
3267
- children: e,
3268
- ...t
3269
- }) => /* @__PURE__ */ i.jsx(xe.Label, { className: "form--tc__label", ...t, children: e }), Qs = h.forwardRef(({ children: e, ...t }, s) => /* @__PURE__ */ i.jsx("form", { className: "form--tc", ref: s, ...t, children: e }));
3270
- Qs.displayName = "TermsAndConditionsForm";
3271
- const Xi = ({
3272
- children: e,
3273
- ...t
3274
- }) => /* @__PURE__ */ i.jsx("p", { className: "form--tc__description", ...t, children: e }), Ii = ({ children: e, ...t }) => /* @__PURE__ */ i.jsx(
3275
- "a",
3276
- {
3277
- className: "form--tc__link",
3278
- target: "_blank",
3279
- rel: "noreferrer",
3280
- role: "button",
3281
- download: !0,
3282
- ...t,
3283
- children: e
3284
- }
3285
- ), Bi = ({ children: e }) => /* @__PURE__ */ i.jsx("h1", { className: "form--tc__title", children: e }), en = ({ children: e, ...t }) => /* @__PURE__ */ i.jsx("span", { className: "form--tc__error", role: "alert", ...t, children: e }), tn = new ps(), nn = ({ environment: e, redirectUrl: t, apiUrl: s, position: r, commerceId: n, bouMenuItems: l }) => /* @__PURE__ */ i.jsx(Vs, { environment: e, children: /* @__PURE__ */ i.jsx(Ws, { commerceId: n, children: /* @__PURE__ */ i.jsx(Hi, { apiUrl: s, redirectUrl: t, children: /* @__PURE__ */ i.jsxs(dr, { client: tn, children: [
3286
- /* @__PURE__ */ i.jsx(Qi, { position: r, bouMenuItems: l, children: /* @__PURE__ */ i.jsx(Wi, {}) }),
3287
- /* @__PURE__ */ i.jsx(zi, {})
3288
- ] }) }) }) });
3289
- export {
3290
- nn as default
3291
- };