zarebin-player-library 1.0.18 → 1.0.19
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Provider, shallowEqual, useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import { configureStore, createSlice } from "@reduxjs/toolkit";
|
|
2
3
|
import React, { Suspense, cloneElement, createContext, createElement, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
3
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
import { createPortal } from "react-dom";
|
|
@@ -34,2019 +35,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
35
|
value: mod,
|
|
35
36
|
enumerable: true
|
|
36
37
|
}) : target, mod));
|
|
37
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
38
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
39
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
40
|
-
});
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js
|
|
43
|
-
/**
|
|
44
|
-
* @license React
|
|
45
|
-
* use-sync-external-store-with-selector.production.js
|
|
46
|
-
*
|
|
47
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
48
|
-
*
|
|
49
|
-
* This source code is licensed under the MIT license found in the
|
|
50
|
-
* LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/
|
|
52
|
-
var require_use_sync_external_store_with_selector_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
53
|
-
var React$2 = __require("react");
|
|
54
|
-
function is(x, y) {
|
|
55
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
56
|
-
}
|
|
57
|
-
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React$2.useSyncExternalStore, useRef = React$2.useRef, useEffect = React$2.useEffect, useMemo = React$2.useMemo, useDebugValue = React$2.useDebugValue;
|
|
58
|
-
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
59
|
-
var instRef = useRef(null);
|
|
60
|
-
if (null === instRef.current) {
|
|
61
|
-
var inst = {
|
|
62
|
-
hasValue: !1,
|
|
63
|
-
value: null
|
|
64
|
-
};
|
|
65
|
-
instRef.current = inst;
|
|
66
|
-
} else inst = instRef.current;
|
|
67
|
-
instRef = useMemo(function() {
|
|
68
|
-
function memoizedSelector(nextSnapshot) {
|
|
69
|
-
if (!hasMemo) {
|
|
70
|
-
hasMemo = !0;
|
|
71
|
-
memoizedSnapshot = nextSnapshot;
|
|
72
|
-
nextSnapshot = selector(nextSnapshot);
|
|
73
|
-
if (void 0 !== isEqual && inst.hasValue) {
|
|
74
|
-
var currentSelection = inst.value;
|
|
75
|
-
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
76
|
-
}
|
|
77
|
-
return memoizedSelection = nextSnapshot;
|
|
78
|
-
}
|
|
79
|
-
currentSelection = memoizedSelection;
|
|
80
|
-
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
81
|
-
var nextSelection = selector(nextSnapshot);
|
|
82
|
-
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
83
|
-
memoizedSnapshot = nextSnapshot;
|
|
84
|
-
return memoizedSelection = nextSelection;
|
|
85
|
-
}
|
|
86
|
-
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
87
|
-
return [function() {
|
|
88
|
-
return memoizedSelector(getSnapshot());
|
|
89
|
-
}, null === maybeGetServerSnapshot ? void 0 : function() {
|
|
90
|
-
return memoizedSelector(maybeGetServerSnapshot());
|
|
91
|
-
}];
|
|
92
|
-
}, [
|
|
93
|
-
getSnapshot,
|
|
94
|
-
getServerSnapshot,
|
|
95
|
-
selector,
|
|
96
|
-
isEqual
|
|
97
|
-
]);
|
|
98
|
-
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
99
|
-
useEffect(function() {
|
|
100
|
-
inst.hasValue = !0;
|
|
101
|
-
inst.value = value;
|
|
102
|
-
}, [value]);
|
|
103
|
-
useDebugValue(value);
|
|
104
|
-
return value;
|
|
105
|
-
};
|
|
106
|
-
}));
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
|
|
109
|
-
/**
|
|
110
|
-
* @license React
|
|
111
|
-
* use-sync-external-store-with-selector.development.js
|
|
112
|
-
*
|
|
113
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the MIT license found in the
|
|
116
|
-
* LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/
|
|
118
|
-
var require_use_sync_external_store_with_selector_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
119
|
-
"production" !== process.env.NODE_ENV && (function() {
|
|
120
|
-
function is(x, y) {
|
|
121
|
-
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
122
|
-
}
|
|
123
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
124
|
-
var React = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
125
|
-
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
126
|
-
var instRef = useRef(null);
|
|
127
|
-
if (null === instRef.current) {
|
|
128
|
-
var inst = {
|
|
129
|
-
hasValue: !1,
|
|
130
|
-
value: null
|
|
131
|
-
};
|
|
132
|
-
instRef.current = inst;
|
|
133
|
-
} else inst = instRef.current;
|
|
134
|
-
instRef = useMemo(function() {
|
|
135
|
-
function memoizedSelector(nextSnapshot) {
|
|
136
|
-
if (!hasMemo) {
|
|
137
|
-
hasMemo = !0;
|
|
138
|
-
memoizedSnapshot = nextSnapshot;
|
|
139
|
-
nextSnapshot = selector(nextSnapshot);
|
|
140
|
-
if (void 0 !== isEqual && inst.hasValue) {
|
|
141
|
-
var currentSelection = inst.value;
|
|
142
|
-
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
143
|
-
}
|
|
144
|
-
return memoizedSelection = nextSnapshot;
|
|
145
|
-
}
|
|
146
|
-
currentSelection = memoizedSelection;
|
|
147
|
-
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
148
|
-
var nextSelection = selector(nextSnapshot);
|
|
149
|
-
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
150
|
-
memoizedSnapshot = nextSnapshot;
|
|
151
|
-
return memoizedSelection = nextSelection;
|
|
152
|
-
}
|
|
153
|
-
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
154
|
-
return [function() {
|
|
155
|
-
return memoizedSelector(getSnapshot());
|
|
156
|
-
}, null === maybeGetServerSnapshot ? void 0 : function() {
|
|
157
|
-
return memoizedSelector(maybeGetServerSnapshot());
|
|
158
|
-
}];
|
|
159
|
-
}, [
|
|
160
|
-
getSnapshot,
|
|
161
|
-
getServerSnapshot,
|
|
162
|
-
selector,
|
|
163
|
-
isEqual
|
|
164
|
-
]);
|
|
165
|
-
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
166
|
-
useEffect(function() {
|
|
167
|
-
inst.hasValue = !0;
|
|
168
|
-
inst.value = value;
|
|
169
|
-
}, [value]);
|
|
170
|
-
useDebugValue(value);
|
|
171
|
-
return value;
|
|
172
|
-
};
|
|
173
|
-
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
174
|
-
})();
|
|
175
|
-
}));
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region node_modules/react-redux/dist/react-redux.mjs
|
|
178
|
-
var import_with_selector = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
179
|
-
if (process.env.NODE_ENV === "production") module.exports = require_use_sync_external_store_with_selector_production();
|
|
180
|
-
else module.exports = require_use_sync_external_store_with_selector_development();
|
|
181
|
-
})))();
|
|
182
|
-
function defaultNoopBatch(callback) {
|
|
183
|
-
callback();
|
|
184
|
-
}
|
|
185
|
-
function createListenerCollection() {
|
|
186
|
-
let first = null;
|
|
187
|
-
let last = null;
|
|
188
|
-
return {
|
|
189
|
-
clear() {
|
|
190
|
-
first = null;
|
|
191
|
-
last = null;
|
|
192
|
-
},
|
|
193
|
-
notify() {
|
|
194
|
-
defaultNoopBatch(() => {
|
|
195
|
-
let listener = first;
|
|
196
|
-
while (listener) {
|
|
197
|
-
listener.callback();
|
|
198
|
-
listener = listener.next;
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
get() {
|
|
203
|
-
const listeners = [];
|
|
204
|
-
let listener = first;
|
|
205
|
-
while (listener) {
|
|
206
|
-
listeners.push(listener);
|
|
207
|
-
listener = listener.next;
|
|
208
|
-
}
|
|
209
|
-
return listeners;
|
|
210
|
-
},
|
|
211
|
-
subscribe(callback) {
|
|
212
|
-
let isSubscribed = true;
|
|
213
|
-
const listener = last = {
|
|
214
|
-
callback,
|
|
215
|
-
next: null,
|
|
216
|
-
prev: last
|
|
217
|
-
};
|
|
218
|
-
if (listener.prev) listener.prev.next = listener;
|
|
219
|
-
else first = listener;
|
|
220
|
-
return function unsubscribe() {
|
|
221
|
-
if (!isSubscribed || first === null) return;
|
|
222
|
-
isSubscribed = false;
|
|
223
|
-
if (listener.next) listener.next.prev = listener.prev;
|
|
224
|
-
else last = listener.prev;
|
|
225
|
-
if (listener.prev) listener.prev.next = listener.next;
|
|
226
|
-
else first = listener.next;
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
var nullListeners = {
|
|
232
|
-
notify() {},
|
|
233
|
-
get: () => []
|
|
234
|
-
};
|
|
235
|
-
function createSubscription(store, parentSub) {
|
|
236
|
-
let unsubscribe;
|
|
237
|
-
let listeners = nullListeners;
|
|
238
|
-
let subscriptionsAmount = 0;
|
|
239
|
-
let selfSubscribed = false;
|
|
240
|
-
function addNestedSub(listener) {
|
|
241
|
-
trySubscribe();
|
|
242
|
-
const cleanupListener = listeners.subscribe(listener);
|
|
243
|
-
let removed = false;
|
|
244
|
-
return () => {
|
|
245
|
-
if (!removed) {
|
|
246
|
-
removed = true;
|
|
247
|
-
cleanupListener();
|
|
248
|
-
tryUnsubscribe();
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
function notifyNestedSubs() {
|
|
253
|
-
listeners.notify();
|
|
254
|
-
}
|
|
255
|
-
function handleChangeWrapper() {
|
|
256
|
-
if (subscription.onStateChange) subscription.onStateChange();
|
|
257
|
-
}
|
|
258
|
-
function isSubscribed() {
|
|
259
|
-
return selfSubscribed;
|
|
260
|
-
}
|
|
261
|
-
function trySubscribe() {
|
|
262
|
-
subscriptionsAmount++;
|
|
263
|
-
if (!unsubscribe) {
|
|
264
|
-
unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper);
|
|
265
|
-
listeners = createListenerCollection();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function tryUnsubscribe() {
|
|
269
|
-
subscriptionsAmount--;
|
|
270
|
-
if (unsubscribe && subscriptionsAmount === 0) {
|
|
271
|
-
unsubscribe();
|
|
272
|
-
unsubscribe = void 0;
|
|
273
|
-
listeners.clear();
|
|
274
|
-
listeners = nullListeners;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
function trySubscribeSelf() {
|
|
278
|
-
if (!selfSubscribed) {
|
|
279
|
-
selfSubscribed = true;
|
|
280
|
-
trySubscribe();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
function tryUnsubscribeSelf() {
|
|
284
|
-
if (selfSubscribed) {
|
|
285
|
-
selfSubscribed = false;
|
|
286
|
-
tryUnsubscribe();
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
const subscription = {
|
|
290
|
-
addNestedSub,
|
|
291
|
-
notifyNestedSubs,
|
|
292
|
-
handleChangeWrapper,
|
|
293
|
-
isSubscribed,
|
|
294
|
-
trySubscribe: trySubscribeSelf,
|
|
295
|
-
tryUnsubscribe: tryUnsubscribeSelf,
|
|
296
|
-
getListeners: () => listeners
|
|
297
|
-
};
|
|
298
|
-
return subscription;
|
|
299
|
-
}
|
|
300
|
-
var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
301
|
-
var isDOM = /* @__PURE__ */ canUseDOM();
|
|
302
|
-
var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
303
|
-
var isReactNative$2 = /* @__PURE__ */ isRunningInReactNative();
|
|
304
|
-
var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative$2 ? React$1.useLayoutEffect : React$1.useEffect;
|
|
305
|
-
var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
|
|
306
|
-
function is$1(x, y) {
|
|
307
|
-
if (x === y) return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
308
|
-
else return x !== x && y !== y;
|
|
309
|
-
}
|
|
310
|
-
function shallowEqual(objA, objB) {
|
|
311
|
-
if (is$1(objA, objB)) return true;
|
|
312
|
-
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) return false;
|
|
313
|
-
const keysA = Object.keys(objA);
|
|
314
|
-
const keysB = Object.keys(objB);
|
|
315
|
-
if (keysA.length !== keysB.length) return false;
|
|
316
|
-
for (let i = 0; i < keysA.length; i++) if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is$1(objA[keysA[i]], objB[keysA[i]])) return false;
|
|
317
|
-
return true;
|
|
318
|
-
}
|
|
319
|
-
var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
|
|
320
|
-
var gT = typeof globalThis !== "undefined" ? globalThis : {};
|
|
321
|
-
function getContext() {
|
|
322
|
-
if (!React$1.createContext) return {};
|
|
323
|
-
const contextMap = gT[ContextKey] ??= /* @__PURE__ */ new Map();
|
|
324
|
-
let realContext = contextMap.get(React$1.createContext);
|
|
325
|
-
if (!realContext) {
|
|
326
|
-
realContext = React$1.createContext(null);
|
|
327
|
-
if (process.env.NODE_ENV !== "production") realContext.displayName = "ReactRedux";
|
|
328
|
-
contextMap.set(React$1.createContext, realContext);
|
|
329
|
-
}
|
|
330
|
-
return realContext;
|
|
331
|
-
}
|
|
332
|
-
var ReactReduxContext = /* @__PURE__ */ getContext();
|
|
333
|
-
function Provider(providerProps) {
|
|
334
|
-
const { children, context, serverState, store } = providerProps;
|
|
335
|
-
const contextValue = React$1.useMemo(() => {
|
|
336
|
-
const baseContextValue = {
|
|
337
|
-
store,
|
|
338
|
-
subscription: createSubscription(store),
|
|
339
|
-
getServerState: serverState ? () => serverState : void 0
|
|
340
|
-
};
|
|
341
|
-
if (process.env.NODE_ENV === "production") return baseContextValue;
|
|
342
|
-
else {
|
|
343
|
-
const { identityFunctionCheck = "once", stabilityCheck = "once" } = providerProps;
|
|
344
|
-
return /* @__PURE__ */ Object.assign(baseContextValue, {
|
|
345
|
-
stabilityCheck,
|
|
346
|
-
identityFunctionCheck
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}, [store, serverState]);
|
|
350
|
-
const previousState = React$1.useMemo(() => store.getState(), [store]);
|
|
351
|
-
useIsomorphicLayoutEffect(() => {
|
|
352
|
-
const { subscription } = contextValue;
|
|
353
|
-
subscription.onStateChange = subscription.notifyNestedSubs;
|
|
354
|
-
subscription.trySubscribe();
|
|
355
|
-
if (previousState !== store.getState()) subscription.notifyNestedSubs();
|
|
356
|
-
return () => {
|
|
357
|
-
subscription.tryUnsubscribe();
|
|
358
|
-
subscription.onStateChange = void 0;
|
|
359
|
-
};
|
|
360
|
-
}, [contextValue, previousState]);
|
|
361
|
-
const Context = context || ReactReduxContext;
|
|
362
|
-
return /* @__PURE__ */ React$1.createElement(Context.Provider, { value: contextValue }, children);
|
|
363
|
-
}
|
|
364
|
-
var Provider_default = Provider;
|
|
365
|
-
function createReduxContextHook(context = ReactReduxContext) {
|
|
366
|
-
return function useReduxContext2() {
|
|
367
|
-
const contextValue = React$1.useContext(context);
|
|
368
|
-
if (process.env.NODE_ENV !== "production" && !contextValue) throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");
|
|
369
|
-
return contextValue;
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
var useReduxContext = /* @__PURE__ */ createReduxContextHook();
|
|
373
|
-
function createStoreHook(context = ReactReduxContext) {
|
|
374
|
-
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
375
|
-
const useStore2 = () => {
|
|
376
|
-
const { store } = useReduxContext2();
|
|
377
|
-
return store;
|
|
378
|
-
};
|
|
379
|
-
Object.assign(useStore2, { withTypes: () => useStore2 });
|
|
380
|
-
return useStore2;
|
|
381
|
-
}
|
|
382
|
-
var useStore = /* @__PURE__ */ createStoreHook();
|
|
383
|
-
function createDispatchHook(context = ReactReduxContext) {
|
|
384
|
-
const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
385
|
-
const useDispatch2 = () => {
|
|
386
|
-
return useStore2().dispatch;
|
|
387
|
-
};
|
|
388
|
-
Object.assign(useDispatch2, { withTypes: () => useDispatch2 });
|
|
389
|
-
return useDispatch2;
|
|
390
|
-
}
|
|
391
|
-
var useDispatch = /* @__PURE__ */ createDispatchHook();
|
|
392
|
-
var refEquality = (a, b) => a === b;
|
|
393
|
-
function createSelectorHook(context = ReactReduxContext) {
|
|
394
|
-
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
395
|
-
const useSelector2 = (selector, equalityFnOrOptions = {}) => {
|
|
396
|
-
const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
|
|
397
|
-
if (process.env.NODE_ENV !== "production") {
|
|
398
|
-
if (!selector) throw new Error(`You must pass a selector to useSelector`);
|
|
399
|
-
if (typeof selector !== "function") throw new Error(`You must pass a function as a selector to useSelector`);
|
|
400
|
-
if (typeof equalityFn !== "function") throw new Error(`You must pass a function as an equality function to useSelector`);
|
|
401
|
-
}
|
|
402
|
-
const reduxContext = useReduxContext2();
|
|
403
|
-
const { store, subscription, getServerState } = reduxContext;
|
|
404
|
-
const firstRun = React$1.useRef(true);
|
|
405
|
-
const wrappedSelector = React$1.useCallback({ [selector.name](state) {
|
|
406
|
-
const selected = selector(state);
|
|
407
|
-
if (process.env.NODE_ENV !== "production") {
|
|
408
|
-
const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
|
|
409
|
-
const { identityFunctionCheck, stabilityCheck } = reduxContext;
|
|
410
|
-
const { identityFunctionCheck: finalIdentityFunctionCheck, stabilityCheck: finalStabilityCheck } = {
|
|
411
|
-
stabilityCheck,
|
|
412
|
-
identityFunctionCheck,
|
|
413
|
-
...devModeChecks
|
|
414
|
-
};
|
|
415
|
-
if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
|
|
416
|
-
const toCompare = selector(state);
|
|
417
|
-
if (!equalityFn(selected, toCompare)) {
|
|
418
|
-
let stack = void 0;
|
|
419
|
-
try {
|
|
420
|
-
throw new Error();
|
|
421
|
-
} catch (e) {
|
|
422
|
-
({stack} = e);
|
|
423
|
-
}
|
|
424
|
-
console.warn("Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization", {
|
|
425
|
-
state,
|
|
426
|
-
selected,
|
|
427
|
-
selected2: toCompare,
|
|
428
|
-
stack
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
|
|
433
|
-
if (selected === state) {
|
|
434
|
-
let stack = void 0;
|
|
435
|
-
try {
|
|
436
|
-
throw new Error();
|
|
437
|
-
} catch (e) {
|
|
438
|
-
({stack} = e);
|
|
439
|
-
}
|
|
440
|
-
console.warn("Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.", { stack });
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
if (firstRun.current) firstRun.current = false;
|
|
444
|
-
}
|
|
445
|
-
return selected;
|
|
446
|
-
} }[selector.name], [selector]);
|
|
447
|
-
const selectedState = (0, import_with_selector.useSyncExternalStoreWithSelector)(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);
|
|
448
|
-
React$1.useDebugValue(selectedState);
|
|
449
|
-
return selectedState;
|
|
450
|
-
};
|
|
451
|
-
Object.assign(useSelector2, { withTypes: () => useSelector2 });
|
|
452
|
-
return useSelector2;
|
|
453
|
-
}
|
|
454
|
-
var useSelector = /* @__PURE__ */ createSelectorHook();
|
|
455
|
-
//#endregion
|
|
456
|
-
//#region node_modules/redux/dist/redux.mjs
|
|
457
|
-
function formatProdErrorMessage$1(code) {
|
|
458
|
-
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
459
|
-
}
|
|
460
|
-
var symbol_observable_default = typeof Symbol === "function" && Symbol.observable || "@@observable";
|
|
461
|
-
var randomString$1 = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
462
|
-
var actionTypes_default = {
|
|
463
|
-
INIT: `@@redux/INIT${/* @__PURE__ */ randomString$1()}`,
|
|
464
|
-
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString$1()}`,
|
|
465
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString$1()}`
|
|
466
|
-
};
|
|
467
|
-
function isPlainObject$2(obj) {
|
|
468
|
-
if (typeof obj !== "object" || obj === null) return false;
|
|
469
|
-
let proto = obj;
|
|
470
|
-
while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
|
|
471
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
472
|
-
}
|
|
473
|
-
function miniKindOf(val) {
|
|
474
|
-
if (val === void 0) return "undefined";
|
|
475
|
-
if (val === null) return "null";
|
|
476
|
-
const type = typeof val;
|
|
477
|
-
switch (type) {
|
|
478
|
-
case "boolean":
|
|
479
|
-
case "string":
|
|
480
|
-
case "number":
|
|
481
|
-
case "symbol":
|
|
482
|
-
case "function": return type;
|
|
483
|
-
}
|
|
484
|
-
if (Array.isArray(val)) return "array";
|
|
485
|
-
if (isDate$1(val)) return "date";
|
|
486
|
-
if (isError(val)) return "error";
|
|
487
|
-
const constructorName = ctorName(val);
|
|
488
|
-
switch (constructorName) {
|
|
489
|
-
case "Symbol":
|
|
490
|
-
case "Promise":
|
|
491
|
-
case "WeakMap":
|
|
492
|
-
case "WeakSet":
|
|
493
|
-
case "Map":
|
|
494
|
-
case "Set": return constructorName;
|
|
495
|
-
}
|
|
496
|
-
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
497
|
-
}
|
|
498
|
-
function ctorName(val) {
|
|
499
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
500
|
-
}
|
|
501
|
-
function isError(val) {
|
|
502
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
503
|
-
}
|
|
504
|
-
function isDate$1(val) {
|
|
505
|
-
if (val instanceof Date) return true;
|
|
506
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
507
|
-
}
|
|
508
|
-
function kindOf$1(val) {
|
|
509
|
-
let typeOfVal = typeof val;
|
|
510
|
-
if (process.env.NODE_ENV !== "production") typeOfVal = miniKindOf(val);
|
|
511
|
-
return typeOfVal;
|
|
512
|
-
}
|
|
513
|
-
function createStore(reducer, preloadedState, enhancer) {
|
|
514
|
-
if (typeof reducer !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf$1(reducer)}'`);
|
|
515
|
-
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(0) : "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.");
|
|
516
|
-
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
517
|
-
enhancer = preloadedState;
|
|
518
|
-
preloadedState = void 0;
|
|
519
|
-
}
|
|
520
|
-
if (typeof enhancer !== "undefined") {
|
|
521
|
-
if (typeof enhancer !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf$1(enhancer)}'`);
|
|
522
|
-
return enhancer(createStore)(reducer, preloadedState);
|
|
523
|
-
}
|
|
524
|
-
let currentReducer = reducer;
|
|
525
|
-
let currentState = preloadedState;
|
|
526
|
-
let currentListeners = /* @__PURE__ */ new Map();
|
|
527
|
-
let nextListeners = currentListeners;
|
|
528
|
-
let listenerIdCounter = 0;
|
|
529
|
-
let isDispatching = false;
|
|
530
|
-
function ensureCanMutateNextListeners() {
|
|
531
|
-
if (nextListeners === currentListeners) {
|
|
532
|
-
nextListeners = /* @__PURE__ */ new Map();
|
|
533
|
-
currentListeners.forEach((listener, key) => {
|
|
534
|
-
nextListeners.set(key, listener);
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
function getState() {
|
|
539
|
-
if (isDispatching) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(3) : "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.");
|
|
540
|
-
return currentState;
|
|
541
|
-
}
|
|
542
|
-
function subscribe(listener) {
|
|
543
|
-
if (typeof listener !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(4) : `Expected the listener to be a function. Instead, received: '${kindOf$1(listener)}'`);
|
|
544
|
-
if (isDispatching) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(5) : "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.");
|
|
545
|
-
let isSubscribed = true;
|
|
546
|
-
ensureCanMutateNextListeners();
|
|
547
|
-
const listenerId = listenerIdCounter++;
|
|
548
|
-
nextListeners.set(listenerId, listener);
|
|
549
|
-
return function unsubscribe() {
|
|
550
|
-
if (!isSubscribed) return;
|
|
551
|
-
if (isDispatching) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
552
|
-
isSubscribed = false;
|
|
553
|
-
ensureCanMutateNextListeners();
|
|
554
|
-
nextListeners.delete(listenerId);
|
|
555
|
-
currentListeners = null;
|
|
556
|
-
};
|
|
557
|
-
}
|
|
558
|
-
function dispatch(action) {
|
|
559
|
-
if (!isPlainObject$2(action)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(7) : `Actions must be plain objects. Instead, the actual type was: '${kindOf$1(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.`);
|
|
560
|
-
if (typeof action.type === "undefined") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(8) : "Actions may not have an undefined \"type\" property. You may have misspelled an action type string constant.");
|
|
561
|
-
if (typeof action.type !== "string") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(17) : `Action "type" property must be a string. Instead, the actual type was: '${kindOf$1(action.type)}'. Value was: '${action.type}' (stringified)`);
|
|
562
|
-
if (isDispatching) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(9) : "Reducers may not dispatch actions.");
|
|
563
|
-
try {
|
|
564
|
-
isDispatching = true;
|
|
565
|
-
currentState = currentReducer(currentState, action);
|
|
566
|
-
} finally {
|
|
567
|
-
isDispatching = false;
|
|
568
|
-
}
|
|
569
|
-
(currentListeners = nextListeners).forEach((listener) => {
|
|
570
|
-
listener();
|
|
571
|
-
});
|
|
572
|
-
return action;
|
|
573
|
-
}
|
|
574
|
-
function replaceReducer(nextReducer) {
|
|
575
|
-
if (typeof nextReducer !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf$1(nextReducer)}`);
|
|
576
|
-
currentReducer = nextReducer;
|
|
577
|
-
dispatch({ type: actionTypes_default.REPLACE });
|
|
578
|
-
}
|
|
579
|
-
function observable() {
|
|
580
|
-
const outerSubscribe = subscribe;
|
|
581
|
-
return {
|
|
582
|
-
/**
|
|
583
|
-
* The minimal observable subscription method.
|
|
584
|
-
* @param observer Any object that can be used as an observer.
|
|
585
|
-
* The observer object should have a `next` method.
|
|
586
|
-
* @returns An object with an `unsubscribe` method that can
|
|
587
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
|
588
|
-
* emission of values from the observable.
|
|
589
|
-
*/
|
|
590
|
-
subscribe(observer) {
|
|
591
|
-
if (typeof observer !== "object" || observer === null) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(11) : `Expected the observer to be an object. Instead, received: '${kindOf$1(observer)}'`);
|
|
592
|
-
function observeState() {
|
|
593
|
-
const observerAsObserver = observer;
|
|
594
|
-
if (observerAsObserver.next) observerAsObserver.next(getState());
|
|
595
|
-
}
|
|
596
|
-
observeState();
|
|
597
|
-
return { unsubscribe: outerSubscribe(observeState) };
|
|
598
|
-
},
|
|
599
|
-
[symbol_observable_default]() {
|
|
600
|
-
return this;
|
|
601
|
-
}
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
dispatch({ type: actionTypes_default.INIT });
|
|
605
|
-
return {
|
|
606
|
-
dispatch,
|
|
607
|
-
subscribe,
|
|
608
|
-
getState,
|
|
609
|
-
replaceReducer,
|
|
610
|
-
[symbol_observable_default]: observable
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
function warning(message) {
|
|
614
|
-
if (typeof console !== "undefined" && typeof console.error === "function") console.error(message);
|
|
615
|
-
try {
|
|
616
|
-
throw new Error(message);
|
|
617
|
-
} catch (e) {}
|
|
618
|
-
}
|
|
619
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
620
|
-
const reducerKeys = Object.keys(reducers);
|
|
621
|
-
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
622
|
-
if (reducerKeys.length === 0) return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
623
|
-
if (!isPlainObject$2(inputState)) return `The ${argumentName} has unexpected type of "${kindOf$1(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join("\", \"")}"`;
|
|
624
|
-
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
625
|
-
unexpectedKeys.forEach((key) => {
|
|
626
|
-
unexpectedKeyCache[key] = true;
|
|
627
|
-
});
|
|
628
|
-
if (action && action.type === actionTypes_default.REPLACE) return;
|
|
629
|
-
if (unexpectedKeys.length > 0) 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.`;
|
|
630
|
-
}
|
|
631
|
-
function assertReducerShape(reducers) {
|
|
632
|
-
Object.keys(reducers).forEach((key) => {
|
|
633
|
-
const reducer = reducers[key];
|
|
634
|
-
if (typeof reducer(void 0, { type: actionTypes_default.INIT }) === "undefined") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(12) : `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.`);
|
|
635
|
-
if (typeof reducer(void 0, { type: actionTypes_default.PROBE_UNKNOWN_ACTION() }) === "undefined") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.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.`);
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
function combineReducers(reducers) {
|
|
639
|
-
const reducerKeys = Object.keys(reducers);
|
|
640
|
-
const finalReducers = {};
|
|
641
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
642
|
-
const key = reducerKeys[i];
|
|
643
|
-
if (process.env.NODE_ENV !== "production") {
|
|
644
|
-
if (typeof reducers[key] === "undefined") warning(`No reducer provided for key "${key}"`);
|
|
645
|
-
}
|
|
646
|
-
if (typeof reducers[key] === "function") finalReducers[key] = reducers[key];
|
|
647
|
-
}
|
|
648
|
-
const finalReducerKeys = Object.keys(finalReducers);
|
|
649
|
-
let unexpectedKeyCache;
|
|
650
|
-
if (process.env.NODE_ENV !== "production") unexpectedKeyCache = {};
|
|
651
|
-
let shapeAssertionError;
|
|
652
|
-
try {
|
|
653
|
-
assertReducerShape(finalReducers);
|
|
654
|
-
} catch (e) {
|
|
655
|
-
shapeAssertionError = e;
|
|
656
|
-
}
|
|
657
|
-
return function combination(state = {}, action) {
|
|
658
|
-
if (shapeAssertionError) throw shapeAssertionError;
|
|
659
|
-
if (process.env.NODE_ENV !== "production") {
|
|
660
|
-
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
661
|
-
if (warningMessage) warning(warningMessage);
|
|
662
|
-
}
|
|
663
|
-
let hasChanged = false;
|
|
664
|
-
const nextState = {};
|
|
665
|
-
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
666
|
-
const key = finalReducerKeys[i];
|
|
667
|
-
const reducer = finalReducers[key];
|
|
668
|
-
const previousStateForKey = state[key];
|
|
669
|
-
const nextStateForKey = reducer(previousStateForKey, action);
|
|
670
|
-
if (typeof nextStateForKey === "undefined") {
|
|
671
|
-
const actionType = action && action.type;
|
|
672
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(14) : `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.`);
|
|
673
|
-
}
|
|
674
|
-
nextState[key] = nextStateForKey;
|
|
675
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
676
|
-
}
|
|
677
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
678
|
-
return hasChanged ? nextState : state;
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
function compose(...funcs) {
|
|
682
|
-
if (funcs.length === 0) return (arg) => arg;
|
|
683
|
-
if (funcs.length === 1) return funcs[0];
|
|
684
|
-
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
685
|
-
}
|
|
686
|
-
function applyMiddleware(...middlewares) {
|
|
687
|
-
return (createStore2) => (reducer, preloadedState) => {
|
|
688
|
-
const store = createStore2(reducer, preloadedState);
|
|
689
|
-
let dispatch = () => {
|
|
690
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage$1(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
|
691
|
-
};
|
|
692
|
-
const middlewareAPI = {
|
|
693
|
-
getState: store.getState,
|
|
694
|
-
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
695
|
-
};
|
|
696
|
-
dispatch = compose(...middlewares.map((middleware) => middleware(middlewareAPI)))(store.dispatch);
|
|
697
|
-
return {
|
|
698
|
-
...store,
|
|
699
|
-
dispatch
|
|
700
|
-
};
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
function isAction(action) {
|
|
704
|
-
return isPlainObject$2(action) && "type" in action && typeof action.type === "string";
|
|
705
|
-
}
|
|
706
|
-
//#endregion
|
|
707
|
-
//#region node_modules/immer/dist/immer.mjs
|
|
708
|
-
var NOTHING = Symbol.for("immer-nothing");
|
|
709
|
-
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
710
|
-
var DRAFT_STATE = Symbol.for("immer-state");
|
|
711
|
-
var errors = process.env.NODE_ENV !== "production" ? [
|
|
712
|
-
function(plugin) {
|
|
713
|
-
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
714
|
-
},
|
|
715
|
-
function(thing) {
|
|
716
|
-
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 '${thing}'`;
|
|
717
|
-
},
|
|
718
|
-
"This object has been frozen and should not be mutated",
|
|
719
|
-
function(data) {
|
|
720
|
-
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
721
|
-
},
|
|
722
|
-
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
723
|
-
"Immer forbids circular references",
|
|
724
|
-
"The first or second argument to `produce` must be a function",
|
|
725
|
-
"The third argument to `produce` must be a function or undefined",
|
|
726
|
-
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
727
|
-
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
728
|
-
function(thing) {
|
|
729
|
-
return `'current' expects a draft, got: ${thing}`;
|
|
730
|
-
},
|
|
731
|
-
"Object.defineProperty() cannot be used on an Immer draft",
|
|
732
|
-
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
733
|
-
"Immer only supports deleting array indices",
|
|
734
|
-
"Immer only supports setting array indices and the 'length' property",
|
|
735
|
-
function(thing) {
|
|
736
|
-
return `'original' expects a draft, got: ${thing}`;
|
|
737
|
-
}
|
|
738
|
-
] : [];
|
|
739
|
-
function die(error, ...args) {
|
|
740
|
-
if (process.env.NODE_ENV !== "production") {
|
|
741
|
-
const e = errors[error];
|
|
742
|
-
const msg = isFunction$3(e) ? e.apply(null, args) : e;
|
|
743
|
-
throw new Error(`[Immer] ${msg}`);
|
|
744
|
-
}
|
|
745
|
-
throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
|
|
746
|
-
}
|
|
747
|
-
var O = Object;
|
|
748
|
-
var getPrototypeOf$1 = O.getPrototypeOf;
|
|
749
|
-
var CONSTRUCTOR = "constructor";
|
|
750
|
-
var PROTOTYPE = "prototype";
|
|
751
|
-
var CONFIGURABLE = "configurable";
|
|
752
|
-
var ENUMERABLE = "enumerable";
|
|
753
|
-
var WRITABLE = "writable";
|
|
754
|
-
var VALUE = "value";
|
|
755
|
-
var isDraft = (value) => !!value && !!value[DRAFT_STATE];
|
|
756
|
-
function isDraftable(value) {
|
|
757
|
-
if (!value) return false;
|
|
758
|
-
return isPlainObject$1(value) || isArray$2(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
759
|
-
}
|
|
760
|
-
var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
|
|
761
|
-
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
762
|
-
function isPlainObject$1(value) {
|
|
763
|
-
if (!value || !isObjectish(value)) return false;
|
|
764
|
-
const proto = getPrototypeOf$1(value);
|
|
765
|
-
if (proto === null || proto === O[PROTOTYPE]) return true;
|
|
766
|
-
const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
767
|
-
if (Ctor === Object) return true;
|
|
768
|
-
if (!isFunction$3(Ctor)) return false;
|
|
769
|
-
let ctorString = cachedCtorStrings.get(Ctor);
|
|
770
|
-
if (ctorString === void 0) {
|
|
771
|
-
ctorString = Function.toString.call(Ctor);
|
|
772
|
-
cachedCtorStrings.set(Ctor, ctorString);
|
|
773
|
-
}
|
|
774
|
-
return ctorString === objectCtorString;
|
|
775
|
-
}
|
|
776
|
-
function each$1(obj, iter, strict = true) {
|
|
777
|
-
if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
|
|
778
|
-
iter(key, obj[key], obj);
|
|
779
|
-
});
|
|
780
|
-
else obj.forEach((entry, index) => iter(index, entry, obj));
|
|
781
|
-
}
|
|
782
|
-
function getArchtype(thing) {
|
|
783
|
-
const state = thing[DRAFT_STATE];
|
|
784
|
-
return state ? state.type_ : isArray$2(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
785
|
-
}
|
|
786
|
-
var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
787
|
-
var get$1 = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.get(prop) : thing[prop];
|
|
788
|
-
var set$3 = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
|
|
789
|
-
if (type === 2) thing.set(propOrOldValue, value);
|
|
790
|
-
else if (type === 3) thing.add(value);
|
|
791
|
-
else thing[propOrOldValue] = value;
|
|
792
|
-
};
|
|
793
|
-
function is(x, y) {
|
|
794
|
-
if (x === y) return x !== 0 || 1 / x === 1 / y;
|
|
795
|
-
else return x !== x && y !== y;
|
|
796
|
-
}
|
|
797
|
-
var isArray$2 = Array.isArray;
|
|
798
|
-
var isMap = (target) => target instanceof Map;
|
|
799
|
-
var isSet = (target) => target instanceof Set;
|
|
800
|
-
var isObjectish = (target) => typeof target === "object";
|
|
801
|
-
var isFunction$3 = (target) => typeof target === "function";
|
|
802
|
-
var isBoolean$2 = (target) => typeof target === "boolean";
|
|
803
|
-
function isArrayIndex(value) {
|
|
804
|
-
const n = +value;
|
|
805
|
-
return Number.isInteger(n) && String(n) === value;
|
|
806
|
-
}
|
|
807
|
-
var latest = (state) => state.copy_ || state.base_;
|
|
808
|
-
var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
|
|
809
|
-
function shallowCopy(base, strict) {
|
|
810
|
-
if (isMap(base)) return new Map(base);
|
|
811
|
-
if (isSet(base)) return new Set(base);
|
|
812
|
-
if (isArray$2(base)) return Array[PROTOTYPE].slice.call(base);
|
|
813
|
-
const isPlain = isPlainObject$1(base);
|
|
814
|
-
if (strict === true || strict === "class_only" && !isPlain) {
|
|
815
|
-
const descriptors = O.getOwnPropertyDescriptors(base);
|
|
816
|
-
delete descriptors[DRAFT_STATE];
|
|
817
|
-
let keys = Reflect.ownKeys(descriptors);
|
|
818
|
-
for (let i = 0; i < keys.length; i++) {
|
|
819
|
-
const key = keys[i];
|
|
820
|
-
const desc = descriptors[key];
|
|
821
|
-
if (desc[WRITABLE] === false) {
|
|
822
|
-
desc[WRITABLE] = true;
|
|
823
|
-
desc[CONFIGURABLE] = true;
|
|
824
|
-
}
|
|
825
|
-
if (desc.get || desc.set) descriptors[key] = {
|
|
826
|
-
[CONFIGURABLE]: true,
|
|
827
|
-
[WRITABLE]: true,
|
|
828
|
-
[ENUMERABLE]: desc[ENUMERABLE],
|
|
829
|
-
[VALUE]: base[key]
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
return O.create(getPrototypeOf$1(base), descriptors);
|
|
833
|
-
} else {
|
|
834
|
-
const proto = getPrototypeOf$1(base);
|
|
835
|
-
if (proto !== null && isPlain) return { ...base };
|
|
836
|
-
const obj = O.create(proto);
|
|
837
|
-
return O.assign(obj, base);
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
function freeze(obj, deep = false) {
|
|
841
|
-
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
|
|
842
|
-
if (getArchtype(obj) > 1) O.defineProperties(obj, {
|
|
843
|
-
set: dontMutateMethodOverride,
|
|
844
|
-
add: dontMutateMethodOverride,
|
|
845
|
-
clear: dontMutateMethodOverride,
|
|
846
|
-
delete: dontMutateMethodOverride
|
|
847
|
-
});
|
|
848
|
-
O.freeze(obj);
|
|
849
|
-
if (deep) each$1(obj, (_key, value) => {
|
|
850
|
-
freeze(value, true);
|
|
851
|
-
}, false);
|
|
852
|
-
return obj;
|
|
853
|
-
}
|
|
854
|
-
function dontMutateFrozenCollections() {
|
|
855
|
-
die(2);
|
|
856
|
-
}
|
|
857
|
-
var dontMutateMethodOverride = { [VALUE]: dontMutateFrozenCollections };
|
|
858
|
-
function isFrozen(obj) {
|
|
859
|
-
if (obj === null || !isObjectish(obj)) return true;
|
|
860
|
-
return O.isFrozen(obj);
|
|
861
|
-
}
|
|
862
|
-
var PluginMapSet = "MapSet";
|
|
863
|
-
var PluginPatches = "Patches";
|
|
864
|
-
var PluginArrayMethods = "ArrayMethods";
|
|
865
|
-
var plugins$1 = {};
|
|
866
|
-
function getPlugin(pluginKey) {
|
|
867
|
-
const plugin = plugins$1[pluginKey];
|
|
868
|
-
if (!plugin) die(0, pluginKey);
|
|
869
|
-
return plugin;
|
|
870
|
-
}
|
|
871
|
-
var isPluginLoaded = (pluginKey) => !!plugins$1[pluginKey];
|
|
872
|
-
var currentScope;
|
|
873
|
-
var getCurrentScope = () => currentScope;
|
|
874
|
-
var createScope = (parent_, immer_) => ({
|
|
875
|
-
drafts_: [],
|
|
876
|
-
parent_,
|
|
877
|
-
immer_,
|
|
878
|
-
canAutoFreeze_: true,
|
|
879
|
-
unfinalizedDrafts_: 0,
|
|
880
|
-
handledSet_: /* @__PURE__ */ new Set(),
|
|
881
|
-
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
882
|
-
mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
|
|
883
|
-
arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
|
|
884
|
-
});
|
|
885
|
-
function usePatchesInScope(scope, patchListener) {
|
|
886
|
-
if (patchListener) {
|
|
887
|
-
scope.patchPlugin_ = getPlugin(PluginPatches);
|
|
888
|
-
scope.patches_ = [];
|
|
889
|
-
scope.inversePatches_ = [];
|
|
890
|
-
scope.patchListener_ = patchListener;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
function revokeScope(scope) {
|
|
894
|
-
leaveScope(scope);
|
|
895
|
-
scope.drafts_.forEach(revokeDraft);
|
|
896
|
-
scope.drafts_ = null;
|
|
897
|
-
}
|
|
898
|
-
function leaveScope(scope) {
|
|
899
|
-
if (scope === currentScope) currentScope = scope.parent_;
|
|
900
|
-
}
|
|
901
|
-
var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
|
|
902
|
-
function revokeDraft(draft) {
|
|
903
|
-
const state = draft[DRAFT_STATE];
|
|
904
|
-
if (state.type_ === 0 || state.type_ === 1) state.revoke_();
|
|
905
|
-
else state.revoked_ = true;
|
|
906
|
-
}
|
|
907
|
-
function processResult(result, scope) {
|
|
908
|
-
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
909
|
-
const baseDraft = scope.drafts_[0];
|
|
910
|
-
if (result !== void 0 && result !== baseDraft) {
|
|
911
|
-
if (baseDraft[DRAFT_STATE].modified_) {
|
|
912
|
-
revokeScope(scope);
|
|
913
|
-
die(4);
|
|
914
|
-
}
|
|
915
|
-
if (isDraftable(result)) result = finalize(scope, result);
|
|
916
|
-
const { patchPlugin_ } = scope;
|
|
917
|
-
if (patchPlugin_) patchPlugin_.generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope);
|
|
918
|
-
} else result = finalize(scope, baseDraft);
|
|
919
|
-
maybeFreeze(scope, result, true);
|
|
920
|
-
revokeScope(scope);
|
|
921
|
-
if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
922
|
-
return result !== NOTHING ? result : void 0;
|
|
923
|
-
}
|
|
924
|
-
function finalize(rootScope, value) {
|
|
925
|
-
if (isFrozen(value)) return value;
|
|
926
|
-
const state = value[DRAFT_STATE];
|
|
927
|
-
if (!state) return handleValue(value, rootScope.handledSet_, rootScope);
|
|
928
|
-
if (!isSameScope(state, rootScope)) return value;
|
|
929
|
-
if (!state.modified_) return state.base_;
|
|
930
|
-
if (!state.finalized_) {
|
|
931
|
-
const { callbacks_ } = state;
|
|
932
|
-
if (callbacks_) while (callbacks_.length > 0) callbacks_.pop()(rootScope);
|
|
933
|
-
generatePatchesAndFinalize(state, rootScope);
|
|
934
|
-
}
|
|
935
|
-
return state.copy_;
|
|
936
|
-
}
|
|
937
|
-
function maybeFreeze(scope, value, deep = false) {
|
|
938
|
-
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
|
|
939
|
-
}
|
|
940
|
-
function markStateFinalized(state) {
|
|
941
|
-
state.finalized_ = true;
|
|
942
|
-
state.scope_.unfinalizedDrafts_--;
|
|
943
|
-
}
|
|
944
|
-
var isSameScope = (state, rootScope) => state.scope_ === rootScope;
|
|
945
|
-
var EMPTY_LOCATIONS_RESULT = [];
|
|
946
|
-
function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
|
|
947
|
-
const parentCopy = latest(parent);
|
|
948
|
-
const parentType = parent.type_;
|
|
949
|
-
if (originalKey !== void 0) {
|
|
950
|
-
if (get$1(parentCopy, originalKey, parentType) === draftValue) {
|
|
951
|
-
set$3(parentCopy, originalKey, finalizedValue, parentType);
|
|
952
|
-
return;
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
if (!parent.draftLocations_) {
|
|
956
|
-
const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
|
|
957
|
-
each$1(parentCopy, (key, value) => {
|
|
958
|
-
if (isDraft(value)) {
|
|
959
|
-
const keys = draftLocations.get(value) || [];
|
|
960
|
-
keys.push(key);
|
|
961
|
-
draftLocations.set(value, keys);
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
|
|
966
|
-
for (const location of locations) set$3(parentCopy, location, finalizedValue, parentType);
|
|
967
|
-
}
|
|
968
|
-
function registerChildFinalizationCallback(parent, child, key) {
|
|
969
|
-
parent.callbacks_.push(function childCleanup(rootScope) {
|
|
970
|
-
const state = child;
|
|
971
|
-
if (!state || !isSameScope(state, rootScope)) return;
|
|
972
|
-
rootScope.mapSetPlugin_?.fixSetContents(state);
|
|
973
|
-
const finalizedValue = getFinalValue(state);
|
|
974
|
-
updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
|
|
975
|
-
generatePatchesAndFinalize(state, rootScope);
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
function generatePatchesAndFinalize(state, rootScope) {
|
|
979
|
-
if (state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0)) {
|
|
980
|
-
const { patchPlugin_ } = rootScope;
|
|
981
|
-
if (patchPlugin_) {
|
|
982
|
-
const basePath = patchPlugin_.getPath(state);
|
|
983
|
-
if (basePath) patchPlugin_.generatePatches_(state, basePath, rootScope);
|
|
984
|
-
}
|
|
985
|
-
markStateFinalized(state);
|
|
986
|
-
}
|
|
987
|
-
}
|
|
988
|
-
function handleCrossReference(target, key, value) {
|
|
989
|
-
const { scope_ } = target;
|
|
990
|
-
if (isDraft(value)) {
|
|
991
|
-
const state = value[DRAFT_STATE];
|
|
992
|
-
if (isSameScope(state, scope_)) state.callbacks_.push(function crossReferenceCleanup() {
|
|
993
|
-
prepareCopy(target);
|
|
994
|
-
updateDraftInParent(target, value, getFinalValue(state), key);
|
|
995
|
-
});
|
|
996
|
-
} else if (isDraftable(value)) target.callbacks_.push(function nestedDraftCleanup() {
|
|
997
|
-
const targetCopy = latest(target);
|
|
998
|
-
if (target.type_ === 3) {
|
|
999
|
-
if (targetCopy.has(value)) handleValue(value, scope_.handledSet_, scope_);
|
|
1000
|
-
} else if (get$1(targetCopy, key, target.type_) === value) {
|
|
1001
|
-
if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) handleValue(get$1(target.copy_, key, target.type_), scope_.handledSet_, scope_);
|
|
1002
|
-
}
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
function handleValue(target, handledSet, rootScope) {
|
|
1006
|
-
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return target;
|
|
1007
|
-
if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) return target;
|
|
1008
|
-
handledSet.add(target);
|
|
1009
|
-
each$1(target, (key, value) => {
|
|
1010
|
-
if (isDraft(value)) {
|
|
1011
|
-
const state = value[DRAFT_STATE];
|
|
1012
|
-
if (isSameScope(state, rootScope)) {
|
|
1013
|
-
set$3(target, key, getFinalValue(state), target.type_);
|
|
1014
|
-
markStateFinalized(state);
|
|
1015
|
-
}
|
|
1016
|
-
} else if (isDraftable(value)) handleValue(value, handledSet, rootScope);
|
|
1017
|
-
});
|
|
1018
|
-
return target;
|
|
1019
|
-
}
|
|
1020
|
-
function createProxyProxy(base, parent) {
|
|
1021
|
-
const baseIsArray = isArray$2(base);
|
|
1022
|
-
const state = {
|
|
1023
|
-
type_: baseIsArray ? 1 : 0,
|
|
1024
|
-
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
1025
|
-
modified_: false,
|
|
1026
|
-
finalized_: false,
|
|
1027
|
-
assigned_: void 0,
|
|
1028
|
-
parent_: parent,
|
|
1029
|
-
base_: base,
|
|
1030
|
-
draft_: null,
|
|
1031
|
-
copy_: null,
|
|
1032
|
-
revoke_: null,
|
|
1033
|
-
isManual_: false,
|
|
1034
|
-
callbacks_: void 0
|
|
1035
|
-
};
|
|
1036
|
-
let target = state;
|
|
1037
|
-
let traps = objectTraps;
|
|
1038
|
-
if (baseIsArray) {
|
|
1039
|
-
target = [state];
|
|
1040
|
-
traps = arrayTraps;
|
|
1041
|
-
}
|
|
1042
|
-
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
1043
|
-
state.draft_ = proxy;
|
|
1044
|
-
state.revoke_ = revoke;
|
|
1045
|
-
return [proxy, state];
|
|
1046
|
-
}
|
|
1047
|
-
var objectTraps = {
|
|
1048
|
-
get(state, prop) {
|
|
1049
|
-
if (prop === DRAFT_STATE) return state;
|
|
1050
|
-
let arrayPlugin = state.scope_.arrayMethodsPlugin_;
|
|
1051
|
-
const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
|
|
1052
|
-
if (isArrayWithStringProp) {
|
|
1053
|
-
if (arrayPlugin?.isArrayOperationMethod(prop)) return arrayPlugin.createMethodInterceptor(state, prop);
|
|
1054
|
-
}
|
|
1055
|
-
const source = latest(state);
|
|
1056
|
-
if (!has(source, prop, state.type_)) return readPropFromProto(state, source, prop);
|
|
1057
|
-
const value = source[prop];
|
|
1058
|
-
if (state.finalized_ || !isDraftable(value)) return value;
|
|
1059
|
-
if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(state.operationMethod) && isArrayIndex(prop)) return value;
|
|
1060
|
-
if (value === peek(state.base_, prop)) {
|
|
1061
|
-
prepareCopy(state);
|
|
1062
|
-
const childKey = state.type_ === 1 ? +prop : prop;
|
|
1063
|
-
const childDraft = createProxy(state.scope_, value, state, childKey);
|
|
1064
|
-
return state.copy_[childKey] = childDraft;
|
|
1065
|
-
}
|
|
1066
|
-
return value;
|
|
1067
|
-
},
|
|
1068
|
-
has(state, prop) {
|
|
1069
|
-
return prop in latest(state);
|
|
1070
|
-
},
|
|
1071
|
-
ownKeys(state) {
|
|
1072
|
-
return Reflect.ownKeys(latest(state));
|
|
1073
|
-
},
|
|
1074
|
-
set(state, prop, value) {
|
|
1075
|
-
const desc = getDescriptorFromProto(latest(state), prop);
|
|
1076
|
-
if (desc?.set) {
|
|
1077
|
-
desc.set.call(state.draft_, value);
|
|
1078
|
-
return true;
|
|
1079
|
-
}
|
|
1080
|
-
if (!state.modified_) {
|
|
1081
|
-
const current2 = peek(latest(state), prop);
|
|
1082
|
-
const currentState = current2?.[DRAFT_STATE];
|
|
1083
|
-
if (currentState && currentState.base_ === value) {
|
|
1084
|
-
state.copy_[prop] = value;
|
|
1085
|
-
state.assigned_.set(prop, false);
|
|
1086
|
-
return true;
|
|
1087
|
-
}
|
|
1088
|
-
if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_))) return true;
|
|
1089
|
-
prepareCopy(state);
|
|
1090
|
-
markChanged(state);
|
|
1091
|
-
}
|
|
1092
|
-
if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
|
|
1093
|
-
state.copy_[prop] = value;
|
|
1094
|
-
state.assigned_.set(prop, true);
|
|
1095
|
-
handleCrossReference(state, prop, value);
|
|
1096
|
-
return true;
|
|
1097
|
-
},
|
|
1098
|
-
deleteProperty(state, prop) {
|
|
1099
|
-
prepareCopy(state);
|
|
1100
|
-
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
1101
|
-
state.assigned_.set(prop, false);
|
|
1102
|
-
markChanged(state);
|
|
1103
|
-
} else state.assigned_.delete(prop);
|
|
1104
|
-
if (state.copy_) delete state.copy_[prop];
|
|
1105
|
-
return true;
|
|
1106
|
-
},
|
|
1107
|
-
getOwnPropertyDescriptor(state, prop) {
|
|
1108
|
-
const owner = latest(state);
|
|
1109
|
-
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
1110
|
-
if (!desc) return desc;
|
|
1111
|
-
return {
|
|
1112
|
-
[WRITABLE]: true,
|
|
1113
|
-
[CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
|
|
1114
|
-
[ENUMERABLE]: desc[ENUMERABLE],
|
|
1115
|
-
[VALUE]: owner[prop]
|
|
1116
|
-
};
|
|
1117
|
-
},
|
|
1118
|
-
defineProperty() {
|
|
1119
|
-
die(11);
|
|
1120
|
-
},
|
|
1121
|
-
getPrototypeOf(state) {
|
|
1122
|
-
return getPrototypeOf$1(state.base_);
|
|
1123
|
-
},
|
|
1124
|
-
setPrototypeOf() {
|
|
1125
|
-
die(12);
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
|
-
var arrayTraps = {};
|
|
1129
|
-
for (let key in objectTraps) {
|
|
1130
|
-
let fn = objectTraps[key];
|
|
1131
|
-
arrayTraps[key] = function() {
|
|
1132
|
-
const args = arguments;
|
|
1133
|
-
args[0] = args[0][0];
|
|
1134
|
-
return fn.apply(this, args);
|
|
1135
|
-
};
|
|
1136
|
-
}
|
|
1137
|
-
arrayTraps.deleteProperty = function(state, prop) {
|
|
1138
|
-
if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop))) die(13);
|
|
1139
|
-
return arrayTraps.set.call(this, state, prop, void 0);
|
|
1140
|
-
};
|
|
1141
|
-
arrayTraps.set = function(state, prop, value) {
|
|
1142
|
-
if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop))) die(14);
|
|
1143
|
-
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
1144
|
-
};
|
|
1145
|
-
function peek(draft, prop) {
|
|
1146
|
-
const state = draft[DRAFT_STATE];
|
|
1147
|
-
return (state ? latest(state) : draft)[prop];
|
|
1148
|
-
}
|
|
1149
|
-
function readPropFromProto(state, source, prop) {
|
|
1150
|
-
const desc = getDescriptorFromProto(source, prop);
|
|
1151
|
-
return desc ? VALUE in desc ? desc[VALUE] : desc.get?.call(state.draft_) : void 0;
|
|
1152
|
-
}
|
|
1153
|
-
function getDescriptorFromProto(source, prop) {
|
|
1154
|
-
if (!(prop in source)) return void 0;
|
|
1155
|
-
let proto = getPrototypeOf$1(source);
|
|
1156
|
-
while (proto) {
|
|
1157
|
-
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
1158
|
-
if (desc) return desc;
|
|
1159
|
-
proto = getPrototypeOf$1(proto);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
function markChanged(state) {
|
|
1163
|
-
if (!state.modified_) {
|
|
1164
|
-
state.modified_ = true;
|
|
1165
|
-
if (state.parent_) markChanged(state.parent_);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
function prepareCopy(state) {
|
|
1169
|
-
if (!state.copy_) {
|
|
1170
|
-
state.assigned_ = /* @__PURE__ */ new Map();
|
|
1171
|
-
state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
var Immer2 = class {
|
|
1175
|
-
constructor(config) {
|
|
1176
|
-
this.autoFreeze_ = true;
|
|
1177
|
-
this.useStrictShallowCopy_ = false;
|
|
1178
|
-
this.useStrictIteration_ = false;
|
|
1179
|
-
/**
|
|
1180
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
1181
|
-
* return value often depends on the base state). The recipe function is
|
|
1182
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
1183
|
-
* only ever applied to a __copy__ of the base state.
|
|
1184
|
-
*
|
|
1185
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
1186
|
-
* from passing the recipe function every time.
|
|
1187
|
-
*
|
|
1188
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
1189
|
-
* considered uncopyable.
|
|
1190
|
-
*
|
|
1191
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
1192
|
-
*
|
|
1193
|
-
* @param {any} base - the initial state
|
|
1194
|
-
* @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
1195
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
1196
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
1197
|
-
*/
|
|
1198
|
-
this.produce = (base, recipe, patchListener) => {
|
|
1199
|
-
if (isFunction$3(base) && !isFunction$3(recipe)) {
|
|
1200
|
-
const defaultBase = recipe;
|
|
1201
|
-
recipe = base;
|
|
1202
|
-
const self = this;
|
|
1203
|
-
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
1204
|
-
return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
if (!isFunction$3(recipe)) die(6);
|
|
1208
|
-
if (patchListener !== void 0 && !isFunction$3(patchListener)) die(7);
|
|
1209
|
-
let result;
|
|
1210
|
-
if (isDraftable(base)) {
|
|
1211
|
-
const scope = enterScope(this);
|
|
1212
|
-
const proxy = createProxy(scope, base, void 0);
|
|
1213
|
-
let hasError = true;
|
|
1214
|
-
try {
|
|
1215
|
-
result = recipe(proxy);
|
|
1216
|
-
hasError = false;
|
|
1217
|
-
} finally {
|
|
1218
|
-
if (hasError) revokeScope(scope);
|
|
1219
|
-
else leaveScope(scope);
|
|
1220
|
-
}
|
|
1221
|
-
usePatchesInScope(scope, patchListener);
|
|
1222
|
-
return processResult(result, scope);
|
|
1223
|
-
} else if (!base || !isObjectish(base)) {
|
|
1224
|
-
result = recipe(base);
|
|
1225
|
-
if (result === void 0) result = base;
|
|
1226
|
-
if (result === NOTHING) result = void 0;
|
|
1227
|
-
if (this.autoFreeze_) freeze(result, true);
|
|
1228
|
-
if (patchListener) {
|
|
1229
|
-
const p = [];
|
|
1230
|
-
const ip = [];
|
|
1231
|
-
getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
|
|
1232
|
-
patches_: p,
|
|
1233
|
-
inversePatches_: ip
|
|
1234
|
-
});
|
|
1235
|
-
patchListener(p, ip);
|
|
1236
|
-
}
|
|
1237
|
-
return result;
|
|
1238
|
-
} else die(1, base);
|
|
1239
|
-
};
|
|
1240
|
-
this.produceWithPatches = (base, recipe) => {
|
|
1241
|
-
if (isFunction$3(base)) return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
1242
|
-
let patches, inversePatches;
|
|
1243
|
-
return [
|
|
1244
|
-
this.produce(base, recipe, (p, ip) => {
|
|
1245
|
-
patches = p;
|
|
1246
|
-
inversePatches = ip;
|
|
1247
|
-
}),
|
|
1248
|
-
patches,
|
|
1249
|
-
inversePatches
|
|
1250
|
-
];
|
|
1251
|
-
};
|
|
1252
|
-
if (isBoolean$2(config?.autoFreeze)) this.setAutoFreeze(config.autoFreeze);
|
|
1253
|
-
if (isBoolean$2(config?.useStrictShallowCopy)) this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
1254
|
-
if (isBoolean$2(config?.useStrictIteration)) this.setUseStrictIteration(config.useStrictIteration);
|
|
1255
|
-
}
|
|
1256
|
-
createDraft(base) {
|
|
1257
|
-
if (!isDraftable(base)) die(8);
|
|
1258
|
-
if (isDraft(base)) base = current(base);
|
|
1259
|
-
const scope = enterScope(this);
|
|
1260
|
-
const proxy = createProxy(scope, base, void 0);
|
|
1261
|
-
proxy[DRAFT_STATE].isManual_ = true;
|
|
1262
|
-
leaveScope(scope);
|
|
1263
|
-
return proxy;
|
|
1264
|
-
}
|
|
1265
|
-
finishDraft(draft, patchListener) {
|
|
1266
|
-
const state = draft && draft[DRAFT_STATE];
|
|
1267
|
-
if (!state || !state.isManual_) die(9);
|
|
1268
|
-
const { scope_: scope } = state;
|
|
1269
|
-
usePatchesInScope(scope, patchListener);
|
|
1270
|
-
return processResult(void 0, scope);
|
|
1271
|
-
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
1274
|
-
*
|
|
1275
|
-
* By default, auto-freezing is enabled.
|
|
1276
|
-
*/
|
|
1277
|
-
setAutoFreeze(value) {
|
|
1278
|
-
this.autoFreeze_ = value;
|
|
1279
|
-
}
|
|
1280
|
-
/**
|
|
1281
|
-
* Pass true to enable strict shallow copy.
|
|
1282
|
-
*
|
|
1283
|
-
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
1284
|
-
*/
|
|
1285
|
-
setUseStrictShallowCopy(value) {
|
|
1286
|
-
this.useStrictShallowCopy_ = value;
|
|
1287
|
-
}
|
|
1288
|
-
/**
|
|
1289
|
-
* Pass false to use faster iteration that skips non-enumerable properties
|
|
1290
|
-
* but still handles symbols for compatibility.
|
|
1291
|
-
*
|
|
1292
|
-
* By default, strict iteration is enabled (includes all own properties).
|
|
1293
|
-
*/
|
|
1294
|
-
setUseStrictIteration(value) {
|
|
1295
|
-
this.useStrictIteration_ = value;
|
|
1296
|
-
}
|
|
1297
|
-
shouldUseStrictIteration() {
|
|
1298
|
-
return this.useStrictIteration_;
|
|
1299
|
-
}
|
|
1300
|
-
applyPatches(base, patches) {
|
|
1301
|
-
let i;
|
|
1302
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
1303
|
-
const patch = patches[i];
|
|
1304
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
1305
|
-
base = patch.value;
|
|
1306
|
-
break;
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
if (i > -1) patches = patches.slice(i + 1);
|
|
1310
|
-
const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
|
|
1311
|
-
if (isDraft(base)) return applyPatchesImpl(base, patches);
|
|
1312
|
-
return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
|
|
1313
|
-
}
|
|
1314
|
-
};
|
|
1315
|
-
function createProxy(rootScope, value, parent, key) {
|
|
1316
|
-
const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
1317
|
-
(parent?.scope_ ?? getCurrentScope()).drafts_.push(draft);
|
|
1318
|
-
state.callbacks_ = parent?.callbacks_ ?? [];
|
|
1319
|
-
state.key_ = key;
|
|
1320
|
-
if (parent && key !== void 0) registerChildFinalizationCallback(parent, state, key);
|
|
1321
|
-
else state.callbacks_.push(function rootDraftCleanup(rootScope2) {
|
|
1322
|
-
rootScope2.mapSetPlugin_?.fixSetContents(state);
|
|
1323
|
-
const { patchPlugin_ } = rootScope2;
|
|
1324
|
-
if (state.modified_ && patchPlugin_) patchPlugin_.generatePatches_(state, [], rootScope2);
|
|
1325
|
-
});
|
|
1326
|
-
return draft;
|
|
1327
|
-
}
|
|
1328
|
-
function current(value) {
|
|
1329
|
-
if (!isDraft(value)) die(10, value);
|
|
1330
|
-
return currentImpl(value);
|
|
1331
|
-
}
|
|
1332
|
-
function currentImpl(value) {
|
|
1333
|
-
if (!isDraftable(value) || isFrozen(value)) return value;
|
|
1334
|
-
const state = value[DRAFT_STATE];
|
|
1335
|
-
let copy;
|
|
1336
|
-
let strict = true;
|
|
1337
|
-
if (state) {
|
|
1338
|
-
if (!state.modified_) return state.base_;
|
|
1339
|
-
state.finalized_ = true;
|
|
1340
|
-
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
1341
|
-
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
1342
|
-
} else copy = shallowCopy(value, true);
|
|
1343
|
-
each$1(copy, (key, childValue) => {
|
|
1344
|
-
set$3(copy, key, currentImpl(childValue));
|
|
1345
|
-
}, strict);
|
|
1346
|
-
if (state) state.finalized_ = false;
|
|
1347
|
-
return copy;
|
|
1348
|
-
}
|
|
1349
|
-
var produce = new Immer2().produce;
|
|
1350
|
-
//#endregion
|
|
1351
|
-
//#region node_modules/redux-thunk/dist/redux-thunk.mjs
|
|
1352
|
-
function createThunkMiddleware(extraArgument) {
|
|
1353
|
-
const middleware = ({ dispatch, getState }) => (next) => (action) => {
|
|
1354
|
-
if (typeof action === "function") return action(dispatch, getState, extraArgument);
|
|
1355
|
-
return next(action);
|
|
1356
|
-
};
|
|
1357
|
-
return middleware;
|
|
1358
|
-
}
|
|
1359
|
-
var thunk = createThunkMiddleware();
|
|
1360
|
-
var withExtraArgument = createThunkMiddleware;
|
|
1361
|
-
//#endregion
|
|
1362
|
-
//#region node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
|
|
1363
|
-
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
1364
|
-
if (arguments.length === 0) return void 0;
|
|
1365
|
-
if (typeof arguments[0] === "object") return compose;
|
|
1366
|
-
return compose.apply(null, arguments);
|
|
1367
|
-
};
|
|
1368
|
-
typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1369
|
-
var hasMatchFunction = (v) => {
|
|
1370
|
-
return v && typeof v.match === "function";
|
|
1371
|
-
};
|
|
1372
|
-
function createAction(type, prepareAction) {
|
|
1373
|
-
function actionCreator(...args) {
|
|
1374
|
-
if (prepareAction) {
|
|
1375
|
-
let prepared = prepareAction(...args);
|
|
1376
|
-
if (!prepared) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
1377
|
-
return {
|
|
1378
|
-
type,
|
|
1379
|
-
payload: prepared.payload,
|
|
1380
|
-
..."meta" in prepared && { meta: prepared.meta },
|
|
1381
|
-
..."error" in prepared && { error: prepared.error }
|
|
1382
|
-
};
|
|
1383
|
-
}
|
|
1384
|
-
return {
|
|
1385
|
-
type,
|
|
1386
|
-
payload: args[0]
|
|
1387
|
-
};
|
|
1388
|
-
}
|
|
1389
|
-
actionCreator.toString = () => `${type}`;
|
|
1390
|
-
actionCreator.type = type;
|
|
1391
|
-
actionCreator.match = (action) => isAction(action) && action.type === type;
|
|
1392
|
-
return actionCreator;
|
|
1393
|
-
}
|
|
1394
|
-
function isActionCreator(action) {
|
|
1395
|
-
return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
|
1396
|
-
}
|
|
1397
|
-
function getMessage(type) {
|
|
1398
|
-
const splitType = type ? `${type}`.split("/") : [];
|
|
1399
|
-
const actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
1400
|
-
return `Detected an action creator with type "${type || "unknown"}" being dispatched.
|
|
1401
|
-
Make 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.`;
|
|
1402
|
-
}
|
|
1403
|
-
function createActionCreatorInvariantMiddleware(options = {}) {
|
|
1404
|
-
if (process.env.NODE_ENV === "production") return () => (next) => (action) => next(action);
|
|
1405
|
-
const { isActionCreator: isActionCreator2 = isActionCreator } = options;
|
|
1406
|
-
return () => (next) => (action) => {
|
|
1407
|
-
if (isActionCreator2(action)) console.warn(getMessage(action.type));
|
|
1408
|
-
return next(action);
|
|
1409
|
-
};
|
|
1410
|
-
}
|
|
1411
|
-
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
1412
|
-
let elapsed = 0;
|
|
1413
|
-
return {
|
|
1414
|
-
measureTime(fn) {
|
|
1415
|
-
const started = Date.now();
|
|
1416
|
-
try {
|
|
1417
|
-
return fn();
|
|
1418
|
-
} finally {
|
|
1419
|
-
elapsed += Date.now() - started;
|
|
1420
|
-
}
|
|
1421
|
-
},
|
|
1422
|
-
warnIfExceeded() {
|
|
1423
|
-
if (elapsed > maxDelay) console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms.
|
|
1424
|
-
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.
|
|
1425
|
-
It is disabled in production builds, so you don't need to worry about that.`);
|
|
1426
|
-
}
|
|
1427
|
-
};
|
|
1428
|
-
}
|
|
1429
|
-
var Tuple = class _Tuple extends Array {
|
|
1430
|
-
constructor(...items) {
|
|
1431
|
-
super(...items);
|
|
1432
|
-
Object.setPrototypeOf(this, _Tuple.prototype);
|
|
1433
|
-
}
|
|
1434
|
-
static get [Symbol.species]() {
|
|
1435
|
-
return _Tuple;
|
|
1436
|
-
}
|
|
1437
|
-
concat(...arr) {
|
|
1438
|
-
return super.concat.apply(this, arr);
|
|
1439
|
-
}
|
|
1440
|
-
prepend(...arr) {
|
|
1441
|
-
if (arr.length === 1 && Array.isArray(arr[0])) return new _Tuple(...arr[0].concat(this));
|
|
1442
|
-
return new _Tuple(...arr.concat(this));
|
|
1443
|
-
}
|
|
1444
|
-
};
|
|
1445
|
-
function freezeDraftable(val) {
|
|
1446
|
-
return isDraftable(val) ? produce(val, () => {}) : val;
|
|
1447
|
-
}
|
|
1448
|
-
function getOrInsertComputed(map, key, compute) {
|
|
1449
|
-
if (map.has(key)) return map.get(key);
|
|
1450
|
-
return map.set(key, compute(key)).get(key);
|
|
1451
|
-
}
|
|
1452
|
-
function isImmutableDefault(value) {
|
|
1453
|
-
return typeof value !== "object" || value == null || Object.isFrozen(value);
|
|
1454
|
-
}
|
|
1455
|
-
function trackForMutations(isImmutable, ignoredPaths, obj) {
|
|
1456
|
-
const trackedProperties = trackProperties(isImmutable, ignoredPaths, obj);
|
|
1457
|
-
return { detectMutations() {
|
|
1458
|
-
return detectMutations(isImmutable, ignoredPaths, trackedProperties, obj);
|
|
1459
|
-
} };
|
|
1460
|
-
}
|
|
1461
|
-
function trackProperties(isImmutable, ignoredPaths = [], obj, path = "", checkedObjects = /* @__PURE__ */ new Set()) {
|
|
1462
|
-
const tracked = { value: obj };
|
|
1463
|
-
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
1464
|
-
checkedObjects.add(obj);
|
|
1465
|
-
tracked.children = {};
|
|
1466
|
-
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
1467
|
-
for (const key in obj) {
|
|
1468
|
-
const nestedPath = path ? path + "." + key : key;
|
|
1469
|
-
if (hasIgnoredPaths) {
|
|
1470
|
-
if (ignoredPaths.some((ignored) => {
|
|
1471
|
-
if (ignored instanceof RegExp) return ignored.test(nestedPath);
|
|
1472
|
-
return nestedPath === ignored;
|
|
1473
|
-
})) continue;
|
|
1474
|
-
}
|
|
1475
|
-
tracked.children[key] = trackProperties(isImmutable, ignoredPaths, obj[key], nestedPath);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
return tracked;
|
|
1479
|
-
}
|
|
1480
|
-
function detectMutations(isImmutable, ignoredPaths = [], trackedProperty, obj, sameParentRef = false, path = "") {
|
|
1481
|
-
const prevObj = trackedProperty ? trackedProperty.value : void 0;
|
|
1482
|
-
const sameRef = prevObj === obj;
|
|
1483
|
-
if (sameParentRef && !sameRef && !Number.isNaN(obj)) return {
|
|
1484
|
-
wasMutated: true,
|
|
1485
|
-
path
|
|
1486
|
-
};
|
|
1487
|
-
if (isImmutable(prevObj) || isImmutable(obj)) return { wasMutated: false };
|
|
1488
|
-
const keysToDetect = {};
|
|
1489
|
-
for (let key in trackedProperty.children) keysToDetect[key] = true;
|
|
1490
|
-
for (let key in obj) keysToDetect[key] = true;
|
|
1491
|
-
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
1492
|
-
for (let key in keysToDetect) {
|
|
1493
|
-
const nestedPath = path ? path + "." + key : key;
|
|
1494
|
-
if (hasIgnoredPaths) {
|
|
1495
|
-
if (ignoredPaths.some((ignored) => {
|
|
1496
|
-
if (ignored instanceof RegExp) return ignored.test(nestedPath);
|
|
1497
|
-
return nestedPath === ignored;
|
|
1498
|
-
})) continue;
|
|
1499
|
-
}
|
|
1500
|
-
const result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
|
1501
|
-
if (result.wasMutated) return result;
|
|
1502
|
-
}
|
|
1503
|
-
return { wasMutated: false };
|
|
1504
|
-
}
|
|
1505
|
-
function createImmutableStateInvariantMiddleware(options = {}) {
|
|
1506
|
-
if (process.env.NODE_ENV === "production") return () => (next) => (action) => next(action);
|
|
1507
|
-
else {
|
|
1508
|
-
let stringify2 = function(obj, serializer, indent, decycler) {
|
|
1509
|
-
return JSON.stringify(obj, getSerialize2(serializer, decycler), indent);
|
|
1510
|
-
}, getSerialize2 = function(serializer, decycler) {
|
|
1511
|
-
let stack = [], keys = [];
|
|
1512
|
-
if (!decycler) decycler = function(_, value) {
|
|
1513
|
-
if (stack[0] === value) return "[Circular ~]";
|
|
1514
|
-
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
1515
|
-
};
|
|
1516
|
-
return function(key, value) {
|
|
1517
|
-
if (stack.length > 0) {
|
|
1518
|
-
var thisPos = stack.indexOf(this);
|
|
1519
|
-
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
1520
|
-
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
|
|
1521
|
-
if (~stack.indexOf(value)) value = decycler.call(this, key, value);
|
|
1522
|
-
} else stack.push(value);
|
|
1523
|
-
return serializer == null ? value : serializer.call(this, key, value);
|
|
1524
|
-
};
|
|
1525
|
-
};
|
|
1526
|
-
let { isImmutable = isImmutableDefault, ignoredPaths, warnAfter = 32 } = options;
|
|
1527
|
-
const track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
|
1528
|
-
return ({ getState }) => {
|
|
1529
|
-
let state = getState();
|
|
1530
|
-
let tracker = track(state);
|
|
1531
|
-
let result;
|
|
1532
|
-
return (next) => (action) => {
|
|
1533
|
-
const measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
|
1534
|
-
measureUtils.measureTime(() => {
|
|
1535
|
-
state = getState();
|
|
1536
|
-
result = tracker.detectMutations();
|
|
1537
|
-
tracker = track(state);
|
|
1538
|
-
if (result.wasMutated) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(19) : `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)`);
|
|
1539
|
-
});
|
|
1540
|
-
const dispatchedAction = next(action);
|
|
1541
|
-
measureUtils.measureTime(() => {
|
|
1542
|
-
state = getState();
|
|
1543
|
-
result = tracker.detectMutations();
|
|
1544
|
-
tracker = track(state);
|
|
1545
|
-
if (result.wasMutated) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1546
|
-
});
|
|
1547
|
-
measureUtils.warnIfExceeded();
|
|
1548
|
-
return dispatchedAction;
|
|
1549
|
-
};
|
|
1550
|
-
};
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
function isPlain(val) {
|
|
1554
|
-
const type = typeof val;
|
|
1555
|
-
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject$2(val);
|
|
1556
|
-
}
|
|
1557
|
-
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
|
|
1558
|
-
let foundNestedSerializable;
|
|
1559
|
-
if (!isSerializable(value)) return {
|
|
1560
|
-
keyPath: path || "<root>",
|
|
1561
|
-
value
|
|
1562
|
-
};
|
|
1563
|
-
if (typeof value !== "object" || value === null) return false;
|
|
1564
|
-
if (cache?.has(value)) return false;
|
|
1565
|
-
const entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
|
1566
|
-
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
1567
|
-
for (const [key, nestedValue] of entries) {
|
|
1568
|
-
const nestedPath = path ? path + "." + key : key;
|
|
1569
|
-
if (hasIgnoredPaths) {
|
|
1570
|
-
if (ignoredPaths.some((ignored) => {
|
|
1571
|
-
if (ignored instanceof RegExp) return ignored.test(nestedPath);
|
|
1572
|
-
return nestedPath === ignored;
|
|
1573
|
-
})) continue;
|
|
1574
|
-
}
|
|
1575
|
-
if (!isSerializable(nestedValue)) return {
|
|
1576
|
-
keyPath: nestedPath,
|
|
1577
|
-
value: nestedValue
|
|
1578
|
-
};
|
|
1579
|
-
if (typeof nestedValue === "object") {
|
|
1580
|
-
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
|
1581
|
-
if (foundNestedSerializable) return foundNestedSerializable;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
if (cache && isNestedFrozen(value)) cache.add(value);
|
|
1585
|
-
return false;
|
|
1586
|
-
}
|
|
1587
|
-
function isNestedFrozen(value) {
|
|
1588
|
-
if (!Object.isFrozen(value)) return false;
|
|
1589
|
-
for (const nestedValue of Object.values(value)) {
|
|
1590
|
-
if (typeof nestedValue !== "object" || nestedValue === null) continue;
|
|
1591
|
-
if (!isNestedFrozen(nestedValue)) return false;
|
|
1592
|
-
}
|
|
1593
|
-
return true;
|
|
1594
|
-
}
|
|
1595
|
-
function createSerializableStateInvariantMiddleware(options = {}) {
|
|
1596
|
-
if (process.env.NODE_ENV === "production") return () => (next) => (action) => next(action);
|
|
1597
|
-
else {
|
|
1598
|
-
const { isSerializable = isPlain, getEntries, ignoredActions = [], ignoredActionPaths = ["meta.arg", "meta.baseQueryMeta"], ignoredPaths = [], warnAfter = 32, ignoreState = false, ignoreActions = false, disableCache = false } = options;
|
|
1599
|
-
const cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
|
|
1600
|
-
return (storeAPI) => (next) => (action) => {
|
|
1601
|
-
if (!isAction(action)) return next(action);
|
|
1602
|
-
const result = next(action);
|
|
1603
|
-
const measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
|
1604
|
-
if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) measureUtils.measureTime(() => {
|
|
1605
|
-
const foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
|
1606
|
-
if (foundActionNonSerializableValue) {
|
|
1607
|
-
const { keyPath, value } = foundActionNonSerializableValue;
|
|
1608
|
-
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)");
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
if (!ignoreState) {
|
|
1612
|
-
measureUtils.measureTime(() => {
|
|
1613
|
-
const foundStateNonSerializableValue = findNonSerializableValue(storeAPI.getState(), "", isSerializable, getEntries, ignoredPaths, cache);
|
|
1614
|
-
if (foundStateNonSerializableValue) {
|
|
1615
|
-
const { keyPath, value } = foundStateNonSerializableValue;
|
|
1616
|
-
console.error(`A non-serializable value was detected in the state, in the path: \`${keyPath}\`. Value:`, value, `
|
|
1617
|
-
Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
1618
|
-
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
|
|
1619
|
-
}
|
|
1620
|
-
});
|
|
1621
|
-
measureUtils.warnIfExceeded();
|
|
1622
|
-
}
|
|
1623
|
-
return result;
|
|
1624
|
-
};
|
|
1625
|
-
}
|
|
1626
|
-
}
|
|
1627
|
-
function isBoolean$1(x) {
|
|
1628
|
-
return typeof x === "boolean";
|
|
1629
|
-
}
|
|
1630
|
-
var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
|
|
1631
|
-
const { thunk: thunk$1 = true, immutableCheck = true, serializableCheck = true, actionCreatorCheck = true } = options ?? {};
|
|
1632
|
-
let middlewareArray = new Tuple();
|
|
1633
|
-
if (thunk$1) if (isBoolean$1(thunk$1)) middlewareArray.push(thunk);
|
|
1634
|
-
else middlewareArray.push(withExtraArgument(thunk$1.extraArgument));
|
|
1635
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1636
|
-
if (immutableCheck) {
|
|
1637
|
-
let immutableOptions = {};
|
|
1638
|
-
if (!isBoolean$1(immutableCheck)) immutableOptions = immutableCheck;
|
|
1639
|
-
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
|
1640
|
-
}
|
|
1641
|
-
if (serializableCheck) {
|
|
1642
|
-
let serializableOptions = {};
|
|
1643
|
-
if (!isBoolean$1(serializableCheck)) serializableOptions = serializableCheck;
|
|
1644
|
-
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
1645
|
-
}
|
|
1646
|
-
if (actionCreatorCheck) {
|
|
1647
|
-
let actionCreatorOptions = {};
|
|
1648
|
-
if (!isBoolean$1(actionCreatorCheck)) actionCreatorOptions = actionCreatorCheck;
|
|
1649
|
-
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
return middlewareArray;
|
|
1653
|
-
};
|
|
1654
|
-
var SHOULD_AUTOBATCH = "RTK_autoBatch";
|
|
1655
|
-
var createQueueWithTimer = (timeout) => {
|
|
1656
|
-
return (notify) => {
|
|
1657
|
-
setTimeout(notify, timeout);
|
|
1658
|
-
};
|
|
1659
|
-
};
|
|
1660
|
-
var autoBatchEnhancer = (options = { type: "raf" }) => (next) => (...args) => {
|
|
1661
|
-
const store = next(...args);
|
|
1662
|
-
let notifying = true;
|
|
1663
|
-
let shouldNotifyAtEndOfTick = false;
|
|
1664
|
-
let notificationQueued = false;
|
|
1665
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
1666
|
-
const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10) : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
|
|
1667
|
-
const notifyListeners = () => {
|
|
1668
|
-
notificationQueued = false;
|
|
1669
|
-
if (shouldNotifyAtEndOfTick) {
|
|
1670
|
-
shouldNotifyAtEndOfTick = false;
|
|
1671
|
-
listeners.forEach((l) => l());
|
|
1672
|
-
}
|
|
1673
|
-
};
|
|
1674
|
-
return Object.assign({}, store, {
|
|
1675
|
-
subscribe(listener2) {
|
|
1676
|
-
const wrappedListener = () => notifying && listener2();
|
|
1677
|
-
const unsubscribe = store.subscribe(wrappedListener);
|
|
1678
|
-
listeners.add(listener2);
|
|
1679
|
-
return () => {
|
|
1680
|
-
unsubscribe();
|
|
1681
|
-
listeners.delete(listener2);
|
|
1682
|
-
};
|
|
1683
|
-
},
|
|
1684
|
-
dispatch(action) {
|
|
1685
|
-
try {
|
|
1686
|
-
notifying = !action?.meta?.[SHOULD_AUTOBATCH];
|
|
1687
|
-
shouldNotifyAtEndOfTick = !notifying;
|
|
1688
|
-
if (shouldNotifyAtEndOfTick) {
|
|
1689
|
-
if (!notificationQueued) {
|
|
1690
|
-
notificationQueued = true;
|
|
1691
|
-
queueCallback(notifyListeners);
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
return store.dispatch(action);
|
|
1695
|
-
} finally {
|
|
1696
|
-
notifying = true;
|
|
1697
|
-
}
|
|
1698
|
-
}
|
|
1699
|
-
});
|
|
1700
|
-
};
|
|
1701
|
-
var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
|
|
1702
|
-
const { autoBatch = true } = options ?? {};
|
|
1703
|
-
let enhancerArray = new Tuple(middlewareEnhancer);
|
|
1704
|
-
if (autoBatch) enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
|
|
1705
|
-
return enhancerArray;
|
|
1706
|
-
};
|
|
1707
|
-
function configureStore(options) {
|
|
1708
|
-
const getDefaultMiddleware = buildGetDefaultMiddleware();
|
|
1709
|
-
const { reducer = void 0, middleware, devTools = true, duplicateMiddlewareCheck = true, preloadedState = void 0, enhancers = void 0 } = options || {};
|
|
1710
|
-
let rootReducer;
|
|
1711
|
-
if (typeof reducer === "function") rootReducer = reducer;
|
|
1712
|
-
else if (isPlainObject$2(reducer)) rootReducer = combineReducers(reducer);
|
|
1713
|
-
else throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
1714
|
-
if (process.env.NODE_ENV !== "production" && middleware && typeof middleware !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "`middleware` field must be a callback");
|
|
1715
|
-
let finalMiddleware;
|
|
1716
|
-
if (typeof middleware === "function") {
|
|
1717
|
-
finalMiddleware = middleware(getDefaultMiddleware);
|
|
1718
|
-
if (process.env.NODE_ENV !== "production" && !Array.isArray(finalMiddleware)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1719
|
-
} else finalMiddleware = getDefaultMiddleware();
|
|
1720
|
-
if (process.env.NODE_ENV !== "production" && finalMiddleware.some((item) => typeof item !== "function")) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "each middleware provided to configureStore must be a function");
|
|
1721
|
-
if (process.env.NODE_ENV !== "production" && duplicateMiddlewareCheck) {
|
|
1722
|
-
let middlewareReferences = /* @__PURE__ */ new Set();
|
|
1723
|
-
finalMiddleware.forEach((middleware2) => {
|
|
1724
|
-
if (middlewareReferences.has(middleware2)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
|
|
1725
|
-
middlewareReferences.add(middleware2);
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
let finalCompose = compose;
|
|
1729
|
-
if (devTools) finalCompose = composeWithDevTools({
|
|
1730
|
-
trace: process.env.NODE_ENV !== "production",
|
|
1731
|
-
...typeof devTools === "object" && devTools
|
|
1732
|
-
});
|
|
1733
|
-
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
1734
|
-
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
1735
|
-
if (process.env.NODE_ENV !== "production" && enhancers && typeof enhancers !== "function") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "`enhancers` field must be a callback");
|
|
1736
|
-
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
1737
|
-
if (process.env.NODE_ENV !== "production" && !Array.isArray(storeEnhancers)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "`enhancers` callback must return an array");
|
|
1738
|
-
if (process.env.NODE_ENV !== "production" && storeEnhancers.some((item) => typeof item !== "function")) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "each enhancer provided to configureStore must be a function");
|
|
1739
|
-
if (process.env.NODE_ENV !== "production" && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
1740
|
-
const composedEnhancer = finalCompose(...storeEnhancers);
|
|
1741
|
-
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
1742
|
-
}
|
|
1743
|
-
function executeReducerBuilderCallback(builderCallback) {
|
|
1744
|
-
const actionsMap = {};
|
|
1745
|
-
const actionMatchers = [];
|
|
1746
|
-
let defaultCaseReducer;
|
|
1747
|
-
const builder = {
|
|
1748
|
-
addCase(typeOrActionCreator, reducer) {
|
|
1749
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1750
|
-
if (actionMatchers.length > 0) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1751
|
-
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1752
|
-
}
|
|
1753
|
-
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1754
|
-
if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1755
|
-
if (type in actionsMap) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1756
|
-
actionsMap[type] = reducer;
|
|
1757
|
-
return builder;
|
|
1758
|
-
},
|
|
1759
|
-
addAsyncThunk(asyncThunk, reducers) {
|
|
1760
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1761
|
-
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
1762
|
-
}
|
|
1763
|
-
if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
|
|
1764
|
-
if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
|
|
1765
|
-
if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
|
|
1766
|
-
if (reducers.settled) actionMatchers.push({
|
|
1767
|
-
matcher: asyncThunk.settled,
|
|
1768
|
-
reducer: reducers.settled
|
|
1769
|
-
});
|
|
1770
|
-
return builder;
|
|
1771
|
-
},
|
|
1772
|
-
addMatcher(matcher, reducer) {
|
|
1773
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1774
|
-
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1775
|
-
}
|
|
1776
|
-
actionMatchers.push({
|
|
1777
|
-
matcher,
|
|
1778
|
-
reducer
|
|
1779
|
-
});
|
|
1780
|
-
return builder;
|
|
1781
|
-
},
|
|
1782
|
-
addDefaultCase(reducer) {
|
|
1783
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1784
|
-
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
1785
|
-
}
|
|
1786
|
-
defaultCaseReducer = reducer;
|
|
1787
|
-
return builder;
|
|
1788
|
-
}
|
|
1789
|
-
};
|
|
1790
|
-
builderCallback(builder);
|
|
1791
|
-
return [
|
|
1792
|
-
actionsMap,
|
|
1793
|
-
actionMatchers,
|
|
1794
|
-
defaultCaseReducer
|
|
1795
|
-
];
|
|
1796
|
-
}
|
|
1797
|
-
function isStateFunction(x) {
|
|
1798
|
-
return typeof x === "function";
|
|
1799
|
-
}
|
|
1800
|
-
function createReducer(initialState, mapOrBuilderCallback) {
|
|
1801
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1802
|
-
if (typeof mapOrBuilderCallback === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1803
|
-
}
|
|
1804
|
-
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
1805
|
-
let getInitialState;
|
|
1806
|
-
if (isStateFunction(initialState)) getInitialState = () => freezeDraftable(initialState());
|
|
1807
|
-
else {
|
|
1808
|
-
const frozenInitialState = freezeDraftable(initialState);
|
|
1809
|
-
getInitialState = () => frozenInitialState;
|
|
1810
|
-
}
|
|
1811
|
-
function reducer(state = getInitialState(), action) {
|
|
1812
|
-
let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({ matcher }) => matcher(action)).map(({ reducer: reducer2 }) => reducer2)];
|
|
1813
|
-
if (caseReducers.filter((cr) => !!cr).length === 0) caseReducers = [finalDefaultCaseReducer];
|
|
1814
|
-
return caseReducers.reduce((previousState, caseReducer) => {
|
|
1815
|
-
if (caseReducer) if (isDraft(previousState)) {
|
|
1816
|
-
const result = caseReducer(previousState, action);
|
|
1817
|
-
if (result === void 0) return previousState;
|
|
1818
|
-
return result;
|
|
1819
|
-
} else if (!isDraftable(previousState)) {
|
|
1820
|
-
const result = caseReducer(previousState, action);
|
|
1821
|
-
if (result === void 0) {
|
|
1822
|
-
if (previousState === null) return previousState;
|
|
1823
|
-
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
1824
|
-
}
|
|
1825
|
-
return result;
|
|
1826
|
-
} else return produce(previousState, (draft) => {
|
|
1827
|
-
return caseReducer(draft, action);
|
|
1828
|
-
});
|
|
1829
|
-
return previousState;
|
|
1830
|
-
}, state);
|
|
1831
|
-
}
|
|
1832
|
-
reducer.getInitialState = getInitialState;
|
|
1833
|
-
return reducer;
|
|
1834
|
-
}
|
|
1835
|
-
var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
1836
|
-
function getType(slice, actionKey) {
|
|
1837
|
-
return `${slice}/${actionKey}`;
|
|
1838
|
-
}
|
|
1839
|
-
function buildCreateSlice({ creators } = {}) {
|
|
1840
|
-
const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
|
|
1841
|
-
return function createSlice2(options) {
|
|
1842
|
-
const { name, reducerPath = name } = options;
|
|
1843
|
-
if (!name) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
1844
|
-
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1845
|
-
if (options.initialState === void 0) console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
1846
|
-
}
|
|
1847
|
-
const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
|
|
1848
|
-
const reducerNames = Object.keys(reducers);
|
|
1849
|
-
const context = {
|
|
1850
|
-
sliceCaseReducersByName: {},
|
|
1851
|
-
sliceCaseReducersByType: {},
|
|
1852
|
-
actionCreators: {},
|
|
1853
|
-
sliceMatchers: []
|
|
1854
|
-
};
|
|
1855
|
-
const contextMethods = {
|
|
1856
|
-
addCase(typeOrActionCreator, reducer2) {
|
|
1857
|
-
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1858
|
-
if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
|
|
1859
|
-
if (type in context.sliceCaseReducersByType) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
1860
|
-
context.sliceCaseReducersByType[type] = reducer2;
|
|
1861
|
-
return contextMethods;
|
|
1862
|
-
},
|
|
1863
|
-
addMatcher(matcher, reducer2) {
|
|
1864
|
-
context.sliceMatchers.push({
|
|
1865
|
-
matcher,
|
|
1866
|
-
reducer: reducer2
|
|
1867
|
-
});
|
|
1868
|
-
return contextMethods;
|
|
1869
|
-
},
|
|
1870
|
-
exposeAction(name2, actionCreator) {
|
|
1871
|
-
context.actionCreators[name2] = actionCreator;
|
|
1872
|
-
return contextMethods;
|
|
1873
|
-
},
|
|
1874
|
-
exposeCaseReducer(name2, reducer2) {
|
|
1875
|
-
context.sliceCaseReducersByName[name2] = reducer2;
|
|
1876
|
-
return contextMethods;
|
|
1877
|
-
}
|
|
1878
|
-
};
|
|
1879
|
-
reducerNames.forEach((reducerName) => {
|
|
1880
|
-
const reducerDefinition = reducers[reducerName];
|
|
1881
|
-
const reducerDetails = {
|
|
1882
|
-
reducerName,
|
|
1883
|
-
type: getType(name, reducerName),
|
|
1884
|
-
createNotation: typeof options.reducers === "function"
|
|
1885
|
-
};
|
|
1886
|
-
if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
|
|
1887
|
-
else handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
|
|
1888
|
-
});
|
|
1889
|
-
function buildReducer() {
|
|
1890
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1891
|
-
if (typeof options.extraReducers === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
1892
|
-
}
|
|
1893
|
-
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
1894
|
-
const finalCaseReducers = {
|
|
1895
|
-
...extraReducers,
|
|
1896
|
-
...context.sliceCaseReducersByType
|
|
1897
|
-
};
|
|
1898
|
-
return createReducer(options.initialState, (builder) => {
|
|
1899
|
-
for (let key in finalCaseReducers) builder.addCase(key, finalCaseReducers[key]);
|
|
1900
|
-
for (let sM of context.sliceMatchers) builder.addMatcher(sM.matcher, sM.reducer);
|
|
1901
|
-
for (let m of actionMatchers) builder.addMatcher(m.matcher, m.reducer);
|
|
1902
|
-
if (defaultCaseReducer) builder.addDefaultCase(defaultCaseReducer);
|
|
1903
|
-
});
|
|
1904
|
-
}
|
|
1905
|
-
const selectSelf = (state) => state;
|
|
1906
|
-
const injectedSelectorCache = /* @__PURE__ */ new Map();
|
|
1907
|
-
const injectedStateCache = /* @__PURE__ */ new WeakMap();
|
|
1908
|
-
let _reducer;
|
|
1909
|
-
function reducer(state, action) {
|
|
1910
|
-
if (!_reducer) _reducer = buildReducer();
|
|
1911
|
-
return _reducer(state, action);
|
|
1912
|
-
}
|
|
1913
|
-
function getInitialState() {
|
|
1914
|
-
if (!_reducer) _reducer = buildReducer();
|
|
1915
|
-
return _reducer.getInitialState();
|
|
1916
|
-
}
|
|
1917
|
-
function makeSelectorProps(reducerPath2, injected = false) {
|
|
1918
|
-
function selectSlice(state) {
|
|
1919
|
-
let sliceState = state[reducerPath2];
|
|
1920
|
-
if (typeof sliceState === "undefined") {
|
|
1921
|
-
if (injected) sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
1922
|
-
else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1923
|
-
}
|
|
1924
|
-
return sliceState;
|
|
1925
|
-
}
|
|
1926
|
-
function getSelectors(selectState = selectSelf) {
|
|
1927
|
-
return getOrInsertComputed(getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap()), selectState, () => {
|
|
1928
|
-
const map = {};
|
|
1929
|
-
for (const [name2, selector] of Object.entries(options.selectors ?? {})) map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
|
|
1930
|
-
return map;
|
|
1931
|
-
});
|
|
1932
|
-
}
|
|
1933
|
-
return {
|
|
1934
|
-
reducerPath: reducerPath2,
|
|
1935
|
-
getSelectors,
|
|
1936
|
-
get selectors() {
|
|
1937
|
-
return getSelectors(selectSlice);
|
|
1938
|
-
},
|
|
1939
|
-
selectSlice
|
|
1940
|
-
};
|
|
1941
|
-
}
|
|
1942
|
-
const slice = {
|
|
1943
|
-
name,
|
|
1944
|
-
reducer,
|
|
1945
|
-
actions: context.actionCreators,
|
|
1946
|
-
caseReducers: context.sliceCaseReducersByName,
|
|
1947
|
-
getInitialState,
|
|
1948
|
-
...makeSelectorProps(reducerPath),
|
|
1949
|
-
injectInto(injectable, { reducerPath: pathOpt, ...config } = {}) {
|
|
1950
|
-
const newReducerPath = pathOpt ?? reducerPath;
|
|
1951
|
-
injectable.inject({
|
|
1952
|
-
reducerPath: newReducerPath,
|
|
1953
|
-
reducer
|
|
1954
|
-
}, config);
|
|
1955
|
-
return {
|
|
1956
|
-
...slice,
|
|
1957
|
-
...makeSelectorProps(newReducerPath, true)
|
|
1958
|
-
};
|
|
1959
|
-
}
|
|
1960
|
-
};
|
|
1961
|
-
return slice;
|
|
1962
|
-
};
|
|
1963
|
-
}
|
|
1964
|
-
function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
1965
|
-
function wrapper(rootState, ...args) {
|
|
1966
|
-
let sliceState = selectState(rootState);
|
|
1967
|
-
if (typeof sliceState === "undefined") {
|
|
1968
|
-
if (injected) sliceState = getInitialState();
|
|
1969
|
-
else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1970
|
-
}
|
|
1971
|
-
return selector(sliceState, ...args);
|
|
1972
|
-
}
|
|
1973
|
-
wrapper.unwrapped = selector;
|
|
1974
|
-
return wrapper;
|
|
1975
|
-
}
|
|
1976
|
-
var createSlice = /* @__PURE__ */ buildCreateSlice();
|
|
1977
|
-
function buildReducerCreators() {
|
|
1978
|
-
function asyncThunk(payloadCreator, config) {
|
|
1979
|
-
return {
|
|
1980
|
-
_reducerDefinitionType: "asyncThunk",
|
|
1981
|
-
payloadCreator,
|
|
1982
|
-
...config
|
|
1983
|
-
};
|
|
1984
|
-
}
|
|
1985
|
-
asyncThunk.withTypes = () => asyncThunk;
|
|
1986
|
-
return {
|
|
1987
|
-
reducer(caseReducer) {
|
|
1988
|
-
return Object.assign({ [caseReducer.name](...args) {
|
|
1989
|
-
return caseReducer(...args);
|
|
1990
|
-
} }[caseReducer.name], { _reducerDefinitionType: "reducer" });
|
|
1991
|
-
},
|
|
1992
|
-
preparedReducer(prepare, reducer) {
|
|
1993
|
-
return {
|
|
1994
|
-
_reducerDefinitionType: "reducerWithPrepare",
|
|
1995
|
-
prepare,
|
|
1996
|
-
reducer
|
|
1997
|
-
};
|
|
1998
|
-
},
|
|
1999
|
-
asyncThunk
|
|
2000
|
-
};
|
|
2001
|
-
}
|
|
2002
|
-
function handleNormalReducerDefinition({ type, reducerName, createNotation }, maybeReducerWithPrepare, context) {
|
|
2003
|
-
let caseReducer;
|
|
2004
|
-
let prepareCallback;
|
|
2005
|
-
if ("reducer" in maybeReducerWithPrepare) {
|
|
2006
|
-
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2007
|
-
caseReducer = maybeReducerWithPrepare.reducer;
|
|
2008
|
-
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
2009
|
-
} else caseReducer = maybeReducerWithPrepare;
|
|
2010
|
-
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
2011
|
-
}
|
|
2012
|
-
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
2013
|
-
return reducerDefinition._reducerDefinitionType === "asyncThunk";
|
|
2014
|
-
}
|
|
2015
|
-
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
2016
|
-
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
2017
|
-
}
|
|
2018
|
-
function handleThunkCaseReducerDefinition({ type, reducerName }, reducerDefinition, context, cAT) {
|
|
2019
|
-
if (!cAT) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
2020
|
-
const { payloadCreator, fulfilled, pending, rejected, settled, options } = reducerDefinition;
|
|
2021
|
-
const thunk = cAT(type, payloadCreator, options);
|
|
2022
|
-
context.exposeAction(reducerName, thunk);
|
|
2023
|
-
if (fulfilled) context.addCase(thunk.fulfilled, fulfilled);
|
|
2024
|
-
if (pending) context.addCase(thunk.pending, pending);
|
|
2025
|
-
if (rejected) context.addCase(thunk.rejected, rejected);
|
|
2026
|
-
if (settled) context.addMatcher(thunk.settled, settled);
|
|
2027
|
-
context.exposeCaseReducer(reducerName, {
|
|
2028
|
-
fulfilled: fulfilled || noop$3,
|
|
2029
|
-
pending: pending || noop$3,
|
|
2030
|
-
rejected: rejected || noop$3,
|
|
2031
|
-
settled: settled || noop$3
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
function noop$3() {}
|
|
2035
|
-
var listener = "listener";
|
|
2036
|
-
var completed = "completed";
|
|
2037
|
-
var cancelled = "cancelled";
|
|
2038
|
-
`${cancelled}`;
|
|
2039
|
-
`${completed}`;
|
|
2040
|
-
`${listener}${cancelled}`;
|
|
2041
|
-
`${listener}${completed}`;
|
|
2042
|
-
var { assign: assign$1 } = Object;
|
|
2043
|
-
var alm = "listenerMiddleware";
|
|
2044
|
-
var addListener$1 = /* @__PURE__ */ assign$1(/* @__PURE__ */ createAction(`${alm}/add`), { withTypes: () => addListener$1 });
|
|
2045
|
-
`${alm}`;
|
|
2046
|
-
var removeListener$1 = /* @__PURE__ */ assign$1(/* @__PURE__ */ createAction(`${alm}/remove`), { withTypes: () => removeListener$1 });
|
|
2047
|
-
function formatProdErrorMessage(code) {
|
|
2048
|
-
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2049
|
-
}
|
|
2050
38
|
//#endregion
|
|
2051
39
|
//#region src/videoPlayerLibrary/shared/redux/slices/controllerSlice.ts
|
|
2052
40
|
var ControllerSliceState = {
|
|
@@ -83896,7 +81884,7 @@ var VideoPlayer = ({ params }) => {
|
|
|
83896
81884
|
//#endregion
|
|
83897
81885
|
//#region src/videoPlayerLibrary/videoPlayerLibrary.tsx
|
|
83898
81886
|
var VideoPlayerLibrary = ({ params }) => {
|
|
83899
|
-
return /* @__PURE__ */ jsx(
|
|
81887
|
+
return /* @__PURE__ */ jsx(Provider, {
|
|
83900
81888
|
store,
|
|
83901
81889
|
children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(VideoPlayer, { params }) }) })
|
|
83902
81890
|
});
|