hasting-swatchcart-module 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/components/SwatchesModule.js +7 -7
  2. package/dist/main.d.ts +1 -1
  3. package/dist/main.js +5 -1
  4. package/dist/src/app/store/rootReducer.js +8 -8
  5. package/dist/src/app/store/store.js +10 -10
  6. package/dist/src/features/Cart/model/cartSlice.js +1 -1
  7. package/dist/src/features/Cart/model/selectors.js +1 -1
  8. package/dist/src/features/MultiProduct/model/multiProductCartSlice.js +1 -1
  9. package/dist/src/features/MultiProduct/model/selectors.js +1 -1
  10. package/dist/src/features/swatches/model/swatchesSlice.js +28 -29
  11. package/dist/src/features/swatches/model/thunks.js +1 -1
  12. package/dist/store/LibraryProvider.d.ts +4 -0
  13. package/dist/store/LibraryProvider.js +9 -0
  14. package/dist/store/rootReducer.d.ts +11 -0
  15. package/dist/store/rootReducer.js +12 -0
  16. package/dist/store/store.d.ts +25 -0
  17. package/dist/store/store.js +17 -0
  18. package/dist/store/withStore.d.ts +2 -0
  19. package/dist/store/withStore.js +9 -0
  20. package/package.json +1 -1
  21. package/dist/_virtual/use-sync-external-store-with-selector.development.js +0 -4
  22. package/dist/_virtual/use-sync-external-store-with-selector.production.js +0 -4
  23. package/dist/_virtual/with-selector.js +0 -5
  24. package/dist/_virtual/with-selector2.js +0 -4
  25. package/dist/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.js +0 -877
  26. package/dist/node_modules/immer/dist/immer.js +0 -467
  27. package/dist/node_modules/react-redux/dist/react-redux.js +0 -246
  28. package/dist/node_modules/redux/dist/redux.js +0 -258
  29. package/dist/node_modules/redux-thunk/dist/redux-thunk.js +0 -8
  30. package/dist/node_modules/reselect/dist/reselect.js +0 -244
  31. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +0 -66
  32. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +0 -65
  33. package/dist/node_modules/use-sync-external-store/with-selector.js +0 -10
  34. package/dist/src/app/providers/StoreProvider.js +0 -7
@@ -1,877 +0,0 @@
1
- import { isPlainObject as P, combineReducers as Z, applyMiddleware as ee, compose as A, createStore as te, isAction as q } from "../../../redux/dist/redux.js";
2
- import { __DO_NOT_USE__ActionTypes as Ue } from "../../../redux/dist/redux.js";
3
- import { produce as B, isDraftable as W, isDraft as re } from "../../../immer/dist/immer.js";
4
- import { current as Ge, freeze as Xe } from "../../../immer/dist/immer.js";
5
- import { thunk as ne, withExtraArgument as oe } from "../../../redux-thunk/dist/redux-thunk.js";
6
- var ie = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
7
- if (arguments.length !== 0)
8
- return typeof arguments[0] == "object" ? A : A.apply(null, arguments);
9
- }, F = (e) => e && typeof e.match == "function";
10
- function k(e, t) {
11
- function n(...r) {
12
- if (t) {
13
- let s = t(...r);
14
- if (!s)
15
- throw new Error(process.env.NODE_ENV === "production" ? w(0) : "prepareAction did not return an object");
16
- return {
17
- type: e,
18
- payload: s.payload,
19
- ..."meta" in s && {
20
- meta: s.meta
21
- },
22
- ..."error" in s && {
23
- error: s.error
24
- }
25
- };
26
- }
27
- return {
28
- type: e,
29
- payload: r[0]
30
- };
31
- }
32
- return n.toString = () => `${e}`, n.type = e, n.match = (r) => q(r) && r.type === e, n;
33
- }
34
- function ae(e) {
35
- return typeof e == "function" && "type" in e && // hasMatchFunction only wants Matchers but I don't see the point in rewriting it
36
- F(e);
37
- }
38
- function se(e) {
39
- const t = e ? `${e}`.split("/") : [], n = t[t.length - 1] || "actionCreator";
40
- return `Detected an action creator with type "${e || "unknown"}" being dispatched.
41
- Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${n}())\` instead of \`dispatch(${n})\`. This is necessary even if the action has no payload.`;
42
- }
43
- function ce(e = {}) {
44
- if (process.env.NODE_ENV === "production")
45
- return () => (n) => (r) => n(r);
46
- const {
47
- isActionCreator: t = ae
48
- } = e;
49
- return () => (n) => (r) => (t(r) && console.warn(se(r.type)), n(r));
50
- }
51
- function U(e, t) {
52
- let n = 0;
53
- return {
54
- measureTime(r) {
55
- const s = Date.now();
56
- try {
57
- return r();
58
- } finally {
59
- const c = Date.now();
60
- n += c - s;
61
- }
62
- },
63
- warnIfExceeded() {
64
- n > e && console.warn(`${t} took ${n}ms, which is more than the warning threshold of ${e}ms.
65
- If 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.
66
- It is disabled in production builds, so you don't need to worry about that.`);
67
- }
68
- };
69
- }
70
- var L = class C extends Array {
71
- constructor(...t) {
72
- super(...t), Object.setPrototypeOf(this, C.prototype);
73
- }
74
- static get [Symbol.species]() {
75
- return C;
76
- }
77
- concat(...t) {
78
- return super.concat.apply(this, t);
79
- }
80
- prepend(...t) {
81
- return t.length === 1 && Array.isArray(t[0]) ? new C(...t[0].concat(this)) : new C(...t.concat(this));
82
- }
83
- };
84
- function x(e) {
85
- return W(e) ? B(e, () => {
86
- }) : e;
87
- }
88
- function V(e, t, n) {
89
- return e.has(t) ? e.get(t) : e.set(t, n(t)).get(t);
90
- }
91
- function ue(e) {
92
- return typeof e != "object" || e == null || Object.isFrozen(e);
93
- }
94
- function de(e, t, n) {
95
- const r = G(e, t, n);
96
- return {
97
- detectMutations() {
98
- return X(e, t, r, n);
99
- }
100
- };
101
- }
102
- function G(e, t = [], n, r = "", s = /* @__PURE__ */ new Set()) {
103
- const c = {
104
- value: n
105
- };
106
- if (!e(n) && !s.has(n)) {
107
- s.add(n), c.children = {};
108
- for (const i in n) {
109
- const u = r ? r + "." + i : i;
110
- t.length && t.indexOf(u) !== -1 || (c.children[i] = G(e, t, n[i], u));
111
- }
112
- }
113
- return c;
114
- }
115
- function X(e, t = [], n, r, s = !1, c = "") {
116
- const i = n ? n.value : void 0, u = i === r;
117
- if (s && !u && !Number.isNaN(r))
118
- return {
119
- wasMutated: !0,
120
- path: c
121
- };
122
- if (e(i) || e(r))
123
- return {
124
- wasMutated: !1
125
- };
126
- const a = {};
127
- for (let o in n.children)
128
- a[o] = !0;
129
- for (let o in r)
130
- a[o] = !0;
131
- const d = t.length > 0;
132
- for (let o in a) {
133
- const l = c ? c + "." + o : o;
134
- if (d && t.some((m) => m instanceof RegExp ? m.test(l) : l === m))
135
- continue;
136
- const p = X(e, t, n.children[o], r[o], u, l);
137
- if (p.wasMutated)
138
- return p;
139
- }
140
- return {
141
- wasMutated: !1
142
- };
143
- }
144
- function le(e = {}) {
145
- if (process.env.NODE_ENV === "production")
146
- return () => (t) => (n) => t(n);
147
- {
148
- let t = function(u, a, d, o) {
149
- return JSON.stringify(u, n(a, o), d);
150
- }, n = function(u, a) {
151
- let d = [], o = [];
152
- return a || (a = function(l, p) {
153
- return d[0] === p ? "[Circular ~]" : "[Circular ~." + o.slice(0, d.indexOf(p)).join(".") + "]";
154
- }), function(l, p) {
155
- if (d.length > 0) {
156
- var f = d.indexOf(this);
157
- ~f ? d.splice(f + 1) : d.push(this), ~f ? o.splice(f, 1 / 0, l) : o.push(l), ~d.indexOf(p) && (p = a.call(this, l, p));
158
- } else d.push(p);
159
- return u == null ? p : u.call(this, l, p);
160
- };
161
- }, {
162
- isImmutable: r = ue,
163
- ignoredPaths: s,
164
- warnAfter: c = 32
165
- } = e;
166
- const i = de.bind(null, r, s);
167
- return ({
168
- getState: u
169
- }) => {
170
- let a = u(), d = i(a), o;
171
- return (l) => (p) => {
172
- const f = U(c, "ImmutableStateInvariantMiddleware");
173
- f.measureTime(() => {
174
- if (a = u(), o = d.detectMutations(), d = i(a), o.wasMutated)
175
- throw new Error(process.env.NODE_ENV === "production" ? w(19) : `A state mutation was detected between dispatches, in the path '${o.path || ""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
176
- });
177
- const m = l(p);
178
- return f.measureTime(() => {
179
- if (a = u(), o = d.detectMutations(), d = i(a), o.wasMutated)
180
- throw new Error(process.env.NODE_ENV === "production" ? w(20) : `A state mutation was detected inside a dispatch, in the path: ${o.path || ""}. Take a look at the reducer(s) handling the action ${t(p)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
181
- }), f.warnIfExceeded(), m;
182
- };
183
- };
184
- }
185
- }
186
- function H(e) {
187
- const t = typeof e;
188
- return e == null || t === "string" || t === "boolean" || t === "number" || Array.isArray(e) || P(e);
189
- }
190
- function j(e, t = "", n = H, r, s = [], c) {
191
- let i;
192
- if (!n(e))
193
- return {
194
- keyPath: t || "<root>",
195
- value: e
196
- };
197
- if (typeof e != "object" || e === null || c?.has(e)) return !1;
198
- const u = r != null ? r(e) : Object.entries(e), a = s.length > 0;
199
- for (const [d, o] of u) {
200
- const l = t ? t + "." + d : d;
201
- if (!(a && s.some((f) => f instanceof RegExp ? f.test(l) : l === f))) {
202
- if (!n(o))
203
- return {
204
- keyPath: l,
205
- value: o
206
- };
207
- if (typeof o == "object" && (i = j(o, l, n, r, s, c), i))
208
- return i;
209
- }
210
- }
211
- return c && Q(e) && c.add(e), !1;
212
- }
213
- function Q(e) {
214
- if (!Object.isFrozen(e)) return !1;
215
- for (const t of Object.values(e))
216
- if (!(typeof t != "object" || t === null) && !Q(t))
217
- return !1;
218
- return !0;
219
- }
220
- function fe(e = {}) {
221
- if (process.env.NODE_ENV === "production")
222
- return () => (t) => (n) => t(n);
223
- {
224
- const {
225
- isSerializable: t = H,
226
- getEntries: n,
227
- ignoredActions: r = [],
228
- ignoredActionPaths: s = ["meta.arg", "meta.baseQueryMeta"],
229
- ignoredPaths: c = [],
230
- warnAfter: i = 32,
231
- ignoreState: u = !1,
232
- ignoreActions: a = !1,
233
- disableCache: d = !1
234
- } = e, o = !d && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
235
- return (l) => (p) => (f) => {
236
- if (!q(f))
237
- return p(f);
238
- const m = p(f), g = U(i, "SerializableStateInvariantMiddleware");
239
- return !a && !(r.length && r.indexOf(f.type) !== -1) && g.measureTime(() => {
240
- const D = j(f, "", t, n, s, o);
241
- if (D) {
242
- const {
243
- keyPath: v,
244
- value: _
245
- } = D;
246
- console.error(`A non-serializable value was detected in an action, in the path: \`${v}\`. Value:`, _, `
247
- Take a look at the logic that dispatched this action: `, f, `
248
- (See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`, `
249
- (To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`);
250
- }
251
- }), u || (g.measureTime(() => {
252
- const D = l.getState(), v = j(D, "", t, n, c, o);
253
- if (v) {
254
- const {
255
- keyPath: _,
256
- value: h
257
- } = v;
258
- console.error(`A non-serializable value was detected in the state, in the path: \`${_}\`. Value:`, h, `
259
- Take a look at the reducer(s) handling this action type: ${f.type}.
260
- (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
261
- }
262
- }), g.warnIfExceeded()), m;
263
- };
264
- }
265
- }
266
- function M(e) {
267
- return typeof e == "boolean";
268
- }
269
- var pe = () => function(t) {
270
- const {
271
- thunk: n = !0,
272
- immutableCheck: r = !0,
273
- serializableCheck: s = !0,
274
- actionCreatorCheck: c = !0
275
- } = t ?? {};
276
- let i = new L();
277
- if (n && (M(n) ? i.push(ne) : i.push(oe(n.extraArgument))), process.env.NODE_ENV !== "production") {
278
- if (r) {
279
- let u = {};
280
- M(r) || (u = r), i.unshift(le(u));
281
- }
282
- if (s) {
283
- let u = {};
284
- M(s) || (u = s), i.push(fe(u));
285
- }
286
- if (c) {
287
- let u = {};
288
- M(c) || (u = c), i.unshift(ce(u));
289
- }
290
- }
291
- return i;
292
- }, he = "RTK_autoBatch", I = (e) => (t) => {
293
- setTimeout(t, e);
294
- }, we = (e = {
295
- type: "raf"
296
- }) => (t) => (...n) => {
297
- const r = t(...n);
298
- let s = !0, c = !1, i = !1;
299
- const u = /* @__PURE__ */ new Set(), a = e.type === "tick" ? queueMicrotask : e.type === "raf" ? (
300
- // requestAnimationFrame won't exist in SSR environments. Fall back to a vague approximation just to keep from erroring.
301
- typeof window < "u" && window.requestAnimationFrame ? window.requestAnimationFrame : I(10)
302
- ) : e.type === "callback" ? e.queueNotification : I(e.timeout), d = () => {
303
- i = !1, c && (c = !1, u.forEach((o) => o()));
304
- };
305
- return Object.assign({}, r, {
306
- // Override the base `store.subscribe` method to keep original listeners
307
- // from running if we're delaying notifications
308
- subscribe(o) {
309
- const l = () => s && o(), p = r.subscribe(l);
310
- return u.add(o), () => {
311
- p(), u.delete(o);
312
- };
313
- },
314
- // Override the base `store.dispatch` method so that we can check actions
315
- // for the `shouldAutoBatch` flag and determine if batching is active
316
- dispatch(o) {
317
- try {
318
- return s = !o?.meta?.[he], c = !s, c && (i || (i = !0, a(d))), r.dispatch(o);
319
- } finally {
320
- s = !0;
321
- }
322
- }
323
- });
324
- }, Ee = (e) => function(n) {
325
- const {
326
- autoBatch: r = !0
327
- } = n ?? {};
328
- let s = new L(e);
329
- return r && s.push(we(typeof r == "object" ? r : void 0)), s;
330
- };
331
- function Pe(e) {
332
- const t = pe(), {
333
- reducer: n = void 0,
334
- middleware: r,
335
- devTools: s = !0,
336
- duplicateMiddlewareCheck: c = !0,
337
- preloadedState: i = void 0,
338
- enhancers: u = void 0
339
- } = e || {};
340
- let a;
341
- if (typeof n == "function")
342
- a = n;
343
- else if (P(n))
344
- a = Z(n);
345
- else
346
- throw new Error(process.env.NODE_ENV === "production" ? w(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
347
- if (process.env.NODE_ENV !== "production" && r && typeof r != "function")
348
- throw new Error(process.env.NODE_ENV === "production" ? w(2) : "`middleware` field must be a callback");
349
- let d;
350
- if (typeof r == "function") {
351
- if (d = r(t), process.env.NODE_ENV !== "production" && !Array.isArray(d))
352
- throw new Error(process.env.NODE_ENV === "production" ? w(3) : "when using a middleware builder function, an array of middleware must be returned");
353
- } else
354
- d = t();
355
- if (process.env.NODE_ENV !== "production" && d.some((g) => typeof g != "function"))
356
- throw new Error(process.env.NODE_ENV === "production" ? w(4) : "each middleware provided to configureStore must be a function");
357
- if (process.env.NODE_ENV !== "production" && c) {
358
- let g = /* @__PURE__ */ new Set();
359
- d.forEach((D) => {
360
- if (g.has(D))
361
- throw new Error(process.env.NODE_ENV === "production" ? w(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
362
- g.add(D);
363
- });
364
- }
365
- let o = A;
366
- s && (o = ie({
367
- // Enable capture of stack traces for dispatched Redux actions
368
- trace: process.env.NODE_ENV !== "production",
369
- ...typeof s == "object" && s
370
- }));
371
- const l = ee(...d), p = Ee(l);
372
- if (process.env.NODE_ENV !== "production" && u && typeof u != "function")
373
- throw new Error(process.env.NODE_ENV === "production" ? w(5) : "`enhancers` field must be a callback");
374
- let f = typeof u == "function" ? u(p) : p();
375
- if (process.env.NODE_ENV !== "production" && !Array.isArray(f))
376
- throw new Error(process.env.NODE_ENV === "production" ? w(6) : "`enhancers` callback must return an array");
377
- if (process.env.NODE_ENV !== "production" && f.some((g) => typeof g != "function"))
378
- throw new Error(process.env.NODE_ENV === "production" ? w(7) : "each enhancer provided to configureStore must be a function");
379
- process.env.NODE_ENV !== "production" && d.length && !f.includes(l) && console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
380
- const m = o(...f);
381
- return te(a, i, m);
382
- }
383
- function Y(e) {
384
- const t = {}, n = [];
385
- let r;
386
- const s = {
387
- addCase(c, i) {
388
- if (process.env.NODE_ENV !== "production") {
389
- if (n.length > 0)
390
- throw new Error(process.env.NODE_ENV === "production" ? w(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
391
- if (r)
392
- throw new Error(process.env.NODE_ENV === "production" ? w(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
393
- }
394
- const u = typeof c == "string" ? c : c.type;
395
- if (!u)
396
- throw new Error(process.env.NODE_ENV === "production" ? w(28) : "`builder.addCase` cannot be called with an empty action type");
397
- if (u in t)
398
- throw new Error(process.env.NODE_ENV === "production" ? w(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${u}'`);
399
- return t[u] = i, s;
400
- },
401
- addAsyncThunk(c, i) {
402
- if (process.env.NODE_ENV !== "production" && r)
403
- throw new Error(process.env.NODE_ENV === "production" ? w(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
404
- return i.pending && (t[c.pending.type] = i.pending), i.rejected && (t[c.rejected.type] = i.rejected), i.fulfilled && (t[c.fulfilled.type] = i.fulfilled), i.settled && n.push({
405
- matcher: c.settled,
406
- reducer: i.settled
407
- }), s;
408
- },
409
- addMatcher(c, i) {
410
- if (process.env.NODE_ENV !== "production" && r)
411
- throw new Error(process.env.NODE_ENV === "production" ? w(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
412
- return n.push({
413
- matcher: c,
414
- reducer: i
415
- }), s;
416
- },
417
- addDefaultCase(c) {
418
- if (process.env.NODE_ENV !== "production" && r)
419
- throw new Error(process.env.NODE_ENV === "production" ? w(31) : "`builder.addDefaultCase` can only be called once");
420
- return r = c, s;
421
- }
422
- };
423
- return e(s), [t, n, r];
424
- }
425
- function me(e) {
426
- return typeof e == "function";
427
- }
428
- function ye(e, t) {
429
- if (process.env.NODE_ENV !== "production" && typeof t == "object")
430
- throw new Error(process.env.NODE_ENV === "production" ? w(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
431
- let [n, r, s] = Y(t), c;
432
- if (me(e))
433
- c = () => x(e());
434
- else {
435
- const u = x(e);
436
- c = () => u;
437
- }
438
- function i(u = c(), a) {
439
- let d = [n[a.type], ...r.filter(({
440
- matcher: o
441
- }) => o(a)).map(({
442
- reducer: o
443
- }) => o)];
444
- return d.filter((o) => !!o).length === 0 && (d = [s]), d.reduce((o, l) => {
445
- if (l)
446
- if (re(o)) {
447
- const f = l(o, a);
448
- return f === void 0 ? o : f;
449
- } else {
450
- if (W(o))
451
- return B(o, (p) => l(p, a));
452
- {
453
- const p = l(o, a);
454
- if (p === void 0) {
455
- if (o === null)
456
- return o;
457
- throw Error("A case reducer on a non-draftable value must not return undefined");
458
- }
459
- return p;
460
- }
461
- }
462
- return o;
463
- }, u);
464
- }
465
- return i.getInitialState = c, i;
466
- }
467
- var be = (e, t) => F(e) ? e.match(t) : e(t);
468
- function Ne(...e) {
469
- return (t) => e.some((n) => be(n, t));
470
- }
471
- var ge = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW", De = (e = 21) => {
472
- let t = "", n = e;
473
- for (; n--; )
474
- t += ge[Math.random() * 64 | 0];
475
- return t;
476
- }, ve = ["name", "message", "stack", "code"], T = class {
477
- constructor(e, t) {
478
- this.payload = e, this.meta = t;
479
- }
480
- /*
481
- type-only property to distinguish between RejectWithValue and FulfillWithMeta
482
- does not exist at runtime
483
- */
484
- _type;
485
- }, z = class {
486
- constructor(e, t) {
487
- this.payload = e, this.meta = t;
488
- }
489
- /*
490
- type-only property to distinguish between RejectWithValue and FulfillWithMeta
491
- does not exist at runtime
492
- */
493
- _type;
494
- }, Oe = (e) => {
495
- if (typeof e == "object" && e !== null) {
496
- const t = {};
497
- for (const n of ve)
498
- typeof e[n] == "string" && (t[n] = e[n]);
499
- return t;
500
- }
501
- return {
502
- message: String(e)
503
- };
504
- }, $ = "External signal was aborted", qe = /* @__PURE__ */ (() => {
505
- function e(t, n, r) {
506
- const s = k(t + "/fulfilled", (a, d, o, l) => ({
507
- payload: a,
508
- meta: {
509
- ...l || {},
510
- arg: o,
511
- requestId: d,
512
- requestStatus: "fulfilled"
513
- }
514
- })), c = k(t + "/pending", (a, d, o) => ({
515
- payload: void 0,
516
- meta: {
517
- ...o || {},
518
- arg: d,
519
- requestId: a,
520
- requestStatus: "pending"
521
- }
522
- })), i = k(t + "/rejected", (a, d, o, l, p) => ({
523
- payload: l,
524
- error: (r && r.serializeError || Oe)(a || "Rejected"),
525
- meta: {
526
- ...p || {},
527
- arg: o,
528
- requestId: d,
529
- rejectedWithValue: !!l,
530
- requestStatus: "rejected",
531
- aborted: a?.name === "AbortError",
532
- condition: a?.name === "ConditionError"
533
- }
534
- }));
535
- function u(a, {
536
- signal: d
537
- } = {}) {
538
- return (o, l, p) => {
539
- const f = r?.idGenerator ? r.idGenerator(a) : De(), m = new AbortController();
540
- let g, D;
541
- function v(h) {
542
- D = h, m.abort();
543
- }
544
- d && (d.aborted ? v($) : d.addEventListener("abort", () => v($), {
545
- once: !0
546
- }));
547
- const _ = (async function() {
548
- let h;
549
- try {
550
- let E = r?.condition?.(a, {
551
- getState: l,
552
- extra: p
553
- });
554
- if (Ce(E) && (E = await E), E === !1 || m.signal.aborted)
555
- throw {
556
- name: "ConditionError",
557
- message: "Aborted due to condition callback returning false."
558
- };
559
- const O = new Promise((b, N) => {
560
- g = () => {
561
- N({
562
- name: "AbortError",
563
- message: D || "Aborted"
564
- });
565
- }, m.signal.addEventListener("abort", g);
566
- });
567
- o(c(f, a, r?.getPendingMeta?.({
568
- requestId: f,
569
- arg: a
570
- }, {
571
- getState: l,
572
- extra: p
573
- }))), h = await Promise.race([O, Promise.resolve(n(a, {
574
- dispatch: o,
575
- getState: l,
576
- extra: p,
577
- requestId: f,
578
- signal: m.signal,
579
- abort: v,
580
- rejectWithValue: (b, N) => new T(b, N),
581
- fulfillWithValue: (b, N) => new z(b, N)
582
- })).then((b) => {
583
- if (b instanceof T)
584
- throw b;
585
- return b instanceof z ? s(b.payload, f, a, b.meta) : s(b, f, a);
586
- })]);
587
- } catch (E) {
588
- h = E instanceof T ? i(null, f, a, E.payload, E.meta) : i(E, f, a);
589
- } finally {
590
- g && m.signal.removeEventListener("abort", g);
591
- }
592
- return r && !r.dispatchConditionRejection && i.match(h) && h.meta.condition || o(h), h;
593
- })();
594
- return Object.assign(_, {
595
- abort: v,
596
- requestId: f,
597
- arg: a,
598
- unwrap() {
599
- return _.then(_e);
600
- }
601
- });
602
- };
603
- }
604
- return Object.assign(u, {
605
- pending: c,
606
- rejected: i,
607
- fulfilled: s,
608
- settled: Ne(i, s),
609
- typePrefix: t
610
- });
611
- }
612
- return e.withTypes = () => e, e;
613
- })();
614
- function _e(e) {
615
- if (e.meta && e.meta.rejectedWithValue)
616
- throw e.payload;
617
- if (e.error)
618
- throw e.error;
619
- return e.payload;
620
- }
621
- function Ce(e) {
622
- return e !== null && typeof e == "object" && typeof e.then == "function";
623
- }
624
- var ke = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
625
- function Ve(e, t) {
626
- return `${e}/${t}`;
627
- }
628
- function Me({
629
- creators: e
630
- } = {}) {
631
- const t = e?.asyncThunk?.[ke];
632
- return function(r) {
633
- const {
634
- name: s,
635
- reducerPath: c = s
636
- } = r;
637
- if (!s)
638
- throw new Error(process.env.NODE_ENV === "production" ? w(11) : "`name` is a required option for createSlice");
639
- typeof process < "u" && process.env.NODE_ENV === "development" && r.initialState === void 0 && console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
640
- const i = (typeof r.reducers == "function" ? r.reducers(Te()) : r.reducers) || {}, u = Object.keys(i), a = {
641
- sliceCaseReducersByName: {},
642
- sliceCaseReducersByType: {},
643
- actionCreators: {},
644
- sliceMatchers: []
645
- }, d = {
646
- addCase(h, y) {
647
- const E = typeof h == "string" ? h : h.type;
648
- if (!E)
649
- throw new Error(process.env.NODE_ENV === "production" ? w(12) : "`context.addCase` cannot be called with an empty action type");
650
- if (E in a.sliceCaseReducersByType)
651
- throw new Error(process.env.NODE_ENV === "production" ? w(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + E);
652
- return a.sliceCaseReducersByType[E] = y, d;
653
- },
654
- addMatcher(h, y) {
655
- return a.sliceMatchers.push({
656
- matcher: h,
657
- reducer: y
658
- }), d;
659
- },
660
- exposeAction(h, y) {
661
- return a.actionCreators[h] = y, d;
662
- },
663
- exposeCaseReducer(h, y) {
664
- return a.sliceCaseReducersByName[h] = y, d;
665
- }
666
- };
667
- u.forEach((h) => {
668
- const y = i[h], E = {
669
- reducerName: h,
670
- type: Ve(s, h),
671
- createNotation: typeof r.reducers == "function"
672
- };
673
- je(y) ? xe(E, y, d, t) : Ae(E, y, d);
674
- });
675
- function o() {
676
- if (process.env.NODE_ENV !== "production" && typeof r.extraReducers == "object")
677
- throw new Error(process.env.NODE_ENV === "production" ? w(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
678
- const [h = {}, y = [], E = void 0] = typeof r.extraReducers == "function" ? Y(r.extraReducers) : [r.extraReducers], O = {
679
- ...h,
680
- ...a.sliceCaseReducersByType
681
- };
682
- return ye(r.initialState, (b) => {
683
- for (let N in O)
684
- b.addCase(N, O[N]);
685
- for (let N of a.sliceMatchers)
686
- b.addMatcher(N.matcher, N.reducer);
687
- for (let N of y)
688
- b.addMatcher(N.matcher, N.reducer);
689
- E && b.addDefaultCase(E);
690
- });
691
- }
692
- const l = (h) => h, p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new WeakMap();
693
- let m;
694
- function g(h, y) {
695
- return m || (m = o()), m(h, y);
696
- }
697
- function D() {
698
- return m || (m = o()), m.getInitialState();
699
- }
700
- function v(h, y = !1) {
701
- function E(b) {
702
- let N = b[h];
703
- if (typeof N > "u") {
704
- if (y)
705
- N = V(f, E, D);
706
- else if (process.env.NODE_ENV !== "production")
707
- throw new Error(process.env.NODE_ENV === "production" ? w(15) : "selectSlice returned undefined for an uninjected slice reducer");
708
- }
709
- return N;
710
- }
711
- function O(b = l) {
712
- const N = V(p, y, () => /* @__PURE__ */ new WeakMap());
713
- return V(N, b, () => {
714
- const R = {};
715
- for (const [J, K] of Object.entries(r.selectors ?? {}))
716
- R[J] = Se(K, b, () => V(f, b, D), y);
717
- return R;
718
- });
719
- }
720
- return {
721
- reducerPath: h,
722
- getSelectors: O,
723
- get selectors() {
724
- return O(E);
725
- },
726
- selectSlice: E
727
- };
728
- }
729
- const _ = {
730
- name: s,
731
- reducer: g,
732
- actions: a.actionCreators,
733
- caseReducers: a.sliceCaseReducersByName,
734
- getInitialState: D,
735
- ...v(c),
736
- injectInto(h, {
737
- reducerPath: y,
738
- ...E
739
- } = {}) {
740
- const O = y ?? c;
741
- return h.inject({
742
- reducerPath: O,
743
- reducer: g
744
- }, E), {
745
- ..._,
746
- ...v(O, !0)
747
- };
748
- }
749
- };
750
- return _;
751
- };
752
- }
753
- function Se(e, t, n, r) {
754
- function s(c, ...i) {
755
- let u = t(c);
756
- if (typeof u > "u") {
757
- if (r)
758
- u = n();
759
- else if (process.env.NODE_ENV !== "production")
760
- throw new Error(process.env.NODE_ENV === "production" ? w(16) : "selectState returned undefined for an uninjected slice reducer");
761
- }
762
- return e(u, ...i);
763
- }
764
- return s.unwrapped = e, s;
765
- }
766
- var Be = /* @__PURE__ */ Me();
767
- function Te() {
768
- function e(t, n) {
769
- return {
770
- _reducerDefinitionType: "asyncThunk",
771
- payloadCreator: t,
772
- ...n
773
- };
774
- }
775
- return e.withTypes = () => e, {
776
- reducer(t) {
777
- return Object.assign({
778
- // hack so the wrapping function has the same name as the original
779
- // we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
780
- [t.name](...n) {
781
- return t(...n);
782
- }
783
- }[t.name], {
784
- _reducerDefinitionType: "reducer"
785
- /* reducer */
786
- });
787
- },
788
- preparedReducer(t, n) {
789
- return {
790
- _reducerDefinitionType: "reducerWithPrepare",
791
- prepare: t,
792
- reducer: n
793
- };
794
- },
795
- asyncThunk: e
796
- };
797
- }
798
- function Ae({
799
- type: e,
800
- reducerName: t,
801
- createNotation: n
802
- }, r, s) {
803
- let c, i;
804
- if ("reducer" in r) {
805
- if (n && !Re(r))
806
- throw new Error(process.env.NODE_ENV === "production" ? w(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
807
- c = r.reducer, i = r.prepare;
808
- } else
809
- c = r;
810
- s.addCase(e, c).exposeCaseReducer(t, c).exposeAction(t, i ? k(e, i) : k(e));
811
- }
812
- function je(e) {
813
- return e._reducerDefinitionType === "asyncThunk";
814
- }
815
- function Re(e) {
816
- return e._reducerDefinitionType === "reducerWithPrepare";
817
- }
818
- function xe({
819
- type: e,
820
- reducerName: t
821
- }, n, r, s) {
822
- if (!s)
823
- throw new Error(process.env.NODE_ENV === "production" ? w(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
824
- const {
825
- payloadCreator: c,
826
- fulfilled: i,
827
- pending: u,
828
- rejected: a,
829
- settled: d,
830
- options: o
831
- } = n, l = s(e, c, o);
832
- r.exposeAction(t, l), i && r.addCase(l.fulfilled, i), u && r.addCase(l.pending, u), a && r.addCase(l.rejected, a), d && r.addMatcher(l.settled, d), r.exposeCaseReducer(t, {
833
- fulfilled: i || S,
834
- pending: u || S,
835
- rejected: a || S,
836
- settled: d || S
837
- });
838
- }
839
- function S() {
840
- }
841
- function w(e) {
842
- return `Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `;
843
- }
844
- export {
845
- he as SHOULD_AUTOBATCH,
846
- L as Tuple,
847
- Ue as __DO_NOT_USE__ActionTypes,
848
- ee as applyMiddleware,
849
- we as autoBatchEnhancer,
850
- Me as buildCreateSlice,
851
- Z as combineReducers,
852
- A as compose,
853
- Pe as configureStore,
854
- k as createAction,
855
- ce as createActionCreatorInvariantMiddleware,
856
- qe as createAsyncThunk,
857
- le as createImmutableStateInvariantMiddleware,
858
- B as createNextState,
859
- ye as createReducer,
860
- fe as createSerializableStateInvariantMiddleware,
861
- Be as createSlice,
862
- te as createStore,
863
- Ge as current,
864
- j as findNonSerializableValue,
865
- w as formatProdErrorMessage,
866
- Xe as freeze,
867
- q as isAction,
868
- ae as isActionCreator,
869
- Ne as isAnyOf,
870
- re as isDraft,
871
- ue as isImmutableDefault,
872
- H as isPlain,
873
- P as isPlainObject,
874
- Oe as miniSerializeError,
875
- De as nanoid,
876
- _e as unwrapResult
877
- };