nolo-cli 0.30.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{_executeModel-VBHHG7LT.js → _executeModel-MYLWE5K2.js} +31 -30
- package/{action-FENWPT3C.js → action-P5NVIGGG.js} +7 -7
- package/{addContentAction-Z5S5ZQ7I.js → addContentAction-V2QQUJ32.js} +6 -6
- package/{addDialogAgentAction-VUNVD2XR.js → addDialogAgentAction-536QKJ6L.js} +5 -5
- package/{agentDeleteCommand-LLGZXUYJ.js → agentDeleteCommand-RIILFDSH.js} +24 -23
- package/{agentEmailCommands-LC2FPN6G.js → agentEmailCommands-KWJ5CUHY.js} +36 -35
- package/{agentListCommands-A6OBQ3QX.js → agentListCommands-BZZSDNCU.js} +26 -25
- package/{agentMachineCommands-4O4Q5B5X.js → agentMachineCommands-Q7LS3LQH.js} +24 -23
- package/{agentRecordCommands-W22RIQRV.js → agentRecordCommands-SJUBM3AJ.js} +35 -34
- package/{agentRunCommand-V4OBU4FB.js → agentRunCommand-6O2VTHXQ.js} +35 -34
- package/{agentRuntimeLocal-I57YSGH4.js → agentRuntimeLocal-43ZQHP35.js} +21 -20
- package/{agentSlice-3ZHY7RAO.js → agentSlice-JLADUWUP.js} +6 -6
- package/{appDeleteCommands-DJJF466K.js → appDeleteCommands-4UNQSSWN.js} +25 -24
- package/{appDeployCommands-WJZGIOEZ.js → appDeployCommands-KG2BZXOG.js} +25 -24
- package/{appDeployStatusCommands-ICYXUJNO.js → appDeployStatusCommands-KF7DF2YA.js} +25 -24
- package/{appGetCommands-UOCWYJPV.js → appGetCommands-QPHSEE5N.js} +25 -24
- package/{appListCommands-EOKWTXPW.js → appListCommands-F3EP542I.js} +25 -24
- package/{authCommand-H5KE7K7K.js → authCommand-YLP77TMC.js} +5 -5
- package/{chunk-IZ3CBMD5.js → chunk-2U6OW2C3.js} +4 -4
- package/{chunk-R5V5G73M.js → chunk-5RDLGLAP.js} +0 -1
- package/{chunk-TJYWZ3LO.js → chunk-75XQT73Q.js} +2 -2
- package/{chunk-7CD24PU4.js → chunk-B4HGX366.js} +6 -6
- package/{chunk-KWKD3BCC.js → chunk-BSMTXN5T.js} +11 -11
- package/{chunk-MMCVBEAD.js → chunk-D6K6XCUJ.js} +25 -23
- package/{chunk-A4JDTA5T.js → chunk-DFPTW7QE.js} +6 -6
- package/{chunk-YWGSCF37.js → chunk-DWZMXGKK.js} +1 -1
- package/{chunk-ZFTCLBEX.js → chunk-E5WZMGFH.js} +417 -237
- package/{chunk-DCWBP2O7.js → chunk-EAKXD6CA.js} +10 -10
- package/{chunk-VSTUQGLT.js → chunk-ECHKECDC.js} +170 -42
- package/{chunk-QLV2GKU5.js → chunk-FCHECEX7.js} +7 -5
- package/{chunk-DWQNDGO7.js → chunk-FD6FKCDH.js} +2 -2
- package/{chunk-GAGUBI42.js → chunk-GD5XAUJ3.js} +5 -5
- package/{chunk-VP4WJWKW.js → chunk-GM6PU7B6.js} +431 -345
- package/{chunk-KW47OSRJ.js → chunk-HC73BU6M.js} +50 -70
- package/{chunk-3LY4F7SV.js → chunk-INZZJSQF.js} +348 -331
- package/{chunk-G6VITLCZ.js → chunk-IT7IN5AX.js} +2 -2
- package/{chunk-Q24P6TUS.js → chunk-JQFRQWGN.js} +1 -1
- package/{chunk-FS5TTXPS.js → chunk-JZTOEZJ4.js} +4 -4
- package/{chunk-UKC5HU2C.js → chunk-KHYNTGOT.js} +5 -5
- package/{chunk-MEUZFIAJ.js → chunk-KMGSN747.js} +1 -1
- package/{chunk-CV6I4HBA.js → chunk-KR6G42Z2.js} +1 -1
- package/{chunk-HI7QZNWX.js → chunk-KU6JXKVW.js} +4 -4
- package/{chunk-2XM5KUNE.js → chunk-LE5PV7CF.js} +2 -2
- package/{chunk-SWOTB2TX.js → chunk-LOZF4FBI.js} +43 -36
- package/{chunk-66O5MZYH.js → chunk-MZIHJGB5.js} +1 -1
- package/{chunk-T3Y5EMJS.js → chunk-N6F6HKEE.js} +1 -1
- package/{chunk-DI6MXJK5.js → chunk-NHOV2D4N.js} +16 -14
- package/{chunk-HLG6GAUD.js → chunk-NLEEVJZU.js} +1 -1
- package/{chunk-446VANPP.js → chunk-OJE3M2CY.js} +4 -4
- package/{chunk-DKRT67FG.js → chunk-OMR6FM26.js} +3 -3
- package/{chunk-GVKTKT3O.js → chunk-ORCLFNKB.js} +3 -3
- package/{chunk-BOL2D2JW.js → chunk-QGSD46W6.js} +2 -2
- package/{chunk-L3VQOVKK.js → chunk-R3YEGS4D.js} +3 -3
- package/{chunk-56IUA7RU.js → chunk-RXGTXWYH.js} +1 -1
- package/{chunk-UTQZ73QQ.js → chunk-SVZ6MSA3.js} +1 -1
- package/{chunk-YLADSPDU.js → chunk-U2I2DYUD.js} +2 -2
- package/chunk-UD4A2FNM.js +7923 -0
- package/{chunk-OYK7PA5U.js → chunk-UEH4ANWR.js} +6 -6
- package/chunk-UUNZE2KQ.js +5558 -0
- package/{chunk-3RIWR23B.js → chunk-VWBCW4JY.js} +1 -1
- package/{chunk-SZ5CBYMZ.js → chunk-W427FQJD.js} +2 -2
- package/{chunk-W2YKDXT7.js → chunk-XBACY73D.js} +1 -1
- package/{chunk-G5JHHUAK.js → chunk-XD6JM3SC.js} +1 -1
- package/{chunk-XD5NQEOH.js → chunk-ZIKG63EC.js} +1 -1
- package/{clipboardy-BVE3LVEH.js → clipboardy-MMBYVRLF.js} +166 -372
- package/{createAgentAutomationAction-3GMH6ORX.js → createAgentAutomationAction-B6ZSNUUI.js} +12 -11
- package/{createDialogAction-R5MCL4RE.js → createDialogAction-G34J7HP5.js} +13 -12
- package/{createPageAction-QYTG656R.js → createPageAction-KL4OCNNH.js} +14 -13
- package/{dbSlice-OBV7VFCF.js → dbSlice-6IRTSQLA.js} +5 -5
- package/{deleteFile-AC45HYSM.js → deleteFile-TSEW36N4.js} +3 -3
- package/{dialogCommands-NUQGIXVZ.js → dialogCommands-PHH75OPO.js} +25 -24
- package/{dialogSlice-CFDECXEU.js → dialogSlice-2B5AGZXL.js} +11 -11
- package/{docCreateCommands-UNFCXB5N.js → docCreateCommands-2EZAGRNU.js} +24 -23
- package/{docDeleteCommands-NG5IVKE5.js → docDeleteCommands-ZYL2JBF2.js} +25 -24
- package/{docReadCommands-6J7MUUX6.js → docReadCommands-Q5HGLLRZ.js} +24 -23
- package/{docStore-MZZWJM4F.js → docStore-CCQWPWYV.js} +13 -12
- package/{docUpdateCommands-6AW3VZOX.js → docUpdateCommands-KGOPINTR.js} +24 -23
- package/{getPricing-XQYSSVV6.js → getPricing-6FIKFX4A.js} +2 -2
- package/{handleSendMessageAction-IU2QNTLM.js → handleSendMessageAction-TS5MF7R4.js} +11 -11
- package/index.js +58 -58
- package/{lib-FYYBQIXS.js → lib-2ZTNRXR4.js} +432 -183
- package/{machineCommands-Z2QEWTHZ.js → machineCommands-4UGY53XP.js} +34 -33
- package/{machineWsRunDispatch-SJTYHZHN.js → machineWsRunDispatch-6KNOLLYI.js} +34 -33
- package/package.json +1 -1
- package/{read-QK7ZRX6G.js → read-UMWKE5D4.js} +3 -3
- package/{readDocTool-EYDMVRBL.js → readDocTool-FEHZDVEE.js} +1 -1
- package/{readlineWorkspace-EY3BPXIU.js → readlineWorkspace-7YWWGBSU.js} +97 -59
- package/{removeDialogAgentAction-TBW3UZJW.js → removeDialogAgentAction-X32EDHZX.js} +7 -7
- package/{runAgentClientLoop-N3YDLTMS.js → runAgentClientLoop-UQ23LEWR.js} +27 -26
- package/{setDialogExtraReferencesAction-Q3ANF2NR.js → setDialogExtraReferencesAction-VGI5CCSY.js} +6 -6
- package/{setPrimaryDialogAgentAction-FQ5R3EFJ.js → setPrimaryDialogAgentAction-QOFXGQT6.js} +7 -7
- package/{settingSlice-JKKV2T7O.js → settingSlice-RHSYAKFT.js} +6 -6
- package/{slateUtils-2M7MUTWX.js → slateUtils-VO2FU36K.js} +1 -1
- package/{spaceCommands-R6AEQNLG.js → spaceCommands-GH5DTWKY.js} +208 -26
- package/{spaceSlice-MCH7RLLP.js → spaceSlice-AW66HZHQ.js} +12 -11
- package/{streamAgentChatTurn-Q4U2CVMI.js → streamAgentChatTurn-TZQZFDJQ.js} +32 -30
- package/{switchDialogAgentAction-QQGVE4SL.js → switchDialogAgentAction-KX56UKUF.js} +5 -5
- package/{tableCommands-PRJNWN6Q.js → tableCommands-RJZ3V4TF.js} +1 -1
- package/{tools-Y3UBLLYW.js → tools-FO7J53WL.js} +22 -21
- package/{tuiSummaryLlmCaller-4474IBTI.js → tuiSummaryLlmCaller-OX5M2GJW.js} +3 -3
- package/{updateDialogTitleAction-3J7GH67I.js → updateDialogTitleAction-FVDTGJNA.js} +15 -13
- package/chunk-THTAR67C.js +0 -16338
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getAllServers,
|
|
3
3
|
getIsDesktopApp,
|
|
4
4
|
isAbortError
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5RDLGLAP.js";
|
|
6
6
|
import {
|
|
7
7
|
API_ENDPOINTS,
|
|
8
8
|
SERVERS,
|
|
@@ -33,8 +33,7 @@ var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelecto
|
|
|
33
33
|
let isInputSameAsOutput = false;
|
|
34
34
|
try {
|
|
35
35
|
const emptyObject = {};
|
|
36
|
-
if (resultFunc(emptyObject) === emptyObject)
|
|
37
|
-
isInputSameAsOutput = true;
|
|
36
|
+
if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true;
|
|
38
37
|
} catch {
|
|
39
38
|
}
|
|
40
39
|
if (isInputSameAsOutput) {
|
|
@@ -85,11 +84,6 @@ function assertIsFunction(func, errorMessage = `expected a function, instead rec
|
|
|
85
84
|
throw new TypeError(errorMessage);
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
|
-
function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) {
|
|
89
|
-
if (typeof object !== "object") {
|
|
90
|
-
throw new TypeError(errorMessage);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
87
|
function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
|
|
94
88
|
if (!array.every((item) => typeof item === "function")) {
|
|
95
89
|
const itemTypes = array.map(
|
|
@@ -133,8 +127,6 @@ var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
|
|
|
133
127
|
}
|
|
134
128
|
};
|
|
135
129
|
};
|
|
136
|
-
var REDUX_PROXY_LABEL = Symbol();
|
|
137
|
-
var proto = Object.getPrototypeOf({});
|
|
138
130
|
var StrongRef = class {
|
|
139
131
|
constructor(value) {
|
|
140
132
|
this.value = value;
|
|
@@ -143,7 +135,8 @@ var StrongRef = class {
|
|
|
143
135
|
return this.value;
|
|
144
136
|
}
|
|
145
137
|
};
|
|
146
|
-
var
|
|
138
|
+
var getWeakRef = () => typeof WeakRef === "undefined" ? StrongRef : WeakRef;
|
|
139
|
+
var Ref = /* @__PURE__ */ getWeakRef();
|
|
147
140
|
var UNTERMINATED = 0;
|
|
148
141
|
var TERMINATED = 1;
|
|
149
142
|
function createCacheNode() {
|
|
@@ -154,6 +147,12 @@ function createCacheNode() {
|
|
|
154
147
|
p: null
|
|
155
148
|
};
|
|
156
149
|
}
|
|
150
|
+
function maybeDeref(r) {
|
|
151
|
+
if (r instanceof Ref) {
|
|
152
|
+
return r.deref();
|
|
153
|
+
}
|
|
154
|
+
return r;
|
|
155
|
+
}
|
|
157
156
|
function weakMapMemoize(func, options = {}) {
|
|
158
157
|
let fnNode = createCacheNode();
|
|
159
158
|
const { resultEqualityCheck } = options;
|
|
@@ -198,13 +197,13 @@ function weakMapMemoize(func, options = {}) {
|
|
|
198
197
|
result = func.apply(null, arguments);
|
|
199
198
|
resultsCount++;
|
|
200
199
|
if (resultEqualityCheck) {
|
|
201
|
-
const lastResultValue = lastResult
|
|
200
|
+
const lastResultValue = maybeDeref(lastResult);
|
|
202
201
|
if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
|
|
203
202
|
result = lastResultValue;
|
|
204
203
|
resultsCount !== 0 && resultsCount--;
|
|
205
204
|
}
|
|
206
205
|
const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
|
|
207
|
-
lastResult = needsWeakRef ? new Ref(result) : result;
|
|
206
|
+
lastResult = needsWeakRef ? /* @__PURE__ */ new Ref(result) : result;
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
terminatedNode.s = TERMINATED;
|
|
@@ -248,8 +247,7 @@ function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
|
248
247
|
memoize,
|
|
249
248
|
memoizeOptions = [],
|
|
250
249
|
argsMemoize = weakMapMemoize,
|
|
251
|
-
argsMemoizeOptions = []
|
|
252
|
-
devModeChecks = {}
|
|
250
|
+
argsMemoizeOptions = []
|
|
253
251
|
} = combinedOptions;
|
|
254
252
|
const finalMemoizeOptions = ensureIsArray(memoizeOptions);
|
|
255
253
|
const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
|
|
@@ -270,6 +268,7 @@ function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
|
270
268
|
);
|
|
271
269
|
lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
|
|
272
270
|
if (process.env.NODE_ENV !== "production") {
|
|
271
|
+
const { devModeChecks = {} } = combinedOptions;
|
|
273
272
|
const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
|
|
274
273
|
if (identityFunctionCheck.shouldRun) {
|
|
275
274
|
identityFunctionCheck.run(
|
|
@@ -289,8 +288,7 @@ function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
|
289
288
|
arguments
|
|
290
289
|
);
|
|
291
290
|
}
|
|
292
|
-
if (firstRun)
|
|
293
|
-
firstRun = false;
|
|
291
|
+
if (firstRun) firstRun = false;
|
|
294
292
|
}
|
|
295
293
|
return lastResult;
|
|
296
294
|
}, ...finalArgsMemoizeOptions);
|
|
@@ -317,29 +315,6 @@ function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
|
317
315
|
return createSelector2;
|
|
318
316
|
}
|
|
319
317
|
var createSelector = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
|
|
320
|
-
var createStructuredSelector = Object.assign(
|
|
321
|
-
(inputSelectorsObject, selectorCreator = createSelector) => {
|
|
322
|
-
assertIsObject(
|
|
323
|
-
inputSelectorsObject,
|
|
324
|
-
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}`
|
|
325
|
-
);
|
|
326
|
-
const inputSelectorKeys = Object.keys(inputSelectorsObject);
|
|
327
|
-
const dependencies = inputSelectorKeys.map(
|
|
328
|
-
(key) => inputSelectorsObject[key]
|
|
329
|
-
);
|
|
330
|
-
const structuredSelector = selectorCreator(
|
|
331
|
-
dependencies,
|
|
332
|
-
(...inputSelectorResults) => {
|
|
333
|
-
return inputSelectorResults.reduce((composition, value, index) => {
|
|
334
|
-
composition[inputSelectorKeys[index]] = value;
|
|
335
|
-
return composition;
|
|
336
|
-
}, {});
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
return structuredSelector;
|
|
340
|
-
},
|
|
341
|
-
{ withTypes: () => createStructuredSelector }
|
|
342
|
-
);
|
|
343
318
|
|
|
344
319
|
// node_modules/redux/dist/redux.mjs
|
|
345
320
|
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
@@ -351,11 +326,11 @@ var ActionTypes = {
|
|
|
351
326
|
function isPlainObject(obj) {
|
|
352
327
|
if (typeof obj !== "object" || obj === null)
|
|
353
328
|
return false;
|
|
354
|
-
let
|
|
355
|
-
while (Object.getPrototypeOf(
|
|
356
|
-
|
|
329
|
+
let proto = obj;
|
|
330
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
331
|
+
proto = Object.getPrototypeOf(proto);
|
|
357
332
|
}
|
|
358
|
-
return Object.getPrototypeOf(obj) ===
|
|
333
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
359
334
|
}
|
|
360
335
|
function compose(...funcs) {
|
|
361
336
|
if (funcs.length === 0) {
|
|
@@ -408,38 +383,51 @@ var errors = process.env.NODE_ENV !== "production" ? [
|
|
|
408
383
|
function die(error, ...args) {
|
|
409
384
|
if (process.env.NODE_ENV !== "production") {
|
|
410
385
|
const e = errors[error];
|
|
411
|
-
const msg =
|
|
386
|
+
const msg = isFunction(e) ? e.apply(null, args) : e;
|
|
412
387
|
throw new Error(`[Immer] ${msg}`);
|
|
413
388
|
}
|
|
414
389
|
throw new Error(
|
|
415
390
|
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
416
391
|
);
|
|
417
392
|
}
|
|
418
|
-
var
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
393
|
+
var O = Object;
|
|
394
|
+
var getPrototypeOf = O.getPrototypeOf;
|
|
395
|
+
var CONSTRUCTOR = "constructor";
|
|
396
|
+
var PROTOTYPE = "prototype";
|
|
397
|
+
var CONFIGURABLE = "configurable";
|
|
398
|
+
var ENUMERABLE = "enumerable";
|
|
399
|
+
var WRITABLE = "writable";
|
|
400
|
+
var VALUE = "value";
|
|
401
|
+
var isDraft = (value) => !!value && !!value[DRAFT_STATE];
|
|
422
402
|
function isDraftable(value) {
|
|
423
403
|
if (!value)
|
|
424
404
|
return false;
|
|
425
|
-
return isPlainObject2(value) ||
|
|
405
|
+
return isPlainObject2(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
|
|
426
406
|
}
|
|
427
|
-
var objectCtorString =
|
|
407
|
+
var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
|
|
408
|
+
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
428
409
|
function isPlainObject2(value) {
|
|
429
|
-
if (!value ||
|
|
410
|
+
if (!value || !isObjectish(value))
|
|
430
411
|
return false;
|
|
431
|
-
const
|
|
432
|
-
if (
|
|
412
|
+
const proto = getPrototypeOf(value);
|
|
413
|
+
if (proto === null || proto === O[PROTOTYPE])
|
|
433
414
|
return true;
|
|
434
|
-
|
|
435
|
-
const Ctor = Object.hasOwnProperty.call(proto2, "constructor") && proto2.constructor;
|
|
415
|
+
const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
436
416
|
if (Ctor === Object)
|
|
437
417
|
return true;
|
|
438
|
-
|
|
418
|
+
if (!isFunction(Ctor))
|
|
419
|
+
return false;
|
|
420
|
+
let ctorString = cachedCtorStrings.get(Ctor);
|
|
421
|
+
if (ctorString === void 0) {
|
|
422
|
+
ctorString = Function.toString.call(Ctor);
|
|
423
|
+
cachedCtorStrings.set(Ctor, ctorString);
|
|
424
|
+
}
|
|
425
|
+
return ctorString === objectCtorString;
|
|
439
426
|
}
|
|
440
|
-
function each(obj, iter) {
|
|
427
|
+
function each(obj, iter, strict = true) {
|
|
441
428
|
if (getArchtype(obj) === 0) {
|
|
442
|
-
Reflect.ownKeys(obj).
|
|
429
|
+
const keys = strict ? Reflect.ownKeys(obj) : O.keys(obj);
|
|
430
|
+
keys.forEach((key) => {
|
|
443
431
|
iter(key, obj[key], obj);
|
|
444
432
|
});
|
|
445
433
|
} else {
|
|
@@ -448,20 +436,21 @@ function each(obj, iter) {
|
|
|
448
436
|
}
|
|
449
437
|
function getArchtype(thing) {
|
|
450
438
|
const state = thing[DRAFT_STATE];
|
|
451
|
-
return state ? state.type_ :
|
|
452
|
-
}
|
|
453
|
-
function has(thing, prop) {
|
|
454
|
-
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
439
|
+
return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
455
440
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
441
|
+
var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
442
|
+
var get = (thing, prop, type = getArchtype(thing)) => (
|
|
443
|
+
// @ts-ignore
|
|
444
|
+
type === 2 ? thing.get(prop) : thing[prop]
|
|
445
|
+
);
|
|
446
|
+
var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
|
|
447
|
+
if (type === 2)
|
|
459
448
|
thing.set(propOrOldValue, value);
|
|
460
|
-
else if (
|
|
449
|
+
else if (type === 3) {
|
|
461
450
|
thing.add(value);
|
|
462
451
|
} else
|
|
463
452
|
thing[propOrOldValue] = value;
|
|
464
|
-
}
|
|
453
|
+
};
|
|
465
454
|
function is(x, y) {
|
|
466
455
|
if (x === y) {
|
|
467
456
|
return x !== 0 || 1 / x === 1 / y;
|
|
@@ -469,15 +458,18 @@ function is(x, y) {
|
|
|
469
458
|
return x !== x && y !== y;
|
|
470
459
|
}
|
|
471
460
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
function
|
|
479
|
-
|
|
461
|
+
var isArray = Array.isArray;
|
|
462
|
+
var isMap = (target) => target instanceof Map;
|
|
463
|
+
var isSet = (target) => target instanceof Set;
|
|
464
|
+
var isObjectish = (target) => typeof target === "object";
|
|
465
|
+
var isFunction = (target) => typeof target === "function";
|
|
466
|
+
var isBoolean = (target) => typeof target === "boolean";
|
|
467
|
+
function isArrayIndex(value) {
|
|
468
|
+
const n = +value;
|
|
469
|
+
return Number.isInteger(n) && String(n) === value;
|
|
480
470
|
}
|
|
471
|
+
var latest = (state) => state.copy_ || state.base_;
|
|
472
|
+
var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
|
|
481
473
|
function shallowCopy(base, strict) {
|
|
482
474
|
if (isMap(base)) {
|
|
483
475
|
return new Map(base);
|
|
@@ -485,56 +477,75 @@ function shallowCopy(base, strict) {
|
|
|
485
477
|
if (isSet(base)) {
|
|
486
478
|
return new Set(base);
|
|
487
479
|
}
|
|
488
|
-
if (
|
|
489
|
-
return Array.
|
|
480
|
+
if (isArray(base))
|
|
481
|
+
return Array[PROTOTYPE].slice.call(base);
|
|
490
482
|
const isPlain = isPlainObject2(base);
|
|
491
483
|
if (strict === true || strict === "class_only" && !isPlain) {
|
|
492
|
-
const descriptors =
|
|
484
|
+
const descriptors = O.getOwnPropertyDescriptors(base);
|
|
493
485
|
delete descriptors[DRAFT_STATE];
|
|
494
486
|
let keys = Reflect.ownKeys(descriptors);
|
|
495
487
|
for (let i = 0; i < keys.length; i++) {
|
|
496
488
|
const key = keys[i];
|
|
497
489
|
const desc = descriptors[key];
|
|
498
|
-
if (desc
|
|
499
|
-
desc
|
|
500
|
-
desc
|
|
490
|
+
if (desc[WRITABLE] === false) {
|
|
491
|
+
desc[WRITABLE] = true;
|
|
492
|
+
desc[CONFIGURABLE] = true;
|
|
501
493
|
}
|
|
502
494
|
if (desc.get || desc.set)
|
|
503
495
|
descriptors[key] = {
|
|
504
|
-
|
|
505
|
-
|
|
496
|
+
[CONFIGURABLE]: true,
|
|
497
|
+
[WRITABLE]: true,
|
|
506
498
|
// could live with !!desc.set as well here...
|
|
507
|
-
|
|
508
|
-
|
|
499
|
+
[ENUMERABLE]: desc[ENUMERABLE],
|
|
500
|
+
[VALUE]: base[key]
|
|
509
501
|
};
|
|
510
502
|
}
|
|
511
|
-
return
|
|
503
|
+
return O.create(getPrototypeOf(base), descriptors);
|
|
512
504
|
} else {
|
|
513
|
-
const
|
|
514
|
-
if (
|
|
505
|
+
const proto = getPrototypeOf(base);
|
|
506
|
+
if (proto !== null && isPlain) {
|
|
515
507
|
return { ...base };
|
|
516
508
|
}
|
|
517
|
-
const obj =
|
|
518
|
-
return
|
|
509
|
+
const obj = O.create(proto);
|
|
510
|
+
return O.assign(obj, base);
|
|
519
511
|
}
|
|
520
512
|
}
|
|
521
513
|
function freeze(obj, deep = false) {
|
|
522
514
|
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
523
515
|
return obj;
|
|
524
516
|
if (getArchtype(obj) > 1) {
|
|
525
|
-
|
|
517
|
+
O.defineProperties(obj, {
|
|
518
|
+
set: dontMutateMethodOverride,
|
|
519
|
+
add: dontMutateMethodOverride,
|
|
520
|
+
clear: dontMutateMethodOverride,
|
|
521
|
+
delete: dontMutateMethodOverride
|
|
522
|
+
});
|
|
526
523
|
}
|
|
527
|
-
|
|
524
|
+
O.freeze(obj);
|
|
528
525
|
if (deep)
|
|
529
|
-
|
|
526
|
+
each(
|
|
527
|
+
obj,
|
|
528
|
+
(_key, value) => {
|
|
529
|
+
freeze(value, true);
|
|
530
|
+
},
|
|
531
|
+
false
|
|
532
|
+
);
|
|
530
533
|
return obj;
|
|
531
534
|
}
|
|
532
535
|
function dontMutateFrozenCollections() {
|
|
533
536
|
die(2);
|
|
534
537
|
}
|
|
538
|
+
var dontMutateMethodOverride = {
|
|
539
|
+
[VALUE]: dontMutateFrozenCollections
|
|
540
|
+
};
|
|
535
541
|
function isFrozen(obj) {
|
|
536
|
-
|
|
542
|
+
if (obj === null || !isObjectish(obj))
|
|
543
|
+
return true;
|
|
544
|
+
return O.isFrozen(obj);
|
|
537
545
|
}
|
|
546
|
+
var PluginMapSet = "MapSet";
|
|
547
|
+
var PluginPatches = "Patches";
|
|
548
|
+
var PluginArrayMethods = "ArrayMethods";
|
|
538
549
|
var plugins = {};
|
|
539
550
|
function getPlugin(pluginKey) {
|
|
540
551
|
const plugin = plugins[pluginKey];
|
|
@@ -543,24 +554,25 @@ function getPlugin(pluginKey) {
|
|
|
543
554
|
}
|
|
544
555
|
return plugin;
|
|
545
556
|
}
|
|
557
|
+
var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
|
|
546
558
|
var currentScope;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}
|
|
559
|
+
var getCurrentScope = () => currentScope;
|
|
560
|
+
var createScope = (parent_, immer_) => ({
|
|
561
|
+
drafts_: [],
|
|
562
|
+
parent_,
|
|
563
|
+
immer_,
|
|
564
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
565
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
566
|
+
canAutoFreeze_: true,
|
|
567
|
+
unfinalizedDrafts_: 0,
|
|
568
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
569
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
570
|
+
mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
|
|
571
|
+
arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
|
|
572
|
+
});
|
|
561
573
|
function usePatchesInScope(scope, patchListener) {
|
|
562
574
|
if (patchListener) {
|
|
563
|
-
getPlugin(
|
|
575
|
+
scope.patchPlugin_ = getPlugin(PluginPatches);
|
|
564
576
|
scope.patches_ = [];
|
|
565
577
|
scope.inversePatches_ = [];
|
|
566
578
|
scope.patchListener_ = patchListener;
|
|
@@ -576,9 +588,7 @@ function leaveScope(scope) {
|
|
|
576
588
|
currentScope = scope.parent_;
|
|
577
589
|
}
|
|
578
590
|
}
|
|
579
|
-
|
|
580
|
-
return currentScope = createScope(currentScope, immer2);
|
|
581
|
-
}
|
|
591
|
+
var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
|
|
582
592
|
function revokeDraft(draft) {
|
|
583
593
|
const state = draft[DRAFT_STATE];
|
|
584
594
|
if (state.type_ === 0 || state.type_ === 1)
|
|
@@ -597,103 +607,170 @@ function processResult(result, scope) {
|
|
|
597
607
|
}
|
|
598
608
|
if (isDraftable(result)) {
|
|
599
609
|
result = finalize(scope, result);
|
|
600
|
-
if (!scope.parent_)
|
|
601
|
-
maybeFreeze(scope, result);
|
|
602
610
|
}
|
|
603
|
-
|
|
604
|
-
|
|
611
|
+
const { patchPlugin_ } = scope;
|
|
612
|
+
if (patchPlugin_) {
|
|
613
|
+
patchPlugin_.generateReplacementPatches_(
|
|
605
614
|
baseDraft[DRAFT_STATE].base_,
|
|
606
615
|
result,
|
|
607
|
-
scope
|
|
608
|
-
scope.inversePatches_
|
|
616
|
+
scope
|
|
609
617
|
);
|
|
610
618
|
}
|
|
611
619
|
} else {
|
|
612
|
-
result = finalize(scope, baseDraft
|
|
620
|
+
result = finalize(scope, baseDraft);
|
|
613
621
|
}
|
|
622
|
+
maybeFreeze(scope, result, true);
|
|
614
623
|
revokeScope(scope);
|
|
615
624
|
if (scope.patches_) {
|
|
616
625
|
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
617
626
|
}
|
|
618
627
|
return result !== NOTHING ? result : void 0;
|
|
619
628
|
}
|
|
620
|
-
function finalize(rootScope, value
|
|
629
|
+
function finalize(rootScope, value) {
|
|
621
630
|
if (isFrozen(value))
|
|
622
631
|
return value;
|
|
623
632
|
const state = value[DRAFT_STATE];
|
|
624
633
|
if (!state) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)
|
|
628
|
-
);
|
|
629
|
-
return value;
|
|
634
|
+
const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
|
|
635
|
+
return finalValue;
|
|
630
636
|
}
|
|
631
|
-
if (state
|
|
637
|
+
if (!isSameScope(state, rootScope)) {
|
|
632
638
|
return value;
|
|
639
|
+
}
|
|
633
640
|
if (!state.modified_) {
|
|
634
|
-
maybeFreeze(rootScope, state.base_, true);
|
|
635
641
|
return state.base_;
|
|
636
642
|
}
|
|
637
643
|
if (!state.finalized_) {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
resultEach = new Set(result);
|
|
645
|
-
result.clear();
|
|
646
|
-
isSet2 = true;
|
|
647
|
-
}
|
|
648
|
-
each(
|
|
649
|
-
resultEach,
|
|
650
|
-
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)
|
|
651
|
-
);
|
|
652
|
-
maybeFreeze(rootScope, result, false);
|
|
653
|
-
if (path && rootScope.patches_) {
|
|
654
|
-
getPlugin("Patches").generatePatches_(
|
|
655
|
-
state,
|
|
656
|
-
path,
|
|
657
|
-
rootScope.patches_,
|
|
658
|
-
rootScope.inversePatches_
|
|
659
|
-
);
|
|
644
|
+
const { callbacks_ } = state;
|
|
645
|
+
if (callbacks_) {
|
|
646
|
+
while (callbacks_.length > 0) {
|
|
647
|
+
const callback = callbacks_.pop();
|
|
648
|
+
callback(rootScope);
|
|
649
|
+
}
|
|
660
650
|
}
|
|
651
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
661
652
|
}
|
|
662
653
|
return state.copy_;
|
|
663
654
|
}
|
|
664
|
-
function
|
|
665
|
-
if (
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
655
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
656
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
657
|
+
freeze(value, deep);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function markStateFinalized(state) {
|
|
661
|
+
state.finalized_ = true;
|
|
662
|
+
state.scope_.unfinalizedDrafts_--;
|
|
663
|
+
}
|
|
664
|
+
var isSameScope = (state, rootScope) => state.scope_ === rootScope;
|
|
665
|
+
var EMPTY_LOCATIONS_RESULT = [];
|
|
666
|
+
function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
|
|
667
|
+
const parentCopy = latest(parent);
|
|
668
|
+
const parentType = parent.type_;
|
|
669
|
+
if (originalKey !== void 0) {
|
|
670
|
+
const currentValue = get(parentCopy, originalKey, parentType);
|
|
671
|
+
if (currentValue === draftValue) {
|
|
672
|
+
set(parentCopy, originalKey, finalizedValue, parentType);
|
|
675
673
|
return;
|
|
676
|
-
|
|
677
|
-
targetObject.add(childValue);
|
|
674
|
+
}
|
|
678
675
|
}
|
|
679
|
-
if (
|
|
680
|
-
|
|
676
|
+
if (!parent.draftLocations_) {
|
|
677
|
+
const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
|
|
678
|
+
each(parentCopy, (key, value) => {
|
|
679
|
+
if (isDraft(value)) {
|
|
680
|
+
const keys = draftLocations.get(value) || [];
|
|
681
|
+
keys.push(key);
|
|
682
|
+
draftLocations.set(value, keys);
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
|
|
687
|
+
for (const location of locations) {
|
|
688
|
+
set(parentCopy, location, finalizedValue, parentType);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
function registerChildFinalizationCallback(parent, child, key) {
|
|
692
|
+
parent.callbacks_.push(function childCleanup(rootScope) {
|
|
693
|
+
const state = child;
|
|
694
|
+
if (!state || !isSameScope(state, rootScope)) {
|
|
681
695
|
return;
|
|
682
696
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
697
|
+
rootScope.mapSetPlugin_?.fixSetContents(state);
|
|
698
|
+
const finalizedValue = getFinalValue(state);
|
|
699
|
+
updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
|
|
700
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
function generatePatchesAndFinalize(state, rootScope) {
|
|
704
|
+
const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);
|
|
705
|
+
if (shouldFinalize) {
|
|
706
|
+
const { patchPlugin_ } = rootScope;
|
|
707
|
+
if (patchPlugin_) {
|
|
708
|
+
const basePath = patchPlugin_.getPath(state);
|
|
709
|
+
if (basePath) {
|
|
710
|
+
patchPlugin_.generatePatches_(state, basePath, rootScope);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
markStateFinalized(state);
|
|
686
714
|
}
|
|
687
715
|
}
|
|
688
|
-
function
|
|
689
|
-
|
|
690
|
-
|
|
716
|
+
function handleCrossReference(target, key, value) {
|
|
717
|
+
const { scope_ } = target;
|
|
718
|
+
if (isDraft(value)) {
|
|
719
|
+
const state = value[DRAFT_STATE];
|
|
720
|
+
if (isSameScope(state, scope_)) {
|
|
721
|
+
state.callbacks_.push(function crossReferenceCleanup() {
|
|
722
|
+
prepareCopy(target);
|
|
723
|
+
const finalizedValue = getFinalValue(state);
|
|
724
|
+
updateDraftInParent(target, value, finalizedValue, key);
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
} else if (isDraftable(value)) {
|
|
728
|
+
target.callbacks_.push(function nestedDraftCleanup() {
|
|
729
|
+
const targetCopy = latest(target);
|
|
730
|
+
if (target.type_ === 3) {
|
|
731
|
+
if (targetCopy.has(value)) {
|
|
732
|
+
handleValue(value, scope_.handledSet_, scope_);
|
|
733
|
+
}
|
|
734
|
+
} else {
|
|
735
|
+
if (get(targetCopy, key, target.type_) === value) {
|
|
736
|
+
if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) {
|
|
737
|
+
handleValue(
|
|
738
|
+
get(target.copy_, key, target.type_),
|
|
739
|
+
scope_.handledSet_,
|
|
740
|
+
scope_
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
});
|
|
691
746
|
}
|
|
692
747
|
}
|
|
748
|
+
function handleValue(target, handledSet, rootScope) {
|
|
749
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
750
|
+
return target;
|
|
751
|
+
}
|
|
752
|
+
if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) {
|
|
753
|
+
return target;
|
|
754
|
+
}
|
|
755
|
+
handledSet.add(target);
|
|
756
|
+
each(target, (key, value) => {
|
|
757
|
+
if (isDraft(value)) {
|
|
758
|
+
const state = value[DRAFT_STATE];
|
|
759
|
+
if (isSameScope(state, rootScope)) {
|
|
760
|
+
const updatedValue = getFinalValue(state);
|
|
761
|
+
set(target, key, updatedValue, target.type_);
|
|
762
|
+
markStateFinalized(state);
|
|
763
|
+
}
|
|
764
|
+
} else if (isDraftable(value)) {
|
|
765
|
+
handleValue(value, handledSet, rootScope);
|
|
766
|
+
}
|
|
767
|
+
});
|
|
768
|
+
return target;
|
|
769
|
+
}
|
|
693
770
|
function createProxyProxy(base, parent) {
|
|
694
|
-
const
|
|
771
|
+
const baseIsArray = isArray(base);
|
|
695
772
|
const state = {
|
|
696
|
-
type_:
|
|
773
|
+
type_: baseIsArray ? 1 : 0,
|
|
697
774
|
// Track which produce call this is associated with.
|
|
698
775
|
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
699
776
|
// True for both shallow and deep changes.
|
|
@@ -701,7 +778,8 @@ function createProxyProxy(base, parent) {
|
|
|
701
778
|
// Used during finalization.
|
|
702
779
|
finalized_: false,
|
|
703
780
|
// Track which properties have been assigned (true) or deleted (false).
|
|
704
|
-
|
|
781
|
+
// actually instantiated in `prepareCopy()`
|
|
782
|
+
assigned_: void 0,
|
|
705
783
|
// The parent draft state.
|
|
706
784
|
parent_: parent,
|
|
707
785
|
// The base state.
|
|
@@ -713,34 +791,50 @@ function createProxyProxy(base, parent) {
|
|
|
713
791
|
copy_: null,
|
|
714
792
|
// Called by the `produce` function.
|
|
715
793
|
revoke_: null,
|
|
716
|
-
isManual_: false
|
|
794
|
+
isManual_: false,
|
|
795
|
+
// `callbacks` actually gets assigned in `createProxy`
|
|
796
|
+
callbacks_: void 0
|
|
717
797
|
};
|
|
718
798
|
let target = state;
|
|
719
799
|
let traps = objectTraps;
|
|
720
|
-
if (
|
|
800
|
+
if (baseIsArray) {
|
|
721
801
|
target = [state];
|
|
722
802
|
traps = arrayTraps;
|
|
723
803
|
}
|
|
724
804
|
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
725
805
|
state.draft_ = proxy;
|
|
726
806
|
state.revoke_ = revoke;
|
|
727
|
-
return proxy;
|
|
807
|
+
return [proxy, state];
|
|
728
808
|
}
|
|
729
809
|
var objectTraps = {
|
|
730
810
|
get(state, prop) {
|
|
731
811
|
if (prop === DRAFT_STATE)
|
|
732
812
|
return state;
|
|
813
|
+
let arrayPlugin = state.scope_.arrayMethodsPlugin_;
|
|
814
|
+
const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
|
|
815
|
+
if (isArrayWithStringProp) {
|
|
816
|
+
if (arrayPlugin?.isArrayOperationMethod(prop)) {
|
|
817
|
+
return arrayPlugin.createMethodInterceptor(state, prop);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
733
820
|
const source = latest(state);
|
|
734
|
-
if (!has(source, prop)) {
|
|
821
|
+
if (!has(source, prop, state.type_)) {
|
|
735
822
|
return readPropFromProto(state, source, prop);
|
|
736
823
|
}
|
|
737
824
|
const value = source[prop];
|
|
738
825
|
if (state.finalized_ || !isDraftable(value)) {
|
|
739
826
|
return value;
|
|
740
827
|
}
|
|
741
|
-
if (
|
|
828
|
+
if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(
|
|
829
|
+
state.operationMethod
|
|
830
|
+
) && isArrayIndex(prop)) {
|
|
831
|
+
return value;
|
|
832
|
+
}
|
|
833
|
+
if (value === peek(state.base_, prop) || isRelocatedBaseRef(state, prop, value)) {
|
|
742
834
|
prepareCopy(state);
|
|
743
|
-
|
|
835
|
+
const childKey = state.type_ === 1 ? +prop : prop;
|
|
836
|
+
const childDraft = createProxy(state.scope_, value, state, childKey);
|
|
837
|
+
return state.copy_[childKey] = childDraft;
|
|
744
838
|
}
|
|
745
839
|
return value;
|
|
746
840
|
},
|
|
@@ -761,29 +855,30 @@ var objectTraps = {
|
|
|
761
855
|
const currentState = current2?.[DRAFT_STATE];
|
|
762
856
|
if (currentState && currentState.base_ === value) {
|
|
763
857
|
state.copy_[prop] = value;
|
|
764
|
-
state.assigned_
|
|
858
|
+
state.assigned_.set(prop, false);
|
|
765
859
|
return true;
|
|
766
860
|
}
|
|
767
|
-
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
861
|
+
if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
|
|
768
862
|
return true;
|
|
769
863
|
prepareCopy(state);
|
|
770
864
|
markChanged(state);
|
|
771
865
|
}
|
|
772
866
|
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
773
|
-
(value !== void 0 || prop
|
|
867
|
+
(value !== void 0 || has(state.copy_, prop, state.type_)) || // special case: NaN
|
|
774
868
|
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
775
869
|
return true;
|
|
776
870
|
state.copy_[prop] = value;
|
|
777
|
-
state.assigned_
|
|
871
|
+
state.assigned_.set(prop, true);
|
|
872
|
+
handleCrossReference(state, prop, value);
|
|
778
873
|
return true;
|
|
779
874
|
},
|
|
780
875
|
deleteProperty(state, prop) {
|
|
876
|
+
prepareCopy(state);
|
|
781
877
|
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
782
|
-
state.assigned_
|
|
783
|
-
prepareCopy(state);
|
|
878
|
+
state.assigned_.set(prop, false);
|
|
784
879
|
markChanged(state);
|
|
785
880
|
} else {
|
|
786
|
-
|
|
881
|
+
state.assigned_.delete(prop);
|
|
787
882
|
}
|
|
788
883
|
if (state.copy_) {
|
|
789
884
|
delete state.copy_[prop];
|
|
@@ -798,10 +893,10 @@ var objectTraps = {
|
|
|
798
893
|
if (!desc)
|
|
799
894
|
return desc;
|
|
800
895
|
return {
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
896
|
+
[WRITABLE]: true,
|
|
897
|
+
[CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
|
|
898
|
+
[ENUMERABLE]: desc[ENUMERABLE],
|
|
899
|
+
[VALUE]: owner[prop]
|
|
805
900
|
};
|
|
806
901
|
},
|
|
807
902
|
defineProperty() {
|
|
@@ -815,12 +910,14 @@ var objectTraps = {
|
|
|
815
910
|
}
|
|
816
911
|
};
|
|
817
912
|
var arrayTraps = {};
|
|
818
|
-
|
|
913
|
+
for (let key in objectTraps) {
|
|
914
|
+
let fn = objectTraps[key];
|
|
819
915
|
arrayTraps[key] = function() {
|
|
820
|
-
|
|
821
|
-
|
|
916
|
+
const args = arguments;
|
|
917
|
+
args[0] = args[0][0];
|
|
918
|
+
return fn.apply(this, args);
|
|
822
919
|
};
|
|
823
|
-
}
|
|
920
|
+
}
|
|
824
921
|
arrayTraps.deleteProperty = function(state, prop) {
|
|
825
922
|
if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
|
|
826
923
|
die(13);
|
|
@@ -836,9 +933,15 @@ function peek(draft, prop) {
|
|
|
836
933
|
const source = state ? latest(state) : draft;
|
|
837
934
|
return source[prop];
|
|
838
935
|
}
|
|
936
|
+
function isRelocatedBaseRef(state, prop, value) {
|
|
937
|
+
if (state.type_ !== 1 || !state.allIndicesReassigned_ || state.assigned_?.get(prop) || !isDraftable(value) || value[DRAFT_STATE]) {
|
|
938
|
+
return false;
|
|
939
|
+
}
|
|
940
|
+
return state.baseRefs_.has(value);
|
|
941
|
+
}
|
|
839
942
|
function readPropFromProto(state, source, prop) {
|
|
840
943
|
const desc = getDescriptorFromProto(source, prop);
|
|
841
|
-
return desc ?
|
|
944
|
+
return desc ? VALUE in desc ? desc[VALUE] : (
|
|
842
945
|
// This is a very special case, if the prop is a getter defined by the
|
|
843
946
|
// prototype, we should invoke it with the draft as context!
|
|
844
947
|
desc.get?.call(state.draft_)
|
|
@@ -847,12 +950,12 @@ function readPropFromProto(state, source, prop) {
|
|
|
847
950
|
function getDescriptorFromProto(source, prop) {
|
|
848
951
|
if (!(prop in source))
|
|
849
952
|
return void 0;
|
|
850
|
-
let
|
|
851
|
-
while (
|
|
852
|
-
const desc = Object.getOwnPropertyDescriptor(
|
|
953
|
+
let proto = getPrototypeOf(source);
|
|
954
|
+
while (proto) {
|
|
955
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
853
956
|
if (desc)
|
|
854
957
|
return desc;
|
|
855
|
-
|
|
958
|
+
proto = getPrototypeOf(proto);
|
|
856
959
|
}
|
|
857
960
|
return void 0;
|
|
858
961
|
}
|
|
@@ -866,6 +969,7 @@ function markChanged(state) {
|
|
|
866
969
|
}
|
|
867
970
|
function prepareCopy(state) {
|
|
868
971
|
if (!state.copy_) {
|
|
972
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
869
973
|
state.copy_ = shallowCopy(
|
|
870
974
|
state.base_,
|
|
871
975
|
state.scope_.immer_.useStrictShallowCopy_
|
|
@@ -876,8 +980,9 @@ var Immer2 = class {
|
|
|
876
980
|
constructor(config) {
|
|
877
981
|
this.autoFreeze_ = true;
|
|
878
982
|
this.useStrictShallowCopy_ = false;
|
|
983
|
+
this.useStrictIteration_ = false;
|
|
879
984
|
this.produce = (base, recipe, patchListener) => {
|
|
880
|
-
if (
|
|
985
|
+
if (isFunction(base) && !isFunction(recipe)) {
|
|
881
986
|
const defaultBase = recipe;
|
|
882
987
|
recipe = base;
|
|
883
988
|
const self = this;
|
|
@@ -885,14 +990,14 @@ var Immer2 = class {
|
|
|
885
990
|
return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
886
991
|
};
|
|
887
992
|
}
|
|
888
|
-
if (
|
|
993
|
+
if (!isFunction(recipe))
|
|
889
994
|
die(6);
|
|
890
|
-
if (patchListener !== void 0 &&
|
|
995
|
+
if (patchListener !== void 0 && !isFunction(patchListener))
|
|
891
996
|
die(7);
|
|
892
997
|
let result;
|
|
893
998
|
if (isDraftable(base)) {
|
|
894
999
|
const scope = enterScope(this);
|
|
895
|
-
const proxy = createProxy(base, void 0);
|
|
1000
|
+
const proxy = createProxy(scope, base, void 0);
|
|
896
1001
|
let hasError = true;
|
|
897
1002
|
try {
|
|
898
1003
|
result = recipe(proxy);
|
|
@@ -905,7 +1010,7 @@ var Immer2 = class {
|
|
|
905
1010
|
}
|
|
906
1011
|
usePatchesInScope(scope, patchListener);
|
|
907
1012
|
return processResult(result, scope);
|
|
908
|
-
} else if (!base ||
|
|
1013
|
+
} else if (!base || !isObjectish(base)) {
|
|
909
1014
|
result = recipe(base);
|
|
910
1015
|
if (result === void 0)
|
|
911
1016
|
result = base;
|
|
@@ -916,7 +1021,10 @@ var Immer2 = class {
|
|
|
916
1021
|
if (patchListener) {
|
|
917
1022
|
const p = [];
|
|
918
1023
|
const ip = [];
|
|
919
|
-
getPlugin(
|
|
1024
|
+
getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
|
|
1025
|
+
patches_: p,
|
|
1026
|
+
inversePatches_: ip
|
|
1027
|
+
});
|
|
920
1028
|
patchListener(p, ip);
|
|
921
1029
|
}
|
|
922
1030
|
return result;
|
|
@@ -924,7 +1032,7 @@ var Immer2 = class {
|
|
|
924
1032
|
die(1, base);
|
|
925
1033
|
};
|
|
926
1034
|
this.produceWithPatches = (base, recipe) => {
|
|
927
|
-
if (
|
|
1035
|
+
if (isFunction(base)) {
|
|
928
1036
|
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
929
1037
|
}
|
|
930
1038
|
let patches, inversePatches;
|
|
@@ -934,10 +1042,12 @@ var Immer2 = class {
|
|
|
934
1042
|
});
|
|
935
1043
|
return [result, patches, inversePatches];
|
|
936
1044
|
};
|
|
937
|
-
if (
|
|
1045
|
+
if (isBoolean(config?.autoFreeze))
|
|
938
1046
|
this.setAutoFreeze(config.autoFreeze);
|
|
939
|
-
if (
|
|
1047
|
+
if (isBoolean(config?.useStrictShallowCopy))
|
|
940
1048
|
this.setUseStrictShallowCopy(config.useStrictShallowCopy);
|
|
1049
|
+
if (isBoolean(config?.useStrictIteration))
|
|
1050
|
+
this.setUseStrictIteration(config.useStrictIteration);
|
|
941
1051
|
}
|
|
942
1052
|
createDraft(base) {
|
|
943
1053
|
if (!isDraftable(base))
|
|
@@ -945,7 +1055,7 @@ var Immer2 = class {
|
|
|
945
1055
|
if (isDraft(base))
|
|
946
1056
|
base = current(base);
|
|
947
1057
|
const scope = enterScope(this);
|
|
948
|
-
const proxy = createProxy(base, void 0);
|
|
1058
|
+
const proxy = createProxy(scope, base, void 0);
|
|
949
1059
|
proxy[DRAFT_STATE].isManual_ = true;
|
|
950
1060
|
leaveScope(scope);
|
|
951
1061
|
return proxy;
|
|
@@ -974,6 +1084,18 @@ var Immer2 = class {
|
|
|
974
1084
|
setUseStrictShallowCopy(value) {
|
|
975
1085
|
this.useStrictShallowCopy_ = value;
|
|
976
1086
|
}
|
|
1087
|
+
/**
|
|
1088
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
1089
|
+
* but still handles symbols for compatibility.
|
|
1090
|
+
*
|
|
1091
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
1092
|
+
*/
|
|
1093
|
+
setUseStrictIteration(value) {
|
|
1094
|
+
this.useStrictIteration_ = value;
|
|
1095
|
+
}
|
|
1096
|
+
shouldUseStrictIteration() {
|
|
1097
|
+
return this.useStrictIteration_;
|
|
1098
|
+
}
|
|
977
1099
|
applyPatches(base, patches) {
|
|
978
1100
|
let i;
|
|
979
1101
|
for (i = patches.length - 1; i >= 0; i--) {
|
|
@@ -986,7 +1108,7 @@ var Immer2 = class {
|
|
|
986
1108
|
if (i > -1) {
|
|
987
1109
|
patches = patches.slice(i + 1);
|
|
988
1110
|
}
|
|
989
|
-
const applyPatchesImpl = getPlugin(
|
|
1111
|
+
const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
|
|
990
1112
|
if (isDraft(base)) {
|
|
991
1113
|
return applyPatchesImpl(base, patches);
|
|
992
1114
|
}
|
|
@@ -996,10 +1118,23 @@ var Immer2 = class {
|
|
|
996
1118
|
);
|
|
997
1119
|
}
|
|
998
1120
|
};
|
|
999
|
-
function createProxy(value, parent) {
|
|
1000
|
-
const draft = isMap(value) ? getPlugin(
|
|
1001
|
-
const scope = parent
|
|
1121
|
+
function createProxy(rootScope, value, parent, key) {
|
|
1122
|
+
const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
1123
|
+
const scope = parent?.scope_ ?? getCurrentScope();
|
|
1002
1124
|
scope.drafts_.push(draft);
|
|
1125
|
+
state.callbacks_ = parent?.callbacks_ ?? [];
|
|
1126
|
+
state.key_ = key;
|
|
1127
|
+
if (parent && key !== void 0) {
|
|
1128
|
+
registerChildFinalizationCallback(parent, state, key);
|
|
1129
|
+
} else {
|
|
1130
|
+
state.callbacks_.push(function rootDraftCleanup(rootScope2) {
|
|
1131
|
+
rootScope2.mapSetPlugin_?.fixSetContents(state);
|
|
1132
|
+
const { patchPlugin_ } = rootScope2;
|
|
1133
|
+
if (state.modified_ && patchPlugin_) {
|
|
1134
|
+
patchPlugin_.generatePatches_(state, [], rootScope2);
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
}
|
|
1003
1138
|
return draft;
|
|
1004
1139
|
}
|
|
1005
1140
|
function current(value) {
|
|
@@ -1012,17 +1147,23 @@ function currentImpl(value) {
|
|
|
1012
1147
|
return value;
|
|
1013
1148
|
const state = value[DRAFT_STATE];
|
|
1014
1149
|
let copy;
|
|
1150
|
+
let strict = true;
|
|
1015
1151
|
if (state) {
|
|
1016
1152
|
if (!state.modified_)
|
|
1017
1153
|
return state.base_;
|
|
1018
1154
|
state.finalized_ = true;
|
|
1019
1155
|
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
1156
|
+
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
1020
1157
|
} else {
|
|
1021
1158
|
copy = shallowCopy(value, true);
|
|
1022
1159
|
}
|
|
1023
|
-
each(
|
|
1024
|
-
|
|
1025
|
-
|
|
1160
|
+
each(
|
|
1161
|
+
copy,
|
|
1162
|
+
(key, childValue) => {
|
|
1163
|
+
set(copy, key, currentImpl(childValue));
|
|
1164
|
+
},
|
|
1165
|
+
strict
|
|
1166
|
+
);
|
|
1026
1167
|
if (state) {
|
|
1027
1168
|
state.finalized_ = false;
|
|
1028
1169
|
}
|
|
@@ -1030,14 +1171,6 @@ function currentImpl(value) {
|
|
|
1030
1171
|
}
|
|
1031
1172
|
var immer = new Immer2();
|
|
1032
1173
|
var produce = immer.produce;
|
|
1033
|
-
var produceWithPatches = immer.produceWithPatches.bind(
|
|
1034
|
-
immer
|
|
1035
|
-
);
|
|
1036
|
-
var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
1037
|
-
var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer);
|
|
1038
|
-
var applyPatches = immer.applyPatches.bind(immer);
|
|
1039
|
-
var createDraft = immer.createDraft.bind(immer);
|
|
1040
|
-
var finishDraft = immer.finishDraft.bind(immer);
|
|
1041
1174
|
|
|
1042
1175
|
// node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
|
|
1043
1176
|
var createDraftSafeSelectorCreator = (...args) => {
|
|
@@ -1132,6 +1265,21 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1132
1265
|
actionsMap[type] = reducer;
|
|
1133
1266
|
return builder;
|
|
1134
1267
|
},
|
|
1268
|
+
addAsyncThunk(asyncThunk, reducers) {
|
|
1269
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1270
|
+
if (defaultCaseReducer) {
|
|
1271
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
|
|
1275
|
+
if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
|
|
1276
|
+
if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
|
|
1277
|
+
if (reducers.settled) actionMatchers.push({
|
|
1278
|
+
matcher: asyncThunk.settled,
|
|
1279
|
+
reducer: reducers.settled
|
|
1280
|
+
});
|
|
1281
|
+
return builder;
|
|
1282
|
+
},
|
|
1135
1283
|
addMatcher(matcher, reducer) {
|
|
1136
1284
|
if (process.env.NODE_ENV !== "production") {
|
|
1137
1285
|
if (defaultCaseReducer) {
|
|
@@ -1240,6 +1388,8 @@ var RejectWithValue = class {
|
|
|
1240
1388
|
this.payload = payload;
|
|
1241
1389
|
this.meta = meta;
|
|
1242
1390
|
}
|
|
1391
|
+
payload;
|
|
1392
|
+
meta;
|
|
1243
1393
|
/*
|
|
1244
1394
|
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
1245
1395
|
does not exist at runtime
|
|
@@ -1251,6 +1401,8 @@ var FulfillWithMeta = class {
|
|
|
1251
1401
|
this.payload = payload;
|
|
1252
1402
|
this.meta = meta;
|
|
1253
1403
|
}
|
|
1404
|
+
payload;
|
|
1405
|
+
meta;
|
|
1254
1406
|
/*
|
|
1255
1407
|
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
1256
1408
|
does not exist at runtime
|
|
@@ -1271,6 +1423,7 @@ var miniSerializeError = (value) => {
|
|
|
1271
1423
|
message: String(value)
|
|
1272
1424
|
};
|
|
1273
1425
|
};
|
|
1426
|
+
var externalAbortMessage = "External signal was aborted";
|
|
1274
1427
|
var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
1275
1428
|
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
1276
1429
|
const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
|
|
@@ -1304,7 +1457,9 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1304
1457
|
condition: error?.name === "ConditionError"
|
|
1305
1458
|
}
|
|
1306
1459
|
}));
|
|
1307
|
-
function actionCreator(arg
|
|
1460
|
+
function actionCreator(arg, {
|
|
1461
|
+
signal
|
|
1462
|
+
} = {}) {
|
|
1308
1463
|
return (dispatch, getState, extra) => {
|
|
1309
1464
|
const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();
|
|
1310
1465
|
const abortController = new AbortController();
|
|
@@ -1314,6 +1469,15 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1314
1469
|
abortReason = reason;
|
|
1315
1470
|
abortController.abort();
|
|
1316
1471
|
}
|
|
1472
|
+
if (signal) {
|
|
1473
|
+
if (signal.aborted) {
|
|
1474
|
+
abort(externalAbortMessage);
|
|
1475
|
+
} else {
|
|
1476
|
+
signal.addEventListener("abort", () => abort(externalAbortMessage), {
|
|
1477
|
+
once: true
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1317
1481
|
const promise = async function() {
|
|
1318
1482
|
let finalAction;
|
|
1319
1483
|
try {
|
|
@@ -1337,7 +1501,9 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1337
1501
|
message: abortReason || "Aborted"
|
|
1338
1502
|
});
|
|
1339
1503
|
};
|
|
1340
|
-
abortController.signal.addEventListener("abort", abortHandler
|
|
1504
|
+
abortController.signal.addEventListener("abort", abortHandler, {
|
|
1505
|
+
once: true
|
|
1506
|
+
});
|
|
1341
1507
|
});
|
|
1342
1508
|
dispatch(pending(requestId, arg, options?.getPendingMeta?.({
|
|
1343
1509
|
requestId,
|
|
@@ -1515,6 +1681,7 @@ function buildCreateSlice({
|
|
|
1515
1681
|
}
|
|
1516
1682
|
const selectSelf = (state) => state;
|
|
1517
1683
|
const injectedSelectorCache = /* @__PURE__ */ new Map();
|
|
1684
|
+
const injectedStateCache = /* @__PURE__ */ new WeakMap();
|
|
1518
1685
|
let _reducer;
|
|
1519
1686
|
function reducer(state, action) {
|
|
1520
1687
|
if (!_reducer) _reducer = buildReducer();
|
|
@@ -1529,7 +1696,7 @@ function buildCreateSlice({
|
|
|
1529
1696
|
let sliceState = state[reducerPath2];
|
|
1530
1697
|
if (typeof sliceState === "undefined") {
|
|
1531
1698
|
if (injected) {
|
|
1532
|
-
sliceState = getInitialState
|
|
1699
|
+
sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
1533
1700
|
} else if (process.env.NODE_ENV !== "production") {
|
|
1534
1701
|
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1535
1702
|
}
|
|
@@ -1541,7 +1708,7 @@ function buildCreateSlice({
|
|
|
1541
1708
|
return getOrInsertComputed(selectorCache, selectState, () => {
|
|
1542
1709
|
const map = {};
|
|
1543
1710
|
for (const [name2, selector] of Object.entries(options.selectors ?? {})) {
|
|
1544
|
-
map[name2] = wrapSelector(selector, selectState, getInitialState, injected);
|
|
1711
|
+
map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
|
|
1545
1712
|
}
|
|
1546
1713
|
return map;
|
|
1547
1714
|
});
|
|
@@ -1784,15 +1951,17 @@ function splitAddedUpdatedEntities(newEntities, selectId, state) {
|
|
|
1784
1951
|
const existingIdsArray = getCurrent(state.ids);
|
|
1785
1952
|
const existingIds = new Set(existingIdsArray);
|
|
1786
1953
|
const added = [];
|
|
1954
|
+
const addedIds = /* @__PURE__ */ new Set([]);
|
|
1787
1955
|
const updated = [];
|
|
1788
1956
|
for (const entity of newEntities) {
|
|
1789
1957
|
const id = selectIdValue(entity, selectId);
|
|
1790
|
-
if (existingIds.has(id)) {
|
|
1958
|
+
if (existingIds.has(id) || addedIds.has(id)) {
|
|
1791
1959
|
updated.push({
|
|
1792
1960
|
id,
|
|
1793
1961
|
changes: entity
|
|
1794
1962
|
});
|
|
1795
1963
|
} else {
|
|
1964
|
+
addedIds.add(id);
|
|
1796
1965
|
added.push(entity);
|
|
1797
1966
|
}
|
|
1798
1967
|
}
|
|
@@ -1903,8 +2072,8 @@ function createUnsortedStateAdapter(selectId) {
|
|
|
1903
2072
|
}
|
|
1904
2073
|
function upsertManyMutably(newEntities, state) {
|
|
1905
2074
|
const [added, updated] = splitAddedUpdatedEntities(newEntities, selectId, state);
|
|
1906
|
-
updateManyMutably(updated, state);
|
|
1907
2075
|
addManyMutably(added, state);
|
|
2076
|
+
updateManyMutably(updated, state);
|
|
1908
2077
|
}
|
|
1909
2078
|
return {
|
|
1910
2079
|
removeAll: createSingleArgumentStateOperator(removeAllMutably),
|
|
@@ -1953,7 +2122,13 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
1953
2122
|
function addManyMutably(newEntities, state, existingIds) {
|
|
1954
2123
|
newEntities = ensureEntitiesArray(newEntities);
|
|
1955
2124
|
const existingKeys = new Set(existingIds ?? getCurrent(state.ids));
|
|
1956
|
-
const
|
|
2125
|
+
const addedKeys = /* @__PURE__ */ new Set();
|
|
2126
|
+
const models = newEntities.filter((model) => {
|
|
2127
|
+
const modelId = selectIdValue(model, selectId);
|
|
2128
|
+
const notAdded = !addedKeys.has(modelId);
|
|
2129
|
+
if (notAdded) addedKeys.add(modelId);
|
|
2130
|
+
return !existingKeys.has(modelId) && notAdded;
|
|
2131
|
+
});
|
|
1957
2132
|
if (models.length !== 0) {
|
|
1958
2133
|
mergeFunction(state, models);
|
|
1959
2134
|
}
|
|
@@ -1962,11 +2137,15 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
1962
2137
|
return setManyMutably([entity], state);
|
|
1963
2138
|
}
|
|
1964
2139
|
function setManyMutably(newEntities, state) {
|
|
2140
|
+
let deduplicatedEntities = {};
|
|
1965
2141
|
newEntities = ensureEntitiesArray(newEntities);
|
|
1966
2142
|
if (newEntities.length !== 0) {
|
|
1967
2143
|
for (const item of newEntities) {
|
|
1968
|
-
|
|
2144
|
+
const entityId = selectId(item);
|
|
2145
|
+
deduplicatedEntities[entityId] = item;
|
|
2146
|
+
delete state.entities[entityId];
|
|
1969
2147
|
}
|
|
2148
|
+
newEntities = ensureEntitiesArray(deduplicatedEntities);
|
|
1970
2149
|
mergeFunction(state, newEntities);
|
|
1971
2150
|
}
|
|
1972
2151
|
}
|
|
@@ -2007,12 +2186,12 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2007
2186
|
}
|
|
2008
2187
|
function upsertManyMutably(newEntities, state) {
|
|
2009
2188
|
const [added, updated, existingIdsArray] = splitAddedUpdatedEntities(newEntities, selectId, state);
|
|
2010
|
-
if (updated.length) {
|
|
2011
|
-
updateManyMutably(updated, state);
|
|
2012
|
-
}
|
|
2013
2189
|
if (added.length) {
|
|
2014
2190
|
addManyMutably(added, state, existingIdsArray);
|
|
2015
2191
|
}
|
|
2192
|
+
if (updated.length) {
|
|
2193
|
+
updateManyMutably(updated, state);
|
|
2194
|
+
}
|
|
2016
2195
|
}
|
|
2017
2196
|
function areArraysEqual(a, b) {
|
|
2018
2197
|
if (a.length !== b.length) {
|
|
@@ -2111,7 +2290,6 @@ var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
|
|
|
2111
2290
|
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
|
|
2112
2291
|
withTypes: () => removeListener
|
|
2113
2292
|
});
|
|
2114
|
-
var ORIGINAL_STATE = Symbol.for("rtk-state-proxy-original");
|
|
2115
2293
|
function formatProdErrorMessage(code) {
|
|
2116
2294
|
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. `;
|
|
2117
2295
|
}
|
|
@@ -2128,6 +2306,7 @@ var selectIdentityToken = (state) => {
|
|
|
2128
2306
|
return void 0;
|
|
2129
2307
|
};
|
|
2130
2308
|
var selectIdentityUser = (state) => LOCAL_USER;
|
|
2309
|
+
var selectIdentityUserBalance = (state) => void 0;
|
|
2131
2310
|
|
|
2132
2311
|
// packages/app/stateViews/runtime.ts
|
|
2133
2312
|
var selectCurrentToken = (state) => {
|
|
@@ -3035,6 +3214,7 @@ export {
|
|
|
3035
3214
|
selectIdentityUserId,
|
|
3036
3215
|
selectIdentityToken,
|
|
3037
3216
|
selectIdentityUser,
|
|
3217
|
+
selectIdentityUserBalance,
|
|
3038
3218
|
selectRuntimeSnapshot,
|
|
3039
3219
|
selectRuntimeCurrentServer,
|
|
3040
3220
|
getRuntimeServerContext,
|