@myxtra/authentication-green 1.15.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/{App-51a9057c.mjs → App-af44a4a3.mjs} +1058 -1165
- package/dist/{index-1d6c1a3a.mjs → index-ae7de489.mjs} +1022 -1022
- package/dist/xtra-authentication.mjs +1 -1
- package/package.json +4 -5
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
1
|
+
var gt = (e, t, s) => {
|
|
2
2
|
if (!t.has(e))
|
|
3
3
|
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var n = (e, t, s) => (
|
|
5
|
+
var n = (e, t, s) => (gt(e, t, "read from private field"), s ? s.call(e) : t.get(e)), p = (e, t, s) => {
|
|
6
6
|
if (t.has(e))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
9
|
-
}, h = (e, t, s, r) => (
|
|
10
|
-
var
|
|
9
|
+
}, h = (e, t, s, r) => (gt(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s);
|
|
10
|
+
var at = (e, t, s, r) => ({
|
|
11
11
|
set _(a) {
|
|
12
12
|
h(e, t, a, s);
|
|
13
13
|
},
|
|
14
14
|
get _() {
|
|
15
15
|
return n(e, t, r);
|
|
16
16
|
}
|
|
17
|
-
}), x = (e, t, s) => (
|
|
18
|
-
import { r as d, j as i, u as
|
|
19
|
-
var
|
|
17
|
+
}), x = (e, t, s) => (gt(e, t, "access private method"), s);
|
|
18
|
+
import { r as d, j as i, u as $s, a as Ks, b as _e, P as Ht, c as cs, d as Gs, E as Vs } from "./index-ae7de489.mjs";
|
|
19
|
+
var Ke = class {
|
|
20
20
|
constructor() {
|
|
21
21
|
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
22
22
|
}
|
|
@@ -32,19 +32,19 @@ var Ge = class {
|
|
|
32
32
|
}
|
|
33
33
|
onUnsubscribe() {
|
|
34
34
|
}
|
|
35
|
-
},
|
|
36
|
-
function
|
|
35
|
+
}, $e = typeof window > "u" || "Deno" in window;
|
|
36
|
+
function Z() {
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function qs(e, t) {
|
|
39
39
|
return typeof e == "function" ? e(t) : e;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function xt(e) {
|
|
42
42
|
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function us(e, t) {
|
|
45
45
|
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function $t(e, t) {
|
|
48
48
|
const {
|
|
49
49
|
type: s = "all",
|
|
50
50
|
exact: r,
|
|
@@ -55,59 +55,59 @@ function Vt(e, t) {
|
|
|
55
55
|
} = e;
|
|
56
56
|
if (l) {
|
|
57
57
|
if (r) {
|
|
58
|
-
if (t.queryHash !==
|
|
58
|
+
if (t.queryHash !== Ft(l, t.options))
|
|
59
59
|
return !1;
|
|
60
|
-
} else if (!
|
|
60
|
+
} else if (!Ve(t.queryKey, l))
|
|
61
61
|
return !1;
|
|
62
62
|
}
|
|
63
63
|
if (s !== "all") {
|
|
64
|
-
const
|
|
65
|
-
if (s === "active" && !
|
|
64
|
+
const m = t.isActive();
|
|
65
|
+
if (s === "active" && !m || s === "inactive" && m)
|
|
66
66
|
return !1;
|
|
67
67
|
}
|
|
68
68
|
return !(typeof c == "boolean" && t.isStale() !== c || typeof a < "u" && a !== t.state.fetchStatus || o && !o(t));
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function Kt(e, t) {
|
|
71
71
|
const { exact: s, status: r, predicate: a, mutationKey: o } = e;
|
|
72
72
|
if (o) {
|
|
73
73
|
if (!t.options.mutationKey)
|
|
74
74
|
return !1;
|
|
75
75
|
if (s) {
|
|
76
|
-
if (
|
|
76
|
+
if (we(t.options.mutationKey) !== we(o))
|
|
77
77
|
return !1;
|
|
78
|
-
} else if (!
|
|
78
|
+
} else if (!Ve(t.options.mutationKey, o))
|
|
79
79
|
return !1;
|
|
80
80
|
}
|
|
81
81
|
return !(r && t.state.status !== r || a && !a(t));
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return ((t == null ? void 0 : t.queryKeyHashFn) ||
|
|
83
|
+
function Ft(e, t) {
|
|
84
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || we)(e);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function we(e) {
|
|
87
87
|
return JSON.stringify(
|
|
88
88
|
e,
|
|
89
|
-
(t, s) =>
|
|
89
|
+
(t, s) => bt(s) ? Object.keys(s).sort().reduce((r, a) => (r[a] = s[a], r), {}) : s
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((s) => !
|
|
92
|
+
function Ve(e, t) {
|
|
93
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((s) => !Ve(e[s], t[s])) : !1;
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function ds(e, t) {
|
|
96
96
|
if (e === t)
|
|
97
97
|
return e;
|
|
98
|
-
const s =
|
|
99
|
-
if (s ||
|
|
100
|
-
const r = s ? e
|
|
101
|
-
let
|
|
102
|
-
for (let
|
|
103
|
-
const
|
|
104
|
-
|
|
98
|
+
const s = Gt(e) && Gt(t);
|
|
99
|
+
if (s || bt(e) && bt(t)) {
|
|
100
|
+
const r = s ? e : Object.keys(e), a = r.length, o = s ? t : Object.keys(t), l = o.length, c = s ? [] : {};
|
|
101
|
+
let m = 0;
|
|
102
|
+
for (let C = 0; C < l; C++) {
|
|
103
|
+
const u = s ? C : o[C];
|
|
104
|
+
!s && e[u] === void 0 && t[u] === void 0 && r.includes(u) ? (c[u] = void 0, m++) : (c[u] = ds(e[u], t[u]), c[u] === e[u] && e[u] !== void 0 && m++);
|
|
105
105
|
}
|
|
106
|
-
return
|
|
106
|
+
return a === l && m === a ? e : c;
|
|
107
107
|
}
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function ct(e, t) {
|
|
111
111
|
if (e && !t || t && !e)
|
|
112
112
|
return !1;
|
|
113
113
|
for (const s in e)
|
|
@@ -115,48 +115,45 @@ function ht(e, t) {
|
|
|
115
115
|
return !1;
|
|
116
116
|
return !0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Gt(e) {
|
|
119
119
|
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
if (!
|
|
121
|
+
function bt(e) {
|
|
122
|
+
if (!Vt(e))
|
|
123
123
|
return !1;
|
|
124
124
|
const t = e.constructor;
|
|
125
125
|
if (typeof t > "u")
|
|
126
126
|
return !0;
|
|
127
127
|
const s = t.prototype;
|
|
128
|
-
return !(!
|
|
128
|
+
return !(!Vt(s) || !s.hasOwnProperty("isPrototypeOf"));
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Vt(e) {
|
|
131
131
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Ws(e) {
|
|
134
134
|
return new Promise((t) => {
|
|
135
135
|
setTimeout(t, e);
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
138
|
+
function wt(e, t, s) {
|
|
139
|
+
return typeof s.structuralSharing == "function" ? s.structuralSharing(e, t) : s.structuralSharing !== !1 ? ds(e, t) : t;
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
return typeof s.structuralSharing == "function" ? s.structuralSharing(e, t) : s.structuralSharing !== !1 ? vs(e, t) : t;
|
|
143
|
-
}
|
|
144
|
-
function Is(e, t, s = 0) {
|
|
141
|
+
function Zs(e, t, s = 0) {
|
|
145
142
|
const r = [...e, t];
|
|
146
143
|
return s && r.length > s ? r.slice(1) : r;
|
|
147
144
|
}
|
|
148
|
-
function
|
|
145
|
+
function Ys(e, t, s = 0) {
|
|
149
146
|
const r = [t, ...e];
|
|
150
147
|
return s && r.length > s ? r.slice(0, -1) : r;
|
|
151
148
|
}
|
|
152
|
-
var
|
|
149
|
+
var pe, ne, Ee, Bt, zs = (Bt = class extends Ke {
|
|
153
150
|
constructor() {
|
|
154
151
|
super();
|
|
155
|
-
p(this,
|
|
156
|
-
p(this,
|
|
157
|
-
p(this,
|
|
158
|
-
h(this,
|
|
159
|
-
if (
|
|
152
|
+
p(this, pe, void 0);
|
|
153
|
+
p(this, ne, void 0);
|
|
154
|
+
p(this, Ee, void 0);
|
|
155
|
+
h(this, Ee, (t) => {
|
|
156
|
+
if (!$e && window.addEventListener) {
|
|
160
157
|
const s = () => t();
|
|
161
158
|
return window.addEventListener("visibilitychange", s, !1), () => {
|
|
162
159
|
window.removeEventListener("visibilitychange", s);
|
|
@@ -165,20 +162,20 @@ var me, ae, Ae, is, er = (is = class extends Ge {
|
|
|
165
162
|
});
|
|
166
163
|
}
|
|
167
164
|
onSubscribe() {
|
|
168
|
-
n(this,
|
|
165
|
+
n(this, ne) || this.setEventListener(n(this, Ee));
|
|
169
166
|
}
|
|
170
167
|
onUnsubscribe() {
|
|
171
168
|
var t;
|
|
172
|
-
this.hasListeners() || ((t = n(this,
|
|
169
|
+
this.hasListeners() || ((t = n(this, ne)) == null || t.call(this), h(this, ne, void 0));
|
|
173
170
|
}
|
|
174
171
|
setEventListener(t) {
|
|
175
172
|
var s;
|
|
176
|
-
h(this,
|
|
173
|
+
h(this, Ee, t), (s = n(this, ne)) == null || s.call(this), h(this, ne, t((r) => {
|
|
177
174
|
typeof r == "boolean" ? this.setFocused(r) : this.onFocus();
|
|
178
175
|
}));
|
|
179
176
|
}
|
|
180
177
|
setFocused(t) {
|
|
181
|
-
n(this,
|
|
178
|
+
n(this, pe) !== t && (h(this, pe, t), this.onFocus());
|
|
182
179
|
}
|
|
183
180
|
onFocus() {
|
|
184
181
|
this.listeners.forEach((t) => {
|
|
@@ -187,16 +184,16 @@ var me, ae, Ae, is, er = (is = class extends Ge {
|
|
|
187
184
|
}
|
|
188
185
|
isFocused() {
|
|
189
186
|
var t;
|
|
190
|
-
return typeof n(this,
|
|
187
|
+
return typeof n(this, pe) == "boolean" ? n(this, pe) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
191
188
|
}
|
|
192
|
-
},
|
|
189
|
+
}, pe = new WeakMap(), ne = new WeakMap(), Ee = new WeakMap(), Bt), ut = new zs(), Se, ae, Ae, es, Js = (es = class extends Ke {
|
|
193
190
|
constructor() {
|
|
194
191
|
super();
|
|
195
192
|
p(this, Se, !0);
|
|
196
|
-
p(this,
|
|
197
|
-
p(this,
|
|
198
|
-
h(this,
|
|
199
|
-
if (
|
|
193
|
+
p(this, ae, void 0);
|
|
194
|
+
p(this, Ae, void 0);
|
|
195
|
+
h(this, Ae, (t) => {
|
|
196
|
+
if (!$e && window.addEventListener) {
|
|
200
197
|
const s = () => t(!0), r = () => t(!1);
|
|
201
198
|
return window.addEventListener("online", s, !1), window.addEventListener("offline", r, !1), () => {
|
|
202
199
|
window.removeEventListener("online", s), window.removeEventListener("offline", r);
|
|
@@ -205,15 +202,15 @@ var me, ae, Ae, is, er = (is = class extends Ge {
|
|
|
205
202
|
});
|
|
206
203
|
}
|
|
207
204
|
onSubscribe() {
|
|
208
|
-
n(this,
|
|
205
|
+
n(this, ae) || this.setEventListener(n(this, Ae));
|
|
209
206
|
}
|
|
210
207
|
onUnsubscribe() {
|
|
211
208
|
var t;
|
|
212
|
-
this.hasListeners() || ((t = n(this,
|
|
209
|
+
this.hasListeners() || ((t = n(this, ae)) == null || t.call(this), h(this, ae, void 0));
|
|
213
210
|
}
|
|
214
211
|
setEventListener(t) {
|
|
215
212
|
var s;
|
|
216
|
-
h(this,
|
|
213
|
+
h(this, Ae, t), (s = n(this, ae)) == null || s.call(this), h(this, ae, t(this.setOnline.bind(this)));
|
|
217
214
|
}
|
|
218
215
|
setOnline(t) {
|
|
219
216
|
n(this, Se) !== t && (h(this, Se, t), this.listeners.forEach((r) => {
|
|
@@ -223,171 +220,174 @@ var me, ae, Ae, is, er = (is = class extends Ge {
|
|
|
223
220
|
isOnline() {
|
|
224
221
|
return n(this, Se);
|
|
225
222
|
}
|
|
226
|
-
}, Se = new WeakMap(),
|
|
227
|
-
function
|
|
223
|
+
}, Se = new WeakMap(), ae = new WeakMap(), Ae = new WeakMap(), es), dt = new Js();
|
|
224
|
+
function Xs(e) {
|
|
228
225
|
return Math.min(1e3 * 2 ** e, 3e4);
|
|
229
226
|
}
|
|
230
|
-
function
|
|
231
|
-
return (e ?? "online") === "online" ?
|
|
227
|
+
function vt(e) {
|
|
228
|
+
return (e ?? "online") === "online" ? dt.isOnline() : !0;
|
|
232
229
|
}
|
|
233
|
-
var
|
|
230
|
+
var hs = class {
|
|
234
231
|
constructor(e) {
|
|
235
232
|
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
236
233
|
}
|
|
237
234
|
};
|
|
238
|
-
function
|
|
239
|
-
return e instanceof
|
|
235
|
+
function Ct(e) {
|
|
236
|
+
return e instanceof hs;
|
|
240
237
|
}
|
|
241
|
-
function
|
|
238
|
+
function fs(e) {
|
|
242
239
|
let t = !1, s = 0, r = !1, a, o, l;
|
|
243
|
-
const c = new Promise((
|
|
244
|
-
o =
|
|
245
|
-
}),
|
|
246
|
-
var
|
|
247
|
-
r || (
|
|
248
|
-
},
|
|
240
|
+
const c = new Promise((y, g) => {
|
|
241
|
+
o = y, l = g;
|
|
242
|
+
}), m = (y) => {
|
|
243
|
+
var g;
|
|
244
|
+
r || (f(new hs(y)), (g = e.abort) == null || g.call(e));
|
|
245
|
+
}, C = () => {
|
|
249
246
|
t = !0;
|
|
250
247
|
}, u = () => {
|
|
251
248
|
t = !1;
|
|
252
|
-
},
|
|
253
|
-
var
|
|
254
|
-
r || (r = !0, (
|
|
255
|
-
},
|
|
256
|
-
var
|
|
257
|
-
r || (r = !0, (
|
|
258
|
-
},
|
|
259
|
-
var
|
|
249
|
+
}, b = () => !ut.isFocused() || e.networkMode !== "always" && !dt.isOnline(), v = (y) => {
|
|
250
|
+
var g;
|
|
251
|
+
r || (r = !0, (g = e.onSuccess) == null || g.call(e, y), a == null || a(), o(y));
|
|
252
|
+
}, f = (y) => {
|
|
253
|
+
var g;
|
|
254
|
+
r || (r = !0, (g = e.onError) == null || g.call(e, y), a == null || a(), l(y));
|
|
255
|
+
}, w = () => new Promise((y) => {
|
|
256
|
+
var g;
|
|
260
257
|
a = (S) => {
|
|
261
|
-
const
|
|
262
|
-
return
|
|
263
|
-
}, (
|
|
258
|
+
const _ = r || !b();
|
|
259
|
+
return _ && y(S), _;
|
|
260
|
+
}, (g = e.onPause) == null || g.call(e);
|
|
264
261
|
}).then(() => {
|
|
265
|
-
var
|
|
266
|
-
a = void 0, r || (
|
|
267
|
-
}),
|
|
262
|
+
var y;
|
|
263
|
+
a = void 0, r || (y = e.onContinue) == null || y.call(e);
|
|
264
|
+
}), E = () => {
|
|
268
265
|
if (r)
|
|
269
266
|
return;
|
|
270
|
-
let
|
|
267
|
+
let y;
|
|
271
268
|
try {
|
|
272
|
-
|
|
273
|
-
} catch (
|
|
274
|
-
|
|
269
|
+
y = e.fn();
|
|
270
|
+
} catch (g) {
|
|
271
|
+
y = Promise.reject(g);
|
|
275
272
|
}
|
|
276
|
-
Promise.resolve(
|
|
277
|
-
var
|
|
273
|
+
Promise.resolve(y).then(v).catch((g) => {
|
|
274
|
+
var $;
|
|
278
275
|
if (r)
|
|
279
276
|
return;
|
|
280
|
-
const S = e.retry ?? (
|
|
281
|
-
if (t || !
|
|
282
|
-
|
|
277
|
+
const S = e.retry ?? ($e ? 0 : 3), _ = e.retryDelay ?? Xs, k = typeof _ == "function" ? _(s, g) : _, L = S === !0 || typeof S == "number" && s < S || typeof S == "function" && S(s, g);
|
|
278
|
+
if (t || !L) {
|
|
279
|
+
f(g);
|
|
283
280
|
return;
|
|
284
281
|
}
|
|
285
|
-
s++, (
|
|
286
|
-
if (
|
|
287
|
-
return
|
|
282
|
+
s++, ($ = e.onFail) == null || $.call(e, s, g), Ws(k).then(() => {
|
|
283
|
+
if (b())
|
|
284
|
+
return w();
|
|
288
285
|
}).then(() => {
|
|
289
|
-
t ?
|
|
286
|
+
t ? f(g) : E();
|
|
290
287
|
});
|
|
291
288
|
});
|
|
292
289
|
};
|
|
293
|
-
return
|
|
290
|
+
return vt(e.networkMode) ? E() : w().then(E), {
|
|
294
291
|
promise: c,
|
|
295
|
-
cancel:
|
|
292
|
+
cancel: m,
|
|
296
293
|
continue: () => (a == null ? void 0 : a()) ? c : Promise.resolve(),
|
|
297
|
-
cancelRetry:
|
|
294
|
+
cancelRetry: C,
|
|
298
295
|
continueRetry: u
|
|
299
296
|
};
|
|
300
297
|
}
|
|
301
|
-
function
|
|
302
|
-
let e = [], t = 0, s = (
|
|
303
|
-
|
|
304
|
-
}, r = (
|
|
305
|
-
|
|
306
|
-
};
|
|
307
|
-
const
|
|
308
|
-
|
|
298
|
+
function Is() {
|
|
299
|
+
let e = [], t = 0, s = (v) => {
|
|
300
|
+
v();
|
|
301
|
+
}, r = (v) => {
|
|
302
|
+
v();
|
|
303
|
+
}, a = (v) => setTimeout(v, 0);
|
|
304
|
+
const o = (v) => {
|
|
305
|
+
a = v;
|
|
306
|
+
}, l = (v) => {
|
|
307
|
+
let f;
|
|
309
308
|
t++;
|
|
310
309
|
try {
|
|
311
|
-
|
|
310
|
+
f = v();
|
|
312
311
|
} finally {
|
|
313
|
-
t--, t ||
|
|
312
|
+
t--, t || C();
|
|
314
313
|
}
|
|
315
|
-
return
|
|
316
|
-
},
|
|
317
|
-
t ? e.push(
|
|
318
|
-
s(
|
|
314
|
+
return f;
|
|
315
|
+
}, c = (v) => {
|
|
316
|
+
t ? e.push(v) : a(() => {
|
|
317
|
+
s(v);
|
|
319
318
|
});
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
|
|
319
|
+
}, m = (v) => (...f) => {
|
|
320
|
+
c(() => {
|
|
321
|
+
v(...f);
|
|
323
322
|
});
|
|
324
|
-
},
|
|
325
|
-
const
|
|
326
|
-
e = [],
|
|
323
|
+
}, C = () => {
|
|
324
|
+
const v = e;
|
|
325
|
+
e = [], v.length && a(() => {
|
|
327
326
|
r(() => {
|
|
328
|
-
|
|
329
|
-
s(
|
|
327
|
+
v.forEach((f) => {
|
|
328
|
+
s(f);
|
|
330
329
|
});
|
|
331
330
|
});
|
|
332
331
|
});
|
|
333
332
|
};
|
|
334
333
|
return {
|
|
335
|
-
batch:
|
|
336
|
-
batchCalls:
|
|
337
|
-
schedule:
|
|
338
|
-
setNotifyFunction: (
|
|
339
|
-
s =
|
|
334
|
+
batch: l,
|
|
335
|
+
batchCalls: m,
|
|
336
|
+
schedule: c,
|
|
337
|
+
setNotifyFunction: (v) => {
|
|
338
|
+
s = v;
|
|
340
339
|
},
|
|
341
|
-
setBatchNotifyFunction: (
|
|
342
|
-
r =
|
|
343
|
-
}
|
|
340
|
+
setBatchNotifyFunction: (v) => {
|
|
341
|
+
r = v;
|
|
342
|
+
},
|
|
343
|
+
setScheduler: o
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
var
|
|
346
|
+
var R = Is(), me, ts, ps = (ts = class {
|
|
347
347
|
constructor() {
|
|
348
|
-
p(this,
|
|
348
|
+
p(this, me, void 0);
|
|
349
349
|
}
|
|
350
350
|
destroy() {
|
|
351
351
|
this.clearGcTimeout();
|
|
352
352
|
}
|
|
353
353
|
scheduleGc() {
|
|
354
|
-
this.clearGcTimeout(),
|
|
354
|
+
this.clearGcTimeout(), xt(this.gcTime) && h(this, me, setTimeout(() => {
|
|
355
355
|
this.optionalRemove();
|
|
356
356
|
}, this.gcTime));
|
|
357
357
|
}
|
|
358
358
|
updateGcTime(e) {
|
|
359
359
|
this.gcTime = Math.max(
|
|
360
360
|
this.gcTime || 0,
|
|
361
|
-
e ?? (
|
|
361
|
+
e ?? ($e ? 1 / 0 : 5 * 60 * 1e3)
|
|
362
362
|
);
|
|
363
363
|
}
|
|
364
364
|
clearGcTimeout() {
|
|
365
|
-
n(this,
|
|
365
|
+
n(this, me) && (clearTimeout(n(this, me)), h(this, me, void 0));
|
|
366
366
|
}
|
|
367
|
-
},
|
|
367
|
+
}, me = new WeakMap(), ts), Pe, Ne, V, oe, q, D, qe, ve, ke, ot, z, te, ss, Bs = (ss = class extends ps {
|
|
368
368
|
constructor(t) {
|
|
369
369
|
super();
|
|
370
|
-
p(this,
|
|
371
|
-
p(this,
|
|
370
|
+
p(this, ke);
|
|
371
|
+
p(this, z);
|
|
372
372
|
p(this, Pe, void 0);
|
|
373
373
|
p(this, Ne, void 0);
|
|
374
|
-
p(this, q, void 0);
|
|
375
|
-
p(this, le, void 0);
|
|
376
374
|
p(this, V, void 0);
|
|
377
|
-
p(this,
|
|
378
|
-
p(this,
|
|
379
|
-
p(this,
|
|
380
|
-
|
|
375
|
+
p(this, oe, void 0);
|
|
376
|
+
p(this, q, void 0);
|
|
377
|
+
p(this, D, void 0);
|
|
378
|
+
p(this, qe, void 0);
|
|
379
|
+
p(this, ve, void 0);
|
|
380
|
+
h(this, ve, !1), h(this, qe, t.defaultOptions), x(this, ke, ot).call(this, t.options), h(this, D, []), h(this, V, t.cache), this.queryKey = t.queryKey, this.queryHash = t.queryHash, h(this, Pe, t.state || er(this.options)), this.state = n(this, Pe), this.scheduleGc();
|
|
381
381
|
}
|
|
382
382
|
get meta() {
|
|
383
383
|
return this.options.meta;
|
|
384
384
|
}
|
|
385
385
|
optionalRemove() {
|
|
386
|
-
!n(this,
|
|
386
|
+
!n(this, D).length && this.state.fetchStatus === "idle" && n(this, V).remove(this);
|
|
387
387
|
}
|
|
388
388
|
setData(t, s) {
|
|
389
|
-
const r =
|
|
390
|
-
return x(this,
|
|
389
|
+
const r = wt(this.state.data, t, this.options);
|
|
390
|
+
return x(this, z, te).call(this, {
|
|
391
391
|
data: r,
|
|
392
392
|
type: "success",
|
|
393
393
|
dataUpdatedAt: s == null ? void 0 : s.updatedAt,
|
|
@@ -395,12 +395,12 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
395
395
|
}), r;
|
|
396
396
|
}
|
|
397
397
|
setState(t, s) {
|
|
398
|
-
x(this,
|
|
398
|
+
x(this, z, te).call(this, { type: "setState", state: t, setStateOptions: s });
|
|
399
399
|
}
|
|
400
400
|
cancel(t) {
|
|
401
401
|
var r;
|
|
402
|
-
const s = n(this,
|
|
403
|
-
return (r = n(this,
|
|
402
|
+
const s = n(this, oe);
|
|
403
|
+
return (r = n(this, q)) == null || r.cancel(t), s ? s.then(Z).catch(Z) : Promise.resolve();
|
|
404
404
|
}
|
|
405
405
|
destroy() {
|
|
406
406
|
super.destroy(), this.cancel({ silent: !0 });
|
|
@@ -409,7 +409,7 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
409
409
|
this.destroy(), this.setState(n(this, Pe));
|
|
410
410
|
}
|
|
411
411
|
isActive() {
|
|
412
|
-
return n(this,
|
|
412
|
+
return n(this, D).some(
|
|
413
413
|
(t) => t.options.enabled !== !1
|
|
414
414
|
);
|
|
415
415
|
}
|
|
@@ -417,56 +417,56 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
417
417
|
return this.getObserversCount() > 0 && !this.isActive();
|
|
418
418
|
}
|
|
419
419
|
isStale() {
|
|
420
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || n(this,
|
|
420
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || n(this, D).some((t) => t.getCurrentResult().isStale);
|
|
421
421
|
}
|
|
422
422
|
isStaleByTime(t = 0) {
|
|
423
|
-
return this.state.isInvalidated || !this.state.dataUpdatedAt || !
|
|
423
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !us(this.state.dataUpdatedAt, t);
|
|
424
424
|
}
|
|
425
425
|
onFocus() {
|
|
426
426
|
var s;
|
|
427
|
-
const t = n(this,
|
|
428
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (s = n(this,
|
|
427
|
+
const t = n(this, D).find((r) => r.shouldFetchOnWindowFocus());
|
|
428
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = n(this, q)) == null || s.continue();
|
|
429
429
|
}
|
|
430
430
|
onOnline() {
|
|
431
431
|
var s;
|
|
432
|
-
const t = n(this,
|
|
433
|
-
t == null || t.refetch({ cancelRefetch: !1 }), (s = n(this,
|
|
432
|
+
const t = n(this, D).find((r) => r.shouldFetchOnReconnect());
|
|
433
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (s = n(this, q)) == null || s.continue();
|
|
434
434
|
}
|
|
435
435
|
addObserver(t) {
|
|
436
|
-
n(this,
|
|
436
|
+
n(this, D).includes(t) || (n(this, D).push(t), this.clearGcTimeout(), n(this, V).notify({ type: "observerAdded", query: this, observer: t }));
|
|
437
437
|
}
|
|
438
438
|
removeObserver(t) {
|
|
439
|
-
n(this,
|
|
439
|
+
n(this, D).includes(t) && (h(this, D, n(this, D).filter((s) => s !== t)), n(this, D).length || (n(this, q) && (n(this, ve) ? n(this, q).cancel({ revert: !0 }) : n(this, q).cancelRetry()), this.scheduleGc()), n(this, V).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
440
440
|
}
|
|
441
441
|
getObserversCount() {
|
|
442
|
-
return n(this,
|
|
442
|
+
return n(this, D).length;
|
|
443
443
|
}
|
|
444
444
|
invalidate() {
|
|
445
|
-
this.state.isInvalidated || x(this,
|
|
445
|
+
this.state.isInvalidated || x(this, z, te).call(this, { type: "invalidate" });
|
|
446
446
|
}
|
|
447
447
|
fetch(t, s) {
|
|
448
|
-
var
|
|
448
|
+
var C, u, b, v;
|
|
449
449
|
if (this.state.fetchStatus !== "idle") {
|
|
450
450
|
if (this.state.dataUpdatedAt && (s != null && s.cancelRefetch))
|
|
451
451
|
this.cancel({ silent: !0 });
|
|
452
|
-
else if (n(this,
|
|
453
|
-
return (
|
|
452
|
+
else if (n(this, oe))
|
|
453
|
+
return (C = n(this, q)) == null || C.continueRetry(), n(this, oe);
|
|
454
454
|
}
|
|
455
|
-
if (t && x(this,
|
|
456
|
-
const
|
|
457
|
-
|
|
455
|
+
if (t && x(this, ke, ot).call(this, t), !this.options.queryFn) {
|
|
456
|
+
const f = n(this, D).find((w) => w.options.queryFn);
|
|
457
|
+
f && x(this, ke, ot).call(this, f.options);
|
|
458
458
|
}
|
|
459
459
|
const r = new AbortController(), a = {
|
|
460
460
|
queryKey: this.queryKey,
|
|
461
461
|
meta: this.meta
|
|
462
|
-
}, o = (
|
|
463
|
-
Object.defineProperty(
|
|
462
|
+
}, o = (f) => {
|
|
463
|
+
Object.defineProperty(f, "signal", {
|
|
464
464
|
enumerable: !0,
|
|
465
|
-
get: () => (h(this,
|
|
465
|
+
get: () => (h(this, ve, !0), r.signal)
|
|
466
466
|
});
|
|
467
467
|
};
|
|
468
468
|
o(a);
|
|
469
|
-
const l = () => this.options.queryFn ? (h(this,
|
|
469
|
+
const l = () => this.options.queryFn ? (h(this, ve, !1), this.options.persister ? this.options.persister(
|
|
470
470
|
this.options.queryFn,
|
|
471
471
|
a,
|
|
472
472
|
this
|
|
@@ -484,57 +484,57 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
484
484
|
o(c), (u = this.options.behavior) == null || u.onFetch(
|
|
485
485
|
c,
|
|
486
486
|
this
|
|
487
|
-
), h(this, Ne, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((
|
|
488
|
-
const
|
|
489
|
-
var
|
|
490
|
-
|
|
487
|
+
), h(this, Ne, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((b = c.fetchOptions) == null ? void 0 : b.meta)) && x(this, z, te).call(this, { type: "fetch", meta: (v = c.fetchOptions) == null ? void 0 : v.meta });
|
|
488
|
+
const m = (f) => {
|
|
489
|
+
var w, E, y, g;
|
|
490
|
+
Ct(f) && f.silent || x(this, z, te).call(this, {
|
|
491
491
|
type: "error",
|
|
492
|
-
error:
|
|
493
|
-
}),
|
|
494
|
-
|
|
495
|
-
|
|
492
|
+
error: f
|
|
493
|
+
}), Ct(f) || ((E = (w = n(this, V).config).onError) == null || E.call(
|
|
494
|
+
w,
|
|
495
|
+
f,
|
|
496
496
|
this
|
|
497
|
-
), (
|
|
498
|
-
|
|
497
|
+
), (g = (y = n(this, V).config).onSettled) == null || g.call(
|
|
498
|
+
y,
|
|
499
499
|
this.state.data,
|
|
500
|
-
|
|
500
|
+
f,
|
|
501
501
|
this
|
|
502
502
|
)), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
503
503
|
};
|
|
504
|
-
return h(this,
|
|
504
|
+
return h(this, q, fs({
|
|
505
505
|
fn: c.fetchFn,
|
|
506
506
|
abort: r.abort.bind(r),
|
|
507
|
-
onSuccess: (
|
|
508
|
-
var
|
|
509
|
-
if (typeof
|
|
510
|
-
|
|
507
|
+
onSuccess: (f) => {
|
|
508
|
+
var w, E, y, g;
|
|
509
|
+
if (typeof f > "u") {
|
|
510
|
+
m(new Error(`${this.queryHash} data is undefined`));
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
|
-
this.setData(
|
|
514
|
-
|
|
515
|
-
|
|
513
|
+
this.setData(f), (E = (w = n(this, V).config).onSuccess) == null || E.call(w, f, this), (g = (y = n(this, V).config).onSettled) == null || g.call(
|
|
514
|
+
y,
|
|
515
|
+
f,
|
|
516
516
|
this.state.error,
|
|
517
517
|
this
|
|
518
518
|
), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
519
519
|
},
|
|
520
|
-
onError:
|
|
521
|
-
onFail: (
|
|
522
|
-
x(this,
|
|
520
|
+
onError: m,
|
|
521
|
+
onFail: (f, w) => {
|
|
522
|
+
x(this, z, te).call(this, { type: "failed", failureCount: f, error: w });
|
|
523
523
|
},
|
|
524
524
|
onPause: () => {
|
|
525
|
-
x(this,
|
|
525
|
+
x(this, z, te).call(this, { type: "pause" });
|
|
526
526
|
},
|
|
527
527
|
onContinue: () => {
|
|
528
|
-
x(this,
|
|
528
|
+
x(this, z, te).call(this, { type: "continue" });
|
|
529
529
|
},
|
|
530
530
|
retry: c.options.retry,
|
|
531
531
|
retryDelay: c.options.retryDelay,
|
|
532
532
|
networkMode: c.options.networkMode
|
|
533
|
-
})), h(this,
|
|
533
|
+
})), h(this, oe, n(this, q).promise), n(this, oe);
|
|
534
534
|
}
|
|
535
|
-
}, Pe = new WeakMap(), Ne = new WeakMap(),
|
|
536
|
-
this.options = { ...n(this,
|
|
537
|
-
},
|
|
535
|
+
}, Pe = new WeakMap(), Ne = new WeakMap(), V = new WeakMap(), oe = new WeakMap(), q = new WeakMap(), D = new WeakMap(), qe = new WeakMap(), ve = new WeakMap(), ke = new WeakSet(), ot = function(t) {
|
|
536
|
+
this.options = { ...n(this, qe), ...t }, this.updateGcTime(this.options.gcTime);
|
|
537
|
+
}, z = new WeakSet(), te = function(t) {
|
|
538
538
|
const s = (r) => {
|
|
539
539
|
switch (t.type) {
|
|
540
540
|
case "failed":
|
|
@@ -559,7 +559,7 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
559
559
|
fetchFailureCount: 0,
|
|
560
560
|
fetchFailureReason: null,
|
|
561
561
|
fetchMeta: t.meta ?? null,
|
|
562
|
-
fetchStatus:
|
|
562
|
+
fetchStatus: vt(this.options.networkMode) ? "fetching" : "paused",
|
|
563
563
|
...!r.dataUpdatedAt && {
|
|
564
564
|
error: null,
|
|
565
565
|
status: "pending"
|
|
@@ -582,7 +582,7 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
582
582
|
};
|
|
583
583
|
case "error":
|
|
584
584
|
const a = t.error;
|
|
585
|
-
return
|
|
585
|
+
return Ct(a) && a.revert && n(this, Ne) ? { ...n(this, Ne), fetchStatus: "idle" } : {
|
|
586
586
|
...r,
|
|
587
587
|
error: a,
|
|
588
588
|
errorUpdateCount: r.errorUpdateCount + 1,
|
|
@@ -604,13 +604,13 @@ var F = rr(), ve, as, xs = (as = class {
|
|
|
604
604
|
};
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
|
-
this.state = s(this.state),
|
|
608
|
-
n(this,
|
|
607
|
+
this.state = s(this.state), R.batch(() => {
|
|
608
|
+
n(this, D).forEach((r) => {
|
|
609
609
|
r.onQueryUpdate();
|
|
610
|
-
}), n(this,
|
|
610
|
+
}), n(this, V).notify({ query: this, type: "updated", action: t });
|
|
611
611
|
});
|
|
612
|
-
},
|
|
613
|
-
function
|
|
612
|
+
}, ss);
|
|
613
|
+
function er(e) {
|
|
614
614
|
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, s = typeof t < "u", r = s ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
615
615
|
return {
|
|
616
616
|
data: t,
|
|
@@ -627,16 +627,16 @@ function nr(e) {
|
|
|
627
627
|
fetchStatus: "idle"
|
|
628
628
|
};
|
|
629
629
|
}
|
|
630
|
-
var
|
|
630
|
+
var J, rs, tr = (rs = class extends Ke {
|
|
631
631
|
constructor(t = {}) {
|
|
632
632
|
super();
|
|
633
|
-
p(this,
|
|
634
|
-
this.config = t, h(this,
|
|
633
|
+
p(this, J, void 0);
|
|
634
|
+
this.config = t, h(this, J, /* @__PURE__ */ new Map());
|
|
635
635
|
}
|
|
636
636
|
build(t, s, r) {
|
|
637
|
-
const a = s.queryKey, o = s.queryHash ??
|
|
637
|
+
const a = s.queryKey, o = s.queryHash ?? Ft(a, s);
|
|
638
638
|
let l = this.get(o);
|
|
639
|
-
return l || (l = new
|
|
639
|
+
return l || (l = new Bs({
|
|
640
640
|
cache: this,
|
|
641
641
|
queryKey: a,
|
|
642
642
|
queryHash: o,
|
|
@@ -646,91 +646,91 @@ var I, ls, ar = (ls = class extends Ge {
|
|
|
646
646
|
}), this.add(l)), l;
|
|
647
647
|
}
|
|
648
648
|
add(t) {
|
|
649
|
-
n(this,
|
|
649
|
+
n(this, J).has(t.queryHash) || (n(this, J).set(t.queryHash, t), this.notify({
|
|
650
650
|
type: "added",
|
|
651
651
|
query: t
|
|
652
652
|
}));
|
|
653
653
|
}
|
|
654
654
|
remove(t) {
|
|
655
|
-
const s = n(this,
|
|
656
|
-
s && (t.destroy(), s === t && n(this,
|
|
655
|
+
const s = n(this, J).get(t.queryHash);
|
|
656
|
+
s && (t.destroy(), s === t && n(this, J).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
657
657
|
}
|
|
658
658
|
clear() {
|
|
659
|
-
|
|
659
|
+
R.batch(() => {
|
|
660
660
|
this.getAll().forEach((t) => {
|
|
661
661
|
this.remove(t);
|
|
662
662
|
});
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
665
|
get(t) {
|
|
666
|
-
return n(this,
|
|
666
|
+
return n(this, J).get(t);
|
|
667
667
|
}
|
|
668
668
|
getAll() {
|
|
669
|
-
return [...n(this,
|
|
669
|
+
return [...n(this, J).values()];
|
|
670
670
|
}
|
|
671
671
|
find(t) {
|
|
672
672
|
const s = { exact: !0, ...t };
|
|
673
673
|
return this.getAll().find(
|
|
674
|
-
(r) =>
|
|
674
|
+
(r) => $t(s, r)
|
|
675
675
|
);
|
|
676
676
|
}
|
|
677
677
|
findAll(t = {}) {
|
|
678
678
|
const s = this.getAll();
|
|
679
|
-
return Object.keys(t).length > 0 ? s.filter((r) =>
|
|
679
|
+
return Object.keys(t).length > 0 ? s.filter((r) => $t(t, r)) : s;
|
|
680
680
|
}
|
|
681
681
|
notify(t) {
|
|
682
|
-
|
|
682
|
+
R.batch(() => {
|
|
683
683
|
this.listeners.forEach((s) => {
|
|
684
684
|
s(t);
|
|
685
685
|
});
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
688
|
onFocus() {
|
|
689
|
-
|
|
689
|
+
R.batch(() => {
|
|
690
690
|
this.getAll().forEach((t) => {
|
|
691
691
|
t.onFocus();
|
|
692
692
|
});
|
|
693
693
|
});
|
|
694
694
|
}
|
|
695
695
|
onOnline() {
|
|
696
|
-
|
|
696
|
+
R.batch(() => {
|
|
697
697
|
this.getAll().forEach((t) => {
|
|
698
698
|
t.onOnline();
|
|
699
699
|
});
|
|
700
700
|
});
|
|
701
701
|
}
|
|
702
|
-
},
|
|
702
|
+
}, J = new WeakMap(), rs), X, We, K, Oe, I, ie, is, sr = (is = class extends ps {
|
|
703
703
|
constructor(t) {
|
|
704
704
|
super();
|
|
705
|
-
p(this,
|
|
706
|
-
p(this,
|
|
707
|
-
p(this,
|
|
708
|
-
p(this,
|
|
705
|
+
p(this, I);
|
|
706
|
+
p(this, X, void 0);
|
|
707
|
+
p(this, We, void 0);
|
|
708
|
+
p(this, K, void 0);
|
|
709
709
|
p(this, Oe, void 0);
|
|
710
|
-
this.mutationId = t.mutationId, h(this,
|
|
710
|
+
this.mutationId = t.mutationId, h(this, We, t.defaultOptions), h(this, K, t.mutationCache), h(this, X, []), this.state = t.state || ms(), this.setOptions(t.options), this.scheduleGc();
|
|
711
711
|
}
|
|
712
712
|
setOptions(t) {
|
|
713
|
-
this.options = { ...n(this,
|
|
713
|
+
this.options = { ...n(this, We), ...t }, this.updateGcTime(this.options.gcTime);
|
|
714
714
|
}
|
|
715
715
|
get meta() {
|
|
716
716
|
return this.options.meta;
|
|
717
717
|
}
|
|
718
718
|
addObserver(t) {
|
|
719
|
-
n(this,
|
|
719
|
+
n(this, X).includes(t) || (n(this, X).push(t), this.clearGcTimeout(), n(this, K).notify({
|
|
720
720
|
type: "observerAdded",
|
|
721
721
|
mutation: this,
|
|
722
722
|
observer: t
|
|
723
723
|
}));
|
|
724
724
|
}
|
|
725
725
|
removeObserver(t) {
|
|
726
|
-
h(this,
|
|
726
|
+
h(this, X, n(this, X).filter((s) => s !== t)), this.scheduleGc(), n(this, K).notify({
|
|
727
727
|
type: "observerRemoved",
|
|
728
728
|
mutation: this,
|
|
729
729
|
observer: t
|
|
730
730
|
});
|
|
731
731
|
}
|
|
732
732
|
optionalRemove() {
|
|
733
|
-
n(this,
|
|
733
|
+
n(this, X).length || (this.state.status === "pending" ? this.scheduleGc() : n(this, K).remove(this));
|
|
734
734
|
}
|
|
735
735
|
continue() {
|
|
736
736
|
var t;
|
|
@@ -738,17 +738,17 @@ var I, ls, ar = (ls = class extends Ge {
|
|
|
738
738
|
this.execute(this.state.variables);
|
|
739
739
|
}
|
|
740
740
|
async execute(t) {
|
|
741
|
-
var a, o, l, c,
|
|
742
|
-
const s = () => (h(this, Oe,
|
|
741
|
+
var a, o, l, c, m, C, u, b, v, f, w, E, y, g, S, _, k, L, $, T;
|
|
742
|
+
const s = () => (h(this, Oe, fs({
|
|
743
743
|
fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
|
|
744
|
-
onFail: (
|
|
745
|
-
x(this,
|
|
744
|
+
onFail: (O, ee) => {
|
|
745
|
+
x(this, I, ie).call(this, { type: "failed", failureCount: O, error: ee });
|
|
746
746
|
},
|
|
747
747
|
onPause: () => {
|
|
748
|
-
x(this,
|
|
748
|
+
x(this, I, ie).call(this, { type: "pause" });
|
|
749
749
|
},
|
|
750
750
|
onContinue: () => {
|
|
751
|
-
x(this,
|
|
751
|
+
x(this, I, ie).call(this, { type: "continue" });
|
|
752
752
|
},
|
|
753
753
|
retry: this.options.retry ?? 0,
|
|
754
754
|
retryDelay: this.options.retryDelay,
|
|
@@ -756,66 +756,66 @@ var I, ls, ar = (ls = class extends Ge {
|
|
|
756
756
|
})), n(this, Oe).promise), r = this.state.status === "pending";
|
|
757
757
|
try {
|
|
758
758
|
if (!r) {
|
|
759
|
-
x(this,
|
|
759
|
+
x(this, I, ie).call(this, { type: "pending", variables: t }), await ((o = (a = n(this, K).config).onMutate) == null ? void 0 : o.call(
|
|
760
760
|
a,
|
|
761
761
|
t,
|
|
762
762
|
this
|
|
763
763
|
));
|
|
764
|
-
const
|
|
765
|
-
|
|
764
|
+
const ee = await ((c = (l = this.options).onMutate) == null ? void 0 : c.call(l, t));
|
|
765
|
+
ee !== this.state.context && x(this, I, ie).call(this, {
|
|
766
766
|
type: "pending",
|
|
767
|
-
context:
|
|
767
|
+
context: ee,
|
|
768
768
|
variables: t
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
|
-
const
|
|
772
|
-
return await ((
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
const O = await s();
|
|
772
|
+
return await ((C = (m = n(this, K).config).onSuccess) == null ? void 0 : C.call(
|
|
773
|
+
m,
|
|
774
|
+
O,
|
|
775
775
|
t,
|
|
776
776
|
this.state.context,
|
|
777
777
|
this
|
|
778
|
-
)), await ((
|
|
779
|
-
|
|
780
|
-
|
|
778
|
+
)), await ((b = (u = this.options).onSuccess) == null ? void 0 : b.call(u, O, t, this.state.context)), await ((f = (v = n(this, K).config).onSettled) == null ? void 0 : f.call(
|
|
779
|
+
v,
|
|
780
|
+
O,
|
|
781
781
|
null,
|
|
782
782
|
this.state.variables,
|
|
783
783
|
this.state.context,
|
|
784
784
|
this
|
|
785
|
-
)), await ((
|
|
786
|
-
} catch (
|
|
785
|
+
)), await ((E = (w = this.options).onSettled) == null ? void 0 : E.call(w, O, null, t, this.state.context)), x(this, I, ie).call(this, { type: "success", data: O }), O;
|
|
786
|
+
} catch (O) {
|
|
787
787
|
try {
|
|
788
|
-
throw await ((
|
|
789
|
-
|
|
790
|
-
|
|
788
|
+
throw await ((g = (y = n(this, K).config).onError) == null ? void 0 : g.call(
|
|
789
|
+
y,
|
|
790
|
+
O,
|
|
791
791
|
t,
|
|
792
792
|
this.state.context,
|
|
793
793
|
this
|
|
794
|
-
)), await ((
|
|
794
|
+
)), await ((_ = (S = this.options).onError) == null ? void 0 : _.call(
|
|
795
795
|
S,
|
|
796
|
-
|
|
796
|
+
O,
|
|
797
797
|
t,
|
|
798
798
|
this.state.context
|
|
799
|
-
)), await ((
|
|
799
|
+
)), await ((L = (k = n(this, K).config).onSettled) == null ? void 0 : L.call(
|
|
800
800
|
k,
|
|
801
801
|
void 0,
|
|
802
|
-
|
|
802
|
+
O,
|
|
803
803
|
this.state.variables,
|
|
804
804
|
this.state.context,
|
|
805
805
|
this
|
|
806
|
-
)), await ((
|
|
807
|
-
|
|
806
|
+
)), await ((T = ($ = this.options).onSettled) == null ? void 0 : T.call(
|
|
807
|
+
$,
|
|
808
808
|
void 0,
|
|
809
|
-
|
|
809
|
+
O,
|
|
810
810
|
t,
|
|
811
811
|
this.state.context
|
|
812
|
-
)),
|
|
812
|
+
)), O;
|
|
813
813
|
} finally {
|
|
814
|
-
x(this,
|
|
814
|
+
x(this, I, ie).call(this, { type: "error", error: O });
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
},
|
|
818
|
+
}, X = new WeakMap(), We = new WeakMap(), K = new WeakMap(), Oe = new WeakMap(), I = new WeakSet(), ie = function(t) {
|
|
819
819
|
const s = (r) => {
|
|
820
820
|
switch (t.type) {
|
|
821
821
|
case "failed":
|
|
@@ -842,7 +842,7 @@ var I, ls, ar = (ls = class extends Ge {
|
|
|
842
842
|
failureCount: 0,
|
|
843
843
|
failureReason: null,
|
|
844
844
|
error: null,
|
|
845
|
-
isPaused: !
|
|
845
|
+
isPaused: !vt(this.options.networkMode),
|
|
846
846
|
status: "pending",
|
|
847
847
|
variables: t.variables,
|
|
848
848
|
submittedAt: Date.now()
|
|
@@ -869,17 +869,17 @@ var I, ls, ar = (ls = class extends Ge {
|
|
|
869
869
|
};
|
|
870
870
|
}
|
|
871
871
|
};
|
|
872
|
-
this.state = s(this.state),
|
|
873
|
-
n(this,
|
|
872
|
+
this.state = s(this.state), R.batch(() => {
|
|
873
|
+
n(this, X).forEach((r) => {
|
|
874
874
|
r.onMutationUpdate(t);
|
|
875
|
-
}), n(this,
|
|
875
|
+
}), n(this, K).notify({
|
|
876
876
|
mutation: this,
|
|
877
877
|
type: "updated",
|
|
878
878
|
action: t
|
|
879
879
|
});
|
|
880
880
|
});
|
|
881
|
-
},
|
|
882
|
-
function
|
|
881
|
+
}, is);
|
|
882
|
+
function ms() {
|
|
883
883
|
return {
|
|
884
884
|
context: void 0,
|
|
885
885
|
data: void 0,
|
|
@@ -892,18 +892,18 @@ function bs() {
|
|
|
892
892
|
submittedAt: 0
|
|
893
893
|
};
|
|
894
894
|
}
|
|
895
|
-
var W,
|
|
895
|
+
var W, Ze, ye, ns, rr = (ns = class extends Ke {
|
|
896
896
|
constructor(t = {}) {
|
|
897
897
|
super();
|
|
898
898
|
p(this, W, void 0);
|
|
899
|
-
p(this,
|
|
899
|
+
p(this, Ze, void 0);
|
|
900
900
|
p(this, ye, void 0);
|
|
901
|
-
this.config = t, h(this, W, []), h(this,
|
|
901
|
+
this.config = t, h(this, W, []), h(this, Ze, 0);
|
|
902
902
|
}
|
|
903
903
|
build(t, s, r) {
|
|
904
|
-
const a = new
|
|
904
|
+
const a = new sr({
|
|
905
905
|
mutationCache: this,
|
|
906
|
-
mutationId: ++
|
|
906
|
+
mutationId: ++at(this, Ze)._,
|
|
907
907
|
options: t.defaultMutationOptions(s),
|
|
908
908
|
state: r
|
|
909
909
|
});
|
|
@@ -916,7 +916,7 @@ var W, Je, ye, us, lr = (us = class extends Ge {
|
|
|
916
916
|
h(this, W, n(this, W).filter((s) => s !== t)), this.notify({ type: "removed", mutation: t });
|
|
917
917
|
}
|
|
918
918
|
clear() {
|
|
919
|
-
|
|
919
|
+
R.batch(() => {
|
|
920
920
|
n(this, W).forEach((t) => {
|
|
921
921
|
this.remove(t);
|
|
922
922
|
});
|
|
@@ -928,16 +928,16 @@ var W, Je, ye, us, lr = (us = class extends Ge {
|
|
|
928
928
|
find(t) {
|
|
929
929
|
const s = { exact: !0, ...t };
|
|
930
930
|
return n(this, W).find(
|
|
931
|
-
(r) =>
|
|
931
|
+
(r) => Kt(s, r)
|
|
932
932
|
);
|
|
933
933
|
}
|
|
934
934
|
findAll(t = {}) {
|
|
935
935
|
return n(this, W).filter(
|
|
936
|
-
(s) =>
|
|
936
|
+
(s) => Kt(t, s)
|
|
937
937
|
);
|
|
938
938
|
}
|
|
939
939
|
notify(t) {
|
|
940
|
-
|
|
940
|
+
R.batch(() => {
|
|
941
941
|
this.listeners.forEach((s) => {
|
|
942
942
|
s(t);
|
|
943
943
|
});
|
|
@@ -946,9 +946,9 @@ var W, Je, ye, us, lr = (us = class extends Ge {
|
|
|
946
946
|
resumePausedMutations() {
|
|
947
947
|
return h(this, ye, (n(this, ye) ?? Promise.resolve()).then(() => {
|
|
948
948
|
const t = n(this, W).filter((s) => s.state.isPaused);
|
|
949
|
-
return
|
|
949
|
+
return R.batch(
|
|
950
950
|
() => t.reduce(
|
|
951
|
-
(s, r) => s.then(() => r.continue().catch(
|
|
951
|
+
(s, r) => s.then(() => r.continue().catch(Z)),
|
|
952
952
|
Promise.resolve()
|
|
953
953
|
)
|
|
954
954
|
);
|
|
@@ -956,62 +956,62 @@ var W, Je, ye, us, lr = (us = class extends Ge {
|
|
|
956
956
|
h(this, ye, void 0);
|
|
957
957
|
})), n(this, ye);
|
|
958
958
|
}
|
|
959
|
-
}, W = new WeakMap(),
|
|
960
|
-
function
|
|
959
|
+
}, W = new WeakMap(), Ze = new WeakMap(), ye = new WeakMap(), ns);
|
|
960
|
+
function ir(e) {
|
|
961
961
|
return {
|
|
962
962
|
onFetch: (t, s) => {
|
|
963
963
|
const r = async () => {
|
|
964
|
-
var
|
|
965
|
-
const a = t.options, o = (
|
|
966
|
-
let
|
|
967
|
-
const u = (
|
|
968
|
-
Object.defineProperty(
|
|
964
|
+
var w, E, y, g, S;
|
|
965
|
+
const a = t.options, o = (y = (E = (w = t.fetchOptions) == null ? void 0 : w.meta) == null ? void 0 : E.fetchMore) == null ? void 0 : y.direction, l = ((g = t.state.data) == null ? void 0 : g.pages) || [], c = ((S = t.state.data) == null ? void 0 : S.pageParams) || [], m = { pages: [], pageParams: [] };
|
|
966
|
+
let C = !1;
|
|
967
|
+
const u = (_) => {
|
|
968
|
+
Object.defineProperty(_, "signal", {
|
|
969
969
|
enumerable: !0,
|
|
970
|
-
get: () => (t.signal.aborted ?
|
|
971
|
-
|
|
970
|
+
get: () => (t.signal.aborted ? C = !0 : t.signal.addEventListener("abort", () => {
|
|
971
|
+
C = !0;
|
|
972
972
|
}), t.signal)
|
|
973
973
|
});
|
|
974
|
-
},
|
|
974
|
+
}, b = t.options.queryFn || (() => Promise.reject(
|
|
975
975
|
new Error(`Missing queryFn: '${t.options.queryHash}'`)
|
|
976
|
-
)),
|
|
977
|
-
if (
|
|
976
|
+
)), v = async (_, k, L) => {
|
|
977
|
+
if (C)
|
|
978
978
|
return Promise.reject();
|
|
979
|
-
if (k == null &&
|
|
980
|
-
return Promise.resolve(
|
|
981
|
-
const
|
|
979
|
+
if (k == null && _.pages.length)
|
|
980
|
+
return Promise.resolve(_);
|
|
981
|
+
const $ = {
|
|
982
982
|
queryKey: t.queryKey,
|
|
983
983
|
pageParam: k,
|
|
984
|
-
direction:
|
|
984
|
+
direction: L ? "backward" : "forward",
|
|
985
985
|
meta: t.options.meta
|
|
986
986
|
};
|
|
987
|
-
u(
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
), { maxPages:
|
|
987
|
+
u($);
|
|
988
|
+
const T = await b(
|
|
989
|
+
$
|
|
990
|
+
), { maxPages: O } = t.options, ee = L ? Ys : Zs;
|
|
991
991
|
return {
|
|
992
|
-
pages:
|
|
993
|
-
pageParams:
|
|
992
|
+
pages: ee(_.pages, T, O),
|
|
993
|
+
pageParams: ee(_.pageParams, k, O)
|
|
994
994
|
};
|
|
995
995
|
};
|
|
996
|
-
let
|
|
996
|
+
let f;
|
|
997
997
|
if (o && l.length) {
|
|
998
|
-
const
|
|
998
|
+
const _ = o === "backward", k = _ ? nr : qt, L = {
|
|
999
999
|
pages: l,
|
|
1000
1000
|
pageParams: c
|
|
1001
|
-
},
|
|
1002
|
-
|
|
1001
|
+
}, $ = k(a, L);
|
|
1002
|
+
f = await v(L, $, _);
|
|
1003
1003
|
} else {
|
|
1004
|
-
|
|
1005
|
-
|
|
1004
|
+
f = await v(
|
|
1005
|
+
m,
|
|
1006
1006
|
c[0] ?? a.initialPageParam
|
|
1007
1007
|
);
|
|
1008
|
-
const
|
|
1009
|
-
for (let k = 1; k <
|
|
1010
|
-
const
|
|
1011
|
-
|
|
1008
|
+
const _ = e ?? l.length;
|
|
1009
|
+
for (let k = 1; k < _; k++) {
|
|
1010
|
+
const L = qt(a, f);
|
|
1011
|
+
f = await v(f, L);
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
return
|
|
1014
|
+
return f;
|
|
1015
1015
|
};
|
|
1016
1016
|
t.options.persister ? t.fetchFn = () => {
|
|
1017
1017
|
var a, o;
|
|
@@ -1029,7 +1029,7 @@ function cr(e) {
|
|
|
1029
1029
|
}
|
|
1030
1030
|
};
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function qt(e, { pages: t, pageParams: s }) {
|
|
1033
1033
|
const r = t.length - 1;
|
|
1034
1034
|
return e.getNextPageParam(
|
|
1035
1035
|
t[r],
|
|
@@ -1038,7 +1038,7 @@ function Jt(e, { pages: t, pageParams: s }) {
|
|
|
1038
1038
|
s
|
|
1039
1039
|
);
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function nr(e, { pages: t, pageParams: s }) {
|
|
1042
1042
|
var r;
|
|
1043
1043
|
return (r = e.getPreviousPageParam) == null ? void 0 : r.call(
|
|
1044
1044
|
e,
|
|
@@ -1048,38 +1048,38 @@ function ur(e, { pages: t, pageParams: s }) {
|
|
|
1048
1048
|
s
|
|
1049
1049
|
);
|
|
1050
1050
|
}
|
|
1051
|
-
var
|
|
1051
|
+
var F, le, ce, Me, Le, ue, Fe, Re, as, vs = (as = class {
|
|
1052
1052
|
constructor(e = {}) {
|
|
1053
|
-
p(this,
|
|
1053
|
+
p(this, F, void 0);
|
|
1054
|
+
p(this, le, void 0);
|
|
1054
1055
|
p(this, ce, void 0);
|
|
1055
|
-
p(this,
|
|
1056
|
+
p(this, Me, void 0);
|
|
1056
1057
|
p(this, Le, void 0);
|
|
1058
|
+
p(this, ue, void 0);
|
|
1057
1059
|
p(this, Fe, void 0);
|
|
1058
|
-
p(this, de, void 0);
|
|
1059
1060
|
p(this, Re, void 0);
|
|
1060
|
-
|
|
1061
|
-
h(this, L, e.queryCache || new ar()), h(this, ce, e.mutationCache || new lr()), h(this, ue, e.defaultOptions || {}), h(this, Le, /* @__PURE__ */ new Map()), h(this, Fe, /* @__PURE__ */ new Map()), h(this, de, 0);
|
|
1061
|
+
h(this, F, e.queryCache || new tr()), h(this, le, e.mutationCache || new rr()), h(this, ce, e.defaultOptions || {}), h(this, Me, /* @__PURE__ */ new Map()), h(this, Le, /* @__PURE__ */ new Map()), h(this, ue, 0);
|
|
1062
1062
|
}
|
|
1063
1063
|
mount() {
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
})), h(this,
|
|
1067
|
-
|
|
1064
|
+
at(this, ue)._++, n(this, ue) === 1 && (h(this, Fe, ut.subscribe(() => {
|
|
1065
|
+
ut.isFocused() && (this.resumePausedMutations(), n(this, F).onFocus());
|
|
1066
|
+
})), h(this, Re, dt.subscribe(() => {
|
|
1067
|
+
dt.isOnline() && (this.resumePausedMutations(), n(this, F).onOnline());
|
|
1068
1068
|
})));
|
|
1069
1069
|
}
|
|
1070
1070
|
unmount() {
|
|
1071
1071
|
var e, t;
|
|
1072
|
-
|
|
1072
|
+
at(this, ue)._--, n(this, ue) === 0 && ((e = n(this, Fe)) == null || e.call(this), h(this, Fe, void 0), (t = n(this, Re)) == null || t.call(this), h(this, Re, void 0));
|
|
1073
1073
|
}
|
|
1074
1074
|
isFetching(e) {
|
|
1075
|
-
return n(this,
|
|
1075
|
+
return n(this, F).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
1076
1076
|
}
|
|
1077
1077
|
isMutating(e) {
|
|
1078
|
-
return n(this,
|
|
1078
|
+
return n(this, le).findAll({ ...e, status: "pending" }).length;
|
|
1079
1079
|
}
|
|
1080
1080
|
getQueryData(e) {
|
|
1081
1081
|
var t;
|
|
1082
|
-
return (t = n(this,
|
|
1082
|
+
return (t = n(this, F).find({ queryKey: e })) == null ? void 0 : t.state.data;
|
|
1083
1083
|
}
|
|
1084
1084
|
ensureQueryData(e) {
|
|
1085
1085
|
const t = this.getQueryData(e.queryKey);
|
|
@@ -1092,14 +1092,14 @@ var L, ce, ue, Le, Fe, de, Re, De, ds, ws = (ds = class {
|
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
setQueryData(e, t, s) {
|
|
1095
|
-
const r = n(this,
|
|
1095
|
+
const r = n(this, F).find({ queryKey: e }), a = r == null ? void 0 : r.state.data, o = qs(t, a);
|
|
1096
1096
|
if (typeof o > "u")
|
|
1097
1097
|
return;
|
|
1098
1098
|
const l = this.defaultQueryOptions({ queryKey: e });
|
|
1099
|
-
return n(this,
|
|
1099
|
+
return n(this, F).build(this, l).setData(o, { ...s, manual: !0 });
|
|
1100
1100
|
}
|
|
1101
1101
|
setQueriesData(e, t, s) {
|
|
1102
|
-
return
|
|
1102
|
+
return R.batch(
|
|
1103
1103
|
() => this.getQueryCache().findAll(e).map(({ queryKey: r }) => [
|
|
1104
1104
|
r,
|
|
1105
1105
|
this.setQueryData(r, t, s)
|
|
@@ -1108,34 +1108,34 @@ var L, ce, ue, Le, Fe, de, Re, De, ds, ws = (ds = class {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
getQueryState(e) {
|
|
1110
1110
|
var t;
|
|
1111
|
-
return (t = n(this,
|
|
1111
|
+
return (t = n(this, F).find({ queryKey: e })) == null ? void 0 : t.state;
|
|
1112
1112
|
}
|
|
1113
1113
|
removeQueries(e) {
|
|
1114
|
-
const t = n(this,
|
|
1115
|
-
|
|
1114
|
+
const t = n(this, F);
|
|
1115
|
+
R.batch(() => {
|
|
1116
1116
|
t.findAll(e).forEach((s) => {
|
|
1117
1117
|
t.remove(s);
|
|
1118
1118
|
});
|
|
1119
1119
|
});
|
|
1120
1120
|
}
|
|
1121
1121
|
resetQueries(e, t) {
|
|
1122
|
-
const s = n(this,
|
|
1122
|
+
const s = n(this, F), r = {
|
|
1123
1123
|
type: "active",
|
|
1124
1124
|
...e
|
|
1125
1125
|
};
|
|
1126
|
-
return
|
|
1126
|
+
return R.batch(() => (s.findAll(e).forEach((a) => {
|
|
1127
1127
|
a.reset();
|
|
1128
1128
|
}), this.refetchQueries(r, t)));
|
|
1129
1129
|
}
|
|
1130
1130
|
cancelQueries(e = {}, t = {}) {
|
|
1131
|
-
const s = { revert: !0, ...t }, r =
|
|
1132
|
-
() => n(this,
|
|
1131
|
+
const s = { revert: !0, ...t }, r = R.batch(
|
|
1132
|
+
() => n(this, F).findAll(e).map((a) => a.cancel(s))
|
|
1133
1133
|
);
|
|
1134
|
-
return Promise.all(r).then(
|
|
1134
|
+
return Promise.all(r).then(Z).catch(Z);
|
|
1135
1135
|
}
|
|
1136
1136
|
invalidateQueries(e = {}, t = {}) {
|
|
1137
|
-
return
|
|
1138
|
-
if (n(this,
|
|
1137
|
+
return R.batch(() => {
|
|
1138
|
+
if (n(this, F).findAll(e).forEach((r) => {
|
|
1139
1139
|
r.invalidate();
|
|
1140
1140
|
}), e.refetchType === "none")
|
|
1141
1141
|
return Promise.resolve();
|
|
@@ -1150,176 +1150,176 @@ var L, ce, ue, Le, Fe, de, Re, De, ds, ws = (ds = class {
|
|
|
1150
1150
|
const s = {
|
|
1151
1151
|
...t,
|
|
1152
1152
|
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
1153
|
-
}, r =
|
|
1154
|
-
() => n(this,
|
|
1153
|
+
}, r = R.batch(
|
|
1154
|
+
() => n(this, F).findAll(e).filter((a) => !a.isDisabled()).map((a) => {
|
|
1155
1155
|
let o = a.fetch(void 0, s);
|
|
1156
|
-
return s.throwOnError || (o = o.catch(
|
|
1156
|
+
return s.throwOnError || (o = o.catch(Z)), a.state.fetchStatus === "paused" ? Promise.resolve() : o;
|
|
1157
1157
|
})
|
|
1158
1158
|
);
|
|
1159
|
-
return Promise.all(r).then(
|
|
1159
|
+
return Promise.all(r).then(Z);
|
|
1160
1160
|
}
|
|
1161
1161
|
fetchQuery(e) {
|
|
1162
1162
|
const t = this.defaultQueryOptions(e);
|
|
1163
1163
|
typeof t.retry > "u" && (t.retry = !1);
|
|
1164
|
-
const s = n(this,
|
|
1164
|
+
const s = n(this, F).build(this, t);
|
|
1165
1165
|
return s.isStaleByTime(t.staleTime) ? s.fetch(t) : Promise.resolve(s.state.data);
|
|
1166
1166
|
}
|
|
1167
1167
|
prefetchQuery(e) {
|
|
1168
|
-
return this.fetchQuery(e).then(
|
|
1168
|
+
return this.fetchQuery(e).then(Z).catch(Z);
|
|
1169
1169
|
}
|
|
1170
1170
|
fetchInfiniteQuery(e) {
|
|
1171
|
-
return e.behavior =
|
|
1171
|
+
return e.behavior = ir(e.pages), this.fetchQuery(e);
|
|
1172
1172
|
}
|
|
1173
1173
|
prefetchInfiniteQuery(e) {
|
|
1174
|
-
return this.fetchInfiniteQuery(e).then(
|
|
1174
|
+
return this.fetchInfiniteQuery(e).then(Z).catch(Z);
|
|
1175
1175
|
}
|
|
1176
1176
|
resumePausedMutations() {
|
|
1177
|
-
return n(this,
|
|
1177
|
+
return n(this, le).resumePausedMutations();
|
|
1178
1178
|
}
|
|
1179
1179
|
getQueryCache() {
|
|
1180
|
-
return n(this,
|
|
1180
|
+
return n(this, F);
|
|
1181
1181
|
}
|
|
1182
1182
|
getMutationCache() {
|
|
1183
|
-
return n(this,
|
|
1183
|
+
return n(this, le);
|
|
1184
1184
|
}
|
|
1185
1185
|
getDefaultOptions() {
|
|
1186
|
-
return n(this,
|
|
1186
|
+
return n(this, ce);
|
|
1187
1187
|
}
|
|
1188
1188
|
setDefaultOptions(e) {
|
|
1189
|
-
h(this,
|
|
1189
|
+
h(this, ce, e);
|
|
1190
1190
|
}
|
|
1191
1191
|
setQueryDefaults(e, t) {
|
|
1192
|
-
n(this,
|
|
1192
|
+
n(this, Me).set(we(e), {
|
|
1193
1193
|
queryKey: e,
|
|
1194
1194
|
defaultOptions: t
|
|
1195
1195
|
});
|
|
1196
1196
|
}
|
|
1197
1197
|
getQueryDefaults(e) {
|
|
1198
|
-
const t = [...n(this,
|
|
1198
|
+
const t = [...n(this, Me).values()];
|
|
1199
1199
|
let s = {};
|
|
1200
1200
|
return t.forEach((r) => {
|
|
1201
|
-
|
|
1201
|
+
Ve(e, r.queryKey) && (s = { ...s, ...r.defaultOptions });
|
|
1202
1202
|
}), s;
|
|
1203
1203
|
}
|
|
1204
1204
|
setMutationDefaults(e, t) {
|
|
1205
|
-
n(this,
|
|
1205
|
+
n(this, Le).set(we(e), {
|
|
1206
1206
|
mutationKey: e,
|
|
1207
1207
|
defaultOptions: t
|
|
1208
1208
|
});
|
|
1209
1209
|
}
|
|
1210
1210
|
getMutationDefaults(e) {
|
|
1211
|
-
const t = [...n(this,
|
|
1211
|
+
const t = [...n(this, Le).values()];
|
|
1212
1212
|
let s = {};
|
|
1213
1213
|
return t.forEach((r) => {
|
|
1214
|
-
|
|
1214
|
+
Ve(e, r.mutationKey) && (s = { ...s, ...r.defaultOptions });
|
|
1215
1215
|
}), s;
|
|
1216
1216
|
}
|
|
1217
1217
|
defaultQueryOptions(e) {
|
|
1218
1218
|
if (e != null && e._defaulted)
|
|
1219
1219
|
return e;
|
|
1220
1220
|
const t = {
|
|
1221
|
-
...n(this,
|
|
1221
|
+
...n(this, ce).queries,
|
|
1222
1222
|
...(e == null ? void 0 : e.queryKey) && this.getQueryDefaults(e.queryKey),
|
|
1223
1223
|
...e,
|
|
1224
1224
|
_defaulted: !0
|
|
1225
1225
|
};
|
|
1226
|
-
return t.queryHash || (t.queryHash =
|
|
1226
|
+
return t.queryHash || (t.queryHash = Ft(
|
|
1227
1227
|
t.queryKey,
|
|
1228
1228
|
t
|
|
1229
1229
|
)), typeof t.refetchOnReconnect > "u" && (t.refetchOnReconnect = t.networkMode !== "always"), typeof t.throwOnError > "u" && (t.throwOnError = !!t.suspense), typeof t.networkMode > "u" && t.persister && (t.networkMode = "offlineFirst"), t;
|
|
1230
1230
|
}
|
|
1231
1231
|
defaultMutationOptions(e) {
|
|
1232
1232
|
return e != null && e._defaulted ? e : {
|
|
1233
|
-
...n(this,
|
|
1233
|
+
...n(this, ce).mutations,
|
|
1234
1234
|
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
1235
1235
|
...e,
|
|
1236
1236
|
_defaulted: !0
|
|
1237
1237
|
};
|
|
1238
1238
|
}
|
|
1239
1239
|
clear() {
|
|
1240
|
-
n(this,
|
|
1240
|
+
n(this, F).clear(), n(this, le).clear();
|
|
1241
1241
|
}
|
|
1242
|
-
},
|
|
1242
|
+
}, F = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), Me = new WeakMap(), Le = new WeakMap(), ue = new WeakMap(), Fe = new WeakMap(), Re = new WeakMap(), as), Q, N, Ye, U, ge, De, B, ze, Te, Ue, Ce, xe, de, Qe, be, Ge, Je, jt, Xe, _t, Ie, Et, Be, St, et, At, tt, Pt, st, Nt, mt, ys, os, ar = (os = class extends Ke {
|
|
1243
1243
|
constructor(t, s) {
|
|
1244
1244
|
super();
|
|
1245
|
-
p(this,
|
|
1245
|
+
p(this, be);
|
|
1246
|
+
p(this, Je);
|
|
1247
|
+
p(this, Xe);
|
|
1246
1248
|
p(this, Ie);
|
|
1247
1249
|
p(this, Be);
|
|
1248
1250
|
p(this, et);
|
|
1249
1251
|
p(this, tt);
|
|
1250
1252
|
p(this, st);
|
|
1251
|
-
p(this,
|
|
1252
|
-
p(this,
|
|
1253
|
-
p(this,
|
|
1254
|
-
p(this,
|
|
1255
|
-
p(this,
|
|
1253
|
+
p(this, mt);
|
|
1254
|
+
p(this, Q, void 0);
|
|
1255
|
+
p(this, N, void 0);
|
|
1256
|
+
p(this, Ye, void 0);
|
|
1257
|
+
p(this, U, void 0);
|
|
1258
|
+
p(this, ge, void 0);
|
|
1259
|
+
p(this, De, void 0);
|
|
1260
|
+
p(this, B, void 0);
|
|
1261
|
+
p(this, ze, void 0);
|
|
1256
1262
|
p(this, Te, void 0);
|
|
1257
|
-
p(this, T, void 0);
|
|
1258
|
-
p(this, Ce, void 0);
|
|
1259
|
-
p(this, Ue, void 0);
|
|
1260
|
-
p(this, te, void 0);
|
|
1261
|
-
p(this, Xe, void 0);
|
|
1262
|
-
p(this, Qe, void 0);
|
|
1263
1263
|
// This property keeps track of the last query with defined data.
|
|
1264
1264
|
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
1265
|
-
p(this,
|
|
1265
|
+
p(this, Ue, void 0);
|
|
1266
|
+
p(this, Ce, void 0);
|
|
1266
1267
|
p(this, xe, void 0);
|
|
1267
|
-
p(this,
|
|
1268
|
-
p(this,
|
|
1269
|
-
|
|
1270
|
-
h(this, P, void 0), h(this, Te, void 0), h(this, T, void 0), h(this, we, /* @__PURE__ */ new Set()), h(this, H, t), this.options = s, h(this, te, null), this.bindMethods(), this.setOptions(s);
|
|
1268
|
+
p(this, de, void 0);
|
|
1269
|
+
p(this, Qe, /* @__PURE__ */ new Set());
|
|
1270
|
+
this.options = s, h(this, Q, t), h(this, B, null), this.bindMethods(), this.setOptions(s);
|
|
1271
1271
|
}
|
|
1272
1272
|
bindMethods() {
|
|
1273
1273
|
this.refetch = this.refetch.bind(this);
|
|
1274
1274
|
}
|
|
1275
1275
|
onSubscribe() {
|
|
1276
|
-
this.listeners.size === 1 && (n(this,
|
|
1276
|
+
this.listeners.size === 1 && (n(this, N).addObserver(this), Wt(n(this, N), this.options) ? x(this, be, Ge).call(this) : this.updateResult(), x(this, Be, St).call(this));
|
|
1277
1277
|
}
|
|
1278
1278
|
onUnsubscribe() {
|
|
1279
1279
|
this.hasListeners() || this.destroy();
|
|
1280
1280
|
}
|
|
1281
1281
|
shouldFetchOnReconnect() {
|
|
1282
|
-
return
|
|
1283
|
-
n(this,
|
|
1282
|
+
return kt(
|
|
1283
|
+
n(this, N),
|
|
1284
1284
|
this.options,
|
|
1285
1285
|
this.options.refetchOnReconnect
|
|
1286
1286
|
);
|
|
1287
1287
|
}
|
|
1288
1288
|
shouldFetchOnWindowFocus() {
|
|
1289
|
-
return
|
|
1290
|
-
n(this,
|
|
1289
|
+
return kt(
|
|
1290
|
+
n(this, N),
|
|
1291
1291
|
this.options,
|
|
1292
1292
|
this.options.refetchOnWindowFocus
|
|
1293
1293
|
);
|
|
1294
1294
|
}
|
|
1295
1295
|
destroy() {
|
|
1296
|
-
this.listeners = /* @__PURE__ */ new Set(), x(this,
|
|
1296
|
+
this.listeners = /* @__PURE__ */ new Set(), x(this, et, At).call(this), x(this, tt, Pt).call(this), n(this, N).removeObserver(this);
|
|
1297
1297
|
}
|
|
1298
1298
|
setOptions(t, s) {
|
|
1299
|
-
const r = this.options, a = n(this,
|
|
1300
|
-
if (this.options = n(this,
|
|
1299
|
+
const r = this.options, a = n(this, N);
|
|
1300
|
+
if (this.options = n(this, Q).defaultQueryOptions(t), ct(r, this.options) || n(this, Q).getQueryCache().notify({
|
|
1301
1301
|
type: "observerOptionsUpdated",
|
|
1302
|
-
query: n(this,
|
|
1302
|
+
query: n(this, N),
|
|
1303
1303
|
observer: this
|
|
1304
1304
|
}), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
|
|
1305
1305
|
throw new Error("Expected enabled to be a boolean");
|
|
1306
|
-
this.options.queryKey || (this.options.queryKey = r.queryKey), x(this,
|
|
1306
|
+
this.options.queryKey || (this.options.queryKey = r.queryKey), x(this, st, Nt).call(this);
|
|
1307
1307
|
const o = this.hasListeners();
|
|
1308
|
-
o &&
|
|
1309
|
-
n(this,
|
|
1308
|
+
o && Zt(
|
|
1309
|
+
n(this, N),
|
|
1310
1310
|
a,
|
|
1311
1311
|
this.options,
|
|
1312
1312
|
r
|
|
1313
|
-
) && x(this,
|
|
1314
|
-
const l = x(this,
|
|
1315
|
-
o && (n(this,
|
|
1313
|
+
) && x(this, be, Ge).call(this), this.updateResult(s), o && (n(this, N) !== a || this.options.enabled !== r.enabled || this.options.staleTime !== r.staleTime) && x(this, Je, jt).call(this);
|
|
1314
|
+
const l = x(this, Xe, _t).call(this);
|
|
1315
|
+
o && (n(this, N) !== a || this.options.enabled !== r.enabled || l !== n(this, de)) && x(this, Ie, Et).call(this, l);
|
|
1316
1316
|
}
|
|
1317
1317
|
getOptimisticResult(t) {
|
|
1318
|
-
const s = n(this,
|
|
1319
|
-
return
|
|
1318
|
+
const s = n(this, Q).getQueryCache().build(n(this, Q), t), r = this.createResult(s, t);
|
|
1319
|
+
return lr(this, r) && (h(this, U, r), h(this, De, this.options), h(this, ge, n(this, N).state)), r;
|
|
1320
1320
|
}
|
|
1321
1321
|
getCurrentResult() {
|
|
1322
|
-
return n(this,
|
|
1322
|
+
return n(this, U);
|
|
1323
1323
|
}
|
|
1324
1324
|
trackResult(t) {
|
|
1325
1325
|
const s = {};
|
|
@@ -1327,12 +1327,12 @@ var L, ce, ue, Le, Fe, de, Re, De, ds, ws = (ds = class {
|
|
|
1327
1327
|
Object.defineProperty(s, r, {
|
|
1328
1328
|
configurable: !1,
|
|
1329
1329
|
enumerable: !0,
|
|
1330
|
-
get: () => (n(this,
|
|
1330
|
+
get: () => (n(this, Qe).add(r), t[r])
|
|
1331
1331
|
});
|
|
1332
1332
|
}), s;
|
|
1333
1333
|
}
|
|
1334
1334
|
getCurrentQuery() {
|
|
1335
|
-
return n(this,
|
|
1335
|
+
return n(this, N);
|
|
1336
1336
|
}
|
|
1337
1337
|
refetch({ ...t } = {}) {
|
|
1338
1338
|
return this.fetch({
|
|
@@ -1340,183 +1340,183 @@ var L, ce, ue, Le, Fe, de, Re, De, ds, ws = (ds = class {
|
|
|
1340
1340
|
});
|
|
1341
1341
|
}
|
|
1342
1342
|
fetchOptimistic(t) {
|
|
1343
|
-
const s = n(this,
|
|
1343
|
+
const s = n(this, Q).defaultQueryOptions(t), r = n(this, Q).getQueryCache().build(n(this, Q), s);
|
|
1344
1344
|
return r.isFetchingOptimistic = !0, r.fetch().then(() => this.createResult(r, s));
|
|
1345
1345
|
}
|
|
1346
1346
|
fetch(t) {
|
|
1347
|
-
return x(this,
|
|
1347
|
+
return x(this, be, Ge).call(this, {
|
|
1348
1348
|
...t,
|
|
1349
1349
|
cancelRefetch: t.cancelRefetch ?? !0
|
|
1350
|
-
}).then(() => (this.updateResult(), n(this,
|
|
1350
|
+
}).then(() => (this.updateResult(), n(this, U)));
|
|
1351
1351
|
}
|
|
1352
1352
|
createResult(t, s) {
|
|
1353
|
-
var
|
|
1354
|
-
const r = n(this,
|
|
1355
|
-
let { error:
|
|
1353
|
+
var $;
|
|
1354
|
+
const r = n(this, N), a = this.options, o = n(this, U), l = n(this, ge), c = n(this, De), C = t !== r ? t.state : n(this, Ye), { state: u } = t;
|
|
1355
|
+
let { error: b, errorUpdatedAt: v, fetchStatus: f, status: w } = u, E = !1, y;
|
|
1356
1356
|
if (s._optimisticResults) {
|
|
1357
|
-
const
|
|
1358
|
-
(
|
|
1357
|
+
const T = this.hasListeners(), O = !T && Wt(t, s), ee = T && Zt(t, r, s, a);
|
|
1358
|
+
(O || ee) && (f = vt(t.options.networkMode) ? "fetching" : "paused", u.dataUpdatedAt || (w = "pending")), s._optimisticResults === "isRestoring" && (f = "idle");
|
|
1359
1359
|
}
|
|
1360
1360
|
if (s.select && typeof u.data < "u")
|
|
1361
|
-
if (o && u.data === (l == null ? void 0 : l.data) && s.select === n(this,
|
|
1362
|
-
|
|
1361
|
+
if (o && u.data === (l == null ? void 0 : l.data) && s.select === n(this, ze))
|
|
1362
|
+
y = n(this, Te);
|
|
1363
1363
|
else
|
|
1364
1364
|
try {
|
|
1365
|
-
h(this,
|
|
1366
|
-
} catch (
|
|
1367
|
-
h(this,
|
|
1365
|
+
h(this, ze, s.select), y = s.select(u.data), y = wt(o == null ? void 0 : o.data, y, s), h(this, Te, y), h(this, B, null);
|
|
1366
|
+
} catch (T) {
|
|
1367
|
+
h(this, B, T);
|
|
1368
1368
|
}
|
|
1369
1369
|
else
|
|
1370
|
-
|
|
1371
|
-
if (typeof s.placeholderData < "u" && typeof
|
|
1372
|
-
let
|
|
1370
|
+
y = u.data;
|
|
1371
|
+
if (typeof s.placeholderData < "u" && typeof y > "u" && w === "pending") {
|
|
1372
|
+
let T;
|
|
1373
1373
|
if (o != null && o.isPlaceholderData && s.placeholderData === (c == null ? void 0 : c.placeholderData))
|
|
1374
|
-
|
|
1375
|
-
else if (
|
|
1376
|
-
(
|
|
1377
|
-
n(this,
|
|
1378
|
-
) : s.placeholderData, s.select && typeof
|
|
1374
|
+
T = o.data;
|
|
1375
|
+
else if (T = typeof s.placeholderData == "function" ? s.placeholderData(
|
|
1376
|
+
($ = n(this, Ue)) == null ? void 0 : $.state.data,
|
|
1377
|
+
n(this, Ue)
|
|
1378
|
+
) : s.placeholderData, s.select && typeof T < "u")
|
|
1379
1379
|
try {
|
|
1380
|
-
|
|
1381
|
-
} catch (
|
|
1382
|
-
h(this,
|
|
1380
|
+
T = s.select(T), h(this, B, null);
|
|
1381
|
+
} catch (O) {
|
|
1382
|
+
h(this, B, O);
|
|
1383
1383
|
}
|
|
1384
|
-
typeof
|
|
1384
|
+
typeof T < "u" && (w = "success", y = wt(
|
|
1385
1385
|
o == null ? void 0 : o.data,
|
|
1386
|
-
|
|
1386
|
+
T,
|
|
1387
1387
|
s
|
|
1388
|
-
),
|
|
1388
|
+
), E = !0);
|
|
1389
1389
|
}
|
|
1390
|
-
n(this,
|
|
1391
|
-
const
|
|
1390
|
+
n(this, B) && (b = n(this, B), y = n(this, Te), v = Date.now(), w = "error");
|
|
1391
|
+
const g = f === "fetching", S = w === "pending", _ = w === "error", k = S && g;
|
|
1392
1392
|
return {
|
|
1393
|
-
status:
|
|
1394
|
-
fetchStatus:
|
|
1393
|
+
status: w,
|
|
1394
|
+
fetchStatus: f,
|
|
1395
1395
|
isPending: S,
|
|
1396
|
-
isSuccess:
|
|
1397
|
-
isError:
|
|
1396
|
+
isSuccess: w === "success",
|
|
1397
|
+
isError: _,
|
|
1398
1398
|
isInitialLoading: k,
|
|
1399
1399
|
isLoading: k,
|
|
1400
|
-
data:
|
|
1400
|
+
data: y,
|
|
1401
1401
|
dataUpdatedAt: u.dataUpdatedAt,
|
|
1402
|
-
error:
|
|
1403
|
-
errorUpdatedAt:
|
|
1402
|
+
error: b,
|
|
1403
|
+
errorUpdatedAt: v,
|
|
1404
1404
|
failureCount: u.fetchFailureCount,
|
|
1405
1405
|
failureReason: u.fetchFailureReason,
|
|
1406
1406
|
errorUpdateCount: u.errorUpdateCount,
|
|
1407
1407
|
isFetched: u.dataUpdateCount > 0 || u.errorUpdateCount > 0,
|
|
1408
|
-
isFetchedAfterMount: u.dataUpdateCount >
|
|
1409
|
-
isFetching:
|
|
1410
|
-
isRefetching:
|
|
1411
|
-
isLoadingError:
|
|
1412
|
-
isPaused:
|
|
1413
|
-
isPlaceholderData:
|
|
1414
|
-
isRefetchError:
|
|
1415
|
-
isStale:
|
|
1408
|
+
isFetchedAfterMount: u.dataUpdateCount > C.dataUpdateCount || u.errorUpdateCount > C.errorUpdateCount,
|
|
1409
|
+
isFetching: g,
|
|
1410
|
+
isRefetching: g && !S,
|
|
1411
|
+
isLoadingError: _ && u.dataUpdatedAt === 0,
|
|
1412
|
+
isPaused: f === "paused",
|
|
1413
|
+
isPlaceholderData: E,
|
|
1414
|
+
isRefetchError: _ && u.dataUpdatedAt !== 0,
|
|
1415
|
+
isStale: Rt(t, s),
|
|
1416
1416
|
refetch: this.refetch
|
|
1417
1417
|
};
|
|
1418
1418
|
}
|
|
1419
1419
|
updateResult(t) {
|
|
1420
|
-
const s = n(this,
|
|
1421
|
-
if (h(this,
|
|
1420
|
+
const s = n(this, U), r = this.createResult(n(this, N), this.options);
|
|
1421
|
+
if (h(this, ge, n(this, N).state), h(this, De, this.options), n(this, ge).data !== void 0 && h(this, Ue, n(this, N)), ct(r, s))
|
|
1422
1422
|
return;
|
|
1423
|
-
h(this,
|
|
1423
|
+
h(this, U, r);
|
|
1424
1424
|
const a = {}, o = () => {
|
|
1425
1425
|
if (!s)
|
|
1426
1426
|
return !0;
|
|
1427
1427
|
const { notifyOnChangeProps: l } = this.options, c = typeof l == "function" ? l() : l;
|
|
1428
|
-
if (c === "all" || !c && !n(this,
|
|
1428
|
+
if (c === "all" || !c && !n(this, Qe).size)
|
|
1429
1429
|
return !0;
|
|
1430
|
-
const
|
|
1431
|
-
c ?? n(this,
|
|
1430
|
+
const m = new Set(
|
|
1431
|
+
c ?? n(this, Qe)
|
|
1432
1432
|
);
|
|
1433
|
-
return this.options.throwOnError &&
|
|
1434
|
-
const u =
|
|
1435
|
-
return n(this,
|
|
1433
|
+
return this.options.throwOnError && m.add("error"), Object.keys(n(this, U)).some((C) => {
|
|
1434
|
+
const u = C;
|
|
1435
|
+
return n(this, U)[u] !== s[u] && m.has(u);
|
|
1436
1436
|
});
|
|
1437
1437
|
};
|
|
1438
|
-
(t == null ? void 0 : t.listeners) !== !1 && o() && (a.listeners = !0), x(this,
|
|
1438
|
+
(t == null ? void 0 : t.listeners) !== !1 && o() && (a.listeners = !0), x(this, mt, ys).call(this, { ...a, ...t });
|
|
1439
1439
|
}
|
|
1440
1440
|
onQueryUpdate() {
|
|
1441
|
-
this.updateResult(), this.hasListeners() && x(this,
|
|
1441
|
+
this.updateResult(), this.hasListeners() && x(this, Be, St).call(this);
|
|
1442
1442
|
}
|
|
1443
|
-
},
|
|
1444
|
-
x(this,
|
|
1445
|
-
let s = n(this,
|
|
1443
|
+
}, Q = new WeakMap(), N = new WeakMap(), Ye = new WeakMap(), U = new WeakMap(), ge = new WeakMap(), De = new WeakMap(), B = new WeakMap(), ze = new WeakMap(), Te = new WeakMap(), Ue = new WeakMap(), Ce = new WeakMap(), xe = new WeakMap(), de = new WeakMap(), Qe = new WeakMap(), be = new WeakSet(), Ge = function(t) {
|
|
1444
|
+
x(this, st, Nt).call(this);
|
|
1445
|
+
let s = n(this, N).fetch(
|
|
1446
1446
|
this.options,
|
|
1447
1447
|
t
|
|
1448
1448
|
);
|
|
1449
|
-
return t != null && t.throwOnError || (s = s.catch(
|
|
1450
|
-
},
|
|
1451
|
-
if (x(this,
|
|
1449
|
+
return t != null && t.throwOnError || (s = s.catch(Z)), s;
|
|
1450
|
+
}, Je = new WeakSet(), jt = function() {
|
|
1451
|
+
if (x(this, et, At).call(this), $e || n(this, U).isStale || !xt(this.options.staleTime))
|
|
1452
1452
|
return;
|
|
1453
|
-
const s =
|
|
1454
|
-
n(this,
|
|
1453
|
+
const s = us(
|
|
1454
|
+
n(this, U).dataUpdatedAt,
|
|
1455
1455
|
this.options.staleTime
|
|
1456
1456
|
) + 1;
|
|
1457
|
-
h(this,
|
|
1458
|
-
n(this,
|
|
1457
|
+
h(this, Ce, setTimeout(() => {
|
|
1458
|
+
n(this, U).isStale || this.updateResult();
|
|
1459
1459
|
}, s));
|
|
1460
|
+
}, Xe = new WeakSet(), _t = function() {
|
|
1461
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(n(this, N)) : this.options.refetchInterval) ?? !1;
|
|
1462
|
+
}, Ie = new WeakSet(), Et = function(t) {
|
|
1463
|
+
x(this, tt, Pt).call(this), h(this, de, t), !($e || this.options.enabled === !1 || !xt(n(this, de)) || n(this, de) === 0) && h(this, xe, setInterval(() => {
|
|
1464
|
+
(this.options.refetchIntervalInBackground || ut.isFocused()) && x(this, be, Ge).call(this);
|
|
1465
|
+
}, n(this, de)));
|
|
1460
1466
|
}, Be = new WeakSet(), St = function() {
|
|
1461
|
-
|
|
1462
|
-
}, et = new WeakSet(),
|
|
1463
|
-
|
|
1464
|
-
(this.options.refetchIntervalInBackground || ft.isFocused()) && x(this, je, Ve).call(this);
|
|
1465
|
-
}, n(this, he)));
|
|
1467
|
+
x(this, Je, jt).call(this), x(this, Ie, Et).call(this, x(this, Xe, _t).call(this));
|
|
1468
|
+
}, et = new WeakSet(), At = function() {
|
|
1469
|
+
n(this, Ce) && (clearTimeout(n(this, Ce)), h(this, Ce, void 0));
|
|
1466
1470
|
}, tt = new WeakSet(), Pt = function() {
|
|
1467
|
-
|
|
1471
|
+
n(this, xe) && (clearInterval(n(this, xe)), h(this, xe, void 0));
|
|
1468
1472
|
}, st = new WeakSet(), Nt = function() {
|
|
1469
|
-
n(this,
|
|
1470
|
-
|
|
1471
|
-
n(this, be) && (clearInterval(n(this, be)), h(this, be, void 0));
|
|
1472
|
-
}, it = new WeakSet(), Ot = function() {
|
|
1473
|
-
const t = n(this, H).getQueryCache().build(n(this, H), this.options);
|
|
1474
|
-
if (t === n(this, P))
|
|
1473
|
+
const t = n(this, Q).getQueryCache().build(n(this, Q), this.options);
|
|
1474
|
+
if (t === n(this, N))
|
|
1475
1475
|
return;
|
|
1476
|
-
const s = n(this,
|
|
1477
|
-
h(this,
|
|
1478
|
-
},
|
|
1479
|
-
|
|
1476
|
+
const s = n(this, N);
|
|
1477
|
+
h(this, N, t), h(this, Ye, t.state), this.hasListeners() && (s == null || s.removeObserver(this), t.addObserver(this));
|
|
1478
|
+
}, mt = new WeakSet(), ys = function(t) {
|
|
1479
|
+
R.batch(() => {
|
|
1480
1480
|
t.listeners && this.listeners.forEach((s) => {
|
|
1481
|
-
s(n(this,
|
|
1482
|
-
}), n(this,
|
|
1483
|
-
query: n(this,
|
|
1481
|
+
s(n(this, U));
|
|
1482
|
+
}), n(this, Q).getQueryCache().notify({
|
|
1483
|
+
query: n(this, N),
|
|
1484
1484
|
type: "observerResultsUpdated"
|
|
1485
1485
|
});
|
|
1486
1486
|
});
|
|
1487
|
-
},
|
|
1488
|
-
function
|
|
1487
|
+
}, os);
|
|
1488
|
+
function or(e, t) {
|
|
1489
1489
|
return t.enabled !== !1 && !e.state.dataUpdatedAt && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1492
|
-
return
|
|
1491
|
+
function Wt(e, t) {
|
|
1492
|
+
return or(e, t) || e.state.dataUpdatedAt > 0 && kt(e, t, t.refetchOnMount);
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function kt(e, t, s) {
|
|
1495
1495
|
if (t.enabled !== !1) {
|
|
1496
1496
|
const r = typeof s == "function" ? s(e) : s;
|
|
1497
|
-
return r === "always" || r !== !1 &&
|
|
1497
|
+
return r === "always" || r !== !1 && Rt(e, t);
|
|
1498
1498
|
}
|
|
1499
1499
|
return !1;
|
|
1500
1500
|
}
|
|
1501
|
-
function
|
|
1502
|
-
return s.enabled !== !1 && (e !== t || r.enabled === !1) && (!s.suspense || e.state.status !== "error") &&
|
|
1501
|
+
function Zt(e, t, s, r) {
|
|
1502
|
+
return s.enabled !== !1 && (e !== t || r.enabled === !1) && (!s.suspense || e.state.status !== "error") && Rt(e, s);
|
|
1503
1503
|
}
|
|
1504
|
-
function
|
|
1504
|
+
function Rt(e, t) {
|
|
1505
1505
|
return e.isStaleByTime(t.staleTime);
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1508
|
-
return !
|
|
1507
|
+
function lr(e, t) {
|
|
1508
|
+
return !ct(e.getCurrentResult(), t);
|
|
1509
1509
|
}
|
|
1510
|
-
var
|
|
1510
|
+
var he, se, G, re, He, lt, rt, Ot, ls, cr = (ls = class extends Ke {
|
|
1511
1511
|
constructor(t, s) {
|
|
1512
1512
|
super();
|
|
1513
|
-
p(this,
|
|
1514
|
-
p(this,
|
|
1515
|
-
p(this,
|
|
1516
|
-
p(this,
|
|
1517
|
-
p(this,
|
|
1518
|
-
p(this,
|
|
1519
|
-
h(this,
|
|
1513
|
+
p(this, He);
|
|
1514
|
+
p(this, rt);
|
|
1515
|
+
p(this, he, void 0);
|
|
1516
|
+
p(this, se, void 0);
|
|
1517
|
+
p(this, G, void 0);
|
|
1518
|
+
p(this, re, void 0);
|
|
1519
|
+
h(this, se, void 0), h(this, he, t), this.setOptions(s), this.bindMethods(), x(this, He, lt).call(this);
|
|
1520
1520
|
}
|
|
1521
1521
|
bindMethods() {
|
|
1522
1522
|
this.mutate = this.mutate.bind(this), this.reset = this.reset.bind(this);
|
|
@@ -1524,33 +1524,34 @@ var fe, Q, Z, ie, $e, dt, nt, Ft, fs, pr = (fs = class extends Ge {
|
|
|
1524
1524
|
setOptions(t) {
|
|
1525
1525
|
var r;
|
|
1526
1526
|
const s = this.options;
|
|
1527
|
-
this.options = n(this,
|
|
1527
|
+
this.options = n(this, he).defaultMutationOptions(t), ct(s, this.options) || n(this, he).getMutationCache().notify({
|
|
1528
1528
|
type: "observerOptionsUpdated",
|
|
1529
|
-
mutation: n(this,
|
|
1529
|
+
mutation: n(this, G),
|
|
1530
1530
|
observer: this
|
|
1531
|
-
}), (r = n(this,
|
|
1531
|
+
}), (r = n(this, G)) == null || r.setOptions(this.options), s != null && s.mutationKey && this.options.mutationKey && we(s.mutationKey) !== we(this.options.mutationKey) && this.reset();
|
|
1532
1532
|
}
|
|
1533
1533
|
onUnsubscribe() {
|
|
1534
1534
|
var t;
|
|
1535
|
-
this.hasListeners() || (t = n(this,
|
|
1535
|
+
this.hasListeners() || (t = n(this, G)) == null || t.removeObserver(this);
|
|
1536
1536
|
}
|
|
1537
1537
|
onMutationUpdate(t) {
|
|
1538
|
-
x(this,
|
|
1538
|
+
x(this, He, lt).call(this), x(this, rt, Ot).call(this, t);
|
|
1539
1539
|
}
|
|
1540
1540
|
getCurrentResult() {
|
|
1541
|
-
return n(this,
|
|
1541
|
+
return n(this, se);
|
|
1542
1542
|
}
|
|
1543
1543
|
reset() {
|
|
1544
|
-
|
|
1544
|
+
var t;
|
|
1545
|
+
(t = n(this, G)) == null || t.removeObserver(this), h(this, G, void 0), x(this, He, lt).call(this), x(this, rt, Ot).call(this);
|
|
1545
1546
|
}
|
|
1546
1547
|
mutate(t, s) {
|
|
1547
1548
|
var r;
|
|
1548
|
-
return h(this,
|
|
1549
|
+
return h(this, re, s), (r = n(this, G)) == null || r.removeObserver(this), h(this, G, n(this, he).getMutationCache().build(n(this, he), this.options)), n(this, G).addObserver(this), n(this, G).execute(t);
|
|
1549
1550
|
}
|
|
1550
|
-
},
|
|
1551
|
+
}, he = new WeakMap(), se = new WeakMap(), G = new WeakMap(), re = new WeakMap(), He = new WeakSet(), lt = function() {
|
|
1551
1552
|
var s;
|
|
1552
|
-
const t = ((s = n(this,
|
|
1553
|
-
h(this,
|
|
1553
|
+
const t = ((s = n(this, G)) == null ? void 0 : s.state) ?? ms();
|
|
1554
|
+
h(this, se, {
|
|
1554
1555
|
...t,
|
|
1555
1556
|
isPending: t.status === "pending",
|
|
1556
1557
|
isSuccess: t.status === "success",
|
|
@@ -1559,52 +1560,40 @@ var fe, Q, Z, ie, $e, dt, nt, Ft, fs, pr = (fs = class extends Ge {
|
|
|
1559
1560
|
mutate: this.mutate,
|
|
1560
1561
|
reset: this.reset
|
|
1561
1562
|
});
|
|
1562
|
-
},
|
|
1563
|
-
|
|
1564
|
-
var s, r, a, o, l, c,
|
|
1565
|
-
n(this,
|
|
1566
|
-
|
|
1567
|
-
t.data,
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
l,
|
|
1578
|
-
t.error,
|
|
1579
|
-
n(this, Q).variables,
|
|
1580
|
-
n(this, Q).context
|
|
1581
|
-
), (g = (f = n(this, ie)).onSettled) == null || g.call(
|
|
1582
|
-
f,
|
|
1583
|
-
void 0,
|
|
1584
|
-
t.error,
|
|
1585
|
-
n(this, Q).variables,
|
|
1586
|
-
n(this, Q).context
|
|
1587
|
-
))), this.listeners.forEach((u) => {
|
|
1588
|
-
u(n(this, Q));
|
|
1563
|
+
}, rt = new WeakSet(), Ot = function(t) {
|
|
1564
|
+
R.batch(() => {
|
|
1565
|
+
var s, r, a, o, l, c, m, C;
|
|
1566
|
+
if (n(this, re) && this.hasListeners()) {
|
|
1567
|
+
const u = n(this, se).variables, b = n(this, se).context;
|
|
1568
|
+
(t == null ? void 0 : t.type) === "success" ? ((r = (s = n(this, re)).onSuccess) == null || r.call(s, t.data, u, b), (o = (a = n(this, re)).onSettled) == null || o.call(a, t.data, null, u, b)) : (t == null ? void 0 : t.type) === "error" && ((c = (l = n(this, re)).onError) == null || c.call(l, t.error, u, b), (C = (m = n(this, re)).onSettled) == null || C.call(
|
|
1569
|
+
m,
|
|
1570
|
+
void 0,
|
|
1571
|
+
t.error,
|
|
1572
|
+
u,
|
|
1573
|
+
b
|
|
1574
|
+
));
|
|
1575
|
+
}
|
|
1576
|
+
this.listeners.forEach((u) => {
|
|
1577
|
+
u(n(this, se));
|
|
1589
1578
|
});
|
|
1590
1579
|
});
|
|
1591
|
-
},
|
|
1580
|
+
}, ls), gs = d.createContext(
|
|
1592
1581
|
void 0
|
|
1593
|
-
),
|
|
1594
|
-
const t = d.useContext(
|
|
1582
|
+
), Dt = (e) => {
|
|
1583
|
+
const t = d.useContext(gs);
|
|
1595
1584
|
if (e)
|
|
1596
1585
|
return e;
|
|
1597
1586
|
if (!t)
|
|
1598
1587
|
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
1599
1588
|
return t;
|
|
1600
|
-
},
|
|
1589
|
+
}, ur = ({
|
|
1601
1590
|
client: e,
|
|
1602
1591
|
children: t
|
|
1603
1592
|
}) => (d.useEffect(() => (e.mount(), () => {
|
|
1604
1593
|
e.unmount();
|
|
1605
|
-
}), [e]), /* @__PURE__ */ d.createElement(
|
|
1606
|
-
|
|
1607
|
-
function
|
|
1594
|
+
}), [e]), /* @__PURE__ */ d.createElement(gs.Provider, { value: e }, t)), Cs = d.createContext(!1), dr = () => d.useContext(Cs);
|
|
1595
|
+
Cs.Provider;
|
|
1596
|
+
function hr() {
|
|
1608
1597
|
let e = !1;
|
|
1609
1598
|
return {
|
|
1610
1599
|
clearReset: () => {
|
|
@@ -1616,40 +1605,40 @@ function gr() {
|
|
|
1616
1605
|
isReset: () => e
|
|
1617
1606
|
};
|
|
1618
1607
|
}
|
|
1619
|
-
var
|
|
1620
|
-
function
|
|
1608
|
+
var fr = d.createContext(hr()), pr = () => d.useContext(fr);
|
|
1609
|
+
function xs(e, t) {
|
|
1621
1610
|
return typeof e == "function" ? e(...t) : !!e;
|
|
1622
1611
|
}
|
|
1623
|
-
var
|
|
1612
|
+
var mr = (e, t) => {
|
|
1624
1613
|
(e.suspense || e.throwOnError) && (t.isReset() || (e.retryOnMount = !1));
|
|
1625
|
-
},
|
|
1614
|
+
}, vr = (e) => {
|
|
1626
1615
|
d.useEffect(() => {
|
|
1627
1616
|
e.clearReset();
|
|
1628
1617
|
}, [e]);
|
|
1629
|
-
},
|
|
1618
|
+
}, yr = ({
|
|
1630
1619
|
result: e,
|
|
1631
1620
|
errorResetBoundary: t,
|
|
1632
1621
|
throwOnError: s,
|
|
1633
1622
|
query: r
|
|
1634
|
-
}) => e.isError && !t.isReset() && !e.isFetching &&
|
|
1623
|
+
}) => e.isError && !t.isReset() && !e.isFetching && r && xs(s, [e.error, r]), gr = (e) => {
|
|
1635
1624
|
e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
|
|
1636
|
-
},
|
|
1625
|
+
}, Cr = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, xr = (e, t, s) => t.fetchOptimistic(e).catch(() => {
|
|
1637
1626
|
s.clearReset();
|
|
1638
1627
|
});
|
|
1639
|
-
function
|
|
1640
|
-
const r =
|
|
1641
|
-
l._optimisticResults = a ? "isRestoring" : "optimistic",
|
|
1628
|
+
function br(e, t, s) {
|
|
1629
|
+
const r = Dt(s), a = dr(), o = pr(), l = r.defaultQueryOptions(e);
|
|
1630
|
+
l._optimisticResults = a ? "isRestoring" : "optimistic", gr(l), mr(l, o), vr(o);
|
|
1642
1631
|
const [c] = d.useState(
|
|
1643
1632
|
() => new t(
|
|
1644
1633
|
r,
|
|
1645
1634
|
l
|
|
1646
1635
|
)
|
|
1647
|
-
),
|
|
1636
|
+
), m = c.getOptimisticResult(l);
|
|
1648
1637
|
if (d.useSyncExternalStore(
|
|
1649
1638
|
d.useCallback(
|
|
1650
|
-
(
|
|
1639
|
+
(C) => {
|
|
1651
1640
|
const u = a ? () => {
|
|
1652
|
-
} : c.subscribe(
|
|
1641
|
+
} : c.subscribe(R.batchCalls(C));
|
|
1653
1642
|
return c.updateResult(), u;
|
|
1654
1643
|
},
|
|
1655
1644
|
[c, a]
|
|
@@ -1658,23 +1647,23 @@ function Ar(e, t, s) {
|
|
|
1658
1647
|
() => c.getCurrentResult()
|
|
1659
1648
|
), d.useEffect(() => {
|
|
1660
1649
|
c.setOptions(l, { listeners: !1 });
|
|
1661
|
-
}, [l, c]),
|
|
1662
|
-
throw
|
|
1663
|
-
if (
|
|
1664
|
-
result:
|
|
1650
|
+
}, [l, c]), Cr(l, m))
|
|
1651
|
+
throw xr(l, c, o);
|
|
1652
|
+
if (yr({
|
|
1653
|
+
result: m,
|
|
1665
1654
|
errorResetBoundary: o,
|
|
1666
1655
|
throwOnError: l.throwOnError,
|
|
1667
|
-
query:
|
|
1656
|
+
query: r.getQueryCache().get(l.queryHash)
|
|
1668
1657
|
}))
|
|
1669
|
-
throw
|
|
1670
|
-
return l.notifyOnChangeProps ?
|
|
1658
|
+
throw m.error;
|
|
1659
|
+
return l.notifyOnChangeProps ? m : c.trackResult(m);
|
|
1671
1660
|
}
|
|
1672
|
-
function
|
|
1673
|
-
return
|
|
1661
|
+
function bs(e, t) {
|
|
1662
|
+
return br(e, ar, t);
|
|
1674
1663
|
}
|
|
1675
|
-
function
|
|
1676
|
-
const s =
|
|
1677
|
-
() => new
|
|
1664
|
+
function wr(e, t) {
|
|
1665
|
+
const s = Dt(t), [r] = d.useState(
|
|
1666
|
+
() => new cr(
|
|
1678
1667
|
s,
|
|
1679
1668
|
e
|
|
1680
1669
|
)
|
|
@@ -1684,100 +1673,101 @@ function Sr(e, t) {
|
|
|
1684
1673
|
}, [r, e]);
|
|
1685
1674
|
const a = d.useSyncExternalStore(
|
|
1686
1675
|
d.useCallback(
|
|
1687
|
-
(l) => r.subscribe(
|
|
1676
|
+
(l) => r.subscribe(R.batchCalls(l)),
|
|
1688
1677
|
[r]
|
|
1689
1678
|
),
|
|
1690
1679
|
() => r.getCurrentResult(),
|
|
1691
1680
|
() => r.getCurrentResult()
|
|
1692
1681
|
), o = d.useCallback(
|
|
1693
1682
|
(l, c) => {
|
|
1694
|
-
r.mutate(l, c).catch(
|
|
1683
|
+
r.mutate(l, c).catch(jr);
|
|
1695
1684
|
},
|
|
1696
1685
|
[r]
|
|
1697
1686
|
);
|
|
1698
|
-
if (a.error &&
|
|
1687
|
+
if (a.error && xs(r.options.throwOnError, [a.error]))
|
|
1699
1688
|
throw a.error;
|
|
1700
1689
|
return { ...a, mutate: o, mutateAsync: a.mutate };
|
|
1701
1690
|
}
|
|
1702
|
-
function
|
|
1691
|
+
function jr() {
|
|
1703
1692
|
}
|
|
1704
|
-
function
|
|
1693
|
+
function ws(e) {
|
|
1705
1694
|
var t, s, r = "";
|
|
1706
1695
|
if (typeof e == "string" || typeof e == "number")
|
|
1707
1696
|
r += e;
|
|
1708
1697
|
else if (typeof e == "object")
|
|
1709
|
-
if (Array.isArray(e))
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1698
|
+
if (Array.isArray(e)) {
|
|
1699
|
+
var a = e.length;
|
|
1700
|
+
for (t = 0; t < a; t++)
|
|
1701
|
+
e[t] && (s = ws(e[t])) && (r && (r += " "), r += s);
|
|
1702
|
+
} else
|
|
1703
|
+
for (s in e)
|
|
1704
|
+
e[s] && (r && (r += " "), r += s);
|
|
1715
1705
|
return r;
|
|
1716
1706
|
}
|
|
1717
|
-
function
|
|
1718
|
-
for (var e, t, s = 0, r = ""
|
|
1719
|
-
(e = arguments[s
|
|
1707
|
+
function P() {
|
|
1708
|
+
for (var e, t, s = 0, r = "", a = arguments.length; s < a; s++)
|
|
1709
|
+
(e = arguments[s]) && (t = ws(e)) && (r && (r += " "), r += t);
|
|
1720
1710
|
return r;
|
|
1721
1711
|
}
|
|
1722
|
-
var
|
|
1712
|
+
var _r = Object.defineProperty, Er = Object.defineProperties, Sr = Object.getOwnPropertyDescriptors, ht = Object.getOwnPropertySymbols, js = Object.prototype.hasOwnProperty, _s = Object.prototype.propertyIsEnumerable, Yt = (e, t, s) => t in e ? _r(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, j = (e, t) => {
|
|
1723
1713
|
for (var s in t || (t = {}))
|
|
1724
|
-
|
|
1725
|
-
if (
|
|
1726
|
-
for (var s of
|
|
1727
|
-
|
|
1714
|
+
js.call(t, s) && Yt(e, s, t[s]);
|
|
1715
|
+
if (ht)
|
|
1716
|
+
for (var s of ht(t))
|
|
1717
|
+
_s.call(t, s) && Yt(e, s, t[s]);
|
|
1728
1718
|
return e;
|
|
1729
|
-
}, A = (e, t) =>
|
|
1719
|
+
}, A = (e, t) => Er(e, Sr(t)), M = (e, t) => {
|
|
1730
1720
|
var s = {};
|
|
1731
1721
|
for (var r in e)
|
|
1732
|
-
|
|
1733
|
-
if (e != null &&
|
|
1734
|
-
for (var r of
|
|
1735
|
-
t.indexOf(r) < 0 &&
|
|
1722
|
+
js.call(e, r) && t.indexOf(r) < 0 && (s[r] = e[r]);
|
|
1723
|
+
if (e != null && ht)
|
|
1724
|
+
for (var r of ht(e))
|
|
1725
|
+
t.indexOf(r) < 0 && _s.call(e, r) && (s[r] = e[r]);
|
|
1736
1726
|
return s;
|
|
1737
1727
|
};
|
|
1738
|
-
function
|
|
1739
|
-
return
|
|
1728
|
+
function ft() {
|
|
1729
|
+
return ft = Object.assign ? Object.assign.bind() : function(e) {
|
|
1740
1730
|
for (var t = 1; t < arguments.length; t++) {
|
|
1741
1731
|
var s = arguments[t];
|
|
1742
1732
|
for (var r in s)
|
|
1743
1733
|
Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
|
|
1744
1734
|
}
|
|
1745
1735
|
return e;
|
|
1746
|
-
},
|
|
1736
|
+
}, ft.apply(this, arguments);
|
|
1747
1737
|
}
|
|
1748
|
-
function
|
|
1738
|
+
function Ar(e, t) {
|
|
1749
1739
|
typeof e == "function" ? e(t) : e != null && (e.current = t);
|
|
1750
1740
|
}
|
|
1751
|
-
function
|
|
1741
|
+
function Pr(...e) {
|
|
1752
1742
|
return (t) => e.forEach(
|
|
1753
|
-
(s) =>
|
|
1743
|
+
(s) => Ar(s, t)
|
|
1754
1744
|
);
|
|
1755
1745
|
}
|
|
1756
|
-
var
|
|
1757
|
-
const s = e, { children: r } = s, a =
|
|
1746
|
+
var Nr = /* @__PURE__ */ d.forwardRef((e, t) => {
|
|
1747
|
+
const s = e, { children: r } = s, a = M(s, ["children"]), o = d.Children.toArray(r), l = o.find(Or);
|
|
1758
1748
|
if (l) {
|
|
1759
|
-
const c = l.props.children,
|
|
1760
|
-
return /* @__PURE__ */ d.createElement(
|
|
1749
|
+
const c = l.props.children, m = o.map((C) => C === l ? d.Children.count(c) > 1 ? d.Children.only(null) : /* @__PURE__ */ d.isValidElement(c) ? c.props.children : null : C);
|
|
1750
|
+
return /* @__PURE__ */ d.createElement(Mt, ft({}, a, {
|
|
1761
1751
|
ref: t
|
|
1762
|
-
}), /* @__PURE__ */ d.isValidElement(c) ? /* @__PURE__ */ d.cloneElement(c, void 0,
|
|
1752
|
+
}), /* @__PURE__ */ d.isValidElement(c) ? /* @__PURE__ */ d.cloneElement(c, void 0, m) : null);
|
|
1763
1753
|
}
|
|
1764
|
-
return /* @__PURE__ */ d.createElement(
|
|
1754
|
+
return /* @__PURE__ */ d.createElement(Mt, ft({}, a, {
|
|
1765
1755
|
ref: t
|
|
1766
1756
|
}), r);
|
|
1767
1757
|
});
|
|
1768
|
-
|
|
1769
|
-
var
|
|
1770
|
-
const s = e, { children: r } = s, a =
|
|
1771
|
-
return /* @__PURE__ */ d.isValidElement(r) ? /* @__PURE__ */ d.cloneElement(r, A(j({},
|
|
1772
|
-
ref: t ?
|
|
1758
|
+
Nr.displayName = "Slot";
|
|
1759
|
+
var Mt = /* @__PURE__ */ d.forwardRef((e, t) => {
|
|
1760
|
+
const s = e, { children: r } = s, a = M(s, ["children"]);
|
|
1761
|
+
return /* @__PURE__ */ d.isValidElement(r) ? /* @__PURE__ */ d.cloneElement(r, A(j({}, Mr(a, r.props)), {
|
|
1762
|
+
ref: t ? Pr(t, r.ref) : r.ref
|
|
1773
1763
|
})) : d.Children.count(r) > 1 ? d.Children.only(null) : null;
|
|
1774
1764
|
});
|
|
1775
|
-
|
|
1776
|
-
var
|
|
1777
|
-
function
|
|
1778
|
-
return /* @__PURE__ */ d.isValidElement(e) && e.type ===
|
|
1765
|
+
Mt.displayName = "SlotClone";
|
|
1766
|
+
var kr = ({ children: e }) => /* @__PURE__ */ d.createElement(d.Fragment, null, e);
|
|
1767
|
+
function Or(e) {
|
|
1768
|
+
return /* @__PURE__ */ d.isValidElement(e) && e.type === kr;
|
|
1779
1769
|
}
|
|
1780
|
-
function
|
|
1770
|
+
function Mr(e, t) {
|
|
1781
1771
|
const s = j({}, t);
|
|
1782
1772
|
for (const r in t) {
|
|
1783
1773
|
const a = e[r], o = t[r];
|
|
@@ -1790,7 +1780,7 @@ function Tr(e, t) {
|
|
|
1790
1780
|
}
|
|
1791
1781
|
return j(j({}, e), s);
|
|
1792
1782
|
}
|
|
1793
|
-
var
|
|
1783
|
+
var Lr = ({ firstName: e, lastName: t, variant: s = "small" }) => {
|
|
1794
1784
|
const r = `${e.charAt(0)}${t.charAt(0)}`;
|
|
1795
1785
|
return /* @__PURE__ */ i.jsx(
|
|
1796
1786
|
"span",
|
|
@@ -1801,7 +1791,7 @@ var Ur = ({ firstName: e, lastName: t, variant: s = "small" }) => {
|
|
|
1801
1791
|
children: /* @__PURE__ */ i.jsx("span", { className: "avatar__initials", children: r })
|
|
1802
1792
|
}
|
|
1803
1793
|
);
|
|
1804
|
-
},
|
|
1794
|
+
}, it = d.forwardRef(
|
|
1805
1795
|
(e, t) => {
|
|
1806
1796
|
var s = e, {
|
|
1807
1797
|
iconLeft: r,
|
|
@@ -1809,9 +1799,9 @@ var Ur = ({ firstName: e, lastName: t, variant: s = "small" }) => {
|
|
|
1809
1799
|
isPending: o = !1,
|
|
1810
1800
|
isFilled: l = !1,
|
|
1811
1801
|
variant: c,
|
|
1812
|
-
className:
|
|
1813
|
-
children:
|
|
1814
|
-
} = s, u =
|
|
1802
|
+
className: m,
|
|
1803
|
+
children: C
|
|
1804
|
+
} = s, u = M(s, [
|
|
1815
1805
|
"iconLeft",
|
|
1816
1806
|
"iconRight",
|
|
1817
1807
|
"isPending",
|
|
@@ -1820,41 +1810,41 @@ var Ur = ({ firstName: e, lastName: t, variant: s = "small" }) => {
|
|
|
1820
1810
|
"className",
|
|
1821
1811
|
"children"
|
|
1822
1812
|
]);
|
|
1823
|
-
const
|
|
1813
|
+
const b = !!r || !!a;
|
|
1824
1814
|
return /* @__PURE__ */ i.jsxs(
|
|
1825
1815
|
"button",
|
|
1826
1816
|
A(j({
|
|
1827
1817
|
ref: t
|
|
1828
1818
|
}, u), {
|
|
1829
|
-
className:
|
|
1819
|
+
className: P(
|
|
1830
1820
|
"button",
|
|
1831
1821
|
c && `button--${c}`,
|
|
1832
1822
|
c && l && `button--${c}--filled`,
|
|
1833
|
-
|
|
1823
|
+
b && "button--with-icon",
|
|
1834
1824
|
o && "button--pending",
|
|
1835
|
-
|
|
1825
|
+
m
|
|
1836
1826
|
),
|
|
1837
1827
|
children: [
|
|
1838
1828
|
r && /* @__PURE__ */ i.jsx("div", { className: "button__icon", children: r }),
|
|
1839
|
-
!!
|
|
1829
|
+
!!C && /* @__PURE__ */ i.jsx("span", { className: "button__label", children: C }),
|
|
1840
1830
|
a && /* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: a })
|
|
1841
1831
|
]
|
|
1842
1832
|
})
|
|
1843
1833
|
);
|
|
1844
1834
|
}
|
|
1845
1835
|
);
|
|
1846
|
-
|
|
1836
|
+
it.displayName = "Button";
|
|
1847
1837
|
d.createContext(void 0);
|
|
1848
|
-
var
|
|
1838
|
+
var Fr = d.forwardRef(
|
|
1849
1839
|
(e, t) => {
|
|
1850
|
-
var s = e, { prefix: r, suffix: a, className: o } = s, l =
|
|
1840
|
+
var s = e, { prefix: r, suffix: a, className: o } = s, l = M(s, ["prefix", "suffix", "className"]);
|
|
1851
1841
|
return /* @__PURE__ */ i.jsxs("div", { className: "input__wrapper", children: [
|
|
1852
1842
|
r && /* @__PURE__ */ i.jsx("span", { className: "input__prefix", children: r }),
|
|
1853
1843
|
/* @__PURE__ */ i.jsx(
|
|
1854
1844
|
"input",
|
|
1855
1845
|
j({
|
|
1856
1846
|
ref: t,
|
|
1857
|
-
className:
|
|
1847
|
+
className: P(
|
|
1858
1848
|
"input",
|
|
1859
1849
|
r && "input--with-prefix",
|
|
1860
1850
|
a && "input--with-suffix",
|
|
@@ -1866,12 +1856,12 @@ var Qr = d.forwardRef(
|
|
|
1866
1856
|
] });
|
|
1867
1857
|
}
|
|
1868
1858
|
);
|
|
1869
|
-
|
|
1859
|
+
Fr.displayName = "TextField";
|
|
1870
1860
|
d.createContext(void 0);
|
|
1871
|
-
var
|
|
1872
|
-
var t = e, { children: s, className: r } = t, a =
|
|
1873
|
-
return /* @__PURE__ */ i.jsx("div", A(j({ className:
|
|
1874
|
-
},
|
|
1861
|
+
var Rr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__header__action", children: e }), Dr = (e) => {
|
|
1862
|
+
var t = e, { children: s, className: r } = t, a = M(t, ["children", "className"]);
|
|
1863
|
+
return /* @__PURE__ */ i.jsx("div", A(j({ className: P("card__body", r) }, a), { children: s }));
|
|
1864
|
+
}, Tr = (e) => /* @__PURE__ */ i.jsx(
|
|
1875
1865
|
"svg",
|
|
1876
1866
|
A(j({
|
|
1877
1867
|
width: "24",
|
|
@@ -1891,7 +1881,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
1891
1881
|
}
|
|
1892
1882
|
)
|
|
1893
1883
|
})
|
|
1894
|
-
),
|
|
1884
|
+
), Tt = Tr, Ur = (e) => /* @__PURE__ */ i.jsx(
|
|
1895
1885
|
"svg",
|
|
1896
1886
|
A(j({
|
|
1897
1887
|
width: "24",
|
|
@@ -1911,7 +1901,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
1911
1901
|
}
|
|
1912
1902
|
)
|
|
1913
1903
|
})
|
|
1914
|
-
),
|
|
1904
|
+
), Qr = Ur, Hr = (e) => /* @__PURE__ */ i.jsx(
|
|
1915
1905
|
"svg",
|
|
1916
1906
|
A(j({
|
|
1917
1907
|
width: "24",
|
|
@@ -1930,7 +1920,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
1930
1920
|
}
|
|
1931
1921
|
)
|
|
1932
1922
|
})
|
|
1933
|
-
),
|
|
1923
|
+
), $r = Hr, Kr = (e) => /* @__PURE__ */ i.jsx(
|
|
1934
1924
|
"svg",
|
|
1935
1925
|
A(j({
|
|
1936
1926
|
width: "24",
|
|
@@ -1949,7 +1939,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
1949
1939
|
}
|
|
1950
1940
|
)
|
|
1951
1941
|
})
|
|
1952
|
-
),
|
|
1942
|
+
), Gr = Kr, Vr = (e) => /* @__PURE__ */ i.jsx(
|
|
1953
1943
|
"svg",
|
|
1954
1944
|
A(j({
|
|
1955
1945
|
width: "24",
|
|
@@ -1968,7 +1958,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
1968
1958
|
}
|
|
1969
1959
|
)
|
|
1970
1960
|
})
|
|
1971
|
-
),
|
|
1961
|
+
), qr = Vr, Wr = (e) => /* @__PURE__ */ i.jsxs(
|
|
1972
1962
|
"svg",
|
|
1973
1963
|
A(j({
|
|
1974
1964
|
width: "24",
|
|
@@ -2005,7 +1995,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2005
1995
|
/* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_19_444", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
2006
1996
|
]
|
|
2007
1997
|
})
|
|
2008
|
-
),
|
|
1998
|
+
), Zr = Wr, Yr = (e) => /* @__PURE__ */ i.jsxs(
|
|
2009
1999
|
"svg",
|
|
2010
2000
|
A(j({
|
|
2011
2001
|
width: "24",
|
|
@@ -2037,7 +2027,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2037
2027
|
)
|
|
2038
2028
|
]
|
|
2039
2029
|
})
|
|
2040
|
-
),
|
|
2030
|
+
), zr = Yr, Jr = (e) => /* @__PURE__ */ i.jsxs(
|
|
2041
2031
|
"svg",
|
|
2042
2032
|
A(j({
|
|
2043
2033
|
width: "24",
|
|
@@ -2089,31 +2079,36 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2089
2079
|
)
|
|
2090
2080
|
]
|
|
2091
2081
|
})
|
|
2092
|
-
),
|
|
2093
|
-
"
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
{
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2082
|
+
), Xr = Jr, Ir = (e) => {
|
|
2083
|
+
var t = e, { className: s } = t, r = M(t, ["className"]);
|
|
2084
|
+
return /* @__PURE__ */ i.jsxs(
|
|
2085
|
+
"svg",
|
|
2086
|
+
A(j({
|
|
2087
|
+
width: "20",
|
|
2088
|
+
height: "20",
|
|
2089
|
+
viewBox: "0 0 20 20",
|
|
2090
|
+
fill: "none",
|
|
2091
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2092
|
+
className: P("spinner", s)
|
|
2093
|
+
}, r), {
|
|
2094
|
+
children: [
|
|
2095
|
+
/* @__PURE__ */ i.jsx("circle", { cx: "10", cy: "10", r: "9", stroke: "currentColor", strokeOpacity: "0.2", strokeWidth: "1.5" }),
|
|
2096
|
+
/* @__PURE__ */ i.jsx(
|
|
2097
|
+
"circle",
|
|
2098
|
+
{
|
|
2099
|
+
cx: "10",
|
|
2100
|
+
cy: "10",
|
|
2101
|
+
r: "9",
|
|
2102
|
+
stroke: "currentColor",
|
|
2103
|
+
strokeWidth: "1.5",
|
|
2104
|
+
strokeLinecap: "round",
|
|
2105
|
+
strokeDasharray: "42.42 14.14"
|
|
2106
|
+
}
|
|
2107
|
+
)
|
|
2108
|
+
]
|
|
2109
|
+
})
|
|
2110
|
+
);
|
|
2111
|
+
}, Br = Ir, ei = (e) => /* @__PURE__ */ i.jsxs(
|
|
2117
2112
|
"svg",
|
|
2118
2113
|
A(j({
|
|
2119
2114
|
width: "24",
|
|
@@ -2147,7 +2142,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2147
2142
|
/* @__PURE__ */ i.jsx("defs", { children: /* @__PURE__ */ i.jsx("clipPath", { id: "clip0_762_2934", children: /* @__PURE__ */ i.jsx("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
2148
2143
|
]
|
|
2149
2144
|
})
|
|
2150
|
-
),
|
|
2145
|
+
), ti = ei, si = (e) => {
|
|
2151
2146
|
const t = (s) => `${s}${e.suffix ? `_${e.suffix}` : ""}`;
|
|
2152
2147
|
return /* @__PURE__ */ i.jsxs(
|
|
2153
2148
|
"svg",
|
|
@@ -2318,7 +2313,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2318
2313
|
]
|
|
2319
2314
|
})
|
|
2320
2315
|
);
|
|
2321
|
-
},
|
|
2316
|
+
}, Ut = si, ri = (e) => /* @__PURE__ */ i.jsxs(
|
|
2322
2317
|
"svg",
|
|
2323
2318
|
A(j({
|
|
2324
2319
|
fill: "none",
|
|
@@ -2380,7 +2375,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2380
2375
|
)
|
|
2381
2376
|
]
|
|
2382
2377
|
})
|
|
2383
|
-
),
|
|
2378
|
+
), ii = ri, ni = (e) => /* @__PURE__ */ i.jsx(
|
|
2384
2379
|
"svg",
|
|
2385
2380
|
A(j({
|
|
2386
2381
|
fill: "none",
|
|
@@ -2400,7 +2395,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2400
2395
|
}
|
|
2401
2396
|
)
|
|
2402
2397
|
})
|
|
2403
|
-
),
|
|
2398
|
+
), ai = ni, oi = (e) => /* @__PURE__ */ i.jsxs(
|
|
2404
2399
|
"svg",
|
|
2405
2400
|
A(j({
|
|
2406
2401
|
width: "24",
|
|
@@ -2427,7 +2422,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2427
2422
|
/* @__PURE__ */ i.jsx("circle", { r: ".8", transform: "matrix(1 0 0 -1 20.8 20.7)", fill: "currentColor" })
|
|
2428
2423
|
]
|
|
2429
2424
|
})
|
|
2430
|
-
),
|
|
2425
|
+
), li = oi, ci = (e) => {
|
|
2431
2426
|
var t = e, {
|
|
2432
2427
|
variant: s,
|
|
2433
2428
|
icon: r,
|
|
@@ -2435,7 +2430,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2435
2430
|
title: o,
|
|
2436
2431
|
description: l,
|
|
2437
2432
|
className: c
|
|
2438
|
-
} = t,
|
|
2433
|
+
} = t, m = M(t, [
|
|
2439
2434
|
"variant",
|
|
2440
2435
|
"icon",
|
|
2441
2436
|
"isStandalone",
|
|
@@ -2445,15 +2440,15 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2445
2440
|
]);
|
|
2446
2441
|
return /* @__PURE__ */ i.jsx(
|
|
2447
2442
|
"div",
|
|
2448
|
-
A(j({},
|
|
2449
|
-
className:
|
|
2443
|
+
A(j({}, m), {
|
|
2444
|
+
className: P(
|
|
2450
2445
|
"card__empty-state",
|
|
2451
2446
|
s === "error" && "card__empty-state--error",
|
|
2452
2447
|
a && "card__empty-state--standalone",
|
|
2453
2448
|
c
|
|
2454
2449
|
),
|
|
2455
2450
|
children: /* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__wrapper", children: [
|
|
2456
|
-
/* @__PURE__ */ i.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ i.jsx(
|
|
2451
|
+
/* @__PURE__ */ i.jsx("i", { className: "card__empty-state__icon", "aria-hidden": !0, children: s === "error" ? /* @__PURE__ */ i.jsx(ti, {}) : r }),
|
|
2457
2452
|
/* @__PURE__ */ i.jsxs("div", { className: "card__empty-state__content", children: [
|
|
2458
2453
|
/* @__PURE__ */ i.jsx("p", { className: "card__empty-state__title", children: o }),
|
|
2459
2454
|
/* @__PURE__ */ i.jsx("p", { className: "card__empty-state__description", children: l })
|
|
@@ -2461,13 +2456,13 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2461
2456
|
] })
|
|
2462
2457
|
})
|
|
2463
2458
|
);
|
|
2464
|
-
},
|
|
2459
|
+
}, ui = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__footer", children: e }), di = (e) => {
|
|
2465
2460
|
var t = e, {
|
|
2466
2461
|
variant: s = "default",
|
|
2467
2462
|
sticky: r,
|
|
2468
2463
|
className: a,
|
|
2469
2464
|
children: o
|
|
2470
|
-
} = t, l =
|
|
2465
|
+
} = t, l = M(t, [
|
|
2471
2466
|
"variant",
|
|
2472
2467
|
"sticky",
|
|
2473
2468
|
"className",
|
|
@@ -2476,7 +2471,7 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2476
2471
|
return /* @__PURE__ */ i.jsx(
|
|
2477
2472
|
"div",
|
|
2478
2473
|
A(j({}, l), {
|
|
2479
|
-
className:
|
|
2474
|
+
className: P(
|
|
2480
2475
|
"card__header",
|
|
2481
2476
|
s && `card__header--${s}`,
|
|
2482
2477
|
r && "card__header--sticky",
|
|
@@ -2485,55 +2480,55 @@ var Hr = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__h
|
|
|
2485
2480
|
children: o
|
|
2486
2481
|
})
|
|
2487
2482
|
);
|
|
2488
|
-
},
|
|
2483
|
+
}, hi = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__image", children: e }), fi = ({ children: e, className: t }) => /* @__PURE__ */ i.jsx("div", { className: P("card__body__item", t), children: e }), pi = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "card__body__subtitle", children: e }), mi = ({ icon: e, children: t }) => /* @__PURE__ */ i.jsxs("div", { className: "card__header__title", children: [
|
|
2489
2484
|
e && /* @__PURE__ */ i.jsx("span", { className: "card__header__title__icon", children: e }),
|
|
2490
2485
|
t
|
|
2491
|
-
] }),
|
|
2486
|
+
] }), Es = d.forwardRef(
|
|
2492
2487
|
(e, t) => {
|
|
2493
|
-
var s = e, { type: r, children: a, className: o, variant: l = "default", disabled: c = !1 } = s,
|
|
2488
|
+
var s = e, { type: r, children: a, className: o, variant: l = "default", disabled: c = !1 } = s, m = M(s, ["type", "children", "className", "variant", "disabled"]);
|
|
2494
2489
|
return d.createElement(
|
|
2495
2490
|
r,
|
|
2496
2491
|
j({
|
|
2497
|
-
className:
|
|
2492
|
+
className: P(
|
|
2498
2493
|
"card",
|
|
2499
2494
|
c && "card--disabled",
|
|
2500
2495
|
l && `card--${l}`,
|
|
2501
2496
|
o
|
|
2502
2497
|
),
|
|
2503
2498
|
ref: t
|
|
2504
|
-
},
|
|
2499
|
+
}, m),
|
|
2505
2500
|
a
|
|
2506
2501
|
);
|
|
2507
2502
|
}
|
|
2508
2503
|
);
|
|
2509
|
-
|
|
2510
|
-
Object.assign(
|
|
2511
|
-
Header:
|
|
2512
|
-
Action:
|
|
2513
|
-
Title:
|
|
2514
|
-
Subtitle:
|
|
2515
|
-
Body:
|
|
2516
|
-
Image:
|
|
2517
|
-
Item:
|
|
2518
|
-
Footer:
|
|
2519
|
-
EmptyState:
|
|
2504
|
+
Es.displayName = "Card";
|
|
2505
|
+
Object.assign(Es, {
|
|
2506
|
+
Header: di,
|
|
2507
|
+
Action: Rr,
|
|
2508
|
+
Title: mi,
|
|
2509
|
+
Subtitle: pi,
|
|
2510
|
+
Body: Dr,
|
|
2511
|
+
Image: hi,
|
|
2512
|
+
Item: fi,
|
|
2513
|
+
Footer: ui,
|
|
2514
|
+
EmptyState: ci
|
|
2520
2515
|
});
|
|
2521
|
-
var
|
|
2522
|
-
var t = e, { className: s, children: r } = t, a =
|
|
2523
|
-
return /* @__PURE__ */ i.jsx("div", A(j({ className:
|
|
2524
|
-
},
|
|
2525
|
-
var t = e, { className: s, children: r } = t, a =
|
|
2526
|
-
return /* @__PURE__ */ i.jsx("span", A(j({ className:
|
|
2527
|
-
},
|
|
2528
|
-
const e = d.useContext(
|
|
2516
|
+
var vi = (e) => {
|
|
2517
|
+
var t = e, { className: s, children: r } = t, a = M(t, ["className", "children"]);
|
|
2518
|
+
return /* @__PURE__ */ i.jsx("div", A(j({ className: P("checkbox__content", s) }, a), { children: r }));
|
|
2519
|
+
}, yi = (e) => {
|
|
2520
|
+
var t = e, { className: s, children: r } = t, a = M(t, ["className", "children"]);
|
|
2521
|
+
return /* @__PURE__ */ i.jsx("span", A(j({ className: P("checkbox__hint", s) }, a), { children: r }));
|
|
2522
|
+
}, Ss = d.createContext(void 0), gi = ({ id: e, name: t, children: s }) => /* @__PURE__ */ i.jsx(Ss.Provider, { value: { id: e, name: t }, children: s }), Ci = () => {
|
|
2523
|
+
const e = d.useContext(Ss);
|
|
2529
2524
|
if (!e)
|
|
2530
2525
|
throw new Error("Checkbox compound components can not be rendered outside of Checkbox");
|
|
2531
2526
|
return e;
|
|
2532
|
-
},
|
|
2533
|
-
var t = e, { className: s, children: r } = t, a =
|
|
2534
|
-
const { id: o } =
|
|
2535
|
-
return /* @__PURE__ */ i.jsx("label", A(j({ htmlFor: o, className:
|
|
2536
|
-
},
|
|
2527
|
+
}, xi = (e) => {
|
|
2528
|
+
var t = e, { className: s, children: r } = t, a = M(t, ["className", "children"]);
|
|
2529
|
+
const { id: o } = Ci();
|
|
2530
|
+
return /* @__PURE__ */ i.jsx("label", A(j({ htmlFor: o, className: P("checkbox__label", s) }, a), { children: r }));
|
|
2531
|
+
}, je = (e) => {
|
|
2537
2532
|
var t = e, {
|
|
2538
2533
|
id: s,
|
|
2539
2534
|
name: r,
|
|
@@ -2541,9 +2536,9 @@ var bi = (e) => {
|
|
|
2541
2536
|
variant: o = "neutral",
|
|
2542
2537
|
hasError: l = !1,
|
|
2543
2538
|
single: c,
|
|
2544
|
-
className:
|
|
2545
|
-
children:
|
|
2546
|
-
} = t, u =
|
|
2539
|
+
className: m,
|
|
2540
|
+
children: C
|
|
2541
|
+
} = t, u = M(t, [
|
|
2547
2542
|
"id",
|
|
2548
2543
|
"name",
|
|
2549
2544
|
"isPending",
|
|
@@ -2553,13 +2548,13 @@ var bi = (e) => {
|
|
|
2553
2548
|
"className",
|
|
2554
2549
|
"children"
|
|
2555
2550
|
]);
|
|
2556
|
-
const
|
|
2551
|
+
const b = d.useRef(null);
|
|
2557
2552
|
return d.useEffect(() => {
|
|
2558
|
-
|
|
2553
|
+
b.current && (a ? b.current.indeterminate = !0 : b.current.indeterminate = !1);
|
|
2559
2554
|
}, [a]), /* @__PURE__ */ i.jsxs(
|
|
2560
2555
|
"div",
|
|
2561
2556
|
{
|
|
2562
|
-
className:
|
|
2557
|
+
className: P("checkbox", o && `checkbox--${o}`, l && "checkbox--error"),
|
|
2563
2558
|
children: [
|
|
2564
2559
|
/* @__PURE__ */ i.jsx(
|
|
2565
2560
|
"input",
|
|
@@ -2567,102 +2562,102 @@ var bi = (e) => {
|
|
|
2567
2562
|
id: s,
|
|
2568
2563
|
name: r,
|
|
2569
2564
|
type: "checkbox",
|
|
2570
|
-
ref:
|
|
2571
|
-
className:
|
|
2565
|
+
ref: b,
|
|
2566
|
+
className: P("checkbox__input", m),
|
|
2572
2567
|
value: c ? "true" : ""
|
|
2573
2568
|
}, u)
|
|
2574
2569
|
),
|
|
2575
|
-
a ? /* @__PURE__ */ i.jsx(
|
|
2576
|
-
/* @__PURE__ */ i.jsx(
|
|
2570
|
+
a ? /* @__PURE__ */ i.jsx(Br, { className: "checkbox__spinner", "aria-hidden": !0 }) : /* @__PURE__ */ i.jsx(Qr, { className: "checkbox__check", "aria-hidden": !0, strokeDasharray: "75" }),
|
|
2571
|
+
/* @__PURE__ */ i.jsx(gi, { id: s, name: r, children: C })
|
|
2577
2572
|
]
|
|
2578
2573
|
}
|
|
2579
2574
|
);
|
|
2580
2575
|
};
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
var
|
|
2586
|
-
var t = e, { type: s = "div", className: r, children: a } = t, o =
|
|
2587
|
-
return d.createElement(s, j({ className:
|
|
2588
|
-
},
|
|
2589
|
-
var t = e, { className: s, children: r, shouldAnimate: a = !0 } = t, o =
|
|
2590
|
-
const { ref: l, defaultOpen: c, isModal:
|
|
2576
|
+
je.Content = vi;
|
|
2577
|
+
je.Label = xi;
|
|
2578
|
+
je.Hint = yi;
|
|
2579
|
+
je.Error = Error;
|
|
2580
|
+
var bi = (e) => {
|
|
2581
|
+
var t = e, { type: s = "div", className: r, children: a } = t, o = M(t, ["type", "className", "children"]);
|
|
2582
|
+
return d.createElement(s, j({ className: P("dialog__body", r) }, o), a);
|
|
2583
|
+
}, Lt = () => document.body.style.removeProperty("overflow"), zt = (e) => e.preventDefault(), wi = '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])', ji = (e) => {
|
|
2584
|
+
var t = e, { className: s, children: r, shouldAnimate: a = !0 } = t, o = M(t, ["className", "children", "shouldAnimate"]);
|
|
2585
|
+
const { ref: l, defaultOpen: c, isModal: m, onClose: C } = nt();
|
|
2591
2586
|
return d.useEffect(() => {
|
|
2592
2587
|
const u = l == null ? void 0 : l.current;
|
|
2593
2588
|
if (u != null && u.open) {
|
|
2594
|
-
const
|
|
2595
|
-
if (!(
|
|
2589
|
+
const b = u.querySelectorAll(wi), v = b[0], f = b[b.length - 1], w = (E) => {
|
|
2590
|
+
if (!(E.key === "Tab"))
|
|
2596
2591
|
return;
|
|
2597
|
-
|
|
2592
|
+
E.shiftKey ? document.activeElement === v && (f.focus(), E.preventDefault()) : document.activeElement === f && (v.focus(), E.preventDefault());
|
|
2598
2593
|
};
|
|
2599
|
-
return document.body.style.overflow = "hidden", u.addEventListener("keydown",
|
|
2600
|
-
u.removeEventListener("keydown",
|
|
2594
|
+
return document.body.style.overflow = "hidden", u.addEventListener("keydown", w), window.addEventListener("popstate", () => Lt()), () => {
|
|
2595
|
+
u.removeEventListener("keydown", w), window.removeEventListener("popstate", () => Lt());
|
|
2601
2596
|
};
|
|
2602
2597
|
}
|
|
2603
2598
|
}, [l]), d.useEffect(() => {
|
|
2604
2599
|
const u = l == null ? void 0 : l.current;
|
|
2605
2600
|
if (!u)
|
|
2606
2601
|
return;
|
|
2607
|
-
if (c && (u.removeAttribute("open"), u.showModal(), u.focus()),
|
|
2608
|
-
return u.addEventListener("cancel",
|
|
2609
|
-
const
|
|
2610
|
-
const { top:
|
|
2611
|
-
S && !(
|
|
2602
|
+
if (c && (u.removeAttribute("open"), u.showModal(), u.focus()), m)
|
|
2603
|
+
return u.addEventListener("cancel", zt), () => u.removeEventListener("cancel", zt);
|
|
2604
|
+
const b = ({ clientX: v, clientY: f }) => {
|
|
2605
|
+
const { top: w, right: E, bottom: y, left: g } = u.getBoundingClientRect(), S = 0 < f && 0 < v, _ = w < f && f < y, k = g < v && v < E;
|
|
2606
|
+
S && !(_ && k) && C();
|
|
2612
2607
|
};
|
|
2613
|
-
return u.addEventListener("cancel",
|
|
2614
|
-
u.removeEventListener("cancel",
|
|
2608
|
+
return u.addEventListener("cancel", C), u.addEventListener("mousedown", b), () => {
|
|
2609
|
+
u.removeEventListener("cancel", C), u.removeEventListener("mousedown", b);
|
|
2615
2610
|
};
|
|
2616
|
-
}, [l,
|
|
2611
|
+
}, [l, m, C, c]), /* @__PURE__ */ i.jsx(
|
|
2617
2612
|
"dialog",
|
|
2618
2613
|
A(j({
|
|
2619
2614
|
ref: l,
|
|
2620
2615
|
open: c,
|
|
2621
|
-
"aria-modal": !!
|
|
2616
|
+
"aria-modal": !!m,
|
|
2622
2617
|
"aria-labelledby": "dialogTitle",
|
|
2623
|
-
className:
|
|
2618
|
+
className: P("dialog", a && "dialog--animated", s)
|
|
2624
2619
|
}, o), {
|
|
2625
2620
|
children: r
|
|
2626
2621
|
})
|
|
2627
2622
|
);
|
|
2628
|
-
},
|
|
2623
|
+
}, As = d.createContext(void 0), _i = ({ defaultOpen: e, onClose: t, isModal: s, children: r }) => {
|
|
2629
2624
|
const a = d.useRef(null), o = d.useRef(t), l = d.useCallback(() => {
|
|
2630
2625
|
var c;
|
|
2631
|
-
|
|
2626
|
+
Lt(), (c = a.current) == null || c.close(), o.current && (o == null || o.current());
|
|
2632
2627
|
}, [a]);
|
|
2633
|
-
return /* @__PURE__ */ i.jsx(
|
|
2634
|
-
},
|
|
2635
|
-
const e = d.useContext(
|
|
2628
|
+
return /* @__PURE__ */ i.jsx(As.Provider, { value: { ref: a, defaultOpen: e, isModal: s, onClose: l }, children: r });
|
|
2629
|
+
}, nt = () => {
|
|
2630
|
+
const e = d.useContext(As);
|
|
2636
2631
|
if (!e)
|
|
2637
2632
|
throw new Error("Dialog compound components can not be rendered outside of Dialog");
|
|
2638
2633
|
return e;
|
|
2639
|
-
},
|
|
2640
|
-
var t = e, { children: s } = t, r =
|
|
2641
|
-
const { onClose: a } =
|
|
2642
|
-
return /* @__PURE__ */ i.jsx(
|
|
2643
|
-
},
|
|
2644
|
-
var s = e, { className: r } = s, a =
|
|
2645
|
-
const { onClose: o } =
|
|
2634
|
+
}, Ei = (e) => {
|
|
2635
|
+
var t = e, { children: s } = t, r = M(t, ["children"]);
|
|
2636
|
+
const { onClose: a } = nt();
|
|
2637
|
+
return /* @__PURE__ */ i.jsx(it, A(j({ onClick: a }, r), { children: s }));
|
|
2638
|
+
}, Ps = d.forwardRef((e, t) => {
|
|
2639
|
+
var s = e, { className: r } = s, a = M(s, ["className"]);
|
|
2640
|
+
const { onClose: o } = nt();
|
|
2646
2641
|
return /* @__PURE__ */ i.jsx(
|
|
2647
|
-
|
|
2642
|
+
it,
|
|
2648
2643
|
j({
|
|
2649
2644
|
type: "submit",
|
|
2650
2645
|
ref: t,
|
|
2651
2646
|
formMethod: "dialog",
|
|
2652
2647
|
onClick: o,
|
|
2653
|
-
iconLeft: /* @__PURE__ */ i.jsx(
|
|
2648
|
+
iconLeft: /* @__PURE__ */ i.jsx($r, {}),
|
|
2654
2649
|
variant: "icon--secondary",
|
|
2655
|
-
className:
|
|
2650
|
+
className: P("dialog__close button--icon", r)
|
|
2656
2651
|
}, a)
|
|
2657
2652
|
);
|
|
2658
2653
|
});
|
|
2659
|
-
|
|
2660
|
-
var
|
|
2661
|
-
var t = e, { className: s, children: r } = t, a =
|
|
2662
|
-
return /* @__PURE__ */ i.jsx("div", A(j({ className:
|
|
2663
|
-
},
|
|
2664
|
-
var t = e, { icon: s, children: r, className: a } = t, o =
|
|
2665
|
-
const { ref: l } =
|
|
2654
|
+
Ps.displayName = "Close";
|
|
2655
|
+
var Si = (e) => {
|
|
2656
|
+
var t = e, { className: s, children: r } = t, a = M(t, ["className", "children"]);
|
|
2657
|
+
return /* @__PURE__ */ i.jsx("div", A(j({ className: P("dialog__footer", s) }, a), { children: r }));
|
|
2658
|
+
}, Ai = ({ children: e }) => /* @__PURE__ */ i.jsx("div", { className: "dialog__header", children: e }), Pi = (e) => {
|
|
2659
|
+
var t = e, { icon: s, children: r, className: a } = t, o = M(t, ["icon", "children", "className"]);
|
|
2660
|
+
const { ref: l } = nt(), c = d.useRef(null);
|
|
2666
2661
|
return d.useEffect(() => {
|
|
2667
2662
|
l != null && l.current && l.current.focus();
|
|
2668
2663
|
}, [l]), /* @__PURE__ */ i.jsxs(
|
|
@@ -2671,7 +2666,7 @@ var Mi = (e) => {
|
|
|
2671
2666
|
tabIndex: 0,
|
|
2672
2667
|
ref: c,
|
|
2673
2668
|
id: "dialogTitle",
|
|
2674
|
-
className:
|
|
2669
|
+
className: P("dialog__header__title", a)
|
|
2675
2670
|
}, o), {
|
|
2676
2671
|
children: [
|
|
2677
2672
|
s && /* @__PURE__ */ i.jsx("span", { className: "dialog__header__icon", children: s }),
|
|
@@ -2679,23 +2674,23 @@ var Mi = (e) => {
|
|
|
2679
2674
|
]
|
|
2680
2675
|
})
|
|
2681
2676
|
);
|
|
2682
|
-
},
|
|
2683
|
-
var t = e, { children: s } = t, r =
|
|
2684
|
-
const { ref: a } =
|
|
2685
|
-
return /* @__PURE__ */ i.jsx(
|
|
2677
|
+
}, Ni = (e) => {
|
|
2678
|
+
var t = e, { children: s } = t, r = M(t, ["children"]);
|
|
2679
|
+
const { ref: a } = nt();
|
|
2680
|
+
return /* @__PURE__ */ i.jsx(it, A(j({ onClick: () => {
|
|
2686
2681
|
var o;
|
|
2687
2682
|
return (o = a == null ? void 0 : a.current) == null ? void 0 : o.showModal();
|
|
2688
2683
|
} }, r), { children: s }));
|
|
2689
|
-
},
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
var
|
|
2684
|
+
}, H = ({ defaultOpen: e, isModal: t, children: s, onClose: r }) => /* @__PURE__ */ i.jsx(_i, { defaultOpen: !!e, isModal: t, onClose: r, children: s });
|
|
2685
|
+
H.Trigger = Ni;
|
|
2686
|
+
H.Root = ji;
|
|
2687
|
+
H.Title = Pi;
|
|
2688
|
+
H.Header = Ai;
|
|
2689
|
+
H.Body = bi;
|
|
2690
|
+
H.Footer = Si;
|
|
2691
|
+
H.Button = Ei;
|
|
2692
|
+
H.Close = Ps;
|
|
2693
|
+
var Ns = d.createContext(void 0), ki = ({
|
|
2699
2694
|
id: e,
|
|
2700
2695
|
position: t,
|
|
2701
2696
|
isOpen: s,
|
|
@@ -2704,10 +2699,10 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2704
2699
|
setActiveItemIndex: o,
|
|
2705
2700
|
clearActiveItemIndex: l,
|
|
2706
2701
|
triggerRef: c,
|
|
2707
|
-
contentRef:
|
|
2708
|
-
children:
|
|
2702
|
+
contentRef: m,
|
|
2703
|
+
children: C
|
|
2709
2704
|
}) => /* @__PURE__ */ i.jsx(
|
|
2710
|
-
|
|
2705
|
+
Ns.Provider,
|
|
2711
2706
|
{
|
|
2712
2707
|
value: {
|
|
2713
2708
|
id: e,
|
|
@@ -2718,16 +2713,16 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2718
2713
|
setActiveItemIndex: o,
|
|
2719
2714
|
clearActiveItemIndex: l,
|
|
2720
2715
|
triggerRef: c,
|
|
2721
|
-
contentRef:
|
|
2716
|
+
contentRef: m
|
|
2722
2717
|
},
|
|
2723
|
-
children:
|
|
2718
|
+
children: C
|
|
2724
2719
|
}
|
|
2725
|
-
),
|
|
2726
|
-
const e = d.useContext(
|
|
2720
|
+
), ks = () => {
|
|
2721
|
+
const e = d.useContext(Ns);
|
|
2727
2722
|
if (e === void 0)
|
|
2728
2723
|
throw new Error("useMenu must be used within a MenuProvider");
|
|
2729
2724
|
return e;
|
|
2730
|
-
},
|
|
2725
|
+
}, Oi = ({ as: e, children: t }) => {
|
|
2731
2726
|
const {
|
|
2732
2727
|
id: s,
|
|
2733
2728
|
position: r,
|
|
@@ -2735,40 +2730,40 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2735
2730
|
setIsOpen: o,
|
|
2736
2731
|
activeItemIndex: l,
|
|
2737
2732
|
setActiveItemIndex: c,
|
|
2738
|
-
clearActiveItemIndex:
|
|
2739
|
-
triggerRef:
|
|
2733
|
+
clearActiveItemIndex: m,
|
|
2734
|
+
triggerRef: C,
|
|
2740
2735
|
contentRef: u
|
|
2741
|
-
} =
|
|
2742
|
-
var
|
|
2736
|
+
} = ks(), b = (v) => {
|
|
2737
|
+
var f;
|
|
2743
2738
|
if (!a)
|
|
2744
2739
|
return;
|
|
2745
|
-
if (
|
|
2746
|
-
return
|
|
2747
|
-
const
|
|
2748
|
-
switch (
|
|
2740
|
+
if (v.key === "Escape")
|
|
2741
|
+
return m(), o(!1), (f = C.current) == null ? void 0 : f.focus();
|
|
2742
|
+
const w = v.shiftKey, E = Ms(u.current).length - 1;
|
|
2743
|
+
switch (v.key) {
|
|
2749
2744
|
case "Tab": {
|
|
2750
|
-
if (
|
|
2751
|
-
return
|
|
2752
|
-
if (!
|
|
2753
|
-
|
|
2754
|
-
const
|
|
2755
|
-
return c(Math.min(
|
|
2745
|
+
if (w && l !== 0)
|
|
2746
|
+
return v.preventDefault(), c(l ? Math.max(0, l - 1) : 0);
|
|
2747
|
+
if (!w && l !== E) {
|
|
2748
|
+
v.preventDefault();
|
|
2749
|
+
const y = l !== void 0 ? l + 1 : 0;
|
|
2750
|
+
return c(Math.min(E, y));
|
|
2756
2751
|
}
|
|
2757
2752
|
break;
|
|
2758
2753
|
}
|
|
2759
2754
|
case "ArrowUp":
|
|
2760
2755
|
case "ArrowLeft":
|
|
2761
|
-
return
|
|
2756
|
+
return v.preventDefault(), c(l ? Math.max(0, l - 1) : 0);
|
|
2762
2757
|
case "ArrowDown":
|
|
2763
2758
|
case "ArrowRight": {
|
|
2764
|
-
|
|
2765
|
-
const
|
|
2766
|
-
return c(Math.min(
|
|
2759
|
+
v.preventDefault();
|
|
2760
|
+
const y = l !== void 0 ? l + 1 : 0;
|
|
2761
|
+
return c(Math.min(E, y));
|
|
2767
2762
|
}
|
|
2768
2763
|
case "Home":
|
|
2769
|
-
return
|
|
2764
|
+
return v.preventDefault(), c(0);
|
|
2770
2765
|
case "End":
|
|
2771
|
-
return
|
|
2766
|
+
return v.preventDefault(), c(E);
|
|
2772
2767
|
}
|
|
2773
2768
|
};
|
|
2774
2769
|
return e ? d.createElement(
|
|
@@ -2776,8 +2771,8 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2776
2771
|
{
|
|
2777
2772
|
id: `${s}-content`,
|
|
2778
2773
|
ref: u,
|
|
2779
|
-
className:
|
|
2780
|
-
onKeyDown:
|
|
2774
|
+
className: P("menu__list", `menu__list--${r}`, a && "menu__list--active"),
|
|
2775
|
+
onKeyDown: b
|
|
2781
2776
|
},
|
|
2782
2777
|
t
|
|
2783
2778
|
) : (
|
|
@@ -2787,19 +2782,19 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2787
2782
|
{
|
|
2788
2783
|
id: `${s}-content`,
|
|
2789
2784
|
ref: u,
|
|
2790
|
-
className:
|
|
2791
|
-
onKeyDown:
|
|
2785
|
+
className: P("menu__list", `menu__list--${r}`, a && "menu__list--active"),
|
|
2786
|
+
onKeyDown: b,
|
|
2792
2787
|
children: t
|
|
2793
2788
|
}
|
|
2794
2789
|
)
|
|
2795
2790
|
);
|
|
2796
|
-
},
|
|
2797
|
-
var t = e, { children: s, className: r } = t, a =
|
|
2798
|
-
return /* @__PURE__ */ i.jsx("li", A(j({}, a), { className:
|
|
2799
|
-
},
|
|
2800
|
-
const { id: s, isOpen: r, setIsOpen: a, clearActiveItemIndex: o, setActiveItemIndex: l, triggerRef: c } =
|
|
2791
|
+
}, Mi = (e) => {
|
|
2792
|
+
var t = e, { children: s, className: r } = t, a = M(t, ["children", "className"]);
|
|
2793
|
+
return /* @__PURE__ */ i.jsx("li", A(j({}, a), { className: P("menu__list-item", r), children: s }));
|
|
2794
|
+
}, Os = ({ children: e, className: t }) => {
|
|
2795
|
+
const { id: s, isOpen: r, setIsOpen: a, clearActiveItemIndex: o, setActiveItemIndex: l, triggerRef: c } = ks(), m = () => {
|
|
2801
2796
|
o(), a((u) => !u), r || l(0);
|
|
2802
|
-
},
|
|
2797
|
+
}, C = (u) => {
|
|
2803
2798
|
if (r) {
|
|
2804
2799
|
if (u.key === "Escape")
|
|
2805
2800
|
return o(), a(!1);
|
|
@@ -2809,41 +2804,41 @@ var Ds = d.createContext(void 0), Ri = ({
|
|
|
2809
2804
|
return d.cloneElement(e, {
|
|
2810
2805
|
id: `${s}-trigger`,
|
|
2811
2806
|
ref: c,
|
|
2812
|
-
className:
|
|
2813
|
-
onClick:
|
|
2814
|
-
onKeyDown:
|
|
2807
|
+
className: P("menu__trigger", t),
|
|
2808
|
+
onClick: m,
|
|
2809
|
+
onKeyDown: C,
|
|
2815
2810
|
"aria-expanded": r,
|
|
2816
2811
|
"aria-controls": `${s}-content`
|
|
2817
2812
|
});
|
|
2818
2813
|
};
|
|
2819
|
-
|
|
2820
|
-
var
|
|
2821
|
-
var t = e, { type: s, id: r, position: a = "right", children: o, className: l } = t, c =
|
|
2822
|
-
const
|
|
2823
|
-
|
|
2824
|
-
const
|
|
2825
|
-
|
|
2826
|
-
}, S = (
|
|
2814
|
+
Os.displayName = "Trigger";
|
|
2815
|
+
var Ms = (e) => e ? e.tagName === "UL" ? e.children : Array.from(e.getElementsByTagName("ul")).reduce((s, r) => [...s, ...Array.from(r.getElementsByTagName("li"))], []) : [], Y = (e) => {
|
|
2816
|
+
var t = e, { type: s, id: r, position: a = "right", children: o, className: l } = t, c = M(t, ["type", "id", "position", "children", "className"]);
|
|
2817
|
+
const m = d.useRef(null), C = d.useRef(null), u = d.useRef(null), [b, v] = d.useState(!1), [f, w] = d.useState(), [E, y] = d.useState(f);
|
|
2818
|
+
f !== E && f !== void 0 && u.current && (Ms(u.current)[f].firstChild.focus(), y(f));
|
|
2819
|
+
const g = () => {
|
|
2820
|
+
w(void 0), y(void 0);
|
|
2821
|
+
}, S = (_) => {
|
|
2827
2822
|
var k;
|
|
2828
|
-
((k =
|
|
2823
|
+
((k = m.current) == null ? void 0 : k.contains(_.relatedTarget)) || (g(), v(!1));
|
|
2829
2824
|
};
|
|
2830
2825
|
return /* @__PURE__ */ i.jsx(
|
|
2831
|
-
|
|
2826
|
+
ki,
|
|
2832
2827
|
{
|
|
2833
2828
|
id: r,
|
|
2834
2829
|
position: a,
|
|
2835
|
-
isOpen:
|
|
2836
|
-
setIsOpen:
|
|
2837
|
-
activeItemIndex:
|
|
2838
|
-
setActiveItemIndex:
|
|
2839
|
-
clearActiveItemIndex:
|
|
2840
|
-
triggerRef:
|
|
2830
|
+
isOpen: b,
|
|
2831
|
+
setIsOpen: v,
|
|
2832
|
+
activeItemIndex: f,
|
|
2833
|
+
setActiveItemIndex: w,
|
|
2834
|
+
clearActiveItemIndex: g,
|
|
2835
|
+
triggerRef: C,
|
|
2841
2836
|
contentRef: u,
|
|
2842
2837
|
children: d.createElement(
|
|
2843
2838
|
s,
|
|
2844
2839
|
A(j({}, c), {
|
|
2845
2840
|
id: r,
|
|
2846
|
-
ref:
|
|
2841
|
+
ref: m,
|
|
2847
2842
|
className: `menu ${l || ""}`,
|
|
2848
2843
|
onBlur: S
|
|
2849
2844
|
}),
|
|
@@ -2852,30 +2847,30 @@ var Qs = (e) => e ? e.tagName === "UL" ? e.children : Array.from(e.getElementsBy
|
|
|
2852
2847
|
}
|
|
2853
2848
|
);
|
|
2854
2849
|
};
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2850
|
+
Y.Trigger = Os;
|
|
2851
|
+
Y.Content = Oi;
|
|
2852
|
+
Y.Item = Mi;
|
|
2858
2853
|
d.createContext(void 0);
|
|
2859
|
-
var
|
|
2860
|
-
[...new Set(
|
|
2854
|
+
var Li = (/* @__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");
|
|
2855
|
+
[...new Set(Li.values())].map((e) => ({
|
|
2861
2856
|
label: `+${e}`,
|
|
2862
2857
|
value: e
|
|
2863
2858
|
}));
|
|
2864
2859
|
d.createContext(void 0);
|
|
2865
2860
|
d.createContext(void 0);
|
|
2866
|
-
var
|
|
2867
|
-
const
|
|
2861
|
+
var pt = /* @__PURE__ */ ((e) => (e[e.categoriesVegetables = 0] = "categoriesVegetables", e[e.categoriesMeat = 1] = "categoriesMeat", e[e.categoriesFish = 2] = "categoriesFish", e[e.categoriesDairy = 3] = "categoriesDairy", e[e.categoriesBreakfast = 4] = "categoriesBreakfast", e[e.categoriesSnacks = 5] = "categoriesSnacks", e[e.categoriesCandy = 6] = "categoriesCandy", e[e.categoriesNonFood = 7] = "categoriesNonFood", e[e.categoriesDryFood = 8] = "categoriesDryFood", e[e.categoriesTins = 9] = "categoriesTins", e[e.categoriesGrid = 10] = "categoriesGrid", e[e.categoriesSoda = 11] = "categoriesSoda", e[e.categoriesBakery = 12] = "categoriesBakery", e[e.categoriesWine = 13] = "categoriesWine", e[e.categoriesBaby = 14] = "categoriesBaby", e[e.categoriesDiet = 15] = "categoriesDiet", e[e.categoriesHygiene = 16] = "categoriesHygiene", e[e.categoriesCleaning = 17] = "categoriesCleaning", e[e.categoriesPets = 18] = "categoriesPets", e[e.categoriesFreezer = 19] = "categoriesFreezer", e[e.categoriesBbq = 20] = "categoriesBbq", e[e.categoriesMealbox = 21] = "categoriesMealbox", e[e.categoriesBrik = 22] = "categoriesBrik", e[e.categoriesGranen = 23] = "categoriesGranen", e[e.categoriesConserve = 24] = "categoriesConserve", e[e.categoriesHome = 25] = "categoriesHome", e[e.categoriesEaster = 26] = "categoriesEaster", e[e.categoriesOnlinePromo = 27] = "categoriesOnlinePromo", e[e.categoriesSportFood = 28] = "categoriesSportFood", e[e.categoriesClothing = 29] = "categoriesClothing", e[e.categoriesEnergy = 30] = "categoriesEnergy", e[e.categoriesDeskAndTravel = 31] = "categoriesDeskAndTravel", e[e.categoriesCigarette = 32] = "categoriesCigarette", e[e.categoriesFood = 33] = "categoriesFood", e[e.categoriesChild = 34] = "categoriesChild", e[e.categoriesPuzzle = 35] = "categoriesPuzzle", e[e.categoriesToys = 36] = "categoriesToys", e[e.categoriesCar = 37] = "categoriesCar", e[e.categoriesPlaceholder = 38] = "categoriesPlaceholder", e[e.categoriesFuel = 39] = "categoriesFuel", e[e.categoriesCarAndBike = 40] = "categoriesCarAndBike", e[e.categoriesToyAndHobby = 41] = "categoriesToyAndHobby", e[e.categoriesMultimedia = 42] = "categoriesMultimedia", e[e.categoriesParty = 43] = "categoriesParty", e[e.toolsPay = 44] = "toolsPay", e[e.toolsReceipt = 45] = "toolsReceipt", e[e.toolsFuel = 46] = "toolsFuel", e[e.toolsStoreLocator = 47] = "toolsStoreLocator", e[e.toolsStats = 48] = "toolsStats", e[e.toolsShowXtraOld = 49] = "toolsShowXtraOld", e[e.toolsShowXtraNew = 50] = "toolsShowXtraNew", e[e.toolsScan2 = 51] = "toolsScan2", e[e.toolsRecipes2 = 52] = "toolsRecipes2", e[e.toolsWarranty = 53] = "toolsWarranty", e[e.toolsCoupons = 54] = "toolsCoupons", e[e.toolsFavoriteInactive = 55] = "toolsFavoriteInactive", e[e.toolsFavoriteActive = 56] = "toolsFavoriteActive", e[e.toolsAssortment = 57] = "toolsAssortment", e[e.toolsPromo = 58] = "toolsPromo", e[e.fuelCng = 59] = "fuelCng", e[e.fuelE5 = 60] = "fuelE5", e[e.fuelAdblue = 61] = "fuelAdblue", e[e.fuelB7 = 62] = "fuelB7", e[e.fuelH2 = 63] = "fuelH2", e[e.fuelE10 = 64] = "fuelE10", e[e.fuelFreeTireInflation = 65] = "fuelFreeTireInflation", e[e.functionalClose = 66] = "functionalClose", e[e.functionalBack = 67] = "functionalBack", e[e.functionalSearch = 68] = "functionalSearch", e[e.functionalEdit = 69] = "functionalEdit", e[e.functionalShare = 70] = "functionalShare", e[e.functionalLocation = 71] = "functionalLocation", e[e.functionalTrash = 72] = "functionalTrash", e[e.functionalCamera = 73] = "functionalCamera", e[e.functionalPhone = 74] = "functionalPhone", e[e.functionalPushNotifications = 75] = "functionalPushNotifications", e[e.functionalMail = 76] = "functionalMail", e[e.functionalGift = 77] = "functionalGift", e[e.functionalPresent = 78] = "functionalPresent", e[e.functionalLoading = 79] = "functionalLoading", e[e.functionalChevronRight = 80] = "functionalChevronRight", e[e.functionalCheck = 81] = "functionalCheck", e[e.functionalChevronDown = 82] = "functionalChevronDown", e[e.functionalChevronUp = 83] = "functionalChevronUp", e[e.functionalPlus = 84] = "functionalPlus", e[e.functionalReset = 85] = "functionalReset", e[e.functionalDownload = 86] = "functionalDownload", e[e.functionalExport = 87] = "functionalExport", e[e.functionalCustomerService = 88] = "functionalCustomerService", e[e.functionalTruck = 89] = "functionalTruck", e[e.functionalBox = 90] = "functionalBox", e[e.functionalEllipsis = 91] = "functionalEllipsis", e[e.functionalLocationHome = 92] = "functionalLocationHome", e[e.functionalLocationPickup = 93] = "functionalLocationPickup", e[e.functionalAccount = 94] = "functionalAccount", e[e.functionalPrivacy = 95] = "functionalPrivacy", e[e.functionalSettings = 96] = "functionalSettings", e[e.functionalUserInfo = 97] = "functionalUserInfo", e[e.functionalPinOutlines = 98] = "functionalPinOutlines", e[e.functionalCalendar = 99] = "functionalCalendar", e[e.functionalMinus = 100] = "functionalMinus", e[e.functionalLifestyle = 101] = "functionalLifestyle", e[e.functionalSms = 102] = "functionalSms", e[e.functionalSwitch = 103] = "functionalSwitch", e[e.functionalSorting = 104] = "functionalSorting", e[e.functionalWarningCircle = 105] = "functionalWarningCircle", e[e.functionalQuestionCircle = 106] = "functionalQuestionCircle", e[e.functionalErrorCircle = 107] = "functionalErrorCircle", e[e.functionalSuccessCircle = 108] = "functionalSuccessCircle", e[e.functionalMessage = 109] = "functionalMessage", e[e.functionalExternalLink = 110] = "functionalExternalLink", e[e.functionalAddToList = 111] = "functionalAddToList", e[e.functionalShoppingcart = 112] = "functionalShoppingcart", e[e.functionalFilter = 113] = "functionalFilter", e[e.functionalLocate = 114] = "functionalLocate", e[e.functionalBarcode = 115] = "functionalBarcode", e[e.functionalClock = 116] = "functionalClock", e[e.functionalHistory = 117] = "functionalHistory", e[e.functionalShops = 118] = "functionalShops", e[e.functionalAddUser = 119] = "functionalAddUser", e[e.functionalOther = 120] = "functionalOther", e[e.functionalInAppNotifications = 121] = "functionalInAppNotifications", e[e.functionalExit = 122] = "functionalExit", e[e.functionalShared = 123] = "functionalShared", e[e.functionalThumbsup = 124] = "functionalThumbsup", e[e.functionalDiscount = 125] = "functionalDiscount", e[e.functionalPercentage = 126] = "functionalPercentage", e[e.functionalList = 127] = "functionalList", e[e.functionalMapLocation = 128] = "functionalMapLocation", e[e.functionalNoConnection = 129] = "functionalNoConnection", e[e.functionalSwap = 130] = "functionalSwap", e[e.functionalPiece = 131] = "functionalPiece", e[e.functionalWeight = 132] = "functionalWeight", e[e.functionalPack = 133] = "functionalPack", e[e.functionalCommunications = 134] = "functionalCommunications", e[e.functionalDeliveryAddresses = 135] = "functionalDeliveryAddresses", e[e["functional18+"] = 136] = "functional18+", e[e.functionalReadtime = 137] = "functionalReadtime", e[e.functionalCopy = 138] = "functionalCopy", e[e.functionalMessageField = 139] = "functionalMessageField", e[e.functionalNext = 140] = "functionalNext", e[e.functionalSave = 141] = "functionalSave", e[e.functionalLogin = 142] = "functionalLogin", e[e.functionalLogout = 143] = "functionalLogout", e[e.functionalWebsite = 144] = "functionalWebsite", e[e.functionalMenu = 145] = "functionalMenu", e[e.functionalRegister = 146] = "functionalRegister", e[e.functionalNews = 147] = "functionalNews", e[e.functionalTimer = 148] = "functionalTimer", e[e.functionalEyeShow = 149] = "functionalEyeShow", e[e.functionalMobilePay = 150] = "functionalMobilePay", e[e.functionalConnectionCable = 151] = "functionalConnectionCable", e[e.functionalDryCleaning = 152] = "functionalDryCleaning", e[e.functionalKiosk = 153] = "functionalKiosk", e[e.functionalConnectedDevice = 154] = "functionalConnectedDevice", e[e.functionalCookies = 155] = "functionalCookies", e[e.functionalViewFile = 156] = "functionalViewFile", e[e.functionalLastAdded = 157] = "functionalLastAdded", e[e.functionalFirstAdded = 158] = "functionalFirstAdded", e[e.functionalStoreLayout = 159] = "functionalStoreLayout", e[e.functionalBlock = 160] = "functionalBlock", e[e.functionalChecklist = 161] = "functionalChecklist", e[e.functionalCartCheckout = 162] = "functionalCartCheckout", e[e.functionalCartEdit = 163] = "functionalCartEdit", e[e.functionalEyeHidden = 164] = "functionalEyeHidden", e[e.functionalWarningCircleFilled = 165] = "functionalWarningCircleFilled", e[e.functionalErrorCircleFilled = 166] = "functionalErrorCircleFilled", e[e.functionalSuccessCircleFilled = 167] = "functionalSuccessCircleFilled", e[e.functionalPlusCircle = 168] = "functionalPlusCircle", e[e.functionalSpinner = 169] = "functionalSpinner", e[e.functionalEcoEarth = 170] = "functionalEcoEarth", e[e.functionalAlphaBeta = 171] = "functionalAlphaBeta", e[e.functionalEuro = 172] = "functionalEuro", e[e.functionalNumber = 173] = "functionalNumber", e[e.functionalIdea = 174] = "functionalIdea", e[e.functionalMultifactorAuthenticator = 175] = "functionalMultifactorAuthenticator", e[e.functionalPassword = 176] = "functionalPassword", e[e.functionalDiscountCode = 177] = "functionalDiscountCode", e))(pt || {});
|
|
2862
|
+
const Fi = "/icons/bouMenuIcons.svg", Ri = ({
|
|
2868
2863
|
bouIconId: e,
|
|
2869
2864
|
...t
|
|
2870
|
-
}) => /* @__PURE__ */ i.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i.jsx("use", { href: `${
|
|
2865
|
+
}) => /* @__PURE__ */ i.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i.jsx("use", { href: `${Fi}#${pt[e]}` }) }), fe = ({
|
|
2871
2866
|
className: e,
|
|
2872
2867
|
label: t,
|
|
2873
2868
|
mobileUrl: s,
|
|
2874
2869
|
desktopUrl: r,
|
|
2875
2870
|
icon: a
|
|
2876
2871
|
}) => {
|
|
2877
|
-
const o =
|
|
2878
|
-
return /* @__PURE__ */ i.jsxs(
|
|
2872
|
+
const o = $s(), l = () => typeof a == "string" && a in pt ? /* @__PURE__ */ i.jsx(Ri, { bouIconId: pt[a] }) : a;
|
|
2873
|
+
return /* @__PURE__ */ i.jsxs(Y.Item, { className: e, children: [
|
|
2879
2874
|
(!o || o && !r) && /* @__PURE__ */ i.jsxs("a", { href: s, referrerPolicy: "no-referrer-when-downgrade", children: [
|
|
2880
2875
|
l(),
|
|
2881
2876
|
t
|
|
@@ -2885,41 +2880,108 @@ const Qi = "/icons/bouMenuIcons.svg", Hi = ({
|
|
|
2885
2880
|
t
|
|
2886
2881
|
] })
|
|
2887
2882
|
] });
|
|
2888
|
-
},
|
|
2889
|
-
|
|
2890
|
-
bouMenuItems: t,
|
|
2891
|
-
authenticationStatus: s,
|
|
2892
|
-
profile: r,
|
|
2893
|
-
children: a
|
|
2894
|
-
}) => /* @__PURE__ */ i.jsx(Hs.Provider, { value: { position: e, bouMenuItems: t, authenticationStatus: s, profile: r }, children: a }), Gt = () => {
|
|
2895
|
-
const e = d.useContext(Hs);
|
|
2883
|
+
}, Ls = d.createContext(void 0), Di = ({ position: e, bouMenuItems: t, children: s }) => /* @__PURE__ */ i.jsx(Ls.Provider, { value: { position: e, bouMenuItems: t }, children: s }), Fs = () => {
|
|
2884
|
+
const e = d.useContext(Ls);
|
|
2896
2885
|
if (!e)
|
|
2897
2886
|
throw new Error("Authentication context can not be rendered outside of Authentication");
|
|
2898
2887
|
return e;
|
|
2899
|
-
},
|
|
2900
|
-
const e = d.useContext(
|
|
2888
|
+
}, Rs = d.createContext(void 0), Ti = ({ apiUrl: e, redirectUrl: t, children: s }) => /* @__PURE__ */ i.jsx(Rs.Provider, { value: { apiUrl: e, redirectUrl: t }, children: s }), Qt = () => {
|
|
2889
|
+
const e = d.useContext(Rs);
|
|
2901
2890
|
if (!e)
|
|
2902
2891
|
throw new Error("Api context can not be rendered outside of Api");
|
|
2903
2892
|
return e;
|
|
2904
|
-
},
|
|
2893
|
+
}, Ds = ({ apiUrl: e, redirectUrl: t, trackingInfo: s }) => {
|
|
2905
2894
|
const r = new URLSearchParams({ redirectUrl: t });
|
|
2906
2895
|
s && r.append("trackingInfo", s);
|
|
2907
2896
|
const a = `${e}/login?${r.toString()}`, o = `${e}/logout?${r.toString()}`;
|
|
2908
2897
|
return { loginUrl: a, logoutUrl: o };
|
|
2909
|
-
},
|
|
2910
|
-
const { apiUrl: e, redirectUrl: t } =
|
|
2911
|
-
return
|
|
2912
|
-
},
|
|
2913
|
-
const { apiUrl: e } =
|
|
2898
|
+
}, yt = () => {
|
|
2899
|
+
const { apiUrl: e, redirectUrl: t } = Qt(), s = Ks();
|
|
2900
|
+
return Ds({ apiUrl: e, redirectUrl: t, trackingInfo: s });
|
|
2901
|
+
}, Ui = () => {
|
|
2902
|
+
const { apiUrl: e } = Qt();
|
|
2903
|
+
return `${`${e}/xtra`}/authentication/v1/user/profile`;
|
|
2904
|
+
}, Jt = (e) => e ? `+${e.countryCode} ${e.number}` : "", Xt = (e, t) => t == null ? void 0 : t.find((s) => s.type === e), It = ({ apiUrl: e, redirectUrl: t }) => {
|
|
2905
|
+
const { loginUrl: s } = Ds({ apiUrl: e, redirectUrl: t });
|
|
2906
|
+
window.location.replace(s);
|
|
2907
|
+
}, Qi = (e) => {
|
|
2908
|
+
if (!e)
|
|
2909
|
+
return { user: { state: () => "NotAuthenticated" }, tryToLogon: It };
|
|
2910
|
+
const t = new Date(e.dateOfBirth), s = Xt(Ht.Mobile, e.phone), r = Xt(Ht.Fixed, e.phone), a = Jt(s) ?? Jt(r) ?? "";
|
|
2914
2911
|
return {
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2912
|
+
user: {
|
|
2913
|
+
firstName: () => e.firstName,
|
|
2914
|
+
lastName: () => e.lastName,
|
|
2915
|
+
dob: () => t.getDate(),
|
|
2916
|
+
mob: () => t.getMonth() + 1,
|
|
2917
|
+
yob: () => t.getFullYear(),
|
|
2918
|
+
gender: () => e.genderCode,
|
|
2919
|
+
phone: () => a,
|
|
2920
|
+
streetName: () => {
|
|
2921
|
+
var o;
|
|
2922
|
+
return (o = e.address) == null ? void 0 : o.streetName;
|
|
2923
|
+
},
|
|
2924
|
+
houseNr: () => {
|
|
2925
|
+
var o;
|
|
2926
|
+
return (o = e.address) == null ? void 0 : o.houseNumber;
|
|
2927
|
+
},
|
|
2928
|
+
box: () => {
|
|
2929
|
+
var o;
|
|
2930
|
+
return (o = e.address) == null ? void 0 : o.letterBoxName;
|
|
2931
|
+
},
|
|
2932
|
+
zip: () => {
|
|
2933
|
+
var o;
|
|
2934
|
+
return (o = e.address) == null ? void 0 : o.postalCode;
|
|
2935
|
+
},
|
|
2936
|
+
city: () => {
|
|
2937
|
+
var o;
|
|
2938
|
+
return (o = e.address) == null ? void 0 : o.locationName;
|
|
2939
|
+
},
|
|
2940
|
+
country: () => {
|
|
2941
|
+
var o;
|
|
2942
|
+
return (o = e.address) == null ? void 0 : o.countryCode;
|
|
2943
|
+
},
|
|
2944
|
+
email: () => e.email,
|
|
2945
|
+
cbh: () => e.customerIdentifier,
|
|
2946
|
+
state: () => "Authenticated"
|
|
2947
|
+
},
|
|
2948
|
+
tryToLogon: It
|
|
2920
2949
|
};
|
|
2921
|
-
},
|
|
2922
|
-
|
|
2950
|
+
}, Ts = ["profile"], Us = () => {
|
|
2951
|
+
const { i18n: e } = _e(), t = Ui(), s = sessionStorage.getItem("profile"), r = !!s;
|
|
2952
|
+
return bs({
|
|
2953
|
+
queryKey: Ts,
|
|
2954
|
+
queryFn: async () => {
|
|
2955
|
+
const o = await fetch(t, {
|
|
2956
|
+
credentials: "include",
|
|
2957
|
+
mode: "cors",
|
|
2958
|
+
headers: { "Accept-Language": e.language }
|
|
2959
|
+
});
|
|
2960
|
+
if (!o.ok) {
|
|
2961
|
+
if (o.status === 401)
|
|
2962
|
+
return sessionStorage.removeItem("profile"), { authenticationStatus: "NotAuthenticated" };
|
|
2963
|
+
if (r)
|
|
2964
|
+
return { authenticationStatus: "Authenticated", profile: JSON.parse(s) };
|
|
2965
|
+
throw new Error("Failed to retrieve profile");
|
|
2966
|
+
}
|
|
2967
|
+
const l = await o.json(), { firstName: c, lastName: m } = l;
|
|
2968
|
+
return sessionStorage.setItem("profile", JSON.stringify({ firstName: c, lastName: m })), window.postMessage(
|
|
2969
|
+
{ source: "xtra-authentication", isAuthenticated: !0 },
|
|
2970
|
+
new URL(window.location.href).origin
|
|
2971
|
+
), window.XTRA = { ...window.XTRA, ...Qi(l) }, {
|
|
2972
|
+
authenticationStatus: "Authenticated",
|
|
2973
|
+
profile: { firstName: l.firstName, lastName: l.lastName }
|
|
2974
|
+
};
|
|
2975
|
+
},
|
|
2976
|
+
initialData: r ? {
|
|
2977
|
+
authenticationStatus: "Authenticated",
|
|
2978
|
+
profile: JSON.parse(s)
|
|
2979
|
+
} : void 0,
|
|
2980
|
+
placeholderData: { authenticationStatus: "Pending" },
|
|
2981
|
+
refetchOnWindowFocus: !1
|
|
2982
|
+
});
|
|
2983
|
+
}, Hi = (e) => e != null && e.length ? /* @__PURE__ */ i.jsx("ul", { className: "bou-menu__list", children: e == null ? void 0 : e.map(({ label: t, icon: s, url: r }, a) => /* @__PURE__ */ i.jsx(
|
|
2984
|
+
fe,
|
|
2923
2985
|
{
|
|
2924
2986
|
className: "bou-menu-item",
|
|
2925
2987
|
mobileUrl: r,
|
|
@@ -2927,94 +2989,94 @@ const Qi = "/icons/bouMenuIcons.svg", Hi = ({
|
|
|
2927
2989
|
label: t
|
|
2928
2990
|
},
|
|
2929
2991
|
a
|
|
2930
|
-
)) }) : null,
|
|
2931
|
-
const { t: e } =
|
|
2932
|
-
return /* @__PURE__ */ i.jsxs(
|
|
2992
|
+
)) }) : null, $i = () => {
|
|
2993
|
+
const { t: e } = _e(), t = cs(), { position: s, bouMenuItems: r } = Fs(), { logoutUrl: a } = yt(), l = Dt().getQueryData(Ts), c = (l == null ? void 0 : l.profile.firstName) ?? "", m = (l == null ? void 0 : l.profile.lastName) ?? "";
|
|
2994
|
+
return /* @__PURE__ */ i.jsxs(Y, { type: "nav", id: "xtra-menu", position: s, children: [
|
|
2933
2995
|
/* @__PURE__ */ i.jsx(
|
|
2934
|
-
|
|
2996
|
+
Y.Trigger,
|
|
2935
2997
|
{
|
|
2936
|
-
className:
|
|
2998
|
+
className: P(
|
|
2937
2999
|
"button",
|
|
2938
3000
|
"button--neutral",
|
|
2939
3001
|
"button--authentication",
|
|
2940
3002
|
"button--authentication--authenticated"
|
|
2941
3003
|
),
|
|
2942
3004
|
children: /* @__PURE__ */ i.jsxs("button", { children: [
|
|
2943
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(
|
|
2944
|
-
/* @__PURE__ */ i.jsx("span", { className: "button__label", children:
|
|
2945
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(
|
|
3005
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Lr, { variant: "small", firstName: c, lastName: m }) }),
|
|
3006
|
+
/* @__PURE__ */ i.jsx("span", { className: "button__label", children: c }),
|
|
3007
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Tt, {}) })
|
|
2946
3008
|
] })
|
|
2947
3009
|
}
|
|
2948
3010
|
),
|
|
2949
|
-
/* @__PURE__ */ i.jsxs(
|
|
2950
|
-
|
|
3011
|
+
/* @__PURE__ */ i.jsxs(Y.Content, { as: "div", children: [
|
|
3012
|
+
Hi(r),
|
|
2951
3013
|
/* @__PURE__ */ i.jsxs("ul", { children: [
|
|
2952
3014
|
/* @__PURE__ */ i.jsx(
|
|
2953
|
-
|
|
3015
|
+
fe,
|
|
2954
3016
|
{
|
|
2955
3017
|
className: "manage-profile",
|
|
2956
3018
|
mobileUrl: `${t}/manage-profile`,
|
|
2957
3019
|
desktopUrl: `${t}/manage-profile/personal-data`,
|
|
2958
|
-
icon: /* @__PURE__ */ i.jsx(
|
|
3020
|
+
icon: /* @__PURE__ */ i.jsx(zr, {}),
|
|
2959
3021
|
label: e("manageProfile")
|
|
2960
3022
|
}
|
|
2961
3023
|
),
|
|
2962
3024
|
/* @__PURE__ */ i.jsx(
|
|
2963
|
-
|
|
3025
|
+
fe,
|
|
2964
3026
|
{
|
|
2965
3027
|
className: "payment",
|
|
2966
3028
|
mobileUrl: `${t}/payment`,
|
|
2967
|
-
icon: /* @__PURE__ */ i.jsx(
|
|
3029
|
+
icon: /* @__PURE__ */ i.jsx(ai, {}),
|
|
2968
3030
|
label: e("payment")
|
|
2969
3031
|
}
|
|
2970
3032
|
),
|
|
2971
3033
|
/* @__PURE__ */ i.jsx(
|
|
2972
|
-
|
|
3034
|
+
fe,
|
|
2973
3035
|
{
|
|
2974
3036
|
className: "gift-cards",
|
|
2975
3037
|
mobileUrl: `${t}/gift-cards`,
|
|
2976
|
-
icon: /* @__PURE__ */ i.jsx(
|
|
3038
|
+
icon: /* @__PURE__ */ i.jsx(ii, {}),
|
|
2977
3039
|
label: e("giftCards")
|
|
2978
3040
|
}
|
|
2979
3041
|
),
|
|
2980
3042
|
/* @__PURE__ */ i.jsx(
|
|
2981
|
-
|
|
3043
|
+
fe,
|
|
2982
3044
|
{
|
|
2983
3045
|
mobileUrl: `${t}/identifiers`,
|
|
2984
|
-
icon: /* @__PURE__ */ i.jsx(
|
|
3046
|
+
icon: /* @__PURE__ */ i.jsx(li, {}),
|
|
2985
3047
|
label: e("qrCode")
|
|
2986
3048
|
}
|
|
2987
3049
|
),
|
|
2988
3050
|
/* @__PURE__ */ i.jsx(
|
|
2989
|
-
|
|
3051
|
+
fe,
|
|
2990
3052
|
{
|
|
2991
3053
|
className: "manage-privacy",
|
|
2992
3054
|
mobileUrl: `${t}/manage-privacy`,
|
|
2993
3055
|
desktopUrl: `${t}/manage-privacy/permissions`,
|
|
2994
|
-
icon: /* @__PURE__ */ i.jsx(
|
|
3056
|
+
icon: /* @__PURE__ */ i.jsx(Zr, {}),
|
|
2995
3057
|
label: e("privacy")
|
|
2996
3058
|
}
|
|
2997
3059
|
),
|
|
2998
|
-
/* @__PURE__ */ i.jsx(
|
|
3060
|
+
/* @__PURE__ */ i.jsx(fe, { mobileUrl: a, icon: /* @__PURE__ */ i.jsx(qr, {}), label: e("logout") })
|
|
2999
3061
|
] })
|
|
3000
3062
|
] })
|
|
3001
3063
|
] });
|
|
3002
|
-
},
|
|
3003
|
-
const { t: e } =
|
|
3004
|
-
return /* @__PURE__ */ i.jsxs("button", { className:
|
|
3064
|
+
}, Ki = () => {
|
|
3065
|
+
const { t: e } = _e();
|
|
3066
|
+
return /* @__PURE__ */ i.jsxs("button", { className: P("button", "button--neutral", "button--authentication"), children: [
|
|
3005
3067
|
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx("i", { className: "spinner" }) }),
|
|
3006
3068
|
/* @__PURE__ */ i.jsxs("span", { className: "button__label", children: [
|
|
3007
3069
|
e("loading"),
|
|
3008
3070
|
"..."
|
|
3009
3071
|
] })
|
|
3010
3072
|
] });
|
|
3011
|
-
},
|
|
3012
|
-
const { t } =
|
|
3073
|
+
}, Gi = ({ className: e }) => {
|
|
3074
|
+
const { t } = _e(), { loginUrl: s } = yt();
|
|
3013
3075
|
return /* @__PURE__ */ i.jsxs(
|
|
3014
3076
|
"a",
|
|
3015
3077
|
{
|
|
3016
3078
|
href: s,
|
|
3017
|
-
className:
|
|
3079
|
+
className: P(
|
|
3018
3080
|
"button",
|
|
3019
3081
|
"button--neutral",
|
|
3020
3082
|
"button--authentication",
|
|
@@ -3022,17 +3084,17 @@ const Qi = "/icons/bouMenuIcons.svg", Hi = ({
|
|
|
3022
3084
|
e
|
|
3023
3085
|
),
|
|
3024
3086
|
children: [
|
|
3025
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(
|
|
3087
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Ut, { width: 24, height: 24, suffix: "desktop" }) }),
|
|
3026
3088
|
/* @__PURE__ */ i.jsx("span", { className: "button__label", children: t("login") }),
|
|
3027
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(
|
|
3089
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Tt, {}) })
|
|
3028
3090
|
]
|
|
3029
3091
|
}
|
|
3030
3092
|
);
|
|
3031
3093
|
};
|
|
3032
|
-
const
|
|
3033
|
-
const { t: e } =
|
|
3094
|
+
const Vi = () => {
|
|
3095
|
+
const { t: e } = _e(), { loginUrl: t } = yt(), s = cs(), { position: r } = Fs();
|
|
3034
3096
|
return /* @__PURE__ */ i.jsxs(
|
|
3035
|
-
|
|
3097
|
+
Y,
|
|
3036
3098
|
{
|
|
3037
3099
|
type: "nav",
|
|
3038
3100
|
id: "xtra-menu",
|
|
@@ -3040,211 +3102,41 @@ const Zi = () => {
|
|
|
3040
3102
|
className: "menu--unauthenticated",
|
|
3041
3103
|
"aria-label": e("xtraMenuAriaLabel"),
|
|
3042
3104
|
children: [
|
|
3043
|
-
/* @__PURE__ */ i.jsx(
|
|
3044
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(
|
|
3045
|
-
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(
|
|
3105
|
+
/* @__PURE__ */ i.jsx(Y.Trigger, { className: P("button", "button--neutral", "button--authentication"), children: /* @__PURE__ */ i.jsxs("button", { children: [
|
|
3106
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Ut, { width: 24, height: 24, suffix: "mobile" }) }),
|
|
3107
|
+
/* @__PURE__ */ i.jsx("div", { className: "button__icon button__icon-right", children: /* @__PURE__ */ i.jsx(Tt, {}) })
|
|
3046
3108
|
] }) }),
|
|
3047
|
-
/* @__PURE__ */ i.jsxs(
|
|
3048
|
-
/* @__PURE__ */ i.jsx(
|
|
3049
|
-
/* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(
|
|
3109
|
+
/* @__PURE__ */ i.jsxs(Y.Content, { children: [
|
|
3110
|
+
/* @__PURE__ */ i.jsx(Y.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: t, className: "button button--with-icon", children: [
|
|
3111
|
+
/* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Gr, {}) }),
|
|
3050
3112
|
/* @__PURE__ */ i.jsx("span", { className: "button__label", children: e("login") })
|
|
3051
3113
|
] }) }),
|
|
3052
|
-
/* @__PURE__ */ i.jsx(
|
|
3053
|
-
/* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(
|
|
3114
|
+
/* @__PURE__ */ i.jsx(Y.Item, { children: /* @__PURE__ */ i.jsxs("a", { href: `${s}/onboarding/register`, className: "button button--with-icon", children: [
|
|
3115
|
+
/* @__PURE__ */ i.jsx("span", { className: "button__icon", children: /* @__PURE__ */ i.jsx(Xr, {}) }),
|
|
3054
3116
|
/* @__PURE__ */ i.jsx("span", { className: "button__label", children: e("register") })
|
|
3055
3117
|
] }) })
|
|
3056
3118
|
] })
|
|
3057
3119
|
]
|
|
3058
3120
|
}
|
|
3059
3121
|
);
|
|
3060
|
-
}
|
|
3061
|
-
var
|
|
3062
|
-
const
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
/* @__PURE__ */ i.jsx(
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
};
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
for (var r in s)
|
|
3074
|
-
e[r] = s[r];
|
|
3075
|
-
}
|
|
3076
|
-
return e;
|
|
3077
|
-
}
|
|
3078
|
-
var Yi = {
|
|
3079
|
-
read: function(e) {
|
|
3080
|
-
return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
3081
|
-
},
|
|
3082
|
-
write: function(e) {
|
|
3083
|
-
return encodeURIComponent(e).replace(
|
|
3084
|
-
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
|
|
3085
|
-
decodeURIComponent
|
|
3086
|
-
);
|
|
3087
|
-
}
|
|
3088
|
-
};
|
|
3089
|
-
function Tt(e, t) {
|
|
3090
|
-
function s(a, o, l) {
|
|
3091
|
-
if (!(typeof document > "u")) {
|
|
3092
|
-
l = ct({}, t, l), typeof l.expires == "number" && (l.expires = new Date(Date.now() + l.expires * 864e5)), l.expires && (l.expires = l.expires.toUTCString()), a = encodeURIComponent(a).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
3093
|
-
var c = "";
|
|
3094
|
-
for (var f in l)
|
|
3095
|
-
l[f] && (c += "; " + f, l[f] !== !0 && (c += "=" + l[f].split(";")[0]));
|
|
3096
|
-
return document.cookie = a + "=" + e.write(o, a) + c;
|
|
3097
|
-
}
|
|
3098
|
-
}
|
|
3099
|
-
function r(a) {
|
|
3100
|
-
if (!(typeof document > "u" || arguments.length && !a)) {
|
|
3101
|
-
for (var o = document.cookie ? document.cookie.split("; ") : [], l = {}, c = 0; c < o.length; c++) {
|
|
3102
|
-
var f = o[c].split("="), g = f.slice(1).join("=");
|
|
3103
|
-
try {
|
|
3104
|
-
var u = decodeURIComponent(f[0]);
|
|
3105
|
-
if (l[u] = e.read(g, u), a === u)
|
|
3106
|
-
break;
|
|
3107
|
-
} catch {
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
return a ? l[a] : l;
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
return Object.create(
|
|
3114
|
-
{
|
|
3115
|
-
set: s,
|
|
3116
|
-
get: r,
|
|
3117
|
-
remove: function(a, o) {
|
|
3118
|
-
s(
|
|
3119
|
-
a,
|
|
3120
|
-
"",
|
|
3121
|
-
ct({}, o, {
|
|
3122
|
-
expires: -1
|
|
3123
|
-
})
|
|
3124
|
-
);
|
|
3125
|
-
},
|
|
3126
|
-
withAttributes: function(a) {
|
|
3127
|
-
return Tt(this.converter, ct({}, this.attributes, a));
|
|
3128
|
-
},
|
|
3129
|
-
withConverter: function(a) {
|
|
3130
|
-
return Tt(ct({}, this.converter, a), this.attributes);
|
|
3131
|
-
}
|
|
3132
|
-
},
|
|
3133
|
-
{
|
|
3134
|
-
attributes: { value: Object.freeze(t) },
|
|
3135
|
-
converter: { value: Object.freeze(e) }
|
|
3136
|
-
}
|
|
3137
|
-
);
|
|
3138
|
-
}
|
|
3139
|
-
var Ut = Tt(Yi, { path: "/" });
|
|
3140
|
-
class yt extends Error {
|
|
3141
|
-
constructor(t) {
|
|
3142
|
-
super(t), this.name = "UnauthorizedError";
|
|
3143
|
-
}
|
|
3144
|
-
}
|
|
3145
|
-
const Ji = () => {
|
|
3146
|
-
const { i18n: e } = Ee(), { profileEndpoint: t } = qe();
|
|
3147
|
-
return ks({
|
|
3148
|
-
queryKey: ["profile"],
|
|
3149
|
-
queryFn: async () => {
|
|
3150
|
-
const r = await fetch(t, {
|
|
3151
|
-
credentials: "include",
|
|
3152
|
-
mode: "cors",
|
|
3153
|
-
headers: { "Accept-Language": e.language }
|
|
3154
|
-
});
|
|
3155
|
-
if (!r.ok)
|
|
3156
|
-
throw r.status === 401 ? new yt(`${r.status} - ${r.statusText}`) : new Error("Network response was not ok");
|
|
3157
|
-
return await r.json();
|
|
3158
|
-
},
|
|
3159
|
-
retry: (r, a) => a instanceof yt ? !1 : r < 2,
|
|
3160
|
-
refetchOnWindowFocus: !1
|
|
3161
|
-
});
|
|
3162
|
-
}, ts = (e) => e ? `+${e.countryCode} ${e.number}` : "", ss = (e, t) => t == null ? void 0 : t.find((s) => s.type === e), rs = ({ apiUrl: e, redirectUrl: t }) => {
|
|
3163
|
-
const { loginUrl: s } = Gs({ apiUrl: e, redirectUrl: t });
|
|
3164
|
-
window.location.replace(s);
|
|
3165
|
-
}, Xi = (e) => {
|
|
3166
|
-
if (!e)
|
|
3167
|
-
return { user: { state: () => Y.NotAuthenticated }, tryToLogon: rs };
|
|
3168
|
-
const t = new Date(e.dateOfBirth), s = ss(qt.Mobile, e.phone), r = ss(qt.Fixed, e.phone), a = ts(s) ?? ts(r) ?? "";
|
|
3169
|
-
return {
|
|
3170
|
-
user: {
|
|
3171
|
-
firstName: () => e.firstName,
|
|
3172
|
-
lastName: () => e.lastName,
|
|
3173
|
-
dob: () => t.getDate(),
|
|
3174
|
-
mob: () => t.getMonth() + 1,
|
|
3175
|
-
yob: () => t.getFullYear(),
|
|
3176
|
-
gender: () => e.genderCode,
|
|
3177
|
-
phone: () => a,
|
|
3178
|
-
streetName: () => {
|
|
3179
|
-
var o;
|
|
3180
|
-
return (o = e.address) == null ? void 0 : o.streetName;
|
|
3181
|
-
},
|
|
3182
|
-
houseNr: () => {
|
|
3183
|
-
var o;
|
|
3184
|
-
return (o = e.address) == null ? void 0 : o.houseNumber;
|
|
3185
|
-
},
|
|
3186
|
-
box: () => {
|
|
3187
|
-
var o;
|
|
3188
|
-
return (o = e.address) == null ? void 0 : o.letterBoxName;
|
|
3189
|
-
},
|
|
3190
|
-
zip: () => {
|
|
3191
|
-
var o;
|
|
3192
|
-
return (o = e.address) == null ? void 0 : o.postalCode;
|
|
3193
|
-
},
|
|
3194
|
-
city: () => {
|
|
3195
|
-
var o;
|
|
3196
|
-
return (o = e.address) == null ? void 0 : o.locationName;
|
|
3197
|
-
},
|
|
3198
|
-
country: () => {
|
|
3199
|
-
var o;
|
|
3200
|
-
return (o = e.address) == null ? void 0 : o.countryCode;
|
|
3201
|
-
},
|
|
3202
|
-
email: () => e.email,
|
|
3203
|
-
cbh: () => e.customerIdentifier,
|
|
3204
|
-
state: () => Y.Authenticated
|
|
3205
|
-
},
|
|
3206
|
-
tryToLogon: rs
|
|
3207
|
-
};
|
|
3208
|
-
}, Vs = () => {
|
|
3209
|
-
const e = Ji(), t = Ut.get("profile"), s = !!t, [r, a] = d.useState(
|
|
3210
|
-
s ? Y.Authenticated : Y.Pending
|
|
3211
|
-
), [o, l] = d.useState(
|
|
3212
|
-
s ? JSON.parse(t) : void 0
|
|
3213
|
-
);
|
|
3214
|
-
return d.useEffect(() => {
|
|
3215
|
-
e.isError && e.error instanceof yt && (Ut.remove("profile"), a(Y.NotAuthenticated)), e.isError && !(e.error instanceof yt) && a(
|
|
3216
|
-
s ? Y.Authenticated : Y.NotAuthenticated
|
|
3217
|
-
), e.isSuccess && (a(Y.Authenticated), l(e.data), window.postMessage(
|
|
3218
|
-
{ source: "xtra-authentication", isAuthenticated: !0 },
|
|
3219
|
-
new URL(window.location.href).origin
|
|
3220
|
-
)), window.XTRA = Xi(e.data);
|
|
3221
|
-
}, [
|
|
3222
|
-
s,
|
|
3223
|
-
e.data,
|
|
3224
|
-
e.error,
|
|
3225
|
-
e.isError,
|
|
3226
|
-
e.isSuccess
|
|
3227
|
-
]), { authenticationStatus: r, profile: o };
|
|
3228
|
-
}, Ii = ({ position: e, bouMenuItems: t }) => {
|
|
3229
|
-
const { authenticationStatus: s, profile: r } = Vs();
|
|
3230
|
-
return /* @__PURE__ */ i.jsx(
|
|
3231
|
-
$i,
|
|
3232
|
-
{
|
|
3233
|
-
bouMenuItems: t,
|
|
3234
|
-
authenticationStatus: s,
|
|
3235
|
-
position: e,
|
|
3236
|
-
profile: r,
|
|
3237
|
-
children: /* @__PURE__ */ i.jsx(zi, {})
|
|
3238
|
-
}
|
|
3239
|
-
);
|
|
3240
|
-
}, Bi = () => {
|
|
3241
|
-
const { postTermsAndConditionsEndpoint: e } = qe(), t = new ws();
|
|
3242
|
-
return Sr({
|
|
3122
|
+
}, qi = () => {
|
|
3123
|
+
var t, s;
|
|
3124
|
+
const e = Us();
|
|
3125
|
+
return ((t = e.data) == null ? void 0 : t.authenticationStatus) === "Authenticated" ? /* @__PURE__ */ i.jsx($i, {}) : ((s = e.data) == null ? void 0 : s.authenticationStatus) === "NotAuthenticated" || e.isError ? /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
3126
|
+
/* @__PURE__ */ i.jsx(Gi, {}),
|
|
3127
|
+
/* @__PURE__ */ i.jsx(Vi, {})
|
|
3128
|
+
] }) : /* @__PURE__ */ i.jsx(Ki, {});
|
|
3129
|
+
}, Qs = () => {
|
|
3130
|
+
const { apiUrl: e } = Qt();
|
|
3131
|
+
return `${`${e}/xtra`}/authentication/v1/gdpr`;
|
|
3132
|
+
}, Wi = () => {
|
|
3133
|
+
const e = Qs(), t = new vs();
|
|
3134
|
+
return wr({
|
|
3243
3135
|
mutationFn: async (r) => {
|
|
3244
|
-
const a = await fetch(e
|
|
3245
|
-
method: "post",
|
|
3136
|
+
const a = await fetch(`${e}/tc`, {
|
|
3246
3137
|
body: JSON.stringify({ acceptedTC: r }),
|
|
3247
3138
|
credentials: "include",
|
|
3139
|
+
method: "POST",
|
|
3248
3140
|
mode: "cors"
|
|
3249
3141
|
});
|
|
3250
3142
|
if (!a.ok)
|
|
@@ -3255,88 +3147,89 @@ const Ji = () => {
|
|
|
3255
3147
|
await t.invalidateQueries({ queryKey: ["gdpr"] });
|
|
3256
3148
|
}
|
|
3257
3149
|
});
|
|
3258
|
-
},
|
|
3259
|
-
|
|
3260
|
-
|
|
3150
|
+
}, Zi = () => {
|
|
3151
|
+
var o;
|
|
3152
|
+
const { i18n: e } = _e(), t = Qs(), r = ((o = Us().data) == null ? void 0 : o.authenticationStatus) === "Authenticated";
|
|
3153
|
+
return bs({
|
|
3261
3154
|
queryKey: ["gdpr"],
|
|
3262
3155
|
queryFn: async () => {
|
|
3263
|
-
const
|
|
3156
|
+
const l = await fetch(`${t}/tc/check`, {
|
|
3264
3157
|
credentials: "include",
|
|
3265
3158
|
mode: "cors",
|
|
3266
3159
|
headers: { "Accept-Language": e.language }
|
|
3267
3160
|
});
|
|
3268
|
-
if (!
|
|
3161
|
+
if (!l.ok)
|
|
3269
3162
|
throw new Error("Network response was not ok");
|
|
3270
|
-
return await
|
|
3163
|
+
return l.status === 204 ? [] : await l.json();
|
|
3271
3164
|
},
|
|
3272
|
-
enabled:
|
|
3273
|
-
initialData: a
|
|
3165
|
+
enabled: r
|
|
3274
3166
|
});
|
|
3275
|
-
},
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3167
|
+
}, Yi = () => {
|
|
3168
|
+
var y;
|
|
3169
|
+
const { t: e } = _e(), { logoutUrl: t } = yt(), s = d.useRef(null), [r, a] = d.useState(0), [o, l] = d.useState({}), { mutate: c, isError: m } = Wi(), { AccessibleFormMessage: C, formRef: u } = Gs({ submitCount: r, errors: o }), b = Zi(), v = !!((y = b.data) != null && y.length), f = e("termsAndConditions.error.required"), w = () => {
|
|
3170
|
+
var g;
|
|
3171
|
+
(g = s == null ? void 0 : s.current) == null || g.click(), document.body.style.removeProperty("overflow");
|
|
3279
3172
|
};
|
|
3280
3173
|
d.useEffect(() => {
|
|
3281
|
-
|
|
3282
|
-
}, [
|
|
3283
|
-
|
|
3284
|
-
}, [
|
|
3285
|
-
const
|
|
3286
|
-
|
|
3287
|
-
const { acceptedTC:
|
|
3288
|
-
if (
|
|
3289
|
-
const
|
|
3290
|
-
|
|
3174
|
+
v && document.body.style.setProperty("overflow", "hidden");
|
|
3175
|
+
}, [v]), d.useEffect(() => {
|
|
3176
|
+
m && l({ acceptedTC: f });
|
|
3177
|
+
}, [f, m]);
|
|
3178
|
+
const E = (g) => {
|
|
3179
|
+
g.preventDefault(), a(r + 1);
|
|
3180
|
+
const { acceptedTC: S } = g.target;
|
|
3181
|
+
if (S instanceof RadioNodeList) {
|
|
3182
|
+
const _ = Object.values(S);
|
|
3183
|
+
_.every((L) => L.checked) ? (l({}), c(_.map((L) => L.value)), w()) : l({ acceptedTC: f });
|
|
3291
3184
|
} else
|
|
3292
|
-
|
|
3185
|
+
S != null && S.checked ? (l({}), c([S.value]), w()) : l({ acceptedTC: f });
|
|
3293
3186
|
};
|
|
3294
|
-
return
|
|
3295
|
-
|
|
3296
|
-
/* @__PURE__ */ i.jsxs(
|
|
3297
|
-
/* @__PURE__ */ i.jsx(
|
|
3298
|
-
/* @__PURE__ */ i.jsx(
|
|
3299
|
-
/* @__PURE__ */ i.jsxs(
|
|
3187
|
+
return v ? /* @__PURE__ */ i.jsxs(H, { defaultOpen: v, isModal: !0, children: [
|
|
3188
|
+
C,
|
|
3189
|
+
/* @__PURE__ */ i.jsxs(H.Root, { children: [
|
|
3190
|
+
/* @__PURE__ */ i.jsx(H.Header, { children: /* @__PURE__ */ i.jsx(H.Title, { icon: /* @__PURE__ */ i.jsx(Ut, { role: "presentation" }), children: /* @__PURE__ */ i.jsx(Ii, { children: e("termsAndConditions.title") }) }) }),
|
|
3191
|
+
/* @__PURE__ */ i.jsx(H.Body, { children: /* @__PURE__ */ i.jsxs(Hs, { ref: u, id: "tc-form", onSubmit: E, children: [
|
|
3192
|
+
/* @__PURE__ */ i.jsxs(Ji, { children: [
|
|
3300
3193
|
e("termsAndConditions.description"),
|
|
3301
|
-
o.acceptedTC && /* @__PURE__ */ i.jsx(
|
|
3194
|
+
o.acceptedTC && /* @__PURE__ */ i.jsx(Bi, { children: f })
|
|
3302
3195
|
] }),
|
|
3303
|
-
|
|
3304
|
-
|
|
3196
|
+
b.data.map(({ tcCode: g, title: S, URL: _ }) => /* @__PURE__ */ i.jsx(
|
|
3197
|
+
je,
|
|
3305
3198
|
{
|
|
3306
|
-
id:
|
|
3307
|
-
value:
|
|
3199
|
+
id: g,
|
|
3200
|
+
value: g,
|
|
3308
3201
|
name: "acceptedTC",
|
|
3309
3202
|
variant: "primary",
|
|
3310
|
-
children: /* @__PURE__ */ i.jsxs(
|
|
3311
|
-
/* @__PURE__ */ i.jsx(
|
|
3312
|
-
/* @__PURE__ */ i.jsx(
|
|
3203
|
+
children: /* @__PURE__ */ i.jsxs(je.Content, { children: [
|
|
3204
|
+
/* @__PURE__ */ i.jsx(zi, { children: S }),
|
|
3205
|
+
/* @__PURE__ */ i.jsx(Xi, { href: _, children: e("termsAndConditions.action", { title: S }) })
|
|
3313
3206
|
] })
|
|
3314
3207
|
},
|
|
3315
|
-
|
|
3208
|
+
g
|
|
3316
3209
|
))
|
|
3317
3210
|
] }) }),
|
|
3318
|
-
/* @__PURE__ */ i.jsxs(
|
|
3211
|
+
/* @__PURE__ */ i.jsxs(H.Footer, { children: [
|
|
3319
3212
|
/* @__PURE__ */ i.jsx(
|
|
3320
3213
|
"a",
|
|
3321
3214
|
{
|
|
3322
|
-
className:
|
|
3215
|
+
className: P("button", "button--secondary", "button--terms-and-conditions"),
|
|
3323
3216
|
href: t,
|
|
3324
3217
|
children: e("logout")
|
|
3325
3218
|
}
|
|
3326
3219
|
),
|
|
3327
|
-
/* @__PURE__ */ i.jsx(
|
|
3220
|
+
/* @__PURE__ */ i.jsx(it, { form: "tc-form", type: "submit", variant: "primary", children: e("confirm") })
|
|
3328
3221
|
] })
|
|
3329
3222
|
] })
|
|
3330
3223
|
] }) : /* @__PURE__ */ i.jsx(i.Fragment, {});
|
|
3331
|
-
},
|
|
3224
|
+
}, zi = ({
|
|
3332
3225
|
children: e,
|
|
3333
3226
|
...t
|
|
3334
|
-
}) => /* @__PURE__ */ i.jsx(
|
|
3335
|
-
|
|
3336
|
-
const
|
|
3227
|
+
}) => /* @__PURE__ */ i.jsx(je.Label, { className: "form--tc__label", ...t, children: e }), Hs = d.forwardRef(({ children: e, ...t }, s) => /* @__PURE__ */ i.jsx("form", { className: "form--tc", ref: s, ...t, children: e }));
|
|
3228
|
+
Hs.displayName = "TermsAndConditionsForm";
|
|
3229
|
+
const Ji = ({
|
|
3337
3230
|
children: e,
|
|
3338
3231
|
...t
|
|
3339
|
-
}) => /* @__PURE__ */ i.jsx("p", { className: "form--tc__description", ...t, children: e }),
|
|
3232
|
+
}) => /* @__PURE__ */ i.jsx("p", { className: "form--tc__description", ...t, children: e }), Xi = ({ children: e, ...t }) => /* @__PURE__ */ i.jsx(
|
|
3340
3233
|
"a",
|
|
3341
3234
|
{
|
|
3342
3235
|
className: "form--tc__link",
|
|
@@ -3347,10 +3240,10 @@ const rn = ({
|
|
|
3347
3240
|
...t,
|
|
3348
3241
|
children: e
|
|
3349
3242
|
}
|
|
3350
|
-
),
|
|
3351
|
-
/* @__PURE__ */ i.jsx(
|
|
3352
|
-
/* @__PURE__ */ i.jsx(
|
|
3243
|
+
), Ii = ({ children: e }) => /* @__PURE__ */ i.jsx("h1", { className: "form--tc__title", children: e }), Bi = ({ children: e, ...t }) => /* @__PURE__ */ i.jsx("span", { className: "form--tc__error", role: "alert", ...t, children: e }), en = new vs(), rn = ({ environment: e, redirectUrl: t, apiUrl: s, position: r, bouMenuItems: a }) => /* @__PURE__ */ i.jsx(Vs, { environment: e, children: /* @__PURE__ */ i.jsx(Ti, { apiUrl: s, redirectUrl: t, children: /* @__PURE__ */ i.jsxs(ur, { client: en, children: [
|
|
3244
|
+
/* @__PURE__ */ i.jsx(Di, { position: r, bouMenuItems: a, children: /* @__PURE__ */ i.jsx(qi, {}) }),
|
|
3245
|
+
/* @__PURE__ */ i.jsx(Yi, {})
|
|
3353
3246
|
] }) }) });
|
|
3354
3247
|
export {
|
|
3355
|
-
|
|
3248
|
+
rn as default
|
|
3356
3249
|
};
|