@equinor/roma-framework 5.0.0-beta.0 → 5.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/dev-portal/package.json +1 -1
- package/dev-portal/roma-framework.umd.js +1494 -642
- package/package.json +1 -1
|
@@ -30493,9 +30493,9 @@
|
|
|
30493
30493
|
{
|
|
30494
30494
|
onScheduleRoot(container, element);
|
|
30495
30495
|
}
|
|
30496
|
-
var current$
|
|
30496
|
+
var current$12 = container.current;
|
|
30497
30497
|
var eventTime = requestEventTime();
|
|
30498
|
-
var lane = requestUpdateLane(current$
|
|
30498
|
+
var lane = requestUpdateLane(current$12);
|
|
30499
30499
|
{
|
|
30500
30500
|
markRenderScheduled(lane);
|
|
30501
30501
|
}
|
|
@@ -30524,10 +30524,10 @@
|
|
|
30524
30524
|
}
|
|
30525
30525
|
update.callback = callback;
|
|
30526
30526
|
}
|
|
30527
|
-
var root2 = enqueueUpdate(current$
|
|
30527
|
+
var root2 = enqueueUpdate(current$12, update, lane);
|
|
30528
30528
|
if (root2 !== null) {
|
|
30529
|
-
scheduleUpdateOnFiber(root2, current$
|
|
30530
|
-
entangleTransitions(root2, current$
|
|
30529
|
+
scheduleUpdateOnFiber(root2, current$12, lane, eventTime);
|
|
30530
|
+
entangleTransitions(root2, current$12, lane);
|
|
30531
30531
|
}
|
|
30532
30532
|
return lane;
|
|
30533
30533
|
}
|
|
@@ -33540,7 +33540,7 @@
|
|
|
33540
33540
|
var e2 = new Error(message);
|
|
33541
33541
|
return e2.name = "SuppressedError", e2.error = error2, e2.suppressed = suppressed, e2;
|
|
33542
33542
|
};
|
|
33543
|
-
function isFunction$
|
|
33543
|
+
function isFunction$2(value) {
|
|
33544
33544
|
return typeof value === "function";
|
|
33545
33545
|
}
|
|
33546
33546
|
function createErrorClass(createImpl) {
|
|
@@ -33604,7 +33604,7 @@
|
|
|
33604
33604
|
}
|
|
33605
33605
|
}
|
|
33606
33606
|
var initialFinalizer = this.initialTeardown;
|
|
33607
|
-
if (isFunction$
|
|
33607
|
+
if (isFunction$2(initialFinalizer)) {
|
|
33608
33608
|
try {
|
|
33609
33609
|
initialFinalizer();
|
|
33610
33610
|
} catch (e2) {
|
|
@@ -33691,10 +33691,10 @@
|
|
|
33691
33691
|
})();
|
|
33692
33692
|
var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
|
|
33693
33693
|
function isSubscription(value) {
|
|
33694
|
-
return value instanceof Subscription || value && "closed" in value && isFunction$
|
|
33694
|
+
return value instanceof Subscription || value && "closed" in value && isFunction$2(value.remove) && isFunction$2(value.add) && isFunction$2(value.unsubscribe);
|
|
33695
33695
|
}
|
|
33696
33696
|
function execFinalizer(finalizer) {
|
|
33697
|
-
if (isFunction$
|
|
33697
|
+
if (isFunction$2(finalizer)) {
|
|
33698
33698
|
finalizer();
|
|
33699
33699
|
} else {
|
|
33700
33700
|
finalizer.unsubscribe();
|
|
@@ -33837,7 +33837,7 @@
|
|
|
33837
33837
|
function SafeSubscriber2(observerOrNext, error2, complete) {
|
|
33838
33838
|
var _this = _super.call(this) || this;
|
|
33839
33839
|
var partialObserver;
|
|
33840
|
-
if (isFunction$
|
|
33840
|
+
if (isFunction$2(observerOrNext) || !observerOrNext) {
|
|
33841
33841
|
partialObserver = {
|
|
33842
33842
|
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0,
|
|
33843
33843
|
error: error2 !== null && error2 !== void 0 ? error2 : void 0,
|
|
@@ -33971,13 +33971,13 @@
|
|
|
33971
33971
|
return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config$1.Promise) !== null && _a !== void 0 ? _a : Promise;
|
|
33972
33972
|
}
|
|
33973
33973
|
function isObserver(value) {
|
|
33974
|
-
return value && isFunction$
|
|
33974
|
+
return value && isFunction$2(value.next) && isFunction$2(value.error) && isFunction$2(value.complete);
|
|
33975
33975
|
}
|
|
33976
33976
|
function isSubscriber(value) {
|
|
33977
33977
|
return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);
|
|
33978
33978
|
}
|
|
33979
33979
|
function hasLift(source) {
|
|
33980
|
-
return isFunction$
|
|
33980
|
+
return isFunction$2(source === null || source === void 0 ? void 0 : source.lift);
|
|
33981
33981
|
}
|
|
33982
33982
|
function operate(init2) {
|
|
33983
33983
|
return function(source) {
|
|
@@ -34464,13 +34464,13 @@
|
|
|
34464
34464
|
return subscriber.complete();
|
|
34465
34465
|
});
|
|
34466
34466
|
function isScheduler(value) {
|
|
34467
|
-
return value && isFunction$
|
|
34467
|
+
return value && isFunction$2(value.schedule);
|
|
34468
34468
|
}
|
|
34469
34469
|
function last$1(arr) {
|
|
34470
34470
|
return arr[arr.length - 1];
|
|
34471
34471
|
}
|
|
34472
34472
|
function popResultSelector(args) {
|
|
34473
|
-
return isFunction$
|
|
34473
|
+
return isFunction$2(last$1(args)) ? args.pop() : void 0;
|
|
34474
34474
|
}
|
|
34475
34475
|
function popScheduler(args) {
|
|
34476
34476
|
return isScheduler(last$1(args)) ? args.pop() : void 0;
|
|
@@ -34482,13 +34482,13 @@
|
|
|
34482
34482
|
return x2 && typeof x2.length === "number" && typeof x2 !== "function";
|
|
34483
34483
|
});
|
|
34484
34484
|
function isPromise$1(value) {
|
|
34485
|
-
return isFunction$
|
|
34485
|
+
return isFunction$2(value === null || value === void 0 ? void 0 : value.then);
|
|
34486
34486
|
}
|
|
34487
34487
|
function isInteropObservable(input) {
|
|
34488
|
-
return isFunction$
|
|
34488
|
+
return isFunction$2(input[observable]);
|
|
34489
34489
|
}
|
|
34490
34490
|
function isAsyncIterable(obj) {
|
|
34491
|
-
return Symbol.asyncIterator && isFunction$
|
|
34491
|
+
return Symbol.asyncIterator && isFunction$2(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);
|
|
34492
34492
|
}
|
|
34493
34493
|
function createInvalidObservableTypeError(input) {
|
|
34494
34494
|
return new TypeError("You provided " + (input !== null && typeof input === "object" ? "an invalid object" : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.");
|
|
@@ -34501,7 +34501,7 @@
|
|
|
34501
34501
|
}
|
|
34502
34502
|
var iterator = getSymbolIterator();
|
|
34503
34503
|
function isIterable$1(input) {
|
|
34504
|
-
return isFunction$
|
|
34504
|
+
return isFunction$2(input === null || input === void 0 ? void 0 : input[iterator]);
|
|
34505
34505
|
}
|
|
34506
34506
|
function readableStreamLikeToAsyncGenerator(readableStream) {
|
|
34507
34507
|
return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() {
|
|
@@ -34541,7 +34541,7 @@
|
|
|
34541
34541
|
});
|
|
34542
34542
|
}
|
|
34543
34543
|
function isReadableStreamLike(obj) {
|
|
34544
|
-
return isFunction$
|
|
34544
|
+
return isFunction$2(obj === null || obj === void 0 ? void 0 : obj.getReader);
|
|
34545
34545
|
}
|
|
34546
34546
|
function innerFrom(input) {
|
|
34547
34547
|
if (input instanceof Observable) {
|
|
@@ -34572,7 +34572,7 @@
|
|
|
34572
34572
|
function fromInteropObservable(obj) {
|
|
34573
34573
|
return new Observable(function(subscriber) {
|
|
34574
34574
|
var obs = obj[observable]();
|
|
34575
|
-
if (isFunction$
|
|
34575
|
+
if (isFunction$2(obs.subscribe)) {
|
|
34576
34576
|
return obs.subscribe(subscriber);
|
|
34577
34577
|
}
|
|
34578
34578
|
throw new TypeError("Provided object does not correctly implement Symbol.observable");
|
|
@@ -34775,7 +34775,7 @@
|
|
|
34775
34775
|
}, 0, true);
|
|
34776
34776
|
});
|
|
34777
34777
|
return function() {
|
|
34778
|
-
return isFunction$
|
|
34778
|
+
return isFunction$2(iterator$1 === null || iterator$1 === void 0 ? void 0 : iterator$1.return) && iterator$1.return();
|
|
34779
34779
|
};
|
|
34780
34780
|
});
|
|
34781
34781
|
}
|
|
@@ -34836,7 +34836,7 @@
|
|
|
34836
34836
|
return from$1(args, scheduler2);
|
|
34837
34837
|
}
|
|
34838
34838
|
function throwError(errorOrErrorFactory, scheduler2) {
|
|
34839
|
-
var errorFactory = isFunction$
|
|
34839
|
+
var errorFactory = isFunction$2(errorOrErrorFactory) ? errorOrErrorFactory : function() {
|
|
34840
34840
|
return errorOrErrorFactory;
|
|
34841
34841
|
};
|
|
34842
34842
|
var init2 = function(subscriber) {
|
|
@@ -34845,7 +34845,7 @@
|
|
|
34845
34845
|
return new Observable(init2);
|
|
34846
34846
|
}
|
|
34847
34847
|
function isObservable(obj) {
|
|
34848
|
-
return !!obj && (obj instanceof Observable || isFunction$
|
|
34848
|
+
return !!obj && (obj instanceof Observable || isFunction$2(obj.lift) && isFunction$2(obj.subscribe));
|
|
34849
34849
|
}
|
|
34850
34850
|
var EmptyError = createErrorClass(function(_super) {
|
|
34851
34851
|
return function EmptyErrorImpl() {
|
|
@@ -34960,21 +34960,21 @@
|
|
|
34960
34960
|
}));
|
|
34961
34961
|
});
|
|
34962
34962
|
}
|
|
34963
|
-
var isArray$
|
|
34963
|
+
var isArray$3 = Array.isArray;
|
|
34964
34964
|
function callOrApply(fn, args) {
|
|
34965
|
-
return isArray$
|
|
34965
|
+
return isArray$3(args) ? fn.apply(void 0, __spreadArray([], __read$1(args))) : fn(args);
|
|
34966
34966
|
}
|
|
34967
34967
|
function mapOneOrManyArgs(fn) {
|
|
34968
34968
|
return map$1(function(args) {
|
|
34969
34969
|
return callOrApply(fn, args);
|
|
34970
34970
|
});
|
|
34971
34971
|
}
|
|
34972
|
-
var isArray$
|
|
34973
|
-
var getPrototypeOf$
|
|
34972
|
+
var isArray$2 = Array.isArray;
|
|
34973
|
+
var getPrototypeOf$2 = Object.getPrototypeOf, objectProto = Object.prototype, getKeys = Object.keys;
|
|
34974
34974
|
function argsArgArrayOrObject(args) {
|
|
34975
34975
|
if (args.length === 1) {
|
|
34976
34976
|
var first_1 = args[0];
|
|
34977
|
-
if (isArray$
|
|
34977
|
+
if (isArray$2(first_1)) {
|
|
34978
34978
|
return { args: first_1, keys: null };
|
|
34979
34979
|
}
|
|
34980
34980
|
if (isPOJO(first_1)) {
|
|
@@ -34990,7 +34990,7 @@
|
|
|
34990
34990
|
return { args, keys: null };
|
|
34991
34991
|
}
|
|
34992
34992
|
function isPOJO(obj) {
|
|
34993
|
-
return obj && typeof obj === "object" && getPrototypeOf$
|
|
34993
|
+
return obj && typeof obj === "object" && getPrototypeOf$2(obj) === objectProto;
|
|
34994
34994
|
}
|
|
34995
34995
|
function createObject(keys, values) {
|
|
34996
34996
|
return keys.reduce(function(result, key, i2) {
|
|
@@ -35115,7 +35115,7 @@
|
|
|
35115
35115
|
if (concurrent === void 0) {
|
|
35116
35116
|
concurrent = Infinity;
|
|
35117
35117
|
}
|
|
35118
|
-
if (isFunction$
|
|
35118
|
+
if (isFunction$2(resultSelector)) {
|
|
35119
35119
|
return mergeMap(function(a2, i2) {
|
|
35120
35120
|
return map$1(function(b2, ii) {
|
|
35121
35121
|
return resultSelector(a2, b2, i2, ii);
|
|
@@ -35148,7 +35148,7 @@
|
|
|
35148
35148
|
var eventTargetMethods = ["addEventListener", "removeEventListener"];
|
|
35149
35149
|
var jqueryMethods = ["on", "off"];
|
|
35150
35150
|
function fromEvent(target2, eventName, options, resultSelector) {
|
|
35151
|
-
if (isFunction$
|
|
35151
|
+
if (isFunction$2(options)) {
|
|
35152
35152
|
resultSelector = options;
|
|
35153
35153
|
options = void 0;
|
|
35154
35154
|
}
|
|
@@ -35192,13 +35192,13 @@
|
|
|
35192
35192
|
};
|
|
35193
35193
|
}
|
|
35194
35194
|
function isNodeStyleEventEmitter(target2) {
|
|
35195
|
-
return isFunction$
|
|
35195
|
+
return isFunction$2(target2.addListener) && isFunction$2(target2.removeListener);
|
|
35196
35196
|
}
|
|
35197
35197
|
function isJQueryStyleEventEmitter(target2) {
|
|
35198
|
-
return isFunction$
|
|
35198
|
+
return isFunction$2(target2.on) && isFunction$2(target2.off);
|
|
35199
35199
|
}
|
|
35200
35200
|
function isEventTarget(target2) {
|
|
35201
|
-
return isFunction$
|
|
35201
|
+
return isFunction$2(target2.addEventListener) && isFunction$2(target2.removeEventListener);
|
|
35202
35202
|
}
|
|
35203
35203
|
function timer(dueTime, intervalOrScheduler, scheduler2) {
|
|
35204
35204
|
if (dueTime === void 0) {
|
|
@@ -35298,7 +35298,7 @@
|
|
|
35298
35298
|
return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));
|
|
35299
35299
|
}
|
|
35300
35300
|
function concatMap(project, resultSelector) {
|
|
35301
|
-
return isFunction$
|
|
35301
|
+
return isFunction$2(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);
|
|
35302
35302
|
}
|
|
35303
35303
|
function defaultIfEmpty(defaultValue) {
|
|
35304
35304
|
return operate(function(source, subscriber) {
|
|
@@ -35367,7 +35367,7 @@
|
|
|
35367
35367
|
function defaultErrorFactory() {
|
|
35368
35368
|
return new EmptyError();
|
|
35369
35369
|
}
|
|
35370
|
-
function finalize$
|
|
35370
|
+
function finalize$2(callback) {
|
|
35371
35371
|
return operate(function(source, subscriber) {
|
|
35372
35372
|
try {
|
|
35373
35373
|
source.subscribe(subscriber);
|
|
@@ -35597,7 +35597,7 @@
|
|
|
35597
35597
|
});
|
|
35598
35598
|
}
|
|
35599
35599
|
function tap(observerOrNext, error2, complete) {
|
|
35600
|
-
var tapObserver = isFunction$
|
|
35600
|
+
var tapObserver = isFunction$2(observerOrNext) || error2 || complete ? { next: observerOrNext, error: error2, complete } : observerOrNext;
|
|
35601
35601
|
return tapObserver ? operate(function(source, subscriber) {
|
|
35602
35602
|
var _a;
|
|
35603
35603
|
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
|
@@ -37705,7 +37705,7 @@
|
|
|
37705
37705
|
return false;
|
|
37706
37706
|
}
|
|
37707
37707
|
});
|
|
37708
|
-
function isPlainObject$
|
|
37708
|
+
function isPlainObject$4(o2) {
|
|
37709
37709
|
if (isObject$1(o2) === false)
|
|
37710
37710
|
return false;
|
|
37711
37711
|
const ctor = o2.constructor;
|
|
@@ -37720,7 +37720,7 @@
|
|
|
37720
37720
|
return true;
|
|
37721
37721
|
}
|
|
37722
37722
|
function shallowClone(o2) {
|
|
37723
|
-
if (isPlainObject$
|
|
37723
|
+
if (isPlainObject$4(o2))
|
|
37724
37724
|
return { ...o2 };
|
|
37725
37725
|
if (Array.isArray(o2))
|
|
37726
37726
|
return [...o2];
|
|
@@ -37903,7 +37903,7 @@
|
|
|
37903
37903
|
return clone$1(schema, def);
|
|
37904
37904
|
}
|
|
37905
37905
|
function extend(schema, shape2) {
|
|
37906
|
-
if (!isPlainObject$
|
|
37906
|
+
if (!isPlainObject$4(shape2)) {
|
|
37907
37907
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
37908
37908
|
}
|
|
37909
37909
|
const checks = schema._zod.def.checks;
|
|
@@ -37922,7 +37922,7 @@
|
|
|
37922
37922
|
return clone$1(schema, def);
|
|
37923
37923
|
}
|
|
37924
37924
|
function safeExtend(schema, shape2) {
|
|
37925
|
-
if (!isPlainObject$
|
|
37925
|
+
if (!isPlainObject$4(shape2)) {
|
|
37926
37926
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
37927
37927
|
}
|
|
37928
37928
|
const def = {
|
|
@@ -38158,7 +38158,7 @@
|
|
|
38158
38158
|
getSizableOrigin,
|
|
38159
38159
|
hexToUint8Array,
|
|
38160
38160
|
isObject: isObject$1,
|
|
38161
|
-
isPlainObject: isPlainObject$
|
|
38161
|
+
isPlainObject: isPlainObject$4,
|
|
38162
38162
|
issue,
|
|
38163
38163
|
joinValues,
|
|
38164
38164
|
jsonStringifyReplacer,
|
|
@@ -40133,7 +40133,7 @@
|
|
|
40133
40133
|
if (a2 instanceof Date && b2 instanceof Date && +a2 === +b2) {
|
|
40134
40134
|
return { valid: true, data: a2 };
|
|
40135
40135
|
}
|
|
40136
|
-
if (isPlainObject$
|
|
40136
|
+
if (isPlainObject$4(a2) && isPlainObject$4(b2)) {
|
|
40137
40137
|
const bKeys = Object.keys(b2);
|
|
40138
40138
|
const sharedKeys = Object.keys(a2).filter((key) => bKeys.indexOf(key) !== -1);
|
|
40139
40139
|
const newObj = { ...a2, ...b2 };
|
|
@@ -40263,7 +40263,7 @@
|
|
|
40263
40263
|
$ZodType.init(inst, def);
|
|
40264
40264
|
inst._zod.parse = (payload, ctx) => {
|
|
40265
40265
|
const input = payload.value;
|
|
40266
|
-
if (!isPlainObject$
|
|
40266
|
+
if (!isPlainObject$4(input)) {
|
|
40267
40267
|
payload.issues.push({
|
|
40268
40268
|
expected: "record",
|
|
40269
40269
|
code: "invalid_type",
|
|
@@ -43304,7 +43304,7 @@
|
|
|
43304
43304
|
}
|
|
43305
43305
|
};
|
|
43306
43306
|
};
|
|
43307
|
-
function is$
|
|
43307
|
+
function is$2() {
|
|
43308
43308
|
return {
|
|
43309
43309
|
localeError: error$u()
|
|
43310
43310
|
};
|
|
@@ -46519,7 +46519,7 @@
|
|
|
46519
46519
|
he: he$1,
|
|
46520
46520
|
hu,
|
|
46521
46521
|
id,
|
|
46522
|
-
is: is$
|
|
46522
|
+
is: is$2,
|
|
46523
46523
|
it,
|
|
46524
46524
|
ja,
|
|
46525
46525
|
ka,
|
|
@@ -49259,7 +49259,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
49259
49259
|
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
49260
49260
|
inst.size = (...args) => inst.check(_size(...args));
|
|
49261
49261
|
});
|
|
49262
|
-
function set$
|
|
49262
|
+
function set$3(valueType, params) {
|
|
49263
49263
|
return new ZodSet({
|
|
49264
49264
|
type: "set",
|
|
49265
49265
|
valueType,
|
|
@@ -49855,7 +49855,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
49855
49855
|
safeEncodeAsync,
|
|
49856
49856
|
safeParse,
|
|
49857
49857
|
safeParseAsync,
|
|
49858
|
-
set: set$
|
|
49858
|
+
set: set$3,
|
|
49859
49859
|
setErrorMap,
|
|
49860
49860
|
size: _size,
|
|
49861
49861
|
startsWith: _startsWith,
|
|
@@ -50304,7 +50304,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
50304
50304
|
})).pipe(
|
|
50305
50305
|
// Stop reading if the abort signal is triggered
|
|
50306
50306
|
takeUntil(options?.abortSignal ? fromEvent(options.abortSignal, "abort") : EMPTY),
|
|
50307
|
-
finalize$
|
|
50307
|
+
finalize$2(async () => {
|
|
50308
50308
|
await reader.cancel().catch(() => {
|
|
50309
50309
|
});
|
|
50310
50310
|
reader.releaseLock();
|
|
@@ -50671,10 +50671,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
50671
50671
|
config2.configureClient(name2, args);
|
|
50672
50672
|
}
|
|
50673
50673
|
});
|
|
50674
|
-
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
50675
|
-
var DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable");
|
|
50676
|
-
var DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
|
|
50677
|
-
var errors = process.env.NODE_ENV !== "production" ? [
|
|
50674
|
+
var NOTHING$1 = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
50675
|
+
var DRAFTABLE$1 = /* @__PURE__ */ Symbol.for("immer-draftable");
|
|
50676
|
+
var DRAFT_STATE$1 = /* @__PURE__ */ Symbol.for("immer-state");
|
|
50677
|
+
var errors$1 = process.env.NODE_ENV !== "production" ? [
|
|
50678
50678
|
// All error codes, starting by 0:
|
|
50679
50679
|
function(plugin) {
|
|
50680
50680
|
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
@@ -50705,48 +50705,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
50705
50705
|
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
50706
50706
|
// See Patches.ts for additional errors
|
|
50707
50707
|
] : [];
|
|
50708
|
-
function die(error2, ...args) {
|
|
50708
|
+
function die$1(error2, ...args) {
|
|
50709
50709
|
if (process.env.NODE_ENV !== "production") {
|
|
50710
|
-
const e2 = errors[error2];
|
|
50711
|
-
const msg =
|
|
50710
|
+
const e2 = errors$1[error2];
|
|
50711
|
+
const msg = isFunction$1(e2) ? e2.apply(null, args) : e2;
|
|
50712
50712
|
throw new Error(`[Immer] ${msg}`);
|
|
50713
50713
|
}
|
|
50714
50714
|
throw new Error(
|
|
50715
50715
|
`[Immer] minified error nr: ${error2}. Full error at: https://bit.ly/3cXEKWf`
|
|
50716
50716
|
);
|
|
50717
50717
|
}
|
|
50718
|
-
var
|
|
50719
|
-
|
|
50720
|
-
|
|
50721
|
-
|
|
50722
|
-
|
|
50718
|
+
var O$1 = Object;
|
|
50719
|
+
var getPrototypeOf$1 = O$1.getPrototypeOf;
|
|
50720
|
+
var CONSTRUCTOR = "constructor";
|
|
50721
|
+
var PROTOTYPE = "prototype";
|
|
50722
|
+
var CONFIGURABLE = "configurable";
|
|
50723
|
+
var ENUMERABLE = "enumerable";
|
|
50724
|
+
var WRITABLE = "writable";
|
|
50725
|
+
var VALUE = "value";
|
|
50726
|
+
var isDraft$1 = (value) => !!value && !!value[DRAFT_STATE$1];
|
|
50727
|
+
function isDraftable$1(value) {
|
|
50723
50728
|
if (!value)
|
|
50724
50729
|
return false;
|
|
50725
|
-
return isPlainObject$
|
|
50730
|
+
return isPlainObject$3(value) || isArray$1(value) || !!value[DRAFTABLE$1] || !!value[CONSTRUCTOR]?.[DRAFTABLE$1] || isMap$2(value) || isSet$2(value);
|
|
50726
50731
|
}
|
|
50727
|
-
var objectCtorString =
|
|
50728
|
-
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
50729
|
-
function isPlainObject$
|
|
50730
|
-
if (!value ||
|
|
50732
|
+
var objectCtorString$1 = O$1[PROTOTYPE][CONSTRUCTOR].toString();
|
|
50733
|
+
var cachedCtorStrings$1 = /* @__PURE__ */ new WeakMap();
|
|
50734
|
+
function isPlainObject$3(value) {
|
|
50735
|
+
if (!value || !isObjectish(value))
|
|
50731
50736
|
return false;
|
|
50732
|
-
const proto =
|
|
50733
|
-
if (proto === null || proto ===
|
|
50737
|
+
const proto = getPrototypeOf$1(value);
|
|
50738
|
+
if (proto === null || proto === O$1[PROTOTYPE])
|
|
50734
50739
|
return true;
|
|
50735
|
-
const Ctor =
|
|
50740
|
+
const Ctor = O$1.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
|
|
50736
50741
|
if (Ctor === Object)
|
|
50737
50742
|
return true;
|
|
50738
|
-
if (
|
|
50743
|
+
if (!isFunction$1(Ctor))
|
|
50739
50744
|
return false;
|
|
50740
|
-
let ctorString = cachedCtorStrings.get(Ctor);
|
|
50745
|
+
let ctorString = cachedCtorStrings$1.get(Ctor);
|
|
50741
50746
|
if (ctorString === void 0) {
|
|
50742
50747
|
ctorString = Function.toString.call(Ctor);
|
|
50743
|
-
cachedCtorStrings.set(Ctor, ctorString);
|
|
50748
|
+
cachedCtorStrings$1.set(Ctor, ctorString);
|
|
50744
50749
|
}
|
|
50745
|
-
return ctorString === objectCtorString;
|
|
50750
|
+
return ctorString === objectCtorString$1;
|
|
50746
50751
|
}
|
|
50747
|
-
function each(obj, iter, strict = true) {
|
|
50748
|
-
if (getArchtype(obj) === 0) {
|
|
50749
|
-
const keys = strict ? Reflect.ownKeys(obj) :
|
|
50752
|
+
function each$1(obj, iter, strict = true) {
|
|
50753
|
+
if (getArchtype$1(obj) === 0) {
|
|
50754
|
+
const keys = strict ? Reflect.ownKeys(obj) : O$1.keys(obj);
|
|
50750
50755
|
keys.forEach((key) => {
|
|
50751
50756
|
iter(key, obj[key], obj);
|
|
50752
50757
|
});
|
|
@@ -50754,300 +50759,352 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
50754
50759
|
obj.forEach((entry, index2) => iter(index2, entry, obj));
|
|
50755
50760
|
}
|
|
50756
50761
|
}
|
|
50757
|
-
function getArchtype(thing) {
|
|
50758
|
-
const state = thing[DRAFT_STATE];
|
|
50759
|
-
return state ? state.type_ :
|
|
50760
|
-
}
|
|
50761
|
-
function has(thing, prop) {
|
|
50762
|
-
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
50762
|
+
function getArchtype$1(thing) {
|
|
50763
|
+
const state = thing[DRAFT_STATE$1];
|
|
50764
|
+
return state ? state.type_ : isArray$1(thing) ? 1 : isMap$2(thing) ? 2 : isSet$2(thing) ? 3 : 0;
|
|
50763
50765
|
}
|
|
50764
|
-
|
|
50765
|
-
|
|
50766
|
-
|
|
50766
|
+
var has$1 = (thing, prop, type = getArchtype$1(thing)) => type === 2 ? thing.has(prop) : O$1[PROTOTYPE].hasOwnProperty.call(thing, prop);
|
|
50767
|
+
var get$2 = (thing, prop, type = getArchtype$1(thing)) => (
|
|
50768
|
+
// @ts-ignore
|
|
50769
|
+
type === 2 ? thing.get(prop) : thing[prop]
|
|
50770
|
+
);
|
|
50771
|
+
var set$2 = (thing, propOrOldValue, value, type = getArchtype$1(thing)) => {
|
|
50772
|
+
if (type === 2)
|
|
50767
50773
|
thing.set(propOrOldValue, value);
|
|
50768
|
-
else if (
|
|
50774
|
+
else if (type === 3) {
|
|
50769
50775
|
thing.add(value);
|
|
50770
50776
|
} else
|
|
50771
50777
|
thing[propOrOldValue] = value;
|
|
50772
|
-
}
|
|
50773
|
-
function is(x2, y2) {
|
|
50778
|
+
};
|
|
50779
|
+
function is$1(x2, y2) {
|
|
50774
50780
|
if (x2 === y2) {
|
|
50775
50781
|
return x2 !== 0 || 1 / x2 === 1 / y2;
|
|
50776
50782
|
} else {
|
|
50777
50783
|
return x2 !== x2 && y2 !== y2;
|
|
50778
50784
|
}
|
|
50779
50785
|
}
|
|
50780
|
-
|
|
50781
|
-
|
|
50782
|
-
|
|
50783
|
-
|
|
50784
|
-
|
|
50785
|
-
|
|
50786
|
-
function
|
|
50787
|
-
|
|
50788
|
-
|
|
50789
|
-
|
|
50790
|
-
|
|
50786
|
+
var isArray$1 = Array.isArray;
|
|
50787
|
+
var isMap$2 = (target2) => target2 instanceof Map;
|
|
50788
|
+
var isSet$2 = (target2) => target2 instanceof Set;
|
|
50789
|
+
var isObjectish = (target2) => typeof target2 === "object";
|
|
50790
|
+
var isFunction$1 = (target2) => typeof target2 === "function";
|
|
50791
|
+
var isBoolean$1 = (target2) => typeof target2 === "boolean";
|
|
50792
|
+
function isArrayIndex(value) {
|
|
50793
|
+
const n2 = +value;
|
|
50794
|
+
return Number.isInteger(n2) && String(n2) === value;
|
|
50795
|
+
}
|
|
50796
|
+
var latest$1 = (state) => state.copy_ || state.base_;
|
|
50797
|
+
var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
|
|
50798
|
+
function shallowCopy$1(base, strict) {
|
|
50799
|
+
if (isMap$2(base)) {
|
|
50791
50800
|
return new Map(base);
|
|
50792
50801
|
}
|
|
50793
|
-
if (isSet$
|
|
50802
|
+
if (isSet$2(base)) {
|
|
50794
50803
|
return new Set(base);
|
|
50795
50804
|
}
|
|
50796
|
-
if (
|
|
50797
|
-
return Array.
|
|
50798
|
-
const isPlain = isPlainObject$
|
|
50805
|
+
if (isArray$1(base))
|
|
50806
|
+
return Array[PROTOTYPE].slice.call(base);
|
|
50807
|
+
const isPlain = isPlainObject$3(base);
|
|
50799
50808
|
if (strict === true || strict === "class_only" && !isPlain) {
|
|
50800
|
-
const descriptors =
|
|
50801
|
-
delete descriptors[DRAFT_STATE];
|
|
50809
|
+
const descriptors = O$1.getOwnPropertyDescriptors(base);
|
|
50810
|
+
delete descriptors[DRAFT_STATE$1];
|
|
50802
50811
|
let keys = Reflect.ownKeys(descriptors);
|
|
50803
50812
|
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
50804
50813
|
const key = keys[i2];
|
|
50805
50814
|
const desc = descriptors[key];
|
|
50806
|
-
if (desc
|
|
50807
|
-
desc
|
|
50808
|
-
desc
|
|
50815
|
+
if (desc[WRITABLE] === false) {
|
|
50816
|
+
desc[WRITABLE] = true;
|
|
50817
|
+
desc[CONFIGURABLE] = true;
|
|
50809
50818
|
}
|
|
50810
50819
|
if (desc.get || desc.set)
|
|
50811
50820
|
descriptors[key] = {
|
|
50812
|
-
|
|
50813
|
-
|
|
50821
|
+
[CONFIGURABLE]: true,
|
|
50822
|
+
[WRITABLE]: true,
|
|
50814
50823
|
// could live with !!desc.set as well here...
|
|
50815
|
-
|
|
50816
|
-
|
|
50824
|
+
[ENUMERABLE]: desc[ENUMERABLE],
|
|
50825
|
+
[VALUE]: base[key]
|
|
50817
50826
|
};
|
|
50818
50827
|
}
|
|
50819
|
-
return
|
|
50828
|
+
return O$1.create(getPrototypeOf$1(base), descriptors);
|
|
50820
50829
|
} else {
|
|
50821
|
-
const proto = getPrototypeOf(base);
|
|
50830
|
+
const proto = getPrototypeOf$1(base);
|
|
50822
50831
|
if (proto !== null && isPlain) {
|
|
50823
50832
|
return { ...base };
|
|
50824
50833
|
}
|
|
50825
|
-
const obj =
|
|
50826
|
-
return
|
|
50834
|
+
const obj = O$1.create(proto);
|
|
50835
|
+
return O$1.assign(obj, base);
|
|
50827
50836
|
}
|
|
50828
50837
|
}
|
|
50829
|
-
function freeze(obj, deep = false) {
|
|
50830
|
-
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
50838
|
+
function freeze$1(obj, deep = false) {
|
|
50839
|
+
if (isFrozen$1(obj) || isDraft$1(obj) || !isDraftable$1(obj))
|
|
50831
50840
|
return obj;
|
|
50832
|
-
if (getArchtype(obj) > 1) {
|
|
50833
|
-
|
|
50834
|
-
set: dontMutateMethodOverride,
|
|
50835
|
-
add: dontMutateMethodOverride,
|
|
50836
|
-
clear: dontMutateMethodOverride,
|
|
50837
|
-
delete: dontMutateMethodOverride
|
|
50841
|
+
if (getArchtype$1(obj) > 1) {
|
|
50842
|
+
O$1.defineProperties(obj, {
|
|
50843
|
+
set: dontMutateMethodOverride$1,
|
|
50844
|
+
add: dontMutateMethodOverride$1,
|
|
50845
|
+
clear: dontMutateMethodOverride$1,
|
|
50846
|
+
delete: dontMutateMethodOverride$1
|
|
50838
50847
|
});
|
|
50839
50848
|
}
|
|
50840
|
-
|
|
50849
|
+
O$1.freeze(obj);
|
|
50841
50850
|
if (deep)
|
|
50842
|
-
|
|
50851
|
+
each$1(
|
|
50852
|
+
obj,
|
|
50853
|
+
(_key, value) => {
|
|
50854
|
+
freeze$1(value, true);
|
|
50855
|
+
},
|
|
50856
|
+
false
|
|
50857
|
+
);
|
|
50843
50858
|
return obj;
|
|
50844
50859
|
}
|
|
50845
|
-
function dontMutateFrozenCollections() {
|
|
50846
|
-
die(2);
|
|
50860
|
+
function dontMutateFrozenCollections$1() {
|
|
50861
|
+
die$1(2);
|
|
50847
50862
|
}
|
|
50848
|
-
var dontMutateMethodOverride = {
|
|
50849
|
-
|
|
50863
|
+
var dontMutateMethodOverride$1 = {
|
|
50864
|
+
[VALUE]: dontMutateFrozenCollections$1
|
|
50850
50865
|
};
|
|
50851
|
-
function isFrozen(obj) {
|
|
50852
|
-
if (obj === null ||
|
|
50866
|
+
function isFrozen$1(obj) {
|
|
50867
|
+
if (obj === null || !isObjectish(obj))
|
|
50853
50868
|
return true;
|
|
50854
|
-
return
|
|
50855
|
-
}
|
|
50856
|
-
var
|
|
50857
|
-
|
|
50858
|
-
|
|
50869
|
+
return O$1.isFrozen(obj);
|
|
50870
|
+
}
|
|
50871
|
+
var PluginMapSet = "MapSet";
|
|
50872
|
+
var PluginPatches = "Patches";
|
|
50873
|
+
var PluginArrayMethods = "ArrayMethods";
|
|
50874
|
+
var plugins$1 = {};
|
|
50875
|
+
function getPlugin$1(pluginKey) {
|
|
50876
|
+
const plugin = plugins$1[pluginKey];
|
|
50859
50877
|
if (!plugin) {
|
|
50860
|
-
die(0, pluginKey);
|
|
50878
|
+
die$1(0, pluginKey);
|
|
50861
50879
|
}
|
|
50862
50880
|
return plugin;
|
|
50863
50881
|
}
|
|
50864
|
-
|
|
50865
|
-
|
|
50866
|
-
|
|
50867
|
-
|
|
50868
|
-
|
|
50869
|
-
|
|
50870
|
-
|
|
50871
|
-
|
|
50872
|
-
|
|
50873
|
-
|
|
50874
|
-
|
|
50875
|
-
|
|
50876
|
-
|
|
50877
|
-
|
|
50878
|
-
|
|
50879
|
-
|
|
50880
|
-
|
|
50881
|
-
};
|
|
50882
|
-
}
|
|
50883
|
-
function usePatchesInScope(scope, patchListener) {
|
|
50882
|
+
var isPluginLoaded = (pluginKey) => !!plugins$1[pluginKey];
|
|
50883
|
+
var currentScope$1;
|
|
50884
|
+
var getCurrentScope$1 = () => currentScope$1;
|
|
50885
|
+
var createScope$1 = (parent_, immer_) => ({
|
|
50886
|
+
drafts_: [],
|
|
50887
|
+
parent_,
|
|
50888
|
+
immer_,
|
|
50889
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
50890
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
50891
|
+
canAutoFreeze_: true,
|
|
50892
|
+
unfinalizedDrafts_: 0,
|
|
50893
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
50894
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
50895
|
+
mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin$1(PluginMapSet) : void 0,
|
|
50896
|
+
arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin$1(PluginArrayMethods) : void 0
|
|
50897
|
+
});
|
|
50898
|
+
function usePatchesInScope$1(scope, patchListener) {
|
|
50884
50899
|
if (patchListener) {
|
|
50885
|
-
getPlugin(
|
|
50900
|
+
scope.patchPlugin_ = getPlugin$1(PluginPatches);
|
|
50886
50901
|
scope.patches_ = [];
|
|
50887
50902
|
scope.inversePatches_ = [];
|
|
50888
50903
|
scope.patchListener_ = patchListener;
|
|
50889
50904
|
}
|
|
50890
50905
|
}
|
|
50891
|
-
function revokeScope(scope) {
|
|
50892
|
-
leaveScope(scope);
|
|
50893
|
-
scope.drafts_.forEach(revokeDraft);
|
|
50906
|
+
function revokeScope$1(scope) {
|
|
50907
|
+
leaveScope$1(scope);
|
|
50908
|
+
scope.drafts_.forEach(revokeDraft$1);
|
|
50894
50909
|
scope.drafts_ = null;
|
|
50895
50910
|
}
|
|
50896
|
-
function leaveScope(scope) {
|
|
50897
|
-
if (scope === currentScope) {
|
|
50898
|
-
currentScope = scope.parent_;
|
|
50911
|
+
function leaveScope$1(scope) {
|
|
50912
|
+
if (scope === currentScope$1) {
|
|
50913
|
+
currentScope$1 = scope.parent_;
|
|
50899
50914
|
}
|
|
50900
50915
|
}
|
|
50901
|
-
|
|
50902
|
-
|
|
50903
|
-
|
|
50904
|
-
function revokeDraft(draft) {
|
|
50905
|
-
const state = draft[DRAFT_STATE];
|
|
50916
|
+
var enterScope$1 = (immer2) => currentScope$1 = createScope$1(currentScope$1, immer2);
|
|
50917
|
+
function revokeDraft$1(draft) {
|
|
50918
|
+
const state = draft[DRAFT_STATE$1];
|
|
50906
50919
|
if (state.type_ === 0 || state.type_ === 1)
|
|
50907
50920
|
state.revoke_();
|
|
50908
50921
|
else
|
|
50909
50922
|
state.revoked_ = true;
|
|
50910
50923
|
}
|
|
50911
|
-
function processResult(result, scope) {
|
|
50924
|
+
function processResult$1(result, scope) {
|
|
50912
50925
|
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
50913
50926
|
const baseDraft = scope.drafts_[0];
|
|
50914
50927
|
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
50915
50928
|
if (isReplaced) {
|
|
50916
|
-
if (baseDraft[DRAFT_STATE].modified_) {
|
|
50917
|
-
revokeScope(scope);
|
|
50918
|
-
die(4);
|
|
50929
|
+
if (baseDraft[DRAFT_STATE$1].modified_) {
|
|
50930
|
+
revokeScope$1(scope);
|
|
50931
|
+
die$1(4);
|
|
50919
50932
|
}
|
|
50920
|
-
if (isDraftable(result)) {
|
|
50921
|
-
result = finalize(scope, result);
|
|
50922
|
-
if (!scope.parent_)
|
|
50923
|
-
maybeFreeze(scope, result);
|
|
50933
|
+
if (isDraftable$1(result)) {
|
|
50934
|
+
result = finalize$1(scope, result);
|
|
50924
50935
|
}
|
|
50925
|
-
|
|
50926
|
-
|
|
50927
|
-
|
|
50936
|
+
const { patchPlugin_ } = scope;
|
|
50937
|
+
if (patchPlugin_) {
|
|
50938
|
+
patchPlugin_.generateReplacementPatches_(
|
|
50939
|
+
baseDraft[DRAFT_STATE$1].base_,
|
|
50928
50940
|
result,
|
|
50929
|
-
scope
|
|
50930
|
-
scope.inversePatches_
|
|
50941
|
+
scope
|
|
50931
50942
|
);
|
|
50932
50943
|
}
|
|
50933
50944
|
} else {
|
|
50934
|
-
result = finalize(scope, baseDraft
|
|
50945
|
+
result = finalize$1(scope, baseDraft);
|
|
50935
50946
|
}
|
|
50936
|
-
|
|
50947
|
+
maybeFreeze$1(scope, result, true);
|
|
50948
|
+
revokeScope$1(scope);
|
|
50937
50949
|
if (scope.patches_) {
|
|
50938
50950
|
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
50939
50951
|
}
|
|
50940
|
-
return result !== NOTHING ? result : void 0;
|
|
50952
|
+
return result !== NOTHING$1 ? result : void 0;
|
|
50941
50953
|
}
|
|
50942
|
-
function finalize(rootScope, value
|
|
50943
|
-
if (isFrozen(value))
|
|
50954
|
+
function finalize$1(rootScope, value) {
|
|
50955
|
+
if (isFrozen$1(value))
|
|
50944
50956
|
return value;
|
|
50945
|
-
const
|
|
50946
|
-
const state = value[DRAFT_STATE];
|
|
50957
|
+
const state = value[DRAFT_STATE$1];
|
|
50947
50958
|
if (!state) {
|
|
50948
|
-
|
|
50949
|
-
|
|
50950
|
-
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path),
|
|
50951
|
-
useStrictIteration
|
|
50952
|
-
);
|
|
50953
|
-
return value;
|
|
50959
|
+
const finalValue = handleValue(value, rootScope.handledSet_, rootScope);
|
|
50960
|
+
return finalValue;
|
|
50954
50961
|
}
|
|
50955
|
-
if (state
|
|
50962
|
+
if (!isSameScope(state, rootScope)) {
|
|
50956
50963
|
return value;
|
|
50964
|
+
}
|
|
50957
50965
|
if (!state.modified_) {
|
|
50958
|
-
maybeFreeze(rootScope, state.base_, true);
|
|
50959
50966
|
return state.base_;
|
|
50960
50967
|
}
|
|
50961
50968
|
if (!state.finalized_) {
|
|
50962
|
-
|
|
50963
|
-
|
|
50964
|
-
|
|
50965
|
-
|
|
50966
|
-
|
|
50967
|
-
|
|
50968
|
-
resultEach = new Set(result);
|
|
50969
|
-
result.clear();
|
|
50970
|
-
isSet2 = true;
|
|
50971
|
-
}
|
|
50972
|
-
each(
|
|
50973
|
-
resultEach,
|
|
50974
|
-
(key, childValue) => finalizeProperty(
|
|
50975
|
-
rootScope,
|
|
50976
|
-
state,
|
|
50977
|
-
result,
|
|
50978
|
-
key,
|
|
50979
|
-
childValue,
|
|
50980
|
-
path,
|
|
50981
|
-
isSet2
|
|
50982
|
-
),
|
|
50983
|
-
useStrictIteration
|
|
50984
|
-
);
|
|
50985
|
-
maybeFreeze(rootScope, result, false);
|
|
50986
|
-
if (path && rootScope.patches_) {
|
|
50987
|
-
getPlugin("Patches").generatePatches_(
|
|
50988
|
-
state,
|
|
50989
|
-
path,
|
|
50990
|
-
rootScope.patches_,
|
|
50991
|
-
rootScope.inversePatches_
|
|
50992
|
-
);
|
|
50969
|
+
const { callbacks_ } = state;
|
|
50970
|
+
if (callbacks_) {
|
|
50971
|
+
while (callbacks_.length > 0) {
|
|
50972
|
+
const callback = callbacks_.pop();
|
|
50973
|
+
callback(rootScope);
|
|
50974
|
+
}
|
|
50993
50975
|
}
|
|
50976
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
50994
50977
|
}
|
|
50995
50978
|
return state.copy_;
|
|
50996
50979
|
}
|
|
50997
|
-
function
|
|
50998
|
-
if (
|
|
50999
|
-
|
|
51000
|
-
}
|
|
51001
|
-
|
|
51002
|
-
|
|
50980
|
+
function maybeFreeze$1(scope, value, deep = false) {
|
|
50981
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
50982
|
+
freeze$1(value, deep);
|
|
50983
|
+
}
|
|
50984
|
+
}
|
|
50985
|
+
function markStateFinalized(state) {
|
|
50986
|
+
state.finalized_ = true;
|
|
50987
|
+
state.scope_.unfinalizedDrafts_--;
|
|
50988
|
+
}
|
|
50989
|
+
var isSameScope = (state, rootScope) => state.scope_ === rootScope;
|
|
50990
|
+
var EMPTY_LOCATIONS_RESULT = [];
|
|
50991
|
+
function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
|
|
50992
|
+
const parentCopy = latest$1(parent);
|
|
50993
|
+
const parentType = parent.type_;
|
|
50994
|
+
if (originalKey !== void 0) {
|
|
50995
|
+
const currentValue = get$2(parentCopy, originalKey, parentType);
|
|
50996
|
+
if (currentValue === draftValue) {
|
|
50997
|
+
set$2(parentCopy, originalKey, finalizedValue, parentType);
|
|
50998
|
+
return;
|
|
50999
|
+
}
|
|
51003
51000
|
}
|
|
51004
|
-
|
|
51005
|
-
|
|
51006
|
-
|
|
51001
|
+
if (!parent.draftLocations_) {
|
|
51002
|
+
const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
|
|
51003
|
+
each$1(parentCopy, (key, value) => {
|
|
51004
|
+
if (isDraft$1(value)) {
|
|
51005
|
+
const keys = draftLocations.get(value) || [];
|
|
51006
|
+
keys.push(key);
|
|
51007
|
+
draftLocations.set(value, keys);
|
|
51008
|
+
}
|
|
51009
|
+
});
|
|
51007
51010
|
}
|
|
51008
|
-
|
|
51009
|
-
|
|
51010
|
-
|
|
51011
|
-
const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
51012
|
-
!has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
51013
|
-
const res = finalize(rootScope, childValue, path);
|
|
51014
|
-
set$1(targetObject, prop, res);
|
|
51015
|
-
if (isDraft(res)) {
|
|
51016
|
-
rootScope.canAutoFreeze_ = false;
|
|
51017
|
-
} else
|
|
51018
|
-
return;
|
|
51019
|
-
} else if (targetIsSet) {
|
|
51020
|
-
targetObject.add(childValue);
|
|
51011
|
+
const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
|
|
51012
|
+
for (const location of locations) {
|
|
51013
|
+
set$2(parentCopy, location, finalizedValue, parentType);
|
|
51021
51014
|
}
|
|
51022
|
-
|
|
51023
|
-
|
|
51015
|
+
}
|
|
51016
|
+
function registerChildFinalizationCallback(parent, child, key) {
|
|
51017
|
+
parent.callbacks_.push(function childCleanup(rootScope) {
|
|
51018
|
+
const state = child;
|
|
51019
|
+
if (!state || !isSameScope(state, rootScope)) {
|
|
51024
51020
|
return;
|
|
51025
51021
|
}
|
|
51026
|
-
|
|
51027
|
-
|
|
51022
|
+
rootScope.mapSetPlugin_?.fixSetContents(state);
|
|
51023
|
+
const finalizedValue = getFinalValue(state);
|
|
51024
|
+
updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
|
|
51025
|
+
generatePatchesAndFinalize(state, rootScope);
|
|
51026
|
+
});
|
|
51027
|
+
}
|
|
51028
|
+
function generatePatchesAndFinalize(state, rootScope) {
|
|
51029
|
+
const shouldFinalize = state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0);
|
|
51030
|
+
if (shouldFinalize) {
|
|
51031
|
+
const { patchPlugin_ } = rootScope;
|
|
51032
|
+
if (patchPlugin_) {
|
|
51033
|
+
const basePath = patchPlugin_.getPath(state);
|
|
51034
|
+
if (basePath) {
|
|
51035
|
+
patchPlugin_.generatePatches_(state, basePath, rootScope);
|
|
51036
|
+
}
|
|
51028
51037
|
}
|
|
51029
|
-
|
|
51030
|
-
if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap$1(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))
|
|
51031
|
-
maybeFreeze(rootScope, childValue);
|
|
51038
|
+
markStateFinalized(state);
|
|
51032
51039
|
}
|
|
51033
51040
|
}
|
|
51034
|
-
function
|
|
51035
|
-
|
|
51036
|
-
|
|
51041
|
+
function handleCrossReference(target2, key, value) {
|
|
51042
|
+
const { scope_ } = target2;
|
|
51043
|
+
if (isDraft$1(value)) {
|
|
51044
|
+
const state = value[DRAFT_STATE$1];
|
|
51045
|
+
if (isSameScope(state, scope_)) {
|
|
51046
|
+
state.callbacks_.push(function crossReferenceCleanup() {
|
|
51047
|
+
prepareCopy$1(target2);
|
|
51048
|
+
const finalizedValue = getFinalValue(state);
|
|
51049
|
+
updateDraftInParent(target2, value, finalizedValue, key);
|
|
51050
|
+
});
|
|
51051
|
+
}
|
|
51052
|
+
} else if (isDraftable$1(value)) {
|
|
51053
|
+
target2.callbacks_.push(function nestedDraftCleanup() {
|
|
51054
|
+
const targetCopy = latest$1(target2);
|
|
51055
|
+
if (target2.type_ === 3) {
|
|
51056
|
+
if (targetCopy.has(value)) {
|
|
51057
|
+
handleValue(value, scope_.handledSet_, scope_);
|
|
51058
|
+
}
|
|
51059
|
+
} else {
|
|
51060
|
+
if (get$2(targetCopy, key, target2.type_) === value) {
|
|
51061
|
+
if (scope_.drafts_.length > 1 && (target2.assigned_.get(key) ?? false) === true && target2.copy_) {
|
|
51062
|
+
handleValue(
|
|
51063
|
+
get$2(target2.copy_, key, target2.type_),
|
|
51064
|
+
scope_.handledSet_,
|
|
51065
|
+
scope_
|
|
51066
|
+
);
|
|
51067
|
+
}
|
|
51068
|
+
}
|
|
51069
|
+
}
|
|
51070
|
+
});
|
|
51037
51071
|
}
|
|
51038
51072
|
}
|
|
51039
|
-
function
|
|
51040
|
-
|
|
51073
|
+
function handleValue(target2, handledSet, rootScope) {
|
|
51074
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
51075
|
+
return target2;
|
|
51076
|
+
}
|
|
51077
|
+
if (isDraft$1(target2) || handledSet.has(target2) || !isDraftable$1(target2) || isFrozen$1(target2)) {
|
|
51078
|
+
return target2;
|
|
51079
|
+
}
|
|
51080
|
+
handledSet.add(target2);
|
|
51081
|
+
each$1(target2, (key, value) => {
|
|
51082
|
+
if (isDraft$1(value)) {
|
|
51083
|
+
const state = value[DRAFT_STATE$1];
|
|
51084
|
+
if (isSameScope(state, rootScope)) {
|
|
51085
|
+
const updatedValue = getFinalValue(state);
|
|
51086
|
+
set$2(target2, key, updatedValue, target2.type_);
|
|
51087
|
+
markStateFinalized(state);
|
|
51088
|
+
}
|
|
51089
|
+
} else if (isDraftable$1(value)) {
|
|
51090
|
+
handleValue(value, handledSet, rootScope);
|
|
51091
|
+
}
|
|
51092
|
+
});
|
|
51093
|
+
return target2;
|
|
51094
|
+
}
|
|
51095
|
+
function createProxyProxy$1(base, parent) {
|
|
51096
|
+
const baseIsArray = isArray$1(base);
|
|
51041
51097
|
const state = {
|
|
51042
|
-
type_:
|
|
51098
|
+
type_: baseIsArray ? 1 : 0,
|
|
51043
51099
|
// Track which produce call this is associated with.
|
|
51044
|
-
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
51100
|
+
scope_: parent ? parent.scope_ : getCurrentScope$1(),
|
|
51045
51101
|
// True for both shallow and deep changes.
|
|
51046
51102
|
modified_: false,
|
|
51047
51103
|
// Used during finalization.
|
|
51048
51104
|
finalized_: false,
|
|
51049
51105
|
// Track which properties have been assigned (true) or deleted (false).
|
|
51050
|
-
|
|
51106
|
+
// actually instantiated in `prepareCopy()`
|
|
51107
|
+
assigned_: void 0,
|
|
51051
51108
|
// The parent draft state.
|
|
51052
51109
|
parent_: parent,
|
|
51053
51110
|
// The base state.
|
|
@@ -51059,77 +51116,94 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51059
51116
|
copy_: null,
|
|
51060
51117
|
// Called by the `produce` function.
|
|
51061
51118
|
revoke_: null,
|
|
51062
|
-
isManual_: false
|
|
51119
|
+
isManual_: false,
|
|
51120
|
+
// `callbacks` actually gets assigned in `createProxy`
|
|
51121
|
+
callbacks_: void 0
|
|
51063
51122
|
};
|
|
51064
51123
|
let target2 = state;
|
|
51065
|
-
let traps = objectTraps;
|
|
51066
|
-
if (
|
|
51124
|
+
let traps = objectTraps$1;
|
|
51125
|
+
if (baseIsArray) {
|
|
51067
51126
|
target2 = [state];
|
|
51068
|
-
traps = arrayTraps;
|
|
51127
|
+
traps = arrayTraps$1;
|
|
51069
51128
|
}
|
|
51070
51129
|
const { revoke, proxy } = Proxy.revocable(target2, traps);
|
|
51071
51130
|
state.draft_ = proxy;
|
|
51072
51131
|
state.revoke_ = revoke;
|
|
51073
|
-
return proxy;
|
|
51132
|
+
return [proxy, state];
|
|
51074
51133
|
}
|
|
51075
|
-
var objectTraps = {
|
|
51134
|
+
var objectTraps$1 = {
|
|
51076
51135
|
get(state, prop) {
|
|
51077
|
-
if (prop === DRAFT_STATE)
|
|
51136
|
+
if (prop === DRAFT_STATE$1)
|
|
51078
51137
|
return state;
|
|
51079
|
-
|
|
51080
|
-
|
|
51081
|
-
|
|
51138
|
+
let arrayPlugin = state.scope_.arrayMethodsPlugin_;
|
|
51139
|
+
const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
|
|
51140
|
+
if (isArrayWithStringProp) {
|
|
51141
|
+
if (arrayPlugin?.isArrayOperationMethod(prop)) {
|
|
51142
|
+
return arrayPlugin.createMethodInterceptor(state, prop);
|
|
51143
|
+
}
|
|
51144
|
+
}
|
|
51145
|
+
const source = latest$1(state);
|
|
51146
|
+
if (!has$1(source, prop, state.type_)) {
|
|
51147
|
+
return readPropFromProto$1(state, source, prop);
|
|
51082
51148
|
}
|
|
51083
51149
|
const value = source[prop];
|
|
51084
|
-
if (state.finalized_ || !isDraftable(value)) {
|
|
51150
|
+
if (state.finalized_ || !isDraftable$1(value)) {
|
|
51085
51151
|
return value;
|
|
51086
51152
|
}
|
|
51087
|
-
if (
|
|
51088
|
-
|
|
51089
|
-
|
|
51153
|
+
if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(
|
|
51154
|
+
state.operationMethod
|
|
51155
|
+
) && isArrayIndex(prop)) {
|
|
51156
|
+
return value;
|
|
51157
|
+
}
|
|
51158
|
+
if (value === peek$2(state.base_, prop)) {
|
|
51159
|
+
prepareCopy$1(state);
|
|
51160
|
+
const childKey = state.type_ === 1 ? +prop : prop;
|
|
51161
|
+
const childDraft = createProxy$1(state.scope_, value, state, childKey);
|
|
51162
|
+
return state.copy_[childKey] = childDraft;
|
|
51090
51163
|
}
|
|
51091
51164
|
return value;
|
|
51092
51165
|
},
|
|
51093
51166
|
has(state, prop) {
|
|
51094
|
-
return prop in latest(state);
|
|
51167
|
+
return prop in latest$1(state);
|
|
51095
51168
|
},
|
|
51096
51169
|
ownKeys(state) {
|
|
51097
|
-
return Reflect.ownKeys(latest(state));
|
|
51170
|
+
return Reflect.ownKeys(latest$1(state));
|
|
51098
51171
|
},
|
|
51099
51172
|
set(state, prop, value) {
|
|
51100
|
-
const desc = getDescriptorFromProto(latest(state), prop);
|
|
51173
|
+
const desc = getDescriptorFromProto$1(latest$1(state), prop);
|
|
51101
51174
|
if (desc?.set) {
|
|
51102
51175
|
desc.set.call(state.draft_, value);
|
|
51103
51176
|
return true;
|
|
51104
51177
|
}
|
|
51105
51178
|
if (!state.modified_) {
|
|
51106
|
-
const current2 = peek$
|
|
51107
|
-
const currentState = current2?.[DRAFT_STATE];
|
|
51179
|
+
const current2 = peek$2(latest$1(state), prop);
|
|
51180
|
+
const currentState = current2?.[DRAFT_STATE$1];
|
|
51108
51181
|
if (currentState && currentState.base_ === value) {
|
|
51109
51182
|
state.copy_[prop] = value;
|
|
51110
|
-
state.assigned_
|
|
51183
|
+
state.assigned_.set(prop, false);
|
|
51111
51184
|
return true;
|
|
51112
51185
|
}
|
|
51113
|
-
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
51186
|
+
if (is$1(value, current2) && (value !== void 0 || has$1(state.base_, prop, state.type_)))
|
|
51114
51187
|
return true;
|
|
51115
|
-
prepareCopy(state);
|
|
51116
|
-
markChanged(state);
|
|
51188
|
+
prepareCopy$1(state);
|
|
51189
|
+
markChanged$1(state);
|
|
51117
51190
|
}
|
|
51118
51191
|
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
51119
51192
|
(value !== void 0 || prop in state.copy_) || // special case: NaN
|
|
51120
51193
|
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
51121
51194
|
return true;
|
|
51122
51195
|
state.copy_[prop] = value;
|
|
51123
|
-
state.assigned_
|
|
51196
|
+
state.assigned_.set(prop, true);
|
|
51197
|
+
handleCrossReference(state, prop, value);
|
|
51124
51198
|
return true;
|
|
51125
51199
|
},
|
|
51126
51200
|
deleteProperty(state, prop) {
|
|
51127
|
-
|
|
51128
|
-
|
|
51129
|
-
|
|
51130
|
-
markChanged(state);
|
|
51201
|
+
prepareCopy$1(state);
|
|
51202
|
+
if (peek$2(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
51203
|
+
state.assigned_.set(prop, false);
|
|
51204
|
+
markChanged$1(state);
|
|
51131
51205
|
} else {
|
|
51132
|
-
|
|
51206
|
+
state.assigned_.delete(prop);
|
|
51133
51207
|
}
|
|
51134
51208
|
if (state.copy_) {
|
|
51135
51209
|
delete state.copy_[prop];
|
|
@@ -51139,92 +51213,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51139
51213
|
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
51140
51214
|
// the same guarantee in ES5 mode.
|
|
51141
51215
|
getOwnPropertyDescriptor(state, prop) {
|
|
51142
|
-
const owner = latest(state);
|
|
51216
|
+
const owner = latest$1(state);
|
|
51143
51217
|
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
51144
51218
|
if (!desc)
|
|
51145
51219
|
return desc;
|
|
51146
51220
|
return {
|
|
51147
|
-
|
|
51148
|
-
|
|
51149
|
-
|
|
51150
|
-
|
|
51221
|
+
[WRITABLE]: true,
|
|
51222
|
+
[CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
|
|
51223
|
+
[ENUMERABLE]: desc[ENUMERABLE],
|
|
51224
|
+
[VALUE]: owner[prop]
|
|
51151
51225
|
};
|
|
51152
51226
|
},
|
|
51153
51227
|
defineProperty() {
|
|
51154
|
-
die(11);
|
|
51228
|
+
die$1(11);
|
|
51155
51229
|
},
|
|
51156
51230
|
getPrototypeOf(state) {
|
|
51157
|
-
return getPrototypeOf(state.base_);
|
|
51231
|
+
return getPrototypeOf$1(state.base_);
|
|
51158
51232
|
},
|
|
51159
51233
|
setPrototypeOf() {
|
|
51160
|
-
die(12);
|
|
51234
|
+
die$1(12);
|
|
51161
51235
|
}
|
|
51162
51236
|
};
|
|
51163
|
-
var arrayTraps = {};
|
|
51164
|
-
|
|
51165
|
-
|
|
51166
|
-
|
|
51167
|
-
|
|
51237
|
+
var arrayTraps$1 = {};
|
|
51238
|
+
for (let key in objectTraps$1) {
|
|
51239
|
+
let fn = objectTraps$1[key];
|
|
51240
|
+
arrayTraps$1[key] = function() {
|
|
51241
|
+
const args = arguments;
|
|
51242
|
+
args[0] = args[0][0];
|
|
51243
|
+
return fn.apply(this, args);
|
|
51168
51244
|
};
|
|
51169
|
-
}
|
|
51170
|
-
arrayTraps.deleteProperty = function(state, prop) {
|
|
51245
|
+
}
|
|
51246
|
+
arrayTraps$1.deleteProperty = function(state, prop) {
|
|
51171
51247
|
if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
|
|
51172
|
-
die(13);
|
|
51173
|
-
return arrayTraps.set.call(this, state, prop, void 0);
|
|
51248
|
+
die$1(13);
|
|
51249
|
+
return arrayTraps$1.set.call(this, state, prop, void 0);
|
|
51174
51250
|
};
|
|
51175
|
-
arrayTraps.set = function(state, prop, value) {
|
|
51251
|
+
arrayTraps$1.set = function(state, prop, value) {
|
|
51176
51252
|
if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop)))
|
|
51177
|
-
die(14);
|
|
51178
|
-
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
51253
|
+
die$1(14);
|
|
51254
|
+
return objectTraps$1.set.call(this, state[0], prop, value, state[0]);
|
|
51179
51255
|
};
|
|
51180
|
-
function peek$
|
|
51181
|
-
const state = draft[DRAFT_STATE];
|
|
51182
|
-
const source = state ? latest(state) : draft;
|
|
51256
|
+
function peek$2(draft, prop) {
|
|
51257
|
+
const state = draft[DRAFT_STATE$1];
|
|
51258
|
+
const source = state ? latest$1(state) : draft;
|
|
51183
51259
|
return source[prop];
|
|
51184
51260
|
}
|
|
51185
|
-
function readPropFromProto(state, source, prop) {
|
|
51186
|
-
const desc = getDescriptorFromProto(source, prop);
|
|
51187
|
-
return desc ?
|
|
51261
|
+
function readPropFromProto$1(state, source, prop) {
|
|
51262
|
+
const desc = getDescriptorFromProto$1(source, prop);
|
|
51263
|
+
return desc ? VALUE in desc ? desc[VALUE] : (
|
|
51188
51264
|
// This is a very special case, if the prop is a getter defined by the
|
|
51189
51265
|
// prototype, we should invoke it with the draft as context!
|
|
51190
51266
|
desc.get?.call(state.draft_)
|
|
51191
51267
|
) : void 0;
|
|
51192
51268
|
}
|
|
51193
|
-
function getDescriptorFromProto(source, prop) {
|
|
51269
|
+
function getDescriptorFromProto$1(source, prop) {
|
|
51194
51270
|
if (!(prop in source))
|
|
51195
51271
|
return void 0;
|
|
51196
|
-
let proto = getPrototypeOf(source);
|
|
51272
|
+
let proto = getPrototypeOf$1(source);
|
|
51197
51273
|
while (proto) {
|
|
51198
51274
|
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
51199
51275
|
if (desc)
|
|
51200
51276
|
return desc;
|
|
51201
|
-
proto = getPrototypeOf(proto);
|
|
51277
|
+
proto = getPrototypeOf$1(proto);
|
|
51202
51278
|
}
|
|
51203
51279
|
return void 0;
|
|
51204
51280
|
}
|
|
51205
|
-
function markChanged(state) {
|
|
51281
|
+
function markChanged$1(state) {
|
|
51206
51282
|
if (!state.modified_) {
|
|
51207
51283
|
state.modified_ = true;
|
|
51208
51284
|
if (state.parent_) {
|
|
51209
|
-
markChanged(state.parent_);
|
|
51285
|
+
markChanged$1(state.parent_);
|
|
51210
51286
|
}
|
|
51211
51287
|
}
|
|
51212
51288
|
}
|
|
51213
|
-
function prepareCopy(state) {
|
|
51289
|
+
function prepareCopy$1(state) {
|
|
51214
51290
|
if (!state.copy_) {
|
|
51215
|
-
state.
|
|
51291
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
51292
|
+
state.copy_ = shallowCopy$1(
|
|
51216
51293
|
state.base_,
|
|
51217
51294
|
state.scope_.immer_.useStrictShallowCopy_
|
|
51218
51295
|
);
|
|
51219
51296
|
}
|
|
51220
51297
|
}
|
|
51221
|
-
var Immer2 = class {
|
|
51298
|
+
var Immer2$1 = class Immer2 {
|
|
51222
51299
|
constructor(config2) {
|
|
51223
51300
|
this.autoFreeze_ = true;
|
|
51224
51301
|
this.useStrictShallowCopy_ = false;
|
|
51225
|
-
this.useStrictIteration_ =
|
|
51302
|
+
this.useStrictIteration_ = false;
|
|
51226
51303
|
this.produce = (base, recipe, patchListener) => {
|
|
51227
|
-
if (
|
|
51304
|
+
if (isFunction$1(base) && !isFunction$1(recipe)) {
|
|
51228
51305
|
const defaultBase = recipe;
|
|
51229
51306
|
recipe = base;
|
|
51230
51307
|
const self2 = this;
|
|
@@ -51232,46 +51309,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51232
51309
|
return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
51233
51310
|
};
|
|
51234
51311
|
}
|
|
51235
|
-
if (
|
|
51236
|
-
die(6);
|
|
51237
|
-
if (patchListener !== void 0 &&
|
|
51238
|
-
die(7);
|
|
51312
|
+
if (!isFunction$1(recipe))
|
|
51313
|
+
die$1(6);
|
|
51314
|
+
if (patchListener !== void 0 && !isFunction$1(patchListener))
|
|
51315
|
+
die$1(7);
|
|
51239
51316
|
let result;
|
|
51240
|
-
if (isDraftable(base)) {
|
|
51241
|
-
const scope = enterScope(this);
|
|
51242
|
-
const proxy = createProxy(base, void 0);
|
|
51317
|
+
if (isDraftable$1(base)) {
|
|
51318
|
+
const scope = enterScope$1(this);
|
|
51319
|
+
const proxy = createProxy$1(scope, base, void 0);
|
|
51243
51320
|
let hasError = true;
|
|
51244
51321
|
try {
|
|
51245
51322
|
result = recipe(proxy);
|
|
51246
51323
|
hasError = false;
|
|
51247
51324
|
} finally {
|
|
51248
51325
|
if (hasError)
|
|
51249
|
-
revokeScope(scope);
|
|
51326
|
+
revokeScope$1(scope);
|
|
51250
51327
|
else
|
|
51251
|
-
leaveScope(scope);
|
|
51328
|
+
leaveScope$1(scope);
|
|
51252
51329
|
}
|
|
51253
|
-
usePatchesInScope(scope, patchListener);
|
|
51254
|
-
return processResult(result, scope);
|
|
51255
|
-
} else if (!base ||
|
|
51330
|
+
usePatchesInScope$1(scope, patchListener);
|
|
51331
|
+
return processResult$1(result, scope);
|
|
51332
|
+
} else if (!base || !isObjectish(base)) {
|
|
51256
51333
|
result = recipe(base);
|
|
51257
51334
|
if (result === void 0)
|
|
51258
51335
|
result = base;
|
|
51259
|
-
if (result === NOTHING)
|
|
51336
|
+
if (result === NOTHING$1)
|
|
51260
51337
|
result = void 0;
|
|
51261
51338
|
if (this.autoFreeze_)
|
|
51262
|
-
freeze(result, true);
|
|
51339
|
+
freeze$1(result, true);
|
|
51263
51340
|
if (patchListener) {
|
|
51264
51341
|
const p2 = [];
|
|
51265
51342
|
const ip = [];
|
|
51266
|
-
getPlugin(
|
|
51343
|
+
getPlugin$1(PluginPatches).generateReplacementPatches_(base, result, {
|
|
51344
|
+
patches_: p2,
|
|
51345
|
+
inversePatches_: ip
|
|
51346
|
+
});
|
|
51267
51347
|
patchListener(p2, ip);
|
|
51268
51348
|
}
|
|
51269
51349
|
return result;
|
|
51270
51350
|
} else
|
|
51271
|
-
die(1, base);
|
|
51351
|
+
die$1(1, base);
|
|
51272
51352
|
};
|
|
51273
51353
|
this.produceWithPatches = (base, recipe) => {
|
|
51274
|
-
if (
|
|
51354
|
+
if (isFunction$1(base)) {
|
|
51275
51355
|
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
51276
51356
|
}
|
|
51277
51357
|
let patches, inversePatches;
|
|
@@ -51281,31 +51361,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51281
51361
|
});
|
|
51282
51362
|
return [result, patches, inversePatches];
|
|
51283
51363
|
};
|
|
51284
|
-
if (
|
|
51364
|
+
if (isBoolean$1(config2?.autoFreeze))
|
|
51285
51365
|
this.setAutoFreeze(config2.autoFreeze);
|
|
51286
|
-
if (
|
|
51366
|
+
if (isBoolean$1(config2?.useStrictShallowCopy))
|
|
51287
51367
|
this.setUseStrictShallowCopy(config2.useStrictShallowCopy);
|
|
51288
|
-
if (
|
|
51368
|
+
if (isBoolean$1(config2?.useStrictIteration))
|
|
51289
51369
|
this.setUseStrictIteration(config2.useStrictIteration);
|
|
51290
51370
|
}
|
|
51291
51371
|
createDraft(base) {
|
|
51292
|
-
if (!isDraftable(base))
|
|
51293
|
-
die(8);
|
|
51294
|
-
if (isDraft(base))
|
|
51295
|
-
base = current(base);
|
|
51296
|
-
const scope = enterScope(this);
|
|
51297
|
-
const proxy = createProxy(base, void 0);
|
|
51298
|
-
proxy[DRAFT_STATE].isManual_ = true;
|
|
51299
|
-
leaveScope(scope);
|
|
51372
|
+
if (!isDraftable$1(base))
|
|
51373
|
+
die$1(8);
|
|
51374
|
+
if (isDraft$1(base))
|
|
51375
|
+
base = current$1(base);
|
|
51376
|
+
const scope = enterScope$1(this);
|
|
51377
|
+
const proxy = createProxy$1(scope, base, void 0);
|
|
51378
|
+
proxy[DRAFT_STATE$1].isManual_ = true;
|
|
51379
|
+
leaveScope$1(scope);
|
|
51300
51380
|
return proxy;
|
|
51301
51381
|
}
|
|
51302
51382
|
finishDraft(draft, patchListener) {
|
|
51303
|
-
const state = draft && draft[DRAFT_STATE];
|
|
51383
|
+
const state = draft && draft[DRAFT_STATE$1];
|
|
51304
51384
|
if (!state || !state.isManual_)
|
|
51305
|
-
die(9);
|
|
51385
|
+
die$1(9);
|
|
51306
51386
|
const { scope_: scope } = state;
|
|
51307
|
-
usePatchesInScope(scope, patchListener);
|
|
51308
|
-
return processResult(void 0, scope);
|
|
51387
|
+
usePatchesInScope$1(scope, patchListener);
|
|
51388
|
+
return processResult$1(void 0, scope);
|
|
51309
51389
|
}
|
|
51310
51390
|
/**
|
|
51311
51391
|
* Pass true to automatically freeze all copies created by Immer.
|
|
@@ -51347,8 +51427,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51347
51427
|
if (i2 > -1) {
|
|
51348
51428
|
patches = patches.slice(i2 + 1);
|
|
51349
51429
|
}
|
|
51350
|
-
const applyPatchesImpl = getPlugin(
|
|
51351
|
-
if (isDraft(base)) {
|
|
51430
|
+
const applyPatchesImpl = getPlugin$1(PluginPatches).applyPatches_;
|
|
51431
|
+
if (isDraft$1(base)) {
|
|
51352
51432
|
return applyPatchesImpl(base, patches);
|
|
51353
51433
|
}
|
|
51354
51434
|
return this.produce(
|
|
@@ -51357,36 +51437,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51357
51437
|
);
|
|
51358
51438
|
}
|
|
51359
51439
|
};
|
|
51360
|
-
function createProxy(value, parent) {
|
|
51361
|
-
const draft = isMap$
|
|
51362
|
-
const scope = parent
|
|
51440
|
+
function createProxy$1(rootScope, value, parent, key) {
|
|
51441
|
+
const [draft, state] = isMap$2(value) ? getPlugin$1(PluginMapSet).proxyMap_(value, parent) : isSet$2(value) ? getPlugin$1(PluginMapSet).proxySet_(value, parent) : createProxyProxy$1(value, parent);
|
|
51442
|
+
const scope = parent?.scope_ ?? getCurrentScope$1();
|
|
51363
51443
|
scope.drafts_.push(draft);
|
|
51444
|
+
state.callbacks_ = parent?.callbacks_ ?? [];
|
|
51445
|
+
state.key_ = key;
|
|
51446
|
+
if (parent && key !== void 0) {
|
|
51447
|
+
registerChildFinalizationCallback(parent, state, key);
|
|
51448
|
+
} else {
|
|
51449
|
+
state.callbacks_.push(function rootDraftCleanup(rootScope2) {
|
|
51450
|
+
rootScope2.mapSetPlugin_?.fixSetContents(state);
|
|
51451
|
+
const { patchPlugin_ } = rootScope2;
|
|
51452
|
+
if (state.modified_ && patchPlugin_) {
|
|
51453
|
+
patchPlugin_.generatePatches_(state, [], rootScope2);
|
|
51454
|
+
}
|
|
51455
|
+
});
|
|
51456
|
+
}
|
|
51364
51457
|
return draft;
|
|
51365
51458
|
}
|
|
51366
|
-
function current(value) {
|
|
51367
|
-
if (!isDraft(value))
|
|
51368
|
-
die(10, value);
|
|
51369
|
-
return currentImpl(value);
|
|
51459
|
+
function current$1(value) {
|
|
51460
|
+
if (!isDraft$1(value))
|
|
51461
|
+
die$1(10, value);
|
|
51462
|
+
return currentImpl$1(value);
|
|
51370
51463
|
}
|
|
51371
|
-
function currentImpl(value) {
|
|
51372
|
-
if (!isDraftable(value) || isFrozen(value))
|
|
51464
|
+
function currentImpl$1(value) {
|
|
51465
|
+
if (!isDraftable$1(value) || isFrozen$1(value))
|
|
51373
51466
|
return value;
|
|
51374
|
-
const state = value[DRAFT_STATE];
|
|
51467
|
+
const state = value[DRAFT_STATE$1];
|
|
51375
51468
|
let copy2;
|
|
51376
51469
|
let strict = true;
|
|
51377
51470
|
if (state) {
|
|
51378
51471
|
if (!state.modified_)
|
|
51379
51472
|
return state.base_;
|
|
51380
51473
|
state.finalized_ = true;
|
|
51381
|
-
copy2 = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
51474
|
+
copy2 = shallowCopy$1(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
51382
51475
|
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
51383
51476
|
} else {
|
|
51384
|
-
copy2 = shallowCopy(value, true);
|
|
51477
|
+
copy2 = shallowCopy$1(value, true);
|
|
51385
51478
|
}
|
|
51386
|
-
each(
|
|
51479
|
+
each$1(
|
|
51387
51480
|
copy2,
|
|
51388
51481
|
(key, childValue) => {
|
|
51389
|
-
set$
|
|
51482
|
+
set$2(copy2, key, currentImpl$1(childValue));
|
|
51390
51483
|
},
|
|
51391
51484
|
strict
|
|
51392
51485
|
);
|
|
@@ -51395,259 +51488,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51395
51488
|
}
|
|
51396
51489
|
return copy2;
|
|
51397
51490
|
}
|
|
51398
|
-
|
|
51399
|
-
|
|
51400
|
-
|
|
51401
|
-
super();
|
|
51402
|
-
this[DRAFT_STATE] = {
|
|
51403
|
-
type_: 2,
|
|
51404
|
-
parent_: parent,
|
|
51405
|
-
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
51406
|
-
modified_: false,
|
|
51407
|
-
finalized_: false,
|
|
51408
|
-
copy_: void 0,
|
|
51409
|
-
assigned_: void 0,
|
|
51410
|
-
base_: target2,
|
|
51411
|
-
draft_: this,
|
|
51412
|
-
isManual_: false,
|
|
51413
|
-
revoked_: false
|
|
51414
|
-
};
|
|
51415
|
-
}
|
|
51416
|
-
get size() {
|
|
51417
|
-
return latest(this[DRAFT_STATE]).size;
|
|
51418
|
-
}
|
|
51419
|
-
has(key) {
|
|
51420
|
-
return latest(this[DRAFT_STATE]).has(key);
|
|
51421
|
-
}
|
|
51422
|
-
set(key, value) {
|
|
51423
|
-
const state = this[DRAFT_STATE];
|
|
51424
|
-
assertUnrevoked(state);
|
|
51425
|
-
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
51426
|
-
prepareMapCopy(state);
|
|
51427
|
-
markChanged(state);
|
|
51428
|
-
state.assigned_.set(key, true);
|
|
51429
|
-
state.copy_.set(key, value);
|
|
51430
|
-
state.assigned_.set(key, true);
|
|
51431
|
-
}
|
|
51432
|
-
return this;
|
|
51433
|
-
}
|
|
51434
|
-
delete(key) {
|
|
51435
|
-
if (!this.has(key)) {
|
|
51436
|
-
return false;
|
|
51437
|
-
}
|
|
51438
|
-
const state = this[DRAFT_STATE];
|
|
51439
|
-
assertUnrevoked(state);
|
|
51440
|
-
prepareMapCopy(state);
|
|
51441
|
-
markChanged(state);
|
|
51442
|
-
if (state.base_.has(key)) {
|
|
51443
|
-
state.assigned_.set(key, false);
|
|
51444
|
-
} else {
|
|
51445
|
-
state.assigned_.delete(key);
|
|
51446
|
-
}
|
|
51447
|
-
state.copy_.delete(key);
|
|
51448
|
-
return true;
|
|
51449
|
-
}
|
|
51450
|
-
clear() {
|
|
51451
|
-
const state = this[DRAFT_STATE];
|
|
51452
|
-
assertUnrevoked(state);
|
|
51453
|
-
if (latest(state).size) {
|
|
51454
|
-
prepareMapCopy(state);
|
|
51455
|
-
markChanged(state);
|
|
51456
|
-
state.assigned_ = /* @__PURE__ */ new Map();
|
|
51457
|
-
each(state.base_, (key) => {
|
|
51458
|
-
state.assigned_.set(key, false);
|
|
51459
|
-
});
|
|
51460
|
-
state.copy_.clear();
|
|
51461
|
-
}
|
|
51462
|
-
}
|
|
51463
|
-
forEach(cb, thisArg) {
|
|
51464
|
-
const state = this[DRAFT_STATE];
|
|
51465
|
-
latest(state).forEach((_value, key, _map2) => {
|
|
51466
|
-
cb.call(thisArg, this.get(key), key, this);
|
|
51467
|
-
});
|
|
51468
|
-
}
|
|
51469
|
-
get(key) {
|
|
51470
|
-
const state = this[DRAFT_STATE];
|
|
51471
|
-
assertUnrevoked(state);
|
|
51472
|
-
const value = latest(state).get(key);
|
|
51473
|
-
if (state.finalized_ || !isDraftable(value)) {
|
|
51474
|
-
return value;
|
|
51475
|
-
}
|
|
51476
|
-
if (value !== state.base_.get(key)) {
|
|
51477
|
-
return value;
|
|
51478
|
-
}
|
|
51479
|
-
const draft = createProxy(value, state);
|
|
51480
|
-
prepareMapCopy(state);
|
|
51481
|
-
state.copy_.set(key, draft);
|
|
51482
|
-
return draft;
|
|
51483
|
-
}
|
|
51484
|
-
keys() {
|
|
51485
|
-
return latest(this[DRAFT_STATE]).keys();
|
|
51486
|
-
}
|
|
51487
|
-
values() {
|
|
51488
|
-
const iterator2 = this.keys();
|
|
51489
|
-
return {
|
|
51490
|
-
[Symbol.iterator]: () => this.values(),
|
|
51491
|
-
next: () => {
|
|
51492
|
-
const r2 = iterator2.next();
|
|
51493
|
-
if (r2.done)
|
|
51494
|
-
return r2;
|
|
51495
|
-
const value = this.get(r2.value);
|
|
51496
|
-
return {
|
|
51497
|
-
done: false,
|
|
51498
|
-
value
|
|
51499
|
-
};
|
|
51500
|
-
}
|
|
51501
|
-
};
|
|
51502
|
-
}
|
|
51503
|
-
entries() {
|
|
51504
|
-
const iterator2 = this.keys();
|
|
51505
|
-
return {
|
|
51506
|
-
[Symbol.iterator]: () => this.entries(),
|
|
51507
|
-
next: () => {
|
|
51508
|
-
const r2 = iterator2.next();
|
|
51509
|
-
if (r2.done)
|
|
51510
|
-
return r2;
|
|
51511
|
-
const value = this.get(r2.value);
|
|
51512
|
-
return {
|
|
51513
|
-
done: false,
|
|
51514
|
-
value: [r2.value, value]
|
|
51515
|
-
};
|
|
51516
|
-
}
|
|
51517
|
-
};
|
|
51518
|
-
}
|
|
51519
|
-
[Symbol.iterator]() {
|
|
51520
|
-
return this.entries();
|
|
51521
|
-
}
|
|
51522
|
-
}
|
|
51523
|
-
function proxyMap_(target2, parent) {
|
|
51524
|
-
return new DraftMap(target2, parent);
|
|
51525
|
-
}
|
|
51526
|
-
function prepareMapCopy(state) {
|
|
51527
|
-
if (!state.copy_) {
|
|
51528
|
-
state.assigned_ = /* @__PURE__ */ new Map();
|
|
51529
|
-
state.copy_ = new Map(state.base_);
|
|
51530
|
-
}
|
|
51531
|
-
}
|
|
51532
|
-
class DraftSet extends Set {
|
|
51533
|
-
constructor(target2, parent) {
|
|
51534
|
-
super();
|
|
51535
|
-
this[DRAFT_STATE] = {
|
|
51536
|
-
type_: 3,
|
|
51537
|
-
parent_: parent,
|
|
51538
|
-
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
51539
|
-
modified_: false,
|
|
51540
|
-
finalized_: false,
|
|
51541
|
-
copy_: void 0,
|
|
51542
|
-
base_: target2,
|
|
51543
|
-
draft_: this,
|
|
51544
|
-
drafts_: /* @__PURE__ */ new Map(),
|
|
51545
|
-
revoked_: false,
|
|
51546
|
-
isManual_: false
|
|
51547
|
-
};
|
|
51548
|
-
}
|
|
51549
|
-
get size() {
|
|
51550
|
-
return latest(this[DRAFT_STATE]).size;
|
|
51551
|
-
}
|
|
51552
|
-
has(value) {
|
|
51553
|
-
const state = this[DRAFT_STATE];
|
|
51554
|
-
assertUnrevoked(state);
|
|
51555
|
-
if (!state.copy_) {
|
|
51556
|
-
return state.base_.has(value);
|
|
51557
|
-
}
|
|
51558
|
-
if (state.copy_.has(value))
|
|
51559
|
-
return true;
|
|
51560
|
-
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
51561
|
-
return true;
|
|
51562
|
-
return false;
|
|
51563
|
-
}
|
|
51564
|
-
add(value) {
|
|
51565
|
-
const state = this[DRAFT_STATE];
|
|
51566
|
-
assertUnrevoked(state);
|
|
51567
|
-
if (!this.has(value)) {
|
|
51568
|
-
prepareSetCopy(state);
|
|
51569
|
-
markChanged(state);
|
|
51570
|
-
state.copy_.add(value);
|
|
51571
|
-
}
|
|
51572
|
-
return this;
|
|
51573
|
-
}
|
|
51574
|
-
delete(value) {
|
|
51575
|
-
if (!this.has(value)) {
|
|
51576
|
-
return false;
|
|
51577
|
-
}
|
|
51578
|
-
const state = this[DRAFT_STATE];
|
|
51579
|
-
assertUnrevoked(state);
|
|
51580
|
-
prepareSetCopy(state);
|
|
51581
|
-
markChanged(state);
|
|
51582
|
-
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
51583
|
-
/* istanbul ignore next */
|
|
51584
|
-
false
|
|
51585
|
-
));
|
|
51586
|
-
}
|
|
51587
|
-
clear() {
|
|
51588
|
-
const state = this[DRAFT_STATE];
|
|
51589
|
-
assertUnrevoked(state);
|
|
51590
|
-
if (latest(state).size) {
|
|
51591
|
-
prepareSetCopy(state);
|
|
51592
|
-
markChanged(state);
|
|
51593
|
-
state.copy_.clear();
|
|
51594
|
-
}
|
|
51595
|
-
}
|
|
51596
|
-
values() {
|
|
51597
|
-
const state = this[DRAFT_STATE];
|
|
51598
|
-
assertUnrevoked(state);
|
|
51599
|
-
prepareSetCopy(state);
|
|
51600
|
-
return state.copy_.values();
|
|
51601
|
-
}
|
|
51602
|
-
entries() {
|
|
51603
|
-
const state = this[DRAFT_STATE];
|
|
51604
|
-
assertUnrevoked(state);
|
|
51605
|
-
prepareSetCopy(state);
|
|
51606
|
-
return state.copy_.entries();
|
|
51607
|
-
}
|
|
51608
|
-
keys() {
|
|
51609
|
-
return this.values();
|
|
51610
|
-
}
|
|
51611
|
-
[Symbol.iterator]() {
|
|
51612
|
-
return this.values();
|
|
51613
|
-
}
|
|
51614
|
-
forEach(cb, thisArg) {
|
|
51615
|
-
const iterator2 = this.values();
|
|
51616
|
-
let result = iterator2.next();
|
|
51617
|
-
while (!result.done) {
|
|
51618
|
-
cb.call(thisArg, result.value, result.value, this);
|
|
51619
|
-
result = iterator2.next();
|
|
51620
|
-
}
|
|
51621
|
-
}
|
|
51622
|
-
}
|
|
51623
|
-
function proxySet_(target2, parent) {
|
|
51624
|
-
return new DraftSet(target2, parent);
|
|
51625
|
-
}
|
|
51626
|
-
function prepareSetCopy(state) {
|
|
51627
|
-
if (!state.copy_) {
|
|
51628
|
-
state.copy_ = /* @__PURE__ */ new Set();
|
|
51629
|
-
state.base_.forEach((value) => {
|
|
51630
|
-
if (isDraftable(value)) {
|
|
51631
|
-
const draft = createProxy(value, state);
|
|
51632
|
-
state.drafts_.set(value, draft);
|
|
51633
|
-
state.copy_.add(draft);
|
|
51634
|
-
} else {
|
|
51635
|
-
state.copy_.add(value);
|
|
51636
|
-
}
|
|
51637
|
-
});
|
|
51638
|
-
}
|
|
51639
|
-
}
|
|
51640
|
-
function assertUnrevoked(state) {
|
|
51641
|
-
if (state.revoked_)
|
|
51642
|
-
die(3, JSON.stringify(latest(state)));
|
|
51643
|
-
}
|
|
51644
|
-
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
51645
|
-
}
|
|
51646
|
-
var immer = new Immer2();
|
|
51647
|
-
var produce = immer.produce;
|
|
51648
|
-
function castDraft(value) {
|
|
51649
|
-
return value;
|
|
51650
|
-
}
|
|
51491
|
+
var immer$1 = new Immer2$1();
|
|
51492
|
+
var produce = immer$1.produce;
|
|
51493
|
+
var castDraft$1 = (value) => value;
|
|
51651
51494
|
const filterAction = (...types) => filter$1((x2) => types.includes(x2.type));
|
|
51652
51495
|
class FlowSubject extends Observable {
|
|
51653
51496
|
/**
|
|
@@ -51834,7 +51677,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51834
51677
|
const isFailureAction = (action) => isActionWithSuffix(action, "failure");
|
|
51835
51678
|
const isCompleteAction = (action) => isSuccessAction(action) || isFailureAction(action);
|
|
51836
51679
|
function freezeDraftable(val) {
|
|
51837
|
-
return isDraftable(val) ? produce(val, () => {
|
|
51680
|
+
return isDraftable$1(val) ? produce(val, () => {
|
|
51838
51681
|
}) : val;
|
|
51839
51682
|
}
|
|
51840
51683
|
function isStateFunction(x2) {
|
|
@@ -51859,14 +51702,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
51859
51702
|
}
|
|
51860
51703
|
return caseReducers.reduce((previousState, caseReducer) => {
|
|
51861
51704
|
if (caseReducer) {
|
|
51862
|
-
if (isDraft(previousState)) {
|
|
51705
|
+
if (isDraft$1(previousState)) {
|
|
51863
51706
|
const draft = previousState;
|
|
51864
51707
|
const result = caseReducer(draft, action);
|
|
51865
51708
|
if (result === void 0) {
|
|
51866
51709
|
return previousState;
|
|
51867
51710
|
}
|
|
51868
51711
|
return result;
|
|
51869
|
-
} else if (!isDraftable(previousState)) {
|
|
51712
|
+
} else if (!isDraftable$1(previousState)) {
|
|
51870
51713
|
const result = caseReducer(previousState, action);
|
|
51871
51714
|
if (result === void 0) {
|
|
51872
51715
|
if (previousState === null) {
|
|
@@ -52172,12 +52015,30 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52172
52015
|
this._set("parent", parent);
|
|
52173
52016
|
return this;
|
|
52174
52017
|
}
|
|
52018
|
+
/**
|
|
52019
|
+
* Attaches an observable stream of telemetry items to the configurator.
|
|
52020
|
+
*
|
|
52021
|
+
* @param item$ - An observable input stream of telemetry items to be processed.
|
|
52022
|
+
* @returns The current instance for method chaining.
|
|
52023
|
+
*/
|
|
52175
52024
|
attachItems(item$) {
|
|
52176
52025
|
this._set("items$", item$);
|
|
52177
52026
|
return this;
|
|
52178
52027
|
}
|
|
52028
|
+
/**
|
|
52029
|
+
* Sets the filter configuration for telemetry items.
|
|
52030
|
+
*
|
|
52031
|
+
* The filter determines which telemetry items should be passed to adapters and/or relayed to parent providers.
|
|
52032
|
+
*
|
|
52033
|
+
* @param filter - Either a filter object with `adapter` and `relay` functions, or a callback that returns such a filter object.
|
|
52034
|
+
* @returns The current instance for method chaining.
|
|
52035
|
+
*/
|
|
52036
|
+
setFilter(filter2) {
|
|
52037
|
+
this._set("filter", filter2);
|
|
52038
|
+
return this;
|
|
52039
|
+
}
|
|
52179
52040
|
}
|
|
52180
|
-
const version$9 = "4.
|
|
52041
|
+
const version$9 = "4.6.3";
|
|
52181
52042
|
var TelemetryLevel;
|
|
52182
52043
|
(function(TelemetryLevel2) {
|
|
52183
52044
|
TelemetryLevel2[TelemetryLevel2["Debug"] = 0] = "Debug";
|
|
@@ -52380,6 +52241,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52380
52241
|
#items = new Subject();
|
|
52381
52242
|
#initialized = false;
|
|
52382
52243
|
#adapters = {};
|
|
52244
|
+
#filters;
|
|
52383
52245
|
#defaultScope;
|
|
52384
52246
|
#eventProvider;
|
|
52385
52247
|
get items() {
|
|
@@ -52402,6 +52264,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52402
52264
|
this.#metadata = config2?.metadata;
|
|
52403
52265
|
this.#defaultScope = config2?.defaultScope ?? [];
|
|
52404
52266
|
this.#eventProvider = deps?.event;
|
|
52267
|
+
this.#filters = config2?.filter;
|
|
52405
52268
|
}
|
|
52406
52269
|
/**
|
|
52407
52270
|
* Initializes the telemetry provider with adapters, parent provider, and optional initial items.
|
|
@@ -52446,7 +52309,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52446
52309
|
*/
|
|
52447
52310
|
async _initializeAdapters() {
|
|
52448
52311
|
const adapterEntries = Object.entries(this.#adapters);
|
|
52449
|
-
const initializationPromises = adapterEntries.map(([
|
|
52312
|
+
const initializationPromises = adapterEntries.map(([_identifier, adapter]) => adapter.initialize());
|
|
52450
52313
|
const results = await Promise.allSettled(initializationPromises);
|
|
52451
52314
|
for (const [index2, result] of results.entries()) {
|
|
52452
52315
|
if (result.status === "rejected") {
|
|
@@ -52460,6 +52323,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52460
52323
|
/**
|
|
52461
52324
|
* Subscribes all adapters to the telemetry item stream.
|
|
52462
52325
|
* Each adapter processes every telemetry item as it is emitted.
|
|
52326
|
+
* If an adapter filter is configured, only items that pass the filter will be sent to adapters.
|
|
52463
52327
|
* If an adapter throws, the error is dispatched as a telemetry error event.
|
|
52464
52328
|
*
|
|
52465
52329
|
* @returns Subscription to the telemetry item stream
|
|
@@ -52470,6 +52334,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52470
52334
|
throw new Error("TelemetryProvider is not initialized");
|
|
52471
52335
|
}
|
|
52472
52336
|
return this.#items.subscribe((item) => {
|
|
52337
|
+
const { adapter: adapterFilter } = this.#filters ?? {};
|
|
52338
|
+
if (adapterFilter && !adapterFilter(item)) {
|
|
52339
|
+
return;
|
|
52340
|
+
}
|
|
52473
52341
|
for (const [identifier2, adapter] of Object.entries(this.#adapters)) {
|
|
52474
52342
|
try {
|
|
52475
52343
|
Promise.resolve(adapter.processItem(item));
|
|
@@ -52486,12 +52354,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
52486
52354
|
*
|
|
52487
52355
|
* Subscribes to the internal telemetry item stream and forwards each processed item
|
|
52488
52356
|
* to the specified target provider by invoking its `track` method.
|
|
52357
|
+
* If a relay filter is configured, only items that pass the filter will be relayed.
|
|
52489
52358
|
*
|
|
52490
52359
|
* @param target - The telemetry provider to which telemetry data should be relayed.
|
|
52491
52360
|
* @returns A Subscription object that can be used to unsubscribe from the relay.
|
|
52492
52361
|
*/
|
|
52493
52362
|
_relayTelemetryData(target2) {
|
|
52494
|
-
return this.#items.subscribe((item) =>
|
|
52363
|
+
return this.#items.subscribe((item) => {
|
|
52364
|
+
const { relay: relayFilter } = this.#filters ?? {};
|
|
52365
|
+
if (relayFilter && !relayFilter(item)) {
|
|
52366
|
+
return;
|
|
52367
|
+
}
|
|
52368
|
+
target2.track(item);
|
|
52369
|
+
});
|
|
52495
52370
|
}
|
|
52496
52371
|
/**
|
|
52497
52372
|
* Dispatches a telemetry event to the event provider, if available.
|
|
@@ -67724,7 +67599,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
67724
67599
|
};
|
|
67725
67600
|
const createReducer$2 = (initial = {}) => createReducer$3(initial, (builder) => {
|
|
67726
67601
|
builder.addCase(actions$2.request, (state, action) => {
|
|
67727
|
-
state[action.meta.transaction] = castDraft({
|
|
67602
|
+
state[action.meta.transaction] = castDraft$1({
|
|
67728
67603
|
...action.payload,
|
|
67729
67604
|
...action.meta,
|
|
67730
67605
|
execution: [],
|
|
@@ -68179,6 +68054,983 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
68179
68054
|
};
|
|
68180
68055
|
}
|
|
68181
68056
|
const actions$1 = createActions$1();
|
|
68057
|
+
var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
|
|
68058
|
+
var DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable");
|
|
68059
|
+
var DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
|
|
68060
|
+
var errors = process.env.NODE_ENV !== "production" ? [
|
|
68061
|
+
// All error codes, starting by 0:
|
|
68062
|
+
function(plugin) {
|
|
68063
|
+
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
68064
|
+
},
|
|
68065
|
+
function(thing) {
|
|
68066
|
+
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}'`;
|
|
68067
|
+
},
|
|
68068
|
+
"This object has been frozen and should not be mutated",
|
|
68069
|
+
function(data) {
|
|
68070
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
68071
|
+
},
|
|
68072
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
68073
|
+
"Immer forbids circular references",
|
|
68074
|
+
"The first or second argument to `produce` must be a function",
|
|
68075
|
+
"The third argument to `produce` must be a function or undefined",
|
|
68076
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
68077
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
68078
|
+
function(thing) {
|
|
68079
|
+
return `'current' expects a draft, got: ${thing}`;
|
|
68080
|
+
},
|
|
68081
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
68082
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
68083
|
+
"Immer only supports deleting array indices",
|
|
68084
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
68085
|
+
function(thing) {
|
|
68086
|
+
return `'original' expects a draft, got: ${thing}`;
|
|
68087
|
+
}
|
|
68088
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
68089
|
+
// See Patches.ts for additional errors
|
|
68090
|
+
] : [];
|
|
68091
|
+
function die(error2, ...args) {
|
|
68092
|
+
if (process.env.NODE_ENV !== "production") {
|
|
68093
|
+
const e2 = errors[error2];
|
|
68094
|
+
const msg = typeof e2 === "function" ? e2.apply(null, args) : e2;
|
|
68095
|
+
throw new Error(`[Immer] ${msg}`);
|
|
68096
|
+
}
|
|
68097
|
+
throw new Error(
|
|
68098
|
+
`[Immer] minified error nr: ${error2}. Full error at: https://bit.ly/3cXEKWf`
|
|
68099
|
+
);
|
|
68100
|
+
}
|
|
68101
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
|
68102
|
+
function isDraft(value) {
|
|
68103
|
+
return !!value && !!value[DRAFT_STATE];
|
|
68104
|
+
}
|
|
68105
|
+
function isDraftable(value) {
|
|
68106
|
+
if (!value)
|
|
68107
|
+
return false;
|
|
68108
|
+
return isPlainObject$2(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap$1(value) || isSet$1(value);
|
|
68109
|
+
}
|
|
68110
|
+
var objectCtorString = Object.prototype.constructor.toString();
|
|
68111
|
+
var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
|
|
68112
|
+
function isPlainObject$2(value) {
|
|
68113
|
+
if (!value || typeof value !== "object")
|
|
68114
|
+
return false;
|
|
68115
|
+
const proto = Object.getPrototypeOf(value);
|
|
68116
|
+
if (proto === null || proto === Object.prototype)
|
|
68117
|
+
return true;
|
|
68118
|
+
const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
68119
|
+
if (Ctor === Object)
|
|
68120
|
+
return true;
|
|
68121
|
+
if (typeof Ctor !== "function")
|
|
68122
|
+
return false;
|
|
68123
|
+
let ctorString = cachedCtorStrings.get(Ctor);
|
|
68124
|
+
if (ctorString === void 0) {
|
|
68125
|
+
ctorString = Function.toString.call(Ctor);
|
|
68126
|
+
cachedCtorStrings.set(Ctor, ctorString);
|
|
68127
|
+
}
|
|
68128
|
+
return ctorString === objectCtorString;
|
|
68129
|
+
}
|
|
68130
|
+
function each(obj, iter, strict = true) {
|
|
68131
|
+
if (getArchtype(obj) === 0) {
|
|
68132
|
+
const keys = strict ? Reflect.ownKeys(obj) : Object.keys(obj);
|
|
68133
|
+
keys.forEach((key) => {
|
|
68134
|
+
iter(key, obj[key], obj);
|
|
68135
|
+
});
|
|
68136
|
+
} else {
|
|
68137
|
+
obj.forEach((entry, index2) => iter(index2, entry, obj));
|
|
68138
|
+
}
|
|
68139
|
+
}
|
|
68140
|
+
function getArchtype(thing) {
|
|
68141
|
+
const state = thing[DRAFT_STATE];
|
|
68142
|
+
return state ? state.type_ : Array.isArray(thing) ? 1 : isMap$1(thing) ? 2 : isSet$1(thing) ? 3 : 0;
|
|
68143
|
+
}
|
|
68144
|
+
function has(thing, prop) {
|
|
68145
|
+
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
68146
|
+
}
|
|
68147
|
+
function set$1(thing, propOrOldValue, value) {
|
|
68148
|
+
const t2 = getArchtype(thing);
|
|
68149
|
+
if (t2 === 2)
|
|
68150
|
+
thing.set(propOrOldValue, value);
|
|
68151
|
+
else if (t2 === 3) {
|
|
68152
|
+
thing.add(value);
|
|
68153
|
+
} else
|
|
68154
|
+
thing[propOrOldValue] = value;
|
|
68155
|
+
}
|
|
68156
|
+
function is(x2, y2) {
|
|
68157
|
+
if (x2 === y2) {
|
|
68158
|
+
return x2 !== 0 || 1 / x2 === 1 / y2;
|
|
68159
|
+
} else {
|
|
68160
|
+
return x2 !== x2 && y2 !== y2;
|
|
68161
|
+
}
|
|
68162
|
+
}
|
|
68163
|
+
function isMap$1(target2) {
|
|
68164
|
+
return target2 instanceof Map;
|
|
68165
|
+
}
|
|
68166
|
+
function isSet$1(target2) {
|
|
68167
|
+
return target2 instanceof Set;
|
|
68168
|
+
}
|
|
68169
|
+
function latest(state) {
|
|
68170
|
+
return state.copy_ || state.base_;
|
|
68171
|
+
}
|
|
68172
|
+
function shallowCopy(base, strict) {
|
|
68173
|
+
if (isMap$1(base)) {
|
|
68174
|
+
return new Map(base);
|
|
68175
|
+
}
|
|
68176
|
+
if (isSet$1(base)) {
|
|
68177
|
+
return new Set(base);
|
|
68178
|
+
}
|
|
68179
|
+
if (Array.isArray(base))
|
|
68180
|
+
return Array.prototype.slice.call(base);
|
|
68181
|
+
const isPlain = isPlainObject$2(base);
|
|
68182
|
+
if (strict === true || strict === "class_only" && !isPlain) {
|
|
68183
|
+
const descriptors = Object.getOwnPropertyDescriptors(base);
|
|
68184
|
+
delete descriptors[DRAFT_STATE];
|
|
68185
|
+
let keys = Reflect.ownKeys(descriptors);
|
|
68186
|
+
for (let i2 = 0; i2 < keys.length; i2++) {
|
|
68187
|
+
const key = keys[i2];
|
|
68188
|
+
const desc = descriptors[key];
|
|
68189
|
+
if (desc.writable === false) {
|
|
68190
|
+
desc.writable = true;
|
|
68191
|
+
desc.configurable = true;
|
|
68192
|
+
}
|
|
68193
|
+
if (desc.get || desc.set)
|
|
68194
|
+
descriptors[key] = {
|
|
68195
|
+
configurable: true,
|
|
68196
|
+
writable: true,
|
|
68197
|
+
// could live with !!desc.set as well here...
|
|
68198
|
+
enumerable: desc.enumerable,
|
|
68199
|
+
value: base[key]
|
|
68200
|
+
};
|
|
68201
|
+
}
|
|
68202
|
+
return Object.create(getPrototypeOf(base), descriptors);
|
|
68203
|
+
} else {
|
|
68204
|
+
const proto = getPrototypeOf(base);
|
|
68205
|
+
if (proto !== null && isPlain) {
|
|
68206
|
+
return { ...base };
|
|
68207
|
+
}
|
|
68208
|
+
const obj = Object.create(proto);
|
|
68209
|
+
return Object.assign(obj, base);
|
|
68210
|
+
}
|
|
68211
|
+
}
|
|
68212
|
+
function freeze(obj, deep = false) {
|
|
68213
|
+
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
68214
|
+
return obj;
|
|
68215
|
+
if (getArchtype(obj) > 1) {
|
|
68216
|
+
Object.defineProperties(obj, {
|
|
68217
|
+
set: dontMutateMethodOverride,
|
|
68218
|
+
add: dontMutateMethodOverride,
|
|
68219
|
+
clear: dontMutateMethodOverride,
|
|
68220
|
+
delete: dontMutateMethodOverride
|
|
68221
|
+
});
|
|
68222
|
+
}
|
|
68223
|
+
Object.freeze(obj);
|
|
68224
|
+
if (deep)
|
|
68225
|
+
Object.values(obj).forEach((value) => freeze(value, true));
|
|
68226
|
+
return obj;
|
|
68227
|
+
}
|
|
68228
|
+
function dontMutateFrozenCollections() {
|
|
68229
|
+
die(2);
|
|
68230
|
+
}
|
|
68231
|
+
var dontMutateMethodOverride = {
|
|
68232
|
+
value: dontMutateFrozenCollections
|
|
68233
|
+
};
|
|
68234
|
+
function isFrozen(obj) {
|
|
68235
|
+
if (obj === null || typeof obj !== "object")
|
|
68236
|
+
return true;
|
|
68237
|
+
return Object.isFrozen(obj);
|
|
68238
|
+
}
|
|
68239
|
+
var plugins = {};
|
|
68240
|
+
function getPlugin(pluginKey) {
|
|
68241
|
+
const plugin = plugins[pluginKey];
|
|
68242
|
+
if (!plugin) {
|
|
68243
|
+
die(0, pluginKey);
|
|
68244
|
+
}
|
|
68245
|
+
return plugin;
|
|
68246
|
+
}
|
|
68247
|
+
function loadPlugin(pluginKey, implementation) {
|
|
68248
|
+
if (!plugins[pluginKey])
|
|
68249
|
+
plugins[pluginKey] = implementation;
|
|
68250
|
+
}
|
|
68251
|
+
var currentScope;
|
|
68252
|
+
function getCurrentScope() {
|
|
68253
|
+
return currentScope;
|
|
68254
|
+
}
|
|
68255
|
+
function createScope(parent_, immer_) {
|
|
68256
|
+
return {
|
|
68257
|
+
drafts_: [],
|
|
68258
|
+
parent_,
|
|
68259
|
+
immer_,
|
|
68260
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
68261
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
68262
|
+
canAutoFreeze_: true,
|
|
68263
|
+
unfinalizedDrafts_: 0
|
|
68264
|
+
};
|
|
68265
|
+
}
|
|
68266
|
+
function usePatchesInScope(scope, patchListener) {
|
|
68267
|
+
if (patchListener) {
|
|
68268
|
+
getPlugin("Patches");
|
|
68269
|
+
scope.patches_ = [];
|
|
68270
|
+
scope.inversePatches_ = [];
|
|
68271
|
+
scope.patchListener_ = patchListener;
|
|
68272
|
+
}
|
|
68273
|
+
}
|
|
68274
|
+
function revokeScope(scope) {
|
|
68275
|
+
leaveScope(scope);
|
|
68276
|
+
scope.drafts_.forEach(revokeDraft);
|
|
68277
|
+
scope.drafts_ = null;
|
|
68278
|
+
}
|
|
68279
|
+
function leaveScope(scope) {
|
|
68280
|
+
if (scope === currentScope) {
|
|
68281
|
+
currentScope = scope.parent_;
|
|
68282
|
+
}
|
|
68283
|
+
}
|
|
68284
|
+
function enterScope(immer2) {
|
|
68285
|
+
return currentScope = createScope(currentScope, immer2);
|
|
68286
|
+
}
|
|
68287
|
+
function revokeDraft(draft) {
|
|
68288
|
+
const state = draft[DRAFT_STATE];
|
|
68289
|
+
if (state.type_ === 0 || state.type_ === 1)
|
|
68290
|
+
state.revoke_();
|
|
68291
|
+
else
|
|
68292
|
+
state.revoked_ = true;
|
|
68293
|
+
}
|
|
68294
|
+
function processResult(result, scope) {
|
|
68295
|
+
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
68296
|
+
const baseDraft = scope.drafts_[0];
|
|
68297
|
+
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
68298
|
+
if (isReplaced) {
|
|
68299
|
+
if (baseDraft[DRAFT_STATE].modified_) {
|
|
68300
|
+
revokeScope(scope);
|
|
68301
|
+
die(4);
|
|
68302
|
+
}
|
|
68303
|
+
if (isDraftable(result)) {
|
|
68304
|
+
result = finalize(scope, result);
|
|
68305
|
+
if (!scope.parent_)
|
|
68306
|
+
maybeFreeze(scope, result);
|
|
68307
|
+
}
|
|
68308
|
+
if (scope.patches_) {
|
|
68309
|
+
getPlugin("Patches").generateReplacementPatches_(
|
|
68310
|
+
baseDraft[DRAFT_STATE].base_,
|
|
68311
|
+
result,
|
|
68312
|
+
scope.patches_,
|
|
68313
|
+
scope.inversePatches_
|
|
68314
|
+
);
|
|
68315
|
+
}
|
|
68316
|
+
} else {
|
|
68317
|
+
result = finalize(scope, baseDraft, []);
|
|
68318
|
+
}
|
|
68319
|
+
revokeScope(scope);
|
|
68320
|
+
if (scope.patches_) {
|
|
68321
|
+
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
68322
|
+
}
|
|
68323
|
+
return result !== NOTHING ? result : void 0;
|
|
68324
|
+
}
|
|
68325
|
+
function finalize(rootScope, value, path) {
|
|
68326
|
+
if (isFrozen(value))
|
|
68327
|
+
return value;
|
|
68328
|
+
const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
|
|
68329
|
+
const state = value[DRAFT_STATE];
|
|
68330
|
+
if (!state) {
|
|
68331
|
+
each(
|
|
68332
|
+
value,
|
|
68333
|
+
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path),
|
|
68334
|
+
useStrictIteration
|
|
68335
|
+
);
|
|
68336
|
+
return value;
|
|
68337
|
+
}
|
|
68338
|
+
if (state.scope_ !== rootScope)
|
|
68339
|
+
return value;
|
|
68340
|
+
if (!state.modified_) {
|
|
68341
|
+
maybeFreeze(rootScope, state.base_, true);
|
|
68342
|
+
return state.base_;
|
|
68343
|
+
}
|
|
68344
|
+
if (!state.finalized_) {
|
|
68345
|
+
state.finalized_ = true;
|
|
68346
|
+
state.scope_.unfinalizedDrafts_--;
|
|
68347
|
+
const result = state.copy_;
|
|
68348
|
+
let resultEach = result;
|
|
68349
|
+
let isSet2 = false;
|
|
68350
|
+
if (state.type_ === 3) {
|
|
68351
|
+
resultEach = new Set(result);
|
|
68352
|
+
result.clear();
|
|
68353
|
+
isSet2 = true;
|
|
68354
|
+
}
|
|
68355
|
+
each(
|
|
68356
|
+
resultEach,
|
|
68357
|
+
(key, childValue) => finalizeProperty(
|
|
68358
|
+
rootScope,
|
|
68359
|
+
state,
|
|
68360
|
+
result,
|
|
68361
|
+
key,
|
|
68362
|
+
childValue,
|
|
68363
|
+
path,
|
|
68364
|
+
isSet2
|
|
68365
|
+
),
|
|
68366
|
+
useStrictIteration
|
|
68367
|
+
);
|
|
68368
|
+
maybeFreeze(rootScope, result, false);
|
|
68369
|
+
if (path && rootScope.patches_) {
|
|
68370
|
+
getPlugin("Patches").generatePatches_(
|
|
68371
|
+
state,
|
|
68372
|
+
path,
|
|
68373
|
+
rootScope.patches_,
|
|
68374
|
+
rootScope.inversePatches_
|
|
68375
|
+
);
|
|
68376
|
+
}
|
|
68377
|
+
}
|
|
68378
|
+
return state.copy_;
|
|
68379
|
+
}
|
|
68380
|
+
function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
|
|
68381
|
+
if (childValue == null) {
|
|
68382
|
+
return;
|
|
68383
|
+
}
|
|
68384
|
+
if (typeof childValue !== "object" && !targetIsSet) {
|
|
68385
|
+
return;
|
|
68386
|
+
}
|
|
68387
|
+
const childIsFrozen = isFrozen(childValue);
|
|
68388
|
+
if (childIsFrozen && !targetIsSet) {
|
|
68389
|
+
return;
|
|
68390
|
+
}
|
|
68391
|
+
if (process.env.NODE_ENV !== "production" && childValue === targetObject)
|
|
68392
|
+
die(5);
|
|
68393
|
+
if (isDraft(childValue)) {
|
|
68394
|
+
const path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
|
|
68395
|
+
!has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
68396
|
+
const res = finalize(rootScope, childValue, path);
|
|
68397
|
+
set$1(targetObject, prop, res);
|
|
68398
|
+
if (isDraft(res)) {
|
|
68399
|
+
rootScope.canAutoFreeze_ = false;
|
|
68400
|
+
} else
|
|
68401
|
+
return;
|
|
68402
|
+
} else if (targetIsSet) {
|
|
68403
|
+
targetObject.add(childValue);
|
|
68404
|
+
}
|
|
68405
|
+
if (isDraftable(childValue) && !childIsFrozen) {
|
|
68406
|
+
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
68407
|
+
return;
|
|
68408
|
+
}
|
|
68409
|
+
if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) {
|
|
68410
|
+
return;
|
|
68411
|
+
}
|
|
68412
|
+
finalize(rootScope, childValue);
|
|
68413
|
+
if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap$1(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop)))
|
|
68414
|
+
maybeFreeze(rootScope, childValue);
|
|
68415
|
+
}
|
|
68416
|
+
}
|
|
68417
|
+
function maybeFreeze(scope, value, deep = false) {
|
|
68418
|
+
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
68419
|
+
freeze(value, deep);
|
|
68420
|
+
}
|
|
68421
|
+
}
|
|
68422
|
+
function createProxyProxy(base, parent) {
|
|
68423
|
+
const isArray3 = Array.isArray(base);
|
|
68424
|
+
const state = {
|
|
68425
|
+
type_: isArray3 ? 1 : 0,
|
|
68426
|
+
// Track which produce call this is associated with.
|
|
68427
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
68428
|
+
// True for both shallow and deep changes.
|
|
68429
|
+
modified_: false,
|
|
68430
|
+
// Used during finalization.
|
|
68431
|
+
finalized_: false,
|
|
68432
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
68433
|
+
assigned_: {},
|
|
68434
|
+
// The parent draft state.
|
|
68435
|
+
parent_: parent,
|
|
68436
|
+
// The base state.
|
|
68437
|
+
base_: base,
|
|
68438
|
+
// The base proxy.
|
|
68439
|
+
draft_: null,
|
|
68440
|
+
// set below
|
|
68441
|
+
// The base copy with any updated values.
|
|
68442
|
+
copy_: null,
|
|
68443
|
+
// Called by the `produce` function.
|
|
68444
|
+
revoke_: null,
|
|
68445
|
+
isManual_: false
|
|
68446
|
+
};
|
|
68447
|
+
let target2 = state;
|
|
68448
|
+
let traps = objectTraps;
|
|
68449
|
+
if (isArray3) {
|
|
68450
|
+
target2 = [state];
|
|
68451
|
+
traps = arrayTraps;
|
|
68452
|
+
}
|
|
68453
|
+
const { revoke, proxy } = Proxy.revocable(target2, traps);
|
|
68454
|
+
state.draft_ = proxy;
|
|
68455
|
+
state.revoke_ = revoke;
|
|
68456
|
+
return proxy;
|
|
68457
|
+
}
|
|
68458
|
+
var objectTraps = {
|
|
68459
|
+
get(state, prop) {
|
|
68460
|
+
if (prop === DRAFT_STATE)
|
|
68461
|
+
return state;
|
|
68462
|
+
const source = latest(state);
|
|
68463
|
+
if (!has(source, prop)) {
|
|
68464
|
+
return readPropFromProto(state, source, prop);
|
|
68465
|
+
}
|
|
68466
|
+
const value = source[prop];
|
|
68467
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
68468
|
+
return value;
|
|
68469
|
+
}
|
|
68470
|
+
if (value === peek$1(state.base_, prop)) {
|
|
68471
|
+
prepareCopy(state);
|
|
68472
|
+
return state.copy_[prop] = createProxy(value, state);
|
|
68473
|
+
}
|
|
68474
|
+
return value;
|
|
68475
|
+
},
|
|
68476
|
+
has(state, prop) {
|
|
68477
|
+
return prop in latest(state);
|
|
68478
|
+
},
|
|
68479
|
+
ownKeys(state) {
|
|
68480
|
+
return Reflect.ownKeys(latest(state));
|
|
68481
|
+
},
|
|
68482
|
+
set(state, prop, value) {
|
|
68483
|
+
const desc = getDescriptorFromProto(latest(state), prop);
|
|
68484
|
+
if (desc?.set) {
|
|
68485
|
+
desc.set.call(state.draft_, value);
|
|
68486
|
+
return true;
|
|
68487
|
+
}
|
|
68488
|
+
if (!state.modified_) {
|
|
68489
|
+
const current2 = peek$1(latest(state), prop);
|
|
68490
|
+
const currentState = current2?.[DRAFT_STATE];
|
|
68491
|
+
if (currentState && currentState.base_ === value) {
|
|
68492
|
+
state.copy_[prop] = value;
|
|
68493
|
+
state.assigned_[prop] = false;
|
|
68494
|
+
return true;
|
|
68495
|
+
}
|
|
68496
|
+
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
68497
|
+
return true;
|
|
68498
|
+
prepareCopy(state);
|
|
68499
|
+
markChanged(state);
|
|
68500
|
+
}
|
|
68501
|
+
if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
|
|
68502
|
+
(value !== void 0 || prop in state.copy_) || // special case: NaN
|
|
68503
|
+
Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
68504
|
+
return true;
|
|
68505
|
+
state.copy_[prop] = value;
|
|
68506
|
+
state.assigned_[prop] = true;
|
|
68507
|
+
return true;
|
|
68508
|
+
},
|
|
68509
|
+
deleteProperty(state, prop) {
|
|
68510
|
+
if (peek$1(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
68511
|
+
state.assigned_[prop] = false;
|
|
68512
|
+
prepareCopy(state);
|
|
68513
|
+
markChanged(state);
|
|
68514
|
+
} else {
|
|
68515
|
+
delete state.assigned_[prop];
|
|
68516
|
+
}
|
|
68517
|
+
if (state.copy_) {
|
|
68518
|
+
delete state.copy_[prop];
|
|
68519
|
+
}
|
|
68520
|
+
return true;
|
|
68521
|
+
},
|
|
68522
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
68523
|
+
// the same guarantee in ES5 mode.
|
|
68524
|
+
getOwnPropertyDescriptor(state, prop) {
|
|
68525
|
+
const owner = latest(state);
|
|
68526
|
+
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
68527
|
+
if (!desc)
|
|
68528
|
+
return desc;
|
|
68529
|
+
return {
|
|
68530
|
+
writable: true,
|
|
68531
|
+
configurable: state.type_ !== 1 || prop !== "length",
|
|
68532
|
+
enumerable: desc.enumerable,
|
|
68533
|
+
value: owner[prop]
|
|
68534
|
+
};
|
|
68535
|
+
},
|
|
68536
|
+
defineProperty() {
|
|
68537
|
+
die(11);
|
|
68538
|
+
},
|
|
68539
|
+
getPrototypeOf(state) {
|
|
68540
|
+
return getPrototypeOf(state.base_);
|
|
68541
|
+
},
|
|
68542
|
+
setPrototypeOf() {
|
|
68543
|
+
die(12);
|
|
68544
|
+
}
|
|
68545
|
+
};
|
|
68546
|
+
var arrayTraps = {};
|
|
68547
|
+
each(objectTraps, (key, fn) => {
|
|
68548
|
+
arrayTraps[key] = function() {
|
|
68549
|
+
arguments[0] = arguments[0][0];
|
|
68550
|
+
return fn.apply(this, arguments);
|
|
68551
|
+
};
|
|
68552
|
+
});
|
|
68553
|
+
arrayTraps.deleteProperty = function(state, prop) {
|
|
68554
|
+
if (process.env.NODE_ENV !== "production" && isNaN(parseInt(prop)))
|
|
68555
|
+
die(13);
|
|
68556
|
+
return arrayTraps.set.call(this, state, prop, void 0);
|
|
68557
|
+
};
|
|
68558
|
+
arrayTraps.set = function(state, prop, value) {
|
|
68559
|
+
if (process.env.NODE_ENV !== "production" && prop !== "length" && isNaN(parseInt(prop)))
|
|
68560
|
+
die(14);
|
|
68561
|
+
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
68562
|
+
};
|
|
68563
|
+
function peek$1(draft, prop) {
|
|
68564
|
+
const state = draft[DRAFT_STATE];
|
|
68565
|
+
const source = state ? latest(state) : draft;
|
|
68566
|
+
return source[prop];
|
|
68567
|
+
}
|
|
68568
|
+
function readPropFromProto(state, source, prop) {
|
|
68569
|
+
const desc = getDescriptorFromProto(source, prop);
|
|
68570
|
+
return desc ? `value` in desc ? desc.value : (
|
|
68571
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
68572
|
+
// prototype, we should invoke it with the draft as context!
|
|
68573
|
+
desc.get?.call(state.draft_)
|
|
68574
|
+
) : void 0;
|
|
68575
|
+
}
|
|
68576
|
+
function getDescriptorFromProto(source, prop) {
|
|
68577
|
+
if (!(prop in source))
|
|
68578
|
+
return void 0;
|
|
68579
|
+
let proto = getPrototypeOf(source);
|
|
68580
|
+
while (proto) {
|
|
68581
|
+
const desc = Object.getOwnPropertyDescriptor(proto, prop);
|
|
68582
|
+
if (desc)
|
|
68583
|
+
return desc;
|
|
68584
|
+
proto = getPrototypeOf(proto);
|
|
68585
|
+
}
|
|
68586
|
+
return void 0;
|
|
68587
|
+
}
|
|
68588
|
+
function markChanged(state) {
|
|
68589
|
+
if (!state.modified_) {
|
|
68590
|
+
state.modified_ = true;
|
|
68591
|
+
if (state.parent_) {
|
|
68592
|
+
markChanged(state.parent_);
|
|
68593
|
+
}
|
|
68594
|
+
}
|
|
68595
|
+
}
|
|
68596
|
+
function prepareCopy(state) {
|
|
68597
|
+
if (!state.copy_) {
|
|
68598
|
+
state.copy_ = shallowCopy(
|
|
68599
|
+
state.base_,
|
|
68600
|
+
state.scope_.immer_.useStrictShallowCopy_
|
|
68601
|
+
);
|
|
68602
|
+
}
|
|
68603
|
+
}
|
|
68604
|
+
var Immer2 = class {
|
|
68605
|
+
constructor(config2) {
|
|
68606
|
+
this.autoFreeze_ = true;
|
|
68607
|
+
this.useStrictShallowCopy_ = false;
|
|
68608
|
+
this.useStrictIteration_ = true;
|
|
68609
|
+
this.produce = (base, recipe, patchListener) => {
|
|
68610
|
+
if (typeof base === "function" && typeof recipe !== "function") {
|
|
68611
|
+
const defaultBase = recipe;
|
|
68612
|
+
recipe = base;
|
|
68613
|
+
const self2 = this;
|
|
68614
|
+
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
68615
|
+
return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
68616
|
+
};
|
|
68617
|
+
}
|
|
68618
|
+
if (typeof recipe !== "function")
|
|
68619
|
+
die(6);
|
|
68620
|
+
if (patchListener !== void 0 && typeof patchListener !== "function")
|
|
68621
|
+
die(7);
|
|
68622
|
+
let result;
|
|
68623
|
+
if (isDraftable(base)) {
|
|
68624
|
+
const scope = enterScope(this);
|
|
68625
|
+
const proxy = createProxy(base, void 0);
|
|
68626
|
+
let hasError = true;
|
|
68627
|
+
try {
|
|
68628
|
+
result = recipe(proxy);
|
|
68629
|
+
hasError = false;
|
|
68630
|
+
} finally {
|
|
68631
|
+
if (hasError)
|
|
68632
|
+
revokeScope(scope);
|
|
68633
|
+
else
|
|
68634
|
+
leaveScope(scope);
|
|
68635
|
+
}
|
|
68636
|
+
usePatchesInScope(scope, patchListener);
|
|
68637
|
+
return processResult(result, scope);
|
|
68638
|
+
} else if (!base || typeof base !== "object") {
|
|
68639
|
+
result = recipe(base);
|
|
68640
|
+
if (result === void 0)
|
|
68641
|
+
result = base;
|
|
68642
|
+
if (result === NOTHING)
|
|
68643
|
+
result = void 0;
|
|
68644
|
+
if (this.autoFreeze_)
|
|
68645
|
+
freeze(result, true);
|
|
68646
|
+
if (patchListener) {
|
|
68647
|
+
const p2 = [];
|
|
68648
|
+
const ip = [];
|
|
68649
|
+
getPlugin("Patches").generateReplacementPatches_(base, result, p2, ip);
|
|
68650
|
+
patchListener(p2, ip);
|
|
68651
|
+
}
|
|
68652
|
+
return result;
|
|
68653
|
+
} else
|
|
68654
|
+
die(1, base);
|
|
68655
|
+
};
|
|
68656
|
+
this.produceWithPatches = (base, recipe) => {
|
|
68657
|
+
if (typeof base === "function") {
|
|
68658
|
+
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
68659
|
+
}
|
|
68660
|
+
let patches, inversePatches;
|
|
68661
|
+
const result = this.produce(base, recipe, (p2, ip) => {
|
|
68662
|
+
patches = p2;
|
|
68663
|
+
inversePatches = ip;
|
|
68664
|
+
});
|
|
68665
|
+
return [result, patches, inversePatches];
|
|
68666
|
+
};
|
|
68667
|
+
if (typeof config2?.autoFreeze === "boolean")
|
|
68668
|
+
this.setAutoFreeze(config2.autoFreeze);
|
|
68669
|
+
if (typeof config2?.useStrictShallowCopy === "boolean")
|
|
68670
|
+
this.setUseStrictShallowCopy(config2.useStrictShallowCopy);
|
|
68671
|
+
if (typeof config2?.useStrictIteration === "boolean")
|
|
68672
|
+
this.setUseStrictIteration(config2.useStrictIteration);
|
|
68673
|
+
}
|
|
68674
|
+
createDraft(base) {
|
|
68675
|
+
if (!isDraftable(base))
|
|
68676
|
+
die(8);
|
|
68677
|
+
if (isDraft(base))
|
|
68678
|
+
base = current(base);
|
|
68679
|
+
const scope = enterScope(this);
|
|
68680
|
+
const proxy = createProxy(base, void 0);
|
|
68681
|
+
proxy[DRAFT_STATE].isManual_ = true;
|
|
68682
|
+
leaveScope(scope);
|
|
68683
|
+
return proxy;
|
|
68684
|
+
}
|
|
68685
|
+
finishDraft(draft, patchListener) {
|
|
68686
|
+
const state = draft && draft[DRAFT_STATE];
|
|
68687
|
+
if (!state || !state.isManual_)
|
|
68688
|
+
die(9);
|
|
68689
|
+
const { scope_: scope } = state;
|
|
68690
|
+
usePatchesInScope(scope, patchListener);
|
|
68691
|
+
return processResult(void 0, scope);
|
|
68692
|
+
}
|
|
68693
|
+
/**
|
|
68694
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
68695
|
+
*
|
|
68696
|
+
* By default, auto-freezing is enabled.
|
|
68697
|
+
*/
|
|
68698
|
+
setAutoFreeze(value) {
|
|
68699
|
+
this.autoFreeze_ = value;
|
|
68700
|
+
}
|
|
68701
|
+
/**
|
|
68702
|
+
* Pass true to enable strict shallow copy.
|
|
68703
|
+
*
|
|
68704
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
68705
|
+
*/
|
|
68706
|
+
setUseStrictShallowCopy(value) {
|
|
68707
|
+
this.useStrictShallowCopy_ = value;
|
|
68708
|
+
}
|
|
68709
|
+
/**
|
|
68710
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
68711
|
+
* but still handles symbols for compatibility.
|
|
68712
|
+
*
|
|
68713
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
68714
|
+
*/
|
|
68715
|
+
setUseStrictIteration(value) {
|
|
68716
|
+
this.useStrictIteration_ = value;
|
|
68717
|
+
}
|
|
68718
|
+
shouldUseStrictIteration() {
|
|
68719
|
+
return this.useStrictIteration_;
|
|
68720
|
+
}
|
|
68721
|
+
applyPatches(base, patches) {
|
|
68722
|
+
let i2;
|
|
68723
|
+
for (i2 = patches.length - 1; i2 >= 0; i2--) {
|
|
68724
|
+
const patch = patches[i2];
|
|
68725
|
+
if (patch.path.length === 0 && patch.op === "replace") {
|
|
68726
|
+
base = patch.value;
|
|
68727
|
+
break;
|
|
68728
|
+
}
|
|
68729
|
+
}
|
|
68730
|
+
if (i2 > -1) {
|
|
68731
|
+
patches = patches.slice(i2 + 1);
|
|
68732
|
+
}
|
|
68733
|
+
const applyPatchesImpl = getPlugin("Patches").applyPatches_;
|
|
68734
|
+
if (isDraft(base)) {
|
|
68735
|
+
return applyPatchesImpl(base, patches);
|
|
68736
|
+
}
|
|
68737
|
+
return this.produce(
|
|
68738
|
+
base,
|
|
68739
|
+
(draft) => applyPatchesImpl(draft, patches)
|
|
68740
|
+
);
|
|
68741
|
+
}
|
|
68742
|
+
};
|
|
68743
|
+
function createProxy(value, parent) {
|
|
68744
|
+
const draft = isMap$1(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet$1(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
68745
|
+
const scope = parent ? parent.scope_ : getCurrentScope();
|
|
68746
|
+
scope.drafts_.push(draft);
|
|
68747
|
+
return draft;
|
|
68748
|
+
}
|
|
68749
|
+
function current(value) {
|
|
68750
|
+
if (!isDraft(value))
|
|
68751
|
+
die(10, value);
|
|
68752
|
+
return currentImpl(value);
|
|
68753
|
+
}
|
|
68754
|
+
function currentImpl(value) {
|
|
68755
|
+
if (!isDraftable(value) || isFrozen(value))
|
|
68756
|
+
return value;
|
|
68757
|
+
const state = value[DRAFT_STATE];
|
|
68758
|
+
let copy2;
|
|
68759
|
+
let strict = true;
|
|
68760
|
+
if (state) {
|
|
68761
|
+
if (!state.modified_)
|
|
68762
|
+
return state.base_;
|
|
68763
|
+
state.finalized_ = true;
|
|
68764
|
+
copy2 = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
68765
|
+
strict = state.scope_.immer_.shouldUseStrictIteration();
|
|
68766
|
+
} else {
|
|
68767
|
+
copy2 = shallowCopy(value, true);
|
|
68768
|
+
}
|
|
68769
|
+
each(
|
|
68770
|
+
copy2,
|
|
68771
|
+
(key, childValue) => {
|
|
68772
|
+
set$1(copy2, key, currentImpl(childValue));
|
|
68773
|
+
},
|
|
68774
|
+
strict
|
|
68775
|
+
);
|
|
68776
|
+
if (state) {
|
|
68777
|
+
state.finalized_ = false;
|
|
68778
|
+
}
|
|
68779
|
+
return copy2;
|
|
68780
|
+
}
|
|
68781
|
+
function enableMapSet() {
|
|
68782
|
+
class DraftMap extends Map {
|
|
68783
|
+
constructor(target2, parent) {
|
|
68784
|
+
super();
|
|
68785
|
+
this[DRAFT_STATE] = {
|
|
68786
|
+
type_: 2,
|
|
68787
|
+
parent_: parent,
|
|
68788
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
68789
|
+
modified_: false,
|
|
68790
|
+
finalized_: false,
|
|
68791
|
+
copy_: void 0,
|
|
68792
|
+
assigned_: void 0,
|
|
68793
|
+
base_: target2,
|
|
68794
|
+
draft_: this,
|
|
68795
|
+
isManual_: false,
|
|
68796
|
+
revoked_: false
|
|
68797
|
+
};
|
|
68798
|
+
}
|
|
68799
|
+
get size() {
|
|
68800
|
+
return latest(this[DRAFT_STATE]).size;
|
|
68801
|
+
}
|
|
68802
|
+
has(key) {
|
|
68803
|
+
return latest(this[DRAFT_STATE]).has(key);
|
|
68804
|
+
}
|
|
68805
|
+
set(key, value) {
|
|
68806
|
+
const state = this[DRAFT_STATE];
|
|
68807
|
+
assertUnrevoked(state);
|
|
68808
|
+
if (!latest(state).has(key) || latest(state).get(key) !== value) {
|
|
68809
|
+
prepareMapCopy(state);
|
|
68810
|
+
markChanged(state);
|
|
68811
|
+
state.assigned_.set(key, true);
|
|
68812
|
+
state.copy_.set(key, value);
|
|
68813
|
+
state.assigned_.set(key, true);
|
|
68814
|
+
}
|
|
68815
|
+
return this;
|
|
68816
|
+
}
|
|
68817
|
+
delete(key) {
|
|
68818
|
+
if (!this.has(key)) {
|
|
68819
|
+
return false;
|
|
68820
|
+
}
|
|
68821
|
+
const state = this[DRAFT_STATE];
|
|
68822
|
+
assertUnrevoked(state);
|
|
68823
|
+
prepareMapCopy(state);
|
|
68824
|
+
markChanged(state);
|
|
68825
|
+
if (state.base_.has(key)) {
|
|
68826
|
+
state.assigned_.set(key, false);
|
|
68827
|
+
} else {
|
|
68828
|
+
state.assigned_.delete(key);
|
|
68829
|
+
}
|
|
68830
|
+
state.copy_.delete(key);
|
|
68831
|
+
return true;
|
|
68832
|
+
}
|
|
68833
|
+
clear() {
|
|
68834
|
+
const state = this[DRAFT_STATE];
|
|
68835
|
+
assertUnrevoked(state);
|
|
68836
|
+
if (latest(state).size) {
|
|
68837
|
+
prepareMapCopy(state);
|
|
68838
|
+
markChanged(state);
|
|
68839
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
68840
|
+
each(state.base_, (key) => {
|
|
68841
|
+
state.assigned_.set(key, false);
|
|
68842
|
+
});
|
|
68843
|
+
state.copy_.clear();
|
|
68844
|
+
}
|
|
68845
|
+
}
|
|
68846
|
+
forEach(cb, thisArg) {
|
|
68847
|
+
const state = this[DRAFT_STATE];
|
|
68848
|
+
latest(state).forEach((_value, key, _map2) => {
|
|
68849
|
+
cb.call(thisArg, this.get(key), key, this);
|
|
68850
|
+
});
|
|
68851
|
+
}
|
|
68852
|
+
get(key) {
|
|
68853
|
+
const state = this[DRAFT_STATE];
|
|
68854
|
+
assertUnrevoked(state);
|
|
68855
|
+
const value = latest(state).get(key);
|
|
68856
|
+
if (state.finalized_ || !isDraftable(value)) {
|
|
68857
|
+
return value;
|
|
68858
|
+
}
|
|
68859
|
+
if (value !== state.base_.get(key)) {
|
|
68860
|
+
return value;
|
|
68861
|
+
}
|
|
68862
|
+
const draft = createProxy(value, state);
|
|
68863
|
+
prepareMapCopy(state);
|
|
68864
|
+
state.copy_.set(key, draft);
|
|
68865
|
+
return draft;
|
|
68866
|
+
}
|
|
68867
|
+
keys() {
|
|
68868
|
+
return latest(this[DRAFT_STATE]).keys();
|
|
68869
|
+
}
|
|
68870
|
+
values() {
|
|
68871
|
+
const iterator2 = this.keys();
|
|
68872
|
+
return {
|
|
68873
|
+
[Symbol.iterator]: () => this.values(),
|
|
68874
|
+
next: () => {
|
|
68875
|
+
const r2 = iterator2.next();
|
|
68876
|
+
if (r2.done)
|
|
68877
|
+
return r2;
|
|
68878
|
+
const value = this.get(r2.value);
|
|
68879
|
+
return {
|
|
68880
|
+
done: false,
|
|
68881
|
+
value
|
|
68882
|
+
};
|
|
68883
|
+
}
|
|
68884
|
+
};
|
|
68885
|
+
}
|
|
68886
|
+
entries() {
|
|
68887
|
+
const iterator2 = this.keys();
|
|
68888
|
+
return {
|
|
68889
|
+
[Symbol.iterator]: () => this.entries(),
|
|
68890
|
+
next: () => {
|
|
68891
|
+
const r2 = iterator2.next();
|
|
68892
|
+
if (r2.done)
|
|
68893
|
+
return r2;
|
|
68894
|
+
const value = this.get(r2.value);
|
|
68895
|
+
return {
|
|
68896
|
+
done: false,
|
|
68897
|
+
value: [r2.value, value]
|
|
68898
|
+
};
|
|
68899
|
+
}
|
|
68900
|
+
};
|
|
68901
|
+
}
|
|
68902
|
+
[Symbol.iterator]() {
|
|
68903
|
+
return this.entries();
|
|
68904
|
+
}
|
|
68905
|
+
}
|
|
68906
|
+
function proxyMap_(target2, parent) {
|
|
68907
|
+
return new DraftMap(target2, parent);
|
|
68908
|
+
}
|
|
68909
|
+
function prepareMapCopy(state) {
|
|
68910
|
+
if (!state.copy_) {
|
|
68911
|
+
state.assigned_ = /* @__PURE__ */ new Map();
|
|
68912
|
+
state.copy_ = new Map(state.base_);
|
|
68913
|
+
}
|
|
68914
|
+
}
|
|
68915
|
+
class DraftSet extends Set {
|
|
68916
|
+
constructor(target2, parent) {
|
|
68917
|
+
super();
|
|
68918
|
+
this[DRAFT_STATE] = {
|
|
68919
|
+
type_: 3,
|
|
68920
|
+
parent_: parent,
|
|
68921
|
+
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
68922
|
+
modified_: false,
|
|
68923
|
+
finalized_: false,
|
|
68924
|
+
copy_: void 0,
|
|
68925
|
+
base_: target2,
|
|
68926
|
+
draft_: this,
|
|
68927
|
+
drafts_: /* @__PURE__ */ new Map(),
|
|
68928
|
+
revoked_: false,
|
|
68929
|
+
isManual_: false
|
|
68930
|
+
};
|
|
68931
|
+
}
|
|
68932
|
+
get size() {
|
|
68933
|
+
return latest(this[DRAFT_STATE]).size;
|
|
68934
|
+
}
|
|
68935
|
+
has(value) {
|
|
68936
|
+
const state = this[DRAFT_STATE];
|
|
68937
|
+
assertUnrevoked(state);
|
|
68938
|
+
if (!state.copy_) {
|
|
68939
|
+
return state.base_.has(value);
|
|
68940
|
+
}
|
|
68941
|
+
if (state.copy_.has(value))
|
|
68942
|
+
return true;
|
|
68943
|
+
if (state.drafts_.has(value) && state.copy_.has(state.drafts_.get(value)))
|
|
68944
|
+
return true;
|
|
68945
|
+
return false;
|
|
68946
|
+
}
|
|
68947
|
+
add(value) {
|
|
68948
|
+
const state = this[DRAFT_STATE];
|
|
68949
|
+
assertUnrevoked(state);
|
|
68950
|
+
if (!this.has(value)) {
|
|
68951
|
+
prepareSetCopy(state);
|
|
68952
|
+
markChanged(state);
|
|
68953
|
+
state.copy_.add(value);
|
|
68954
|
+
}
|
|
68955
|
+
return this;
|
|
68956
|
+
}
|
|
68957
|
+
delete(value) {
|
|
68958
|
+
if (!this.has(value)) {
|
|
68959
|
+
return false;
|
|
68960
|
+
}
|
|
68961
|
+
const state = this[DRAFT_STATE];
|
|
68962
|
+
assertUnrevoked(state);
|
|
68963
|
+
prepareSetCopy(state);
|
|
68964
|
+
markChanged(state);
|
|
68965
|
+
return state.copy_.delete(value) || (state.drafts_.has(value) ? state.copy_.delete(state.drafts_.get(value)) : (
|
|
68966
|
+
/* istanbul ignore next */
|
|
68967
|
+
false
|
|
68968
|
+
));
|
|
68969
|
+
}
|
|
68970
|
+
clear() {
|
|
68971
|
+
const state = this[DRAFT_STATE];
|
|
68972
|
+
assertUnrevoked(state);
|
|
68973
|
+
if (latest(state).size) {
|
|
68974
|
+
prepareSetCopy(state);
|
|
68975
|
+
markChanged(state);
|
|
68976
|
+
state.copy_.clear();
|
|
68977
|
+
}
|
|
68978
|
+
}
|
|
68979
|
+
values() {
|
|
68980
|
+
const state = this[DRAFT_STATE];
|
|
68981
|
+
assertUnrevoked(state);
|
|
68982
|
+
prepareSetCopy(state);
|
|
68983
|
+
return state.copy_.values();
|
|
68984
|
+
}
|
|
68985
|
+
entries() {
|
|
68986
|
+
const state = this[DRAFT_STATE];
|
|
68987
|
+
assertUnrevoked(state);
|
|
68988
|
+
prepareSetCopy(state);
|
|
68989
|
+
return state.copy_.entries();
|
|
68990
|
+
}
|
|
68991
|
+
keys() {
|
|
68992
|
+
return this.values();
|
|
68993
|
+
}
|
|
68994
|
+
[Symbol.iterator]() {
|
|
68995
|
+
return this.values();
|
|
68996
|
+
}
|
|
68997
|
+
forEach(cb, thisArg) {
|
|
68998
|
+
const iterator2 = this.values();
|
|
68999
|
+
let result = iterator2.next();
|
|
69000
|
+
while (!result.done) {
|
|
69001
|
+
cb.call(thisArg, result.value, result.value, this);
|
|
69002
|
+
result = iterator2.next();
|
|
69003
|
+
}
|
|
69004
|
+
}
|
|
69005
|
+
}
|
|
69006
|
+
function proxySet_(target2, parent) {
|
|
69007
|
+
return new DraftSet(target2, parent);
|
|
69008
|
+
}
|
|
69009
|
+
function prepareSetCopy(state) {
|
|
69010
|
+
if (!state.copy_) {
|
|
69011
|
+
state.copy_ = /* @__PURE__ */ new Set();
|
|
69012
|
+
state.base_.forEach((value) => {
|
|
69013
|
+
if (isDraftable(value)) {
|
|
69014
|
+
const draft = createProxy(value, state);
|
|
69015
|
+
state.drafts_.set(value, draft);
|
|
69016
|
+
state.copy_.add(draft);
|
|
69017
|
+
} else {
|
|
69018
|
+
state.copy_.add(value);
|
|
69019
|
+
}
|
|
69020
|
+
});
|
|
69021
|
+
}
|
|
69022
|
+
}
|
|
69023
|
+
function assertUnrevoked(state) {
|
|
69024
|
+
if (state.revoked_)
|
|
69025
|
+
die(3, JSON.stringify(latest(state)));
|
|
69026
|
+
}
|
|
69027
|
+
loadPlugin("MapSet", { proxyMap_, proxySet_ });
|
|
69028
|
+
}
|
|
69029
|
+
var immer = new Immer2();
|
|
69030
|
+
immer.produce;
|
|
69031
|
+
function castDraft(value) {
|
|
69032
|
+
return value;
|
|
69033
|
+
}
|
|
68182
69034
|
const sortCache = (a2, b2) => {
|
|
68183
69035
|
return (b2.updated ?? 0) - (a2.updated ?? 0);
|
|
68184
69036
|
};
|
|
@@ -68482,7 +69334,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
68482
69334
|
complete: result.completed,
|
|
68483
69335
|
value: result.value
|
|
68484
69336
|
};
|
|
68485
|
-
}), finalize$
|
|
69337
|
+
}), finalize$2(() => {
|
|
68486
69338
|
job.complete();
|
|
68487
69339
|
})).subscribe(this);
|
|
68488
69340
|
}
|
|
@@ -69260,7 +70112,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
69260
70112
|
// abort task on signal
|
|
69261
70113
|
takeUntil(abort$),
|
|
69262
70114
|
// close the observable sent to the caller
|
|
69263
|
-
finalize$
|
|
70115
|
+
finalize$2(() => subject$.complete()),
|
|
69264
70116
|
// catch any unhandled exceptions to not stall the queue
|
|
69265
70117
|
catchError((err) => {
|
|
69266
70118
|
subject$.error(err);
|
|
@@ -69270,7 +70122,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
69270
70122
|
this.#contextQueue.next(task$);
|
|
69271
70123
|
return subject$.pipe(
|
|
69272
70124
|
// if caller subscribes, unsubscribe should abort queue entry
|
|
69273
|
-
finalize$
|
|
70125
|
+
finalize$2(() => abort$.next(true))
|
|
69274
70126
|
);
|
|
69275
70127
|
}
|
|
69276
70128
|
/**
|