@trackunit/custom-field-components 0.0.223 → 0.0.225

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/index.js CHANGED
@@ -6,1846 +6,6 @@ import * as React from 'react';
6
6
  import { useCallback, useEffect, useState } from 'react';
7
7
  import { isValidPhoneNumber } from 'libphonenumber-js';
8
8
 
9
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
-
11
- var fails$h = function (exec) {
12
- try {
13
- return !!exec();
14
- } catch (error) {
15
- return true;
16
- }
17
- };
18
-
19
- var fails$g = fails$h;
20
-
21
- var functionBindNative = !fails$g(function () {
22
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
23
- var test = (function () { /* empty */ }).bind();
24
- // eslint-disable-next-line no-prototype-builtins -- safe
25
- return typeof test != 'function' || test.hasOwnProperty('prototype');
26
- });
27
-
28
- var NATIVE_BIND$1 = functionBindNative;
29
-
30
- var FunctionPrototype$1 = Function.prototype;
31
- var call$8 = FunctionPrototype$1.call;
32
- var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$8, call$8);
33
-
34
- var functionUncurryThis = NATIVE_BIND$1 ? uncurryThisWithBind : function (fn) {
35
- return function () {
36
- return call$8.apply(fn, arguments);
37
- };
38
- };
39
-
40
- var uncurryThis$e = functionUncurryThis;
41
-
42
- var toString$7 = uncurryThis$e({}.toString);
43
- var stringSlice$3 = uncurryThis$e(''.slice);
44
-
45
- var classofRaw$1 = function (it) {
46
- return stringSlice$3(toString$7(it), 8, -1);
47
- };
48
-
49
- var uncurryThis$d = functionUncurryThis;
50
- var fails$f = fails$h;
51
- var classof$3 = classofRaw$1;
52
-
53
- var $Object$4 = Object;
54
- var split = uncurryThis$d(''.split);
55
-
56
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
57
- var indexedObject = fails$f(function () {
58
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
59
- // eslint-disable-next-line no-prototype-builtins -- safe
60
- return !$Object$4('z').propertyIsEnumerable(0);
61
- }) ? function (it) {
62
- return classof$3(it) == 'String' ? split(it, '') : $Object$4(it);
63
- } : $Object$4;
64
-
65
- // we can't use just `it == null` since of `document.all` special case
66
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
67
- var isNullOrUndefined$2 = function (it) {
68
- return it === null || it === undefined;
69
- };
70
-
71
- var isNullOrUndefined$1 = isNullOrUndefined$2;
72
-
73
- var $TypeError$6 = TypeError;
74
-
75
- // `RequireObjectCoercible` abstract operation
76
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
77
- var requireObjectCoercible$3 = function (it) {
78
- if (isNullOrUndefined$1(it)) throw $TypeError$6("Can't call method on " + it);
79
- return it;
80
- };
81
-
82
- // toObject with fallback for non-array-like ES3 strings
83
- var IndexedObject$1 = indexedObject;
84
- var requireObjectCoercible$2 = requireObjectCoercible$3;
85
-
86
- var toIndexedObject$5 = function (it) {
87
- return IndexedObject$1(requireObjectCoercible$2(it));
88
- };
89
-
90
- var check = function (it) {
91
- return it && it.Math == Math && it;
92
- };
93
-
94
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
95
- var global$h =
96
- // eslint-disable-next-line es/no-global-this -- safe
97
- check(typeof globalThis == 'object' && globalThis) ||
98
- check(typeof window == 'object' && window) ||
99
- // eslint-disable-next-line no-restricted-globals -- safe
100
- check(typeof self == 'object' && self) ||
101
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
102
- // eslint-disable-next-line no-new-func -- fallback
103
- (function () { return this; })() || Function('return this')();
104
-
105
- var shared$4 = {exports: {}};
106
-
107
- var global$g = global$h;
108
-
109
- // eslint-disable-next-line es/no-object-defineproperty -- safe
110
- var defineProperty$7 = Object.defineProperty;
111
-
112
- var defineGlobalProperty$3 = function (key, value) {
113
- try {
114
- defineProperty$7(global$g, key, { value: value, configurable: true, writable: true });
115
- } catch (error) {
116
- global$g[key] = value;
117
- } return value;
118
- };
119
-
120
- var global$f = global$h;
121
- var defineGlobalProperty$2 = defineGlobalProperty$3;
122
-
123
- var SHARED = '__core-js_shared__';
124
- var store$3 = global$f[SHARED] || defineGlobalProperty$2(SHARED, {});
125
-
126
- var sharedStore = store$3;
127
-
128
- var store$2 = sharedStore;
129
-
130
- (shared$4.exports = function (key, value) {
131
- return store$2[key] || (store$2[key] = value !== undefined ? value : {});
132
- })('versions', []).push({
133
- version: '3.26.1',
134
- mode: 'global',
135
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
136
- license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
137
- source: 'https://github.com/zloirock/core-js'
138
- });
139
-
140
- var requireObjectCoercible$1 = requireObjectCoercible$3;
141
-
142
- var $Object$3 = Object;
143
-
144
- // `ToObject` abstract operation
145
- // https://tc39.es/ecma262/#sec-toobject
146
- var toObject$3 = function (argument) {
147
- return $Object$3(requireObjectCoercible$1(argument));
148
- };
149
-
150
- var uncurryThis$c = functionUncurryThis;
151
- var toObject$2 = toObject$3;
152
-
153
- var hasOwnProperty = uncurryThis$c({}.hasOwnProperty);
154
-
155
- // `HasOwnProperty` abstract operation
156
- // https://tc39.es/ecma262/#sec-hasownproperty
157
- // eslint-disable-next-line es/no-object-hasown -- safe
158
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
159
- return hasOwnProperty(toObject$2(it), key);
160
- };
161
-
162
- var uncurryThis$b = functionUncurryThis;
163
-
164
- var id = 0;
165
- var postfix = Math.random();
166
- var toString$6 = uncurryThis$b(1.0.toString);
167
-
168
- var uid$2 = function (key) {
169
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$6(++id + postfix, 36);
170
- };
171
-
172
- var documentAll$2 = typeof document == 'object' && document.all;
173
-
174
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
175
- var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
176
-
177
- var documentAll_1 = {
178
- all: documentAll$2,
179
- IS_HTMLDDA: IS_HTMLDDA
180
- };
181
-
182
- var $documentAll$1 = documentAll_1;
183
-
184
- var documentAll$1 = $documentAll$1.all;
185
-
186
- // `IsCallable` abstract operation
187
- // https://tc39.es/ecma262/#sec-iscallable
188
- var isCallable$h = $documentAll$1.IS_HTMLDDA ? function (argument) {
189
- return typeof argument == 'function' || argument === documentAll$1;
190
- } : function (argument) {
191
- return typeof argument == 'function';
192
- };
193
-
194
- var global$e = global$h;
195
- var isCallable$g = isCallable$h;
196
-
197
- var aFunction = function (argument) {
198
- return isCallable$g(argument) ? argument : undefined;
199
- };
200
-
201
- var getBuiltIn$5 = function (namespace, method) {
202
- return arguments.length < 2 ? aFunction(global$e[namespace]) : global$e[namespace] && global$e[namespace][method];
203
- };
204
-
205
- var getBuiltIn$4 = getBuiltIn$5;
206
-
207
- var engineUserAgent = getBuiltIn$4('navigator', 'userAgent') || '';
208
-
209
- var global$d = global$h;
210
- var userAgent = engineUserAgent;
211
-
212
- var process = global$d.process;
213
- var Deno = global$d.Deno;
214
- var versions = process && process.versions || Deno && Deno.version;
215
- var v8 = versions && versions.v8;
216
- var match, version;
217
-
218
- if (v8) {
219
- match = v8.split('.');
220
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
221
- // but their correct versions are not interesting for us
222
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
223
- }
224
-
225
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
226
- // so check `userAgent` even if `.v8` exists, but 0
227
- if (!version && userAgent) {
228
- match = userAgent.match(/Edge\/(\d+)/);
229
- if (!match || match[1] >= 74) {
230
- match = userAgent.match(/Chrome\/(\d+)/);
231
- if (match) version = +match[1];
232
- }
233
- }
234
-
235
- var engineV8Version = version;
236
-
237
- /* eslint-disable es/no-symbol -- required for testing */
238
-
239
- var V8_VERSION = engineV8Version;
240
- var fails$e = fails$h;
241
-
242
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
243
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
244
- var symbol = Symbol();
245
- // Chrome 38 Symbol has incorrect toString conversion
246
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
247
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
248
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
249
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
250
- });
251
-
252
- /* eslint-disable es/no-symbol -- required for testing */
253
-
254
- var NATIVE_SYMBOL$2 = symbolConstructorDetection;
255
-
256
- var useSymbolAsUid = NATIVE_SYMBOL$2
257
- && !Symbol.sham
258
- && typeof Symbol.iterator == 'symbol';
259
-
260
- var global$c = global$h;
261
- var shared$3 = shared$4.exports;
262
- var hasOwn$b = hasOwnProperty_1;
263
- var uid$1 = uid$2;
264
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
265
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
266
-
267
- var WellKnownSymbolsStore = shared$3('wks');
268
- var Symbol$2 = global$c.Symbol;
269
- var symbolFor = Symbol$2 && Symbol$2['for'];
270
- var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$2 : Symbol$2 && Symbol$2.withoutSetter || uid$1;
271
-
272
- var wellKnownSymbol$b = function (name) {
273
- if (!hasOwn$b(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL$1 || typeof WellKnownSymbolsStore[name] == 'string')) {
274
- var description = 'Symbol.' + name;
275
- if (NATIVE_SYMBOL$1 && hasOwn$b(Symbol$2, name)) {
276
- WellKnownSymbolsStore[name] = Symbol$2[name];
277
- } else if (USE_SYMBOL_AS_UID$1 && symbolFor) {
278
- WellKnownSymbolsStore[name] = symbolFor(description);
279
- } else {
280
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
281
- }
282
- } return WellKnownSymbolsStore[name];
283
- };
284
-
285
- var isCallable$f = isCallable$h;
286
- var $documentAll = documentAll_1;
287
-
288
- var documentAll = $documentAll.all;
289
-
290
- var isObject$8 = $documentAll.IS_HTMLDDA ? function (it) {
291
- return typeof it == 'object' ? it !== null : isCallable$f(it) || it === documentAll;
292
- } : function (it) {
293
- return typeof it == 'object' ? it !== null : isCallable$f(it);
294
- };
295
-
296
- var isObject$7 = isObject$8;
297
-
298
- var $String$3 = String;
299
- var $TypeError$5 = TypeError;
300
-
301
- // `Assert: Type(argument) is Object`
302
- var anObject$7 = function (argument) {
303
- if (isObject$7(argument)) return argument;
304
- throw $TypeError$5($String$3(argument) + ' is not an object');
305
- };
306
-
307
- var objectDefineProperties = {};
308
-
309
- var fails$d = fails$h;
310
-
311
- // Detect IE8's incomplete defineProperty implementation
312
- var descriptors = !fails$d(function () {
313
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
314
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
315
- });
316
-
317
- var DESCRIPTORS$c = descriptors;
318
- var fails$c = fails$h;
319
-
320
- // V8 ~ Chrome 36-
321
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
322
- var v8PrototypeDefineBug = DESCRIPTORS$c && fails$c(function () {
323
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
324
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
325
- value: 42,
326
- writable: false
327
- }).prototype != 42;
328
- });
329
-
330
- var objectDefineProperty = {};
331
-
332
- var global$b = global$h;
333
- var isObject$6 = isObject$8;
334
-
335
- var document$1 = global$b.document;
336
- // typeof document.createElement is 'object' in old IE
337
- var EXISTS$1 = isObject$6(document$1) && isObject$6(document$1.createElement);
338
-
339
- var documentCreateElement$2 = function (it) {
340
- return EXISTS$1 ? document$1.createElement(it) : {};
341
- };
342
-
343
- var DESCRIPTORS$b = descriptors;
344
- var fails$b = fails$h;
345
- var createElement = documentCreateElement$2;
346
-
347
- // Thanks to IE8 for its funny defineProperty
348
- var ie8DomDefine = !DESCRIPTORS$b && !fails$b(function () {
349
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
350
- return Object.defineProperty(createElement('div'), 'a', {
351
- get: function () { return 7; }
352
- }).a != 7;
353
- });
354
-
355
- var NATIVE_BIND = functionBindNative;
356
-
357
- var call$7 = Function.prototype.call;
358
-
359
- var functionCall = NATIVE_BIND ? call$7.bind(call$7) : function () {
360
- return call$7.apply(call$7, arguments);
361
- };
362
-
363
- var uncurryThis$a = functionUncurryThis;
364
-
365
- var objectIsPrototypeOf = uncurryThis$a({}.isPrototypeOf);
366
-
367
- var getBuiltIn$3 = getBuiltIn$5;
368
- var isCallable$e = isCallable$h;
369
- var isPrototypeOf$3 = objectIsPrototypeOf;
370
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
371
-
372
- var $Object$2 = Object;
373
-
374
- var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
375
- return typeof it == 'symbol';
376
- } : function (it) {
377
- var $Symbol = getBuiltIn$3('Symbol');
378
- return isCallable$e($Symbol) && isPrototypeOf$3($Symbol.prototype, $Object$2(it));
379
- };
380
-
381
- var $String$2 = String;
382
-
383
- var tryToString$1 = function (argument) {
384
- try {
385
- return $String$2(argument);
386
- } catch (error) {
387
- return 'Object';
388
- }
389
- };
390
-
391
- var isCallable$d = isCallable$h;
392
- var tryToString = tryToString$1;
393
-
394
- var $TypeError$4 = TypeError;
395
-
396
- // `Assert: IsCallable(argument) is true`
397
- var aCallable$1 = function (argument) {
398
- if (isCallable$d(argument)) return argument;
399
- throw $TypeError$4(tryToString(argument) + ' is not a function');
400
- };
401
-
402
- var aCallable = aCallable$1;
403
- var isNullOrUndefined = isNullOrUndefined$2;
404
-
405
- // `GetMethod` abstract operation
406
- // https://tc39.es/ecma262/#sec-getmethod
407
- var getMethod$1 = function (V, P) {
408
- var func = V[P];
409
- return isNullOrUndefined(func) ? undefined : aCallable(func);
410
- };
411
-
412
- var call$6 = functionCall;
413
- var isCallable$c = isCallable$h;
414
- var isObject$5 = isObject$8;
415
-
416
- var $TypeError$3 = TypeError;
417
-
418
- // `OrdinaryToPrimitive` abstract operation
419
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
420
- var ordinaryToPrimitive$1 = function (input, pref) {
421
- var fn, val;
422
- if (pref === 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$6(fn, input))) return val;
423
- if (isCallable$c(fn = input.valueOf) && !isObject$5(val = call$6(fn, input))) return val;
424
- if (pref !== 'string' && isCallable$c(fn = input.toString) && !isObject$5(val = call$6(fn, input))) return val;
425
- throw $TypeError$3("Can't convert object to primitive value");
426
- };
427
-
428
- var call$5 = functionCall;
429
- var isObject$4 = isObject$8;
430
- var isSymbol$1 = isSymbol$2;
431
- var getMethod = getMethod$1;
432
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
433
- var wellKnownSymbol$a = wellKnownSymbol$b;
434
-
435
- var $TypeError$2 = TypeError;
436
- var TO_PRIMITIVE = wellKnownSymbol$a('toPrimitive');
437
-
438
- // `ToPrimitive` abstract operation
439
- // https://tc39.es/ecma262/#sec-toprimitive
440
- var toPrimitive$1 = function (input, pref) {
441
- if (!isObject$4(input) || isSymbol$1(input)) return input;
442
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
443
- var result;
444
- if (exoticToPrim) {
445
- if (pref === undefined) pref = 'default';
446
- result = call$5(exoticToPrim, input, pref);
447
- if (!isObject$4(result) || isSymbol$1(result)) return result;
448
- throw $TypeError$2("Can't convert object to primitive value");
449
- }
450
- if (pref === undefined) pref = 'number';
451
- return ordinaryToPrimitive(input, pref);
452
- };
453
-
454
- var toPrimitive = toPrimitive$1;
455
- var isSymbol = isSymbol$2;
456
-
457
- // `ToPropertyKey` abstract operation
458
- // https://tc39.es/ecma262/#sec-topropertykey
459
- var toPropertyKey$2 = function (argument) {
460
- var key = toPrimitive(argument, 'string');
461
- return isSymbol(key) ? key : key + '';
462
- };
463
-
464
- var DESCRIPTORS$a = descriptors;
465
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
466
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
467
- var anObject$6 = anObject$7;
468
- var toPropertyKey$1 = toPropertyKey$2;
469
-
470
- var $TypeError$1 = TypeError;
471
- // eslint-disable-next-line es/no-object-defineproperty -- safe
472
- var $defineProperty = Object.defineProperty;
473
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
474
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
475
- var ENUMERABLE = 'enumerable';
476
- var CONFIGURABLE$1 = 'configurable';
477
- var WRITABLE = 'writable';
478
-
479
- // `Object.defineProperty` method
480
- // https://tc39.es/ecma262/#sec-object.defineproperty
481
- objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
482
- anObject$6(O);
483
- P = toPropertyKey$1(P);
484
- anObject$6(Attributes);
485
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
486
- var current = $getOwnPropertyDescriptor$1(O, P);
487
- if (current && current[WRITABLE]) {
488
- O[P] = Attributes.value;
489
- Attributes = {
490
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
491
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
492
- writable: false
493
- };
494
- }
495
- } return $defineProperty(O, P, Attributes);
496
- } : $defineProperty : function defineProperty(O, P, Attributes) {
497
- anObject$6(O);
498
- P = toPropertyKey$1(P);
499
- anObject$6(Attributes);
500
- if (IE8_DOM_DEFINE$1) try {
501
- return $defineProperty(O, P, Attributes);
502
- } catch (error) { /* empty */ }
503
- if ('get' in Attributes || 'set' in Attributes) throw $TypeError$1('Accessors not supported');
504
- if ('value' in Attributes) O[P] = Attributes.value;
505
- return O;
506
- };
507
-
508
- var ceil = Math.ceil;
509
- var floor = Math.floor;
510
-
511
- // `Math.trunc` method
512
- // https://tc39.es/ecma262/#sec-math.trunc
513
- // eslint-disable-next-line es/no-math-trunc -- safe
514
- var mathTrunc = Math.trunc || function trunc(x) {
515
- var n = +x;
516
- return (n > 0 ? floor : ceil)(n);
517
- };
518
-
519
- var trunc = mathTrunc;
520
-
521
- // `ToIntegerOrInfinity` abstract operation
522
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
523
- var toIntegerOrInfinity$2 = function (argument) {
524
- var number = +argument;
525
- // eslint-disable-next-line no-self-compare -- NaN check
526
- return number !== number || number === 0 ? 0 : trunc(number);
527
- };
528
-
529
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
530
-
531
- var max = Math.max;
532
- var min$1 = Math.min;
533
-
534
- // Helper for a popular repeating case of the spec:
535
- // Let integer be ? ToInteger(index).
536
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
537
- var toAbsoluteIndex$1 = function (index, length) {
538
- var integer = toIntegerOrInfinity$1(index);
539
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
540
- };
541
-
542
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
543
-
544
- var min = Math.min;
545
-
546
- // `ToLength` abstract operation
547
- // https://tc39.es/ecma262/#sec-tolength
548
- var toLength$1 = function (argument) {
549
- return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
550
- };
551
-
552
- var toLength = toLength$1;
553
-
554
- // `LengthOfArrayLike` abstract operation
555
- // https://tc39.es/ecma262/#sec-lengthofarraylike
556
- var lengthOfArrayLike$1 = function (obj) {
557
- return toLength(obj.length);
558
- };
559
-
560
- var toIndexedObject$4 = toIndexedObject$5;
561
- var toAbsoluteIndex = toAbsoluteIndex$1;
562
- var lengthOfArrayLike = lengthOfArrayLike$1;
563
-
564
- // `Array.prototype.{ indexOf, includes }` methods implementation
565
- var createMethod$1 = function (IS_INCLUDES) {
566
- return function ($this, el, fromIndex) {
567
- var O = toIndexedObject$4($this);
568
- var length = lengthOfArrayLike(O);
569
- var index = toAbsoluteIndex(fromIndex, length);
570
- var value;
571
- // Array#includes uses SameValueZero equality algorithm
572
- // eslint-disable-next-line no-self-compare -- NaN check
573
- if (IS_INCLUDES && el != el) while (length > index) {
574
- value = O[index++];
575
- // eslint-disable-next-line no-self-compare -- NaN check
576
- if (value != value) return true;
577
- // Array#indexOf ignores holes, Array#includes - not
578
- } else for (;length > index; index++) {
579
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
580
- } return !IS_INCLUDES && -1;
581
- };
582
- };
583
-
584
- var arrayIncludes = {
585
- // `Array.prototype.includes` method
586
- // https://tc39.es/ecma262/#sec-array.prototype.includes
587
- includes: createMethod$1(true),
588
- // `Array.prototype.indexOf` method
589
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
590
- indexOf: createMethod$1(false)
591
- };
592
-
593
- var hiddenKeys$4 = {};
594
-
595
- var uncurryThis$9 = functionUncurryThis;
596
- var hasOwn$a = hasOwnProperty_1;
597
- var toIndexedObject$3 = toIndexedObject$5;
598
- var indexOf$1 = arrayIncludes.indexOf;
599
- var hiddenKeys$3 = hiddenKeys$4;
600
-
601
- var push = uncurryThis$9([].push);
602
-
603
- var objectKeysInternal = function (object, names) {
604
- var O = toIndexedObject$3(object);
605
- var i = 0;
606
- var result = [];
607
- var key;
608
- for (key in O) !hasOwn$a(hiddenKeys$3, key) && hasOwn$a(O, key) && push(result, key);
609
- // Don't enum bug & hidden keys
610
- while (names.length > i) if (hasOwn$a(O, key = names[i++])) {
611
- ~indexOf$1(result, key) || push(result, key);
612
- }
613
- return result;
614
- };
615
-
616
- // IE8- don't enum bug keys
617
- var enumBugKeys$3 = [
618
- 'constructor',
619
- 'hasOwnProperty',
620
- 'isPrototypeOf',
621
- 'propertyIsEnumerable',
622
- 'toLocaleString',
623
- 'toString',
624
- 'valueOf'
625
- ];
626
-
627
- var internalObjectKeys$1 = objectKeysInternal;
628
- var enumBugKeys$2 = enumBugKeys$3;
629
-
630
- // `Object.keys` method
631
- // https://tc39.es/ecma262/#sec-object.keys
632
- // eslint-disable-next-line es/no-object-keys -- safe
633
- var objectKeys$2 = Object.keys || function keys(O) {
634
- return internalObjectKeys$1(O, enumBugKeys$2);
635
- };
636
-
637
- var DESCRIPTORS$9 = descriptors;
638
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
639
- var definePropertyModule$4 = objectDefineProperty;
640
- var anObject$5 = anObject$7;
641
- var toIndexedObject$2 = toIndexedObject$5;
642
- var objectKeys$1 = objectKeys$2;
643
-
644
- // `Object.defineProperties` method
645
- // https://tc39.es/ecma262/#sec-object.defineproperties
646
- // eslint-disable-next-line es/no-object-defineproperties -- safe
647
- objectDefineProperties.f = DESCRIPTORS$9 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
648
- anObject$5(O);
649
- var props = toIndexedObject$2(Properties);
650
- var keys = objectKeys$1(Properties);
651
- var length = keys.length;
652
- var index = 0;
653
- var key;
654
- while (length > index) definePropertyModule$4.f(O, key = keys[index++], props[key]);
655
- return O;
656
- };
657
-
658
- var getBuiltIn$2 = getBuiltIn$5;
659
-
660
- var html$1 = getBuiltIn$2('document', 'documentElement');
661
-
662
- var shared$2 = shared$4.exports;
663
- var uid = uid$2;
664
-
665
- var keys$1 = shared$2('keys');
666
-
667
- var sharedKey$3 = function (key) {
668
- return keys$1[key] || (keys$1[key] = uid(key));
669
- };
670
-
671
- /* global ActiveXObject -- old IE, WSH */
672
-
673
- var anObject$4 = anObject$7;
674
- var definePropertiesModule = objectDefineProperties;
675
- var enumBugKeys$1 = enumBugKeys$3;
676
- var hiddenKeys$2 = hiddenKeys$4;
677
- var html = html$1;
678
- var documentCreateElement$1 = documentCreateElement$2;
679
- var sharedKey$2 = sharedKey$3;
680
-
681
- var GT = '>';
682
- var LT = '<';
683
- var PROTOTYPE = 'prototype';
684
- var SCRIPT = 'script';
685
- var IE_PROTO$1 = sharedKey$2('IE_PROTO');
686
-
687
- var EmptyConstructor = function () { /* empty */ };
688
-
689
- var scriptTag = function (content) {
690
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
691
- };
692
-
693
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
694
- var NullProtoObjectViaActiveX = function (activeXDocument) {
695
- activeXDocument.write(scriptTag(''));
696
- activeXDocument.close();
697
- var temp = activeXDocument.parentWindow.Object;
698
- activeXDocument = null; // avoid memory leak
699
- return temp;
700
- };
701
-
702
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
703
- var NullProtoObjectViaIFrame = function () {
704
- // Thrash, waste and sodomy: IE GC bug
705
- var iframe = documentCreateElement$1('iframe');
706
- var JS = 'java' + SCRIPT + ':';
707
- var iframeDocument;
708
- iframe.style.display = 'none';
709
- html.appendChild(iframe);
710
- // https://github.com/zloirock/core-js/issues/475
711
- iframe.src = String(JS);
712
- iframeDocument = iframe.contentWindow.document;
713
- iframeDocument.open();
714
- iframeDocument.write(scriptTag('document.F=Object'));
715
- iframeDocument.close();
716
- return iframeDocument.F;
717
- };
718
-
719
- // Check for document.domain and active x support
720
- // No need to use active x approach when document.domain is not set
721
- // see https://github.com/es-shims/es5-shim/issues/150
722
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
723
- // avoid IE GC bug
724
- var activeXDocument;
725
- var NullProtoObject = function () {
726
- try {
727
- activeXDocument = new ActiveXObject('htmlfile');
728
- } catch (error) { /* ignore */ }
729
- NullProtoObject = typeof document != 'undefined'
730
- ? document.domain && activeXDocument
731
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
732
- : NullProtoObjectViaIFrame()
733
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
734
- var length = enumBugKeys$1.length;
735
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys$1[length]];
736
- return NullProtoObject();
737
- };
738
-
739
- hiddenKeys$2[IE_PROTO$1] = true;
740
-
741
- // `Object.create` method
742
- // https://tc39.es/ecma262/#sec-object.create
743
- // eslint-disable-next-line es/no-object-create -- safe
744
- var objectCreate = Object.create || function create(O, Properties) {
745
- var result;
746
- if (O !== null) {
747
- EmptyConstructor[PROTOTYPE] = anObject$4(O);
748
- result = new EmptyConstructor();
749
- EmptyConstructor[PROTOTYPE] = null;
750
- // add "__proto__" for Object.getPrototypeOf polyfill
751
- result[IE_PROTO$1] = O;
752
- } else result = NullProtoObject();
753
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
754
- };
755
-
756
- var wellKnownSymbol$9 = wellKnownSymbol$b;
757
- var create$2 = objectCreate;
758
- var defineProperty$6 = objectDefineProperty.f;
759
-
760
- var UNSCOPABLES = wellKnownSymbol$9('unscopables');
761
- var ArrayPrototype = Array.prototype;
762
-
763
- // Array.prototype[@@unscopables]
764
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
765
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
766
- defineProperty$6(ArrayPrototype, UNSCOPABLES, {
767
- configurable: true,
768
- value: create$2(null)
769
- });
770
- }
771
-
772
- // add a key to Array.prototype[@@unscopables]
773
- var addToUnscopables$1 = function (key) {
774
- ArrayPrototype[UNSCOPABLES][key] = true;
775
- };
776
-
777
- var iterators = {};
778
-
779
- var global$a = global$h;
780
- var isCallable$b = isCallable$h;
781
-
782
- var WeakMap$1 = global$a.WeakMap;
783
-
784
- var weakMapBasicDetection = isCallable$b(WeakMap$1) && /native code/.test(String(WeakMap$1));
785
-
786
- var createPropertyDescriptor$3 = function (bitmap, value) {
787
- return {
788
- enumerable: !(bitmap & 1),
789
- configurable: !(bitmap & 2),
790
- writable: !(bitmap & 4),
791
- value: value
792
- };
793
- };
794
-
795
- var DESCRIPTORS$8 = descriptors;
796
- var definePropertyModule$3 = objectDefineProperty;
797
- var createPropertyDescriptor$2 = createPropertyDescriptor$3;
798
-
799
- var createNonEnumerableProperty$5 = DESCRIPTORS$8 ? function (object, key, value) {
800
- return definePropertyModule$3.f(object, key, createPropertyDescriptor$2(1, value));
801
- } : function (object, key, value) {
802
- object[key] = value;
803
- return object;
804
- };
805
-
806
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
807
- var global$9 = global$h;
808
- var isObject$3 = isObject$8;
809
- var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
810
- var hasOwn$9 = hasOwnProperty_1;
811
- var shared$1 = sharedStore;
812
- var sharedKey$1 = sharedKey$3;
813
- var hiddenKeys$1 = hiddenKeys$4;
814
-
815
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
816
- var TypeError$1 = global$9.TypeError;
817
- var WeakMap = global$9.WeakMap;
818
- var set, get, has;
819
-
820
- var enforce = function (it) {
821
- return has(it) ? get(it) : set(it, {});
822
- };
823
-
824
- var getterFor = function (TYPE) {
825
- return function (it) {
826
- var state;
827
- if (!isObject$3(it) || (state = get(it)).type !== TYPE) {
828
- throw TypeError$1('Incompatible receiver, ' + TYPE + ' required');
829
- } return state;
830
- };
831
- };
832
-
833
- if (NATIVE_WEAK_MAP || shared$1.state) {
834
- var store$1 = shared$1.state || (shared$1.state = new WeakMap());
835
- /* eslint-disable no-self-assign -- prototype methods protection */
836
- store$1.get = store$1.get;
837
- store$1.has = store$1.has;
838
- store$1.set = store$1.set;
839
- /* eslint-enable no-self-assign -- prototype methods protection */
840
- set = function (it, metadata) {
841
- if (store$1.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
842
- metadata.facade = it;
843
- store$1.set(it, metadata);
844
- return metadata;
845
- };
846
- get = function (it) {
847
- return store$1.get(it) || {};
848
- };
849
- has = function (it) {
850
- return store$1.has(it);
851
- };
852
- } else {
853
- var STATE = sharedKey$1('state');
854
- hiddenKeys$1[STATE] = true;
855
- set = function (it, metadata) {
856
- if (hasOwn$9(it, STATE)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
857
- metadata.facade = it;
858
- createNonEnumerableProperty$4(it, STATE, metadata);
859
- return metadata;
860
- };
861
- get = function (it) {
862
- return hasOwn$9(it, STATE) ? it[STATE] : {};
863
- };
864
- has = function (it) {
865
- return hasOwn$9(it, STATE);
866
- };
867
- }
868
-
869
- var internalState = {
870
- set: set,
871
- get: get,
872
- has: has,
873
- enforce: enforce,
874
- getterFor: getterFor
875
- };
876
-
877
- var objectGetOwnPropertyDescriptor = {};
878
-
879
- var objectPropertyIsEnumerable = {};
880
-
881
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
882
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
883
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
884
-
885
- // Nashorn ~ JDK8 bug
886
- var NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
887
-
888
- // `Object.prototype.propertyIsEnumerable` method implementation
889
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
890
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
891
- var descriptor = getOwnPropertyDescriptor$1(this, V);
892
- return !!descriptor && descriptor.enumerable;
893
- } : $propertyIsEnumerable;
894
-
895
- var DESCRIPTORS$7 = descriptors;
896
- var call$4 = functionCall;
897
- var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
898
- var createPropertyDescriptor$1 = createPropertyDescriptor$3;
899
- var toIndexedObject$1 = toIndexedObject$5;
900
- var toPropertyKey = toPropertyKey$2;
901
- var hasOwn$8 = hasOwnProperty_1;
902
- var IE8_DOM_DEFINE = ie8DomDefine;
903
-
904
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
905
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
906
-
907
- // `Object.getOwnPropertyDescriptor` method
908
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
909
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$7 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
910
- O = toIndexedObject$1(O);
911
- P = toPropertyKey(P);
912
- if (IE8_DOM_DEFINE) try {
913
- return $getOwnPropertyDescriptor(O, P);
914
- } catch (error) { /* empty */ }
915
- if (hasOwn$8(O, P)) return createPropertyDescriptor$1(!call$4(propertyIsEnumerableModule$1.f, O, P), O[P]);
916
- };
917
-
918
- var makeBuiltIn$2 = {exports: {}};
919
-
920
- var DESCRIPTORS$6 = descriptors;
921
- var hasOwn$7 = hasOwnProperty_1;
922
-
923
- var FunctionPrototype = Function.prototype;
924
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
925
- var getDescriptor = DESCRIPTORS$6 && Object.getOwnPropertyDescriptor;
926
-
927
- var EXISTS = hasOwn$7(FunctionPrototype, 'name');
928
- // additional protection from minified / mangled / dropped function names
929
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
930
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$6 || (DESCRIPTORS$6 && getDescriptor(FunctionPrototype, 'name').configurable));
931
-
932
- var functionName = {
933
- EXISTS: EXISTS,
934
- PROPER: PROPER,
935
- CONFIGURABLE: CONFIGURABLE
936
- };
937
-
938
- var uncurryThis$8 = functionUncurryThis;
939
- var isCallable$a = isCallable$h;
940
- var store = sharedStore;
941
-
942
- var functionToString = uncurryThis$8(Function.toString);
943
-
944
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
945
- if (!isCallable$a(store.inspectSource)) {
946
- store.inspectSource = function (it) {
947
- return functionToString(it);
948
- };
949
- }
950
-
951
- var inspectSource$1 = store.inspectSource;
952
-
953
- var fails$a = fails$h;
954
- var isCallable$9 = isCallable$h;
955
- var hasOwn$6 = hasOwnProperty_1;
956
- var DESCRIPTORS$5 = descriptors;
957
- var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
958
- var inspectSource = inspectSource$1;
959
- var InternalStateModule$1 = internalState;
960
-
961
- var enforceInternalState$1 = InternalStateModule$1.enforce;
962
- var getInternalState$2 = InternalStateModule$1.get;
963
- // eslint-disable-next-line es/no-object-defineproperty -- safe
964
- var defineProperty$5 = Object.defineProperty;
965
-
966
- var CONFIGURABLE_LENGTH = DESCRIPTORS$5 && !fails$a(function () {
967
- return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
968
- });
969
-
970
- var TEMPLATE = String(String).split('String');
971
-
972
- var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
973
- if (String(name).slice(0, 7) === 'Symbol(') {
974
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
975
- }
976
- if (options && options.getter) name = 'get ' + name;
977
- if (options && options.setter) name = 'set ' + name;
978
- if (!hasOwn$6(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
979
- if (DESCRIPTORS$5) defineProperty$5(value, 'name', { value: name, configurable: true });
980
- else value.name = name;
981
- }
982
- if (CONFIGURABLE_LENGTH && options && hasOwn$6(options, 'arity') && value.length !== options.arity) {
983
- defineProperty$5(value, 'length', { value: options.arity });
984
- }
985
- try {
986
- if (options && hasOwn$6(options, 'constructor') && options.constructor) {
987
- if (DESCRIPTORS$5) defineProperty$5(value, 'prototype', { writable: false });
988
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
989
- } else if (value.prototype) value.prototype = undefined;
990
- } catch (error) { /* empty */ }
991
- var state = enforceInternalState$1(value);
992
- if (!hasOwn$6(state, 'source')) {
993
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
994
- } return value;
995
- };
996
-
997
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
998
- // eslint-disable-next-line no-extend-native -- required
999
- Function.prototype.toString = makeBuiltIn$1(function toString() {
1000
- return isCallable$9(this) && getInternalState$2(this).source || inspectSource(this);
1001
- }, 'toString');
1002
-
1003
- var isCallable$8 = isCallable$h;
1004
- var definePropertyModule$2 = objectDefineProperty;
1005
- var makeBuiltIn = makeBuiltIn$2.exports;
1006
- var defineGlobalProperty$1 = defineGlobalProperty$3;
1007
-
1008
- var defineBuiltIn$5 = function (O, key, value, options) {
1009
- if (!options) options = {};
1010
- var simple = options.enumerable;
1011
- var name = options.name !== undefined ? options.name : key;
1012
- if (isCallable$8(value)) makeBuiltIn(value, name, options);
1013
- if (options.global) {
1014
- if (simple) O[key] = value;
1015
- else defineGlobalProperty$1(key, value);
1016
- } else {
1017
- try {
1018
- if (!options.unsafe) delete O[key];
1019
- else if (O[key]) simple = true;
1020
- } catch (error) { /* empty */ }
1021
- if (simple) O[key] = value;
1022
- else definePropertyModule$2.f(O, key, {
1023
- value: value,
1024
- enumerable: false,
1025
- configurable: !options.nonConfigurable,
1026
- writable: !options.nonWritable
1027
- });
1028
- } return O;
1029
- };
1030
-
1031
- var objectGetOwnPropertyNames = {};
1032
-
1033
- var internalObjectKeys = objectKeysInternal;
1034
- var enumBugKeys = enumBugKeys$3;
1035
-
1036
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
1037
-
1038
- // `Object.getOwnPropertyNames` method
1039
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
1040
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
1041
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
1042
- return internalObjectKeys(O, hiddenKeys);
1043
- };
1044
-
1045
- var objectGetOwnPropertySymbols = {};
1046
-
1047
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1048
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1049
-
1050
- var getBuiltIn$1 = getBuiltIn$5;
1051
- var uncurryThis$7 = functionUncurryThis;
1052
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1053
- var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1054
- var anObject$3 = anObject$7;
1055
-
1056
- var concat$1 = uncurryThis$7([].concat);
1057
-
1058
- // all object keys, includes non-enumerable and symbols
1059
- var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
1060
- var keys = getOwnPropertyNamesModule.f(anObject$3(it));
1061
- var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1062
- return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
1063
- };
1064
-
1065
- var hasOwn$5 = hasOwnProperty_1;
1066
- var ownKeys = ownKeys$1;
1067
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1068
- var definePropertyModule$1 = objectDefineProperty;
1069
-
1070
- var copyConstructorProperties$2 = function (target, source, exceptions) {
1071
- var keys = ownKeys(source);
1072
- var defineProperty = definePropertyModule$1.f;
1073
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1074
- for (var i = 0; i < keys.length; i++) {
1075
- var key = keys[i];
1076
- if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) {
1077
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1078
- }
1079
- }
1080
- };
1081
-
1082
- var fails$9 = fails$h;
1083
- var isCallable$7 = isCallable$h;
1084
-
1085
- var replacement = /#|\.prototype\./;
1086
-
1087
- var isForced$2 = function (feature, detection) {
1088
- var value = data[normalize(feature)];
1089
- return value == POLYFILL ? true
1090
- : value == NATIVE ? false
1091
- : isCallable$7(detection) ? fails$9(detection)
1092
- : !!detection;
1093
- };
1094
-
1095
- var normalize = isForced$2.normalize = function (string) {
1096
- return String(string).replace(replacement, '.').toLowerCase();
1097
- };
1098
-
1099
- var data = isForced$2.data = {};
1100
- var NATIVE = isForced$2.NATIVE = 'N';
1101
- var POLYFILL = isForced$2.POLYFILL = 'P';
1102
-
1103
- var isForced_1 = isForced$2;
1104
-
1105
- var global$8 = global$h;
1106
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1107
- var createNonEnumerableProperty$3 = createNonEnumerableProperty$5;
1108
- var defineBuiltIn$4 = defineBuiltIn$5;
1109
- var defineGlobalProperty = defineGlobalProperty$3;
1110
- var copyConstructorProperties$1 = copyConstructorProperties$2;
1111
- var isForced$1 = isForced_1;
1112
-
1113
- /*
1114
- options.target - name of the target object
1115
- options.global - target is the global object
1116
- options.stat - export as static methods of target
1117
- options.proto - export as prototype methods of target
1118
- options.real - real prototype method for the `pure` version
1119
- options.forced - export even if the native feature is available
1120
- options.bind - bind methods to the target, required for the `pure` version
1121
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
1122
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
1123
- options.sham - add a flag to not completely full polyfills
1124
- options.enumerable - export as enumerable property
1125
- options.dontCallGetSet - prevent calling a getter on target
1126
- options.name - the .name of the function if it does not match the key
1127
- */
1128
- var _export = function (options, source) {
1129
- var TARGET = options.target;
1130
- var GLOBAL = options.global;
1131
- var STATIC = options.stat;
1132
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1133
- if (GLOBAL) {
1134
- target = global$8;
1135
- } else if (STATIC) {
1136
- target = global$8[TARGET] || defineGlobalProperty(TARGET, {});
1137
- } else {
1138
- target = (global$8[TARGET] || {}).prototype;
1139
- }
1140
- if (target) for (key in source) {
1141
- sourceProperty = source[key];
1142
- if (options.dontCallGetSet) {
1143
- descriptor = getOwnPropertyDescriptor(target, key);
1144
- targetProperty = descriptor && descriptor.value;
1145
- } else targetProperty = target[key];
1146
- FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1147
- // contained in target
1148
- if (!FORCED && targetProperty !== undefined) {
1149
- if (typeof sourceProperty == typeof targetProperty) continue;
1150
- copyConstructorProperties$1(sourceProperty, targetProperty);
1151
- }
1152
- // add a flag to not completely full polyfills
1153
- if (options.sham || (targetProperty && targetProperty.sham)) {
1154
- createNonEnumerableProperty$3(sourceProperty, 'sham', true);
1155
- }
1156
- defineBuiltIn$4(target, key, sourceProperty, options);
1157
- }
1158
- };
1159
-
1160
- var fails$8 = fails$h;
1161
-
1162
- var correctPrototypeGetter = !fails$8(function () {
1163
- function F() { /* empty */ }
1164
- F.prototype.constructor = null;
1165
- // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1166
- return Object.getPrototypeOf(new F()) !== F.prototype;
1167
- });
1168
-
1169
- var hasOwn$4 = hasOwnProperty_1;
1170
- var isCallable$6 = isCallable$h;
1171
- var toObject$1 = toObject$3;
1172
- var sharedKey = sharedKey$3;
1173
- var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1174
-
1175
- var IE_PROTO = sharedKey('IE_PROTO');
1176
- var $Object$1 = Object;
1177
- var ObjectPrototype = $Object$1.prototype;
1178
-
1179
- // `Object.getPrototypeOf` method
1180
- // https://tc39.es/ecma262/#sec-object.getprototypeof
1181
- // eslint-disable-next-line es/no-object-getprototypeof -- safe
1182
- var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1183
- var object = toObject$1(O);
1184
- if (hasOwn$4(object, IE_PROTO)) return object[IE_PROTO];
1185
- var constructor = object.constructor;
1186
- if (isCallable$6(constructor) && object instanceof constructor) {
1187
- return constructor.prototype;
1188
- } return object instanceof $Object$1 ? ObjectPrototype : null;
1189
- };
1190
-
1191
- var fails$7 = fails$h;
1192
- var isCallable$5 = isCallable$h;
1193
- var isObject$2 = isObject$8;
1194
- var getPrototypeOf$1 = objectGetPrototypeOf;
1195
- var defineBuiltIn$3 = defineBuiltIn$5;
1196
- var wellKnownSymbol$8 = wellKnownSymbol$b;
1197
-
1198
- var ITERATOR$3 = wellKnownSymbol$8('iterator');
1199
- var BUGGY_SAFARI_ITERATORS$1 = false;
1200
-
1201
- // `%IteratorPrototype%` object
1202
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1203
- var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1204
-
1205
- /* eslint-disable es/no-array-prototype-keys -- safe */
1206
- if ([].keys) {
1207
- arrayIterator = [].keys();
1208
- // Safari 8 has buggy iterators w/o `next`
1209
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1210
- else {
1211
- PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1212
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1213
- }
1214
- }
1215
-
1216
- var NEW_ITERATOR_PROTOTYPE = !isObject$2(IteratorPrototype$2) || fails$7(function () {
1217
- var test = {};
1218
- // FF44- legacy iterators case
1219
- return IteratorPrototype$2[ITERATOR$3].call(test) !== test;
1220
- });
1221
-
1222
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1223
-
1224
- // `%IteratorPrototype%[@@iterator]()` method
1225
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1226
- if (!isCallable$5(IteratorPrototype$2[ITERATOR$3])) {
1227
- defineBuiltIn$3(IteratorPrototype$2, ITERATOR$3, function () {
1228
- return this;
1229
- });
1230
- }
1231
-
1232
- var iteratorsCore = {
1233
- IteratorPrototype: IteratorPrototype$2,
1234
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1235
- };
1236
-
1237
- var defineProperty$4 = objectDefineProperty.f;
1238
- var hasOwn$3 = hasOwnProperty_1;
1239
- var wellKnownSymbol$7 = wellKnownSymbol$b;
1240
-
1241
- var TO_STRING_TAG$3 = wellKnownSymbol$7('toStringTag');
1242
-
1243
- var setToStringTag$2 = function (target, TAG, STATIC) {
1244
- if (target && !STATIC) target = target.prototype;
1245
- if (target && !hasOwn$3(target, TO_STRING_TAG$3)) {
1246
- defineProperty$4(target, TO_STRING_TAG$3, { configurable: true, value: TAG });
1247
- }
1248
- };
1249
-
1250
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1251
- var create$1 = objectCreate;
1252
- var createPropertyDescriptor = createPropertyDescriptor$3;
1253
- var setToStringTag$1 = setToStringTag$2;
1254
- var Iterators$2 = iterators;
1255
-
1256
- var returnThis$1 = function () { return this; };
1257
-
1258
- var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1259
- var TO_STRING_TAG = NAME + ' Iterator';
1260
- IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1261
- setToStringTag$1(IteratorConstructor, TO_STRING_TAG, false);
1262
- Iterators$2[TO_STRING_TAG] = returnThis$1;
1263
- return IteratorConstructor;
1264
- };
1265
-
1266
- var isCallable$4 = isCallable$h;
1267
-
1268
- var $String$1 = String;
1269
- var $TypeError = TypeError;
1270
-
1271
- var aPossiblePrototype$1 = function (argument) {
1272
- if (typeof argument == 'object' || isCallable$4(argument)) return argument;
1273
- throw $TypeError("Can't set " + $String$1(argument) + ' as a prototype');
1274
- };
1275
-
1276
- /* eslint-disable no-proto -- safe */
1277
-
1278
- var uncurryThis$6 = functionUncurryThis;
1279
- var anObject$2 = anObject$7;
1280
- var aPossiblePrototype = aPossiblePrototype$1;
1281
-
1282
- // `Object.setPrototypeOf` method
1283
- // https://tc39.es/ecma262/#sec-object.setprototypeof
1284
- // Works with __proto__ only. Old v8 can't work with null proto objects.
1285
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
1286
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1287
- var CORRECT_SETTER = false;
1288
- var test = {};
1289
- var setter;
1290
- try {
1291
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1292
- setter = uncurryThis$6(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
1293
- setter(test, []);
1294
- CORRECT_SETTER = test instanceof Array;
1295
- } catch (error) { /* empty */ }
1296
- return function setPrototypeOf(O, proto) {
1297
- anObject$2(O);
1298
- aPossiblePrototype(proto);
1299
- if (CORRECT_SETTER) setter(O, proto);
1300
- else O.__proto__ = proto;
1301
- return O;
1302
- };
1303
- }() : undefined);
1304
-
1305
- var $$4 = _export;
1306
- var call$3 = functionCall;
1307
- var FunctionName = functionName;
1308
- var isCallable$3 = isCallable$h;
1309
- var createIteratorConstructor = iteratorCreateConstructor;
1310
- var getPrototypeOf = objectGetPrototypeOf;
1311
- var setPrototypeOf$1 = objectSetPrototypeOf;
1312
- var setToStringTag = setToStringTag$2;
1313
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$5;
1314
- var defineBuiltIn$2 = defineBuiltIn$5;
1315
- var wellKnownSymbol$6 = wellKnownSymbol$b;
1316
- var Iterators$1 = iterators;
1317
- var IteratorsCore = iteratorsCore;
1318
-
1319
- var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
1320
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1321
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
1322
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1323
- var ITERATOR$2 = wellKnownSymbol$6('iterator');
1324
- var KEYS = 'keys';
1325
- var VALUES = 'values';
1326
- var ENTRIES = 'entries';
1327
-
1328
- var returnThis = function () { return this; };
1329
-
1330
- var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1331
- createIteratorConstructor(IteratorConstructor, NAME, next);
1332
-
1333
- var getIterationMethod = function (KIND) {
1334
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1335
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
1336
- switch (KIND) {
1337
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1338
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1339
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1340
- } return function () { return new IteratorConstructor(this); };
1341
- };
1342
-
1343
- var TO_STRING_TAG = NAME + ' Iterator';
1344
- var INCORRECT_VALUES_NAME = false;
1345
- var IterablePrototype = Iterable.prototype;
1346
- var nativeIterator = IterablePrototype[ITERATOR$2]
1347
- || IterablePrototype['@@iterator']
1348
- || DEFAULT && IterablePrototype[DEFAULT];
1349
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1350
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1351
- var CurrentIteratorPrototype, methods, KEY;
1352
-
1353
- // fix native
1354
- if (anyNativeIterator) {
1355
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1356
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1357
- if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1358
- if (setPrototypeOf$1) {
1359
- setPrototypeOf$1(CurrentIteratorPrototype, IteratorPrototype);
1360
- } else if (!isCallable$3(CurrentIteratorPrototype[ITERATOR$2])) {
1361
- defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$2, returnThis);
1362
- }
1363
- }
1364
- // Set @@toStringTag to native iterators
1365
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
1366
- }
1367
- }
1368
-
1369
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1370
- if (PROPER_FUNCTION_NAME$1 && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1371
- if (CONFIGURABLE_FUNCTION_NAME) {
1372
- createNonEnumerableProperty$2(IterablePrototype, 'name', VALUES);
1373
- } else {
1374
- INCORRECT_VALUES_NAME = true;
1375
- defaultIterator = function values() { return call$3(nativeIterator, this); };
1376
- }
1377
- }
1378
-
1379
- // export additional methods
1380
- if (DEFAULT) {
1381
- methods = {
1382
- values: getIterationMethod(VALUES),
1383
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1384
- entries: getIterationMethod(ENTRIES)
1385
- };
1386
- if (FORCED) for (KEY in methods) {
1387
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1388
- defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
1389
- }
1390
- } else $$4({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1391
- }
1392
-
1393
- // define iterator
1394
- if (IterablePrototype[ITERATOR$2] !== defaultIterator) {
1395
- defineBuiltIn$2(IterablePrototype, ITERATOR$2, defaultIterator, { name: DEFAULT });
1396
- }
1397
- Iterators$1[NAME] = defaultIterator;
1398
-
1399
- return methods;
1400
- };
1401
-
1402
- // `CreateIterResultObject` abstract operation
1403
- // https://tc39.es/ecma262/#sec-createiterresultobject
1404
- var createIterResultObject$1 = function (value, done) {
1405
- return { value: value, done: done };
1406
- };
1407
-
1408
- var toIndexedObject = toIndexedObject$5;
1409
- var addToUnscopables = addToUnscopables$1;
1410
- var Iterators = iterators;
1411
- var InternalStateModule = internalState;
1412
- var defineProperty$3 = objectDefineProperty.f;
1413
- var defineIterator = iteratorDefine;
1414
- var createIterResultObject = createIterResultObject$1;
1415
- var DESCRIPTORS$4 = descriptors;
1416
-
1417
- var ARRAY_ITERATOR = 'Array Iterator';
1418
- var setInternalState = InternalStateModule.set;
1419
- var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
1420
-
1421
- // `Array.prototype.entries` method
1422
- // https://tc39.es/ecma262/#sec-array.prototype.entries
1423
- // `Array.prototype.keys` method
1424
- // https://tc39.es/ecma262/#sec-array.prototype.keys
1425
- // `Array.prototype.values` method
1426
- // https://tc39.es/ecma262/#sec-array.prototype.values
1427
- // `Array.prototype[@@iterator]` method
1428
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1429
- // `CreateArrayIterator` internal method
1430
- // https://tc39.es/ecma262/#sec-createarrayiterator
1431
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1432
- setInternalState(this, {
1433
- type: ARRAY_ITERATOR,
1434
- target: toIndexedObject(iterated), // target
1435
- index: 0, // next index
1436
- kind: kind // kind
1437
- });
1438
- // `%ArrayIteratorPrototype%.next` method
1439
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1440
- }, function () {
1441
- var state = getInternalState$1(this);
1442
- var target = state.target;
1443
- var kind = state.kind;
1444
- var index = state.index++;
1445
- if (!target || index >= target.length) {
1446
- state.target = undefined;
1447
- return createIterResultObject(undefined, true);
1448
- }
1449
- if (kind == 'keys') return createIterResultObject(index, false);
1450
- if (kind == 'values') return createIterResultObject(target[index], false);
1451
- return createIterResultObject([index, target[index]], false);
1452
- }, 'values');
1453
-
1454
- // argumentsList[@@iterator] is %ArrayProto_values%
1455
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1456
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1457
- var values = Iterators.Arguments = Iterators.Array;
1458
-
1459
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1460
- addToUnscopables('keys');
1461
- addToUnscopables('values');
1462
- addToUnscopables('entries');
1463
-
1464
- // V8 ~ Chrome 45- bug
1465
- if (DESCRIPTORS$4 && values.name !== 'values') try {
1466
- defineProperty$3(values, 'name', { value: 'values' });
1467
- } catch (error) { /* empty */ }
1468
-
1469
- // iterable DOM collections
1470
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
1471
- var domIterables = {
1472
- CSSRuleList: 0,
1473
- CSSStyleDeclaration: 0,
1474
- CSSValueList: 0,
1475
- ClientRectList: 0,
1476
- DOMRectList: 0,
1477
- DOMStringList: 0,
1478
- DOMTokenList: 1,
1479
- DataTransferItemList: 0,
1480
- FileList: 0,
1481
- HTMLAllCollection: 0,
1482
- HTMLCollection: 0,
1483
- HTMLFormElement: 0,
1484
- HTMLSelectElement: 0,
1485
- MediaList: 0,
1486
- MimeTypeArray: 0,
1487
- NamedNodeMap: 0,
1488
- NodeList: 1,
1489
- PaintRequestList: 0,
1490
- Plugin: 0,
1491
- PluginArray: 0,
1492
- SVGLengthList: 0,
1493
- SVGNumberList: 0,
1494
- SVGPathSegList: 0,
1495
- SVGPointList: 0,
1496
- SVGStringList: 0,
1497
- SVGTransformList: 0,
1498
- SourceBufferList: 0,
1499
- StyleSheetList: 0,
1500
- TextTrackCueList: 0,
1501
- TextTrackList: 0,
1502
- TouchList: 0
1503
- };
1504
-
1505
- // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
1506
- var documentCreateElement = documentCreateElement$2;
1507
-
1508
- var classList = documentCreateElement('span').classList;
1509
- var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
1510
-
1511
- var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1512
-
1513
- var global$7 = global$h;
1514
- var DOMIterables = domIterables;
1515
- var DOMTokenListPrototype = domTokenListPrototype;
1516
- var ArrayIteratorMethods = es_array_iterator;
1517
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$5;
1518
- var wellKnownSymbol$5 = wellKnownSymbol$b;
1519
-
1520
- var ITERATOR$1 = wellKnownSymbol$5('iterator');
1521
- var TO_STRING_TAG$2 = wellKnownSymbol$5('toStringTag');
1522
- var ArrayValues = ArrayIteratorMethods.values;
1523
-
1524
- var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1525
- if (CollectionPrototype) {
1526
- // some Chrome versions have non-configurable methods on DOMTokenList
1527
- if (CollectionPrototype[ITERATOR$1] !== ArrayValues) try {
1528
- createNonEnumerableProperty$1(CollectionPrototype, ITERATOR$1, ArrayValues);
1529
- } catch (error) {
1530
- CollectionPrototype[ITERATOR$1] = ArrayValues;
1531
- }
1532
- if (!CollectionPrototype[TO_STRING_TAG$2]) {
1533
- createNonEnumerableProperty$1(CollectionPrototype, TO_STRING_TAG$2, COLLECTION_NAME);
1534
- }
1535
- if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1536
- // some Chrome versions have non-configurable methods on DOMTokenList
1537
- if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1538
- createNonEnumerableProperty$1(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1539
- } catch (error) {
1540
- CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1541
- }
1542
- }
1543
- }
1544
- };
1545
-
1546
- for (var COLLECTION_NAME in DOMIterables) {
1547
- handlePrototype(global$7[COLLECTION_NAME] && global$7[COLLECTION_NAME].prototype, COLLECTION_NAME);
1548
- }
1549
-
1550
- handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1551
-
1552
- var wellKnownSymbol$4 = wellKnownSymbol$b;
1553
-
1554
- var TO_STRING_TAG$1 = wellKnownSymbol$4('toStringTag');
1555
- var test = {};
1556
-
1557
- test[TO_STRING_TAG$1] = 'z';
1558
-
1559
- var toStringTagSupport = String(test) === '[object z]';
1560
-
1561
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1562
- var isCallable$2 = isCallable$h;
1563
- var classofRaw = classofRaw$1;
1564
- var wellKnownSymbol$3 = wellKnownSymbol$b;
1565
-
1566
- var TO_STRING_TAG = wellKnownSymbol$3('toStringTag');
1567
- var $Object = Object;
1568
-
1569
- // ES3 wrong here
1570
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
1571
-
1572
- // fallback for IE11 Script Access Denied error
1573
- var tryGet = function (it, key) {
1574
- try {
1575
- return it[key];
1576
- } catch (error) { /* empty */ }
1577
- };
1578
-
1579
- // getting tag from ES6+ `Object.prototype.toString`
1580
- var classof$2 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1581
- var O, tag, result;
1582
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1583
- // @@toStringTag case
1584
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1585
- // builtinTag case
1586
- : CORRECT_ARGUMENTS ? classofRaw(O)
1587
- // ES3 arguments fallback
1588
- : (result = classofRaw(O)) == 'Object' && isCallable$2(O.callee) ? 'Arguments' : result;
1589
- };
1590
-
1591
- var classof$1 = classof$2;
1592
-
1593
- var $String = String;
1594
-
1595
- var toString$5 = function (argument) {
1596
- if (classof$1(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1597
- return $String(argument);
1598
- };
1599
-
1600
- var $$3 = _export;
1601
- var DESCRIPTORS$3 = descriptors;
1602
- var global$6 = global$h;
1603
- var uncurryThis$5 = functionUncurryThis;
1604
- var hasOwn$2 = hasOwnProperty_1;
1605
- var isCallable$1 = isCallable$h;
1606
- var isPrototypeOf$2 = objectIsPrototypeOf;
1607
- var toString$4 = toString$5;
1608
- var defineProperty$2 = objectDefineProperty.f;
1609
- var copyConstructorProperties = copyConstructorProperties$2;
1610
-
1611
- var NativeSymbol = global$6.Symbol;
1612
- var SymbolPrototype = NativeSymbol && NativeSymbol.prototype;
1613
-
1614
- if (DESCRIPTORS$3 && isCallable$1(NativeSymbol) && (!('description' in SymbolPrototype) ||
1615
- // Safari 12 bug
1616
- NativeSymbol().description !== undefined
1617
- )) {
1618
- var EmptyStringDescriptionStore = {};
1619
- // wrap Symbol constructor for correct work with undefined description
1620
- var SymbolWrapper = function Symbol() {
1621
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString$4(arguments[0]);
1622
- var result = isPrototypeOf$2(SymbolPrototype, this)
1623
- ? new NativeSymbol(description)
1624
- // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
1625
- : description === undefined ? NativeSymbol() : NativeSymbol(description);
1626
- if (description === '') EmptyStringDescriptionStore[result] = true;
1627
- return result;
1628
- };
1629
-
1630
- copyConstructorProperties(SymbolWrapper, NativeSymbol);
1631
- SymbolWrapper.prototype = SymbolPrototype;
1632
- SymbolPrototype.constructor = SymbolWrapper;
1633
-
1634
- var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)';
1635
- var thisSymbolValue = uncurryThis$5(SymbolPrototype.valueOf);
1636
- var symbolDescriptiveString = uncurryThis$5(SymbolPrototype.toString);
1637
- var regexp = /^Symbol\((.*)\)[^)]+$/;
1638
- var replace$3 = uncurryThis$5(''.replace);
1639
- var stringSlice$2 = uncurryThis$5(''.slice);
1640
-
1641
- defineProperty$2(SymbolPrototype, 'description', {
1642
- configurable: true,
1643
- get: function description() {
1644
- var symbol = thisSymbolValue(this);
1645
- if (hasOwn$2(EmptyStringDescriptionStore, symbol)) return '';
1646
- var string = symbolDescriptiveString(symbol);
1647
- var desc = NATIVE_SYMBOL ? stringSlice$2(string, 7, -1) : replace$3(string, regexp, '$1');
1648
- return desc === '' ? undefined : desc;
1649
- }
1650
- });
1651
-
1652
- $$3({ global: true, constructor: true, forced: true }, {
1653
- Symbol: SymbolWrapper
1654
- });
1655
- }
1656
-
1657
- var DESCRIPTORS$2 = descriptors;
1658
- var uncurryThis$4 = functionUncurryThis;
1659
- var call$2 = functionCall;
1660
- var fails$6 = fails$h;
1661
- var objectKeys = objectKeys$2;
1662
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1663
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1664
- var toObject = toObject$3;
1665
- var IndexedObject = indexedObject;
1666
-
1667
- // eslint-disable-next-line es/no-object-assign -- safe
1668
- var $assign = Object.assign;
1669
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1670
- var defineProperty$1 = Object.defineProperty;
1671
- var concat = uncurryThis$4([].concat);
1672
-
1673
- // `Object.assign` method
1674
- // https://tc39.es/ecma262/#sec-object.assign
1675
- var objectAssign = !$assign || fails$6(function () {
1676
- // should have correct order of operations (Edge bug)
1677
- if (DESCRIPTORS$2 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
1678
- enumerable: true,
1679
- get: function () {
1680
- defineProperty$1(this, 'b', {
1681
- value: 3,
1682
- enumerable: false
1683
- });
1684
- }
1685
- }), { b: 2 })).b !== 1) return true;
1686
- // should work with symbols and should have deterministic property order (V8 bug)
1687
- var A = {};
1688
- var B = {};
1689
- // eslint-disable-next-line es/no-symbol -- safe
1690
- var symbol = Symbol();
1691
- var alphabet = 'abcdefghijklmnopqrst';
1692
- A[symbol] = 7;
1693
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1694
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
1695
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1696
- var T = toObject(target);
1697
- var argumentsLength = arguments.length;
1698
- var index = 1;
1699
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1700
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
1701
- while (argumentsLength > index) {
1702
- var S = IndexedObject(arguments[index++]);
1703
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1704
- var length = keys.length;
1705
- var j = 0;
1706
- var key;
1707
- while (length > j) {
1708
- key = keys[j++];
1709
- if (!DESCRIPTORS$2 || call$2(propertyIsEnumerable, S, key)) T[key] = S[key];
1710
- }
1711
- } return T;
1712
- } : $assign;
1713
-
1714
- var $$2 = _export;
1715
- var assign = objectAssign;
1716
-
1717
- // `Object.assign` method
1718
- // https://tc39.es/ecma262/#sec-object.assign
1719
- // eslint-disable-next-line es/no-object-assign -- required for testing
1720
- $$2({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1721
- assign: assign
1722
- });
1723
-
1724
- // a string of all valid unicode whitespaces
1725
- var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
1726
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
1727
-
1728
- var uncurryThis$3 = functionUncurryThis;
1729
- var requireObjectCoercible = requireObjectCoercible$3;
1730
- var toString$3 = toString$5;
1731
- var whitespaces$1 = whitespaces$2;
1732
-
1733
- var replace$2 = uncurryThis$3(''.replace);
1734
- var whitespace = '[' + whitespaces$1 + ']';
1735
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
1736
- var rtrim = RegExp(whitespace + whitespace + '*$');
1737
-
1738
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
1739
- var createMethod = function (TYPE) {
1740
- return function ($this) {
1741
- var string = toString$3(requireObjectCoercible($this));
1742
- if (TYPE & 1) string = replace$2(string, ltrim, '');
1743
- if (TYPE & 2) string = replace$2(string, rtrim, '');
1744
- return string;
1745
- };
1746
- };
1747
-
1748
- var stringTrim = {
1749
- // `String.prototype.{ trimLeft, trimStart }` methods
1750
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1751
- start: createMethod(1),
1752
- // `String.prototype.{ trimRight, trimEnd }` methods
1753
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
1754
- end: createMethod(2),
1755
- // `String.prototype.trim` method
1756
- // https://tc39.es/ecma262/#sec-string.prototype.trim
1757
- trim: createMethod(3)
1758
- };
1759
-
1760
- var global$5 = global$h;
1761
- var fails$5 = fails$h;
1762
- var uncurryThis$2 = functionUncurryThis;
1763
- var toString$2 = toString$5;
1764
- var trim = stringTrim.trim;
1765
- var whitespaces = whitespaces$2;
1766
-
1767
- var charAt$2 = uncurryThis$2(''.charAt);
1768
- var $parseFloat$1 = global$5.parseFloat;
1769
- var Symbol$1 = global$5.Symbol;
1770
- var ITERATOR = Symbol$1 && Symbol$1.iterator;
1771
- var FORCED = 1 / $parseFloat$1(whitespaces + '-0') !== -Infinity
1772
- // MS Edge 18- broken with boxed symbols
1773
- || (ITERATOR && !fails$5(function () { $parseFloat$1(Object(ITERATOR)); }));
1774
-
1775
- // `parseFloat` method
1776
- // https://tc39.es/ecma262/#sec-parsefloat-string
1777
- var numberParseFloat = FORCED ? function parseFloat(string) {
1778
- var trimmedString = trim(toString$2(string));
1779
- var result = $parseFloat$1(trimmedString);
1780
- return result === 0 && charAt$2(trimmedString, 0) == '-' ? -0 : result;
1781
- } : $parseFloat$1;
1782
-
1783
- var $$1 = _export;
1784
- var $parseFloat = numberParseFloat;
1785
-
1786
- // `parseFloat` method
1787
- // https://tc39.es/ecma262/#sec-parsefloat-string
1788
- $$1({ global: true, forced: parseFloat != $parseFloat }, {
1789
- parseFloat: $parseFloat
1790
- });
1791
-
1792
- var anObject$1 = anObject$7;
1793
-
1794
- // `RegExp.prototype.flags` getter implementation
1795
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1796
- var regexpFlags$1 = function () {
1797
- var that = anObject$1(this);
1798
- var result = '';
1799
- if (that.hasIndices) result += 'd';
1800
- if (that.global) result += 'g';
1801
- if (that.ignoreCase) result += 'i';
1802
- if (that.multiline) result += 'm';
1803
- if (that.dotAll) result += 's';
1804
- if (that.unicode) result += 'u';
1805
- if (that.unicodeSets) result += 'v';
1806
- if (that.sticky) result += 'y';
1807
- return result;
1808
- };
1809
-
1810
- var call$1 = functionCall;
1811
- var hasOwn$1 = hasOwnProperty_1;
1812
- var isPrototypeOf$1 = objectIsPrototypeOf;
1813
- var regExpFlags = regexpFlags$1;
1814
-
1815
- var RegExpPrototype$2 = RegExp.prototype;
1816
-
1817
- var regexpGetFlags = function (R) {
1818
- var flags = R.flags;
1819
- return flags === undefined && !('flags' in RegExpPrototype$2) && !hasOwn$1(R, 'flags') && isPrototypeOf$1(RegExpPrototype$2, R)
1820
- ? call$1(regExpFlags, R) : flags;
1821
- };
1822
-
1823
- var PROPER_FUNCTION_NAME = functionName.PROPER;
1824
- var defineBuiltIn$1 = defineBuiltIn$5;
1825
- var anObject = anObject$7;
1826
- var $toString = toString$5;
1827
- var fails$4 = fails$h;
1828
- var getRegExpFlags$1 = regexpGetFlags;
1829
-
1830
- var TO_STRING = 'toString';
1831
- var RegExpPrototype$1 = RegExp.prototype;
1832
- var nativeToString = RegExpPrototype$1[TO_STRING];
1833
-
1834
- var NOT_GENERIC = fails$4(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
1835
- // FF44- RegExp#toString has a wrong name
1836
- var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name != TO_STRING;
1837
-
1838
- // `RegExp.prototype.toString` method
1839
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
1840
- if (NOT_GENERIC || INCORRECT_NAME) {
1841
- defineBuiltIn$1(RegExp.prototype, TO_STRING, function toString() {
1842
- var R = anObject(this);
1843
- var pattern = $toString(R.source);
1844
- var flags = $toString(getRegExpFlags$1(R));
1845
- return '/' + pattern + '/' + flags;
1846
- }, { unsafe: true });
1847
- }
1848
-
1849
9
  /******************************************************************************
1850
10
  Copyright (c) Microsoft Corporation.
1851
11
 
@@ -1873,920 +33,265 @@ function __rest(s, e) {
1873
33
  return t;
1874
34
  }
1875
35
 
1876
- const BooleanCustomField = _a => {
1877
- var {
1878
- defaultValue,
1879
- dataTestId = "booleanField",
1880
- onChange,
1881
- value,
1882
- id,
1883
- setValue,
1884
- register,
1885
- validationRules,
1886
- disabled = false,
1887
- label,
1888
- tip,
1889
- isInvalid,
1890
- errorMessage,
1891
- helpAddon,
1892
- maxLength,
1893
- helpText
1894
- } = _a,
1895
- rest = __rest(_a, ["defaultValue", "dataTestId", "onChange", "value", "id", "setValue", "register", "validationRules", "disabled", "label", "tip", "isInvalid", "errorMessage", "helpAddon", "maxLength", "helpText"]);
1896
- const initialValue = value !== undefined ? value : defaultValue ? defaultValue : false;
1897
- const renderAsInvalid = isInvalid || Boolean(errorMessage);
1898
- const [internalValue, setInternalValue] = React.useState(initialValue);
1899
- React.useEffect(() => {
1900
- setInternalValue((value === undefined ? defaultValue : value) || false);
1901
- }, [value, setInternalValue, defaultValue]);
1902
- const onChangeHandler = React.useCallback(event => {
1903
- var _a;
1904
- onChange && onChange(event);
1905
- const isChecked = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.checked) || false;
1906
- if (setValue) {
1907
- setValue(id, isChecked);
1908
- }
1909
- setInternalValue(isChecked);
1910
- }, [setInternalValue, onChange, id, setValue]);
1911
- React.useEffect(() => {
1912
- register && register(id, Object.assign(Object.assign({}, validationRules), {
1913
- value: internalValue.toString()
1914
- }));
1915
- // eslint-disable-next-line react-hooks/exhaustive-deps
1916
- }, []); // register only once
1917
- return jsx(FormGroup, Object.assign({
1918
- label: label,
1919
- tip: tip,
1920
- isInvalid: renderAsInvalid,
1921
- helpText: errorMessage || helpText,
1922
- helpAddon: helpAddon || null,
1923
- dataTestId: `${dataTestId}-FormGroup`
1924
- }, {
1925
- children: jsx(Checkbox, Object.assign({
1926
- checked: internalValue,
1927
- dataTestId: dataTestId,
1928
- id: id,
1929
- disabled: disabled,
1930
- name: id,
1931
- onChange: onChangeHandler,
1932
- isInvalid: renderAsInvalid
1933
- }, rest))
1934
- }));
1935
- };
1936
-
1937
- const DateCustomField = props => {
1938
- const {
1939
- setValue,
1940
- defaultValue,
1941
- register,
1942
- id,
1943
- validationRules
1944
- } = props,
1945
- rest = __rest(props, ["setValue", "defaultValue", "register", "id", "validationRules"]);
1946
- const onChangeHandler = useCallback(e => {
1947
- var _a, _b, _c, _d;
1948
- if (((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.valueAsDate) === null || _b === void 0 ? void 0 : _b.toISOString()) !== undefined) {
1949
- setValue && setValue(id, (_d = (_c = e.target) === null || _c === void 0 ? void 0 : _c.valueAsDate) === null || _d === void 0 ? void 0 : _d.toISOString());
1950
- }
1951
- }, [setValue, id]);
1952
- useEffect(() => {
1953
- const value = defaultValue && new Date(defaultValue);
1954
- register && register(id, Object.assign(Object.assign({}, validationRules), {
1955
- value
1956
- }));
1957
- }, [register, validationRules, defaultValue, id]);
1958
- return jsx(DateField, Object.assign({}, rest, {
1959
- helpAddon: props.helpAddon || null,
1960
- helpText: props.errorMessage || props.helpText,
1961
- onChange: onChangeHandler,
1962
- label: props.title,
1963
- defaultValue: defaultValue
1964
- }));
1965
- };
1966
-
1967
- const convertToValueFormat = value => {
1968
- return {
1969
- label: value,
1970
- value
1971
- };
1972
- };
1973
- const DropdownCustomField = ({
1974
- defaultValue,
1975
- dataTestId,
1976
- onChange,
1977
- onBlur,
1978
- id,
1979
- disabled: _disabled = false,
1980
- allValues,
1981
- multiSelect: _multiSelect = false,
1982
- register,
1983
- validationRules,
1984
- setValue,
1985
- label,
1986
- tip,
1987
- errorMessage,
1988
- helpText,
1989
- isInvalid,
1990
- helpAddon
1991
- }) => {
1992
- const renderAsInvalid = isInvalid || Boolean(errorMessage);
1993
- const [selectedValue, setSelectedValue] = React.useState(defaultValue ? defaultValue.map(convertToValueFormat) : []);
1994
- const onChangeHandler = React.useCallback(selected => {
1995
- if (selected) {
1996
- const values = Array.isArray(selected) ? selected : [selected];
1997
- setSelectedValue(values);
1998
- setValue && setValue(id, values);
1999
- } else {
2000
- setSelectedValue([]);
2001
- setValue && setValue(id, []);
2002
- }
2003
- }, [onChange]);
2004
- const options = React.useMemo(() => {
2005
- return allValues ? allValues.map(convertToValueFormat) : [];
2006
- }, [allValues]);
2007
- React.useEffect(() => {
2008
- register && register(id, Object.assign(Object.assign({}, validationRules), {
2009
- value: selectedValue
2010
- }));
2011
- }, [register, validationRules, selectedValue, id]);
2012
- return jsx(FormGroup, Object.assign({
2013
- label: label,
2014
- tip: tip,
2015
- isInvalid: renderAsInvalid,
2016
- helpText: errorMessage || helpText,
2017
- helpAddon: helpAddon || null,
2018
- dataTestId: `${dataTestId}-FormGroup`
2019
- }, {
2020
- children: jsx(Select, {
2021
- disabled: _disabled,
2022
- dataTestId: dataTestId,
2023
- onChange: onChangeHandler,
2024
- hasError: renderAsInvalid,
2025
- options: options,
2026
- value: selectedValue,
2027
- isMulti: _multiSelect,
2028
- isClearable: true
2029
- })
2030
- }));
2031
- };
2032
-
2033
- var isCallable = isCallable$h;
2034
- var isObject$1 = isObject$8;
2035
- var setPrototypeOf = objectSetPrototypeOf;
2036
-
2037
- // makes subclassing work correct for wrapped built-ins
2038
- var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
2039
- var NewTarget, NewTargetPrototype;
2040
- if (
2041
- // it can work only with native `setPrototypeOf`
2042
- setPrototypeOf &&
2043
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
2044
- isCallable(NewTarget = dummy.constructor) &&
2045
- NewTarget !== Wrapper &&
2046
- isObject$1(NewTargetPrototype = NewTarget.prototype) &&
2047
- NewTargetPrototype !== Wrapper.prototype
2048
- ) setPrototypeOf($this, NewTargetPrototype);
2049
- return $this;
2050
- };
2051
-
2052
- var isObject = isObject$8;
2053
- var classof = classofRaw$1;
2054
- var wellKnownSymbol$2 = wellKnownSymbol$b;
2055
-
2056
- var MATCH$1 = wellKnownSymbol$2('match');
2057
-
2058
- // `IsRegExp` abstract operation
2059
- // https://tc39.es/ecma262/#sec-isregexp
2060
- var isRegexp = function (it) {
2061
- var isRegExp;
2062
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
2063
- };
2064
-
2065
- var fails$3 = fails$h;
2066
- var global$4 = global$h;
2067
-
2068
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
2069
- var $RegExp$2 = global$4.RegExp;
2070
-
2071
- var UNSUPPORTED_Y$2 = fails$3(function () {
2072
- var re = $RegExp$2('a', 'y');
2073
- re.lastIndex = 2;
2074
- return re.exec('abcd') != null;
2075
- });
2076
-
2077
- // UC Browser bug
2078
- // https://github.com/zloirock/core-js/issues/1008
2079
- var MISSED_STICKY$1 = UNSUPPORTED_Y$2 || fails$3(function () {
2080
- return !$RegExp$2('a', 'y').sticky;
2081
- });
2082
-
2083
- var BROKEN_CARET = UNSUPPORTED_Y$2 || fails$3(function () {
2084
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
2085
- var re = $RegExp$2('^r', 'gy');
2086
- re.lastIndex = 2;
2087
- return re.exec('str') != null;
2088
- });
2089
-
2090
- var regexpStickyHelpers = {
2091
- BROKEN_CARET: BROKEN_CARET,
2092
- MISSED_STICKY: MISSED_STICKY$1,
2093
- UNSUPPORTED_Y: UNSUPPORTED_Y$2
2094
- };
2095
-
2096
- var defineProperty = objectDefineProperty.f;
2097
-
2098
- var proxyAccessor$1 = function (Target, Source, key) {
2099
- key in Target || defineProperty(Target, key, {
2100
- configurable: true,
2101
- get: function () { return Source[key]; },
2102
- set: function (it) { Source[key] = it; }
2103
- });
2104
- };
2105
-
2106
- var getBuiltIn = getBuiltIn$5;
2107
- var definePropertyModule = objectDefineProperty;
2108
- var wellKnownSymbol$1 = wellKnownSymbol$b;
2109
- var DESCRIPTORS$1 = descriptors;
2110
-
2111
- var SPECIES = wellKnownSymbol$1('species');
2112
-
2113
- var setSpecies$1 = function (CONSTRUCTOR_NAME) {
2114
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
2115
- var defineProperty = definePropertyModule.f;
2116
-
2117
- if (DESCRIPTORS$1 && Constructor && !Constructor[SPECIES]) {
2118
- defineProperty(Constructor, SPECIES, {
2119
- configurable: true,
2120
- get: function () { return this; }
2121
- });
2122
- }
2123
- };
2124
-
2125
- var fails$2 = fails$h;
2126
- var global$3 = global$h;
2127
-
2128
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
2129
- var $RegExp$1 = global$3.RegExp;
2130
-
2131
- var regexpUnsupportedDotAll = fails$2(function () {
2132
- var re = $RegExp$1('.', 's');
2133
- return !(re.dotAll && re.exec('\n') && re.flags === 's');
2134
- });
2135
-
2136
- var fails$1 = fails$h;
2137
- var global$2 = global$h;
2138
-
2139
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
2140
- var $RegExp = global$2.RegExp;
2141
-
2142
- var regexpUnsupportedNcg = fails$1(function () {
2143
- var re = $RegExp('(?<a>b)', 'g');
2144
- return re.exec('b').groups.a !== 'b' ||
2145
- 'b'.replace(re, '$<a>c') !== 'bc';
2146
- });
2147
-
2148
- var DESCRIPTORS = descriptors;
2149
- var global$1 = global$h;
2150
- var uncurryThis$1 = functionUncurryThis;
2151
- var isForced = isForced_1;
2152
- var inheritIfRequired = inheritIfRequired$1;
2153
- var createNonEnumerableProperty = createNonEnumerableProperty$5;
2154
- var getOwnPropertyNames = objectGetOwnPropertyNames.f;
2155
- var isPrototypeOf = objectIsPrototypeOf;
2156
- var isRegExp = isRegexp;
2157
- var toString$1 = toString$5;
2158
- var getRegExpFlags = regexpGetFlags;
2159
- var stickyHelpers$1 = regexpStickyHelpers;
2160
- var proxyAccessor = proxyAccessor$1;
2161
- var defineBuiltIn = defineBuiltIn$5;
2162
- var fails = fails$h;
2163
- var hasOwn = hasOwnProperty_1;
2164
- var enforceInternalState = internalState.enforce;
2165
- var setSpecies = setSpecies$1;
2166
- var wellKnownSymbol = wellKnownSymbol$b;
2167
- var UNSUPPORTED_DOT_ALL$1 = regexpUnsupportedDotAll;
2168
- var UNSUPPORTED_NCG$1 = regexpUnsupportedNcg;
2169
-
2170
- var MATCH = wellKnownSymbol('match');
2171
- var NativeRegExp = global$1.RegExp;
2172
- var RegExpPrototype = NativeRegExp.prototype;
2173
- var SyntaxError = global$1.SyntaxError;
2174
- var exec$1 = uncurryThis$1(RegExpPrototype.exec);
2175
- var charAt$1 = uncurryThis$1(''.charAt);
2176
- var replace$1 = uncurryThis$1(''.replace);
2177
- var stringIndexOf = uncurryThis$1(''.indexOf);
2178
- var stringSlice$1 = uncurryThis$1(''.slice);
2179
- // TODO: Use only proper RegExpIdentifierName
2180
- var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
2181
- var re1 = /a/g;
2182
- var re2 = /a/g;
2183
-
2184
- // "new" should create a new object, old webkit bug
2185
- var CORRECT_NEW = new NativeRegExp(re1) !== re1;
2186
-
2187
- var MISSED_STICKY = stickyHelpers$1.MISSED_STICKY;
2188
- var UNSUPPORTED_Y$1 = stickyHelpers$1.UNSUPPORTED_Y;
2189
-
2190
- var BASE_FORCED = DESCRIPTORS &&
2191
- (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL$1 || UNSUPPORTED_NCG$1 || fails(function () {
2192
- re2[MATCH] = false;
2193
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
2194
- return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
2195
- }));
2196
-
2197
- var handleDotAll = function (string) {
2198
- var length = string.length;
2199
- var index = 0;
2200
- var result = '';
2201
- var brackets = false;
2202
- var chr;
2203
- for (; index <= length; index++) {
2204
- chr = charAt$1(string, index);
2205
- if (chr === '\\') {
2206
- result += chr + charAt$1(string, ++index);
2207
- continue;
2208
- }
2209
- if (!brackets && chr === '.') {
2210
- result += '[\\s\\S]';
2211
- } else {
2212
- if (chr === '[') {
2213
- brackets = true;
2214
- } else if (chr === ']') {
2215
- brackets = false;
2216
- } result += chr;
2217
- }
2218
- } return result;
2219
- };
2220
-
2221
- var handleNCG = function (string) {
2222
- var length = string.length;
2223
- var index = 0;
2224
- var result = '';
2225
- var named = [];
2226
- var names = {};
2227
- var brackets = false;
2228
- var ncg = false;
2229
- var groupid = 0;
2230
- var groupname = '';
2231
- var chr;
2232
- for (; index <= length; index++) {
2233
- chr = charAt$1(string, index);
2234
- if (chr === '\\') {
2235
- chr = chr + charAt$1(string, ++index);
2236
- } else if (chr === ']') {
2237
- brackets = false;
2238
- } else if (!brackets) switch (true) {
2239
- case chr === '[':
2240
- brackets = true;
2241
- break;
2242
- case chr === '(':
2243
- if (exec$1(IS_NCG, stringSlice$1(string, index + 1))) {
2244
- index += 2;
2245
- ncg = true;
2246
- }
2247
- result += chr;
2248
- groupid++;
2249
- continue;
2250
- case chr === '>' && ncg:
2251
- if (groupname === '' || hasOwn(names, groupname)) {
2252
- throw new SyntaxError('Invalid capture group name');
2253
- }
2254
- names[groupname] = true;
2255
- named[named.length] = [groupname, groupid];
2256
- ncg = false;
2257
- groupname = '';
2258
- continue;
2259
- }
2260
- if (ncg) groupname += chr;
2261
- else result += chr;
2262
- } return [result, named];
2263
- };
2264
-
2265
- // `RegExp` constructor
2266
- // https://tc39.es/ecma262/#sec-regexp-constructor
2267
- if (isForced('RegExp', BASE_FORCED)) {
2268
- var RegExpWrapper = function RegExp(pattern, flags) {
2269
- var thisIsRegExp = isPrototypeOf(RegExpPrototype, this);
2270
- var patternIsRegExp = isRegExp(pattern);
2271
- var flagsAreUndefined = flags === undefined;
2272
- var groups = [];
2273
- var rawPattern = pattern;
2274
- var rawFlags, dotAll, sticky, handled, result, state;
2275
-
2276
- if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
2277
- return pattern;
2278
- }
2279
-
2280
- if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) {
2281
- pattern = pattern.source;
2282
- if (flagsAreUndefined) flags = getRegExpFlags(rawPattern);
2283
- }
2284
-
2285
- pattern = pattern === undefined ? '' : toString$1(pattern);
2286
- flags = flags === undefined ? '' : toString$1(flags);
2287
- rawPattern = pattern;
2288
-
2289
- if (UNSUPPORTED_DOT_ALL$1 && 'dotAll' in re1) {
2290
- dotAll = !!flags && stringIndexOf(flags, 's') > -1;
2291
- if (dotAll) flags = replace$1(flags, /s/g, '');
2292
- }
2293
-
2294
- rawFlags = flags;
2295
-
2296
- if (MISSED_STICKY && 'sticky' in re1) {
2297
- sticky = !!flags && stringIndexOf(flags, 'y') > -1;
2298
- if (sticky && UNSUPPORTED_Y$1) flags = replace$1(flags, /y/g, '');
2299
- }
2300
-
2301
- if (UNSUPPORTED_NCG$1) {
2302
- handled = handleNCG(pattern);
2303
- pattern = handled[0];
2304
- groups = handled[1];
2305
- }
2306
-
2307
- result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
2308
-
2309
- if (dotAll || sticky || groups.length) {
2310
- state = enforceInternalState(result);
2311
- if (dotAll) {
2312
- state.dotAll = true;
2313
- state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
2314
- }
2315
- if (sticky) state.sticky = true;
2316
- if (groups.length) state.groups = groups;
2317
- }
2318
-
2319
- if (pattern !== rawPattern) try {
2320
- // fails in old engines, but we have no alternatives for unsupported regex syntax
2321
- createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
2322
- } catch (error) { /* empty */ }
2323
-
2324
- return result;
2325
- };
2326
-
2327
- for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
2328
- proxyAccessor(RegExpWrapper, NativeRegExp, keys[index++]);
2329
- }
2330
-
2331
- RegExpPrototype.constructor = RegExpWrapper;
2332
- RegExpWrapper.prototype = RegExpPrototype;
2333
- defineBuiltIn(global$1, 'RegExp', RegExpWrapper, { constructor: true });
2334
- }
2335
-
2336
- // https://tc39.es/ecma262/#sec-get-regexp-@@species
2337
- setSpecies('RegExp');
2338
-
2339
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
2340
- /* eslint-disable regexp/no-useless-quantifier -- testing */
2341
- var call = functionCall;
2342
- var uncurryThis = functionUncurryThis;
2343
- var toString = toString$5;
2344
- var regexpFlags = regexpFlags$1;
2345
- var stickyHelpers = regexpStickyHelpers;
2346
- var shared = shared$4.exports;
2347
- var create = objectCreate;
2348
- var getInternalState = internalState.get;
2349
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
2350
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
2351
-
2352
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
2353
- var nativeExec = RegExp.prototype.exec;
2354
- var patchedExec = nativeExec;
2355
- var charAt = uncurryThis(''.charAt);
2356
- var indexOf = uncurryThis(''.indexOf);
2357
- var replace = uncurryThis(''.replace);
2358
- var stringSlice = uncurryThis(''.slice);
2359
-
2360
- var UPDATES_LAST_INDEX_WRONG = (function () {
2361
- var re1 = /a/;
2362
- var re2 = /b*/g;
2363
- call(nativeExec, re1, 'a');
2364
- call(nativeExec, re2, 'a');
2365
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2366
- })();
2367
-
2368
- var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
2369
-
2370
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
2371
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2372
-
2373
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
2374
-
2375
- if (PATCH) {
2376
- patchedExec = function exec(string) {
2377
- var re = this;
2378
- var state = getInternalState(re);
2379
- var str = toString(string);
2380
- var raw = state.raw;
2381
- var result, reCopy, lastIndex, match, i, object, group;
2382
-
2383
- if (raw) {
2384
- raw.lastIndex = re.lastIndex;
2385
- result = call(patchedExec, raw, str);
2386
- re.lastIndex = raw.lastIndex;
2387
- return result;
2388
- }
2389
-
2390
- var groups = state.groups;
2391
- var sticky = UNSUPPORTED_Y && re.sticky;
2392
- var flags = call(regexpFlags, re);
2393
- var source = re.source;
2394
- var charsAdded = 0;
2395
- var strCopy = str;
2396
-
2397
- if (sticky) {
2398
- flags = replace(flags, 'y', '');
2399
- if (indexOf(flags, 'g') === -1) {
2400
- flags += 'g';
2401
- }
2402
-
2403
- strCopy = stringSlice(str, re.lastIndex);
2404
- // Support anchored sticky behavior.
2405
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
2406
- source = '(?: ' + source + ')';
2407
- strCopy = ' ' + strCopy;
2408
- charsAdded++;
2409
- }
2410
- // ^(? + rx + ) is needed, in combination with some str slicing, to
2411
- // simulate the 'y' flag.
2412
- reCopy = new RegExp('^(?:' + source + ')', flags);
2413
- }
2414
-
2415
- if (NPCG_INCLUDED) {
2416
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
2417
- }
2418
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2419
-
2420
- match = call(nativeExec, sticky ? reCopy : re, strCopy);
2421
-
2422
- if (sticky) {
2423
- if (match) {
2424
- match.input = stringSlice(match.input, charsAdded);
2425
- match[0] = stringSlice(match[0], charsAdded);
2426
- match.index = re.lastIndex;
2427
- re.lastIndex += match[0].length;
2428
- } else re.lastIndex = 0;
2429
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
2430
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2431
- }
2432
- if (NPCG_INCLUDED && match && match.length > 1) {
2433
- // Fix browsers whose `exec` methods don't consistently return `undefined`
2434
- // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
2435
- call(nativeReplace, match[0], reCopy, function () {
2436
- for (i = 1; i < arguments.length - 2; i++) {
2437
- if (arguments[i] === undefined) match[i] = undefined;
2438
- }
2439
- });
2440
- }
2441
-
2442
- if (match && groups) {
2443
- match.groups = object = create(null);
2444
- for (i = 0; i < groups.length; i++) {
2445
- group = groups[i];
2446
- object[group[0]] = match[group[1]];
2447
- }
2448
- }
2449
-
2450
- return match;
2451
- };
2452
- }
2453
-
2454
- var regexpExec = patchedExec;
2455
-
2456
- var $ = _export;
2457
- var exec = regexpExec;
2458
-
2459
- // `RegExp.prototype.exec` method
2460
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
2461
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
2462
- exec: exec
2463
- });
2464
-
2465
- const getWebAddressValidationRules = definition => {
2466
- const defaultRules = {};
2467
- const pattern = {
2468
- pattern: {
2469
- value: RegExp("^(((https?|ftps?)://)(%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,][[:blank:|:blank:]])?$"),
2470
- message: `Must match url pattern`
2471
- }
2472
- };
2473
- return definition.uiEditable ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
2474
- };
2475
- const getNumberValidationRules = definition => {
2476
- const defaultRules = {
2477
- valueAsNumber: true
2478
- };
2479
- const minimum = definition.minimumNumber && {
2480
- min: {
2481
- value: definition.minimumNumber,
2482
- message: `minimum value is ${definition.minimumNumber}`
2483
- }
2484
- };
2485
- const maximum = definition.maximumNumber && {
2486
- max: {
2487
- value: definition.maximumNumber,
2488
- message: `maximum value is ${definition.maximumNumber}`
2489
- }
2490
- };
2491
- // TODO: Validate if integer if definition requires integer
2492
- return definition.uiEditable ? Object.assign(Object.assign(Object.assign({}, maximum), minimum), defaultRules) : defaultRules;
2493
- };
2494
- const getStringValidationRules = definition => {
2495
- const defaultRules = {};
2496
- const minLength = definition.minimumLength ? {
2497
- minLength: {
2498
- value: definition.minimumLength,
2499
- message: `minimum length is ${definition.minimumLength}`
2500
- },
2501
- required: {
2502
- value: true,
2503
- message: `minimum length is ${definition.minimumLength}`
2504
- }
2505
- } : undefined;
2506
- const maxLength = definition.maximumLength ? {
2507
- maxLength: {
2508
- value: definition.maximumLength,
2509
- message: `maximum length is ${definition.maximumLength}`
2510
- }
2511
- } : undefined;
2512
- const pattern = definition.pattern ? {
2513
- pattern: {
2514
- value: RegExp(definition.pattern),
2515
- message: `Must match pattern: ${definition.pattern}`
2516
- }
2517
- } : undefined;
2518
- return definition.uiEditable ? Object.assign(Object.assign(Object.assign(Object.assign({}, maxLength), minLength), pattern), defaultRules) : defaultRules;
2519
- };
2520
- const getBooleanValidationRules = definition => {
2521
- const defaultRules = {};
2522
- return defaultRules;
2523
- };
2524
- const getDropdownValidationRules = definition => {
2525
- const defaultRules = {};
2526
- return defaultRules;
2527
- };
2528
- const getDateValidationRules = definition => {
2529
- const defaultRules = {};
2530
- return defaultRules;
2531
- };
2532
- const getEmailValidationRules = definition => {
2533
- const defaultRules = {};
2534
- const pattern = {
2535
- pattern: {
2536
- value: RegExp("^[a-zA-Z0-9_+&*-]+(?:.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,7}$"),
2537
- message: `Must match email pattern`
2538
- }
2539
- };
2540
- return definition.uiEditable ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
2541
- };
2542
- const getPhoneNumberValidationRules = definition => {
2543
- const defaultRules = {};
2544
- const pattern = {
2545
- validate: value => isValidPhoneNumber(value) || value === ""
2546
- };
2547
- return definition.uiEditable ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
2548
- };
2549
-
2550
- let _ = t => t,
2551
- _t2,
2552
- _t3;
2553
- const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldId) => {
2554
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
2555
- const [isEditing, setIsEditing] = useState(false);
2556
- const [numberValue, setNumberValue] = useState(() => {
2557
- var _a;
2558
- if ((field === null || field === void 0 ? void 0 : field.definition) && field.definition.type === CustomFieldType.NUMBER) {
2559
- const typedValue = field.value;
2560
- return (_a = typedValue.numberValue) !== null && _a !== void 0 ? _a : field.definition.defaultNumberValue;
2561
- } else {
2562
- return "";
2563
- }
2564
- });
2565
- if ((field === null || field === void 0 ? void 0 : field.definition) === undefined || ((_a = field === null || field === void 0 ? void 0 : field.definition) === null || _a === void 0 ? void 0 : _a.type) === undefined) {
2566
- return null;
2567
- }
2568
- const key = (_b = fieldId !== null && fieldId !== void 0 ? fieldId : field.definition.key) !== null && _b !== void 0 ? _b : "";
2569
- const fieldError = key ? validation.formState.errors[key] : undefined;
2570
- const errorMessage = fieldError ? fieldError.message + "" : undefined;
2571
- const {
2572
- type,
2573
- description,
2574
- title
2575
- } = field.definition;
2576
- switch (type) {
2577
- case CustomFieldType.WEB_ADDRESS:
2578
- {
2579
- const typedDefinition = field.definition;
2580
- const typedValue = field.value;
2581
- const rules = getWebAddressValidationRules(typedDefinition);
2582
- return jsx(TextField, Object.assign({
2583
- id: key,
2584
- label: title,
2585
- placeholder: (_c = typedDefinition.title) !== null && _c !== void 0 ? _c : "",
2586
- defaultValue: (_e = (_d = typedValue.stringValue) !== null && _d !== void 0 ? _d : typedDefinition.defaultStringValue) !== null && _e !== void 0 ? _e : "",
2587
- dataTestId: "webAddressField",
2588
- actions: !typedDefinition.uiEditable && (typedValue.stringValue || typedDefinition.defaultStringValue) && jsx(ActionButton, {
2589
- value: (_f = typedValue.stringValue) !== null && _f !== void 0 ? _f : typedDefinition.defaultStringValue,
2590
- type: "WEB_ADDRESS"
2591
- }),
2592
- readOnly: !typedDefinition.uiEditable,
2593
- helpText: description,
2594
- errorMessage: errorMessage
2595
- }, validation.register(key, rules)));
2596
- }
2597
- case CustomFieldType.EMAIL:
2598
- {
2599
- const typedDefinition = field.definition;
2600
- const typedValue = field.value;
2601
- const rules = getEmailValidationRules(typedDefinition);
2602
- return jsx(TextField, Object.assign({
2603
- id: key,
2604
- label: title,
2605
- placeholder: (_g = typedDefinition.title) !== null && _g !== void 0 ? _g : "",
2606
- defaultValue: (_j = (_h = typedValue.stringValue) !== null && _h !== void 0 ? _h : typedDefinition.defaultStringValue) !== null && _j !== void 0 ? _j : "",
2607
- actions: !typedDefinition.uiEditable && (typedValue.stringValue || typedDefinition.defaultStringValue) && jsx(ActionButton, {
2608
- value: (_k = typedValue.stringValue) !== null && _k !== void 0 ? _k : typedDefinition.defaultStringValue,
2609
- type: "EMAIL"
2610
- }),
2611
- readOnly: !typedDefinition.uiEditable,
2612
- helpText: description,
2613
- errorMessage: errorMessage
2614
- }, validation.register(key, rules)));
2615
- }
2616
- case CustomFieldType.PHONE_NUMBER:
2617
- {
2618
- const typedDefinition = field.definition;
2619
- const typedValue = field.value;
2620
- const rules = getPhoneNumberValidationRules(typedDefinition);
2621
- return jsx(TextField, Object.assign({
2622
- label: title,
2623
- id: key,
2624
- placeholder: (_l = typedDefinition.title) !== null && _l !== void 0 ? _l : "",
2625
- defaultValue: (_o = (_m = typedValue.stringValue) !== null && _m !== void 0 ? _m : typedDefinition.defaultStringValue) !== null && _o !== void 0 ? _o : "",
2626
- actions: !typedDefinition.uiEditable && (typedValue.stringValue || typedDefinition.defaultStringValue) && jsx(ActionButton, {
2627
- value: (_p = typedValue.stringValue) !== null && _p !== void 0 ? _p : typedDefinition.defaultStringValue,
2628
- type: "PHONE_NUMBER"
2629
- }),
2630
- readOnly: !typedDefinition.uiEditable,
2631
- helpText: description,
2632
- errorMessage: errorMessage === "" ? "Must be a phone number" : undefined
2633
- }, validation.register(key, rules)));
2634
- }
2635
- case CustomFieldType.STRING:
2636
- {
2637
- const typedDefinition = field.definition;
2638
- const typedValue = field.value;
2639
- const rules = getStringValidationRules(typedDefinition);
2640
- return jsx(TextField, Object.assign({
2641
- label: title,
2642
- id: key || "string-field",
2643
- placeholder: (_q = typedDefinition.title) !== null && _q !== void 0 ? _q : "",
2644
- defaultValue: (_s = (_r = typedValue.stringValue) !== null && _r !== void 0 ? _r : typedDefinition.defaultStringValue) !== null && _s !== void 0 ? _s : "",
2645
- readOnly: !typedDefinition.uiEditable,
2646
- helpText: description,
2647
- errorMessage: errorMessage,
2648
- dataTestId: `stringField`
2649
- }, validation.register(key, rules)));
2650
- }
2651
- case CustomFieldType.NUMBER:
2652
- {
2653
- const typedDefinition = field.definition;
2654
- const typedValue = field.value;
2655
- const rules = getNumberValidationRules(typedDefinition);
2656
- const unit = unitPreference === "US_CUSTOMARY" ? typedDefinition.unitUs : typedDefinition.unitSi;
2657
- const numberProps = {
2658
- placeholder: (_t = typedDefinition.title) !== null && _t !== void 0 ? _t : "",
2659
- addonAfter: unit
2660
- };
2661
- return jsx(FormGroup, Object.assign({
2662
- label: title,
2663
- isInvalid: errorMessage ? true : false,
2664
- helpText: errorMessage || description,
2665
- dataTestId: `numberField-FormGroup`,
2666
- disabled: !typedDefinition.uiEditable
2667
- }, {
2668
- children: isEditing ? jsx(NumberInput, Object.assign({
2669
- id: key || "number-field",
2670
- dataTestId: "numberField",
2671
- defaultValue: (_v = (_u = typedValue.numberValue) !== null && _u !== void 0 ? _u : typedDefinition.defaultNumberValue) !== null && _v !== void 0 ? _v : "",
2672
- readOnly: !typedDefinition.uiEditable,
2673
- step: typedDefinition.isInteger ? 1 : "any",
2674
- min: (_w = typedDefinition.minimumNumber) !== null && _w !== void 0 ? _w : undefined,
2675
- max: (_x = typedDefinition.maximumNumber) !== null && _x !== void 0 ? _x : undefined
2676
- }, validation.register(key, rules), {
2677
- onBlur: () => setIsEditing(!isEditing),
2678
- onChange: e => {
2679
- setNumberValue(e.target.value);
2680
- validation.register(key, rules).onChange(e);
2681
- }
2682
- }, numberProps)) : jsx(BaseInput, Object.assign({
2683
- type: "text",
2684
- id: `${key}-number-field`,
2685
- dataTestId: `${key}-numberField`,
2686
- defaultValue: parseFloat(Number(numberValue).toPrecision(4)),
2687
- readOnly: true,
2688
- actions: jsx(ActionContainer, {
2689
- children: jsx(StyledIconButton, {
2690
- dataTestId: "editIconButtonId",
2691
- size: "small",
2692
- color: "tertiary",
2693
- icon: jsx(Icon, {
2694
- size: "small",
2695
- name: "PencilIcon"
2696
- }),
2697
- onClick: () => setIsEditing(!isEditing)
2698
- })
2699
- })
2700
- }, numberProps))
2701
- }));
2702
- }
2703
- case CustomFieldType.BOOLEAN:
2704
- {
2705
- const typedDefinition = field.definition;
2706
- const typedValue = field.value;
2707
- const rules = getBooleanValidationRules();
2708
- return jsx(BooleanCustomField, {
2709
- label: (_y = typedDefinition.title) !== null && _y !== void 0 ? _y : "",
2710
- id: key || "boolean-field",
2711
- defaultValue: (_0 = (_z = typedValue.booleanValue) !== null && _z !== void 0 ? _z : typedDefinition.defaultBooleanValue) !== null && _0 !== void 0 ? _0 : undefined,
2712
- readOnly: !typedDefinition.uiEditable,
2713
- register: validation.register,
2714
- validationRules: rules,
2715
- helpText: description,
2716
- setValue: validation.setValue,
2717
- errorMessage: errorMessage,
2718
- dataTestId: "booleanField"
2719
- }, key);
2720
- }
2721
- case CustomFieldType.DROPDOWN:
2722
- {
2723
- const typedDefinition = field.definition;
2724
- const typedValue = field.value;
2725
- const rules = getDropdownValidationRules();
2726
- return jsx(DropdownCustomField, {
2727
- label: typedDefinition.title || "",
2728
- id: key || "dropdown-field",
2729
- defaultValue: (_2 = (_1 = typedValue.stringArrayValue) !== null && _1 !== void 0 ? _1 : typedDefinition.defaultStringArrayValue) !== null && _2 !== void 0 ? _2 : undefined,
2730
- disabled: !typedDefinition.uiEditable,
2731
- allValues: (_3 = typedDefinition.allValues) !== null && _3 !== void 0 ? _3 : undefined,
2732
- multiSelect: (_4 = typedDefinition.multiSelect) !== null && _4 !== void 0 ? _4 : false,
2733
- register: validation.register,
2734
- validationRules: rules,
2735
- helpText: description,
2736
- setValue: validation.setValue,
2737
- errorMessage: errorMessage,
2738
- dataTestId: "dropdownField"
2739
- }, key);
2740
- }
2741
- case CustomFieldType.DATE:
2742
- {
2743
- const typedDefinition = field.definition;
2744
- const typedValue = field.value;
2745
- const rules = getDateValidationRules();
2746
- let defaultValue;
2747
- if (typedValue.dateValue !== undefined && typedValue.dateValue !== null) {
2748
- defaultValue = new Date(typedValue.dateValue);
2749
- } else if (typedDefinition.defaultDateValue !== undefined && typedDefinition.defaultDateValue !== null) {
2750
- defaultValue = new Date(typedDefinition.defaultDateValue);
2751
- }
2752
- return jsx(DateCustomField, {
2753
- dataTestId: "dateField",
2754
- id: key || "date-field",
2755
- defaultValue: defaultValue,
2756
- readOnly: !typedDefinition.uiEditable,
2757
- register: validation.register,
2758
- label: typedDefinition.title || "",
2759
- validationRules: rules,
2760
- helpText: description,
2761
- errorMessage: errorMessage,
2762
- setValue: validation.setValue,
2763
- title: field.definition.title || ""
2764
- }, key);
2765
- }
2766
- default:
2767
- throw new Error(`Type not supported: ${type}`);
2768
- }
2769
- };
2770
- const CustomField = ({
2771
- field,
2772
- register,
2773
- formState,
2774
- setValue,
2775
- unitPreference,
2776
- fieldId
2777
- }) => {
2778
- const fieldComponent = useCustomFieldResolver(field, {
2779
- register,
2780
- setValue,
2781
- formState
2782
- }, unitPreference, fieldId);
2783
- return fieldComponent;
2784
- };
2785
- const ActionContainer = tw.div(_t2 || (_t2 = _`
36
+ const BooleanCustomField = (_a) => {
37
+ var { defaultValue, dataTestId = "booleanField", onChange, value, id, setValue, register, validationRules, disabled = false, label, tip, isInvalid, errorMessage, helpAddon, maxLength, helpText } = _a, rest = __rest(_a, ["defaultValue", "dataTestId", "onChange", "value", "id", "setValue", "register", "validationRules", "disabled", "label", "tip", "isInvalid", "errorMessage", "helpAddon", "maxLength", "helpText"]);
38
+ const initialValue = value !== undefined ? value : defaultValue ? defaultValue : false;
39
+ const renderAsInvalid = isInvalid || Boolean(errorMessage);
40
+ const [internalValue, setInternalValue] = React.useState(initialValue);
41
+ React.useEffect(() => {
42
+ setInternalValue((value === undefined ? defaultValue : value) || false);
43
+ }, [value, setInternalValue, defaultValue]);
44
+ const onChangeHandler = React.useCallback((event) => {
45
+ var _a;
46
+ onChange && onChange(event);
47
+ const isChecked = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.checked) || false;
48
+ if (setValue) {
49
+ setValue(id, isChecked);
50
+ }
51
+ setInternalValue(isChecked);
52
+ }, [setInternalValue, onChange, id, setValue]);
53
+ React.useEffect(() => {
54
+ register && register(id, Object.assign(Object.assign({}, validationRules), { value: internalValue.toString() }));
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, []); // register only once
57
+ return (jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon || null, dataTestId: `${dataTestId}-FormGroup` }, { children: jsx(Checkbox, Object.assign({ checked: internalValue, dataTestId: dataTestId, id: id, disabled: disabled, name: id, onChange: onChangeHandler, isInvalid: renderAsInvalid }, rest)) })));
58
+ };
59
+
60
+ const DateCustomField = (props) => {
61
+ const { setValue, defaultValue, register, id, validationRules } = props, rest = __rest(props, ["setValue", "defaultValue", "register", "id", "validationRules"]);
62
+ const onChangeHandler = useCallback((e) => {
63
+ var _a, _b, _c, _d;
64
+ if (((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.valueAsDate) === null || _b === void 0 ? void 0 : _b.toISOString()) !== undefined) {
65
+ setValue && setValue(id, (_d = (_c = e.target) === null || _c === void 0 ? void 0 : _c.valueAsDate) === null || _d === void 0 ? void 0 : _d.toISOString());
66
+ }
67
+ }, [setValue, id]);
68
+ useEffect(() => {
69
+ const value = defaultValue && new Date(defaultValue);
70
+ register && register(id, Object.assign(Object.assign({}, validationRules), { value }));
71
+ }, [register, validationRules, defaultValue, id]);
72
+ return (jsx(DateField, Object.assign({}, rest, { helpAddon: props.helpAddon || null, helpText: props.errorMessage || props.helpText, onChange: onChangeHandler, label: props.title, defaultValue: defaultValue })));
73
+ };
74
+
75
+ const convertToValueFormat = (value) => {
76
+ return { label: value, value };
77
+ };
78
+ const DropdownCustomField = ({ defaultValue, dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid, helpAddon, }) => {
79
+ const renderAsInvalid = isInvalid || Boolean(errorMessage);
80
+ const [selectedValue, setSelectedValue] = React.useState(defaultValue ? defaultValue.map(convertToValueFormat) : []);
81
+ const onChangeHandler = React.useCallback((selected) => {
82
+ if (selected) {
83
+ const values = Array.isArray(selected) ? selected : [selected];
84
+ setSelectedValue(values);
85
+ setValue && setValue(id, values);
86
+ }
87
+ else {
88
+ setSelectedValue([]);
89
+ setValue && setValue(id, []);
90
+ }
91
+ }, [onChange]);
92
+ const options = React.useMemo(() => {
93
+ return allValues ? allValues.map(convertToValueFormat) : [];
94
+ }, [allValues]);
95
+ React.useEffect(() => {
96
+ register && register(id, Object.assign(Object.assign({}, validationRules), { value: selectedValue }));
97
+ }, [register, validationRules, selectedValue, id]);
98
+ return (jsx(FormGroup, Object.assign({ label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon || null, dataTestId: `${dataTestId}-FormGroup` }, { children: jsx(Select, { disabled: disabled, dataTestId: dataTestId, onChange: onChangeHandler, hasError: renderAsInvalid, options: options, value: selectedValue, isMulti: multiSelect, isClearable: true }) })));
99
+ };
100
+
101
+ const getWebAddressValidationRules = (definition) => {
102
+ const defaultRules = {};
103
+ const pattern = {
104
+ pattern: {
105
+ value: RegExp("^(((https?|ftps?)://)(%[0-9A-Fa-f]{2}|[-()_.!~*';/?:@&=+$,A-Za-z0-9])+)([).!';/?:,][[:blank:|:blank:]])?$"),
106
+ message: `Must match url pattern`,
107
+ },
108
+ };
109
+ return definition.uiEditable
110
+ ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
111
+ };
112
+ const getNumberValidationRules = (definition) => {
113
+ const defaultRules = { valueAsNumber: true };
114
+ const minimum = definition.minimumNumber && {
115
+ min: {
116
+ value: definition.minimumNumber,
117
+ message: `minimum value is ${definition.minimumNumber}`,
118
+ },
119
+ };
120
+ const maximum = definition.maximumNumber && {
121
+ max: {
122
+ value: definition.maximumNumber,
123
+ message: `maximum value is ${definition.maximumNumber}`,
124
+ },
125
+ };
126
+ // TODO: Validate if integer if definition requires integer
127
+ return definition.uiEditable
128
+ ? Object.assign(Object.assign(Object.assign({}, maximum), minimum), defaultRules) : defaultRules;
129
+ };
130
+ const getStringValidationRules = (definition) => {
131
+ const defaultRules = {};
132
+ const minLength = definition.minimumLength
133
+ ? {
134
+ minLength: {
135
+ value: definition.minimumLength,
136
+ message: `minimum length is ${definition.minimumLength}`,
137
+ },
138
+ required: {
139
+ value: true,
140
+ message: `minimum length is ${definition.minimumLength}`,
141
+ },
142
+ }
143
+ : undefined;
144
+ const maxLength = definition.maximumLength
145
+ ? {
146
+ maxLength: {
147
+ value: definition.maximumLength,
148
+ message: `maximum length is ${definition.maximumLength}`,
149
+ },
150
+ }
151
+ : undefined;
152
+ const pattern = definition.pattern
153
+ ? {
154
+ pattern: {
155
+ value: RegExp(definition.pattern),
156
+ message: `Must match pattern: ${definition.pattern}`,
157
+ },
158
+ }
159
+ : undefined;
160
+ return definition.uiEditable
161
+ ? Object.assign(Object.assign(Object.assign(Object.assign({}, maxLength), minLength), pattern), defaultRules) : defaultRules;
162
+ };
163
+ const getBooleanValidationRules = (definition) => {
164
+ const defaultRules = {};
165
+ return defaultRules;
166
+ };
167
+ const getDropdownValidationRules = (definition) => {
168
+ const defaultRules = {};
169
+ return defaultRules;
170
+ };
171
+ const getDateValidationRules = (definition) => {
172
+ const defaultRules = {};
173
+ return defaultRules;
174
+ };
175
+ const getEmailValidationRules = (definition) => {
176
+ const defaultRules = {};
177
+ const pattern = {
178
+ pattern: {
179
+ value: RegExp("^[a-zA-Z0-9_+&*-]+(?:.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+.)+[a-zA-Z]{2,7}$"),
180
+ message: `Must match email pattern`,
181
+ },
182
+ };
183
+ return definition.uiEditable
184
+ ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
185
+ };
186
+ const getPhoneNumberValidationRules = (definition) => {
187
+ const defaultRules = {};
188
+ const pattern = {
189
+ validate: value => isValidPhoneNumber(value) || value === "",
190
+ };
191
+ return definition.uiEditable
192
+ ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;
193
+ };
194
+
195
+ const useCustomFieldResolver = (field, validation, unitPreference = "SI", fieldId) => {
196
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
197
+ const [isEditing, setIsEditing] = useState(false);
198
+ const [numberValue, setNumberValue] = useState(() => {
199
+ var _a;
200
+ if ((field === null || field === void 0 ? void 0 : field.definition) && field.definition.type === CustomFieldType.NUMBER) {
201
+ const typedValue = field.value;
202
+ return (_a = typedValue.numberValue) !== null && _a !== void 0 ? _a : field.definition.defaultNumberValue;
203
+ }
204
+ else {
205
+ return "";
206
+ }
207
+ });
208
+ if ((field === null || field === void 0 ? void 0 : field.definition) === undefined || ((_a = field === null || field === void 0 ? void 0 : field.definition) === null || _a === void 0 ? void 0 : _a.type) === undefined) {
209
+ return null;
210
+ }
211
+ const key = (_b = fieldId !== null && fieldId !== void 0 ? fieldId : field.definition.key) !== null && _b !== void 0 ? _b : "";
212
+ const fieldError = key ? validation.formState.errors[key] : undefined;
213
+ const errorMessage = fieldError ? fieldError.message + "" : undefined;
214
+ const { type, description, title } = field.definition;
215
+ switch (type) {
216
+ case CustomFieldType.WEB_ADDRESS: {
217
+ const typedDefinition = field.definition;
218
+ const typedValue = field.value;
219
+ const rules = getWebAddressValidationRules(typedDefinition);
220
+ return (jsx(TextField, Object.assign({ id: key, label: title, placeholder: (_c = typedDefinition.title) !== null && _c !== void 0 ? _c : "", defaultValue: (_e = (_d = typedValue.stringValue) !== null && _d !== void 0 ? _d : typedDefinition.defaultStringValue) !== null && _e !== void 0 ? _e : "", dataTestId: "webAddressField", actions: !typedDefinition.uiEditable &&
221
+ (typedValue.stringValue || typedDefinition.defaultStringValue) && (jsx(ActionButton, { value: (_f = typedValue.stringValue) !== null && _f !== void 0 ? _f : typedDefinition.defaultStringValue, type: "WEB_ADDRESS" })), readOnly: !typedDefinition.uiEditable, helpText: description, errorMessage: errorMessage }, validation.register(key, rules))));
222
+ }
223
+ case CustomFieldType.EMAIL: {
224
+ const typedDefinition = field.definition;
225
+ const typedValue = field.value;
226
+ const rules = getEmailValidationRules(typedDefinition);
227
+ return (jsx(TextField, Object.assign({ id: key, label: title, placeholder: (_g = typedDefinition.title) !== null && _g !== void 0 ? _g : "", defaultValue: (_j = (_h = typedValue.stringValue) !== null && _h !== void 0 ? _h : typedDefinition.defaultStringValue) !== null && _j !== void 0 ? _j : "", actions: !typedDefinition.uiEditable &&
228
+ (typedValue.stringValue || typedDefinition.defaultStringValue) && (jsx(ActionButton, { value: (_k = typedValue.stringValue) !== null && _k !== void 0 ? _k : typedDefinition.defaultStringValue, type: "EMAIL" })), readOnly: !typedDefinition.uiEditable, helpText: description, errorMessage: errorMessage }, validation.register(key, rules))));
229
+ }
230
+ case CustomFieldType.PHONE_NUMBER: {
231
+ const typedDefinition = field.definition;
232
+ const typedValue = field.value;
233
+ const rules = getPhoneNumberValidationRules(typedDefinition);
234
+ return (jsx(TextField, Object.assign({ label: title, id: key, placeholder: (_l = typedDefinition.title) !== null && _l !== void 0 ? _l : "", defaultValue: (_o = (_m = typedValue.stringValue) !== null && _m !== void 0 ? _m : typedDefinition.defaultStringValue) !== null && _o !== void 0 ? _o : "", actions: !typedDefinition.uiEditable &&
235
+ (typedValue.stringValue || typedDefinition.defaultStringValue) && (jsx(ActionButton, { value: (_p = typedValue.stringValue) !== null && _p !== void 0 ? _p : typedDefinition.defaultStringValue, type: "PHONE_NUMBER" })), readOnly: !typedDefinition.uiEditable, helpText: description, errorMessage: errorMessage === "" ? "Must be a phone number" : undefined }, validation.register(key, rules))));
236
+ }
237
+ case CustomFieldType.STRING: {
238
+ const typedDefinition = field.definition;
239
+ const typedValue = field.value;
240
+ const rules = getStringValidationRules(typedDefinition);
241
+ return (jsx(TextField, Object.assign({ label: title, id: key || "string-field", placeholder: (_q = typedDefinition.title) !== null && _q !== void 0 ? _q : "", defaultValue: (_s = (_r = typedValue.stringValue) !== null && _r !== void 0 ? _r : typedDefinition.defaultStringValue) !== null && _s !== void 0 ? _s : "", readOnly: !typedDefinition.uiEditable, helpText: description, errorMessage: errorMessage, dataTestId: `stringField` }, validation.register(key, rules))));
242
+ }
243
+ case CustomFieldType.NUMBER: {
244
+ const typedDefinition = field.definition;
245
+ const typedValue = field.value;
246
+ const rules = getNumberValidationRules(typedDefinition);
247
+ const unit = unitPreference === "US_CUSTOMARY" ? typedDefinition.unitUs : typedDefinition.unitSi;
248
+ const numberProps = {
249
+ placeholder: (_t = typedDefinition.title) !== null && _t !== void 0 ? _t : "",
250
+ addonAfter: unit,
251
+ };
252
+ return (jsx(FormGroup, Object.assign({ label: title, isInvalid: errorMessage ? true : false, helpText: errorMessage || description, dataTestId: `numberField-FormGroup`, disabled: !typedDefinition.uiEditable }, { children: isEditing ? (jsx(NumberInput, Object.assign({ id: key || "number-field", dataTestId: "numberField", defaultValue: (_v = (_u = typedValue.numberValue) !== null && _u !== void 0 ? _u : typedDefinition.defaultNumberValue) !== null && _v !== void 0 ? _v : "", readOnly: !typedDefinition.uiEditable, step: typedDefinition.isInteger ? 1 : "any", min: (_w = typedDefinition.minimumNumber) !== null && _w !== void 0 ? _w : undefined, max: (_x = typedDefinition.maximumNumber) !== null && _x !== void 0 ? _x : undefined }, validation.register(key, rules), { onBlur: () => setIsEditing(!isEditing), onChange: e => {
253
+ setNumberValue(e.target.value);
254
+ validation.register(key, rules).onChange(e);
255
+ } }, numberProps))) : (jsx(BaseInput, Object.assign({ type: "text", id: `${key}-number-field`, dataTestId: `${key}-numberField`, defaultValue: parseFloat(Number(numberValue).toPrecision(4)), readOnly: true, actions: jsx(ActionContainer, { children: jsx(StyledIconButton, { dataTestId: "editIconButtonId", size: "small", color: "tertiary", icon: jsx(Icon, { size: "small", name: "PencilIcon" }), onClick: () => setIsEditing(!isEditing) }) }) }, numberProps))) })));
256
+ }
257
+ case CustomFieldType.BOOLEAN: {
258
+ const typedDefinition = field.definition;
259
+ const typedValue = field.value;
260
+ const rules = getBooleanValidationRules();
261
+ return (jsx(BooleanCustomField, { label: (_y = typedDefinition.title) !== null && _y !== void 0 ? _y : "", id: key || "boolean-field", defaultValue: (_0 = (_z = typedValue.booleanValue) !== null && _z !== void 0 ? _z : typedDefinition.defaultBooleanValue) !== null && _0 !== void 0 ? _0 : undefined, readOnly: !typedDefinition.uiEditable, register: validation.register, validationRules: rules, helpText: description, setValue: validation.setValue, errorMessage: errorMessage, dataTestId: "booleanField" }, key));
262
+ }
263
+ case CustomFieldType.DROPDOWN: {
264
+ const typedDefinition = field.definition;
265
+ const typedValue = field.value;
266
+ const rules = getDropdownValidationRules();
267
+ return (jsx(DropdownCustomField, { label: typedDefinition.title || "", id: key || "dropdown-field", defaultValue: (_2 = (_1 = typedValue.stringArrayValue) !== null && _1 !== void 0 ? _1 : typedDefinition.defaultStringArrayValue) !== null && _2 !== void 0 ? _2 : undefined, disabled: !typedDefinition.uiEditable, allValues: (_3 = typedDefinition.allValues) !== null && _3 !== void 0 ? _3 : undefined, multiSelect: (_4 = typedDefinition.multiSelect) !== null && _4 !== void 0 ? _4 : false, register: validation.register, validationRules: rules, helpText: description, setValue: validation.setValue, errorMessage: errorMessage, dataTestId: "dropdownField" }, key));
268
+ }
269
+ case CustomFieldType.DATE: {
270
+ const typedDefinition = field.definition;
271
+ const typedValue = field.value;
272
+ const rules = getDateValidationRules();
273
+ let defaultValue;
274
+ if (typedValue.dateValue !== undefined && typedValue.dateValue !== null) {
275
+ defaultValue = new Date(typedValue.dateValue);
276
+ }
277
+ else if (typedDefinition.defaultDateValue !== undefined && typedDefinition.defaultDateValue !== null) {
278
+ defaultValue = new Date(typedDefinition.defaultDateValue);
279
+ }
280
+ return (jsx(DateCustomField, { dataTestId: "dateField", id: key || "date-field", defaultValue: defaultValue, readOnly: !typedDefinition.uiEditable, register: validation.register, label: typedDefinition.title || "", validationRules: rules, helpText: description, errorMessage: errorMessage, setValue: validation.setValue, title: field.definition.title || "" }, key));
281
+ }
282
+ default:
283
+ throw new Error(`Type not supported: ${type}`);
284
+ }
285
+ };
286
+ const CustomField = ({ field, register, formState, setValue, unitPreference, fieldId }) => {
287
+ const fieldComponent = useCustomFieldResolver(field, { register, setValue, formState }, unitPreference, fieldId);
288
+ return fieldComponent;
289
+ };
290
+ const ActionContainer = tw.div `
2786
291
  tu-action-container
2787
- `));
2788
- const StyledIconButton = twx(IconButton)(_t3 || (_t3 = _`
292
+ `;
293
+ const StyledIconButton = twx(IconButton) `
2789
294
  tu-action-button
2790
- `));
295
+ `;
2791
296
 
2792
297
  export { CustomField, useCustomFieldResolver };