@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.cjs.js
CHANGED
|
@@ -19018,12 +19018,14 @@ function _extends$1() {
|
|
|
19018
19018
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
19019
19019
|
for (var i = 1; i < arguments.length; i++) {
|
|
19020
19020
|
var source = arguments[i];
|
|
19021
|
+
|
|
19021
19022
|
for (var key in source) {
|
|
19022
19023
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
19023
19024
|
target[key] = source[key];
|
|
19024
19025
|
}
|
|
19025
19026
|
}
|
|
19026
19027
|
}
|
|
19028
|
+
|
|
19027
19029
|
return target;
|
|
19028
19030
|
};
|
|
19029
19031
|
return _extends$1.apply(this, arguments);
|
|
@@ -19033,6 +19035,7 @@ function _assertThisInitialized(self) {
|
|
|
19033
19035
|
if (self === void 0) {
|
|
19034
19036
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
19035
19037
|
}
|
|
19038
|
+
|
|
19036
19039
|
return self;
|
|
19037
19040
|
}
|
|
19038
19041
|
|
|
@@ -19065,6 +19068,7 @@ function _isNativeReflectConstruct() {
|
|
|
19065
19068
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
19066
19069
|
if (Reflect.construct.sham) return false;
|
|
19067
19070
|
if (typeof Proxy === "function") return true;
|
|
19071
|
+
|
|
19068
19072
|
try {
|
|
19069
19073
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
19070
19074
|
return true;
|
|
@@ -19086,23 +19090,30 @@ function _construct(Parent, args, Class) {
|
|
|
19086
19090
|
return instance;
|
|
19087
19091
|
};
|
|
19088
19092
|
}
|
|
19093
|
+
|
|
19089
19094
|
return _construct.apply(null, arguments);
|
|
19090
19095
|
}
|
|
19091
19096
|
|
|
19092
19097
|
function _wrapNativeSuper(Class) {
|
|
19093
19098
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
19099
|
+
|
|
19094
19100
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
19095
19101
|
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
19102
|
+
|
|
19096
19103
|
if (typeof Class !== "function") {
|
|
19097
19104
|
throw new TypeError("Super expression must either be null or a function");
|
|
19098
19105
|
}
|
|
19106
|
+
|
|
19099
19107
|
if (typeof _cache !== "undefined") {
|
|
19100
19108
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
19109
|
+
|
|
19101
19110
|
_cache.set(Class, Wrapper);
|
|
19102
19111
|
}
|
|
19112
|
+
|
|
19103
19113
|
function Wrapper() {
|
|
19104
19114
|
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
19105
19115
|
}
|
|
19116
|
+
|
|
19106
19117
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
19107
19118
|
constructor: {
|
|
19108
19119
|
value: Wrapper,
|
|
@@ -19113,6 +19124,7 @@ function _wrapNativeSuper(Class) {
|
|
|
19113
19124
|
});
|
|
19114
19125
|
return _setPrototypeOf(Wrapper, Class);
|
|
19115
19126
|
};
|
|
19127
|
+
|
|
19116
19128
|
return _wrapNativeSuper(Class);
|
|
19117
19129
|
}
|
|
19118
19130
|
|
|
@@ -22401,7 +22413,7 @@ var check = function (it) {
|
|
|
22401
22413
|
|
|
22402
22414
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
22403
22415
|
var global_1 =
|
|
22404
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
22416
|
+
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
22405
22417
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
22406
22418
|
check(typeof window == 'object' && window) ||
|
|
22407
22419
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -22420,12 +22432,12 @@ var fails = function (exec) {
|
|
|
22420
22432
|
|
|
22421
22433
|
// Detect IE8's incomplete defineProperty implementation
|
|
22422
22434
|
var descriptors = !fails(function () {
|
|
22423
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22435
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22424
22436
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
22425
22437
|
});
|
|
22426
22438
|
|
|
22427
22439
|
var functionBindNative = !fails(function () {
|
|
22428
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
22440
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
22429
22441
|
var test = (function () { /* empty */ }).bind();
|
|
22430
22442
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
22431
22443
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -22438,7 +22450,7 @@ var functionCall = functionBindNative ? call.bind(call) : function () {
|
|
|
22438
22450
|
};
|
|
22439
22451
|
|
|
22440
22452
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
22441
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22453
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22442
22454
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
22443
22455
|
|
|
22444
22456
|
// Nashorn ~ JDK8 bug
|
|
@@ -22465,11 +22477,14 @@ var createPropertyDescriptor = function (bitmap, value) {
|
|
|
22465
22477
|
};
|
|
22466
22478
|
|
|
22467
22479
|
var FunctionPrototype = Function.prototype;
|
|
22480
|
+
var bind$1 = FunctionPrototype.bind;
|
|
22468
22481
|
var call$1 = FunctionPrototype.call;
|
|
22469
|
-
var
|
|
22482
|
+
var uncurryThis = functionBindNative && bind$1.bind(call$1, call$1);
|
|
22470
22483
|
|
|
22471
|
-
var functionUncurryThis = functionBindNative ?
|
|
22472
|
-
return
|
|
22484
|
+
var functionUncurryThis = functionBindNative ? function (fn) {
|
|
22485
|
+
return fn && uncurryThis(fn);
|
|
22486
|
+
} : function (fn) {
|
|
22487
|
+
return fn && function () {
|
|
22473
22488
|
return call$1.apply(fn, arguments);
|
|
22474
22489
|
};
|
|
22475
22490
|
};
|
|
@@ -22493,18 +22508,12 @@ var indexedObject = fails(function () {
|
|
|
22493
22508
|
return classofRaw(it) == 'String' ? split(it, '') : $Object(it);
|
|
22494
22509
|
} : $Object;
|
|
22495
22510
|
|
|
22496
|
-
// we can't use just `it == null` since of `document.all` special case
|
|
22497
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
|
|
22498
|
-
var isNullOrUndefined = function (it) {
|
|
22499
|
-
return it === null || it === undefined;
|
|
22500
|
-
};
|
|
22501
|
-
|
|
22502
22511
|
var $TypeError = TypeError;
|
|
22503
22512
|
|
|
22504
22513
|
// `RequireObjectCoercible` abstract operation
|
|
22505
22514
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
22506
22515
|
var requireObjectCoercible = function (it) {
|
|
22507
|
-
if (
|
|
22516
|
+
if (it == undefined) throw $TypeError("Can't call method on " + it);
|
|
22508
22517
|
return it;
|
|
22509
22518
|
};
|
|
22510
22519
|
|
|
@@ -22516,32 +22525,13 @@ var toIndexedObject = function (it) {
|
|
|
22516
22525
|
return indexedObject(requireObjectCoercible(it));
|
|
22517
22526
|
};
|
|
22518
22527
|
|
|
22519
|
-
var documentAll = typeof document == 'object' && document.all;
|
|
22520
|
-
|
|
22521
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
22522
|
-
// eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
|
|
22523
|
-
var IS_HTMLDDA = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
22524
|
-
|
|
22525
|
-
var documentAll_1 = {
|
|
22526
|
-
all: documentAll,
|
|
22527
|
-
IS_HTMLDDA: IS_HTMLDDA
|
|
22528
|
-
};
|
|
22529
|
-
|
|
22530
|
-
var documentAll$1 = documentAll_1.all;
|
|
22531
|
-
|
|
22532
22528
|
// `IsCallable` abstract operation
|
|
22533
22529
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
22534
|
-
var isCallable =
|
|
22535
|
-
return typeof argument == 'function' || argument === documentAll$1;
|
|
22536
|
-
} : function (argument) {
|
|
22530
|
+
var isCallable = function (argument) {
|
|
22537
22531
|
return typeof argument == 'function';
|
|
22538
22532
|
};
|
|
22539
22533
|
|
|
22540
|
-
var
|
|
22541
|
-
|
|
22542
|
-
var isObject = documentAll_1.IS_HTMLDDA ? function (it) {
|
|
22543
|
-
return typeof it == 'object' ? it !== null : isCallable(it) || it === documentAll$2;
|
|
22544
|
-
} : function (it) {
|
|
22534
|
+
var isObject = function (it) {
|
|
22545
22535
|
return typeof it == 'object' ? it !== null : isCallable(it);
|
|
22546
22536
|
};
|
|
22547
22537
|
|
|
@@ -22555,7 +22545,7 @@ var getBuiltIn = function (namespace, method) {
|
|
|
22555
22545
|
|
|
22556
22546
|
var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
22557
22547
|
|
|
22558
|
-
var engineUserAgent =
|
|
22548
|
+
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
22559
22549
|
|
|
22560
22550
|
var process$1 = global_1.process;
|
|
22561
22551
|
var Deno = global_1.Deno;
|
|
@@ -22582,12 +22572,12 @@ if (!version && engineUserAgent) {
|
|
|
22582
22572
|
|
|
22583
22573
|
var engineV8Version = version;
|
|
22584
22574
|
|
|
22585
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
22575
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
22586
22576
|
|
|
22587
22577
|
|
|
22588
22578
|
|
|
22589
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
22590
|
-
var
|
|
22579
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
22580
|
+
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
22591
22581
|
var symbol = Symbol();
|
|
22592
22582
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
22593
22583
|
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
@@ -22596,10 +22586,10 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(functi
|
|
|
22596
22586
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
22597
22587
|
});
|
|
22598
22588
|
|
|
22599
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
22589
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
22600
22590
|
|
|
22601
22591
|
|
|
22602
|
-
var useSymbolAsUid =
|
|
22592
|
+
var useSymbolAsUid = nativeSymbol
|
|
22603
22593
|
&& !Symbol.sham
|
|
22604
22594
|
&& typeof Symbol.iterator == 'symbol';
|
|
22605
22595
|
|
|
@@ -22634,7 +22624,7 @@ var aCallable = function (argument) {
|
|
|
22634
22624
|
// https://tc39.es/ecma262/#sec-getmethod
|
|
22635
22625
|
var getMethod = function (V, P) {
|
|
22636
22626
|
var func = V[P];
|
|
22637
|
-
return
|
|
22627
|
+
return func == null ? undefined : aCallable(func);
|
|
22638
22628
|
};
|
|
22639
22629
|
|
|
22640
22630
|
var $TypeError$2 = TypeError;
|
|
@@ -22649,7 +22639,7 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
22649
22639
|
throw $TypeError$2("Can't convert object to primitive value");
|
|
22650
22640
|
};
|
|
22651
22641
|
|
|
22652
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22642
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22653
22643
|
var defineProperty = Object.defineProperty;
|
|
22654
22644
|
|
|
22655
22645
|
var defineGlobalProperty = function (key, value) {
|
|
@@ -22669,10 +22659,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
22669
22659
|
(module.exports = function (key, value) {
|
|
22670
22660
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
22671
22661
|
})('versions', []).push({
|
|
22672
|
-
version: '3.
|
|
22662
|
+
version: '3.24.1',
|
|
22673
22663
|
mode: 'global',
|
|
22674
|
-
copyright: '© 2014-
|
|
22675
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
22664
|
+
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
22665
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE',
|
|
22676
22666
|
source: 'https://github.com/zloirock/core-js'
|
|
22677
22667
|
});
|
|
22678
22668
|
});
|
|
@@ -22689,7 +22679,7 @@ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
|
22689
22679
|
|
|
22690
22680
|
// `HasOwnProperty` abstract operation
|
|
22691
22681
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
22692
|
-
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
22682
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
22693
22683
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
22694
22684
|
return hasOwnProperty(toObject(it), key);
|
|
22695
22685
|
};
|
|
@@ -22702,15 +22692,21 @@ var uid = function (key) {
|
|
|
22702
22692
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
|
|
22703
22693
|
};
|
|
22704
22694
|
|
|
22705
|
-
var Symbol$1 = global_1.Symbol;
|
|
22706
22695
|
var WellKnownSymbolsStore = shared('wks');
|
|
22707
|
-
var
|
|
22696
|
+
var Symbol$1 = global_1.Symbol;
|
|
22697
|
+
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
22698
|
+
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
|
|
22708
22699
|
|
|
22709
22700
|
var wellKnownSymbol = function (name) {
|
|
22710
|
-
if (!hasOwnProperty_1(WellKnownSymbolsStore, name)) {
|
|
22711
|
-
|
|
22712
|
-
|
|
22713
|
-
|
|
22701
|
+
if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
|
|
22702
|
+
var description = 'Symbol.' + name;
|
|
22703
|
+
if (nativeSymbol && hasOwnProperty_1(Symbol$1, name)) {
|
|
22704
|
+
WellKnownSymbolsStore[name] = Symbol$1[name];
|
|
22705
|
+
} else if (useSymbolAsUid && symbolFor) {
|
|
22706
|
+
WellKnownSymbolsStore[name] = symbolFor(description);
|
|
22707
|
+
} else {
|
|
22708
|
+
WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
|
22709
|
+
}
|
|
22714
22710
|
} return WellKnownSymbolsStore[name];
|
|
22715
22711
|
};
|
|
22716
22712
|
|
|
@@ -22750,13 +22746,13 @@ var documentCreateElement = function (it) {
|
|
|
22750
22746
|
|
|
22751
22747
|
// Thanks to IE8 for its funny defineProperty
|
|
22752
22748
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
22753
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22749
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22754
22750
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
22755
22751
|
get: function () { return 7; }
|
|
22756
22752
|
}).a != 7;
|
|
22757
22753
|
});
|
|
22758
22754
|
|
|
22759
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22755
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22760
22756
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
22761
22757
|
|
|
22762
22758
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -22777,7 +22773,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
22777
22773
|
// V8 ~ Chrome 36-
|
|
22778
22774
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
22779
22775
|
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
22780
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
22776
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
22781
22777
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
22782
22778
|
value: 42,
|
|
22783
22779
|
writable: false
|
|
@@ -22794,9 +22790,9 @@ var anObject = function (argument) {
|
|
|
22794
22790
|
};
|
|
22795
22791
|
|
|
22796
22792
|
var $TypeError$5 = TypeError;
|
|
22797
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22793
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22798
22794
|
var $defineProperty = Object.defineProperty;
|
|
22799
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22795
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22800
22796
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
22801
22797
|
var ENUMERABLE = 'enumerable';
|
|
22802
22798
|
var CONFIGURABLE = 'configurable';
|
|
@@ -22843,7 +22839,7 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
|
22843
22839
|
};
|
|
22844
22840
|
|
|
22845
22841
|
var FunctionPrototype$1 = Function.prototype;
|
|
22846
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
22842
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
22847
22843
|
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
22848
22844
|
|
|
22849
22845
|
var EXISTS$1 = hasOwnProperty_1(FunctionPrototype$1, 'name');
|
|
@@ -22870,7 +22866,7 @@ var inspectSource = sharedStore.inspectSource;
|
|
|
22870
22866
|
|
|
22871
22867
|
var WeakMap$1 = global_1.WeakMap;
|
|
22872
22868
|
|
|
22873
|
-
var
|
|
22869
|
+
var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
|
|
22874
22870
|
|
|
22875
22871
|
var keys$1 = shared('keys');
|
|
22876
22872
|
|
|
@@ -22898,30 +22894,28 @@ var getterFor = function (TYPE) {
|
|
|
22898
22894
|
};
|
|
22899
22895
|
};
|
|
22900
22896
|
|
|
22901
|
-
if (
|
|
22897
|
+
if (nativeWeakMap || sharedStore.state) {
|
|
22902
22898
|
var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$2());
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22906
|
-
store$1.set = store$1.set;
|
|
22907
|
-
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
22899
|
+
var wmget = functionUncurryThis(store$1.get);
|
|
22900
|
+
var wmhas = functionUncurryThis(store$1.has);
|
|
22901
|
+
var wmset = functionUncurryThis(store$1.set);
|
|
22908
22902
|
set = function (it, metadata) {
|
|
22909
|
-
if (store$1
|
|
22903
|
+
if (wmhas(store$1, it)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22910
22904
|
metadata.facade = it;
|
|
22911
|
-
store$1
|
|
22905
|
+
wmset(store$1, it, metadata);
|
|
22912
22906
|
return metadata;
|
|
22913
22907
|
};
|
|
22914
22908
|
get = function (it) {
|
|
22915
|
-
return store$1
|
|
22909
|
+
return wmget(store$1, it) || {};
|
|
22916
22910
|
};
|
|
22917
22911
|
has = function (it) {
|
|
22918
|
-
return store$1
|
|
22912
|
+
return wmhas(store$1, it);
|
|
22919
22913
|
};
|
|
22920
22914
|
} else {
|
|
22921
22915
|
var STATE = sharedKey('state');
|
|
22922
22916
|
hiddenKeys[STATE] = true;
|
|
22923
22917
|
set = function (it, metadata) {
|
|
22924
|
-
if (hasOwnProperty_1(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22918
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
22925
22919
|
metadata.facade = it;
|
|
22926
22920
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
22927
22921
|
return metadata;
|
|
@@ -22949,12 +22943,8 @@ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
|
22949
22943
|
|
|
22950
22944
|
var enforceInternalState = internalState.enforce;
|
|
22951
22945
|
var getInternalState = internalState.get;
|
|
22952
|
-
|
|
22953
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
22946
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
22954
22947
|
var defineProperty = Object.defineProperty;
|
|
22955
|
-
var stringSlice = functionUncurryThis(''.slice);
|
|
22956
|
-
var replace = functionUncurryThis(''.replace);
|
|
22957
|
-
var join = functionUncurryThis([].join);
|
|
22958
22948
|
|
|
22959
22949
|
var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
22960
22950
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
@@ -22963,8 +22953,8 @@ var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
|
|
|
22963
22953
|
var TEMPLATE = String(String).split('String');
|
|
22964
22954
|
|
|
22965
22955
|
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
22966
|
-
if (
|
|
22967
|
-
name = '[' +
|
|
22956
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
22957
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
22968
22958
|
}
|
|
22969
22959
|
if (options && options.getter) name = 'get ' + name;
|
|
22970
22960
|
if (options && options.setter) name = 'set ' + name;
|
|
@@ -22983,7 +22973,7 @@ var makeBuiltIn = module.exports = function (value, name, options) {
|
|
|
22983
22973
|
} catch (error) { /* empty */ }
|
|
22984
22974
|
var state = enforceInternalState(value);
|
|
22985
22975
|
if (!hasOwnProperty_1(state, 'source')) {
|
|
22986
|
-
state.source = join(
|
|
22976
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
22987
22977
|
} return value;
|
|
22988
22978
|
};
|
|
22989
22979
|
|
|
@@ -23022,7 +23012,7 @@ var floor = Math.floor;
|
|
|
23022
23012
|
|
|
23023
23013
|
// `Math.trunc` method
|
|
23024
23014
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
23025
|
-
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
23015
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
23026
23016
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
23027
23017
|
var n = +x;
|
|
23028
23018
|
return (n > 0 ? floor : ceil)(n);
|
|
@@ -23123,7 +23113,7 @@ var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
|
|
23123
23113
|
|
|
23124
23114
|
// `Object.getOwnPropertyNames` method
|
|
23125
23115
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
23126
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
23116
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
23127
23117
|
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
23128
23118
|
return objectKeysInternal(O, hiddenKeys$1);
|
|
23129
23119
|
};
|
|
@@ -23132,7 +23122,7 @@ var objectGetOwnPropertyNames = {
|
|
|
23132
23122
|
f: f$3
|
|
23133
23123
|
};
|
|
23134
23124
|
|
|
23135
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
23125
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
23136
23126
|
var f$4 = Object.getOwnPropertySymbols;
|
|
23137
23127
|
|
|
23138
23128
|
var objectGetOwnPropertySymbols = {
|
|
@@ -23276,7 +23266,7 @@ var toString_1 = function (argument) {
|
|
|
23276
23266
|
var charAt = functionUncurryThis(''.charAt);
|
|
23277
23267
|
|
|
23278
23268
|
var FORCED = fails(function () {
|
|
23279
|
-
// eslint-disable-next-line es/no-array-string-prototype-at -- safe
|
|
23269
|
+
// eslint-disable-next-line es-x/no-array-string-prototype-at -- safe
|
|
23280
23270
|
return '𠮷'.at(-2) !== '\uD842';
|
|
23281
23271
|
});
|
|
23282
23272
|
|
|
@@ -23294,14 +23284,14 @@ _export({ target: 'String', proto: true, forced: FORCED }, {
|
|
|
23294
23284
|
|
|
23295
23285
|
// `Object.keys` method
|
|
23296
23286
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
23297
|
-
// eslint-disable-next-line es/no-object-keys -- safe
|
|
23287
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
23298
23288
|
var objectKeys = Object.keys || function keys(O) {
|
|
23299
23289
|
return objectKeysInternal(O, enumBugKeys);
|
|
23300
23290
|
};
|
|
23301
23291
|
|
|
23302
23292
|
// `Object.defineProperties` method
|
|
23303
23293
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
23304
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
23294
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
23305
23295
|
var f$5 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
23306
23296
|
anObject(O);
|
|
23307
23297
|
var props = toIndexedObject(Properties);
|
|
@@ -23390,7 +23380,7 @@ hiddenKeys[IE_PROTO] = true;
|
|
|
23390
23380
|
|
|
23391
23381
|
// `Object.create` method
|
|
23392
23382
|
// https://tc39.es/ecma262/#sec-object.create
|
|
23393
|
-
// eslint-disable-next-line es/no-object-create -- safe
|
|
23383
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
23394
23384
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
23395
23385
|
var result;
|
|
23396
23386
|
if (O !== null) {
|
|
@@ -23436,19 +23426,13 @@ _export({ target: 'Array', proto: true }, {
|
|
|
23436
23426
|
|
|
23437
23427
|
addToUnscopables('at');
|
|
23438
23428
|
|
|
23439
|
-
// eslint-disable-next-line es/no-typed-arrays -- safe
|
|
23440
|
-
var
|
|
23441
|
-
|
|
23442
|
-
var defineBuiltInAccessor = function (target, name, descriptor) {
|
|
23443
|
-
if (descriptor.get) makeBuiltIn_1(descriptor.get, name, { getter: true });
|
|
23444
|
-
if (descriptor.set) makeBuiltIn_1(descriptor.set, name, { setter: true });
|
|
23445
|
-
return objectDefineProperty.f(target, name, descriptor);
|
|
23446
|
-
};
|
|
23429
|
+
// eslint-disable-next-line es-x/no-typed-arrays -- safe
|
|
23430
|
+
var arrayBufferNative = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
|
|
23447
23431
|
|
|
23448
23432
|
var correctPrototypeGetter = !fails(function () {
|
|
23449
23433
|
function F() { /* empty */ }
|
|
23450
23434
|
F.prototype.constructor = null;
|
|
23451
|
-
// eslint-disable-next-line es/no-object-getprototypeof -- required for testing
|
|
23435
|
+
// eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing
|
|
23452
23436
|
return Object.getPrototypeOf(new F()) !== F.prototype;
|
|
23453
23437
|
});
|
|
23454
23438
|
|
|
@@ -23458,7 +23442,7 @@ var ObjectPrototype = $Object$4.prototype;
|
|
|
23458
23442
|
|
|
23459
23443
|
// `Object.getPrototypeOf` method
|
|
23460
23444
|
// https://tc39.es/ecma262/#sec-object.getprototypeof
|
|
23461
|
-
// eslint-disable-next-line es/no-object-getprototypeof -- safe
|
|
23445
|
+
// eslint-disable-next-line es-x/no-object-getprototypeof -- safe
|
|
23462
23446
|
var objectGetPrototypeOf = correctPrototypeGetter ? $Object$4.getPrototypeOf : function (O) {
|
|
23463
23447
|
var object = toObject(O);
|
|
23464
23448
|
if (hasOwnProperty_1(object, IE_PROTO$1)) return object[IE_PROTO$1];
|
|
@@ -23468,13 +23452,6 @@ var objectGetPrototypeOf = correctPrototypeGetter ? $Object$4.getPrototypeOf : f
|
|
|
23468
23452
|
} return object instanceof $Object$4 ? ObjectPrototype : null;
|
|
23469
23453
|
};
|
|
23470
23454
|
|
|
23471
|
-
var functionUncurryThisAccessor = function (object, key, method) {
|
|
23472
|
-
try {
|
|
23473
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
23474
|
-
return functionUncurryThis(aCallable(Object.getOwnPropertyDescriptor(object, key)[method]));
|
|
23475
|
-
} catch (error) { /* empty */ }
|
|
23476
|
-
};
|
|
23477
|
-
|
|
23478
23455
|
var $String$3 = String;
|
|
23479
23456
|
var $TypeError$6 = TypeError;
|
|
23480
23457
|
|
|
@@ -23491,13 +23468,14 @@ var aPossiblePrototype = function (argument) {
|
|
|
23491
23468
|
// `Object.setPrototypeOf` method
|
|
23492
23469
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
23493
23470
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
23494
|
-
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
23471
|
+
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
23495
23472
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
23496
23473
|
var CORRECT_SETTER = false;
|
|
23497
23474
|
var test = {};
|
|
23498
23475
|
var setter;
|
|
23499
23476
|
try {
|
|
23500
|
-
|
|
23477
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
23478
|
+
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
23501
23479
|
setter(test, []);
|
|
23502
23480
|
CORRECT_SETTER = test instanceof Array;
|
|
23503
23481
|
} catch (error) { /* empty */ }
|
|
@@ -23510,6 +23488,14 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
23510
23488
|
};
|
|
23511
23489
|
}() : undefined);
|
|
23512
23490
|
|
|
23491
|
+
var defineProperty$2 = objectDefineProperty.f;
|
|
23492
|
+
|
|
23493
|
+
|
|
23494
|
+
|
|
23495
|
+
|
|
23496
|
+
|
|
23497
|
+
|
|
23498
|
+
|
|
23513
23499
|
var enforceInternalState = internalState.enforce;
|
|
23514
23500
|
var getInternalState = internalState.get;
|
|
23515
23501
|
var Int8Array = global_1.Int8Array;
|
|
@@ -23525,7 +23511,7 @@ var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
|
23525
23511
|
var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
|
|
23526
23512
|
var TYPED_ARRAY_CONSTRUCTOR = 'TypedArrayConstructor';
|
|
23527
23513
|
// Fixing native typed arrays in Opera Presto crashes the browser, see #595
|
|
23528
|
-
var NATIVE_ARRAY_BUFFER_VIEWS =
|
|
23514
|
+
var NATIVE_ARRAY_BUFFER_VIEWS = arrayBufferNative && !!objectSetPrototypeOf && classof(global_1.opera) !== 'Opera';
|
|
23529
23515
|
var TYPED_ARRAY_TAG_REQUIRED = false;
|
|
23530
23516
|
var NAME, Constructor, Prototype;
|
|
23531
23517
|
|
|
@@ -23660,12 +23646,9 @@ if (NATIVE_ARRAY_BUFFER_VIEWS && objectGetPrototypeOf(Uint8ClampedArrayPrototype
|
|
|
23660
23646
|
|
|
23661
23647
|
if (descriptors && !hasOwnProperty_1(TypedArrayPrototype, TO_STRING_TAG$2)) {
|
|
23662
23648
|
TYPED_ARRAY_TAG_REQUIRED = true;
|
|
23663
|
-
|
|
23664
|
-
|
|
23665
|
-
|
|
23666
|
-
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
|
23667
|
-
}
|
|
23668
|
-
});
|
|
23649
|
+
defineProperty$2(TypedArrayPrototype, TO_STRING_TAG$2, { get: function () {
|
|
23650
|
+
return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
|
|
23651
|
+
} });
|
|
23669
23652
|
for (NAME in TypedArrayConstructorsList) if (global_1[NAME]) {
|
|
23670
23653
|
createNonEnumerableProperty(global_1[NAME], TYPED_ARRAY_TAG, NAME);
|
|
23671
23654
|
}
|
|
@@ -38612,44 +38595,52 @@ var TableHeading_styled = styled__default.th.withConfig({
|
|
|
38612
38595
|
return extraStyles;
|
|
38613
38596
|
});
|
|
38614
38597
|
|
|
38615
|
-
const validatorToPredicate =
|
|
38616
|
-
|
|
38617
|
-
...rest
|
|
38618
|
-
|
|
38598
|
+
const validatorToPredicate =
|
|
38599
|
+
(validatorFn, emptyCase) =>
|
|
38600
|
+
(value, ...rest) =>
|
|
38601
|
+
value === '' ? emptyCase : validatorFn(value, ...rest);
|
|
38619
38602
|
|
|
38620
38603
|
var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
38621
38604
|
|
|
38605
|
+
function getDefaultExportFromCjs (x) {
|
|
38606
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
38607
|
+
}
|
|
38608
|
+
|
|
38622
38609
|
var dayjs_min = {exports: {}};
|
|
38623
38610
|
|
|
38624
38611
|
(function (module, exports) {
|
|
38625
|
-
!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"
|
|
38626
|
-
}(dayjs_min));
|
|
38612
|
+
!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}));
|
|
38613
|
+
} (dayjs_min));
|
|
38627
38614
|
|
|
38628
|
-
var
|
|
38615
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
38616
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
38629
38617
|
|
|
38630
38618
|
var customParseFormat$1 = {exports: {}};
|
|
38631
38619
|
|
|
38632
38620
|
(function (module, exports) {
|
|
38633
|
-
!function(t
|
|
38634
|
-
}(customParseFormat$1));
|
|
38621
|
+
!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);};}}));
|
|
38622
|
+
} (customParseFormat$1));
|
|
38635
38623
|
|
|
38636
|
-
var
|
|
38624
|
+
var customParseFormatExports = customParseFormat$1.exports;
|
|
38625
|
+
var customParseFormat = /*@__PURE__*/getDefaultExportFromCjs(customParseFormatExports);
|
|
38637
38626
|
|
|
38638
38627
|
var isSameOrBefore$1 = {exports: {}};
|
|
38639
38628
|
|
|
38640
38629
|
(function (module, exports) {
|
|
38641
|
-
!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)};}}));
|
|
38642
|
-
}(isSameOrBefore$1));
|
|
38630
|
+
!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)};}}));
|
|
38631
|
+
} (isSameOrBefore$1));
|
|
38643
38632
|
|
|
38644
|
-
var
|
|
38633
|
+
var isSameOrBeforeExports = isSameOrBefore$1.exports;
|
|
38634
|
+
var isSameOrBefore = /*@__PURE__*/getDefaultExportFromCjs(isSameOrBeforeExports);
|
|
38645
38635
|
|
|
38646
38636
|
var isSameOrAfter$1 = {exports: {}};
|
|
38647
38637
|
|
|
38648
38638
|
(function (module, exports) {
|
|
38649
|
-
!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)};}}));
|
|
38650
|
-
}(isSameOrAfter$1));
|
|
38639
|
+
!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)};}}));
|
|
38640
|
+
} (isSameOrAfter$1));
|
|
38651
38641
|
|
|
38652
|
-
var
|
|
38642
|
+
var isSameOrAfterExports = isSameOrAfter$1.exports;
|
|
38643
|
+
var isSameOrAfter = /*@__PURE__*/getDefaultExportFromCjs(isSameOrAfterExports);
|
|
38653
38644
|
|
|
38654
38645
|
/* eslint-disable no-unused-vars */
|
|
38655
38646
|
|
|
@@ -38665,24 +38656,24 @@ dayjs.extend(isSameOrAfter);
|
|
|
38665
38656
|
|
|
38666
38657
|
let validatorFns = {};
|
|
38667
38658
|
|
|
38668
|
-
const INCLUDED_IN =
|
|
38669
|
-
const INCLUDED_IN_ERROR =
|
|
38659
|
+
const INCLUDED_IN = 'validator/INCLUDED_IN';
|
|
38660
|
+
const INCLUDED_IN_ERROR = 'error/INCLUDED_IN';
|
|
38670
38661
|
const includedIn = createValidator(INCLUDED_IN, INCLUDED_IN_ERROR);
|
|
38671
38662
|
validatorFns[INCLUDED_IN] = (value, args, form) =>
|
|
38672
38663
|
Array.isArray(args[0]) ? args[0].includes(value) : args[0] === value;
|
|
38673
38664
|
|
|
38674
|
-
const REQUIRED =
|
|
38675
|
-
const REQUIRED_ERROR =
|
|
38665
|
+
const REQUIRED = 'validator/REQUIRED';
|
|
38666
|
+
const REQUIRED_ERROR = 'error/REQUIRED';
|
|
38676
38667
|
const required = createValidator(REQUIRED, REQUIRED_ERROR);
|
|
38677
|
-
validatorFns[REQUIRED] = (value, args, form) => value !==
|
|
38668
|
+
validatorFns[REQUIRED] = (value, args, form) => value !== '';
|
|
38678
38669
|
|
|
38679
|
-
const ONLY_INTEGERS =
|
|
38680
|
-
const ONLY_INTEGERS_ERROR =
|
|
38670
|
+
const ONLY_INTEGERS = 'validator/ONLY_INTEGERS';
|
|
38671
|
+
const ONLY_INTEGERS_ERROR = 'error/ONLY_INTEGERS';
|
|
38681
38672
|
const onlyIntegers = createValidator(ONLY_INTEGERS, ONLY_INTEGERS_ERROR);
|
|
38682
38673
|
validatorFns[ONLY_INTEGERS] = (value, args, form) => /^(-?\d+)?$/.test(value);
|
|
38683
38674
|
|
|
38684
|
-
const ONLY_NATURALS =
|
|
38685
|
-
const ONLY_NATURALS_ERROR =
|
|
38675
|
+
const ONLY_NATURALS = 'validator/ONLY_NATURALS';
|
|
38676
|
+
const ONLY_NATURALS_ERROR = 'error/ONLY_NATURALS';
|
|
38686
38677
|
const onlyNaturals = createValidator(ONLY_NATURALS, ONLY_NATURALS_ERROR);
|
|
38687
38678
|
validatorFns[ONLY_NATURALS] = (value, args, form) => /^(\d+)?$/.test(value);
|
|
38688
38679
|
|
|
@@ -38695,8 +38686,8 @@ not tested as validation function
|
|
|
38695
38686
|
to validate exp date instead use combo of:
|
|
38696
38687
|
required(), hasLength(), isValidMonth(), dateAfterToday()
|
|
38697
38688
|
*/
|
|
38698
|
-
const ONLY_EXPIRATION_DATE =
|
|
38699
|
-
const ONLY_EXPIRATION_DATE_ERROR =
|
|
38689
|
+
const ONLY_EXPIRATION_DATE = 'validator/ONLY_EXPIRATION_DATE';
|
|
38690
|
+
const ONLY_EXPIRATION_DATE_ERROR = 'error/ONLY_EXPIRATION_DATE';
|
|
38700
38691
|
const onlyExpirationDate = createValidator(
|
|
38701
38692
|
ONLY_EXPIRATION_DATE,
|
|
38702
38693
|
ONLY_EXPIRATION_DATE_ERROR
|
|
@@ -38704,64 +38695,63 @@ const onlyExpirationDate = createValidator(
|
|
|
38704
38695
|
validatorFns[ONLY_EXPIRATION_DATE] = (value, args, form) =>
|
|
38705
38696
|
/^(\d?\d?\/?\d?\d?)?$/.test(value);
|
|
38706
38697
|
|
|
38707
|
-
const NUMBER_LESS_THAN =
|
|
38708
|
-
const NUMBER_LESS_THAN_ERROR =
|
|
38698
|
+
const NUMBER_LESS_THAN = 'validator/NUMBER_LESS_THAN';
|
|
38699
|
+
const NUMBER_LESS_THAN_ERROR = 'error/NUMBER_LESS_THAN';
|
|
38709
38700
|
const numberLessThan = createValidator(
|
|
38710
38701
|
NUMBER_LESS_THAN,
|
|
38711
38702
|
NUMBER_LESS_THAN_ERROR
|
|
38712
38703
|
);
|
|
38713
38704
|
validatorFns[NUMBER_LESS_THAN] = (value, args, form) => {
|
|
38714
|
-
if (value ===
|
|
38705
|
+
if (value === '') {
|
|
38715
38706
|
return true;
|
|
38716
38707
|
}
|
|
38717
38708
|
return Number(value) < args[0];
|
|
38718
38709
|
};
|
|
38719
38710
|
|
|
38720
|
-
const NUMBER_LESS_THAN_OR_EQUAL_TO =
|
|
38721
|
-
"validator/NUMBER_LESS_THAN_OR_EQUAL_TO";
|
|
38711
|
+
const NUMBER_LESS_THAN_OR_EQUAL_TO = 'validator/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38722
38712
|
const NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR =
|
|
38723
|
-
|
|
38713
|
+
'error/NUMBER_LESS_THAN_OR_EQUAL_TO';
|
|
38724
38714
|
const numberLessThanOrEqualTo = createValidator(
|
|
38725
38715
|
NUMBER_LESS_THAN_OR_EQUAL_TO,
|
|
38726
38716
|
NUMBER_LESS_THAN_OR_EQUAL_TO_ERROR
|
|
38727
38717
|
);
|
|
38728
38718
|
validatorFns[NUMBER_LESS_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38729
|
-
if (value ===
|
|
38719
|
+
if (value === '') {
|
|
38730
38720
|
return true;
|
|
38731
38721
|
}
|
|
38732
38722
|
return Number(value) <= args[0];
|
|
38733
38723
|
};
|
|
38734
38724
|
|
|
38735
|
-
const NUMBER_GREATER_THAN =
|
|
38736
|
-
const NUMBER_GREATER_THAN_ERROR =
|
|
38725
|
+
const NUMBER_GREATER_THAN = 'validator/NUMBER_GREATER_THAN';
|
|
38726
|
+
const NUMBER_GREATER_THAN_ERROR = 'error/NUMBER_GREATER_THAN';
|
|
38737
38727
|
const numberGreaterThan = createValidator(
|
|
38738
38728
|
NUMBER_GREATER_THAN,
|
|
38739
38729
|
NUMBER_GREATER_THAN_ERROR
|
|
38740
38730
|
);
|
|
38741
38731
|
validatorFns[NUMBER_GREATER_THAN] = (value, args, form) => {
|
|
38742
|
-
if (value ===
|
|
38732
|
+
if (value === '') {
|
|
38743
38733
|
return true;
|
|
38744
38734
|
}
|
|
38745
38735
|
return Number(value) > args[0];
|
|
38746
38736
|
};
|
|
38747
38737
|
|
|
38748
38738
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO =
|
|
38749
|
-
|
|
38739
|
+
'validator/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38750
38740
|
const NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR =
|
|
38751
|
-
|
|
38741
|
+
'error/NUMBER_GREATER_THAN_OR_EQUAL_TO';
|
|
38752
38742
|
const numberGreaterThanOrEqualTo = createValidator(
|
|
38753
38743
|
NUMBER_GREATER_THAN_OR_EQUAL_TO,
|
|
38754
38744
|
NUMBER_GREATER_THAN_OR_EQUAL_TO_ERROR
|
|
38755
38745
|
);
|
|
38756
38746
|
validatorFns[NUMBER_GREATER_THAN_OR_EQUAL_TO] = (value, args, form) => {
|
|
38757
|
-
if (value ===
|
|
38747
|
+
if (value === '') {
|
|
38758
38748
|
return true;
|
|
38759
38749
|
}
|
|
38760
38750
|
return Number(value) >= args[0];
|
|
38761
38751
|
};
|
|
38762
38752
|
|
|
38763
|
-
const MATCHES_FIELD =
|
|
38764
|
-
const MATCHES_FIELD_ERROR$1 =
|
|
38753
|
+
const MATCHES_FIELD = 'validator/MATCHES_FIELD';
|
|
38754
|
+
const MATCHES_FIELD_ERROR$1 = 'error/MATCHES_FIELD';
|
|
38765
38755
|
const matchesField = createValidator(MATCHES_FIELD, MATCHES_FIELD_ERROR$1);
|
|
38766
38756
|
validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
38767
38757
|
const dependentField = form[args[0]];
|
|
@@ -38774,7 +38764,7 @@ validatorFns[MATCHES_FIELD] = (value, args, form) => {
|
|
|
38774
38764
|
return value === dependentFieldValue;
|
|
38775
38765
|
};
|
|
38776
38766
|
|
|
38777
|
-
const validateWhenErrorMessage = type =>
|
|
38767
|
+
const validateWhenErrorMessage = (type) =>
|
|
38778
38768
|
`${type} was passed to validateWhen, but that validator type does not exist.
|
|
38779
38769
|
Please check that you are only calling validator creator functions exported from
|
|
38780
38770
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -38782,25 +38772,21 @@ const validateWhenErrorMessage = type =>
|
|
|
38782
38772
|
createFormState). Also make sure you aren't passing validateWhen() to validateWhen
|
|
38783
38773
|
as the primary validator.`;
|
|
38784
38774
|
|
|
38785
|
-
const VALIDATE_WHEN =
|
|
38786
|
-
const VALIDATE_WHEN_ERROR =
|
|
38787
|
-
const validateWhen = (
|
|
38788
|
-
dependentValidator,
|
|
38789
|
-
primaryValidator,
|
|
38790
|
-
optionalFieldName
|
|
38791
|
-
) => ({
|
|
38775
|
+
const VALIDATE_WHEN = 'validator/VALIDATE_WHEN';
|
|
38776
|
+
const VALIDATE_WHEN_ERROR = 'error/VALIDATE_WHEN';
|
|
38777
|
+
const validateWhen = (dependentValidator, primaryValidator, optionalFieldName) => ({
|
|
38792
38778
|
type: VALIDATE_WHEN,
|
|
38793
38779
|
args: [dependentValidator, primaryValidator, optionalFieldName],
|
|
38794
|
-
error: dependentValidator.error
|
|
38780
|
+
error: dependentValidator.error,
|
|
38795
38781
|
});
|
|
38796
38782
|
validateWhen.error = VALIDATE_WHEN_ERROR;
|
|
38797
38783
|
validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
38798
38784
|
const [dependentValidator, primaryValidator, optionalFieldName] = args;
|
|
38799
|
-
const dependsOnOtherField = typeof optionalFieldName ===
|
|
38785
|
+
const dependsOnOtherField = typeof optionalFieldName === 'string';
|
|
38800
38786
|
|
|
38801
38787
|
if (
|
|
38802
38788
|
primaryValidator.type === undefined ||
|
|
38803
|
-
typeof validatorFns[primaryValidator.type] !==
|
|
38789
|
+
typeof validatorFns[primaryValidator.type] !== 'function'
|
|
38804
38790
|
) {
|
|
38805
38791
|
throw new Error(validateWhenErrorMessage(primaryValidator.type));
|
|
38806
38792
|
}
|
|
@@ -38824,26 +38810,22 @@ validatorFns[VALIDATE_WHEN] = (value, args, form) => {
|
|
|
38824
38810
|
);
|
|
38825
38811
|
|
|
38826
38812
|
return primaryPredicatePassed
|
|
38827
|
-
? validatorFns[dependentValidator.type](
|
|
38828
|
-
value,
|
|
38829
|
-
dependentValidator.args,
|
|
38830
|
-
form
|
|
38831
|
-
)
|
|
38813
|
+
? validatorFns[dependentValidator.type](value, dependentValidator.args, form)
|
|
38832
38814
|
: true;
|
|
38833
38815
|
};
|
|
38834
38816
|
|
|
38835
|
-
const validateSumErrorMessage = type =>
|
|
38817
|
+
const validateSumErrorMessage = (type) =>
|
|
38836
38818
|
`${type} was passed to validateSum, but that validator type does not exist.
|
|
38837
38819
|
Please check that you are only calling validator creator functions exported from
|
|
38838
38820
|
redux-freeform in your form config and that you didn't forget to
|
|
38839
38821
|
invoke the validator creator (you cannot pass the functions themselves to
|
|
38840
38822
|
createFormState).`;
|
|
38841
|
-
const VALIDATE_SUM =
|
|
38842
|
-
const VALIDATE_SUM_ERROR =
|
|
38823
|
+
const VALIDATE_SUM = 'validator/VALIDATE_SUM';
|
|
38824
|
+
const VALIDATE_SUM_ERROR = 'error/VALIDATE_SUM';
|
|
38843
38825
|
const validateSum = (validator, fieldNamesArray) => ({
|
|
38844
38826
|
type: VALIDATE_SUM,
|
|
38845
38827
|
args: [validator, fieldNamesArray],
|
|
38846
|
-
error: validator.error
|
|
38828
|
+
error: validator.error,
|
|
38847
38829
|
});
|
|
38848
38830
|
validateSum.error = VALIDATE_SUM_ERROR;
|
|
38849
38831
|
validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
@@ -38851,7 +38833,7 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38851
38833
|
|
|
38852
38834
|
if (
|
|
38853
38835
|
validator.type === undefined ||
|
|
38854
|
-
typeof validatorFns[validator.type] !==
|
|
38836
|
+
typeof validatorFns[validator.type] !== 'function'
|
|
38855
38837
|
) {
|
|
38856
38838
|
throw new Error(validateSumErrorMessage(validator.type));
|
|
38857
38839
|
}
|
|
@@ -38872,37 +38854,35 @@ validatorFns[VALIDATE_SUM] = (value, args, form) => {
|
|
|
38872
38854
|
return validatorFns[validator.type](sum, validator.args, form);
|
|
38873
38855
|
};
|
|
38874
38856
|
|
|
38875
|
-
const HAS_LENGTH =
|
|
38876
|
-
const HAS_LENGTH_ERROR =
|
|
38857
|
+
const HAS_LENGTH = 'validator/HAS_LENGTH';
|
|
38858
|
+
const HAS_LENGTH_ERROR = 'error/HAS_LENGTH';
|
|
38877
38859
|
const hasLength = createValidator(HAS_LENGTH, HAS_LENGTH_ERROR);
|
|
38878
38860
|
validatorFns[HAS_LENGTH] = (value, args, form) => {
|
|
38879
|
-
if (value ===
|
|
38861
|
+
if (value === '') {
|
|
38880
38862
|
return true;
|
|
38881
38863
|
}
|
|
38882
38864
|
const min = args[0];
|
|
38883
38865
|
const max = args[1];
|
|
38884
38866
|
if (max == undefined || min == undefined) {
|
|
38885
38867
|
throw new Error(
|
|
38886
|
-
|
|
38868
|
+
'Max and min need to be defined for hasLength, both or one of them is undefined'
|
|
38887
38869
|
);
|
|
38888
38870
|
}
|
|
38889
38871
|
if (max < min) {
|
|
38890
|
-
throw new Error(
|
|
38891
|
-
"hasLength validator was passed a min greater than the max"
|
|
38892
|
-
);
|
|
38872
|
+
throw new Error('hasLength validator was passed a min greater than the max');
|
|
38893
38873
|
}
|
|
38894
38874
|
const valueLength = value.length;
|
|
38895
38875
|
return max >= valueLength && valueLength >= min;
|
|
38896
38876
|
};
|
|
38897
38877
|
|
|
38898
|
-
const DATE_BEFORE_TODAY =
|
|
38899
|
-
const DATE_BEFORE_TODAY_ERROR =
|
|
38878
|
+
const DATE_BEFORE_TODAY = 'validator/DATE_BEFORE_TODAY';
|
|
38879
|
+
const DATE_BEFORE_TODAY_ERROR = 'error/DATE_BEFORE_TODAY';
|
|
38900
38880
|
const dateBeforeToday = createValidator(
|
|
38901
38881
|
DATE_BEFORE_TODAY,
|
|
38902
38882
|
DATE_BEFORE_TODAY_ERROR
|
|
38903
38883
|
);
|
|
38904
38884
|
validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
38905
|
-
if (value ===
|
|
38885
|
+
if (value === '') {
|
|
38906
38886
|
return true;
|
|
38907
38887
|
}
|
|
38908
38888
|
const dateFormat = args[0];
|
|
@@ -38911,7 +38891,7 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38911
38891
|
|
|
38912
38892
|
if (dateFormat == undefined || unit == undefined) {
|
|
38913
38893
|
throw new Error(
|
|
38914
|
-
|
|
38894
|
+
'Date format and unit need to be defined for dateBeforeToday, one or both are undefined'
|
|
38915
38895
|
);
|
|
38916
38896
|
}
|
|
38917
38897
|
const now = dayjs();
|
|
@@ -38923,14 +38903,14 @@ validatorFns[DATE_BEFORE_TODAY] = (value, args, form) => {
|
|
|
38923
38903
|
return dateValue.isBefore(now, unit);
|
|
38924
38904
|
};
|
|
38925
38905
|
|
|
38926
|
-
const DATE_AFTER_TODAY =
|
|
38927
|
-
const DATE_AFTER_TODAY_ERROR =
|
|
38906
|
+
const DATE_AFTER_TODAY = 'validator/DATE_AFTER_TODAY';
|
|
38907
|
+
const DATE_AFTER_TODAY_ERROR = 'error/DATE_AFTER_TODAY';
|
|
38928
38908
|
const dateAfterToday = createValidator(
|
|
38929
38909
|
DATE_AFTER_TODAY,
|
|
38930
38910
|
DATE_AFTER_TODAY_ERROR
|
|
38931
38911
|
);
|
|
38932
38912
|
validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
38933
|
-
if (value ===
|
|
38913
|
+
if (value === '') {
|
|
38934
38914
|
return true;
|
|
38935
38915
|
}
|
|
38936
38916
|
const dateFormat = args[0];
|
|
@@ -38939,7 +38919,7 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38939
38919
|
|
|
38940
38920
|
if (dateFormat == undefined || unit == undefined) {
|
|
38941
38921
|
throw new Error(
|
|
38942
|
-
|
|
38922
|
+
'Date format and unit need to be defined for dateAfterToday, one or both are undefined'
|
|
38943
38923
|
);
|
|
38944
38924
|
}
|
|
38945
38925
|
const now = dayjs();
|
|
@@ -38951,14 +38931,11 @@ validatorFns[DATE_AFTER_TODAY] = (value, args, form) => {
|
|
|
38951
38931
|
return dateValue.isAfter(now, unit);
|
|
38952
38932
|
};
|
|
38953
38933
|
|
|
38954
|
-
const IS_VALID_MONTH =
|
|
38955
|
-
const IS_VALID_MONTH_ERROR =
|
|
38956
|
-
const isValidMonth = createValidator(
|
|
38957
|
-
IS_VALID_MONTH,
|
|
38958
|
-
IS_VALID_MONTH_ERROR
|
|
38959
|
-
);
|
|
38934
|
+
const IS_VALID_MONTH = 'validator/IS_VALID_MONTH';
|
|
38935
|
+
const IS_VALID_MONTH_ERROR = 'error/IS_VALID_MONTH';
|
|
38936
|
+
const isValidMonth = createValidator(IS_VALID_MONTH, IS_VALID_MONTH_ERROR);
|
|
38960
38937
|
validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
38961
|
-
if (value ===
|
|
38938
|
+
if (value === '') {
|
|
38962
38939
|
return true;
|
|
38963
38940
|
}
|
|
38964
38941
|
// Function takes one argument representing the character position
|
|
@@ -38968,43 +38945,43 @@ validatorFns[IS_VALID_MONTH] = (value, args, form) => {
|
|
|
38968
38945
|
// Only works with two digit months (01, 02, 03, etc)
|
|
38969
38946
|
const monthStartPosition = parseInt(args[0]);
|
|
38970
38947
|
const monthEndPosition = monthStartPosition + 2;
|
|
38971
|
-
if (monthStartPosition
|
|
38972
|
-
throw new Error(
|
|
38948
|
+
if (isNaN(monthStartPosition)) {
|
|
38949
|
+
throw new Error('Month start position has to be a valid integer string');
|
|
38973
38950
|
}
|
|
38974
38951
|
const month = parseInt(value.slice(monthStartPosition, monthEndPosition));
|
|
38975
|
-
if (month
|
|
38952
|
+
if (isNaN(month)) {
|
|
38976
38953
|
return false;
|
|
38977
38954
|
}
|
|
38978
38955
|
return month >= 1 && month <= 12;
|
|
38979
38956
|
};
|
|
38980
38957
|
|
|
38981
|
-
const MATCHES_REGEX =
|
|
38982
|
-
const MATCHES_REGEX_ERROR =
|
|
38958
|
+
const MATCHES_REGEX = 'validator/MATCHES_REGEX';
|
|
38959
|
+
const MATCHES_REGEX_ERROR = 'error/MATCHES_REGEX';
|
|
38983
38960
|
const matchesRegex = createValidator(MATCHES_REGEX, MATCHES_REGEX_ERROR);
|
|
38984
38961
|
validatorFns[MATCHES_REGEX] = (value, args, form) => {
|
|
38985
|
-
if (value ===
|
|
38962
|
+
if (value === '') {
|
|
38986
38963
|
return true;
|
|
38987
38964
|
}
|
|
38988
38965
|
return new RegExp(args[0]).test(value); // new RexExp never throws an error, no matter the input
|
|
38989
38966
|
};
|
|
38990
38967
|
|
|
38991
38968
|
// based on http://www.brainjar.com/js/validation/
|
|
38992
|
-
const IS_ROUTING_NUMBER =
|
|
38993
|
-
const IS_ROUTING_NUMBER_ERROR =
|
|
38969
|
+
const IS_ROUTING_NUMBER = 'validator/IS_ROUTING_NUMBER';
|
|
38970
|
+
const IS_ROUTING_NUMBER_ERROR = 'error/IS_ROUTING_NUMBER';
|
|
38994
38971
|
const isRoutingNumber = createValidator(
|
|
38995
38972
|
IS_ROUTING_NUMBER,
|
|
38996
38973
|
IS_ROUTING_NUMBER_ERROR
|
|
38997
38974
|
);
|
|
38998
38975
|
validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
38999
|
-
if (value ===
|
|
38976
|
+
if (value === '') {
|
|
39000
38977
|
return true;
|
|
39001
38978
|
}
|
|
39002
38979
|
if (value.length != 9) {
|
|
39003
38980
|
return false;
|
|
39004
38981
|
}
|
|
39005
38982
|
const sum = value
|
|
39006
|
-
.split(
|
|
39007
|
-
.map(ch => parseInt(ch))
|
|
38983
|
+
.split('')
|
|
38984
|
+
.map((ch) => parseInt(ch))
|
|
39008
38985
|
.reduce((acc, cur, idx) => {
|
|
39009
38986
|
switch (idx % 3) {
|
|
39010
38987
|
case 0:
|
|
@@ -39018,69 +38995,69 @@ validatorFns[IS_ROUTING_NUMBER] = (value, args, form) => {
|
|
|
39018
38995
|
return sum != 0 && sum % 10 == 0;
|
|
39019
38996
|
};
|
|
39020
38997
|
|
|
39021
|
-
const HAS_NUMBER =
|
|
39022
|
-
const HAS_NUMBER_ERROR$1 =
|
|
38998
|
+
const HAS_NUMBER = 'validator/HAS_NUMBER';
|
|
38999
|
+
const HAS_NUMBER_ERROR$1 = 'error/HAS_NUMBER';
|
|
39023
39000
|
const hasNumber = createValidator(HAS_NUMBER, HAS_NUMBER_ERROR$1);
|
|
39024
39001
|
validatorFns[HAS_NUMBER] = (value, args, form) => {
|
|
39025
|
-
if (value ===
|
|
39002
|
+
if (value === '') {
|
|
39026
39003
|
return true;
|
|
39027
39004
|
}
|
|
39028
39005
|
return new RegExp(/[0-9]/).test(value);
|
|
39029
39006
|
};
|
|
39030
39007
|
|
|
39031
|
-
const HAS_LOWERCASE_LETTER =
|
|
39032
|
-
const HAS_LOWERCASE_LETTER_ERROR$1 =
|
|
39008
|
+
const HAS_LOWERCASE_LETTER = 'validator/HAS_LOWERCASE_LETTER';
|
|
39009
|
+
const HAS_LOWERCASE_LETTER_ERROR$1 = 'error/HAS_LOWERCASE_LETTER';
|
|
39033
39010
|
const hasLowercaseLetter = createValidator(
|
|
39034
39011
|
HAS_LOWERCASE_LETTER,
|
|
39035
39012
|
HAS_LOWERCASE_LETTER_ERROR$1
|
|
39036
39013
|
);
|
|
39037
39014
|
validatorFns[HAS_LOWERCASE_LETTER] = (value, args, form) => {
|
|
39038
|
-
if (value ===
|
|
39015
|
+
if (value === '') {
|
|
39039
39016
|
return true;
|
|
39040
39017
|
}
|
|
39041
39018
|
return new RegExp(/[a-z]/).test(value);
|
|
39042
39019
|
};
|
|
39043
39020
|
|
|
39044
|
-
const HAS_UPPERCASE_LETTER =
|
|
39045
|
-
const HAS_UPPERCASE_LETTER_ERROR$1 =
|
|
39021
|
+
const HAS_UPPERCASE_LETTER = 'validator/HAS_UPPERCASE_LETTER';
|
|
39022
|
+
const HAS_UPPERCASE_LETTER_ERROR$1 = 'error/HAS_UPPERCASE_LETTER';
|
|
39046
39023
|
const hasUppercaseLetter = createValidator(
|
|
39047
39024
|
HAS_UPPERCASE_LETTER,
|
|
39048
39025
|
HAS_UPPERCASE_LETTER_ERROR$1
|
|
39049
39026
|
);
|
|
39050
39027
|
validatorFns[HAS_UPPERCASE_LETTER] = (value, args, form) => {
|
|
39051
|
-
if (value ===
|
|
39028
|
+
if (value === '') {
|
|
39052
39029
|
return true;
|
|
39053
39030
|
}
|
|
39054
39031
|
return new RegExp(/[A-Z]/).test(value);
|
|
39055
39032
|
};
|
|
39056
39033
|
|
|
39057
|
-
const HAS_SPECIAL_CHARACTER =
|
|
39058
|
-
const HAS_SPECIAL_CHARACTER_ERROR$1 =
|
|
39034
|
+
const HAS_SPECIAL_CHARACTER = 'validator/HAS_SPECIAL_CHARACTER';
|
|
39035
|
+
const HAS_SPECIAL_CHARACTER_ERROR$1 = 'error/HAS_SPECIAL_CHARACTER';
|
|
39059
39036
|
const hasSpecialCharacter = createValidator(
|
|
39060
39037
|
HAS_SPECIAL_CHARACTER,
|
|
39061
39038
|
HAS_SPECIAL_CHARACTER_ERROR$1
|
|
39062
39039
|
);
|
|
39063
39040
|
validatorFns[HAS_SPECIAL_CHARACTER] = (value, args, form) => {
|
|
39064
|
-
if (value ===
|
|
39041
|
+
if (value === '') {
|
|
39065
39042
|
return true;
|
|
39066
39043
|
}
|
|
39067
39044
|
return new RegExp(/[!@#$%^&*.?]/).test(value);
|
|
39068
39045
|
};
|
|
39069
39046
|
|
|
39070
|
-
const IS_PROBABLY_EMAIL =
|
|
39071
|
-
const IS_PROBABLY_EMAIL_ERROR =
|
|
39047
|
+
const IS_PROBABLY_EMAIL = 'validator/IS_PROBABLY_EMAIL';
|
|
39048
|
+
const IS_PROBABLY_EMAIL_ERROR = 'error/IS_PROBABLY_EMAIL';
|
|
39072
39049
|
const isProbablyEmail = createValidator(
|
|
39073
39050
|
IS_PROBABLY_EMAIL,
|
|
39074
39051
|
IS_PROBABLY_EMAIL_ERROR
|
|
39075
39052
|
);
|
|
39076
39053
|
validatorFns[IS_PROBABLY_EMAIL] = (value, args, form) => {
|
|
39077
|
-
if (value ===
|
|
39054
|
+
if (value === '') {
|
|
39078
39055
|
return true;
|
|
39079
39056
|
}
|
|
39080
39057
|
return new RegExp(/^\S+@\S+\.\S+$/).test(value);
|
|
39081
39058
|
};
|
|
39082
39059
|
|
|
39083
|
-
const runValidatorErrorMessage = type =>
|
|
39060
|
+
const runValidatorErrorMessage = (type) =>
|
|
39084
39061
|
`${type} was passed to runValidator, but that validator type does not exist.
|
|
39085
39062
|
Please check that you are only calling validator creator functions exported from
|
|
39086
39063
|
redux-freeform in your form config and that you didn't forget to
|
|
@@ -39095,1165 +39072,53 @@ const runValidator = (validator, value, form) => {
|
|
|
39095
39072
|
return validatorFn(value, validator.args, form) ? null : validator.error;
|
|
39096
39073
|
};
|
|
39097
39074
|
|
|
39098
|
-
const
|
|
39075
|
+
const runFormValidators = (fieldName, form, validators) => {
|
|
39099
39076
|
return validators
|
|
39100
|
-
.map(v => runValidator(v, form[fieldName].rawValue, form))
|
|
39101
|
-
.filter(x => x !== null);
|
|
39077
|
+
.map((v) => runValidator(v, form[fieldName].rawValue, form))
|
|
39078
|
+
.filter((x) => x !== null);
|
|
39102
39079
|
};
|
|
39103
39080
|
|
|
39104
39081
|
const computeConstraints = (fieldName, form) => {
|
|
39105
39082
|
const constraints = form[fieldName].constraints;
|
|
39106
|
-
return
|
|
39083
|
+
return runFormValidators(fieldName, form, constraints);
|
|
39107
39084
|
};
|
|
39108
39085
|
|
|
39109
39086
|
const computeErrors = (fieldName, form) => {
|
|
39110
39087
|
const validators = form[fieldName].validators;
|
|
39111
|
-
return
|
|
39112
|
-
};
|
|
39113
|
-
|
|
39114
|
-
var obj;
|
|
39115
|
-
var NOTHING = typeof Symbol !== "undefined" ? Symbol("immer-nothing") : ( obj = {}, obj["immer-nothing"] = true, obj );
|
|
39116
|
-
var DRAFTABLE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-draftable") : "__$immer_draftable";
|
|
39117
|
-
var DRAFT_STATE = typeof Symbol !== "undefined" && Symbol.for ? Symbol.for("immer-state") : "__$immer_state";
|
|
39118
|
-
function isDraft(value) {
|
|
39119
|
-
return !!value && !!value[DRAFT_STATE];
|
|
39120
|
-
}
|
|
39121
|
-
function isDraftable(value) {
|
|
39122
|
-
if (!value) { return false; }
|
|
39123
|
-
return isPlainObject(value) || !!value[DRAFTABLE] || !!value.constructor[DRAFTABLE];
|
|
39124
|
-
}
|
|
39125
|
-
function isPlainObject(value) {
|
|
39126
|
-
if (!value || typeof value !== "object") { return false; }
|
|
39127
|
-
if (Array.isArray(value)) { return true; }
|
|
39128
|
-
var proto = Object.getPrototypeOf(value);
|
|
39129
|
-
return !proto || proto === Object.prototype;
|
|
39130
|
-
}
|
|
39131
|
-
var assign = Object.assign || function assign(target, value) {
|
|
39132
|
-
for (var key in value) {
|
|
39133
|
-
if (has$1(value, key)) {
|
|
39134
|
-
target[key] = value[key];
|
|
39135
|
-
}
|
|
39136
|
-
}
|
|
39137
|
-
|
|
39138
|
-
return target;
|
|
39139
|
-
};
|
|
39140
|
-
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;
|
|
39141
|
-
function shallowCopy(base, invokeGetters) {
|
|
39142
|
-
if ( invokeGetters === void 0 ) invokeGetters = false;
|
|
39143
|
-
|
|
39144
|
-
if (Array.isArray(base)) { return base.slice(); }
|
|
39145
|
-
var clone = Object.create(Object.getPrototypeOf(base));
|
|
39146
|
-
ownKeys$2(base).forEach(function (key) {
|
|
39147
|
-
if (key === DRAFT_STATE) {
|
|
39148
|
-
return; // Never copy over draft state.
|
|
39149
|
-
}
|
|
39150
|
-
|
|
39151
|
-
var desc = Object.getOwnPropertyDescriptor(base, key);
|
|
39152
|
-
var value = desc.value;
|
|
39153
|
-
|
|
39154
|
-
if (desc.get) {
|
|
39155
|
-
if (!invokeGetters) {
|
|
39156
|
-
throw new Error("Immer drafts cannot have computed properties");
|
|
39157
|
-
}
|
|
39158
|
-
|
|
39159
|
-
value = desc.get.call(base);
|
|
39160
|
-
}
|
|
39161
|
-
|
|
39162
|
-
if (desc.enumerable) {
|
|
39163
|
-
clone[key] = value;
|
|
39164
|
-
} else {
|
|
39165
|
-
Object.defineProperty(clone, key, {
|
|
39166
|
-
value: value,
|
|
39167
|
-
writable: true,
|
|
39168
|
-
configurable: true
|
|
39169
|
-
});
|
|
39170
|
-
}
|
|
39171
|
-
});
|
|
39172
|
-
return clone;
|
|
39173
|
-
}
|
|
39174
|
-
function each(value, cb) {
|
|
39175
|
-
if (Array.isArray(value)) {
|
|
39176
|
-
for (var i = 0; i < value.length; i++) { cb(i, value[i], value); }
|
|
39177
|
-
} else {
|
|
39178
|
-
ownKeys$2(value).forEach(function (key) { return cb(key, value[key], value); });
|
|
39179
|
-
}
|
|
39180
|
-
}
|
|
39181
|
-
function isEnumerable(base, prop) {
|
|
39182
|
-
var desc = Object.getOwnPropertyDescriptor(base, prop);
|
|
39183
|
-
return !!desc && desc.enumerable;
|
|
39184
|
-
}
|
|
39185
|
-
function has$1(thing, prop) {
|
|
39186
|
-
return Object.prototype.hasOwnProperty.call(thing, prop);
|
|
39187
|
-
}
|
|
39188
|
-
function is(x, y) {
|
|
39189
|
-
// From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js
|
|
39190
|
-
if (x === y) {
|
|
39191
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
39192
|
-
} else {
|
|
39193
|
-
return x !== x && y !== y;
|
|
39194
|
-
}
|
|
39195
|
-
}
|
|
39196
|
-
function clone(obj) {
|
|
39197
|
-
if (!isDraftable(obj)) { return obj; }
|
|
39198
|
-
if (Array.isArray(obj)) { return obj.map(clone); }
|
|
39199
|
-
var cloned = Object.create(Object.getPrototypeOf(obj));
|
|
39200
|
-
|
|
39201
|
-
for (var key in obj) { cloned[key] = clone(obj[key]); }
|
|
39202
|
-
|
|
39203
|
-
return cloned;
|
|
39204
|
-
}
|
|
39205
|
-
|
|
39206
|
-
/** Each scope represents a `produce` call. */
|
|
39207
|
-
|
|
39208
|
-
var ImmerScope = function ImmerScope(parent) {
|
|
39209
|
-
this.drafts = [];
|
|
39210
|
-
this.parent = parent; // Whenever the modified draft contains a draft from another scope, we
|
|
39211
|
-
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
39212
|
-
|
|
39213
|
-
this.canAutoFreeze = true; // To avoid prototype lookups:
|
|
39214
|
-
|
|
39215
|
-
this.patches = null;
|
|
39216
|
-
};
|
|
39217
|
-
|
|
39218
|
-
ImmerScope.prototype.usePatches = function usePatches (patchListener) {
|
|
39219
|
-
if (patchListener) {
|
|
39220
|
-
this.patches = [];
|
|
39221
|
-
this.inversePatches = [];
|
|
39222
|
-
this.patchListener = patchListener;
|
|
39223
|
-
}
|
|
39224
|
-
};
|
|
39225
|
-
|
|
39226
|
-
ImmerScope.prototype.revoke = function revoke$1 () {
|
|
39227
|
-
this.leave();
|
|
39228
|
-
this.drafts.forEach(revoke);
|
|
39229
|
-
this.drafts = null; // Make draft-related methods throw.
|
|
39230
|
-
};
|
|
39231
|
-
|
|
39232
|
-
ImmerScope.prototype.leave = function leave () {
|
|
39233
|
-
if (this === ImmerScope.current) {
|
|
39234
|
-
ImmerScope.current = this.parent;
|
|
39235
|
-
}
|
|
39236
|
-
};
|
|
39237
|
-
ImmerScope.current = null;
|
|
39238
|
-
|
|
39239
|
-
ImmerScope.enter = function () {
|
|
39240
|
-
return this.current = new ImmerScope(this.current);
|
|
39241
|
-
};
|
|
39242
|
-
|
|
39243
|
-
function revoke(draft) {
|
|
39244
|
-
draft[DRAFT_STATE].revoke();
|
|
39245
|
-
}
|
|
39246
|
-
|
|
39247
|
-
// but share them all instead
|
|
39248
|
-
|
|
39249
|
-
var descriptors$1 = {};
|
|
39250
|
-
function willFinalize(scope, result, isReplaced) {
|
|
39251
|
-
scope.drafts.forEach(function (draft) {
|
|
39252
|
-
draft[DRAFT_STATE].finalizing = true;
|
|
39253
|
-
});
|
|
39254
|
-
|
|
39255
|
-
if (!isReplaced) {
|
|
39256
|
-
if (scope.patches) {
|
|
39257
|
-
markChangesRecursively(scope.drafts[0]);
|
|
39258
|
-
} // This is faster when we don't care about which attributes changed.
|
|
39259
|
-
|
|
39260
|
-
|
|
39261
|
-
markChangesSweep(scope.drafts);
|
|
39262
|
-
} // When a child draft is returned, look for changes.
|
|
39263
|
-
else if (isDraft(result) && result[DRAFT_STATE].scope === scope) {
|
|
39264
|
-
markChangesSweep(scope.drafts);
|
|
39265
|
-
}
|
|
39266
|
-
}
|
|
39267
|
-
function createProxy(base, parent) {
|
|
39268
|
-
var isArray = Array.isArray(base);
|
|
39269
|
-
var draft = clonePotentialDraft(base);
|
|
39270
|
-
each(draft, function (prop) {
|
|
39271
|
-
proxyProperty(draft, prop, isArray || isEnumerable(base, prop));
|
|
39272
|
-
}); // See "proxy.js" for property documentation.
|
|
39273
|
-
|
|
39274
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39275
|
-
var state = {
|
|
39276
|
-
scope: scope,
|
|
39277
|
-
modified: false,
|
|
39278
|
-
finalizing: false,
|
|
39279
|
-
// es5 only
|
|
39280
|
-
finalized: false,
|
|
39281
|
-
assigned: {},
|
|
39282
|
-
parent: parent,
|
|
39283
|
-
base: base,
|
|
39284
|
-
draft: draft,
|
|
39285
|
-
copy: null,
|
|
39286
|
-
revoke: revoke$1,
|
|
39287
|
-
revoked: false // es5 only
|
|
39288
|
-
|
|
39289
|
-
};
|
|
39290
|
-
createHiddenProperty(draft, DRAFT_STATE, state);
|
|
39291
|
-
scope.drafts.push(draft);
|
|
39292
|
-
return draft;
|
|
39293
|
-
}
|
|
39294
|
-
|
|
39295
|
-
function revoke$1() {
|
|
39296
|
-
this.revoked = true;
|
|
39297
|
-
}
|
|
39298
|
-
|
|
39299
|
-
function source(state) {
|
|
39300
|
-
return state.copy || state.base;
|
|
39301
|
-
} // Access a property without creating an Immer draft.
|
|
39302
|
-
|
|
39303
|
-
|
|
39304
|
-
function peek(draft, prop) {
|
|
39305
|
-
var state = draft[DRAFT_STATE];
|
|
39306
|
-
|
|
39307
|
-
if (state && !state.finalizing) {
|
|
39308
|
-
state.finalizing = true;
|
|
39309
|
-
var value = draft[prop];
|
|
39310
|
-
state.finalizing = false;
|
|
39311
|
-
return value;
|
|
39312
|
-
}
|
|
39313
|
-
|
|
39314
|
-
return draft[prop];
|
|
39315
|
-
}
|
|
39316
|
-
|
|
39317
|
-
function get$1(state, prop) {
|
|
39318
|
-
assertUnrevoked(state);
|
|
39319
|
-
var value = peek(source(state), prop);
|
|
39320
|
-
if (state.finalizing) { return value; } // Create a draft if the value is unmodified.
|
|
39321
|
-
|
|
39322
|
-
if (value === peek(state.base, prop) && isDraftable(value)) {
|
|
39323
|
-
prepareCopy(state);
|
|
39324
|
-
return state.copy[prop] = createProxy(value, state);
|
|
39325
|
-
}
|
|
39326
|
-
|
|
39327
|
-
return value;
|
|
39328
|
-
}
|
|
39329
|
-
|
|
39330
|
-
function set$1(state, prop, value) {
|
|
39331
|
-
assertUnrevoked(state);
|
|
39332
|
-
state.assigned[prop] = true;
|
|
39333
|
-
|
|
39334
|
-
if (!state.modified) {
|
|
39335
|
-
if (is(value, peek(source(state), prop))) { return; }
|
|
39336
|
-
markChanged(state);
|
|
39337
|
-
prepareCopy(state);
|
|
39338
|
-
}
|
|
39339
|
-
|
|
39340
|
-
state.copy[prop] = value;
|
|
39341
|
-
}
|
|
39342
|
-
|
|
39343
|
-
function markChanged(state) {
|
|
39344
|
-
if (!state.modified) {
|
|
39345
|
-
state.modified = true;
|
|
39346
|
-
if (state.parent) { markChanged(state.parent); }
|
|
39347
|
-
}
|
|
39348
|
-
}
|
|
39349
|
-
|
|
39350
|
-
function prepareCopy(state) {
|
|
39351
|
-
if (!state.copy) { state.copy = clonePotentialDraft(state.base); }
|
|
39352
|
-
}
|
|
39353
|
-
|
|
39354
|
-
function clonePotentialDraft(base) {
|
|
39355
|
-
var state = base && base[DRAFT_STATE];
|
|
39356
|
-
|
|
39357
|
-
if (state) {
|
|
39358
|
-
state.finalizing = true;
|
|
39359
|
-
var draft = shallowCopy(state.draft, true);
|
|
39360
|
-
state.finalizing = false;
|
|
39361
|
-
return draft;
|
|
39362
|
-
}
|
|
39363
|
-
|
|
39364
|
-
return shallowCopy(base);
|
|
39365
|
-
}
|
|
39366
|
-
|
|
39367
|
-
function proxyProperty(draft, prop, enumerable) {
|
|
39368
|
-
var desc = descriptors$1[prop];
|
|
39369
|
-
|
|
39370
|
-
if (desc) {
|
|
39371
|
-
desc.enumerable = enumerable;
|
|
39372
|
-
} else {
|
|
39373
|
-
descriptors$1[prop] = desc = {
|
|
39374
|
-
configurable: true,
|
|
39375
|
-
enumerable: enumerable,
|
|
39376
|
-
|
|
39377
|
-
get: function get$1$1() {
|
|
39378
|
-
return get$1(this[DRAFT_STATE], prop);
|
|
39379
|
-
},
|
|
39380
|
-
|
|
39381
|
-
set: function set$1$1(value) {
|
|
39382
|
-
set$1(this[DRAFT_STATE], prop, value);
|
|
39383
|
-
}
|
|
39384
|
-
|
|
39385
|
-
};
|
|
39386
|
-
}
|
|
39387
|
-
|
|
39388
|
-
Object.defineProperty(draft, prop, desc);
|
|
39389
|
-
}
|
|
39390
|
-
|
|
39391
|
-
function assertUnrevoked(state) {
|
|
39392
|
-
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))); }
|
|
39393
|
-
} // This looks expensive, but only proxies are visited, and only objects without known changes are scanned.
|
|
39394
|
-
|
|
39395
|
-
|
|
39396
|
-
function markChangesSweep(drafts) {
|
|
39397
|
-
// The natural order of drafts in the `scope` array is based on when they
|
|
39398
|
-
// were accessed. By processing drafts in reverse natural order, we have a
|
|
39399
|
-
// better chance of processing leaf nodes first. When a leaf node is known to
|
|
39400
|
-
// have changed, we can avoid any traversal of its ancestor nodes.
|
|
39401
|
-
for (var i = drafts.length - 1; i >= 0; i--) {
|
|
39402
|
-
var state = drafts[i][DRAFT_STATE];
|
|
39403
|
-
|
|
39404
|
-
if (!state.modified) {
|
|
39405
|
-
if (Array.isArray(state.base)) {
|
|
39406
|
-
if (hasArrayChanges(state)) { markChanged(state); }
|
|
39407
|
-
} else if (hasObjectChanges(state)) { markChanged(state); }
|
|
39408
|
-
}
|
|
39409
|
-
}
|
|
39410
|
-
}
|
|
39411
|
-
|
|
39412
|
-
function markChangesRecursively(object) {
|
|
39413
|
-
if (!object || typeof object !== "object") { return; }
|
|
39414
|
-
var state = object[DRAFT_STATE];
|
|
39415
|
-
if (!state) { return; }
|
|
39416
|
-
var base = state.base;
|
|
39417
|
-
var draft = state.draft;
|
|
39418
|
-
var assigned = state.assigned;
|
|
39419
|
-
|
|
39420
|
-
if (!Array.isArray(object)) {
|
|
39421
|
-
// Look for added keys.
|
|
39422
|
-
Object.keys(draft).forEach(function (key) {
|
|
39423
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39424
|
-
if (base[key] === undefined && !has$1(base, key)) {
|
|
39425
|
-
assigned[key] = true;
|
|
39426
|
-
markChanged(state);
|
|
39427
|
-
} else if (!assigned[key]) {
|
|
39428
|
-
// Only untouched properties trigger recursion.
|
|
39429
|
-
markChangesRecursively(draft[key]);
|
|
39430
|
-
}
|
|
39431
|
-
}); // Look for removed keys.
|
|
39432
|
-
|
|
39433
|
-
Object.keys(base).forEach(function (key) {
|
|
39434
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39435
|
-
if (draft[key] === undefined && !has$1(draft, key)) {
|
|
39436
|
-
assigned[key] = false;
|
|
39437
|
-
markChanged(state);
|
|
39438
|
-
}
|
|
39439
|
-
});
|
|
39440
|
-
} else if (hasArrayChanges(state)) {
|
|
39441
|
-
markChanged(state);
|
|
39442
|
-
assigned.length = true;
|
|
39443
|
-
|
|
39444
|
-
if (draft.length < base.length) {
|
|
39445
|
-
for (var i = draft.length; i < base.length; i++) { assigned[i] = false; }
|
|
39446
|
-
} else {
|
|
39447
|
-
for (var i$1 = base.length; i$1 < draft.length; i$1++) { assigned[i$1] = true; }
|
|
39448
|
-
}
|
|
39449
|
-
|
|
39450
|
-
for (var i$2 = 0; i$2 < draft.length; i$2++) {
|
|
39451
|
-
// Only untouched indices trigger recursion.
|
|
39452
|
-
if (assigned[i$2] === undefined) { markChangesRecursively(draft[i$2]); }
|
|
39453
|
-
}
|
|
39454
|
-
}
|
|
39455
|
-
}
|
|
39456
|
-
|
|
39457
|
-
function hasObjectChanges(state) {
|
|
39458
|
-
var base = state.base;
|
|
39459
|
-
var draft = state.draft; // Search for added keys and changed keys. Start at the back, because
|
|
39460
|
-
// non-numeric keys are ordered by time of definition on the object.
|
|
39461
|
-
|
|
39462
|
-
var keys = Object.keys(draft);
|
|
39463
|
-
|
|
39464
|
-
for (var i = keys.length - 1; i >= 0; i--) {
|
|
39465
|
-
var key = keys[i];
|
|
39466
|
-
var baseValue = base[key]; // The `undefined` check is a fast path for pre-existing keys.
|
|
39467
|
-
|
|
39468
|
-
if (baseValue === undefined && !has$1(base, key)) {
|
|
39469
|
-
return true;
|
|
39470
|
-
} // Once a base key is deleted, future changes go undetected, because its
|
|
39471
|
-
// descriptor is erased. This branch detects any missed changes.
|
|
39472
|
-
else {
|
|
39473
|
-
var value = draft[key];
|
|
39474
|
-
var state$1 = value && value[DRAFT_STATE];
|
|
39475
|
-
|
|
39476
|
-
if (state$1 ? state$1.base !== baseValue : !is(value, baseValue)) {
|
|
39477
|
-
return true;
|
|
39478
|
-
}
|
|
39479
|
-
}
|
|
39480
|
-
} // At this point, no keys were added or changed.
|
|
39481
|
-
// Compare key count to determine if keys were deleted.
|
|
39482
|
-
|
|
39483
|
-
|
|
39484
|
-
return keys.length !== Object.keys(base).length;
|
|
39485
|
-
}
|
|
39486
|
-
|
|
39487
|
-
function hasArrayChanges(state) {
|
|
39488
|
-
var draft = state.draft;
|
|
39489
|
-
if (draft.length !== state.base.length) { return true; } // See #116
|
|
39490
|
-
// If we first shorten the length, our array interceptors will be removed.
|
|
39491
|
-
// If after that new items are added, result in the same original length,
|
|
39492
|
-
// those last items will have no intercepting property.
|
|
39493
|
-
// So if there is no own descriptor on the last position, we know that items were removed and added
|
|
39494
|
-
// N.B.: splice, unshift, etc only shift values around, but not prop descriptors, so we only have to check
|
|
39495
|
-
// the last one
|
|
39496
|
-
|
|
39497
|
-
var descriptor = Object.getOwnPropertyDescriptor(draft, draft.length - 1); // descriptor can be null, but only for newly created sparse arrays, eg. new Array(10)
|
|
39498
|
-
|
|
39499
|
-
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
|
|
39500
|
-
|
|
39501
|
-
return false;
|
|
39502
|
-
}
|
|
39503
|
-
|
|
39504
|
-
function createHiddenProperty(target, prop, value) {
|
|
39505
|
-
Object.defineProperty(target, prop, {
|
|
39506
|
-
value: value,
|
|
39507
|
-
enumerable: false,
|
|
39508
|
-
writable: true
|
|
39509
|
-
});
|
|
39510
|
-
}
|
|
39511
|
-
|
|
39512
|
-
var legacyProxy = /*#__PURE__*/Object.freeze({
|
|
39513
|
-
willFinalize: willFinalize,
|
|
39514
|
-
createProxy: createProxy
|
|
39515
|
-
});
|
|
39516
|
-
|
|
39517
|
-
function willFinalize$1() {}
|
|
39518
|
-
function createProxy$1(base, parent) {
|
|
39519
|
-
var scope = parent ? parent.scope : ImmerScope.current;
|
|
39520
|
-
var state = {
|
|
39521
|
-
// Track which produce call this is associated with.
|
|
39522
|
-
scope: scope,
|
|
39523
|
-
// True for both shallow and deep changes.
|
|
39524
|
-
modified: false,
|
|
39525
|
-
// Used during finalization.
|
|
39526
|
-
finalized: false,
|
|
39527
|
-
// Track which properties have been assigned (true) or deleted (false).
|
|
39528
|
-
assigned: {},
|
|
39529
|
-
// The parent draft state.
|
|
39530
|
-
parent: parent,
|
|
39531
|
-
// The base state.
|
|
39532
|
-
base: base,
|
|
39533
|
-
// The base proxy.
|
|
39534
|
-
draft: null,
|
|
39535
|
-
// Any property proxies.
|
|
39536
|
-
drafts: {},
|
|
39537
|
-
// The base copy with any updated values.
|
|
39538
|
-
copy: null,
|
|
39539
|
-
// Called by the `produce` function.
|
|
39540
|
-
revoke: null
|
|
39541
|
-
};
|
|
39542
|
-
var ref = Array.isArray(base) ? // [state] is used for arrays, to make sure the proxy is array-ish and not violate invariants,
|
|
39543
|
-
// although state itself is an object
|
|
39544
|
-
Proxy.revocable([state], arrayTraps) : Proxy.revocable(state, objectTraps);
|
|
39545
|
-
var revoke = ref.revoke;
|
|
39546
|
-
var proxy = ref.proxy;
|
|
39547
|
-
state.draft = proxy;
|
|
39548
|
-
state.revoke = revoke;
|
|
39549
|
-
scope.drafts.push(proxy);
|
|
39550
|
-
return proxy;
|
|
39551
|
-
}
|
|
39552
|
-
var objectTraps = {
|
|
39553
|
-
get: get$1$1,
|
|
39554
|
-
|
|
39555
|
-
has: function has(target, prop) {
|
|
39556
|
-
return prop in source$1(target);
|
|
39557
|
-
},
|
|
39558
|
-
|
|
39559
|
-
ownKeys: function ownKeys(target) {
|
|
39560
|
-
return Reflect.ownKeys(source$1(target));
|
|
39561
|
-
},
|
|
39562
|
-
|
|
39563
|
-
set: set$1$1,
|
|
39564
|
-
deleteProperty: deleteProperty,
|
|
39565
|
-
getOwnPropertyDescriptor: getOwnPropertyDescriptor$2,
|
|
39566
|
-
|
|
39567
|
-
defineProperty: function defineProperty() {
|
|
39568
|
-
throw new Error("Object.defineProperty() cannot be used on an Immer draft"); // prettier-ignore
|
|
39569
|
-
},
|
|
39570
|
-
|
|
39571
|
-
getPrototypeOf: function getPrototypeOf(target) {
|
|
39572
|
-
return Object.getPrototypeOf(target.base);
|
|
39573
|
-
},
|
|
39574
|
-
|
|
39575
|
-
setPrototypeOf: function setPrototypeOf() {
|
|
39576
|
-
throw new Error("Object.setPrototypeOf() cannot be used on an Immer draft"); // prettier-ignore
|
|
39577
|
-
}
|
|
39578
|
-
|
|
39579
|
-
};
|
|
39580
|
-
var arrayTraps = {};
|
|
39581
|
-
each(objectTraps, function (key, fn) {
|
|
39582
|
-
arrayTraps[key] = function () {
|
|
39583
|
-
arguments[0] = arguments[0][0];
|
|
39584
|
-
return fn.apply(this, arguments);
|
|
39585
|
-
};
|
|
39586
|
-
});
|
|
39587
|
-
|
|
39588
|
-
arrayTraps.deleteProperty = function (state, prop) {
|
|
39589
|
-
if (isNaN(parseInt(prop))) {
|
|
39590
|
-
throw new Error("Immer only supports deleting array indices"); // prettier-ignore
|
|
39591
|
-
}
|
|
39592
|
-
|
|
39593
|
-
return objectTraps.deleteProperty.call(this, state[0], prop);
|
|
39594
|
-
};
|
|
39595
|
-
|
|
39596
|
-
arrayTraps.set = function (state, prop, value) {
|
|
39597
|
-
if (prop !== "length" && isNaN(parseInt(prop))) {
|
|
39598
|
-
throw new Error("Immer only supports setting array indices and the 'length' property"); // prettier-ignore
|
|
39599
|
-
}
|
|
39600
|
-
|
|
39601
|
-
return objectTraps.set.call(this, state[0], prop, value);
|
|
39602
|
-
}; // returns the object we should be reading the current value from, which is base, until some change has been made
|
|
39603
|
-
|
|
39604
|
-
|
|
39605
|
-
function source$1(state) {
|
|
39606
|
-
return state.copy || state.base;
|
|
39607
|
-
} // Access a property without creating an Immer draft.
|
|
39608
|
-
|
|
39609
|
-
|
|
39610
|
-
function peek$1(draft, prop) {
|
|
39611
|
-
var state = draft[DRAFT_STATE];
|
|
39612
|
-
var desc = Reflect.getOwnPropertyDescriptor(state ? source$1(state) : draft, prop);
|
|
39613
|
-
return desc && desc.value;
|
|
39614
|
-
}
|
|
39615
|
-
|
|
39616
|
-
function get$1$1(state, prop) {
|
|
39617
|
-
if (prop === DRAFT_STATE) { return state; }
|
|
39618
|
-
var drafts = state.drafts; // Check for existing draft in unmodified state.
|
|
39619
|
-
|
|
39620
|
-
if (!state.modified && has$1(drafts, prop)) {
|
|
39621
|
-
return drafts[prop];
|
|
39622
|
-
}
|
|
39623
|
-
|
|
39624
|
-
var value = source$1(state)[prop];
|
|
39625
|
-
|
|
39626
|
-
if (state.finalized || !isDraftable(value)) {
|
|
39627
|
-
return value;
|
|
39628
|
-
} // Check for existing draft in modified state.
|
|
39629
|
-
|
|
39630
|
-
|
|
39631
|
-
if (state.modified) {
|
|
39632
|
-
// Assigned values are never drafted. This catches any drafts we created, too.
|
|
39633
|
-
if (value !== peek$1(state.base, prop)) { return value; } // Store drafts on the copy (when one exists).
|
|
39634
|
-
|
|
39635
|
-
drafts = state.copy;
|
|
39636
|
-
}
|
|
39637
|
-
|
|
39638
|
-
return drafts[prop] = createProxy$1(value, state);
|
|
39639
|
-
}
|
|
39640
|
-
|
|
39641
|
-
function set$1$1(state, prop, value) {
|
|
39642
|
-
if (!state.modified) {
|
|
39643
|
-
var baseValue = peek$1(state.base, prop); // Optimize based on value's truthiness. Truthy values are guaranteed to
|
|
39644
|
-
// never be undefined, so we can avoid the `in` operator. Lastly, truthy
|
|
39645
|
-
// values may be drafts, but falsy values are never drafts.
|
|
39646
|
-
|
|
39647
|
-
var isUnchanged = value ? is(baseValue, value) || value === state.drafts[prop] : is(baseValue, value) && prop in state.base;
|
|
39648
|
-
if (isUnchanged) { return true; }
|
|
39649
|
-
markChanged$1(state);
|
|
39650
|
-
}
|
|
39651
|
-
|
|
39652
|
-
state.assigned[prop] = true;
|
|
39653
|
-
state.copy[prop] = value;
|
|
39654
|
-
return true;
|
|
39655
|
-
}
|
|
39656
|
-
|
|
39657
|
-
function deleteProperty(state, prop) {
|
|
39658
|
-
// The `undefined` check is a fast path for pre-existing keys.
|
|
39659
|
-
if (peek$1(state.base, prop) !== undefined || prop in state.base) {
|
|
39660
|
-
state.assigned[prop] = false;
|
|
39661
|
-
markChanged$1(state);
|
|
39662
|
-
} else if (state.assigned[prop]) {
|
|
39663
|
-
// if an originally not assigned property was deleted
|
|
39664
|
-
delete state.assigned[prop];
|
|
39665
|
-
}
|
|
39666
|
-
|
|
39667
|
-
if (state.copy) { delete state.copy[prop]; }
|
|
39668
|
-
return true;
|
|
39669
|
-
} // Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
39670
|
-
// the same guarantee in ES5 mode.
|
|
39671
|
-
|
|
39672
|
-
|
|
39673
|
-
function getOwnPropertyDescriptor$2(state, prop) {
|
|
39674
|
-
var owner = source$1(state);
|
|
39675
|
-
var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
39676
|
-
|
|
39677
|
-
if (desc) {
|
|
39678
|
-
desc.writable = true;
|
|
39679
|
-
desc.configurable = !Array.isArray(owner) || prop !== "length";
|
|
39680
|
-
}
|
|
39681
|
-
|
|
39682
|
-
return desc;
|
|
39683
|
-
}
|
|
39684
|
-
|
|
39685
|
-
function markChanged$1(state) {
|
|
39686
|
-
if (!state.modified) {
|
|
39687
|
-
state.modified = true;
|
|
39688
|
-
state.copy = assign(shallowCopy(state.base), state.drafts);
|
|
39689
|
-
state.drafts = null;
|
|
39690
|
-
if (state.parent) { markChanged$1(state.parent); }
|
|
39691
|
-
}
|
|
39692
|
-
}
|
|
39693
|
-
|
|
39694
|
-
var modernProxy = /*#__PURE__*/Object.freeze({
|
|
39695
|
-
willFinalize: willFinalize$1,
|
|
39696
|
-
createProxy: createProxy$1
|
|
39697
|
-
});
|
|
39698
|
-
|
|
39699
|
-
function generatePatches(state, basePath, patches, inversePatches) {
|
|
39700
|
-
Array.isArray(state.base) ? generateArrayPatches(state, basePath, patches, inversePatches) : generateObjectPatches(state, basePath, patches, inversePatches);
|
|
39701
|
-
}
|
|
39702
|
-
|
|
39703
|
-
function generateArrayPatches(state, basePath, patches, inversePatches) {
|
|
39704
|
-
var assign, assign$1;
|
|
39705
|
-
|
|
39706
|
-
var base = state.base;
|
|
39707
|
-
var copy = state.copy;
|
|
39708
|
-
var assigned = state.assigned; // Reduce complexity by ensuring `base` is never longer.
|
|
39709
|
-
|
|
39710
|
-
if (copy.length < base.length) {
|
|
39711
|
-
(assign = [copy, base], base = assign[0], copy = assign[1]);
|
|
39712
|
-
(assign$1 = [inversePatches, patches], patches = assign$1[0], inversePatches = assign$1[1]);
|
|
39713
|
-
}
|
|
39714
|
-
|
|
39715
|
-
var delta = copy.length - base.length; // Find the first replaced index.
|
|
39716
|
-
|
|
39717
|
-
var start = 0;
|
|
39718
|
-
|
|
39719
|
-
while (base[start] === copy[start] && start < base.length) {
|
|
39720
|
-
++start;
|
|
39721
|
-
} // Find the last replaced index. Search from the end to optimize splice patches.
|
|
39722
|
-
|
|
39723
|
-
|
|
39724
|
-
var end = base.length;
|
|
39725
|
-
|
|
39726
|
-
while (end > start && base[end - 1] === copy[end + delta - 1]) {
|
|
39727
|
-
--end;
|
|
39728
|
-
} // Process replaced indices.
|
|
39729
|
-
|
|
39730
|
-
|
|
39731
|
-
for (var i = start; i < end; ++i) {
|
|
39732
|
-
if (assigned[i] && copy[i] !== base[i]) {
|
|
39733
|
-
var path = basePath.concat([i]);
|
|
39734
|
-
patches.push({
|
|
39735
|
-
op: "replace",
|
|
39736
|
-
path: path,
|
|
39737
|
-
value: copy[i]
|
|
39738
|
-
});
|
|
39739
|
-
inversePatches.push({
|
|
39740
|
-
op: "replace",
|
|
39741
|
-
path: path,
|
|
39742
|
-
value: base[i]
|
|
39743
|
-
});
|
|
39744
|
-
}
|
|
39745
|
-
}
|
|
39746
|
-
|
|
39747
|
-
var replaceCount = patches.length; // Process added indices.
|
|
39748
|
-
|
|
39749
|
-
for (var i$1 = end + delta - 1; i$1 >= end; --i$1) {
|
|
39750
|
-
var path$1 = basePath.concat([i$1]);
|
|
39751
|
-
patches[replaceCount + i$1 - end] = {
|
|
39752
|
-
op: "add",
|
|
39753
|
-
path: path$1,
|
|
39754
|
-
value: copy[i$1]
|
|
39755
|
-
};
|
|
39756
|
-
inversePatches.push({
|
|
39757
|
-
op: "remove",
|
|
39758
|
-
path: path$1
|
|
39759
|
-
});
|
|
39760
|
-
}
|
|
39761
|
-
}
|
|
39762
|
-
|
|
39763
|
-
function generateObjectPatches(state, basePath, patches, inversePatches) {
|
|
39764
|
-
var base = state.base;
|
|
39765
|
-
var copy = state.copy;
|
|
39766
|
-
each(state.assigned, function (key, assignedValue) {
|
|
39767
|
-
var origValue = base[key];
|
|
39768
|
-
var value = copy[key];
|
|
39769
|
-
var op = !assignedValue ? "remove" : key in base ? "replace" : "add";
|
|
39770
|
-
if (origValue === value && op === "replace") { return; }
|
|
39771
|
-
var path = basePath.concat(key);
|
|
39772
|
-
patches.push(op === "remove" ? {
|
|
39773
|
-
op: op,
|
|
39774
|
-
path: path
|
|
39775
|
-
} : {
|
|
39776
|
-
op: op,
|
|
39777
|
-
path: path,
|
|
39778
|
-
value: value
|
|
39779
|
-
});
|
|
39780
|
-
inversePatches.push(op === "add" ? {
|
|
39781
|
-
op: "remove",
|
|
39782
|
-
path: path
|
|
39783
|
-
} : op === "remove" ? {
|
|
39784
|
-
op: "add",
|
|
39785
|
-
path: path,
|
|
39786
|
-
value: origValue
|
|
39787
|
-
} : {
|
|
39788
|
-
op: "replace",
|
|
39789
|
-
path: path,
|
|
39790
|
-
value: origValue
|
|
39791
|
-
});
|
|
39792
|
-
});
|
|
39793
|
-
}
|
|
39794
|
-
|
|
39795
|
-
var applyPatches = function (draft, patches) {
|
|
39796
|
-
for (var i$1 = 0, list = patches; i$1 < list.length; i$1 += 1) {
|
|
39797
|
-
var patch = list[i$1];
|
|
39798
|
-
|
|
39799
|
-
var path = patch.path;
|
|
39800
|
-
var op = patch.op;
|
|
39801
|
-
var value = clone(patch.value); // used to clone patch to ensure original patch is not modified, see #411
|
|
39802
|
-
|
|
39803
|
-
if (!path.length) { throw new Error("Illegal state"); }
|
|
39804
|
-
var base = draft;
|
|
39805
|
-
|
|
39806
|
-
for (var i = 0; i < path.length - 1; i++) {
|
|
39807
|
-
base = base[path[i]];
|
|
39808
|
-
if (!base || typeof base !== "object") { throw new Error("Cannot apply patch, path doesn't resolve: " + path.join("/")); } // prettier-ignore
|
|
39809
|
-
}
|
|
39810
|
-
|
|
39811
|
-
var key = path[path.length - 1];
|
|
39812
|
-
|
|
39813
|
-
switch (op) {
|
|
39814
|
-
case "replace":
|
|
39815
|
-
// if value is an object, then it's assigned by reference
|
|
39816
|
-
// in the following add or remove ops, the value field inside the patch will also be modifyed
|
|
39817
|
-
// so we use value from the cloned patch
|
|
39818
|
-
base[key] = value;
|
|
39819
|
-
break;
|
|
39820
|
-
|
|
39821
|
-
case "add":
|
|
39822
|
-
if (Array.isArray(base)) {
|
|
39823
|
-
// TODO: support "foo/-" paths for appending to an array
|
|
39824
|
-
base.splice(key, 0, value);
|
|
39825
|
-
} else {
|
|
39826
|
-
base[key] = value;
|
|
39827
|
-
}
|
|
39828
|
-
|
|
39829
|
-
break;
|
|
39830
|
-
|
|
39831
|
-
case "remove":
|
|
39832
|
-
if (Array.isArray(base)) {
|
|
39833
|
-
base.splice(key, 1);
|
|
39834
|
-
} else {
|
|
39835
|
-
delete base[key];
|
|
39836
|
-
}
|
|
39837
|
-
|
|
39838
|
-
break;
|
|
39839
|
-
|
|
39840
|
-
default:
|
|
39841
|
-
throw new Error("Unsupported patch operation: " + op);
|
|
39842
|
-
}
|
|
39843
|
-
}
|
|
39844
|
-
|
|
39845
|
-
return draft;
|
|
39846
|
-
};
|
|
39847
|
-
|
|
39848
|
-
function verifyMinified() {}
|
|
39849
|
-
|
|
39850
|
-
var configDefaults = {
|
|
39851
|
-
useProxies: typeof Proxy !== "undefined" && typeof Reflect !== "undefined",
|
|
39852
|
-
autoFreeze: typeof process !== "undefined" ? process.env.NODE_ENV !== "production" : verifyMinified.name === "verifyMinified",
|
|
39853
|
-
onAssign: null,
|
|
39854
|
-
onDelete: null,
|
|
39855
|
-
onCopy: null
|
|
39088
|
+
return runFormValidators(fieldName, form, validators);
|
|
39856
39089
|
};
|
|
39857
|
-
var Immer = function Immer(config) {
|
|
39858
|
-
assign(this, configDefaults, config);
|
|
39859
|
-
this.setUseProxies(this.useProxies);
|
|
39860
|
-
this.produce = this.produce.bind(this);
|
|
39861
|
-
};
|
|
39862
|
-
|
|
39863
|
-
Immer.prototype.produce = function produce (base, recipe, patchListener) {
|
|
39864
|
-
var this$1$1 = this;
|
|
39865
|
-
|
|
39866
|
-
// curried invocation
|
|
39867
|
-
if (typeof base === "function" && typeof recipe !== "function") {
|
|
39868
|
-
var defaultBase = recipe;
|
|
39869
|
-
recipe = base;
|
|
39870
|
-
var self = this;
|
|
39871
|
-
return function curriedProduce(base) {
|
|
39872
|
-
var this$1$1 = this;
|
|
39873
|
-
if ( base === void 0 ) base = defaultBase;
|
|
39874
|
-
var args = [], len = arguments.length - 1;
|
|
39875
|
-
while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
|
|
39876
|
-
|
|
39877
|
-
return self.produce(base, function (draft) { return recipe.call.apply(recipe, [ this$1$1, draft ].concat( args )); }); // prettier-ignore
|
|
39878
|
-
};
|
|
39879
|
-
} // prettier-ignore
|
|
39880
|
-
|
|
39881
|
-
|
|
39882
|
-
{
|
|
39883
|
-
if (typeof recipe !== "function") {
|
|
39884
|
-
throw new Error("The first or second argument to `produce` must be a function");
|
|
39885
|
-
}
|
|
39886
|
-
|
|
39887
|
-
if (patchListener !== undefined && typeof patchListener !== "function") {
|
|
39888
|
-
throw new Error("The third argument to `produce` must be a function or undefined");
|
|
39889
|
-
}
|
|
39890
|
-
}
|
|
39891
|
-
var result; // Only plain objects, arrays, and "immerable classes" are drafted.
|
|
39892
|
-
|
|
39893
|
-
if (isDraftable(base)) {
|
|
39894
|
-
var scope = ImmerScope.enter();
|
|
39895
|
-
var proxy = this.createProxy(base);
|
|
39896
|
-
var hasError = true;
|
|
39897
|
-
|
|
39898
|
-
try {
|
|
39899
|
-
result = recipe(proxy);
|
|
39900
|
-
hasError = false;
|
|
39901
|
-
} finally {
|
|
39902
|
-
// finally instead of catch + rethrow better preserves original stack
|
|
39903
|
-
if (hasError) { scope.revoke(); }else { scope.leave(); }
|
|
39904
|
-
}
|
|
39905
|
-
|
|
39906
|
-
if (result instanceof Promise) {
|
|
39907
|
-
return result.then(function (result) {
|
|
39908
|
-
scope.usePatches(patchListener);
|
|
39909
|
-
return this$1$1.processResult(result, scope);
|
|
39910
|
-
}, function (error) {
|
|
39911
|
-
scope.revoke();
|
|
39912
|
-
throw error;
|
|
39913
|
-
});
|
|
39914
|
-
}
|
|
39915
39090
|
|
|
39916
|
-
|
|
39917
|
-
|
|
39918
|
-
|
|
39919
|
-
|
|
39920
|
-
|
|
39921
|
-
|
|
39091
|
+
const computeErrorEntries = (formState) => {
|
|
39092
|
+
const fields = Object.entries(formState);
|
|
39093
|
+
for (let entry of fields) {
|
|
39094
|
+
let fieldName = entry[0];
|
|
39095
|
+
let errors = computeErrors(fieldName, formState);
|
|
39096
|
+
formState[fieldName].errors = errors;
|
|
39097
|
+
formState[fieldName].hasErrors = errors.length > 0;
|
|
39922
39098
|
}
|
|
39923
39099
|
};
|
|
39924
39100
|
|
|
39925
|
-
|
|
39926
|
-
|
|
39927
|
-
|
|
39928
|
-
|
|
39929
|
-
|
|
39930
|
-
|
|
39931
|
-
|
|
39932
|
-
|
|
39933
|
-
return this$1$1.produceWithPatches(state, function (draft) { return arg1.apply(void 0, [ draft ].concat( args )); });
|
|
39934
|
-
};
|
|
39935
|
-
} // non-curried form
|
|
39936
|
-
|
|
39937
|
-
|
|
39938
|
-
if (arg3) { throw new Error("A patch listener cannot be passed to produceWithPatches"); }
|
|
39939
|
-
var patches, inversePatches;
|
|
39940
|
-
var nextState = this.produce(arg1, arg2, function (p, ip) {
|
|
39941
|
-
patches = p;
|
|
39942
|
-
inversePatches = ip;
|
|
39943
|
-
});
|
|
39944
|
-
return [nextState, patches, inversePatches];
|
|
39945
|
-
};
|
|
39946
|
-
|
|
39947
|
-
Immer.prototype.createDraft = function createDraft (base) {
|
|
39948
|
-
if (!isDraftable(base)) {
|
|
39949
|
-
throw new Error("First argument to `createDraft` must be a plain object, an array, or an immerable object"); // prettier-ignore
|
|
39950
|
-
}
|
|
39951
|
-
|
|
39952
|
-
var scope = ImmerScope.enter();
|
|
39953
|
-
var proxy = this.createProxy(base);
|
|
39954
|
-
proxy[DRAFT_STATE].isManual = true;
|
|
39955
|
-
scope.leave();
|
|
39956
|
-
return proxy;
|
|
39957
|
-
};
|
|
39958
|
-
|
|
39959
|
-
Immer.prototype.finishDraft = function finishDraft (draft, patchListener) {
|
|
39960
|
-
var state = draft && draft[DRAFT_STATE];
|
|
39961
|
-
|
|
39962
|
-
if (!state || !state.isManual) {
|
|
39963
|
-
throw new Error("First argument to `finishDraft` must be a draft returned by `createDraft`"); // prettier-ignore
|
|
39964
|
-
}
|
|
39965
|
-
|
|
39966
|
-
if (state.finalized) {
|
|
39967
|
-
throw new Error("The given draft is already finalized"); // prettier-ignore
|
|
39101
|
+
const computeDirtyEntries = (formState, changedFieldName) => {
|
|
39102
|
+
const fields = Object.entries(formState);
|
|
39103
|
+
for (let entry of fields) {
|
|
39104
|
+
let fieldName = entry[0];
|
|
39105
|
+
let field = entry[1];
|
|
39106
|
+
let dirty = fieldName === changedFieldName ? true : field.dirty;
|
|
39107
|
+
formState[fieldName].dirty = dirty;
|
|
39968
39108
|
}
|
|
39969
|
-
|
|
39970
|
-
var scope = state.scope;
|
|
39971
|
-
scope.usePatches(patchListener);
|
|
39972
|
-
return this.processResult(undefined, scope);
|
|
39973
|
-
};
|
|
39974
|
-
|
|
39975
|
-
Immer.prototype.setAutoFreeze = function setAutoFreeze (value) {
|
|
39976
|
-
this.autoFreeze = value;
|
|
39977
|
-
};
|
|
39978
|
-
|
|
39979
|
-
Immer.prototype.setUseProxies = function setUseProxies (value) {
|
|
39980
|
-
this.useProxies = value;
|
|
39981
|
-
assign(this, value ? modernProxy : legacyProxy);
|
|
39982
39109
|
};
|
|
39983
39110
|
|
|
39984
|
-
Immer.prototype.applyPatches = function applyPatches$1 (base, patches) {
|
|
39985
|
-
// If a patch replaces the entire state, take that replacement as base
|
|
39986
|
-
// before applying patches
|
|
39987
|
-
var i;
|
|
39988
|
-
|
|
39989
|
-
for (i = patches.length - 1; i >= 0; i--) {
|
|
39990
|
-
var patch = patches[i];
|
|
39991
|
-
|
|
39992
|
-
if (patch.path.length === 0 && patch.op === "replace") {
|
|
39993
|
-
base = patch.value;
|
|
39994
|
-
break;
|
|
39995
|
-
}
|
|
39996
|
-
}
|
|
39997
|
-
|
|
39998
|
-
if (isDraft(base)) {
|
|
39999
|
-
// N.B: never hits if some patch a replacement, patches are never drafts
|
|
40000
|
-
return applyPatches(base, patches);
|
|
40001
|
-
} // Otherwise, produce a copy of the base state.
|
|
40002
|
-
|
|
40003
|
-
|
|
40004
|
-
return this.produce(base, function (draft) { return applyPatches(draft, patches.slice(i + 1)); });
|
|
40005
|
-
};
|
|
40006
|
-
/** @internal */
|
|
40007
|
-
|
|
40008
|
-
|
|
40009
|
-
Immer.prototype.processResult = function processResult (result, scope) {
|
|
40010
|
-
var baseDraft = scope.drafts[0];
|
|
40011
|
-
var isReplaced = result !== undefined && result !== baseDraft;
|
|
40012
|
-
this.willFinalize(scope, result, isReplaced);
|
|
40013
|
-
|
|
40014
|
-
if (isReplaced) {
|
|
40015
|
-
if (baseDraft[DRAFT_STATE].modified) {
|
|
40016
|
-
scope.revoke();
|
|
40017
|
-
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
|
|
40018
|
-
}
|
|
40019
|
-
|
|
40020
|
-
if (isDraftable(result)) {
|
|
40021
|
-
// Finalize the result in case it contains (or is) a subset of the draft.
|
|
40022
|
-
result = this.finalize(result, null, scope);
|
|
40023
|
-
}
|
|
39111
|
+
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;
|
|
40024
39112
|
|
|
40025
|
-
|
|
40026
|
-
scope.patches.push({
|
|
40027
|
-
op: "replace",
|
|
40028
|
-
path: [],
|
|
40029
|
-
value: result
|
|
40030
|
-
});
|
|
40031
|
-
scope.inversePatches.push({
|
|
40032
|
-
op: "replace",
|
|
40033
|
-
path: [],
|
|
40034
|
-
value: baseDraft[DRAFT_STATE].base
|
|
40035
|
-
});
|
|
40036
|
-
}
|
|
40037
|
-
} else {
|
|
40038
|
-
// Finalize the base draft.
|
|
40039
|
-
result = this.finalize(baseDraft, [], scope);
|
|
40040
|
-
}
|
|
40041
|
-
|
|
40042
|
-
scope.revoke();
|
|
40043
|
-
|
|
40044
|
-
if (scope.patches) {
|
|
40045
|
-
scope.patchListener(scope.patches, scope.inversePatches);
|
|
40046
|
-
}
|
|
40047
|
-
|
|
40048
|
-
return result !== NOTHING ? result : undefined;
|
|
40049
|
-
};
|
|
40050
|
-
/**
|
|
40051
|
-
* @internal
|
|
40052
|
-
* Finalize a draft, returning either the unmodified base state or a modified
|
|
40053
|
-
* copy of the base state.
|
|
40054
|
-
*/
|
|
40055
|
-
|
|
40056
|
-
|
|
40057
|
-
Immer.prototype.finalize = function finalize (draft, path, scope) {
|
|
40058
|
-
var this$1$1 = this;
|
|
40059
|
-
|
|
40060
|
-
var state = draft[DRAFT_STATE];
|
|
40061
|
-
|
|
40062
|
-
if (!state) {
|
|
40063
|
-
if (Object.isFrozen(draft)) { return draft; }
|
|
40064
|
-
return this.finalizeTree(draft, null, scope);
|
|
40065
|
-
} // Never finalize drafts owned by another scope.
|
|
40066
|
-
|
|
40067
|
-
|
|
40068
|
-
if (state.scope !== scope) {
|
|
40069
|
-
return draft;
|
|
40070
|
-
}
|
|
40071
|
-
|
|
40072
|
-
if (!state.modified) {
|
|
40073
|
-
return state.base;
|
|
40074
|
-
}
|
|
40075
|
-
|
|
40076
|
-
if (!state.finalized) {
|
|
40077
|
-
state.finalized = true;
|
|
40078
|
-
this.finalizeTree(state.draft, path, scope);
|
|
40079
|
-
|
|
40080
|
-
if (this.onDelete) {
|
|
40081
|
-
// The `assigned` object is unreliable with ES5 drafts.
|
|
40082
|
-
if (this.useProxies) {
|
|
40083
|
-
var assigned = state.assigned;
|
|
40084
|
-
|
|
40085
|
-
for (var prop in assigned) {
|
|
40086
|
-
if (!assigned[prop]) { this.onDelete(state, prop); }
|
|
40087
|
-
}
|
|
40088
|
-
} else {
|
|
40089
|
-
var base = state.base;
|
|
40090
|
-
var copy = state.copy;
|
|
40091
|
-
each(base, function (prop) {
|
|
40092
|
-
if (!has$1(copy, prop)) { this$1$1.onDelete(state, prop); }
|
|
40093
|
-
});
|
|
40094
|
-
}
|
|
40095
|
-
}
|
|
40096
|
-
|
|
40097
|
-
if (this.onCopy) {
|
|
40098
|
-
this.onCopy(state);
|
|
40099
|
-
} // At this point, all descendants of `state.copy` have been finalized,
|
|
40100
|
-
// so we can be sure that `scope.canAutoFreeze` is accurate.
|
|
40101
|
-
|
|
40102
|
-
|
|
40103
|
-
if (this.autoFreeze && scope.canAutoFreeze) {
|
|
40104
|
-
Object.freeze(state.copy);
|
|
40105
|
-
}
|
|
40106
|
-
|
|
40107
|
-
if (path && scope.patches) {
|
|
40108
|
-
generatePatches(state, path, scope.patches, scope.inversePatches);
|
|
40109
|
-
}
|
|
40110
|
-
}
|
|
40111
|
-
|
|
40112
|
-
return state.copy;
|
|
40113
|
-
};
|
|
40114
|
-
/**
|
|
40115
|
-
* @internal
|
|
40116
|
-
* Finalize all drafts in the given state tree.
|
|
40117
|
-
*/
|
|
40118
|
-
|
|
40119
|
-
|
|
40120
|
-
Immer.prototype.finalizeTree = function finalizeTree (root, rootPath, scope) {
|
|
40121
|
-
var this$1$1 = this;
|
|
40122
|
-
|
|
40123
|
-
var state = root[DRAFT_STATE];
|
|
40124
|
-
|
|
40125
|
-
if (state) {
|
|
40126
|
-
if (!this.useProxies) {
|
|
40127
|
-
// Create the final copy, with added keys and without deleted keys.
|
|
40128
|
-
state.copy = shallowCopy(state.draft, true);
|
|
40129
|
-
}
|
|
40130
|
-
|
|
40131
|
-
root = state.copy;
|
|
40132
|
-
}
|
|
40133
|
-
|
|
40134
|
-
var needPatches = !!rootPath && !!scope.patches;
|
|
40135
|
-
|
|
40136
|
-
var finalizeProperty = function (prop, value, parent) {
|
|
40137
|
-
if (value === parent) {
|
|
40138
|
-
throw Error("Immer forbids circular references");
|
|
40139
|
-
} // In the `finalizeTree` method, only the `root` object may be a draft.
|
|
40140
|
-
|
|
40141
|
-
|
|
40142
|
-
var isDraftProp = !!state && parent === root;
|
|
40143
|
-
|
|
40144
|
-
if (isDraft(value)) {
|
|
40145
|
-
var path = isDraftProp && needPatches && !state.assigned[prop] ? rootPath.concat(prop) : null; // Drafts owned by `scope` are finalized here.
|
|
40146
|
-
|
|
40147
|
-
value = this$1$1.finalize(value, path, scope); // Drafts from another scope must prevent auto-freezing.
|
|
40148
|
-
|
|
40149
|
-
if (isDraft(value)) {
|
|
40150
|
-
scope.canAutoFreeze = false;
|
|
40151
|
-
} // Preserve non-enumerable properties.
|
|
40152
|
-
|
|
40153
|
-
|
|
40154
|
-
if (Array.isArray(parent) || isEnumerable(parent, prop)) {
|
|
40155
|
-
parent[prop] = value;
|
|
40156
|
-
} else {
|
|
40157
|
-
Object.defineProperty(parent, prop, {
|
|
40158
|
-
value: value
|
|
40159
|
-
});
|
|
40160
|
-
} // Unchanged drafts are never passed to the `onAssign` hook.
|
|
40161
|
-
|
|
40162
|
-
|
|
40163
|
-
if (isDraftProp && value === state.base[prop]) { return; }
|
|
40164
|
-
} // Unchanged draft properties are ignored.
|
|
40165
|
-
else if (isDraftProp && is(value, state.base[prop])) {
|
|
40166
|
-
return;
|
|
40167
|
-
} // Search new objects for unfinalized drafts. Frozen objects should never contain drafts.
|
|
40168
|
-
else if (isDraftable(value) && !Object.isFrozen(value)) {
|
|
40169
|
-
each(value, finalizeProperty);
|
|
40170
|
-
}
|
|
40171
|
-
|
|
40172
|
-
if (isDraftProp && this$1$1.onAssign) {
|
|
40173
|
-
this$1$1.onAssign(state, prop, value);
|
|
40174
|
-
}
|
|
40175
|
-
};
|
|
40176
|
-
|
|
40177
|
-
each(root, finalizeProperty);
|
|
40178
|
-
return root;
|
|
40179
|
-
};
|
|
40180
|
-
|
|
40181
|
-
var immer = new Immer();
|
|
40182
|
-
/**
|
|
40183
|
-
* The `produce` function takes a value and a "recipe function" (whose
|
|
40184
|
-
* return value often depends on the base state). The recipe function is
|
|
40185
|
-
* free to mutate its first argument however it wants. All mutations are
|
|
40186
|
-
* only ever applied to a __copy__ of the base state.
|
|
40187
|
-
*
|
|
40188
|
-
* Pass only a function to create a "curried producer" which relieves you
|
|
40189
|
-
* from passing the recipe function every time.
|
|
40190
|
-
*
|
|
40191
|
-
* Only plain objects and arrays are made mutable. All other objects are
|
|
40192
|
-
* considered uncopyable.
|
|
40193
|
-
*
|
|
40194
|
-
* Note: This function is __bound__ to its `Immer` instance.
|
|
40195
|
-
*
|
|
40196
|
-
* @param {any} base - the initial state
|
|
40197
|
-
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
|
|
40198
|
-
* @param {Function} patchListener - optional function that will be called with all the patches produced here
|
|
40199
|
-
* @returns {any} a new state, or the initial state if nothing was modified
|
|
40200
|
-
*/
|
|
40201
|
-
|
|
40202
|
-
var produce = immer.produce;
|
|
40203
|
-
/**
|
|
40204
|
-
* Like `produce`, but `produceWithPatches` always returns a tuple
|
|
40205
|
-
* [nextState, patches, inversePatches] (instead of just the next state)
|
|
40206
|
-
*/
|
|
40207
|
-
|
|
40208
|
-
immer.produceWithPatches.bind(immer);
|
|
40209
|
-
/**
|
|
40210
|
-
* Pass true to automatically freeze all copies created by Immer.
|
|
40211
|
-
*
|
|
40212
|
-
* By default, auto-freezing is disabled in production.
|
|
40213
|
-
*/
|
|
40214
|
-
|
|
40215
|
-
immer.setAutoFreeze.bind(immer);
|
|
40216
|
-
/**
|
|
40217
|
-
* Pass true to use the ES2015 `Proxy` class when creating drafts, which is
|
|
40218
|
-
* always faster than using ES5 proxies.
|
|
40219
|
-
*
|
|
40220
|
-
* By default, feature detection is used, so calling this is rarely necessary.
|
|
40221
|
-
*/
|
|
40222
|
-
|
|
40223
|
-
immer.setUseProxies.bind(immer);
|
|
40224
|
-
/**
|
|
40225
|
-
* Apply an array of Immer patches to the first argument.
|
|
40226
|
-
*
|
|
40227
|
-
* This function is a producer, which means copy-on-write is in effect.
|
|
40228
|
-
*/
|
|
40229
|
-
|
|
40230
|
-
immer.applyPatches.bind(immer);
|
|
40231
|
-
/**
|
|
40232
|
-
* Create an Immer draft from the given base state, which may be a draft itself.
|
|
40233
|
-
* The draft can be modified until you finalize it with the `finishDraft` function.
|
|
40234
|
-
*/
|
|
40235
|
-
|
|
40236
|
-
immer.createDraft.bind(immer);
|
|
40237
|
-
/**
|
|
40238
|
-
* Finalize an Immer draft from a `createDraft` call, returning the base state
|
|
40239
|
-
* (if no changes were made) or a modified copy. The draft must *not* be
|
|
40240
|
-
* mutated afterwards.
|
|
40241
|
-
*
|
|
40242
|
-
* Pass a function as the 2nd argument to generate Immer patches based on the
|
|
40243
|
-
* changes that were made.
|
|
40244
|
-
*/
|
|
40245
|
-
|
|
40246
|
-
immer.finishDraft.bind(immer);
|
|
40247
|
-
|
|
40248
|
-
const createInitialState = formConfig => {
|
|
39113
|
+
const createInitialState = (formConfig) => {
|
|
40249
39114
|
let initialForm = {};
|
|
40250
39115
|
const formConfigKeys = Object.keys(formConfig);
|
|
40251
39116
|
for (let formKey of formConfigKeys) {
|
|
40252
39117
|
initialForm[formKey] = {
|
|
40253
39118
|
dirty: false,
|
|
40254
|
-
rawValue: formConfig[formKey].defaultValue ||
|
|
39119
|
+
rawValue: formConfig[formKey].defaultValue || '',
|
|
40255
39120
|
validators: formConfig[formKey].validators || [],
|
|
40256
|
-
constraints: formConfig[formKey].constraints || []
|
|
39121
|
+
constraints: formConfig[formKey].constraints || [],
|
|
40257
39122
|
};
|
|
40258
39123
|
}
|
|
40259
39124
|
// Because validators require the entire form we have to do a
|
|
@@ -40264,82 +39129,99 @@ const createInitialState = formConfig => {
|
|
|
40264
39129
|
initialForm[formKey].errors = errors;
|
|
40265
39130
|
initialForm[formKey].hasErrors = errors.length > 0;
|
|
40266
39131
|
}
|
|
39132
|
+
|
|
40267
39133
|
return initialForm;
|
|
40268
39134
|
};
|
|
40269
39135
|
|
|
40270
|
-
const SET =
|
|
40271
|
-
const set$
|
|
39136
|
+
const SET = 'field/SET';
|
|
39137
|
+
const set$1 = (fieldName) => (value) => ({
|
|
40272
39138
|
type: SET,
|
|
40273
|
-
payload: { fieldName, value }
|
|
39139
|
+
payload: { fieldName, value },
|
|
40274
39140
|
});
|
|
40275
39141
|
|
|
40276
|
-
const CLEAR =
|
|
39142
|
+
const CLEAR = 'form/CLEAR';
|
|
40277
39143
|
const clear = () => ({ type: CLEAR });
|
|
40278
39144
|
|
|
40279
|
-
const ADD_VALIDATOR =
|
|
40280
|
-
const addValidator = fieldName => validator => ({
|
|
39145
|
+
const ADD_VALIDATOR = 'field/ADD_VALIDATOR';
|
|
39146
|
+
const addValidator = (fieldName) => (validator) => ({
|
|
40281
39147
|
type: ADD_VALIDATOR,
|
|
40282
|
-
payload: { fieldName, validator }
|
|
39148
|
+
payload: { fieldName, validator },
|
|
40283
39149
|
});
|
|
40284
39150
|
|
|
40285
|
-
const
|
|
40286
|
-
|
|
40287
|
-
|
|
40288
|
-
|
|
40289
|
-
|
|
40290
|
-
case SET:
|
|
40291
|
-
const changedFieldName = action.payload.fieldName;
|
|
40292
|
-
const newRawValue = action.payload.value;
|
|
40293
|
-
|
|
40294
|
-
return produce(state, draftState => {
|
|
40295
|
-
let originalValue = draftState[changedFieldName].rawValue;
|
|
40296
|
-
draftState[changedFieldName].rawValue = newRawValue;
|
|
40297
|
-
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
40298
|
-
// If the change violates constraints, revert the change
|
|
40299
|
-
draftState[changedFieldName].rawValue = originalValue;
|
|
40300
|
-
return draftState;
|
|
40301
|
-
}
|
|
39151
|
+
const REMOVE_VALIDATOR = 'field/REMOVE_VALIDATOR';
|
|
39152
|
+
const removeValidator = (fieldName) => (validator) => ({
|
|
39153
|
+
type: REMOVE_VALIDATOR,
|
|
39154
|
+
payload: { fieldName, validator },
|
|
39155
|
+
});
|
|
40302
39156
|
|
|
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
|
-
|
|
40329
|
-
|
|
40330
|
-
|
|
40331
|
-
|
|
40332
|
-
|
|
40333
|
-
|
|
40334
|
-
|
|
40335
|
-
|
|
40336
|
-
|
|
39157
|
+
const CLEAR_FIELD_VALIDATORS = 'field/CLEAR_FIELD_VALIDATORS';
|
|
39158
|
+
const clearFieldValidators = (fieldName) => () => ({
|
|
39159
|
+
type: CLEAR_FIELD_VALIDATORS,
|
|
39160
|
+
payload: { fieldName },
|
|
39161
|
+
});
|
|
39162
|
+
|
|
39163
|
+
const createFormReducer =
|
|
39164
|
+
(formConfig) =>
|
|
39165
|
+
(state = createInitialState(formConfig), action) => {
|
|
39166
|
+
switch (action.type) {
|
|
39167
|
+
case SET: {
|
|
39168
|
+
const changedFieldName = action.payload.fieldName;
|
|
39169
|
+
const newRawValue = action.payload.value;
|
|
39170
|
+
|
|
39171
|
+
return produce(state, (draftState) => {
|
|
39172
|
+
let originalValue = draftState[changedFieldName].rawValue;
|
|
39173
|
+
draftState[changedFieldName].rawValue = newRawValue;
|
|
39174
|
+
if (computeConstraints(changedFieldName, draftState).length > 0) {
|
|
39175
|
+
// If the change violates constraints, revert the change
|
|
39176
|
+
draftState[changedFieldName].rawValue = originalValue;
|
|
39177
|
+
return draftState;
|
|
39178
|
+
}
|
|
39179
|
+
|
|
39180
|
+
computeDirtyEntries(draftState, changedFieldName);
|
|
39181
|
+
computeErrorEntries(draftState);
|
|
39182
|
+
});
|
|
39183
|
+
}
|
|
39184
|
+
case CLEAR:
|
|
39185
|
+
return createInitialState(formConfig);
|
|
39186
|
+
case ADD_VALIDATOR: {
|
|
39187
|
+
const fieldWithOverride = action.payload.fieldName;
|
|
39188
|
+
const newValidator = action.payload.validator;
|
|
39189
|
+
|
|
39190
|
+
return produce(state, (draftState) => {
|
|
39191
|
+
draftState[fieldWithOverride].validators.push(newValidator);
|
|
39192
|
+
computeErrorEntries(draftState);
|
|
39193
|
+
});
|
|
39194
|
+
}
|
|
39195
|
+
case REMOVE_VALIDATOR: {
|
|
39196
|
+
const fieldToOverride = action.payload.fieldName;
|
|
39197
|
+
const targetValidator = action.payload.validator;
|
|
39198
|
+
|
|
39199
|
+
return produce(state, (draftState) => {
|
|
39200
|
+
let fieldValidators = draftState[fieldToOverride].validators;
|
|
39201
|
+
draftState[fieldToOverride].validators = fieldValidators.filter(
|
|
39202
|
+
(validator) => validator.type !== targetValidator.type
|
|
39203
|
+
);
|
|
39204
|
+
computeErrorEntries(draftState);
|
|
39205
|
+
});
|
|
39206
|
+
}
|
|
39207
|
+
case CLEAR_FIELD_VALIDATORS: {
|
|
39208
|
+
const fieldToClear = action.payload.fieldName;
|
|
39209
|
+
|
|
39210
|
+
return produce(state, (draftState) => {
|
|
39211
|
+
draftState[fieldToClear].validators = [];
|
|
39212
|
+
computeErrorEntries(draftState);
|
|
39213
|
+
});
|
|
39214
|
+
}
|
|
39215
|
+
default:
|
|
39216
|
+
return state;
|
|
39217
|
+
}
|
|
39218
|
+
};
|
|
40337
39219
|
|
|
40338
|
-
const createMapDispatchToProps = formConfig => {
|
|
39220
|
+
const createMapDispatchToProps = (formConfig) => {
|
|
40339
39221
|
// Do memo-ization
|
|
40340
39222
|
let cachedDispatch;
|
|
40341
39223
|
let cacheValue;
|
|
40342
|
-
return dispatch => {
|
|
39224
|
+
return (dispatch) => {
|
|
40343
39225
|
if (dispatch == cachedDispatch) {
|
|
40344
39226
|
return cacheValue;
|
|
40345
39227
|
}
|
|
@@ -40348,8 +39230,11 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40348
39230
|
const keys = Object.keys(formConfig);
|
|
40349
39231
|
for (let fieldName of keys) {
|
|
40350
39232
|
dispatchObj.fields[fieldName] = {
|
|
40351
|
-
set: value => dispatch(set$
|
|
40352
|
-
addValidator: validator => dispatch(addValidator(fieldName)(validator))
|
|
39233
|
+
set: (value) => dispatch(set$1(fieldName)(value)),
|
|
39234
|
+
addValidator: (validator) => dispatch(addValidator(fieldName)(validator)),
|
|
39235
|
+
removeValidator: (validator) =>
|
|
39236
|
+
dispatch(removeValidator(fieldName)(validator)),
|
|
39237
|
+
clear: () => dispatch(clearFieldValidators(fieldName)()),
|
|
40353
39238
|
};
|
|
40354
39239
|
}
|
|
40355
39240
|
dispatchObj.form = { clear: () => dispatch(clear()) };
|
|
@@ -40359,12 +39244,12 @@ const createMapDispatchToProps = formConfig => {
|
|
|
40359
39244
|
};
|
|
40360
39245
|
};
|
|
40361
39246
|
|
|
40362
|
-
const mapStateToProps = state => ({ fields: state });
|
|
39247
|
+
const mapStateToProps = (state) => ({ fields: state });
|
|
40363
39248
|
|
|
40364
|
-
const createFormState = formConfig => ({
|
|
39249
|
+
const createFormState = (formConfig) => ({
|
|
40365
39250
|
reducer: createFormReducer(formConfig),
|
|
40366
39251
|
mapDispatchToProps: createMapDispatchToProps(formConfig),
|
|
40367
|
-
mapStateToProps: mapStateToProps
|
|
39252
|
+
mapStateToProps: mapStateToProps,
|
|
40368
39253
|
});
|
|
40369
39254
|
|
|
40370
39255
|
var AddressForm = function AddressForm(_ref) {
|
|
@@ -43230,12 +42115,12 @@ LoginForm.mapDispatchToProps = mapDispatchToProps$5;
|
|
|
43230
42115
|
* This source code is licensed under the MIT license found in the
|
|
43231
42116
|
* LICENSE file in the root directory of this source tree.
|
|
43232
42117
|
*/
|
|
43233
|
-
var b$
|
|
43234
|
-
Symbol.for("react.suspense_list"):60120,r=b$
|
|
43235
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$
|
|
43236
|
-
var Profiler=g;var StrictMode=f$
|
|
43237
|
-
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$
|
|
43238
|
-
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f$
|
|
42118
|
+
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?
|
|
42119
|
+
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;
|
|
42120
|
+
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;
|
|
42121
|
+
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};
|
|
42122
|
+
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};
|
|
42123
|
+
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;
|
|
43239
42124
|
|
|
43240
42125
|
var reactIs_production_min = {
|
|
43241
42126
|
AsyncMode: AsyncMode,
|
|
@@ -43606,14 +42491,14 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
|
43606
42491
|
|
|
43607
42492
|
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
43608
42493
|
|
|
43609
|
-
var has$
|
|
42494
|
+
var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
43610
42495
|
|
|
43611
42496
|
var printWarning = function() {};
|
|
43612
42497
|
|
|
43613
42498
|
if (process.env.NODE_ENV !== 'production') {
|
|
43614
42499
|
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
43615
42500
|
var loggedTypeFailures = {};
|
|
43616
|
-
var has$
|
|
42501
|
+
var has$2 = has$1;
|
|
43617
42502
|
|
|
43618
42503
|
printWarning = function(text) {
|
|
43619
42504
|
var message = 'Warning: ' + text;
|
|
@@ -43643,7 +42528,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
43643
42528
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
43644
42529
|
if (process.env.NODE_ENV !== 'production') {
|
|
43645
42530
|
for (var typeSpecName in typeSpecs) {
|
|
43646
|
-
if (has$
|
|
42531
|
+
if (has$2(typeSpecs, typeSpecName)) {
|
|
43647
42532
|
var error;
|
|
43648
42533
|
// Prop type validation may throw. In case they do, we don't want to
|
|
43649
42534
|
// fail the render phase where it didn't fail before. So we log it.
|
|
@@ -44042,7 +42927,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44042
42927
|
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
44043
42928
|
}
|
|
44044
42929
|
for (var key in propValue) {
|
|
44045
|
-
if (has$
|
|
42930
|
+
if (has$1(propValue, key)) {
|
|
44046
42931
|
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
44047
42932
|
if (error instanceof Error) {
|
|
44048
42933
|
return error;
|
|
@@ -44079,7 +42964,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44079
42964
|
if (checkerResult == null) {
|
|
44080
42965
|
return null;
|
|
44081
42966
|
}
|
|
44082
|
-
if (checkerResult.data && has$
|
|
42967
|
+
if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
|
|
44083
42968
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
44084
42969
|
}
|
|
44085
42970
|
}
|
|
@@ -44139,7 +43024,7 @@ var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
|
44139
43024
|
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
44140
43025
|
for (var key in allKeys) {
|
|
44141
43026
|
var checker = shapeTypes[key];
|
|
44142
|
-
if (has$
|
|
43027
|
+
if (has$1(shapeTypes, key) && typeof checker !== 'function') {
|
|
44143
43028
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
44144
43029
|
}
|
|
44145
43030
|
if (!checker) {
|
|
@@ -44877,7 +43762,7 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
44877
43762
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
44878
43763
|
*/
|
|
44879
43764
|
|
|
44880
|
-
function ownKeys$
|
|
43765
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
44881
43766
|
var keys = Object.keys(object);
|
|
44882
43767
|
|
|
44883
43768
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -44893,9 +43778,9 @@ function ownKeys$3(object, enumerableOnly) {
|
|
|
44893
43778
|
function _objectSpread2$1(target) {
|
|
44894
43779
|
for (var i = 1; i < arguments.length; i++) {
|
|
44895
43780
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
44896
|
-
i % 2 ? ownKeys$
|
|
43781
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
44897
43782
|
_defineProperty$1(target, key, source[key]);
|
|
44898
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$
|
|
43783
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
44899
43784
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44900
43785
|
});
|
|
44901
43786
|
}
|