@thecb/components 9.0.1 → 9.0.2-beta.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/dist/index.esm.js
CHANGED
|
@@ -19010,12 +19010,14 @@ function _extends$1() {
|
|
|
19010
19010
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
19011
19011
|
for (var i = 1; i < arguments.length; i++) {
|
|
19012
19012
|
var source = arguments[i];
|
|
19013
|
+
|
|
19013
19014
|
for (var key in source) {
|
|
19014
19015
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19015
19016
|
target[key] = source[key];
|
|
19016
19017
|
}
|
|
19017
19018
|
}
|
|
19018
19019
|
}
|
|
19020
|
+
|
|
19019
19021
|
return target;
|
|
19020
19022
|
};
|
|
19021
19023
|
return _extends$1.apply(this, arguments);
|
|
@@ -19025,6 +19027,7 @@ function _assertThisInitialized(self) {
|
|
|
19025
19027
|
if (self === void 0) {
|
|
19026
19028
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
19027
19029
|
}
|
|
19030
|
+
|
|
19028
19031
|
return self;
|
|
19029
19032
|
}
|
|
19030
19033
|
|
|
@@ -19057,6 +19060,7 @@ function _isNativeReflectConstruct() {
|
|
|
19057
19060
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
19058
19061
|
if (Reflect.construct.sham) return false;
|
|
19059
19062
|
if (typeof Proxy === "function") return true;
|
|
19063
|
+
|
|
19060
19064
|
try {
|
|
19061
19065
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
19062
19066
|
return true;
|
|
@@ -19078,23 +19082,30 @@ function _construct(Parent, args, Class) {
|
|
|
19078
19082
|
return instance;
|
|
19079
19083
|
};
|
|
19080
19084
|
}
|
|
19085
|
+
|
|
19081
19086
|
return _construct.apply(null, arguments);
|
|
19082
19087
|
}
|
|
19083
19088
|
|
|
19084
19089
|
function _wrapNativeSuper(Class) {
|
|
19085
19090
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
19091
|
+
|
|
19086
19092
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
19087
19093
|
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
19094
|
+
|
|
19088
19095
|
if (typeof Class !== "function") {
|
|
19089
19096
|
throw new TypeError("Super expression must either be null or a function");
|
|
19090
19097
|
}
|
|
19098
|
+
|
|
19091
19099
|
if (typeof _cache !== "undefined") {
|
|
19092
19100
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
19101
|
+
|
|
19093
19102
|
_cache.set(Class, Wrapper);
|
|
19094
19103
|
}
|
|
19104
|
+
|
|
19095
19105
|
function Wrapper() {
|
|
19096
19106
|
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
19097
19107
|
}
|
|
19108
|
+
|
|
19098
19109
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
19099
19110
|
constructor: {
|
|
19100
19111
|
value: Wrapper,
|
|
@@ -19105,6 +19116,7 @@ function _wrapNativeSuper(Class) {
|
|
|
19105
19116
|
});
|
|
19106
19117
|
return _setPrototypeOf(Wrapper, Class);
|
|
19107
19118
|
};
|
|
19119
|
+
|
|
19108
19120
|
return _wrapNativeSuper(Class);
|
|
19109
19121
|
}
|
|
19110
19122
|
|
|
@@ -22393,7 +22405,7 @@ var check = function (it) {
|
|
|
22393
22405
|
|
|
22394
22406
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
22395
22407
|
var global_1 =
|
|
22396
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
22408
|
+
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
22397
22409
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
22398
22410
|
check(typeof window == 'object' && window) ||
|
|
22399
22411
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -22412,12 +22424,12 @@ var fails = function (exec) {
|
|
|
22412
22424
|
|
|
22413
22425
|
// Detect IE8's incomplete defineProperty implementation
|
|
22414
22426
|
var descriptors = !fails(function () {
|
|
22415
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22427
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22416
22428
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
22417
22429
|
});
|
|
22418
22430
|
|
|
22419
22431
|
var functionBindNative = !fails(function () {
|
|
22420
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
22432
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
22421
22433
|
var test = (function () { /* empty */ }).bind();
|
|
22422
22434
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
22423
22435
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -22430,7 +22442,7 @@ var functionCall = functionBindNative ? call.bind(call) : function () {
|
|
|
22430
22442
|
};
|
|
22431
22443
|
|
|
22432
22444
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
22433
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22445
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22434
22446
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
22435
22447
|
|
|
22436
22448
|
// Nashorn ~ JDK8 bug
|
|
@@ -22457,11 +22469,14 @@ var createPropertyDescriptor = function (bitmap, value) {
|
|
|
22457
22469
|
};
|
|
22458
22470
|
|
|
22459
22471
|
var FunctionPrototype = Function.prototype;
|
|
22472
|
+
var bind$1 = FunctionPrototype.bind;
|
|
22460
22473
|
var call$1 = FunctionPrototype.call;
|
|
22461
|
-
var
|
|
22474
|
+
var uncurryThis = functionBindNative && bind$1.bind(call$1, call$1);
|
|
22462
22475
|
|
|
22463
|
-
var functionUncurryThis = functionBindNative ?
|
|
22464
|
-
return
|
|
22476
|
+
var functionUncurryThis = functionBindNative ? function (fn) {
|
|
22477
|
+
return fn && uncurryThis(fn);
|
|
22478
|
+
} : function (fn) {
|
|
22479
|
+
return fn && function () {
|
|
22465
22480
|
return call$1.apply(fn, arguments);
|
|
22466
22481
|
};
|
|
22467
22482
|
};
|
|
@@ -22485,18 +22500,12 @@ var indexedObject = fails(function () {
|
|
|
22485
22500
|
return classofRaw(it) == 'String' ? split(it, '') : $Object(it);
|
|
22486
22501
|
} : $Object;
|
|
22487
22502
|
|
|
22488
|
-
// we can't use just `it == null` since of `document.all` special case
|
|
22489
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
22490
|
-
var isNullOrUndefined = function (it) {
|
|
22491
|
-
return it === null || it === undefined;
|
|
22492
|
-
};
|
|
22493
|
-
|
|
22494
22503
|
var $TypeError = TypeError;
|
|
22495
22504
|
|
|
22496
22505
|
// `RequireObjectCoercible` abstract operation
|
|
22497
22506
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
22498
22507
|
var requireObjectCoercible = function (it) {
|
|
22499
|
-
if (
|
|
22508
|
+
if (it == undefined) throw $TypeError("Can't call method on " + it);
|
|
22500
22509
|
return it;
|
|
22501
22510
|
};
|
|
22502
22511
|
|
|
@@ -22508,32 +22517,13 @@ var toIndexedObject = function (it) {
|
|
|
22508
22517
|
return indexedObject(requireObjectCoercible(it));
|
|
22509
22518
|
};
|
|
22510
22519
|
|
|
22511
|
-
var documentAll = typeof document == 'object' && document.all;
|
|
22512
|
-
|
|
22513
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
22514
|
-
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
22515
|
-
var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
22516
|
-
|
|
22517
|
-
var documentAll_1 = {
|
|
22518
|
-
all: documentAll,
|
|
22519
|
-
IS_HTMLDDA: IS_HTMLDDA
|
|
22520
|
-
};
|
|
22521
|
-
|
|
22522
|
-
var documentAll$1 = documentAll_1.all;
|
|
22523
|
-
|
|
22524
22520
|
// `IsCallable` abstract operation
|
|
22525
22521
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
22526
|
-
var isCallable =
|
|
22527
|
-
return typeof argument == 'function' || argument === documentAll$1;
|
|
22528
|
-
} : function (argument) {
|
|
22522
|
+
var isCallable = function (argument) {
|
|
22529
22523
|
return typeof argument == 'function';
|
|
22530
22524
|
};
|
|
22531
22525
|
|
|
22532
|
-
var
|
|
22533
|
-
|
|
22534
|
-
var isObject = documentAll_1.IS_HTMLDDA ? function (it) {
|
|
22535
|
-
return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll$2;
|
|
22536
|
-
} : function (it) {
|
|
22526
|
+
var isObject = function (it) {
|
|
22537
22527
|
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
22538
22528
|
};
|
|
22539
22529
|
|
|
@@ -22547,7 +22537,7 @@ var getBuiltIn = function (namespace, method) {
|
|
|
22547
22537
|
|
|
22548
22538
|
var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
22549
22539
|
|
|
22550
|
-
var engineUserAgent =
|
|
22540
|
+
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
22551
22541
|
|
|
22552
22542
|
var process$1 = global_1.process;
|
|
22553
22543
|
var Deno = global_1.Deno;
|
|
@@ -22574,12 +22564,12 @@ if (!version && engineUserAgent) {
|
|
|
22574
22564
|
|
|
22575
22565
|
var engineV8Version = version;
|
|
22576
22566
|
|
|
22577
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
22567
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
22578
22568
|
|
|
22579
22569
|
|
|
22580
22570
|
|
|
22581
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
22582
|
-
var
|
|
22571
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
22572
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
22583
22573
|
var symbol = Symbol();
|
|
22584
22574
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
22585
22575
|
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
@@ -22588,10 +22578,10 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(functi
|
|
|
22588
22578
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
22589
22579
|
});
|
|
22590
22580
|
|
|
22591
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
22581
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
22592
22582
|
|
|
22593
22583
|
|
|
22594
|
-
var useSymbolAsUid =
|
|
22584
|
+
var useSymbolAsUid = nativeSymbol
|
|
22595
22585
|
&& !Symbol.sham
|
|
22596
22586
|
&& typeof Symbol.iterator == 'symbol';
|
|
22597
22587
|
|
|
@@ -22626,7 +22616,7 @@ var aCallable = function (argument) {
|
|
|
22626
22616
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
22627
22617
|
var getMethod = function (V, P) {
|
|
22628
22618
|
var func = V[P];
|
|
22629
|
-
return
|
|
22619
|
+
return func == null ? undefined : aCallable(func);
|
|
22630
22620
|
};
|
|
22631
22621
|
|
|
22632
22622
|
var $TypeError$2 = TypeError;
|
|
@@ -22641,7 +22631,7 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
22641
22631
|
throw $TypeError$2("Can't convert object to primitive value");
|
|
22642
22632
|
};
|
|
22643
22633
|
|
|
22644
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22634
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22645
22635
|
var defineProperty = Object.defineProperty;
|
|
22646
22636
|
|
|
22647
22637
|
var defineGlobalProperty = function (key, value) {
|
|
@@ -22661,10 +22651,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
22661
22651
|
(module.exports = function (key, value) {
|
|
22662
22652
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
22663
22653
|
})('versions', []).push({
|
|
22664
|
-
version: '3.
|
|
22654
|
+
version: '3.24.1',
|
|
22665
22655
|
mode: 'global',
|
|
22666
|
-
copyright: '© 2014-
|
|
22667
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
22656
|
+
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
22657
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',
|
|
22668
22658
|
source: 'https://github.com/zloirock/core-js'
|
|
22669
22659
|
});
|
|
22670
22660
|
});
|
|
@@ -22681,7 +22671,7 @@ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
|
22681
22671
|
|
|
22682
22672
|
// `HasOwnProperty` abstract operation
|
|
22683
22673
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
22684
|
-
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
22674
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
22685
22675
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
22686
22676
|
return hasOwnProperty(toObject(it), key);
|
|
22687
22677
|
};
|
|
@@ -22694,15 +22684,21 @@ var uid = function (key) {
|
|
|
22694
22684
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
|
|
22695
22685
|
};
|
|
22696
22686
|
|
|
22697
|
-
var Symbol$1 = global_1.Symbol;
|
|
22698
22687
|
var WellKnownSymbolsStore = shared('wks');
|
|
22699
|
-
var
|
|
22688
|
+
var Symbol$1 = global_1.Symbol;
|
|
22689
|
+
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
22690
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
22700
22691
|
|
|
22701
22692
|
var wellKnownSymbol = function (name) {
|
|
22702
|
-
if (!hasOwnProperty_1(WellKnownSymbolsStore, name)) {
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
|
|
22693
|
+
if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
|
|
22694
|
+
var description = 'Symbol.' + name;
|
|
22695
|
+
if (nativeSymbol && hasOwnProperty_1(Symbol$1, name)) {
|
|
22696
|
+
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
22697
|
+
} else if (useSymbolAsUid && symbolFor) {
|
|
22698
|
+
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
22699
|
+
} else {
|
|
22700
|
+
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
22701
|
+
}
|
|
22706
22702
|
} return WellKnownSymbolsStore[name];
|
|
22707
22703
|
};
|
|
22708
22704
|
|
|
@@ -22742,13 +22738,13 @@ var documentCreateElement = function (it) {
|
|
|
22742
22738
|
|
|
22743
22739
|
// Thanks to IE8 for its funny defineProperty
|
|
22744
22740
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
22745
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22741
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22746
22742
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
22747
22743
|
get: function () { return 7; }
|
|
22748
22744
|
}).a != 7;
|
|
22749
22745
|
});
|
|
22750
22746
|
|
|
22751
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22747
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22752
22748
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
22753
22749
|
|
|
22754
22750
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -22769,7 +22765,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
22769
22765
|
// V8 ~ Chrome 36-
|
|
22770
22766
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
22771
22767
|
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
22772
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22768
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22773
22769
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
22774
22770
|
value: 42,
|
|
22775
22771
|
writable: false
|
|
@@ -22786,9 +22782,9 @@ var anObject = function (argument) {
|
|
|
22786
22782
|
};
|
|
22787
22783
|
|
|
22788
22784
|
var $TypeError$5 = TypeError;
|
|
22789
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22785
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22790
22786
|
var $defineProperty = Object.defineProperty;
|
|
22791
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22787
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22792
22788
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
22793
22789
|
var ENUMERABLE = 'enumerable';
|
|
22794
22790
|
var CONFIGURABLE = 'configurable';
|
|
@@ -22835,7 +22831,7 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
|
22835
22831
|
};
|
|
22836
22832
|
|
|
22837
22833
|
var FunctionPrototype$1 = Function.prototype;
|
|
22838
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22834
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22839
22835
|
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
22840
22836
|
|
|
22841
22837
|
var EXISTS$1 = hasOwnProperty_1(FunctionPrototype$1, 'name');
|
|
@@ -22862,7 +22858,7 @@ var inspectSource = sharedStore.inspectSource;
|
|
|
22862
22858
|
|
|
22863
22859
|
var WeakMap$1 = global_1.WeakMap;
|
|
22864
22860
|
|
|
22865
|
-
var
|
|
22861
|
+
var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
|
|
22866
22862
|
|
|
22867
22863
|
var keys$1 = shared('keys');
|
|
22868
22864
|
|
|
@@ -22890,30 +22886,28 @@ var getterFor = function (TYPE) {
|
|
|
22890
22886
|
};
|
|
22891
22887
|
};
|
|
22892
22888
|
|
|
22893
|
-
if (
|
|
22889
|
+
if (nativeWeakMap || sharedStore.state) {
|
|
22894
22890
|
var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$2());
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
store$1.set = store$1.set;
|
|
22899
|
-
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
22891
|
+
var wmget = functionUncurryThis(store$1.get);
|
|
22892
|
+
var wmhas = functionUncurryThis(store$1.has);
|
|
22893
|
+
var wmset = functionUncurryThis(store$1.set);
|
|
22900
22894
|
set = function (it, metadata) {
|
|
22901
|
-
if (store$1
|
|
22895
|
+
if (wmhas(store$1, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22902
22896
|
metadata.facade = it;
|
|
22903
|
-
store$1
|
|
22897
|
+
wmset(store$1, it, metadata);
|
|
22904
22898
|
return metadata;
|
|
22905
22899
|
};
|
|
22906
22900
|
get = function (it) {
|
|
22907
|
-
return store$1
|
|
22901
|
+
return wmget(store$1, it) || {};
|
|
22908
22902
|
};
|
|
22909
22903
|
has = function (it) {
|
|
22910
|
-
return store$1
|
|
22904
|
+
return wmhas(store$1, it);
|
|
22911
22905
|
};
|
|
22912
22906
|
} else {
|
|
22913
22907
|
var STATE = sharedKey('state');
|
|
22914
22908
|
hiddenKeys[STATE] = true;
|
|
22915
22909
|
set = function (it, metadata) {
|
|
22916
|
-
if (hasOwnProperty_1(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22910
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22917
22911
|
metadata.facade = it;
|
|
22918
22912
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
22919
22913
|
return metadata;
|
|
@@ -22941,12 +22935,8 @@ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
|
22941
22935
|
|
|
22942
22936
|
var enforceInternalState = internalState.enforce;
|
|
22943
22937
|
var getInternalState = internalState.get;
|
|
22944
|
-
|
|
22945
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22938
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22946
22939
|
var defineProperty = Object.defineProperty;
|
|
22947
|
-
var stringSlice = functionUncurryThis(''.slice);
|
|
22948
|
-
var replace = functionUncurryThis(''.replace);
|
|
22949
|
-
var join = functionUncurryThis([].join);
|
|
22950
22940
|
|
|
22951
22941
|
var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
22952
22942
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
@@ -22955,8 +22945,8 @@ var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
|
22955
22945
|
var TEMPLATE = String(String).split('String');
|
|
22956
22946
|
|
|
22957
22947
|
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
22958
|
-
if (
|
|
22959
|
-
name = '[' +
|
|
22948
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
22949
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
22960
22950
|
}
|
|
22961
22951
|
if (options && options.getter) name = 'get ' + name;
|
|
22962
22952
|
if (options && options.setter) name = 'set ' + name;
|
|
@@ -22975,7 +22965,7 @@ var makeBuiltIn = module.exports = function (value, name, options) {
|
|
|
22975
22965
|
} catch (error) { /* empty */ }
|
|
22976
22966
|
var state = enforceInternalState(value);
|
|
22977
22967
|
if (!hasOwnProperty_1(state, 'source')) {
|
|
22978
|
-
state.source = join(
|
|
22968
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
22979
22969
|
} return value;
|
|
22980
22970
|
};
|
|
22981
22971
|
|
|
@@ -23014,7 +23004,7 @@ var floor = Math.floor;
|
|
|
23014
23004
|
|
|
23015
23005
|
// `Math.trunc` method
|
|
23016
23006
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
23017
|
-
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
23007
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
23018
23008
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
23019
23009
|
var n = +x;
|
|
23020
23010
|
return (n > 0 ? floor : ceil)(n);
|
|
@@ -23115,7 +23105,7 @@ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
|
|
23115
23105
|
|
|
23116
23106
|
// `Object.getOwnPropertyNames` method
|
|
23117
23107
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
23118
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
23108
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
23119
23109
|
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
23120
23110
|
return objectKeysInternal(O, hiddenKeys$1);
|
|
23121
23111
|
};
|
|
@@ -23124,7 +23114,7 @@ var objectGetOwnPropertyNames = {
|
|
|
23124
23114
|
f: f$3
|
|
23125
23115
|
};
|
|
23126
23116
|
|
|
23127
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
23117
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
23128
23118
|
var f$4 = Object.getOwnPropertySymbols;
|
|
23129
23119
|
|
|
23130
23120
|
var objectGetOwnPropertySymbols = {
|
|
@@ -23268,7 +23258,7 @@ var toString_1 = function (argument) {
|
|
|
23268
23258
|
var charAt = functionUncurryThis(''.charAt);
|
|
23269
23259
|
|
|
23270
23260
|
var FORCED = fails(function () {
|
|
23271
|
-
// eslint-disable-next-line es/no-array-string-prototype-at -- safe
|
|
23261
|
+
// eslint-disable-next-line es-x/no-array-string-prototype-at -- safe
|
|
23272
23262
|
return '𠮷'.at(-2) !== '\uD842';
|
|
23273
23263
|
});
|
|
23274
23264
|
|
|
@@ -23286,14 +23276,14 @@ _export({ target: 'String', proto: true, forced: FORCED }, {
|
|
|
23286
23276
|
|
|
23287
23277
|
// `Object.keys` method
|
|
23288
23278
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
23289
|
-
// eslint-disable-next-line es/no-object-keys -- safe
|
|
23279
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
23290
23280
|
var objectKeys = Object.keys || function keys(O) {
|
|
23291
23281
|
return objectKeysInternal(O, enumBugKeys);
|
|
23292
23282
|
};
|
|
23293
23283
|
|
|
23294
23284
|
// `Object.defineProperties` method
|
|
23295
23285
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
23296
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
23286
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
23297
23287
|
var f$5 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
23298
23288
|
anObject(O);
|
|
23299
23289
|
var props = toIndexedObject(Properties);
|
|
@@ -23382,7 +23372,7 @@ hiddenKeys[IE_PROTO] = true;
|
|
|
23382
23372
|
|
|
23383
23373
|
// `Object.create` method
|
|
23384
23374
|
// https://tc39.es/ecma262/#sec-object.create
|
|
23385
|
-
// eslint-disable-next-line es/no-object-create -- safe
|
|
23375
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
23386
23376
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
23387
23377
|
var result;
|
|
23388
23378
|
if (O !== null) {
|
|
@@ -23428,19 +23418,13 @@ _export({ target: 'Array', proto: true }, {
|
|
|
23428
23418
|
|
|
23429
23419
|
addToUnscopables('at');
|
|
23430
23420
|
|
|
23431
|
-
// eslint-disable-next-line es/no-typed-arrays -- safe
|
|
23432
|
-
var
|
|
23433
|
-
|
|
23434
|
-
var defineBuiltInAccessor = function (target, name, descriptor) {
|
|
23435
|
-
if (descriptor.get) makeBuiltIn_1(descriptor.get, name, { getter: true });
|
|
23436
|
-
if (descriptor.set) makeBuiltIn_1(descriptor.set, name, { setter: true });
|
|
23437
|
-
return objectDefineProperty.f(target, name, descriptor);
|
|
23438
|
-
};
|
|
23421
|
+
// eslint-disable-next-line es-x/no-typed-arrays -- safe
|
|
23422
|
+
var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
|
|
23439
23423
|
|
|
23440
23424
|
var correctPrototypeGetter = !fails(function () {
|
|
23441
23425
|
function F() { /* empty */ }
|
|
23442
23426
|
F.prototype.constructor = null;
|
|
23443
|
-
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
23427
|
+
// eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
|
|
23444
23428
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
23445
23429
|
});
|
|
23446
23430
|
|
|
@@ -23450,7 +23434,7 @@ var ObjectPrototype = $Object$4.prototype;
|
|
|
23450
23434
|
|
|
23451
23435
|
// `Object.getPrototypeOf` method
|
|
23452
23436
|
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
23453
|
-
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
23437
|
+
// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
|
|
23454
23438
|
var objectGetPrototypeOf = correctPrototypeGetter ? $Object$4.getPrototypeOf : function (O) {
|
|
23455
23439
|
var object = toObject(O);
|
|
23456
23440
|
if (hasOwnProperty_1(object, IE_PROTO$1)) return object[IE_PROTO$1];
|
|
@@ -23460,13 +23444,6 @@ var objectGetPrototypeOf = correctPrototypeGetter ? $Object$4.getPrototypeOf : f
|
|
|
23460
23444
|
} return object instanceof $Object$4 ? ObjectPrototype : null;
|
|
23461
23445
|
};
|
|
23462
23446
|
|
|
23463
|
-
var functionUncurryThisAccessor = function (object, key, method) {
|
|
23464
|
-
try {
|
|
23465
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
23466
|
-
return functionUncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
23467
|
-
} catch (error) { /* empty */ }
|
|
23468
|
-
};
|
|
23469
|
-
|
|
23470
23447
|
var $String$3 = String;
|
|
23471
23448
|
var $TypeError$6 = TypeError;
|
|
23472
23449
|
|
|
@@ -23483,13 +23460,14 @@ var aPossiblePrototype = function (argument) {
|
|
|
23483
23460
|
// `Object.setPrototypeOf` method
|
|
23484
23461
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
23485
23462
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
23486
|
-
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
23463
|
+
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
23487
23464
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
23488
23465
|
var CORRECT_SETTER = false;
|
|
23489
23466
|
var test = {};
|
|
23490
23467
|
var setter;
|
|
23491
23468
|
try {
|
|
23492
|
-
|
|
23469
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
23470
|
+
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
23493
23471
|
setter(test, []);
|
|
23494
23472
|
CORRECT_SETTER = test instanceof Array;
|
|
23495
23473
|
} catch (error) { /* empty */ }
|
|
@@ -23502,6 +23480,14 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
23502
23480
|
};
|
|
23503
23481
|
}() : undefined);
|
|
23504
23482
|
|
|
23483
|
+
var defineProperty$2 = objectDefineProperty.f;
|
|
23484
|
+
|
|
23485
|
+
|
|
23486
|
+
|
|
23487
|
+
|
|
23488
|
+
|
|
23489
|
+
|
|
23490
|
+
|
|
23505
23491
|
var enforceInternalState = internalState.enforce;
|
|
23506
23492
|
var getInternalState = internalState.get;
|
|
23507
23493
|
var Int8Array = global_1.Int8Array;
|
|
@@ -23517,7 +23503,7 @@ var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
|
23517
23503
|
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
|
|
23518
23504
|
var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
|
|
23519
23505
|
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
|
|
23520
|
-
var NATIVE_ARRAY_BUFFER_VIEWS =
|
|
23506
|
+
var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferNative && !!objectSetPrototypeOf && classof(global_1.opera) !== 'Opera';
|
|
23521
23507
|
var TYPED_ARRAY_TAG_REQUIRED = false;
|
|
23522
23508
|
var NAME, Constructor, Prototype;
|
|
23523
23509
|
|
|
@@ -23652,12 +23638,9 @@ if (NATIVE_ARRAY_BUFFER_VIEWS && objectGetPrototypeOf(Uint8ClampedArrayPrototype
|
|
|
23652
23638
|
|
|
23653
23639
|
if (descriptors && !hasOwnProperty_1(TypedArrayPrototype, TO_STRING_TAG$2)) {
|
|
23654
23640
|
TYPED_ARRAY_TAG_REQUIRED = true;
|
|
23655
|
-
|
|
23656
|
-
|
|
23657
|
-
|
|
23658
|
-
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
|
23659
|
-
}
|
|
23660
|
-
});
|
|
23641
|
+
defineProperty$2(TypedArrayPrototype, TO_STRING_TAG$2, { get: function () {
|
|
23642
|
+
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
|
23643
|
+
} });
|
|
23661
23644
|
for (NAME in TypedArrayConstructorsList) if (global_1[NAME]) {
|
|
23662
23645
|
createNonEnumerableProperty(global_1[NAME], TYPED_ARRAY_TAG, NAME);
|
|
23663
23646
|
}
|
|
@@ -38604,44 +38587,52 @@ var TableHeading_styled = styled.th.withConfig({
|
|
|
38604
38587
|
return extraStyles;
|
|
38605
38588
|
});
|
|
38606
38589
|
|
|
38607
|
-
const validatorToPredicate =
|
|
38608
|
-
|
|
38609
|
-
...rest
|
|
38610
|
-
|
|
38590
|
+
const validatorToPredicate =
|
|
38591
|
+
(validatorFn, emptyCase) =>
|
|
38592
|
+
(value, ...rest) =>
|
|
38593
|
+
value === '' ? emptyCase : validatorFn(value, ...rest);
|
|
38611
38594
|
|
|
38612
38595
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38613
38596
|
|
|
38597
|
+
function getDefaultExportFromCjs (x) {
|
|
38598
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
38599
|
+
}
|
|
38600
|
+
|
|
38614
38601
|
var dayjs_min = {exports: {}};
|
|
38615
38602
|
|
|
38616
38603
|
(function (module, exports) {
|
|
38617
|
-
!function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date"
|
|
38618
|
-
}(dayjs_min));
|
|
38604
|
+
!function(t,e){module.exports=e();}(commonjsGlobal$1,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof _},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(h){case c:return r?l(1,0):l(31,11);case f:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),l=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,l=this;r=Number(r);var $=O.p(h),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===f)return this.set(f,this.$M+r);if($===c)return this.set(c,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},$={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||$[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,v=this-M,g=O.m(this,M);return g=($={},$[c]=g/12,$[f]=g,$[h]=g/3,$[o]=(v-m)/6048e5,$[a]=(v-m)/864e5,$[u]=v/n,$[s]=v/e,$[i]=v/t,$)[y]||v,l?g:O.a(g)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),T=_.prototype;return w.prototype=T,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){T[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
38605
|
+
} (dayjs_min));
|
|
38619
38606
|
|
|
38620
|
-
var
|
|
38607
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
38608
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
38621
38609
|
|
|
38622
38610
|
var customParseFormat$1 = {exports: {}};
|
|
38623
38611
|
|
|
38624
38612
|
(function (module, exports) {
|
|
38625
|
-
!function(t
|
|
38626
|
-
}(customParseFormat$1));
|
|
38613
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
|
|
38614
|
+
} (customParseFormat$1));
|
|
38627
38615
|
|
|
38628
|
-
var
|
|
38616
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
38617
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
38629
38618
|
|
|
38630
38619
|
var isSameOrBefore$1 = {exports: {}};
|
|
38631
38620
|
|
|
38632
38621
|
(function (module, exports) {
|
|
38633
|
-
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38634
|
-
}(isSameOrBefore$1));
|
|
38622
|
+
!function(e,i){module.exports=i();}(commonjsGlobal$1,(function(){return function(e,i){i.prototype.isSameOrBefore=function(e,i){return this.isSame(e,i)||this.isBefore(e,i)};}}));
|
|
38623
|
+
} (isSameOrBefore$1));
|
|
38635
38624
|
|
|
38636
|
-
var
|
|
38625
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
38626
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
38637
38627
|
|
|
38638
38628
|
var isSameOrAfter$1 = {exports: {}};
|
|
38639
38629
|
|
|
38640
38630
|
(function (module, exports) {
|
|
38641
|
-
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38642
|
-
}(isSameOrAfter$1));
|
|
38631
|
+
!function(e,t){module.exports=t();}(commonjsGlobal$1,(function(){return function(e,t){t.prototype.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)};}}));
|
|
38632
|
+
} (isSameOrAfter$1));
|
|
38643
38633
|
|
|
38644
|
-
var
|
|
38634
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
38635
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
38645
38636
|
|
|
38646
38637
|
/* eslint-disable no-unused-vars */
|
|
38647
38638
|
|
|
@@ -38657,24 +38648,24 @@ dayjs.extend(isSameOrAfter);
|
|
|
38657
38648
|
|
|
38658
38649
|
let validatorFns = {};
|
|
38659
38650
|
|
|
38660
|
-
const INCLUDED_IN =
|
|
38661
|
-
const INCLUDED_IN_ERROR =
|
|
38651
|
+
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
38652
|
+
const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
|
|
38662
38653
|
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
38663
38654
|
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
38664
38655
|
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
38665
38656
|
|
|
38666
|
-
const REQUIRED =
|
|
38667
|
-
const REQUIRED_ERROR =
|
|
38657
|
+
const REQUIRED = 'validator/REQUIRED';
|
|
38658
|
+
const REQUIRED_ERROR = 'error/REQUIRED';
|
|
38668
38659
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
38669
|
-
validatorFns[REQUIRED] = (value, args, form) => value !==
|
|
38660
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== '';
|
|
38670
38661
|
|
|
38671
|
-
const ONLY_INTEGERS =
|
|
38672
|
-
const ONLY_INTEGERS_ERROR =
|
|
38662
|
+
const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
|
|
38663
|
+
const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
|
|
38673
38664
|
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
38674
38665
|
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
38675
38666
|
|
|
38676
|
-
const ONLY_NATURALS =
|
|
38677
|
-
const ONLY_NATURALS_ERROR =
|
|
38667
|
+
const ONLY_NATURALS = 'validator/ONLY_NATURALS';
|
|
38668
|
+
const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
|
|
38678
38669
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
38679
38670
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
38680
38671
|
|
|
@@ -38687,8 +38678,8 @@ not tested as validation function
|
|
|
38687
38678
|
to validate exp date instead use combo of:
|
|
38688
38679
|
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
38689
38680
|
*/
|
|
38690
|
-
const ONLY_EXPIRATION_DATE =
|
|
38691
|
-
const ONLY_EXPIRATION_DATE_ERROR =
|
|
38681
|
+
const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
|
|
38682
|
+
const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
|
|
38692
38683
|
const onlyExpirationDate = createValidator(
|
|
38693
38684
|
ONLY_EXPIRATION_DATE,
|
|
38694
38685
|
ONLY_EXPIRATION_DATE_ERROR
|
|
@@ -38696,64 +38687,63 @@ const onlyExpirationDate = createValidator(
|
|
|
38696
38687
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
38697
38688
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
38698
38689
|
|
|
38699
|
-
const NUMBER_LESS_THAN =
|
|
38700
|
-
const NUMBER_LESS_THAN_ERROR =
|
|
38690
|
+
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
38691
|
+
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
38701
38692
|
const numberLessThan = createValidator(
|
|
38702
38693
|
NUMBER_LESS_THAN,
|
|
38703
38694
|
NUMBER_LESS_THAN_ERROR
|
|
38704
38695
|
);
|
|
38705
38696
|
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
38706
|
-
if (value ===
|
|
38697
|
+
if (value === '') {
|
|
38707
38698
|
return true;
|
|
38708
38699
|
}
|
|
38709
38700
|
return Number(value) < args[0];
|
|
38710
38701
|
};
|
|
38711
38702
|
|
|
38712
|
-
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
38713
|
-
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
38703
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38714
38704
|
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
38715
|
-
|
|
38705
|
+
'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38716
38706
|
const numberLessThanOrEqualTo = createValidator(
|
|
38717
38707
|
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
38718
38708
|
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
38719
38709
|
);
|
|
38720
38710
|
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38721
|
-
if (value ===
|
|
38711
|
+
if (value === '') {
|
|
38722
38712
|
return true;
|
|
38723
38713
|
}
|
|
38724
38714
|
return Number(value) <= args[0];
|
|
38725
38715
|
};
|
|
38726
38716
|
|
|
38727
|
-
const NUMBER_GREATER_THAN =
|
|
38728
|
-
const NUMBER_GREATER_THAN_ERROR =
|
|
38717
|
+
const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
|
|
38718
|
+
const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
|
|
38729
38719
|
const numberGreaterThan = createValidator(
|
|
38730
38720
|
NUMBER_GREATER_THAN,
|
|
38731
38721
|
NUMBER_GREATER_THAN_ERROR
|
|
38732
38722
|
);
|
|
38733
38723
|
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
38734
|
-
if (value ===
|
|
38724
|
+
if (value === '') {
|
|
38735
38725
|
return true;
|
|
38736
38726
|
}
|
|
38737
38727
|
return Number(value) > args[0];
|
|
38738
38728
|
};
|
|
38739
38729
|
|
|
38740
38730
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
38741
|
-
|
|
38731
|
+
'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38742
38732
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
38743
|
-
|
|
38733
|
+
'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38744
38734
|
const numberGreaterThanOrEqualTo = createValidator(
|
|
38745
38735
|
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
38746
38736
|
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
38747
38737
|
);
|
|
38748
38738
|
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38749
|
-
if (value ===
|
|
38739
|
+
if (value === '') {
|
|
38750
38740
|
return true;
|
|
38751
38741
|
}
|
|
38752
38742
|
return Number(value) >= args[0];
|
|
38753
38743
|
};
|
|
38754
38744
|
|
|
38755
|
-
const MATCHES_FIELD =
|
|
38756
|
-
const MATCHES_FIELD_ERROR$1 =
|
|
38745
|
+
const MATCHES_FIELD = 'validator/MATCHES_FIELD';
|
|
38746
|
+
const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
|
|
38757
38747
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
38758
38748
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
38759
38749
|
const dependentField = form[args[0]];
|
|
@@ -38766,7 +38756,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
|
38766
38756
|
return value === dependentFieldValue;
|
|
38767
38757
|
};
|
|
38768
38758
|
|
|
38769
|
-
const validateWhenErrorMessage = type =>
|
|
38759
|
+
const validateWhenErrorMessage = (type) =>
|
|
38770
38760
|
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
38771
38761
|
Please check that you are only calling validator creator functions exported from
|
|
38772
38762
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -38774,25 +38764,21 @@ const validateWhenErrorMessage = type =>
|
|
|
38774
38764
|
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
38775
38765
|
as the primary validator.`;
|
|
38776
38766
|
|
|
38777
|
-
const VALIDATE_WHEN =
|
|
38778
|
-
const VALIDATE_WHEN_ERROR =
|
|
38779
|
-
const validateWhen = (
|
|
38780
|
-
dependentValidator,
|
|
38781
|
-
primaryValidator,
|
|
38782
|
-
optionalFieldName
|
|
38783
|
-
) => ({
|
|
38767
|
+
const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
|
|
38768
|
+
const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
|
|
38769
|
+
const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
|
|
38784
38770
|
type: VALIDATE_WHEN,
|
|
38785
38771
|
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
38786
|
-
error: dependentValidator.error
|
|
38772
|
+
error: dependentValidator.error,
|
|
38787
38773
|
});
|
|
38788
38774
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
38789
38775
|
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
38790
38776
|
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
38791
|
-
const dependsOnOtherField = typeof optionalFieldName ===
|
|
38777
|
+
const dependsOnOtherField = typeof optionalFieldName === 'string';
|
|
38792
38778
|
|
|
38793
38779
|
if (
|
|
38794
38780
|
primaryValidator.type === undefined ||
|
|
38795
|
-
typeof validatorFns[primaryValidator.type] !==
|
|
38781
|
+
typeof validatorFns[primaryValidator.type] !== 'function'
|
|
38796
38782
|
) {
|
|
38797
38783
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
38798
38784
|
}
|
|
@@ -38816,26 +38802,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
|
38816
38802
|
);
|
|
38817
38803
|
|
|
38818
38804
|
return primaryPredicatePassed
|
|
38819
|
-
? validatorFns[dependentValidator.type](
|
|
38820
|
-
value,
|
|
38821
|
-
dependentValidator.args,
|
|
38822
|
-
form
|
|
38823
|
-
)
|
|
38805
|
+
? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
|
|
38824
38806
|
: true;
|
|
38825
38807
|
};
|
|
38826
38808
|
|
|
38827
|
-
const validateSumErrorMessage = type =>
|
|
38809
|
+
const validateSumErrorMessage = (type) =>
|
|
38828
38810
|
`${type} was passed to validateSum, but that validator type does not exist.
|
|
38829
38811
|
Please check that you are only calling validator creator functions exported from
|
|
38830
38812
|
redux-freeform in your form config and that you didn't forget to
|
|
38831
38813
|
invoke the validator creator (you cannot pass the functions themselves to
|
|
38832
38814
|
createFormState).`;
|
|
38833
|
-
const VALIDATE_SUM =
|
|
38834
|
-
const VALIDATE_SUM_ERROR =
|
|
38815
|
+
const VALIDATE_SUM = 'validator/VALIDATE_SUM';
|
|
38816
|
+
const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
|
|
38835
38817
|
const validateSum = (validator, fieldNamesArray) => ({
|
|
38836
38818
|
type: VALIDATE_SUM,
|
|
38837
38819
|
args: [validator, fieldNamesArray],
|
|
38838
|
-
error: validator.error
|
|
38820
|
+
error: validator.error,
|
|
38839
38821
|
});
|
|
38840
38822
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
38841
38823
|
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
@@ -38843,7 +38825,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38843
38825
|
|
|
38844
38826
|
if (
|
|
38845
38827
|
validator.type === undefined ||
|
|
38846
|
-
typeof validatorFns[validator.type] !==
|
|
38828
|
+
typeof validatorFns[validator.type] !== 'function'
|
|
38847
38829
|
) {
|
|
38848
38830
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
38849
38831
|
}
|
|
@@ -38864,37 +38846,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38864
38846
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
38865
38847
|
};
|
|
38866
38848
|
|
|
38867
|
-
const HAS_LENGTH =
|
|
38868
|
-
const HAS_LENGTH_ERROR =
|
|
38849
|
+
const HAS_LENGTH = 'validator/HAS_LENGTH';
|
|
38850
|
+
const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
|
|
38869
38851
|
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
38870
38852
|
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
38871
|
-
if (value ===
|
|
38853
|
+
if (value === '') {
|
|
38872
38854
|
return true;
|
|
38873
38855
|
}
|
|
38874
38856
|
const min = args[0];
|
|
38875
38857
|
const max = args[1];
|
|
38876
38858
|
if (max == undefined || min == undefined) {
|
|
38877
38859
|
throw new Error(
|
|
38878
|
-
|
|
38860
|
+
'Max and min need to be defined for hasLength, both or one of them is undefined'
|
|
38879
38861
|
);
|
|
38880
38862
|
}
|
|
38881
38863
|
if (max < min) {
|
|
38882
|
-
throw new Error(
|
|
38883
|
-
"hasLength validator was passed a min greater than the max"
|
|
38884
|
-
);
|
|
38864
|
+
throw new Error('hasLength validator was passed a min greater than the max');
|
|
38885
38865
|
}
|
|
38886
38866
|
const valueLength = value.length;
|
|
38887
38867
|
return max >= valueLength && valueLength >= min;
|
|
38888
38868
|
};
|
|
38889
38869
|
|
|
38890
|
-
const DATE_BEFORE_TODAY =
|
|
38891
|
-
const DATE_BEFORE_TODAY_ERROR =
|
|
38870
|
+
const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
|
|
38871
|
+
const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
|
|
38892
38872
|
const dateBeforeToday = createValidator(
|
|
38893
38873
|
DATE_BEFORE_TODAY,
|
|
38894
38874
|
DATE_BEFORE_TODAY_ERROR
|
|
38895
38875
|
);
|
|
38896
38876
|
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
38897
|
-
if (value ===
|
|
38877
|
+
if (value === '') {
|
|
38898
38878
|
return true;
|
|
38899
38879
|
}
|
|
38900
38880
|
const dateFormat = args[0];
|
|
@@ -38903,7 +38883,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38903
38883
|
|
|
38904
38884
|
if (dateFormat == undefined || unit == undefined) {
|
|
38905
38885
|
throw new Error(
|
|
38906
|
-
|
|
38886
|
+
'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
|
|
38907
38887
|
);
|
|
38908
38888
|
}
|
|
38909
38889
|
const now = dayjs();
|
|
@@ -38915,14 +38895,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38915
38895
|
return dateValue.isBefore(now, unit);
|
|
38916
38896
|
};
|
|
38917
38897
|
|
|
38918
|
-
const DATE_AFTER_TODAY =
|
|
38919
|
-
const DATE_AFTER_TODAY_ERROR =
|
|
38898
|
+
const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
|
|
38899
|
+
const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
|
|
38920
38900
|
const dateAfterToday = createValidator(
|
|
38921
38901
|
DATE_AFTER_TODAY,
|
|
38922
38902
|
DATE_AFTER_TODAY_ERROR
|
|
38923
38903
|
);
|
|
38924
38904
|
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
38925
|
-
if (value ===
|
|
38905
|
+
if (value === '') {
|
|
38926
38906
|
return true;
|
|
38927
38907
|
}
|
|
38928
38908
|
const dateFormat = args[0];
|
|
@@ -38931,7 +38911,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38931
38911
|
|
|
38932
38912
|
if (dateFormat == undefined || unit == undefined) {
|
|
38933
38913
|
throw new Error(
|
|
38934
|
-
|
|
38914
|
+
'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
|
|
38935
38915
|
);
|
|
38936
38916
|
}
|
|
38937
38917
|
const now = dayjs();
|
|
@@ -38943,14 +38923,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38943
38923
|
return dateValue.isAfter(now, unit);
|
|
38944
38924
|
};
|
|
38945
38925
|
|
|
38946
|
-
const IS_VALID_MONTH =
|
|
38947
|
-
const IS_VALID_MONTH_ERROR =
|
|
38948
|
-
const isValidMonth = createValidator(
|
|
38949
|
-
IS_VALID_MONTH,
|
|
38950
|
-
IS_VALID_MONTH_ERROR
|
|
38951
|
-
);
|
|
38926
|
+
const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
|
|
38927
|
+
const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
|
|
38928
|
+
const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
38952
38929
|
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
38953
|
-
if (value ===
|
|
38930
|
+
if (value === '') {
|
|
38954
38931
|
return true;
|
|
38955
38932
|
}
|
|
38956
38933
|
// Function takes one argument representing the character position
|
|
@@ -38960,43 +38937,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
|
38960
38937
|
// Only works with two digit months (01, 02, 03, etc)
|
|
38961
38938
|
const monthStartPosition = parseInt(args[0]);
|
|
38962
38939
|
const monthEndPosition = monthStartPosition + 2;
|
|
38963
|
-
if (monthStartPosition
|
|
38964
|
-
throw new Error(
|
|
38940
|
+
if (isNaN(monthStartPosition)) {
|
|
38941
|
+
throw new Error('Month start position has to be a valid integer string');
|
|
38965
38942
|
}
|
|
38966
38943
|
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
38967
|
-
if (month
|
|
38944
|
+
if (isNaN(month)) {
|
|
38968
38945
|
return false;
|
|
38969
38946
|
}
|
|
38970
38947
|
return month >= 1 && month <= 12;
|
|
38971
38948
|
};
|
|
38972
38949
|
|
|
38973
|
-
const MATCHES_REGEX =
|
|
38974
|
-
const MATCHES_REGEX_ERROR =
|
|
38950
|
+
const MATCHES_REGEX = 'validator/MATCHES_REGEX';
|
|
38951
|
+
const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
|
|
38975
38952
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
38976
38953
|
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
38977
|
-
if (value ===
|
|
38954
|
+
if (value === '') {
|
|
38978
38955
|
return true;
|
|
38979
38956
|
}
|
|
38980
38957
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
38981
38958
|
};
|
|
38982
38959
|
|
|
38983
38960
|
// based on http://www.brainjar.com/js/validation/
|
|
38984
|
-
const IS_ROUTING_NUMBER =
|
|
38985
|
-
const IS_ROUTING_NUMBER_ERROR =
|
|
38961
|
+
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
38962
|
+
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
38986
38963
|
const isRoutingNumber = createValidator(
|
|
38987
38964
|
IS_ROUTING_NUMBER,
|
|
38988
38965
|
IS_ROUTING_NUMBER_ERROR
|
|
38989
38966
|
);
|
|
38990
38967
|
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
38991
|
-
if (value ===
|
|
38968
|
+
if (value === '') {
|
|
38992
38969
|
return true;
|
|
38993
38970
|
}
|
|
38994
38971
|
if (value.length != 9) {
|
|
38995
38972
|
return false;
|
|
38996
38973
|
}
|
|
38997
38974
|
const sum = value
|
|
38998
|
-
.split(
|
|
38999
|
-
.map(ch => parseInt(ch))
|
|
38975
|
+
.split('')
|
|
38976
|
+
.map((ch) => parseInt(ch))
|
|
39000
38977
|
.reduce((acc, cur, idx) => {
|
|
39001
38978
|
switch (idx % 3) {
|
|
39002
38979
|
case 0:
|
|
@@ -39010,69 +38987,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
|
39010
38987
|
return sum != 0 && sum % 10 == 0;
|
|
39011
38988
|
};
|
|
39012
38989
|
|
|
39013
|
-
const HAS_NUMBER =
|
|
39014
|
-
const HAS_NUMBER_ERROR$1 =
|
|
38990
|
+
const HAS_NUMBER = 'validator/HAS_NUMBER';
|
|
38991
|
+
const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
|
|
39015
38992
|
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
39016
38993
|
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
39017
|
-
if (value ===
|
|
38994
|
+
if (value === '') {
|
|
39018
38995
|
return true;
|
|
39019
38996
|
}
|
|
39020
38997
|
return new RegExp(/[0-9]/).test(value);
|
|
39021
38998
|
};
|
|
39022
38999
|
|
|
39023
|
-
const HAS_LOWERCASE_LETTER =
|
|
39024
|
-
const HAS_LOWERCASE_LETTER_ERROR$1 =
|
|
39000
|
+
const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
|
|
39001
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
|
|
39025
39002
|
const hasLowercaseLetter = createValidator(
|
|
39026
39003
|
HAS_LOWERCASE_LETTER,
|
|
39027
39004
|
HAS_LOWERCASE_LETTER_ERROR$1
|
|
39028
39005
|
);
|
|
39029
39006
|
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
39030
|
-
if (value ===
|
|
39007
|
+
if (value === '') {
|
|
39031
39008
|
return true;
|
|
39032
39009
|
}
|
|
39033
39010
|
return new RegExp(/[a-z]/).test(value);
|
|
39034
39011
|
};
|
|
39035
39012
|
|
|
39036
|
-
const HAS_UPPERCASE_LETTER =
|
|
39037
|
-
const HAS_UPPERCASE_LETTER_ERROR$1 =
|
|
39013
|
+
const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
|
|
39014
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
|
|
39038
39015
|
const hasUppercaseLetter = createValidator(
|
|
39039
39016
|
HAS_UPPERCASE_LETTER,
|
|
39040
39017
|
HAS_UPPERCASE_LETTER_ERROR$1
|
|
39041
39018
|
);
|
|
39042
39019
|
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
39043
|
-
if (value ===
|
|
39020
|
+
if (value === '') {
|
|
39044
39021
|
return true;
|
|
39045
39022
|
}
|
|
39046
39023
|
return new RegExp(/[A-Z]/).test(value);
|
|
39047
39024
|
};
|
|
39048
39025
|
|
|
39049
|
-
const HAS_SPECIAL_CHARACTER =
|
|
39050
|
-
const HAS_SPECIAL_CHARACTER_ERROR$1 =
|
|
39026
|
+
const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
|
|
39027
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
|
|
39051
39028
|
const hasSpecialCharacter = createValidator(
|
|
39052
39029
|
HAS_SPECIAL_CHARACTER,
|
|
39053
39030
|
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
39054
39031
|
);
|
|
39055
39032
|
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
39056
|
-
if (value ===
|
|
39033
|
+
if (value === '') {
|
|
39057
39034
|
return true;
|
|
39058
39035
|
}
|
|
39059
39036
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
39060
39037
|
};
|
|
39061
39038
|
|
|
39062
|
-
const IS_PROBABLY_EMAIL =
|
|
39063
|
-
const IS_PROBABLY_EMAIL_ERROR =
|
|
39039
|
+
const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
|
|
39040
|
+
const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
|
|
39064
39041
|
const isProbablyEmail = createValidator(
|
|
39065
39042
|
IS_PROBABLY_EMAIL,
|
|
39066
39043
|
IS_PROBABLY_EMAIL_ERROR
|
|
39067
39044
|
);
|
|
39068
39045
|
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
39069
|
-
if (value ===
|
|
39046
|
+
if (value === '') {
|
|
39070
39047
|
return true;
|
|
39071
39048
|
}
|
|
39072
39049
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
39073
39050
|
};
|
|
39074
39051
|
|
|
39075
|
-
const runValidatorErrorMessage = type =>
|
|
39052
|
+
const runValidatorErrorMessage = (type) =>
|
|
39076
39053
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
39077
39054
|
Please check that you are only calling validator creator functions exported from
|
|
39078
39055
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -39087,1165 +39064,53 @@ const runValidator = (validator, value, form) => {
|
|
|
39087
39064
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
39088
39065
|
};
|
|
39089
39066
|
|
|
39090
|
-
const
|
|
39067
|
+
const runFormValidators = (fieldName, form, validators) => {
|
|
39091
39068
|
return validators
|
|
39092
|
-
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
39093
|
-
.filter(x => x !== null);
|
|
39069
|
+
.map((v) => runValidator(v, form[fieldName].rawValue, form))
|
|
39070
|
+
.filter((x) => x !== null);
|
|
39094
39071
|
};
|
|
39095
39072
|
|
|
39096
39073
|
const computeConstraints = (fieldName, form) => {
|
|
39097
39074
|
const constraints = form[fieldName].constraints;
|
|
39098
|
-
return
|
|
39075
|
+
return runFormValidators(fieldName, form, constraints);
|
|
39099
39076
|
};
|
|
39100
39077
|
|
|
39101
39078
|
const computeErrors = (fieldName, form) => {
|
|
39102
39079
|
const validators = form[fieldName].validators;
|
|
39103
|
-
return
|
|
39104
|
-
};
|
|
39105
|
-
|
|
39106
|
-
var obj;
|
|
39107
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
39108
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
39109
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
39110
|
-
function isDraft(value) {
|
|
39111
|
-
return !!value && !!value[DRAFT_STATE];
|
|
39112
|
-
}
|
|
39113
|
-
function isDraftable(value) {
|
|
39114
|
-
if (!value) { return false; }
|
|
39115
|
-
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
39116
|
-
}
|
|
39117
|
-
function isPlainObject(value) {
|
|
39118
|
-
if (!value || typeof value !== "object") { return false; }
|
|
39119
|
-
if (Array.isArray(value)) { return true; }
|
|
39120
|
-
var proto = Object.getPrototypeOf(value);
|
|
39121
|
-
return !proto || proto === Object.prototype;
|
|
39122
|
-
}
|
|
39123
|
-
var assign = Object.assign || function assign(target, value) {
|
|
39124
|
-
for (var key in value) {
|
|
39125
|
-
if (has$1(value, key)) {
|
|
39126
|
-
target[key] = value[key];
|
|
39127
|
-
}
|
|
39128
|
-
}
|
|
39129
|
-
|
|
39130
|
-
return target;
|
|
39131
|
-
};
|
|
39132
|
-
var ownKeys$2 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : typeof Object.getOwnPropertySymbols !== "undefined" ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : Object.getOwnPropertyNames;
|
|
39133
|
-
function shallowCopy(base, invokeGetters) {
|
|
39134
|
-
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
39135
|
-
|
|
39136
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
39137
|
-
var clone = Object.create(Object.getPrototypeOf(base));
|
|
39138
|
-
ownKeys$2(base).forEach(function (key) {
|
|
39139
|
-
if (key === DRAFT_STATE) {
|
|
39140
|
-
return; // Never copy over draft state.
|
|
39141
|
-
}
|
|
39142
|
-
|
|
39143
|
-
var desc = Object.getOwnPropertyDescriptor(base, key);
|
|
39144
|
-
var value = desc.value;
|
|
39145
|
-
|
|
39146
|
-
if (desc.get) {
|
|
39147
|
-
if (!invokeGetters) {
|
|
39148
|
-
throw new Error("Immer drafts cannot have computed properties");
|
|
39149
|
-
}
|
|
39150
|
-
|
|
39151
|
-
value = desc.get.call(base);
|
|
39152
|
-
}
|
|
39153
|
-
|
|
39154
|
-
if (desc.enumerable) {
|
|
39155
|
-
clone[key] = value;
|
|
39156
|
-
} else {
|
|
39157
|
-
Object.defineProperty(clone, key, {
|
|
39158
|
-
value: value,
|
|
39159
|
-
writable: true,
|
|
39160
|
-
configurable: true
|
|
39161
|
-
});
|
|
39162
|
-
}
|
|
39163
|
-
});
|
|
39164
|
-
return clone;
|
|
39165
|
-
}
|
|
39166
|
-
function each(value, cb) {
|
|
39167
|
-
if (Array.isArray(value)) {
|
|
39168
|
-
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
39169
|
-
} else {
|
|
39170
|
-
ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
39171
|
-
}
|
|
39172
|
-
}
|
|
39173
|
-
function isEnumerable(base, prop) {
|
|
39174
|
-
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
39175
|
-
return !!desc && desc.enumerable;
|
|
39176
|
-
}
|
|
39177
|
-
function has$1(thing, prop) {
|
|
39178
|
-
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
39179
|
-
}
|
|
39180
|
-
function is(x, y) {
|
|
39181
|
-
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
39182
|
-
if (x === y) {
|
|
39183
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
39184
|
-
} else {
|
|
39185
|
-
return x !== x && y !== y;
|
|
39186
|
-
}
|
|
39187
|
-
}
|
|
39188
|
-
function clone(obj) {
|
|
39189
|
-
if (!isDraftable(obj)) { return obj; }
|
|
39190
|
-
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
39191
|
-
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
39192
|
-
|
|
39193
|
-
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
39194
|
-
|
|
39195
|
-
return cloned;
|
|
39196
|
-
}
|
|
39197
|
-
|
|
39198
|
-
/** Each scope represents a `produce` call. */
|
|
39199
|
-
|
|
39200
|
-
var ImmerScope = function ImmerScope(parent) {
|
|
39201
|
-
this.drafts = [];
|
|
39202
|
-
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
39203
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
39204
|
-
|
|
39205
|
-
this.canAutoFreeze = true; // To avoid prototype lookups:
|
|
39206
|
-
|
|
39207
|
-
this.patches = null;
|
|
39208
|
-
};
|
|
39209
|
-
|
|
39210
|
-
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
39211
|
-
if (patchListener) {
|
|
39212
|
-
this.patches = [];
|
|
39213
|
-
this.inversePatches = [];
|
|
39214
|
-
this.patchListener = patchListener;
|
|
39215
|
-
}
|
|
39216
|
-
};
|
|
39217
|
-
|
|
39218
|
-
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
39219
|
-
this.leave();
|
|
39220
|
-
this.drafts.forEach(revoke);
|
|
39221
|
-
this.drafts = null; // Make draft-related methods throw.
|
|
39222
|
-
};
|
|
39223
|
-
|
|
39224
|
-
ImmerScope.prototype.leave = function leave () {
|
|
39225
|
-
if (this === ImmerScope.current) {
|
|
39226
|
-
ImmerScope.current = this.parent;
|
|
39227
|
-
}
|
|
39228
|
-
};
|
|
39229
|
-
ImmerScope.current = null;
|
|
39230
|
-
|
|
39231
|
-
ImmerScope.enter = function () {
|
|
39232
|
-
return this.current = new ImmerScope(this.current);
|
|
39233
|
-
};
|
|
39234
|
-
|
|
39235
|
-
function revoke(draft) {
|
|
39236
|
-
draft[DRAFT_STATE].revoke();
|
|
39237
|
-
}
|
|
39238
|
-
|
|
39239
|
-
// but share them all instead
|
|
39240
|
-
|
|
39241
|
-
var descriptors$1 = {};
|
|
39242
|
-
function willFinalize(scope, result, isReplaced) {
|
|
39243
|
-
scope.drafts.forEach(function (draft) {
|
|
39244
|
-
draft[DRAFT_STATE].finalizing = true;
|
|
39245
|
-
});
|
|
39246
|
-
|
|
39247
|
-
if (!isReplaced) {
|
|
39248
|
-
if (scope.patches) {
|
|
39249
|
-
markChangesRecursively(scope.drafts[0]);
|
|
39250
|
-
} // This is faster when we don't care about which attributes changed.
|
|
39251
|
-
|
|
39252
|
-
|
|
39253
|
-
markChangesSweep(scope.drafts);
|
|
39254
|
-
} // When a child draft is returned, look for changes.
|
|
39255
|
-
else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
|
|
39256
|
-
markChangesSweep(scope.drafts);
|
|
39257
|
-
}
|
|
39258
|
-
}
|
|
39259
|
-
function createProxy(base, parent) {
|
|
39260
|
-
var isArray = Array.isArray(base);
|
|
39261
|
-
var draft = clonePotentialDraft(base);
|
|
39262
|
-
each(draft, function (prop) {
|
|
39263
|
-
proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
|
|
39264
|
-
}); // See "proxy.js" for property documentation.
|
|
39265
|
-
|
|
39266
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39267
|
-
var state = {
|
|
39268
|
-
scope: scope,
|
|
39269
|
-
modified: false,
|
|
39270
|
-
finalizing: false,
|
|
39271
|
-
// es5 only
|
|
39272
|
-
finalized: false,
|
|
39273
|
-
assigned: {},
|
|
39274
|
-
parent: parent,
|
|
39275
|
-
base: base,
|
|
39276
|
-
draft: draft,
|
|
39277
|
-
copy: null,
|
|
39278
|
-
revoke: revoke$1,
|
|
39279
|
-
revoked: false // es5 only
|
|
39280
|
-
|
|
39281
|
-
};
|
|
39282
|
-
createHiddenProperty(draft, DRAFT_STATE, state);
|
|
39283
|
-
scope.drafts.push(draft);
|
|
39284
|
-
return draft;
|
|
39285
|
-
}
|
|
39286
|
-
|
|
39287
|
-
function revoke$1() {
|
|
39288
|
-
this.revoked = true;
|
|
39289
|
-
}
|
|
39290
|
-
|
|
39291
|
-
function source(state) {
|
|
39292
|
-
return state.copy || state.base;
|
|
39293
|
-
} // Access a property without creating an Immer draft.
|
|
39294
|
-
|
|
39295
|
-
|
|
39296
|
-
function peek(draft, prop) {
|
|
39297
|
-
var state = draft[DRAFT_STATE];
|
|
39298
|
-
|
|
39299
|
-
if (state && !state.finalizing) {
|
|
39300
|
-
state.finalizing = true;
|
|
39301
|
-
var value = draft[prop];
|
|
39302
|
-
state.finalizing = false;
|
|
39303
|
-
return value;
|
|
39304
|
-
}
|
|
39305
|
-
|
|
39306
|
-
return draft[prop];
|
|
39307
|
-
}
|
|
39308
|
-
|
|
39309
|
-
function get$1(state, prop) {
|
|
39310
|
-
assertUnrevoked(state);
|
|
39311
|
-
var value = peek(source(state), prop);
|
|
39312
|
-
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
39313
|
-
|
|
39314
|
-
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
39315
|
-
prepareCopy(state);
|
|
39316
|
-
return state.copy[prop] = createProxy(value, state);
|
|
39317
|
-
}
|
|
39318
|
-
|
|
39319
|
-
return value;
|
|
39320
|
-
}
|
|
39321
|
-
|
|
39322
|
-
function set$1(state, prop, value) {
|
|
39323
|
-
assertUnrevoked(state);
|
|
39324
|
-
state.assigned[prop] = true;
|
|
39325
|
-
|
|
39326
|
-
if (!state.modified) {
|
|
39327
|
-
if (is(value, peek(source(state), prop))) { return; }
|
|
39328
|
-
markChanged(state);
|
|
39329
|
-
prepareCopy(state);
|
|
39330
|
-
}
|
|
39331
|
-
|
|
39332
|
-
state.copy[prop] = value;
|
|
39333
|
-
}
|
|
39334
|
-
|
|
39335
|
-
function markChanged(state) {
|
|
39336
|
-
if (!state.modified) {
|
|
39337
|
-
state.modified = true;
|
|
39338
|
-
if (state.parent) { markChanged(state.parent); }
|
|
39339
|
-
}
|
|
39340
|
-
}
|
|
39341
|
-
|
|
39342
|
-
function prepareCopy(state) {
|
|
39343
|
-
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
39344
|
-
}
|
|
39345
|
-
|
|
39346
|
-
function clonePotentialDraft(base) {
|
|
39347
|
-
var state = base && base[DRAFT_STATE];
|
|
39348
|
-
|
|
39349
|
-
if (state) {
|
|
39350
|
-
state.finalizing = true;
|
|
39351
|
-
var draft = shallowCopy(state.draft, true);
|
|
39352
|
-
state.finalizing = false;
|
|
39353
|
-
return draft;
|
|
39354
|
-
}
|
|
39355
|
-
|
|
39356
|
-
return shallowCopy(base);
|
|
39357
|
-
}
|
|
39358
|
-
|
|
39359
|
-
function proxyProperty(draft, prop, enumerable) {
|
|
39360
|
-
var desc = descriptors$1[prop];
|
|
39361
|
-
|
|
39362
|
-
if (desc) {
|
|
39363
|
-
desc.enumerable = enumerable;
|
|
39364
|
-
} else {
|
|
39365
|
-
descriptors$1[prop] = desc = {
|
|
39366
|
-
configurable: true,
|
|
39367
|
-
enumerable: enumerable,
|
|
39368
|
-
|
|
39369
|
-
get: function get$1$1() {
|
|
39370
|
-
return get$1(this[DRAFT_STATE], prop);
|
|
39371
|
-
},
|
|
39372
|
-
|
|
39373
|
-
set: function set$1$1(value) {
|
|
39374
|
-
set$1(this[DRAFT_STATE], prop, value);
|
|
39375
|
-
}
|
|
39376
|
-
|
|
39377
|
-
};
|
|
39378
|
-
}
|
|
39379
|
-
|
|
39380
|
-
Object.defineProperty(draft, prop, desc);
|
|
39381
|
-
}
|
|
39382
|
-
|
|
39383
|
-
function assertUnrevoked(state) {
|
|
39384
|
-
if (state.revoked === true) { throw new Error("Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + JSON.stringify(source(state))); }
|
|
39385
|
-
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
39386
|
-
|
|
39387
|
-
|
|
39388
|
-
function markChangesSweep(drafts) {
|
|
39389
|
-
// The natural order of drafts in the `scope` array is based on when they
|
|
39390
|
-
// were accessed. By processing drafts in reverse natural order, we have a
|
|
39391
|
-
// better chance of processing leaf nodes first. When a leaf node is known to
|
|
39392
|
-
// have changed, we can avoid any traversal of its ancestor nodes.
|
|
39393
|
-
for (var i = drafts.length - 1; i >= 0; i--) {
|
|
39394
|
-
var state = drafts[i][DRAFT_STATE];
|
|
39395
|
-
|
|
39396
|
-
if (!state.modified) {
|
|
39397
|
-
if (Array.isArray(state.base)) {
|
|
39398
|
-
if (hasArrayChanges(state)) { markChanged(state); }
|
|
39399
|
-
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
39400
|
-
}
|
|
39401
|
-
}
|
|
39402
|
-
}
|
|
39403
|
-
|
|
39404
|
-
function markChangesRecursively(object) {
|
|
39405
|
-
if (!object || typeof object !== "object") { return; }
|
|
39406
|
-
var state = object[DRAFT_STATE];
|
|
39407
|
-
if (!state) { return; }
|
|
39408
|
-
var base = state.base;
|
|
39409
|
-
var draft = state.draft;
|
|
39410
|
-
var assigned = state.assigned;
|
|
39411
|
-
|
|
39412
|
-
if (!Array.isArray(object)) {
|
|
39413
|
-
// Look for added keys.
|
|
39414
|
-
Object.keys(draft).forEach(function (key) {
|
|
39415
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39416
|
-
if (base[key] === undefined && !has$1(base, key)) {
|
|
39417
|
-
assigned[key] = true;
|
|
39418
|
-
markChanged(state);
|
|
39419
|
-
} else if (!assigned[key]) {
|
|
39420
|
-
// Only untouched properties trigger recursion.
|
|
39421
|
-
markChangesRecursively(draft[key]);
|
|
39422
|
-
}
|
|
39423
|
-
}); // Look for removed keys.
|
|
39424
|
-
|
|
39425
|
-
Object.keys(base).forEach(function (key) {
|
|
39426
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39427
|
-
if (draft[key] === undefined && !has$1(draft, key)) {
|
|
39428
|
-
assigned[key] = false;
|
|
39429
|
-
markChanged(state);
|
|
39430
|
-
}
|
|
39431
|
-
});
|
|
39432
|
-
} else if (hasArrayChanges(state)) {
|
|
39433
|
-
markChanged(state);
|
|
39434
|
-
assigned.length = true;
|
|
39435
|
-
|
|
39436
|
-
if (draft.length < base.length) {
|
|
39437
|
-
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
39438
|
-
} else {
|
|
39439
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
39440
|
-
}
|
|
39441
|
-
|
|
39442
|
-
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
39443
|
-
// Only untouched indices trigger recursion.
|
|
39444
|
-
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
39445
|
-
}
|
|
39446
|
-
}
|
|
39447
|
-
}
|
|
39448
|
-
|
|
39449
|
-
function hasObjectChanges(state) {
|
|
39450
|
-
var base = state.base;
|
|
39451
|
-
var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
|
|
39452
|
-
// non-numeric keys are ordered by time of definition on the object.
|
|
39453
|
-
|
|
39454
|
-
var keys = Object.keys(draft);
|
|
39455
|
-
|
|
39456
|
-
for (var i = keys.length - 1; i >= 0; i--) {
|
|
39457
|
-
var key = keys[i];
|
|
39458
|
-
var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
|
|
39459
|
-
|
|
39460
|
-
if (baseValue === undefined && !has$1(base, key)) {
|
|
39461
|
-
return true;
|
|
39462
|
-
} // Once a base key is deleted, future changes go undetected, because its
|
|
39463
|
-
// descriptor is erased. This branch detects any missed changes.
|
|
39464
|
-
else {
|
|
39465
|
-
var value = draft[key];
|
|
39466
|
-
var state$1 = value && value[DRAFT_STATE];
|
|
39467
|
-
|
|
39468
|
-
if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
|
|
39469
|
-
return true;
|
|
39470
|
-
}
|
|
39471
|
-
}
|
|
39472
|
-
} // At this point, no keys were added or changed.
|
|
39473
|
-
// Compare key count to determine if keys were deleted.
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
return keys.length !== Object.keys(base).length;
|
|
39477
|
-
}
|
|
39478
|
-
|
|
39479
|
-
function hasArrayChanges(state) {
|
|
39480
|
-
var draft = state.draft;
|
|
39481
|
-
if (draft.length !== state.base.length) { return true; } // See #116
|
|
39482
|
-
// If we first shorten the length, our array interceptors will be removed.
|
|
39483
|
-
// If after that new items are added, result in the same original length,
|
|
39484
|
-
// those last items will have no intercepting property.
|
|
39485
|
-
// So if there is no own descriptor on the last position, we know that items were removed and added
|
|
39486
|
-
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
39487
|
-
// the last one
|
|
39488
|
-
|
|
39489
|
-
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
39490
|
-
|
|
39491
|
-
if (descriptor && !descriptor.get) { return true; } // For all other cases, we don't have to compare, as they would have been picked up by the index setters
|
|
39492
|
-
|
|
39493
|
-
return false;
|
|
39494
|
-
}
|
|
39495
|
-
|
|
39496
|
-
function createHiddenProperty(target, prop, value) {
|
|
39497
|
-
Object.defineProperty(target, prop, {
|
|
39498
|
-
value: value,
|
|
39499
|
-
enumerable: false,
|
|
39500
|
-
writable: true
|
|
39501
|
-
});
|
|
39502
|
-
}
|
|
39503
|
-
|
|
39504
|
-
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
39505
|
-
willFinalize: willFinalize,
|
|
39506
|
-
createProxy: createProxy
|
|
39507
|
-
});
|
|
39508
|
-
|
|
39509
|
-
function willFinalize$1() {}
|
|
39510
|
-
function createProxy$1(base, parent) {
|
|
39511
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39512
|
-
var state = {
|
|
39513
|
-
// Track which produce call this is associated with.
|
|
39514
|
-
scope: scope,
|
|
39515
|
-
// True for both shallow and deep changes.
|
|
39516
|
-
modified: false,
|
|
39517
|
-
// Used during finalization.
|
|
39518
|
-
finalized: false,
|
|
39519
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
39520
|
-
assigned: {},
|
|
39521
|
-
// The parent draft state.
|
|
39522
|
-
parent: parent,
|
|
39523
|
-
// The base state.
|
|
39524
|
-
base: base,
|
|
39525
|
-
// The base proxy.
|
|
39526
|
-
draft: null,
|
|
39527
|
-
// Any property proxies.
|
|
39528
|
-
drafts: {},
|
|
39529
|
-
// The base copy with any updated values.
|
|
39530
|
-
copy: null,
|
|
39531
|
-
// Called by the `produce` function.
|
|
39532
|
-
revoke: null
|
|
39533
|
-
};
|
|
39534
|
-
var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
|
|
39535
|
-
// although state itself is an object
|
|
39536
|
-
Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
|
|
39537
|
-
var revoke = ref.revoke;
|
|
39538
|
-
var proxy = ref.proxy;
|
|
39539
|
-
state.draft = proxy;
|
|
39540
|
-
state.revoke = revoke;
|
|
39541
|
-
scope.drafts.push(proxy);
|
|
39542
|
-
return proxy;
|
|
39543
|
-
}
|
|
39544
|
-
var objectTraps = {
|
|
39545
|
-
get: get$1$1,
|
|
39546
|
-
|
|
39547
|
-
has: function has(target, prop) {
|
|
39548
|
-
return prop in source$1(target);
|
|
39549
|
-
},
|
|
39550
|
-
|
|
39551
|
-
ownKeys: function ownKeys(target) {
|
|
39552
|
-
return Reflect.ownKeys(source$1(target));
|
|
39553
|
-
},
|
|
39554
|
-
|
|
39555
|
-
set: set$1$1,
|
|
39556
|
-
deleteProperty: deleteProperty,
|
|
39557
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
|
|
39558
|
-
|
|
39559
|
-
defineProperty: function defineProperty() {
|
|
39560
|
-
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
39561
|
-
},
|
|
39562
|
-
|
|
39563
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
39564
|
-
return Object.getPrototypeOf(target.base);
|
|
39565
|
-
},
|
|
39566
|
-
|
|
39567
|
-
setPrototypeOf: function setPrototypeOf() {
|
|
39568
|
-
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
39569
|
-
}
|
|
39570
|
-
|
|
39571
|
-
};
|
|
39572
|
-
var arrayTraps = {};
|
|
39573
|
-
each(objectTraps, function (key, fn) {
|
|
39574
|
-
arrayTraps[key] = function () {
|
|
39575
|
-
arguments[0] = arguments[0][0];
|
|
39576
|
-
return fn.apply(this, arguments);
|
|
39577
|
-
};
|
|
39578
|
-
});
|
|
39579
|
-
|
|
39580
|
-
arrayTraps.deleteProperty = function (state, prop) {
|
|
39581
|
-
if (isNaN(parseInt(prop))) {
|
|
39582
|
-
throw new Error("Immer only supports deleting array indices"); // prettier-ignore
|
|
39583
|
-
}
|
|
39584
|
-
|
|
39585
|
-
return objectTraps.deleteProperty.call(this, state[0], prop);
|
|
39586
|
-
};
|
|
39587
|
-
|
|
39588
|
-
arrayTraps.set = function (state, prop, value) {
|
|
39589
|
-
if (prop !== "length" && isNaN(parseInt(prop))) {
|
|
39590
|
-
throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
|
|
39591
|
-
}
|
|
39592
|
-
|
|
39593
|
-
return objectTraps.set.call(this, state[0], prop, value);
|
|
39594
|
-
}; // returns the object we should be reading the current value from, which is base, until some change has been made
|
|
39595
|
-
|
|
39596
|
-
|
|
39597
|
-
function source$1(state) {
|
|
39598
|
-
return state.copy || state.base;
|
|
39599
|
-
} // Access a property without creating an Immer draft.
|
|
39600
|
-
|
|
39601
|
-
|
|
39602
|
-
function peek$1(draft, prop) {
|
|
39603
|
-
var state = draft[DRAFT_STATE];
|
|
39604
|
-
var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
|
|
39605
|
-
return desc && desc.value;
|
|
39606
|
-
}
|
|
39607
|
-
|
|
39608
|
-
function get$1$1(state, prop) {
|
|
39609
|
-
if (prop === DRAFT_STATE) { return state; }
|
|
39610
|
-
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
39611
|
-
|
|
39612
|
-
if (!state.modified && has$1(drafts, prop)) {
|
|
39613
|
-
return drafts[prop];
|
|
39614
|
-
}
|
|
39615
|
-
|
|
39616
|
-
var value = source$1(state)[prop];
|
|
39617
|
-
|
|
39618
|
-
if (state.finalized || !isDraftable(value)) {
|
|
39619
|
-
return value;
|
|
39620
|
-
} // Check for existing draft in modified state.
|
|
39621
|
-
|
|
39622
|
-
|
|
39623
|
-
if (state.modified) {
|
|
39624
|
-
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
39625
|
-
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
39626
|
-
|
|
39627
|
-
drafts = state.copy;
|
|
39628
|
-
}
|
|
39629
|
-
|
|
39630
|
-
return drafts[prop] = createProxy$1(value, state);
|
|
39631
|
-
}
|
|
39632
|
-
|
|
39633
|
-
function set$1$1(state, prop, value) {
|
|
39634
|
-
if (!state.modified) {
|
|
39635
|
-
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
39636
|
-
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
39637
|
-
// values may be drafts, but falsy values are never drafts.
|
|
39638
|
-
|
|
39639
|
-
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
39640
|
-
if (isUnchanged) { return true; }
|
|
39641
|
-
markChanged$1(state);
|
|
39642
|
-
}
|
|
39643
|
-
|
|
39644
|
-
state.assigned[prop] = true;
|
|
39645
|
-
state.copy[prop] = value;
|
|
39646
|
-
return true;
|
|
39647
|
-
}
|
|
39648
|
-
|
|
39649
|
-
function deleteProperty(state, prop) {
|
|
39650
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39651
|
-
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
39652
|
-
state.assigned[prop] = false;
|
|
39653
|
-
markChanged$1(state);
|
|
39654
|
-
} else if (state.assigned[prop]) {
|
|
39655
|
-
// if an originally not assigned property was deleted
|
|
39656
|
-
delete state.assigned[prop];
|
|
39657
|
-
}
|
|
39658
|
-
|
|
39659
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
39660
|
-
return true;
|
|
39661
|
-
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
39662
|
-
// the same guarantee in ES5 mode.
|
|
39663
|
-
|
|
39664
|
-
|
|
39665
|
-
function getOwnPropertyDescriptor$2(state, prop) {
|
|
39666
|
-
var owner = source$1(state);
|
|
39667
|
-
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
39668
|
-
|
|
39669
|
-
if (desc) {
|
|
39670
|
-
desc.writable = true;
|
|
39671
|
-
desc.configurable = !Array.isArray(owner) || prop !== "length";
|
|
39672
|
-
}
|
|
39673
|
-
|
|
39674
|
-
return desc;
|
|
39675
|
-
}
|
|
39676
|
-
|
|
39677
|
-
function markChanged$1(state) {
|
|
39678
|
-
if (!state.modified) {
|
|
39679
|
-
state.modified = true;
|
|
39680
|
-
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
39681
|
-
state.drafts = null;
|
|
39682
|
-
if (state.parent) { markChanged$1(state.parent); }
|
|
39683
|
-
}
|
|
39684
|
-
}
|
|
39685
|
-
|
|
39686
|
-
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
39687
|
-
willFinalize: willFinalize$1,
|
|
39688
|
-
createProxy: createProxy$1
|
|
39689
|
-
});
|
|
39690
|
-
|
|
39691
|
-
function generatePatches(state, basePath, patches, inversePatches) {
|
|
39692
|
-
Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
|
|
39693
|
-
}
|
|
39694
|
-
|
|
39695
|
-
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
39696
|
-
var assign, assign$1;
|
|
39697
|
-
|
|
39698
|
-
var base = state.base;
|
|
39699
|
-
var copy = state.copy;
|
|
39700
|
-
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
39701
|
-
|
|
39702
|
-
if (copy.length < base.length) {
|
|
39703
|
-
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
39704
|
-
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
39705
|
-
}
|
|
39706
|
-
|
|
39707
|
-
var delta = copy.length - base.length; // Find the first replaced index.
|
|
39708
|
-
|
|
39709
|
-
var start = 0;
|
|
39710
|
-
|
|
39711
|
-
while (base[start] === copy[start] && start < base.length) {
|
|
39712
|
-
++start;
|
|
39713
|
-
} // Find the last replaced index. Search from the end to optimize splice patches.
|
|
39714
|
-
|
|
39715
|
-
|
|
39716
|
-
var end = base.length;
|
|
39717
|
-
|
|
39718
|
-
while (end > start && base[end - 1] === copy[end + delta - 1]) {
|
|
39719
|
-
--end;
|
|
39720
|
-
} // Process replaced indices.
|
|
39721
|
-
|
|
39722
|
-
|
|
39723
|
-
for (var i = start; i < end; ++i) {
|
|
39724
|
-
if (assigned[i] && copy[i] !== base[i]) {
|
|
39725
|
-
var path = basePath.concat([i]);
|
|
39726
|
-
patches.push({
|
|
39727
|
-
op: "replace",
|
|
39728
|
-
path: path,
|
|
39729
|
-
value: copy[i]
|
|
39730
|
-
});
|
|
39731
|
-
inversePatches.push({
|
|
39732
|
-
op: "replace",
|
|
39733
|
-
path: path,
|
|
39734
|
-
value: base[i]
|
|
39735
|
-
});
|
|
39736
|
-
}
|
|
39737
|
-
}
|
|
39738
|
-
|
|
39739
|
-
var replaceCount = patches.length; // Process added indices.
|
|
39740
|
-
|
|
39741
|
-
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
39742
|
-
var path$1 = basePath.concat([i$1]);
|
|
39743
|
-
patches[replaceCount + i$1 - end] = {
|
|
39744
|
-
op: "add",
|
|
39745
|
-
path: path$1,
|
|
39746
|
-
value: copy[i$1]
|
|
39747
|
-
};
|
|
39748
|
-
inversePatches.push({
|
|
39749
|
-
op: "remove",
|
|
39750
|
-
path: path$1
|
|
39751
|
-
});
|
|
39752
|
-
}
|
|
39753
|
-
}
|
|
39754
|
-
|
|
39755
|
-
function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
39756
|
-
var base = state.base;
|
|
39757
|
-
var copy = state.copy;
|
|
39758
|
-
each(state.assigned, function (key, assignedValue) {
|
|
39759
|
-
var origValue = base[key];
|
|
39760
|
-
var value = copy[key];
|
|
39761
|
-
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
39762
|
-
if (origValue === value && op === "replace") { return; }
|
|
39763
|
-
var path = basePath.concat(key);
|
|
39764
|
-
patches.push(op === "remove" ? {
|
|
39765
|
-
op: op,
|
|
39766
|
-
path: path
|
|
39767
|
-
} : {
|
|
39768
|
-
op: op,
|
|
39769
|
-
path: path,
|
|
39770
|
-
value: value
|
|
39771
|
-
});
|
|
39772
|
-
inversePatches.push(op === "add" ? {
|
|
39773
|
-
op: "remove",
|
|
39774
|
-
path: path
|
|
39775
|
-
} : op === "remove" ? {
|
|
39776
|
-
op: "add",
|
|
39777
|
-
path: path,
|
|
39778
|
-
value: origValue
|
|
39779
|
-
} : {
|
|
39780
|
-
op: "replace",
|
|
39781
|
-
path: path,
|
|
39782
|
-
value: origValue
|
|
39783
|
-
});
|
|
39784
|
-
});
|
|
39785
|
-
}
|
|
39786
|
-
|
|
39787
|
-
var applyPatches = function (draft, patches) {
|
|
39788
|
-
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
39789
|
-
var patch = list[i$1];
|
|
39790
|
-
|
|
39791
|
-
var path = patch.path;
|
|
39792
|
-
var op = patch.op;
|
|
39793
|
-
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
39794
|
-
|
|
39795
|
-
if (!path.length) { throw new Error("Illegal state"); }
|
|
39796
|
-
var base = draft;
|
|
39797
|
-
|
|
39798
|
-
for (var i = 0; i < path.length - 1; i++) {
|
|
39799
|
-
base = base[path[i]];
|
|
39800
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
39801
|
-
}
|
|
39802
|
-
|
|
39803
|
-
var key = path[path.length - 1];
|
|
39804
|
-
|
|
39805
|
-
switch (op) {
|
|
39806
|
-
case "replace":
|
|
39807
|
-
// if value is an object, then it's assigned by reference
|
|
39808
|
-
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
39809
|
-
// so we use value from the cloned patch
|
|
39810
|
-
base[key] = value;
|
|
39811
|
-
break;
|
|
39812
|
-
|
|
39813
|
-
case "add":
|
|
39814
|
-
if (Array.isArray(base)) {
|
|
39815
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
39816
|
-
base.splice(key, 0, value);
|
|
39817
|
-
} else {
|
|
39818
|
-
base[key] = value;
|
|
39819
|
-
}
|
|
39820
|
-
|
|
39821
|
-
break;
|
|
39822
|
-
|
|
39823
|
-
case "remove":
|
|
39824
|
-
if (Array.isArray(base)) {
|
|
39825
|
-
base.splice(key, 1);
|
|
39826
|
-
} else {
|
|
39827
|
-
delete base[key];
|
|
39828
|
-
}
|
|
39829
|
-
|
|
39830
|
-
break;
|
|
39831
|
-
|
|
39832
|
-
default:
|
|
39833
|
-
throw new Error("Unsupported patch operation: " + op);
|
|
39834
|
-
}
|
|
39835
|
-
}
|
|
39836
|
-
|
|
39837
|
-
return draft;
|
|
39838
|
-
};
|
|
39839
|
-
|
|
39840
|
-
function verifyMinified() {}
|
|
39841
|
-
|
|
39842
|
-
var configDefaults = {
|
|
39843
|
-
useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
|
|
39844
|
-
autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
|
|
39845
|
-
onAssign: null,
|
|
39846
|
-
onDelete: null,
|
|
39847
|
-
onCopy: null
|
|
39080
|
+
return runFormValidators(fieldName, form, validators);
|
|
39848
39081
|
};
|
|
39849
|
-
var Immer = function Immer(config) {
|
|
39850
|
-
assign(this, configDefaults, config);
|
|
39851
|
-
this.setUseProxies(this.useProxies);
|
|
39852
|
-
this.produce = this.produce.bind(this);
|
|
39853
|
-
};
|
|
39854
|
-
|
|
39855
|
-
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
39856
|
-
var this$1$1 = this;
|
|
39857
|
-
|
|
39858
|
-
// curried invocation
|
|
39859
|
-
if (typeof base === "function" && typeof recipe !== "function") {
|
|
39860
|
-
var defaultBase = recipe;
|
|
39861
|
-
recipe = base;
|
|
39862
|
-
var self = this;
|
|
39863
|
-
return function curriedProduce(base) {
|
|
39864
|
-
var this$1$1 = this;
|
|
39865
|
-
if ( base === void 0 ) base = defaultBase;
|
|
39866
|
-
var args = [], len = arguments.length - 1;
|
|
39867
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39868
|
-
|
|
39869
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
39870
|
-
};
|
|
39871
|
-
} // prettier-ignore
|
|
39872
|
-
|
|
39873
|
-
|
|
39874
|
-
{
|
|
39875
|
-
if (typeof recipe !== "function") {
|
|
39876
|
-
throw new Error("The first or second argument to `produce` must be a function");
|
|
39877
|
-
}
|
|
39878
|
-
|
|
39879
|
-
if (patchListener !== undefined && typeof patchListener !== "function") {
|
|
39880
|
-
throw new Error("The third argument to `produce` must be a function or undefined");
|
|
39881
|
-
}
|
|
39882
|
-
}
|
|
39883
|
-
var result; // Only plain objects, arrays, and "immerable classes" are drafted.
|
|
39884
|
-
|
|
39885
|
-
if (isDraftable(base)) {
|
|
39886
|
-
var scope = ImmerScope.enter();
|
|
39887
|
-
var proxy = this.createProxy(base);
|
|
39888
|
-
var hasError = true;
|
|
39889
|
-
|
|
39890
|
-
try {
|
|
39891
|
-
result = recipe(proxy);
|
|
39892
|
-
hasError = false;
|
|
39893
|
-
} finally {
|
|
39894
|
-
// finally instead of catch + rethrow better preserves original stack
|
|
39895
|
-
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
39896
|
-
}
|
|
39897
|
-
|
|
39898
|
-
if (result instanceof Promise) {
|
|
39899
|
-
return result.then(function (result) {
|
|
39900
|
-
scope.usePatches(patchListener);
|
|
39901
|
-
return this$1$1.processResult(result, scope);
|
|
39902
|
-
}, function (error) {
|
|
39903
|
-
scope.revoke();
|
|
39904
|
-
throw error;
|
|
39905
|
-
});
|
|
39906
|
-
}
|
|
39907
39082
|
|
|
39908
|
-
|
|
39909
|
-
|
|
39910
|
-
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39083
|
+
const computeErrorEntries = (formState) => {
|
|
39084
|
+
const fields = Object.entries(formState);
|
|
39085
|
+
for (let entry of fields) {
|
|
39086
|
+
let fieldName = entry[0];
|
|
39087
|
+
let errors = computeErrors(fieldName, formState);
|
|
39088
|
+
formState[fieldName].errors = errors;
|
|
39089
|
+
formState[fieldName].hasErrors = errors.length > 0;
|
|
39914
39090
|
}
|
|
39915
39091
|
};
|
|
39916
39092
|
|
|
39917
|
-
|
|
39918
|
-
|
|
39919
|
-
|
|
39920
|
-
|
|
39921
|
-
|
|
39922
|
-
|
|
39923
|
-
|
|
39924
|
-
|
|
39925
|
-
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
39926
|
-
};
|
|
39927
|
-
} // non-curried form
|
|
39928
|
-
|
|
39929
|
-
|
|
39930
|
-
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
39931
|
-
var patches, inversePatches;
|
|
39932
|
-
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
39933
|
-
patches = p;
|
|
39934
|
-
inversePatches = ip;
|
|
39935
|
-
});
|
|
39936
|
-
return [nextState, patches, inversePatches];
|
|
39937
|
-
};
|
|
39938
|
-
|
|
39939
|
-
Immer.prototype.createDraft = function createDraft (base) {
|
|
39940
|
-
if (!isDraftable(base)) {
|
|
39941
|
-
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
39942
|
-
}
|
|
39943
|
-
|
|
39944
|
-
var scope = ImmerScope.enter();
|
|
39945
|
-
var proxy = this.createProxy(base);
|
|
39946
|
-
proxy[DRAFT_STATE].isManual = true;
|
|
39947
|
-
scope.leave();
|
|
39948
|
-
return proxy;
|
|
39949
|
-
};
|
|
39950
|
-
|
|
39951
|
-
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
39952
|
-
var state = draft && draft[DRAFT_STATE];
|
|
39953
|
-
|
|
39954
|
-
if (!state || !state.isManual) {
|
|
39955
|
-
throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
|
|
39956
|
-
}
|
|
39957
|
-
|
|
39958
|
-
if (state.finalized) {
|
|
39959
|
-
throw new Error("The given draft is already finalized"); // prettier-ignore
|
|
39093
|
+
const computeDirtyEntries = (formState, changedFieldName) => {
|
|
39094
|
+
const fields = Object.entries(formState);
|
|
39095
|
+
for (let entry of fields) {
|
|
39096
|
+
let fieldName = entry[0];
|
|
39097
|
+
let field = entry[1];
|
|
39098
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
39099
|
+
formState[fieldName].dirty = dirty;
|
|
39960
39100
|
}
|
|
39961
|
-
|
|
39962
|
-
var scope = state.scope;
|
|
39963
|
-
scope.usePatches(patchListener);
|
|
39964
|
-
return this.processResult(undefined, scope);
|
|
39965
|
-
};
|
|
39966
|
-
|
|
39967
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
39968
|
-
this.autoFreeze = value;
|
|
39969
|
-
};
|
|
39970
|
-
|
|
39971
|
-
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
39972
|
-
this.useProxies = value;
|
|
39973
|
-
assign(this, value ? modernProxy : legacyProxy);
|
|
39974
39101
|
};
|
|
39975
39102
|
|
|
39976
|
-
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
39977
|
-
// If a patch replaces the entire state, take that replacement as base
|
|
39978
|
-
// before applying patches
|
|
39979
|
-
var i;
|
|
39980
|
-
|
|
39981
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
39982
|
-
var patch = patches[i];
|
|
39983
|
-
|
|
39984
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
39985
|
-
base = patch.value;
|
|
39986
|
-
break;
|
|
39987
|
-
}
|
|
39988
|
-
}
|
|
39989
|
-
|
|
39990
|
-
if (isDraft(base)) {
|
|
39991
|
-
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
39992
|
-
return applyPatches(base, patches);
|
|
39993
|
-
} // Otherwise, produce a copy of the base state.
|
|
39994
|
-
|
|
39995
|
-
|
|
39996
|
-
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
39997
|
-
};
|
|
39998
|
-
/** @internal */
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
Immer.prototype.processResult = function processResult (result, scope) {
|
|
40002
|
-
var baseDraft = scope.drafts[0];
|
|
40003
|
-
var isReplaced = result !== undefined && result !== baseDraft;
|
|
40004
|
-
this.willFinalize(scope, result, isReplaced);
|
|
40005
|
-
|
|
40006
|
-
if (isReplaced) {
|
|
40007
|
-
if (baseDraft[DRAFT_STATE].modified) {
|
|
40008
|
-
scope.revoke();
|
|
40009
|
-
throw new Error("An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft."); // prettier-ignore
|
|
40010
|
-
}
|
|
40011
|
-
|
|
40012
|
-
if (isDraftable(result)) {
|
|
40013
|
-
// Finalize the result in case it contains (or is) a subset of the draft.
|
|
40014
|
-
result = this.finalize(result, null, scope);
|
|
40015
|
-
}
|
|
39103
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a$1(n,r){return 2===o(n)?n.get(r):n[r]}function f$6(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c$1(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b$1(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b$1("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b$1("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b$1("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b$1("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f$6(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b$1("MapSet").F(r,t):v(r)?b$1("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b$1("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b$1("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a$1(u.t,r)===t||f$6(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){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 '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c$1(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b$1("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b$1("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
40016
39104
|
|
|
40017
|
-
|
|
40018
|
-
scope.patches.push({
|
|
40019
|
-
op: "replace",
|
|
40020
|
-
path: [],
|
|
40021
|
-
value: result
|
|
40022
|
-
});
|
|
40023
|
-
scope.inversePatches.push({
|
|
40024
|
-
op: "replace",
|
|
40025
|
-
path: [],
|
|
40026
|
-
value: baseDraft[DRAFT_STATE].base
|
|
40027
|
-
});
|
|
40028
|
-
}
|
|
40029
|
-
} else {
|
|
40030
|
-
// Finalize the base draft.
|
|
40031
|
-
result = this.finalize(baseDraft, [], scope);
|
|
40032
|
-
}
|
|
40033
|
-
|
|
40034
|
-
scope.revoke();
|
|
40035
|
-
|
|
40036
|
-
if (scope.patches) {
|
|
40037
|
-
scope.patchListener(scope.patches, scope.inversePatches);
|
|
40038
|
-
}
|
|
40039
|
-
|
|
40040
|
-
return result !== NOTHING ? result : undefined;
|
|
40041
|
-
};
|
|
40042
|
-
/**
|
|
40043
|
-
* @internal
|
|
40044
|
-
* Finalize a draft, returning either the unmodified base state or a modified
|
|
40045
|
-
* copy of the base state.
|
|
40046
|
-
*/
|
|
40047
|
-
|
|
40048
|
-
|
|
40049
|
-
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
40050
|
-
var this$1$1 = this;
|
|
40051
|
-
|
|
40052
|
-
var state = draft[DRAFT_STATE];
|
|
40053
|
-
|
|
40054
|
-
if (!state) {
|
|
40055
|
-
if (Object.isFrozen(draft)) { return draft; }
|
|
40056
|
-
return this.finalizeTree(draft, null, scope);
|
|
40057
|
-
} // Never finalize drafts owned by another scope.
|
|
40058
|
-
|
|
40059
|
-
|
|
40060
|
-
if (state.scope !== scope) {
|
|
40061
|
-
return draft;
|
|
40062
|
-
}
|
|
40063
|
-
|
|
40064
|
-
if (!state.modified) {
|
|
40065
|
-
return state.base;
|
|
40066
|
-
}
|
|
40067
|
-
|
|
40068
|
-
if (!state.finalized) {
|
|
40069
|
-
state.finalized = true;
|
|
40070
|
-
this.finalizeTree(state.draft, path, scope);
|
|
40071
|
-
|
|
40072
|
-
if (this.onDelete) {
|
|
40073
|
-
// The `assigned` object is unreliable with ES5 drafts.
|
|
40074
|
-
if (this.useProxies) {
|
|
40075
|
-
var assigned = state.assigned;
|
|
40076
|
-
|
|
40077
|
-
for (var prop in assigned) {
|
|
40078
|
-
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
40079
|
-
}
|
|
40080
|
-
} else {
|
|
40081
|
-
var base = state.base;
|
|
40082
|
-
var copy = state.copy;
|
|
40083
|
-
each(base, function (prop) {
|
|
40084
|
-
if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
40085
|
-
});
|
|
40086
|
-
}
|
|
40087
|
-
}
|
|
40088
|
-
|
|
40089
|
-
if (this.onCopy) {
|
|
40090
|
-
this.onCopy(state);
|
|
40091
|
-
} // At this point, all descendants of `state.copy` have been finalized,
|
|
40092
|
-
// so we can be sure that `scope.canAutoFreeze` is accurate.
|
|
40093
|
-
|
|
40094
|
-
|
|
40095
|
-
if (this.autoFreeze && scope.canAutoFreeze) {
|
|
40096
|
-
Object.freeze(state.copy);
|
|
40097
|
-
}
|
|
40098
|
-
|
|
40099
|
-
if (path && scope.patches) {
|
|
40100
|
-
generatePatches(state, path, scope.patches, scope.inversePatches);
|
|
40101
|
-
}
|
|
40102
|
-
}
|
|
40103
|
-
|
|
40104
|
-
return state.copy;
|
|
40105
|
-
};
|
|
40106
|
-
/**
|
|
40107
|
-
* @internal
|
|
40108
|
-
* Finalize all drafts in the given state tree.
|
|
40109
|
-
*/
|
|
40110
|
-
|
|
40111
|
-
|
|
40112
|
-
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
40113
|
-
var this$1$1 = this;
|
|
40114
|
-
|
|
40115
|
-
var state = root[DRAFT_STATE];
|
|
40116
|
-
|
|
40117
|
-
if (state) {
|
|
40118
|
-
if (!this.useProxies) {
|
|
40119
|
-
// Create the final copy, with added keys and without deleted keys.
|
|
40120
|
-
state.copy = shallowCopy(state.draft, true);
|
|
40121
|
-
}
|
|
40122
|
-
|
|
40123
|
-
root = state.copy;
|
|
40124
|
-
}
|
|
40125
|
-
|
|
40126
|
-
var needPatches = !!rootPath && !!scope.patches;
|
|
40127
|
-
|
|
40128
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
40129
|
-
if (value === parent) {
|
|
40130
|
-
throw Error("Immer forbids circular references");
|
|
40131
|
-
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
40132
|
-
|
|
40133
|
-
|
|
40134
|
-
var isDraftProp = !!state && parent === root;
|
|
40135
|
-
|
|
40136
|
-
if (isDraft(value)) {
|
|
40137
|
-
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
40138
|
-
|
|
40139
|
-
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
40140
|
-
|
|
40141
|
-
if (isDraft(value)) {
|
|
40142
|
-
scope.canAutoFreeze = false;
|
|
40143
|
-
} // Preserve non-enumerable properties.
|
|
40144
|
-
|
|
40145
|
-
|
|
40146
|
-
if (Array.isArray(parent) || isEnumerable(parent, prop)) {
|
|
40147
|
-
parent[prop] = value;
|
|
40148
|
-
} else {
|
|
40149
|
-
Object.defineProperty(parent, prop, {
|
|
40150
|
-
value: value
|
|
40151
|
-
});
|
|
40152
|
-
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
40153
|
-
|
|
40154
|
-
|
|
40155
|
-
if (isDraftProp && value === state.base[prop]) { return; }
|
|
40156
|
-
} // Unchanged draft properties are ignored.
|
|
40157
|
-
else if (isDraftProp && is(value, state.base[prop])) {
|
|
40158
|
-
return;
|
|
40159
|
-
} // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
|
|
40160
|
-
else if (isDraftable(value) && !Object.isFrozen(value)) {
|
|
40161
|
-
each(value, finalizeProperty);
|
|
40162
|
-
}
|
|
40163
|
-
|
|
40164
|
-
if (isDraftProp && this$1$1.onAssign) {
|
|
40165
|
-
this$1$1.onAssign(state, prop, value);
|
|
40166
|
-
}
|
|
40167
|
-
};
|
|
40168
|
-
|
|
40169
|
-
each(root, finalizeProperty);
|
|
40170
|
-
return root;
|
|
40171
|
-
};
|
|
40172
|
-
|
|
40173
|
-
var immer = new Immer();
|
|
40174
|
-
/**
|
|
40175
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
40176
|
-
* return value often depends on the base state). The recipe function is
|
|
40177
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
40178
|
-
* only ever applied to a __copy__ of the base state.
|
|
40179
|
-
*
|
|
40180
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
40181
|
-
* from passing the recipe function every time.
|
|
40182
|
-
*
|
|
40183
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
40184
|
-
* considered uncopyable.
|
|
40185
|
-
*
|
|
40186
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
40187
|
-
*
|
|
40188
|
-
* @param {any} base - the initial state
|
|
40189
|
-
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
40190
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
40191
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
40192
|
-
*/
|
|
40193
|
-
|
|
40194
|
-
var produce = immer.produce;
|
|
40195
|
-
/**
|
|
40196
|
-
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
40197
|
-
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
40198
|
-
*/
|
|
40199
|
-
|
|
40200
|
-
immer.produceWithPatches.bind(immer);
|
|
40201
|
-
/**
|
|
40202
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
40203
|
-
*
|
|
40204
|
-
* By default, auto-freezing is disabled in production.
|
|
40205
|
-
*/
|
|
40206
|
-
|
|
40207
|
-
immer.setAutoFreeze.bind(immer);
|
|
40208
|
-
/**
|
|
40209
|
-
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
40210
|
-
* always faster than using ES5 proxies.
|
|
40211
|
-
*
|
|
40212
|
-
* By default, feature detection is used, so calling this is rarely necessary.
|
|
40213
|
-
*/
|
|
40214
|
-
|
|
40215
|
-
immer.setUseProxies.bind(immer);
|
|
40216
|
-
/**
|
|
40217
|
-
* Apply an array of Immer patches to the first argument.
|
|
40218
|
-
*
|
|
40219
|
-
* This function is a producer, which means copy-on-write is in effect.
|
|
40220
|
-
*/
|
|
40221
|
-
|
|
40222
|
-
immer.applyPatches.bind(immer);
|
|
40223
|
-
/**
|
|
40224
|
-
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
40225
|
-
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
40226
|
-
*/
|
|
40227
|
-
|
|
40228
|
-
immer.createDraft.bind(immer);
|
|
40229
|
-
/**
|
|
40230
|
-
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
40231
|
-
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
40232
|
-
* mutated afterwards.
|
|
40233
|
-
*
|
|
40234
|
-
* Pass a function as the 2nd argument to generate Immer patches based on the
|
|
40235
|
-
* changes that were made.
|
|
40236
|
-
*/
|
|
40237
|
-
|
|
40238
|
-
immer.finishDraft.bind(immer);
|
|
40239
|
-
|
|
40240
|
-
const createInitialState = formConfig => {
|
|
39105
|
+
const createInitialState = (formConfig) => {
|
|
40241
39106
|
let initialForm = {};
|
|
40242
39107
|
const formConfigKeys = Object.keys(formConfig);
|
|
40243
39108
|
for (let formKey of formConfigKeys) {
|
|
40244
39109
|
initialForm[formKey] = {
|
|
40245
39110
|
dirty: false,
|
|
40246
|
-
rawValue: formConfig[formKey].defaultValue ||
|
|
39111
|
+
rawValue: formConfig[formKey].defaultValue || '',
|
|
40247
39112
|
validators: formConfig[formKey].validators || [],
|
|
40248
|
-
constraints: formConfig[formKey].constraints || []
|
|
39113
|
+
constraints: formConfig[formKey].constraints || [],
|
|
40249
39114
|
};
|
|
40250
39115
|
}
|
|
40251
39116
|
// Because validators require the entire form we have to do a
|
|
@@ -40256,82 +39121,99 @@ const createInitialState = formConfig => {
|
|
|
40256
39121
|
initialForm[formKey].errors = errors;
|
|
40257
39122
|
initialForm[formKey].hasErrors = errors.length > 0;
|
|
40258
39123
|
}
|
|
39124
|
+
|
|
40259
39125
|
return initialForm;
|
|
40260
39126
|
};
|
|
40261
39127
|
|
|
40262
|
-
const SET =
|
|
40263
|
-
const set$
|
|
39128
|
+
const SET = 'field/SET';
|
|
39129
|
+
const set$1 = (fieldName) => (value) => ({
|
|
40264
39130
|
type: SET,
|
|
40265
|
-
payload: { fieldName, value }
|
|
39131
|
+
payload: { fieldName, value },
|
|
40266
39132
|
});
|
|
40267
39133
|
|
|
40268
|
-
const CLEAR =
|
|
39134
|
+
const CLEAR = 'form/CLEAR';
|
|
40269
39135
|
const clear = () => ({ type: CLEAR });
|
|
40270
39136
|
|
|
40271
|
-
const ADD_VALIDATOR =
|
|
40272
|
-
const addValidator = fieldName => validator => ({
|
|
39137
|
+
const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
|
|
39138
|
+
const addValidator = (fieldName) => (validator) => ({
|
|
40273
39139
|
type: ADD_VALIDATOR,
|
|
40274
|
-
payload: { fieldName, validator }
|
|
39140
|
+
payload: { fieldName, validator },
|
|
40275
39141
|
});
|
|
40276
39142
|
|
|
40277
|
-
const
|
|
40278
|
-
|
|
40279
|
-
|
|
40280
|
-
|
|
40281
|
-
|
|
40282
|
-
case SET:
|
|
40283
|
-
const changedFieldName = action.payload.fieldName;
|
|
40284
|
-
const newRawValue = action.payload.value;
|
|
40285
|
-
|
|
40286
|
-
return produce(state, draftState => {
|
|
40287
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
40288
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
40289
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
40290
|
-
// If the change violates constraints, revert the change
|
|
40291
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
40292
|
-
return draftState;
|
|
40293
|
-
}
|
|
39143
|
+
const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
|
|
39144
|
+
const removeValidator = (fieldName) => (validator) => ({
|
|
39145
|
+
type: REMOVE_VALIDATOR,
|
|
39146
|
+
payload: { fieldName, validator },
|
|
39147
|
+
});
|
|
40294
39148
|
|
|
40295
|
-
|
|
40296
|
-
|
|
40297
|
-
|
|
40298
|
-
|
|
40299
|
-
|
|
40300
|
-
|
|
40301
|
-
|
|
40302
|
-
|
|
40303
|
-
|
|
40304
|
-
|
|
40305
|
-
|
|
40306
|
-
|
|
40307
|
-
|
|
40308
|
-
|
|
40309
|
-
|
|
40310
|
-
|
|
40311
|
-
|
|
40312
|
-
|
|
40313
|
-
|
|
40314
|
-
|
|
40315
|
-
|
|
40316
|
-
|
|
40317
|
-
|
|
40318
|
-
|
|
40319
|
-
|
|
40320
|
-
|
|
40321
|
-
|
|
40322
|
-
|
|
40323
|
-
|
|
40324
|
-
|
|
40325
|
-
|
|
40326
|
-
|
|
40327
|
-
|
|
40328
|
-
|
|
39149
|
+
const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
|
|
39150
|
+
const clearFieldValidators = (fieldName) => () => ({
|
|
39151
|
+
type: CLEAR_FIELD_VALIDATORS,
|
|
39152
|
+
payload: { fieldName },
|
|
39153
|
+
});
|
|
39154
|
+
|
|
39155
|
+
const createFormReducer =
|
|
39156
|
+
(formConfig) =>
|
|
39157
|
+
(state = createInitialState(formConfig), action) => {
|
|
39158
|
+
switch (action.type) {
|
|
39159
|
+
case SET: {
|
|
39160
|
+
const changedFieldName = action.payload.fieldName;
|
|
39161
|
+
const newRawValue = action.payload.value;
|
|
39162
|
+
|
|
39163
|
+
return produce(state, (draftState) => {
|
|
39164
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
39165
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
39166
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
39167
|
+
// If the change violates constraints, revert the change
|
|
39168
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
39169
|
+
return draftState;
|
|
39170
|
+
}
|
|
39171
|
+
|
|
39172
|
+
computeDirtyEntries(draftState, changedFieldName);
|
|
39173
|
+
computeErrorEntries(draftState);
|
|
39174
|
+
});
|
|
39175
|
+
}
|
|
39176
|
+
case CLEAR:
|
|
39177
|
+
return createInitialState(formConfig);
|
|
39178
|
+
case ADD_VALIDATOR: {
|
|
39179
|
+
const fieldWithOverride = action.payload.fieldName;
|
|
39180
|
+
const newValidator = action.payload.validator;
|
|
39181
|
+
|
|
39182
|
+
return produce(state, (draftState) => {
|
|
39183
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
39184
|
+
computeErrorEntries(draftState);
|
|
39185
|
+
});
|
|
39186
|
+
}
|
|
39187
|
+
case REMOVE_VALIDATOR: {
|
|
39188
|
+
const fieldToOverride = action.payload.fieldName;
|
|
39189
|
+
const targetValidator = action.payload.validator;
|
|
39190
|
+
|
|
39191
|
+
return produce(state, (draftState) => {
|
|
39192
|
+
let fieldValidators = draftState[fieldToOverride].validators;
|
|
39193
|
+
draftState[fieldToOverride].validators = fieldValidators.filter(
|
|
39194
|
+
(validator) => validator.type !== targetValidator.type
|
|
39195
|
+
);
|
|
39196
|
+
computeErrorEntries(draftState);
|
|
39197
|
+
});
|
|
39198
|
+
}
|
|
39199
|
+
case CLEAR_FIELD_VALIDATORS: {
|
|
39200
|
+
const fieldToClear = action.payload.fieldName;
|
|
39201
|
+
|
|
39202
|
+
return produce(state, (draftState) => {
|
|
39203
|
+
draftState[fieldToClear].validators = [];
|
|
39204
|
+
computeErrorEntries(draftState);
|
|
39205
|
+
});
|
|
39206
|
+
}
|
|
39207
|
+
default:
|
|
39208
|
+
return state;
|
|
39209
|
+
}
|
|
39210
|
+
};
|
|
40329
39211
|
|
|
40330
|
-
const createMapDispatchToProps = formConfig => {
|
|
39212
|
+
const createMapDispatchToProps = (formConfig) => {
|
|
40331
39213
|
// Do memo-ization
|
|
40332
39214
|
let cachedDispatch;
|
|
40333
39215
|
let cacheValue;
|
|
40334
|
-
return dispatch => {
|
|
39216
|
+
return (dispatch) => {
|
|
40335
39217
|
if (dispatch == cachedDispatch) {
|
|
40336
39218
|
return cacheValue;
|
|
40337
39219
|
}
|
|
@@ -40340,8 +39222,11 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40340
39222
|
const keys = Object.keys(formConfig);
|
|
40341
39223
|
for (let fieldName of keys) {
|
|
40342
39224
|
dispatchObj.fields[fieldName] = {
|
|
40343
|
-
set: value => dispatch(set$
|
|
40344
|
-
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
39225
|
+
set: (value) => dispatch(set$1(fieldName)(value)),
|
|
39226
|
+
addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
|
|
39227
|
+
removeValidator: (validator) =>
|
|
39228
|
+
dispatch(removeValidator(fieldName)(validator)),
|
|
39229
|
+
clear: () => dispatch(clearFieldValidators(fieldName)()),
|
|
40345
39230
|
};
|
|
40346
39231
|
}
|
|
40347
39232
|
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
@@ -40351,12 +39236,12 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40351
39236
|
};
|
|
40352
39237
|
};
|
|
40353
39238
|
|
|
40354
|
-
const mapStateToProps = state => ({ fields: state });
|
|
39239
|
+
const mapStateToProps = (state) => ({ fields: state });
|
|
40355
39240
|
|
|
40356
|
-
const createFormState = formConfig => ({
|
|
39241
|
+
const createFormState = (formConfig) => ({
|
|
40357
39242
|
reducer: createFormReducer(formConfig),
|
|
40358
39243
|
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
40359
|
-
mapStateToProps: mapStateToProps
|
|
39244
|
+
mapStateToProps: mapStateToProps,
|
|
40360
39245
|
});
|
|
40361
39246
|
|
|
40362
39247
|
var AddressForm = function AddressForm(_ref) {
|
|
@@ -43222,12 +42107,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
|
|
|
43222
42107
|
* This source code is licensed under the MIT license found in the
|
|
43223
42108
|
* LICENSE file in the root directory of this source tree.
|
|
43224
42109
|
*/
|
|
43225
|
-
var b$
|
|
43226
|
-
Symbol.for("react.suspense_list"):60120,r=b$
|
|
43227
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$
|
|
43228
|
-
var Profiler=g;var StrictMode=f$
|
|
43229
|
-
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f$
|
|
43230
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$
|
|
42110
|
+
var b$2="function"===typeof Symbol&&Symbol.for,c$2=b$2?Symbol.for("react.element"):60103,d$1=b$2?Symbol.for("react.portal"):60106,e=b$2?Symbol.for("react.fragment"):60107,f$7=b$2?Symbol.for("react.strict_mode"):60108,g$1=b$2?Symbol.for("react.profiler"):60114,h$1=b$2?Symbol.for("react.provider"):60109,k$1=b$2?Symbol.for("react.context"):60110,l$1=b$2?Symbol.for("react.async_mode"):60111,m=b$2?Symbol.for("react.concurrent_mode"):60111,n$1=b$2?Symbol.for("react.forward_ref"):60112,p$1=b$2?Symbol.for("react.suspense"):60113,q$1=b$2?
|
|
42111
|
+
Symbol.for("react.suspense_list"):60120,r$1=b$2?Symbol.for("react.memo"):60115,t$1=b$2?Symbol.for("react.lazy"):60116,v$1=b$2?Symbol.for("react.block"):60121,w$1=b$2?Symbol.for("react.fundamental"):60117,x$1=b$2?Symbol.for("react.responder"):60118,y$1=b$2?Symbol.for("react.scope"):60119;
|
|
42112
|
+
function z$1(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$2:switch(a=a.type,a){case l$1:case m:case e:case g$1:case f$7:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r$1:case h$1:return a;default:return u}}case d$1:return u}}}function A$1(a){return z$1(a)===m}var AsyncMode=l$1;var ConcurrentMode=m;var ContextConsumer=k$1;var ContextProvider=h$1;var Element$1=c$2;var ForwardRef=n$1;var Fragment=e;var Lazy=t$1;var Memo=r$1;var Portal=d$1;
|
|
42113
|
+
var Profiler=g$1;var StrictMode=f$7;var Suspense=p$1;var isAsyncMode=function(a){return A$1(a)||z$1(a)===l$1};var isConcurrentMode=A$1;var isContextConsumer=function(a){return z$1(a)===k$1};var isContextProvider=function(a){return z$1(a)===h$1};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$2};var isForwardRef=function(a){return z$1(a)===n$1};var isFragment=function(a){return z$1(a)===e};var isLazy=function(a){return z$1(a)===t$1};
|
|
42114
|
+
var isMemo=function(a){return z$1(a)===r$1};var isPortal=function(a){return z$1(a)===d$1};var isProfiler=function(a){return z$1(a)===g$1};var isStrictMode=function(a){return z$1(a)===f$7};var isSuspense=function(a){return z$1(a)===p$1};
|
|
42115
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g$1||a===f$7||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r$1||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y$1||a.$$typeof===v$1)};var typeOf=z$1;
|
|
43231
42116
|
|
|
43232
42117
|
var reactIs_production_min = {
|
|
43233
42118
|
AsyncMode: AsyncMode,
|
|
@@ -43598,14 +42483,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
43598
42483
|
|
|
43599
42484
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
43600
42485
|
|
|
43601
|
-
var has$
|
|
42486
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
43602
42487
|
|
|
43603
42488
|
var printWarning = function() {};
|
|
43604
42489
|
|
|
43605
42490
|
if (process.env.NODE_ENV !== 'production') {
|
|
43606
42491
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
43607
42492
|
var loggedTypeFailures = {};
|
|
43608
|
-
var has$
|
|
42493
|
+
var has$2 = has$1;
|
|
43609
42494
|
|
|
43610
42495
|
printWarning = function(text) {
|
|
43611
42496
|
var message = 'Warning: ' + text;
|
|
@@ -43635,7 +42520,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43635
42520
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
43636
42521
|
if (process.env.NODE_ENV !== 'production') {
|
|
43637
42522
|
for (var typeSpecName in typeSpecs) {
|
|
43638
|
-
if (has$
|
|
42523
|
+
if (has$2(typeSpecs, typeSpecName)) {
|
|
43639
42524
|
var error;
|
|
43640
42525
|
// Prop type validation may throw. In case they do, we don't want to
|
|
43641
42526
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -44034,7 +42919,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44034
42919
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
44035
42920
|
}
|
|
44036
42921
|
for (var key in propValue) {
|
|
44037
|
-
if (has$
|
|
42922
|
+
if (has$1(propValue, key)) {
|
|
44038
42923
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
44039
42924
|
if (error instanceof Error) {
|
|
44040
42925
|
return error;
|
|
@@ -44071,7 +42956,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44071
42956
|
if (checkerResult == null) {
|
|
44072
42957
|
return null;
|
|
44073
42958
|
}
|
|
44074
|
-
if (checkerResult.data && has$
|
|
42959
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
44075
42960
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
44076
42961
|
}
|
|
44077
42962
|
}
|
|
@@ -44131,7 +43016,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44131
43016
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
44132
43017
|
for (var key in allKeys) {
|
|
44133
43018
|
var checker = shapeTypes[key];
|
|
44134
|
-
if (has$
|
|
43019
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
44135
43020
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
44136
43021
|
}
|
|
44137
43022
|
if (!checker) {
|
|
@@ -44869,7 +43754,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
44869
43754
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
44870
43755
|
*/
|
|
44871
43756
|
|
|
44872
|
-
function ownKeys$
|
|
43757
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
44873
43758
|
var keys = Object.keys(object);
|
|
44874
43759
|
|
|
44875
43760
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -44885,9 +43770,9 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
44885
43770
|
function _objectSpread2$1(target) {
|
|
44886
43771
|
for (var i = 1; i < arguments.length; i++) {
|
|
44887
43772
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
44888
|
-
i % 2 ? ownKeys$
|
|
43773
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
44889
43774
|
_defineProperty$1(target, key, source[key]);
|
|
44890
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$
|
|
43775
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
44891
43776
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44892
43777
|
});
|
|
44893
43778
|
}
|