1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.RTK = {}));
|
5 | })(this, (function (exports) { 'use strict';
|
6 |
|
7 | var __extends = (undefined && undefined.__extends) || (function () {
|
8 | var extendStatics = function (d, b) {
|
9 | extendStatics = Object.setPrototypeOf ||
|
10 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
11 | function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
12 | return extendStatics(d, b);
|
13 | };
|
14 | return function (d, b) {
|
15 | if (typeof b !== "function" && b !== null)
|
16 | throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
17 | extendStatics(d, b);
|
18 | function __() { this.constructor = d; }
|
19 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
20 | };
|
21 | })();
|
22 | var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
23 | var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
24 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
25 | function verb(n) { return function (v) { return step([n, v]); }; }
|
26 | function step(op) {
|
27 | if (f) throw new TypeError("Generator is already executing.");
|
28 | while (_) try {
|
29 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
30 | if (y = 0, t) op = [op[0] & 2, t.value];
|
31 | switch (op[0]) {
|
32 | case 0: case 1: t = op; break;
|
33 | case 4: _.label++; return { value: op[1], done: false };
|
34 | case 5: _.label++; y = op[1]; op = [0]; continue;
|
35 | case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
36 | default:
|
37 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
38 | if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
39 | if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
40 | if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
41 | if (t[2]) _.ops.pop();
|
42 | _.trys.pop(); continue;
|
43 | }
|
44 | op = body.call(thisArg, _);
|
45 | } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
46 | if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
47 | }
|
48 | };
|
49 | var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) {
|
50 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
51 | to[j] = from[i];
|
52 | return to;
|
53 | };
|
54 | var __defProp = Object.defineProperty;
|
55 | var __defProps = Object.defineProperties;
|
56 | var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
57 | var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
58 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
59 | var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
60 | var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; };
|
61 | var __spreadValues = function (a2, b2) {
|
62 | for (var prop in b2 || (b2 = {}))
|
63 | if (__hasOwnProp.call(b2, prop))
|
64 | __defNormalProp(a2, prop, b2[prop]);
|
65 | if (__getOwnPropSymbols)
|
66 | for (var _c = 0, _d = __getOwnPropSymbols(b2); _c < _d.length; _c++) {
|
67 | var prop = _d[_c];
|
68 | if (__propIsEnum.call(b2, prop))
|
69 | __defNormalProp(a2, prop, b2[prop]);
|
70 | }
|
71 | return a2;
|
72 | };
|
73 | var __spreadProps = function (a2, b2) { return __defProps(a2, __getOwnPropDescs(b2)); };
|
74 | var __async = function (__this, __arguments, generator) {
|
75 | return new Promise(function (resolve, reject) {
|
76 | var fulfilled = function (value) {
|
77 | try {
|
78 | step(generator.next(value));
|
79 | }
|
80 | catch (e2) {
|
81 | reject(e2);
|
82 | }
|
83 | };
|
84 | var rejected = function (value) {
|
85 | try {
|
86 | step(generator.throw(value));
|
87 | }
|
88 | catch (e2) {
|
89 | reject(e2);
|
90 | }
|
91 | };
|
92 | var step = function (x2) { return x2.done ? resolve(x2.value) : Promise.resolve(x2.value).then(fulfilled, rejected); };
|
93 | step((generator = generator.apply(__this, __arguments)).next());
|
94 | });
|
95 | };
|
96 |
|
97 | function n(n2) {
|
98 | for (var r2 = arguments.length, t2 = Array(r2 > 1 ? r2 - 1 : 0), e2 = 1; e2 < r2; e2++)
|
99 | t2[e2 - 1] = arguments[e2];
|
100 | {
|
101 | var i2 = Y[n2], o2 = i2 ? typeof i2 == "function" ? i2.apply(null, t2) : i2 : "unknown error nr: " + n2;
|
102 | throw Error("[Immer] " + o2);
|
103 | }
|
104 | }
|
105 | function r(n2) {
|
106 | return !!n2 && !!n2[Q];
|
107 | }
|
108 | function t(n2) {
|
109 | var r2;
|
110 | return !!n2 && (function (n3) {
|
111 | if (!n3 || typeof n3 != "object")
|
112 | return false;
|
113 | var r3 = Object.getPrototypeOf(n3);
|
114 | if (r3 === null)
|
115 | return true;
|
116 | var t2 = Object.hasOwnProperty.call(r3, "constructor") && r3.constructor;
|
117 | return t2 === Object || typeof t2 == "function" && Function.toString.call(t2) === Z;
|
118 | }(n2) || Array.isArray(n2) || !!n2[L] || !!((r2 = n2.constructor) === null || r2 === void 0 ? void 0 : r2[L]) || s(n2) || v(n2));
|
119 | }
|
120 | function e(t2) {
|
121 | return r(t2) || n(23, t2), t2[Q].t;
|
122 | }
|
123 | function i(n2, r2, t2) {
|
124 | t2 === void 0 && (t2 = false), o(n2) === 0 ? (t2 ? Object.keys : nn)(n2).forEach(function (e2) {
|
125 | t2 && typeof e2 == "symbol" || r2(e2, n2[e2], n2);
|
126 | }) : n2.forEach(function (t3, e2) {
|
127 | return r2(e2, t3, n2);
|
128 | });
|
129 | }
|
130 | function o(n2) {
|
131 | var r2 = n2[Q];
|
132 | return r2 ? r2.i > 3 ? r2.i - 4 : r2.i : Array.isArray(n2) ? 1 : s(n2) ? 2 : v(n2) ? 3 : 0;
|
133 | }
|
134 | function u(n2, r2) {
|
135 | return o(n2) === 2 ? n2.has(r2) : Object.prototype.hasOwnProperty.call(n2, r2);
|
136 | }
|
137 | function a(n2, r2) {
|
138 | return o(n2) === 2 ? n2.get(r2) : n2[r2];
|
139 | }
|
140 | function f(n2, r2, t2) {
|
141 | var e2 = o(n2);
|
142 | e2 === 2 ? n2.set(r2, t2) : e2 === 3 ? n2.add(t2) : n2[r2] = t2;
|
143 | }
|
144 | function c(n2, r2) {
|
145 | return n2 === r2 ? n2 !== 0 || 1 / n2 == 1 / r2 : n2 != n2 && r2 != r2;
|
146 | }
|
147 | function s(n2) {
|
148 | return X && n2 instanceof Map;
|
149 | }
|
150 | function v(n2) {
|
151 | return q && n2 instanceof Set;
|
152 | }
|
153 | function p(n2) {
|
154 | return n2.o || n2.t;
|
155 | }
|
156 | function l(n2) {
|
157 | if (Array.isArray(n2))
|
158 | return Array.prototype.slice.call(n2);
|
159 | var r2 = rn(n2);
|
160 | delete r2[Q];
|
161 | for (var t2 = nn(r2), e2 = 0; e2 < t2.length; e2++) {
|
162 | var i2 = t2[e2], o2 = r2[i2];
|
163 | o2.writable === false && (o2.writable = true, o2.configurable = true), (o2.get || o2.set) && (r2[i2] = { configurable: true, writable: true, enumerable: o2.enumerable, value: n2[i2] });
|
164 | }
|
165 | return Object.create(Object.getPrototypeOf(n2), r2);
|
166 | }
|
167 | function d(n2, e2) {
|
168 | return e2 === void 0 && (e2 = false), y(n2) || r(n2) || !t(n2) || (o(n2) > 1 && (n2.set = n2.add = n2.clear = n2.delete = h), Object.freeze(n2), e2 && i(n2, function (n3, r2) {
|
169 | return d(r2, true);
|
170 | }, true)), n2;
|
171 | }
|
172 | function h() {
|
173 | n(2);
|
174 | }
|
175 | function y(n2) {
|
176 | return n2 == null || typeof n2 != "object" || Object.isFrozen(n2);
|
177 | }
|
178 | function b(r2) {
|
179 | var t2 = tn[r2];
|
180 | return t2 || n(18, r2), t2;
|
181 | }
|
182 | function m(n2, r2) {
|
183 | tn[n2] || (tn[n2] = r2);
|
184 | }
|
185 | function _() {
|
186 | return U || n(0), U;
|
187 | }
|
188 | function j(n2, r2) {
|
189 | r2 && (b("Patches"), n2.u = [], n2.s = [], n2.v = r2);
|
190 | }
|
191 | function g(n2) {
|
192 | O(n2), n2.p.forEach(S), n2.p = null;
|
193 | }
|
194 | function O(n2) {
|
195 | n2 === U && (U = n2.l);
|
196 | }
|
197 | function w(n2) {
|
198 | return U = { p: [], l: U, h: n2, m: true, _: 0 };
|
199 | }
|
200 | function S(n2) {
|
201 | var r2 = n2[Q];
|
202 | r2.i === 0 || r2.i === 1 ? r2.j() : r2.g = true;
|
203 | }
|
204 | function P(r2, e2) {
|
205 | e2._ = e2.p.length;
|
206 | var i2 = e2.p[0], o2 = r2 !== void 0 && r2 !== i2;
|
207 | return e2.h.O || b("ES5").S(e2, r2, o2), o2 ? (i2[Q].P && (g(e2), n(4)), t(r2) && (r2 = M(e2, r2), e2.l || x(e2, r2)), e2.u && b("Patches").M(i2[Q].t, r2, e2.u, e2.s)) : r2 = M(e2, i2, []), g(e2), e2.u && e2.v(e2.u, e2.s), r2 !== H ? r2 : void 0;
|
208 | }
|
209 | function M(n2, r2, t2) {
|
210 | if (y(r2))
|
211 | return r2;
|
212 | var e2 = r2[Q];
|
213 | if (!e2)
|
214 | return i(r2, function (i2, o3) {
|
215 | return A(n2, e2, r2, i2, o3, t2);
|
216 | }, true), r2;
|
217 | if (e2.A !== n2)
|
218 | return r2;
|
219 | if (!e2.P)
|
220 | return x(n2, e2.t, true), e2.t;
|
221 | if (!e2.I) {
|
222 | e2.I = true, e2.A._--;
|
223 | var o2 = e2.i === 4 || e2.i === 5 ? e2.o = l(e2.k) : e2.o, u2 = o2, a2 = false;
|
224 | e2.i === 3 && (u2 = new Set(o2), o2.clear(), a2 = true), i(u2, function (r3, i2) {
|
225 | return A(n2, e2, o2, r3, i2, t2, a2);
|
226 | }), x(n2, o2, false), t2 && n2.u && b("Patches").N(e2, t2, n2.u, n2.s);
|
227 | }
|
228 | return e2.o;
|
229 | }
|
230 | function A(e2, i2, o2, a2, c2, s2, v2) {
|
231 | if (c2 === o2 && n(5), r(c2)) {
|
232 | var p2 = M(e2, c2, s2 && i2 && i2.i !== 3 && !u(i2.R, a2) ? s2.concat(a2) : void 0);
|
233 | if (f(o2, a2, p2), !r(p2))
|
234 | return;
|
235 | e2.m = false;
|
236 | }
|
237 | else
|
238 | v2 && o2.add(c2);
|
239 | if (t(c2) && !y(c2)) {
|
240 | if (!e2.h.D && e2._ < 1)
|
241 | return;
|
242 | M(e2, c2), i2 && i2.A.l || x(e2, c2);
|
243 | }
|
244 | }
|
245 | function x(n2, r2, t2) {
|
246 | t2 === void 0 && (t2 = false), !n2.l && n2.h.D && n2.m && d(r2, t2);
|
247 | }
|
248 | function z(n2, r2) {
|
249 | var t2 = n2[Q];
|
250 | return (t2 ? p(t2) : n2)[r2];
|
251 | }
|
252 | function I(n2, r2) {
|
253 | if (r2 in n2)
|
254 | for (var t2 = Object.getPrototypeOf(n2); t2;) {
|
255 | var e2 = Object.getOwnPropertyDescriptor(t2, r2);
|
256 | if (e2)
|
257 | return e2;
|
258 | t2 = Object.getPrototypeOf(t2);
|
259 | }
|
260 | }
|
261 | function k(n2) {
|
262 | n2.P || (n2.P = true, n2.l && k(n2.l));
|
263 | }
|
264 | function E(n2) {
|
265 | n2.o || (n2.o = l(n2.t));
|
266 | }
|
267 | function N(n2, r2, t2) {
|
268 | var e2 = s(r2) ? b("MapSet").F(r2, t2) : v(r2) ? b("MapSet").T(r2, t2) : n2.O ? function (n3, r3) {
|
269 | var t3 = Array.isArray(n3), e3 = { i: t3 ? 1 : 0, A: r3 ? r3.A : _(), P: false, I: false, R: {}, l: r3, t: n3, k: null, o: null, j: null, C: false }, i2 = e3, o2 = en;
|
270 | t3 && (i2 = [e3], o2 = on);
|
271 | var u2 = Proxy.revocable(i2, o2), a2 = u2.revoke, f2 = u2.proxy;
|
272 | return e3.k = f2, e3.j = a2, f2;
|
273 | }(r2, t2) : b("ES5").J(r2, t2);
|
274 | return (t2 ? t2.A : _()).p.push(e2), e2;
|
275 | }
|
276 | function R(e2) {
|
277 | return r(e2) || n(22, e2), function n2(r2) {
|
278 | if (!t(r2))
|
279 | return r2;
|
280 | var e3, u2 = r2[Q], c2 = o(r2);
|
281 | if (u2) {
|
282 | if (!u2.P && (u2.i < 4 || !b("ES5").K(u2)))
|
283 | return u2.t;
|
284 | u2.I = true, e3 = D(r2, c2), u2.I = false;
|
285 | }
|
286 | else
|
287 | e3 = D(r2, c2);
|
288 | return i(e3, function (r3, t2) {
|
289 | u2 && a(u2.t, r3) === t2 || f(e3, r3, n2(t2));
|
290 | }), c2 === 3 ? new Set(e3) : e3;
|
291 | }(e2);
|
292 | }
|
293 | function D(n2, r2) {
|
294 | switch (r2) {
|
295 | case 2:
|
296 | return new Map(n2);
|
297 | case 3:
|
298 | return Array.from(n2);
|
299 | }
|
300 | return l(n2);
|
301 | }
|
302 | function F() {
|
303 | function t2(n2, r2) {
|
304 | var t3 = s2[n2];
|
305 | return t3 ? t3.enumerable = r2 : s2[n2] = t3 = { configurable: true, enumerable: r2, get: function () {
|
306 | var r3 = this[Q];
|
307 | return f2(r3), en.get(r3, n2);
|
308 | }, set: function (r3) {
|
309 | var t4 = this[Q];
|
310 | f2(t4), en.set(t4, n2, r3);
|
311 | } }, t3;
|
312 | }
|
313 | function e2(n2) {
|
314 | for (var r2 = n2.length - 1; r2 >= 0; r2--) {
|
315 | var t3 = n2[r2][Q];
|
316 | if (!t3.P)
|
317 | switch (t3.i) {
|
318 | case 5:
|
319 | a2(t3) && k(t3);
|
320 | break;
|
321 | case 4:
|
322 | o2(t3) && k(t3);
|
323 | }
|
324 | }
|
325 | }
|
326 | function o2(n2) {
|
327 | for (var r2 = n2.t, t3 = n2.k, e3 = nn(t3), i2 = e3.length - 1; i2 >= 0; i2--) {
|
328 | var o3 = e3[i2];
|
329 | if (o3 !== Q) {
|
330 | var a3 = r2[o3];
|
331 | if (a3 === void 0 && !u(r2, o3))
|
332 | return true;
|
333 | var f3 = t3[o3], s3 = f3 && f3[Q];
|
334 | if (s3 ? s3.t !== a3 : !c(f3, a3))
|
335 | return true;
|
336 | }
|
337 | }
|
338 | var v2 = !!r2[Q];
|
339 | return e3.length !== nn(r2).length + (v2 ? 0 : 1);
|
340 | }
|
341 | function a2(n2) {
|
342 | var r2 = n2.k;
|
343 | if (r2.length !== n2.t.length)
|
344 | return true;
|
345 | var t3 = Object.getOwnPropertyDescriptor(r2, r2.length - 1);
|
346 | if (t3 && !t3.get)
|
347 | return true;
|
348 | for (var e3 = 0; e3 < r2.length; e3++)
|
349 | if (!r2.hasOwnProperty(e3))
|
350 | return true;
|
351 | return false;
|
352 | }
|
353 | function f2(r2) {
|
354 | r2.g && n(3, JSON.stringify(p(r2)));
|
355 | }
|
356 | var s2 = {};
|
357 | m("ES5", { J: function (n2, r2) {
|
358 | var e3 = Array.isArray(n2), i2 = function (n3, r3) {
|
359 | if (n3) {
|
360 | for (var e4 = Array(r3.length), i3 = 0; i3 < r3.length; i3++)
|
361 | Object.defineProperty(e4, "" + i3, t2(i3, true));
|
362 | return e4;
|
363 | }
|
364 | var o4 = rn(r3);
|
365 | delete o4[Q];
|
366 | for (var u2 = nn(o4), a3 = 0; a3 < u2.length; a3++) {
|
367 | var f3 = u2[a3];
|
368 | o4[f3] = t2(f3, n3 || !!o4[f3].enumerable);
|
369 | }
|
370 | return Object.create(Object.getPrototypeOf(r3), o4);
|
371 | }(e3, n2), o3 = { i: e3 ? 5 : 4, A: r2 ? r2.A : _(), P: false, I: false, R: {}, l: r2, t: n2, k: i2, o: null, g: false, C: false };
|
372 | return Object.defineProperty(i2, Q, { value: o3, writable: true }), i2;
|
373 | }, S: function (n2, t3, o3) {
|
374 | o3 ? r(t3) && t3[Q].A === n2 && e2(n2.p) : (n2.u && function n3(r2) {
|
375 | if (r2 && typeof r2 == "object") {
|
376 | var t4 = r2[Q];
|
377 | if (t4) {
|
378 | var e3 = t4.t, o4 = t4.k, f3 = t4.R, c2 = t4.i;
|
379 | if (c2 === 4)
|
380 | i(o4, function (r3) {
|
381 | r3 !== Q && (e3[r3] !== void 0 || u(e3, r3) ? f3[r3] || n3(o4[r3]) : (f3[r3] = true, k(t4)));
|
382 | }), i(e3, function (n4) {
|
383 | o4[n4] !== void 0 || u(o4, n4) || (f3[n4] = false, k(t4));
|
384 | });
|
385 | else if (c2 === 5) {
|
386 | if (a2(t4) && (k(t4), f3.length = true), o4.length < e3.length)
|
387 | for (var s3 = o4.length; s3 < e3.length; s3++)
|
388 | f3[s3] = false;
|
389 | else
|
390 | for (var v2 = e3.length; v2 < o4.length; v2++)
|
391 | f3[v2] = true;
|
392 | for (var p2 = Math.min(o4.length, e3.length), l2 = 0; l2 < p2; l2++)
|
393 | o4.hasOwnProperty(l2) || (f3[l2] = true), f3[l2] === void 0 && n3(o4[l2]);
|
394 | }
|
395 | }
|
396 | }
|
397 | }(n2.p[0]), e2(n2.p));
|
398 | }, K: function (n2) {
|
399 | return n2.i === 4 ? o2(n2) : a2(n2);
|
400 | } });
|
401 | }
|
402 | var G;
|
403 | var U;
|
404 | var W = typeof Symbol != "undefined" && typeof Symbol("x") == "symbol";
|
405 | var X = typeof Map != "undefined";
|
406 | var q = typeof Set != "undefined";
|
407 | var B = typeof Proxy != "undefined" && Proxy.revocable !== void 0 && typeof Reflect != "undefined";
|
408 | var H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = true, G);
|
409 | var L = W ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
410 | var Q = W ? Symbol.for("immer-state") : "__$immer_state";
|
411 | var Y = { 0: "Illegal state", 1: "Immer drafts cannot have computed properties", 2: "This object has been frozen and should not be mutated", 3: function (n2) {
|
412 | return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n2;
|
413 | }, 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", 5: "Immer forbids circular references", 6: "The first or second argument to `produce` must be a function", 7: "The third argument to `produce` must be a function or undefined", 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", 10: "The given draft is already finalized", 11: "Object.defineProperty() cannot be used on an Immer draft", 12: "Object.setPrototypeOf() cannot be used on an Immer draft", 13: "Immer only supports deleting array indices", 14: "Immer only supports setting array indices and the 'length' property", 15: function (n2) {
|
414 | return "Cannot apply patch, path doesn't resolve: " + n2;
|
415 | }, 16: 'Sets cannot have "replace" patches.', 17: function (n2) {
|
416 | return "Unsupported patch operation: " + n2;
|
417 | }, 18: function (n2) {
|
418 | return "The plugin for '" + n2 + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n2 + "()` when initializing your application.";
|
419 | }, 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", 21: function (n2) {
|
420 | 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 '" + n2 + "'";
|
421 | }, 22: function (n2) {
|
422 | return "'current' expects a draft, got: " + n2;
|
423 | }, 23: function (n2) {
|
424 | return "'original' expects a draft, got: " + n2;
|
425 | }, 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" };
|
426 | var Z = "" + Object.prototype.constructor;
|
427 | var nn = typeof Reflect != "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols !== void 0 ? function (n2) {
|
428 | return Object.getOwnPropertyNames(n2).concat(Object.getOwnPropertySymbols(n2));
|
429 | } : Object.getOwnPropertyNames;
|
430 | var rn = Object.getOwnPropertyDescriptors || function (n2) {
|
431 | var r2 = {};
|
432 | return nn(n2).forEach(function (t2) {
|
433 | r2[t2] = Object.getOwnPropertyDescriptor(n2, t2);
|
434 | }), r2;
|
435 | };
|
436 | var tn = {};
|
437 | var en = { get: function (n2, r2) {
|
438 | if (r2 === Q)
|
439 | return n2;
|
440 | var e2 = p(n2);
|
441 | if (!u(e2, r2))
|
442 | return function (n3, r3, t2) {
|
443 | var e3, i3 = I(r3, t2);
|
444 | return i3 ? "value" in i3 ? i3.value : (e3 = i3.get) === null || e3 === void 0 ? void 0 : e3.call(n3.k) : void 0;
|
445 | }(n2, e2, r2);
|
446 | var i2 = e2[r2];
|
447 | return n2.I || !t(i2) ? i2 : i2 === z(n2.t, r2) ? (E(n2), n2.o[r2] = N(n2.A.h, i2, n2)) : i2;
|
448 | }, has: function (n2, r2) {
|
449 | return r2 in p(n2);
|
450 | }, ownKeys: function (n2) {
|
451 | return Reflect.ownKeys(p(n2));
|
452 | }, set: function (n2, r2, t2) {
|
453 | var e2 = I(p(n2), r2);
|
454 | if (e2 == null ? void 0 : e2.set)
|
455 | return e2.set.call(n2.k, t2), true;
|
456 | if (!n2.P) {
|
457 | var i2 = z(p(n2), r2), o2 = i2 == null ? void 0 : i2[Q];
|
458 | if (o2 && o2.t === t2)
|
459 | return n2.o[r2] = t2, n2.R[r2] = false, true;
|
460 | if (c(t2, i2) && (t2 !== void 0 || u(n2.t, r2)))
|
461 | return true;
|
462 | E(n2), k(n2);
|
463 | }
|
464 | return n2.o[r2] === t2 && (t2 !== void 0 || r2 in n2.o) || Number.isNaN(t2) && Number.isNaN(n2.o[r2]) || (n2.o[r2] = t2, n2.R[r2] = true), true;
|
465 | }, deleteProperty: function (n2, r2) {
|
466 | return z(n2.t, r2) !== void 0 || r2 in n2.t ? (n2.R[r2] = false, E(n2), k(n2)) : delete n2.R[r2], n2.o && delete n2.o[r2], true;
|
467 | }, getOwnPropertyDescriptor: function (n2, r2) {
|
468 | var t2 = p(n2), e2 = Reflect.getOwnPropertyDescriptor(t2, r2);
|
469 | return e2 ? { writable: true, configurable: n2.i !== 1 || r2 !== "length", enumerable: e2.enumerable, value: t2[r2] } : e2;
|
470 | }, defineProperty: function () {
|
471 | n(11);
|
472 | }, getPrototypeOf: function (n2) {
|
473 | return Object.getPrototypeOf(n2.t);
|
474 | }, setPrototypeOf: function () {
|
475 | n(12);
|
476 | } };
|
477 | var on = {};
|
478 | i(en, function (n2, r2) {
|
479 | on[n2] = function () {
|
480 | return arguments[0] = arguments[0][0], r2.apply(this, arguments);
|
481 | };
|
482 | }), on.deleteProperty = function (r2, t2) {
|
483 | return isNaN(parseInt(t2)) && n(13), on.set.call(this, r2, t2, void 0);
|
484 | }, on.set = function (r2, t2, e2) {
|
485 | return t2 !== "length" && isNaN(parseInt(t2)) && n(14), en.set.call(this, r2[0], t2, e2, r2[0]);
|
486 | };
|
487 | var un = function () {
|
488 | function e2(r2) {
|
489 | var e3 = this;
|
490 | this.O = B, this.D = true, this.produce = function (r3, i3, o2) {
|
491 | if (typeof r3 == "function" && typeof i3 != "function") {
|
492 | var u2 = i3;
|
493 | i3 = r3;
|
494 | var a2 = e3;
|
495 | return function (n2) {
|
496 | var r4 = this;
|
497 | n2 === void 0 && (n2 = u2);
|
498 | for (var t2 = arguments.length, e4 = Array(t2 > 1 ? t2 - 1 : 0), o3 = 1; o3 < t2; o3++)
|
499 | e4[o3 - 1] = arguments[o3];
|
500 | return a2.produce(n2, function (n3) {
|
501 | var t3;
|
502 | return (t3 = i3).call.apply(t3, [r4, n3].concat(e4));
|
503 | });
|
504 | };
|
505 | }
|
506 | var f2;
|
507 | if (typeof i3 != "function" && n(6), o2 !== void 0 && typeof o2 != "function" && n(7), t(r3)) {
|
508 | var c2 = w(e3), s2 = N(e3, r3, void 0), v2 = true;
|
509 | try {
|
510 | f2 = i3(s2), v2 = false;
|
511 | }
|
512 | finally {
|
513 | v2 ? g(c2) : O(c2);
|
514 | }
|
515 | return typeof Promise != "undefined" && f2 instanceof Promise ? f2.then(function (n2) {
|
516 | return j(c2, o2), P(n2, c2);
|
517 | }, function (n2) {
|
518 | throw g(c2), n2;
|
519 | }) : (j(c2, o2), P(f2, c2));
|
520 | }
|
521 | if (!r3 || typeof r3 != "object") {
|
522 | if ((f2 = i3(r3)) === void 0 && (f2 = r3), f2 === H && (f2 = void 0), e3.D && d(f2, true), o2) {
|
523 | var p2 = [], l2 = [];
|
524 | b("Patches").M(r3, f2, p2, l2), o2(p2, l2);
|
525 | }
|
526 | return f2;
|
527 | }
|
528 | n(21, r3);
|
529 | }, this.produceWithPatches = function (n2, r3) {
|
530 | if (typeof n2 == "function")
|
531 | return function (r4) {
|
532 | for (var t3 = arguments.length, i4 = Array(t3 > 1 ? t3 - 1 : 0), o3 = 1; o3 < t3; o3++)
|
533 | i4[o3 - 1] = arguments[o3];
|
534 | return e3.produceWithPatches(r4, function (r5) {
|
535 | return n2.apply(void 0, [r5].concat(i4));
|
536 | });
|
537 | };
|
538 | var t2, i3, o2 = e3.produce(n2, r3, function (n3, r4) {
|
539 | t2 = n3, i3 = r4;
|
540 | });
|
541 | return typeof Promise != "undefined" && o2 instanceof Promise ? o2.then(function (n3) {
|
542 | return [n3, t2, i3];
|
543 | }) : [o2, t2, i3];
|
544 | }, typeof (r2 == null ? void 0 : r2.useProxies) == "boolean" && this.setUseProxies(r2.useProxies), typeof (r2 == null ? void 0 : r2.autoFreeze) == "boolean" && this.setAutoFreeze(r2.autoFreeze);
|
545 | }
|
546 | var i2 = e2.prototype;
|
547 | return i2.createDraft = function (e3) {
|
548 | t(e3) || n(8), r(e3) && (e3 = R(e3));
|
549 | var i3 = w(this), o2 = N(this, e3, void 0);
|
550 | return o2[Q].C = true, O(i3), o2;
|
551 | }, i2.finishDraft = function (r2, t2) {
|
552 | var e3 = r2 && r2[Q];
|
553 | e3 && e3.C || n(9), e3.I && n(10);
|
554 | var i3 = e3.A;
|
555 | return j(i3, t2), P(void 0, i3);
|
556 | }, i2.setAutoFreeze = function (n2) {
|
557 | this.D = n2;
|
558 | }, i2.setUseProxies = function (r2) {
|
559 | r2 && !B && n(20), this.O = r2;
|
560 | }, i2.applyPatches = function (n2, t2) {
|
561 | var e3;
|
562 | for (e3 = t2.length - 1; e3 >= 0; e3--) {
|
563 | var i3 = t2[e3];
|
564 | if (i3.path.length === 0 && i3.op === "replace") {
|
565 | n2 = i3.value;
|
566 | break;
|
567 | }
|
568 | }
|
569 | e3 > -1 && (t2 = t2.slice(e3 + 1));
|
570 | var o2 = b("Patches").$;
|
571 | return r(n2) ? o2(n2, t2) : this.produce(n2, function (n3) {
|
572 | return o2(n3, t2);
|
573 | });
|
574 | }, e2;
|
575 | }();
|
576 | var an = new un();
|
577 | var fn = an.produce;
|
578 | an.produceWithPatches.bind(an);
|
579 | an.setAutoFreeze.bind(an);
|
580 | an.setUseProxies.bind(an);
|
581 | an.applyPatches.bind(an);
|
582 | an.createDraft.bind(an);
|
583 | an.finishDraft.bind(an);
|
584 | var immer_esm_default = fn;
|
585 |
|
586 | function _defineProperty(obj, key, value) {
|
587 | if (key in obj) {
|
588 | Object.defineProperty(obj, key, {
|
589 | value: value,
|
590 | enumerable: true,
|
591 | configurable: true,
|
592 | writable: true
|
593 | });
|
594 | }
|
595 | else {
|
596 | obj[key] = value;
|
597 | }
|
598 | return obj;
|
599 | }
|
600 |
|
601 | function ownKeys(object, enumerableOnly) {
|
602 | var keys = Object.keys(object);
|
603 | if (Object.getOwnPropertySymbols) {
|
604 | var symbols = Object.getOwnPropertySymbols(object);
|
605 | enumerableOnly && (symbols = symbols.filter(function (sym) {
|
606 | return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
607 | })), keys.push.apply(keys, symbols);
|
608 | }
|
609 | return keys;
|
610 | }
|
611 | function _objectSpread2(target) {
|
612 | for (var i2 = 1; i2 < arguments.length; i2++) {
|
613 | var source = arguments[i2] != null ? arguments[i2] : {};
|
614 | i2 % 2 ? ownKeys(Object(source), true).forEach(function (key) {
|
615 | _defineProperty(target, key, source[key]);
|
616 | }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
617 | Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
618 | });
|
619 | }
|
620 | return target;
|
621 | }
|
622 |
|
623 | var $$observable = function () {
|
624 | return typeof Symbol === "function" && Symbol.observable || "@@observable";
|
625 | }();
|
626 | var randomString = function randomString2() {
|
627 | return Math.random().toString(36).substring(7).split("").join(".");
|
628 | };
|
629 | var ActionTypes = {
|
630 | INIT: "@@redux/INIT" + randomString(),
|
631 | REPLACE: "@@redux/REPLACE" + randomString(),
|
632 | PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
633 | return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
634 | }
|
635 | };
|
636 | function isPlainObject(obj) {
|
637 | if (typeof obj !== "object" || obj === null)
|
638 | return false;
|
639 | var proto = obj;
|
640 | while (Object.getPrototypeOf(proto) !== null) {
|
641 | proto = Object.getPrototypeOf(proto);
|
642 | }
|
643 | return Object.getPrototypeOf(obj) === proto;
|
644 | }
|
645 | function miniKindOf(val) {
|
646 | if (val === void 0)
|
647 | return "undefined";
|
648 | if (val === null)
|
649 | return "null";
|
650 | var type = typeof val;
|
651 | switch (type) {
|
652 | case "boolean":
|
653 | case "string":
|
654 | case "number":
|
655 | case "symbol":
|
656 | case "function": {
|
657 | return type;
|
658 | }
|
659 | }
|
660 | if (Array.isArray(val))
|
661 | return "array";
|
662 | if (isDate(val))
|
663 | return "date";
|
664 | if (isError(val))
|
665 | return "error";
|
666 | var constructorName = ctorName(val);
|
667 | switch (constructorName) {
|
668 | case "Symbol":
|
669 | case "Promise":
|
670 | case "WeakMap":
|
671 | case "WeakSet":
|
672 | case "Map":
|
673 | case "Set":
|
674 | return constructorName;
|
675 | }
|
676 | return type.slice(8, -1).toLowerCase().replace(/\s/g, "");
|
677 | }
|
678 | function ctorName(val) {
|
679 | return typeof val.constructor === "function" ? val.constructor.name : null;
|
680 | }
|
681 | function isError(val) {
|
682 | return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
683 | }
|
684 | function isDate(val) {
|
685 | if (val instanceof Date)
|
686 | return true;
|
687 | return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
688 | }
|
689 | function kindOf(val) {
|
690 | var typeOfVal = typeof val;
|
691 | {
|
692 | typeOfVal = miniKindOf(val);
|
693 | }
|
694 | return typeOfVal;
|
695 | }
|
696 | function createStore(reducer, preloadedState, enhancer) {
|
697 | var _ref2;
|
698 | if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
699 | throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
|
700 | }
|
701 | if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
702 | enhancer = preloadedState;
|
703 | preloadedState = void 0;
|
704 | }
|
705 | if (typeof enhancer !== "undefined") {
|
706 | if (typeof enhancer !== "function") {
|
707 | throw new Error("Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
|
708 | }
|
709 | return enhancer(createStore)(reducer, preloadedState);
|
710 | }
|
711 | if (typeof reducer !== "function") {
|
712 | throw new Error("Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
|
713 | }
|
714 | var currentReducer = reducer;
|
715 | var currentState = preloadedState;
|
716 | var currentListeners = [];
|
717 | var nextListeners = currentListeners;
|
718 | var isDispatching = false;
|
719 | function ensureCanMutateNextListeners() {
|
720 | if (nextListeners === currentListeners) {
|
721 | nextListeners = currentListeners.slice();
|
722 | }
|
723 | }
|
724 | function getState() {
|
725 | if (isDispatching) {
|
726 | throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
|
727 | }
|
728 | return currentState;
|
729 | }
|
730 | function subscribe(listener2) {
|
731 | if (typeof listener2 !== "function") {
|
732 | throw new Error("Expected the listener to be a function. Instead, received: '" + kindOf(listener2) + "'");
|
733 | }
|
734 | if (isDispatching) {
|
735 | throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
|
736 | }
|
737 | var isSubscribed = true;
|
738 | ensureCanMutateNextListeners();
|
739 | nextListeners.push(listener2);
|
740 | return function unsubscribe() {
|
741 | if (!isSubscribed) {
|
742 | return;
|
743 | }
|
744 | if (isDispatching) {
|
745 | throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
746 | }
|
747 | isSubscribed = false;
|
748 | ensureCanMutateNextListeners();
|
749 | var index = nextListeners.indexOf(listener2);
|
750 | nextListeners.splice(index, 1);
|
751 | currentListeners = null;
|
752 | };
|
753 | }
|
754 | function dispatch(action) {
|
755 | if (!isPlainObject(action)) {
|
756 | throw new Error("Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
|
757 | }
|
758 | if (typeof action.type === "undefined") {
|
759 | throw new Error('Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
760 | }
|
761 | if (isDispatching) {
|
762 | throw new Error("Reducers may not dispatch actions.");
|
763 | }
|
764 | try {
|
765 | isDispatching = true;
|
766 | currentState = currentReducer(currentState, action);
|
767 | }
|
768 | finally {
|
769 | isDispatching = false;
|
770 | }
|
771 | var listeners = currentListeners = nextListeners;
|
772 | for (var i2 = 0; i2 < listeners.length; i2++) {
|
773 | var listener2 = listeners[i2];
|
774 | listener2();
|
775 | }
|
776 | return action;
|
777 | }
|
778 | function replaceReducer(nextReducer) {
|
779 | if (typeof nextReducer !== "function") {
|
780 | throw new Error("Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
|
781 | }
|
782 | currentReducer = nextReducer;
|
783 | dispatch({
|
784 | type: ActionTypes.REPLACE
|
785 | });
|
786 | }
|
787 | function observable() {
|
788 | var _ref;
|
789 | var outerSubscribe = subscribe;
|
790 | return _ref = {
|
791 | subscribe: function subscribe2(observer) {
|
792 | if (typeof observer !== "object" || observer === null) {
|
793 | throw new Error("Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
|
794 | }
|
795 | function observeState() {
|
796 | if (observer.next) {
|
797 | observer.next(getState());
|
798 | }
|
799 | }
|
800 | observeState();
|
801 | var unsubscribe = outerSubscribe(observeState);
|
802 | return {
|
803 | unsubscribe: unsubscribe
|
804 | };
|
805 | }
|
806 | }, _ref[$$observable] = function () {
|
807 | return this;
|
808 | }, _ref;
|
809 | }
|
810 | dispatch({
|
811 | type: ActionTypes.INIT
|
812 | });
|
813 | return _ref2 = {
|
814 | dispatch: dispatch,
|
815 | subscribe: subscribe,
|
816 | getState: getState,
|
817 | replaceReducer: replaceReducer
|
818 | }, _ref2[$$observable] = observable, _ref2;
|
819 | }
|
820 | var legacy_createStore = createStore;
|
821 | function warning(message) {
|
822 | if (typeof console !== "undefined" && typeof console.error === "function") {
|
823 | console.error(message);
|
824 | }
|
825 | try {
|
826 | throw new Error(message);
|
827 | }
|
828 | catch (e2) {
|
829 | }
|
830 | }
|
831 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
832 | var reducerKeys = Object.keys(reducers);
|
833 | var argumentName = action && action.type === ActionTypes.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
834 | if (reducerKeys.length === 0) {
|
835 | return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
836 | }
|
837 | if (!isPlainObject(inputState)) {
|
838 | return "The " + argumentName + ' has unexpected type of "' + kindOf(inputState) + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"');
|
839 | }
|
840 | var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
841 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
842 | });
|
843 | unexpectedKeys.forEach(function (key) {
|
844 | unexpectedKeyCache[key] = true;
|
845 | });
|
846 | if (action && action.type === ActionTypes.REPLACE)
|
847 | return;
|
848 | if (unexpectedKeys.length > 0) {
|
849 | return "Unexpected " + (unexpectedKeys.length > 1 ? "keys" : "key") + " " + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.');
|
850 | }
|
851 | }
|
852 | function assertReducerShape(reducers) {
|
853 | Object.keys(reducers).forEach(function (key) {
|
854 | var reducer = reducers[key];
|
855 | var initialState = reducer(void 0, {
|
856 | type: ActionTypes.INIT
|
857 | });
|
858 | if (typeof initialState === "undefined") {
|
859 | throw new Error('The slice reducer for key "' + key + "\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");
|
860 | }
|
861 | if (typeof reducer(void 0, {
|
862 | type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
863 | }) === "undefined") {
|
864 | throw new Error('The slice reducer for key "' + key + '" returned undefined when probed with a random type. ' + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.");
|
865 | }
|
866 | });
|
867 | }
|
868 | function combineReducers(reducers) {
|
869 | var reducerKeys = Object.keys(reducers);
|
870 | var finalReducers = {};
|
871 | for (var i2 = 0; i2 < reducerKeys.length; i2++) {
|
872 | var key = reducerKeys[i2];
|
873 | {
|
874 | if (typeof reducers[key] === "undefined") {
|
875 | warning('No reducer provided for key "' + key + '"');
|
876 | }
|
877 | }
|
878 | if (typeof reducers[key] === "function") {
|
879 | finalReducers[key] = reducers[key];
|
880 | }
|
881 | }
|
882 | var finalReducerKeys = Object.keys(finalReducers);
|
883 | var unexpectedKeyCache;
|
884 | {
|
885 | unexpectedKeyCache = {};
|
886 | }
|
887 | var shapeAssertionError;
|
888 | try {
|
889 | assertReducerShape(finalReducers);
|
890 | }
|
891 | catch (e2) {
|
892 | shapeAssertionError = e2;
|
893 | }
|
894 | return function combination(state, action) {
|
895 | if (state === void 0) {
|
896 | state = {};
|
897 | }
|
898 | if (shapeAssertionError) {
|
899 | throw shapeAssertionError;
|
900 | }
|
901 | {
|
902 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
903 | if (warningMessage) {
|
904 | warning(warningMessage);
|
905 | }
|
906 | }
|
907 | var hasChanged = false;
|
908 | var nextState = {};
|
909 | for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
910 | var _key = finalReducerKeys[_i];
|
911 | var reducer = finalReducers[_key];
|
912 | var previousStateForKey = state[_key];
|
913 | var nextStateForKey = reducer(previousStateForKey, action);
|
914 | if (typeof nextStateForKey === "undefined") {
|
915 | var actionType = action && action.type;
|
916 | throw new Error("When called with an action of type " + (actionType ? '"' + String(actionType) + '"' : "(unknown type)") + ', the slice reducer for key "' + _key + '" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.');
|
917 | }
|
918 | nextState[_key] = nextStateForKey;
|
919 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
920 | }
|
921 | hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
922 | return hasChanged ? nextState : state;
|
923 | };
|
924 | }
|
925 | function bindActionCreator(actionCreator, dispatch) {
|
926 | return function () {
|
927 | return dispatch(actionCreator.apply(this, arguments));
|
928 | };
|
929 | }
|
930 | function bindActionCreators(actionCreators, dispatch) {
|
931 | if (typeof actionCreators === "function") {
|
932 | return bindActionCreator(actionCreators, dispatch);
|
933 | }
|
934 | if (typeof actionCreators !== "object" || actionCreators === null) {
|
935 | throw new Error("bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
936 | }
|
937 | var boundActionCreators = {};
|
938 | for (var key in actionCreators) {
|
939 | var actionCreator = actionCreators[key];
|
940 | if (typeof actionCreator === "function") {
|
941 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
942 | }
|
943 | }
|
944 | return boundActionCreators;
|
945 | }
|
946 | function compose() {
|
947 | for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
948 | funcs[_key] = arguments[_key];
|
949 | }
|
950 | if (funcs.length === 0) {
|
951 | return function (arg) {
|
952 | return arg;
|
953 | };
|
954 | }
|
955 | if (funcs.length === 1) {
|
956 | return funcs[0];
|
957 | }
|
958 | return funcs.reduce(function (a2, b2) {
|
959 | return function () {
|
960 | return a2(b2.apply(void 0, arguments));
|
961 | };
|
962 | });
|
963 | }
|
964 | function applyMiddleware() {
|
965 | for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
966 | middlewares[_key] = arguments[_key];
|
967 | }
|
968 | return function (createStore2) {
|
969 | return function () {
|
970 | var store = createStore2.apply(void 0, arguments);
|
971 | var _dispatch = function dispatch() {
|
972 | throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
973 | };
|
974 | var middlewareAPI = {
|
975 | getState: store.getState,
|
976 | dispatch: function dispatch() {
|
977 | return _dispatch.apply(void 0, arguments);
|
978 | }
|
979 | };
|
980 | var chain = middlewares.map(function (middleware) {
|
981 | return middleware(middlewareAPI);
|
982 | });
|
983 | _dispatch = compose.apply(void 0, chain)(store.dispatch);
|
984 | return _objectSpread2(_objectSpread2({}, store), {}, {
|
985 | dispatch: _dispatch
|
986 | });
|
987 | };
|
988 | };
|
989 | }
|
990 |
|
991 | var NOT_FOUND = "NOT_FOUND";
|
992 | function createSingletonCache(equals) {
|
993 | var entry;
|
994 | return {
|
995 | get: function get(key) {
|
996 | if (entry && equals(entry.key, key)) {
|
997 | return entry.value;
|
998 | }
|
999 | return NOT_FOUND;
|
1000 | },
|
1001 | put: function put(key, value) {
|
1002 | entry = {
|
1003 | key: key,
|
1004 | value: value
|
1005 | };
|
1006 | },
|
1007 | getEntries: function getEntries() {
|
1008 | return entry ? [entry] : [];
|
1009 | },
|
1010 | clear: function clear() {
|
1011 | entry = void 0;
|
1012 | }
|
1013 | };
|
1014 | }
|
1015 | function createLruCache(maxSize, equals) {
|
1016 | var entries = [];
|
1017 | function get(key) {
|
1018 | var cacheIndex = entries.findIndex(function (entry2) {
|
1019 | return equals(key, entry2.key);
|
1020 | });
|
1021 | if (cacheIndex > -1) {
|
1022 | var entry = entries[cacheIndex];
|
1023 | if (cacheIndex > 0) {
|
1024 | entries.splice(cacheIndex, 1);
|
1025 | entries.unshift(entry);
|
1026 | }
|
1027 | return entry.value;
|
1028 | }
|
1029 | return NOT_FOUND;
|
1030 | }
|
1031 | function put(key, value) {
|
1032 | if (get(key) === NOT_FOUND) {
|
1033 | entries.unshift({
|
1034 | key: key,
|
1035 | value: value
|
1036 | });
|
1037 | if (entries.length > maxSize) {
|
1038 | entries.pop();
|
1039 | }
|
1040 | }
|
1041 | }
|
1042 | function getEntries() {
|
1043 | return entries;
|
1044 | }
|
1045 | function clear() {
|
1046 | entries = [];
|
1047 | }
|
1048 | return {
|
1049 | get: get,
|
1050 | put: put,
|
1051 | getEntries: getEntries,
|
1052 | clear: clear
|
1053 | };
|
1054 | }
|
1055 | var defaultEqualityCheck = function defaultEqualityCheck2(a2, b2) {
|
1056 | return a2 === b2;
|
1057 | };
|
1058 | function createCacheKeyComparator(equalityCheck) {
|
1059 | return function areArgumentsShallowlyEqual(prev, next) {
|
1060 | if (prev === null || next === null || prev.length !== next.length) {
|
1061 | return false;
|
1062 | }
|
1063 | var length = prev.length;
|
1064 | for (var i2 = 0; i2 < length; i2++) {
|
1065 | if (!equalityCheck(prev[i2], next[i2])) {
|
1066 | return false;
|
1067 | }
|
1068 | }
|
1069 | return true;
|
1070 | };
|
1071 | }
|
1072 | function defaultMemoize(func, equalityCheckOrOptions) {
|
1073 | var providedOptions = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : {
|
1074 | equalityCheck: equalityCheckOrOptions
|
1075 | };
|
1076 | var _providedOptions$equa = providedOptions.equalityCheck, equalityCheck = _providedOptions$equa === void 0 ? defaultEqualityCheck : _providedOptions$equa, _providedOptions$maxS = providedOptions.maxSize, maxSize = _providedOptions$maxS === void 0 ? 1 : _providedOptions$maxS, resultEqualityCheck = providedOptions.resultEqualityCheck;
|
1077 | var comparator = createCacheKeyComparator(equalityCheck);
|
1078 | var cache = maxSize === 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator);
|
1079 | function memoized() {
|
1080 | var value = cache.get(arguments);
|
1081 | if (value === NOT_FOUND) {
|
1082 | value = func.apply(null, arguments);
|
1083 | if (resultEqualityCheck) {
|
1084 | var entries = cache.getEntries();
|
1085 | var matchingEntry = entries.find(function (entry) {
|
1086 | return resultEqualityCheck(entry.value, value);
|
1087 | });
|
1088 | if (matchingEntry) {
|
1089 | value = matchingEntry.value;
|
1090 | }
|
1091 | }
|
1092 | cache.put(arguments, value);
|
1093 | }
|
1094 | return value;
|
1095 | }
|
1096 | memoized.clearCache = function () {
|
1097 | return cache.clear();
|
1098 | };
|
1099 | return memoized;
|
1100 | }
|
1101 |
|
1102 | function getDependencies(funcs) {
|
1103 | var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
|
1104 | if (!dependencies.every(function (dep) {
|
1105 | return typeof dep === "function";
|
1106 | })) {
|
1107 | var dependencyTypes = dependencies.map(function (dep) {
|
1108 | return typeof dep === "function" ? "function " + (dep.name || "unnamed") + "()" : typeof dep;
|
1109 | }).join(", ");
|
1110 | throw new Error("createSelector expects all input-selectors to be functions, but received the following types: [" + dependencyTypes + "]");
|
1111 | }
|
1112 | return dependencies;
|
1113 | }
|
1114 | function createSelectorCreator(memoize) {
|
1115 | for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1116 | memoizeOptionsFromArgs[_key - 1] = arguments[_key];
|
1117 | }
|
1118 | var createSelector2 = function createSelector3() {
|
1119 | for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
1120 | funcs[_key2] = arguments[_key2];
|
1121 | }
|
1122 | var _recomputations = 0;
|
1123 | var _lastResult;
|
1124 | var directlyPassedOptions = {
|
1125 | memoizeOptions: void 0
|
1126 | };
|
1127 | var resultFunc = funcs.pop();
|
1128 | if (typeof resultFunc === "object") {
|
1129 | directlyPassedOptions = resultFunc;
|
1130 | resultFunc = funcs.pop();
|
1131 | }
|
1132 | if (typeof resultFunc !== "function") {
|
1133 | throw new Error("createSelector expects an output function after the inputs, but received: [" + typeof resultFunc + "]");
|
1134 | }
|
1135 | var _directlyPassedOption = directlyPassedOptions, _directlyPassedOption2 = _directlyPassedOption.memoizeOptions, memoizeOptions = _directlyPassedOption2 === void 0 ? memoizeOptionsFromArgs : _directlyPassedOption2;
|
1136 | var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions];
|
1137 | var dependencies = getDependencies(funcs);
|
1138 | var memoizedResultFunc = memoize.apply(void 0, [function recomputationWrapper() {
|
1139 | _recomputations++;
|
1140 | return resultFunc.apply(null, arguments);
|
1141 | }].concat(finalMemoizeOptions));
|
1142 | var selector = memoize(function dependenciesChecker() {
|
1143 | var params = [];
|
1144 | var length = dependencies.length;
|
1145 | for (var i2 = 0; i2 < length; i2++) {
|
1146 | params.push(dependencies[i2].apply(null, arguments));
|
1147 | }
|
1148 | _lastResult = memoizedResultFunc.apply(null, params);
|
1149 | return _lastResult;
|
1150 | });
|
1151 | Object.assign(selector, {
|
1152 | resultFunc: resultFunc,
|
1153 | memoizedResultFunc: memoizedResultFunc,
|
1154 | dependencies: dependencies,
|
1155 | lastResult: function lastResult() {
|
1156 | return _lastResult;
|
1157 | },
|
1158 | recomputations: function recomputations() {
|
1159 | return _recomputations;
|
1160 | },
|
1161 | resetRecomputations: function resetRecomputations() {
|
1162 | return _recomputations = 0;
|
1163 | }
|
1164 | });
|
1165 | return selector;
|
1166 | };
|
1167 | return createSelector2;
|
1168 | }
|
1169 | var createSelector = createSelectorCreator(defaultMemoize);
|
1170 |
|
1171 | var createDraftSafeSelector = function () {
|
1172 | var args = [];
|
1173 | for (var _c = 0; _c < arguments.length; _c++) {
|
1174 | args[_c] = arguments[_c];
|
1175 | }
|
1176 | var selector = createSelector.apply(void 0, args);
|
1177 | var wrappedSelector = function (value) {
|
1178 | var rest = [];
|
1179 | for (var _c = 1; _c < arguments.length; _c++) {
|
1180 | rest[_c - 1] = arguments[_c];
|
1181 | }
|
1182 | return selector.apply(void 0, __spreadArray([r(value) ? R(value) : value], rest));
|
1183 | };
|
1184 | return wrappedSelector;
|
1185 | };
|
1186 |
|
1187 | var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () {
|
1188 | if (arguments.length === 0)
|
1189 | return void 0;
|
1190 | if (typeof arguments[0] === "object")
|
1191 | return compose;
|
1192 | return compose.apply(null, arguments);
|
1193 | };
|
1194 |
|
1195 | function isPlainObject2(value) {
|
1196 | if (typeof value !== "object" || value === null)
|
1197 | return false;
|
1198 | var proto = Object.getPrototypeOf(value);
|
1199 | if (proto === null)
|
1200 | return true;
|
1201 | var baseProto = proto;
|
1202 | while (Object.getPrototypeOf(baseProto) !== null) {
|
1203 | baseProto = Object.getPrototypeOf(baseProto);
|
1204 | }
|
1205 | return proto === baseProto;
|
1206 | }
|
1207 |
|
1208 | function createThunkMiddleware(extraArgument) {
|
1209 | var middleware = function middleware2(_ref) {
|
1210 | var dispatch = _ref.dispatch, getState = _ref.getState;
|
1211 | return function (next) {
|
1212 | return function (action) {
|
1213 | if (typeof action === "function") {
|
1214 | return action(dispatch, getState, extraArgument);
|
1215 | }
|
1216 | return next(action);
|
1217 | };
|
1218 | };
|
1219 | };
|
1220 | return middleware;
|
1221 | }
|
1222 | var thunk = createThunkMiddleware();
|
1223 | thunk.withExtraArgument = createThunkMiddleware;
|
1224 | var es_default = thunk;
|
1225 |
|
1226 | var hasMatchFunction = function (v2) {
|
1227 | return v2 && typeof v2.match === "function";
|
1228 | };
|
1229 |
|
1230 | function createAction(type, prepareAction) {
|
1231 | function actionCreator() {
|
1232 | var args = [];
|
1233 | for (var _c = 0; _c < arguments.length; _c++) {
|
1234 | args[_c] = arguments[_c];
|
1235 | }
|
1236 | if (prepareAction) {
|
1237 | var prepared = prepareAction.apply(void 0, args);
|
1238 | if (!prepared) {
|
1239 | throw new Error("prepareAction did not return an object");
|
1240 | }
|
1241 | return __spreadValues(__spreadValues({
|
1242 | type: type,
|
1243 | payload: prepared.payload
|
1244 | }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
|
1245 | }
|
1246 | return { type: type, payload: args[0] };
|
1247 | }
|
1248 | actionCreator.toString = function () { return "" + type; };
|
1249 | actionCreator.type = type;
|
1250 | actionCreator.match = function (action) { return action.type === type; };
|
1251 | return actionCreator;
|
1252 | }
|
1253 | function isAction(action) {
|
1254 | return isPlainObject2(action) && "type" in action;
|
1255 | }
|
1256 | function isActionCreator(action) {
|
1257 | return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
1258 | }
|
1259 | function isFSA(action) {
|
1260 | return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey);
|
1261 | }
|
1262 | function isValidKey(key) {
|
1263 | return ["type", "payload", "error", "meta"].indexOf(key) > -1;
|
1264 | }
|
1265 | function getType(actionCreator) {
|
1266 | return "" + actionCreator;
|
1267 | }
|
1268 |
|
1269 | function getMessage(type) {
|
1270 | var splitType = type ? ("" + type).split("/") : [];
|
1271 | var actionName = splitType[splitType.length - 1] || "actionCreator";
|
1272 | return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
|
1273 | }
|
1274 | function createActionCreatorInvariantMiddleware(options) {
|
1275 | if (options === void 0) { options = {}; }
|
1276 | var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
|
1277 | return function () { return function (next) { return function (action) {
|
1278 | if (isActionCreator2(action)) {
|
1279 | console.warn(getMessage(action.type));
|
1280 | }
|
1281 | return next(action);
|
1282 | }; }; };
|
1283 | }
|
1284 |
|
1285 | function getTimeMeasureUtils(maxDelay, fnName) {
|
1286 | var elapsed = 0;
|
1287 | return {
|
1288 | measureTime: function (fn2) {
|
1289 | var started = Date.now();
|
1290 | try {
|
1291 | return fn2();
|
1292 | }
|
1293 | finally {
|
1294 | var finished = Date.now();
|
1295 | elapsed += finished - started;
|
1296 | }
|
1297 | },
|
1298 | warnIfExceeded: function () {
|
1299 | if (elapsed > maxDelay) {
|
1300 | console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that.");
|
1301 | }
|
1302 | }
|
1303 | };
|
1304 | }
|
1305 | var MiddlewareArray = (function (_super) {
|
1306 | __extends(MiddlewareArray, _super);
|
1307 | function MiddlewareArray() {
|
1308 | var args = [];
|
1309 | for (var _c = 0; _c < arguments.length; _c++) {
|
1310 | args[_c] = arguments[_c];
|
1311 | }
|
1312 | var _this = _super.apply(this, args) || this;
|
1313 | Object.setPrototypeOf(_this, MiddlewareArray.prototype);
|
1314 | return _this;
|
1315 | }
|
1316 | Object.defineProperty(MiddlewareArray, Symbol.species, {
|
1317 | get: function () {
|
1318 | return MiddlewareArray;
|
1319 | },
|
1320 | enumerable: false,
|
1321 | configurable: true
|
1322 | });
|
1323 | MiddlewareArray.prototype.concat = function () {
|
1324 | var arr = [];
|
1325 | for (var _c = 0; _c < arguments.length; _c++) {
|
1326 | arr[_c] = arguments[_c];
|
1327 | }
|
1328 | return _super.prototype.concat.apply(this, arr);
|
1329 | };
|
1330 | MiddlewareArray.prototype.prepend = function () {
|
1331 | var arr = [];
|
1332 | for (var _c = 0; _c < arguments.length; _c++) {
|
1333 | arr[_c] = arguments[_c];
|
1334 | }
|
1335 | if (arr.length === 1 && Array.isArray(arr[0])) {
|
1336 | return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))();
|
1337 | }
|
1338 | return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))();
|
1339 | };
|
1340 | return MiddlewareArray;
|
1341 | }(Array));
|
1342 | var EnhancerArray = (function (_super) {
|
1343 | __extends(EnhancerArray, _super);
|
1344 | function EnhancerArray() {
|
1345 | var args = [];
|
1346 | for (var _c = 0; _c < arguments.length; _c++) {
|
1347 | args[_c] = arguments[_c];
|
1348 | }
|
1349 | var _this = _super.apply(this, args) || this;
|
1350 | Object.setPrototypeOf(_this, EnhancerArray.prototype);
|
1351 | return _this;
|
1352 | }
|
1353 | Object.defineProperty(EnhancerArray, Symbol.species, {
|
1354 | get: function () {
|
1355 | return EnhancerArray;
|
1356 | },
|
1357 | enumerable: false,
|
1358 | configurable: true
|
1359 | });
|
1360 | EnhancerArray.prototype.concat = function () {
|
1361 | var arr = [];
|
1362 | for (var _c = 0; _c < arguments.length; _c++) {
|
1363 | arr[_c] = arguments[_c];
|
1364 | }
|
1365 | return _super.prototype.concat.apply(this, arr);
|
1366 | };
|
1367 | EnhancerArray.prototype.prepend = function () {
|
1368 | var arr = [];
|
1369 | for (var _c = 0; _c < arguments.length; _c++) {
|
1370 | arr[_c] = arguments[_c];
|
1371 | }
|
1372 | if (arr.length === 1 && Array.isArray(arr[0])) {
|
1373 | return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))();
|
1374 | }
|
1375 | return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))();
|
1376 | };
|
1377 | return EnhancerArray;
|
1378 | }(Array));
|
1379 | function freezeDraftable(val) {
|
1380 | return t(val) ? immer_esm_default(val, function () {
|
1381 | }) : val;
|
1382 | }
|
1383 | var prefix = "Invariant failed";
|
1384 | function invariant(condition, message) {
|
1385 | if (condition) {
|
1386 | return;
|
1387 | }
|
1388 | throw new Error(prefix + ": " + (message || ""));
|
1389 | }
|
1390 | function stringify(obj, serializer, indent, decycler) {
|
1391 | return JSON.stringify(obj, getSerialize(serializer, decycler), indent);
|
1392 | }
|
1393 | function getSerialize(serializer, decycler) {
|
1394 | var stack = [], keys = [];
|
1395 | if (!decycler)
|
1396 | decycler = function (_2, value) {
|
1397 | if (stack[0] === value)
|
1398 | return "[Circular ~]";
|
1399 | return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
1400 | };
|
1401 | return function (key, value) {
|
1402 | if (stack.length > 0) {
|
1403 | var thisPos = stack.indexOf(this);
|
1404 | ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
1405 | ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
1406 | if (~stack.indexOf(value))
|
1407 | value = decycler.call(this, key, value);
|
1408 | }
|
1409 | else
|
1410 | stack.push(value);
|
1411 | return serializer == null ? value : serializer.call(this, key, value);
|
1412 | };
|
1413 | }
|
1414 | function isImmutableDefault(value) {
|
1415 | return typeof value !== "object" || value == null || Object.isFrozen(value);
|
1416 | }
|
1417 | function trackForMutations(isImmutable, ignorePaths, obj) {
|
1418 | var trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
|
1419 | return {
|
1420 | detectMutations: function () {
|
1421 | return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
|
1422 | }
|
1423 | };
|
1424 | }
|
1425 | function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
|
1426 | if (ignorePaths === void 0) { ignorePaths = []; }
|
1427 | if (path === void 0) { path = ""; }
|
1428 | if (checkedObjects === void 0) { checkedObjects = new Set(); }
|
1429 | var tracked = { value: obj };
|
1430 | if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
1431 | checkedObjects.add(obj);
|
1432 | tracked.children = {};
|
1433 | for (var key in obj) {
|
1434 | var childPath = path ? path + "." + key : key;
|
1435 | if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
|
1436 | continue;
|
1437 | }
|
1438 | tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
|
1439 | }
|
1440 | }
|
1441 | return tracked;
|
1442 | }
|
1443 | function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) {
|
1444 | if (ignoredPaths === void 0) { ignoredPaths = []; }
|
1445 | if (sameParentRef === void 0) { sameParentRef = false; }
|
1446 | if (path === void 0) { path = ""; }
|
1447 | var prevObj = trackedProperty ? trackedProperty.value : void 0;
|
1448 | var sameRef = prevObj === obj;
|
1449 | if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
|
1450 | return { wasMutated: true, path: path };
|
1451 | }
|
1452 | if (isImmutable(prevObj) || isImmutable(obj)) {
|
1453 | return { wasMutated: false };
|
1454 | }
|
1455 | var keysToDetect = {};
|
1456 | for (var key in trackedProperty.children) {
|
1457 | keysToDetect[key] = true;
|
1458 | }
|
1459 | for (var key in obj) {
|
1460 | keysToDetect[key] = true;
|
1461 | }
|
1462 | var hasIgnoredPaths = ignoredPaths.length > 0;
|
1463 | var _loop_1 = function (key) {
|
1464 | var nestedPath = path ? path + "." + key : key;
|
1465 | if (hasIgnoredPaths) {
|
1466 | var hasMatches = ignoredPaths.some(function (ignored) {
|
1467 | if (ignored instanceof RegExp) {
|
1468 | return ignored.test(nestedPath);
|
1469 | }
|
1470 | return nestedPath === ignored;
|
1471 | });
|
1472 | if (hasMatches) {
|
1473 | return "continue";
|
1474 | }
|
1475 | }
|
1476 | var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
1477 | if (result.wasMutated) {
|
1478 | return { value: result };
|
1479 | }
|
1480 | };
|
1481 | for (var key in keysToDetect) {
|
1482 | var state_1 = _loop_1(key);
|
1483 | if (typeof state_1 === "object")
|
1484 | return state_1.value;
|
1485 | }
|
1486 | return { wasMutated: false };
|
1487 | }
|
1488 | function createImmutableStateInvariantMiddleware(options) {
|
1489 | if (options === void 0) { options = {}; }
|
1490 | var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore;
|
1491 | ignoredPaths = ignoredPaths || ignore;
|
1492 | var track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
1493 | return function (_c) {
|
1494 | var getState = _c.getState;
|
1495 | var state = getState();
|
1496 | var tracker = track(state);
|
1497 | var result;
|
1498 | return function (next) { return function (action) {
|
1499 | var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
1500 | measureUtils.measureTime(function () {
|
1501 | state = getState();
|
1502 | result = tracker.detectMutations();
|
1503 | tracker = track(state);
|
1504 | invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
1505 | });
|
1506 | var dispatchedAction = next(action);
|
1507 | measureUtils.measureTime(function () {
|
1508 | state = getState();
|
1509 | result = tracker.detectMutations();
|
1510 | tracker = track(state);
|
1511 | result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)");
|
1512 | });
|
1513 | measureUtils.warnIfExceeded();
|
1514 | return dispatchedAction;
|
1515 | }; };
|
1516 | };
|
1517 | }
|
1518 |
|
1519 | function isPlain(val) {
|
1520 | var type = typeof val;
|
1521 | return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject2(val);
|
1522 | }
|
1523 | function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) {
|
1524 | if (path === void 0) { path = ""; }
|
1525 | if (isSerializable === void 0) { isSerializable = isPlain; }
|
1526 | if (ignoredPaths === void 0) { ignoredPaths = []; }
|
1527 | var foundNestedSerializable;
|
1528 | if (!isSerializable(value)) {
|
1529 | return {
|
1530 | keyPath: path || "<root>",
|
1531 | value: value
|
1532 | };
|
1533 | }
|
1534 | if (typeof value !== "object" || value === null) {
|
1535 | return false;
|
1536 | }
|
1537 | if (cache == null ? void 0 : cache.has(value))
|
1538 | return false;
|
1539 | var entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
1540 | var hasIgnoredPaths = ignoredPaths.length > 0;
|
1541 | var _loop_2 = function (key, nestedValue) {
|
1542 | var nestedPath = path ? path + "." + key : key;
|
1543 | if (hasIgnoredPaths) {
|
1544 | var hasMatches = ignoredPaths.some(function (ignored) {
|
1545 | if (ignored instanceof RegExp) {
|
1546 | return ignored.test(nestedPath);
|
1547 | }
|
1548 | return nestedPath === ignored;
|
1549 | });
|
1550 | if (hasMatches) {
|
1551 | return "continue";
|
1552 | }
|
1553 | }
|
1554 | if (!isSerializable(nestedValue)) {
|
1555 | return { value: {
|
1556 | keyPath: nestedPath,
|
1557 | value: nestedValue
|
1558 | } };
|
1559 | }
|
1560 | if (typeof nestedValue === "object") {
|
1561 | foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
1562 | if (foundNestedSerializable) {
|
1563 | return { value: foundNestedSerializable };
|
1564 | }
|
1565 | }
|
1566 | };
|
1567 | for (var _c = 0, entries_1 = entries; _c < entries_1.length; _c++) {
|
1568 | var _d = entries_1[_c], key = _d[0], nestedValue = _d[1];
|
1569 | var state_2 = _loop_2(key, nestedValue);
|
1570 | if (typeof state_2 === "object")
|
1571 | return state_2.value;
|
1572 | }
|
1573 | if (cache && isNestedFrozen(value))
|
1574 | cache.add(value);
|
1575 | return false;
|
1576 | }
|
1577 | function isNestedFrozen(value) {
|
1578 | if (!Object.isFrozen(value))
|
1579 | return false;
|
1580 | for (var _c = 0, _d = Object.values(value); _c < _d.length; _c++) {
|
1581 | var nestedValue = _d[_c];
|
1582 | if (typeof nestedValue !== "object" || nestedValue === null)
|
1583 | continue;
|
1584 | if (!isNestedFrozen(nestedValue))
|
1585 | return false;
|
1586 | }
|
1587 | return true;
|
1588 | }
|
1589 | function createSerializableStateInvariantMiddleware(options) {
|
1590 | if (options === void 0) { options = {}; }
|
1591 | var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j, _k = options.disableCache, disableCache = _k === void 0 ? false : _k;
|
1592 | var cache = !disableCache && WeakSet ? new WeakSet() : void 0;
|
1593 | return function (storeAPI) { return function (next) { return function (action) {
|
1594 | var result = next(action);
|
1595 | var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
1596 | if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
|
1597 | measureUtils.measureTime(function () {
|
1598 | var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
1599 | if (foundActionNonSerializableValue) {
|
1600 | var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value;
|
1601 | console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
|
1602 | }
|
1603 | });
|
1604 | }
|
1605 | if (!ignoreState) {
|
1606 | measureUtils.measureTime(function () {
|
1607 | var state = storeAPI.getState();
|
1608 | var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
|
1609 | if (foundStateNonSerializableValue) {
|
1610 | var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value;
|
1611 | console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)");
|
1612 | }
|
1613 | });
|
1614 | measureUtils.warnIfExceeded();
|
1615 | }
|
1616 | return result;
|
1617 | }; }; };
|
1618 | }
|
1619 |
|
1620 | function isBoolean(x2) {
|
1621 | return typeof x2 === "boolean";
|
1622 | }
|
1623 | function curryGetDefaultMiddleware() {
|
1624 | return function curriedGetDefaultMiddleware(options) {
|
1625 | return getDefaultMiddleware(options);
|
1626 | };
|
1627 | }
|
1628 | function getDefaultMiddleware(options) {
|
1629 | if (options === void 0) { options = {}; }
|
1630 | var _c = options.thunk, thunk2 = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
|
1631 | var middlewareArray = new MiddlewareArray();
|
1632 | if (thunk2) {
|
1633 | if (isBoolean(thunk2)) {
|
1634 | middlewareArray.push(es_default);
|
1635 | }
|
1636 | else {
|
1637 | middlewareArray.push(es_default.withExtraArgument(thunk2.extraArgument));
|
1638 | }
|
1639 | }
|
1640 | {
|
1641 | if (immutableCheck) {
|
1642 | var immutableOptions = {};
|
1643 | if (!isBoolean(immutableCheck)) {
|
1644 | immutableOptions = immutableCheck;
|
1645 | }
|
1646 | middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
1647 | }
|
1648 | if (serializableCheck) {
|
1649 | var serializableOptions = {};
|
1650 | if (!isBoolean(serializableCheck)) {
|
1651 | serializableOptions = serializableCheck;
|
1652 | }
|
1653 | middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
1654 | }
|
1655 | if (actionCreatorCheck) {
|
1656 | var actionCreatorOptions = {};
|
1657 | if (!isBoolean(actionCreatorCheck)) {
|
1658 | actionCreatorOptions = actionCreatorCheck;
|
1659 | }
|
1660 | middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
1661 | }
|
1662 | }
|
1663 | return middlewareArray;
|
1664 | }
|
1665 |
|
1666 | var IS_PRODUCTION = false;
|
1667 | function configureStore(options) {
|
1668 | var curriedGetDefaultMiddleware = curryGetDefaultMiddleware();
|
1669 | var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h;
|
1670 | var rootReducer;
|
1671 | if (typeof reducer === "function") {
|
1672 | rootReducer = reducer;
|
1673 | }
|
1674 | else if (isPlainObject2(reducer)) {
|
1675 | rootReducer = combineReducers(reducer);
|
1676 | }
|
1677 | else {
|
1678 | throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers');
|
1679 | }
|
1680 | var finalMiddleware = middleware;
|
1681 | if (typeof finalMiddleware === "function") {
|
1682 | finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware);
|
1683 | if (!Array.isArray(finalMiddleware)) {
|
1684 | throw new Error("when using a middleware builder function, an array of middleware must be returned");
|
1685 | }
|
1686 | }
|
1687 | if (finalMiddleware.some(function (item) { return typeof item !== "function"; })) {
|
1688 | throw new Error("each middleware provided to configureStore must be a function");
|
1689 | }
|
1690 | var middlewareEnhancer = applyMiddleware.apply(void 0, finalMiddleware);
|
1691 | var finalCompose = compose;
|
1692 | if (devTools) {
|
1693 | finalCompose = composeWithDevTools(__spreadValues({
|
1694 | trace: !IS_PRODUCTION
|
1695 | }, typeof devTools === "object" && devTools));
|
1696 | }
|
1697 | var defaultEnhancers = new EnhancerArray(middlewareEnhancer);
|
1698 | var storeEnhancers = defaultEnhancers;
|
1699 | if (Array.isArray(enhancers)) {
|
1700 | storeEnhancers = __spreadArray([middlewareEnhancer], enhancers);
|
1701 | }
|
1702 | else if (typeof enhancers === "function") {
|
1703 | storeEnhancers = enhancers(defaultEnhancers);
|
1704 | }
|
1705 | var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
|
1706 | return createStore(rootReducer, preloadedState, composedEnhancer);
|
1707 | }
|
1708 |
|
1709 | function executeReducerBuilderCallback(builderCallback) {
|
1710 | var actionsMap = {};
|
1711 | var actionMatchers = [];
|
1712 | var defaultCaseReducer;
|
1713 | var builder = {
|
1714 | addCase: function (typeOrActionCreator, reducer) {
|
1715 | {
|
1716 | if (actionMatchers.length > 0) {
|
1717 | throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`");
|
1718 | }
|
1719 | if (defaultCaseReducer) {
|
1720 | throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
1721 | }
|
1722 | }
|
1723 | var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
1724 | if (!type) {
|
1725 | throw new Error("`builder.addCase` cannot be called with an empty action type");
|
1726 | }
|
1727 | if (type in actionsMap) {
|
1728 | throw new Error("`builder.addCase` cannot be called with two reducers for the same action type");
|
1729 | }
|
1730 | actionsMap[type] = reducer;
|
1731 | return builder;
|
1732 | },
|
1733 | addMatcher: function (matcher, reducer) {
|
1734 | {
|
1735 | if (defaultCaseReducer) {
|
1736 | throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
1737 | }
|
1738 | }
|
1739 | actionMatchers.push({ matcher: matcher, reducer: reducer });
|
1740 | return builder;
|
1741 | },
|
1742 | addDefaultCase: function (reducer) {
|
1743 | {
|
1744 | if (defaultCaseReducer) {
|
1745 | throw new Error("`builder.addDefaultCase` can only be called once");
|
1746 | }
|
1747 | }
|
1748 | defaultCaseReducer = reducer;
|
1749 | return builder;
|
1750 | }
|
1751 | };
|
1752 | builderCallback(builder);
|
1753 | return [actionsMap, actionMatchers, defaultCaseReducer];
|
1754 | }
|
1755 |
|
1756 | function isStateFunction(x2) {
|
1757 | return typeof x2 === "function";
|
1758 | }
|
1759 | var hasWarnedAboutObjectNotation = false;
|
1760 | function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) {
|
1761 | if (actionMatchers === void 0) { actionMatchers = []; }
|
1762 | {
|
1763 | if (typeof mapOrBuilderCallback === "object") {
|
1764 | if (!hasWarnedAboutObjectNotation) {
|
1765 | hasWarnedAboutObjectNotation = true;
|
1766 | console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
1767 | }
|
1768 | }
|
1769 | }
|
1770 | var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2];
|
1771 | var getInitialState;
|
1772 | if (isStateFunction(initialState)) {
|
1773 | getInitialState = function () { return freezeDraftable(initialState()); };
|
1774 | }
|
1775 | else {
|
1776 | var frozenInitialState_1 = freezeDraftable(initialState);
|
1777 | getInitialState = function () { return frozenInitialState_1; };
|
1778 | }
|
1779 | function reducer(state, action) {
|
1780 | if (state === void 0) { state = getInitialState(); }
|
1781 | var caseReducers = __spreadArray([
|
1782 | actionsMap[action.type]
|
1783 | ], finalActionMatchers.filter(function (_c) {
|
1784 | var matcher = _c.matcher;
|
1785 | return matcher(action);
|
1786 | }).map(function (_c) {
|
1787 | var reducer2 = _c.reducer;
|
1788 | return reducer2;
|
1789 | }));
|
1790 | if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) {
|
1791 | caseReducers = [finalDefaultCaseReducer];
|
1792 | }
|
1793 | return caseReducers.reduce(function (previousState, caseReducer) {
|
1794 | if (caseReducer) {
|
1795 | if (r(previousState)) {
|
1796 | var draft = previousState;
|
1797 | var result = caseReducer(draft, action);
|
1798 | if (result === void 0) {
|
1799 | return previousState;
|
1800 | }
|
1801 | return result;
|
1802 | }
|
1803 | else if (!t(previousState)) {
|
1804 | var result = caseReducer(previousState, action);
|
1805 | if (result === void 0) {
|
1806 | if (previousState === null) {
|
1807 | return previousState;
|
1808 | }
|
1809 | throw Error("A case reducer on a non-draftable value must not return undefined");
|
1810 | }
|
1811 | return result;
|
1812 | }
|
1813 | else {
|
1814 | return immer_esm_default(previousState, function (draft) {
|
1815 | return caseReducer(draft, action);
|
1816 | });
|
1817 | }
|
1818 | }
|
1819 | return previousState;
|
1820 | }, state);
|
1821 | }
|
1822 | reducer.getInitialState = getInitialState;
|
1823 | return reducer;
|
1824 | }
|
1825 |
|
1826 | var hasWarnedAboutObjectNotation2 = false;
|
1827 | function getType2(slice, actionKey) {
|
1828 | return slice + "/" + actionKey;
|
1829 | }
|
1830 | function createSlice(options) {
|
1831 | var name = options.name;
|
1832 | if (!name) {
|
1833 | throw new Error("`name` is a required option for createSlice");
|
1834 | }
|
1835 | if (typeof process !== "undefined" && true) {
|
1836 | if (options.initialState === void 0) {
|
1837 | console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
1838 | }
|
1839 | }
|
1840 | var initialState = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState);
|
1841 | var reducers = options.reducers || {};
|
1842 | var reducerNames = Object.keys(reducers);
|
1843 | var sliceCaseReducersByName = {};
|
1844 | var sliceCaseReducersByType = {};
|
1845 | var actionCreators = {};
|
1846 | reducerNames.forEach(function (reducerName) {
|
1847 | var maybeReducerWithPrepare = reducers[reducerName];
|
1848 | var type = getType2(name, reducerName);
|
1849 | var caseReducer;
|
1850 | var prepareCallback;
|
1851 | if ("reducer" in maybeReducerWithPrepare) {
|
1852 | caseReducer = maybeReducerWithPrepare.reducer;
|
1853 | prepareCallback = maybeReducerWithPrepare.prepare;
|
1854 | }
|
1855 | else {
|
1856 | caseReducer = maybeReducerWithPrepare;
|
1857 | }
|
1858 | sliceCaseReducersByName[reducerName] = caseReducer;
|
1859 | sliceCaseReducersByType[type] = caseReducer;
|
1860 | actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type);
|
1861 | });
|
1862 | function buildReducer() {
|
1863 | {
|
1864 | if (typeof options.extraReducers === "object") {
|
1865 | if (!hasWarnedAboutObjectNotation2) {
|
1866 | hasWarnedAboutObjectNotation2 = true;
|
1867 | console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
1868 | }
|
1869 | }
|
1870 | }
|
1871 | var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f;
|
1872 | var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType);
|
1873 | return createReducer(initialState, function (builder) {
|
1874 | for (var key in finalCaseReducers) {
|
1875 | builder.addCase(key, finalCaseReducers[key]);
|
1876 | }
|
1877 | for (var _c = 0, actionMatchers_1 = actionMatchers; _c < actionMatchers_1.length; _c++) {
|
1878 | var m2 = actionMatchers_1[_c];
|
1879 | builder.addMatcher(m2.matcher, m2.reducer);
|
1880 | }
|
1881 | if (defaultCaseReducer) {
|
1882 | builder.addDefaultCase(defaultCaseReducer);
|
1883 | }
|
1884 | });
|
1885 | }
|
1886 | var _reducer;
|
1887 | return {
|
1888 | name: name,
|
1889 | reducer: function (state, action) {
|
1890 | if (!_reducer)
|
1891 | _reducer = buildReducer();
|
1892 | return _reducer(state, action);
|
1893 | },
|
1894 | actions: actionCreators,
|
1895 | caseReducers: sliceCaseReducersByName,
|
1896 | getInitialState: function () {
|
1897 | if (!_reducer)
|
1898 | _reducer = buildReducer();
|
1899 | return _reducer.getInitialState();
|
1900 | }
|
1901 | };
|
1902 | }
|
1903 |
|
1904 | function getInitialEntityState() {
|
1905 | return {
|
1906 | ids: [],
|
1907 | entities: {}
|
1908 | };
|
1909 | }
|
1910 | function createInitialStateFactory() {
|
1911 | function getInitialState(additionalState) {
|
1912 | if (additionalState === void 0) { additionalState = {}; }
|
1913 | return Object.assign(getInitialEntityState(), additionalState);
|
1914 | }
|
1915 | return { getInitialState: getInitialState };
|
1916 | }
|
1917 |
|
1918 | function createSelectorsFactory() {
|
1919 | function getSelectors(selectState) {
|
1920 | var selectIds = function (state) { return state.ids; };
|
1921 | var selectEntities = function (state) { return state.entities; };
|
1922 | var selectAll = createDraftSafeSelector(selectIds, selectEntities, function (ids, entities) { return ids.map(function (id) { return entities[id]; }); });
|
1923 | var selectId = function (_2, id) { return id; };
|
1924 | var selectById = function (entities, id) { return entities[id]; };
|
1925 | var selectTotal = createDraftSafeSelector(selectIds, function (ids) { return ids.length; });
|
1926 | if (!selectState) {
|
1927 | return {
|
1928 | selectIds: selectIds,
|
1929 | selectEntities: selectEntities,
|
1930 | selectAll: selectAll,
|
1931 | selectTotal: selectTotal,
|
1932 | selectById: createDraftSafeSelector(selectEntities, selectId, selectById)
|
1933 | };
|
1934 | }
|
1935 | var selectGlobalizedEntities = createDraftSafeSelector(selectState, selectEntities);
|
1936 | return {
|
1937 | selectIds: createDraftSafeSelector(selectState, selectIds),
|
1938 | selectEntities: selectGlobalizedEntities,
|
1939 | selectAll: createDraftSafeSelector(selectState, selectAll),
|
1940 | selectTotal: createDraftSafeSelector(selectState, selectTotal),
|
1941 | selectById: createDraftSafeSelector(selectGlobalizedEntities, selectId, selectById)
|
1942 | };
|
1943 | }
|
1944 | return { getSelectors: getSelectors };
|
1945 | }
|
1946 |
|
1947 | function createSingleArgumentStateOperator(mutator) {
|
1948 | var operator = createStateOperator(function (_2, state) { return mutator(state); });
|
1949 | return function operation(state) {
|
1950 | return operator(state, void 0);
|
1951 | };
|
1952 | }
|
1953 | function createStateOperator(mutator) {
|
1954 | return function operation(state, arg) {
|
1955 | function isPayloadActionArgument(arg2) {
|
1956 | return isFSA(arg2);
|
1957 | }
|
1958 | var runMutator = function (draft) {
|
1959 | if (isPayloadActionArgument(arg)) {
|
1960 | mutator(arg.payload, draft);
|
1961 | }
|
1962 | else {
|
1963 | mutator(arg, draft);
|
1964 | }
|
1965 | };
|
1966 | if (r(state)) {
|
1967 | runMutator(state);
|
1968 | return state;
|
1969 | }
|
1970 | else {
|
1971 | return immer_esm_default(state, runMutator);
|
1972 | }
|
1973 | };
|
1974 | }
|
1975 |
|
1976 | function selectIdValue(entity, selectId) {
|
1977 | var key = selectId(entity);
|
1978 | if (key === void 0) {
|
1979 | console.warn("The entity passed to the `selectId` implementation returned undefined.", "You should probably provide your own `selectId` implementation.", "The entity that was passed:", entity, "The `selectId` implementation:", selectId.toString());
|
1980 | }
|
1981 | return key;
|
1982 | }
|
1983 | function ensureEntitiesArray(entities) {
|
1984 | if (!Array.isArray(entities)) {
|
1985 | entities = Object.values(entities);
|
1986 | }
|
1987 | return entities;
|
1988 | }
|
1989 | function splitAddedUpdatedEntities(newEntities, selectId, state) {
|
1990 | newEntities = ensureEntitiesArray(newEntities);
|
1991 | var added = [];
|
1992 | var updated = [];
|
1993 | for (var _c = 0, newEntities_1 = newEntities; _c < newEntities_1.length; _c++) {
|
1994 | var entity = newEntities_1[_c];
|
1995 | var id = selectIdValue(entity, selectId);
|
1996 | if (id in state.entities) {
|
1997 | updated.push({ id: id, changes: entity });
|
1998 | }
|
1999 | else {
|
2000 | added.push(entity);
|
2001 | }
|
2002 | }
|
2003 | return [added, updated];
|
2004 | }
|
2005 |
|
2006 | function createUnsortedStateAdapter(selectId) {
|
2007 | function addOneMutably(entity, state) {
|
2008 | var key = selectIdValue(entity, selectId);
|
2009 | if (key in state.entities) {
|
2010 | return;
|
2011 | }
|
2012 | state.ids.push(key);
|
2013 | state.entities[key] = entity;
|
2014 | }
|
2015 | function addManyMutably(newEntities, state) {
|
2016 | newEntities = ensureEntitiesArray(newEntities);
|
2017 | for (var _c = 0, newEntities_2 = newEntities; _c < newEntities_2.length; _c++) {
|
2018 | var entity = newEntities_2[_c];
|
2019 | addOneMutably(entity, state);
|
2020 | }
|
2021 | }
|
2022 | function setOneMutably(entity, state) {
|
2023 | var key = selectIdValue(entity, selectId);
|
2024 | if (!(key in state.entities)) {
|
2025 | state.ids.push(key);
|
2026 | }
|
2027 | state.entities[key] = entity;
|
2028 | }
|
2029 | function setManyMutably(newEntities, state) {
|
2030 | newEntities = ensureEntitiesArray(newEntities);
|
2031 | for (var _c = 0, newEntities_3 = newEntities; _c < newEntities_3.length; _c++) {
|
2032 | var entity = newEntities_3[_c];
|
2033 | setOneMutably(entity, state);
|
2034 | }
|
2035 | }
|
2036 | function setAllMutably(newEntities, state) {
|
2037 | newEntities = ensureEntitiesArray(newEntities);
|
2038 | state.ids = [];
|
2039 | state.entities = {};
|
2040 | addManyMutably(newEntities, state);
|
2041 | }
|
2042 | function removeOneMutably(key, state) {
|
2043 | return removeManyMutably([key], state);
|
2044 | }
|
2045 | function removeManyMutably(keys, state) {
|
2046 | var didMutate = false;
|
2047 | keys.forEach(function (key) {
|
2048 | if (key in state.entities) {
|
2049 | delete state.entities[key];
|
2050 | didMutate = true;
|
2051 | }
|
2052 | });
|
2053 | if (didMutate) {
|
2054 | state.ids = state.ids.filter(function (id) { return id in state.entities; });
|
2055 | }
|
2056 | }
|
2057 | function removeAllMutably(state) {
|
2058 | Object.assign(state, {
|
2059 | ids: [],
|
2060 | entities: {}
|
2061 | });
|
2062 | }
|
2063 | function takeNewKey(keys, update, state) {
|
2064 | var original = state.entities[update.id];
|
2065 | var updated = Object.assign({}, original, update.changes);
|
2066 | var newKey = selectIdValue(updated, selectId);
|
2067 | var hasNewKey = newKey !== update.id;
|
2068 | if (hasNewKey) {
|
2069 | keys[update.id] = newKey;
|
2070 | delete state.entities[update.id];
|
2071 | }
|
2072 | state.entities[newKey] = updated;
|
2073 | return hasNewKey;
|
2074 | }
|
2075 | function updateOneMutably(update, state) {
|
2076 | return updateManyMutably([update], state);
|
2077 | }
|
2078 | function updateManyMutably(updates, state) {
|
2079 | var newKeys = {};
|
2080 | var updatesPerEntity = {};
|
2081 | updates.forEach(function (update) {
|
2082 | if (update.id in state.entities) {
|
2083 | updatesPerEntity[update.id] = {
|
2084 | id: update.id,
|
2085 | changes: __spreadValues(__spreadValues({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null), update.changes)
|
2086 | };
|
2087 | }
|
2088 | });
|
2089 | updates = Object.values(updatesPerEntity);
|
2090 | var didMutateEntities = updates.length > 0;
|
2091 | if (didMutateEntities) {
|
2092 | var didMutateIds = updates.filter(function (update) { return takeNewKey(newKeys, update, state); }).length > 0;
|
2093 | if (didMutateIds) {
|
2094 | state.ids = Object.keys(state.entities);
|
2095 | }
|
2096 | }
|
2097 | }
|
2098 | function upsertOneMutably(entity, state) {
|
2099 | return upsertManyMutably([entity], state);
|
2100 | }
|
2101 | function upsertManyMutably(newEntities, state) {
|
2102 | var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1];
|
2103 | updateManyMutably(updated, state);
|
2104 | addManyMutably(added, state);
|
2105 | }
|
2106 | return {
|
2107 | removeAll: createSingleArgumentStateOperator(removeAllMutably),
|
2108 | addOne: createStateOperator(addOneMutably),
|
2109 | addMany: createStateOperator(addManyMutably),
|
2110 | setOne: createStateOperator(setOneMutably),
|
2111 | setMany: createStateOperator(setManyMutably),
|
2112 | setAll: createStateOperator(setAllMutably),
|
2113 | updateOne: createStateOperator(updateOneMutably),
|
2114 | updateMany: createStateOperator(updateManyMutably),
|
2115 | upsertOne: createStateOperator(upsertOneMutably),
|
2116 | upsertMany: createStateOperator(upsertManyMutably),
|
2117 | removeOne: createStateOperator(removeOneMutably),
|
2118 | removeMany: createStateOperator(removeManyMutably)
|
2119 | };
|
2120 | }
|
2121 |
|
2122 | function createSortedStateAdapter(selectId, sort) {
|
2123 | var _c = createUnsortedStateAdapter(selectId), removeOne = _c.removeOne, removeMany = _c.removeMany, removeAll = _c.removeAll;
|
2124 | function addOneMutably(entity, state) {
|
2125 | return addManyMutably([entity], state);
|
2126 | }
|
2127 | function addManyMutably(newEntities, state) {
|
2128 | newEntities = ensureEntitiesArray(newEntities);
|
2129 | var models = newEntities.filter(function (model) { return !(selectIdValue(model, selectId) in state.entities); });
|
2130 | if (models.length !== 0) {
|
2131 | merge(models, state);
|
2132 | }
|
2133 | }
|
2134 | function setOneMutably(entity, state) {
|
2135 | return setManyMutably([entity], state);
|
2136 | }
|
2137 | function setManyMutably(newEntities, state) {
|
2138 | newEntities = ensureEntitiesArray(newEntities);
|
2139 | if (newEntities.length !== 0) {
|
2140 | merge(newEntities, state);
|
2141 | }
|
2142 | }
|
2143 | function setAllMutably(newEntities, state) {
|
2144 | newEntities = ensureEntitiesArray(newEntities);
|
2145 | state.entities = {};
|
2146 | state.ids = [];
|
2147 | addManyMutably(newEntities, state);
|
2148 | }
|
2149 | function updateOneMutably(update, state) {
|
2150 | return updateManyMutably([update], state);
|
2151 | }
|
2152 | function updateManyMutably(updates, state) {
|
2153 | var appliedUpdates = false;
|
2154 | for (var _c = 0, updates_1 = updates; _c < updates_1.length; _c++) {
|
2155 | var update = updates_1[_c];
|
2156 | var entity = state.entities[update.id];
|
2157 | if (!entity) {
|
2158 | continue;
|
2159 | }
|
2160 | appliedUpdates = true;
|
2161 | Object.assign(entity, update.changes);
|
2162 | var newId = selectId(entity);
|
2163 | if (update.id !== newId) {
|
2164 | delete state.entities[update.id];
|
2165 | state.entities[newId] = entity;
|
2166 | }
|
2167 | }
|
2168 | if (appliedUpdates) {
|
2169 | resortEntities(state);
|
2170 | }
|
2171 | }
|
2172 | function upsertOneMutably(entity, state) {
|
2173 | return upsertManyMutably([entity], state);
|
2174 | }
|
2175 | function upsertManyMutably(newEntities, state) {
|
2176 | var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1];
|
2177 | updateManyMutably(updated, state);
|
2178 | addManyMutably(added, state);
|
2179 | }
|
2180 | function areArraysEqual(a2, b2) {
|
2181 | if (a2.length !== b2.length) {
|
2182 | return false;
|
2183 | }
|
2184 | for (var i2 = 0; i2 < a2.length && i2 < b2.length; i2++) {
|
2185 | if (a2[i2] === b2[i2]) {
|
2186 | continue;
|
2187 | }
|
2188 | return false;
|
2189 | }
|
2190 | return true;
|
2191 | }
|
2192 | function merge(models, state) {
|
2193 | models.forEach(function (model) {
|
2194 | state.entities[selectId(model)] = model;
|
2195 | });
|
2196 | resortEntities(state);
|
2197 | }
|
2198 | function resortEntities(state) {
|
2199 | var allEntities = Object.values(state.entities);
|
2200 | allEntities.sort(sort);
|
2201 | var newSortedIds = allEntities.map(selectId);
|
2202 | var ids = state.ids;
|
2203 | if (!areArraysEqual(ids, newSortedIds)) {
|
2204 | state.ids = newSortedIds;
|
2205 | }
|
2206 | }
|
2207 | return {
|
2208 | removeOne: removeOne,
|
2209 | removeMany: removeMany,
|
2210 | removeAll: removeAll,
|
2211 | addOne: createStateOperator(addOneMutably),
|
2212 | updateOne: createStateOperator(updateOneMutably),
|
2213 | upsertOne: createStateOperator(upsertOneMutably),
|
2214 | setOne: createStateOperator(setOneMutably),
|
2215 | setMany: createStateOperator(setManyMutably),
|
2216 | setAll: createStateOperator(setAllMutably),
|
2217 | addMany: createStateOperator(addManyMutably),
|
2218 | updateMany: createStateOperator(updateManyMutably),
|
2219 | upsertMany: createStateOperator(upsertManyMutably)
|
2220 | };
|
2221 | }
|
2222 |
|
2223 | function createEntityAdapter(options) {
|
2224 | if (options === void 0) { options = {}; }
|
2225 | var _c = __spreadValues({
|
2226 | sortComparer: false,
|
2227 | selectId: function (instance) { return instance.id; }
|
2228 | }, options), selectId = _c.selectId, sortComparer = _c.sortComparer;
|
2229 | var stateFactory = createInitialStateFactory();
|
2230 | var selectorsFactory = createSelectorsFactory();
|
2231 | var stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId);
|
2232 | return __spreadValues(__spreadValues(__spreadValues({
|
2233 | selectId: selectId,
|
2234 | sortComparer: sortComparer
|
2235 | }, stateFactory), selectorsFactory), stateAdapter);
|
2236 | }
|
2237 |
|
2238 | var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
2239 | var nanoid = function (size) {
|
2240 | if (size === void 0) { size = 21; }
|
2241 | var id = "";
|
2242 | var i2 = size;
|
2243 | while (i2--) {
|
2244 | id += urlAlphabet[Math.random() * 64 | 0];
|
2245 | }
|
2246 | return id;
|
2247 | };
|
2248 |
|
2249 | var commonProperties = [
|
2250 | "name",
|
2251 | "message",
|
2252 | "stack",
|
2253 | "code"
|
2254 | ];
|
2255 | var RejectWithValue = (function () {
|
2256 | function RejectWithValue(payload, meta) {
|
2257 | this.payload = payload;
|
2258 | this.meta = meta;
|
2259 | }
|
2260 | return RejectWithValue;
|
2261 | }());
|
2262 | var FulfillWithMeta = (function () {
|
2263 | function FulfillWithMeta(payload, meta) {
|
2264 | this.payload = payload;
|
2265 | this.meta = meta;
|
2266 | }
|
2267 | return FulfillWithMeta;
|
2268 | }());
|
2269 | var miniSerializeError = function (value) {
|
2270 | if (typeof value === "object" && value !== null) {
|
2271 | var simpleError = {};
|
2272 | for (var _c = 0, commonProperties_1 = commonProperties; _c < commonProperties_1.length; _c++) {
|
2273 | var property = commonProperties_1[_c];
|
2274 | if (typeof value[property] === "string") {
|
2275 | simpleError[property] = value[property];
|
2276 | }
|
2277 | }
|
2278 | return simpleError;
|
2279 | }
|
2280 | return { message: String(value) };
|
2281 | };
|
2282 | var createAsyncThunk = (function () {
|
2283 | function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
2284 | var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({
|
2285 | payload: payload,
|
2286 | meta: __spreadProps(__spreadValues({}, meta || {}), {
|
2287 | arg: arg,
|
2288 | requestId: requestId,
|
2289 | requestStatus: "fulfilled"
|
2290 | })
|
2291 | }); });
|
2292 | var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({
|
2293 | payload: void 0,
|
2294 | meta: __spreadProps(__spreadValues({}, meta || {}), {
|
2295 | arg: arg,
|
2296 | requestId: requestId,
|
2297 | requestStatus: "pending"
|
2298 | })
|
2299 | }); });
|
2300 | var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({
|
2301 | payload: payload,
|
2302 | error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
2303 | meta: __spreadProps(__spreadValues({}, meta || {}), {
|
2304 | arg: arg,
|
2305 | requestId: requestId,
|
2306 | rejectedWithValue: !!payload,
|
2307 | requestStatus: "rejected",
|
2308 | aborted: (error == null ? void 0 : error.name) === "AbortError",
|
2309 | condition: (error == null ? void 0 : error.name) === "ConditionError"
|
2310 | })
|
2311 | }); });
|
2312 | var displayedWarning = false;
|
2313 | var AC = typeof AbortController !== "undefined" ? AbortController : (function () {
|
2314 | function class_1() {
|
2315 | this.signal = {
|
2316 | aborted: false,
|
2317 | addEventListener: function () {
|
2318 | },
|
2319 | dispatchEvent: function () {
|
2320 | return false;
|
2321 | },
|
2322 | onabort: function () {
|
2323 | },
|
2324 | removeEventListener: function () {
|
2325 | },
|
2326 | reason: void 0,
|
2327 | throwIfAborted: function () {
|
2328 | }
|
2329 | };
|
2330 | }
|
2331 | class_1.prototype.abort = function () {
|
2332 | {
|
2333 | if (!displayedWarning) {
|
2334 | displayedWarning = true;
|
2335 | console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'.");
|
2336 | }
|
2337 | }
|
2338 | };
|
2339 | return class_1;
|
2340 | }());
|
2341 | function actionCreator(arg) {
|
2342 | return function (dispatch, getState, extra) {
|
2343 | var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
|
2344 | var abortController = new AC();
|
2345 | var abortReason;
|
2346 | function abort(reason) {
|
2347 | abortReason = reason;
|
2348 | abortController.abort();
|
2349 | }
|
2350 | var promise2 = function () {
|
2351 | return __async(this, null, function () {
|
2352 | var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch;
|
2353 | return __generator(this, function (_c) {
|
2354 | switch (_c.label) {
|
2355 | case 0:
|
2356 | _c.trys.push([0, 4, , 5]);
|
2357 | conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra });
|
2358 | if (!isThenable(conditionResult)) return [3 , 2];
|
2359 | return [4 , conditionResult];
|
2360 | case 1:
|
2361 | conditionResult = _c.sent();
|
2362 | _c.label = 2;
|
2363 | case 2:
|
2364 | if (conditionResult === false || abortController.signal.aborted) {
|
2365 | throw {
|
2366 | name: "ConditionError",
|
2367 | message: "Aborted due to condition callback returning false."
|
2368 | };
|
2369 | }
|
2370 | abortedPromise = new Promise(function (_2, reject) { return abortController.signal.addEventListener("abort", function () { return reject({
|
2371 | name: "AbortError",
|
2372 | message: abortReason || "Aborted"
|
2373 | }); }); });
|
2374 | dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra })));
|
2375 | return [4 , Promise.race([
|
2376 | abortedPromise,
|
2377 | Promise.resolve(payloadCreator(arg, {
|
2378 | dispatch: dispatch,
|
2379 | getState: getState,
|
2380 | extra: extra,
|
2381 | requestId: requestId,
|
2382 | signal: abortController.signal,
|
2383 | abort: abort,
|
2384 | rejectWithValue: function (value, meta) {
|
2385 | return new RejectWithValue(value, meta);
|
2386 | },
|
2387 | fulfillWithValue: function (value, meta) {
|
2388 | return new FulfillWithMeta(value, meta);
|
2389 | }
|
2390 | })).then(function (result) {
|
2391 | if (result instanceof RejectWithValue) {
|
2392 | throw result;
|
2393 | }
|
2394 | if (result instanceof FulfillWithMeta) {
|
2395 | return fulfilled(result.payload, requestId, arg, result.meta);
|
2396 | }
|
2397 | return fulfilled(result, requestId, arg);
|
2398 | })
|
2399 | ])];
|
2400 | case 3:
|
2401 | finalAction = _c.sent();
|
2402 | return [3 , 5];
|
2403 | case 4:
|
2404 | err_1 = _c.sent();
|
2405 | finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg);
|
2406 | return [3 , 5];
|
2407 | case 5:
|
2408 | skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
2409 | if (!skipDispatch) {
|
2410 | dispatch(finalAction);
|
2411 | }
|
2412 | return [2 , finalAction];
|
2413 | }
|
2414 | });
|
2415 | });
|
2416 | }();
|
2417 | return Object.assign(promise2, {
|
2418 | abort: abort,
|
2419 | requestId: requestId,
|
2420 | arg: arg,
|
2421 | unwrap: function () {
|
2422 | return promise2.then(unwrapResult);
|
2423 | }
|
2424 | });
|
2425 | };
|
2426 | }
|
2427 | return Object.assign(actionCreator, {
|
2428 | pending: pending,
|
2429 | rejected: rejected,
|
2430 | fulfilled: fulfilled,
|
2431 | typePrefix: typePrefix
|
2432 | });
|
2433 | }
|
2434 | createAsyncThunk2.withTypes = function () { return createAsyncThunk2; };
|
2435 | return createAsyncThunk2;
|
2436 | })();
|
2437 | function unwrapResult(action) {
|
2438 | if (action.meta && action.meta.rejectedWithValue) {
|
2439 | throw action.payload;
|
2440 | }
|
2441 | if (action.error) {
|
2442 | throw action.error;
|
2443 | }
|
2444 | return action.payload;
|
2445 | }
|
2446 | function isThenable(value) {
|
2447 | return value !== null && typeof value === "object" && typeof value.then === "function";
|
2448 | }
|
2449 |
|
2450 | var matches = function (matcher, action) {
|
2451 | if (hasMatchFunction(matcher)) {
|
2452 | return matcher.match(action);
|
2453 | }
|
2454 | else {
|
2455 | return matcher(action);
|
2456 | }
|
2457 | };
|
2458 | function isAnyOf() {
|
2459 | var matchers = [];
|
2460 | for (var _c = 0; _c < arguments.length; _c++) {
|
2461 | matchers[_c] = arguments[_c];
|
2462 | }
|
2463 | return function (action) {
|
2464 | return matchers.some(function (matcher) { return matches(matcher, action); });
|
2465 | };
|
2466 | }
|
2467 | function isAllOf() {
|
2468 | var matchers = [];
|
2469 | for (var _c = 0; _c < arguments.length; _c++) {
|
2470 | matchers[_c] = arguments[_c];
|
2471 | }
|
2472 | return function (action) {
|
2473 | return matchers.every(function (matcher) { return matches(matcher, action); });
|
2474 | };
|
2475 | }
|
2476 | function hasExpectedRequestMetadata(action, validStatus) {
|
2477 | if (!action || !action.meta)
|
2478 | return false;
|
2479 | var hasValidRequestId = typeof action.meta.requestId === "string";
|
2480 | var hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1;
|
2481 | return hasValidRequestId && hasValidRequestStatus;
|
2482 | }
|
2483 | function isAsyncThunkArray(a2) {
|
2484 | return typeof a2[0] === "function" && "pending" in a2[0] && "fulfilled" in a2[0] && "rejected" in a2[0];
|
2485 | }
|
2486 | function isPending() {
|
2487 | var asyncThunks = [];
|
2488 | for (var _c = 0; _c < arguments.length; _c++) {
|
2489 | asyncThunks[_c] = arguments[_c];
|
2490 | }
|
2491 | if (asyncThunks.length === 0) {
|
2492 | return function (action) { return hasExpectedRequestMetadata(action, ["pending"]); };
|
2493 | }
|
2494 | if (!isAsyncThunkArray(asyncThunks)) {
|
2495 | return isPending()(asyncThunks[0]);
|
2496 | }
|
2497 | return function (action) {
|
2498 | var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.pending; });
|
2499 | var combinedMatcher = isAnyOf.apply(void 0, matchers);
|
2500 | return combinedMatcher(action);
|
2501 | };
|
2502 | }
|
2503 | function isRejected() {
|
2504 | var asyncThunks = [];
|
2505 | for (var _c = 0; _c < arguments.length; _c++) {
|
2506 | asyncThunks[_c] = arguments[_c];
|
2507 | }
|
2508 | if (asyncThunks.length === 0) {
|
2509 | return function (action) { return hasExpectedRequestMetadata(action, ["rejected"]); };
|
2510 | }
|
2511 | if (!isAsyncThunkArray(asyncThunks)) {
|
2512 | return isRejected()(asyncThunks[0]);
|
2513 | }
|
2514 | return function (action) {
|
2515 | var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.rejected; });
|
2516 | var combinedMatcher = isAnyOf.apply(void 0, matchers);
|
2517 | return combinedMatcher(action);
|
2518 | };
|
2519 | }
|
2520 | function isRejectedWithValue() {
|
2521 | var asyncThunks = [];
|
2522 | for (var _c = 0; _c < arguments.length; _c++) {
|
2523 | asyncThunks[_c] = arguments[_c];
|
2524 | }
|
2525 | var hasFlag = function (action) {
|
2526 | return action && action.meta && action.meta.rejectedWithValue;
|
2527 | };
|
2528 | if (asyncThunks.length === 0) {
|
2529 | return function (action) {
|
2530 | var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag);
|
2531 | return combinedMatcher(action);
|
2532 | };
|
2533 | }
|
2534 | if (!isAsyncThunkArray(asyncThunks)) {
|
2535 | return isRejectedWithValue()(asyncThunks[0]);
|
2536 | }
|
2537 | return function (action) {
|
2538 | var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag);
|
2539 | return combinedMatcher(action);
|
2540 | };
|
2541 | }
|
2542 | function isFulfilled() {
|
2543 | var asyncThunks = [];
|
2544 | for (var _c = 0; _c < arguments.length; _c++) {
|
2545 | asyncThunks[_c] = arguments[_c];
|
2546 | }
|
2547 | if (asyncThunks.length === 0) {
|
2548 | return function (action) { return hasExpectedRequestMetadata(action, ["fulfilled"]); };
|
2549 | }
|
2550 | if (!isAsyncThunkArray(asyncThunks)) {
|
2551 | return isFulfilled()(asyncThunks[0]);
|
2552 | }
|
2553 | return function (action) {
|
2554 | var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.fulfilled; });
|
2555 | var combinedMatcher = isAnyOf.apply(void 0, matchers);
|
2556 | return combinedMatcher(action);
|
2557 | };
|
2558 | }
|
2559 | function isAsyncThunkAction() {
|
2560 | var asyncThunks = [];
|
2561 | for (var _c = 0; _c < arguments.length; _c++) {
|
2562 | asyncThunks[_c] = arguments[_c];
|
2563 | }
|
2564 | if (asyncThunks.length === 0) {
|
2565 | return function (action) { return hasExpectedRequestMetadata(action, ["pending", "fulfilled", "rejected"]); };
|
2566 | }
|
2567 | if (!isAsyncThunkArray(asyncThunks)) {
|
2568 | return isAsyncThunkAction()(asyncThunks[0]);
|
2569 | }
|
2570 | return function (action) {
|
2571 | var matchers = [];
|
2572 | for (var _c = 0, asyncThunks_1 = asyncThunks; _c < asyncThunks_1.length; _c++) {
|
2573 | var asyncThunk = asyncThunks_1[_c];
|
2574 | matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled);
|
2575 | }
|
2576 | var combinedMatcher = isAnyOf.apply(void 0, matchers);
|
2577 | return combinedMatcher(action);
|
2578 | };
|
2579 | }
|
2580 |
|
2581 | var assertFunction = function (func, expected) {
|
2582 | if (typeof func !== "function") {
|
2583 | throw new TypeError(expected + " is not a function");
|
2584 | }
|
2585 | };
|
2586 | var noop = function () {
|
2587 | };
|
2588 | var catchRejection = function (promise2, onError) {
|
2589 | if (onError === void 0) { onError = noop; }
|
2590 | promise2.catch(onError);
|
2591 | return promise2;
|
2592 | };
|
2593 | var addAbortSignalListener = function (abortSignal, callback) {
|
2594 | abortSignal.addEventListener("abort", callback, { once: true });
|
2595 | return function () { return abortSignal.removeEventListener("abort", callback); };
|
2596 | };
|
2597 | var abortControllerWithReason = function (abortController, reason) {
|
2598 | var signal = abortController.signal;
|
2599 | if (signal.aborted) {
|
2600 | return;
|
2601 | }
|
2602 | if (!("reason" in signal)) {
|
2603 | Object.defineProperty(signal, "reason", {
|
2604 | enumerable: true,
|
2605 | value: reason,
|
2606 | configurable: true,
|
2607 | writable: true
|
2608 | });
|
2609 | }
|
2610 | abortController.abort(reason);
|
2611 | };
|
2612 |
|
2613 | var task = "task";
|
2614 | var listener = "listener";
|
2615 | var completed = "completed";
|
2616 | var cancelled = "cancelled";
|
2617 | var taskCancelled = "task-" + cancelled;
|
2618 | var taskCompleted = "task-" + completed;
|
2619 | var listenerCancelled = listener + "-" + cancelled;
|
2620 | var listenerCompleted = listener + "-" + completed;
|
2621 | var TaskAbortError = (function () {
|
2622 | function TaskAbortError(code) {
|
2623 | this.code = code;
|
2624 | this.name = "TaskAbortError";
|
2625 | this.message = task + " " + cancelled + " (reason: " + code + ")";
|
2626 | }
|
2627 | return TaskAbortError;
|
2628 | }());
|
2629 |
|
2630 | var validateActive = function (signal) {
|
2631 | if (signal.aborted) {
|
2632 | throw new TaskAbortError(signal.reason);
|
2633 | }
|
2634 | };
|
2635 | function raceWithSignal(signal, promise2) {
|
2636 | var cleanup = noop;
|
2637 | return new Promise(function (resolve, reject) {
|
2638 | var notifyRejection = function () { return reject(new TaskAbortError(signal.reason)); };
|
2639 | if (signal.aborted) {
|
2640 | notifyRejection();
|
2641 | return;
|
2642 | }
|
2643 | cleanup = addAbortSignalListener(signal, notifyRejection);
|
2644 | promise2.finally(function () { return cleanup(); }).then(resolve, reject);
|
2645 | }).finally(function () {
|
2646 | cleanup = noop;
|
2647 | });
|
2648 | }
|
2649 | var runTask = function (task2, cleanUp) { return __async(void 0, null, function () {
|
2650 | var value, error_1;
|
2651 | return __generator(this, function (_c) {
|
2652 | switch (_c.label) {
|
2653 | case 0:
|
2654 | _c.trys.push([0, 3, 4, 5]);
|
2655 | return [4 , Promise.resolve()];
|
2656 | case 1:
|
2657 | _c.sent();
|
2658 | return [4 , task2()];
|
2659 | case 2:
|
2660 | value = _c.sent();
|
2661 | return [2 , {
|
2662 | status: "ok",
|
2663 | value: value
|
2664 | }];
|
2665 | case 3:
|
2666 | error_1 = _c.sent();
|
2667 | return [2 , {
|
2668 | status: error_1 instanceof TaskAbortError ? "cancelled" : "rejected",
|
2669 | error: error_1
|
2670 | }];
|
2671 | case 4:
|
2672 | cleanUp == null ? void 0 : cleanUp();
|
2673 | return [7 ];
|
2674 | case 5: return [2 ];
|
2675 | }
|
2676 | });
|
2677 | }); };
|
2678 | var createPause = function (signal) {
|
2679 | return function (promise2) {
|
2680 | return catchRejection(raceWithSignal(signal, promise2).then(function (output) {
|
2681 | validateActive(signal);
|
2682 | return output;
|
2683 | }));
|
2684 | };
|
2685 | };
|
2686 | var createDelay = function (signal) {
|
2687 | var pause = createPause(signal);
|
2688 | return function (timeoutMs) {
|
2689 | return pause(new Promise(function (resolve) { return setTimeout(resolve, timeoutMs); }));
|
2690 | };
|
2691 | };
|
2692 |
|
2693 | var assign = Object.assign;
|
2694 | var INTERNAL_NIL_TOKEN = {};
|
2695 | var alm = "listenerMiddleware";
|
2696 | var createFork = function (parentAbortSignal, parentBlockingPromises) {
|
2697 | var linkControllers = function (controller) { return addAbortSignalListener(parentAbortSignal, function () { return abortControllerWithReason(controller, parentAbortSignal.reason); }); };
|
2698 | return function (taskExecutor, opts) {
|
2699 | assertFunction(taskExecutor, "taskExecutor");
|
2700 | var childAbortController = new AbortController();
|
2701 | linkControllers(childAbortController);
|
2702 | var result = runTask(function () { return __async(void 0, null, function () {
|
2703 | var result2;
|
2704 | return __generator(this, function (_c) {
|
2705 | switch (_c.label) {
|
2706 | case 0:
|
2707 | validateActive(parentAbortSignal);
|
2708 | validateActive(childAbortController.signal);
|
2709 | return [4 , taskExecutor({
|
2710 | pause: createPause(childAbortController.signal),
|
2711 | delay: createDelay(childAbortController.signal),
|
2712 | signal: childAbortController.signal
|
2713 | })];
|
2714 | case 1:
|
2715 | result2 = _c.sent();
|
2716 | validateActive(childAbortController.signal);
|
2717 | return [2 , result2];
|
2718 | }
|
2719 | });
|
2720 | }); }, function () { return abortControllerWithReason(childAbortController, taskCompleted); });
|
2721 | if (opts == null ? void 0 : opts.autoJoin) {
|
2722 | parentBlockingPromises.push(result);
|
2723 | }
|
2724 | return {
|
2725 | result: createPause(parentAbortSignal)(result),
|
2726 | cancel: function () {
|
2727 | abortControllerWithReason(childAbortController, taskCancelled);
|
2728 | }
|
2729 | };
|
2730 | };
|
2731 | };
|
2732 | var createTakePattern = function (startListening, signal) {
|
2733 | var take = function (predicate, timeout) { return __async(void 0, null, function () {
|
2734 | var unsubscribe, tuplePromise, promises, output;
|
2735 | return __generator(this, function (_c) {
|
2736 | switch (_c.label) {
|
2737 | case 0:
|
2738 | validateActive(signal);
|
2739 | unsubscribe = function () {
|
2740 | };
|
2741 | tuplePromise = new Promise(function (resolve, reject) {
|
2742 | var stopListening = startListening({
|
2743 | predicate: predicate,
|
2744 | effect: function (action, listenerApi) {
|
2745 | listenerApi.unsubscribe();
|
2746 | resolve([
|
2747 | action,
|
2748 | listenerApi.getState(),
|
2749 | listenerApi.getOriginalState()
|
2750 | ]);
|
2751 | }
|
2752 | });
|
2753 | unsubscribe = function () {
|
2754 | stopListening();
|
2755 | reject();
|
2756 | };
|
2757 | });
|
2758 | promises = [
|
2759 | tuplePromise
|
2760 | ];
|
2761 | if (timeout != null) {
|
2762 | promises.push(new Promise(function (resolve) { return setTimeout(resolve, timeout, null); }));
|
2763 | }
|
2764 | _c.label = 1;
|
2765 | case 1:
|
2766 | _c.trys.push([1, , 3, 4]);
|
2767 | return [4 , raceWithSignal(signal, Promise.race(promises))];
|
2768 | case 2:
|
2769 | output = _c.sent();
|
2770 | validateActive(signal);
|
2771 | return [2 , output];
|
2772 | case 3:
|
2773 | unsubscribe();
|
2774 | return [7 ];
|
2775 | case 4: return [2 ];
|
2776 | }
|
2777 | });
|
2778 | }); };
|
2779 | return function (predicate, timeout) { return catchRejection(take(predicate, timeout)); };
|
2780 | };
|
2781 | var getListenerEntryPropsFrom = function (options) {
|
2782 | var type = options.type, actionCreator = options.actionCreator, matcher = options.matcher, predicate = options.predicate, effect = options.effect;
|
2783 | if (type) {
|
2784 | predicate = createAction(type).match;
|
2785 | }
|
2786 | else if (actionCreator) {
|
2787 | type = actionCreator.type;
|
2788 | predicate = actionCreator.match;
|
2789 | }
|
2790 | else if (matcher) {
|
2791 | predicate = matcher;
|
2792 | }
|
2793 | else if (predicate) ;
|
2794 | else {
|
2795 | throw new Error("Creating or removing a listener requires one of the known fields for matching an action");
|
2796 | }
|
2797 | assertFunction(effect, "options.listener");
|
2798 | return { predicate: predicate, type: type, effect: effect };
|
2799 | };
|
2800 | var createListenerEntry = function (options) {
|
2801 | var _c = getListenerEntryPropsFrom(options), type = _c.type, predicate = _c.predicate, effect = _c.effect;
|
2802 | var id = nanoid();
|
2803 | var entry = {
|
2804 | id: id,
|
2805 | effect: effect,
|
2806 | type: type,
|
2807 | predicate: predicate,
|
2808 | pending: new Set(),
|
2809 | unsubscribe: function () {
|
2810 | throw new Error("Unsubscribe not initialized");
|
2811 | }
|
2812 | };
|
2813 | return entry;
|
2814 | };
|
2815 | var cancelActiveListeners = function (entry) {
|
2816 | entry.pending.forEach(function (controller) {
|
2817 | abortControllerWithReason(controller, listenerCancelled);
|
2818 | });
|
2819 | };
|
2820 | var createClearListenerMiddleware = function (listenerMap) {
|
2821 | return function () {
|
2822 | listenerMap.forEach(cancelActiveListeners);
|
2823 | listenerMap.clear();
|
2824 | };
|
2825 | };
|
2826 | var safelyNotifyError = function (errorHandler, errorToNotify, errorInfo) {
|
2827 | try {
|
2828 | errorHandler(errorToNotify, errorInfo);
|
2829 | }
|
2830 | catch (errorHandlerError) {
|
2831 | setTimeout(function () {
|
2832 | throw errorHandlerError;
|
2833 | }, 0);
|
2834 | }
|
2835 | };
|
2836 | var addListener = createAction(alm + "/add");
|
2837 | var clearAllListeners = createAction(alm + "/removeAll");
|
2838 | var removeListener = createAction(alm + "/remove");
|
2839 | var defaultErrorHandler = function () {
|
2840 | var args = [];
|
2841 | for (var _c = 0; _c < arguments.length; _c++) {
|
2842 | args[_c] = arguments[_c];
|
2843 | }
|
2844 | console.error.apply(console, __spreadArray([alm + "/error"], args));
|
2845 | };
|
2846 | function createListenerMiddleware(middlewareOptions) {
|
2847 | var _this = this;
|
2848 | if (middlewareOptions === void 0) { middlewareOptions = {}; }
|
2849 | var listenerMap = new Map();
|
2850 | var extra = middlewareOptions.extra, _c = middlewareOptions.onError, onError = _c === void 0 ? defaultErrorHandler : _c;
|
2851 | assertFunction(onError, "onError");
|
2852 | var insertEntry = function (entry) {
|
2853 | entry.unsubscribe = function () { return listenerMap.delete(entry.id); };
|
2854 | listenerMap.set(entry.id, entry);
|
2855 | return function (cancelOptions) {
|
2856 | entry.unsubscribe();
|
2857 | if (cancelOptions == null ? void 0 : cancelOptions.cancelActive) {
|
2858 | cancelActiveListeners(entry);
|
2859 | }
|
2860 | };
|
2861 | };
|
2862 | var findListenerEntry = function (comparator) {
|
2863 | for (var _c = 0, _d = Array.from(listenerMap.values()); _c < _d.length; _c++) {
|
2864 | var entry = _d[_c];
|
2865 | if (comparator(entry)) {
|
2866 | return entry;
|
2867 | }
|
2868 | }
|
2869 | return void 0;
|
2870 | };
|
2871 | var startListening = function (options) {
|
2872 | var entry = findListenerEntry(function (existingEntry) { return existingEntry.effect === options.effect; });
|
2873 | if (!entry) {
|
2874 | entry = createListenerEntry(options);
|
2875 | }
|
2876 | return insertEntry(entry);
|
2877 | };
|
2878 | var stopListening = function (options) {
|
2879 | var _c = getListenerEntryPropsFrom(options), type = _c.type, effect = _c.effect, predicate = _c.predicate;
|
2880 | var entry = findListenerEntry(function (entry2) {
|
2881 | var matchPredicateOrType = typeof type === "string" ? entry2.type === type : entry2.predicate === predicate;
|
2882 | return matchPredicateOrType && entry2.effect === effect;
|
2883 | });
|
2884 | if (entry) {
|
2885 | entry.unsubscribe();
|
2886 | if (options.cancelActive) {
|
2887 | cancelActiveListeners(entry);
|
2888 | }
|
2889 | }
|
2890 | return !!entry;
|
2891 | };
|
2892 | var notifyListener = function (entry, action, api, getOriginalState) { return __async(_this, null, function () {
|
2893 | var internalTaskController, take, autoJoinPromises, listenerError_1;
|
2894 | return __generator(this, function (_c) {
|
2895 | switch (_c.label) {
|
2896 | case 0:
|
2897 | internalTaskController = new AbortController();
|
2898 | take = createTakePattern(startListening, internalTaskController.signal);
|
2899 | autoJoinPromises = [];
|
2900 | _c.label = 1;
|
2901 | case 1:
|
2902 | _c.trys.push([1, 3, 4, 6]);
|
2903 | entry.pending.add(internalTaskController);
|
2904 | return [4 , Promise.resolve(entry.effect(action, assign({}, api, {
|
2905 | getOriginalState: getOriginalState,
|
2906 | condition: function (predicate, timeout) { return take(predicate, timeout).then(Boolean); },
|
2907 | take: take,
|
2908 | delay: createDelay(internalTaskController.signal),
|
2909 | pause: createPause(internalTaskController.signal),
|
2910 | extra: extra,
|
2911 | signal: internalTaskController.signal,
|
2912 | fork: createFork(internalTaskController.signal, autoJoinPromises),
|
2913 | unsubscribe: entry.unsubscribe,
|
2914 | subscribe: function () {
|
2915 | listenerMap.set(entry.id, entry);
|
2916 | },
|
2917 | cancelActiveListeners: function () {
|
2918 | entry.pending.forEach(function (controller, _2, set) {
|
2919 | if (controller !== internalTaskController) {
|
2920 | abortControllerWithReason(controller, listenerCancelled);
|
2921 | set.delete(controller);
|
2922 | }
|
2923 | });
|
2924 | }
|
2925 | })))];
|
2926 | case 2:
|
2927 | _c.sent();
|
2928 | return [3 /*break*/, 6];
|
2929 | case 3:
|
2930 | listenerError_1 = _c.sent();
|
2931 | if (!(listenerError_1 instanceof TaskAbortError)) {
|
2932 | safelyNotifyError(onError, listenerError_1, {
|
2933 | raisedBy: "effect"
|
2934 | });
|
2935 | }
|
2936 | return [3 , 6];
|
2937 | case 4: return [4 , Promise.allSettled(autoJoinPromises)];
|
2938 | case 5:
|
2939 | _c.sent();
|
2940 | abortControllerWithReason(internalTaskController, listenerCompleted);
|
2941 | entry.pending.delete(internalTaskController);
|
2942 | return [7 ];
|
2943 | case 6: return [2 ];
|
2944 | }
|
2945 | });
|
2946 | }); };
|
2947 | var clearListenerMiddleware = createClearListenerMiddleware(listenerMap);
|
2948 | var middleware = function (api) { return function (next) { return function (action) {
|
2949 | if (!isAction(action)) {
|
2950 | return next(action);
|
2951 | }
|
2952 | if (addListener.match(action)) {
|
2953 | return startListening(action.payload);
|
2954 | }
|
2955 | if (clearAllListeners.match(action)) {
|
2956 | clearListenerMiddleware();
|
2957 | return;
|
2958 | }
|
2959 | if (removeListener.match(action)) {
|
2960 | return stopListening(action.payload);
|
2961 | }
|
2962 | var originalState = api.getState();
|
2963 | var getOriginalState = function () {
|
2964 | if (originalState === INTERNAL_NIL_TOKEN) {
|
2965 | throw new Error(alm + ": getOriginalState can only be called synchronously");
|
2966 | }
|
2967 | return originalState;
|
2968 | };
|
2969 | var result;
|
2970 | try {
|
2971 | result = next(action);
|
2972 | if (listenerMap.size > 0) {
|
2973 | var currentState = api.getState();
|
2974 | var listenerEntries = Array.from(listenerMap.values());
|
2975 | for (var _c = 0, listenerEntries_1 = listenerEntries; _c < listenerEntries_1.length; _c++) {
|
2976 | var entry = listenerEntries_1[_c];
|
2977 | var runListener = false;
|
2978 | try {
|
2979 | runListener = entry.predicate(action, currentState, originalState);
|
2980 | }
|
2981 | catch (predicateError) {
|
2982 | runListener = false;
|
2983 | safelyNotifyError(onError, predicateError, {
|
2984 | raisedBy: "predicate"
|
2985 | });
|
2986 | }
|
2987 | if (!runListener) {
|
2988 | continue;
|
2989 | }
|
2990 | notifyListener(entry, action, api, getOriginalState);
|
2991 | }
|
2992 | }
|
2993 | }
|
2994 | finally {
|
2995 | originalState = INTERNAL_NIL_TOKEN;
|
2996 | }
|
2997 | return result;
|
2998 | }; }; };
|
2999 | return {
|
3000 | middleware: middleware,
|
3001 | startListening: startListening,
|
3002 | stopListening: stopListening,
|
3003 | clearListeners: clearListenerMiddleware
|
3004 | };
|
3005 | }
|
3006 |
|
3007 | var SHOULD_AUTOBATCH = "RTK_autoBatch";
|
3008 | var prepareAutoBatched = function () { return function (payload) {
|
3009 | var _c;
|
3010 | return ({
|
3011 | payload: payload,
|
3012 | meta: (_c = {}, _c[SHOULD_AUTOBATCH] = true, _c)
|
3013 | });
|
3014 | }; };
|
3015 | var promise;
|
3016 | var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () {
|
3017 | throw err;
|
3018 | }, 0); }); };
|
3019 | var createQueueWithTimer = function (timeout) {
|
3020 | return function (notify) {
|
3021 | setTimeout(notify, timeout);
|
3022 | };
|
3023 | };
|
3024 | var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10);
|
3025 | var autoBatchEnhancer = function (options) {
|
3026 | if (options === void 0) { options = { type: "raf" }; }
|
3027 | return function (next) { return function () {
|
3028 | var args = [];
|
3029 | for (var _c = 0; _c < arguments.length; _c++) {
|
3030 | args[_c] = arguments[_c];
|
3031 | }
|
3032 | var store = next.apply(void 0, args);
|
3033 | var notifying = true;
|
3034 | var shouldNotifyAtEndOfTick = false;
|
3035 | var notificationQueued = false;
|
3036 | var listeners = new Set();
|
3037 | var queueCallback = options.type === "tick" ? queueMicrotaskShim : options.type === "raf" ? rAF : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
|
3038 | var notifyListeners = function () {
|
3039 | notificationQueued = false;
|
3040 | if (shouldNotifyAtEndOfTick) {
|
3041 | shouldNotifyAtEndOfTick = false;
|
3042 | listeners.forEach(function (l2) { return l2(); });
|
3043 | }
|
3044 | };
|
3045 | return Object.assign({}, store, {
|
3046 | subscribe: function (listener2) {
|
3047 | var wrappedListener = function () { return notifying && listener2(); };
|
3048 | var unsubscribe = store.subscribe(wrappedListener);
|
3049 | listeners.add(listener2);
|
3050 | return function () {
|
3051 | unsubscribe();
|
3052 | listeners.delete(listener2);
|
3053 | };
|
3054 | },
|
3055 | dispatch: function (action) {
|
3056 | var _a;
|
3057 | try {
|
3058 | notifying = !((_a = action == null ? void 0 : action.meta) == null ? void 0 : _a[SHOULD_AUTOBATCH]);
|
3059 | shouldNotifyAtEndOfTick = !notifying;
|
3060 | if (shouldNotifyAtEndOfTick) {
|
3061 | if (!notificationQueued) {
|
3062 | notificationQueued = true;
|
3063 | queueCallback(notifyListeners);
|
3064 | }
|
3065 | }
|
3066 | return store.dispatch(action);
|
3067 | }
|
3068 | finally {
|
3069 | notifying = true;
|
3070 | }
|
3071 | }
|
3072 | });
|
3073 | }; };
|
3074 | };
|
3075 |
|
3076 | F();
|
3077 |
|
3078 | exports.EnhancerArray = EnhancerArray;
|
3079 | exports.MiddlewareArray = MiddlewareArray;
|
3080 | exports.SHOULD_AUTOBATCH = SHOULD_AUTOBATCH;
|
3081 | exports.TaskAbortError = TaskAbortError;
|
3082 | exports.__DO_NOT_USE__ActionTypes = ActionTypes;
|
3083 | exports.addListener = addListener;
|
3084 | exports.applyMiddleware = applyMiddleware;
|
3085 | exports.autoBatchEnhancer = autoBatchEnhancer;
|
3086 | exports.bindActionCreators = bindActionCreators;
|
3087 | exports.clearAllListeners = clearAllListeners;
|
3088 | exports.combineReducers = combineReducers;
|
3089 | exports.compose = compose;
|
3090 | exports.configureStore = configureStore;
|
3091 | exports.createAction = createAction;
|
3092 | exports.createActionCreatorInvariantMiddleware = createActionCreatorInvariantMiddleware;
|
3093 | exports.createAsyncThunk = createAsyncThunk;
|
3094 | exports.createDraftSafeSelector = createDraftSafeSelector;
|
3095 | exports.createEntityAdapter = createEntityAdapter;
|
3096 | exports.createImmutableStateInvariantMiddleware = createImmutableStateInvariantMiddleware;
|
3097 | exports.createListenerMiddleware = createListenerMiddleware;
|
3098 | exports.createNextState = immer_esm_default;
|
3099 | exports.createReducer = createReducer;
|
3100 | exports.createSelector = createSelector;
|
3101 | exports.createSerializableStateInvariantMiddleware = createSerializableStateInvariantMiddleware;
|
3102 | exports.createSlice = createSlice;
|
3103 | exports.createStore = createStore;
|
3104 | exports.current = R;
|
3105 | exports.findNonSerializableValue = findNonSerializableValue;
|
3106 | exports.freeze = d;
|
3107 | exports.getDefaultMiddleware = getDefaultMiddleware;
|
3108 | exports.getType = getType;
|
3109 | exports.isAction = isAction;
|
3110 | exports.isActionCreator = isActionCreator;
|
3111 | exports.isAllOf = isAllOf;
|
3112 | exports.isAnyOf = isAnyOf;
|
3113 | exports.isAsyncThunkAction = isAsyncThunkAction;
|
3114 | exports.isDraft = r;
|
3115 | exports.isFluxStandardAction = isFSA;
|
3116 | exports.isFulfilled = isFulfilled;
|
3117 | exports.isImmutableDefault = isImmutableDefault;
|
3118 | exports.isPending = isPending;
|
3119 | exports.isPlain = isPlain;
|
3120 | exports.isPlainObject = isPlainObject2;
|
3121 | exports.isRejected = isRejected;
|
3122 | exports.isRejectedWithValue = isRejectedWithValue;
|
3123 | exports.legacy_createStore = legacy_createStore;
|
3124 | exports.miniSerializeError = miniSerializeError;
|
3125 | exports.nanoid = nanoid;
|
3126 | exports.original = e;
|
3127 | exports.prepareAutoBatched = prepareAutoBatched;
|
3128 | exports.removeListener = removeListener;
|
3129 | exports.unwrapResult = unwrapResult;
|
3130 |
|
3131 | Object.defineProperty(exports, '__esModule', { value: true });
|
3132 |
|
3133 | }));
|
3134 |
|