@myxtra/authentication-green 1.7.3 → 1.7.4

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