@open-kingdom/shared-frontend-data-access-api-client 0.0.2-2

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/dist/index.js ADDED
@@ -0,0 +1,4047 @@
1
+ import { nanoid as zn, formatProdErrorMessage as ye, isPlainObject as Ue, createAction as De, createSelector as Rr, createNextState as Kt, createAsyncThunk as cn, createSlice as Se, prepareAutoBatched as ke, isAnyOf as $e, isFulfilled as _e, isRejectedWithValue as Ht, combineReducers as Or, SHOULD_AUTOBATCH as Un, isAllOf as Pt, isRejected as Wt, isPending as $n, isAction as Ir, isAsyncThunkAction as an, createListenerMiddleware as Ar } from "@reduxjs/toolkit";
2
+ import * as he from "react";
3
+ import Ln, { useCallback as ge, useDebugValue as Rt, useMemo as G, useState as un, useEffect as de, useRef as fe, useLayoutEffect as Cr } from "react";
4
+ var Bt = Symbol.for("immer-nothing"), xe = Symbol.for("immer-draftable"), B = Symbol.for("immer-state"), jn = process.env.NODE_ENV !== "production" ? [
5
+ // All error codes, starting by 0:
6
+ function(e) {
7
+ return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
8
+ },
9
+ function(e) {
10
+ return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
11
+ },
12
+ "This object has been frozen and should not be mutated",
13
+ function(e) {
14
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
15
+ },
16
+ "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
17
+ "Immer forbids circular references",
18
+ "The first or second argument to `produce` must be a function",
19
+ "The third argument to `produce` must be a function or undefined",
20
+ "First argument to `createDraft` must be a plain object, an array, or an immerable object",
21
+ "First argument to `finishDraft` must be a draft returned by `createDraft`",
22
+ function(e) {
23
+ return `'current' expects a draft, got: ${e}`;
24
+ },
25
+ "Object.defineProperty() cannot be used on an Immer draft",
26
+ "Object.setPrototypeOf() cannot be used on an Immer draft",
27
+ "Immer only supports deleting array indices",
28
+ "Immer only supports setting array indices and the 'length' property",
29
+ function(e) {
30
+ return `'original' expects a draft, got: ${e}`;
31
+ }
32
+ // Note: if more errors are added, the errorOffset in Patches.ts should be increased
33
+ // See Patches.ts for additional errors
34
+ ] : [];
35
+ function W(e, ...t) {
36
+ if (process.env.NODE_ENV !== "production") {
37
+ const n = jn[e], r = pe(n) ? n.apply(null, t) : n;
38
+ throw new Error(`[Immer] ${r}`);
39
+ }
40
+ throw new Error(
41
+ `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
42
+ );
43
+ }
44
+ var J = Object, Ee = J.getPrototypeOf, Le = "constructor", Ye = "prototype", Mt = "configurable", ft = "enumerable", ut = "writable", je = "value", Z = (e) => !!e && !!e[B];
45
+ function re(e) {
46
+ return e ? Kn(e) || Je(e) || !!e[xe] || !!e[Le]?.[xe] || Xe(e) || Ze(e) : !1;
47
+ }
48
+ var Tr = J[Ye][Le].toString(), ln = /* @__PURE__ */ new WeakMap();
49
+ function Kn(e) {
50
+ if (!e || !Ae(e))
51
+ return !1;
52
+ const t = Ee(e);
53
+ if (t === null || t === J[Ye])
54
+ return !0;
55
+ const n = J.hasOwnProperty.call(t, Le) && t[Le];
56
+ if (n === Object)
57
+ return !0;
58
+ if (!pe(n))
59
+ return !1;
60
+ let r = ln.get(n);
61
+ return r === void 0 && (r = Function.toString.call(n), ln.set(n, r)), r === Tr;
62
+ }
63
+ function Dr(e) {
64
+ return Z(e) || W(15, e), e[B].base_;
65
+ }
66
+ function Ne(e, t, n = !0) {
67
+ we(e) === 0 ? (n ? Reflect.ownKeys(e) : J.keys(e)).forEach((i) => {
68
+ t(i, e[i], e);
69
+ }) : e.forEach((r, i) => t(i, r, e));
70
+ }
71
+ function we(e) {
72
+ const t = e[B];
73
+ return t ? t.type_ : Je(e) ? 1 : Xe(e) ? 2 : Ze(e) ? 3 : 0;
74
+ }
75
+ var Ve = (e, t, n = we(e)) => n === 2 ? e.has(t) : J[Ye].hasOwnProperty.call(e, t), se = (e, t, n = we(e)) => (
76
+ // @ts-ignore
77
+ n === 2 ? e.get(t) : e[t]
78
+ ), dt = (e, t, n, r = we(e)) => {
79
+ r === 2 ? e.set(t, n) : r === 3 ? e.add(n) : e[t] = n;
80
+ };
81
+ function Nr(e, t) {
82
+ return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
83
+ }
84
+ var Je = Array.isArray, Xe = (e) => e instanceof Map, Ze = (e) => e instanceof Set, Ae = (e) => typeof e == "object", pe = (e) => typeof e == "function", Ot = (e) => typeof e == "boolean", kr = (e) => Ae(e) ? e?.[B] : null, ce = (e) => e.copy_ || e.base_, Gt = (e) => e.modified_ ? e.copy_ : e.base_;
85
+ function Qt(e, t) {
86
+ if (Xe(e))
87
+ return new Map(e);
88
+ if (Ze(e))
89
+ return new Set(e);
90
+ if (Je(e))
91
+ return Array[Ye].slice.call(e);
92
+ const n = Kn(e);
93
+ if (t === !0 || t === "class_only" && !n) {
94
+ const r = J.getOwnPropertyDescriptors(e);
95
+ delete r[B];
96
+ let i = Reflect.ownKeys(r);
97
+ for (let a = 0; a < i.length; a++) {
98
+ const v = i[a], _ = r[v];
99
+ _[ut] === !1 && (_[ut] = !0, _[Mt] = !0), (_.get || _.set) && (r[v] = {
100
+ [Mt]: !0,
101
+ [ut]: !0,
102
+ // could live with !!desc.set as well here...
103
+ [ft]: _[ft],
104
+ [je]: e[v]
105
+ });
106
+ }
107
+ return J.create(Ee(e), r);
108
+ } else {
109
+ const r = Ee(e);
110
+ if (r !== null && n)
111
+ return { ...e };
112
+ const i = J.create(r);
113
+ return J.assign(i, e);
114
+ }
115
+ }
116
+ function Yt(e, t = !1) {
117
+ return St(e) || Z(e) || (we(e) > 1 && J.defineProperties(e, {
118
+ set: rt,
119
+ add: rt,
120
+ clear: rt,
121
+ delete: rt
122
+ }), J.freeze(e), t && Ne(
123
+ e,
124
+ (n, r) => {
125
+ Yt(r, !0);
126
+ },
127
+ !1
128
+ )), e;
129
+ }
130
+ function Mr() {
131
+ W(2);
132
+ }
133
+ var rt = {
134
+ [je]: Mr
135
+ };
136
+ function St(e) {
137
+ return e === null || !Ae(e) ? !0 : J.isFrozen(e);
138
+ }
139
+ var pt = "MapSet", ht = "Patches", yt = {};
140
+ function Ce(e) {
141
+ const t = yt[e];
142
+ return t || W(0, e), t;
143
+ }
144
+ var Qr = (e) => !!yt[e];
145
+ function qr(e, t) {
146
+ yt[e] || (yt[e] = t);
147
+ }
148
+ var Ke, Hn = () => Ke, Fr = (e, t) => ({
149
+ drafts_: [],
150
+ parent_: e,
151
+ immer_: t,
152
+ // Whenever the modified draft contains a draft from another scope, we
153
+ // need to prevent auto-freezing so the unowned draft can be finalized.
154
+ canAutoFreeze_: !0,
155
+ unfinalizedDrafts_: 0,
156
+ handledSet_: /* @__PURE__ */ new Set(),
157
+ processedForPatches_: /* @__PURE__ */ new Set(),
158
+ mapSetPlugin_: Qr(pt) ? Ce(pt) : void 0
159
+ });
160
+ function fn(e, t) {
161
+ t && (e.patchPlugin_ = Ce(ht), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
162
+ }
163
+ function qt(e) {
164
+ Ft(e), e.drafts_.forEach(xr), e.drafts_ = null;
165
+ }
166
+ function Ft(e) {
167
+ e === Ke && (Ke = e.parent_);
168
+ }
169
+ var dn = (e) => Ke = Fr(Ke, e);
170
+ function xr(e) {
171
+ const t = e[B];
172
+ t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
173
+ }
174
+ function pn(e, t) {
175
+ t.unfinalizedDrafts_ = t.drafts_.length;
176
+ const n = t.drafts_[0];
177
+ if (e !== void 0 && e !== n) {
178
+ n[B].modified_ && (qt(t), W(4)), re(e) && (e = hn(t, e));
179
+ const { patchPlugin_: i } = t;
180
+ i && i.generateReplacementPatches_(
181
+ n[B].base_,
182
+ e,
183
+ t
184
+ );
185
+ } else
186
+ e = hn(t, n);
187
+ return Vr(t, e, !0), qt(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Bt ? e : void 0;
188
+ }
189
+ function hn(e, t) {
190
+ if (St(t))
191
+ return t;
192
+ const n = t[B];
193
+ if (!n)
194
+ return Jt(t, e.handledSet_, e);
195
+ if (!bt(n, e))
196
+ return t;
197
+ if (!n.modified_)
198
+ return n.base_;
199
+ if (!n.finalized_) {
200
+ const { callbacks_: r } = n;
201
+ if (r)
202
+ for (; r.length > 0; )
203
+ r.pop()(e);
204
+ Gn(n, e);
205
+ }
206
+ return n.copy_;
207
+ }
208
+ function Vr(e, t, n = !1) {
209
+ !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Yt(t, n);
210
+ }
211
+ function Wn(e) {
212
+ e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
213
+ }
214
+ var bt = (e, t) => e.scope_ === t, zr = [];
215
+ function Bn(e, t, n, r) {
216
+ const i = ce(e), a = e.type_;
217
+ if (r !== void 0 && se(i, r, a) === t) {
218
+ dt(i, r, n, a);
219
+ return;
220
+ }
221
+ if (!e.draftLocations_) {
222
+ const _ = e.draftLocations_ = /* @__PURE__ */ new Map();
223
+ Ne(i, (C, P) => {
224
+ if (Z(P)) {
225
+ const T = _.get(P) || [];
226
+ T.push(C), _.set(P, T);
227
+ }
228
+ });
229
+ }
230
+ const v = e.draftLocations_.get(t) ?? zr;
231
+ for (const _ of v)
232
+ dt(i, _, n, a);
233
+ }
234
+ function Ur(e, t, n) {
235
+ e.callbacks_.push(function(i) {
236
+ const a = t;
237
+ if (!a || !bt(a, i))
238
+ return;
239
+ i.mapSetPlugin_?.fixSetContents(a);
240
+ const v = Gt(a);
241
+ Bn(e, a.draft_ ?? a, v, n), Gn(a, i);
242
+ });
243
+ }
244
+ function Gn(e, t) {
245
+ if (e.modified_ && !e.finalized_ && (e.type_ === 3 || (e.assigned_?.size ?? 0) > 0)) {
246
+ const { patchPlugin_: r } = t;
247
+ if (r) {
248
+ const i = r.getPath(e);
249
+ i && r.generatePatches_(e, i, t);
250
+ }
251
+ Wn(e);
252
+ }
253
+ }
254
+ function $r(e, t, n) {
255
+ const { scope_: r } = e;
256
+ if (Z(n)) {
257
+ const i = n[B];
258
+ bt(i, r) && i.callbacks_.push(function() {
259
+ lt(e);
260
+ const v = Gt(i);
261
+ Bn(e, n, v, t);
262
+ });
263
+ } else re(n) && e.callbacks_.push(function() {
264
+ const a = ce(e);
265
+ se(a, t, e.type_) === n && r.drafts_.length > 1 && (e.assigned_.get(t) ?? !1) === !0 && e.copy_ && Jt(
266
+ se(e.copy_, t, e.type_),
267
+ r.handledSet_,
268
+ r
269
+ );
270
+ });
271
+ }
272
+ function Jt(e, t, n) {
273
+ return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || Z(e) || t.has(e) || !re(e) || St(e) || (t.add(e), Ne(e, (r, i) => {
274
+ if (Z(i)) {
275
+ const a = i[B];
276
+ if (bt(a, n)) {
277
+ const v = Gt(a);
278
+ dt(e, r, v, e.type_), Wn(a);
279
+ }
280
+ } else re(i) && Jt(i, t, n);
281
+ })), e;
282
+ }
283
+ function Lr(e, t) {
284
+ const n = Je(e), r = {
285
+ type_: n ? 1 : 0,
286
+ // Track which produce call this is associated with.
287
+ scope_: t ? t.scope_ : Hn(),
288
+ // True for both shallow and deep changes.
289
+ modified_: !1,
290
+ // Used during finalization.
291
+ finalized_: !1,
292
+ // Track which properties have been assigned (true) or deleted (false).
293
+ // actually instantiated in `prepareCopy()`
294
+ assigned_: void 0,
295
+ // The parent draft state.
296
+ parent_: t,
297
+ // The base state.
298
+ base_: e,
299
+ // The base proxy.
300
+ draft_: null,
301
+ // set below
302
+ // The base copy with any updated values.
303
+ copy_: null,
304
+ // Called by the `produce` function.
305
+ revoke_: null,
306
+ isManual_: !1,
307
+ // `callbacks` actually gets assigned in `createProxy`
308
+ callbacks_: void 0
309
+ };
310
+ let i = r, a = Xt;
311
+ n && (i = [r], a = He);
312
+ const { revoke: v, proxy: _ } = Proxy.revocable(i, a);
313
+ return r.draft_ = _, r.revoke_ = v, [_, r];
314
+ }
315
+ var Xt = {
316
+ get(e, t) {
317
+ if (t === B)
318
+ return e;
319
+ const n = ce(e);
320
+ if (!Ve(n, t, e.type_))
321
+ return jr(e, n, t);
322
+ const r = n[t];
323
+ if (e.finalized_ || !re(r))
324
+ return r;
325
+ if (r === It(e.base_, t)) {
326
+ lt(e);
327
+ const i = e.type_ === 1 ? +t : t, a = Vt(e.scope_, r, e, i);
328
+ return e.copy_[i] = a;
329
+ }
330
+ return r;
331
+ },
332
+ has(e, t) {
333
+ return t in ce(e);
334
+ },
335
+ ownKeys(e) {
336
+ return Reflect.ownKeys(ce(e));
337
+ },
338
+ set(e, t, n) {
339
+ const r = Yn(ce(e), t);
340
+ if (r?.set)
341
+ return r.set.call(e.draft_, n), !0;
342
+ if (!e.modified_) {
343
+ const i = It(ce(e), t), a = i?.[B];
344
+ if (a && a.base_ === n)
345
+ return e.copy_[t] = n, e.assigned_.set(t, !1), !0;
346
+ if (Nr(n, i) && (n !== void 0 || Ve(e.base_, t, e.type_)))
347
+ return !0;
348
+ lt(e), xt(e);
349
+ }
350
+ return e.copy_[t] === n && // special case: handle new props with value 'undefined'
351
+ (n !== void 0 || t in e.copy_) || // special case: NaN
352
+ Number.isNaN(n) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = n, e.assigned_.set(t, !0), $r(e, t, n)), !0;
353
+ },
354
+ deleteProperty(e, t) {
355
+ return lt(e), It(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_.set(t, !1), xt(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0;
356
+ },
357
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
358
+ // the same guarantee in ES5 mode.
359
+ getOwnPropertyDescriptor(e, t) {
360
+ const n = ce(e), r = Reflect.getOwnPropertyDescriptor(n, t);
361
+ return r && {
362
+ [ut]: !0,
363
+ [Mt]: e.type_ !== 1 || t !== "length",
364
+ [ft]: r[ft],
365
+ [je]: n[t]
366
+ };
367
+ },
368
+ defineProperty() {
369
+ W(11);
370
+ },
371
+ getPrototypeOf(e) {
372
+ return Ee(e.base_);
373
+ },
374
+ setPrototypeOf() {
375
+ W(12);
376
+ }
377
+ }, He = {};
378
+ Ne(Xt, (e, t) => {
379
+ He[e] = function() {
380
+ const n = arguments;
381
+ return n[0] = n[0][0], t.apply(this, n);
382
+ };
383
+ });
384
+ He.deleteProperty = function(e, t) {
385
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && W(13), He.set.call(this, e, t, void 0);
386
+ };
387
+ He.set = function(e, t, n) {
388
+ return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && W(14), Xt.set.call(this, e[0], t, n, e[0]);
389
+ };
390
+ function It(e, t) {
391
+ const n = e[B];
392
+ return (n ? ce(n) : e)[t];
393
+ }
394
+ function jr(e, t, n) {
395
+ const r = Yn(t, n);
396
+ return r ? je in r ? r[je] : (
397
+ // This is a very special case, if the prop is a getter defined by the
398
+ // prototype, we should invoke it with the draft as context!
399
+ r.get?.call(e.draft_)
400
+ ) : void 0;
401
+ }
402
+ function Yn(e, t) {
403
+ if (!(t in e))
404
+ return;
405
+ let n = Ee(e);
406
+ for (; n; ) {
407
+ const r = Object.getOwnPropertyDescriptor(n, t);
408
+ if (r)
409
+ return r;
410
+ n = Ee(n);
411
+ }
412
+ }
413
+ function xt(e) {
414
+ e.modified_ || (e.modified_ = !0, e.parent_ && xt(e.parent_));
415
+ }
416
+ function lt(e) {
417
+ e.copy_ || (e.assigned_ = /* @__PURE__ */ new Map(), e.copy_ = Qt(
418
+ e.base_,
419
+ e.scope_.immer_.useStrictShallowCopy_
420
+ ));
421
+ }
422
+ var Kr = class {
423
+ constructor(e) {
424
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (t, n, r) => {
425
+ if (pe(t) && !pe(n)) {
426
+ const a = n;
427
+ n = t;
428
+ const v = this;
429
+ return function(C = a, ...P) {
430
+ return v.produce(C, (T) => n.call(this, T, ...P));
431
+ };
432
+ }
433
+ pe(n) || W(6), r !== void 0 && !pe(r) && W(7);
434
+ let i;
435
+ if (re(t)) {
436
+ const a = dn(this), v = Vt(a, t, void 0);
437
+ let _ = !0;
438
+ try {
439
+ i = n(v), _ = !1;
440
+ } finally {
441
+ _ ? qt(a) : Ft(a);
442
+ }
443
+ return fn(a, r), pn(i, a);
444
+ } else if (!t || !Ae(t)) {
445
+ if (i = n(t), i === void 0 && (i = t), i === Bt && (i = void 0), this.autoFreeze_ && Yt(i, !0), r) {
446
+ const a = [], v = [];
447
+ Ce(ht).generateReplacementPatches_(t, i, {
448
+ patches_: a,
449
+ inversePatches_: v
450
+ }), r(a, v);
451
+ }
452
+ return i;
453
+ } else
454
+ W(1, t);
455
+ }, this.produceWithPatches = (t, n) => {
456
+ if (pe(t))
457
+ return (v, ..._) => this.produceWithPatches(v, (C) => t(C, ..._));
458
+ let r, i;
459
+ return [this.produce(t, n, (v, _) => {
460
+ r = v, i = _;
461
+ }), r, i];
462
+ }, Ot(e?.autoFreeze) && this.setAutoFreeze(e.autoFreeze), Ot(e?.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy), Ot(e?.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
463
+ }
464
+ createDraft(e) {
465
+ re(e) || W(8), Z(e) && (e = Jn(e));
466
+ const t = dn(this), n = Vt(t, e, void 0);
467
+ return n[B].isManual_ = !0, Ft(t), n;
468
+ }
469
+ finishDraft(e, t) {
470
+ const n = e && e[B];
471
+ (!n || !n.isManual_) && W(9);
472
+ const { scope_: r } = n;
473
+ return fn(r, t), pn(void 0, r);
474
+ }
475
+ /**
476
+ * Pass true to automatically freeze all copies created by Immer.
477
+ *
478
+ * By default, auto-freezing is enabled.
479
+ */
480
+ setAutoFreeze(e) {
481
+ this.autoFreeze_ = e;
482
+ }
483
+ /**
484
+ * Pass true to enable strict shallow copy.
485
+ *
486
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
487
+ */
488
+ setUseStrictShallowCopy(e) {
489
+ this.useStrictShallowCopy_ = e;
490
+ }
491
+ /**
492
+ * Pass false to use faster iteration that skips non-enumerable properties
493
+ * but still handles symbols for compatibility.
494
+ *
495
+ * By default, strict iteration is enabled (includes all own properties).
496
+ */
497
+ setUseStrictIteration(e) {
498
+ this.useStrictIteration_ = e;
499
+ }
500
+ shouldUseStrictIteration() {
501
+ return this.useStrictIteration_;
502
+ }
503
+ applyPatches(e, t) {
504
+ let n;
505
+ for (n = t.length - 1; n >= 0; n--) {
506
+ const i = t[n];
507
+ if (i.path.length === 0 && i.op === "replace") {
508
+ e = i.value;
509
+ break;
510
+ }
511
+ }
512
+ n > -1 && (t = t.slice(n + 1));
513
+ const r = Ce(ht).applyPatches_;
514
+ return Z(e) ? r(e, t) : this.produce(
515
+ e,
516
+ (i) => r(i, t)
517
+ );
518
+ }
519
+ };
520
+ function Vt(e, t, n, r) {
521
+ const [i, a] = Xe(t) ? Ce(pt).proxyMap_(t, n) : Ze(t) ? Ce(pt).proxySet_(t, n) : Lr(t, n);
522
+ return (n?.scope_ ?? Hn()).drafts_.push(i), a.callbacks_ = n?.callbacks_ ?? [], a.key_ = r, n && r !== void 0 ? Ur(n, a, r) : a.callbacks_.push(function(C) {
523
+ C.mapSetPlugin_?.fixSetContents(a);
524
+ const { patchPlugin_: P } = C;
525
+ a.modified_ && P && P.generatePatches_(a, [], C);
526
+ }), i;
527
+ }
528
+ function Jn(e) {
529
+ return Z(e) || W(10, e), Xn(e);
530
+ }
531
+ function Xn(e) {
532
+ if (!re(e) || St(e))
533
+ return e;
534
+ const t = e[B];
535
+ let n, r = !0;
536
+ if (t) {
537
+ if (!t.modified_)
538
+ return t.base_;
539
+ t.finalized_ = !0, n = Qt(e, t.scope_.immer_.useStrictShallowCopy_), r = t.scope_.immer_.shouldUseStrictIteration();
540
+ } else
541
+ n = Qt(e, !0);
542
+ return Ne(
543
+ n,
544
+ (i, a) => {
545
+ dt(n, i, Xn(a));
546
+ },
547
+ r
548
+ ), t && (t.finalized_ = !1), n;
549
+ }
550
+ function Hr() {
551
+ process.env.NODE_ENV !== "production" && jn.push(
552
+ 'Sets cannot have "replace" patches.',
553
+ function(d) {
554
+ return "Unsupported patch operation: " + d;
555
+ },
556
+ function(d) {
557
+ return "Cannot apply patch, path doesn't resolve: " + d;
558
+ },
559
+ "Patching reserved attributes like __proto__, prototype and constructor is not allowed"
560
+ );
561
+ function t(d, S = []) {
562
+ if ("key_" in d && d.key_ !== void 0) {
563
+ const p = d.parent_.copy_ ?? d.parent_.base_, w = kr(se(p, d.key_)), O = se(p, d.key_);
564
+ if (O === void 0 || O !== d.draft_ && O !== d.base_ && O !== d.copy_ || w != null && w.base_ !== d.base_)
565
+ return null;
566
+ const f = d.parent_.type_ === 3;
567
+ let g;
568
+ if (f) {
569
+ const o = d.parent_;
570
+ g = Array.from(o.drafts_.keys()).indexOf(d.key_);
571
+ } else
572
+ g = d.key_;
573
+ if (!(f && p.size > g || Ve(p, g)))
574
+ return null;
575
+ S.push(g);
576
+ }
577
+ if (d.parent_)
578
+ return t(d.parent_, S);
579
+ S.reverse();
580
+ try {
581
+ n(d.copy_, S);
582
+ } catch {
583
+ return null;
584
+ }
585
+ return S;
586
+ }
587
+ function n(d, S) {
588
+ let p = d;
589
+ for (let w = 0; w < S.length - 1; w++) {
590
+ const O = S[w];
591
+ if (p = se(p, O), !Ae(p) || p === null)
592
+ throw new Error(`Cannot resolve path at '${S.join("/")}'`);
593
+ }
594
+ return p;
595
+ }
596
+ const r = "replace", i = "add", a = "remove";
597
+ function v(d, S, p) {
598
+ if (d.scope_.processedForPatches_.has(d))
599
+ return;
600
+ d.scope_.processedForPatches_.add(d);
601
+ const { patches_: w, inversePatches_: O } = p;
602
+ switch (d.type_) {
603
+ case 0:
604
+ case 2:
605
+ return C(
606
+ d,
607
+ S,
608
+ w,
609
+ O
610
+ );
611
+ case 1:
612
+ return _(
613
+ d,
614
+ S,
615
+ w,
616
+ O
617
+ );
618
+ case 3:
619
+ return P(
620
+ d,
621
+ S,
622
+ w,
623
+ O
624
+ );
625
+ }
626
+ }
627
+ function _(d, S, p, w) {
628
+ let { base_: O, assigned_: f } = d, g = d.copy_;
629
+ g.length < O.length && ([O, g] = [g, O], [p, w] = [w, p]);
630
+ for (let o = 0; o < O.length; o++) {
631
+ const c = g[o], E = O[o];
632
+ if (f?.get(o.toString()) && c !== E) {
633
+ const b = c?.[B];
634
+ if (b && b.modified_)
635
+ continue;
636
+ const h = S.concat([o]);
637
+ p.push({
638
+ op: r,
639
+ path: h,
640
+ // Need to maybe clone it, as it can in fact be the original value
641
+ // due to the base/copy inversion at the start of this function
642
+ value: R(c)
643
+ }), w.push({
644
+ op: r,
645
+ path: h,
646
+ value: R(E)
647
+ });
648
+ }
649
+ }
650
+ for (let o = O.length; o < g.length; o++) {
651
+ const c = S.concat([o]);
652
+ p.push({
653
+ op: i,
654
+ path: c,
655
+ // Need to maybe clone it, as it can in fact be the original value
656
+ // due to the base/copy inversion at the start of this function
657
+ value: R(g[o])
658
+ });
659
+ }
660
+ for (let o = g.length - 1; O.length <= o; --o) {
661
+ const c = S.concat([o]);
662
+ w.push({
663
+ op: a,
664
+ path: c
665
+ });
666
+ }
667
+ }
668
+ function C(d, S, p, w) {
669
+ const { base_: O, copy_: f, type_: g } = d;
670
+ Ne(d.assigned_, (o, c) => {
671
+ const E = se(O, o, g), b = se(f, o, g), h = c ? Ve(O, o) ? r : i : a;
672
+ if (E === b && h === r)
673
+ return;
674
+ const l = S.concat(o);
675
+ p.push(
676
+ h === a ? { op: h, path: l } : { op: h, path: l, value: R(b) }
677
+ ), w.push(
678
+ h === i ? { op: a, path: l } : h === a ? { op: i, path: l, value: R(E) } : { op: r, path: l, value: R(E) }
679
+ );
680
+ });
681
+ }
682
+ function P(d, S, p, w) {
683
+ let { base_: O, copy_: f } = d, g = 0;
684
+ O.forEach((o) => {
685
+ if (!f.has(o)) {
686
+ const c = S.concat([g]);
687
+ p.push({
688
+ op: a,
689
+ path: c,
690
+ value: o
691
+ }), w.unshift({
692
+ op: i,
693
+ path: c,
694
+ value: o
695
+ });
696
+ }
697
+ g++;
698
+ }), g = 0, f.forEach((o) => {
699
+ if (!O.has(o)) {
700
+ const c = S.concat([g]);
701
+ p.push({
702
+ op: i,
703
+ path: c,
704
+ value: o
705
+ }), w.unshift({
706
+ op: a,
707
+ path: c,
708
+ value: o
709
+ });
710
+ }
711
+ g++;
712
+ });
713
+ }
714
+ function T(d, S, p) {
715
+ const { patches_: w, inversePatches_: O } = p;
716
+ w.push({
717
+ op: r,
718
+ path: [],
719
+ value: S === Bt ? void 0 : S
720
+ }), O.push({
721
+ op: r,
722
+ path: [],
723
+ value: d
724
+ });
725
+ }
726
+ function I(d, S) {
727
+ return S.forEach((p) => {
728
+ const { path: w, op: O } = p;
729
+ let f = d;
730
+ for (let E = 0; E < w.length - 1; E++) {
731
+ const b = we(f);
732
+ let h = w[E];
733
+ typeof h != "string" && typeof h != "number" && (h = "" + h), (b === 0 || b === 1) && (h === "__proto__" || h === Le) && W(19), pe(f) && h === Ye && W(19), f = se(f, h), Ae(f) || W(18, w.join("/"));
734
+ }
735
+ const g = we(f), o = A(p.value), c = w[w.length - 1];
736
+ switch (O) {
737
+ case r:
738
+ switch (g) {
739
+ case 2:
740
+ return f.set(c, o);
741
+ case 3:
742
+ W(16);
743
+ default:
744
+ return f[c] = o;
745
+ }
746
+ case i:
747
+ switch (g) {
748
+ case 1:
749
+ return c === "-" ? f.push(o) : f.splice(c, 0, o);
750
+ case 2:
751
+ return f.set(c, o);
752
+ case 3:
753
+ return f.add(o);
754
+ default:
755
+ return f[c] = o;
756
+ }
757
+ case a:
758
+ switch (g) {
759
+ case 1:
760
+ return f.splice(c, 1);
761
+ case 2:
762
+ return f.delete(c);
763
+ case 3:
764
+ return f.delete(p.value);
765
+ default:
766
+ return delete f[c];
767
+ }
768
+ default:
769
+ W(17, O);
770
+ }
771
+ }), d;
772
+ }
773
+ function A(d) {
774
+ if (!re(d))
775
+ return d;
776
+ if (Je(d))
777
+ return d.map(A);
778
+ if (Xe(d))
779
+ return new Map(
780
+ Array.from(d.entries()).map(([p, w]) => [p, A(w)])
781
+ );
782
+ if (Ze(d))
783
+ return new Set(Array.from(d).map(A));
784
+ const S = Object.create(Ee(d));
785
+ for (const p in d)
786
+ S[p] = A(d[p]);
787
+ return Ve(d, xe) && (S[xe] = d[xe]), S;
788
+ }
789
+ function R(d) {
790
+ return Z(d) ? A(d) : d;
791
+ }
792
+ qr(ht, {
793
+ applyPatches_: I,
794
+ generatePatches_: v,
795
+ generateReplacementPatches_: T,
796
+ getPath: t
797
+ });
798
+ }
799
+ var We = new Kr();
800
+ We.produce;
801
+ var Zn = /* @__PURE__ */ We.produceWithPatches.bind(
802
+ We
803
+ ), yn = /* @__PURE__ */ We.applyPatches.bind(We), Wr = class extends Error {
804
+ /**
805
+ * The schema issues.
806
+ */
807
+ issues;
808
+ /**
809
+ * Creates a schema error with useful information.
810
+ *
811
+ * @param issues The schema issues.
812
+ */
813
+ constructor(e) {
814
+ super(e[0].message), this.name = "SchemaError", this.issues = e;
815
+ }
816
+ }, Br = (e, t, n) => {
817
+ if (t.length === 1 && t[0] === n) {
818
+ let r = !1;
819
+ try {
820
+ const i = {};
821
+ e(i) === i && (r = !0);
822
+ } catch {
823
+ }
824
+ if (r) {
825
+ let i;
826
+ try {
827
+ throw new Error();
828
+ } catch (a) {
829
+ ({ stack: i } = a);
830
+ }
831
+ console.warn(
832
+ `The result function returned its own inputs without modification. e.g
833
+ \`createSelector([state => state.todos], todos => todos)\`
834
+ This could lead to inefficient memoization and unnecessary re-renders.
835
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
836
+ { stack: i }
837
+ );
838
+ }
839
+ }
840
+ }, Gr = (e, t, n) => {
841
+ const { memoize: r, memoizeOptions: i } = t, { inputSelectorResults: a, inputSelectorResultsCopy: v } = e, _ = r(() => ({}), ...i);
842
+ if (!(_.apply(null, a) === _.apply(null, v))) {
843
+ let P;
844
+ try {
845
+ throw new Error();
846
+ } catch (T) {
847
+ ({ stack: P } = T);
848
+ }
849
+ console.warn(
850
+ `An input selector returned a different result when passed same arguments.
851
+ This means your output selector will likely run more frequently than intended.
852
+ Avoid returning a new reference inside your input selector, e.g.
853
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
854
+ {
855
+ arguments: n,
856
+ firstInputs: a,
857
+ secondInputs: v,
858
+ stack: P
859
+ }
860
+ );
861
+ }
862
+ }, Yr = {
863
+ inputStabilityCheck: "once",
864
+ identityFunctionCheck: "once"
865
+ };
866
+ function Jr(e, t = `expected a function, instead received ${typeof e}`) {
867
+ if (typeof e != "function")
868
+ throw new TypeError(t);
869
+ }
870
+ function Xr(e, t = `expected an object, instead received ${typeof e}`) {
871
+ if (typeof e != "object")
872
+ throw new TypeError(t);
873
+ }
874
+ function Zr(e, t = "expected all items to be functions, instead received the following types: ") {
875
+ if (!e.every((n) => typeof n == "function")) {
876
+ const n = e.map(
877
+ (r) => typeof r == "function" ? `function ${r.name || "unnamed"}()` : typeof r
878
+ ).join(", ");
879
+ throw new TypeError(`${t}[${n}]`);
880
+ }
881
+ }
882
+ var gn = (e) => Array.isArray(e) ? e : [e];
883
+ function ei(e) {
884
+ const t = Array.isArray(e[0]) ? e[0] : e;
885
+ return Zr(
886
+ t,
887
+ "createSelector expects all input-selectors to be functions, but received the following types: "
888
+ ), t;
889
+ }
890
+ function mn(e, t) {
891
+ const n = [], { length: r } = e;
892
+ for (let i = 0; i < r; i++)
893
+ n.push(e[i].apply(null, t));
894
+ return n;
895
+ }
896
+ var ti = (e, t) => {
897
+ const { identityFunctionCheck: n, inputStabilityCheck: r } = {
898
+ ...Yr,
899
+ ...t
900
+ };
901
+ return {
902
+ identityFunctionCheck: {
903
+ shouldRun: n === "always" || n === "once" && e,
904
+ run: Br
905
+ },
906
+ inputStabilityCheck: {
907
+ shouldRun: r === "always" || r === "once" && e,
908
+ run: Gr
909
+ }
910
+ };
911
+ }, ni = class {
912
+ constructor(e) {
913
+ this.value = e;
914
+ }
915
+ deref() {
916
+ return this.value;
917
+ }
918
+ }, ri = typeof WeakRef < "u" ? WeakRef : ni, ii = 0, vn = 1;
919
+ function it() {
920
+ return {
921
+ s: ii,
922
+ v: void 0,
923
+ o: null,
924
+ p: null
925
+ };
926
+ }
927
+ function gt(e, t = {}) {
928
+ let n = it();
929
+ const { resultEqualityCheck: r } = t;
930
+ let i, a = 0;
931
+ function v() {
932
+ let _ = n;
933
+ const { length: C } = arguments;
934
+ for (let I = 0, A = C; I < A; I++) {
935
+ const R = arguments[I];
936
+ if (typeof R == "function" || typeof R == "object" && R !== null) {
937
+ let d = _.o;
938
+ d === null && (_.o = d = /* @__PURE__ */ new WeakMap());
939
+ const S = d.get(R);
940
+ S === void 0 ? (_ = it(), d.set(R, _)) : _ = S;
941
+ } else {
942
+ let d = _.p;
943
+ d === null && (_.p = d = /* @__PURE__ */ new Map());
944
+ const S = d.get(R);
945
+ S === void 0 ? (_ = it(), d.set(R, _)) : _ = S;
946
+ }
947
+ }
948
+ const P = _;
949
+ let T;
950
+ if (_.s === vn)
951
+ T = _.v;
952
+ else if (T = e.apply(null, arguments), a++, r) {
953
+ const I = i?.deref?.() ?? i;
954
+ I != null && r(I, T) && (T = I, a !== 0 && a--), i = typeof T == "object" && T !== null || typeof T == "function" ? new ri(T) : T;
955
+ }
956
+ return P.s = vn, P.v = T, T;
957
+ }
958
+ return v.clearCache = () => {
959
+ n = it(), v.resetResultsCount();
960
+ }, v.resultsCount = () => a, v.resetResultsCount = () => {
961
+ a = 0;
962
+ }, v;
963
+ }
964
+ function oi(e, ...t) {
965
+ const n = typeof e == "function" ? {
966
+ memoize: e,
967
+ memoizeOptions: t
968
+ } : e, r = (...i) => {
969
+ let a = 0, v = 0, _, C = {}, P = i.pop();
970
+ typeof P == "object" && (C = P, P = i.pop()), Jr(
971
+ P,
972
+ `createSelector expects an output function after the inputs, but received: [${typeof P}]`
973
+ );
974
+ const T = {
975
+ ...n,
976
+ ...C
977
+ }, {
978
+ memoize: I,
979
+ memoizeOptions: A = [],
980
+ argsMemoize: R = gt,
981
+ argsMemoizeOptions: d = [],
982
+ devModeChecks: S = {}
983
+ } = T, p = gn(A), w = gn(d), O = ei(i), f = I(function() {
984
+ return a++, P.apply(
985
+ null,
986
+ arguments
987
+ );
988
+ }, ...p);
989
+ let g = !0;
990
+ const o = R(function() {
991
+ v++;
992
+ const E = mn(
993
+ O,
994
+ arguments
995
+ );
996
+ if (_ = f.apply(null, E), process.env.NODE_ENV !== "production") {
997
+ const { identityFunctionCheck: b, inputStabilityCheck: h } = ti(g, S);
998
+ if (b.shouldRun && b.run(
999
+ P,
1000
+ E,
1001
+ _
1002
+ ), h.shouldRun) {
1003
+ const l = mn(
1004
+ O,
1005
+ arguments
1006
+ );
1007
+ h.run(
1008
+ { inputSelectorResults: E, inputSelectorResultsCopy: l },
1009
+ { memoize: I, memoizeOptions: p },
1010
+ arguments
1011
+ );
1012
+ }
1013
+ g && (g = !1);
1014
+ }
1015
+ return _;
1016
+ }, ...w);
1017
+ return Object.assign(o, {
1018
+ resultFunc: P,
1019
+ memoizedResultFunc: f,
1020
+ dependencies: O,
1021
+ dependencyRecomputations: () => v,
1022
+ resetDependencyRecomputations: () => {
1023
+ v = 0;
1024
+ },
1025
+ lastResult: () => _,
1026
+ recomputations: () => a,
1027
+ resetRecomputations: () => {
1028
+ a = 0;
1029
+ },
1030
+ memoize: I,
1031
+ argsMemoize: R
1032
+ });
1033
+ };
1034
+ return Object.assign(r, {
1035
+ withTypes: () => r
1036
+ }), r;
1037
+ }
1038
+ var er = /* @__PURE__ */ oi(gt), si = Object.assign(
1039
+ (e, t = er) => {
1040
+ Xr(
1041
+ e,
1042
+ `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`
1043
+ );
1044
+ const n = Object.keys(e), r = n.map(
1045
+ (a) => e[a]
1046
+ );
1047
+ return t(
1048
+ r,
1049
+ (...a) => a.reduce((v, _, C) => (v[n[C]] = _, v), {})
1050
+ );
1051
+ },
1052
+ { withTypes: () => si }
1053
+ ), tr = /* @__PURE__ */ ((e) => (e.uninitialized = "uninitialized", e.pending = "pending", e.fulfilled = "fulfilled", e.rejected = "rejected", e))(tr || {}), ae = "uninitialized", zt = "pending", qe = "fulfilled", Fe = "rejected";
1054
+ function Sn(e) {
1055
+ return {
1056
+ status: e,
1057
+ isUninitialized: e === ae,
1058
+ isLoading: e === zt,
1059
+ isSuccess: e === qe,
1060
+ isError: e === Fe
1061
+ };
1062
+ }
1063
+ var bn = Ue;
1064
+ function Zt(e, t) {
1065
+ if (e === t || !(bn(e) && bn(t) || Array.isArray(e) && Array.isArray(t)))
1066
+ return t;
1067
+ const n = Object.keys(t), r = Object.keys(e);
1068
+ let i = n.length === r.length;
1069
+ const a = Array.isArray(t) ? [] : {};
1070
+ for (const v of n)
1071
+ a[v] = Zt(e[v], t[v]), i && (i = e[v] === a[v]);
1072
+ return i ? e : a;
1073
+ }
1074
+ function Ut(e, t, n) {
1075
+ return e.reduce((r, i, a) => (t(i, a) && r.push(n(i, a)), r), []).flat();
1076
+ }
1077
+ function ci(e) {
1078
+ return new RegExp("(^|:)//").test(e);
1079
+ }
1080
+ function ai() {
1081
+ return typeof document > "u" ? !0 : document.visibilityState !== "hidden";
1082
+ }
1083
+ function en(e) {
1084
+ return e != null;
1085
+ }
1086
+ function _n(e) {
1087
+ return [...e?.values() ?? []].filter(en);
1088
+ }
1089
+ function ui() {
1090
+ return typeof navigator > "u" || navigator.onLine === void 0 ? !0 : navigator.onLine;
1091
+ }
1092
+ var li = (e) => e.replace(/\/$/, ""), fi = (e) => e.replace(/^\//, "");
1093
+ function di(e, t) {
1094
+ if (!e)
1095
+ return t;
1096
+ if (!t)
1097
+ return e;
1098
+ if (ci(t))
1099
+ return t;
1100
+ const n = e.endsWith("/") || !t.startsWith("?") ? "/" : "";
1101
+ return e = li(e), t = fi(t), `${e}${n}${t}`;
1102
+ }
1103
+ function mt(e, t, n) {
1104
+ return e.has(t) ? e.get(t) : e.set(t, n(t)).get(t);
1105
+ }
1106
+ var $t = () => /* @__PURE__ */ new Map(), En = (...e) => fetch(...e), pi = (e) => e.status >= 200 && e.status <= 299, hi = (e) => (
1107
+ /*applicat*/
1108
+ /ion\/(vnd\.api\+)?json/.test(e.get("content-type") || "")
1109
+ );
1110
+ function wn(e) {
1111
+ if (!Ue(e))
1112
+ return e;
1113
+ const t = {
1114
+ ...e
1115
+ };
1116
+ for (const [n, r] of Object.entries(t))
1117
+ r === void 0 && delete t[n];
1118
+ return t;
1119
+ }
1120
+ var yi = (e) => typeof e == "object" && (Ue(e) || Array.isArray(e) || typeof e.toJSON == "function");
1121
+ function gi({
1122
+ baseUrl: e,
1123
+ prepareHeaders: t = (I) => I,
1124
+ fetchFn: n = En,
1125
+ paramsSerializer: r,
1126
+ isJsonContentType: i = hi,
1127
+ jsonContentType: a = "application/json",
1128
+ jsonReplacer: v,
1129
+ timeout: _,
1130
+ responseHandler: C,
1131
+ validateStatus: P,
1132
+ ...T
1133
+ } = {}) {
1134
+ return typeof fetch > "u" && n === En && console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."), async (A, R, d) => {
1135
+ const {
1136
+ getState: S,
1137
+ extra: p,
1138
+ endpoint: w,
1139
+ forced: O,
1140
+ type: f
1141
+ } = R;
1142
+ let g, {
1143
+ url: o,
1144
+ headers: c = new Headers(T.headers),
1145
+ params: E = void 0,
1146
+ responseHandler: b = C ?? "json",
1147
+ validateStatus: h = P ?? pi,
1148
+ timeout: l = _,
1149
+ ...s
1150
+ } = typeof A == "string" ? {
1151
+ url: A
1152
+ } : A, u, y = R.signal;
1153
+ l && (u = new AbortController(), R.signal.addEventListener("abort", u.abort), y = u.signal);
1154
+ let m = {
1155
+ ...T,
1156
+ signal: y,
1157
+ ...s
1158
+ };
1159
+ c = new Headers(wn(c)), m.headers = await t(c, {
1160
+ getState: S,
1161
+ arg: A,
1162
+ extra: p,
1163
+ endpoint: w,
1164
+ forced: O,
1165
+ type: f,
1166
+ extraOptions: d
1167
+ }) || c;
1168
+ const N = yi(m.body);
1169
+ if (m.body != null && !N && typeof m.body != "string" && m.headers.delete("content-type"), !m.headers.has("content-type") && N && m.headers.set("content-type", a), N && i(m.headers) && (m.body = JSON.stringify(m.body, v)), m.headers.has("accept") || (b === "json" ? m.headers.set("accept", "application/json") : b === "text" && m.headers.set("accept", "text/plain, text/html, */*")), E) {
1170
+ const q = ~o.indexOf("?") ? "&" : "?", j = r ? r(E) : new URLSearchParams(wn(E));
1171
+ o += q + j;
1172
+ }
1173
+ o = di(e, o);
1174
+ const M = new Request(o, m);
1175
+ g = {
1176
+ request: new Request(o, m)
1177
+ };
1178
+ let k, D = !1, Q = u && setTimeout(() => {
1179
+ D = !0, u.abort();
1180
+ }, l);
1181
+ try {
1182
+ k = await n(M);
1183
+ } catch (q) {
1184
+ return {
1185
+ error: {
1186
+ status: D ? "TIMEOUT_ERROR" : "FETCH_ERROR",
1187
+ error: String(q)
1188
+ },
1189
+ meta: g
1190
+ };
1191
+ } finally {
1192
+ Q && clearTimeout(Q), u?.signal.removeEventListener("abort", u.abort);
1193
+ }
1194
+ const V = k.clone();
1195
+ g.response = V;
1196
+ let L, K = "";
1197
+ try {
1198
+ let q;
1199
+ if (await Promise.all([
1200
+ I(k, b).then((j) => L = j, (j) => q = j),
1201
+ // see https://github.com/node-fetch/node-fetch/issues/665#issuecomment-538995182
1202
+ // we *have* to "use up" both streams at the same time or they will stop running in node-fetch scenarios
1203
+ V.text().then((j) => K = j, () => {
1204
+ })
1205
+ ]), q) throw q;
1206
+ } catch (q) {
1207
+ return {
1208
+ error: {
1209
+ status: "PARSING_ERROR",
1210
+ originalStatus: k.status,
1211
+ data: K,
1212
+ error: String(q)
1213
+ },
1214
+ meta: g
1215
+ };
1216
+ }
1217
+ return h(k, L) ? {
1218
+ data: L,
1219
+ meta: g
1220
+ } : {
1221
+ error: {
1222
+ status: k.status,
1223
+ data: L
1224
+ },
1225
+ meta: g
1226
+ };
1227
+ };
1228
+ async function I(A, R) {
1229
+ if (typeof R == "function")
1230
+ return R(A);
1231
+ if (R === "content-type" && (R = i(A.headers) ? "json" : "text"), R === "json") {
1232
+ const d = await A.text();
1233
+ return d.length ? JSON.parse(d) : null;
1234
+ }
1235
+ return A.text();
1236
+ }
1237
+ }
1238
+ var Pn = class {
1239
+ constructor(e, t = void 0) {
1240
+ this.value = e, this.meta = t;
1241
+ }
1242
+ }, _t = "__rtkq/", mi = "online", vi = "offline", nr = "focused", tn = /* @__PURE__ */ De(`${_t}${nr}`), rr = /* @__PURE__ */ De(`${_t}un${nr}`), nn = /* @__PURE__ */ De(`${_t}${mi}`), ir = /* @__PURE__ */ De(`${_t}${vi}`), et = "query", or = "mutation", sr = "infinitequery";
1243
+ function Et(e) {
1244
+ return e.type === et;
1245
+ }
1246
+ function Si(e) {
1247
+ return e.type === or;
1248
+ }
1249
+ function tt(e) {
1250
+ return e.type === sr;
1251
+ }
1252
+ function vt(e) {
1253
+ return Et(e) || tt(e);
1254
+ }
1255
+ function rn(e, t, n, r, i, a) {
1256
+ const v = bi(e) ? e(t, n, r, i) : e;
1257
+ return v ? Ut(v, en, (_) => a(cr(_))) : [];
1258
+ }
1259
+ function bi(e) {
1260
+ return typeof e == "function";
1261
+ }
1262
+ function cr(e) {
1263
+ return typeof e == "string" ? {
1264
+ type: e
1265
+ } : e;
1266
+ }
1267
+ function _i(e, t) {
1268
+ return e.catch(t);
1269
+ }
1270
+ var Te = (e, t) => e.endpointDefinitions[t], Be = Symbol("forceQueryFn"), Lt = (e) => typeof e[Be] == "function";
1271
+ function Ei({
1272
+ serializeQueryArgs: e,
1273
+ queryThunk: t,
1274
+ infiniteQueryThunk: n,
1275
+ mutationThunk: r,
1276
+ api: i,
1277
+ context: a,
1278
+ getInternalState: v
1279
+ }) {
1280
+ const _ = (o) => v(o)?.runningQueries, C = (o) => v(o)?.runningMutations, {
1281
+ unsubscribeQueryResult: P,
1282
+ removeMutationResult: T,
1283
+ updateSubscriptionOptions: I
1284
+ } = i.internalActions;
1285
+ return {
1286
+ buildInitiateQuery: O,
1287
+ buildInitiateInfiniteQuery: f,
1288
+ buildInitiateMutation: g,
1289
+ getRunningQueryThunk: A,
1290
+ getRunningMutationThunk: R,
1291
+ getRunningQueriesThunk: d,
1292
+ getRunningMutationsThunk: S
1293
+ };
1294
+ function A(o, c) {
1295
+ return (E) => {
1296
+ const b = Te(a, o), h = e({
1297
+ queryArgs: c,
1298
+ endpointDefinition: b,
1299
+ endpointName: o
1300
+ });
1301
+ return _(E)?.get(h);
1302
+ };
1303
+ }
1304
+ function R(o, c) {
1305
+ return (E) => C(E)?.get(c);
1306
+ }
1307
+ function d() {
1308
+ return (o) => _n(_(o));
1309
+ }
1310
+ function S() {
1311
+ return (o) => _n(C(o));
1312
+ }
1313
+ function p(o) {
1314
+ if (process.env.NODE_ENV !== "production") {
1315
+ if (p.triggered) return;
1316
+ const c = o(i.internalActions.internal_getRTKQSubscriptions());
1317
+ if (p.triggered = !0, typeof c != "object" || typeof c?.type == "string")
1318
+ throw new Error(process.env.NODE_ENV === "production" ? ye(34) : `Warning: Middleware for RTK-Query API at reducerPath "${i.reducerPath}" has not been added to the store.
1319
+ You must add the middleware for RTK-Query to function correctly!`);
1320
+ }
1321
+ }
1322
+ function w(o, c) {
1323
+ const E = (b, {
1324
+ subscribe: h = !0,
1325
+ forceRefetch: l,
1326
+ subscriptionOptions: s,
1327
+ [Be]: u,
1328
+ ...y
1329
+ } = {}) => (m, N) => {
1330
+ const M = e({
1331
+ queryArgs: b,
1332
+ endpointDefinition: c,
1333
+ endpointName: o
1334
+ });
1335
+ let F;
1336
+ const k = {
1337
+ ...y,
1338
+ type: et,
1339
+ subscribe: h,
1340
+ forceRefetch: l,
1341
+ subscriptionOptions: s,
1342
+ endpointName: o,
1343
+ originalArgs: b,
1344
+ queryCacheKey: M,
1345
+ [Be]: u
1346
+ };
1347
+ if (Et(c))
1348
+ F = t(k);
1349
+ else {
1350
+ const {
1351
+ direction: $,
1352
+ initialPageParam: z,
1353
+ refetchCachedPages: x
1354
+ } = y;
1355
+ F = n({
1356
+ ...k,
1357
+ // Supply these even if undefined. This helps with a field existence
1358
+ // check over in `buildSlice.ts`
1359
+ direction: $,
1360
+ initialPageParam: z,
1361
+ refetchCachedPages: x
1362
+ });
1363
+ }
1364
+ const D = i.endpoints[o].select(b), Q = m(F), V = D(N());
1365
+ p(m);
1366
+ const {
1367
+ requestId: L,
1368
+ abort: K
1369
+ } = Q, q = V.requestId !== L, j = _(m)?.get(M), H = () => D(N()), U = Object.assign(u ? (
1370
+ // a query has been forced (upsertQueryData)
1371
+ // -> we want to resolve it once data has been written with the data that will be written
1372
+ Q.then(H)
1373
+ ) : q && !j ? (
1374
+ // a query has been skipped due to a condition and we do not have any currently running query
1375
+ // -> we want to resolve it immediately with the current data
1376
+ Promise.resolve(V)
1377
+ ) : (
1378
+ // query just started or one is already in flight
1379
+ // -> wait for the running query, then resolve with data from after that
1380
+ Promise.all([j, Q]).then(H)
1381
+ ), {
1382
+ arg: b,
1383
+ requestId: L,
1384
+ subscriptionOptions: s,
1385
+ queryCacheKey: M,
1386
+ abort: K,
1387
+ async unwrap() {
1388
+ const $ = await U;
1389
+ if ($.isError)
1390
+ throw $.error;
1391
+ return $.data;
1392
+ },
1393
+ refetch: ($) => m(E(b, {
1394
+ subscribe: !1,
1395
+ forceRefetch: !0,
1396
+ ...$
1397
+ })),
1398
+ unsubscribe() {
1399
+ h && m(P({
1400
+ queryCacheKey: M,
1401
+ requestId: L
1402
+ }));
1403
+ },
1404
+ updateSubscriptionOptions($) {
1405
+ U.subscriptionOptions = $, m(I({
1406
+ endpointName: o,
1407
+ requestId: L,
1408
+ queryCacheKey: M,
1409
+ options: $
1410
+ }));
1411
+ }
1412
+ });
1413
+ if (!j && !q && !u) {
1414
+ const $ = _(m);
1415
+ $.set(M, U), U.then(() => {
1416
+ $.delete(M);
1417
+ });
1418
+ }
1419
+ return U;
1420
+ };
1421
+ return E;
1422
+ }
1423
+ function O(o, c) {
1424
+ return w(o, c);
1425
+ }
1426
+ function f(o, c) {
1427
+ return w(o, c);
1428
+ }
1429
+ function g(o) {
1430
+ return (c, {
1431
+ track: E = !0,
1432
+ fixedCacheKey: b
1433
+ } = {}) => (h, l) => {
1434
+ const s = r({
1435
+ type: "mutation",
1436
+ endpointName: o,
1437
+ originalArgs: c,
1438
+ track: E,
1439
+ fixedCacheKey: b
1440
+ }), u = h(s);
1441
+ p(h);
1442
+ const {
1443
+ requestId: y,
1444
+ abort: m,
1445
+ unwrap: N
1446
+ } = u, M = _i(u.unwrap().then((Q) => ({
1447
+ data: Q
1448
+ })), (Q) => ({
1449
+ error: Q
1450
+ })), F = () => {
1451
+ h(T({
1452
+ requestId: y,
1453
+ fixedCacheKey: b
1454
+ }));
1455
+ }, k = Object.assign(M, {
1456
+ arg: u.arg,
1457
+ requestId: y,
1458
+ abort: m,
1459
+ unwrap: N,
1460
+ reset: F
1461
+ }), D = C(h);
1462
+ return D.set(y, k), k.then(() => {
1463
+ D.delete(y);
1464
+ }), b && (D.set(b, k), k.then(() => {
1465
+ D.get(b) === k && D.delete(b);
1466
+ })), k;
1467
+ };
1468
+ }
1469
+ }
1470
+ var ar = class extends Wr {
1471
+ constructor(e, t, n, r) {
1472
+ super(e), this.value = t, this.schemaName = n, this._bqMeta = r;
1473
+ }
1474
+ }, me = (e, t) => Array.isArray(e) ? e.includes(t) : !!e;
1475
+ async function ve(e, t, n, r) {
1476
+ const i = await e["~standard"].validate(t);
1477
+ if (i.issues)
1478
+ throw new ar(i.issues, t, n, r);
1479
+ return i.value;
1480
+ }
1481
+ function Rn(e) {
1482
+ return e;
1483
+ }
1484
+ var Me = (e = {}) => ({
1485
+ ...e,
1486
+ [Un]: !0
1487
+ });
1488
+ function wi({
1489
+ reducerPath: e,
1490
+ baseQuery: t,
1491
+ context: {
1492
+ endpointDefinitions: n
1493
+ },
1494
+ serializeQueryArgs: r,
1495
+ api: i,
1496
+ assertTagType: a,
1497
+ selectors: v,
1498
+ onSchemaFailure: _,
1499
+ catchSchemaFailure: C,
1500
+ skipSchemaValidation: P
1501
+ }) {
1502
+ const T = (s, u, y, m) => (N, M) => {
1503
+ const F = n[s], k = r({
1504
+ queryArgs: u,
1505
+ endpointDefinition: F,
1506
+ endpointName: s
1507
+ });
1508
+ if (N(i.internalActions.queryResultPatched({
1509
+ queryCacheKey: k,
1510
+ patches: y
1511
+ })), !m)
1512
+ return;
1513
+ const D = i.endpoints[s].select(u)(
1514
+ // Work around TS 4.1 mismatch
1515
+ M()
1516
+ ), Q = rn(F.providesTags, D.data, void 0, u, {}, a);
1517
+ N(i.internalActions.updateProvidedBy([{
1518
+ queryCacheKey: k,
1519
+ providedTags: Q
1520
+ }]));
1521
+ };
1522
+ function I(s, u, y = 0) {
1523
+ const m = [u, ...s];
1524
+ return y && m.length > y ? m.slice(0, -1) : m;
1525
+ }
1526
+ function A(s, u, y = 0) {
1527
+ const m = [...s, u];
1528
+ return y && m.length > y ? m.slice(1) : m;
1529
+ }
1530
+ const R = (s, u, y, m = !0) => (N, M) => {
1531
+ const k = i.endpoints[s].select(u)(
1532
+ // Work around TS 4.1 mismatch
1533
+ M()
1534
+ ), D = {
1535
+ patches: [],
1536
+ inversePatches: [],
1537
+ undo: () => N(i.util.patchQueryData(s, u, D.inversePatches, m))
1538
+ };
1539
+ if (k.status === ae)
1540
+ return D;
1541
+ let Q;
1542
+ if ("data" in k)
1543
+ if (re(k.data)) {
1544
+ const [V, L, K] = Zn(k.data, y);
1545
+ D.patches.push(...L), D.inversePatches.push(...K), Q = V;
1546
+ } else
1547
+ Q = y(k.data), D.patches.push({
1548
+ op: "replace",
1549
+ path: [],
1550
+ value: Q
1551
+ }), D.inversePatches.push({
1552
+ op: "replace",
1553
+ path: [],
1554
+ value: k.data
1555
+ });
1556
+ return D.patches.length === 0 || N(i.util.patchQueryData(s, u, D.patches, m)), D;
1557
+ }, d = (s, u, y) => (m) => m(i.endpoints[s].initiate(u, {
1558
+ subscribe: !1,
1559
+ forceRefetch: !0,
1560
+ [Be]: () => ({
1561
+ data: y
1562
+ })
1563
+ })), S = (s, u) => s.query && s[u] ? s[u] : Rn, p = async (s, {
1564
+ signal: u,
1565
+ abort: y,
1566
+ rejectWithValue: m,
1567
+ fulfillWithValue: N,
1568
+ dispatch: M,
1569
+ getState: F,
1570
+ extra: k
1571
+ }) => {
1572
+ const D = n[s.endpointName], {
1573
+ metaSchema: Q,
1574
+ skipSchemaValidation: V = P
1575
+ } = D, L = s.type === et;
1576
+ try {
1577
+ let K = Rn;
1578
+ const q = {
1579
+ signal: u,
1580
+ abort: y,
1581
+ dispatch: M,
1582
+ getState: F,
1583
+ extra: k,
1584
+ endpoint: s.endpointName,
1585
+ type: s.type,
1586
+ forced: L ? w(s, F()) : void 0,
1587
+ queryCacheKey: L ? s.queryCacheKey : void 0
1588
+ }, j = L ? s[Be] : void 0;
1589
+ let H;
1590
+ const U = async (z, x, ne, Y) => {
1591
+ if (x == null && z.pages.length)
1592
+ return Promise.resolve({
1593
+ data: z
1594
+ });
1595
+ const Re = {
1596
+ queryArg: s.originalArgs,
1597
+ pageParam: x
1598
+ }, ie = await $(Re), Oe = Y ? I : A;
1599
+ return {
1600
+ data: {
1601
+ pages: Oe(z.pages, ie.data, ne),
1602
+ pageParams: Oe(z.pageParams, x, ne)
1603
+ },
1604
+ meta: ie.meta
1605
+ };
1606
+ };
1607
+ async function $(z) {
1608
+ let x;
1609
+ const {
1610
+ extraOptions: ne,
1611
+ argSchema: Y,
1612
+ rawResponseSchema: Re,
1613
+ responseSchema: ie
1614
+ } = D;
1615
+ if (Y && !me(V, "arg") && (z = await ve(
1616
+ Y,
1617
+ z,
1618
+ "argSchema",
1619
+ {}
1620
+ // we don't have a meta yet, so we can't pass it
1621
+ )), j ? x = j() : D.query ? (K = S(D, "transformResponse"), x = await t(D.query(z), q, ne)) : x = await D.queryFn(z, q, ne, (X) => t(X, q, ne)), typeof process < "u" && process.env.NODE_ENV === "development") {
1622
+ const X = D.query ? "`baseQuery`" : "`queryFn`";
1623
+ let ee;
1624
+ if (!x)
1625
+ ee = `${X} did not return anything.`;
1626
+ else if (typeof x != "object")
1627
+ ee = `${X} did not return an object.`;
1628
+ else if (x.error && x.data)
1629
+ ee = `${X} returned an object containing both \`error\` and \`result\`.`;
1630
+ else if (x.error === void 0 && x.data === void 0)
1631
+ ee = `${X} returned an object containing neither a valid \`error\` and \`result\`. At least one of them should not be \`undefined\``;
1632
+ else
1633
+ for (const le of Object.keys(x))
1634
+ if (le !== "error" && le !== "data" && le !== "meta") {
1635
+ ee = `The object returned by ${X} has the unknown property ${le}.`;
1636
+ break;
1637
+ }
1638
+ ee && console.error(`Error encountered handling the endpoint ${s.endpointName}.
1639
+ ${ee}
1640
+ It needs to return an object with either the shape \`{ data: <value> }\` or \`{ error: <value> }\` that may contain an optional \`meta\` property.
1641
+ Object returned was:`, x);
1642
+ }
1643
+ if (x.error) throw new Pn(x.error, x.meta);
1644
+ let {
1645
+ data: Oe
1646
+ } = x;
1647
+ Re && !me(V, "rawResponse") && (Oe = await ve(Re, x.data, "rawResponseSchema", x.meta));
1648
+ let ue = await K(Oe, x.meta, z);
1649
+ return ie && !me(V, "response") && (ue = await ve(ie, ue, "responseSchema", x.meta)), {
1650
+ ...x,
1651
+ data: ue
1652
+ };
1653
+ }
1654
+ if (L && "infiniteQueryOptions" in D) {
1655
+ const {
1656
+ infiniteQueryOptions: z
1657
+ } = D, {
1658
+ maxPages: x = 1 / 0
1659
+ } = z, ne = s.refetchCachedPages ?? z.refetchCachedPages ?? !0;
1660
+ let Y;
1661
+ const Re = {
1662
+ pages: [],
1663
+ pageParams: []
1664
+ }, ie = v.selectQueryEntry(F(), s.queryCacheKey)?.data, ue = /* arg.forceRefetch */ w(s, F()) && !s.direction || !ie ? Re : ie;
1665
+ if ("direction" in s && s.direction && ue.pages.length) {
1666
+ const X = s.direction === "backward", le = (X ? ur : jt)(z, ue, s.originalArgs);
1667
+ Y = await U(ue, le, x, X);
1668
+ } else {
1669
+ const {
1670
+ initialPageParam: X = z.initialPageParam
1671
+ } = s, ee = ie?.pageParams ?? [], le = ee[0] ?? X, wr = ee.length;
1672
+ if (Y = await U(ue, le, x), j && (Y = {
1673
+ data: Y.data.pages[0]
1674
+ }), ne)
1675
+ for (let sn = 1; sn < wr; sn++) {
1676
+ const Pr = jt(z, Y.data, s.originalArgs);
1677
+ Y = await U(Y.data, Pr, x);
1678
+ }
1679
+ }
1680
+ H = Y;
1681
+ } else
1682
+ H = await $(s.originalArgs);
1683
+ return Q && !me(V, "meta") && H.meta && (H.meta = await ve(Q, H.meta, "metaSchema", H.meta)), N(H.data, Me({
1684
+ fulfilledTimeStamp: Date.now(),
1685
+ baseQueryMeta: H.meta
1686
+ }));
1687
+ } catch (K) {
1688
+ let q = K;
1689
+ if (q instanceof Pn) {
1690
+ let j = S(D, "transformErrorResponse");
1691
+ const {
1692
+ rawErrorResponseSchema: H,
1693
+ errorResponseSchema: U
1694
+ } = D;
1695
+ let {
1696
+ value: $,
1697
+ meta: z
1698
+ } = q;
1699
+ try {
1700
+ H && !me(V, "rawErrorResponse") && ($ = await ve(H, $, "rawErrorResponseSchema", z)), Q && !me(V, "meta") && (z = await ve(Q, z, "metaSchema", z));
1701
+ let x = await j($, z, s.originalArgs);
1702
+ return U && !me(V, "errorResponse") && (x = await ve(U, x, "errorResponseSchema", z)), m(x, Me({
1703
+ baseQueryMeta: z
1704
+ }));
1705
+ } catch (x) {
1706
+ q = x;
1707
+ }
1708
+ }
1709
+ try {
1710
+ if (q instanceof ar) {
1711
+ const j = {
1712
+ endpoint: s.endpointName,
1713
+ arg: s.originalArgs,
1714
+ type: s.type,
1715
+ queryCacheKey: L ? s.queryCacheKey : void 0
1716
+ };
1717
+ D.onSchemaFailure?.(q, j), _?.(q, j);
1718
+ const {
1719
+ catchSchemaFailure: H = C
1720
+ } = D;
1721
+ if (H)
1722
+ return m(H(q, j), Me({
1723
+ baseQueryMeta: q._bqMeta
1724
+ }));
1725
+ }
1726
+ } catch (j) {
1727
+ q = j;
1728
+ }
1729
+ throw typeof process < "u" && process.env.NODE_ENV !== "production" ? console.error(`An unhandled error occurred processing a request for the endpoint "${s.endpointName}".
1730
+ In the case of an unhandled error, no tags will be "provided" or "invalidated".`, q) : console.error(q), q;
1731
+ }
1732
+ };
1733
+ function w(s, u) {
1734
+ const y = v.selectQueryEntry(u, s.queryCacheKey), m = v.selectConfig(u).refetchOnMountOrArgChange, N = y?.fulfilledTimeStamp, M = s.forceRefetch ?? (s.subscribe && m);
1735
+ return M ? M === !0 || (Number(/* @__PURE__ */ new Date()) - Number(N)) / 1e3 >= M : !1;
1736
+ }
1737
+ const O = () => cn(`${e}/executeQuery`, p, {
1738
+ getPendingMeta({
1739
+ arg: u
1740
+ }) {
1741
+ const y = n[u.endpointName];
1742
+ return Me({
1743
+ startedTimeStamp: Date.now(),
1744
+ ...tt(y) ? {
1745
+ direction: u.direction
1746
+ } : {}
1747
+ });
1748
+ },
1749
+ condition(u, {
1750
+ getState: y
1751
+ }) {
1752
+ const m = y(), N = v.selectQueryEntry(m, u.queryCacheKey), M = N?.fulfilledTimeStamp, F = u.originalArgs, k = N?.originalArgs, D = n[u.endpointName], Q = u.direction;
1753
+ return Lt(u) ? !0 : N?.status === "pending" ? !1 : w(u, m) || Et(D) && D?.forceRefetch?.({
1754
+ currentArg: F,
1755
+ previousArg: k,
1756
+ endpointState: N,
1757
+ state: m
1758
+ }) ? !0 : !(M && !Q);
1759
+ },
1760
+ dispatchConditionRejection: !0
1761
+ }), f = O(), g = O(), o = cn(`${e}/executeMutation`, p, {
1762
+ getPendingMeta() {
1763
+ return Me({
1764
+ startedTimeStamp: Date.now()
1765
+ });
1766
+ }
1767
+ }), c = (s) => "force" in s, E = (s) => "ifOlderThan" in s, b = (s, u, y = {}) => (m, N) => {
1768
+ const M = c(y) && y.force, F = E(y) && y.ifOlderThan, k = (Q = !0) => {
1769
+ const V = {
1770
+ forceRefetch: Q,
1771
+ subscribe: !1
1772
+ };
1773
+ return i.endpoints[s].initiate(u, V);
1774
+ }, D = i.endpoints[s].select(u)(N());
1775
+ if (M)
1776
+ m(k());
1777
+ else if (F) {
1778
+ const Q = D?.fulfilledTimeStamp;
1779
+ if (!Q) {
1780
+ m(k());
1781
+ return;
1782
+ }
1783
+ (Number(/* @__PURE__ */ new Date()) - Number(new Date(Q))) / 1e3 >= F && m(k());
1784
+ } else
1785
+ m(k(!1));
1786
+ };
1787
+ function h(s) {
1788
+ return (u) => u?.meta?.arg?.endpointName === s;
1789
+ }
1790
+ function l(s, u) {
1791
+ return {
1792
+ matchPending: Pt($n(s), h(u)),
1793
+ matchFulfilled: Pt(_e(s), h(u)),
1794
+ matchRejected: Pt(Wt(s), h(u))
1795
+ };
1796
+ }
1797
+ return {
1798
+ queryThunk: f,
1799
+ mutationThunk: o,
1800
+ infiniteQueryThunk: g,
1801
+ prefetch: b,
1802
+ updateQueryData: R,
1803
+ upsertQueryData: d,
1804
+ patchQueryData: T,
1805
+ buildMatchThunkActions: l
1806
+ };
1807
+ }
1808
+ function jt(e, {
1809
+ pages: t,
1810
+ pageParams: n
1811
+ }, r) {
1812
+ const i = t.length - 1;
1813
+ return e.getNextPageParam(t[i], t, n[i], n, r);
1814
+ }
1815
+ function ur(e, {
1816
+ pages: t,
1817
+ pageParams: n
1818
+ }, r) {
1819
+ return e.getPreviousPageParam?.(t[0], t, n[0], n, r);
1820
+ }
1821
+ function lr(e, t, n, r) {
1822
+ return rn(n[e.meta.arg.endpointName][t], _e(e) ? e.payload : void 0, Ht(e) ? e.payload : void 0, e.meta.arg.originalArgs, "baseQueryMeta" in e.meta ? e.meta.baseQueryMeta : void 0, r);
1823
+ }
1824
+ function On(e) {
1825
+ return Z(e) ? Jn(e) : e;
1826
+ }
1827
+ function ot(e, t, n) {
1828
+ const r = e[t];
1829
+ r && n(r);
1830
+ }
1831
+ function Ge(e) {
1832
+ return ("arg" in e ? e.arg.fixedCacheKey : e.fixedCacheKey) ?? e.requestId;
1833
+ }
1834
+ function In(e, t, n) {
1835
+ const r = e[Ge(t)];
1836
+ r && n(r);
1837
+ }
1838
+ var st = {};
1839
+ function Pi({
1840
+ reducerPath: e,
1841
+ queryThunk: t,
1842
+ mutationThunk: n,
1843
+ serializeQueryArgs: r,
1844
+ context: {
1845
+ endpointDefinitions: i,
1846
+ apiUid: a,
1847
+ extractRehydrationInfo: v,
1848
+ hasRehydrationInfo: _
1849
+ },
1850
+ assertTagType: C,
1851
+ config: P
1852
+ }) {
1853
+ const T = De(`${e}/resetApiState`);
1854
+ function I(h, l, s, u) {
1855
+ h[l.queryCacheKey] ??= {
1856
+ status: ae,
1857
+ endpointName: l.endpointName
1858
+ }, ot(h, l.queryCacheKey, (y) => {
1859
+ y.status = zt, y.requestId = s && y.requestId ? (
1860
+ // for `upsertQuery` **updates**, keep the current `requestId`
1861
+ y.requestId
1862
+ ) : (
1863
+ // for normal queries or `upsertQuery` **inserts** always update the `requestId`
1864
+ u.requestId
1865
+ ), l.originalArgs !== void 0 && (y.originalArgs = l.originalArgs), y.startedTimeStamp = u.startedTimeStamp;
1866
+ const m = i[u.arg.endpointName];
1867
+ tt(m) && "direction" in l && (y.direction = l.direction);
1868
+ });
1869
+ }
1870
+ function A(h, l, s, u) {
1871
+ ot(h, l.arg.queryCacheKey, (y) => {
1872
+ if (y.requestId !== l.requestId && !u) return;
1873
+ const {
1874
+ merge: m
1875
+ } = i[l.arg.endpointName];
1876
+ if (y.status = qe, m)
1877
+ if (y.data !== void 0) {
1878
+ const {
1879
+ fulfilledTimeStamp: N,
1880
+ arg: M,
1881
+ baseQueryMeta: F,
1882
+ requestId: k
1883
+ } = l;
1884
+ let D = Kt(y.data, (Q) => m(Q, s, {
1885
+ arg: M.originalArgs,
1886
+ baseQueryMeta: F,
1887
+ fulfilledTimeStamp: N,
1888
+ requestId: k
1889
+ }));
1890
+ y.data = D;
1891
+ } else
1892
+ y.data = s;
1893
+ else
1894
+ y.data = i[l.arg.endpointName].structuralSharing ?? !0 ? Zt(Z(y.data) ? Dr(y.data) : y.data, s) : s;
1895
+ delete y.error, y.fulfilledTimeStamp = l.fulfilledTimeStamp;
1896
+ });
1897
+ }
1898
+ const R = Se({
1899
+ name: `${e}/queries`,
1900
+ initialState: st,
1901
+ reducers: {
1902
+ removeQueryResult: {
1903
+ reducer(h, {
1904
+ payload: {
1905
+ queryCacheKey: l
1906
+ }
1907
+ }) {
1908
+ delete h[l];
1909
+ },
1910
+ prepare: ke()
1911
+ },
1912
+ cacheEntriesUpserted: {
1913
+ reducer(h, l) {
1914
+ for (const s of l.payload) {
1915
+ const {
1916
+ queryDescription: u,
1917
+ value: y
1918
+ } = s;
1919
+ I(h, u, !0, {
1920
+ arg: u,
1921
+ requestId: l.meta.requestId,
1922
+ startedTimeStamp: l.meta.timestamp
1923
+ }), A(
1924
+ h,
1925
+ {
1926
+ arg: u,
1927
+ requestId: l.meta.requestId,
1928
+ fulfilledTimeStamp: l.meta.timestamp,
1929
+ baseQueryMeta: {}
1930
+ },
1931
+ y,
1932
+ // We know we're upserting here
1933
+ !0
1934
+ );
1935
+ }
1936
+ },
1937
+ prepare: (h) => ({
1938
+ payload: h.map((u) => {
1939
+ const {
1940
+ endpointName: y,
1941
+ arg: m,
1942
+ value: N
1943
+ } = u, M = i[y];
1944
+ return {
1945
+ queryDescription: {
1946
+ type: et,
1947
+ endpointName: y,
1948
+ originalArgs: u.arg,
1949
+ queryCacheKey: r({
1950
+ queryArgs: m,
1951
+ endpointDefinition: M,
1952
+ endpointName: y
1953
+ })
1954
+ },
1955
+ value: N
1956
+ };
1957
+ }),
1958
+ meta: {
1959
+ [Un]: !0,
1960
+ requestId: zn(),
1961
+ timestamp: Date.now()
1962
+ }
1963
+ })
1964
+ },
1965
+ queryResultPatched: {
1966
+ reducer(h, {
1967
+ payload: {
1968
+ queryCacheKey: l,
1969
+ patches: s
1970
+ }
1971
+ }) {
1972
+ ot(h, l, (u) => {
1973
+ u.data = yn(u.data, s.concat());
1974
+ });
1975
+ },
1976
+ prepare: ke()
1977
+ }
1978
+ },
1979
+ extraReducers(h) {
1980
+ h.addCase(t.pending, (l, {
1981
+ meta: s,
1982
+ meta: {
1983
+ arg: u
1984
+ }
1985
+ }) => {
1986
+ const y = Lt(u);
1987
+ I(l, u, y, s);
1988
+ }).addCase(t.fulfilled, (l, {
1989
+ meta: s,
1990
+ payload: u
1991
+ }) => {
1992
+ const y = Lt(s.arg);
1993
+ A(l, s, u, y);
1994
+ }).addCase(t.rejected, (l, {
1995
+ meta: {
1996
+ condition: s,
1997
+ arg: u,
1998
+ requestId: y
1999
+ },
2000
+ error: m,
2001
+ payload: N
2002
+ }) => {
2003
+ ot(l, u.queryCacheKey, (M) => {
2004
+ if (!s) {
2005
+ if (M.requestId !== y) return;
2006
+ M.status = Fe, M.error = N ?? m;
2007
+ }
2008
+ });
2009
+ }).addMatcher(_, (l, s) => {
2010
+ const {
2011
+ queries: u
2012
+ } = v(s);
2013
+ for (const [y, m] of Object.entries(u))
2014
+ // do not rehydrate entries that were currently in flight.
2015
+ (m?.status === qe || m?.status === Fe) && (l[y] = m);
2016
+ });
2017
+ }
2018
+ }), d = Se({
2019
+ name: `${e}/mutations`,
2020
+ initialState: st,
2021
+ reducers: {
2022
+ removeMutationResult: {
2023
+ reducer(h, {
2024
+ payload: l
2025
+ }) {
2026
+ const s = Ge(l);
2027
+ s in h && delete h[s];
2028
+ },
2029
+ prepare: ke()
2030
+ }
2031
+ },
2032
+ extraReducers(h) {
2033
+ h.addCase(n.pending, (l, {
2034
+ meta: s,
2035
+ meta: {
2036
+ requestId: u,
2037
+ arg: y,
2038
+ startedTimeStamp: m
2039
+ }
2040
+ }) => {
2041
+ y.track && (l[Ge(s)] = {
2042
+ requestId: u,
2043
+ status: zt,
2044
+ endpointName: y.endpointName,
2045
+ startedTimeStamp: m
2046
+ });
2047
+ }).addCase(n.fulfilled, (l, {
2048
+ payload: s,
2049
+ meta: u
2050
+ }) => {
2051
+ u.arg.track && In(l, u, (y) => {
2052
+ y.requestId === u.requestId && (y.status = qe, y.data = s, y.fulfilledTimeStamp = u.fulfilledTimeStamp);
2053
+ });
2054
+ }).addCase(n.rejected, (l, {
2055
+ payload: s,
2056
+ error: u,
2057
+ meta: y
2058
+ }) => {
2059
+ y.arg.track && In(l, y, (m) => {
2060
+ m.requestId === y.requestId && (m.status = Fe, m.error = s ?? u);
2061
+ });
2062
+ }).addMatcher(_, (l, s) => {
2063
+ const {
2064
+ mutations: u
2065
+ } = v(s);
2066
+ for (const [y, m] of Object.entries(u))
2067
+ // do not rehydrate entries that were currently in flight.
2068
+ (m?.status === qe || m?.status === Fe) && // only rehydrate endpoints that were persisted using a `fixedCacheKey`
2069
+ y !== m?.requestId && (l[y] = m);
2070
+ });
2071
+ }
2072
+ }), S = {
2073
+ tags: {},
2074
+ keys: {}
2075
+ }, p = Se({
2076
+ name: `${e}/invalidation`,
2077
+ initialState: S,
2078
+ reducers: {
2079
+ updateProvidedBy: {
2080
+ reducer(h, l) {
2081
+ for (const {
2082
+ queryCacheKey: s,
2083
+ providedTags: u
2084
+ } of l.payload) {
2085
+ w(h, s);
2086
+ for (const {
2087
+ type: y,
2088
+ id: m
2089
+ } of u) {
2090
+ const N = (h.tags[y] ??= {})[m || "__internal_without_id"] ??= [];
2091
+ N.includes(s) || N.push(s);
2092
+ }
2093
+ h.keys[s] = u;
2094
+ }
2095
+ },
2096
+ prepare: ke()
2097
+ }
2098
+ },
2099
+ extraReducers(h) {
2100
+ h.addCase(R.actions.removeQueryResult, (l, {
2101
+ payload: {
2102
+ queryCacheKey: s
2103
+ }
2104
+ }) => {
2105
+ w(l, s);
2106
+ }).addMatcher(_, (l, s) => {
2107
+ const {
2108
+ provided: u
2109
+ } = v(s);
2110
+ for (const [y, m] of Object.entries(u.tags ?? {}))
2111
+ for (const [N, M] of Object.entries(m)) {
2112
+ const F = (l.tags[y] ??= {})[N || "__internal_without_id"] ??= [];
2113
+ for (const k of M)
2114
+ F.includes(k) || F.push(k), l.keys[k] = u.keys[k];
2115
+ }
2116
+ }).addMatcher($e(_e(t), Ht(t)), (l, s) => {
2117
+ O(l, [s]);
2118
+ }).addMatcher(R.actions.cacheEntriesUpserted.match, (l, s) => {
2119
+ const u = s.payload.map(({
2120
+ queryDescription: y,
2121
+ value: m
2122
+ }) => ({
2123
+ type: "UNKNOWN",
2124
+ payload: m,
2125
+ meta: {
2126
+ requestStatus: "fulfilled",
2127
+ requestId: "UNKNOWN",
2128
+ arg: y
2129
+ }
2130
+ }));
2131
+ O(l, u);
2132
+ });
2133
+ }
2134
+ });
2135
+ function w(h, l) {
2136
+ const s = On(h.keys[l] ?? []);
2137
+ for (const u of s) {
2138
+ const y = u.type, m = u.id ?? "__internal_without_id", N = h.tags[y]?.[m];
2139
+ N && (h.tags[y][m] = On(N).filter((M) => M !== l));
2140
+ }
2141
+ delete h.keys[l];
2142
+ }
2143
+ function O(h, l) {
2144
+ const s = l.map((u) => {
2145
+ const y = lr(u, "providesTags", i, C), {
2146
+ queryCacheKey: m
2147
+ } = u.meta.arg;
2148
+ return {
2149
+ queryCacheKey: m,
2150
+ providedTags: y
2151
+ };
2152
+ });
2153
+ p.caseReducers.updateProvidedBy(h, p.actions.updateProvidedBy(s));
2154
+ }
2155
+ const f = Se({
2156
+ name: `${e}/subscriptions`,
2157
+ initialState: st,
2158
+ reducers: {
2159
+ updateSubscriptionOptions(h, l) {
2160
+ },
2161
+ unsubscribeQueryResult(h, l) {
2162
+ },
2163
+ internal_getRTKQSubscriptions() {
2164
+ }
2165
+ }
2166
+ }), g = Se({
2167
+ name: `${e}/internalSubscriptions`,
2168
+ initialState: st,
2169
+ reducers: {
2170
+ subscriptionsUpdated: {
2171
+ reducer(h, l) {
2172
+ return yn(h, l.payload);
2173
+ },
2174
+ prepare: ke()
2175
+ }
2176
+ }
2177
+ }), o = Se({
2178
+ name: `${e}/config`,
2179
+ initialState: {
2180
+ online: ui(),
2181
+ focused: ai(),
2182
+ middlewareRegistered: !1,
2183
+ ...P
2184
+ },
2185
+ reducers: {
2186
+ middlewareRegistered(h, {
2187
+ payload: l
2188
+ }) {
2189
+ h.middlewareRegistered = h.middlewareRegistered === "conflict" || a !== l ? "conflict" : !0;
2190
+ }
2191
+ },
2192
+ extraReducers: (h) => {
2193
+ h.addCase(nn, (l) => {
2194
+ l.online = !0;
2195
+ }).addCase(ir, (l) => {
2196
+ l.online = !1;
2197
+ }).addCase(tn, (l) => {
2198
+ l.focused = !0;
2199
+ }).addCase(rr, (l) => {
2200
+ l.focused = !1;
2201
+ }).addMatcher(_, (l) => ({
2202
+ ...l
2203
+ }));
2204
+ }
2205
+ }), c = Or({
2206
+ queries: R.reducer,
2207
+ mutations: d.reducer,
2208
+ provided: p.reducer,
2209
+ subscriptions: g.reducer,
2210
+ config: o.reducer
2211
+ }), E = (h, l) => c(T.match(l) ? void 0 : h, l), b = {
2212
+ ...o.actions,
2213
+ ...R.actions,
2214
+ ...f.actions,
2215
+ ...g.actions,
2216
+ ...d.actions,
2217
+ ...p.actions,
2218
+ resetApiState: T
2219
+ };
2220
+ return {
2221
+ reducer: E,
2222
+ actions: b
2223
+ };
2224
+ }
2225
+ var te = /* @__PURE__ */ Symbol.for("RTKQ/skipToken"), fr = {
2226
+ status: ae
2227
+ }, An = /* @__PURE__ */ Kt(fr, () => {
2228
+ }), Cn = /* @__PURE__ */ Kt(fr, () => {
2229
+ });
2230
+ function Ri({
2231
+ serializeQueryArgs: e,
2232
+ reducerPath: t,
2233
+ createSelector: n
2234
+ }) {
2235
+ const r = (f) => An, i = (f) => Cn;
2236
+ return {
2237
+ buildQuerySelector: A,
2238
+ buildInfiniteQuerySelector: R,
2239
+ buildMutationSelector: d,
2240
+ selectInvalidatedBy: S,
2241
+ selectCachedArgsForQuery: p,
2242
+ selectApiState: v,
2243
+ selectQueries: _,
2244
+ selectMutations: P,
2245
+ selectQueryEntry: C,
2246
+ selectConfig: T
2247
+ };
2248
+ function a(f) {
2249
+ return {
2250
+ ...f,
2251
+ ...Sn(f.status)
2252
+ };
2253
+ }
2254
+ function v(f) {
2255
+ const g = f[t];
2256
+ if (process.env.NODE_ENV !== "production" && !g) {
2257
+ if (v.triggered) return g;
2258
+ v.triggered = !0, console.error(`Error: No data found at \`state.${t}\`. Did you forget to add the reducer to the store?`);
2259
+ }
2260
+ return g;
2261
+ }
2262
+ function _(f) {
2263
+ return v(f)?.queries;
2264
+ }
2265
+ function C(f, g) {
2266
+ return _(f)?.[g];
2267
+ }
2268
+ function P(f) {
2269
+ return v(f)?.mutations;
2270
+ }
2271
+ function T(f) {
2272
+ return v(f)?.config;
2273
+ }
2274
+ function I(f, g, o) {
2275
+ return (c) => {
2276
+ if (c === te)
2277
+ return n(r, o);
2278
+ const E = e({
2279
+ queryArgs: c,
2280
+ endpointDefinition: g,
2281
+ endpointName: f
2282
+ });
2283
+ return n((h) => C(h, E) ?? An, o);
2284
+ };
2285
+ }
2286
+ function A(f, g) {
2287
+ return I(f, g, a);
2288
+ }
2289
+ function R(f, g) {
2290
+ const {
2291
+ infiniteQueryOptions: o
2292
+ } = g;
2293
+ function c(E) {
2294
+ const b = {
2295
+ ...E,
2296
+ ...Sn(E.status)
2297
+ }, {
2298
+ isLoading: h,
2299
+ isError: l,
2300
+ direction: s
2301
+ } = b, u = s === "forward", y = s === "backward";
2302
+ return {
2303
+ ...b,
2304
+ hasNextPage: w(o, b.data, b.originalArgs),
2305
+ hasPreviousPage: O(o, b.data, b.originalArgs),
2306
+ isFetchingNextPage: h && u,
2307
+ isFetchingPreviousPage: h && y,
2308
+ isFetchNextPageError: l && u,
2309
+ isFetchPreviousPageError: l && y
2310
+ };
2311
+ }
2312
+ return I(f, g, c);
2313
+ }
2314
+ function d() {
2315
+ return (f) => {
2316
+ let g;
2317
+ return typeof f == "object" ? g = Ge(f) ?? te : g = f, n(g === te ? i : (E) => v(E)?.mutations?.[g] ?? Cn, a);
2318
+ };
2319
+ }
2320
+ function S(f, g) {
2321
+ const o = f[t], c = /* @__PURE__ */ new Set(), E = Ut(g, en, cr);
2322
+ for (const b of E) {
2323
+ const h = o.provided.tags[b.type];
2324
+ if (!h)
2325
+ continue;
2326
+ let l = (b.id !== void 0 ? (
2327
+ // id given: invalidate all queries that provide this type & id
2328
+ h[b.id]
2329
+ ) : (
2330
+ // no id: invalidate all queries that provide this type
2331
+ Object.values(h).flat()
2332
+ )) ?? [];
2333
+ for (const s of l)
2334
+ c.add(s);
2335
+ }
2336
+ return Array.from(c.values()).flatMap((b) => {
2337
+ const h = o.queries[b];
2338
+ return h ? {
2339
+ queryCacheKey: b,
2340
+ endpointName: h.endpointName,
2341
+ originalArgs: h.originalArgs
2342
+ } : [];
2343
+ });
2344
+ }
2345
+ function p(f, g) {
2346
+ return Ut(Object.values(_(f)), (o) => o?.endpointName === g && o.status !== ae, (o) => o.originalArgs);
2347
+ }
2348
+ function w(f, g, o) {
2349
+ return g ? jt(f, g, o) != null : !1;
2350
+ }
2351
+ function O(f, g, o) {
2352
+ return !g || !f.getPreviousPageParam ? !1 : ur(f, g, o) != null;
2353
+ }
2354
+ }
2355
+ var Tn = WeakMap ? /* @__PURE__ */ new WeakMap() : void 0, Dn = ({
2356
+ endpointName: e,
2357
+ queryArgs: t
2358
+ }) => {
2359
+ let n = "";
2360
+ const r = Tn?.get(t);
2361
+ if (typeof r == "string")
2362
+ n = r;
2363
+ else {
2364
+ const i = JSON.stringify(t, (a, v) => (v = typeof v == "bigint" ? {
2365
+ $bigint: v.toString()
2366
+ } : v, v = Ue(v) ? Object.keys(v).sort().reduce((_, C) => (_[C] = v[C], _), {}) : v, v));
2367
+ Ue(t) && Tn?.set(t, i), n = i;
2368
+ }
2369
+ return `${e}(${n})`;
2370
+ };
2371
+ function dr(...e) {
2372
+ return function(n) {
2373
+ const r = gt((P) => n.extractRehydrationInfo?.(P, {
2374
+ reducerPath: n.reducerPath ?? "api"
2375
+ })), i = {
2376
+ reducerPath: "api",
2377
+ keepUnusedDataFor: 60,
2378
+ refetchOnMountOrArgChange: !1,
2379
+ refetchOnFocus: !1,
2380
+ refetchOnReconnect: !1,
2381
+ invalidationBehavior: "delayed",
2382
+ ...n,
2383
+ extractRehydrationInfo: r,
2384
+ serializeQueryArgs(P) {
2385
+ let T = Dn;
2386
+ if ("serializeQueryArgs" in P.endpointDefinition) {
2387
+ const I = P.endpointDefinition.serializeQueryArgs;
2388
+ T = (A) => {
2389
+ const R = I(A);
2390
+ return typeof R == "string" ? R : Dn({
2391
+ ...A,
2392
+ queryArgs: R
2393
+ });
2394
+ };
2395
+ } else n.serializeQueryArgs && (T = n.serializeQueryArgs);
2396
+ return T(P);
2397
+ },
2398
+ tagTypes: [...n.tagTypes || []]
2399
+ }, a = {
2400
+ endpointDefinitions: {},
2401
+ batch(P) {
2402
+ P();
2403
+ },
2404
+ apiUid: zn(),
2405
+ extractRehydrationInfo: r,
2406
+ hasRehydrationInfo: gt((P) => r(P) != null)
2407
+ }, v = {
2408
+ injectEndpoints: C,
2409
+ enhanceEndpoints({
2410
+ addTagTypes: P,
2411
+ endpoints: T
2412
+ }) {
2413
+ if (P)
2414
+ for (const I of P)
2415
+ i.tagTypes.includes(I) || i.tagTypes.push(I);
2416
+ if (T)
2417
+ for (const [I, A] of Object.entries(T))
2418
+ typeof A == "function" ? A(Te(a, I)) : Object.assign(Te(a, I) || {}, A);
2419
+ return v;
2420
+ }
2421
+ }, _ = e.map((P) => P.init(v, i, a));
2422
+ function C(P) {
2423
+ const T = P.endpoints({
2424
+ query: (I) => ({
2425
+ ...I,
2426
+ type: et
2427
+ }),
2428
+ mutation: (I) => ({
2429
+ ...I,
2430
+ type: or
2431
+ }),
2432
+ infiniteQuery: (I) => ({
2433
+ ...I,
2434
+ type: sr
2435
+ })
2436
+ });
2437
+ for (const [I, A] of Object.entries(T)) {
2438
+ if (P.overrideExisting !== !0 && I in a.endpointDefinitions) {
2439
+ if (P.overrideExisting === "throw")
2440
+ throw new Error(process.env.NODE_ENV === "production" ? ye(39) : `called \`injectEndpoints\` to override already-existing endpointName ${I} without specifying \`overrideExisting: true\``);
2441
+ typeof process < "u" && process.env.NODE_ENV === "development" && console.error(`called \`injectEndpoints\` to override already-existing endpointName ${I} without specifying \`overrideExisting: true\``);
2442
+ continue;
2443
+ }
2444
+ if (typeof process < "u" && process.env.NODE_ENV === "development" && tt(A)) {
2445
+ const {
2446
+ infiniteQueryOptions: R
2447
+ } = A, {
2448
+ maxPages: d,
2449
+ getPreviousPageParam: S
2450
+ } = R;
2451
+ if (typeof d == "number") {
2452
+ if (d < 1)
2453
+ throw new Error(process.env.NODE_ENV === "production" ? ye(40) : `maxPages for endpoint '${I}' must be a number greater than 0`);
2454
+ if (typeof S != "function")
2455
+ throw new Error(process.env.NODE_ENV === "production" ? ye(41) : `getPreviousPageParam for endpoint '${I}' must be a function if maxPages is used`);
2456
+ }
2457
+ }
2458
+ a.endpointDefinitions[I] = A;
2459
+ for (const R of _)
2460
+ R.injectEndpoint(I, A);
2461
+ }
2462
+ return v;
2463
+ }
2464
+ return v.injectEndpoints({
2465
+ endpoints: n.endpoints
2466
+ });
2467
+ };
2468
+ }
2469
+ function oe(e, ...t) {
2470
+ return Object.assign(e, ...t);
2471
+ }
2472
+ var Oi = ({
2473
+ api: e,
2474
+ queryThunk: t,
2475
+ internalState: n,
2476
+ mwApi: r
2477
+ }) => {
2478
+ const i = `${e.reducerPath}/subscriptions`;
2479
+ let a = null, v = null;
2480
+ const {
2481
+ updateSubscriptionOptions: _,
2482
+ unsubscribeQueryResult: C
2483
+ } = e.internalActions, P = (S, p) => {
2484
+ if (_.match(p)) {
2485
+ const {
2486
+ queryCacheKey: O,
2487
+ requestId: f,
2488
+ options: g
2489
+ } = p.payload, o = S.get(O);
2490
+ return o?.has(f) && o.set(f, g), !0;
2491
+ }
2492
+ if (C.match(p)) {
2493
+ const {
2494
+ queryCacheKey: O,
2495
+ requestId: f
2496
+ } = p.payload, g = S.get(O);
2497
+ return g && g.delete(f), !0;
2498
+ }
2499
+ if (e.internalActions.removeQueryResult.match(p))
2500
+ return S.delete(p.payload.queryCacheKey), !0;
2501
+ if (t.pending.match(p)) {
2502
+ const {
2503
+ meta: {
2504
+ arg: O,
2505
+ requestId: f
2506
+ }
2507
+ } = p, g = mt(S, O.queryCacheKey, $t);
2508
+ return O.subscribe && g.set(f, O.subscriptionOptions ?? g.get(f) ?? {}), !0;
2509
+ }
2510
+ let w = !1;
2511
+ if (t.rejected.match(p)) {
2512
+ const {
2513
+ meta: {
2514
+ condition: O,
2515
+ arg: f,
2516
+ requestId: g
2517
+ }
2518
+ } = p;
2519
+ if (O && f.subscribe) {
2520
+ const o = mt(S, f.queryCacheKey, $t);
2521
+ o.set(g, f.subscriptionOptions ?? o.get(g) ?? {}), w = !0;
2522
+ }
2523
+ }
2524
+ return w;
2525
+ }, T = () => n.currentSubscriptions, R = {
2526
+ getSubscriptions: T,
2527
+ getSubscriptionCount: (S) => T().get(S)?.size ?? 0,
2528
+ isRequestSubscribed: (S, p) => !!T()?.get(S)?.get(p)
2529
+ };
2530
+ function d(S) {
2531
+ return JSON.parse(JSON.stringify(Object.fromEntries([...S].map(([p, w]) => [p, Object.fromEntries(w)]))));
2532
+ }
2533
+ return (S, p) => {
2534
+ if (a || (a = d(n.currentSubscriptions)), e.util.resetApiState.match(S))
2535
+ return a = {}, n.currentSubscriptions.clear(), v = null, [!0, !1];
2536
+ if (e.internalActions.internal_getRTKQSubscriptions.match(S))
2537
+ return [!1, R];
2538
+ const w = P(n.currentSubscriptions, S);
2539
+ let O = !0;
2540
+ if (process.env.NODE_ENV === "test" && typeof S.type == "string" && S.type === `${e.reducerPath}/getPolling`)
2541
+ return [!1, n.currentPolls];
2542
+ if (w) {
2543
+ v || (v = setTimeout(() => {
2544
+ const o = d(n.currentSubscriptions), [, c] = Zn(a, () => o);
2545
+ p.next(e.internalActions.subscriptionsUpdated(c)), a = o, v = null;
2546
+ }, 500));
2547
+ const f = typeof S.type == "string" && !!S.type.startsWith(i), g = t.rejected.match(S) && S.meta.condition && !!S.meta.arg.subscribe;
2548
+ O = !f && !g;
2549
+ }
2550
+ return [O, !1];
2551
+ };
2552
+ }, Ii = 2147483647 / 1e3 - 1, Ai = ({
2553
+ reducerPath: e,
2554
+ api: t,
2555
+ queryThunk: n,
2556
+ context: r,
2557
+ internalState: i,
2558
+ selectors: {
2559
+ selectQueryEntry: a,
2560
+ selectConfig: v
2561
+ },
2562
+ getRunningQueryThunk: _,
2563
+ mwApi: C
2564
+ }) => {
2565
+ const {
2566
+ removeQueryResult: P,
2567
+ unsubscribeQueryResult: T,
2568
+ cacheEntriesUpserted: I
2569
+ } = t.internalActions, A = $e(T.match, n.fulfilled, n.rejected, I.match);
2570
+ function R(f) {
2571
+ const g = i.currentSubscriptions.get(f);
2572
+ return g ? g.size > 0 : !1;
2573
+ }
2574
+ const d = {};
2575
+ function S(f) {
2576
+ for (const g of f.values())
2577
+ g?.abort?.();
2578
+ }
2579
+ const p = (f, g) => {
2580
+ const o = g.getState(), c = v(o);
2581
+ if (A(f)) {
2582
+ let E;
2583
+ if (I.match(f))
2584
+ E = f.payload.map((b) => b.queryDescription.queryCacheKey);
2585
+ else {
2586
+ const {
2587
+ queryCacheKey: b
2588
+ } = T.match(f) ? f.payload : f.meta.arg;
2589
+ E = [b];
2590
+ }
2591
+ w(E, g, c);
2592
+ }
2593
+ if (t.util.resetApiState.match(f)) {
2594
+ for (const [E, b] of Object.entries(d))
2595
+ b && clearTimeout(b), delete d[E];
2596
+ S(i.runningQueries), S(i.runningMutations);
2597
+ }
2598
+ if (r.hasRehydrationInfo(f)) {
2599
+ const {
2600
+ queries: E
2601
+ } = r.extractRehydrationInfo(f);
2602
+ w(Object.keys(E), g, c);
2603
+ }
2604
+ };
2605
+ function w(f, g, o) {
2606
+ const c = g.getState();
2607
+ for (const E of f) {
2608
+ const b = a(c, E);
2609
+ b?.endpointName && O(E, b.endpointName, g, o);
2610
+ }
2611
+ }
2612
+ function O(f, g, o, c) {
2613
+ const b = Te(r, g)?.keepUnusedDataFor ?? c.keepUnusedDataFor;
2614
+ if (b === 1 / 0)
2615
+ return;
2616
+ const h = Math.max(0, Math.min(b, Ii));
2617
+ if (!R(f)) {
2618
+ const l = d[f];
2619
+ l && clearTimeout(l), d[f] = setTimeout(() => {
2620
+ if (!R(f)) {
2621
+ const s = a(o.getState(), f);
2622
+ s?.endpointName && o.dispatch(_(s.endpointName, s.originalArgs))?.abort(), o.dispatch(P({
2623
+ queryCacheKey: f
2624
+ }));
2625
+ }
2626
+ delete d[f];
2627
+ }, h * 1e3);
2628
+ }
2629
+ }
2630
+ return p;
2631
+ }, Nn = new Error("Promise never resolved before cacheEntryRemoved."), Ci = ({
2632
+ api: e,
2633
+ reducerPath: t,
2634
+ context: n,
2635
+ queryThunk: r,
2636
+ mutationThunk: i,
2637
+ internalState: a,
2638
+ selectors: {
2639
+ selectQueryEntry: v,
2640
+ selectApiState: _
2641
+ }
2642
+ }) => {
2643
+ const C = an(r), P = an(i), T = _e(r, i), I = {}, {
2644
+ removeQueryResult: A,
2645
+ removeMutationResult: R,
2646
+ cacheEntriesUpserted: d
2647
+ } = e.internalActions;
2648
+ function S(o, c, E) {
2649
+ const b = I[o];
2650
+ b?.valueResolved && (b.valueResolved({
2651
+ data: c,
2652
+ meta: E
2653
+ }), delete b.valueResolved);
2654
+ }
2655
+ function p(o) {
2656
+ const c = I[o];
2657
+ c && (delete I[o], c.cacheEntryRemoved());
2658
+ }
2659
+ function w(o) {
2660
+ const {
2661
+ arg: c,
2662
+ requestId: E
2663
+ } = o.meta, {
2664
+ endpointName: b,
2665
+ originalArgs: h
2666
+ } = c;
2667
+ return [b, h, E];
2668
+ }
2669
+ const O = (o, c, E) => {
2670
+ const b = f(o);
2671
+ function h(l, s, u, y) {
2672
+ const m = v(E, s), N = v(c.getState(), s);
2673
+ !m && N && g(l, y, s, c, u);
2674
+ }
2675
+ if (r.pending.match(o)) {
2676
+ const [l, s, u] = w(o);
2677
+ h(l, b, u, s);
2678
+ } else if (d.match(o))
2679
+ for (const {
2680
+ queryDescription: l,
2681
+ value: s
2682
+ } of o.payload) {
2683
+ const {
2684
+ endpointName: u,
2685
+ originalArgs: y,
2686
+ queryCacheKey: m
2687
+ } = l;
2688
+ h(u, m, o.meta.requestId, y), S(m, s, {});
2689
+ }
2690
+ else if (i.pending.match(o)) {
2691
+ if (c.getState()[t].mutations[b]) {
2692
+ const [s, u, y] = w(o);
2693
+ g(s, u, b, c, y);
2694
+ }
2695
+ } else if (T(o))
2696
+ S(b, o.payload, o.meta.baseQueryMeta);
2697
+ else if (A.match(o) || R.match(o))
2698
+ p(b);
2699
+ else if (e.util.resetApiState.match(o))
2700
+ for (const l of Object.keys(I))
2701
+ p(l);
2702
+ };
2703
+ function f(o) {
2704
+ return C(o) ? o.meta.arg.queryCacheKey : P(o) ? o.meta.arg.fixedCacheKey ?? o.meta.requestId : A.match(o) ? o.payload.queryCacheKey : R.match(o) ? Ge(o.payload) : "";
2705
+ }
2706
+ function g(o, c, E, b, h) {
2707
+ const l = Te(n, o), s = l?.onCacheEntryAdded;
2708
+ if (!s) return;
2709
+ const u = {}, y = new Promise((D) => {
2710
+ u.cacheEntryRemoved = D;
2711
+ }), m = Promise.race([new Promise((D) => {
2712
+ u.valueResolved = D;
2713
+ }), y.then(() => {
2714
+ throw Nn;
2715
+ })]);
2716
+ m.catch(() => {
2717
+ }), I[E] = u;
2718
+ const N = e.endpoints[o].select(vt(l) ? c : E), M = b.dispatch((D, Q, V) => V), F = {
2719
+ ...b,
2720
+ getCacheEntry: () => N(b.getState()),
2721
+ requestId: h,
2722
+ extra: M,
2723
+ updateCachedData: vt(l) ? (D) => b.dispatch(e.util.updateQueryData(o, c, D)) : void 0,
2724
+ cacheDataLoaded: m,
2725
+ cacheEntryRemoved: y
2726
+ }, k = s(c, F);
2727
+ Promise.resolve(k).catch((D) => {
2728
+ if (D !== Nn)
2729
+ throw D;
2730
+ });
2731
+ }
2732
+ return O;
2733
+ }, Ti = ({
2734
+ api: e,
2735
+ context: {
2736
+ apiUid: t
2737
+ },
2738
+ reducerPath: n
2739
+ }) => (r, i) => {
2740
+ e.util.resetApiState.match(r) && i.dispatch(e.internalActions.middlewareRegistered(t)), typeof process < "u" && process.env.NODE_ENV === "development" && e.internalActions.middlewareRegistered.match(r) && r.payload === t && i.getState()[n]?.config?.middlewareRegistered === "conflict" && console.warn(`There is a mismatch between slice and middleware for the reducerPath "${n}".
2741
+ You can only have one api per reducer path, this will lead to crashes in various situations!${n === "api" ? `
2742
+ If you have multiple apis, you *have* to specify the reducerPath option when using createApi!` : ""}`);
2743
+ }, Di = ({
2744
+ reducerPath: e,
2745
+ context: t,
2746
+ context: {
2747
+ endpointDefinitions: n
2748
+ },
2749
+ mutationThunk: r,
2750
+ queryThunk: i,
2751
+ api: a,
2752
+ assertTagType: v,
2753
+ refetchQuery: _,
2754
+ internalState: C
2755
+ }) => {
2756
+ const {
2757
+ removeQueryResult: P
2758
+ } = a.internalActions, T = $e(_e(r), Ht(r)), I = $e(_e(i, r), Wt(i, r));
2759
+ let A = [], R = 0;
2760
+ const d = (w, O) => {
2761
+ (i.pending.match(w) || r.pending.match(w)) && R++, I(w) && (R = Math.max(0, R - 1)), T(w) ? p(lr(w, "invalidatesTags", n, v), O) : I(w) ? p([], O) : a.util.invalidateTags.match(w) && p(rn(w.payload, void 0, void 0, void 0, void 0, v), O);
2762
+ };
2763
+ function S() {
2764
+ return R > 0;
2765
+ }
2766
+ function p(w, O) {
2767
+ const f = O.getState(), g = f[e];
2768
+ if (A.push(...w), g.config.invalidationBehavior === "delayed" && S())
2769
+ return;
2770
+ const o = A;
2771
+ if (A = [], o.length === 0) return;
2772
+ const c = a.util.selectInvalidatedBy(f, o);
2773
+ t.batch(() => {
2774
+ const E = Array.from(c.values());
2775
+ for (const {
2776
+ queryCacheKey: b
2777
+ } of E) {
2778
+ const h = g.queries[b], l = mt(C.currentSubscriptions, b, $t);
2779
+ h && (l.size === 0 ? O.dispatch(P({
2780
+ queryCacheKey: b
2781
+ })) : h.status !== ae && O.dispatch(_(h)));
2782
+ }
2783
+ });
2784
+ }
2785
+ return d;
2786
+ }, Ni = ({
2787
+ reducerPath: e,
2788
+ queryThunk: t,
2789
+ api: n,
2790
+ refetchQuery: r,
2791
+ internalState: i
2792
+ }) => {
2793
+ const {
2794
+ currentPolls: a,
2795
+ currentSubscriptions: v
2796
+ } = i, _ = /* @__PURE__ */ new Set();
2797
+ let C = null;
2798
+ const P = (p, w) => {
2799
+ (n.internalActions.updateSubscriptionOptions.match(p) || n.internalActions.unsubscribeQueryResult.match(p)) && T(p.payload.queryCacheKey, w), (t.pending.match(p) || t.rejected.match(p) && p.meta.condition) && T(p.meta.arg.queryCacheKey, w), (t.fulfilled.match(p) || t.rejected.match(p) && !p.meta.condition) && I(p.meta.arg, w), n.util.resetApiState.match(p) && (d(), C && (clearTimeout(C), C = null), _.clear());
2800
+ };
2801
+ function T(p, w) {
2802
+ _.add(p), C || (C = setTimeout(() => {
2803
+ for (const O of _)
2804
+ A({
2805
+ queryCacheKey: O
2806
+ }, w);
2807
+ _.clear(), C = null;
2808
+ }, 0));
2809
+ }
2810
+ function I({
2811
+ queryCacheKey: p
2812
+ }, w) {
2813
+ const O = w.getState()[e], f = O.queries[p], g = v.get(p);
2814
+ if (!f || f.status === ae) return;
2815
+ const {
2816
+ lowestPollingInterval: o,
2817
+ skipPollingIfUnfocused: c
2818
+ } = S(g);
2819
+ if (!Number.isFinite(o)) return;
2820
+ const E = a.get(p);
2821
+ E?.timeout && (clearTimeout(E.timeout), E.timeout = void 0);
2822
+ const b = Date.now() + o;
2823
+ a.set(p, {
2824
+ nextPollTimestamp: b,
2825
+ pollingInterval: o,
2826
+ timeout: setTimeout(() => {
2827
+ (O.config.focused || !c) && w.dispatch(r(f)), I({
2828
+ queryCacheKey: p
2829
+ }, w);
2830
+ }, o)
2831
+ });
2832
+ }
2833
+ function A({
2834
+ queryCacheKey: p
2835
+ }, w) {
2836
+ const f = w.getState()[e].queries[p], g = v.get(p);
2837
+ if (!f || f.status === ae)
2838
+ return;
2839
+ const {
2840
+ lowestPollingInterval: o
2841
+ } = S(g);
2842
+ if (process.env.NODE_ENV === "test") {
2843
+ const b = a.pollUpdateCounters ??= {};
2844
+ b[p] ??= 0, b[p]++;
2845
+ }
2846
+ if (!Number.isFinite(o)) {
2847
+ R(p);
2848
+ return;
2849
+ }
2850
+ const c = a.get(p), E = Date.now() + o;
2851
+ (!c || E < c.nextPollTimestamp) && I({
2852
+ queryCacheKey: p
2853
+ }, w);
2854
+ }
2855
+ function R(p) {
2856
+ const w = a.get(p);
2857
+ w?.timeout && clearTimeout(w.timeout), a.delete(p);
2858
+ }
2859
+ function d() {
2860
+ for (const p of a.keys())
2861
+ R(p);
2862
+ }
2863
+ function S(p = /* @__PURE__ */ new Map()) {
2864
+ let w = !1, O = Number.POSITIVE_INFINITY;
2865
+ for (const f of p.values())
2866
+ f.pollingInterval && (O = Math.min(f.pollingInterval, O), w = f.skipPollingIfUnfocused || w);
2867
+ return {
2868
+ lowestPollingInterval: O,
2869
+ skipPollingIfUnfocused: w
2870
+ };
2871
+ }
2872
+ return P;
2873
+ }, ki = ({
2874
+ api: e,
2875
+ context: t,
2876
+ queryThunk: n,
2877
+ mutationThunk: r
2878
+ }) => {
2879
+ const i = $n(n, r), a = Wt(n, r), v = _e(n, r), _ = {};
2880
+ return (P, T) => {
2881
+ if (i(P)) {
2882
+ const {
2883
+ requestId: I,
2884
+ arg: {
2885
+ endpointName: A,
2886
+ originalArgs: R
2887
+ }
2888
+ } = P.meta, d = Te(t, A), S = d?.onQueryStarted;
2889
+ if (S) {
2890
+ const p = {}, w = new Promise((o, c) => {
2891
+ p.resolve = o, p.reject = c;
2892
+ });
2893
+ w.catch(() => {
2894
+ }), _[I] = p;
2895
+ const O = e.endpoints[A].select(vt(d) ? R : I), f = T.dispatch((o, c, E) => E), g = {
2896
+ ...T,
2897
+ getCacheEntry: () => O(T.getState()),
2898
+ requestId: I,
2899
+ extra: f,
2900
+ updateCachedData: vt(d) ? (o) => T.dispatch(e.util.updateQueryData(A, R, o)) : void 0,
2901
+ queryFulfilled: w
2902
+ };
2903
+ S(R, g);
2904
+ }
2905
+ } else if (v(P)) {
2906
+ const {
2907
+ requestId: I,
2908
+ baseQueryMeta: A
2909
+ } = P.meta;
2910
+ _[I]?.resolve({
2911
+ data: P.payload,
2912
+ meta: A
2913
+ }), delete _[I];
2914
+ } else if (a(P)) {
2915
+ const {
2916
+ requestId: I,
2917
+ rejectedWithValue: A,
2918
+ baseQueryMeta: R
2919
+ } = P.meta;
2920
+ _[I]?.reject({
2921
+ error: P.payload ?? P.error,
2922
+ isUnhandledError: !A,
2923
+ meta: R
2924
+ }), delete _[I];
2925
+ }
2926
+ };
2927
+ }, Mi = ({
2928
+ reducerPath: e,
2929
+ context: t,
2930
+ api: n,
2931
+ refetchQuery: r,
2932
+ internalState: i
2933
+ }) => {
2934
+ const {
2935
+ removeQueryResult: a
2936
+ } = n.internalActions, v = (C, P) => {
2937
+ tn.match(C) && _(P, "refetchOnFocus"), nn.match(C) && _(P, "refetchOnReconnect");
2938
+ };
2939
+ function _(C, P) {
2940
+ const T = C.getState()[e], I = T.queries, A = i.currentSubscriptions;
2941
+ t.batch(() => {
2942
+ for (const R of A.keys()) {
2943
+ const d = I[R], S = A.get(R);
2944
+ if (!S || !d) continue;
2945
+ const p = [...S.values()];
2946
+ (p.some((O) => O[P] === !0) || p.every((O) => O[P] === void 0) && T.config[P]) && (S.size === 0 ? C.dispatch(a({
2947
+ queryCacheKey: R
2948
+ })) : d.status !== ae && C.dispatch(r(d)));
2949
+ }
2950
+ });
2951
+ }
2952
+ return v;
2953
+ };
2954
+ function Qi(e) {
2955
+ const {
2956
+ reducerPath: t,
2957
+ queryThunk: n,
2958
+ api: r,
2959
+ context: i,
2960
+ getInternalState: a
2961
+ } = e, {
2962
+ apiUid: v
2963
+ } = i, _ = {
2964
+ invalidateTags: De(`${t}/invalidateTags`)
2965
+ }, C = (A) => A.type.startsWith(`${t}/`), P = [Ti, Ai, Di, Ni, Ci, ki];
2966
+ return {
2967
+ middleware: (A) => {
2968
+ let R = !1;
2969
+ const d = a(A.dispatch), S = {
2970
+ ...e,
2971
+ internalState: d,
2972
+ refetchQuery: I,
2973
+ isThisApiSliceAction: C,
2974
+ mwApi: A
2975
+ }, p = P.map((f) => f(S)), w = Oi(S), O = Mi(S);
2976
+ return (f) => (g) => {
2977
+ if (!Ir(g))
2978
+ return f(g);
2979
+ R || (R = !0, A.dispatch(r.internalActions.middlewareRegistered(v)));
2980
+ const o = {
2981
+ ...A,
2982
+ next: f
2983
+ }, c = A.getState(), [E, b] = w(g, o, c);
2984
+ let h;
2985
+ if (E ? h = f(g) : h = b, A.getState()[t] && (O(g, o, c), C(g) || i.hasRehydrationInfo(g)))
2986
+ for (const l of p)
2987
+ l(g, o, c);
2988
+ return h;
2989
+ };
2990
+ },
2991
+ actions: _
2992
+ };
2993
+ function I(A) {
2994
+ return e.api.endpoints[A.endpointName].initiate(A.originalArgs, {
2995
+ subscribe: !1,
2996
+ forceRefetch: !0
2997
+ });
2998
+ }
2999
+ }
3000
+ var kn = /* @__PURE__ */ Symbol(), pr = ({
3001
+ createSelector: e = Rr
3002
+ } = {}) => ({
3003
+ name: kn,
3004
+ init(t, {
3005
+ baseQuery: n,
3006
+ tagTypes: r,
3007
+ reducerPath: i,
3008
+ serializeQueryArgs: a,
3009
+ keepUnusedDataFor: v,
3010
+ refetchOnMountOrArgChange: _,
3011
+ refetchOnFocus: C,
3012
+ refetchOnReconnect: P,
3013
+ invalidationBehavior: T,
3014
+ onSchemaFailure: I,
3015
+ catchSchemaFailure: A,
3016
+ skipSchemaValidation: R
3017
+ }, d) {
3018
+ Hr();
3019
+ const S = (U) => (typeof process < "u" && process.env.NODE_ENV === "development" && (r.includes(U.type) || console.error(`Tag type '${U.type}' was used, but not specified in \`tagTypes\`!`)), U);
3020
+ Object.assign(t, {
3021
+ reducerPath: i,
3022
+ endpoints: {},
3023
+ internalActions: {
3024
+ onOnline: nn,
3025
+ onOffline: ir,
3026
+ onFocus: tn,
3027
+ onFocusLost: rr
3028
+ },
3029
+ util: {}
3030
+ });
3031
+ const p = Ri({
3032
+ serializeQueryArgs: a,
3033
+ reducerPath: i,
3034
+ createSelector: e
3035
+ }), {
3036
+ selectInvalidatedBy: w,
3037
+ selectCachedArgsForQuery: O,
3038
+ buildQuerySelector: f,
3039
+ buildInfiniteQuerySelector: g,
3040
+ buildMutationSelector: o
3041
+ } = p;
3042
+ oe(t.util, {
3043
+ selectInvalidatedBy: w,
3044
+ selectCachedArgsForQuery: O
3045
+ });
3046
+ const {
3047
+ queryThunk: c,
3048
+ infiniteQueryThunk: E,
3049
+ mutationThunk: b,
3050
+ patchQueryData: h,
3051
+ updateQueryData: l,
3052
+ upsertQueryData: s,
3053
+ prefetch: u,
3054
+ buildMatchThunkActions: y
3055
+ } = wi({
3056
+ baseQuery: n,
3057
+ reducerPath: i,
3058
+ context: d,
3059
+ api: t,
3060
+ serializeQueryArgs: a,
3061
+ assertTagType: S,
3062
+ selectors: p,
3063
+ onSchemaFailure: I,
3064
+ catchSchemaFailure: A,
3065
+ skipSchemaValidation: R
3066
+ }), {
3067
+ reducer: m,
3068
+ actions: N
3069
+ } = Pi({
3070
+ context: d,
3071
+ queryThunk: c,
3072
+ mutationThunk: b,
3073
+ serializeQueryArgs: a,
3074
+ reducerPath: i,
3075
+ assertTagType: S,
3076
+ config: {
3077
+ refetchOnFocus: C,
3078
+ refetchOnReconnect: P,
3079
+ refetchOnMountOrArgChange: _,
3080
+ keepUnusedDataFor: v,
3081
+ reducerPath: i,
3082
+ invalidationBehavior: T
3083
+ }
3084
+ });
3085
+ oe(t.util, {
3086
+ patchQueryData: h,
3087
+ updateQueryData: l,
3088
+ upsertQueryData: s,
3089
+ prefetch: u,
3090
+ resetApiState: N.resetApiState,
3091
+ upsertQueryEntries: N.cacheEntriesUpserted
3092
+ }), oe(t.internalActions, N);
3093
+ const M = /* @__PURE__ */ new WeakMap(), F = (U) => mt(M, U, () => ({
3094
+ currentSubscriptions: /* @__PURE__ */ new Map(),
3095
+ currentPolls: /* @__PURE__ */ new Map(),
3096
+ runningQueries: /* @__PURE__ */ new Map(),
3097
+ runningMutations: /* @__PURE__ */ new Map()
3098
+ })), {
3099
+ buildInitiateQuery: k,
3100
+ buildInitiateInfiniteQuery: D,
3101
+ buildInitiateMutation: Q,
3102
+ getRunningMutationThunk: V,
3103
+ getRunningMutationsThunk: L,
3104
+ getRunningQueriesThunk: K,
3105
+ getRunningQueryThunk: q
3106
+ } = Ei({
3107
+ queryThunk: c,
3108
+ mutationThunk: b,
3109
+ infiniteQueryThunk: E,
3110
+ api: t,
3111
+ serializeQueryArgs: a,
3112
+ context: d,
3113
+ getInternalState: F
3114
+ });
3115
+ oe(t.util, {
3116
+ getRunningMutationThunk: V,
3117
+ getRunningMutationsThunk: L,
3118
+ getRunningQueryThunk: q,
3119
+ getRunningQueriesThunk: K
3120
+ });
3121
+ const {
3122
+ middleware: j,
3123
+ actions: H
3124
+ } = Qi({
3125
+ reducerPath: i,
3126
+ context: d,
3127
+ queryThunk: c,
3128
+ mutationThunk: b,
3129
+ infiniteQueryThunk: E,
3130
+ api: t,
3131
+ assertTagType: S,
3132
+ selectors: p,
3133
+ getRunningQueryThunk: q,
3134
+ getInternalState: F
3135
+ });
3136
+ return oe(t.util, H), oe(t, {
3137
+ reducer: m,
3138
+ middleware: j
3139
+ }), {
3140
+ name: kn,
3141
+ injectEndpoint(U, $) {
3142
+ const z = t, x = z.endpoints[U] ??= {};
3143
+ Et($) && oe(x, {
3144
+ name: U,
3145
+ select: f(U, $),
3146
+ initiate: k(U, $)
3147
+ }, y(c, U)), Si($) && oe(x, {
3148
+ name: U,
3149
+ select: o(),
3150
+ initiate: Q(U)
3151
+ }, y(b, U)), tt($) && oe(x, {
3152
+ name: U,
3153
+ select: g(U, $),
3154
+ initiate: D(U, $)
3155
+ }, y(c, U));
3156
+ }
3157
+ };
3158
+ }
3159
+ });
3160
+ pr();
3161
+ var ct = { exports: {} }, At = {};
3162
+ var Mn;
3163
+ function qi() {
3164
+ if (Mn) return At;
3165
+ Mn = 1;
3166
+ var e = Ln;
3167
+ function t(C, P) {
3168
+ return C === P && (C !== 0 || 1 / C === 1 / P) || C !== C && P !== P;
3169
+ }
3170
+ var n = typeof Object.is == "function" ? Object.is : t, r = e.useSyncExternalStore, i = e.useRef, a = e.useEffect, v = e.useMemo, _ = e.useDebugValue;
3171
+ return At.useSyncExternalStoreWithSelector = function(C, P, T, I, A) {
3172
+ var R = i(null);
3173
+ if (R.current === null) {
3174
+ var d = { hasValue: !1, value: null };
3175
+ R.current = d;
3176
+ } else d = R.current;
3177
+ R = v(
3178
+ function() {
3179
+ function p(o) {
3180
+ if (!w) {
3181
+ if (w = !0, O = o, o = I(o), A !== void 0 && d.hasValue) {
3182
+ var c = d.value;
3183
+ if (A(c, o))
3184
+ return f = c;
3185
+ }
3186
+ return f = o;
3187
+ }
3188
+ if (c = f, n(O, o)) return c;
3189
+ var E = I(o);
3190
+ return A !== void 0 && A(c, E) ? (O = o, c) : (O = o, f = E);
3191
+ }
3192
+ var w = !1, O, f, g = T === void 0 ? null : T;
3193
+ return [
3194
+ function() {
3195
+ return p(P());
3196
+ },
3197
+ g === null ? void 0 : function() {
3198
+ return p(g());
3199
+ }
3200
+ ];
3201
+ },
3202
+ [P, T, I, A]
3203
+ );
3204
+ var S = r(C, R[0], R[1]);
3205
+ return a(
3206
+ function() {
3207
+ d.hasValue = !0, d.value = S;
3208
+ },
3209
+ [S]
3210
+ ), _(S), S;
3211
+ }, At;
3212
+ }
3213
+ var Ct = {};
3214
+ var Qn;
3215
+ function Fi() {
3216
+ return Qn || (Qn = 1, process.env.NODE_ENV !== "production" && (function() {
3217
+ function e(C, P) {
3218
+ return C === P && (C !== 0 || 1 / C === 1 / P) || C !== C && P !== P;
3219
+ }
3220
+ typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
3221
+ var t = Ln, n = typeof Object.is == "function" ? Object.is : e, r = t.useSyncExternalStore, i = t.useRef, a = t.useEffect, v = t.useMemo, _ = t.useDebugValue;
3222
+ Ct.useSyncExternalStoreWithSelector = function(C, P, T, I, A) {
3223
+ var R = i(null);
3224
+ if (R.current === null) {
3225
+ var d = { hasValue: !1, value: null };
3226
+ R.current = d;
3227
+ } else d = R.current;
3228
+ R = v(
3229
+ function() {
3230
+ function p(o) {
3231
+ if (!w) {
3232
+ if (w = !0, O = o, o = I(o), A !== void 0 && d.hasValue) {
3233
+ var c = d.value;
3234
+ if (A(c, o))
3235
+ return f = c;
3236
+ }
3237
+ return f = o;
3238
+ }
3239
+ if (c = f, n(O, o))
3240
+ return c;
3241
+ var E = I(o);
3242
+ return A !== void 0 && A(c, E) ? (O = o, c) : (O = o, f = E);
3243
+ }
3244
+ var w = !1, O, f, g = T === void 0 ? null : T;
3245
+ return [
3246
+ function() {
3247
+ return p(P());
3248
+ },
3249
+ g === null ? void 0 : function() {
3250
+ return p(g());
3251
+ }
3252
+ ];
3253
+ },
3254
+ [P, T, I, A]
3255
+ );
3256
+ var S = r(C, R[0], R[1]);
3257
+ return a(
3258
+ function() {
3259
+ d.hasValue = !0, d.value = S;
3260
+ },
3261
+ [S]
3262
+ ), _(S), S;
3263
+ }, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
3264
+ })()), Ct;
3265
+ }
3266
+ var qn;
3267
+ function xi() {
3268
+ return qn || (qn = 1, process.env.NODE_ENV === "production" ? ct.exports = qi() : ct.exports = Fi()), ct.exports;
3269
+ }
3270
+ var Vi = xi();
3271
+ function zi(e) {
3272
+ e();
3273
+ }
3274
+ function Fn(e, t) {
3275
+ return e === t ? e !== 0 || t !== 0 || 1 / e === 1 / t : e !== e && t !== t;
3276
+ }
3277
+ function ze(e, t) {
3278
+ if (Fn(e, t)) return !0;
3279
+ if (typeof e != "object" || e === null || typeof t != "object" || t === null)
3280
+ return !1;
3281
+ const n = Object.keys(e), r = Object.keys(t);
3282
+ if (n.length !== r.length) return !1;
3283
+ for (let i = 0; i < n.length; i++)
3284
+ if (!Object.prototype.hasOwnProperty.call(t, n[i]) || !Fn(e[n[i]], t[n[i]]))
3285
+ return !1;
3286
+ return !0;
3287
+ }
3288
+ var Ui = /* @__PURE__ */ Symbol.for("react-redux-context"), $i = typeof globalThis < "u" ? globalThis : (
3289
+ /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
3290
+ {}
3291
+ );
3292
+ function Li() {
3293
+ if (!he.createContext) return {};
3294
+ const e = $i[Ui] ??= /* @__PURE__ */ new Map();
3295
+ let t = e.get(he.createContext);
3296
+ return t || (t = he.createContext(
3297
+ null
3298
+ ), process.env.NODE_ENV !== "production" && (t.displayName = "ReactRedux"), e.set(he.createContext, t)), t;
3299
+ }
3300
+ var Pe = /* @__PURE__ */ Li();
3301
+ function on(e = Pe) {
3302
+ return function() {
3303
+ const n = he.useContext(e);
3304
+ if (process.env.NODE_ENV !== "production" && !n)
3305
+ throw new Error(
3306
+ "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
3307
+ );
3308
+ return n;
3309
+ };
3310
+ }
3311
+ var hr = /* @__PURE__ */ on();
3312
+ function yr(e = Pe) {
3313
+ const t = e === Pe ? hr : (
3314
+ // @ts-ignore
3315
+ on(e)
3316
+ ), n = () => {
3317
+ const { store: r } = t();
3318
+ return r;
3319
+ };
3320
+ return Object.assign(n, {
3321
+ withTypes: () => n
3322
+ }), n;
3323
+ }
3324
+ var gr = /* @__PURE__ */ yr();
3325
+ function ji(e = Pe) {
3326
+ const t = e === Pe ? gr : yr(e), n = () => t().dispatch;
3327
+ return Object.assign(n, {
3328
+ withTypes: () => n
3329
+ }), n;
3330
+ }
3331
+ var Ki = /* @__PURE__ */ ji(), Hi = (e, t) => e === t;
3332
+ function Wi(e = Pe) {
3333
+ const t = e === Pe ? hr : on(e), n = (r, i = {}) => {
3334
+ const { equalityFn: a = Hi } = typeof i == "function" ? { equalityFn: i } : i;
3335
+ if (process.env.NODE_ENV !== "production") {
3336
+ if (!r)
3337
+ throw new Error("You must pass a selector to useSelector");
3338
+ if (typeof r != "function")
3339
+ throw new Error("You must pass a function as a selector to useSelector");
3340
+ if (typeof a != "function")
3341
+ throw new Error(
3342
+ "You must pass a function as an equality function to useSelector"
3343
+ );
3344
+ }
3345
+ const v = t(), { store: _, subscription: C, getServerState: P } = v, T = he.useRef(!0), I = he.useCallback(
3346
+ {
3347
+ [r.name](R) {
3348
+ const d = r(R);
3349
+ if (process.env.NODE_ENV !== "production") {
3350
+ const { devModeChecks: S = {} } = typeof i == "function" ? {} : i, { identityFunctionCheck: p, stabilityCheck: w } = v, {
3351
+ identityFunctionCheck: O,
3352
+ stabilityCheck: f
3353
+ } = {
3354
+ stabilityCheck: w,
3355
+ identityFunctionCheck: p,
3356
+ ...S
3357
+ };
3358
+ if (f === "always" || f === "once" && T.current) {
3359
+ const g = r(R);
3360
+ if (!a(d, g)) {
3361
+ let o;
3362
+ try {
3363
+ throw new Error();
3364
+ } catch (c) {
3365
+ ({ stack: o } = c);
3366
+ }
3367
+ console.warn(
3368
+ "Selector " + (r.name || "unknown") + ` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
3369
+ Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,
3370
+ {
3371
+ state: R,
3372
+ selected: d,
3373
+ selected2: g,
3374
+ stack: o
3375
+ }
3376
+ );
3377
+ }
3378
+ }
3379
+ if ((O === "always" || O === "once" && T.current) && d === R) {
3380
+ let g;
3381
+ try {
3382
+ throw new Error();
3383
+ } catch (o) {
3384
+ ({ stack: g } = o);
3385
+ }
3386
+ console.warn(
3387
+ "Selector " + (r.name || "unknown") + ` returned the root state when called. This can lead to unnecessary rerenders.
3388
+ Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,
3389
+ { stack: g }
3390
+ );
3391
+ }
3392
+ T.current && (T.current = !1);
3393
+ }
3394
+ return d;
3395
+ }
3396
+ }[r.name],
3397
+ [r]
3398
+ ), A = Vi.useSyncExternalStoreWithSelector(
3399
+ C.addNestedSub,
3400
+ _.getState,
3401
+ P || _.getState,
3402
+ I,
3403
+ a
3404
+ );
3405
+ return he.useDebugValue(A), A;
3406
+ };
3407
+ return Object.assign(n, {
3408
+ withTypes: () => n
3409
+ }), n;
3410
+ }
3411
+ var Bi = /* @__PURE__ */ Wi(), Gi = zi;
3412
+ function at(e) {
3413
+ return e.replace(e[0], e[0].toUpperCase());
3414
+ }
3415
+ function Yi(e) {
3416
+ let t = 0;
3417
+ for (const n in e)
3418
+ t++;
3419
+ return t;
3420
+ }
3421
+ var Ji = "query", Xi = "mutation", Zi = "infinitequery";
3422
+ function eo(e) {
3423
+ return e.type === Ji;
3424
+ }
3425
+ function to(e) {
3426
+ return e.type === Xi;
3427
+ }
3428
+ function mr(e) {
3429
+ return e.type === Zi;
3430
+ }
3431
+ function Qe(e, ...t) {
3432
+ return Object.assign(e, ...t);
3433
+ }
3434
+ var Tt = Symbol();
3435
+ function Dt(e) {
3436
+ const t = fe(e), n = G(() => Zt(t.current, e), [e]);
3437
+ return de(() => {
3438
+ t.current !== n && (t.current = n);
3439
+ }, [n]), n;
3440
+ }
3441
+ function Ie(e) {
3442
+ const t = fe(e);
3443
+ return de(() => {
3444
+ ze(t.current, e) || (t.current = e);
3445
+ }, [e]), ze(t.current, e) ? t.current : e;
3446
+ }
3447
+ var no = () => typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", ro = /* @__PURE__ */ no(), io = () => typeof navigator < "u" && navigator.product === "ReactNative", oo = /* @__PURE__ */ io(), so = () => ro || oo ? Cr : de, co = /* @__PURE__ */ so(), xn = (e) => e.isUninitialized ? {
3448
+ ...e,
3449
+ isUninitialized: !1,
3450
+ isFetching: !0,
3451
+ isLoading: e.data === void 0,
3452
+ // This is the one place where we still have to use `QueryStatus` as an enum,
3453
+ // since it's the only reference in the React package and not in the core.
3454
+ status: tr.pending
3455
+ } : e;
3456
+ function Nt(e, ...t) {
3457
+ const n = {};
3458
+ return t.forEach((r) => {
3459
+ n[r] = e[r];
3460
+ }), n;
3461
+ }
3462
+ var kt = ["data", "status", "isLoading", "isSuccess", "isError", "error"];
3463
+ function ao({
3464
+ api: e,
3465
+ moduleOptions: {
3466
+ batch: t,
3467
+ hooks: {
3468
+ useDispatch: n,
3469
+ useSelector: r,
3470
+ useStore: i
3471
+ },
3472
+ unstable__sideEffectsInRender: a,
3473
+ createSelector: v
3474
+ },
3475
+ serializeQueryArgs: _,
3476
+ context: C
3477
+ }) {
3478
+ const P = a ? (c) => c() : de, T = (c) => c.current?.unsubscribe?.(), I = C.endpointDefinitions;
3479
+ return {
3480
+ buildQueryHooks: f,
3481
+ buildInfiniteQueryHooks: g,
3482
+ buildMutationHook: o,
3483
+ usePrefetch: d
3484
+ };
3485
+ function A(c, E, b) {
3486
+ if (E?.endpointName && c.isUninitialized) {
3487
+ const {
3488
+ endpointName: m
3489
+ } = E, N = I[m];
3490
+ b !== te && _({
3491
+ queryArgs: E.originalArgs,
3492
+ endpointDefinition: N,
3493
+ endpointName: m
3494
+ }) === _({
3495
+ queryArgs: b,
3496
+ endpointDefinition: N,
3497
+ endpointName: m
3498
+ }) && (E = void 0);
3499
+ }
3500
+ let h = c.isSuccess ? c.data : E?.data;
3501
+ h === void 0 && (h = c.data);
3502
+ const l = h !== void 0, s = c.isLoading, u = (!E || E.isLoading || E.isUninitialized) && !l && s, y = c.isSuccess || l && (s && !E?.isError || c.isUninitialized);
3503
+ return {
3504
+ ...c,
3505
+ data: h,
3506
+ currentData: c.data,
3507
+ isFetching: s,
3508
+ isLoading: u,
3509
+ isSuccess: y
3510
+ };
3511
+ }
3512
+ function R(c, E, b) {
3513
+ if (E?.endpointName && c.isUninitialized) {
3514
+ const {
3515
+ endpointName: m
3516
+ } = E, N = I[m];
3517
+ b !== te && _({
3518
+ queryArgs: E.originalArgs,
3519
+ endpointDefinition: N,
3520
+ endpointName: m
3521
+ }) === _({
3522
+ queryArgs: b,
3523
+ endpointDefinition: N,
3524
+ endpointName: m
3525
+ }) && (E = void 0);
3526
+ }
3527
+ let h = c.isSuccess ? c.data : E?.data;
3528
+ h === void 0 && (h = c.data);
3529
+ const l = h !== void 0, s = c.isLoading, u = (!E || E.isLoading || E.isUninitialized) && !l && s, y = c.isSuccess || s && l;
3530
+ return {
3531
+ ...c,
3532
+ data: h,
3533
+ currentData: c.data,
3534
+ isFetching: s,
3535
+ isLoading: u,
3536
+ isSuccess: y
3537
+ };
3538
+ }
3539
+ function d(c, E) {
3540
+ const b = n(), h = Ie(E);
3541
+ return ge((l, s) => b(e.util.prefetch(c, l, {
3542
+ ...h,
3543
+ ...s
3544
+ })), [c, b, h]);
3545
+ }
3546
+ function S(c, E, {
3547
+ refetchOnReconnect: b,
3548
+ refetchOnFocus: h,
3549
+ refetchOnMountOrArgChange: l,
3550
+ skip: s = !1,
3551
+ pollingInterval: u = 0,
3552
+ skipPollingIfUnfocused: y = !1,
3553
+ ...m
3554
+ } = {}) {
3555
+ const {
3556
+ initiate: N
3557
+ } = e.endpoints[c], M = n(), F = fe(void 0);
3558
+ if (!F.current) {
3559
+ const z = M(e.internalActions.internal_getRTKQSubscriptions());
3560
+ if (process.env.NODE_ENV !== "production" && (typeof z != "object" || typeof z?.type == "string"))
3561
+ throw new Error(process.env.NODE_ENV === "production" ? ye(37) : `Warning: Middleware for RTK-Query API at reducerPath "${e.reducerPath}" has not been added to the store.
3562
+ You must add the middleware for RTK-Query to function correctly!`);
3563
+ F.current = z;
3564
+ }
3565
+ const k = Dt(s ? te : E), D = Ie({
3566
+ refetchOnReconnect: b,
3567
+ refetchOnFocus: h,
3568
+ pollingInterval: u,
3569
+ skipPollingIfUnfocused: y
3570
+ }), Q = m.initialPageParam, V = Ie(Q), L = m.refetchCachedPages, K = Ie(L), q = fe(void 0);
3571
+ let {
3572
+ queryCacheKey: j,
3573
+ requestId: H
3574
+ } = q.current || {}, U = !1;
3575
+ j && H && (U = F.current.isRequestSubscribed(j, H));
3576
+ const $ = !U && q.current !== void 0;
3577
+ return P(() => {
3578
+ $ && (q.current = void 0);
3579
+ }, [$]), P(() => {
3580
+ const z = q.current;
3581
+ if (typeof process < "u" && process.env.NODE_ENV === "removeMeOnCompilation" && console.log($), k === te) {
3582
+ z?.unsubscribe(), q.current = void 0;
3583
+ return;
3584
+ }
3585
+ const x = q.current?.subscriptionOptions;
3586
+ if (!z || z.arg !== k) {
3587
+ z?.unsubscribe();
3588
+ const ne = M(N(k, {
3589
+ subscriptionOptions: D,
3590
+ forceRefetch: l,
3591
+ ...mr(I[c]) ? {
3592
+ initialPageParam: V,
3593
+ refetchCachedPages: K
3594
+ } : {}
3595
+ }));
3596
+ q.current = ne;
3597
+ } else D !== x && z.updateSubscriptionOptions(D);
3598
+ }, [M, N, l, k, D, $, V, K, c]), [q, M, N, D];
3599
+ }
3600
+ function p(c, E) {
3601
+ return (h, {
3602
+ skip: l = !1,
3603
+ selectFromResult: s
3604
+ } = {}) => {
3605
+ const {
3606
+ select: u
3607
+ } = e.endpoints[c], y = Dt(l ? te : h), m = fe(void 0), N = G(() => (
3608
+ // Normally ts-ignores are bad and should be avoided, but we're
3609
+ // already casting this selector to be `Selector<any>` anyway,
3610
+ // so the inconsistencies don't matter here
3611
+ // @ts-ignore
3612
+ v([
3613
+ // @ts-ignore
3614
+ u(y),
3615
+ (Q, V) => V,
3616
+ (Q) => y
3617
+ ], E, {
3618
+ memoizeOptions: {
3619
+ resultEqualityCheck: ze
3620
+ }
3621
+ })
3622
+ ), [u, y]), M = G(() => s ? v([N], s, {
3623
+ devModeChecks: {
3624
+ identityFunctionCheck: "never"
3625
+ }
3626
+ }) : N, [N, s]), F = r((Q) => M(Q, m.current), ze), k = i(), D = N(k.getState(), m.current);
3627
+ return co(() => {
3628
+ m.current = D;
3629
+ }, [D]), F;
3630
+ };
3631
+ }
3632
+ function w(c) {
3633
+ de(() => () => {
3634
+ T(c), c.current = void 0;
3635
+ }, [c]);
3636
+ }
3637
+ function O(c) {
3638
+ if (!c.current) throw new Error(process.env.NODE_ENV === "production" ? ye(38) : "Cannot refetch a query that has not been started yet.");
3639
+ return c.current.refetch();
3640
+ }
3641
+ function f(c) {
3642
+ const E = (l, s = {}) => {
3643
+ const [u] = S(c, l, s);
3644
+ return w(u), G(() => ({
3645
+ /**
3646
+ * A method to manually refetch data for the query
3647
+ */
3648
+ refetch: () => O(u)
3649
+ }), [u]);
3650
+ }, b = ({
3651
+ refetchOnReconnect: l,
3652
+ refetchOnFocus: s,
3653
+ pollingInterval: u = 0,
3654
+ skipPollingIfUnfocused: y = !1
3655
+ } = {}) => {
3656
+ const {
3657
+ initiate: m
3658
+ } = e.endpoints[c], N = n(), [M, F] = un(Tt), k = fe(void 0), D = Ie({
3659
+ refetchOnReconnect: l,
3660
+ refetchOnFocus: s,
3661
+ pollingInterval: u,
3662
+ skipPollingIfUnfocused: y
3663
+ });
3664
+ P(() => {
3665
+ const K = k.current?.subscriptionOptions;
3666
+ D !== K && k.current?.updateSubscriptionOptions(D);
3667
+ }, [D]);
3668
+ const Q = fe(D);
3669
+ P(() => {
3670
+ Q.current = D;
3671
+ }, [D]);
3672
+ const V = ge(function(K, q = !1) {
3673
+ let j;
3674
+ return t(() => {
3675
+ T(k), k.current = j = N(m(K, {
3676
+ subscriptionOptions: Q.current,
3677
+ forceRefetch: !q
3678
+ })), F(K);
3679
+ }), j;
3680
+ }, [N, m]), L = ge(() => {
3681
+ k.current?.queryCacheKey && N(e.internalActions.removeQueryResult({
3682
+ queryCacheKey: k.current?.queryCacheKey
3683
+ }));
3684
+ }, [N]);
3685
+ return de(() => () => {
3686
+ T(k);
3687
+ }, []), de(() => {
3688
+ M !== Tt && !k.current && V(M, !0);
3689
+ }, [M, V]), G(() => [V, M, {
3690
+ reset: L
3691
+ }], [V, M, L]);
3692
+ }, h = p(c, A);
3693
+ return {
3694
+ useQueryState: h,
3695
+ useQuerySubscription: E,
3696
+ useLazyQuerySubscription: b,
3697
+ useLazyQuery(l) {
3698
+ const [s, u, {
3699
+ reset: y
3700
+ }] = b(l), m = h(u, {
3701
+ ...l,
3702
+ skip: u === Tt
3703
+ }), N = G(() => ({
3704
+ lastArg: u
3705
+ }), [u]);
3706
+ return G(() => [s, {
3707
+ ...m,
3708
+ reset: y
3709
+ }, N], [s, m, y, N]);
3710
+ },
3711
+ useQuery(l, s) {
3712
+ const u = E(l, s), y = h(l, {
3713
+ selectFromResult: l === te || s?.skip ? void 0 : xn,
3714
+ ...s
3715
+ }), m = Nt(y, ...kt);
3716
+ return Rt(m), G(() => ({
3717
+ ...y,
3718
+ ...u
3719
+ }), [y, u]);
3720
+ }
3721
+ };
3722
+ }
3723
+ function g(c) {
3724
+ const E = (h, l = {}) => {
3725
+ const [s, u, y, m] = S(c, h, l), N = fe(m);
3726
+ P(() => {
3727
+ N.current = m;
3728
+ }, [m]);
3729
+ const M = l.refetchCachedPages, F = Ie(M), k = ge(function(V, L) {
3730
+ let K;
3731
+ return t(() => {
3732
+ T(s), s.current = K = u(y(V, {
3733
+ subscriptionOptions: N.current,
3734
+ direction: L
3735
+ }));
3736
+ }), K;
3737
+ }, [s, u, y]);
3738
+ w(s);
3739
+ const D = Dt(l.skip ? te : h), Q = ge((V) => {
3740
+ if (!s.current) throw new Error(process.env.NODE_ENV === "production" ? ye(38) : "Cannot refetch a query that has not been started yet.");
3741
+ const L = {
3742
+ refetchCachedPages: V?.refetchCachedPages ?? F
3743
+ };
3744
+ return s.current.refetch(L);
3745
+ }, [s, F]);
3746
+ return G(() => ({
3747
+ trigger: k,
3748
+ /**
3749
+ * A method to manually refetch data for the query
3750
+ */
3751
+ refetch: Q,
3752
+ fetchNextPage: () => k(D, "forward"),
3753
+ fetchPreviousPage: () => k(D, "backward")
3754
+ }), [Q, k, D]);
3755
+ }, b = p(c, R);
3756
+ return {
3757
+ useInfiniteQueryState: b,
3758
+ useInfiniteQuerySubscription: E,
3759
+ useInfiniteQuery(h, l) {
3760
+ const {
3761
+ refetch: s,
3762
+ fetchNextPage: u,
3763
+ fetchPreviousPage: y
3764
+ } = E(h, l), m = b(h, {
3765
+ selectFromResult: h === te || l?.skip ? void 0 : xn,
3766
+ ...l
3767
+ }), N = Nt(m, ...kt, "hasNextPage", "hasPreviousPage");
3768
+ return Rt(N), G(() => ({
3769
+ ...m,
3770
+ fetchNextPage: u,
3771
+ fetchPreviousPage: y,
3772
+ refetch: s
3773
+ }), [m, u, y, s]);
3774
+ }
3775
+ };
3776
+ }
3777
+ function o(c) {
3778
+ return ({
3779
+ selectFromResult: E,
3780
+ fixedCacheKey: b
3781
+ } = {}) => {
3782
+ const {
3783
+ select: h,
3784
+ initiate: l
3785
+ } = e.endpoints[c], s = n(), [u, y] = un();
3786
+ de(() => () => {
3787
+ u?.arg.fixedCacheKey || u?.reset();
3788
+ }, [u]);
3789
+ const m = ge(function(K) {
3790
+ const q = s(l(K, {
3791
+ fixedCacheKey: b
3792
+ }));
3793
+ return y(q), q;
3794
+ }, [s, l, b]), {
3795
+ requestId: N
3796
+ } = u || {}, M = G(() => h({
3797
+ fixedCacheKey: b,
3798
+ requestId: u?.requestId
3799
+ }), [b, u, h]), F = G(() => E ? v([M], E) : M, [E, M]), k = r(F, ze), D = b == null ? u?.arg.originalArgs : void 0, Q = ge(() => {
3800
+ t(() => {
3801
+ u && y(void 0), b && s(e.internalActions.removeMutationResult({
3802
+ requestId: N,
3803
+ fixedCacheKey: b
3804
+ }));
3805
+ });
3806
+ }, [s, b, u, N]), V = Nt(k, ...kt, "endpointName");
3807
+ Rt(V);
3808
+ const L = G(() => ({
3809
+ ...k,
3810
+ originalArgs: D,
3811
+ reset: Q
3812
+ }), [k, D, Q]);
3813
+ return G(() => [m, L], [m, L]);
3814
+ };
3815
+ }
3816
+ }
3817
+ var uo = /* @__PURE__ */ Symbol(), lo = ({
3818
+ batch: e = Gi,
3819
+ hooks: t = {
3820
+ useDispatch: Ki,
3821
+ useSelector: Bi,
3822
+ useStore: gr
3823
+ },
3824
+ createSelector: n = er,
3825
+ unstable__sideEffectsInRender: r = !1,
3826
+ ...i
3827
+ } = {}) => {
3828
+ if (process.env.NODE_ENV !== "production") {
3829
+ const a = ["useDispatch", "useSelector", "useStore"];
3830
+ let v = !1;
3831
+ for (const _ of a)
3832
+ if (Yi(i) > 0 && (i[_] && (v || (console.warn("As of RTK 2.0, the hooks now need to be specified as one object, provided under a `hooks` key:\n`reactHooksModule({ hooks: { useDispatch, useSelector, useStore } })`"), v = !0)), t[_] = i[_]), typeof t[_] != "function")
3833
+ throw new Error(process.env.NODE_ENV === "production" ? ye(36) : `When using custom hooks for context, all ${a.length} hooks need to be provided: ${a.join(", ")}.
3834
+ Hook ${_} was either not provided or not a function.`);
3835
+ }
3836
+ return {
3837
+ name: uo,
3838
+ init(a, {
3839
+ serializeQueryArgs: v
3840
+ }, _) {
3841
+ const C = a, {
3842
+ buildQueryHooks: P,
3843
+ buildInfiniteQueryHooks: T,
3844
+ buildMutationHook: I,
3845
+ usePrefetch: A
3846
+ } = ao({
3847
+ api: a,
3848
+ moduleOptions: {
3849
+ batch: e,
3850
+ hooks: t,
3851
+ unstable__sideEffectsInRender: r,
3852
+ createSelector: n
3853
+ },
3854
+ serializeQueryArgs: v,
3855
+ context: _
3856
+ });
3857
+ return Qe(C, {
3858
+ usePrefetch: A
3859
+ }), Qe(_, {
3860
+ batch: e
3861
+ }), {
3862
+ injectEndpoint(R, d) {
3863
+ if (eo(d)) {
3864
+ const {
3865
+ useQuery: S,
3866
+ useLazyQuery: p,
3867
+ useLazyQuerySubscription: w,
3868
+ useQueryState: O,
3869
+ useQuerySubscription: f
3870
+ } = P(R);
3871
+ Qe(C.endpoints[R], {
3872
+ useQuery: S,
3873
+ useLazyQuery: p,
3874
+ useLazyQuerySubscription: w,
3875
+ useQueryState: O,
3876
+ useQuerySubscription: f
3877
+ }), a[`use${at(R)}Query`] = S, a[`useLazy${at(R)}Query`] = p;
3878
+ }
3879
+ if (to(d)) {
3880
+ const S = I(R);
3881
+ Qe(C.endpoints[R], {
3882
+ useMutation: S
3883
+ }), a[`use${at(R)}Mutation`] = S;
3884
+ } else if (mr(d)) {
3885
+ const {
3886
+ useInfiniteQuery: S,
3887
+ useInfiniteQuerySubscription: p,
3888
+ useInfiniteQueryState: w
3889
+ } = T(R);
3890
+ Qe(C.endpoints[R], {
3891
+ useInfiniteQuery: S,
3892
+ useInfiniteQuerySubscription: p,
3893
+ useInfiniteQueryState: w
3894
+ }), a[`use${at(R)}InfiniteQuery`] = S;
3895
+ }
3896
+ }
3897
+ };
3898
+ }
3899
+ };
3900
+ }, fo = /* @__PURE__ */ dr(pr(), lo());
3901
+ const nt = "auth";
3902
+ let vr = null;
3903
+ function po() {
3904
+ return vr;
3905
+ }
3906
+ function _o(e) {
3907
+ vr = e;
3908
+ }
3909
+ const ho = {
3910
+ token: null
3911
+ }, Sr = Se({
3912
+ name: nt,
3913
+ initialState: ho,
3914
+ reducers: {
3915
+ setToken: (e, t) => {
3916
+ e.token = t.payload;
3917
+ },
3918
+ logout: (e) => {
3919
+ e.token = null;
3920
+ }
3921
+ }
3922
+ }), { setToken: br, logout: Vn } = Sr.actions, Eo = Sr.reducer, wo = (e) => e[nt].token, Po = (e) => !!e[nt].token, yo = "api", wt = fo({
3923
+ reducerPath: yo,
3924
+ baseQuery: gi({
3925
+ baseUrl: process.env.VITE_API_BASE_URL || "",
3926
+ prepareHeaders: (e, { getState: t }) => {
3927
+ const r = t()[nt], i = r ? r.token : void 0, a = po();
3928
+ return i && (a ? a.prepareHeaders(e, i) : e.set("Authorization", `Bearer ${i}`)), e;
3929
+ }
3930
+ }),
3931
+ endpoints: () => ({})
3932
+ }), Ro = wt.reducer, Oo = wt.middleware, _r = ["App", "Authentication"], Er = wt.enhanceEndpoints({
3933
+ addTagTypes: _r
3934
+ }).injectEndpoints({
3935
+ endpoints: (e) => ({
3936
+ appControllerGetData: e.query({
3937
+ query: () => ({ url: "/api" }),
3938
+ providesTags: ["App"]
3939
+ }),
3940
+ authControllerLogin: e.mutation({
3941
+ query: (t) => ({
3942
+ url: "/api/auth/login",
3943
+ method: "POST",
3944
+ body: t.loginDto
3945
+ }),
3946
+ invalidatesTags: ["Authentication"]
3947
+ }),
3948
+ authControllerGetProfile: e.query({
3949
+ query: () => ({ url: "/api/profile" }),
3950
+ providesTags: ["Authentication"]
3951
+ })
3952
+ }),
3953
+ overrideExisting: !1
3954
+ }), {
3955
+ useAppControllerGetDataQuery: go,
3956
+ useAuthControllerLoginMutation: mo,
3957
+ useAuthControllerGetProfileQuery: vo
3958
+ } = Er, Io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3959
+ __proto__: null,
3960
+ addTagTypes: _r,
3961
+ api: Er,
3962
+ useAppControllerGetDataQuery: go,
3963
+ useAuthControllerGetProfileQuery: vo,
3964
+ useAuthControllerLoginMutation: mo
3965
+ }, Symbol.toStringTag, { value: "Module" }));
3966
+ function Ao(e) {
3967
+ return {
3968
+ prepareHeaders(t, n) {
3969
+ const r = e.formatValue ? e.formatValue(n) : n;
3970
+ t.set(e.headerName, r);
3971
+ }
3972
+ };
3973
+ }
3974
+ let be = {};
3975
+ function Co(e) {
3976
+ be = e;
3977
+ }
3978
+ function To() {
3979
+ const e = Ar();
3980
+ return e.startListening({
3981
+ actionCreator: Vn,
3982
+ effect: (t, n) => {
3983
+ n.dispatch(wt.util.resetApiState()), be.onLogout && be.onLogout();
3984
+ }
3985
+ }), e.startListening({
3986
+ matcher: $e(br, Vn),
3987
+ effect: (t, n) => {
3988
+ if (!be.persistence) return;
3989
+ const r = n.getState();
3990
+ be.persistence.setToken(r[nt].token);
3991
+ }
3992
+ }), e.middleware;
3993
+ }
3994
+ function Do() {
3995
+ let e = !1;
3996
+ return (t) => (n) => (r) => {
3997
+ if (!e && be.persistence) {
3998
+ e = !0;
3999
+ const i = be.persistence.getToken();
4000
+ i && t.dispatch(br(i));
4001
+ }
4002
+ return n(r);
4003
+ };
4004
+ }
4005
+ function No(e, t = "token") {
4006
+ return {
4007
+ getToken: () => {
4008
+ try {
4009
+ return e.getItem(t);
4010
+ } catch {
4011
+ return null;
4012
+ }
4013
+ },
4014
+ setToken: (n) => {
4015
+ try {
4016
+ n ? e.setItem(t, n) : e.removeItem(t);
4017
+ } catch {
4018
+ }
4019
+ }
4020
+ };
4021
+ }
4022
+ export {
4023
+ yo as ApiKey,
4024
+ nt as AuthKey,
4025
+ _r as addTagTypes,
4026
+ Er as api,
4027
+ Oo as apiMiddleware,
4028
+ Ro as apiReducer,
4029
+ Eo as authReducer,
4030
+ Sr as authSlice,
4031
+ wt as baseApi,
4032
+ Co as configureAuth,
4033
+ Do as createAuthHydrationMiddleware,
4034
+ To as createAuthListenerMiddleware,
4035
+ Ao as createCustomHeaderAdapter,
4036
+ Io as demoScaffoldBackend,
4037
+ po as getAuthAdapter,
4038
+ Vn as logout,
4039
+ Po as selectIsAuthenticated,
4040
+ wo as selectToken,
4041
+ _o as setAuthAdapter,
4042
+ br as setToken,
4043
+ No as storagePersistence,
4044
+ go as useAppControllerGetDataQuery,
4045
+ vo as useAuthControllerGetProfileQuery,
4046
+ mo as useAuthControllerLoginMutation
4047
+ };