@myxtra/authentication-green 2.2.0 → 2.4.0

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.
@@ -0,0 +1,3294 @@
1
+ var he = (t, e, s) => {
2
+ if (!e.has(t))
3
+ throw TypeError("Cannot " + s);
4
+ };
5
+ var a = (t, e, s) => (he(t, e, "read from private field"), s ? s.call(t) : e.get(t)), g = (t, e, s) => {
6
+ if (e.has(t))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ e instanceof WeakSet ? e.add(t) : e.set(t, s);
9
+ }, f = (t, e, s, r) => (he(t, e, "write to private field"), r ? r.call(t, s) : e.set(t, s), s);
10
+ var ee = (t, e, s, r) => ({
11
+ set _(n) {
12
+ f(t, e, n, s);
13
+ },
14
+ get _() {
15
+ return a(t, e, r);
16
+ }
17
+ }), b = (t, e, s) => (he(t, e, "access private method"), s);
18
+ import { r as h, j as i, u as $s, a as Ks, b as bt, P as Re, c as ns, d as qs, e as Gs, E as Vs, C as Ws } from "./index-d3e6ee05.mjs";
19
+ var Ut = class {
20
+ constructor() {
21
+ this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
22
+ }
23
+ subscribe(t) {
24
+ return this.listeners.add(t), this.onSubscribe(), () => {
25
+ this.listeners.delete(t), this.onUnsubscribe();
26
+ };
27
+ }
28
+ hasListeners() {
29
+ return this.listeners.size > 0;
30
+ }
31
+ onSubscribe() {
32
+ }
33
+ onUnsubscribe() {
34
+ }
35
+ }, Tt = typeof window > "u" || "Deno" in globalThis;
36
+ function V() {
37
+ }
38
+ function Zs(t, e) {
39
+ return typeof t == "function" ? t(e) : t;
40
+ }
41
+ function fe(t) {
42
+ return typeof t == "number" && t >= 0 && t !== 1 / 0;
43
+ }
44
+ function as(t, e) {
45
+ return Math.max(t + (e || 0) - Date.now(), 0);
46
+ }
47
+ function De(t, e) {
48
+ const {
49
+ type: s = "all",
50
+ exact: r,
51
+ fetchStatus: n,
52
+ predicate: l,
53
+ queryKey: o,
54
+ stale: c
55
+ } = t;
56
+ if (o) {
57
+ if (r) {
58
+ if (e.queryHash !== Ae(o, e.options))
59
+ return !1;
60
+ } else if (!Ht(e.queryKey, o))
61
+ return !1;
62
+ }
63
+ if (s !== "all") {
64
+ const m = e.isActive();
65
+ if (s === "active" && !m || s === "inactive" && m)
66
+ return !1;
67
+ }
68
+ return !(typeof c == "boolean" && e.isStale() !== c || n && n !== e.state.fetchStatus || l && !l(e));
69
+ }
70
+ function Te(t, e) {
71
+ const { exact: s, status: r, predicate: n, mutationKey: l } = t;
72
+ if (l) {
73
+ if (!e.options.mutationKey)
74
+ return !1;
75
+ if (s) {
76
+ if (Ct(e.options.mutationKey) !== Ct(l))
77
+ return !1;
78
+ } else if (!Ht(e.options.mutationKey, l))
79
+ return !1;
80
+ }
81
+ return !(r && e.state.status !== r || n && !n(e));
82
+ }
83
+ function Ae(t, e) {
84
+ return ((e == null ? void 0 : e.queryKeyHashFn) || Ct)(t);
85
+ }
86
+ function Ct(t) {
87
+ return JSON.stringify(
88
+ t,
89
+ (e, s) => pe(s) ? Object.keys(s).sort().reduce((r, n) => (r[n] = s[n], r), {}) : s
90
+ );
91
+ }
92
+ function Ht(t, e) {
93
+ return t === e ? !0 : typeof t != typeof e ? !1 : t && e && typeof t == "object" && typeof e == "object" ? !Object.keys(e).some((s) => !Ht(t[s], e[s])) : !1;
94
+ }
95
+ function os(t, e) {
96
+ if (t === e)
97
+ return t;
98
+ const s = Ue(t) && Ue(e);
99
+ if (s || pe(t) && pe(e)) {
100
+ const r = s ? t : Object.keys(t), n = r.length, l = s ? e : Object.keys(e), 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 && t[d] === void 0 && e[d] === void 0 && r.includes(d) ? (c[d] = void 0, m++) : (c[d] = os(t[d], e[d]), c[d] === t[d] && t[d] !== void 0 && m++);
105
+ }
106
+ return n === o && m === n ? t : c;
107
+ }
108
+ return e;
109
+ }
110
+ function ie(t, e) {
111
+ if (!e || Object.keys(t).length !== Object.keys(e).length)
112
+ return !1;
113
+ for (const s in t)
114
+ if (t[s] !== e[s])
115
+ return !1;
116
+ return !0;
117
+ }
118
+ function Ue(t) {
119
+ return Array.isArray(t) && t.length === Object.keys(t).length;
120
+ }
121
+ function pe(t) {
122
+ if (!Qe(t))
123
+ return !1;
124
+ const e = t.constructor;
125
+ if (e === void 0)
126
+ return !0;
127
+ const s = e.prototype;
128
+ return !(!Qe(s) || !s.hasOwnProperty("isPrototypeOf"));
129
+ }
130
+ function Qe(t) {
131
+ return Object.prototype.toString.call(t) === "[object Object]";
132
+ }
133
+ function Ys(t) {
134
+ return new Promise((e) => {
135
+ setTimeout(e, t);
136
+ });
137
+ }
138
+ function me(t, e, s) {
139
+ return typeof s.structuralSharing == "function" ? s.structuralSharing(t, e) : s.structuralSharing !== !1 ? os(t, e) : e;
140
+ }
141
+ function zs(t, e, s = 0) {
142
+ const r = [...t, e];
143
+ return s && r.length > s ? r.slice(1) : r;
144
+ }
145
+ function Js(t, e, s = 0) {
146
+ const r = [e, ...t];
147
+ return s && r.length > s ? r.slice(0, -1) : r;
148
+ }
149
+ var Ne = Symbol(), ht, rt, jt, ze, Xs = (ze = class extends Ut {
150
+ constructor() {
151
+ super();
152
+ g(this, ht, void 0);
153
+ g(this, rt, void 0);
154
+ g(this, jt, void 0);
155
+ f(this, jt, (e) => {
156
+ if (!Tt && window.addEventListener) {
157
+ const s = () => e();
158
+ return window.addEventListener("visibilitychange", s, !1), () => {
159
+ window.removeEventListener("visibilitychange", s);
160
+ };
161
+ }
162
+ });
163
+ }
164
+ onSubscribe() {
165
+ a(this, rt) || this.setEventListener(a(this, jt));
166
+ }
167
+ onUnsubscribe() {
168
+ var e;
169
+ this.hasListeners() || ((e = a(this, rt)) == null || e.call(this), f(this, rt, void 0));
170
+ }
171
+ setEventListener(e) {
172
+ var s;
173
+ f(this, jt, e), (s = a(this, rt)) == null || s.call(this), f(this, rt, e((r) => {
174
+ typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
175
+ }));
176
+ }
177
+ setFocused(e) {
178
+ a(this, ht) !== e && (f(this, ht, e), this.onFocus());
179
+ }
180
+ onFocus() {
181
+ const e = this.isFocused();
182
+ this.listeners.forEach((s) => {
183
+ s(e);
184
+ });
185
+ }
186
+ isFocused() {
187
+ var e;
188
+ return typeof a(this, ht) == "boolean" ? a(this, ht) : ((e = globalThis.document) == null ? void 0 : e.visibilityState) !== "hidden";
189
+ }
190
+ }, ht = new WeakMap(), rt = new WeakMap(), jt = new WeakMap(), ze), ke = new Xs(), _t, it, St, Je, Is = (Je = class extends Ut {
191
+ constructor() {
192
+ super();
193
+ g(this, _t, !0);
194
+ g(this, it, void 0);
195
+ g(this, St, void 0);
196
+ f(this, St, (e) => {
197
+ if (!Tt && window.addEventListener) {
198
+ const s = () => e(!0), r = () => e(!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, it) || this.setEventListener(a(this, St));
207
+ }
208
+ onUnsubscribe() {
209
+ var e;
210
+ this.hasListeners() || ((e = a(this, it)) == null || e.call(this), f(this, it, void 0));
211
+ }
212
+ setEventListener(e) {
213
+ var s;
214
+ f(this, St, e), (s = a(this, it)) == null || s.call(this), f(this, it, e(this.setOnline.bind(this)));
215
+ }
216
+ setOnline(e) {
217
+ a(this, _t) !== e && (f(this, _t, e), this.listeners.forEach((r) => {
218
+ r(e);
219
+ }));
220
+ }
221
+ isOnline() {
222
+ return a(this, _t);
223
+ }
224
+ }, _t = new WeakMap(), it = new WeakMap(), St = new WeakMap(), Je), ne = new Is();
225
+ function Bs(t) {
226
+ return Math.min(1e3 * 2 ** t, 3e4);
227
+ }
228
+ function ls(t) {
229
+ return (t ?? "online") === "online" ? ne.isOnline() : !0;
230
+ }
231
+ var cs = class {
232
+ constructor(t) {
233
+ this.revert = t == null ? void 0 : t.revert, this.silent = t == null ? void 0 : t.silent;
234
+ }
235
+ };
236
+ function de(t) {
237
+ return t instanceof cs;
238
+ }
239
+ function us(t) {
240
+ let e = !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 = t.abort) == null || C.call(t));
246
+ }, y = () => {
247
+ e = !0;
248
+ }, d = () => {
249
+ e = !1;
250
+ }, v = () => ke.isFocused() && (t.networkMode === "always" || ne.isOnline()) && t.canRun(), u = () => ls(t.networkMode) && t.canRun(), p = (x) => {
251
+ var C;
252
+ r || (r = !0, (C = t.onSuccess) == null || C.call(t, x), n == null || n(), l(x));
253
+ }, E = (x) => {
254
+ var C;
255
+ r || (r = !0, (C = t.onError) == null || C.call(t, x), n == null || n(), o(x));
256
+ }, S = () => new Promise((x) => {
257
+ var C;
258
+ n = (_) => {
259
+ (r || v()) && x(_);
260
+ }, (C = t.onPause) == null || C.call(t);
261
+ }).then(() => {
262
+ var x;
263
+ n = void 0, r || (x = t.onContinue) == null || x.call(t);
264
+ }), j = () => {
265
+ if (r)
266
+ return;
267
+ let x;
268
+ try {
269
+ x = t.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 _ = t.retry ?? (Tt ? 0 : 3), O = t.retryDelay ?? Bs, F = typeof O == "function" ? O(s, C) : O, Y = _ === !0 || typeof _ == "number" && s < _ || typeof _ == "function" && _(s, C);
278
+ if (e || !Y) {
279
+ E(C);
280
+ return;
281
+ }
282
+ s++, (z = t.onFail) == null || z.call(t, s, C), Ys(F).then(() => v() ? void 0 : S()).then(() => {
283
+ e ? 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 tr() {
298
+ let t = [], e = 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
+ e++;
308
+ try {
309
+ p = u();
310
+ } finally {
311
+ e--, e || y();
312
+ }
313
+ return p;
314
+ }, c = (u) => {
315
+ e ? t.push(u) : n(() => {
316
+ s(u);
317
+ });
318
+ }, m = (u) => (...p) => {
319
+ c(() => {
320
+ u(...p);
321
+ });
322
+ }, y = () => {
323
+ const u = t;
324
+ t = [], 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 = tr(), dt, Xe, hs = (Xe = class {
346
+ constructor() {
347
+ g(this, dt, void 0);
348
+ }
349
+ destroy() {
350
+ this.clearGcTimeout();
351
+ }
352
+ scheduleGc() {
353
+ this.clearGcTimeout(), fe(this.gcTime) && f(this, dt, setTimeout(() => {
354
+ this.optionalRemove();
355
+ }, this.gcTime));
356
+ }
357
+ updateGcTime(t) {
358
+ this.gcTime = Math.max(
359
+ this.gcTime || 0,
360
+ t ?? (Tt ? 1 / 0 : 5 * 60 * 1e3)
361
+ );
362
+ }
363
+ clearGcTimeout() {
364
+ a(this, dt) && (clearTimeout(a(this, dt)), f(this, dt, void 0));
365
+ }
366
+ }, dt = new WeakMap(), Xe), Et, Pt, G, D, $t, ft, Z, tt, Ie, er = (Ie = class extends hs {
367
+ constructor(e) {
368
+ super();
369
+ g(this, Z);
370
+ g(this, Et, void 0);
371
+ g(this, Pt, void 0);
372
+ g(this, G, void 0);
373
+ g(this, D, void 0);
374
+ g(this, $t, void 0);
375
+ g(this, ft, void 0);
376
+ f(this, ft, !1), f(this, $t, e.defaultOptions), this.setOptions(e.options), this.observers = [], f(this, G, e.cache), this.queryKey = e.queryKey, this.queryHash = e.queryHash, f(this, Et, e.state || sr(this.options)), this.state = a(this, Et), this.scheduleGc();
377
+ }
378
+ get meta() {
379
+ return this.options.meta;
380
+ }
381
+ setOptions(e) {
382
+ this.options = { ...a(this, $t), ...e }, this.updateGcTime(this.options.gcTime);
383
+ }
384
+ optionalRemove() {
385
+ !this.observers.length && this.state.fetchStatus === "idle" && a(this, G).remove(this);
386
+ }
387
+ setData(e, s) {
388
+ const r = me(this.state.data, e, this.options);
389
+ return b(this, Z, tt).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(e, s) {
397
+ b(this, Z, tt).call(this, { type: "setState", state: e, setStateOptions: s });
398
+ }
399
+ cancel(e) {
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(e), 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, Et));
409
+ }
410
+ isActive() {
411
+ return this.observers.some((e) => e.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
+ (e) => e.getCurrentResult().isStale
419
+ ) : this.state.data === void 0;
420
+ }
421
+ isStaleByTime(e = 0) {
422
+ return this.state.isInvalidated || this.state.data === void 0 || !as(this.state.dataUpdatedAt, e);
423
+ }
424
+ onFocus() {
425
+ var s;
426
+ const e = this.observers.find((r) => r.shouldFetchOnWindowFocus());
427
+ e == null || e.refetch({ cancelRefetch: !1 }), (s = a(this, D)) == null || s.continue();
428
+ }
429
+ onOnline() {
430
+ var s;
431
+ const e = this.observers.find((r) => r.shouldFetchOnReconnect());
432
+ e == null || e.refetch({ cancelRefetch: !1 }), (s = a(this, D)) == null || s.continue();
433
+ }
434
+ addObserver(e) {
435
+ this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), a(this, G).notify({ type: "observerAdded", query: this, observer: e }));
436
+ }
437
+ removeObserver(e) {
438
+ this.observers.includes(e) && (this.observers = this.observers.filter((s) => s !== e), this.observers.length || (a(this, D) && (a(this, ft) ? a(this, D).cancel({ revert: !0 }) : a(this, D).cancelRetry()), this.scheduleGc()), a(this, G).notify({ type: "observerRemoved", query: this, observer: e }));
439
+ }
440
+ getObserversCount() {
441
+ return this.observers.length;
442
+ }
443
+ invalidate() {
444
+ this.state.isInvalidated || b(this, Z, tt).call(this, { type: "invalidate" });
445
+ }
446
+ fetch(e, 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 (e && this.setOptions(e), !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, ft, !0), r.signal)
465
+ });
466
+ };
467
+ l(n);
468
+ const o = () => !this.options.queryFn || this.options.queryFn === Ne ? Promise.reject(
469
+ new Error(`Missing queryFn: '${this.options.queryHash}'`)
470
+ ) : (f(this, ft, !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, Pt, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((d = c.fetchOptions) == null ? void 0 : d.meta)) && b(this, Z, tt).call(this, { type: "fetch", meta: (v = c.fetchOptions) == null ? void 0 : v.meta });
487
+ const m = (u) => {
488
+ var p, E, S, j;
489
+ de(u) && u.silent || b(this, Z, tt).call(this, {
490
+ type: "error",
491
+ error: u
492
+ }), de(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, tt).call(this, { type: "failed", failureCount: u, error: p });
522
+ },
523
+ onPause: () => {
524
+ b(this, Z, tt).call(this, { type: "pause" });
525
+ },
526
+ onContinue: () => {
527
+ b(this, Z, tt).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
+ }, Et = new WeakMap(), Pt = new WeakMap(), G = new WeakMap(), D = new WeakMap(), $t = new WeakMap(), ft = new WeakMap(), Z = new WeakSet(), tt = function(e) {
536
+ const s = (r) => {
537
+ switch (e.type) {
538
+ case "failed":
539
+ return {
540
+ ...r,
541
+ fetchFailureCount: e.failureCount,
542
+ fetchFailureReason: e.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: e.meta ?? null
559
+ };
560
+ case "success":
561
+ return {
562
+ ...r,
563
+ data: e.data,
564
+ dataUpdateCount: r.dataUpdateCount + 1,
565
+ dataUpdatedAt: e.dataUpdatedAt ?? Date.now(),
566
+ error: null,
567
+ isInvalidated: !1,
568
+ status: "success",
569
+ ...!e.manual && {
570
+ fetchStatus: "idle",
571
+ fetchFailureCount: 0,
572
+ fetchFailureReason: null
573
+ }
574
+ };
575
+ case "error":
576
+ const n = e.error;
577
+ return de(n) && n.revert && a(this, Pt) ? { ...a(this, Pt), 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
+ ...e.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: e });
603
+ });
604
+ }, Ie);
605
+ function ds(t, e) {
606
+ return {
607
+ fetchFailureCount: 0,
608
+ fetchFailureReason: null,
609
+ fetchStatus: ls(e.networkMode) ? "fetching" : "paused",
610
+ ...t === void 0 && {
611
+ error: null,
612
+ status: "pending"
613
+ }
614
+ };
615
+ }
616
+ function sr(t) {
617
+ const e = typeof t.initialData == "function" ? t.initialData() : t.initialData, s = e !== void 0, r = s ? typeof t.initialDataUpdatedAt == "function" ? t.initialDataUpdatedAt() : t.initialDataUpdatedAt : 0;
618
+ return {
619
+ data: e,
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, Be, rr = (Be = class extends Ut {
634
+ constructor(e = {}) {
635
+ super();
636
+ g(this, J, void 0);
637
+ this.config = e, f(this, J, /* @__PURE__ */ new Map());
638
+ }
639
+ build(e, s, r) {
640
+ const n = s.queryKey, l = s.queryHash ?? Ae(n, s);
641
+ let o = this.get(l);
642
+ return o || (o = new er({
643
+ cache: this,
644
+ queryKey: n,
645
+ queryHash: l,
646
+ options: e.defaultQueryOptions(s),
647
+ state: r,
648
+ defaultOptions: e.getQueryDefaults(n)
649
+ }), this.add(o)), o;
650
+ }
651
+ add(e) {
652
+ a(this, J).has(e.queryHash) || (a(this, J).set(e.queryHash, e), this.notify({
653
+ type: "added",
654
+ query: e
655
+ }));
656
+ }
657
+ remove(e) {
658
+ const s = a(this, J).get(e.queryHash);
659
+ s && (e.destroy(), s === e && a(this, J).delete(e.queryHash), this.notify({ type: "removed", query: e }));
660
+ }
661
+ clear() {
662
+ R.batch(() => {
663
+ this.getAll().forEach((e) => {
664
+ this.remove(e);
665
+ });
666
+ });
667
+ }
668
+ get(e) {
669
+ return a(this, J).get(e);
670
+ }
671
+ getAll() {
672
+ return [...a(this, J).values()];
673
+ }
674
+ find(e) {
675
+ const s = { exact: !0, ...e };
676
+ return this.getAll().find(
677
+ (r) => De(s, r)
678
+ );
679
+ }
680
+ findAll(e = {}) {
681
+ const s = this.getAll();
682
+ return Object.keys(e).length > 0 ? s.filter((r) => De(e, r)) : s;
683
+ }
684
+ notify(e) {
685
+ R.batch(() => {
686
+ this.listeners.forEach((s) => {
687
+ s(e);
688
+ });
689
+ });
690
+ }
691
+ onFocus() {
692
+ R.batch(() => {
693
+ this.getAll().forEach((e) => {
694
+ e.onFocus();
695
+ });
696
+ });
697
+ }
698
+ onOnline() {
699
+ R.batch(() => {
700
+ this.getAll().forEach((e) => {
701
+ e.onOnline();
702
+ });
703
+ });
704
+ }
705
+ }, J = new WeakMap(), Be), X, T, pt, I, st, ts, ir = (ts = class extends hs {
706
+ constructor(e) {
707
+ super();
708
+ g(this, I);
709
+ g(this, X, void 0);
710
+ g(this, T, void 0);
711
+ g(this, pt, void 0);
712
+ this.mutationId = e.mutationId, f(this, T, e.mutationCache), f(this, X, []), this.state = e.state || fs(), this.setOptions(e.options), this.scheduleGc();
713
+ }
714
+ setOptions(e) {
715
+ this.options = e, this.updateGcTime(this.options.gcTime);
716
+ }
717
+ get meta() {
718
+ return this.options.meta;
719
+ }
720
+ addObserver(e) {
721
+ a(this, X).includes(e) || (a(this, X).push(e), this.clearGcTimeout(), a(this, T).notify({
722
+ type: "observerAdded",
723
+ mutation: this,
724
+ observer: e
725
+ }));
726
+ }
727
+ removeObserver(e) {
728
+ f(this, X, a(this, X).filter((s) => s !== e)), this.scheduleGc(), a(this, T).notify({
729
+ type: "observerRemoved",
730
+ mutation: this,
731
+ observer: e
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 e;
739
+ return ((e = a(this, pt)) == null ? void 0 : e.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(e) {
743
+ var n, l, o, c, m, y, d, v, u, p, E, S, j, x, C, _, O, F, Y, z;
744
+ f(this, pt, us({
745
+ fn: () => this.options.mutationFn ? this.options.mutationFn(e) : Promise.reject(new Error("No mutationFn found")),
746
+ onFail: (P, W) => {
747
+ b(this, I, st).call(this, { type: "failed", failureCount: P, error: W });
748
+ },
749
+ onPause: () => {
750
+ b(this, I, st).call(this, { type: "pause" });
751
+ },
752
+ onContinue: () => {
753
+ b(this, I, st).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, pt).canStart();
761
+ try {
762
+ if (!s) {
763
+ b(this, I, st).call(this, { type: "pending", variables: e, isPaused: r }), await ((l = (n = a(this, T).config).onMutate) == null ? void 0 : l.call(
764
+ n,
765
+ e,
766
+ this
767
+ ));
768
+ const W = await ((c = (o = this.options).onMutate) == null ? void 0 : c.call(o, e));
769
+ W !== this.state.context && b(this, I, st).call(this, {
770
+ type: "pending",
771
+ context: W,
772
+ variables: e,
773
+ isPaused: r
774
+ });
775
+ }
776
+ const P = await a(this, pt).start();
777
+ return await ((y = (m = a(this, T).config).onSuccess) == null ? void 0 : y.call(
778
+ m,
779
+ P,
780
+ e,
781
+ this.state.context,
782
+ this
783
+ )), await ((v = (d = this.options).onSuccess) == null ? void 0 : v.call(d, P, e, 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, e, this.state.context)), b(this, I, st).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
+ e,
797
+ this.state.context,
798
+ this
799
+ )), await ((_ = (C = this.options).onError) == null ? void 0 : _.call(
800
+ C,
801
+ P,
802
+ e,
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
+ e,
816
+ this.state.context
817
+ )), P;
818
+ } finally {
819
+ b(this, I, st).call(this, { type: "error", error: P });
820
+ }
821
+ } finally {
822
+ a(this, T).runNext(this);
823
+ }
824
+ }
825
+ }, X = new WeakMap(), T = new WeakMap(), pt = new WeakMap(), I = new WeakSet(), st = function(e) {
826
+ const s = (r) => {
827
+ switch (e.type) {
828
+ case "failed":
829
+ return {
830
+ ...r,
831
+ failureCount: e.failureCount,
832
+ failureReason: e.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: e.context,
848
+ data: void 0,
849
+ failureCount: 0,
850
+ failureReason: null,
851
+ error: null,
852
+ isPaused: e.isPaused,
853
+ status: "pending",
854
+ variables: e.variables,
855
+ submittedAt: Date.now()
856
+ };
857
+ case "success":
858
+ return {
859
+ ...r,
860
+ data: e.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: e.error,
872
+ failureCount: r.failureCount + 1,
873
+ failureReason: e.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(e);
882
+ }), a(this, T).notify({
883
+ mutation: this,
884
+ type: "updated",
885
+ action: e
886
+ });
887
+ });
888
+ }, ts);
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, Kt, es, nr = (es = class extends Ut {
903
+ constructor(e = {}) {
904
+ super();
905
+ g(this, K, void 0);
906
+ g(this, Kt, void 0);
907
+ this.config = e, f(this, K, /* @__PURE__ */ new Map()), f(this, Kt, Date.now());
908
+ }
909
+ build(e, s, r) {
910
+ const n = new ir({
911
+ mutationCache: this,
912
+ mutationId: ++ee(this, Kt)._,
913
+ options: e.defaultMutationOptions(s),
914
+ state: r
915
+ });
916
+ return this.add(n), n;
917
+ }
918
+ add(e) {
919
+ const s = se(e), r = a(this, K).get(s) ?? [];
920
+ r.push(e), a(this, K).set(s, r), this.notify({ type: "added", mutation: e });
921
+ }
922
+ remove(e) {
923
+ var r;
924
+ const s = se(e);
925
+ if (a(this, K).has(s)) {
926
+ const n = (r = a(this, K).get(s)) == null ? void 0 : r.filter((l) => l !== e);
927
+ n && (n.length === 0 ? a(this, K).delete(s) : a(this, K).set(s, n));
928
+ }
929
+ this.notify({ type: "removed", mutation: e });
930
+ }
931
+ canRun(e) {
932
+ var r;
933
+ const s = (r = a(this, K).get(se(e))) == null ? void 0 : r.find((n) => n.state.status === "pending");
934
+ return !s || s === e;
935
+ }
936
+ runNext(e) {
937
+ var r;
938
+ const s = (r = a(this, K).get(se(e))) == null ? void 0 : r.find((n) => n !== e && n.state.isPaused);
939
+ return (s == null ? void 0 : s.continue()) ?? Promise.resolve();
940
+ }
941
+ clear() {
942
+ R.batch(() => {
943
+ this.getAll().forEach((e) => {
944
+ this.remove(e);
945
+ });
946
+ });
947
+ }
948
+ getAll() {
949
+ return [...a(this, K).values()].flat();
950
+ }
951
+ find(e) {
952
+ const s = { exact: !0, ...e };
953
+ return this.getAll().find(
954
+ (r) => Te(s, r)
955
+ );
956
+ }
957
+ findAll(e = {}) {
958
+ return this.getAll().filter((s) => Te(e, s));
959
+ }
960
+ notify(e) {
961
+ R.batch(() => {
962
+ this.listeners.forEach((s) => {
963
+ s(e);
964
+ });
965
+ });
966
+ }
967
+ resumePausedMutations() {
968
+ const e = this.getAll().filter((s) => s.state.isPaused);
969
+ return R.batch(
970
+ () => Promise.all(
971
+ e.map((s) => s.continue().catch(V))
972
+ )
973
+ );
974
+ }
975
+ }, K = new WeakMap(), Kt = new WeakMap(), es);
976
+ function se(t) {
977
+ var e;
978
+ return ((e = t.options.scope) == null ? void 0 : e.id) ?? String(t.mutationId);
979
+ }
980
+ function ar(t) {
981
+ return {
982
+ onFetch: (e, s) => {
983
+ const r = async () => {
984
+ var E, S, j, x, C;
985
+ const n = e.options, l = (j = (S = (E = e.fetchOptions) == null ? void 0 : E.meta) == null ? void 0 : S.fetchMore) == null ? void 0 : j.direction, o = ((x = e.state.data) == null ? void 0 : x.pages) || [], c = ((C = e.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: () => (e.signal.aborted ? y = !0 : e.signal.addEventListener("abort", () => {
991
+ y = !0;
992
+ }), e.signal)
993
+ });
994
+ }, v = e.options.queryFn && e.options.queryFn !== Ne ? e.options.queryFn : () => Promise.reject(
995
+ new Error(`Missing queryFn: '${e.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: e.queryKey,
1003
+ pageParam: O,
1004
+ direction: F ? "backward" : "forward",
1005
+ meta: e.options.meta
1006
+ };
1007
+ d(Y);
1008
+ const z = await v(
1009
+ Y
1010
+ ), { maxPages: P } = e.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 : He, 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 _ = t ?? o.length;
1029
+ for (let O = 1; O < _; O++) {
1030
+ const F = He(n, p);
1031
+ p = await u(p, F);
1032
+ }
1033
+ }
1034
+ return p;
1035
+ };
1036
+ e.options.persister ? e.fetchFn = () => {
1037
+ var n, l;
1038
+ return (l = (n = e.options).persister) == null ? void 0 : l.call(
1039
+ n,
1040
+ r,
1041
+ {
1042
+ queryKey: e.queryKey,
1043
+ meta: e.options.meta,
1044
+ signal: e.signal
1045
+ },
1046
+ s
1047
+ );
1048
+ } : e.fetchFn = r;
1049
+ }
1050
+ };
1051
+ }
1052
+ function He(t, { pages: e, pageParams: s }) {
1053
+ const r = e.length - 1;
1054
+ return t.getNextPageParam(
1055
+ e[r],
1056
+ e,
1057
+ s[r],
1058
+ s
1059
+ );
1060
+ }
1061
+ function or(t, { pages: e, pageParams: s }) {
1062
+ var r;
1063
+ return (r = t.getPreviousPageParam) == null ? void 0 : r.call(
1064
+ t,
1065
+ e[0],
1066
+ e,
1067
+ s[0],
1068
+ s
1069
+ );
1070
+ }
1071
+ var M, nt, at, At, Nt, ot, kt, Ot, ss, ps = (ss = class {
1072
+ constructor(t = {}) {
1073
+ g(this, M, void 0);
1074
+ g(this, nt, void 0);
1075
+ g(this, at, void 0);
1076
+ g(this, At, void 0);
1077
+ g(this, Nt, void 0);
1078
+ g(this, ot, void 0);
1079
+ g(this, kt, void 0);
1080
+ g(this, Ot, void 0);
1081
+ f(this, M, t.queryCache || new rr()), f(this, nt, t.mutationCache || new nr()), f(this, at, t.defaultOptions || {}), f(this, At, /* @__PURE__ */ new Map()), f(this, Nt, /* @__PURE__ */ new Map()), f(this, ot, 0);
1082
+ }
1083
+ mount() {
1084
+ ee(this, ot)._++, a(this, ot) === 1 && (f(this, kt, ke.subscribe(async (t) => {
1085
+ t && (await this.resumePausedMutations(), a(this, M).onFocus());
1086
+ })), f(this, Ot, ne.subscribe(async (t) => {
1087
+ t && (await this.resumePausedMutations(), a(this, M).onOnline());
1088
+ })));
1089
+ }
1090
+ unmount() {
1091
+ var t, e;
1092
+ ee(this, ot)._--, a(this, ot) === 0 && ((t = a(this, kt)) == null || t.call(this), f(this, kt, void 0), (e = a(this, Ot)) == null || e.call(this), f(this, Ot, void 0));
1093
+ }
1094
+ isFetching(t) {
1095
+ return a(this, M).findAll({ ...t, fetchStatus: "fetching" }).length;
1096
+ }
1097
+ isMutating(t) {
1098
+ return a(this, nt).findAll({ ...t, status: "pending" }).length;
1099
+ }
1100
+ getQueryData(t) {
1101
+ var s;
1102
+ const e = this.defaultQueryOptions({ queryKey: t });
1103
+ return (s = a(this, M).get(e.queryHash)) == null ? void 0 : s.state.data;
1104
+ }
1105
+ ensureQueryData(t) {
1106
+ const e = this.getQueryData(t.queryKey);
1107
+ if (e === void 0)
1108
+ return this.fetchQuery(t);
1109
+ {
1110
+ const s = this.defaultQueryOptions(t), r = a(this, M).build(this, s);
1111
+ return t.revalidateIfStale && r.isStaleByTime(s.staleTime) && this.prefetchQuery(s), Promise.resolve(e);
1112
+ }
1113
+ }
1114
+ getQueriesData(t) {
1115
+ return a(this, M).findAll(t).map(({ queryKey: e, state: s }) => {
1116
+ const r = s.data;
1117
+ return [e, r];
1118
+ });
1119
+ }
1120
+ setQueryData(t, e, s) {
1121
+ const r = this.defaultQueryOptions({ queryKey: t }), n = a(this, M).get(
1122
+ r.queryHash
1123
+ ), l = n == null ? void 0 : n.state.data, o = Zs(e, l);
1124
+ if (o !== void 0)
1125
+ return a(this, M).build(this, r).setData(o, { ...s, manual: !0 });
1126
+ }
1127
+ setQueriesData(t, e, s) {
1128
+ return R.batch(
1129
+ () => a(this, M).findAll(t).map(({ queryKey: r }) => [
1130
+ r,
1131
+ this.setQueryData(r, e, s)
1132
+ ])
1133
+ );
1134
+ }
1135
+ getQueryState(t) {
1136
+ var s;
1137
+ const e = this.defaultQueryOptions({ queryKey: t });
1138
+ return (s = a(this, M).get(e.queryHash)) == null ? void 0 : s.state;
1139
+ }
1140
+ removeQueries(t) {
1141
+ const e = a(this, M);
1142
+ R.batch(() => {
1143
+ e.findAll(t).forEach((s) => {
1144
+ e.remove(s);
1145
+ });
1146
+ });
1147
+ }
1148
+ resetQueries(t, e) {
1149
+ const s = a(this, M), r = {
1150
+ type: "active",
1151
+ ...t
1152
+ };
1153
+ return R.batch(() => (s.findAll(t).forEach((n) => {
1154
+ n.reset();
1155
+ }), this.refetchQueries(r, e)));
1156
+ }
1157
+ cancelQueries(t = {}, e = {}) {
1158
+ const s = { revert: !0, ...e }, r = R.batch(
1159
+ () => a(this, M).findAll(t).map((n) => n.cancel(s))
1160
+ );
1161
+ return Promise.all(r).then(V).catch(V);
1162
+ }
1163
+ invalidateQueries(t = {}, e = {}) {
1164
+ return R.batch(() => {
1165
+ if (a(this, M).findAll(t).forEach((r) => {
1166
+ r.invalidate();
1167
+ }), t.refetchType === "none")
1168
+ return Promise.resolve();
1169
+ const s = {
1170
+ ...t,
1171
+ type: t.refetchType ?? t.type ?? "active"
1172
+ };
1173
+ return this.refetchQueries(s, e);
1174
+ });
1175
+ }
1176
+ refetchQueries(t = {}, e) {
1177
+ const s = {
1178
+ ...e,
1179
+ cancelRefetch: (e == null ? void 0 : e.cancelRefetch) ?? !0
1180
+ }, r = R.batch(
1181
+ () => a(this, M).findAll(t).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(t) {
1189
+ const e = this.defaultQueryOptions(t);
1190
+ e.retry === void 0 && (e.retry = !1);
1191
+ const s = a(this, M).build(this, e);
1192
+ return s.isStaleByTime(e.staleTime) ? s.fetch(e) : Promise.resolve(s.state.data);
1193
+ }
1194
+ prefetchQuery(t) {
1195
+ return this.fetchQuery(t).then(V).catch(V);
1196
+ }
1197
+ fetchInfiniteQuery(t) {
1198
+ return t.behavior = ar(t.pages), this.fetchQuery(t);
1199
+ }
1200
+ prefetchInfiniteQuery(t) {
1201
+ return this.fetchInfiniteQuery(t).then(V).catch(V);
1202
+ }
1203
+ resumePausedMutations() {
1204
+ return ne.isOnline() ? a(this, nt).resumePausedMutations() : Promise.resolve();
1205
+ }
1206
+ getQueryCache() {
1207
+ return a(this, M);
1208
+ }
1209
+ getMutationCache() {
1210
+ return a(this, nt);
1211
+ }
1212
+ getDefaultOptions() {
1213
+ return a(this, at);
1214
+ }
1215
+ setDefaultOptions(t) {
1216
+ f(this, at, t);
1217
+ }
1218
+ setQueryDefaults(t, e) {
1219
+ a(this, At).set(Ct(t), {
1220
+ queryKey: t,
1221
+ defaultOptions: e
1222
+ });
1223
+ }
1224
+ getQueryDefaults(t) {
1225
+ const e = [...a(this, At).values()];
1226
+ let s = {};
1227
+ return e.forEach((r) => {
1228
+ Ht(t, r.queryKey) && (s = { ...s, ...r.defaultOptions });
1229
+ }), s;
1230
+ }
1231
+ setMutationDefaults(t, e) {
1232
+ a(this, Nt).set(Ct(t), {
1233
+ mutationKey: t,
1234
+ defaultOptions: e
1235
+ });
1236
+ }
1237
+ getMutationDefaults(t) {
1238
+ const e = [...a(this, Nt).values()];
1239
+ let s = {};
1240
+ return e.forEach((r) => {
1241
+ Ht(t, r.mutationKey) && (s = { ...s, ...r.defaultOptions });
1242
+ }), s;
1243
+ }
1244
+ defaultQueryOptions(t) {
1245
+ if (t._defaulted)
1246
+ return t;
1247
+ const e = {
1248
+ ...a(this, at).queries,
1249
+ ...this.getQueryDefaults(t.queryKey),
1250
+ ...t,
1251
+ _defaulted: !0
1252
+ };
1253
+ return e.queryHash || (e.queryHash = Ae(
1254
+ e.queryKey,
1255
+ e
1256
+ )), e.refetchOnReconnect === void 0 && (e.refetchOnReconnect = e.networkMode !== "always"), e.throwOnError === void 0 && (e.throwOnError = !!e.suspense), !e.networkMode && e.persister && (e.networkMode = "offlineFirst"), e.enabled !== !0 && e.queryFn === Ne && (e.enabled = !1), e;
1257
+ }
1258
+ defaultMutationOptions(t) {
1259
+ return t != null && t._defaulted ? t : {
1260
+ ...a(this, at).mutations,
1261
+ ...(t == null ? void 0 : t.mutationKey) && this.getMutationDefaults(t.mutationKey),
1262
+ ...t,
1263
+ _defaulted: !0
1264
+ };
1265
+ }
1266
+ clear() {
1267
+ a(this, M).clear(), a(this, nt).clear();
1268
+ }
1269
+ }, M = new WeakMap(), nt = new WeakMap(), at = new WeakMap(), At = new WeakMap(), Nt = new WeakMap(), ot = new WeakMap(), kt = new WeakMap(), Ot = new WeakMap(), ss), Q, k, qt, U, mt, Mt, B, Gt, Lt, Ft, vt, gt, lt, Rt, yt, Qt, Vt, ve, Wt, ge, Zt, ye, Yt, Ce, zt, xe, Jt, be, Xt, we, ce, ms, rs, lr = (rs = class extends Ut {
1270
+ constructor(e, s) {
1271
+ super();
1272
+ g(this, yt);
1273
+ g(this, Vt);
1274
+ g(this, Wt);
1275
+ g(this, Zt);
1276
+ g(this, Yt);
1277
+ g(this, zt);
1278
+ g(this, Jt);
1279
+ g(this, Xt);
1280
+ g(this, ce);
1281
+ g(this, Q, void 0);
1282
+ g(this, k, void 0);
1283
+ g(this, qt, void 0);
1284
+ g(this, U, void 0);
1285
+ g(this, mt, void 0);
1286
+ g(this, Mt, void 0);
1287
+ g(this, B, void 0);
1288
+ g(this, Gt, void 0);
1289
+ g(this, Lt, 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, Ft, void 0);
1293
+ g(this, vt, void 0);
1294
+ g(this, gt, void 0);
1295
+ g(this, lt, void 0);
1296
+ g(this, Rt, /* @__PURE__ */ new Set());
1297
+ this.options = s, f(this, Q, e), 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), $e(a(this, k), this.options) ? b(this, yt, Qt).call(this) : this.updateResult(), b(this, Yt, Ce).call(this));
1304
+ }
1305
+ onUnsubscribe() {
1306
+ this.hasListeners() || this.destroy();
1307
+ }
1308
+ shouldFetchOnReconnect() {
1309
+ return je(
1310
+ a(this, k),
1311
+ this.options,
1312
+ this.options.refetchOnReconnect
1313
+ );
1314
+ }
1315
+ shouldFetchOnWindowFocus() {
1316
+ return je(
1317
+ a(this, k),
1318
+ this.options,
1319
+ this.options.refetchOnWindowFocus
1320
+ );
1321
+ }
1322
+ destroy() {
1323
+ this.listeners = /* @__PURE__ */ new Set(), b(this, zt, xe).call(this), b(this, Jt, be).call(this), a(this, k).removeObserver(this);
1324
+ }
1325
+ setOptions(e, s) {
1326
+ const r = this.options, n = a(this, k);
1327
+ if (this.options = a(this, Q).defaultQueryOptions(e), this.options.enabled !== void 0 && typeof this.options.enabled != "boolean")
1328
+ throw new Error("Expected enabled to be a boolean");
1329
+ b(this, Xt, we).call(this), a(this, k).setOptions(this.options), r._defaulted && !ie(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 && Ke(
1336
+ a(this, k),
1337
+ n,
1338
+ this.options,
1339
+ r
1340
+ ) && b(this, yt, Qt).call(this), this.updateResult(s), l && (a(this, k) !== n || this.options.enabled !== r.enabled || this.options.staleTime !== r.staleTime) && b(this, Vt, ve).call(this);
1341
+ const o = b(this, Wt, ge).call(this);
1342
+ l && (a(this, k) !== n || this.options.enabled !== r.enabled || o !== a(this, lt)) && b(this, Zt, ye).call(this, o);
1343
+ }
1344
+ getOptimisticResult(e) {
1345
+ const s = a(this, Q).getQueryCache().build(a(this, Q), e), r = this.createResult(s, e);
1346
+ return ur(this, r) && (f(this, U, r), f(this, Mt, this.options), f(this, mt, a(this, k).state)), r;
1347
+ }
1348
+ getCurrentResult() {
1349
+ return a(this, U);
1350
+ }
1351
+ trackResult(e, s) {
1352
+ const r = {};
1353
+ return Object.keys(e).forEach((n) => {
1354
+ Object.defineProperty(r, n, {
1355
+ configurable: !1,
1356
+ enumerable: !0,
1357
+ get: () => (this.trackProp(n), s == null || s(n), e[n])
1358
+ });
1359
+ }), r;
1360
+ }
1361
+ trackProp(e) {
1362
+ a(this, Rt).add(e);
1363
+ }
1364
+ getCurrentQuery() {
1365
+ return a(this, k);
1366
+ }
1367
+ refetch({ ...e } = {}) {
1368
+ return this.fetch({
1369
+ ...e
1370
+ });
1371
+ }
1372
+ fetchOptimistic(e) {
1373
+ const s = a(this, Q).defaultQueryOptions(e), 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(e) {
1377
+ return b(this, yt, Qt).call(this, {
1378
+ ...e,
1379
+ cancelRefetch: e.cancelRefetch ?? !0
1380
+ }).then(() => (this.updateResult(), a(this, U)));
1381
+ }
1382
+ createResult(e, s) {
1383
+ var z;
1384
+ const r = a(this, k), n = this.options, l = a(this, U), o = a(this, mt), c = a(this, Mt), y = e !== r ? e.state : a(this, qt), { state: d } = e;
1385
+ let v = { ...d }, u = !1, p;
1386
+ if (s._optimisticResults) {
1387
+ const P = this.hasListeners(), W = !P && $e(e, s), Hs = P && Ke(e, r, s, n);
1388
+ (W || Hs) && (v = {
1389
+ ...v,
1390
+ ...ds(d.data, e.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, Gt))
1396
+ p = a(this, Lt);
1397
+ else
1398
+ try {
1399
+ f(this, Gt, s.select), p = s.select(v.data), p = me(l == null ? void 0 : l.data, p, s), f(this, Lt, 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, Ft)) == null ? void 0 : z.state.data,
1411
+ a(this, Ft)
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 = me(
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, Lt), 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: Oe(e, s),
1450
+ refetch: this.refetch
1451
+ };
1452
+ }
1453
+ updateResult(e) {
1454
+ const s = a(this, U), r = this.createResult(a(this, k), this.options);
1455
+ if (f(this, mt, a(this, k).state), f(this, Mt, this.options), a(this, mt).data !== void 0 && f(this, Ft, a(this, k)), ie(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, Rt).size)
1463
+ return !0;
1464
+ const m = new Set(
1465
+ c ?? a(this, Rt)
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
+ (e == null ? void 0 : e.listeners) !== !1 && l() && (n.listeners = !0), b(this, ce, ms).call(this, { ...n, ...e });
1473
+ }
1474
+ onQueryUpdate() {
1475
+ this.updateResult(), this.hasListeners() && b(this, Yt, Ce).call(this);
1476
+ }
1477
+ }, Q = new WeakMap(), k = new WeakMap(), qt = new WeakMap(), U = new WeakMap(), mt = new WeakMap(), Mt = new WeakMap(), B = new WeakMap(), Gt = new WeakMap(), Lt = new WeakMap(), Ft = new WeakMap(), vt = new WeakMap(), gt = new WeakMap(), lt = new WeakMap(), Rt = new WeakMap(), yt = new WeakSet(), Qt = function(e) {
1478
+ b(this, Xt, we).call(this);
1479
+ let s = a(this, k).fetch(
1480
+ this.options,
1481
+ e
1482
+ );
1483
+ return e != null && e.throwOnError || (s = s.catch(V)), s;
1484
+ }, Vt = new WeakSet(), ve = function() {
1485
+ if (b(this, zt, xe).call(this), Tt || a(this, U).isStale || !fe(this.options.staleTime))
1486
+ return;
1487
+ const s = as(
1488
+ a(this, U).dataUpdatedAt,
1489
+ this.options.staleTime
1490
+ ) + 1;
1491
+ f(this, vt, setTimeout(() => {
1492
+ a(this, U).isStale || this.updateResult();
1493
+ }, s));
1494
+ }, Wt = new WeakSet(), ge = function() {
1495
+ return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(a(this, k)) : this.options.refetchInterval) ?? !1;
1496
+ }, Zt = new WeakSet(), ye = function(e) {
1497
+ b(this, Jt, be).call(this), f(this, lt, e), !(Tt || this.options.enabled === !1 || !fe(a(this, lt)) || a(this, lt) === 0) && f(this, gt, setInterval(() => {
1498
+ (this.options.refetchIntervalInBackground || ke.isFocused()) && b(this, yt, Qt).call(this);
1499
+ }, a(this, lt)));
1500
+ }, Yt = new WeakSet(), Ce = function() {
1501
+ b(this, Vt, ve).call(this), b(this, Zt, ye).call(this, b(this, Wt, ge).call(this));
1502
+ }, zt = new WeakSet(), xe = function() {
1503
+ a(this, vt) && (clearTimeout(a(this, vt)), f(this, vt, void 0));
1504
+ }, Jt = new WeakSet(), be = function() {
1505
+ a(this, gt) && (clearInterval(a(this, gt)), f(this, gt, void 0));
1506
+ }, Xt = new WeakSet(), we = function() {
1507
+ const e = a(this, Q).getQueryCache().build(a(this, Q), this.options);
1508
+ if (e === a(this, k))
1509
+ return;
1510
+ const s = a(this, k);
1511
+ f(this, k, e), f(this, qt, e.state), this.hasListeners() && (s == null || s.removeObserver(this), e.addObserver(this));
1512
+ }, ce = new WeakSet(), ms = function(e) {
1513
+ R.batch(() => {
1514
+ e.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(t, e) {
1523
+ return e.enabled !== !1 && t.state.data === void 0 && !(t.state.status === "error" && e.retryOnMount === !1);
1524
+ }
1525
+ function $e(t, e) {
1526
+ return cr(t, e) || t.state.data !== void 0 && je(t, e, e.refetchOnMount);
1527
+ }
1528
+ function je(t, e, s) {
1529
+ if (e.enabled !== !1) {
1530
+ const r = typeof s == "function" ? s(t) : s;
1531
+ return r === "always" || r !== !1 && Oe(t, e);
1532
+ }
1533
+ return !1;
1534
+ }
1535
+ function Ke(t, e, s, r) {
1536
+ return (t !== e || r.enabled === !1) && (!s.suspense || t.state.status !== "error") && Oe(t, s);
1537
+ }
1538
+ function Oe(t, e) {
1539
+ return e.enabled !== !1 && t.isStaleByTime(e.staleTime);
1540
+ }
1541
+ function ur(t, e) {
1542
+ return !ie(t.getCurrentResult(), e);
1543
+ }
1544
+ var ct, ut, H, et, Dt, re, It, _e, is, hr = (is = class extends Ut {
1545
+ constructor(e, s) {
1546
+ super();
1547
+ g(this, Dt);
1548
+ g(this, It);
1549
+ g(this, ct, void 0);
1550
+ g(this, ut, void 0);
1551
+ g(this, H, void 0);
1552
+ g(this, et, void 0);
1553
+ f(this, ct, e), this.setOptions(s), this.bindMethods(), b(this, Dt, re).call(this);
1554
+ }
1555
+ bindMethods() {
1556
+ this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
1557
+ }
1558
+ setOptions(e) {
1559
+ var r;
1560
+ const s = this.options;
1561
+ this.options = a(this, ct).defaultMutationOptions(e), ie(this.options, s) || a(this, ct).getMutationCache().notify({
1562
+ type: "observerOptionsUpdated",
1563
+ mutation: a(this, H),
1564
+ observer: this
1565
+ }), s != null && s.mutationKey && this.options.mutationKey && Ct(s.mutationKey) !== Ct(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 e;
1569
+ this.hasListeners() || (e = a(this, H)) == null || e.removeObserver(this);
1570
+ }
1571
+ onMutationUpdate(e) {
1572
+ b(this, Dt, re).call(this), b(this, It, _e).call(this, e);
1573
+ }
1574
+ getCurrentResult() {
1575
+ return a(this, ut);
1576
+ }
1577
+ reset() {
1578
+ var e;
1579
+ (e = a(this, H)) == null || e.removeObserver(this), f(this, H, void 0), b(this, Dt, re).call(this), b(this, It, _e).call(this);
1580
+ }
1581
+ mutate(e, s) {
1582
+ var r;
1583
+ return f(this, et, s), (r = a(this, H)) == null || r.removeObserver(this), f(this, H, a(this, ct).getMutationCache().build(a(this, ct), this.options)), a(this, H).addObserver(this), a(this, H).execute(e);
1584
+ }
1585
+ }, ct = new WeakMap(), ut = new WeakMap(), H = new WeakMap(), et = new WeakMap(), Dt = new WeakSet(), re = function() {
1586
+ var s;
1587
+ const e = ((s = a(this, H)) == null ? void 0 : s.state) ?? fs();
1588
+ f(this, ut, {
1589
+ ...e,
1590
+ isPending: e.status === "pending",
1591
+ isSuccess: e.status === "success",
1592
+ isError: e.status === "error",
1593
+ isIdle: e.status === "idle",
1594
+ mutate: this.mutate,
1595
+ reset: this.reset
1596
+ });
1597
+ }, It = new WeakSet(), _e = function(e) {
1598
+ R.batch(() => {
1599
+ var s, r, n, l, o, c, m, y;
1600
+ if (a(this, et) && this.hasListeners()) {
1601
+ const d = a(this, ut).variables, v = a(this, ut).context;
1602
+ (e == null ? void 0 : e.type) === "success" ? ((r = (s = a(this, et)).onSuccess) == null || r.call(s, e.data, d, v), (l = (n = a(this, et)).onSettled) == null || l.call(n, e.data, null, d, v)) : (e == null ? void 0 : e.type) === "error" && ((c = (o = a(this, et)).onError) == null || c.call(o, e.error, d, v), (y = (m = a(this, et)).onSettled) == null || y.call(
1603
+ m,
1604
+ void 0,
1605
+ e.error,
1606
+ d,
1607
+ v
1608
+ ));
1609
+ }
1610
+ this.listeners.forEach((d) => {
1611
+ d(a(this, ut));
1612
+ });
1613
+ });
1614
+ }, is), vs = h.createContext(
1615
+ void 0
1616
+ ), Me = (t) => {
1617
+ const e = h.useContext(vs);
1618
+ if (t)
1619
+ return t;
1620
+ if (!e)
1621
+ throw new Error("No QueryClient set, use QueryClientProvider to set one");
1622
+ return e;
1623
+ }, dr = ({
1624
+ client: t,
1625
+ children: e
1626
+ }) => (h.useEffect(() => (t.mount(), () => {
1627
+ t.unmount();
1628
+ }), [t]), /* @__PURE__ */ i.jsx(vs.Provider, { value: t, children: e })), gs = h.createContext(!1), fr = () => h.useContext(gs);
1629
+ gs.Provider;
1630
+ function pr() {
1631
+ let t = !1;
1632
+ return {
1633
+ clearReset: () => {
1634
+ t = !1;
1635
+ },
1636
+ reset: () => {
1637
+ t = !0;
1638
+ },
1639
+ isReset: () => t
1640
+ };
1641
+ }
1642
+ var mr = h.createContext(pr()), vr = () => h.useContext(mr);
1643
+ function ys(t, e) {
1644
+ return typeof t == "function" ? t(...e) : !!t;
1645
+ }
1646
+ function gr() {
1647
+ }
1648
+ var yr = (t, e) => {
1649
+ (t.suspense || t.throwOnError) && (e.isReset() || (t.retryOnMount = !1));
1650
+ }, Cr = (t) => {
1651
+ h.useEffect(() => {
1652
+ t.clearReset();
1653
+ }, [t]);
1654
+ }, xr = ({
1655
+ result: t,
1656
+ errorResetBoundary: e,
1657
+ throwOnError: s,
1658
+ query: r
1659
+ }) => t.isError && !e.isReset() && !t.isFetching && r && ys(s, [t.error, r]), br = (t) => {
1660
+ t.suspense && typeof t.staleTime != "number" && (t.staleTime = 1e3);
1661
+ }, wr = (t, e) => (t == null ? void 0 : t.suspense) && e.isPending, jr = (t, e, s) => e.fetchOptimistic(t).catch(() => {
1662
+ s.clearReset();
1663
+ });
1664
+ function _r(t, e, s) {
1665
+ const r = Me(s), n = fr(), l = vr(), o = r.defaultQueryOptions(t);
1666
+ o._optimisticResults = n ? "isRestoring" : "optimistic", br(o), yr(o, l), Cr(l);
1667
+ const [c] = h.useState(
1668
+ () => new e(
1669
+ r,
1670
+ o
1671
+ )
1672
+ ), m = c.getOptimisticResult(o);
1673
+ if (h.useSyncExternalStore(
1674
+ h.useCallback(
1675
+ (y) => {
1676
+ const d = n ? () => {
1677
+ } : c.subscribe(R.batchCalls(y));
1678
+ return c.updateResult(), d;
1679
+ },
1680
+ [c, n]
1681
+ ),
1682
+ () => c.getCurrentResult(),
1683
+ () => c.getCurrentResult()
1684
+ ), h.useEffect(() => {
1685
+ c.setOptions(o, { listeners: !1 });
1686
+ }, [o, c]), wr(o, m))
1687
+ throw jr(o, c, l);
1688
+ if (xr({
1689
+ result: m,
1690
+ errorResetBoundary: l,
1691
+ throwOnError: o.throwOnError,
1692
+ query: r.getQueryCache().get(o.queryHash)
1693
+ }))
1694
+ throw m.error;
1695
+ return o.notifyOnChangeProps ? m : c.trackResult(m);
1696
+ }
1697
+ function Cs(t, e) {
1698
+ return _r(t, lr, e);
1699
+ }
1700
+ function Sr(t, e) {
1701
+ const s = Me(e), [r] = h.useState(
1702
+ () => new hr(
1703
+ s,
1704
+ t
1705
+ )
1706
+ );
1707
+ h.useEffect(() => {
1708
+ r.setOptions(t);
1709
+ }, [r, t]);
1710
+ const n = h.useSyncExternalStore(
1711
+ h.useCallback(
1712
+ (o) => r.subscribe(R.batchCalls(o)),
1713
+ [r]
1714
+ ),
1715
+ () => r.getCurrentResult(),
1716
+ () => r.getCurrentResult()
1717
+ ), l = h.useCallback(
1718
+ (o, c) => {
1719
+ r.mutate(o, c).catch(gr);
1720
+ },
1721
+ [r]
1722
+ );
1723
+ if (n.error && ys(r.options.throwOnError, [n.error]))
1724
+ throw n.error;
1725
+ return { ...n, mutate: l, mutateAsync: n.mutate };
1726
+ }
1727
+ function xs(t) {
1728
+ var e, s, r = "";
1729
+ if (typeof t == "string" || typeof t == "number")
1730
+ r += t;
1731
+ else if (typeof t == "object")
1732
+ if (Array.isArray(t)) {
1733
+ var n = t.length;
1734
+ for (e = 0; e < n; e++)
1735
+ t[e] && (s = xs(t[e])) && (r && (r += " "), r += s);
1736
+ } else
1737
+ for (s in t)
1738
+ t[s] && (r && (r += " "), r += s);
1739
+ return r;
1740
+ }
1741
+ function N() {
1742
+ for (var t, e, s = 0, r = "", n = arguments.length; s < n; s++)
1743
+ (t = arguments[s]) && (e = xs(t)) && (r && (r += " "), r += e);
1744
+ return r;
1745
+ }
1746
+ var Er = Object.defineProperty, Pr = Object.defineProperties, Ar = Object.getOwnPropertyDescriptors, ae = Object.getOwnPropertySymbols, bs = Object.prototype.hasOwnProperty, ws = Object.prototype.propertyIsEnumerable, qe = (t, e, s) => e in t ? Er(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s, w = (t, e) => {
1747
+ for (var s in e || (e = {}))
1748
+ bs.call(e, s) && qe(t, s, e[s]);
1749
+ if (ae)
1750
+ for (var s of ae(e))
1751
+ ws.call(e, s) && qe(t, s, e[s]);
1752
+ return t;
1753
+ }, A = (t, e) => Pr(t, Ar(e)), L = (t, e) => {
1754
+ var s = {};
1755
+ for (var r in t)
1756
+ bs.call(t, r) && e.indexOf(r) < 0 && (s[r] = t[r]);
1757
+ if (t != null && ae)
1758
+ for (var r of ae(t))
1759
+ e.indexOf(r) < 0 && ws.call(t, r) && (s[r] = t[r]);
1760
+ return s;
1761
+ };
1762
+ function oe() {
1763
+ return oe = Object.assign ? Object.assign.bind() : function(t) {
1764
+ for (var e = 1; e < arguments.length; e++) {
1765
+ var s = arguments[e];
1766
+ for (var r in s)
1767
+ Object.prototype.hasOwnProperty.call(s, r) && (t[r] = s[r]);
1768
+ }
1769
+ return t;
1770
+ }, oe.apply(this, arguments);
1771
+ }
1772
+ function Nr(t, e) {
1773
+ typeof t == "function" ? t(e) : t != null && (t.current = e);
1774
+ }
1775
+ function kr(...t) {
1776
+ return (e) => t.forEach(
1777
+ (s) => Nr(s, e)
1778
+ );
1779
+ }
1780
+ var Or = /* @__PURE__ */ h.forwardRef((t, e) => {
1781
+ const s = t, { children: r } = s, n = L(s, ["children"]), l = h.Children.toArray(r), o = l.find(Lr);
1782
+ if (o) {
1783
+ 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);
1784
+ return /* @__PURE__ */ h.createElement(Se, oe({}, n, {
1785
+ ref: e
1786
+ }), /* @__PURE__ */ h.isValidElement(c) ? /* @__PURE__ */ h.cloneElement(c, void 0, m) : null);
1787
+ }
1788
+ return /* @__PURE__ */ h.createElement(Se, oe({}, n, {
1789
+ ref: e
1790
+ }), r);
1791
+ });
1792
+ Or.displayName = "Slot";
1793
+ var Se = /* @__PURE__ */ h.forwardRef((t, e) => {
1794
+ const s = t, { children: r } = s, n = L(s, ["children"]);
1795
+ return /* @__PURE__ */ h.isValidElement(r) ? /* @__PURE__ */ h.cloneElement(r, A(w({}, Fr(n, r.props)), {
1796
+ ref: e ? kr(e, r.ref) : r.ref
1797
+ })) : h.Children.count(r) > 1 ? h.Children.only(null) : null;
1798
+ });
1799
+ Se.displayName = "SlotClone";
1800
+ var Mr = ({ children: t }) => /* @__PURE__ */ h.createElement(h.Fragment, null, t);
1801
+ function Lr(t) {
1802
+ return /* @__PURE__ */ h.isValidElement(t) && t.type === Mr;
1803
+ }
1804
+ function Fr(t, e) {
1805
+ const s = w({}, e);
1806
+ for (const r in e) {
1807
+ const n = t[r], l = e[r];
1808
+ /^on[A-Z]/.test(r) ? n && l ? s[r] = (...c) => {
1809
+ l(...c), n(...c);
1810
+ } : n && (s[r] = n) : r === "style" ? s[r] = w(w({}, n), l) : r === "className" && (s[r] = [
1811
+ n,
1812
+ l
1813
+ ].filter(Boolean).join(" "));
1814
+ }
1815
+ return w(w({}, t), s);
1816
+ }
1817
+ var Rr = ({ firstName: t, lastName: e, variant: s = "small" }) => {
1818
+ const r = `${t.charAt(0)}${e.charAt(0)}`;
1819
+ return /* @__PURE__ */ i.jsx(
1820
+ "span",
1821
+ {
1822
+ className: `avatar avatar--${s}`,
1823
+ "aria-label": `${t} ${e}`,
1824
+ role: "img",
1825
+ children: /* @__PURE__ */ i.jsx("span", { className: "avatar__initials", children: r })
1826
+ }
1827
+ );
1828
+ }, Bt = h.forwardRef(
1829
+ (t, e) => {
1830
+ var s = t, {
1831
+ iconLeft: r,
1832
+ iconRight: n,
1833
+ isPending: l = !1,
1834
+ isFilled: o = !1,
1835
+ variant: c,
1836
+ className: m,
1837
+ children: y
1838
+ } = s, d = L(s, [
1839
+ "iconLeft",
1840
+ "iconRight",
1841
+ "isPending",
1842
+ "isFilled",
1843
+ "variant",
1844
+ "className",
1845
+ "children"
1846
+ ]);
1847
+ const v = !!r || !!n;
1848
+ return /* @__PURE__ */ i.jsxs(
1849
+ "button",
1850
+ A(w({
1851
+ ref: e
1852
+ }, d), {
1853
+ className: N(
1854
+ "button",
1855
+ c && `button--${c}`,
1856
+ c && o && `button--${c}--filled`,
1857
+ v && "button--with-icon",
1858
+ l && "button--pending",
1859
+ m
1860
+ ),
1861
+ children: [
1862
+ r && /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: r }),
1863
+ !!y && /* @__PURE__ */ i.jsx("span", { className: "button__label", children: y }),
1864
+ n && /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: n })
1865
+ ]
1866
+ })
1867
+ );
1868
+ }
1869
+ );
1870
+ Bt.displayName = "Button";
1871
+ h.createContext(void 0);
1872
+ var Dr = h.forwardRef(
1873
+ (t, e) => {
1874
+ var s = t, { prefix: r, suffix: n, className: l } = s, o = L(s, ["prefix", "suffix", "className"]);
1875
+ return /* @__PURE__ */ i.jsxs("div", { className: "input__wrapper", children: [
1876
+ r && /* @__PURE__ */ i.jsx("span", { className: "input__prefix", children: r }),
1877
+ /* @__PURE__ */ i.jsx(
1878
+ "input",
1879
+ w({
1880
+ ref: e,
1881
+ className: N(
1882
+ "input",
1883
+ r && "input--with-prefix",
1884
+ n && "input--with-suffix",
1885
+ l
1886
+ )
1887
+ }, o)
1888
+ ),
1889
+ n && /* @__PURE__ */ i.jsx("span", { className: "input__suffix", children: n })
1890
+ ] });
1891
+ }
1892
+ );
1893
+ Dr.displayName = "TextField";
1894
+ h.createContext(void 0);
1895
+ var Tr = ({ children: t }) => /* @__PURE__ */ i.jsx("div", { className: "card__header__action", children: t }), Ur = (t) => {
1896
+ var e = t, { children: s, className: r } = e, n = L(e, ["children", "className"]);
1897
+ return /* @__PURE__ */ i.jsx("div", A(w({ className: N("card__body", r) }, n), { children: s }));
1898
+ }, Qr = (t) => /* @__PURE__ */ i.jsx(
1899
+ "svg",
1900
+ A(w({
1901
+ width: "24",
1902
+ height: "24",
1903
+ viewBox: "0 0 24 24",
1904
+ fill: "none",
1905
+ xmlns: "http://www.w3.org/2000/svg"
1906
+ }, t), {
1907
+ children: /* @__PURE__ */ i.jsx(
1908
+ "path",
1909
+ {
1910
+ d: "M8 10L12 14L16 10",
1911
+ stroke: "currentColor",
1912
+ strokeWidth: "1.5",
1913
+ strokeLinecap: "round",
1914
+ strokeLinejoin: "round"
1915
+ }
1916
+ )
1917
+ })
1918
+ ), Le = Qr, Hr = (t) => /* @__PURE__ */ i.jsx(
1919
+ "svg",
1920
+ A(w({
1921
+ width: "24",
1922
+ height: "24",
1923
+ viewBox: "0 0 24 24",
1924
+ fill: "none",
1925
+ xmlns: "http://www.w3.org/2000/svg"
1926
+ }, t), {
1927
+ children: /* @__PURE__ */ i.jsx(
1928
+ "path",
1929
+ {
1930
+ d: "M20 6.5L9 17.5L4 12.5",
1931
+ stroke: "currentColor",
1932
+ strokeWidth: "1.5",
1933
+ strokeLinecap: "round",
1934
+ strokeLinejoin: "round"
1935
+ }
1936
+ )
1937
+ })
1938
+ ), $r = Hr, Kr = (t) => /* @__PURE__ */ i.jsx(
1939
+ "svg",
1940
+ A(w({
1941
+ width: "24",
1942
+ height: "24",
1943
+ viewBox: "0 0 24 24",
1944
+ fill: "none",
1945
+ xmlns: "http://www.w3.org/2000/svg"
1946
+ }, t), {
1947
+ children: /* @__PURE__ */ i.jsx(
1948
+ "path",
1949
+ {
1950
+ fillRule: "evenodd",
1951
+ clipRule: "evenodd",
1952
+ fill: "currentColor",
1953
+ 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"
1954
+ }
1955
+ )
1956
+ })
1957
+ ), qr = Kr, Gr = (t) => /* @__PURE__ */ i.jsx(
1958
+ "svg",
1959
+ A(w({
1960
+ width: "24",
1961
+ height: "24",
1962
+ viewBox: "0 0 24 24",
1963
+ fill: "none",
1964
+ xmlns: "http://www.w3.org/2000/svg"
1965
+ }, t), {
1966
+ children: /* @__PURE__ */ i.jsx(
1967
+ "path",
1968
+ {
1969
+ fillRule: "evenodd",
1970
+ clipRule: "evenodd",
1971
+ 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",
1972
+ fill: "#323232"
1973
+ }
1974
+ )
1975
+ })
1976
+ ), Vr = Gr, Wr = (t) => /* @__PURE__ */ i.jsx(
1977
+ "svg",
1978
+ A(w({
1979
+ width: "24",
1980
+ height: "24",
1981
+ viewBox: "0 0 24 24",
1982
+ fill: "none",
1983
+ xmlns: "http://www.w3.org/2000/svg"
1984
+ }, t), {
1985
+ children: /* @__PURE__ */ i.jsx(
1986
+ "path",
1987
+ {
1988
+ fillRule: "evenodd",
1989
+ clipRule: "evenodd",
1990
+ 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",
1991
+ fill: "currentColor"
1992
+ }
1993
+ )
1994
+ })
1995
+ ), Zr = Wr, Yr = (t) => /* @__PURE__ */ i.jsxs(
1996
+ "svg",
1997
+ A(w({
1998
+ width: "24",
1999
+ height: "24",
2000
+ fill: "none",
2001
+ viewBox: "0 0 24 24",
2002
+ xmlns: "http://www.w3.org/2000/svg"
2003
+ }, t), {
2004
+ children: [
2005
+ /* @__PURE__ */ i.jsxs("g", { clipPath: "url(#clip0_19_444)", children: [
2006
+ /* @__PURE__ */ i.jsx(
2007
+ "path",
2008
+ {
2009
+ 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",
2010
+ stroke: "currentColor",
2011
+ strokeWidth: "1.5",
2012
+ strokeLinecap: "round",
2013
+ strokeLinejoin: "round"
2014
+ }
2015
+ ),
2016
+ /* @__PURE__ */ i.jsx("circle", { cx: "10.3", cy: "15.5", r: "0.8", fill: "currentColor" }),
2017
+ /* @__PURE__ */ i.jsx("circle", { cx: "13.7", cy: "15.5", r: "0.8", fill: "currentColor" }),
2018
+ /* @__PURE__ */ i.jsx(
2019
+ "path",
2020
+ {
2021
+ d: "M8 10V7V7C8 4.79086 9.79086 3 12 3V3C14.2091 3 16 4.79086 16 7V10",
2022
+ stroke: "currentColor",
2023
+ strokeWidth: "1.5",
2024
+ strokeLinecap: "round",
2025
+ strokeLinejoin: "round"
2026
+ }
2027
+ )
2028
+ ] }),
2029
+ /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2030
+ ]
2031
+ })
2032
+ ), zr = Yr, Jr = (t) => /* @__PURE__ */ i.jsxs(
2033
+ "svg",
2034
+ A(w({
2035
+ width: "24",
2036
+ height: "24",
2037
+ viewBox: "0 0 24 24",
2038
+ fill: "none",
2039
+ xmlns: "http://www.w3.org/2000/svg"
2040
+ }, t), {
2041
+ children: [
2042
+ /* @__PURE__ */ i.jsx(
2043
+ "path",
2044
+ {
2045
+ 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",
2046
+ stroke: "currentColor",
2047
+ strokeWidth: "1.5",
2048
+ strokeLinecap: "round",
2049
+ strokeLinejoin: "round"
2050
+ }
2051
+ ),
2052
+ /* @__PURE__ */ i.jsx(
2053
+ "path",
2054
+ {
2055
+ 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",
2056
+ stroke: "currentColor",
2057
+ strokeWidth: "1.5",
2058
+ strokeLinecap: "round",
2059
+ strokeLinejoin: "round"
2060
+ }
2061
+ )
2062
+ ]
2063
+ })
2064
+ ), Xr = Jr, Ir = (t) => /* @__PURE__ */ i.jsxs(
2065
+ "svg",
2066
+ A(w({
2067
+ width: "24",
2068
+ height: "24",
2069
+ viewBox: "0 0 24 24",
2070
+ fill: "none",
2071
+ xmlns: "http://www.w3.org/2000/svg"
2072
+ }, t), {
2073
+ children: [
2074
+ /* @__PURE__ */ i.jsx(
2075
+ "path",
2076
+ {
2077
+ 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",
2078
+ stroke: "currentColor",
2079
+ strokeWidth: "1.5",
2080
+ strokeLinecap: "round",
2081
+ strokeLinejoin: "round"
2082
+ }
2083
+ ),
2084
+ /* @__PURE__ */ i.jsx(
2085
+ "path",
2086
+ {
2087
+ 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",
2088
+ stroke: "currentColor",
2089
+ strokeWidth: "1.5",
2090
+ strokeLinecap: "round",
2091
+ strokeLinejoin: "round"
2092
+ }
2093
+ ),
2094
+ /* @__PURE__ */ i.jsx(
2095
+ "path",
2096
+ {
2097
+ d: "M17.5 16V18.0164V20",
2098
+ stroke: "currentColor",
2099
+ strokeWidth: "1.5",
2100
+ strokeLinecap: "round",
2101
+ strokeLinejoin: "round"
2102
+ }
2103
+ ),
2104
+ /* @__PURE__ */ i.jsx(
2105
+ "path",
2106
+ {
2107
+ d: "M19.5 18L17.4836 18L15.5 18",
2108
+ stroke: "currentColor",
2109
+ strokeWidth: "1.5",
2110
+ strokeLinecap: "round",
2111
+ strokeLinejoin: "round"
2112
+ }
2113
+ )
2114
+ ]
2115
+ })
2116
+ ), Br = Ir, ti = (t) => {
2117
+ var e = t, { className: s } = e, r = L(e, ["className"]);
2118
+ return /* @__PURE__ */ i.jsxs(
2119
+ "svg",
2120
+ A(w({
2121
+ width: "20",
2122
+ height: "20",
2123
+ viewBox: "0 0 20 20",
2124
+ fill: "none",
2125
+ xmlns: "http://www.w3.org/2000/svg",
2126
+ className: N("spinner", s)
2127
+ }, r), {
2128
+ children: [
2129
+ /* @__PURE__ */ i.jsx("circle", { cx: "10", cy: "10", r: "9", stroke: "currentColor", strokeOpacity: "0.2", strokeWidth: "1.5" }),
2130
+ /* @__PURE__ */ i.jsx(
2131
+ "circle",
2132
+ {
2133
+ cx: "10",
2134
+ cy: "10",
2135
+ r: "9",
2136
+ stroke: "currentColor",
2137
+ strokeWidth: "1.5",
2138
+ strokeLinecap: "round",
2139
+ strokeDasharray: "42.42 14.14"
2140
+ }
2141
+ )
2142
+ ]
2143
+ })
2144
+ );
2145
+ }, ei = ti, si = (t) => /* @__PURE__ */ i.jsxs(
2146
+ "svg",
2147
+ A(w({
2148
+ width: "24",
2149
+ height: "24",
2150
+ fill: "none",
2151
+ viewBox: "0 0 24 24",
2152
+ xmlns: "http://www.w3.org/2000/svg"
2153
+ }, t), {
2154
+ children: [
2155
+ /* @__PURE__ */ i.jsxs("g", { clipPath: "url(#clip0_762_2934)", children: [
2156
+ /* @__PURE__ */ i.jsx(
2157
+ "path",
2158
+ {
2159
+ fillRule: "evenodd",
2160
+ clipRule: "evenodd",
2161
+ 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",
2162
+ fill: "currentColor"
2163
+ }
2164
+ ),
2165
+ /* @__PURE__ */ i.jsx(
2166
+ "path",
2167
+ {
2168
+ 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",
2169
+ stroke: "currentColor",
2170
+ strokeWidth: "1.5",
2171
+ strokeLinecap: "round",
2172
+ strokeLinejoin: "round"
2173
+ }
2174
+ )
2175
+ ] }),
2176
+ /* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_762_2934", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
2177
+ ]
2178
+ })
2179
+ ), ri = si, ii = (t) => {
2180
+ const e = (s) => `${s}${t.suffix ? `_${t.suffix}` : ""}`;
2181
+ return /* @__PURE__ */ i.jsxs(
2182
+ "svg",
2183
+ A(w({
2184
+ width: "24",
2185
+ height: "24",
2186
+ viewBox: "0 0 24 24",
2187
+ fill: "none",
2188
+ xmlns: "http://www.w3.org/2000/svg"
2189
+ }, t), {
2190
+ children: [
2191
+ /* @__PURE__ */ i.jsx(
2192
+ "path",
2193
+ {
2194
+ 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",
2195
+ fill: e("url(#paint0")
2196
+ }
2197
+ ),
2198
+ /* @__PURE__ */ i.jsx(
2199
+ "path",
2200
+ {
2201
+ opacity: "0.9",
2202
+ 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",
2203
+ fill: e("url(#paint1")
2204
+ }
2205
+ ),
2206
+ /* @__PURE__ */ i.jsx(
2207
+ "path",
2208
+ {
2209
+ 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",
2210
+ fill: e("url(#paint2")
2211
+ }
2212
+ ),
2213
+ /* @__PURE__ */ i.jsx(
2214
+ "path",
2215
+ {
2216
+ opacity: "0.85",
2217
+ 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",
2218
+ fill: e("url(#paint3")
2219
+ }
2220
+ ),
2221
+ /* @__PURE__ */ i.jsx(
2222
+ "path",
2223
+ {
2224
+ opacity: "0.87",
2225
+ 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",
2226
+ fill: e("url(#paint4")
2227
+ }
2228
+ ),
2229
+ /* @__PURE__ */ i.jsx(
2230
+ "path",
2231
+ {
2232
+ 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",
2233
+ fill: e("url(#paint5")
2234
+ }
2235
+ ),
2236
+ /* @__PURE__ */ i.jsxs("defs", { children: [
2237
+ /* @__PURE__ */ i.jsxs(
2238
+ "linearGradient",
2239
+ {
2240
+ id: e("paint0"),
2241
+ x1: "10.6862",
2242
+ y1: "11.0225",
2243
+ x2: "14.9751",
2244
+ y2: "0.707188",
2245
+ gradientUnits: "userSpaceOnUse",
2246
+ children: [
2247
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.413", stopColor: "#90B117" }),
2248
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.501", stopColor: "#8BAF19" }),
2249
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.601", stopColor: "#7DAB1E" }),
2250
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.706", stopColor: "#67A325" }),
2251
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.815", stopColor: "#479830" }),
2252
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.925", stopColor: "#1F8A3E" }),
2253
+ /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#007F48" })
2254
+ ]
2255
+ }
2256
+ ),
2257
+ /* @__PURE__ */ i.jsxs(
2258
+ "linearGradient",
2259
+ {
2260
+ id: e("paint1"),
2261
+ x1: "11.5281",
2262
+ y1: "8.85339",
2263
+ x2: "12.4519",
2264
+ y2: "1.60772",
2265
+ gradientUnits: "userSpaceOnUse",
2266
+ children: [
2267
+ /* @__PURE__ */ i.jsx("stop", { stopColor: "#36BCEE" }),
2268
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.201", stopColor: "#31ACE3" }),
2269
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.59", stopColor: "#2583C5" }),
2270
+ /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#1652A1" })
2271
+ ]
2272
+ }
2273
+ ),
2274
+ /* @__PURE__ */ i.jsxs(
2275
+ "linearGradient",
2276
+ {
2277
+ id: e("paint2"),
2278
+ x1: "15.0651",
2279
+ y1: "18.7384",
2280
+ x2: "12.9747",
2281
+ y2: "8.0336",
2282
+ gradientUnits: "userSpaceOnUse",
2283
+ children: [
2284
+ /* @__PURE__ */ i.jsx("stop", { stopColor: "#E42313" }),
2285
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.071", stopColor: "#E73611" }),
2286
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.312", stopColor: "#F0710B" }),
2287
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.534", stopColor: "#F6A006" }),
2288
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.73", stopColor: "#FBC103" }),
2289
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.891", stopColor: "#FED601" }),
2290
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.999", stopColor: "#FFDD00" })
2291
+ ]
2292
+ }
2293
+ ),
2294
+ /* @__PURE__ */ i.jsxs(
2295
+ "linearGradient",
2296
+ {
2297
+ id: e("paint3"),
2298
+ x1: "13.9806",
2299
+ y1: "8.29749",
2300
+ x2: "10.8203",
2301
+ y2: "18.1127",
2302
+ gradientUnits: "userSpaceOnUse",
2303
+ children: [
2304
+ /* @__PURE__ */ i.jsx("stop", { stopColor: "#FFC832" }),
2305
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.354", stopColor: "#F8A220" }),
2306
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.779", stopColor: "#F07A0D" }),
2307
+ /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2308
+ ]
2309
+ }
2310
+ ),
2311
+ /* @__PURE__ */ i.jsxs(
2312
+ "linearGradient",
2313
+ {
2314
+ id: e("paint4"),
2315
+ x1: "13.9806",
2316
+ y1: "8.2892",
2317
+ x2: "10.8212",
2318
+ y2: "18.1113",
2319
+ gradientUnits: "userSpaceOnUse",
2320
+ children: [
2321
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.461", stopColor: "#F3C636", stopOpacity: "0" }),
2322
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.645", stopColor: "#F1A223", stopOpacity: "0.341" }),
2323
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.879", stopColor: "#EE7A0E", stopOpacity: "0.776" }),
2324
+ /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "#ED6B06" })
2325
+ ]
2326
+ }
2327
+ ),
2328
+ /* @__PURE__ */ i.jsxs(
2329
+ "radialGradient",
2330
+ {
2331
+ id: e("paint5"),
2332
+ cx: "0",
2333
+ cy: "0",
2334
+ r: "1",
2335
+ gradientUnits: "userSpaceOnUse",
2336
+ gradientTransform: "translate(11.9404 22.4736) scale(7.73227 0.851796)",
2337
+ children: [
2338
+ /* @__PURE__ */ i.jsx("stop", { stopColor: "#C9C9C9" }),
2339
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.302", stopColor: "#CCCCCC", stopOpacity: "0.698" }),
2340
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.554", stopColor: "#D7D7D7", stopOpacity: "0.447" }),
2341
+ /* @__PURE__ */ i.jsx("stop", { offset: "0.787", stopColor: "#E8E8E8", stopOpacity: "0.212" }),
2342
+ /* @__PURE__ */ i.jsx("stop", { offset: "1", stopColor: "white", stopOpacity: "0" })
2343
+ ]
2344
+ }
2345
+ )
2346
+ ] })
2347
+ ]
2348
+ })
2349
+ );
2350
+ }, js = ii, ni = (t) => /* @__PURE__ */ i.jsxs(
2351
+ "svg",
2352
+ A(w({
2353
+ fill: "none",
2354
+ xmlns: "http://www.w3.org/2000/svg",
2355
+ viewBox: "0 0 24 24",
2356
+ width: "24",
2357
+ height: "24"
2358
+ }, t), {
2359
+ children: [
2360
+ /* @__PURE__ */ i.jsx(
2361
+ "path",
2362
+ {
2363
+ 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",
2364
+ stroke: "currentColor",
2365
+ strokeWidth: "1.5",
2366
+ strokeLinecap: "round",
2367
+ strokeLinejoin: "round"
2368
+ }
2369
+ ),
2370
+ /* @__PURE__ */ i.jsx(
2371
+ "path",
2372
+ {
2373
+ 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",
2374
+ stroke: "currentColor",
2375
+ strokeWidth: "1.5",
2376
+ strokeLinecap: "round",
2377
+ strokeLinejoin: "round"
2378
+ }
2379
+ ),
2380
+ /* @__PURE__ */ i.jsx(
2381
+ "path",
2382
+ {
2383
+ 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",
2384
+ stroke: "currentColor",
2385
+ strokeWidth: "1.5",
2386
+ strokeLinecap: "round",
2387
+ strokeLinejoin: "round"
2388
+ }
2389
+ ),
2390
+ /* @__PURE__ */ i.jsx(
2391
+ "path",
2392
+ {
2393
+ d: "M12 3V21",
2394
+ stroke: "currentColor",
2395
+ strokeWidth: "1.5",
2396
+ strokeLinecap: "round",
2397
+ strokeLinejoin: "round"
2398
+ }
2399
+ ),
2400
+ /* @__PURE__ */ i.jsx(
2401
+ "path",
2402
+ {
2403
+ d: "M21 12H3",
2404
+ stroke: "currentColor",
2405
+ strokeWidth: "1.5",
2406
+ strokeLinecap: "round",
2407
+ strokeLinejoin: "round"
2408
+ }
2409
+ )
2410
+ ]
2411
+ })
2412
+ ), ai = ni, oi = (t) => /* @__PURE__ */ i.jsx(
2413
+ "svg",
2414
+ A(w({
2415
+ fill: "none",
2416
+ xmlns: "http://www.w3.org/2000/svg",
2417
+ viewBox: "0 0 21 16",
2418
+ width: "21",
2419
+ height: "16"
2420
+ }, t), {
2421
+ children: /* @__PURE__ */ i.jsx(
2422
+ "path",
2423
+ {
2424
+ 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",
2425
+ stroke: "currentcolor",
2426
+ strokeWidth: "1.5",
2427
+ strokeLinecap: "round",
2428
+ strokeLinejoin: "round"
2429
+ }
2430
+ )
2431
+ })
2432
+ ), li = oi, ci = (t) => /* @__PURE__ */ i.jsxs(
2433
+ "svg",
2434
+ A(w({
2435
+ width: "24",
2436
+ height: "24",
2437
+ fill: "none",
2438
+ xmlns: "http://www.w3.org/2000/svg",
2439
+ viewBox: "0 0 24 24"
2440
+ }, t), {
2441
+ children: [
2442
+ /* @__PURE__ */ i.jsx(
2443
+ "path",
2444
+ {
2445
+ d: "M3 3h6v6H3V3ZM2.8 14.8h6v6h-6v-6ZM20.8 8.8h-6v-6h6v6Z",
2446
+ strokeWidth: "1.5",
2447
+ strokeLinecap: "round",
2448
+ strokeLinejoin: "round",
2449
+ stroke: "currentColor"
2450
+ }
2451
+ ),
2452
+ /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 14.7)", fill: "currentColor" }),
2453
+ /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 14.7)", fill: "currentColor" }),
2454
+ /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 17.8 17.7)", fill: "currentColor" }),
2455
+ /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 14.8 20.7)", fill: "currentColor" }),
2456
+ /* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 20.7)", fill: "currentColor" })
2457
+ ]
2458
+ })
2459
+ ), ui = ci, hi = (t) => {
2460
+ var e = t, {
2461
+ variant: s,
2462
+ icon: r,
2463
+ isStandalone: n,
2464
+ title: l,
2465
+ description: o,
2466
+ className: c
2467
+ } = e, m = L(e, [
2468
+ "variant",
2469
+ "icon",
2470
+ "isStandalone",
2471
+ "title",
2472
+ "description",
2473
+ "className"
2474
+ ]);
2475
+ return /* @__PURE__ */ i.jsx(
2476
+ "div",
2477
+ A(w({}, m), {
2478
+ className: N(
2479
+ "card__empty-state",
2480
+ s === "error" && "card__empty-state--error",
2481
+ n && "card__empty-state--standalone",
2482
+ c
2483
+ ),
2484
+ children: /* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__wrapper", children: [
2485
+ /* @__PURE__ */ i.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ i.jsx(ri, {}) : r }),
2486
+ /* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__content", children: [
2487
+ /* @__PURE__ */ i.jsx("p", { className: "card__empty-state__title", children: l }),
2488
+ /* @__PURE__ */ i.jsx("p", { className: "card__empty-state__description", children: o })
2489
+ ] })
2490
+ ] })
2491
+ })
2492
+ );
2493
+ }, di = ({ children: t }) => /* @__PURE__ */ i.jsx("div", { className: "card__footer", children: t }), fi = (t) => {
2494
+ var e = t, {
2495
+ variant: s = "default",
2496
+ sticky: r,
2497
+ className: n,
2498
+ children: l
2499
+ } = e, o = L(e, [
2500
+ "variant",
2501
+ "sticky",
2502
+ "className",
2503
+ "children"
2504
+ ]);
2505
+ return /* @__PURE__ */ i.jsx(
2506
+ "div",
2507
+ A(w({}, o), {
2508
+ className: N(
2509
+ "card__header",
2510
+ s && `card__header--${s}`,
2511
+ r && "card__header--sticky",
2512
+ n
2513
+ ),
2514
+ children: l
2515
+ })
2516
+ );
2517
+ }, pi = ({ children: t }) => /* @__PURE__ */ i.jsx("div", { className: "card__image", children: t }), mi = ({ children: t, className: e }) => /* @__PURE__ */ i.jsx("div", { className: N("card__body__item", e), children: t }), vi = ({ children: t }) => /* @__PURE__ */ i.jsx("div", { className: "card__body__subtitle", children: t }), gi = ({ icon: t, children: e }) => /* @__PURE__ */ i.jsxs("div", { className: "card__header__title", children: [
2518
+ t && /* @__PURE__ */ i.jsx("span", { className: "card__header__title__icon", children: t }),
2519
+ e
2520
+ ] }), _s = h.forwardRef(
2521
+ (t, e) => {
2522
+ var s = t, { type: r, children: n, className: l, variant: o = "default", disabled: c = !1 } = s, m = L(s, ["type", "children", "className", "variant", "disabled"]);
2523
+ return h.createElement(
2524
+ r,
2525
+ w({
2526
+ className: N(
2527
+ "card",
2528
+ c && "card--disabled",
2529
+ o && `card--${o}`,
2530
+ l
2531
+ ),
2532
+ ref: e
2533
+ }, m),
2534
+ n
2535
+ );
2536
+ }
2537
+ );
2538
+ _s.displayName = "Card";
2539
+ Object.assign(_s, {
2540
+ Header: fi,
2541
+ Action: Tr,
2542
+ Title: gi,
2543
+ Subtitle: vi,
2544
+ Body: Ur,
2545
+ Image: pi,
2546
+ Item: mi,
2547
+ Footer: di,
2548
+ EmptyState: hi
2549
+ });
2550
+ var yi = (t) => {
2551
+ var e = t, { className: s, children: r } = e, n = L(e, ["className", "children"]);
2552
+ return /* @__PURE__ */ i.jsx("div", A(w({ className: N("checkbox__content", s) }, n), { children: r }));
2553
+ }, Ci = (t) => {
2554
+ var e = t, { className: s, children: r } = e, n = L(e, ["className", "children"]);
2555
+ return /* @__PURE__ */ i.jsx("span", A(w({ className: N("checkbox__hint", s) }, n), { children: r }));
2556
+ }, Ss = h.createContext(void 0), xi = ({ id: t, name: e, children: s }) => /* @__PURE__ */ i.jsx(Ss.Provider, { value: { id: t, name: e }, children: s }), bi = () => {
2557
+ const t = h.useContext(Ss);
2558
+ if (!t)
2559
+ throw new Error("Checkbox compound components can not be rendered outside of Checkbox");
2560
+ return t;
2561
+ }, wi = (t) => {
2562
+ var e = t, { className: s, children: r } = e, n = L(e, ["className", "children"]);
2563
+ const { id: l } = bi();
2564
+ return /* @__PURE__ */ i.jsx("label", A(w({ htmlFor: l, className: N("checkbox__label", s) }, n), { children: r }));
2565
+ }, xt = (t) => {
2566
+ var e = t, {
2567
+ id: s,
2568
+ name: r,
2569
+ isPending: n = !1,
2570
+ variant: l = "neutral",
2571
+ hasError: o = !1,
2572
+ single: c,
2573
+ className: m,
2574
+ children: y
2575
+ } = e, d = L(e, [
2576
+ "id",
2577
+ "name",
2578
+ "isPending",
2579
+ "variant",
2580
+ "hasError",
2581
+ "single",
2582
+ "className",
2583
+ "children"
2584
+ ]);
2585
+ const v = h.useRef(null);
2586
+ return h.useEffect(() => {
2587
+ v.current && (n ? v.current.indeterminate = !0 : v.current.indeterminate = !1);
2588
+ }, [n]), /* @__PURE__ */ i.jsxs(
2589
+ "div",
2590
+ {
2591
+ className: N("checkbox", l && `checkbox--${l}`, o && "checkbox--error"),
2592
+ children: [
2593
+ /* @__PURE__ */ i.jsx(
2594
+ "input",
2595
+ w({
2596
+ id: s,
2597
+ name: r,
2598
+ type: "checkbox",
2599
+ ref: v,
2600
+ className: N("checkbox__input", m),
2601
+ value: c ? "true" : ""
2602
+ }, d)
2603
+ ),
2604
+ n ? /* @__PURE__ */ i.jsx(ei, { className: "checkbox__spinner", "aria-hidden": !0 }) : /* @__PURE__ */ i.jsx($r, { className: "checkbox__check", "aria-hidden": !0, strokeDasharray: "75" }),
2605
+ /* @__PURE__ */ i.jsx(xi, { id: s, name: r, children: y })
2606
+ ]
2607
+ }
2608
+ );
2609
+ };
2610
+ xt.Content = yi;
2611
+ xt.Label = wi;
2612
+ xt.Hint = Ci;
2613
+ xt.Error = Error;
2614
+ var ji = (t) => {
2615
+ var e = t, { type: s = "div", className: r, children: n } = e, l = L(e, ["type", "className", "children"]);
2616
+ return h.createElement(s, w({ className: N("dialog__body", r) }, l), n);
2617
+ }, Ee = () => document.body.style.removeProperty("overflow"), Ge = (t) => t.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 = (t) => {
2618
+ var e = t, { className: s, children: r, shouldAnimate: n = !0 } = e, l = L(e, ["className", "children", "shouldAnimate"]);
2619
+ const { ref: o, defaultOpen: c, isModal: m, onClose: y } = te();
2620
+ return h.useEffect(() => {
2621
+ const d = o == null ? void 0 : o.current;
2622
+ if (d != null && d.open) {
2623
+ const v = d.querySelectorAll(_i), u = v[0], p = v[v.length - 1], E = (S) => {
2624
+ if (!(S.key === "Tab"))
2625
+ return;
2626
+ S.shiftKey ? document.activeElement === u && (p.focus(), S.preventDefault()) : document.activeElement === p && (u.focus(), S.preventDefault());
2627
+ };
2628
+ return document.body.style.overflow = "hidden", d.addEventListener("keydown", E), window.addEventListener("popstate", () => Ee()), () => {
2629
+ d.removeEventListener("keydown", E), window.removeEventListener("popstate", () => Ee());
2630
+ };
2631
+ }
2632
+ }, [o]), h.useEffect(() => {
2633
+ const d = o == null ? void 0 : o.current;
2634
+ if (!d)
2635
+ return;
2636
+ if (c && (d.removeAttribute("open"), d.showModal(), d.focus()), m)
2637
+ return d.addEventListener("cancel", Ge), () => d.removeEventListener("cancel", Ge);
2638
+ const v = ({ clientX: u, clientY: p }) => {
2639
+ 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;
2640
+ C && !(_ && O) && y();
2641
+ };
2642
+ return d.addEventListener("cancel", y), d.addEventListener("mousedown", v), () => {
2643
+ d.removeEventListener("cancel", y), d.removeEventListener("mousedown", v);
2644
+ };
2645
+ }, [o, m, y, c]), /* @__PURE__ */ i.jsx(
2646
+ "dialog",
2647
+ A(w({
2648
+ ref: o,
2649
+ open: c,
2650
+ "aria-modal": !!m,
2651
+ "aria-labelledby": "dialogTitle",
2652
+ className: N("dialog", n && "dialog--animated", s)
2653
+ }, l), {
2654
+ children: r
2655
+ })
2656
+ );
2657
+ }, Es = h.createContext(void 0), Ei = ({ defaultOpen: t, onClose: e, isModal: s, children: r }) => {
2658
+ const n = h.useRef(null), l = h.useRef(e), o = h.useCallback(() => {
2659
+ var c;
2660
+ Ee(), (c = n.current) == null || c.close(), l.current && (l == null || l.current());
2661
+ }, [n]);
2662
+ return /* @__PURE__ */ i.jsx(Es.Provider, { value: { ref: n, defaultOpen: t, isModal: s, onClose: o }, children: r });
2663
+ }, te = () => {
2664
+ const t = h.useContext(Es);
2665
+ if (!t)
2666
+ throw new Error("Dialog compound components can not be rendered outside of Dialog");
2667
+ return t;
2668
+ }, Pi = (t) => {
2669
+ var e = t, { children: s } = e, r = L(e, ["children"]);
2670
+ const { onClose: n } = te();
2671
+ return /* @__PURE__ */ i.jsx(Bt, A(w({ onClick: n }, r), { children: s }));
2672
+ }, Ps = h.forwardRef((t, e) => {
2673
+ var s = t, { className: r } = s, n = L(s, ["className"]);
2674
+ const { onClose: l } = te();
2675
+ return /* @__PURE__ */ i.jsx(
2676
+ Bt,
2677
+ w({
2678
+ type: "submit",
2679
+ ref: e,
2680
+ formMethod: "dialog",
2681
+ onClick: l,
2682
+ iconLeft: /* @__PURE__ */ i.jsx(qr, {}),
2683
+ variant: "icon--secondary",
2684
+ className: N("dialog__close button--icon", r)
2685
+ }, n)
2686
+ );
2687
+ });
2688
+ Ps.displayName = "Close";
2689
+ var Ai = (t) => {
2690
+ var e = t, { className: s, children: r } = e, n = L(e, ["className", "children"]);
2691
+ return /* @__PURE__ */ i.jsx("div", A(w({ className: N("dialog__footer", s) }, n), { children: r }));
2692
+ }, Ni = ({ children: t }) => /* @__PURE__ */ i.jsx("div", { className: "dialog__header", children: t }), ki = (t) => {
2693
+ var e = t, { icon: s, children: r, className: n } = e, l = L(e, ["icon", "children", "className"]);
2694
+ const { ref: o } = te(), c = h.useRef(null);
2695
+ return h.useEffect(() => {
2696
+ o != null && o.current && o.current.focus();
2697
+ }, [o]), /* @__PURE__ */ i.jsxs(
2698
+ "div",
2699
+ A(w({
2700
+ tabIndex: 0,
2701
+ ref: c,
2702
+ id: "dialogTitle",
2703
+ className: N("dialog__header__title", n)
2704
+ }, l), {
2705
+ children: [
2706
+ s && /* @__PURE__ */ i.jsx("span", { className: "dialog__header__icon", children: s }),
2707
+ r
2708
+ ]
2709
+ })
2710
+ );
2711
+ }, Oi = (t) => {
2712
+ var e = t, { children: s } = e, r = L(e, ["children"]);
2713
+ const { ref: n } = te();
2714
+ return /* @__PURE__ */ i.jsx(Bt, A(w({ onClick: () => {
2715
+ var l;
2716
+ return (l = n == null ? void 0 : n.current) == null ? void 0 : l.showModal();
2717
+ } }, r), { children: s }));
2718
+ }, $ = ({ defaultOpen: t, isModal: e, children: s, onClose: r }) => /* @__PURE__ */ i.jsx(Ei, { defaultOpen: !!t, isModal: e, onClose: r, children: s });
2719
+ $.Trigger = Oi;
2720
+ $.Root = Si;
2721
+ $.Title = ki;
2722
+ $.Header = Ni;
2723
+ $.Body = ji;
2724
+ $.Footer = Ai;
2725
+ $.Button = Pi;
2726
+ $.Close = Ps;
2727
+ var As = h.createContext(void 0), Mi = ({
2728
+ id: t,
2729
+ position: e,
2730
+ isOpen: s,
2731
+ setIsOpen: r,
2732
+ activeItemIndex: n,
2733
+ setActiveItemIndex: l,
2734
+ clearActiveItemIndex: o,
2735
+ triggerRef: c,
2736
+ contentRef: m,
2737
+ children: y
2738
+ }) => /* @__PURE__ */ i.jsx(
2739
+ As.Provider,
2740
+ {
2741
+ value: {
2742
+ id: t,
2743
+ position: e,
2744
+ isOpen: s,
2745
+ setIsOpen: r,
2746
+ activeItemIndex: n,
2747
+ setActiveItemIndex: l,
2748
+ clearActiveItemIndex: o,
2749
+ triggerRef: c,
2750
+ contentRef: m
2751
+ },
2752
+ children: y
2753
+ }
2754
+ ), Ns = () => {
2755
+ const t = h.useContext(As);
2756
+ if (t === void 0)
2757
+ throw new Error("useMenu must be used within a MenuProvider");
2758
+ return t;
2759
+ }, Li = ({ as: t, children: e }) => {
2760
+ const {
2761
+ id: s,
2762
+ position: r,
2763
+ isOpen: n,
2764
+ setIsOpen: l,
2765
+ activeItemIndex: o,
2766
+ setActiveItemIndex: c,
2767
+ clearActiveItemIndex: m,
2768
+ triggerRef: y,
2769
+ contentRef: d
2770
+ } = Ns(), v = (u) => {
2771
+ var p;
2772
+ if (!n)
2773
+ return;
2774
+ if (u.key === "Escape")
2775
+ return m(), l(!1), (p = y.current) == null ? void 0 : p.focus();
2776
+ const E = u.shiftKey, S = Os(d.current).length - 1;
2777
+ switch (u.key) {
2778
+ case "Tab": {
2779
+ if (E && o !== 0)
2780
+ return u.preventDefault(), c(o ? Math.max(0, o - 1) : 0);
2781
+ if (!E && o !== S) {
2782
+ u.preventDefault();
2783
+ const j = o !== void 0 ? o + 1 : 0;
2784
+ return c(Math.min(S, j));
2785
+ }
2786
+ break;
2787
+ }
2788
+ case "ArrowUp":
2789
+ case "ArrowLeft":
2790
+ return u.preventDefault(), c(o ? Math.max(0, o - 1) : 0);
2791
+ case "ArrowDown":
2792
+ case "ArrowRight": {
2793
+ u.preventDefault();
2794
+ const j = o !== void 0 ? o + 1 : 0;
2795
+ return c(Math.min(S, j));
2796
+ }
2797
+ case "Home":
2798
+ return u.preventDefault(), c(0);
2799
+ case "End":
2800
+ return u.preventDefault(), c(S);
2801
+ }
2802
+ };
2803
+ return t ? h.createElement(
2804
+ t,
2805
+ {
2806
+ id: `${s}-content`,
2807
+ ref: d,
2808
+ className: N("menu__list", `menu__list--${r}`, n && "menu__list--active"),
2809
+ onKeyDown: v
2810
+ },
2811
+ e
2812
+ ) : (
2813
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
2814
+ /* @__PURE__ */ i.jsx(
2815
+ "ul",
2816
+ {
2817
+ id: `${s}-content`,
2818
+ ref: d,
2819
+ className: N("menu__list", `menu__list--${r}`, n && "menu__list--active"),
2820
+ onKeyDown: v,
2821
+ children: e
2822
+ }
2823
+ )
2824
+ );
2825
+ }, Fi = (t) => {
2826
+ var e = t, { children: s, className: r } = e, n = L(e, ["children", "className"]);
2827
+ return /* @__PURE__ */ i.jsx("li", A(w({}, n), { className: N("menu__list-item", r), children: s }));
2828
+ }, ks = ({ children: t, className: e }) => {
2829
+ const { id: s, isOpen: r, setIsOpen: n, clearActiveItemIndex: l, setActiveItemIndex: o, triggerRef: c } = Ns(), m = () => {
2830
+ l(), n((d) => !d), r || o(0);
2831
+ }, y = (d) => {
2832
+ if (r) {
2833
+ if (d.key === "Escape")
2834
+ return l(), n(!1);
2835
+ d.key === "ArrowDown" && (d.preventDefault(), o(0));
2836
+ }
2837
+ };
2838
+ return h.cloneElement(t, {
2839
+ id: `${s}-trigger`,
2840
+ ref: c,
2841
+ className: N("menu__trigger", e),
2842
+ onClick: m,
2843
+ onKeyDown: y,
2844
+ "aria-expanded": r,
2845
+ "aria-controls": `${s}-content`
2846
+ });
2847
+ };
2848
+ ks.displayName = "Trigger";
2849
+ var Os = (t) => t ? t.tagName === "UL" ? t.children : Array.from(t.getElementsByTagName("ul")).reduce((s, r) => [...s, ...Array.from(r.getElementsByTagName("li"))], []) : [], q = (t) => {
2850
+ var e = t, { type: s, id: r, position: n = "bottom-end", children: l, className: o } = e, c = L(e, ["type", "id", "position", "children", "className"]);
2851
+ 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);
2852
+ p !== S && p !== void 0 && d.current && (Os(d.current)[p].firstChild.focus(), j(p));
2853
+ const x = () => {
2854
+ E(void 0), j(void 0);
2855
+ }, C = (_) => {
2856
+ var O;
2857
+ ((O = m.current) == null ? void 0 : O.contains(_.relatedTarget)) || (x(), u(!1));
2858
+ };
2859
+ return /* @__PURE__ */ i.jsx(
2860
+ Mi,
2861
+ {
2862
+ id: r,
2863
+ position: n,
2864
+ isOpen: v,
2865
+ setIsOpen: u,
2866
+ activeItemIndex: p,
2867
+ setActiveItemIndex: E,
2868
+ clearActiveItemIndex: x,
2869
+ triggerRef: y,
2870
+ contentRef: d,
2871
+ children: h.createElement(
2872
+ s,
2873
+ A(w({}, c), {
2874
+ id: r,
2875
+ ref: m,
2876
+ className: `menu ${o || ""}`,
2877
+ onBlur: C
2878
+ }),
2879
+ l
2880
+ )
2881
+ }
2882
+ );
2883
+ };
2884
+ q.Trigger = ks;
2885
+ q.Content = Li;
2886
+ q.Item = Fi;
2887
+ h.createContext(void 0);
2888
+ 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");
2889
+ [...new Set(Ri.values())].map((t) => ({
2890
+ label: `+${t}`,
2891
+ value: t
2892
+ }));
2893
+ h.createContext(void 0);
2894
+ h.createContext(void 0);
2895
+ var le = /* @__PURE__ */ ((t) => (t[t.categoriesVegetables = 0] = "categoriesVegetables", t[t.categoriesMeat = 1] = "categoriesMeat", t[t.categoriesFish = 2] = "categoriesFish", t[t.categoriesDairy = 3] = "categoriesDairy", t[t.categoriesBreakfast = 4] = "categoriesBreakfast", t[t.categoriesSnacks = 5] = "categoriesSnacks", t[t.categoriesCandy = 6] = "categoriesCandy", t[t.categoriesNonFood = 7] = "categoriesNonFood", t[t.categoriesDryFood = 8] = "categoriesDryFood", t[t.categoriesTins = 9] = "categoriesTins", t[t.categoriesGrid = 10] = "categoriesGrid", t[t.categoriesSoda = 11] = "categoriesSoda", t[t.categoriesBakery = 12] = "categoriesBakery", t[t.categoriesWine = 13] = "categoriesWine", t[t.categoriesBaby = 14] = "categoriesBaby", t[t.categoriesDiet = 15] = "categoriesDiet", t[t.categoriesHygiene = 16] = "categoriesHygiene", t[t.categoriesCleaning = 17] = "categoriesCleaning", t[t.categoriesPets = 18] = "categoriesPets", t[t.categoriesFreezer = 19] = "categoriesFreezer", t[t.categoriesBbq = 20] = "categoriesBbq", t[t.categoriesMealbox = 21] = "categoriesMealbox", t[t.categoriesBrik = 22] = "categoriesBrik", t[t.categoriesGranen = 23] = "categoriesGranen", t[t.categoriesConserve = 24] = "categoriesConserve", t[t.categoriesHome = 25] = "categoriesHome", t[t.categoriesEaster = 26] = "categoriesEaster", t[t.categoriesOnlinePromo = 27] = "categoriesOnlinePromo", t[t.categoriesSportFood = 28] = "categoriesSportFood", t[t.categoriesClothing = 29] = "categoriesClothing", t[t.categoriesEnergy = 30] = "categoriesEnergy", t[t.categoriesDeskAndTravel = 31] = "categoriesDeskAndTravel", t[t.categoriesCigarette = 32] = "categoriesCigarette", t[t.categoriesFood = 33] = "categoriesFood", t[t.categoriesChild = 34] = "categoriesChild", t[t.categoriesPuzzle = 35] = "categoriesPuzzle", t[t.categoriesToys = 36] = "categoriesToys", t[t.categoriesCar = 37] = "categoriesCar", t[t.categoriesPlaceholder = 38] = "categoriesPlaceholder", t[t.categoriesFuel = 39] = "categoriesFuel", t[t.categoriesCarAndBike = 40] = "categoriesCarAndBike", t[t.categoriesToyAndHobby = 41] = "categoriesToyAndHobby", t[t.categoriesMultimedia = 42] = "categoriesMultimedia", t[t.categoriesParty = 43] = "categoriesParty", t[t.toolsPay = 44] = "toolsPay", t[t.toolsReceipt = 45] = "toolsReceipt", t[t.toolsFuel = 46] = "toolsFuel", t[t.toolsStoreLocator = 47] = "toolsStoreLocator", t[t.toolsStats = 48] = "toolsStats", t[t.toolsShowXtraOld = 49] = "toolsShowXtraOld", t[t.toolsShowXtraNew = 50] = "toolsShowXtraNew", t[t.toolsScan2 = 51] = "toolsScan2", t[t.toolsRecipes2 = 52] = "toolsRecipes2", t[t.toolsWarranty = 53] = "toolsWarranty", t[t.toolsCoupons = 54] = "toolsCoupons", t[t.toolsFavoriteInactive = 55] = "toolsFavoriteInactive", t[t.toolsFavoriteActive = 56] = "toolsFavoriteActive", t[t.toolsAssortment = 57] = "toolsAssortment", t[t.toolsPromo = 58] = "toolsPromo", t[t.fuelCng = 59] = "fuelCng", t[t.fuelE5 = 60] = "fuelE5", t[t.fuelAdblue = 61] = "fuelAdblue", t[t.fuelB7 = 62] = "fuelB7", t[t.fuelH2 = 63] = "fuelH2", t[t.fuelE10 = 64] = "fuelE10", t[t.fuelFreeTireInflation = 65] = "fuelFreeTireInflation", t[t.functionalClose = 66] = "functionalClose", t[t.functionalBack = 67] = "functionalBack", t[t.functionalSearch = 68] = "functionalSearch", t[t.functionalEdit = 69] = "functionalEdit", t[t.functionalShare = 70] = "functionalShare", t[t.functionalLocation = 71] = "functionalLocation", t[t.functionalTrash = 72] = "functionalTrash", t[t.functionalCamera = 73] = "functionalCamera", t[t.functionalPhone = 74] = "functionalPhone", t[t.functionalPushNotifications = 75] = "functionalPushNotifications", t[t.functionalMail = 76] = "functionalMail", t[t.functionalGift = 77] = "functionalGift", t[t.functionalPresent = 78] = "functionalPresent", t[t.functionalLoading = 79] = "functionalLoading", t[t.functionalChevronRight = 80] = "functionalChevronRight", t[t.functionalCheck = 81] = "functionalCheck", t[t.functionalChevronDown = 82] = "functionalChevronDown", t[t.functionalChevronUp = 83] = "functionalChevronUp", t[t.functionalPlus = 84] = "functionalPlus", t[t.functionalReset = 85] = "functionalReset", t[t.functionalDownload = 86] = "functionalDownload", t[t.functionalExport = 87] = "functionalExport", t[t.functionalCustomerService = 88] = "functionalCustomerService", t[t.functionalTruck = 89] = "functionalTruck", t[t.functionalBox = 90] = "functionalBox", t[t.functionalEllipsis = 91] = "functionalEllipsis", t[t.functionalLocationHome = 92] = "functionalLocationHome", t[t.functionalLocationPickup = 93] = "functionalLocationPickup", t[t.functionalAccount = 94] = "functionalAccount", t[t.functionalPrivacy = 95] = "functionalPrivacy", t[t.functionalSettings = 96] = "functionalSettings", t[t.functionalUserInfo = 97] = "functionalUserInfo", t[t.functionalPinOutlines = 98] = "functionalPinOutlines", t[t.functionalCalendar = 99] = "functionalCalendar", t[t.functionalMinus = 100] = "functionalMinus", t[t.functionalLifestyle = 101] = "functionalLifestyle", t[t.functionalSms = 102] = "functionalSms", t[t.functionalSwitch = 103] = "functionalSwitch", t[t.functionalSorting = 104] = "functionalSorting", t[t.functionalWarningCircle = 105] = "functionalWarningCircle", t[t.functionalQuestionCircle = 106] = "functionalQuestionCircle", t[t.functionalErrorCircle = 107] = "functionalErrorCircle", t[t.functionalSuccessCircle = 108] = "functionalSuccessCircle", t[t.functionalMessage = 109] = "functionalMessage", t[t.functionalExternalLink = 110] = "functionalExternalLink", t[t.functionalAddToList = 111] = "functionalAddToList", t[t.functionalShoppingcart = 112] = "functionalShoppingcart", t[t.functionalFilter = 113] = "functionalFilter", t[t.functionalLocate = 114] = "functionalLocate", t[t.functionalBarcode = 115] = "functionalBarcode", t[t.functionalClock = 116] = "functionalClock", t[t.functionalHistory = 117] = "functionalHistory", t[t.functionalShops = 118] = "functionalShops", t[t.functionalAddUser = 119] = "functionalAddUser", t[t.functionalOther = 120] = "functionalOther", t[t.functionalInAppNotifications = 121] = "functionalInAppNotifications", t[t.functionalExit = 122] = "functionalExit", t[t.functionalShared = 123] = "functionalShared", t[t.functionalThumbsup = 124] = "functionalThumbsup", t[t.functionalDiscount = 125] = "functionalDiscount", t[t.functionalPercentage = 126] = "functionalPercentage", t[t.functionalList = 127] = "functionalList", t[t.functionalMapLocation = 128] = "functionalMapLocation", t[t.functionalNoConnection = 129] = "functionalNoConnection", t[t.functionalSwap = 130] = "functionalSwap", t[t.functionalPiece = 131] = "functionalPiece", t[t.functionalWeight = 132] = "functionalWeight", t[t.functionalPack = 133] = "functionalPack", t[t.functionalCommunications = 134] = "functionalCommunications", t[t.functionalDeliveryAddresses = 135] = "functionalDeliveryAddresses", t[t["functional18+"] = 136] = "functional18+", t[t.functionalReadtime = 137] = "functionalReadtime", t[t.functionalCopy = 138] = "functionalCopy", t[t.functionalMessageField = 139] = "functionalMessageField", t[t.functionalNext = 140] = "functionalNext", t[t.functionalSave = 141] = "functionalSave", t[t.functionalLogin = 142] = "functionalLogin", t[t.functionalLogout = 143] = "functionalLogout", t[t.functionalWebsite = 144] = "functionalWebsite", t[t.functionalMenu = 145] = "functionalMenu", t[t.functionalRegister = 146] = "functionalRegister", t[t.functionalNews = 147] = "functionalNews", t[t.functionalTimer = 148] = "functionalTimer", t[t.functionalEyeShow = 149] = "functionalEyeShow", t[t.functionalMobilePay = 150] = "functionalMobilePay", t[t.functionalConnectionCable = 151] = "functionalConnectionCable", t[t.functionalDryCleaning = 152] = "functionalDryCleaning", t[t.functionalKiosk = 153] = "functionalKiosk", t[t.functionalConnectedDevice = 154] = "functionalConnectedDevice", t[t.functionalCookies = 155] = "functionalCookies", t[t.functionalViewFile = 156] = "functionalViewFile", t[t.functionalLastAdded = 157] = "functionalLastAdded", t[t.functionalFirstAdded = 158] = "functionalFirstAdded", t[t.functionalStoreLayout = 159] = "functionalStoreLayout", t[t.functionalBlock = 160] = "functionalBlock", t[t.functionalChecklist = 161] = "functionalChecklist", t[t.functionalCartCheckout = 162] = "functionalCartCheckout", t[t.functionalCartEdit = 163] = "functionalCartEdit", t[t.functionalEyeHidden = 164] = "functionalEyeHidden", t[t.functionalWarningCircleFilled = 165] = "functionalWarningCircleFilled", t[t.functionalErrorCircleFilled = 166] = "functionalErrorCircleFilled", t[t.functionalSuccessCircleFilled = 167] = "functionalSuccessCircleFilled", t[t.functionalPlusCircle = 168] = "functionalPlusCircle", t[t.functionalSpinner = 169] = "functionalSpinner", t[t.functionalEcoEarth = 170] = "functionalEcoEarth", t[t.functionalAlphaBeta = 171] = "functionalAlphaBeta", t[t.functionalEuro = 172] = "functionalEuro", t[t.functionalNumber = 173] = "functionalNumber", t[t.functionalIdea = 174] = "functionalIdea", t[t.functionalMultifactorAuthenticator = 175] = "functionalMultifactorAuthenticator", t[t.functionalPassword = 176] = "functionalPassword", t[t.functionalDiscountCode = 177] = "functionalDiscountCode", t))(le || {});
2896
+ const Di = "/icons/bouMenuIcons.svg", Ti = ({
2897
+ bouIconId: t,
2898
+ ...e
2899
+ }) => /* @__PURE__ */ i.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", ...e, children: /* @__PURE__ */ i.jsx("use", { href: `${Di}#${le[t]}` }) }), Pe = (t) => typeof t.icon == "string" && t.icon in le ? /* @__PURE__ */ i.jsx(Ti, { bouIconId: le[t.icon] }) : t.icon, Ui = ({
2900
+ label: t,
2901
+ className: e,
2902
+ onClick: s,
2903
+ icon: r
2904
+ }) => /* @__PURE__ */ i.jsx(q.Item, { className: e, children: /* @__PURE__ */ i.jsxs("button", { onClick: s, children: [
2905
+ /* @__PURE__ */ i.jsx(Pe, { icon: r }),
2906
+ t
2907
+ ] }) }), wt = (t) => {
2908
+ const e = $s(), { className: s, label: r, mobileUrl: n, desktopUrl: l, icon: o } = t;
2909
+ return /* @__PURE__ */ i.jsxs(q.Item, { className: s, children: [
2910
+ (!e || e && !l) && /* @__PURE__ */ i.jsxs("a", { href: n, referrerPolicy: "no-referrer-when-downgrade", children: [
2911
+ /* @__PURE__ */ i.jsx(Pe, { icon: o }),
2912
+ r
2913
+ ] }),
2914
+ !!l && /* @__PURE__ */ i.jsxs("a", { href: l, referrerPolicy: "no-referrer-when-downgrade", children: [
2915
+ /* @__PURE__ */ i.jsx(Pe, { icon: o }),
2916
+ r
2917
+ ] })
2918
+ ] });
2919
+ }, Ms = h.createContext(void 0), Qi = ({ position: t, bouMenuItems: e, children: s }) => /* @__PURE__ */ i.jsx(Ms.Provider, { value: { position: t, bouMenuItems: e }, children: s }), Ls = () => {
2920
+ const t = h.useContext(Ms);
2921
+ if (!t)
2922
+ throw new Error("Authentication context can not be rendered outside of Authentication");
2923
+ return t;
2924
+ }, Fs = h.createContext(void 0), Hi = ({ apiUrl: t, redirectUrl: e, children: s }) => /* @__PURE__ */ i.jsx(Fs.Provider, { value: { apiUrl: t, redirectUrl: e }, children: s }), Fe = () => {
2925
+ const t = h.useContext(Fs);
2926
+ if (!t)
2927
+ throw new Error("Api context can not be rendered outside of Api");
2928
+ return t;
2929
+ }, Rs = ({ apiUrl: t, redirectUrl: e, trackingInfo: s }) => {
2930
+ const r = new URLSearchParams({ redirectUrl: e });
2931
+ s && r.append("trackingInfo", s);
2932
+ const n = `${t}/login?${r.toString()}`, l = `${t}/logout?${r.toString()}`;
2933
+ return { loginUrl: n, logoutUrl: l };
2934
+ }, ue = () => {
2935
+ const { apiUrl: t, redirectUrl: e } = Fe(), s = Ks();
2936
+ return Rs({ apiUrl: t, redirectUrl: e, trackingInfo: s });
2937
+ }, $i = () => {
2938
+ const { apiUrl: t } = Fe();
2939
+ return `${`${t}/xtra`}/authentication/v1/user/profile`;
2940
+ }, Ve = (t) => t ? `+${t.countryCode} ${t.number}` : "", We = (t, e) => e == null ? void 0 : e.find((s) => s.type === t), Ze = ({ apiUrl: t, redirectUrl: e }) => {
2941
+ const { loginUrl: s } = Rs({ apiUrl: t, redirectUrl: e });
2942
+ window.location.replace(s);
2943
+ }, Ye = (t) => {
2944
+ var l;
2945
+ if (!t)
2946
+ return { user: { state: () => "NotAuthenticated" }, tryToLogon: Ze };
2947
+ const e = new Date(t.dateOfBirth), s = We(Re.Mobile, t.phone), r = We(Re.Fixed, t.phone), n = Ve(s) ?? Ve(r) ?? "";
2948
+ return {
2949
+ user: {
2950
+ ...(l = window.XTRA) == null ? void 0 : l.user,
2951
+ firstName: () => t.firstName,
2952
+ lastName: () => t.lastName,
2953
+ dob: () => e.getDate(),
2954
+ mob: () => e.getMonth() + 1,
2955
+ yob: () => e.getFullYear(),
2956
+ gender: () => t.genderCode,
2957
+ phone: () => n,
2958
+ streetName: () => {
2959
+ var o;
2960
+ return (o = t.address) == null ? void 0 : o.streetName;
2961
+ },
2962
+ houseNr: () => {
2963
+ var o;
2964
+ return (o = t.address) == null ? void 0 : o.houseNumber;
2965
+ },
2966
+ box: () => {
2967
+ var o;
2968
+ return (o = t.address) == null ? void 0 : o.letterBoxName;
2969
+ },
2970
+ zip: () => {
2971
+ var o;
2972
+ return (o = t.address) == null ? void 0 : o.postalCode;
2973
+ },
2974
+ city: () => {
2975
+ var o;
2976
+ return (o = t.address) == null ? void 0 : o.locationName;
2977
+ },
2978
+ country: () => {
2979
+ var o;
2980
+ return (o = t.address) == null ? void 0 : o.countryCode;
2981
+ },
2982
+ email: () => t.email,
2983
+ cbh: () => t.customerIdentifier,
2984
+ state: () => "Authenticated"
2985
+ },
2986
+ tryToLogon: Ze
2987
+ };
2988
+ }, Ds = ["profile"], Ts = () => {
2989
+ const { i18n: t } = bt(), e = $i(), s = sessionStorage.getItem("profile"), r = !!s;
2990
+ return Cs({
2991
+ queryKey: Ds,
2992
+ queryFn: async () => {
2993
+ const l = await fetch(e, {
2994
+ credentials: "include",
2995
+ mode: "cors",
2996
+ headers: { "Accept-Language": t.language }
2997
+ });
2998
+ if (!l.ok) {
2999
+ if (l.status === 401)
3000
+ return window.XTRA = { ...window.XTRA, ...Ye() }, window.postMessage(
3001
+ { source: "xtra-authentication", isAuthenticated: !1 },
3002
+ new URL(window.location.href).origin
3003
+ ), sessionStorage.removeItem("profile"), { authenticationStatus: "NotAuthenticated" };
3004
+ if (r)
3005
+ return { authenticationStatus: "Authenticated", profile: JSON.parse(s) };
3006
+ throw new Error("Failed to retrieve profile");
3007
+ }
3008
+ const o = await l.json(), { firstName: c, lastName: m } = o;
3009
+ return sessionStorage.setItem("profile", JSON.stringify({ firstName: c, lastName: m })), window.postMessage(
3010
+ { source: "xtra-authentication", isAuthenticated: !0 },
3011
+ new URL(window.location.href).origin
3012
+ ), window.XTRA = { ...window.XTRA, ...Ye(o) }, {
3013
+ authenticationStatus: "Authenticated",
3014
+ profile: { firstName: o.firstName, lastName: o.lastName }
3015
+ };
3016
+ },
3017
+ initialData: r ? {
3018
+ authenticationStatus: "Authenticated",
3019
+ profile: JSON.parse(s)
3020
+ } : void 0,
3021
+ placeholderData: { authenticationStatus: "Pending" },
3022
+ refetchOnWindowFocus: !1
3023
+ });
3024
+ }, Ki = () => {
3025
+ const { t } = bt(), e = ns(), { position: s, bouMenuItems: r } = Ls(), { logoutUrl: n } = ue(), o = Me().getQueryData(Ds), c = (o == null ? void 0 : o.profile.firstName) ?? "", m = (o == null ? void 0 : o.profile.lastName) ?? "", y = () => {
3026
+ sessionStorage.removeItem("profile"), window.location.href = n;
3027
+ };
3028
+ return /* @__PURE__ */ i.jsxs(q, { type: "nav", id: "xtra-menu", position: s, children: [
3029
+ /* @__PURE__ */ i.jsx(
3030
+ q.Trigger,
3031
+ {
3032
+ className: N(
3033
+ "button",
3034
+ "button--neutral",
3035
+ "button--authentication",
3036
+ "button--authentication--authenticated"
3037
+ ),
3038
+ children: /* @__PURE__ */ i.jsxs("button", { children: [
3039
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Rr, { variant: "small", firstName: c, lastName: m }) }),
3040
+ /* @__PURE__ */ i.jsx("span", { className: "button__label", children: c }),
3041
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Le, {}) })
3042
+ ] })
3043
+ }
3044
+ ),
3045
+ /* @__PURE__ */ i.jsxs(q.Content, { as: "div", children: [
3046
+ !!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(
3047
+ wt,
3048
+ {
3049
+ className: "bou-menu-item",
3050
+ mobileUrl: u,
3051
+ icon: v,
3052
+ label: d
3053
+ },
3054
+ p
3055
+ )) }),
3056
+ /* @__PURE__ */ i.jsxs("ul", { children: [
3057
+ /* @__PURE__ */ i.jsx(
3058
+ wt,
3059
+ {
3060
+ className: "manage-profile",
3061
+ mobileUrl: `${e}/manage-profile`,
3062
+ desktopUrl: `${e}/manage-profile/personal-data`,
3063
+ icon: /* @__PURE__ */ i.jsx(Xr, {}),
3064
+ label: t("manageProfile")
3065
+ }
3066
+ ),
3067
+ /* @__PURE__ */ i.jsx(
3068
+ wt,
3069
+ {
3070
+ className: "payment",
3071
+ mobileUrl: `${e}/payment`,
3072
+ icon: /* @__PURE__ */ i.jsx(li, {}),
3073
+ label: t("payment")
3074
+ }
3075
+ ),
3076
+ /* @__PURE__ */ i.jsx(
3077
+ wt,
3078
+ {
3079
+ className: "gift-cards",
3080
+ mobileUrl: `${e}/gift-cards`,
3081
+ icon: /* @__PURE__ */ i.jsx(ai, {}),
3082
+ label: t("giftCards")
3083
+ }
3084
+ ),
3085
+ /* @__PURE__ */ i.jsx(
3086
+ wt,
3087
+ {
3088
+ mobileUrl: `${e}/identifiers`,
3089
+ icon: /* @__PURE__ */ i.jsx(ui, {}),
3090
+ label: t("qrCode")
3091
+ }
3092
+ ),
3093
+ /* @__PURE__ */ i.jsx(
3094
+ wt,
3095
+ {
3096
+ className: "manage-privacy",
3097
+ mobileUrl: `${e}/manage-privacy`,
3098
+ desktopUrl: `${e}/manage-privacy/permissions`,
3099
+ icon: /* @__PURE__ */ i.jsx(zr, {}),
3100
+ label: t("privacy")
3101
+ }
3102
+ ),
3103
+ /* @__PURE__ */ i.jsx(Ui, { onClick: y, icon: /* @__PURE__ */ i.jsx(Zr, {}), label: t("logout") })
3104
+ ] })
3105
+ ] })
3106
+ ] });
3107
+ }, qi = () => {
3108
+ const { t } = bt();
3109
+ return /* @__PURE__ */ i.jsxs("button", { className: N("button", "button--neutral", "button--authentication"), children: [
3110
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx("i", { className: "spinner" }) }),
3111
+ /* @__PURE__ */ i.jsxs("span", { className: "button__label", children: [
3112
+ t("loading"),
3113
+ "..."
3114
+ ] })
3115
+ ] });
3116
+ }, Gi = ({ className: t }) => {
3117
+ const { t: e } = bt(), { loginUrl: s } = ue();
3118
+ return /* @__PURE__ */ i.jsxs(
3119
+ "a",
3120
+ {
3121
+ href: s,
3122
+ className: N(
3123
+ "button",
3124
+ "button--neutral",
3125
+ "button--authentication",
3126
+ "button--authentication--unauthenticated",
3127
+ t
3128
+ ),
3129
+ children: [
3130
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(js, { width: 24, height: 24, suffix: "desktop" }) }),
3131
+ /* @__PURE__ */ i.jsx("span", { className: "button__label", children: e("login") }),
3132
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Le, {}) })
3133
+ ]
3134
+ }
3135
+ );
3136
+ };
3137
+ const Vi = () => {
3138
+ const { t } = bt(), { loginUrl: e } = ue(), s = ns(), { position: r } = Ls();
3139
+ return /* @__PURE__ */ i.jsxs(
3140
+ q,
3141
+ {
3142
+ type: "nav",
3143
+ id: "xtra-menu",
3144
+ position: r,
3145
+ className: "menu--unauthenticated",
3146
+ "aria-label": t("xtraMenuAriaLabel"),
3147
+ children: [
3148
+ /* @__PURE__ */ i.jsx(q.Trigger, { className: N("button", "button--neutral", "button--authentication"), children: /* @__PURE__ */ i.jsxs("button", { children: [
3149
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(js, { width: 24, height: 24, suffix: "mobile" }) }),
3150
+ /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Le, {}) })
3151
+ ] }) }),
3152
+ /* @__PURE__ */ i.jsxs(q.Content, { children: [
3153
+ /* @__PURE__ */ i.jsx(q.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: e, className: "button button--with-icon", children: [
3154
+ /* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Vr, {}) }),
3155
+ /* @__PURE__ */ i.jsx("span", { className: "button__label", children: t("login") })
3156
+ ] }) }),
3157
+ /* @__PURE__ */ i.jsx(q.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: `${s}/onboarding/register`, className: "button button--with-icon", children: [
3158
+ /* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Br, {}) }),
3159
+ /* @__PURE__ */ i.jsx("span", { className: "button__label", children: t("register") })
3160
+ ] }) })
3161
+ ] })
3162
+ ]
3163
+ }
3164
+ );
3165
+ }, Wi = () => {
3166
+ var e, s;
3167
+ const t = Ts();
3168
+ return ((e = t.data) == null ? void 0 : e.authenticationStatus) === "Authenticated" ? /* @__PURE__ */ i.jsx(Ki, {}) : ((s = t.data) == null ? void 0 : s.authenticationStatus) === "NotAuthenticated" || t.isError ? /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
3169
+ /* @__PURE__ */ i.jsx(Gi, {}),
3170
+ /* @__PURE__ */ i.jsx(Vi, {})
3171
+ ] }) : /* @__PURE__ */ i.jsx(qi, {});
3172
+ }, Us = () => {
3173
+ const { apiUrl: t } = Fe();
3174
+ return `${`${t}/xtra`}/authentication/v1/gdpr`;
3175
+ }, Zi = () => {
3176
+ const t = Us(), e = new ps();
3177
+ return Sr({
3178
+ mutationFn: async (r) => {
3179
+ const n = await fetch(`${t}/tc`, {
3180
+ body: JSON.stringify({ acceptedTC: r }),
3181
+ credentials: "include",
3182
+ method: "POST",
3183
+ mode: "cors"
3184
+ });
3185
+ if (!n.ok)
3186
+ throw new Error("Network response was not ok");
3187
+ return n;
3188
+ },
3189
+ onSuccess: async () => {
3190
+ await e.invalidateQueries({ queryKey: ["gdpr"] });
3191
+ }
3192
+ });
3193
+ }, Yi = () => {
3194
+ var l;
3195
+ const { i18n: t } = bt(), e = Us(), r = ((l = Ts().data) == null ? void 0 : l.authenticationStatus) === "Authenticated";
3196
+ return Cs({
3197
+ queryKey: ["gdpr"],
3198
+ queryFn: async () => {
3199
+ const o = await fetch(`${e}/tc/check`, {
3200
+ credentials: "include",
3201
+ mode: "cors",
3202
+ headers: { "Accept-Language": t.language }
3203
+ });
3204
+ if (!o.ok)
3205
+ throw new Error("Network response was not ok");
3206
+ return o.status === 204 ? [] : await o.json();
3207
+ },
3208
+ enabled: r
3209
+ });
3210
+ }, zi = () => {
3211
+ var j;
3212
+ const { t } = bt();
3213
+ qs({ element: "xtra-authentication" });
3214
+ const { logoutUrl: e } = ue(), 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 = t("termsAndConditions.error.required"), E = () => {
3215
+ var x;
3216
+ (x = s == null ? void 0 : s.current) == null || x.click(), document.body.style.removeProperty("overflow");
3217
+ };
3218
+ h.useEffect(() => {
3219
+ u && document.body.style.setProperty("overflow", "hidden");
3220
+ }, [u]), h.useEffect(() => {
3221
+ m && o({ acceptedTC: p });
3222
+ }, [p, m]);
3223
+ const S = (x) => {
3224
+ x.preventDefault(), n(r + 1);
3225
+ const { acceptedTC: C } = x.target;
3226
+ if (C instanceof RadioNodeList) {
3227
+ const _ = Object.values(C);
3228
+ _.every((F) => F.checked) ? (o({}), c(_.map((F) => F.value)), E()) : o({ acceptedTC: p });
3229
+ } else
3230
+ C != null && C.checked ? (o({}), c([C.value]), E()) : o({ acceptedTC: p });
3231
+ };
3232
+ return u ? /* @__PURE__ */ i.jsxs($, { defaultOpen: u, isModal: !0, children: [
3233
+ y,
3234
+ /* @__PURE__ */ i.jsxs($.Root, { children: [
3235
+ /* @__PURE__ */ i.jsx($.Header, { children: /* @__PURE__ */ i.jsx($.Title, { icon: /* @__PURE__ */ i.jsx("i", { className: "commerce__icon" }), children: /* @__PURE__ */ i.jsx(Bi, { children: t("termsAndConditions.title") }) }) }),
3236
+ /* @__PURE__ */ i.jsx($.Body, { children: /* @__PURE__ */ i.jsxs(Qs, { ref: d, id: "tc-form", onSubmit: S, children: [
3237
+ /* @__PURE__ */ i.jsxs(Xi, { children: [
3238
+ t("termsAndConditions.description"),
3239
+ l.acceptedTC && /* @__PURE__ */ i.jsx(tn, { children: p })
3240
+ ] }),
3241
+ v.data.map(({ tcCode: x, title: C, URL: _ }) => /* @__PURE__ */ i.jsx(
3242
+ xt,
3243
+ {
3244
+ id: x,
3245
+ value: x,
3246
+ name: "acceptedTC",
3247
+ variant: "primary",
3248
+ children: /* @__PURE__ */ i.jsxs(xt.Content, { children: [
3249
+ /* @__PURE__ */ i.jsx(Ji, { children: C }),
3250
+ /* @__PURE__ */ i.jsx(Ii, { href: _, children: t("termsAndConditions.action", { title: C }) })
3251
+ ] })
3252
+ },
3253
+ x
3254
+ ))
3255
+ ] }) }),
3256
+ /* @__PURE__ */ i.jsxs($.Footer, { children: [
3257
+ /* @__PURE__ */ i.jsx(
3258
+ "a",
3259
+ {
3260
+ className: N("button", "button--secondary", "button--terms-and-conditions"),
3261
+ href: e,
3262
+ children: t("logout")
3263
+ }
3264
+ ),
3265
+ /* @__PURE__ */ i.jsx(Bt, { form: "tc-form", type: "submit", variant: "primary", children: t("confirm") })
3266
+ ] })
3267
+ ] })
3268
+ ] }) : /* @__PURE__ */ i.jsx(i.Fragment, {});
3269
+ }, Ji = ({
3270
+ children: t,
3271
+ ...e
3272
+ }) => /* @__PURE__ */ i.jsx(xt.Label, { className: "form--tc__label", ...e, children: t }), Qs = h.forwardRef(({ children: t, ...e }, s) => /* @__PURE__ */ i.jsx("form", { className: "form--tc", ref: s, ...e, children: t }));
3273
+ Qs.displayName = "TermsAndConditionsForm";
3274
+ const Xi = ({
3275
+ children: t,
3276
+ ...e
3277
+ }) => /* @__PURE__ */ i.jsx("p", { className: "form--tc__description", ...e, children: t }), Ii = ({ children: t, ...e }) => /* @__PURE__ */ i.jsx(
3278
+ "a",
3279
+ {
3280
+ className: "form--tc__link",
3281
+ target: "_blank",
3282
+ rel: "noreferrer",
3283
+ role: "button",
3284
+ download: !0,
3285
+ ...e,
3286
+ children: t
3287
+ }
3288
+ ), Bi = ({ children: t }) => /* @__PURE__ */ i.jsx("h1", { className: "form--tc__title", children: t }), tn = ({ children: t, ...e }) => /* @__PURE__ */ i.jsx("span", { className: "form--tc__error", role: "alert", ...e, children: t }), en = new ps(), nn = ({ environment: t, redirectUrl: e, apiUrl: s, position: r, commerceId: n, bouMenuItems: l }) => /* @__PURE__ */ i.jsx(Vs, { environment: t, children: /* @__PURE__ */ i.jsx(Ws, { commerceId: n, children: /* @__PURE__ */ i.jsx(Hi, { apiUrl: s, redirectUrl: e, children: /* @__PURE__ */ i.jsxs(dr, { client: en, children: [
3289
+ /* @__PURE__ */ i.jsx(Qi, { position: r, bouMenuItems: l, children: /* @__PURE__ */ i.jsx(Wi, {}) }),
3290
+ /* @__PURE__ */ i.jsx(zi, {})
3291
+ ] }) }) }) });
3292
+ export {
3293
+ nn as default
3294
+ };