@open-kingdom/shared-frontend-data-access-logger 0.0.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1442 -0
- package/dist/lib/console-listener.d.ts +2 -0
- package/dist/lib/console-listener.d.ts.map +1 -0
- package/dist/lib/logger.actions.d.ts +15 -0
- package/dist/lib/logger.actions.d.ts.map +1 -0
- package/dist/lib/logger.middleware.d.ts +3 -0
- package/dist/lib/logger.middleware.d.ts.map +1 -0
- package/dist/lib/logger.selectors.d.ts +118 -0
- package/dist/lib/logger.selectors.d.ts.map +1 -0
- package/dist/lib/logger.slice.d.ts +9 -0
- package/dist/lib/logger.slice.d.ts.map +1 -0
- package/dist/lib/logger.types.d.ts +20 -0
- package/dist/lib/logger.types.d.ts.map +1 -0
- package/package.json +32 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1442 @@
|
|
|
1
|
+
function tt(e) {
|
|
2
|
+
if (typeof e != "object" || e === null)
|
|
3
|
+
return !1;
|
|
4
|
+
let t = e;
|
|
5
|
+
for (; Object.getPrototypeOf(t) !== null; )
|
|
6
|
+
t = Object.getPrototypeOf(t);
|
|
7
|
+
return Object.getPrototypeOf(e) === t || Object.getPrototypeOf(e) === null;
|
|
8
|
+
}
|
|
9
|
+
function Me(e) {
|
|
10
|
+
return tt(e) && "type" in e && typeof e.type == "string";
|
|
11
|
+
}
|
|
12
|
+
var Ie = Symbol.for("immer-nothing"), we = Symbol.for("immer-draftable"), S = Symbol.for("immer-state"), rt = process.env.NODE_ENV !== "production" ? [
|
|
13
|
+
// All error codes, starting by 0:
|
|
14
|
+
function(e) {
|
|
15
|
+
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
16
|
+
},
|
|
17
|
+
function(e) {
|
|
18
|
+
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}'`;
|
|
19
|
+
},
|
|
20
|
+
"This object has been frozen and should not be mutated",
|
|
21
|
+
function(e) {
|
|
22
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
23
|
+
},
|
|
24
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
25
|
+
"Immer forbids circular references",
|
|
26
|
+
"The first or second argument to `produce` must be a function",
|
|
27
|
+
"The third argument to `produce` must be a function or undefined",
|
|
28
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
29
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
30
|
+
function(e) {
|
|
31
|
+
return `'current' expects a draft, got: ${e}`;
|
|
32
|
+
},
|
|
33
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
34
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
35
|
+
"Immer only supports deleting array indices",
|
|
36
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
37
|
+
function(e) {
|
|
38
|
+
return `'original' expects a draft, got: ${e}`;
|
|
39
|
+
}
|
|
40
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
41
|
+
// See Patches.ts for additional errors
|
|
42
|
+
] : [];
|
|
43
|
+
function N(e, ...t) {
|
|
44
|
+
if (process.env.NODE_ENV !== "production") {
|
|
45
|
+
const r = rt[e], n = typeof r == "function" ? r.apply(null, t) : r;
|
|
46
|
+
throw new Error(`[Immer] ${n}`);
|
|
47
|
+
}
|
|
48
|
+
throw new Error(
|
|
49
|
+
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
var F = Object.getPrototypeOf;
|
|
53
|
+
function M(e) {
|
|
54
|
+
return !!e && !!e[S];
|
|
55
|
+
}
|
|
56
|
+
function D(e) {
|
|
57
|
+
return e ? je(e) || Array.isArray(e) || !!e[we] || !!e.constructor?.[we] || x(e) || Q(e) : !1;
|
|
58
|
+
}
|
|
59
|
+
var nt = Object.prototype.constructor.toString(), ve = /* @__PURE__ */ new WeakMap();
|
|
60
|
+
function je(e) {
|
|
61
|
+
if (!e || typeof e != "object")
|
|
62
|
+
return !1;
|
|
63
|
+
const t = Object.getPrototypeOf(e);
|
|
64
|
+
if (t === null || t === Object.prototype)
|
|
65
|
+
return !0;
|
|
66
|
+
const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
|
|
67
|
+
if (r === Object)
|
|
68
|
+
return !0;
|
|
69
|
+
if (typeof r != "function")
|
|
70
|
+
return !1;
|
|
71
|
+
let n = ve.get(r);
|
|
72
|
+
return n === void 0 && (n = Function.toString.call(r), ve.set(r, n)), n === nt;
|
|
73
|
+
}
|
|
74
|
+
function q(e, t, r = !0) {
|
|
75
|
+
X(e) === 0 ? (r ? Reflect.ownKeys(e) : Object.keys(e)).forEach((o) => {
|
|
76
|
+
t(o, e[o], e);
|
|
77
|
+
}) : e.forEach((n, o) => t(o, n, e));
|
|
78
|
+
}
|
|
79
|
+
function X(e) {
|
|
80
|
+
const t = e[S];
|
|
81
|
+
return t ? t.type_ : Array.isArray(e) ? 1 : x(e) ? 2 : Q(e) ? 3 : 0;
|
|
82
|
+
}
|
|
83
|
+
function se(e, t) {
|
|
84
|
+
return X(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
|
|
85
|
+
}
|
|
86
|
+
function ze(e, t, r) {
|
|
87
|
+
const n = X(e);
|
|
88
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
89
|
+
}
|
|
90
|
+
function ot(e, t) {
|
|
91
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
92
|
+
}
|
|
93
|
+
function x(e) {
|
|
94
|
+
return e instanceof Map;
|
|
95
|
+
}
|
|
96
|
+
function Q(e) {
|
|
97
|
+
return e instanceof Set;
|
|
98
|
+
}
|
|
99
|
+
function R(e) {
|
|
100
|
+
return e.copy_ || e.base_;
|
|
101
|
+
}
|
|
102
|
+
function ce(e, t) {
|
|
103
|
+
if (x(e))
|
|
104
|
+
return new Map(e);
|
|
105
|
+
if (Q(e))
|
|
106
|
+
return new Set(e);
|
|
107
|
+
if (Array.isArray(e))
|
|
108
|
+
return Array.prototype.slice.call(e);
|
|
109
|
+
const r = je(e);
|
|
110
|
+
if (t === !0 || t === "class_only" && !r) {
|
|
111
|
+
const n = Object.getOwnPropertyDescriptors(e);
|
|
112
|
+
delete n[S];
|
|
113
|
+
let o = Reflect.ownKeys(n);
|
|
114
|
+
for (let i = 0; i < o.length; i++) {
|
|
115
|
+
const s = o[i], c = n[s];
|
|
116
|
+
c.writable === !1 && (c.writable = !0, c.configurable = !0), (c.get || c.set) && (n[s] = {
|
|
117
|
+
configurable: !0,
|
|
118
|
+
writable: !0,
|
|
119
|
+
// could live with !!desc.set as well here...
|
|
120
|
+
enumerable: c.enumerable,
|
|
121
|
+
value: e[s]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return Object.create(F(e), n);
|
|
125
|
+
} else {
|
|
126
|
+
const n = F(e);
|
|
127
|
+
if (n !== null && r)
|
|
128
|
+
return { ...e };
|
|
129
|
+
const o = Object.create(n);
|
|
130
|
+
return Object.assign(o, e);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function he(e, t = !1) {
|
|
134
|
+
return Z(e) || M(e) || !D(e) || (X(e) > 1 && Object.defineProperties(e, {
|
|
135
|
+
set: W,
|
|
136
|
+
add: W,
|
|
137
|
+
clear: W,
|
|
138
|
+
delete: W
|
|
139
|
+
}), Object.freeze(e), t && Object.values(e).forEach((r) => he(r, !0))), e;
|
|
140
|
+
}
|
|
141
|
+
function it() {
|
|
142
|
+
N(2);
|
|
143
|
+
}
|
|
144
|
+
var W = {
|
|
145
|
+
value: it
|
|
146
|
+
};
|
|
147
|
+
function Z(e) {
|
|
148
|
+
return e === null || typeof e != "object" ? !0 : Object.isFrozen(e);
|
|
149
|
+
}
|
|
150
|
+
var st = {};
|
|
151
|
+
function I(e) {
|
|
152
|
+
const t = st[e];
|
|
153
|
+
return t || N(0, e), t;
|
|
154
|
+
}
|
|
155
|
+
var $;
|
|
156
|
+
function Ae() {
|
|
157
|
+
return $;
|
|
158
|
+
}
|
|
159
|
+
function ct(e, t) {
|
|
160
|
+
return {
|
|
161
|
+
drafts_: [],
|
|
162
|
+
parent_: e,
|
|
163
|
+
immer_: t,
|
|
164
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
165
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
166
|
+
canAutoFreeze_: !0,
|
|
167
|
+
unfinalizedDrafts_: 0
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function Ee(e, t) {
|
|
171
|
+
t && (I("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
172
|
+
}
|
|
173
|
+
function ae(e) {
|
|
174
|
+
ue(e), e.drafts_.forEach(at), e.drafts_ = null;
|
|
175
|
+
}
|
|
176
|
+
function ue(e) {
|
|
177
|
+
e === $ && ($ = e.parent_);
|
|
178
|
+
}
|
|
179
|
+
function be(e) {
|
|
180
|
+
return $ = ct($, e);
|
|
181
|
+
}
|
|
182
|
+
function at(e) {
|
|
183
|
+
const t = e[S];
|
|
184
|
+
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
185
|
+
}
|
|
186
|
+
function Ce(e, t) {
|
|
187
|
+
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
188
|
+
const r = t.drafts_[0];
|
|
189
|
+
return e !== void 0 && e !== r ? (r[S].modified_ && (ae(t), N(4)), D(e) && (e = H(t, e), t.parent_ || G(t, e)), t.patches_ && I("Patches").generateReplacementPatches_(
|
|
190
|
+
r[S].base_,
|
|
191
|
+
e,
|
|
192
|
+
t.patches_,
|
|
193
|
+
t.inversePatches_
|
|
194
|
+
)) : e = H(t, r, []), ae(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Ie ? e : void 0;
|
|
195
|
+
}
|
|
196
|
+
function H(e, t, r) {
|
|
197
|
+
if (Z(t))
|
|
198
|
+
return t;
|
|
199
|
+
const n = e.immer_.shouldUseStrictIteration(), o = t[S];
|
|
200
|
+
if (!o)
|
|
201
|
+
return q(
|
|
202
|
+
t,
|
|
203
|
+
(i, s) => Ne(e, o, t, i, s, r),
|
|
204
|
+
n
|
|
205
|
+
), t;
|
|
206
|
+
if (o.scope_ !== e)
|
|
207
|
+
return t;
|
|
208
|
+
if (!o.modified_)
|
|
209
|
+
return G(e, o.base_, !0), o.base_;
|
|
210
|
+
if (!o.finalized_) {
|
|
211
|
+
o.finalized_ = !0, o.scope_.unfinalizedDrafts_--;
|
|
212
|
+
const i = o.copy_;
|
|
213
|
+
let s = i, c = !1;
|
|
214
|
+
o.type_ === 3 && (s = new Set(i), i.clear(), c = !0), q(
|
|
215
|
+
s,
|
|
216
|
+
(u, l) => Ne(
|
|
217
|
+
e,
|
|
218
|
+
o,
|
|
219
|
+
i,
|
|
220
|
+
u,
|
|
221
|
+
l,
|
|
222
|
+
r,
|
|
223
|
+
c
|
|
224
|
+
),
|
|
225
|
+
n
|
|
226
|
+
), G(e, i, !1), r && e.patches_ && I("Patches").generatePatches_(
|
|
227
|
+
o,
|
|
228
|
+
r,
|
|
229
|
+
e.patches_,
|
|
230
|
+
e.inversePatches_
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return o.copy_;
|
|
234
|
+
}
|
|
235
|
+
function Ne(e, t, r, n, o, i, s) {
|
|
236
|
+
if (o == null || typeof o != "object" && !s)
|
|
237
|
+
return;
|
|
238
|
+
const c = Z(o);
|
|
239
|
+
if (!(c && !s)) {
|
|
240
|
+
if (process.env.NODE_ENV !== "production" && o === r && N(5), M(o)) {
|
|
241
|
+
const u = i && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
242
|
+
!se(t.assigned_, n) ? i.concat(n) : void 0, l = H(e, o, u);
|
|
243
|
+
if (ze(r, n, l), M(l))
|
|
244
|
+
e.canAutoFreeze_ = !1;
|
|
245
|
+
else
|
|
246
|
+
return;
|
|
247
|
+
} else s && r.add(o);
|
|
248
|
+
if (D(o) && !c) {
|
|
249
|
+
if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1 || t && t.base_ && t.base_[n] === o && c)
|
|
250
|
+
return;
|
|
251
|
+
H(e, o), (!t || !t.scope_.parent_) && typeof n != "symbol" && (x(r) ? r.has(n) : Object.prototype.propertyIsEnumerable.call(r, n)) && G(e, o);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function G(e, t, r = !1) {
|
|
256
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && he(t, r);
|
|
257
|
+
}
|
|
258
|
+
function ut(e, t) {
|
|
259
|
+
const r = Array.isArray(e), n = {
|
|
260
|
+
type_: r ? 1 : 0,
|
|
261
|
+
// Track which produce call this is associated with.
|
|
262
|
+
scope_: t ? t.scope_ : Ae(),
|
|
263
|
+
// True for both shallow and deep changes.
|
|
264
|
+
modified_: !1,
|
|
265
|
+
// Used during finalization.
|
|
266
|
+
finalized_: !1,
|
|
267
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
268
|
+
assigned_: {},
|
|
269
|
+
// The parent draft state.
|
|
270
|
+
parent_: t,
|
|
271
|
+
// The base state.
|
|
272
|
+
base_: e,
|
|
273
|
+
// The base proxy.
|
|
274
|
+
draft_: null,
|
|
275
|
+
// set below
|
|
276
|
+
// The base copy with any updated values.
|
|
277
|
+
copy_: null,
|
|
278
|
+
// Called by the `produce` function.
|
|
279
|
+
revoke_: null,
|
|
280
|
+
isManual_: !1
|
|
281
|
+
};
|
|
282
|
+
let o = n, i = me;
|
|
283
|
+
r && (o = [n], i = L);
|
|
284
|
+
const { revoke: s, proxy: c } = Proxy.revocable(o, i);
|
|
285
|
+
return n.draft_ = c, n.revoke_ = s, c;
|
|
286
|
+
}
|
|
287
|
+
var me = {
|
|
288
|
+
get(e, t) {
|
|
289
|
+
if (t === S)
|
|
290
|
+
return e;
|
|
291
|
+
const r = R(e);
|
|
292
|
+
if (!se(r, t))
|
|
293
|
+
return lt(e, r, t);
|
|
294
|
+
const n = r[t];
|
|
295
|
+
return e.finalized_ || !D(n) ? n : n === oe(e.base_, t) ? (ie(e), e.copy_[t] = fe(n, e)) : n;
|
|
296
|
+
},
|
|
297
|
+
has(e, t) {
|
|
298
|
+
return t in R(e);
|
|
299
|
+
},
|
|
300
|
+
ownKeys(e) {
|
|
301
|
+
return Reflect.ownKeys(R(e));
|
|
302
|
+
},
|
|
303
|
+
set(e, t, r) {
|
|
304
|
+
const n = Fe(R(e), t);
|
|
305
|
+
if (n?.set)
|
|
306
|
+
return n.set.call(e.draft_, r), !0;
|
|
307
|
+
if (!e.modified_) {
|
|
308
|
+
const o = oe(R(e), t), i = o?.[S];
|
|
309
|
+
if (i && i.base_ === r)
|
|
310
|
+
return e.copy_[t] = r, e.assigned_[t] = !1, !0;
|
|
311
|
+
if (ot(r, o) && (r !== void 0 || se(e.base_, t)))
|
|
312
|
+
return !0;
|
|
313
|
+
ie(e), le(e);
|
|
314
|
+
}
|
|
315
|
+
return e.copy_[t] === r && // special case: handle new props with value 'undefined'
|
|
316
|
+
(r !== void 0 || t in e.copy_) || // special case: NaN
|
|
317
|
+
Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
|
|
318
|
+
},
|
|
319
|
+
deleteProperty(e, t) {
|
|
320
|
+
return oe(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, ie(e), le(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
|
|
321
|
+
},
|
|
322
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
323
|
+
// the same guarantee in ES5 mode.
|
|
324
|
+
getOwnPropertyDescriptor(e, t) {
|
|
325
|
+
const r = R(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
326
|
+
return n && {
|
|
327
|
+
writable: !0,
|
|
328
|
+
configurable: e.type_ !== 1 || t !== "length",
|
|
329
|
+
enumerable: n.enumerable,
|
|
330
|
+
value: r[t]
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
defineProperty() {
|
|
334
|
+
N(11);
|
|
335
|
+
},
|
|
336
|
+
getPrototypeOf(e) {
|
|
337
|
+
return F(e.base_);
|
|
338
|
+
},
|
|
339
|
+
setPrototypeOf() {
|
|
340
|
+
N(12);
|
|
341
|
+
}
|
|
342
|
+
}, L = {};
|
|
343
|
+
q(me, (e, t) => {
|
|
344
|
+
L[e] = function() {
|
|
345
|
+
return arguments[0] = arguments[0][0], t.apply(this, arguments);
|
|
346
|
+
};
|
|
347
|
+
});
|
|
348
|
+
L.deleteProperty = function(e, t) {
|
|
349
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && N(13), L.set.call(this, e, t, void 0);
|
|
350
|
+
};
|
|
351
|
+
L.set = function(e, t, r) {
|
|
352
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && N(14), me.set.call(this, e[0], t, r, e[0]);
|
|
353
|
+
};
|
|
354
|
+
function oe(e, t) {
|
|
355
|
+
const r = e[S];
|
|
356
|
+
return (r ? R(r) : e)[t];
|
|
357
|
+
}
|
|
358
|
+
function lt(e, t, r) {
|
|
359
|
+
const n = Fe(t, r);
|
|
360
|
+
return n ? "value" in n ? n.value : (
|
|
361
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
362
|
+
// prototype, we should invoke it with the draft as context!
|
|
363
|
+
n.get?.call(e.draft_)
|
|
364
|
+
) : void 0;
|
|
365
|
+
}
|
|
366
|
+
function Fe(e, t) {
|
|
367
|
+
if (!(t in e))
|
|
368
|
+
return;
|
|
369
|
+
let r = F(e);
|
|
370
|
+
for (; r; ) {
|
|
371
|
+
const n = Object.getOwnPropertyDescriptor(r, t);
|
|
372
|
+
if (n)
|
|
373
|
+
return n;
|
|
374
|
+
r = F(r);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
function le(e) {
|
|
378
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && le(e.parent_));
|
|
379
|
+
}
|
|
380
|
+
function ie(e) {
|
|
381
|
+
e.copy_ || (e.copy_ = ce(
|
|
382
|
+
e.base_,
|
|
383
|
+
e.scope_.immer_.useStrictShallowCopy_
|
|
384
|
+
));
|
|
385
|
+
}
|
|
386
|
+
var ft = class {
|
|
387
|
+
constructor(e) {
|
|
388
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !0, this.produce = (t, r, n) => {
|
|
389
|
+
if (typeof t == "function" && typeof r != "function") {
|
|
390
|
+
const i = r;
|
|
391
|
+
r = t;
|
|
392
|
+
const s = this;
|
|
393
|
+
return function(u = i, ...l) {
|
|
394
|
+
return s.produce(u, (f) => r.call(this, f, ...l));
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
typeof r != "function" && N(6), n !== void 0 && typeof n != "function" && N(7);
|
|
398
|
+
let o;
|
|
399
|
+
if (D(t)) {
|
|
400
|
+
const i = be(this), s = fe(t, void 0);
|
|
401
|
+
let c = !0;
|
|
402
|
+
try {
|
|
403
|
+
o = r(s), c = !1;
|
|
404
|
+
} finally {
|
|
405
|
+
c ? ae(i) : ue(i);
|
|
406
|
+
}
|
|
407
|
+
return Ee(i, n), Ce(o, i);
|
|
408
|
+
} else if (!t || typeof t != "object") {
|
|
409
|
+
if (o = r(t), o === void 0 && (o = t), o === Ie && (o = void 0), this.autoFreeze_ && he(o, !0), n) {
|
|
410
|
+
const i = [], s = [];
|
|
411
|
+
I("Patches").generateReplacementPatches_(t, o, i, s), n(i, s);
|
|
412
|
+
}
|
|
413
|
+
return o;
|
|
414
|
+
} else
|
|
415
|
+
N(1, t);
|
|
416
|
+
}, this.produceWithPatches = (t, r) => {
|
|
417
|
+
if (typeof t == "function")
|
|
418
|
+
return (s, ...c) => this.produceWithPatches(s, (u) => t(u, ...c));
|
|
419
|
+
let n, o;
|
|
420
|
+
return [this.produce(t, r, (s, c) => {
|
|
421
|
+
n = s, o = c;
|
|
422
|
+
}), n, o];
|
|
423
|
+
}, typeof e?.autoFreeze == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof e?.useStrictShallowCopy == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy), typeof e?.useStrictIteration == "boolean" && this.setUseStrictIteration(e.useStrictIteration);
|
|
424
|
+
}
|
|
425
|
+
createDraft(e) {
|
|
426
|
+
D(e) || N(8), M(e) && (e = dt(e));
|
|
427
|
+
const t = be(this), r = fe(e, void 0);
|
|
428
|
+
return r[S].isManual_ = !0, ue(t), r;
|
|
429
|
+
}
|
|
430
|
+
finishDraft(e, t) {
|
|
431
|
+
const r = e && e[S];
|
|
432
|
+
(!r || !r.isManual_) && N(9);
|
|
433
|
+
const { scope_: n } = r;
|
|
434
|
+
return Ee(n, t), Ce(void 0, n);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
438
|
+
*
|
|
439
|
+
* By default, auto-freezing is enabled.
|
|
440
|
+
*/
|
|
441
|
+
setAutoFreeze(e) {
|
|
442
|
+
this.autoFreeze_ = e;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Pass true to enable strict shallow copy.
|
|
446
|
+
*
|
|
447
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
448
|
+
*/
|
|
449
|
+
setUseStrictShallowCopy(e) {
|
|
450
|
+
this.useStrictShallowCopy_ = e;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
454
|
+
* but still handles symbols for compatibility.
|
|
455
|
+
*
|
|
456
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
457
|
+
*/
|
|
458
|
+
setUseStrictIteration(e) {
|
|
459
|
+
this.useStrictIteration_ = e;
|
|
460
|
+
}
|
|
461
|
+
shouldUseStrictIteration() {
|
|
462
|
+
return this.useStrictIteration_;
|
|
463
|
+
}
|
|
464
|
+
applyPatches(e, t) {
|
|
465
|
+
let r;
|
|
466
|
+
for (r = t.length - 1; r >= 0; r--) {
|
|
467
|
+
const o = t[r];
|
|
468
|
+
if (o.path.length === 0 && o.op === "replace") {
|
|
469
|
+
e = o.value;
|
|
470
|
+
break;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
r > -1 && (t = t.slice(r + 1));
|
|
474
|
+
const n = I("Patches").applyPatches_;
|
|
475
|
+
return M(e) ? n(e, t) : this.produce(
|
|
476
|
+
e,
|
|
477
|
+
(o) => n(o, t)
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
function fe(e, t) {
|
|
482
|
+
const r = x(e) ? I("MapSet").proxyMap_(e, t) : Q(e) ? I("MapSet").proxySet_(e, t) : ut(e, t);
|
|
483
|
+
return (t ? t.scope_ : Ae()).drafts_.push(r), r;
|
|
484
|
+
}
|
|
485
|
+
function dt(e) {
|
|
486
|
+
return M(e) || N(10, e), $e(e);
|
|
487
|
+
}
|
|
488
|
+
function $e(e) {
|
|
489
|
+
if (!D(e) || Z(e))
|
|
490
|
+
return e;
|
|
491
|
+
const t = e[S];
|
|
492
|
+
let r, n = !0;
|
|
493
|
+
if (t) {
|
|
494
|
+
if (!t.modified_)
|
|
495
|
+
return t.base_;
|
|
496
|
+
t.finalized_ = !0, r = ce(e, t.scope_.immer_.useStrictShallowCopy_), n = t.scope_.immer_.shouldUseStrictIteration();
|
|
497
|
+
} else
|
|
498
|
+
r = ce(e, !0);
|
|
499
|
+
return q(
|
|
500
|
+
r,
|
|
501
|
+
(o, i) => {
|
|
502
|
+
ze(r, o, $e(i));
|
|
503
|
+
},
|
|
504
|
+
n
|
|
505
|
+
), t && (t.finalized_ = !1), r;
|
|
506
|
+
}
|
|
507
|
+
var de = new ft(), Le = de.produce, pt = /* @__PURE__ */ de.setUseStrictIteration.bind(
|
|
508
|
+
de
|
|
509
|
+
), yt = (e, t, r) => {
|
|
510
|
+
if (t.length === 1 && t[0] === r) {
|
|
511
|
+
let n = !1;
|
|
512
|
+
try {
|
|
513
|
+
const o = {};
|
|
514
|
+
e(o) === o && (n = !0);
|
|
515
|
+
} catch {
|
|
516
|
+
}
|
|
517
|
+
if (n) {
|
|
518
|
+
let o;
|
|
519
|
+
try {
|
|
520
|
+
throw new Error();
|
|
521
|
+
} catch (i) {
|
|
522
|
+
({ stack: o } = i);
|
|
523
|
+
}
|
|
524
|
+
console.warn(
|
|
525
|
+
`The result function returned its own inputs without modification. e.g
|
|
526
|
+
\`createSelector([state => state.todos], todos => todos)\`
|
|
527
|
+
This could lead to inefficient memoization and unnecessary re-renders.
|
|
528
|
+
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,
|
|
529
|
+
{ stack: o }
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}, ht = (e, t, r) => {
|
|
534
|
+
const { memoize: n, memoizeOptions: o } = t, { inputSelectorResults: i, inputSelectorResultsCopy: s } = e, c = n(() => ({}), ...o);
|
|
535
|
+
if (!(c.apply(null, i) === c.apply(null, s))) {
|
|
536
|
+
let l;
|
|
537
|
+
try {
|
|
538
|
+
throw new Error();
|
|
539
|
+
} catch (f) {
|
|
540
|
+
({ stack: l } = f);
|
|
541
|
+
}
|
|
542
|
+
console.warn(
|
|
543
|
+
`An input selector returned a different result when passed same arguments.
|
|
544
|
+
This means your output selector will likely run more frequently than intended.
|
|
545
|
+
Avoid returning a new reference inside your input selector, e.g.
|
|
546
|
+
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,
|
|
547
|
+
{
|
|
548
|
+
arguments: r,
|
|
549
|
+
firstInputs: i,
|
|
550
|
+
secondInputs: s,
|
|
551
|
+
stack: l
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
}, mt = {
|
|
556
|
+
inputStabilityCheck: "once",
|
|
557
|
+
identityFunctionCheck: "once"
|
|
558
|
+
};
|
|
559
|
+
function gt(e, t = `expected a function, instead received ${typeof e}`) {
|
|
560
|
+
if (typeof e != "function")
|
|
561
|
+
throw new TypeError(t);
|
|
562
|
+
}
|
|
563
|
+
function _t(e, t = `expected an object, instead received ${typeof e}`) {
|
|
564
|
+
if (typeof e != "object")
|
|
565
|
+
throw new TypeError(t);
|
|
566
|
+
}
|
|
567
|
+
function wt(e, t = "expected all items to be functions, instead received the following types: ") {
|
|
568
|
+
if (!e.every((r) => typeof r == "function")) {
|
|
569
|
+
const r = e.map(
|
|
570
|
+
(n) => typeof n == "function" ? `function ${n.name || "unnamed"}()` : typeof n
|
|
571
|
+
).join(", ");
|
|
572
|
+
throw new TypeError(`${t}[${r}]`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
var Oe = (e) => Array.isArray(e) ? e : [e];
|
|
576
|
+
function vt(e) {
|
|
577
|
+
const t = Array.isArray(e[0]) ? e[0] : e;
|
|
578
|
+
return wt(
|
|
579
|
+
t,
|
|
580
|
+
"createSelector expects all input-selectors to be functions, but received the following types: "
|
|
581
|
+
), t;
|
|
582
|
+
}
|
|
583
|
+
function Se(e, t) {
|
|
584
|
+
const r = [], { length: n } = e;
|
|
585
|
+
for (let o = 0; o < n; o++)
|
|
586
|
+
r.push(e[o].apply(null, t));
|
|
587
|
+
return r;
|
|
588
|
+
}
|
|
589
|
+
var Et = (e, t) => {
|
|
590
|
+
const { identityFunctionCheck: r, inputStabilityCheck: n } = {
|
|
591
|
+
...mt,
|
|
592
|
+
...t
|
|
593
|
+
};
|
|
594
|
+
return {
|
|
595
|
+
identityFunctionCheck: {
|
|
596
|
+
shouldRun: r === "always" || r === "once" && e,
|
|
597
|
+
run: yt
|
|
598
|
+
},
|
|
599
|
+
inputStabilityCheck: {
|
|
600
|
+
shouldRun: n === "always" || n === "once" && e,
|
|
601
|
+
run: ht
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
}, bt = class {
|
|
605
|
+
constructor(e) {
|
|
606
|
+
this.value = e;
|
|
607
|
+
}
|
|
608
|
+
deref() {
|
|
609
|
+
return this.value;
|
|
610
|
+
}
|
|
611
|
+
}, Ct = typeof WeakRef < "u" ? WeakRef : bt, Nt = 0, ke = 1;
|
|
612
|
+
function B() {
|
|
613
|
+
return {
|
|
614
|
+
s: Nt,
|
|
615
|
+
v: void 0,
|
|
616
|
+
o: null,
|
|
617
|
+
p: null
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
function xe(e, t = {}) {
|
|
621
|
+
let r = B();
|
|
622
|
+
const { resultEqualityCheck: n } = t;
|
|
623
|
+
let o, i = 0;
|
|
624
|
+
function s() {
|
|
625
|
+
let c = r;
|
|
626
|
+
const { length: u } = arguments;
|
|
627
|
+
for (let h = 0, v = u; h < v; h++) {
|
|
628
|
+
const a = arguments[h];
|
|
629
|
+
if (typeof a == "function" || typeof a == "object" && a !== null) {
|
|
630
|
+
let d = c.o;
|
|
631
|
+
d === null && (c.o = d = /* @__PURE__ */ new WeakMap());
|
|
632
|
+
const g = d.get(a);
|
|
633
|
+
g === void 0 ? (c = B(), d.set(a, c)) : c = g;
|
|
634
|
+
} else {
|
|
635
|
+
let d = c.p;
|
|
636
|
+
d === null && (c.p = d = /* @__PURE__ */ new Map());
|
|
637
|
+
const g = d.get(a);
|
|
638
|
+
g === void 0 ? (c = B(), d.set(a, c)) : c = g;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
const l = c;
|
|
642
|
+
let f;
|
|
643
|
+
if (c.s === ke)
|
|
644
|
+
f = c.v;
|
|
645
|
+
else if (f = e.apply(null, arguments), i++, n) {
|
|
646
|
+
const h = o?.deref?.() ?? o;
|
|
647
|
+
h != null && n(h, f) && (f = h, i !== 0 && i--), o = typeof f == "object" && f !== null || typeof f == "function" ? new Ct(f) : f;
|
|
648
|
+
}
|
|
649
|
+
return l.s = ke, l.v = f, f;
|
|
650
|
+
}
|
|
651
|
+
return s.clearCache = () => {
|
|
652
|
+
r = B(), s.resetResultsCount();
|
|
653
|
+
}, s.resultsCount = () => i, s.resetResultsCount = () => {
|
|
654
|
+
i = 0;
|
|
655
|
+
}, s;
|
|
656
|
+
}
|
|
657
|
+
function Ot(e, ...t) {
|
|
658
|
+
const r = typeof e == "function" ? {
|
|
659
|
+
memoize: e,
|
|
660
|
+
memoizeOptions: t
|
|
661
|
+
} : e, n = (...o) => {
|
|
662
|
+
let i = 0, s = 0, c, u = {}, l = o.pop();
|
|
663
|
+
typeof l == "object" && (u = l, l = o.pop()), gt(
|
|
664
|
+
l,
|
|
665
|
+
`createSelector expects an output function after the inputs, but received: [${typeof l}]`
|
|
666
|
+
);
|
|
667
|
+
const f = {
|
|
668
|
+
...r,
|
|
669
|
+
...u
|
|
670
|
+
}, {
|
|
671
|
+
memoize: h,
|
|
672
|
+
memoizeOptions: v = [],
|
|
673
|
+
argsMemoize: a = xe,
|
|
674
|
+
argsMemoizeOptions: d = [],
|
|
675
|
+
devModeChecks: g = {}
|
|
676
|
+
} = f, O = Oe(v), w = Oe(d), k = vt(o), y = h(function() {
|
|
677
|
+
return i++, l.apply(
|
|
678
|
+
null,
|
|
679
|
+
arguments
|
|
680
|
+
);
|
|
681
|
+
}, ...O);
|
|
682
|
+
let p = !0;
|
|
683
|
+
const m = a(function() {
|
|
684
|
+
s++;
|
|
685
|
+
const C = Se(
|
|
686
|
+
k,
|
|
687
|
+
arguments
|
|
688
|
+
);
|
|
689
|
+
if (c = y.apply(null, C), process.env.NODE_ENV !== "production") {
|
|
690
|
+
const { identityFunctionCheck: E, inputStabilityCheck: A } = Et(p, g);
|
|
691
|
+
if (E.shouldRun && E.run(
|
|
692
|
+
l,
|
|
693
|
+
C,
|
|
694
|
+
c
|
|
695
|
+
), A.shouldRun) {
|
|
696
|
+
const ne = Se(
|
|
697
|
+
k,
|
|
698
|
+
arguments
|
|
699
|
+
);
|
|
700
|
+
A.run(
|
|
701
|
+
{ inputSelectorResults: C, inputSelectorResultsCopy: ne },
|
|
702
|
+
{ memoize: h, memoizeOptions: O },
|
|
703
|
+
arguments
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
p && (p = !1);
|
|
707
|
+
}
|
|
708
|
+
return c;
|
|
709
|
+
}, ...w);
|
|
710
|
+
return Object.assign(m, {
|
|
711
|
+
resultFunc: l,
|
|
712
|
+
memoizedResultFunc: y,
|
|
713
|
+
dependencies: k,
|
|
714
|
+
dependencyRecomputations: () => s,
|
|
715
|
+
resetDependencyRecomputations: () => {
|
|
716
|
+
s = 0;
|
|
717
|
+
},
|
|
718
|
+
lastResult: () => c,
|
|
719
|
+
recomputations: () => i,
|
|
720
|
+
resetRecomputations: () => {
|
|
721
|
+
i = 0;
|
|
722
|
+
},
|
|
723
|
+
memoize: h,
|
|
724
|
+
argsMemoize: a
|
|
725
|
+
});
|
|
726
|
+
};
|
|
727
|
+
return Object.assign(n, {
|
|
728
|
+
withTypes: () => n
|
|
729
|
+
}), n;
|
|
730
|
+
}
|
|
731
|
+
var ee = /* @__PURE__ */ Ot(xe), St = Object.assign(
|
|
732
|
+
(e, t = ee) => {
|
|
733
|
+
_t(
|
|
734
|
+
e,
|
|
735
|
+
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`
|
|
736
|
+
);
|
|
737
|
+
const r = Object.keys(e), n = r.map(
|
|
738
|
+
(i) => e[i]
|
|
739
|
+
);
|
|
740
|
+
return t(
|
|
741
|
+
n,
|
|
742
|
+
(...i) => i.reduce((s, c, u) => (s[r[u]] = c, s), {})
|
|
743
|
+
);
|
|
744
|
+
},
|
|
745
|
+
{ withTypes: () => St }
|
|
746
|
+
);
|
|
747
|
+
function z(e, t) {
|
|
748
|
+
function r(...n) {
|
|
749
|
+
if (t) {
|
|
750
|
+
let o = t(...n);
|
|
751
|
+
if (!o)
|
|
752
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(0) : "prepareAction did not return an object");
|
|
753
|
+
return {
|
|
754
|
+
type: e,
|
|
755
|
+
payload: o.payload,
|
|
756
|
+
..."meta" in o && {
|
|
757
|
+
meta: o.meta
|
|
758
|
+
},
|
|
759
|
+
..."error" in o && {
|
|
760
|
+
error: o.error
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
return {
|
|
765
|
+
type: e,
|
|
766
|
+
payload: n[0]
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
return r.toString = () => `${e}`, r.type = e, r.match = (n) => Me(n) && n.type === e, r;
|
|
770
|
+
}
|
|
771
|
+
function De(e) {
|
|
772
|
+
return D(e) ? Le(e, () => {
|
|
773
|
+
}) : e;
|
|
774
|
+
}
|
|
775
|
+
function U(e, t, r) {
|
|
776
|
+
return e.has(t) ? e.get(t) : e.set(t, r(t)).get(t);
|
|
777
|
+
}
|
|
778
|
+
function Ve(e) {
|
|
779
|
+
const t = {}, r = [];
|
|
780
|
+
let n;
|
|
781
|
+
const o = {
|
|
782
|
+
addCase(i, s) {
|
|
783
|
+
if (process.env.NODE_ENV !== "production") {
|
|
784
|
+
if (r.length > 0)
|
|
785
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
786
|
+
if (n)
|
|
787
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
788
|
+
}
|
|
789
|
+
const c = typeof i == "string" ? i : i.type;
|
|
790
|
+
if (!c)
|
|
791
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
792
|
+
if (c in t)
|
|
793
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${c}'`);
|
|
794
|
+
return t[c] = s, o;
|
|
795
|
+
},
|
|
796
|
+
addAsyncThunk(i, s) {
|
|
797
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
798
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
799
|
+
return s.pending && (t[i.pending.type] = s.pending), s.rejected && (t[i.rejected.type] = s.rejected), s.fulfilled && (t[i.fulfilled.type] = s.fulfilled), s.settled && r.push({
|
|
800
|
+
matcher: i.settled,
|
|
801
|
+
reducer: s.settled
|
|
802
|
+
}), o;
|
|
803
|
+
},
|
|
804
|
+
addMatcher(i, s) {
|
|
805
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
806
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
807
|
+
return r.push({
|
|
808
|
+
matcher: i,
|
|
809
|
+
reducer: s
|
|
810
|
+
}), o;
|
|
811
|
+
},
|
|
812
|
+
addDefaultCase(i) {
|
|
813
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
814
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(31) : "`builder.addDefaultCase` can only be called once");
|
|
815
|
+
return n = i, o;
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
return e(o), [t, r, n];
|
|
819
|
+
}
|
|
820
|
+
pt(!1);
|
|
821
|
+
function kt(e) {
|
|
822
|
+
return typeof e == "function";
|
|
823
|
+
}
|
|
824
|
+
function Dt(e, t) {
|
|
825
|
+
if (process.env.NODE_ENV !== "production" && typeof t == "object")
|
|
826
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
827
|
+
let [r, n, o] = Ve(t), i;
|
|
828
|
+
if (kt(e))
|
|
829
|
+
i = () => De(e());
|
|
830
|
+
else {
|
|
831
|
+
const c = De(e);
|
|
832
|
+
i = () => c;
|
|
833
|
+
}
|
|
834
|
+
function s(c = i(), u) {
|
|
835
|
+
let l = [r[u.type], ...n.filter(({
|
|
836
|
+
matcher: f
|
|
837
|
+
}) => f(u)).map(({
|
|
838
|
+
reducer: f
|
|
839
|
+
}) => f)];
|
|
840
|
+
return l.filter((f) => !!f).length === 0 && (l = [o]), l.reduce((f, h) => {
|
|
841
|
+
if (h)
|
|
842
|
+
if (M(f)) {
|
|
843
|
+
const a = h(f, u);
|
|
844
|
+
return a === void 0 ? f : a;
|
|
845
|
+
} else {
|
|
846
|
+
if (D(f))
|
|
847
|
+
return Le(f, (v) => h(v, u));
|
|
848
|
+
{
|
|
849
|
+
const v = h(f, u);
|
|
850
|
+
if (v === void 0) {
|
|
851
|
+
if (f === null)
|
|
852
|
+
return f;
|
|
853
|
+
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
854
|
+
}
|
|
855
|
+
return v;
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
return f;
|
|
859
|
+
}, c);
|
|
860
|
+
}
|
|
861
|
+
return s.getInitialState = i, s;
|
|
862
|
+
}
|
|
863
|
+
var Rt = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW", Pt = (e = 21) => {
|
|
864
|
+
let t = "", r = e;
|
|
865
|
+
for (; r--; )
|
|
866
|
+
t += Rt[Math.random() * 64 | 0];
|
|
867
|
+
return t;
|
|
868
|
+
}, Tt = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
869
|
+
function Mt(e, t) {
|
|
870
|
+
return `${e}/${t}`;
|
|
871
|
+
}
|
|
872
|
+
function It({
|
|
873
|
+
creators: e
|
|
874
|
+
} = {}) {
|
|
875
|
+
const t = e?.asyncThunk?.[Tt];
|
|
876
|
+
return function(n) {
|
|
877
|
+
const {
|
|
878
|
+
name: o,
|
|
879
|
+
reducerPath: i = o
|
|
880
|
+
} = n;
|
|
881
|
+
if (!o)
|
|
882
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(11) : "`name` is a required option for createSlice");
|
|
883
|
+
typeof process < "u" && process.env.NODE_ENV === "development" && n.initialState === void 0 && console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
884
|
+
const s = (typeof n.reducers == "function" ? n.reducers(At()) : n.reducers) || {}, c = Object.keys(s), u = {
|
|
885
|
+
sliceCaseReducersByName: {},
|
|
886
|
+
sliceCaseReducersByType: {},
|
|
887
|
+
actionCreators: {},
|
|
888
|
+
sliceMatchers: []
|
|
889
|
+
}, l = {
|
|
890
|
+
addCase(y, p) {
|
|
891
|
+
const m = typeof y == "string" ? y : y.type;
|
|
892
|
+
if (!m)
|
|
893
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(12) : "`context.addCase` cannot be called with an empty action type");
|
|
894
|
+
if (m in u.sliceCaseReducersByType)
|
|
895
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + m);
|
|
896
|
+
return u.sliceCaseReducersByType[m] = p, l;
|
|
897
|
+
},
|
|
898
|
+
addMatcher(y, p) {
|
|
899
|
+
return u.sliceMatchers.push({
|
|
900
|
+
matcher: y,
|
|
901
|
+
reducer: p
|
|
902
|
+
}), l;
|
|
903
|
+
},
|
|
904
|
+
exposeAction(y, p) {
|
|
905
|
+
return u.actionCreators[y] = p, l;
|
|
906
|
+
},
|
|
907
|
+
exposeCaseReducer(y, p) {
|
|
908
|
+
return u.sliceCaseReducersByName[y] = p, l;
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
c.forEach((y) => {
|
|
912
|
+
const p = s[y], m = {
|
|
913
|
+
reducerName: y,
|
|
914
|
+
type: Mt(o, y),
|
|
915
|
+
createNotation: typeof n.reducers == "function"
|
|
916
|
+
};
|
|
917
|
+
$t(p) ? xt(m, p, l, t) : Ft(m, p, l);
|
|
918
|
+
});
|
|
919
|
+
function f() {
|
|
920
|
+
if (process.env.NODE_ENV !== "production" && typeof n.extraReducers == "object")
|
|
921
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
922
|
+
const [y = {}, p = [], m = void 0] = typeof n.extraReducers == "function" ? Ve(n.extraReducers) : [n.extraReducers], b = {
|
|
923
|
+
...y,
|
|
924
|
+
...u.sliceCaseReducersByType
|
|
925
|
+
};
|
|
926
|
+
return Dt(n.initialState, (C) => {
|
|
927
|
+
for (let E in b)
|
|
928
|
+
C.addCase(E, b[E]);
|
|
929
|
+
for (let E of u.sliceMatchers)
|
|
930
|
+
C.addMatcher(E.matcher, E.reducer);
|
|
931
|
+
for (let E of p)
|
|
932
|
+
C.addMatcher(E.matcher, E.reducer);
|
|
933
|
+
m && C.addDefaultCase(m);
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
const h = (y) => y, v = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new WeakMap();
|
|
937
|
+
let d;
|
|
938
|
+
function g(y, p) {
|
|
939
|
+
return d || (d = f()), d(y, p);
|
|
940
|
+
}
|
|
941
|
+
function O() {
|
|
942
|
+
return d || (d = f()), d.getInitialState();
|
|
943
|
+
}
|
|
944
|
+
function w(y, p = !1) {
|
|
945
|
+
function m(C) {
|
|
946
|
+
let E = C[y];
|
|
947
|
+
if (typeof E > "u") {
|
|
948
|
+
if (p)
|
|
949
|
+
E = U(a, m, O);
|
|
950
|
+
else if (process.env.NODE_ENV !== "production")
|
|
951
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
952
|
+
}
|
|
953
|
+
return E;
|
|
954
|
+
}
|
|
955
|
+
function b(C = h) {
|
|
956
|
+
const E = U(v, p, () => /* @__PURE__ */ new WeakMap());
|
|
957
|
+
return U(E, C, () => {
|
|
958
|
+
const A = {};
|
|
959
|
+
for (const [ne, et] of Object.entries(n.selectors ?? {}))
|
|
960
|
+
A[ne] = jt(et, C, () => U(a, C, O), p);
|
|
961
|
+
return A;
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
return {
|
|
965
|
+
reducerPath: y,
|
|
966
|
+
getSelectors: b,
|
|
967
|
+
get selectors() {
|
|
968
|
+
return b(m);
|
|
969
|
+
},
|
|
970
|
+
selectSlice: m
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
const k = {
|
|
974
|
+
name: o,
|
|
975
|
+
reducer: g,
|
|
976
|
+
actions: u.actionCreators,
|
|
977
|
+
caseReducers: u.sliceCaseReducersByName,
|
|
978
|
+
getInitialState: O,
|
|
979
|
+
...w(i),
|
|
980
|
+
injectInto(y, {
|
|
981
|
+
reducerPath: p,
|
|
982
|
+
...m
|
|
983
|
+
} = {}) {
|
|
984
|
+
const b = p ?? i;
|
|
985
|
+
return y.inject({
|
|
986
|
+
reducerPath: b,
|
|
987
|
+
reducer: g
|
|
988
|
+
}, m), {
|
|
989
|
+
...k,
|
|
990
|
+
...w(b, !0)
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
return k;
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
function jt(e, t, r, n) {
|
|
998
|
+
function o(i, ...s) {
|
|
999
|
+
let c = t(i);
|
|
1000
|
+
if (typeof c > "u") {
|
|
1001
|
+
if (n)
|
|
1002
|
+
c = r();
|
|
1003
|
+
else if (process.env.NODE_ENV !== "production")
|
|
1004
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1005
|
+
}
|
|
1006
|
+
return e(c, ...s);
|
|
1007
|
+
}
|
|
1008
|
+
return o.unwrapped = e, o;
|
|
1009
|
+
}
|
|
1010
|
+
var zt = /* @__PURE__ */ It();
|
|
1011
|
+
function At() {
|
|
1012
|
+
function e(t, r) {
|
|
1013
|
+
return {
|
|
1014
|
+
_reducerDefinitionType: "asyncThunk",
|
|
1015
|
+
payloadCreator: t,
|
|
1016
|
+
...r
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
return e.withTypes = () => e, {
|
|
1020
|
+
reducer(t) {
|
|
1021
|
+
return Object.assign({
|
|
1022
|
+
// hack so the wrapping function has the same name as the original
|
|
1023
|
+
// we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
|
|
1024
|
+
[t.name](...r) {
|
|
1025
|
+
return t(...r);
|
|
1026
|
+
}
|
|
1027
|
+
}[t.name], {
|
|
1028
|
+
_reducerDefinitionType: "reducer"
|
|
1029
|
+
/* reducer */
|
|
1030
|
+
});
|
|
1031
|
+
},
|
|
1032
|
+
preparedReducer(t, r) {
|
|
1033
|
+
return {
|
|
1034
|
+
_reducerDefinitionType: "reducerWithPrepare",
|
|
1035
|
+
prepare: t,
|
|
1036
|
+
reducer: r
|
|
1037
|
+
};
|
|
1038
|
+
},
|
|
1039
|
+
asyncThunk: e
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function Ft({
|
|
1043
|
+
type: e,
|
|
1044
|
+
reducerName: t,
|
|
1045
|
+
createNotation: r
|
|
1046
|
+
}, n, o) {
|
|
1047
|
+
let i, s;
|
|
1048
|
+
if ("reducer" in n) {
|
|
1049
|
+
if (r && !Lt(n))
|
|
1050
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
1051
|
+
i = n.reducer, s = n.prepare;
|
|
1052
|
+
} else
|
|
1053
|
+
i = n;
|
|
1054
|
+
o.addCase(e, i).exposeCaseReducer(t, i).exposeAction(t, s ? z(e, s) : z(e));
|
|
1055
|
+
}
|
|
1056
|
+
function $t(e) {
|
|
1057
|
+
return e._reducerDefinitionType === "asyncThunk";
|
|
1058
|
+
}
|
|
1059
|
+
function Lt(e) {
|
|
1060
|
+
return e._reducerDefinitionType === "reducerWithPrepare";
|
|
1061
|
+
}
|
|
1062
|
+
function xt({
|
|
1063
|
+
type: e,
|
|
1064
|
+
reducerName: t
|
|
1065
|
+
}, r, n, o) {
|
|
1066
|
+
if (!o)
|
|
1067
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
1068
|
+
const {
|
|
1069
|
+
payloadCreator: i,
|
|
1070
|
+
fulfilled: s,
|
|
1071
|
+
pending: c,
|
|
1072
|
+
rejected: u,
|
|
1073
|
+
settled: l,
|
|
1074
|
+
options: f
|
|
1075
|
+
} = r, h = o(e, i, f);
|
|
1076
|
+
n.exposeAction(t, h), s && n.addCase(h.fulfilled, s), c && n.addCase(h.pending, c), u && n.addCase(h.rejected, u), l && n.addMatcher(h.settled, l), n.exposeCaseReducer(t, {
|
|
1077
|
+
fulfilled: s || K,
|
|
1078
|
+
pending: c || K,
|
|
1079
|
+
rejected: u || K,
|
|
1080
|
+
settled: l || K
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
function K() {
|
|
1084
|
+
}
|
|
1085
|
+
var Vt = "task", We = "listener", Be = "completed", ge = "cancelled", Wt = `task-${ge}`, Bt = `task-${Be}`, pe = `${We}-${ge}`, Ut = `${We}-${Be}`, te = class {
|
|
1086
|
+
constructor(e) {
|
|
1087
|
+
this.code = e, this.message = `${Vt} ${ge} (reason: ${e})`;
|
|
1088
|
+
}
|
|
1089
|
+
name = "TaskAbortError";
|
|
1090
|
+
message;
|
|
1091
|
+
}, _e = (e, t) => {
|
|
1092
|
+
if (typeof e != "function")
|
|
1093
|
+
throw new TypeError(process.env.NODE_ENV === "production" ? _(32) : `${t} is not a function`);
|
|
1094
|
+
}, J = () => {
|
|
1095
|
+
}, Ue = (e, t = J) => (e.catch(t), e), Ke = (e, t) => (e.addEventListener("abort", t, {
|
|
1096
|
+
once: !0
|
|
1097
|
+
}), () => e.removeEventListener("abort", t)), P = (e, t) => {
|
|
1098
|
+
const r = e.signal;
|
|
1099
|
+
r.aborted || ("reason" in r || Object.defineProperty(r, "reason", {
|
|
1100
|
+
enumerable: !0,
|
|
1101
|
+
value: t,
|
|
1102
|
+
configurable: !0,
|
|
1103
|
+
writable: !0
|
|
1104
|
+
}), e.abort(t));
|
|
1105
|
+
}, T = (e) => {
|
|
1106
|
+
if (e.aborted) {
|
|
1107
|
+
const {
|
|
1108
|
+
reason: t
|
|
1109
|
+
} = e;
|
|
1110
|
+
throw new te(t);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
function qe(e, t) {
|
|
1114
|
+
let r = J;
|
|
1115
|
+
return new Promise((n, o) => {
|
|
1116
|
+
const i = () => o(new te(e.reason));
|
|
1117
|
+
if (e.aborted) {
|
|
1118
|
+
i();
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
r = Ke(e, i), t.finally(() => r()).then(n, o);
|
|
1122
|
+
}).finally(() => {
|
|
1123
|
+
r = J;
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
var Kt = async (e, t) => {
|
|
1127
|
+
try {
|
|
1128
|
+
return await Promise.resolve(), {
|
|
1129
|
+
status: "ok",
|
|
1130
|
+
value: await e()
|
|
1131
|
+
};
|
|
1132
|
+
} catch (r) {
|
|
1133
|
+
return {
|
|
1134
|
+
status: r instanceof te ? "cancelled" : "rejected",
|
|
1135
|
+
error: r
|
|
1136
|
+
};
|
|
1137
|
+
} finally {
|
|
1138
|
+
t?.();
|
|
1139
|
+
}
|
|
1140
|
+
}, Y = (e) => (t) => Ue(qe(e, t).then((r) => (T(e), r))), He = (e) => {
|
|
1141
|
+
const t = Y(e);
|
|
1142
|
+
return (r) => t(new Promise((n) => setTimeout(n, r)));
|
|
1143
|
+
}, {
|
|
1144
|
+
assign: j
|
|
1145
|
+
} = Object, Re = {}, V = "listenerMiddleware", qt = (e, t) => {
|
|
1146
|
+
const r = (n) => Ke(e, () => P(n, e.reason));
|
|
1147
|
+
return (n, o) => {
|
|
1148
|
+
_e(n, "taskExecutor");
|
|
1149
|
+
const i = new AbortController();
|
|
1150
|
+
r(i);
|
|
1151
|
+
const s = Kt(async () => {
|
|
1152
|
+
T(e), T(i.signal);
|
|
1153
|
+
const c = await n({
|
|
1154
|
+
pause: Y(i.signal),
|
|
1155
|
+
delay: He(i.signal),
|
|
1156
|
+
signal: i.signal
|
|
1157
|
+
});
|
|
1158
|
+
return T(i.signal), c;
|
|
1159
|
+
}, () => P(i, Bt));
|
|
1160
|
+
return o?.autoJoin && t.push(s.catch(J)), {
|
|
1161
|
+
result: Y(e)(s),
|
|
1162
|
+
cancel() {
|
|
1163
|
+
P(i, Wt);
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
};
|
|
1167
|
+
}, Ht = (e, t) => {
|
|
1168
|
+
const r = async (n, o) => {
|
|
1169
|
+
T(t);
|
|
1170
|
+
let i = () => {
|
|
1171
|
+
};
|
|
1172
|
+
const c = [new Promise((u, l) => {
|
|
1173
|
+
let f = e({
|
|
1174
|
+
predicate: n,
|
|
1175
|
+
effect: (h, v) => {
|
|
1176
|
+
v.unsubscribe(), u([h, v.getState(), v.getOriginalState()]);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
i = () => {
|
|
1180
|
+
f(), l();
|
|
1181
|
+
};
|
|
1182
|
+
})];
|
|
1183
|
+
o != null && c.push(new Promise((u) => setTimeout(u, o, null)));
|
|
1184
|
+
try {
|
|
1185
|
+
const u = await qe(t, Promise.race(c));
|
|
1186
|
+
return T(t), u;
|
|
1187
|
+
} finally {
|
|
1188
|
+
i();
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
return (n, o) => Ue(r(n, o));
|
|
1192
|
+
}, Ge = (e) => {
|
|
1193
|
+
let {
|
|
1194
|
+
type: t,
|
|
1195
|
+
actionCreator: r,
|
|
1196
|
+
matcher: n,
|
|
1197
|
+
predicate: o,
|
|
1198
|
+
effect: i
|
|
1199
|
+
} = e;
|
|
1200
|
+
if (t)
|
|
1201
|
+
o = z(t).match;
|
|
1202
|
+
else if (r)
|
|
1203
|
+
t = r.type, o = r.match;
|
|
1204
|
+
else if (n)
|
|
1205
|
+
o = n;
|
|
1206
|
+
else if (!o) throw new Error(process.env.NODE_ENV === "production" ? _(21) : "Creating or removing a listener requires one of the known fields for matching an action");
|
|
1207
|
+
return _e(i, "options.listener"), {
|
|
1208
|
+
predicate: o,
|
|
1209
|
+
type: t,
|
|
1210
|
+
effect: i
|
|
1211
|
+
};
|
|
1212
|
+
}, Je = /* @__PURE__ */ j((e) => {
|
|
1213
|
+
const {
|
|
1214
|
+
type: t,
|
|
1215
|
+
predicate: r,
|
|
1216
|
+
effect: n
|
|
1217
|
+
} = Ge(e);
|
|
1218
|
+
return {
|
|
1219
|
+
id: Pt(),
|
|
1220
|
+
effect: n,
|
|
1221
|
+
type: t,
|
|
1222
|
+
predicate: r,
|
|
1223
|
+
pending: /* @__PURE__ */ new Set(),
|
|
1224
|
+
unsubscribe: () => {
|
|
1225
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(22) : "Unsubscribe not initialized");
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
}, {
|
|
1229
|
+
withTypes: () => Je
|
|
1230
|
+
}), Pe = (e, t) => {
|
|
1231
|
+
const {
|
|
1232
|
+
type: r,
|
|
1233
|
+
effect: n,
|
|
1234
|
+
predicate: o
|
|
1235
|
+
} = Ge(t);
|
|
1236
|
+
return Array.from(e.values()).find((i) => (typeof r == "string" ? i.type === r : i.predicate === o) && i.effect === n);
|
|
1237
|
+
}, ye = (e) => {
|
|
1238
|
+
e.pending.forEach((t) => {
|
|
1239
|
+
P(t, pe);
|
|
1240
|
+
});
|
|
1241
|
+
}, Gt = (e, t) => () => {
|
|
1242
|
+
for (const r of t.keys())
|
|
1243
|
+
ye(r);
|
|
1244
|
+
e.clear();
|
|
1245
|
+
}, Te = (e, t, r) => {
|
|
1246
|
+
try {
|
|
1247
|
+
e(t, r);
|
|
1248
|
+
} catch (n) {
|
|
1249
|
+
setTimeout(() => {
|
|
1250
|
+
throw n;
|
|
1251
|
+
}, 0);
|
|
1252
|
+
}
|
|
1253
|
+
}, Ye = /* @__PURE__ */ j(/* @__PURE__ */ z(`${V}/add`), {
|
|
1254
|
+
withTypes: () => Ye
|
|
1255
|
+
}), Jt = /* @__PURE__ */ z(`${V}/removeAll`), Xe = /* @__PURE__ */ j(/* @__PURE__ */ z(`${V}/remove`), {
|
|
1256
|
+
withTypes: () => Xe
|
|
1257
|
+
}), Yt = (...e) => {
|
|
1258
|
+
console.error(`${V}/error`, ...e);
|
|
1259
|
+
}, Xt = (e = {}) => {
|
|
1260
|
+
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), n = (a) => {
|
|
1261
|
+
const d = r.get(a) ?? 0;
|
|
1262
|
+
r.set(a, d + 1);
|
|
1263
|
+
}, o = (a) => {
|
|
1264
|
+
const d = r.get(a) ?? 1;
|
|
1265
|
+
d === 1 ? r.delete(a) : r.set(a, d - 1);
|
|
1266
|
+
}, {
|
|
1267
|
+
extra: i,
|
|
1268
|
+
onError: s = Yt
|
|
1269
|
+
} = e;
|
|
1270
|
+
_e(s, "onError");
|
|
1271
|
+
const c = (a) => (a.unsubscribe = () => t.delete(a.id), t.set(a.id, a), (d) => {
|
|
1272
|
+
a.unsubscribe(), d?.cancelActive && ye(a);
|
|
1273
|
+
}), u = (a) => {
|
|
1274
|
+
const d = Pe(t, a) ?? Je(a);
|
|
1275
|
+
return c(d);
|
|
1276
|
+
};
|
|
1277
|
+
j(u, {
|
|
1278
|
+
withTypes: () => u
|
|
1279
|
+
});
|
|
1280
|
+
const l = (a) => {
|
|
1281
|
+
const d = Pe(t, a);
|
|
1282
|
+
return d && (d.unsubscribe(), a.cancelActive && ye(d)), !!d;
|
|
1283
|
+
};
|
|
1284
|
+
j(l, {
|
|
1285
|
+
withTypes: () => l
|
|
1286
|
+
});
|
|
1287
|
+
const f = async (a, d, g, O) => {
|
|
1288
|
+
const w = new AbortController(), k = Ht(u, w.signal), y = [];
|
|
1289
|
+
try {
|
|
1290
|
+
a.pending.add(w), n(a), await Promise.resolve(a.effect(
|
|
1291
|
+
d,
|
|
1292
|
+
// Use assign() rather than ... to avoid extra helper functions added to bundle
|
|
1293
|
+
j({}, g, {
|
|
1294
|
+
getOriginalState: O,
|
|
1295
|
+
condition: (p, m) => k(p, m).then(Boolean),
|
|
1296
|
+
take: k,
|
|
1297
|
+
delay: He(w.signal),
|
|
1298
|
+
pause: Y(w.signal),
|
|
1299
|
+
extra: i,
|
|
1300
|
+
signal: w.signal,
|
|
1301
|
+
fork: qt(w.signal, y),
|
|
1302
|
+
unsubscribe: a.unsubscribe,
|
|
1303
|
+
subscribe: () => {
|
|
1304
|
+
t.set(a.id, a);
|
|
1305
|
+
},
|
|
1306
|
+
cancelActiveListeners: () => {
|
|
1307
|
+
a.pending.forEach((p, m, b) => {
|
|
1308
|
+
p !== w && (P(p, pe), b.delete(p));
|
|
1309
|
+
});
|
|
1310
|
+
},
|
|
1311
|
+
cancel: () => {
|
|
1312
|
+
P(w, pe), a.pending.delete(w);
|
|
1313
|
+
},
|
|
1314
|
+
throwIfCancelled: () => {
|
|
1315
|
+
T(w.signal);
|
|
1316
|
+
}
|
|
1317
|
+
})
|
|
1318
|
+
));
|
|
1319
|
+
} catch (p) {
|
|
1320
|
+
p instanceof te || Te(s, p, {
|
|
1321
|
+
raisedBy: "effect"
|
|
1322
|
+
});
|
|
1323
|
+
} finally {
|
|
1324
|
+
await Promise.all(y), P(w, Ut), o(a), a.pending.delete(w);
|
|
1325
|
+
}
|
|
1326
|
+
}, h = Gt(t, r);
|
|
1327
|
+
return {
|
|
1328
|
+
middleware: (a) => (d) => (g) => {
|
|
1329
|
+
if (!Me(g))
|
|
1330
|
+
return d(g);
|
|
1331
|
+
if (Ye.match(g))
|
|
1332
|
+
return u(g.payload);
|
|
1333
|
+
if (Jt.match(g)) {
|
|
1334
|
+
h();
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
if (Xe.match(g))
|
|
1338
|
+
return l(g.payload);
|
|
1339
|
+
let O = a.getState();
|
|
1340
|
+
const w = () => {
|
|
1341
|
+
if (O === Re)
|
|
1342
|
+
throw new Error(process.env.NODE_ENV === "production" ? _(23) : `${V}: getOriginalState can only be called synchronously`);
|
|
1343
|
+
return O;
|
|
1344
|
+
};
|
|
1345
|
+
let k;
|
|
1346
|
+
try {
|
|
1347
|
+
if (k = d(g), t.size > 0) {
|
|
1348
|
+
const y = a.getState(), p = Array.from(t.values());
|
|
1349
|
+
for (const m of p) {
|
|
1350
|
+
let b = !1;
|
|
1351
|
+
try {
|
|
1352
|
+
b = m.predicate(g, y, O);
|
|
1353
|
+
} catch (C) {
|
|
1354
|
+
b = !1, Te(s, C, {
|
|
1355
|
+
raisedBy: "predicate"
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
b && f(m, g, a, w);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
} finally {
|
|
1362
|
+
O = Re;
|
|
1363
|
+
}
|
|
1364
|
+
return k;
|
|
1365
|
+
},
|
|
1366
|
+
startListening: u,
|
|
1367
|
+
stopListening: l,
|
|
1368
|
+
clearListeners: h
|
|
1369
|
+
};
|
|
1370
|
+
};
|
|
1371
|
+
function _(e) {
|
|
1372
|
+
return `Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `;
|
|
1373
|
+
}
|
|
1374
|
+
const Qt = {
|
|
1375
|
+
logs: []
|
|
1376
|
+
}, Qe = zt({
|
|
1377
|
+
name: "logger",
|
|
1378
|
+
initialState: Qt,
|
|
1379
|
+
reducers: {
|
|
1380
|
+
addLog: (e, t) => {
|
|
1381
|
+
const r = {
|
|
1382
|
+
...t.payload,
|
|
1383
|
+
id: Date.now().toString(),
|
|
1384
|
+
timestamp: Date.now()
|
|
1385
|
+
};
|
|
1386
|
+
e.logs.push(r);
|
|
1387
|
+
},
|
|
1388
|
+
clearLogs: (e) => {
|
|
1389
|
+
e.logs = [];
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}), { addLog: re, clearLogs: rr } = Qe.actions, nr = Qe.reducer, or = (e) => re({ message: e, level: "info" }), ir = (e) => re({ message: e, level: "warn" }), sr = (e) => re({ message: e, level: "error" }), Zt = "logger", er = (e) => e[Zt], Ze = ee(
|
|
1393
|
+
[er],
|
|
1394
|
+
(e) => e.logs
|
|
1395
|
+
), cr = ee(
|
|
1396
|
+
[Ze, (e, t) => t],
|
|
1397
|
+
(e, t) => e.filter((r) => r.level === t)
|
|
1398
|
+
), ar = ee(
|
|
1399
|
+
[Ze, (e, t) => t],
|
|
1400
|
+
(e, t) => t === 0 ? [] : e.slice(-t)
|
|
1401
|
+
), tr = () => {
|
|
1402
|
+
const e = Xt();
|
|
1403
|
+
return e.startListening({
|
|
1404
|
+
actionCreator: re,
|
|
1405
|
+
effect: (t, r) => {
|
|
1406
|
+
const n = t.payload, { message: o, level: i } = n;
|
|
1407
|
+
switch (i) {
|
|
1408
|
+
case "info":
|
|
1409
|
+
console.info(`[INFO] ${o}`);
|
|
1410
|
+
break;
|
|
1411
|
+
case "warn":
|
|
1412
|
+
console.warn(`[WARN] ${o}`);
|
|
1413
|
+
break;
|
|
1414
|
+
case "error":
|
|
1415
|
+
console.error(`[ERROR] ${o}`);
|
|
1416
|
+
break;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}), e.middleware;
|
|
1420
|
+
}, ur = (e) => {
|
|
1421
|
+
switch (e.destination) {
|
|
1422
|
+
case "console":
|
|
1423
|
+
return tr();
|
|
1424
|
+
default:
|
|
1425
|
+
throw new Error(`Unsupported logger destination: ${e.destination}`);
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1428
|
+
export {
|
|
1429
|
+
Zt as LoggerKey,
|
|
1430
|
+
re as addLog,
|
|
1431
|
+
rr as clearLogs,
|
|
1432
|
+
ur as createLoggerMiddleware,
|
|
1433
|
+
sr as logError,
|
|
1434
|
+
or as logInfo,
|
|
1435
|
+
ir as logWarn,
|
|
1436
|
+
nr as loggerReducer,
|
|
1437
|
+
Qe as loggerSlice,
|
|
1438
|
+
er as selectLoggerState,
|
|
1439
|
+
Ze as selectLogs,
|
|
1440
|
+
cr as selectLogsByLevel,
|
|
1441
|
+
ar as selectRecentLogs
|
|
1442
|
+
};
|