@bolttech/form-engine 3.0.2-beta.8 → 3.0.2

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.esm.js CHANGED
@@ -1,10 +1,11 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { FormGroup, FormCore } from '@bolttech/form-engine-core';
3
- import { createContext, useContext, useRef, useMemo, useState, useEffect, useCallback, Suspense, Children } from 'react';
1
+ 'use client';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { createContext, useContext, useRef, useEffect, useState, useMemo, useCallback, Suspense } from 'react';
4
+ import { FormGroup, FormField } from '@bolttech/form-engine-core';
4
5
 
5
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
7
 
7
- var fails$h = function (exec) {
8
+ var fails$j = function (exec) {
8
9
  try {
9
10
  return !!exec();
10
11
  } catch (error) {
@@ -12,75 +13,76 @@ var fails$h = function (exec) {
12
13
  }
13
14
  };
14
15
 
15
- var fails$g = fails$h;
16
+ var fails$i = fails$j;
16
17
 
17
- var functionBindNative = !fails$g(function () {
18
+ var functionBindNative = !fails$i(function () {
18
19
  // eslint-disable-next-line es/no-function-prototype-bind -- safe
19
20
  var test = (function () { /* empty */ }).bind();
20
21
  // eslint-disable-next-line no-prototype-builtins -- safe
21
22
  return typeof test != 'function' || test.hasOwnProperty('prototype');
22
23
  });
23
24
 
24
- var NATIVE_BIND$1 = functionBindNative;
25
+ var NATIVE_BIND$3 = functionBindNative;
25
26
 
26
- var FunctionPrototype$1 = Function.prototype;
27
- var call$8 = FunctionPrototype$1.call;
28
- var uncurryThisWithBind = NATIVE_BIND$1 && FunctionPrototype$1.bind.bind(call$8, call$8);
27
+ var FunctionPrototype$2 = Function.prototype;
28
+ var call$f = FunctionPrototype$2.call;
29
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
30
+ var uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$2.bind.bind(call$f, call$f);
29
31
 
30
- var functionUncurryThis = NATIVE_BIND$1 ? uncurryThisWithBind : function (fn) {
32
+ var functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function (fn) {
31
33
  return function () {
32
- return call$8.apply(fn, arguments);
34
+ return call$f.apply(fn, arguments);
33
35
  };
34
36
  };
35
37
 
36
38
  var uncurryThis$f = functionUncurryThis;
37
39
 
38
- var toString$5 = uncurryThis$f({}.toString);
39
- var stringSlice$3 = uncurryThis$f(''.slice);
40
+ var toString$4 = uncurryThis$f({}.toString);
41
+ var stringSlice$1 = uncurryThis$f(''.slice);
40
42
 
41
43
  var classofRaw$2 = function (it) {
42
- return stringSlice$3(toString$5(it), 8, -1);
44
+ return stringSlice$1(toString$4(it), 8, -1);
43
45
  };
44
46
 
45
47
  var uncurryThis$e = functionUncurryThis;
46
- var fails$f = fails$h;
47
- var classof$3 = classofRaw$2;
48
+ var fails$h = fails$j;
49
+ var classof$5 = classofRaw$2;
48
50
 
49
51
  var $Object$4 = Object;
50
52
  var split = uncurryThis$e(''.split);
51
53
 
52
54
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
53
- var indexedObject = fails$f(function () {
55
+ var indexedObject = fails$h(function () {
54
56
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
55
57
  // eslint-disable-next-line no-prototype-builtins -- safe
56
58
  return !$Object$4('z').propertyIsEnumerable(0);
57
59
  }) ? function (it) {
58
- return classof$3(it) === 'String' ? split(it, '') : $Object$4(it);
60
+ return classof$5(it) === 'String' ? split(it, '') : $Object$4(it);
59
61
  } : $Object$4;
60
62
 
61
63
  // we can't use just `it == null` since of `document.all` special case
62
64
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
63
- var isNullOrUndefined$2 = function (it) {
65
+ var isNullOrUndefined$3 = function (it) {
64
66
  return it === null || it === undefined;
65
67
  };
66
68
 
67
- var isNullOrUndefined$1 = isNullOrUndefined$2;
69
+ var isNullOrUndefined$2 = isNullOrUndefined$3;
68
70
 
69
- var $TypeError$8 = TypeError;
71
+ var $TypeError$f = TypeError;
70
72
 
71
73
  // `RequireObjectCoercible` abstract operation
72
74
  // https://tc39.es/ecma262/#sec-requireobjectcoercible
73
- var requireObjectCoercible$4 = function (it) {
74
- if (isNullOrUndefined$1(it)) throw new $TypeError$8("Can't call method on " + it);
75
+ var requireObjectCoercible$3 = function (it) {
76
+ if (isNullOrUndefined$2(it)) throw new $TypeError$f("Can't call method on " + it);
75
77
  return it;
76
78
  };
77
79
 
78
80
  // toObject with fallback for non-array-like ES3 strings
79
- var IndexedObject$1 = indexedObject;
80
- var requireObjectCoercible$3 = requireObjectCoercible$4;
81
+ var IndexedObject$2 = indexedObject;
82
+ var requireObjectCoercible$2 = requireObjectCoercible$3;
81
83
 
82
84
  var toIndexedObject$5 = function (it) {
83
- return IndexedObject$1(requireObjectCoercible$3(it));
85
+ return IndexedObject$2(requireObjectCoercible$2(it));
84
86
  };
85
87
 
86
88
  var check = function (it) {
@@ -88,7 +90,7 @@ var check = function (it) {
88
90
  };
89
91
 
90
92
  // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
91
- var global$e =
93
+ var globalThis_1 =
92
94
  // eslint-disable-next-line es/no-global-this -- safe
93
95
  check(typeof globalThis == 'object' && globalThis) ||
94
96
  check(typeof window == 'object' && window) ||
@@ -101,51 +103,53 @@ var global$e =
101
103
 
102
104
  var sharedStore = {exports: {}};
103
105
 
104
- var global$d = global$e;
106
+ var globalThis$h = globalThis_1;
105
107
 
106
108
  // eslint-disable-next-line es/no-object-defineproperty -- safe
107
- var defineProperty$5 = Object.defineProperty;
109
+ var defineProperty$7 = Object.defineProperty;
108
110
 
109
111
  var defineGlobalProperty$3 = function (key, value) {
110
112
  try {
111
- defineProperty$5(global$d, key, { value: value, configurable: true, writable: true });
113
+ defineProperty$7(globalThis$h, key, { value: value, configurable: true, writable: true });
112
114
  } catch (error) {
113
- global$d[key] = value;
115
+ globalThis$h[key] = value;
114
116
  } return value;
115
117
  };
116
118
 
117
- var globalThis$1 = global$e;
119
+ var globalThis$g = globalThis_1;
118
120
  var defineGlobalProperty$2 = defineGlobalProperty$3;
119
121
 
120
122
  var SHARED = '__core-js_shared__';
121
- var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
123
+ var store$3 = sharedStore.exports = globalThis$g[SHARED] || defineGlobalProperty$2(SHARED, {});
122
124
 
123
125
  (store$3.versions || (store$3.versions = [])).push({
124
- version: '3.37.1',
126
+ version: '3.45.1',
125
127
  mode: 'global',
126
- copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
127
- license: 'https://github.com/zloirock/core-js/blob/v3.37.1/LICENSE',
128
+ copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
129
+ license: 'https://github.com/zloirock/core-js/blob/v3.45.1/LICENSE',
128
130
  source: 'https://github.com/zloirock/core-js'
129
131
  });
130
132
 
131
- var store$2 = sharedStore.exports;
133
+ var sharedStoreExports = sharedStore.exports;
134
+
135
+ var store$2 = sharedStoreExports;
132
136
 
133
- var shared$4 = function (key, value) {
137
+ var shared$3 = function (key, value) {
134
138
  return store$2[key] || (store$2[key] = value || {});
135
139
  };
136
140
 
137
- var requireObjectCoercible$2 = requireObjectCoercible$4;
141
+ var requireObjectCoercible$1 = requireObjectCoercible$3;
138
142
 
139
143
  var $Object$3 = Object;
140
144
 
141
145
  // `ToObject` abstract operation
142
146
  // https://tc39.es/ecma262/#sec-toobject
143
- var toObject$4 = function (argument) {
144
- return $Object$3(requireObjectCoercible$2(argument));
147
+ var toObject$6 = function (argument) {
148
+ return $Object$3(requireObjectCoercible$1(argument));
145
149
  };
146
150
 
147
151
  var uncurryThis$d = functionUncurryThis;
148
- var toObject$3 = toObject$4;
152
+ var toObject$5 = toObject$6;
149
153
 
150
154
  var hasOwnProperty = uncurryThis$d({}.hasOwnProperty);
151
155
 
@@ -153,27 +157,32 @@ var hasOwnProperty = uncurryThis$d({}.hasOwnProperty);
153
157
  // https://tc39.es/ecma262/#sec-hasownproperty
154
158
  // eslint-disable-next-line es/no-object-hasown -- safe
155
159
  var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
156
- return hasOwnProperty(toObject$3(it), key);
160
+ return hasOwnProperty(toObject$5(it), key);
157
161
  };
158
162
 
159
163
  var uncurryThis$c = functionUncurryThis;
160
164
 
161
165
  var id = 0;
162
166
  var postfix = Math.random();
163
- var toString$4 = uncurryThis$c(1.0.toString);
167
+ var toString$3 = uncurryThis$c(1.1.toString);
164
168
 
165
169
  var uid$2 = function (key) {
166
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$4(++id + postfix, 36);
170
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
167
171
  };
168
172
 
169
- var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
173
+ var globalThis$f = globalThis_1;
174
+
175
+ var navigator = globalThis$f.navigator;
176
+ var userAgent$4 = navigator && navigator.userAgent;
177
+
178
+ var environmentUserAgent = userAgent$4 ? String(userAgent$4) : '';
170
179
 
171
- var global$c = global$e;
172
- var userAgent$2 = engineUserAgent;
180
+ var globalThis$e = globalThis_1;
181
+ var userAgent$3 = environmentUserAgent;
173
182
 
174
- var process = global$c.process;
175
- var Deno = global$c.Deno;
176
- var versions = process && process.versions || Deno && Deno.version;
183
+ var process = globalThis$e.process;
184
+ var Deno$1 = globalThis$e.Deno;
185
+ var versions = process && process.versions || Deno$1 && Deno$1.version;
177
186
  var v8 = versions && versions.v8;
178
187
  var match, version;
179
188
 
@@ -186,25 +195,25 @@ if (v8) {
186
195
 
187
196
  // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
188
197
  // so check `userAgent` even if `.v8` exists, but 0
189
- if (!version && userAgent$2) {
190
- match = userAgent$2.match(/Edge\/(\d+)/);
198
+ if (!version && userAgent$3) {
199
+ match = userAgent$3.match(/Edge\/(\d+)/);
191
200
  if (!match || match[1] >= 74) {
192
- match = userAgent$2.match(/Chrome\/(\d+)/);
201
+ match = userAgent$3.match(/Chrome\/(\d+)/);
193
202
  if (match) version = +match[1];
194
203
  }
195
204
  }
196
205
 
197
- var engineV8Version = version;
206
+ var environmentV8Version = version;
198
207
 
199
208
  /* eslint-disable es/no-symbol -- required for testing */
200
- var V8_VERSION = engineV8Version;
201
- var fails$e = fails$h;
202
- var global$b = global$e;
209
+ var V8_VERSION = environmentV8Version;
210
+ var fails$g = fails$j;
211
+ var globalThis$d = globalThis_1;
203
212
 
204
- var $String$5 = global$b.String;
213
+ var $String$5 = globalThis$d.String;
205
214
 
206
215
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
207
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
216
+ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$g(function () {
208
217
  var symbol = Symbol('symbol detection');
209
218
  // Chrome 38 Symbol has incorrect toString conversion
210
219
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
@@ -218,24 +227,24 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(func
218
227
  /* eslint-disable es/no-symbol -- required for testing */
219
228
  var NATIVE_SYMBOL$1 = symbolConstructorDetection;
220
229
 
221
- var useSymbolAsUid = NATIVE_SYMBOL$1
222
- && !Symbol.sham
223
- && typeof Symbol.iterator == 'symbol';
230
+ var useSymbolAsUid = NATIVE_SYMBOL$1 &&
231
+ !Symbol.sham &&
232
+ typeof Symbol.iterator == 'symbol';
224
233
 
225
- var global$a = global$e;
226
- var shared$3 = shared$4;
227
- var hasOwn$9 = hasOwnProperty_1;
234
+ var globalThis$c = globalThis_1;
235
+ var shared$2 = shared$3;
236
+ var hasOwn$b = hasOwnProperty_1;
228
237
  var uid$1 = uid$2;
229
238
  var NATIVE_SYMBOL = symbolConstructorDetection;
230
239
  var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
231
240
 
232
- var Symbol$1 = global$a.Symbol;
233
- var WellKnownSymbolsStore = shared$3('wks');
241
+ var Symbol$1 = globalThis$c.Symbol;
242
+ var WellKnownSymbolsStore = shared$2('wks');
234
243
  var createWellKnownSymbol = USE_SYMBOL_AS_UID$1 ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
235
244
 
236
- var wellKnownSymbol$a = function (name) {
237
- if (!hasOwn$9(WellKnownSymbolsStore, name)) {
238
- WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$9(Symbol$1, name)
245
+ var wellKnownSymbol$c = function (name) {
246
+ if (!hasOwn$b(WellKnownSymbolsStore, name)) {
247
+ WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$b(Symbol$1, name)
239
248
  ? Symbol$1[name]
240
249
  : createWellKnownSymbol('Symbol.' + name);
241
250
  } return WellKnownSymbolsStore[name];
@@ -247,45 +256,45 @@ var documentAll = typeof document == 'object' && document.all;
247
256
  // `IsCallable` abstract operation
248
257
  // https://tc39.es/ecma262/#sec-iscallable
249
258
  // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
250
- var isCallable$e = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
259
+ var isCallable$g = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
251
260
  return typeof argument == 'function' || argument === documentAll;
252
261
  } : function (argument) {
253
262
  return typeof argument == 'function';
254
263
  };
255
264
 
256
- var isCallable$d = isCallable$e;
265
+ var isCallable$f = isCallable$g;
257
266
 
258
- var isObject$9 = function (it) {
259
- return typeof it == 'object' ? it !== null : isCallable$d(it);
267
+ var isObject$a = function (it) {
268
+ return typeof it == 'object' ? it !== null : isCallable$f(it);
260
269
  };
261
270
 
262
- var isObject$8 = isObject$9;
271
+ var isObject$9 = isObject$a;
263
272
 
264
273
  var $String$4 = String;
265
- var $TypeError$7 = TypeError;
274
+ var $TypeError$e = TypeError;
266
275
 
267
276
  // `Assert: Type(argument) is Object`
268
- var anObject$6 = function (argument) {
269
- if (isObject$8(argument)) return argument;
270
- throw new $TypeError$7($String$4(argument) + ' is not an object');
277
+ var anObject$f = function (argument) {
278
+ if (isObject$9(argument)) return argument;
279
+ throw new $TypeError$e($String$4(argument) + ' is not an object');
271
280
  };
272
281
 
273
282
  var objectDefineProperties = {};
274
283
 
275
- var fails$d = fails$h;
284
+ var fails$f = fails$j;
276
285
 
277
286
  // Detect IE8's incomplete defineProperty implementation
278
- var descriptors = !fails$d(function () {
287
+ var descriptors = !fails$f(function () {
279
288
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
280
289
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
281
290
  });
282
291
 
283
- var DESCRIPTORS$9 = descriptors;
284
- var fails$c = fails$h;
292
+ var DESCRIPTORS$d = descriptors;
293
+ var fails$e = fails$j;
285
294
 
286
295
  // V8 ~ Chrome 36-
287
296
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
288
- var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$c(function () {
297
+ var v8PrototypeDefineBug = DESCRIPTORS$d && fails$e(function () {
289
298
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
290
299
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
291
300
  value: 42,
@@ -295,55 +304,55 @@ var v8PrototypeDefineBug = DESCRIPTORS$9 && fails$c(function () {
295
304
 
296
305
  var objectDefineProperty = {};
297
306
 
298
- var global$9 = global$e;
299
- var isObject$7 = isObject$9;
307
+ var globalThis$b = globalThis_1;
308
+ var isObject$8 = isObject$a;
300
309
 
301
- var document$1 = global$9.document;
310
+ var document$1 = globalThis$b.document;
302
311
  // typeof document.createElement is 'object' in old IE
303
- var EXISTS$1 = isObject$7(document$1) && isObject$7(document$1.createElement);
312
+ var EXISTS$1 = isObject$8(document$1) && isObject$8(document$1.createElement);
304
313
 
305
314
  var documentCreateElement$2 = function (it) {
306
315
  return EXISTS$1 ? document$1.createElement(it) : {};
307
316
  };
308
317
 
309
- var DESCRIPTORS$8 = descriptors;
310
- var fails$b = fails$h;
318
+ var DESCRIPTORS$c = descriptors;
319
+ var fails$d = fails$j;
311
320
  var createElement = documentCreateElement$2;
312
321
 
313
322
  // Thanks to IE8 for its funny defineProperty
314
- var ie8DomDefine = !DESCRIPTORS$8 && !fails$b(function () {
323
+ var ie8DomDefine = !DESCRIPTORS$c && !fails$d(function () {
315
324
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
316
325
  return Object.defineProperty(createElement('div'), 'a', {
317
326
  get: function () { return 7; }
318
327
  }).a !== 7;
319
328
  });
320
329
 
321
- var NATIVE_BIND = functionBindNative;
322
-
323
- var call$7 = Function.prototype.call;
330
+ var NATIVE_BIND$2 = functionBindNative;
324
331
 
325
- var functionCall = NATIVE_BIND ? call$7.bind(call$7) : function () {
326
- return call$7.apply(call$7, arguments);
332
+ var call$e = Function.prototype.call;
333
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
334
+ var functionCall = NATIVE_BIND$2 ? call$e.bind(call$e) : function () {
335
+ return call$e.apply(call$e, arguments);
327
336
  };
328
337
 
329
- var global$8 = global$e;
330
- var isCallable$c = isCallable$e;
338
+ var globalThis$a = globalThis_1;
339
+ var isCallable$e = isCallable$g;
331
340
 
332
341
  var aFunction = function (argument) {
333
- return isCallable$c(argument) ? argument : undefined;
342
+ return isCallable$e(argument) ? argument : undefined;
334
343
  };
335
344
 
336
- var getBuiltIn$3 = function (namespace, method) {
337
- return arguments.length < 2 ? aFunction(global$8[namespace]) : global$8[namespace] && global$8[namespace][method];
345
+ var getBuiltIn$4 = function (namespace, method) {
346
+ return arguments.length < 2 ? aFunction(globalThis$a[namespace]) : globalThis$a[namespace] && globalThis$a[namespace][method];
338
347
  };
339
348
 
340
349
  var uncurryThis$b = functionUncurryThis;
341
350
 
342
351
  var objectIsPrototypeOf = uncurryThis$b({}.isPrototypeOf);
343
352
 
344
- var getBuiltIn$2 = getBuiltIn$3;
345
- var isCallable$b = isCallable$e;
346
- var isPrototypeOf$1 = objectIsPrototypeOf;
353
+ var getBuiltIn$3 = getBuiltIn$4;
354
+ var isCallable$d = isCallable$g;
355
+ var isPrototypeOf$4 = objectIsPrototypeOf;
347
356
  var USE_SYMBOL_AS_UID = useSymbolAsUid;
348
357
 
349
358
  var $Object$2 = Object;
@@ -351,13 +360,13 @@ var $Object$2 = Object;
351
360
  var isSymbol$2 = USE_SYMBOL_AS_UID ? function (it) {
352
361
  return typeof it == 'symbol';
353
362
  } : function (it) {
354
- var $Symbol = getBuiltIn$2('Symbol');
355
- return isCallable$b($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
363
+ var $Symbol = getBuiltIn$3('Symbol');
364
+ return isCallable$d($Symbol) && isPrototypeOf$4($Symbol.prototype, $Object$2(it));
356
365
  };
357
366
 
358
367
  var $String$3 = String;
359
368
 
360
- var tryToString$2 = function (argument) {
369
+ var tryToString$4 = function (argument) {
361
370
  try {
362
371
  return $String$3(argument);
363
372
  } catch (error) {
@@ -365,64 +374,64 @@ var tryToString$2 = function (argument) {
365
374
  }
366
375
  };
367
376
 
368
- var isCallable$a = isCallable$e;
369
- var tryToString$1 = tryToString$2;
377
+ var isCallable$c = isCallable$g;
378
+ var tryToString$3 = tryToString$4;
370
379
 
371
- var $TypeError$6 = TypeError;
380
+ var $TypeError$d = TypeError;
372
381
 
373
382
  // `Assert: IsCallable(argument) is true`
374
- var aCallable$3 = function (argument) {
375
- if (isCallable$a(argument)) return argument;
376
- throw new $TypeError$6(tryToString$1(argument) + ' is not a function');
383
+ var aCallable$a = function (argument) {
384
+ if (isCallable$c(argument)) return argument;
385
+ throw new $TypeError$d(tryToString$3(argument) + ' is not a function');
377
386
  };
378
387
 
379
- var aCallable$2 = aCallable$3;
380
- var isNullOrUndefined = isNullOrUndefined$2;
388
+ var aCallable$9 = aCallable$a;
389
+ var isNullOrUndefined$1 = isNullOrUndefined$3;
381
390
 
382
391
  // `GetMethod` abstract operation
383
392
  // https://tc39.es/ecma262/#sec-getmethod
384
- var getMethod$1 = function (V, P) {
393
+ var getMethod$4 = function (V, P) {
385
394
  var func = V[P];
386
- return isNullOrUndefined(func) ? undefined : aCallable$2(func);
395
+ return isNullOrUndefined$1(func) ? undefined : aCallable$9(func);
387
396
  };
388
397
 
389
- var call$6 = functionCall;
390
- var isCallable$9 = isCallable$e;
391
- var isObject$6 = isObject$9;
398
+ var call$d = functionCall;
399
+ var isCallable$b = isCallable$g;
400
+ var isObject$7 = isObject$a;
392
401
 
393
- var $TypeError$5 = TypeError;
402
+ var $TypeError$c = TypeError;
394
403
 
395
404
  // `OrdinaryToPrimitive` abstract operation
396
405
  // https://tc39.es/ecma262/#sec-ordinarytoprimitive
397
406
  var ordinaryToPrimitive$1 = function (input, pref) {
398
407
  var fn, val;
399
- if (pref === 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$6(fn, input))) return val;
400
- if (isCallable$9(fn = input.valueOf) && !isObject$6(val = call$6(fn, input))) return val;
401
- if (pref !== 'string' && isCallable$9(fn = input.toString) && !isObject$6(val = call$6(fn, input))) return val;
402
- throw new $TypeError$5("Can't convert object to primitive value");
408
+ if (pref === 'string' && isCallable$b(fn = input.toString) && !isObject$7(val = call$d(fn, input))) return val;
409
+ if (isCallable$b(fn = input.valueOf) && !isObject$7(val = call$d(fn, input))) return val;
410
+ if (pref !== 'string' && isCallable$b(fn = input.toString) && !isObject$7(val = call$d(fn, input))) return val;
411
+ throw new $TypeError$c("Can't convert object to primitive value");
403
412
  };
404
413
 
405
- var call$5 = functionCall;
406
- var isObject$5 = isObject$9;
414
+ var call$c = functionCall;
415
+ var isObject$6 = isObject$a;
407
416
  var isSymbol$1 = isSymbol$2;
408
- var getMethod = getMethod$1;
417
+ var getMethod$3 = getMethod$4;
409
418
  var ordinaryToPrimitive = ordinaryToPrimitive$1;
410
- var wellKnownSymbol$9 = wellKnownSymbol$a;
419
+ var wellKnownSymbol$b = wellKnownSymbol$c;
411
420
 
412
- var $TypeError$4 = TypeError;
413
- var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
421
+ var $TypeError$b = TypeError;
422
+ var TO_PRIMITIVE = wellKnownSymbol$b('toPrimitive');
414
423
 
415
424
  // `ToPrimitive` abstract operation
416
425
  // https://tc39.es/ecma262/#sec-toprimitive
417
426
  var toPrimitive$1 = function (input, pref) {
418
- if (!isObject$5(input) || isSymbol$1(input)) return input;
419
- var exoticToPrim = getMethod(input, TO_PRIMITIVE);
427
+ if (!isObject$6(input) || isSymbol$1(input)) return input;
428
+ var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
420
429
  var result;
421
430
  if (exoticToPrim) {
422
431
  if (pref === undefined) pref = 'default';
423
- result = call$5(exoticToPrim, input, pref);
424
- if (!isObject$5(result) || isSymbol$1(result)) return result;
425
- throw new $TypeError$4("Can't convert object to primitive value");
432
+ result = call$c(exoticToPrim, input, pref);
433
+ if (!isObject$6(result) || isSymbol$1(result)) return result;
434
+ throw new $TypeError$b("Can't convert object to primitive value");
426
435
  }
427
436
  if (pref === undefined) pref = 'number';
428
437
  return ordinaryToPrimitive(input, pref);
@@ -438,13 +447,13 @@ var toPropertyKey$2 = function (argument) {
438
447
  return isSymbol(key) ? key : key + '';
439
448
  };
440
449
 
441
- var DESCRIPTORS$7 = descriptors;
450
+ var DESCRIPTORS$b = descriptors;
442
451
  var IE8_DOM_DEFINE$1 = ie8DomDefine;
443
452
  var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
444
- var anObject$5 = anObject$6;
453
+ var anObject$e = anObject$f;
445
454
  var toPropertyKey$1 = toPropertyKey$2;
446
455
 
447
- var $TypeError$3 = TypeError;
456
+ var $TypeError$a = TypeError;
448
457
  // eslint-disable-next-line es/no-object-defineproperty -- safe
449
458
  var $defineProperty = Object.defineProperty;
450
459
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
@@ -455,10 +464,10 @@ var WRITABLE = 'writable';
455
464
 
456
465
  // `Object.defineProperty` method
457
466
  // https://tc39.es/ecma262/#sec-object.defineproperty
458
- objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
459
- anObject$5(O);
467
+ objectDefineProperty.f = DESCRIPTORS$b ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
468
+ anObject$e(O);
460
469
  P = toPropertyKey$1(P);
461
- anObject$5(Attributes);
470
+ anObject$e(Attributes);
462
471
  if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
463
472
  var current = $getOwnPropertyDescriptor$1(O, P);
464
473
  if (current && current[WRITABLE]) {
@@ -471,13 +480,13 @@ objectDefineProperty.f = DESCRIPTORS$7 ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
471
480
  }
472
481
  } return $defineProperty(O, P, Attributes);
473
482
  } : $defineProperty : function defineProperty(O, P, Attributes) {
474
- anObject$5(O);
483
+ anObject$e(O);
475
484
  P = toPropertyKey$1(P);
476
- anObject$5(Attributes);
485
+ anObject$e(Attributes);
477
486
  if (IE8_DOM_DEFINE$1) try {
478
487
  return $defineProperty(O, P, Attributes);
479
488
  } catch (error) { /* empty */ }
480
- if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$3('Accessors not supported');
489
+ if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$a('Accessors not supported');
481
490
  if ('value' in Attributes) O[P] = Attributes.value;
482
491
  return O;
483
492
  };
@@ -506,44 +515,44 @@ var toIntegerOrInfinity$2 = function (argument) {
506
515
  var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
507
516
 
508
517
  var max = Math.max;
509
- var min$2 = Math.min;
518
+ var min$1 = Math.min;
510
519
 
511
520
  // Helper for a popular repeating case of the spec:
512
521
  // Let integer be ? ToInteger(index).
513
522
  // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
514
523
  var toAbsoluteIndex$1 = function (index, length) {
515
524
  var integer = toIntegerOrInfinity$1(index);
516
- return integer < 0 ? max(integer + length, 0) : min$2(integer, length);
525
+ return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
517
526
  };
518
527
 
519
528
  var toIntegerOrInfinity = toIntegerOrInfinity$2;
520
529
 
521
- var min$1 = Math.min;
530
+ var min = Math.min;
522
531
 
523
532
  // `ToLength` abstract operation
524
533
  // https://tc39.es/ecma262/#sec-tolength
525
- var toLength$2 = function (argument) {
534
+ var toLength$1 = function (argument) {
526
535
  var len = toIntegerOrInfinity(argument);
527
- return len > 0 ? min$1(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
536
+ return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
528
537
  };
529
538
 
530
- var toLength$1 = toLength$2;
539
+ var toLength = toLength$1;
531
540
 
532
541
  // `LengthOfArrayLike` abstract operation
533
542
  // https://tc39.es/ecma262/#sec-lengthofarraylike
534
- var lengthOfArrayLike$2 = function (obj) {
535
- return toLength$1(obj.length);
543
+ var lengthOfArrayLike$5 = function (obj) {
544
+ return toLength(obj.length);
536
545
  };
537
546
 
538
547
  var toIndexedObject$4 = toIndexedObject$5;
539
548
  var toAbsoluteIndex = toAbsoluteIndex$1;
540
- var lengthOfArrayLike$1 = lengthOfArrayLike$2;
549
+ var lengthOfArrayLike$4 = lengthOfArrayLike$5;
541
550
 
542
551
  // `Array.prototype.{ indexOf, includes }` methods implementation
543
- var createMethod = function (IS_INCLUDES) {
552
+ var createMethod$1 = function (IS_INCLUDES) {
544
553
  return function ($this, el, fromIndex) {
545
554
  var O = toIndexedObject$4($this);
546
- var length = lengthOfArrayLike$1(O);
555
+ var length = lengthOfArrayLike$4(O);
547
556
  if (length === 0) return !IS_INCLUDES && -1;
548
557
  var index = toAbsoluteIndex(fromIndex, length);
549
558
  var value;
@@ -561,20 +570,17 @@ var createMethod = function (IS_INCLUDES) {
561
570
  };
562
571
 
563
572
  var arrayIncludes = {
564
- // `Array.prototype.includes` method
565
- // https://tc39.es/ecma262/#sec-array.prototype.includes
566
- includes: createMethod(true),
567
573
  // `Array.prototype.indexOf` method
568
574
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
569
- indexOf: createMethod(false)
575
+ indexOf: createMethod$1(false)
570
576
  };
571
577
 
572
578
  var hiddenKeys$4 = {};
573
579
 
574
580
  var uncurryThis$a = functionUncurryThis;
575
- var hasOwn$8 = hasOwnProperty_1;
581
+ var hasOwn$a = hasOwnProperty_1;
576
582
  var toIndexedObject$3 = toIndexedObject$5;
577
- var indexOf$1 = arrayIncludes.indexOf;
583
+ var indexOf = arrayIncludes.indexOf;
578
584
  var hiddenKeys$3 = hiddenKeys$4;
579
585
 
580
586
  var push$1 = uncurryThis$a([].push);
@@ -584,10 +590,10 @@ var objectKeysInternal = function (object, names) {
584
590
  var i = 0;
585
591
  var result = [];
586
592
  var key;
587
- for (key in O) !hasOwn$8(hiddenKeys$3, key) && hasOwn$8(O, key) && push$1(result, key);
593
+ for (key in O) !hasOwn$a(hiddenKeys$3, key) && hasOwn$a(O, key) && push$1(result, key);
588
594
  // Don't enum bug & hidden keys
589
- while (names.length > i) if (hasOwn$8(O, key = names[i++])) {
590
- ~indexOf$1(result, key) || push$1(result, key);
595
+ while (names.length > i) if (hasOwn$a(O, key = names[i++])) {
596
+ ~indexOf(result, key) || push$1(result, key);
591
597
  }
592
598
  return result;
593
599
  };
@@ -613,42 +619,42 @@ var objectKeys$2 = Object.keys || function keys(O) {
613
619
  return internalObjectKeys$1(O, enumBugKeys$2);
614
620
  };
615
621
 
616
- var DESCRIPTORS$6 = descriptors;
622
+ var DESCRIPTORS$a = descriptors;
617
623
  var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
618
- var definePropertyModule$3 = objectDefineProperty;
619
- var anObject$4 = anObject$6;
624
+ var definePropertyModule$4 = objectDefineProperty;
625
+ var anObject$d = anObject$f;
620
626
  var toIndexedObject$2 = toIndexedObject$5;
621
627
  var objectKeys$1 = objectKeys$2;
622
628
 
623
629
  // `Object.defineProperties` method
624
630
  // https://tc39.es/ecma262/#sec-object.defineproperties
625
631
  // eslint-disable-next-line es/no-object-defineproperties -- safe
626
- objectDefineProperties.f = DESCRIPTORS$6 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
627
- anObject$4(O);
632
+ objectDefineProperties.f = DESCRIPTORS$a && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
633
+ anObject$d(O);
628
634
  var props = toIndexedObject$2(Properties);
629
635
  var keys = objectKeys$1(Properties);
630
636
  var length = keys.length;
631
637
  var index = 0;
632
638
  var key;
633
- while (length > index) definePropertyModule$3.f(O, key = keys[index++], props[key]);
639
+ while (length > index) definePropertyModule$4.f(O, key = keys[index++], props[key]);
634
640
  return O;
635
641
  };
636
642
 
637
- var getBuiltIn$1 = getBuiltIn$3;
643
+ var getBuiltIn$2 = getBuiltIn$4;
638
644
 
639
- var html$1 = getBuiltIn$1('document', 'documentElement');
645
+ var html$1 = getBuiltIn$2('document', 'documentElement');
640
646
 
641
- var shared$2 = shared$4;
647
+ var shared$1 = shared$3;
642
648
  var uid = uid$2;
643
649
 
644
- var keys = shared$2('keys');
650
+ var keys = shared$1('keys');
645
651
 
646
652
  var sharedKey$3 = function (key) {
647
653
  return keys[key] || (keys[key] = uid(key));
648
654
  };
649
655
 
650
656
  /* global ActiveXObject -- old IE, WSH */
651
- var anObject$3 = anObject$6;
657
+ var anObject$c = anObject$f;
652
658
  var definePropertiesModule = objectDefineProperties;
653
659
  var enumBugKeys$1 = enumBugKeys$3;
654
660
  var hiddenKeys$2 = hiddenKeys$4;
@@ -673,7 +679,8 @@ var NullProtoObjectViaActiveX = function (activeXDocument) {
673
679
  activeXDocument.write(scriptTag(''));
674
680
  activeXDocument.close();
675
681
  var temp = activeXDocument.parentWindow.Object;
676
- activeXDocument = null; // avoid memory leak
682
+ // eslint-disable-next-line no-useless-assignment -- avoid memory leak
683
+ activeXDocument = null;
677
684
  return temp;
678
685
  };
679
686
 
@@ -722,7 +729,7 @@ hiddenKeys$2[IE_PROTO$1] = true;
722
729
  var objectCreate = Object.create || function create(O, Properties) {
723
730
  var result;
724
731
  if (O !== null) {
725
- EmptyConstructor[PROTOTYPE] = anObject$3(O);
732
+ EmptyConstructor[PROTOTYPE] = anObject$c(O);
726
733
  result = new EmptyConstructor();
727
734
  EmptyConstructor[PROTOTYPE] = null;
728
735
  // add "__proto__" for Object.getPrototypeOf polyfill
@@ -731,17 +738,17 @@ var objectCreate = Object.create || function create(O, Properties) {
731
738
  return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
732
739
  };
733
740
 
734
- var wellKnownSymbol$8 = wellKnownSymbol$a;
741
+ var wellKnownSymbol$a = wellKnownSymbol$c;
735
742
  var create$2 = objectCreate;
736
- var defineProperty$4 = objectDefineProperty.f;
743
+ var defineProperty$6 = objectDefineProperty.f;
737
744
 
738
- var UNSCOPABLES = wellKnownSymbol$8('unscopables');
739
- var ArrayPrototype = Array.prototype;
745
+ var UNSCOPABLES = wellKnownSymbol$a('unscopables');
746
+ var ArrayPrototype$1 = Array.prototype;
740
747
 
741
748
  // Array.prototype[@@unscopables]
742
749
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
743
- if (ArrayPrototype[UNSCOPABLES] === undefined) {
744
- defineProperty$4(ArrayPrototype, UNSCOPABLES, {
750
+ if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
751
+ defineProperty$6(ArrayPrototype$1, UNSCOPABLES, {
745
752
  configurable: true,
746
753
  value: create$2(null)
747
754
  });
@@ -749,19 +756,19 @@ if (ArrayPrototype[UNSCOPABLES] === undefined) {
749
756
 
750
757
  // add a key to Array.prototype[@@unscopables]
751
758
  var addToUnscopables$1 = function (key) {
752
- ArrayPrototype[UNSCOPABLES][key] = true;
759
+ ArrayPrototype$1[UNSCOPABLES][key] = true;
753
760
  };
754
761
 
755
762
  var iterators = {};
756
763
 
757
- var global$7 = global$e;
758
- var isCallable$8 = isCallable$e;
764
+ var globalThis$9 = globalThis_1;
765
+ var isCallable$a = isCallable$g;
759
766
 
760
- var WeakMap$1 = global$7.WeakMap;
767
+ var WeakMap$1 = globalThis$9.WeakMap;
761
768
 
762
- var weakMapBasicDetection = isCallable$8(WeakMap$1) && /native code/.test(String(WeakMap$1));
769
+ var weakMapBasicDetection = isCallable$a(WeakMap$1) && /native code/.test(String(WeakMap$1));
763
770
 
764
- var createPropertyDescriptor$3 = function (bitmap, value) {
771
+ var createPropertyDescriptor$5 = function (bitmap, value) {
765
772
  return {
766
773
  enumerable: !(bitmap & 1),
767
774
  configurable: !(bitmap & 2),
@@ -770,29 +777,29 @@ var createPropertyDescriptor$3 = function (bitmap, value) {
770
777
  };
771
778
  };
772
779
 
773
- var DESCRIPTORS$5 = descriptors;
774
- var definePropertyModule$2 = objectDefineProperty;
775
- var createPropertyDescriptor$2 = createPropertyDescriptor$3;
780
+ var DESCRIPTORS$9 = descriptors;
781
+ var definePropertyModule$3 = objectDefineProperty;
782
+ var createPropertyDescriptor$4 = createPropertyDescriptor$5;
776
783
 
777
- var createNonEnumerableProperty$4 = DESCRIPTORS$5 ? function (object, key, value) {
778
- return definePropertyModule$2.f(object, key, createPropertyDescriptor$2(1, value));
784
+ var createNonEnumerableProperty$8 = DESCRIPTORS$9 ? function (object, key, value) {
785
+ return definePropertyModule$3.f(object, key, createPropertyDescriptor$4(1, value));
779
786
  } : function (object, key, value) {
780
787
  object[key] = value;
781
788
  return object;
782
789
  };
783
790
 
784
791
  var NATIVE_WEAK_MAP = weakMapBasicDetection;
785
- var global$6 = global$e;
786
- var isObject$4 = isObject$9;
787
- var createNonEnumerableProperty$3 = createNonEnumerableProperty$4;
788
- var hasOwn$7 = hasOwnProperty_1;
789
- var shared$1 = sharedStore.exports;
792
+ var globalThis$8 = globalThis_1;
793
+ var isObject$5 = isObject$a;
794
+ var createNonEnumerableProperty$7 = createNonEnumerableProperty$8;
795
+ var hasOwn$9 = hasOwnProperty_1;
796
+ var shared = sharedStoreExports;
790
797
  var sharedKey$1 = sharedKey$3;
791
798
  var hiddenKeys$1 = hiddenKeys$4;
792
799
 
793
800
  var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
794
- var TypeError$1 = global$6.TypeError;
795
- var WeakMap = global$6.WeakMap;
801
+ var TypeError$1 = globalThis$8.TypeError;
802
+ var WeakMap = globalThis$8.WeakMap;
796
803
  var set, get, has;
797
804
 
798
805
  var enforce = function (it) {
@@ -802,14 +809,14 @@ var enforce = function (it) {
802
809
  var getterFor = function (TYPE) {
803
810
  return function (it) {
804
811
  var state;
805
- if (!isObject$4(it) || (state = get(it)).type !== TYPE) {
812
+ if (!isObject$5(it) || (state = get(it)).type !== TYPE) {
806
813
  throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
807
814
  } return state;
808
815
  };
809
816
  };
810
817
 
811
- if (NATIVE_WEAK_MAP || shared$1.state) {
812
- var store$1 = shared$1.state || (shared$1.state = new WeakMap());
818
+ if (NATIVE_WEAK_MAP || shared.state) {
819
+ var store$1 = shared.state || (shared.state = new WeakMap());
813
820
  /* eslint-disable no-self-assign -- prototype methods protection */
814
821
  store$1.get = store$1.get;
815
822
  store$1.has = store$1.has;
@@ -831,16 +838,16 @@ if (NATIVE_WEAK_MAP || shared$1.state) {
831
838
  var STATE = sharedKey$1('state');
832
839
  hiddenKeys$1[STATE] = true;
833
840
  set = function (it, metadata) {
834
- if (hasOwn$7(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
841
+ if (hasOwn$9(it, STATE)) throw new TypeError$1(OBJECT_ALREADY_INITIALIZED);
835
842
  metadata.facade = it;
836
- createNonEnumerableProperty$3(it, STATE, metadata);
843
+ createNonEnumerableProperty$7(it, STATE, metadata);
837
844
  return metadata;
838
845
  };
839
846
  get = function (it) {
840
- return hasOwn$7(it, STATE) ? it[STATE] : {};
847
+ return hasOwn$9(it, STATE) ? it[STATE] : {};
841
848
  };
842
849
  has = function (it) {
843
- return hasOwn$7(it, STATE);
850
+ return hasOwn$9(it, STATE);
844
851
  };
845
852
  }
846
853
 
@@ -870,13 +877,13 @@ objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
870
877
  return !!descriptor && descriptor.enumerable;
871
878
  } : $propertyIsEnumerable;
872
879
 
873
- var DESCRIPTORS$4 = descriptors;
874
- var call$4 = functionCall;
880
+ var DESCRIPTORS$8 = descriptors;
881
+ var call$b = functionCall;
875
882
  var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
876
- var createPropertyDescriptor$1 = createPropertyDescriptor$3;
883
+ var createPropertyDescriptor$3 = createPropertyDescriptor$5;
877
884
  var toIndexedObject$1 = toIndexedObject$5;
878
885
  var toPropertyKey = toPropertyKey$2;
879
- var hasOwn$6 = hasOwnProperty_1;
886
+ var hasOwn$8 = hasOwnProperty_1;
880
887
  var IE8_DOM_DEFINE = ie8DomDefine;
881
888
 
882
889
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
@@ -884,43 +891,42 @@ var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
884
891
 
885
892
  // `Object.getOwnPropertyDescriptor` method
886
893
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
887
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$4 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
894
+ objectGetOwnPropertyDescriptor.f = DESCRIPTORS$8 ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
888
895
  O = toIndexedObject$1(O);
889
896
  P = toPropertyKey(P);
890
897
  if (IE8_DOM_DEFINE) try {
891
898
  return $getOwnPropertyDescriptor(O, P);
892
899
  } catch (error) { /* empty */ }
893
- if (hasOwn$6(O, P)) return createPropertyDescriptor$1(!call$4(propertyIsEnumerableModule$1.f, O, P), O[P]);
900
+ if (hasOwn$8(O, P)) return createPropertyDescriptor$3(!call$b(propertyIsEnumerableModule$1.f, O, P), O[P]);
894
901
  };
895
902
 
896
- var makeBuiltIn$2 = {exports: {}};
903
+ var makeBuiltIn$3 = {exports: {}};
897
904
 
898
- var DESCRIPTORS$3 = descriptors;
899
- var hasOwn$5 = hasOwnProperty_1;
905
+ var DESCRIPTORS$7 = descriptors;
906
+ var hasOwn$7 = hasOwnProperty_1;
900
907
 
901
- var FunctionPrototype = Function.prototype;
908
+ var FunctionPrototype$1 = Function.prototype;
902
909
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
903
- var getDescriptor = DESCRIPTORS$3 && Object.getOwnPropertyDescriptor;
910
+ var getDescriptor = DESCRIPTORS$7 && Object.getOwnPropertyDescriptor;
904
911
 
905
- var EXISTS = hasOwn$5(FunctionPrototype, 'name');
912
+ var EXISTS = hasOwn$7(FunctionPrototype$1, 'name');
906
913
  // additional protection from minified / mangled / dropped function names
907
914
  var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
908
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$3 || (DESCRIPTORS$3 && getDescriptor(FunctionPrototype, 'name').configurable));
915
+ var CONFIGURABLE = EXISTS && (!DESCRIPTORS$7 || (DESCRIPTORS$7 && getDescriptor(FunctionPrototype$1, 'name').configurable));
909
916
 
910
917
  var functionName = {
911
- EXISTS: EXISTS,
912
918
  PROPER: PROPER,
913
919
  CONFIGURABLE: CONFIGURABLE
914
920
  };
915
921
 
916
922
  var uncurryThis$9 = functionUncurryThis;
917
- var isCallable$7 = isCallable$e;
918
- var store = sharedStore.exports;
923
+ var isCallable$9 = isCallable$g;
924
+ var store = sharedStoreExports;
919
925
 
920
926
  var functionToString = uncurryThis$9(Function.toString);
921
927
 
922
928
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
923
- if (!isCallable$7(store.inspectSource)) {
929
+ if (!isCallable$9(store.inspectSource)) {
924
930
  store.inspectSource = function (it) {
925
931
  return functionToString(it);
926
932
  };
@@ -929,70 +935,72 @@ if (!isCallable$7(store.inspectSource)) {
929
935
  var inspectSource$1 = store.inspectSource;
930
936
 
931
937
  var uncurryThis$8 = functionUncurryThis;
932
- var fails$a = fails$h;
933
- var isCallable$6 = isCallable$e;
934
- var hasOwn$4 = hasOwnProperty_1;
935
- var DESCRIPTORS$2 = descriptors;
938
+ var fails$c = fails$j;
939
+ var isCallable$8 = isCallable$g;
940
+ var hasOwn$6 = hasOwnProperty_1;
941
+ var DESCRIPTORS$6 = descriptors;
936
942
  var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
937
943
  var inspectSource = inspectSource$1;
938
- var InternalStateModule$1 = internalState;
944
+ var InternalStateModule$2 = internalState;
939
945
 
940
- var enforceInternalState = InternalStateModule$1.enforce;
941
- var getInternalState$2 = InternalStateModule$1.get;
946
+ var enforceInternalState = InternalStateModule$2.enforce;
947
+ var getInternalState$1 = InternalStateModule$2.get;
942
948
  var $String$2 = String;
943
949
  // eslint-disable-next-line es/no-object-defineproperty -- safe
944
- var defineProperty$3 = Object.defineProperty;
945
- var stringSlice$2 = uncurryThis$8(''.slice);
950
+ var defineProperty$5 = Object.defineProperty;
951
+ var stringSlice = uncurryThis$8(''.slice);
946
952
  var replace$1 = uncurryThis$8(''.replace);
947
953
  var join = uncurryThis$8([].join);
948
954
 
949
- var CONFIGURABLE_LENGTH = DESCRIPTORS$2 && !fails$a(function () {
950
- return defineProperty$3(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
955
+ var CONFIGURABLE_LENGTH = DESCRIPTORS$6 && !fails$c(function () {
956
+ return defineProperty$5(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
951
957
  });
952
958
 
953
959
  var TEMPLATE = String(String).split('String');
954
960
 
955
- var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
956
- if (stringSlice$2($String$2(name), 0, 7) === 'Symbol(') {
961
+ var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
962
+ if (stringSlice($String$2(name), 0, 7) === 'Symbol(') {
957
963
  name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
958
964
  }
959
965
  if (options && options.getter) name = 'get ' + name;
960
966
  if (options && options.setter) name = 'set ' + name;
961
- if (!hasOwn$4(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
962
- if (DESCRIPTORS$2) defineProperty$3(value, 'name', { value: name, configurable: true });
967
+ if (!hasOwn$6(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
968
+ if (DESCRIPTORS$6) defineProperty$5(value, 'name', { value: name, configurable: true });
963
969
  else value.name = name;
964
970
  }
965
- if (CONFIGURABLE_LENGTH && options && hasOwn$4(options, 'arity') && value.length !== options.arity) {
966
- defineProperty$3(value, 'length', { value: options.arity });
971
+ if (CONFIGURABLE_LENGTH && options && hasOwn$6(options, 'arity') && value.length !== options.arity) {
972
+ defineProperty$5(value, 'length', { value: options.arity });
967
973
  }
968
974
  try {
969
- if (options && hasOwn$4(options, 'constructor') && options.constructor) {
970
- if (DESCRIPTORS$2) defineProperty$3(value, 'prototype', { writable: false });
975
+ if (options && hasOwn$6(options, 'constructor') && options.constructor) {
976
+ if (DESCRIPTORS$6) defineProperty$5(value, 'prototype', { writable: false });
971
977
  // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
972
978
  } else if (value.prototype) value.prototype = undefined;
973
979
  } catch (error) { /* empty */ }
974
980
  var state = enforceInternalState(value);
975
- if (!hasOwn$4(state, 'source')) {
981
+ if (!hasOwn$6(state, 'source')) {
976
982
  state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
977
983
  } return value;
978
984
  };
979
985
 
980
986
  // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
981
987
  // eslint-disable-next-line no-extend-native -- required
982
- Function.prototype.toString = makeBuiltIn$1(function toString() {
983
- return isCallable$6(this) && getInternalState$2(this).source || inspectSource(this);
988
+ Function.prototype.toString = makeBuiltIn$2(function toString() {
989
+ return isCallable$8(this) && getInternalState$1(this).source || inspectSource(this);
984
990
  }, 'toString');
985
991
 
986
- var isCallable$5 = isCallable$e;
987
- var definePropertyModule$1 = objectDefineProperty;
988
- var makeBuiltIn = makeBuiltIn$2.exports;
992
+ var makeBuiltInExports = makeBuiltIn$3.exports;
993
+
994
+ var isCallable$7 = isCallable$g;
995
+ var definePropertyModule$2 = objectDefineProperty;
996
+ var makeBuiltIn$1 = makeBuiltInExports;
989
997
  var defineGlobalProperty$1 = defineGlobalProperty$3;
990
998
 
991
- var defineBuiltIn$4 = function (O, key, value, options) {
999
+ var defineBuiltIn$5 = function (O, key, value, options) {
992
1000
  if (!options) options = {};
993
1001
  var simple = options.enumerable;
994
1002
  var name = options.name !== undefined ? options.name : key;
995
- if (isCallable$5(value)) makeBuiltIn(value, name, options);
1003
+ if (isCallable$7(value)) makeBuiltIn$1(value, name, options);
996
1004
  if (options.global) {
997
1005
  if (simple) O[key] = value;
998
1006
  else defineGlobalProperty$1(key, value);
@@ -1002,7 +1010,7 @@ var defineBuiltIn$4 = function (O, key, value, options) {
1002
1010
  else if (O[key]) simple = true;
1003
1011
  } catch (error) { /* empty */ }
1004
1012
  if (simple) O[key] = value;
1005
- else definePropertyModule$1.f(O, key, {
1013
+ else definePropertyModule$2.f(O, key, {
1006
1014
  value: value,
1007
1015
  enumerable: false,
1008
1016
  configurable: !options.nonConfigurable,
@@ -1030,40 +1038,40 @@ var objectGetOwnPropertySymbols = {};
1030
1038
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
1031
1039
  objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
1032
1040
 
1033
- var getBuiltIn = getBuiltIn$3;
1041
+ var getBuiltIn$1 = getBuiltIn$4;
1034
1042
  var uncurryThis$7 = functionUncurryThis;
1035
1043
  var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
1036
1044
  var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
1037
- var anObject$2 = anObject$6;
1045
+ var anObject$b = anObject$f;
1038
1046
 
1039
1047
  var concat$1 = uncurryThis$7([].concat);
1040
1048
 
1041
1049
  // all object keys, includes non-enumerable and symbols
1042
- var ownKeys$1 = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
1043
- var keys = getOwnPropertyNamesModule.f(anObject$2(it));
1050
+ var ownKeys$1 = getBuiltIn$1('Reflect', 'ownKeys') || function ownKeys(it) {
1051
+ var keys = getOwnPropertyNamesModule.f(anObject$b(it));
1044
1052
  var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
1045
1053
  return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
1046
1054
  };
1047
1055
 
1048
- var hasOwn$3 = hasOwnProperty_1;
1056
+ var hasOwn$5 = hasOwnProperty_1;
1049
1057
  var ownKeys = ownKeys$1;
1050
1058
  var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
1051
- var definePropertyModule = objectDefineProperty;
1059
+ var definePropertyModule$1 = objectDefineProperty;
1052
1060
 
1053
- var copyConstructorProperties$1 = function (target, source, exceptions) {
1061
+ var copyConstructorProperties$2 = function (target, source, exceptions) {
1054
1062
  var keys = ownKeys(source);
1055
- var defineProperty = definePropertyModule.f;
1063
+ var defineProperty = definePropertyModule$1.f;
1056
1064
  var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
1057
1065
  for (var i = 0; i < keys.length; i++) {
1058
1066
  var key = keys[i];
1059
- if (!hasOwn$3(target, key) && !(exceptions && hasOwn$3(exceptions, key))) {
1067
+ if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) {
1060
1068
  defineProperty(target, key, getOwnPropertyDescriptor(source, key));
1061
1069
  }
1062
1070
  }
1063
1071
  };
1064
1072
 
1065
- var fails$9 = fails$h;
1066
- var isCallable$4 = isCallable$e;
1073
+ var fails$b = fails$j;
1074
+ var isCallable$6 = isCallable$g;
1067
1075
 
1068
1076
  var replacement = /#|\.prototype\./;
1069
1077
 
@@ -1071,7 +1079,7 @@ var isForced$1 = function (feature, detection) {
1071
1079
  var value = data[normalize(feature)];
1072
1080
  return value === POLYFILL ? true
1073
1081
  : value === NATIVE ? false
1074
- : isCallable$4(detection) ? fails$9(detection)
1082
+ : isCallable$6(detection) ? fails$b(detection)
1075
1083
  : !!detection;
1076
1084
  };
1077
1085
 
@@ -1085,12 +1093,12 @@ var POLYFILL = isForced$1.POLYFILL = 'P';
1085
1093
 
1086
1094
  var isForced_1 = isForced$1;
1087
1095
 
1088
- var global$5 = global$e;
1096
+ var globalThis$7 = globalThis_1;
1089
1097
  var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
1090
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$4;
1091
- var defineBuiltIn$3 = defineBuiltIn$4;
1098
+ var createNonEnumerableProperty$6 = createNonEnumerableProperty$8;
1099
+ var defineBuiltIn$4 = defineBuiltIn$5;
1092
1100
  var defineGlobalProperty = defineGlobalProperty$3;
1093
- var copyConstructorProperties = copyConstructorProperties$1;
1101
+ var copyConstructorProperties$1 = copyConstructorProperties$2;
1094
1102
  var isForced = isForced_1;
1095
1103
 
1096
1104
  /*
@@ -1114,11 +1122,11 @@ var _export = function (options, source) {
1114
1122
  var STATIC = options.stat;
1115
1123
  var FORCED, target, key, targetProperty, sourceProperty, descriptor;
1116
1124
  if (GLOBAL) {
1117
- target = global$5;
1125
+ target = globalThis$7;
1118
1126
  } else if (STATIC) {
1119
- target = global$5[TARGET] || defineGlobalProperty(TARGET, {});
1127
+ target = globalThis$7[TARGET] || defineGlobalProperty(TARGET, {});
1120
1128
  } else {
1121
- target = global$5[TARGET] && global$5[TARGET].prototype;
1129
+ target = globalThis$7[TARGET] && globalThis$7[TARGET].prototype;
1122
1130
  }
1123
1131
  if (target) for (key in source) {
1124
1132
  sourceProperty = source[key];
@@ -1130,28 +1138,28 @@ var _export = function (options, source) {
1130
1138
  // contained in target
1131
1139
  if (!FORCED && targetProperty !== undefined) {
1132
1140
  if (typeof sourceProperty == typeof targetProperty) continue;
1133
- copyConstructorProperties(sourceProperty, targetProperty);
1141
+ copyConstructorProperties$1(sourceProperty, targetProperty);
1134
1142
  }
1135
1143
  // add a flag to not completely full polyfills
1136
1144
  if (options.sham || (targetProperty && targetProperty.sham)) {
1137
- createNonEnumerableProperty$2(sourceProperty, 'sham', true);
1145
+ createNonEnumerableProperty$6(sourceProperty, 'sham', true);
1138
1146
  }
1139
- defineBuiltIn$3(target, key, sourceProperty, options);
1147
+ defineBuiltIn$4(target, key, sourceProperty, options);
1140
1148
  }
1141
1149
  };
1142
1150
 
1143
- var fails$8 = fails$h;
1151
+ var fails$a = fails$j;
1144
1152
 
1145
- var correctPrototypeGetter = !fails$8(function () {
1153
+ var correctPrototypeGetter = !fails$a(function () {
1146
1154
  function F() { /* empty */ }
1147
1155
  F.prototype.constructor = null;
1148
1156
  // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1149
1157
  return Object.getPrototypeOf(new F()) !== F.prototype;
1150
1158
  });
1151
1159
 
1152
- var hasOwn$2 = hasOwnProperty_1;
1153
- var isCallable$3 = isCallable$e;
1154
- var toObject$2 = toObject$4;
1160
+ var hasOwn$4 = hasOwnProperty_1;
1161
+ var isCallable$5 = isCallable$g;
1162
+ var toObject$4 = toObject$6;
1155
1163
  var sharedKey = sharedKey$3;
1156
1164
  var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1157
1165
 
@@ -1163,27 +1171,27 @@ var ObjectPrototype = $Object$1.prototype;
1163
1171
  // https://tc39.es/ecma262/#sec-object.getprototypeof
1164
1172
  // eslint-disable-next-line es/no-object-getprototypeof -- safe
1165
1173
  var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1166
- var object = toObject$2(O);
1167
- if (hasOwn$2(object, IE_PROTO)) return object[IE_PROTO];
1174
+ var object = toObject$4(O);
1175
+ if (hasOwn$4(object, IE_PROTO)) return object[IE_PROTO];
1168
1176
  var constructor = object.constructor;
1169
- if (isCallable$3(constructor) && object instanceof constructor) {
1177
+ if (isCallable$5(constructor) && object instanceof constructor) {
1170
1178
  return constructor.prototype;
1171
1179
  } return object instanceof $Object$1 ? ObjectPrototype : null;
1172
1180
  };
1173
1181
 
1174
- var fails$7 = fails$h;
1175
- var isCallable$2 = isCallable$e;
1176
- var isObject$3 = isObject$9;
1177
- var getPrototypeOf$1 = objectGetPrototypeOf;
1178
- var defineBuiltIn$2 = defineBuiltIn$4;
1179
- var wellKnownSymbol$7 = wellKnownSymbol$a;
1182
+ var fails$9 = fails$j;
1183
+ var isCallable$4 = isCallable$g;
1184
+ var isObject$4 = isObject$a;
1185
+ var getPrototypeOf$2 = objectGetPrototypeOf;
1186
+ var defineBuiltIn$3 = defineBuiltIn$5;
1187
+ var wellKnownSymbol$9 = wellKnownSymbol$c;
1180
1188
 
1181
- var ITERATOR$2 = wellKnownSymbol$7('iterator');
1189
+ var ITERATOR$5 = wellKnownSymbol$9('iterator');
1182
1190
  var BUGGY_SAFARI_ITERATORS$1 = false;
1183
1191
 
1184
1192
  // `%IteratorPrototype%` object
1185
1193
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1186
- var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
1194
+ var IteratorPrototype$4, PrototypeOfArrayIteratorPrototype, arrayIterator;
1187
1195
 
1188
1196
  /* eslint-disable es/no-array-prototype-keys -- safe */
1189
1197
  if ([].keys) {
@@ -1191,91 +1199,91 @@ if ([].keys) {
1191
1199
  // Safari 8 has buggy iterators w/o `next`
1192
1200
  if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1193
1201
  else {
1194
- PrototypeOfArrayIteratorPrototype = getPrototypeOf$1(getPrototypeOf$1(arrayIterator));
1195
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
1202
+ PrototypeOfArrayIteratorPrototype = getPrototypeOf$2(getPrototypeOf$2(arrayIterator));
1203
+ if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$4 = PrototypeOfArrayIteratorPrototype;
1196
1204
  }
1197
1205
  }
1198
1206
 
1199
- var NEW_ITERATOR_PROTOTYPE = !isObject$3(IteratorPrototype$2) || fails$7(function () {
1207
+ var NEW_ITERATOR_PROTOTYPE = !isObject$4(IteratorPrototype$4) || fails$9(function () {
1200
1208
  var test = {};
1201
1209
  // FF44- legacy iterators case
1202
- return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
1210
+ return IteratorPrototype$4[ITERATOR$5].call(test) !== test;
1203
1211
  });
1204
1212
 
1205
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
1213
+ if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$4 = {};
1206
1214
 
1207
1215
  // `%IteratorPrototype%[@@iterator]()` method
1208
1216
  // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1209
- if (!isCallable$2(IteratorPrototype$2[ITERATOR$2])) {
1210
- defineBuiltIn$2(IteratorPrototype$2, ITERATOR$2, function () {
1217
+ if (!isCallable$4(IteratorPrototype$4[ITERATOR$5])) {
1218
+ defineBuiltIn$3(IteratorPrototype$4, ITERATOR$5, function () {
1211
1219
  return this;
1212
1220
  });
1213
1221
  }
1214
1222
 
1215
1223
  var iteratorsCore = {
1216
- IteratorPrototype: IteratorPrototype$2,
1224
+ IteratorPrototype: IteratorPrototype$4,
1217
1225
  BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1218
1226
  };
1219
1227
 
1220
- var defineProperty$2 = objectDefineProperty.f;
1221
- var hasOwn$1 = hasOwnProperty_1;
1222
- var wellKnownSymbol$6 = wellKnownSymbol$a;
1228
+ var defineProperty$4 = objectDefineProperty.f;
1229
+ var hasOwn$3 = hasOwnProperty_1;
1230
+ var wellKnownSymbol$8 = wellKnownSymbol$c;
1223
1231
 
1224
- var TO_STRING_TAG$2 = wellKnownSymbol$6('toStringTag');
1232
+ var TO_STRING_TAG$4 = wellKnownSymbol$8('toStringTag');
1225
1233
 
1226
1234
  var setToStringTag$3 = function (target, TAG, STATIC) {
1227
1235
  if (target && !STATIC) target = target.prototype;
1228
- if (target && !hasOwn$1(target, TO_STRING_TAG$2)) {
1229
- defineProperty$2(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
1236
+ if (target && !hasOwn$3(target, TO_STRING_TAG$4)) {
1237
+ defineProperty$4(target, TO_STRING_TAG$4, { configurable: true, value: TAG });
1230
1238
  }
1231
1239
  };
1232
1240
 
1233
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1241
+ var IteratorPrototype$3 = iteratorsCore.IteratorPrototype;
1234
1242
  var create$1 = objectCreate;
1235
- var createPropertyDescriptor = createPropertyDescriptor$3;
1243
+ var createPropertyDescriptor$2 = createPropertyDescriptor$5;
1236
1244
  var setToStringTag$2 = setToStringTag$3;
1237
- var Iterators$2 = iterators;
1245
+ var Iterators$4 = iterators;
1238
1246
 
1239
1247
  var returnThis$1 = function () { return this; };
1240
1248
 
1241
1249
  var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1242
1250
  var TO_STRING_TAG = NAME + ' Iterator';
1243
- IteratorConstructor.prototype = create$1(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
1251
+ IteratorConstructor.prototype = create$1(IteratorPrototype$3, { next: createPropertyDescriptor$2(+!ENUMERABLE_NEXT, next) });
1244
1252
  setToStringTag$2(IteratorConstructor, TO_STRING_TAG, false);
1245
- Iterators$2[TO_STRING_TAG] = returnThis$1;
1253
+ Iterators$4[TO_STRING_TAG] = returnThis$1;
1246
1254
  return IteratorConstructor;
1247
1255
  };
1248
1256
 
1249
1257
  var uncurryThis$6 = functionUncurryThis;
1250
- var aCallable$1 = aCallable$3;
1258
+ var aCallable$8 = aCallable$a;
1251
1259
 
1252
1260
  var functionUncurryThisAccessor = function (object, key, method) {
1253
1261
  try {
1254
1262
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1255
- return uncurryThis$6(aCallable$1(Object.getOwnPropertyDescriptor(object, key)[method]));
1263
+ return uncurryThis$6(aCallable$8(Object.getOwnPropertyDescriptor(object, key)[method]));
1256
1264
  } catch (error) { /* empty */ }
1257
1265
  };
1258
1266
 
1259
- var isObject$2 = isObject$9;
1267
+ var isObject$3 = isObject$a;
1260
1268
 
1261
1269
  var isPossiblePrototype$1 = function (argument) {
1262
- return isObject$2(argument) || argument === null;
1270
+ return isObject$3(argument) || argument === null;
1263
1271
  };
1264
1272
 
1265
1273
  var isPossiblePrototype = isPossiblePrototype$1;
1266
1274
 
1267
1275
  var $String$1 = String;
1268
- var $TypeError$2 = TypeError;
1276
+ var $TypeError$9 = TypeError;
1269
1277
 
1270
1278
  var aPossiblePrototype$1 = function (argument) {
1271
1279
  if (isPossiblePrototype(argument)) return argument;
1272
- throw new $TypeError$2("Can't set " + $String$1(argument) + ' as a prototype');
1280
+ throw new $TypeError$9("Can't set " + $String$1(argument) + ' as a prototype');
1273
1281
  };
1274
1282
 
1275
1283
  /* eslint-disable no-proto -- safe */
1276
1284
  var uncurryThisAccessor = functionUncurryThisAccessor;
1277
- var isObject$1 = isObject$9;
1278
- var requireObjectCoercible$1 = requireObjectCoercible$4;
1285
+ var isObject$2 = isObject$a;
1286
+ var requireObjectCoercible = requireObjectCoercible$3;
1279
1287
  var aPossiblePrototype = aPossiblePrototype$1;
1280
1288
 
1281
1289
  // `Object.setPrototypeOf` method
@@ -1292,34 +1300,34 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
1292
1300
  CORRECT_SETTER = test instanceof Array;
1293
1301
  } catch (error) { /* empty */ }
1294
1302
  return function setPrototypeOf(O, proto) {
1295
- requireObjectCoercible$1(O);
1303
+ requireObjectCoercible(O);
1296
1304
  aPossiblePrototype(proto);
1297
- if (!isObject$1(O)) return O;
1305
+ if (!isObject$2(O)) return O;
1298
1306
  if (CORRECT_SETTER) setter(O, proto);
1299
1307
  else O.__proto__ = proto;
1300
1308
  return O;
1301
1309
  };
1302
1310
  }() : undefined);
1303
1311
 
1304
- var $$4 = _export;
1305
- var call$3 = functionCall;
1312
+ var $$a = _export;
1313
+ var call$a = functionCall;
1306
1314
  var FunctionName = functionName;
1307
- var isCallable$1 = isCallable$e;
1315
+ var isCallable$3 = isCallable$g;
1308
1316
  var createIteratorConstructor = iteratorCreateConstructor;
1309
- var getPrototypeOf = objectGetPrototypeOf;
1310
- var setPrototypeOf = objectSetPrototypeOf;
1317
+ var getPrototypeOf$1 = objectGetPrototypeOf;
1318
+ var setPrototypeOf$2 = objectSetPrototypeOf;
1311
1319
  var setToStringTag$1 = setToStringTag$3;
1312
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$4;
1313
- var defineBuiltIn$1 = defineBuiltIn$4;
1314
- var wellKnownSymbol$5 = wellKnownSymbol$a;
1315
- var Iterators$1 = iterators;
1320
+ var createNonEnumerableProperty$5 = createNonEnumerableProperty$8;
1321
+ var defineBuiltIn$2 = defineBuiltIn$5;
1322
+ var wellKnownSymbol$7 = wellKnownSymbol$c;
1323
+ var Iterators$3 = iterators;
1316
1324
  var IteratorsCore = iteratorsCore;
1317
1325
 
1318
1326
  var PROPER_FUNCTION_NAME$1 = FunctionName.PROPER;
1319
1327
  var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1320
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
1328
+ var IteratorPrototype$2 = IteratorsCore.IteratorPrototype;
1321
1329
  var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1322
- var ITERATOR$1 = wellKnownSymbol$5('iterator');
1330
+ var ITERATOR$4 = wellKnownSymbol$7('iterator');
1323
1331
  var KEYS = 'keys';
1324
1332
  var VALUES = 'values';
1325
1333
  var ENTRIES = 'entries';
@@ -1345,7 +1353,7 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1345
1353
  var TO_STRING_TAG = NAME + ' Iterator';
1346
1354
  var INCORRECT_VALUES_NAME = false;
1347
1355
  var IterablePrototype = Iterable.prototype;
1348
- var nativeIterator = IterablePrototype[ITERATOR$1]
1356
+ var nativeIterator = IterablePrototype[ITERATOR$4]
1349
1357
  || IterablePrototype['@@iterator']
1350
1358
  || DEFAULT && IterablePrototype[DEFAULT];
1351
1359
  var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
@@ -1354,13 +1362,13 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1354
1362
 
1355
1363
  // fix native
1356
1364
  if (anyNativeIterator) {
1357
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
1365
+ CurrentIteratorPrototype = getPrototypeOf$1(anyNativeIterator.call(new Iterable()));
1358
1366
  if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1359
- if (getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
1360
- if (setPrototypeOf) {
1361
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
1362
- } else if (!isCallable$1(CurrentIteratorPrototype[ITERATOR$1])) {
1363
- defineBuiltIn$1(CurrentIteratorPrototype, ITERATOR$1, returnThis);
1367
+ if (getPrototypeOf$1(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1368
+ if (setPrototypeOf$2) {
1369
+ setPrototypeOf$2(CurrentIteratorPrototype, IteratorPrototype$2);
1370
+ } else if (!isCallable$3(CurrentIteratorPrototype[ITERATOR$4])) {
1371
+ defineBuiltIn$2(CurrentIteratorPrototype, ITERATOR$4, returnThis);
1364
1372
  }
1365
1373
  }
1366
1374
  // Set @@toStringTag to native iterators
@@ -1371,10 +1379,10 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1371
1379
  // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1372
1380
  if (PROPER_FUNCTION_NAME$1 && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1373
1381
  if (CONFIGURABLE_FUNCTION_NAME) {
1374
- createNonEnumerableProperty$1(IterablePrototype, 'name', VALUES);
1382
+ createNonEnumerableProperty$5(IterablePrototype, 'name', VALUES);
1375
1383
  } else {
1376
1384
  INCORRECT_VALUES_NAME = true;
1377
- defaultIterator = function values() { return call$3(nativeIterator, this); };
1385
+ defaultIterator = function values() { return call$a(nativeIterator, this); };
1378
1386
  }
1379
1387
  }
1380
1388
 
@@ -1387,38 +1395,38 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL
1387
1395
  };
1388
1396
  if (FORCED) for (KEY in methods) {
1389
1397
  if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1390
- defineBuiltIn$1(IterablePrototype, KEY, methods[KEY]);
1398
+ defineBuiltIn$2(IterablePrototype, KEY, methods[KEY]);
1391
1399
  }
1392
- } else $$4({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1400
+ } else $$a({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1393
1401
  }
1394
1402
 
1395
1403
  // define iterator
1396
- if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
1397
- defineBuiltIn$1(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
1404
+ if (IterablePrototype[ITERATOR$4] !== defaultIterator) {
1405
+ defineBuiltIn$2(IterablePrototype, ITERATOR$4, defaultIterator, { name: DEFAULT });
1398
1406
  }
1399
- Iterators$1[NAME] = defaultIterator;
1407
+ Iterators$3[NAME] = defaultIterator;
1400
1408
 
1401
1409
  return methods;
1402
1410
  };
1403
1411
 
1404
1412
  // `CreateIterResultObject` abstract operation
1405
1413
  // https://tc39.es/ecma262/#sec-createiterresultobject
1406
- var createIterResultObject$1 = function (value, done) {
1414
+ var createIterResultObject$2 = function (value, done) {
1407
1415
  return { value: value, done: done };
1408
1416
  };
1409
1417
 
1410
1418
  var toIndexedObject = toIndexedObject$5;
1411
1419
  var addToUnscopables = addToUnscopables$1;
1412
- var Iterators = iterators;
1413
- var InternalStateModule = internalState;
1414
- var defineProperty$1 = objectDefineProperty.f;
1420
+ var Iterators$2 = iterators;
1421
+ var InternalStateModule$1 = internalState;
1422
+ var defineProperty$3 = objectDefineProperty.f;
1415
1423
  var defineIterator = iteratorDefine;
1416
- var createIterResultObject = createIterResultObject$1;
1417
- var DESCRIPTORS$1 = descriptors;
1424
+ var createIterResultObject$1 = createIterResultObject$2;
1425
+ var DESCRIPTORS$5 = descriptors;
1418
1426
 
1419
1427
  var ARRAY_ITERATOR = 'Array Iterator';
1420
- var setInternalState = InternalStateModule.set;
1421
- var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
1428
+ var setInternalState$1 = InternalStateModule$1.set;
1429
+ var getInternalState = InternalStateModule$1.getterFor(ARRAY_ITERATOR);
1422
1430
 
1423
1431
  // `Array.prototype.entries` method
1424
1432
  // https://tc39.es/ecma262/#sec-array.prototype.entries
@@ -1431,7 +1439,7 @@ var getInternalState$1 = InternalStateModule.getterFor(ARRAY_ITERATOR);
1431
1439
  // `CreateArrayIterator` internal method
1432
1440
  // https://tc39.es/ecma262/#sec-createarrayiterator
1433
1441
  var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1434
- setInternalState(this, {
1442
+ setInternalState$1(this, {
1435
1443
  type: ARRAY_ITERATOR,
1436
1444
  target: toIndexedObject(iterated), // target
1437
1445
  index: 0, // next index
@@ -1440,23 +1448,23 @@ var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind)
1440
1448
  // `%ArrayIteratorPrototype%.next` method
1441
1449
  // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1442
1450
  }, function () {
1443
- var state = getInternalState$1(this);
1451
+ var state = getInternalState(this);
1444
1452
  var target = state.target;
1445
1453
  var index = state.index++;
1446
1454
  if (!target || index >= target.length) {
1447
- state.target = undefined;
1448
- return createIterResultObject(undefined, true);
1455
+ state.target = null;
1456
+ return createIterResultObject$1(undefined, true);
1449
1457
  }
1450
1458
  switch (state.kind) {
1451
- case 'keys': return createIterResultObject(index, false);
1452
- case 'values': return createIterResultObject(target[index], false);
1453
- } return createIterResultObject([index, target[index]], false);
1459
+ case 'keys': return createIterResultObject$1(index, false);
1460
+ case 'values': return createIterResultObject$1(target[index], false);
1461
+ } return createIterResultObject$1([index, target[index]], false);
1454
1462
  }, 'values');
1455
1463
 
1456
1464
  // argumentsList[@@iterator] is %ArrayProto_values%
1457
1465
  // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1458
1466
  // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1459
- var values = Iterators.Arguments = Iterators.Array;
1467
+ var values = Iterators$2.Arguments = Iterators$2.Array;
1460
1468
 
1461
1469
  // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1462
1470
  addToUnscopables('keys');
@@ -1464,8 +1472,8 @@ addToUnscopables('values');
1464
1472
  addToUnscopables('entries');
1465
1473
 
1466
1474
  // V8 ~ Chrome 45- bug
1467
- if (DESCRIPTORS$1 && values.name !== 'values') try {
1468
- defineProperty$1(values, 'name', { value: 'values' });
1475
+ if (DESCRIPTORS$5 && values.name !== 'values') try {
1476
+ defineProperty$3(values, 'name', { value: 'values' });
1469
1477
  } catch (error) { /* empty */ }
1470
1478
 
1471
1479
  // iterable DOM collections
@@ -1512,30 +1520,30 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
1512
1520
 
1513
1521
  var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
1514
1522
 
1515
- var global$4 = global$e;
1523
+ var globalThis$6 = globalThis_1;
1516
1524
  var DOMIterables = domIterables;
1517
1525
  var DOMTokenListPrototype = domTokenListPrototype;
1518
1526
  var ArrayIteratorMethods = es_array_iterator;
1519
- var createNonEnumerableProperty = createNonEnumerableProperty$4;
1527
+ var createNonEnumerableProperty$4 = createNonEnumerableProperty$8;
1520
1528
  var setToStringTag = setToStringTag$3;
1521
- var wellKnownSymbol$4 = wellKnownSymbol$a;
1529
+ var wellKnownSymbol$6 = wellKnownSymbol$c;
1522
1530
 
1523
- var ITERATOR = wellKnownSymbol$4('iterator');
1531
+ var ITERATOR$3 = wellKnownSymbol$6('iterator');
1524
1532
  var ArrayValues = ArrayIteratorMethods.values;
1525
1533
 
1526
1534
  var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1527
1535
  if (CollectionPrototype) {
1528
1536
  // some Chrome versions have non-configurable methods on DOMTokenList
1529
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
1530
- createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
1537
+ if (CollectionPrototype[ITERATOR$3] !== ArrayValues) try {
1538
+ createNonEnumerableProperty$4(CollectionPrototype, ITERATOR$3, ArrayValues);
1531
1539
  } catch (error) {
1532
- CollectionPrototype[ITERATOR] = ArrayValues;
1540
+ CollectionPrototype[ITERATOR$3] = ArrayValues;
1533
1541
  }
1534
1542
  setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
1535
1543
  if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
1536
1544
  // some Chrome versions have non-configurable methods on DOMTokenList
1537
1545
  if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
1538
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1546
+ createNonEnumerableProperty$4(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
1539
1547
  } catch (error) {
1540
1548
  CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
1541
1549
  }
@@ -1544,38 +1552,155 @@ var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
1544
1552
  };
1545
1553
 
1546
1554
  for (var COLLECTION_NAME in DOMIterables) {
1547
- handlePrototype(global$4[COLLECTION_NAME] && global$4[COLLECTION_NAME].prototype, COLLECTION_NAME);
1555
+ handlePrototype(globalThis$6[COLLECTION_NAME] && globalThis$6[COLLECTION_NAME].prototype, COLLECTION_NAME);
1548
1556
  }
1549
1557
 
1550
1558
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1551
1559
 
1552
- var tryToString = tryToString$2;
1560
+ var isPrototypeOf$3 = objectIsPrototypeOf;
1553
1561
 
1554
- var $TypeError$1 = TypeError;
1562
+ var $TypeError$8 = TypeError;
1555
1563
 
1556
- var deletePropertyOrThrow$1 = function (O, P) {
1557
- if (!delete O[P]) throw new $TypeError$1('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
1564
+ var anInstance$1 = function (it, Prototype) {
1565
+ if (isPrototypeOf$3(Prototype, it)) return it;
1566
+ throw new $TypeError$8('Incorrect invocation');
1567
+ };
1568
+
1569
+ var makeBuiltIn = makeBuiltInExports;
1570
+ var defineProperty$2 = objectDefineProperty;
1571
+
1572
+ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
1573
+ if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1574
+ if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1575
+ return defineProperty$2.f(target, name, descriptor);
1576
+ };
1577
+
1578
+ var DESCRIPTORS$4 = descriptors;
1579
+ var definePropertyModule = objectDefineProperty;
1580
+ var createPropertyDescriptor$1 = createPropertyDescriptor$5;
1581
+
1582
+ var createProperty$1 = function (object, key, value) {
1583
+ if (DESCRIPTORS$4) definePropertyModule.f(object, key, createPropertyDescriptor$1(0, value));
1584
+ else object[key] = value;
1585
+ };
1586
+
1587
+ var $$9 = _export;
1588
+ var globalThis$5 = globalThis_1;
1589
+ var anInstance = anInstance$1;
1590
+ var anObject$a = anObject$f;
1591
+ var isCallable$2 = isCallable$g;
1592
+ var getPrototypeOf = objectGetPrototypeOf;
1593
+ var defineBuiltInAccessor = defineBuiltInAccessor$1;
1594
+ var createProperty = createProperty$1;
1595
+ var fails$8 = fails$j;
1596
+ var hasOwn$2 = hasOwnProperty_1;
1597
+ var wellKnownSymbol$5 = wellKnownSymbol$c;
1598
+ var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
1599
+ var DESCRIPTORS$3 = descriptors;
1600
+
1601
+ var CONSTRUCTOR = 'constructor';
1602
+ var ITERATOR$2 = 'Iterator';
1603
+ var TO_STRING_TAG$3 = wellKnownSymbol$5('toStringTag');
1604
+
1605
+ var $TypeError$7 = TypeError;
1606
+ var NativeIterator = globalThis$5[ITERATOR$2];
1607
+
1608
+ // FF56- have non-standard global helper `Iterator`
1609
+ var FORCED$5 = !isCallable$2(NativeIterator)
1610
+ || NativeIterator.prototype !== IteratorPrototype$1
1611
+ // FF44- non-standard `Iterator` passes previous tests
1612
+ || !fails$8(function () { NativeIterator({}); });
1613
+
1614
+ var IteratorConstructor = function Iterator() {
1615
+ anInstance(this, IteratorPrototype$1);
1616
+ if (getPrototypeOf(this) === IteratorPrototype$1) throw new $TypeError$7('Abstract class Iterator not directly constructable');
1617
+ };
1618
+
1619
+ var defineIteratorPrototypeAccessor = function (key, value) {
1620
+ if (DESCRIPTORS$3) {
1621
+ defineBuiltInAccessor(IteratorPrototype$1, key, {
1622
+ configurable: true,
1623
+ get: function () {
1624
+ return value;
1625
+ },
1626
+ set: function (replacement) {
1627
+ anObject$a(this);
1628
+ if (this === IteratorPrototype$1) throw new $TypeError$7("You can't redefine this property");
1629
+ if (hasOwn$2(this, key)) this[key] = replacement;
1630
+ else createProperty(this, key, replacement);
1631
+ }
1632
+ });
1633
+ } else IteratorPrototype$1[key] = value;
1634
+ };
1635
+
1636
+ if (!hasOwn$2(IteratorPrototype$1, TO_STRING_TAG$3)) defineIteratorPrototypeAccessor(TO_STRING_TAG$3, ITERATOR$2);
1637
+
1638
+ if (FORCED$5 || !hasOwn$2(IteratorPrototype$1, CONSTRUCTOR) || IteratorPrototype$1[CONSTRUCTOR] === Object) {
1639
+ defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
1640
+ }
1641
+
1642
+ IteratorConstructor.prototype = IteratorPrototype$1;
1643
+
1644
+ // `Iterator` constructor
1645
+ // https://tc39.es/ecma262/#sec-iterator
1646
+ $$9({ global: true, constructor: true, forced: FORCED$5 }, {
1647
+ Iterator: IteratorConstructor
1648
+ });
1649
+
1650
+ var classofRaw$1 = classofRaw$2;
1651
+ var uncurryThis$5 = functionUncurryThis;
1652
+
1653
+ var functionUncurryThisClause = function (fn) {
1654
+ // Nashorn bug:
1655
+ // https://github.com/zloirock/core-js/issues/1128
1656
+ // https://github.com/zloirock/core-js/issues/1130
1657
+ if (classofRaw$1(fn) === 'Function') return uncurryThis$5(fn);
1658
+ };
1659
+
1660
+ var uncurryThis$4 = functionUncurryThisClause;
1661
+ var aCallable$7 = aCallable$a;
1662
+ var NATIVE_BIND$1 = functionBindNative;
1663
+
1664
+ var bind$1 = uncurryThis$4(uncurryThis$4.bind);
1665
+
1666
+ // optional / simple context binding
1667
+ var functionBindContext = function (fn, that) {
1668
+ aCallable$7(fn);
1669
+ return that === undefined ? fn : NATIVE_BIND$1 ? bind$1(fn, that) : function (/* ...args */) {
1670
+ return fn.apply(that, arguments);
1671
+ };
1672
+ };
1673
+
1674
+ var wellKnownSymbol$4 = wellKnownSymbol$c;
1675
+ var Iterators$1 = iterators;
1676
+
1677
+ var ITERATOR$1 = wellKnownSymbol$4('iterator');
1678
+ var ArrayPrototype = Array.prototype;
1679
+
1680
+ // check on default Array iterator
1681
+ var isArrayIteratorMethod$1 = function (it) {
1682
+ return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$1] === it);
1558
1683
  };
1559
1684
 
1560
- var wellKnownSymbol$3 = wellKnownSymbol$a;
1685
+ var wellKnownSymbol$3 = wellKnownSymbol$c;
1561
1686
 
1562
- var TO_STRING_TAG$1 = wellKnownSymbol$3('toStringTag');
1687
+ var TO_STRING_TAG$2 = wellKnownSymbol$3('toStringTag');
1563
1688
  var test$1 = {};
1564
1689
 
1565
- test$1[TO_STRING_TAG$1] = 'z';
1690
+ test$1[TO_STRING_TAG$2] = 'z';
1566
1691
 
1567
1692
  var toStringTagSupport = String(test$1) === '[object z]';
1568
1693
 
1569
1694
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1570
- var isCallable = isCallable$e;
1571
- var classofRaw$1 = classofRaw$2;
1572
- var wellKnownSymbol$2 = wellKnownSymbol$a;
1695
+ var isCallable$1 = isCallable$g;
1696
+ var classofRaw = classofRaw$2;
1697
+ var wellKnownSymbol$2 = wellKnownSymbol$c;
1573
1698
 
1574
- var TO_STRING_TAG = wellKnownSymbol$2('toStringTag');
1699
+ var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
1575
1700
  var $Object = Object;
1576
1701
 
1577
1702
  // ES3 wrong here
1578
- var CORRECT_ARGUMENTS = classofRaw$1(function () { return arguments; }()) === 'Arguments';
1703
+ var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1579
1704
 
1580
1705
  // fallback for IE11 Script Access Denied error
1581
1706
  var tryGet = function (it, key) {
@@ -1585,228 +1710,403 @@ var tryGet = function (it, key) {
1585
1710
  };
1586
1711
 
1587
1712
  // getting tag from ES6+ `Object.prototype.toString`
1588
- var classof$2 = TO_STRING_TAG_SUPPORT ? classofRaw$1 : function (it) {
1713
+ var classof$4 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1589
1714
  var O, tag, result;
1590
1715
  return it === undefined ? 'Undefined' : it === null ? 'Null'
1591
1716
  // @@toStringTag case
1592
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
1717
+ : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1593
1718
  // builtinTag case
1594
- : CORRECT_ARGUMENTS ? classofRaw$1(O)
1719
+ : CORRECT_ARGUMENTS ? classofRaw(O)
1595
1720
  // ES3 arguments fallback
1596
- : (result = classofRaw$1(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
1721
+ : (result = classofRaw(O)) === 'Object' && isCallable$1(O.callee) ? 'Arguments' : result;
1597
1722
  };
1598
1723
 
1599
- var classof$1 = classof$2;
1724
+ var classof$3 = classof$4;
1725
+ var getMethod$2 = getMethod$4;
1726
+ var isNullOrUndefined = isNullOrUndefined$3;
1727
+ var Iterators = iterators;
1728
+ var wellKnownSymbol$1 = wellKnownSymbol$c;
1600
1729
 
1601
- var $String = String;
1730
+ var ITERATOR = wellKnownSymbol$1('iterator');
1602
1731
 
1603
- var toString$3 = function (argument) {
1604
- if (classof$1(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
1605
- return $String(argument);
1732
+ var getIteratorMethod$2 = function (it) {
1733
+ if (!isNullOrUndefined(it)) return getMethod$2(it, ITERATOR)
1734
+ || getMethod$2(it, '@@iterator')
1735
+ || Iterators[classof$3(it)];
1606
1736
  };
1607
1737
 
1608
- var uncurryThis$5 = functionUncurryThis;
1609
-
1610
- var arraySlice$1 = uncurryThis$5([].slice);
1611
-
1612
- var arraySlice = arraySlice$1;
1613
-
1614
- var floor = Math.floor;
1738
+ var call$9 = functionCall;
1739
+ var aCallable$6 = aCallable$a;
1740
+ var anObject$9 = anObject$f;
1741
+ var tryToString$2 = tryToString$4;
1742
+ var getIteratorMethod$1 = getIteratorMethod$2;
1615
1743
 
1616
- var sort = function (array, comparefn) {
1617
- var length = array.length;
1744
+ var $TypeError$6 = TypeError;
1618
1745
 
1619
- if (length < 8) {
1620
- // insertion sort
1621
- var i = 1;
1622
- var element, j;
1746
+ var getIterator$1 = function (argument, usingIterator) {
1747
+ var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1748
+ if (aCallable$6(iteratorMethod)) return anObject$9(call$9(iteratorMethod, argument));
1749
+ throw new $TypeError$6(tryToString$2(argument) + ' is not iterable');
1750
+ };
1623
1751
 
1624
- while (i < length) {
1625
- j = i;
1626
- element = array[i];
1627
- while (j && comparefn(array[j - 1], element) > 0) {
1628
- array[j] = array[--j];
1629
- }
1630
- if (j !== i++) array[j] = element;
1631
- }
1632
- } else {
1633
- // merge sort
1634
- var middle = floor(length / 2);
1635
- var left = sort(arraySlice(array, 0, middle), comparefn);
1636
- var right = sort(arraySlice(array, middle), comparefn);
1637
- var llength = left.length;
1638
- var rlength = right.length;
1639
- var lindex = 0;
1640
- var rindex = 0;
1752
+ var call$8 = functionCall;
1753
+ var anObject$8 = anObject$f;
1754
+ var getMethod$1 = getMethod$4;
1641
1755
 
1642
- while (lindex < llength || rindex < rlength) {
1643
- array[lindex + rindex] = (lindex < llength && rindex < rlength)
1644
- ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
1645
- : lindex < llength ? left[lindex++] : right[rindex++];
1756
+ var iteratorClose$8 = function (iterator, kind, value) {
1757
+ var innerResult, innerError;
1758
+ anObject$8(iterator);
1759
+ try {
1760
+ innerResult = getMethod$1(iterator, 'return');
1761
+ if (!innerResult) {
1762
+ if (kind === 'throw') throw value;
1763
+ return value;
1646
1764
  }
1765
+ innerResult = call$8(innerResult, iterator);
1766
+ } catch (error) {
1767
+ innerError = true;
1768
+ innerResult = error;
1647
1769
  }
1770
+ if (kind === 'throw') throw value;
1771
+ if (innerError) throw innerResult;
1772
+ anObject$8(innerResult);
1773
+ return value;
1774
+ };
1775
+
1776
+ var bind = functionBindContext;
1777
+ var call$7 = functionCall;
1778
+ var anObject$7 = anObject$f;
1779
+ var tryToString$1 = tryToString$4;
1780
+ var isArrayIteratorMethod = isArrayIteratorMethod$1;
1781
+ var lengthOfArrayLike$3 = lengthOfArrayLike$5;
1782
+ var isPrototypeOf$2 = objectIsPrototypeOf;
1783
+ var getIterator = getIterator$1;
1784
+ var getIteratorMethod = getIteratorMethod$2;
1785
+ var iteratorClose$7 = iteratorClose$8;
1648
1786
 
1649
- return array;
1650
- };
1651
-
1652
- var arraySort = sort;
1653
-
1654
- var fails$6 = fails$h;
1787
+ var $TypeError$5 = TypeError;
1655
1788
 
1656
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1657
- var method = [][METHOD_NAME];
1658
- return !!method && fails$6(function () {
1659
- // eslint-disable-next-line no-useless-call -- required for testing
1660
- method.call(null, argument || function () { return 1; }, 1);
1661
- });
1789
+ var Result = function (stopped, result) {
1790
+ this.stopped = stopped;
1791
+ this.result = result;
1662
1792
  };
1663
1793
 
1664
- var userAgent$1 = engineUserAgent;
1794
+ var ResultPrototype = Result.prototype;
1665
1795
 
1666
- var firefox = userAgent$1.match(/firefox\/(\d+)/i);
1796
+ var iterate$3 = function (iterable, unboundFunction, options) {
1797
+ var that = options && options.that;
1798
+ var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1799
+ var IS_RECORD = !!(options && options.IS_RECORD);
1800
+ var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1801
+ var INTERRUPTED = !!(options && options.INTERRUPTED);
1802
+ var fn = bind(unboundFunction, that);
1803
+ var iterator, iterFn, index, length, result, next, step;
1667
1804
 
1668
- var engineFfVersion = !!firefox && +firefox[1];
1669
-
1670
- var UA = engineUserAgent;
1671
-
1672
- var engineIsIeOrEdge = /MSIE|Trident/.test(UA);
1673
-
1674
- var userAgent = engineUserAgent;
1805
+ var stop = function (condition) {
1806
+ if (iterator) iteratorClose$7(iterator, 'normal');
1807
+ return new Result(true, condition);
1808
+ };
1675
1809
 
1676
- var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
1810
+ var callFn = function (value) {
1811
+ if (AS_ENTRIES) {
1812
+ anObject$7(value);
1813
+ return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1814
+ } return INTERRUPTED ? fn(value, stop) : fn(value);
1815
+ };
1677
1816
 
1678
- var engineWebkitVersion = !!webkit && +webkit[1];
1817
+ if (IS_RECORD) {
1818
+ iterator = iterable.iterator;
1819
+ } else if (IS_ITERATOR) {
1820
+ iterator = iterable;
1821
+ } else {
1822
+ iterFn = getIteratorMethod(iterable);
1823
+ if (!iterFn) throw new $TypeError$5(tryToString$1(iterable) + ' is not iterable');
1824
+ // optimisation for array iterators
1825
+ if (isArrayIteratorMethod(iterFn)) {
1826
+ for (index = 0, length = lengthOfArrayLike$3(iterable); length > index; index++) {
1827
+ result = callFn(iterable[index]);
1828
+ if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
1829
+ } return new Result(false);
1830
+ }
1831
+ iterator = getIterator(iterable, iterFn);
1832
+ }
1679
1833
 
1680
- var $$3 = _export;
1681
- var uncurryThis$4 = functionUncurryThis;
1682
- var aCallable = aCallable$3;
1683
- var toObject$1 = toObject$4;
1684
- var lengthOfArrayLike = lengthOfArrayLike$2;
1685
- var deletePropertyOrThrow = deletePropertyOrThrow$1;
1686
- var toString$2 = toString$3;
1687
- var fails$5 = fails$h;
1688
- var internalSort = arraySort;
1689
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
1690
- var FF = engineFfVersion;
1691
- var IE_OR_EDGE = engineIsIeOrEdge;
1692
- var V8 = engineV8Version;
1693
- var WEBKIT = engineWebkitVersion;
1834
+ next = IS_RECORD ? iterable.next : iterator.next;
1835
+ while (!(step = call$7(next, iterator)).done) {
1836
+ try {
1837
+ result = callFn(step.value);
1838
+ } catch (error) {
1839
+ iteratorClose$7(iterator, 'throw', error);
1840
+ }
1841
+ if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
1842
+ } return new Result(false);
1843
+ };
1694
1844
 
1695
- var test = [];
1696
- var nativeSort = uncurryThis$4(test.sort);
1697
- var push = uncurryThis$4(test.push);
1845
+ // `GetIteratorDirect(obj)` abstract operation
1846
+ // https://tc39.es/ecma262/#sec-getiteratordirect
1847
+ var getIteratorDirect$4 = function (obj) {
1848
+ return {
1849
+ iterator: obj,
1850
+ next: obj.next,
1851
+ done: false
1852
+ };
1853
+ };
1698
1854
 
1699
- // IE8-
1700
- var FAILS_ON_UNDEFINED = fails$5(function () {
1701
- test.sort(undefined);
1702
- });
1703
- // V8 bug
1704
- var FAILS_ON_NULL = fails$5(function () {
1705
- test.sort(null);
1706
- });
1707
- // Old WebKit
1708
- var STRICT_METHOD = arrayMethodIsStrict('sort');
1855
+ var globalThis$4 = globalThis_1;
1709
1856
 
1710
- var STABLE_SORT = !fails$5(function () {
1711
- // feature detection can be too slow, so check engines versions
1712
- if (V8) return V8 < 70;
1713
- if (FF && FF > 3) return;
1714
- if (IE_OR_EDGE) return true;
1715
- if (WEBKIT) return WEBKIT < 603;
1857
+ // https://github.com/tc39/ecma262/pull/3467
1858
+ var iteratorHelperWithoutClosingOnEarlyError$4 = function (METHOD_NAME, ExpectedError) {
1859
+ var Iterator = globalThis$4.Iterator;
1860
+ var IteratorPrototype = Iterator && Iterator.prototype;
1861
+ var method = IteratorPrototype && IteratorPrototype[METHOD_NAME];
1716
1862
 
1717
- var result = '';
1718
- var code, chr, value, index;
1863
+ var CLOSED = false;
1719
1864
 
1720
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
1721
- for (code = 65; code < 76; code++) {
1722
- chr = String.fromCharCode(code);
1865
+ if (method) try {
1866
+ method.call({
1867
+ next: function () { return { done: true }; },
1868
+ 'return': function () { CLOSED = true; }
1869
+ }, -1);
1870
+ } catch (error) {
1871
+ // https://bugs.webkit.org/show_bug.cgi?id=291195
1872
+ if (!(error instanceof ExpectedError)) CLOSED = false;
1873
+ }
1723
1874
 
1724
- switch (code) {
1725
- case 66: case 69: case 70: case 72: value = 3; break;
1726
- case 68: case 71: value = 4; break;
1727
- default: value = 2;
1728
- }
1875
+ if (!CLOSED) return method;
1876
+ };
1729
1877
 
1730
- for (index = 0; index < 47; index++) {
1731
- test.push({ k: chr + index, v: value });
1878
+ var $$8 = _export;
1879
+ var call$6 = functionCall;
1880
+ var iterate$2 = iterate$3;
1881
+ var aCallable$5 = aCallable$a;
1882
+ var anObject$6 = anObject$f;
1883
+ var getIteratorDirect$3 = getIteratorDirect$4;
1884
+ var iteratorClose$6 = iteratorClose$8;
1885
+ var iteratorHelperWithoutClosingOnEarlyError$3 = iteratorHelperWithoutClosingOnEarlyError$4;
1886
+
1887
+ var findWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$3('find', TypeError);
1888
+
1889
+ // `Iterator.prototype.find` method
1890
+ // https://tc39.es/ecma262/#sec-iterator.prototype.find
1891
+ $$8({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnEarlyError }, {
1892
+ find: function find(predicate) {
1893
+ anObject$6(this);
1894
+ try {
1895
+ aCallable$5(predicate);
1896
+ } catch (error) {
1897
+ iteratorClose$6(this, 'throw', error);
1732
1898
  }
1733
- }
1734
1899
 
1735
- test.sort(function (a, b) { return b.v - a.v; });
1900
+ if (findWithoutClosingOnEarlyError) return call$6(findWithoutClosingOnEarlyError, this, predicate);
1736
1901
 
1737
- for (index = 0; index < test.length; index++) {
1738
- chr = test[index].k.charAt(0);
1739
- if (result.charAt(result.length - 1) !== chr) result += chr;
1902
+ var record = getIteratorDirect$3(this);
1903
+ var counter = 0;
1904
+ return iterate$2(record, function (value, stop) {
1905
+ if (predicate(value, counter++)) return stop(value);
1906
+ }, { IS_RECORD: true, INTERRUPTED: true }).result;
1740
1907
  }
1741
-
1742
- return result !== 'DGBEFHACIJK';
1743
1908
  });
1744
1909
 
1745
- var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
1910
+ var defineBuiltIn$1 = defineBuiltIn$5;
1746
1911
 
1747
- var getSortCompare = function (comparefn) {
1748
- return function (x, y) {
1749
- if (y === undefined) return -1;
1750
- if (x === undefined) return 1;
1751
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
1752
- return toString$2(x) > toString$2(y) ? 1 : -1;
1753
- };
1912
+ var defineBuiltIns$1 = function (target, src, options) {
1913
+ for (var key in src) defineBuiltIn$1(target, key, src[key], options);
1914
+ return target;
1754
1915
  };
1755
1916
 
1756
- // `Array.prototype.sort` method
1757
- // https://tc39.es/ecma262/#sec-array.prototype.sort
1758
- $$3({ target: 'Array', proto: true, forced: FORCED }, {
1759
- sort: function sort(comparefn) {
1760
- if (comparefn !== undefined) aCallable(comparefn);
1761
-
1762
- var array = toObject$1(this);
1763
-
1764
- if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
1917
+ var iteratorClose$5 = iteratorClose$8;
1765
1918
 
1766
- var items = [];
1767
- var arrayLength = lengthOfArrayLike(array);
1768
- var itemsLength, index;
1919
+ var iteratorCloseAll$1 = function (iters, kind, value) {
1920
+ for (var i = iters.length - 1; i >= 0; i--) {
1921
+ if (iters[i] === undefined) continue;
1922
+ try {
1923
+ value = iteratorClose$5(iters[i].iterator, kind, value);
1924
+ } catch (error) {
1925
+ kind = 'throw';
1926
+ value = error;
1927
+ }
1928
+ }
1929
+ if (kind === 'throw') throw value;
1930
+ return value;
1931
+ };
1769
1932
 
1770
- for (index = 0; index < arrayLength; index++) {
1771
- if (index in array) push(items, array[index]);
1933
+ var call$5 = functionCall;
1934
+ var create = objectCreate;
1935
+ var createNonEnumerableProperty$3 = createNonEnumerableProperty$8;
1936
+ var defineBuiltIns = defineBuiltIns$1;
1937
+ var wellKnownSymbol = wellKnownSymbol$c;
1938
+ var InternalStateModule = internalState;
1939
+ var getMethod = getMethod$4;
1940
+ var IteratorPrototype = iteratorsCore.IteratorPrototype;
1941
+ var createIterResultObject = createIterResultObject$2;
1942
+ var iteratorClose$4 = iteratorClose$8;
1943
+ var iteratorCloseAll = iteratorCloseAll$1;
1944
+
1945
+ var TO_STRING_TAG = wellKnownSymbol('toStringTag');
1946
+ var ITERATOR_HELPER = 'IteratorHelper';
1947
+ var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
1948
+ var NORMAL = 'normal';
1949
+ var THROW = 'throw';
1950
+ var setInternalState = InternalStateModule.set;
1951
+
1952
+ var createIteratorProxyPrototype = function (IS_ITERATOR) {
1953
+ var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
1954
+
1955
+ return defineBuiltIns(create(IteratorPrototype), {
1956
+ next: function next() {
1957
+ var state = getInternalState(this);
1958
+ // for simplification:
1959
+ // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`
1960
+ // for `%IteratorHelperPrototype%.next` - just a value
1961
+ if (IS_ITERATOR) return state.nextHandler();
1962
+ if (state.done) return createIterResultObject(undefined, true);
1963
+ try {
1964
+ var result = state.nextHandler();
1965
+ return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
1966
+ } catch (error) {
1967
+ state.done = true;
1968
+ throw error;
1969
+ }
1970
+ },
1971
+ 'return': function () {
1972
+ var state = getInternalState(this);
1973
+ var iterator = state.iterator;
1974
+ state.done = true;
1975
+ if (IS_ITERATOR) {
1976
+ var returnMethod = getMethod(iterator, 'return');
1977
+ return returnMethod ? call$5(returnMethod, iterator) : createIterResultObject(undefined, true);
1978
+ }
1979
+ if (state.inner) try {
1980
+ iteratorClose$4(state.inner.iterator, NORMAL);
1981
+ } catch (error) {
1982
+ return iteratorClose$4(iterator, THROW, error);
1983
+ }
1984
+ if (state.openIters) try {
1985
+ iteratorCloseAll(state.openIters, NORMAL);
1986
+ } catch (error) {
1987
+ return iteratorClose$4(iterator, THROW, error);
1988
+ }
1989
+ if (iterator) iteratorClose$4(iterator, NORMAL);
1990
+ return createIterResultObject(undefined, true);
1772
1991
  }
1992
+ });
1993
+ };
1773
1994
 
1774
- internalSort(items, getSortCompare(comparefn));
1995
+ var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
1996
+ var IteratorHelperPrototype = createIteratorProxyPrototype(false);
1775
1997
 
1776
- itemsLength = lengthOfArrayLike(items);
1777
- index = 0;
1998
+ createNonEnumerableProperty$3(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
1778
1999
 
1779
- while (index < itemsLength) array[index] = items[index++];
1780
- while (index < arrayLength) deletePropertyOrThrow(array, index++);
2000
+ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
2001
+ var IteratorProxy = function Iterator(record, state) {
2002
+ if (state) {
2003
+ state.iterator = record.iterator;
2004
+ state.next = record.next;
2005
+ } else state = record;
2006
+ state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
2007
+ state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
2008
+ state.nextHandler = nextHandler;
2009
+ state.counter = 0;
2010
+ state.done = false;
2011
+ setInternalState(this, state);
2012
+ };
1781
2013
 
1782
- return array;
2014
+ IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
2015
+
2016
+ return IteratorProxy;
2017
+ };
2018
+
2019
+ var anObject$5 = anObject$f;
2020
+ var iteratorClose$3 = iteratorClose$8;
2021
+
2022
+ // call something on iterator step with safe closing on error
2023
+ var callWithSafeIterationClosing$1 = function (iterator, fn, value, ENTRIES) {
2024
+ try {
2025
+ return ENTRIES ? fn(anObject$5(value)[0], value[1]) : fn(value);
2026
+ } catch (error) {
2027
+ iteratorClose$3(iterator, 'throw', error);
2028
+ }
2029
+ };
2030
+
2031
+ // Should throw an error on invalid iterator
2032
+ // https://issues.chromium.org/issues/336839115
2033
+ var iteratorHelperThrowsOnInvalidIterator$1 = function (methodName, argument) {
2034
+ // eslint-disable-next-line es/no-iterator -- required for testing
2035
+ var method = typeof Iterator == 'function' && Iterator.prototype[methodName];
2036
+ if (method) try {
2037
+ method.call({ next: null }, argument).next();
2038
+ } catch (error) {
2039
+ return true;
1783
2040
  }
2041
+ };
2042
+
2043
+ var $$7 = _export;
2044
+ var call$4 = functionCall;
2045
+ var aCallable$4 = aCallable$a;
2046
+ var anObject$4 = anObject$f;
2047
+ var getIteratorDirect$2 = getIteratorDirect$4;
2048
+ var createIteratorProxy = iteratorCreateProxy;
2049
+ var callWithSafeIterationClosing = callWithSafeIterationClosing$1;
2050
+ var iteratorClose$2 = iteratorClose$8;
2051
+ var iteratorHelperThrowsOnInvalidIterator = iteratorHelperThrowsOnInvalidIterator$1;
2052
+ var iteratorHelperWithoutClosingOnEarlyError$2 = iteratorHelperWithoutClosingOnEarlyError$4;
2053
+
2054
+ var MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR = !iteratorHelperThrowsOnInvalidIterator('map', function () { /* empty */ });
2055
+ var mapWithoutClosingOnEarlyError = !MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR
2056
+ && iteratorHelperWithoutClosingOnEarlyError$2('map', TypeError);
2057
+
2058
+ var FORCED$4 = MAP_WITHOUT_THROWING_ON_INVALID_ITERATOR || mapWithoutClosingOnEarlyError;
2059
+
2060
+ var IteratorProxy = createIteratorProxy(function () {
2061
+ var iterator = this.iterator;
2062
+ var result = anObject$4(call$4(this.next, iterator));
2063
+ var done = this.done = !!result.done;
2064
+ if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
1784
2065
  });
1785
2066
 
1786
- var DESCRIPTORS = descriptors;
2067
+ // `Iterator.prototype.map` method
2068
+ // https://tc39.es/ecma262/#sec-iterator.prototype.map
2069
+ $$7({ target: 'Iterator', proto: true, real: true, forced: FORCED$4 }, {
2070
+ map: function map(mapper) {
2071
+ anObject$4(this);
2072
+ try {
2073
+ aCallable$4(mapper);
2074
+ } catch (error) {
2075
+ iteratorClose$2(this, 'throw', error);
2076
+ }
2077
+
2078
+ if (mapWithoutClosingOnEarlyError) return call$4(mapWithoutClosingOnEarlyError, this, mapper);
2079
+
2080
+ return new IteratorProxy(getIteratorDirect$2(this), {
2081
+ mapper: mapper
2082
+ });
2083
+ }
2084
+ });
2085
+
2086
+ var DESCRIPTORS$2 = descriptors;
1787
2087
  var uncurryThis$3 = functionUncurryThis;
1788
- var call$2 = functionCall;
1789
- var fails$4 = fails$h;
2088
+ var call$3 = functionCall;
2089
+ var fails$7 = fails$j;
1790
2090
  var objectKeys = objectKeys$2;
1791
2091
  var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1792
2092
  var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1793
- var toObject = toObject$4;
1794
- var IndexedObject = indexedObject;
2093
+ var toObject$3 = toObject$6;
2094
+ var IndexedObject$1 = indexedObject;
1795
2095
 
1796
2096
  // eslint-disable-next-line es/no-object-assign -- safe
1797
2097
  var $assign = Object.assign;
1798
2098
  // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1799
- var defineProperty = Object.defineProperty;
2099
+ var defineProperty$1 = Object.defineProperty;
1800
2100
  var concat = uncurryThis$3([].concat);
1801
2101
 
1802
2102
  // `Object.assign` method
1803
2103
  // https://tc39.es/ecma262/#sec-object.assign
1804
- var objectAssign = !$assign || fails$4(function () {
2104
+ var objectAssign = !$assign || fails$7(function () {
1805
2105
  // should have correct order of operations (Edge bug)
1806
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
2106
+ if (DESCRIPTORS$2 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
1807
2107
  enumerable: true,
1808
2108
  get: function () {
1809
- defineProperty(this, 'b', {
2109
+ defineProperty$1(this, 'b', {
1810
2110
  value: 3,
1811
2111
  enumerable: false
1812
2112
  });
@@ -1819,174 +2119,101 @@ var objectAssign = !$assign || fails$4(function () {
1819
2119
  var symbol = Symbol('assign detection');
1820
2120
  var alphabet = 'abcdefghijklmnopqrst';
1821
2121
  A[symbol] = 7;
2122
+ // eslint-disable-next-line es/no-array-prototype-foreach -- safe
1822
2123
  alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1823
2124
  return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
1824
2125
  }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1825
- var T = toObject(target);
2126
+ var T = toObject$3(target);
1826
2127
  var argumentsLength = arguments.length;
1827
2128
  var index = 1;
1828
2129
  var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1829
2130
  var propertyIsEnumerable = propertyIsEnumerableModule.f;
1830
2131
  while (argumentsLength > index) {
1831
- var S = IndexedObject(arguments[index++]);
2132
+ var S = IndexedObject$1(arguments[index++]);
1832
2133
  var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1833
2134
  var length = keys.length;
1834
2135
  var j = 0;
1835
2136
  var key;
1836
2137
  while (length > j) {
1837
2138
  key = keys[j++];
1838
- if (!DESCRIPTORS || call$2(propertyIsEnumerable, S, key)) T[key] = S[key];
2139
+ if (!DESCRIPTORS$2 || call$3(propertyIsEnumerable, S, key)) T[key] = S[key];
1839
2140
  }
1840
2141
  } return T;
1841
2142
  } : $assign;
1842
2143
 
1843
- var $$2 = _export;
2144
+ var $$6 = _export;
1844
2145
  var assign = objectAssign;
1845
2146
 
1846
2147
  // `Object.assign` method
1847
2148
  // https://tc39.es/ecma262/#sec-object.assign
1848
2149
  // eslint-disable-next-line es/no-object-assign -- required for testing
1849
- $$2({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
2150
+ $$6({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1850
2151
  assign: assign
1851
2152
  });
1852
2153
 
1853
- var anObject$1 = anObject$6;
1854
-
1855
- // `RegExp.prototype.flags` getter implementation
1856
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1857
- var regexpFlags$1 = function () {
1858
- var that = anObject$1(this);
1859
- var result = '';
1860
- if (that.hasIndices) result += 'd';
1861
- if (that.global) result += 'g';
1862
- if (that.ignoreCase) result += 'i';
1863
- if (that.multiline) result += 'm';
1864
- if (that.dotAll) result += 's';
1865
- if (that.unicode) result += 'u';
1866
- if (that.unicodeSets) result += 'v';
1867
- if (that.sticky) result += 'y';
1868
- return result;
1869
- };
1870
-
1871
- var call$1 = functionCall;
1872
- var hasOwn = hasOwnProperty_1;
1873
- var isPrototypeOf = objectIsPrototypeOf;
1874
- var regExpFlags = regexpFlags$1;
1875
-
1876
- var RegExpPrototype$1 = RegExp.prototype;
1877
-
1878
- var regexpGetFlags = function (R) {
1879
- var flags = R.flags;
1880
- return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype$1, R)
1881
- ? call$1(regExpFlags, R) : flags;
1882
- };
1883
-
1884
- var PROPER_FUNCTION_NAME = functionName.PROPER;
1885
- var defineBuiltIn = defineBuiltIn$4;
1886
- var anObject = anObject$6;
1887
- var $toString = toString$3;
1888
- var fails$3 = fails$h;
1889
- var getRegExpFlags = regexpGetFlags;
1890
-
1891
- var TO_STRING = 'toString';
1892
- var RegExpPrototype = RegExp.prototype;
1893
- var nativeToString = RegExpPrototype[TO_STRING];
1894
-
1895
- var NOT_GENERIC = fails$3(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
1896
- // FF44- RegExp#toString has a wrong name
1897
- var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
1898
-
1899
- // `RegExp.prototype.toString` method
1900
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
1901
- if (NOT_GENERIC || INCORRECT_NAME) {
1902
- defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
1903
- var R = anObject(this);
1904
- var pattern = $toString(R.source);
1905
- var flags = $toString(getRegExpFlags(R));
1906
- return '/' + pattern + '/' + flags;
1907
- }, { unsafe: true });
1908
- }
1909
-
1910
- var classofRaw = classofRaw$2;
1911
- var uncurryThis$2 = functionUncurryThis;
1912
-
1913
- var functionUncurryThisClause = function (fn) {
1914
- // Nashorn bug:
1915
- // https://github.com/zloirock/core-js/issues/1128
1916
- // https://github.com/zloirock/core-js/issues/1130
1917
- if (classofRaw(fn) === 'Function') return uncurryThis$2(fn);
1918
- };
1919
-
1920
- var isObject = isObject$9;
1921
- var classof = classofRaw$2;
1922
- var wellKnownSymbol$1 = wellKnownSymbol$a;
1923
-
1924
- var MATCH$1 = wellKnownSymbol$1('match');
1925
-
1926
- // `IsRegExp` abstract operation
1927
- // https://tc39.es/ecma262/#sec-isregexp
1928
- var isRegexp = function (it) {
1929
- var isRegExp;
1930
- return isObject(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof(it) === 'RegExp');
1931
- };
1932
-
1933
- var isRegExp = isRegexp;
1934
-
1935
- var $TypeError = TypeError;
1936
-
1937
- var notARegexp = function (it) {
1938
- if (isRegExp(it)) {
1939
- throw new $TypeError("The method doesn't accept regular expressions");
1940
- } return it;
2154
+ /******************************************************************************
2155
+ Copyright (c) Microsoft Corporation.
2156
+
2157
+ Permission to use, copy, modify, and/or distribute this software for any
2158
+ purpose with or without fee is hereby granted.
2159
+
2160
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2161
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2162
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2163
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2164
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2165
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2166
+ PERFORMANCE OF THIS SOFTWARE.
2167
+ ***************************************************************************** */
2168
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
2169
+
2170
+
2171
+ function __rest(s, e) {
2172
+ var t = {};
2173
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2174
+ t[p] = s[p];
2175
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
2176
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2177
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2178
+ t[p[i]] = s[p[i]];
2179
+ }
2180
+ return t;
2181
+ }
2182
+
2183
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2184
+ var e = new Error(message);
2185
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1941
2186
  };
1942
2187
 
1943
- var wellKnownSymbol = wellKnownSymbol$a;
1944
-
1945
- var MATCH = wellKnownSymbol('match');
1946
-
1947
- var correctIsRegexpLogic = function (METHOD_NAME) {
1948
- var regexp = /./;
1949
- try {
1950
- '/./'[METHOD_NAME](regexp);
1951
- } catch (error1) {
1952
- try {
1953
- regexp[MATCH] = false;
1954
- return '/./'[METHOD_NAME](regexp);
1955
- } catch (error2) { /* empty */ }
1956
- } return false;
2188
+ const BuildSchemaAsFields = ({
2189
+ components,
2190
+ mappers,
2191
+ formIndex,
2192
+ mountedForm
2193
+ }) => {
2194
+ return components && components.map(_a => {
2195
+ var {
2196
+ component
2197
+ } = _a,
2198
+ componentEl = __rest(_a, ["component"]);
2199
+ const mapper = mappers === null || mappers === void 0 ? void 0 : mappers.find(el => el.componentName === component);
2200
+ return mapper ? jsx(AsFormFieldBuilder, Object.assign({
2201
+ formIndex: formIndex,
2202
+ mapper: mapper,
2203
+ formMounted: mountedForm
2204
+ }, componentEl, {
2205
+ children: componentEl.children && componentEl.children.length > 0 && jsx(BuildSchemaAsFields, {
2206
+ formIndex: formIndex,
2207
+ mappers: mappers,
2208
+ components: componentEl.children,
2209
+ mountedForm: mountedForm
2210
+ })
2211
+ }), componentEl.name) : jsx("div", {
2212
+ children: `component mapper not found for ${component} from field name ${componentEl.name} on form ${formIndex}`
2213
+ }, componentEl.name);
2214
+ });
1957
2215
  };
1958
2216
 
1959
- var $$1 = _export;
1960
- var uncurryThis$1 = functionUncurryThisClause;
1961
- var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
1962
- var toLength = toLength$2;
1963
- var toString$1 = toString$3;
1964
- var notARegExp = notARegexp;
1965
- var requireObjectCoercible = requireObjectCoercible$4;
1966
- var correctIsRegExpLogic = correctIsRegexpLogic;
1967
-
1968
- var stringSlice$1 = uncurryThis$1(''.slice);
1969
- var min = Math.min;
1970
-
1971
- var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');
1972
- // https://github.com/zloirock/core-js/pull/702
1973
- var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
1974
- var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');
1975
- return descriptor && !descriptor.writable;
1976
- }();
1977
-
1978
- // `String.prototype.startsWith` method
1979
- // https://tc39.es/ecma262/#sec-string.prototype.startswith
1980
- $$1({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
1981
- startsWith: function startsWith(searchString /* , position = 0 */) {
1982
- var that = toString$1(requireObjectCoercible(this));
1983
- notARegExp(searchString);
1984
- var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));
1985
- var search = toString$1(searchString);
1986
- return stringSlice$1(that, index, index + search.length) === search;
1987
- }
1988
- });
1989
-
1990
2217
  const FormGroupContext = /*#__PURE__*/createContext({});
1991
2218
  /**
1992
2219
  * context interface to be used isolated or with the context provider
@@ -2000,8 +2227,10 @@ const IsolatedContext = ({
2000
2227
  config
2001
2228
  }) => {
2002
2229
  const formGroupInstance = useRef(new FormGroup({
2003
- config
2230
+ config,
2231
+ mappers
2004
2232
  }));
2233
+ const formGroupContextMountRef = useRef(false);
2005
2234
  const addFormWithIndex = index => {
2006
2235
  formGroupInstance.current.createFormWithIndex({
2007
2236
  index,
@@ -2010,11 +2239,11 @@ const IsolatedContext = ({
2010
2239
  };
2011
2240
  const addForm = ({
2012
2241
  key,
2013
- formInstance
2242
+ params
2014
2243
  }) => {
2015
2244
  formGroupInstance.current.addForm({
2016
2245
  key,
2017
- formInstance
2246
+ params
2018
2247
  });
2019
2248
  };
2020
2249
  const removeForm = ({
@@ -2032,9 +2261,23 @@ const IsolatedContext = ({
2032
2261
  const printFormGroupInstance = () => {
2033
2262
  console.log(formGroupInstance.current.printFormGroupInstance());
2034
2263
  };
2035
- function submitMultipleFormsByIndex(indexes) {
2036
- return formGroupInstance.current.submitMultipleFormsByIndex(indexes);
2264
+ function submitMultipleFormsByIndex(indexes, callback) {
2265
+ return formGroupInstance.current.submitMultipleFormsByIndex(indexes, callback);
2037
2266
  }
2267
+ useEffect(() => {
2268
+ return () => {
2269
+ if (formGroupContextMountRef.current) {
2270
+ // strictMode made me do this, Beato Carlo Acutis please forgive me
2271
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2272
+ formGroupInstance.current.destroy();
2273
+ }
2274
+ };
2275
+ }, []);
2276
+ useEffect(() => {
2277
+ return () => {
2278
+ formGroupContextMountRef.current = true;
2279
+ };
2280
+ }, []);
2038
2281
  return {
2039
2282
  addFormWithIndex,
2040
2283
  addForm,
@@ -2095,284 +2338,529 @@ const useFormGroupContext = props => {
2095
2338
  return context;
2096
2339
  };
2097
2340
 
2098
- /**
2099
- * Renders the React element defined on the mappers configuration
2100
- *
2101
- * @param param component props, field instance and children to render
2102
- * @returns
2103
- */
2104
- const FieldWrapperComponentRender = ({
2105
- props,
2106
- fieldInstance,
2107
- children
2108
- }) => {
2109
- var _a, _b, _c;
2110
- const Component = (_a = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _a === void 0 ? void 0 : _a.component;
2111
- const Asynccomponent = (_b = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _b === void 0 ? void 0 : _b.asynccomponent;
2112
- if (Component) return jsx(Component, Object.assign({}, props, {
2113
- children: children && children
2114
- }));
2115
- if (Asynccomponent) return jsx(Suspense, {
2116
- children: jsx(Asynccomponent, Object.assign({}, props, {
2117
- children: children && children
2118
- }))
2119
- });
2120
- return jsx("div", {
2121
- children: `failed to render field ${fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.name} with componentName:${(_c = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _c === void 0 ? void 0 : _c.componentName}, please check mappers`
2341
+ var NATIVE_BIND = functionBindNative;
2342
+
2343
+ var FunctionPrototype = Function.prototype;
2344
+ var apply$2 = FunctionPrototype.apply;
2345
+ var call$2 = FunctionPrototype.call;
2346
+
2347
+ // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
2348
+ var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$2.bind(apply$2) : function () {
2349
+ return call$2.apply(apply$2, arguments);
2350
+ });
2351
+
2352
+ var defineProperty = objectDefineProperty.f;
2353
+
2354
+ var proxyAccessor$1 = function (Target, Source, key) {
2355
+ key in Target || defineProperty(Target, key, {
2356
+ configurable: true,
2357
+ get: function () { return Source[key]; },
2358
+ set: function (it) { Source[key] = it; }
2122
2359
  });
2123
2360
  };
2124
- /**
2125
- * Base field Wrapper to render the component with the necessary configurations from the schema
2126
- * and mapper configuration
2127
- *
2128
- * @param {TFieldWrapperProps} param FieldWrapper params
2129
- * @returns {ReactElement}
2130
- */
2131
- const FieldWrapper = ({
2132
- name,
2133
- formIndex,
2134
- children,
2135
- props,
2136
- context
2137
- }) => {
2138
- var _a, _b, _c;
2139
- const localContext = useFormGroupContext({});
2140
- /**
2141
- * picks the right context prioritizing the context passed as prop
2142
- */
2143
- const {
2144
- formGroupInstance,
2145
- debugMode
2146
- } = useMemo(() => context ? context : localContext, [context, localContext]);
2147
- const fieldInstance = useRef((_a = formGroupInstance.getForm({
2148
- key: formIndex
2149
- })) === null || _a === void 0 ? void 0 : _a.getField({
2150
- key: name
2151
- })).current;
2152
- const [valueState, setValueState] = useState((fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.stateValue) || {});
2153
- const [state, setState] = useState({
2154
- visibility: fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.visibility,
2155
- props: (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.props) || props
2156
- });
2157
- /**
2158
- * handles the mounting and unmounting logic onto the field instance
2159
- */
2160
- useEffect(() => {
2161
- fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mountField({
2162
- valueSubscription: value => {
2163
- setValueState(value);
2164
- },
2165
- propsSubscription: ({
2166
- visibility,
2167
- props,
2168
- errors
2169
- }) => {
2170
- setState(prev => Object.assign(Object.assign({}, prev), {
2171
- visibility,
2172
- props,
2173
- errors
2174
- }));
2175
- }
2176
- });
2177
- return () => {
2178
- fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.destroyField();
2179
- };
2180
- }, []);
2181
- /**
2182
- * handles the value change onto the field instance
2183
- */
2184
- const handleChange = useCallback(event => {
2185
- fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitValue({
2186
- value: event,
2187
- event: 'ON_FIELD_CHANGE'
2188
- });
2189
- }, []);
2190
- /**
2191
- * handles the event emission onto the field instance
2192
- */
2193
- const handleEvent = useCallback(event => {
2194
- fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitEvents({
2195
- event
2196
- });
2197
- }, []);
2198
- /**
2199
- * handles the mappers configuration to bind the event submission callback
2200
- * to the corresponding prop defined on the mappers
2201
- */
2202
- const mapProps = useMemo(() => {
2203
- var _a;
2204
- const events = (_a = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _a === void 0 ? void 0 : _a.events;
2205
- const props = {};
2206
- if (events === null || events === void 0 ? void 0 : events.onBlur) props[events.onBlur] = () => handleEvent('ON_FIELD_BLUR');
2207
- if (events === null || events === void 0 ? void 0 : events.getValue) props[events.getValue] = handleChange;
2208
- if (events === null || events === void 0 ? void 0 : events.onFocus) props[events.onFocus] = () => handleEvent('ON_FIELD_FOCUS');
2209
- if (events === null || events === void 0 ? void 0 : events.onClick) props[events.onClick] = () => handleEvent('ON_FIELD_CLICK');
2210
- if (events === null || events === void 0 ? void 0 : events.onSubmit) props[events.onSubmit] = () => handleEvent('ON_FORM_SUBMIT');
2211
- if (events === null || events === void 0 ? void 0 : events.onKeyUp) props[events.onKeyUp] = () => handleEvent('ON_FIELD_KEYUP');
2212
- if (events === null || events === void 0 ? void 0 : events.onKeyDown) props[events.onKeyDown] = () => handleEvent('ON_FIELD_KEYDOWN');
2213
- return props;
2214
- }, []);
2215
- return (state === null || state === void 0 ? void 0 : state.visibility) ? jsxs(Fragment, {
2216
- children: [debugMode && jsxs("div", {
2217
- style: {
2218
- width: '100%',
2219
- display: 'flex',
2220
- flexDirection: 'column'
2221
- },
2222
- children: [jsxs("b", {
2223
- style: {
2224
- padding: '0px',
2225
- margin: '0px'
2226
- },
2227
- children: ["name:", name]
2228
- }), jsxs("b", {
2229
- style: {
2230
- padding: '0px',
2231
- margin: '0px'
2232
- },
2233
- children: ["order:", (_b = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.originalSchema) === null || _b === void 0 ? void 0 : _b.order]
2234
- }), jsxs("b", {
2235
- style: {
2236
- padding: '0px',
2237
- margin: '0px'
2238
- },
2239
- children: ["path:", fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.path]
2240
- }), jsx("br", {}), jsx("hr", {})]
2241
- }), jsx(FieldWrapperComponentRender, {
2242
- props: Object.assign(Object.assign(Object.assign(Object.assign({}, mapProps), state.props), state.errors), valueState),
2243
- fieldInstance: fieldInstance,
2244
- children: children ? children : ((_c = state === null || state === void 0 ? void 0 : state.props) === null || _c === void 0 ? void 0 : _c.children) ? state === null || state === void 0 ? void 0 : state.props.children : null
2245
- })]
2246
- }) : jsx(Fragment, {});
2361
+
2362
+ var isCallable = isCallable$g;
2363
+ var isObject$1 = isObject$a;
2364
+ var setPrototypeOf$1 = objectSetPrototypeOf;
2365
+
2366
+ // makes subclassing work correct for wrapped built-ins
2367
+ var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
2368
+ var NewTarget, NewTargetPrototype;
2369
+ if (
2370
+ // it can work only with native `setPrototypeOf`
2371
+ setPrototypeOf$1 &&
2372
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
2373
+ isCallable(NewTarget = dummy.constructor) &&
2374
+ NewTarget !== Wrapper &&
2375
+ isObject$1(NewTargetPrototype = NewTarget.prototype) &&
2376
+ NewTargetPrototype !== Wrapper.prototype
2377
+ ) setPrototypeOf$1($this, NewTargetPrototype);
2378
+ return $this;
2247
2379
  };
2248
2380
 
2249
- /**
2250
- * recursive function to transform form fields from a form instance into
2251
- * a react component tree
2252
- *
2253
- * @param {Map<string,IFormField>} param.fields form instance field Map
2254
- * @param {string} param.prevPath previous field path to track the tree branch creation
2255
- * @param {string} param.formIndex form index to aid field identification onto the FieldWrapper
2256
- * @returns {ReactNode}
2257
- */
2258
- const BuildTree = ({
2259
- fields,
2260
- prevPath,
2261
- formIndex
2262
- }) => {
2263
- return Array.from(fields).sort(([, field], [, field2]) => {
2264
- var _a, _b;
2265
- return (((_a = field.originalSchema) === null || _a === void 0 ? void 0 : _a.order) || 0) - (((_b = field2.originalSchema) === null || _b === void 0 ? void 0 : _b.order) || 0);
2266
- }).filter(([, value]) => {
2267
- return value.path === prevPath;
2268
- }).map(([, value]) => {
2269
- const fieldName = value.name;
2270
- const children = BuildTree({
2271
- fields,
2272
- prevPath: `${prevPath ? `${prevPath}.` : ``}${value.name}`,
2273
- formIndex
2274
- });
2275
- const lenght = Children.count(children);
2276
- return jsx(FieldWrapper, {
2277
- name: fieldName,
2278
- formIndex: formIndex,
2279
- children: lenght > 0 ? children : null
2280
- }, fieldName);
2381
+ var classof$2 = classof$4;
2382
+
2383
+ var $String = String;
2384
+
2385
+ var toString$2 = function (argument) {
2386
+ if (classof$2(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
2387
+ return $String(argument);
2388
+ };
2389
+
2390
+ var toString$1 = toString$2;
2391
+
2392
+ var normalizeStringArgument$1 = function (argument, $default) {
2393
+ return argument === undefined ? arguments.length < 2 ? '' : $default : toString$1(argument);
2394
+ };
2395
+
2396
+ var isObject = isObject$a;
2397
+ var createNonEnumerableProperty$2 = createNonEnumerableProperty$8;
2398
+
2399
+ // `InstallErrorCause` abstract operation
2400
+ // https://tc39.es/ecma262/#sec-installerrorcause
2401
+ var installErrorCause$1 = function (O, options) {
2402
+ if (isObject(options) && 'cause' in options) {
2403
+ createNonEnumerableProperty$2(O, 'cause', options.cause);
2404
+ }
2405
+ };
2406
+
2407
+ var uncurryThis$2 = functionUncurryThis;
2408
+
2409
+ var $Error = Error;
2410
+ var replace = uncurryThis$2(''.replace);
2411
+
2412
+ var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
2413
+ // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe
2414
+ var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
2415
+ var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
2416
+
2417
+ var errorStackClear = function (stack, dropEntries) {
2418
+ if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
2419
+ while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
2420
+ } return stack;
2421
+ };
2422
+
2423
+ var fails$6 = fails$j;
2424
+ var createPropertyDescriptor = createPropertyDescriptor$5;
2425
+
2426
+ var errorStackInstallable = !fails$6(function () {
2427
+ var error = new Error('a');
2428
+ if (!('stack' in error)) return true;
2429
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
2430
+ Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
2431
+ return error.stack !== 7;
2432
+ });
2433
+
2434
+ var createNonEnumerableProperty$1 = createNonEnumerableProperty$8;
2435
+ var clearErrorStack = errorStackClear;
2436
+ var ERROR_STACK_INSTALLABLE = errorStackInstallable;
2437
+
2438
+ // non-standard V8
2439
+ // eslint-disable-next-line es/no-nonstandard-error-properties -- safe
2440
+ var captureStackTrace = Error.captureStackTrace;
2441
+
2442
+ var errorStackInstall = function (error, C, stack, dropEntries) {
2443
+ if (ERROR_STACK_INSTALLABLE) {
2444
+ if (captureStackTrace) captureStackTrace(error, C);
2445
+ else createNonEnumerableProperty$1(error, 'stack', clearErrorStack(stack, dropEntries));
2446
+ }
2447
+ };
2448
+
2449
+ var getBuiltIn = getBuiltIn$4;
2450
+ var hasOwn$1 = hasOwnProperty_1;
2451
+ var createNonEnumerableProperty = createNonEnumerableProperty$8;
2452
+ var isPrototypeOf$1 = objectIsPrototypeOf;
2453
+ var setPrototypeOf = objectSetPrototypeOf;
2454
+ var copyConstructorProperties = copyConstructorProperties$2;
2455
+ var proxyAccessor = proxyAccessor$1;
2456
+ var inheritIfRequired = inheritIfRequired$1;
2457
+ var normalizeStringArgument = normalizeStringArgument$1;
2458
+ var installErrorCause = installErrorCause$1;
2459
+ var installErrorStack = errorStackInstall;
2460
+ var DESCRIPTORS$1 = descriptors;
2461
+
2462
+ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
2463
+ var STACK_TRACE_LIMIT = 'stackTraceLimit';
2464
+ var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
2465
+ var path = FULL_NAME.split('.');
2466
+ var ERROR_NAME = path[path.length - 1];
2467
+ var OriginalError = getBuiltIn.apply(null, path);
2468
+
2469
+ if (!OriginalError) return;
2470
+
2471
+ var OriginalErrorPrototype = OriginalError.prototype;
2472
+
2473
+ // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
2474
+ if (hasOwn$1(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;
2475
+
2476
+ if (!FORCED) return OriginalError;
2477
+
2478
+ var BaseError = getBuiltIn('Error');
2479
+
2480
+ var WrappedError = wrapper(function (a, b) {
2481
+ var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
2482
+ var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
2483
+ if (message !== undefined) createNonEnumerableProperty(result, 'message', message);
2484
+ installErrorStack(result, WrappedError, result.stack, 2);
2485
+ if (this && isPrototypeOf$1(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError);
2486
+ if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
2487
+ return result;
2281
2488
  });
2489
+
2490
+ WrappedError.prototype = OriginalErrorPrototype;
2491
+
2492
+ if (ERROR_NAME !== 'Error') {
2493
+ if (setPrototypeOf) setPrototypeOf(WrappedError, BaseError);
2494
+ else copyConstructorProperties(WrappedError, BaseError, { name: true });
2495
+ } else if (DESCRIPTORS$1 && STACK_TRACE_LIMIT in OriginalError) {
2496
+ proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT);
2497
+ proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace');
2498
+ }
2499
+
2500
+ copyConstructorProperties(WrappedError, OriginalError);
2501
+
2502
+ try {
2503
+ // Safari 13- bug: WebAssembly errors does not have a proper `.name`
2504
+ if (OriginalErrorPrototype.name !== ERROR_NAME) {
2505
+ createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME);
2506
+ }
2507
+ OriginalErrorPrototype.constructor = WrappedError;
2508
+ } catch (error) { /* empty */ }
2509
+
2510
+ return WrappedError;
2282
2511
  };
2283
- /**
2284
- * function to transform AsFormField elements onto a JSON schema
2285
- *
2286
- * @param param.children ReactNode children elements
2287
- * @returns {IComponentSchema[] | null | undefined}
2288
- */
2289
- const BuildAsFormFieldTree = ({
2290
- children
2291
- }) => {
2292
- return Children.map(children, (child, index) => {
2293
- var _a, _b, _c, _d, _e;
2294
- let struct;
2295
- if (!String((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.name).startsWith('AsFormField')) {
2296
- if (typeof child.type === 'function' || typeof child.type === 'object') {
2297
- const props = Object.assign({}, child.props);
2298
- delete props.children;
2299
- struct = {
2300
- component: ((_b = child === null || child === void 0 ? void 0 : child.type) === null || _b === void 0 ? void 0 : _b.name) || 'customForwardRef',
2301
- name: `adapter-${Math.floor(Math.random() * Date.now()).toString(16)}`,
2302
- mapper: {
2303
- component: child.type,
2304
- componentName: typeof child.type !== 'string' ? (_c = child === null || child === void 0 ? void 0 : child.type) === null || _c === void 0 ? void 0 : _c.name : child.type
2305
- },
2306
- props
2307
- };
2308
- } else if (typeof child.type === 'string' || typeof child === 'string') {
2309
- throw new Error(`Only function components works inside a Form as React Nodes,\n
2310
- if you want something like this to work: <div>hi</div>\n
2311
- wrap it onto a function component\n
2312
- const CustomTextNode = (props:{text:string}) => <div>props</div>\n
2313
- and use it like <CustomTextNode text="hi"/>`);
2314
- } else {
2315
- throw {
2316
- message: `Unknown error occured, please check the child that was tried to render below`,
2317
- component: child
2318
- };
2319
- }
2320
- } else {
2321
- if (((_d = child === null || child === void 0 ? void 0 : child.type) === null || _d === void 0 ? void 0 : _d.name) === 'AsFormField') {
2322
- struct = Object.assign({}, child.props);
2323
- } else {
2324
- if (!child.type.defaultProps.component) throw new Error(`set defaultProps component name\n
2325
- ex: AsFormFieldInput.defaultProps = {
2326
- component = 'input'
2327
- }`);
2328
- struct = Object.assign(Object.assign({}, child.props), child.type.defaultProps);
2512
+
2513
+ /* eslint-disable no-unused-vars -- required for functions `.length` */
2514
+ var $$5 = _export;
2515
+ var globalThis$3 = globalThis_1;
2516
+ var apply$1 = functionApply;
2517
+ var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
2518
+
2519
+ var WEB_ASSEMBLY = 'WebAssembly';
2520
+ var WebAssembly = globalThis$3[WEB_ASSEMBLY];
2521
+
2522
+ // eslint-disable-next-line es/no-error-cause -- feature detection
2523
+ var FORCED$3 = new Error('e', { cause: 7 }).cause !== 7;
2524
+
2525
+ var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
2526
+ var O = {};
2527
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$3);
2528
+ $$5({ global: true, constructor: true, arity: 1, forced: FORCED$3 }, O);
2529
+ };
2530
+
2531
+ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
2532
+ if (WebAssembly && WebAssembly[ERROR_NAME]) {
2533
+ var O = {};
2534
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$3);
2535
+ $$5({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$3 }, O);
2536
+ }
2537
+ };
2538
+
2539
+ // https://tc39.es/ecma262/#sec-nativeerror
2540
+ exportGlobalErrorCauseWrapper('Error', function (init) {
2541
+ return function Error(message) { return apply$1(init, this, arguments); };
2542
+ });
2543
+ exportGlobalErrorCauseWrapper('EvalError', function (init) {
2544
+ return function EvalError(message) { return apply$1(init, this, arguments); };
2545
+ });
2546
+ exportGlobalErrorCauseWrapper('RangeError', function (init) {
2547
+ return function RangeError(message) { return apply$1(init, this, arguments); };
2548
+ });
2549
+ exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
2550
+ return function ReferenceError(message) { return apply$1(init, this, arguments); };
2551
+ });
2552
+ exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
2553
+ return function SyntaxError(message) { return apply$1(init, this, arguments); };
2554
+ });
2555
+ exportGlobalErrorCauseWrapper('TypeError', function (init) {
2556
+ return function TypeError(message) { return apply$1(init, this, arguments); };
2557
+ });
2558
+ exportGlobalErrorCauseWrapper('URIError', function (init) {
2559
+ return function URIError(message) { return apply$1(init, this, arguments); };
2560
+ });
2561
+ exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
2562
+ return function CompileError(message) { return apply$1(init, this, arguments); };
2563
+ });
2564
+ exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
2565
+ return function LinkError(message) { return apply$1(init, this, arguments); };
2566
+ });
2567
+ exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
2568
+ return function RuntimeError(message) { return apply$1(init, this, arguments); };
2569
+ });
2570
+
2571
+ var tryToString = tryToString$4;
2572
+
2573
+ var $TypeError$4 = TypeError;
2574
+
2575
+ var deletePropertyOrThrow$1 = function (O, P) {
2576
+ if (!delete O[P]) throw new $TypeError$4('Cannot delete property ' + tryToString(P) + ' of ' + tryToString(O));
2577
+ };
2578
+
2579
+ var uncurryThis$1 = functionUncurryThis;
2580
+
2581
+ var arraySlice$1 = uncurryThis$1([].slice);
2582
+
2583
+ var arraySlice = arraySlice$1;
2584
+
2585
+ var floor = Math.floor;
2586
+
2587
+ var sort = function (array, comparefn) {
2588
+ var length = array.length;
2589
+
2590
+ if (length < 8) {
2591
+ // insertion sort
2592
+ var i = 1;
2593
+ var element, j;
2594
+
2595
+ while (i < length) {
2596
+ j = i;
2597
+ element = array[i];
2598
+ while (j && comparefn(array[j - 1], element) > 0) {
2599
+ array[j] = array[--j];
2329
2600
  }
2601
+ if (j !== i++) array[j] = element;
2330
2602
  }
2331
- if (struct && (struct === null || struct === void 0 ? void 0 : struct.children)) {
2332
- delete struct.children;
2603
+ } else {
2604
+ // merge sort
2605
+ var middle = floor(length / 2);
2606
+ var left = sort(arraySlice(array, 0, middle), comparefn);
2607
+ var right = sort(arraySlice(array, middle), comparefn);
2608
+ var llength = left.length;
2609
+ var rlength = right.length;
2610
+ var lindex = 0;
2611
+ var rindex = 0;
2612
+
2613
+ while (lindex < llength || rindex < rlength) {
2614
+ array[lindex + rindex] = (lindex < llength && rindex < rlength)
2615
+ ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
2616
+ : lindex < llength ? left[lindex++] : right[rindex++];
2333
2617
  }
2334
- struct.order = index;
2335
- const childElements = BuildAsFormFieldTree({
2336
- children: (_e = child.props) === null || _e === void 0 ? void 0 : _e.children
2337
- });
2338
- return Object.assign(Object.assign({}, struct), childElements && {
2339
- children: childElements
2340
- });
2618
+ }
2619
+
2620
+ return array;
2621
+ };
2622
+
2623
+ var arraySort = sort;
2624
+
2625
+ var fails$5 = fails$j;
2626
+
2627
+ var arrayMethodIsStrict$2 = function (METHOD_NAME, argument) {
2628
+ var method = [][METHOD_NAME];
2629
+ return !!method && fails$5(function () {
2630
+ // eslint-disable-next-line no-useless-call -- required for testing
2631
+ method.call(null, argument || function () { return 1; }, 1);
2341
2632
  });
2342
2633
  };
2343
2634
 
2344
- /******************************************************************************
2345
- Copyright (c) Microsoft Corporation.
2346
-
2347
- Permission to use, copy, modify, and/or distribute this software for any
2348
- purpose with or without fee is hereby granted.
2349
-
2350
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
2351
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
2352
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
2353
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
2354
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
2355
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
2356
- PERFORMANCE OF THIS SOFTWARE.
2357
- ***************************************************************************** */
2358
-
2359
- function __rest(s, e) {
2360
- var t = {};
2361
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
2362
- t[p] = s[p];
2363
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
2364
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
2365
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
2366
- t[p[i]] = s[p[i]];
2367
- }
2368
- return t;
2369
- }
2370
-
2371
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
2372
- var e = new Error(message);
2373
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
2635
+ var userAgent$2 = environmentUserAgent;
2636
+
2637
+ var firefox = userAgent$2.match(/firefox\/(\d+)/i);
2638
+
2639
+ var environmentFfVersion = !!firefox && +firefox[1];
2640
+
2641
+ var UA = environmentUserAgent;
2642
+
2643
+ var environmentIsIeOrEdge = /MSIE|Trident/.test(UA);
2644
+
2645
+ var userAgent$1 = environmentUserAgent;
2646
+
2647
+ var webkit = userAgent$1.match(/AppleWebKit\/(\d+)\./);
2648
+
2649
+ var environmentWebkitVersion = !!webkit && +webkit[1];
2650
+
2651
+ var $$4 = _export;
2652
+ var uncurryThis = functionUncurryThis;
2653
+ var aCallable$3 = aCallable$a;
2654
+ var toObject$2 = toObject$6;
2655
+ var lengthOfArrayLike$2 = lengthOfArrayLike$5;
2656
+ var deletePropertyOrThrow = deletePropertyOrThrow$1;
2657
+ var toString = toString$2;
2658
+ var fails$4 = fails$j;
2659
+ var internalSort = arraySort;
2660
+ var arrayMethodIsStrict$1 = arrayMethodIsStrict$2;
2661
+ var FF = environmentFfVersion;
2662
+ var IE_OR_EDGE = environmentIsIeOrEdge;
2663
+ var V8 = environmentV8Version;
2664
+ var WEBKIT = environmentWebkitVersion;
2665
+
2666
+ var test = [];
2667
+ var nativeSort = uncurryThis(test.sort);
2668
+ var push = uncurryThis(test.push);
2669
+
2670
+ // IE8-
2671
+ var FAILS_ON_UNDEFINED = fails$4(function () {
2672
+ test.sort(undefined);
2673
+ });
2674
+ // V8 bug
2675
+ var FAILS_ON_NULL = fails$4(function () {
2676
+ test.sort(null);
2677
+ });
2678
+ // Old WebKit
2679
+ var STRICT_METHOD = arrayMethodIsStrict$1('sort');
2680
+
2681
+ var STABLE_SORT = !fails$4(function () {
2682
+ // feature detection can be too slow, so check engines versions
2683
+ if (V8) return V8 < 70;
2684
+ if (FF && FF > 3) return;
2685
+ if (IE_OR_EDGE) return true;
2686
+ if (WEBKIT) return WEBKIT < 603;
2687
+
2688
+ var result = '';
2689
+ var code, chr, value, index;
2690
+
2691
+ // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
2692
+ for (code = 65; code < 76; code++) {
2693
+ chr = String.fromCharCode(code);
2694
+
2695
+ switch (code) {
2696
+ case 66: case 69: case 70: case 72: value = 3; break;
2697
+ case 68: case 71: value = 4; break;
2698
+ default: value = 2;
2699
+ }
2700
+
2701
+ for (index = 0; index < 47; index++) {
2702
+ test.push({ k: chr + index, v: value });
2703
+ }
2704
+ }
2705
+
2706
+ test.sort(function (a, b) { return b.v - a.v; });
2707
+
2708
+ for (index = 0; index < test.length; index++) {
2709
+ chr = test[index].k.charAt(0);
2710
+ if (result.charAt(result.length - 1) !== chr) result += chr;
2711
+ }
2712
+
2713
+ return result !== 'DGBEFHACIJK';
2714
+ });
2715
+
2716
+ var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
2717
+
2718
+ var getSortCompare = function (comparefn) {
2719
+ return function (x, y) {
2720
+ if (y === undefined) return -1;
2721
+ if (x === undefined) return 1;
2722
+ if (comparefn !== undefined) return +comparefn(x, y) || 0;
2723
+ return toString(x) > toString(y) ? 1 : -1;
2724
+ };
2725
+ };
2726
+
2727
+ // `Array.prototype.sort` method
2728
+ // https://tc39.es/ecma262/#sec-array.prototype.sort
2729
+ $$4({ target: 'Array', proto: true, forced: FORCED$2 }, {
2730
+ sort: function sort(comparefn) {
2731
+ if (comparefn !== undefined) aCallable$3(comparefn);
2732
+
2733
+ var array = toObject$2(this);
2734
+
2735
+ if (STABLE_SORT) return comparefn === undefined ? nativeSort(array) : nativeSort(array, comparefn);
2736
+
2737
+ var items = [];
2738
+ var arrayLength = lengthOfArrayLike$2(array);
2739
+ var itemsLength, index;
2740
+
2741
+ for (index = 0; index < arrayLength; index++) {
2742
+ if (index in array) push(items, array[index]);
2743
+ }
2744
+
2745
+ internalSort(items, getSortCompare(comparefn));
2746
+
2747
+ itemsLength = lengthOfArrayLike$2(items);
2748
+ index = 0;
2749
+
2750
+ while (index < itemsLength) array[index] = items[index++];
2751
+ while (index < arrayLength) deletePropertyOrThrow(array, index++);
2752
+
2753
+ return array;
2754
+ }
2755
+ });
2756
+
2757
+ var globalThis$2 = globalThis_1;
2758
+ var fails$3 = fails$j;
2759
+
2760
+ // babel-minify and Closure Compiler transpiles RegExp('.', 'd') -> /./d and it causes SyntaxError
2761
+ var RegExp$1 = globalThis$2.RegExp;
2762
+
2763
+ var FLAGS_GETTER_IS_CORRECT = !fails$3(function () {
2764
+ var INDICES_SUPPORT = true;
2765
+ try {
2766
+ RegExp$1('.', 'd');
2767
+ } catch (error) {
2768
+ INDICES_SUPPORT = false;
2769
+ }
2770
+
2771
+ var O = {};
2772
+ // modern V8 bug
2773
+ var calls = '';
2774
+ var expected = INDICES_SUPPORT ? 'dgimsy' : 'gimsy';
2775
+
2776
+ var addGetter = function (key, chr) {
2777
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
2778
+ Object.defineProperty(O, key, { get: function () {
2779
+ calls += chr;
2780
+ return true;
2781
+ } });
2782
+ };
2783
+
2784
+ var pairs = {
2785
+ dotAll: 's',
2786
+ global: 'g',
2787
+ ignoreCase: 'i',
2788
+ multiline: 'm',
2789
+ sticky: 'y'
2790
+ };
2791
+
2792
+ if (INDICES_SUPPORT) pairs.hasIndices = 'd';
2793
+
2794
+ for (var key in pairs) addGetter(key, pairs[key]);
2795
+
2796
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2797
+ var result = Object.getOwnPropertyDescriptor(RegExp$1.prototype, 'flags').get.call(O);
2798
+
2799
+ return result !== expected || calls !== expected;
2800
+ });
2801
+
2802
+ var regexpFlagsDetection = { correct: FLAGS_GETTER_IS_CORRECT };
2803
+
2804
+ var anObject$3 = anObject$f;
2805
+
2806
+ // `RegExp.prototype.flags` getter implementation
2807
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
2808
+ var regexpFlags = function () {
2809
+ var that = anObject$3(this);
2810
+ var result = '';
2811
+ if (that.hasIndices) result += 'd';
2812
+ if (that.global) result += 'g';
2813
+ if (that.ignoreCase) result += 'i';
2814
+ if (that.multiline) result += 'm';
2815
+ if (that.dotAll) result += 's';
2816
+ if (that.unicode) result += 'u';
2817
+ if (that.unicodeSets) result += 'v';
2818
+ if (that.sticky) result += 'y';
2819
+ return result;
2820
+ };
2821
+
2822
+ var call$1 = functionCall;
2823
+ var hasOwn = hasOwnProperty_1;
2824
+ var isPrototypeOf = objectIsPrototypeOf;
2825
+ var regExpFlagsDetection = regexpFlagsDetection;
2826
+ var regExpFlagsGetterImplementation = regexpFlags;
2827
+
2828
+ var RegExpPrototype$1 = RegExp.prototype;
2829
+
2830
+ var regexpGetFlags = regExpFlagsDetection.correct ? function (it) {
2831
+ return it.flags;
2832
+ } : function (it) {
2833
+ return (!regExpFlagsDetection.correct && isPrototypeOf(RegExpPrototype$1, it) && !hasOwn(it, 'flags'))
2834
+ ? call$1(regExpFlagsGetterImplementation, it)
2835
+ : it.flags;
2374
2836
  };
2375
2837
 
2838
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
2839
+ var defineBuiltIn = defineBuiltIn$5;
2840
+ var anObject$2 = anObject$f;
2841
+ var $toString = toString$2;
2842
+ var fails$2 = fails$j;
2843
+ var getRegExpFlags = regexpGetFlags;
2844
+
2845
+ var TO_STRING = 'toString';
2846
+ var RegExpPrototype = RegExp.prototype;
2847
+ var nativeToString = RegExpPrototype[TO_STRING];
2848
+
2849
+ var NOT_GENERIC = fails$2(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
2850
+ // FF44- RegExp#toString has a wrong name
2851
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
2852
+
2853
+ // `RegExp.prototype.toString` method
2854
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2855
+ if (NOT_GENERIC || INCORRECT_NAME) {
2856
+ defineBuiltIn(RegExpPrototype, TO_STRING, function toString() {
2857
+ var R = anObject$2(this);
2858
+ var pattern = $toString(R.source);
2859
+ var flags = $toString(getRegExpFlags(R));
2860
+ return '/' + pattern + '/' + flags;
2861
+ }, { unsafe: true });
2862
+ }
2863
+
2376
2864
  /**
2377
2865
  * events mapping to aid function callback binding
2378
2866
  */
@@ -2383,8 +2871,20 @@ const eventsMapping = {
2383
2871
  ON_FIELD_KEYDOWN: 'onKeyDown',
2384
2872
  ON_FIELD_KEYUP: 'onKeyUp',
2385
2873
  ON_FIELD_MOUNT: 'onMount',
2874
+ ON_API_FIELD_REQUEST: 'onApiRequest',
2386
2875
  ON_API_FIELD_RESPONSE: 'onApiResponse',
2387
- ON_FIELD_CLICK: 'onClick'
2876
+ ON_FIELD_CLICK: 'onClick',
2877
+ ON_FIELD_CLEARED: 'onCleared',
2878
+ ON_FIELD_UNMOUNT: 'onUnmount'
2879
+ };
2880
+ const uniqueIdGen = () => {
2881
+ const timestamp = +new Date();
2882
+ const rand = Math.random() * 1e5;
2883
+ const finalNumb = timestamp * rand;
2884
+ const string = (Math.random() + 1).toString(36).substring(7);
2885
+ const mixedID = finalNumb + string + '-';
2886
+ const shuffle = str => [...str].sort(() => Math.random() - 0.5).join('');
2887
+ return shuffle(mixedID);
2388
2888
  };
2389
2889
 
2390
2890
  /**
@@ -2393,15 +2893,56 @@ const eventsMapping = {
2393
2893
  function useForm(_a, deps) {
2394
2894
  var {
2395
2895
  id,
2896
+ index,
2396
2897
  onData,
2397
2898
  onSubmit,
2398
2899
  onFormMount,
2399
- onValid
2900
+ onValid,
2901
+ iVars,
2902
+ initialValues,
2903
+ stopEventsOnSubmit
2400
2904
  } = _a,
2401
- rest = __rest(_a, ["id", "onData", "onSubmit", "onFormMount", "onValid"]);
2905
+ rest = __rest(_a, ["id", "index", "onData", "onSubmit", "onFormMount", "onValid", "iVars", "initialValues", "stopEventsOnSubmit"]);
2402
2906
  const {
2403
2907
  formGroupInstance
2404
2908
  } = useFormGroupContext({});
2909
+ const useFormIndex = index || id;
2910
+ if (!useFormIndex) {
2911
+ throw new Error('useForm hook must have an id or an index');
2912
+ }
2913
+ useEffect(() => {
2914
+ if (!formGroupInstance.forms.has(useFormIndex)) {
2915
+ console.log('failed to set stopEventsOnSubmit due to no form instance');
2916
+ return;
2917
+ }
2918
+ if (typeof stopEventsOnSubmit === 'boolean') {
2919
+ formGroupInstance.getForm({
2920
+ key: useFormIndex
2921
+ }).stopEventsOnSubmit = stopEventsOnSubmit;
2922
+ }
2923
+ }, []);
2924
+ /**
2925
+ * iVars change tracker to update iVars onto form instance
2926
+ */
2927
+ useEffect(() => {
2928
+ if (!formGroupInstance.forms.has(useFormIndex)) {
2929
+ console.log('failed to add iVars due to no form instance');
2930
+ return;
2931
+ }
2932
+ if (iVars) formGroupInstance.forms.get(useFormIndex).iVars = iVars;
2933
+ // if (iVars) formInstance.current.iVars = iVars;
2934
+ }, [iVars]);
2935
+ /**
2936
+ * initialValues setter for async initialValues
2937
+ */
2938
+ useEffect(() => {
2939
+ if (!formGroupInstance.forms.has(useFormIndex)) {
2940
+ console.log('failed to add initialValues due to no form instance');
2941
+ return;
2942
+ }
2943
+ if (initialValues) formGroupInstance.forms.get(useFormIndex).initialValues = initialValues;
2944
+ // if (initialValues) formInstance.current.initialValues = initialValues;
2945
+ }, [initialValues]);
2405
2946
  /**
2406
2947
  * reference to store all updated callback functions rerendered by props change
2407
2948
  */
@@ -2438,7 +2979,7 @@ function useForm(_a, deps) {
2438
2979
  }
2439
2980
  };
2440
2981
  const sub = (_a = formGroupInstance.getForm({
2441
- key: id
2982
+ key: useFormIndex
2442
2983
  })) === null || _a === void 0 ? void 0 : _a.subscribeFieldEvent({
2443
2984
  callback
2444
2985
  });
@@ -2449,7 +2990,7 @@ function useForm(_a, deps) {
2449
2990
  }
2450
2991
  };
2451
2992
  const mountSub = (_b = formGroupInstance.getForm({
2452
- key: id
2993
+ key: useFormIndex
2453
2994
  })) === null || _b === void 0 ? void 0 : _b.subscribeOnMount(mountCallback);
2454
2995
  const dataCallback = payload => {
2455
2996
  var _a, _b;
@@ -2458,7 +2999,7 @@ function useForm(_a, deps) {
2458
2999
  }
2459
3000
  };
2460
3001
  const dataSub = (_c = formGroupInstance.getForm({
2461
- key: id
3002
+ key: useFormIndex
2462
3003
  })) === null || _c === void 0 ? void 0 : _c.subscribeData(dataCallback);
2463
3004
  const validationCallback = payload => {
2464
3005
  if (formValuesCallbackRefs.current.onValid) {
@@ -2466,7 +3007,7 @@ function useForm(_a, deps) {
2466
3007
  }
2467
3008
  };
2468
3009
  const validSub = (_d = formGroupInstance.getForm({
2469
- key: id
3010
+ key: useFormIndex
2470
3011
  })) === null || _d === void 0 ? void 0 : _d.subscribeFormValidation(validationCallback);
2471
3012
  const submitCallback = payload => {
2472
3013
  var _a, _b;
@@ -2475,7 +3016,7 @@ function useForm(_a, deps) {
2475
3016
  }
2476
3017
  };
2477
3018
  const submitSub = (_e = formGroupInstance.getForm({
2478
- key: id
3019
+ key: useFormIndex
2479
3020
  })) === null || _e === void 0 ? void 0 : _e.subscribeOnSubmit(submitCallback);
2480
3021
  return () => {
2481
3022
  sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
@@ -2513,100 +3054,48 @@ function Form({
2513
3054
  onKeyUp,
2514
3055
  onMount,
2515
3056
  onValid,
3057
+ stopEventsOnSubmit,
2516
3058
  children
2517
3059
  }) {
2518
3060
  const {
2519
- addForm,
2520
- removeForm,
2521
3061
  getForm,
2522
3062
  mappers,
2523
3063
  debugMode,
2524
3064
  formGroupInstance
2525
3065
  } = useFormGroupContext({});
2526
- const [tree, setTree] = useState();
2527
- const schemaIndex = useMemo(() => index || (schema === null || schema === void 0 ? void 0 : schema.index) || 'defaultChange', [index, schema]);
3066
+ const schemaIndex = useRef(index || (schema === null || schema === void 0 ? void 0 : schema.index) || 'defaultChange').current;
3067
+ const [mounted, setMounted] = useState(false);
3068
+ const mountedRef = useRef(false);
2528
3069
  /**
2529
- * logic to initialize the form instance and it's removal
3070
+ * effect to create the form instance and notify the recursive generated fields of it's mounted status
2530
3071
  */
2531
3072
  useEffect(() => {
2532
- if (schemaIndex === 'defaultChange') {
2533
- console.warn('please, add an unique id to the form, otherwise multiple forms will break');
2534
- }
2535
- const formInstance = new FormCore({
2536
- schema,
2537
- initialValues: initialValues || (schema === null || schema === void 0 ? void 0 : schema.initialValues),
2538
- iVars: iVars || (schema === null || schema === void 0 ? void 0 : schema.iVars),
2539
- action: action || (schema === null || schema === void 0 ? void 0 : schema.action),
2540
- method: method || (schema === null || schema === void 0 ? void 0 : schema.method),
2541
- index: schemaIndex,
2542
- mappers,
2543
- config: config || formGroupInstance.config
2544
- });
2545
- addForm({
3073
+ if (mountedRef.current || formGroupInstance.getForm({
3074
+ key: schemaIndex
3075
+ })) return;
3076
+ formGroupInstance.addForm({
2546
3077
  key: schemaIndex,
2547
- formInstance
3078
+ params: {
3079
+ schema,
3080
+ action: action || (schema === null || schema === void 0 ? void 0 : schema.action),
3081
+ method: method || (schema === null || schema === void 0 ? void 0 : schema.method),
3082
+ index: schemaIndex,
3083
+ mappers,
3084
+ config: config || formGroupInstance.config
3085
+ }
2548
3086
  });
2549
- let subMounted;
2550
- if (onFormMount) {
2551
- subMounted = formInstance.subscribeOnMount(onFormMount);
2552
- }
2553
- formInstance === null || formInstance === void 0 ? void 0 : formInstance.mounted();
2554
- /*
2555
- @TODO check if form instance is killed each time it is unmounted
2556
- the management of multiple forms needs to be planned
2557
- */
2558
- return () => {
2559
- subMounted === null || subMounted === void 0 ? void 0 : subMounted.unsubscribe();
2560
- removeForm({
2561
- key: schemaIndex
2562
- });
2563
- };
3087
+ setMounted(true);
3088
+ mountedRef.current = true;
3089
+ // }
2564
3090
  }, []);
2565
- /**
2566
- * logic to transform AsFormFields onto JSON schema
2567
- * and JSON schema onto FieldWrappers, refreshes when
2568
- * the react tree changes it's children
2569
- */
2570
- useEffect(() => {
2571
- var _a;
2572
- const schema = BuildAsFormFieldTree({
2573
- children
2574
- });
2575
- schema && getForm({
2576
- key: index
2577
- }).refreshFields(schema);
2578
- const fields = (_a = getForm({
2579
- key: index
2580
- })) === null || _a === void 0 ? void 0 : _a.fields;
2581
- if (fields) {
2582
- const buildTree = BuildTree({
2583
- fields,
2584
- formIndex: index
2585
- });
2586
- setTree(buildTree);
2587
- }
2588
- }, [children]);
2589
- /**
2590
- * iVars change tracker to update iVars onto form instance
2591
- */
2592
- useEffect(() => {
2593
- if (iVars) getForm({
2594
- key: schemaIndex
2595
- }).iVars = iVars;
2596
- }, [iVars]);
2597
- /**
2598
- * initialValues setter for async initialValues
2599
- */
2600
- useEffect(() => {
2601
- if (initialValues) getForm({
2602
- key: schemaIndex
2603
- }).setInitialValues(initialValues);
2604
- }, [initialValues]);
2605
3091
  /**
2606
3092
  * hook usage to keep event bindings updated on callback functions passed as props
2607
3093
  */
2608
3094
  useForm({
2609
- id: schemaIndex,
3095
+ index: schemaIndex,
3096
+ initialValues,
3097
+ iVars,
3098
+ stopEventsOnSubmit,
2610
3099
  onApiResponse,
2611
3100
  onBlur,
2612
3101
  onChange,
@@ -2641,229 +3130,223 @@ function Form({
2641
3130
  padding: '0px',
2642
3131
  margin: '0px'
2643
3132
  },
2644
- children: `form index: ${schemaIndex}`
2645
- }), jsx("button", {
2646
- onClick: () => console.log(getForm({
2647
- key: schemaIndex
2648
- })),
2649
- children: "print form instance"
2650
- }), jsx("button", {
2651
- onClick: () => {
2652
- var _a;
2653
- return console.log((_a = getForm({
2654
- key: schemaIndex
2655
- })) === null || _a === void 0 ? void 0 : _a.getFormValues());
2656
- },
2657
- children: "print form values"
2658
- }), jsx("button", {
2659
- onClick: () => {
2660
- var _a;
2661
- return (_a = getForm({
2662
- key: schemaIndex
2663
- })) === null || _a === void 0 ? void 0 : _a.submit();
2664
- },
2665
- children: "try submit"
3133
+ children: `form index: ${schemaIndex}`
3134
+ }), jsx("button", {
3135
+ onClick: () => console.log(getForm({
3136
+ key: schemaIndex
3137
+ })),
3138
+ children: "print form instance"
3139
+ }), jsx("button", {
3140
+ onClick: () => {
3141
+ var _a;
3142
+ return console.log((_a = getForm({
3143
+ key: schemaIndex
3144
+ })) === null || _a === void 0 ? void 0 : _a.getFormValues());
3145
+ },
3146
+ children: "print form values"
3147
+ }), jsx("button", {
3148
+ onClick: () => {
3149
+ var _a;
3150
+ return (_a = getForm({
3151
+ key: schemaIndex
3152
+ })) === null || _a === void 0 ? void 0 : _a.submit();
3153
+ },
3154
+ children: "try submit"
3155
+ }), jsx("br", {}), jsx("hr", {})]
3156
+ }), jsxs("form", {
3157
+ onSubmit: handleSubmit,
3158
+ children: [jsx(BuildSchemaAsFields, {
3159
+ formIndex: schemaIndex,
3160
+ mappers: mappers,
3161
+ components: schema === null || schema === void 0 ? void 0 : schema.components,
3162
+ mountedForm: mounted
3163
+ }), children]
3164
+ })]
3165
+ });
3166
+ }
3167
+
3168
+ /**
3169
+ * Component wrapper to aid building schemas with react without writting a JSON schema
3170
+ * along with BuildAsFormFieldTree inside a Form component, FieldWrapper gets this props
3171
+ * to build the component as it does with a JSON schema, this component only works inside
3172
+ * the Form component
3173
+ *
3174
+ * @param {TAsFormFieldProps} props JSON schema props
3175
+ * @returns {ReactNode}
3176
+ */
3177
+ const AsFormField = props => {
3178
+ return props.children;
3179
+ };
3180
+
3181
+ /**
3182
+ * Renders the React element defined on the mappers configuration
3183
+ *
3184
+ * @param param component props, field instance and children to render
3185
+ * @returns
3186
+ */
3187
+ const FieldWrapperComponentRender = ({
3188
+ props,
3189
+ fieldInstance,
3190
+ children,
3191
+ mapper
3192
+ }) => {
3193
+ var _a, _b, _c;
3194
+ const Component = (mapper === null || mapper === void 0 ? void 0 : mapper.component) || ((_a = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _a === void 0 ? void 0 : _a.component);
3195
+ const Asynccomponent = (mapper === null || mapper === void 0 ? void 0 : mapper.asynccomponent) || ((_b = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _b === void 0 ? void 0 : _b.asynccomponent);
3196
+ if (Component) return jsx(Component, Object.assign({}, props, {
3197
+ children: children && children
3198
+ }));
3199
+ if (Asynccomponent) return jsx(Suspense, {
3200
+ children: jsx(Asynccomponent, Object.assign({}, props, {
3201
+ children: children && children
3202
+ }))
3203
+ });
3204
+ return jsx("div", {
3205
+ children: `failed to render field ${fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.name} with componentName:${(_c = fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mapper) === null || _c === void 0 ? void 0 : _c.componentName}, please check mappers`
3206
+ });
3207
+ };
3208
+ /**
3209
+ * Base field Wrapper to render the component with the necessary configurations from the schema
3210
+ * and mapper configuration
3211
+ *
3212
+ * @param {TFieldWrapperProps} param FieldWrapper params
3213
+ * @returns {ReactElement}
3214
+ */
3215
+ const FieldWrapper = ({
3216
+ name,
3217
+ formIndex,
3218
+ children,
3219
+ props,
3220
+ context,
3221
+ mounted,
3222
+ mapper,
3223
+ visibility,
3224
+ component
3225
+ }) => {
3226
+ var _a, _b, _c;
3227
+ const localContext = useFormGroupContext({});
3228
+ const fieldMapper = mapper || ((_a = localContext.mappers) === null || _a === void 0 ? void 0 : _a.find(mapper => mapper.componentName === component));
3229
+ /**
3230
+ * picks the right context prioritizing the context passed as prop
3231
+ */
3232
+ const {
3233
+ formGroupInstance,
3234
+ debugMode
3235
+ } = useMemo(() => context ? context : localContext, [context, localContext]);
3236
+ const fieldInstance = useMemo(() => {
3237
+ var _a;
3238
+ return (_a = formGroupInstance.getForm({
3239
+ key: formIndex
3240
+ })) === null || _a === void 0 ? void 0 : _a.getField({
3241
+ key: name
3242
+ });
3243
+ }, [mounted]);
3244
+ /**
3245
+ * props with templates stripped until the field ins't ready on the instance
3246
+ */
3247
+ const filteredProps = useMemo(() => {
3248
+ let returnProps = {};
3249
+ if (props) {
3250
+ returnProps = FormField.filterProps(props);
3251
+ }
3252
+ if (fieldInstance) fieldInstance.props = returnProps;
3253
+ return returnProps;
3254
+ }, [props]);
3255
+ const [valueState, setValueState] = useState((fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.stateValue) || {
3256
+ [((_b = fieldMapper === null || fieldMapper === void 0 ? void 0 : fieldMapper.events) === null || _b === void 0 ? void 0 : _b.setValue) || 'value']: ''
3257
+ });
3258
+ const [state, setState] = useState({
3259
+ visibility: typeof visibility === 'boolean' ? visibility : true,
3260
+ props: filteredProps
3261
+ });
3262
+ /**
3263
+ * handles the mounting and unmounting logic onto the field instance
3264
+ */
3265
+ useEffect(() => {
3266
+ if (!fieldInstance || (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted)) return;
3267
+ fieldInstance.mountField({
3268
+ valueSubscription: value => {
3269
+ setValueState(value);
3270
+ },
3271
+ propsSubscription: ({
3272
+ visibility,
3273
+ props,
3274
+ errors
3275
+ }) => {
3276
+ setState(prev => Object.assign(Object.assign({}, prev), {
3277
+ visibility,
3278
+ props,
3279
+ errors
3280
+ }));
3281
+ }
3282
+ });
3283
+ }, [fieldInstance]);
3284
+ /**
3285
+ * recycle effect to remove the field Subscriptions due to memory leaks
3286
+ */
3287
+ useEffect(() => {
3288
+ return () => {
3289
+ (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.mounted) && (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.destroyField());
3290
+ };
3291
+ }, []);
3292
+ /**
3293
+ * handles the value change onto the field instance
3294
+ */
3295
+ const handleChange = useCallback(event => {
3296
+ if (!mounted) return;
3297
+ fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitValue({
3298
+ value: event,
3299
+ event: 'ON_FIELD_CHANGE'
3300
+ });
3301
+ }, [mounted]);
3302
+ /**
3303
+ * handles the event emission onto the field instance
3304
+ */
3305
+ const handleEvent = useCallback(event => {
3306
+ if (!mounted) return;
3307
+ fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.emitEvents({
3308
+ event
3309
+ });
3310
+ }, [mounted]);
3311
+ /**
3312
+ * handles the mappers configuration to bind the event submission callback
3313
+ * to the corresponding prop defined on the mappers
3314
+ */
3315
+ const mapProps = useMemo(() => {
3316
+ const events = fieldMapper === null || fieldMapper === void 0 ? void 0 : fieldMapper.events;
3317
+ const props = {};
3318
+ if (events === null || events === void 0 ? void 0 : events.onBlur) props[events.onBlur] = () => handleEvent('ON_FIELD_BLUR');
3319
+ if (events === null || events === void 0 ? void 0 : events.getValue) props[events.getValue] = handleChange;
3320
+ if (events === null || events === void 0 ? void 0 : events.onFocus) props[events.onFocus] = () => handleEvent('ON_FIELD_FOCUS');
3321
+ if (events === null || events === void 0 ? void 0 : events.onClick) props[events.onClick] = () => handleEvent('ON_FIELD_CLICK');
3322
+ if (events === null || events === void 0 ? void 0 : events.onSubmit) props[events.onSubmit] = () => handleEvent('ON_FORM_SUBMIT');
3323
+ if (events === null || events === void 0 ? void 0 : events.onKeyUp) props[events.onKeyUp] = () => handleEvent('ON_FIELD_KEYUP');
3324
+ if (events === null || events === void 0 ? void 0 : events.onKeyDown) props[events.onKeyDown] = () => handleEvent('ON_FIELD_KEYDOWN');
3325
+ return props;
3326
+ }, [mounted]);
3327
+ return state.visibility ? jsxs(Fragment, {
3328
+ children: [debugMode && jsxs("div", {
3329
+ style: {
3330
+ width: '100%',
3331
+ display: 'flex',
3332
+ flexDirection: 'column'
3333
+ },
3334
+ children: [jsxs("b", {
3335
+ style: {
3336
+ padding: '0px',
3337
+ margin: '0px'
3338
+ },
3339
+ children: ["name:", name]
2666
3340
  }), jsx("br", {}), jsx("hr", {})]
2667
- }), jsx("form", {
2668
- onSubmit: handleSubmit,
2669
- children: tree && tree
3341
+ }), jsx(FieldWrapperComponentRender, {
3342
+ props: Object.assign(Object.assign(Object.assign(Object.assign({}, mapProps), state.props), state.errors), valueState),
3343
+ fieldInstance: fieldInstance,
3344
+ mapper: fieldMapper,
3345
+ children: children ? children : ((_c = state === null || state === void 0 ? void 0 : state.props) === null || _c === void 0 ? void 0 : _c.children) ? state === null || state === void 0 ? void 0 : state.props.children : null
2670
3346
  })]
2671
- });
2672
- }
2673
-
2674
- /**
2675
- * Component wrapper to aid building schemas with react without writting a JSON schema
2676
- * along with BuildAsFormFieldTree inside a Form component, FieldWrapper gets this props
2677
- * to build the component as it does with a JSON schema, this component only works inside
2678
- * the Form component
2679
- *
2680
- * @param {TAsFormFieldProps} props JSON schema props
2681
- * @returns {ReactNode}
2682
- */
2683
- const AsFormField = props => {
2684
- return props.children;
2685
- };
2686
-
2687
- var fails$2 = fails$h;
2688
- var global$3 = global$e;
2689
-
2690
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
2691
- var $RegExp$2 = global$3.RegExp;
2692
-
2693
- var UNSUPPORTED_Y$1 = fails$2(function () {
2694
- var re = $RegExp$2('a', 'y');
2695
- re.lastIndex = 2;
2696
- return re.exec('abcd') !== null;
2697
- });
2698
-
2699
- // UC Browser bug
2700
- // https://github.com/zloirock/core-js/issues/1008
2701
- var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$2(function () {
2702
- return !$RegExp$2('a', 'y').sticky;
2703
- });
2704
-
2705
- var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$2(function () {
2706
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
2707
- var re = $RegExp$2('^r', 'gy');
2708
- re.lastIndex = 2;
2709
- return re.exec('str') !== null;
2710
- });
2711
-
2712
- var regexpStickyHelpers = {
2713
- BROKEN_CARET: BROKEN_CARET,
2714
- MISSED_STICKY: MISSED_STICKY,
2715
- UNSUPPORTED_Y: UNSUPPORTED_Y$1
3347
+ }) : jsx(Fragment, {});
2716
3348
  };
2717
3349
 
2718
- var fails$1 = fails$h;
2719
- var global$2 = global$e;
2720
-
2721
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
2722
- var $RegExp$1 = global$2.RegExp;
2723
-
2724
- var regexpUnsupportedDotAll = fails$1(function () {
2725
- var re = $RegExp$1('.', 's');
2726
- return !(re.dotAll && re.test('\n') && re.flags === 's');
2727
- });
2728
-
2729
- var fails = fails$h;
2730
- var global$1 = global$e;
2731
-
2732
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
2733
- var $RegExp = global$1.RegExp;
2734
-
2735
- var regexpUnsupportedNcg = fails(function () {
2736
- var re = $RegExp('(?<a>b)', 'g');
2737
- return re.exec('b').groups.a !== 'b' ||
2738
- 'b'.replace(re, '$<a>c') !== 'bc';
2739
- });
2740
-
2741
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
2742
- /* eslint-disable regexp/no-useless-quantifier -- testing */
2743
- var call = functionCall;
2744
- var uncurryThis = functionUncurryThis;
2745
- var toString = toString$3;
2746
- var regexpFlags = regexpFlags$1;
2747
- var stickyHelpers = regexpStickyHelpers;
2748
- var shared = shared$4;
2749
- var create = objectCreate;
2750
- var getInternalState = internalState.get;
2751
- var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
2752
- var UNSUPPORTED_NCG = regexpUnsupportedNcg;
2753
-
2754
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
2755
- var nativeExec = RegExp.prototype.exec;
2756
- var patchedExec = nativeExec;
2757
- var charAt = uncurryThis(''.charAt);
2758
- var indexOf = uncurryThis(''.indexOf);
2759
- var replace = uncurryThis(''.replace);
2760
- var stringSlice = uncurryThis(''.slice);
2761
-
2762
- var UPDATES_LAST_INDEX_WRONG = (function () {
2763
- var re1 = /a/;
2764
- var re2 = /b*/g;
2765
- call(nativeExec, re1, 'a');
2766
- call(nativeExec, re2, 'a');
2767
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
2768
- })();
2769
-
2770
- var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET;
2771
-
2772
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
2773
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
2774
-
2775
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
2776
-
2777
- if (PATCH) {
2778
- patchedExec = function exec(string) {
2779
- var re = this;
2780
- var state = getInternalState(re);
2781
- var str = toString(string);
2782
- var raw = state.raw;
2783
- var result, reCopy, lastIndex, match, i, object, group;
2784
-
2785
- if (raw) {
2786
- raw.lastIndex = re.lastIndex;
2787
- result = call(patchedExec, raw, str);
2788
- re.lastIndex = raw.lastIndex;
2789
- return result;
2790
- }
2791
-
2792
- var groups = state.groups;
2793
- var sticky = UNSUPPORTED_Y && re.sticky;
2794
- var flags = call(regexpFlags, re);
2795
- var source = re.source;
2796
- var charsAdded = 0;
2797
- var strCopy = str;
2798
-
2799
- if (sticky) {
2800
- flags = replace(flags, 'y', '');
2801
- if (indexOf(flags, 'g') === -1) {
2802
- flags += 'g';
2803
- }
2804
-
2805
- strCopy = stringSlice(str, re.lastIndex);
2806
- // Support anchored sticky behavior.
2807
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) {
2808
- source = '(?: ' + source + ')';
2809
- strCopy = ' ' + strCopy;
2810
- charsAdded++;
2811
- }
2812
- // ^(? + rx + ) is needed, in combination with some str slicing, to
2813
- // simulate the 'y' flag.
2814
- reCopy = new RegExp('^(?:' + source + ')', flags);
2815
- }
2816
-
2817
- if (NPCG_INCLUDED) {
2818
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
2819
- }
2820
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
2821
-
2822
- match = call(nativeExec, sticky ? reCopy : re, strCopy);
2823
-
2824
- if (sticky) {
2825
- if (match) {
2826
- match.input = stringSlice(match.input, charsAdded);
2827
- match[0] = stringSlice(match[0], charsAdded);
2828
- match.index = re.lastIndex;
2829
- re.lastIndex += match[0].length;
2830
- } else re.lastIndex = 0;
2831
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
2832
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
2833
- }
2834
- if (NPCG_INCLUDED && match && match.length > 1) {
2835
- // Fix browsers whose `exec` methods don't consistently return `undefined`
2836
- // for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
2837
- call(nativeReplace, match[0], reCopy, function () {
2838
- for (i = 1; i < arguments.length - 2; i++) {
2839
- if (arguments[i] === undefined) match[i] = undefined;
2840
- }
2841
- });
2842
- }
2843
-
2844
- if (match && groups) {
2845
- match.groups = object = create(null);
2846
- for (i = 0; i < groups.length; i++) {
2847
- group = groups[i];
2848
- object[group[0]] = match[group[1]];
2849
- }
2850
- }
2851
-
2852
- return match;
2853
- };
2854
- }
2855
-
2856
- var regexpExec = patchedExec;
2857
-
2858
- var $ = _export;
2859
- var exec = regexpExec;
2860
-
2861
- // `RegExp.prototype.exec` method
2862
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
2863
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
2864
- exec: exec
2865
- });
2866
-
2867
3350
  /**
2868
3351
  * Component Wrapper to render form fields without the Form component, gets additional formId and mapper since
2869
3352
  * it won't rely on them and needs to be manually declared
@@ -2877,59 +3360,50 @@ const AsFormFieldBuilder = props => {
2877
3360
  * state to track the field instance creation process
2878
3361
  */
2879
3362
  const [mounted, setMounted] = useState(false);
3363
+ const mountedRef = useRef(false);
2880
3364
  /**
2881
3365
  * initializer to create or add a form instance to the formGroup by it's formId
2882
3366
  * and add the field to the form instance
2883
3367
  * Also has the logic to remove it once this element is removed
2884
3368
  */
2885
3369
  useEffect(() => {
2886
- var _a;
2887
- if (!((_a = context.formGroupInstance) === null || _a === void 0 ? void 0 : _a.forms.has(props.formIndex))) {
3370
+ var _a, _b;
3371
+ if (mountedRef.current) return;
3372
+ if (typeof props.formMounted === 'undefined' && !((_a = context.formGroupInstance) === null || _a === void 0 ? void 0 : _a.forms.has(props.formIndex))) {
2888
3373
  context.addFormWithIndex(props.formIndex);
2889
3374
  }
2890
- const fieldSchema = Object.assign(Object.assign({}, props), {
2891
- component: props.mapper.componentName,
2892
- children: undefined
2893
- });
2894
- const formInstance = context.formGroupInstance.forms.get(props.formIndex);
2895
- formInstance === null || formInstance === void 0 ? void 0 : formInstance.addField({
2896
- fieldSchema,
2897
- mapperElement: props.mapper
2898
- });
2899
- const field = formInstance === null || formInstance === void 0 ? void 0 : formInstance.getField({
2900
- key: props.name
2901
- });
2902
- if (typeof (props === null || props === void 0 ? void 0 : props.visibility) !== 'undefined' && field) {
2903
- field.visibility = props.visibility;
3375
+ if (props.formMounted || typeof props.formMounted === 'undefined') {
3376
+ const fieldSchema = Object.assign(Object.assign({}, props), {
3377
+ component: ((_b = props.mapper) === null || _b === void 0 ? void 0 : _b.componentName) || props.component,
3378
+ //forcing 1 option with OneOf
3379
+ children: undefined
3380
+ });
3381
+ const formInstance = context.formGroupInstance.forms.get(props.formIndex);
3382
+ formInstance === null || formInstance === void 0 ? void 0 : formInstance.addField({
3383
+ fieldSchema,
3384
+ mapperElement: props.mapper
3385
+ });
3386
+ setMounted(true);
3387
+ mountedRef.current = true;
2904
3388
  }
2905
- setMounted(true);
2906
- return () => formInstance === null || formInstance === void 0 ? void 0 : formInstance.removeField({
2907
- key: props.name
2908
- });
2909
- }, []);
3389
+ }, [props.formMounted]);
2910
3390
  /**
2911
- * expensive function to allow both external props and templating work
2912
- * evaluate if templating will be done onto form-engine or not
3391
+ * recycle effect to remove the field from the form instance when the field leaves the vDOM
3392
+ * and the subscriptions
2913
3393
  */
2914
3394
  useEffect(() => {
2915
- var _a;
2916
- if (!mounted) return;
2917
- const field = (_a = context.formGroupInstance.forms.get(props.formIndex)) === null || _a === void 0 ? void 0 : _a.fields.get(props.name);
2918
- const fieldProps = field === null || field === void 0 ? void 0 : field.props;
2919
- if (props.props) {
2920
- Object.keys(props.props).forEach(propKey => {
2921
- var _a, _b;
2922
- if (typeof ((_a = props.props) === null || _a === void 0 ? void 0 : _a[propKey]) === 'string' &&
2923
- /**
2924
- * need to check linting on build, this needs to be casted in order to build..
2925
- */
2926
- /\$/.test((_b = props.props) === null || _b === void 0 ? void 0 : _b[propKey])) {
2927
- delete props.props[propKey];
2928
- }
3395
+ return () => {
3396
+ var _a, _b;
3397
+ if ((_b = (_a = context.getForm({
3398
+ key: props.formIndex
3399
+ })) === null || _a === void 0 ? void 0 : _a.getField({
3400
+ key: props.name
3401
+ })) === null || _b === void 0 ? void 0 : _b.mounted) context.formGroupInstance.removeField({
3402
+ formIndex: props.formIndex,
3403
+ fieldIndex: props.name
2929
3404
  });
2930
- }
2931
- field === null || field === void 0 ? void 0 : field.propsSubject$.next(Object.assign(Object.assign({}, fieldProps), props.props));
2932
- }, [props.props]);
3405
+ };
3406
+ }, []);
2933
3407
  /**
2934
3408
  * allows to control field selected value on each event
2935
3409
  */
@@ -2946,15 +3420,276 @@ const AsFormFieldBuilder = props => {
2946
3420
  });
2947
3421
  return () => sub === null || sub === void 0 ? void 0 : sub.unsubscribe();
2948
3422
  }, [props.onSelected]);
2949
- return mounted ? jsx(FieldWrapper, {
3423
+ return jsx(FieldWrapper, {
2950
3424
  formIndex: props.formIndex,
2951
3425
  name: props.name,
2952
3426
  props: props.props,
2953
3427
  context: !context.active ? context : null,
3428
+ mounted: mounted,
3429
+ mapper: props.mapper,
3430
+ visibility: props.visibility,
3431
+ component: props.component,
2954
3432
  children: props.children && props.children
2955
- }) : jsx(Fragment, {});
3433
+ });
3434
+ };
3435
+
3436
+ var classof$1 = classofRaw$2;
3437
+
3438
+ // `IsArray` abstract operation
3439
+ // https://tc39.es/ecma262/#sec-isarray
3440
+ // eslint-disable-next-line es/no-array-isarray -- safe
3441
+ var isArray$1 = Array.isArray || function isArray(argument) {
3442
+ return classof$1(argument) === 'Array';
3443
+ };
3444
+
3445
+ var DESCRIPTORS = descriptors;
3446
+ var isArray = isArray$1;
3447
+
3448
+ var $TypeError$3 = TypeError;
3449
+ // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
3450
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
3451
+
3452
+ // Safari < 13 does not throw an error in this case
3453
+ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
3454
+ // makes no sense without proper strict mode support
3455
+ if (this !== undefined) return true;
3456
+ try {
3457
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
3458
+ Object.defineProperty([], 'length', { writable: false }).length = 1;
3459
+ } catch (error) {
3460
+ return error instanceof TypeError;
3461
+ }
3462
+ }();
3463
+
3464
+ var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
3465
+ if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
3466
+ throw new $TypeError$3('Cannot set read only .length');
3467
+ } return O.length = length;
3468
+ } : function (O, length) {
3469
+ return O.length = length;
3470
+ };
3471
+
3472
+ var $TypeError$2 = TypeError;
3473
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
3474
+
3475
+ var doesNotExceedSafeInteger$1 = function (it) {
3476
+ if (it > MAX_SAFE_INTEGER) throw $TypeError$2('Maximum allowed index exceeded');
3477
+ return it;
2956
3478
  };
2957
3479
 
3480
+ var $$3 = _export;
3481
+ var toObject$1 = toObject$6;
3482
+ var lengthOfArrayLike$1 = lengthOfArrayLike$5;
3483
+ var setArrayLength = arraySetLength;
3484
+ var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
3485
+ var fails$1 = fails$j;
3486
+
3487
+ var INCORRECT_TO_LENGTH = fails$1(function () {
3488
+ return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
3489
+ });
3490
+
3491
+ // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
3492
+ // https://bugs.chromium.org/p/v8/issues/detail?id=12681
3493
+ var properErrorOnNonWritableLength = function () {
3494
+ try {
3495
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
3496
+ Object.defineProperty([], 'length', { writable: false }).push();
3497
+ } catch (error) {
3498
+ return error instanceof TypeError;
3499
+ }
3500
+ };
3501
+
3502
+ var FORCED$1 = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
3503
+
3504
+ // `Array.prototype.push` method
3505
+ // https://tc39.es/ecma262/#sec-array.prototype.push
3506
+ $$3({ target: 'Array', proto: true, arity: 1, forced: FORCED$1 }, {
3507
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
3508
+ push: function push(item) {
3509
+ var O = toObject$1(this);
3510
+ var len = lengthOfArrayLike$1(O);
3511
+ var argCount = arguments.length;
3512
+ doesNotExceedSafeInteger(len + argCount);
3513
+ for (var i = 0; i < argCount; i++) {
3514
+ O[len] = arguments[i];
3515
+ len++;
3516
+ }
3517
+ setArrayLength(O, len);
3518
+ return len;
3519
+ }
3520
+ });
3521
+
3522
+ var aCallable$2 = aCallable$a;
3523
+ var toObject = toObject$6;
3524
+ var IndexedObject = indexedObject;
3525
+ var lengthOfArrayLike = lengthOfArrayLike$5;
3526
+
3527
+ var $TypeError$1 = TypeError;
3528
+
3529
+ var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
3530
+
3531
+ // `Array.prototype.{ reduce, reduceRight }` methods implementation
3532
+ var createMethod = function (IS_RIGHT) {
3533
+ return function (that, callbackfn, argumentsLength, memo) {
3534
+ var O = toObject(that);
3535
+ var self = IndexedObject(O);
3536
+ var length = lengthOfArrayLike(O);
3537
+ aCallable$2(callbackfn);
3538
+ if (length === 0 && argumentsLength < 2) throw new $TypeError$1(REDUCE_EMPTY);
3539
+ var index = IS_RIGHT ? length - 1 : 0;
3540
+ var i = IS_RIGHT ? -1 : 1;
3541
+ if (argumentsLength < 2) while (true) {
3542
+ if (index in self) {
3543
+ memo = self[index];
3544
+ index += i;
3545
+ break;
3546
+ }
3547
+ index += i;
3548
+ if (IS_RIGHT ? index < 0 : length <= index) {
3549
+ throw new $TypeError$1(REDUCE_EMPTY);
3550
+ }
3551
+ }
3552
+ for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
3553
+ memo = callbackfn(memo, self[index], index, O);
3554
+ }
3555
+ return memo;
3556
+ };
3557
+ };
3558
+
3559
+ var arrayReduce = {
3560
+ // `Array.prototype.reduce` method
3561
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
3562
+ left: createMethod(false)};
3563
+
3564
+ /* global Bun, Deno -- detection */
3565
+ var globalThis$1 = globalThis_1;
3566
+ var userAgent = environmentUserAgent;
3567
+ var classof = classofRaw$2;
3568
+
3569
+ var userAgentStartsWith = function (string) {
3570
+ return userAgent.slice(0, string.length) === string;
3571
+ };
3572
+
3573
+ var environment = (function () {
3574
+ if (userAgentStartsWith('Bun/')) return 'BUN';
3575
+ if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
3576
+ if (userAgentStartsWith('Deno/')) return 'DENO';
3577
+ if (userAgentStartsWith('Node.js/')) return 'NODE';
3578
+ if (globalThis$1.Bun && typeof Bun.version == 'string') return 'BUN';
3579
+ if (globalThis$1.Deno && typeof Deno.version == 'object') return 'DENO';
3580
+ if (classof(globalThis$1.process) === 'process') return 'NODE';
3581
+ if (globalThis$1.window && globalThis$1.document) return 'BROWSER';
3582
+ return 'REST';
3583
+ })();
3584
+
3585
+ var ENVIRONMENT = environment;
3586
+
3587
+ var environmentIsNode = ENVIRONMENT === 'NODE';
3588
+
3589
+ var $$2 = _export;
3590
+ var $reduce = arrayReduce.left;
3591
+ var arrayMethodIsStrict = arrayMethodIsStrict$2;
3592
+ var CHROME_VERSION = environmentV8Version;
3593
+ var IS_NODE = environmentIsNode;
3594
+
3595
+ // Chrome 80-82 has a critical bug
3596
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
3597
+ var CHROME_BUG = !IS_NODE && CHROME_VERSION > 79 && CHROME_VERSION < 83;
3598
+ var FORCED = CHROME_BUG || !arrayMethodIsStrict('reduce');
3599
+
3600
+ // `Array.prototype.reduce` method
3601
+ // https://tc39.es/ecma262/#sec-array.prototype.reduce
3602
+ $$2({ target: 'Array', proto: true, forced: FORCED }, {
3603
+ reduce: function reduce(callbackfn /* , initialValue */) {
3604
+ var length = arguments.length;
3605
+ return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
3606
+ }
3607
+ });
3608
+
3609
+ var $$1 = _export;
3610
+ var call = functionCall;
3611
+ var iterate$1 = iterate$3;
3612
+ var aCallable$1 = aCallable$a;
3613
+ var anObject$1 = anObject$f;
3614
+ var getIteratorDirect$1 = getIteratorDirect$4;
3615
+ var iteratorClose$1 = iteratorClose$8;
3616
+ var iteratorHelperWithoutClosingOnEarlyError$1 = iteratorHelperWithoutClosingOnEarlyError$4;
3617
+
3618
+ var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$1('forEach', TypeError);
3619
+
3620
+ // `Iterator.prototype.forEach` method
3621
+ // https://tc39.es/ecma262/#sec-iterator.prototype.foreach
3622
+ $$1({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
3623
+ forEach: function forEach(fn) {
3624
+ anObject$1(this);
3625
+ try {
3626
+ aCallable$1(fn);
3627
+ } catch (error) {
3628
+ iteratorClose$1(this, 'throw', error);
3629
+ }
3630
+
3631
+ if (forEachWithoutClosingOnEarlyError) return call(forEachWithoutClosingOnEarlyError, this, fn);
3632
+
3633
+ var record = getIteratorDirect$1(this);
3634
+ var counter = 0;
3635
+ iterate$1(record, function (value) {
3636
+ fn(value, counter++);
3637
+ }, { IS_RECORD: true });
3638
+ }
3639
+ });
3640
+
3641
+ var $ = _export;
3642
+ var iterate = iterate$3;
3643
+ var aCallable = aCallable$a;
3644
+ var anObject = anObject$f;
3645
+ var getIteratorDirect = getIteratorDirect$4;
3646
+ var iteratorClose = iteratorClose$8;
3647
+ var iteratorHelperWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError$4;
3648
+ var apply = functionApply;
3649
+ var fails = fails$j;
3650
+
3651
+ var $TypeError = TypeError;
3652
+
3653
+ // https://bugs.webkit.org/show_bug.cgi?id=291651
3654
+ var FAILS_ON_INITIAL_UNDEFINED = fails(function () {
3655
+ // eslint-disable-next-line es/no-iterator-prototype-reduce, es/no-array-prototype-keys, array-callback-return -- required for testing
3656
+ [].keys().reduce(function () { /* empty */ }, undefined);
3657
+ });
3658
+
3659
+ var reduceWithoutClosingOnEarlyError = !FAILS_ON_INITIAL_UNDEFINED && iteratorHelperWithoutClosingOnEarlyError('reduce', $TypeError);
3660
+
3661
+ // `Iterator.prototype.reduce` method
3662
+ // https://tc39.es/ecma262/#sec-iterator.prototype.reduce
3663
+ $({ target: 'Iterator', proto: true, real: true, forced: FAILS_ON_INITIAL_UNDEFINED || reduceWithoutClosingOnEarlyError }, {
3664
+ reduce: function reduce(reducer /* , initialValue */) {
3665
+ anObject(this);
3666
+ try {
3667
+ aCallable(reducer);
3668
+ } catch (error) {
3669
+ iteratorClose(this, 'throw', error);
3670
+ }
3671
+
3672
+ var noInitial = arguments.length < 2;
3673
+ var accumulator = noInitial ? undefined : arguments[1];
3674
+ if (reduceWithoutClosingOnEarlyError) {
3675
+ return apply(reduceWithoutClosingOnEarlyError, this, noInitial ? [reducer] : [reducer, accumulator]);
3676
+ }
3677
+ var record = getIteratorDirect(this);
3678
+ var counter = 0;
3679
+ iterate(record, function (value) {
3680
+ if (noInitial) {
3681
+ noInitial = false;
3682
+ accumulator = value;
3683
+ } else {
3684
+ accumulator = reducer(accumulator, value, counter);
3685
+ }
3686
+ counter++;
3687
+ }, { IS_RECORD: true });
3688
+ if (noInitial) throw new $TypeError('Reduce of empty iterator with no initial value');
3689
+ return accumulator;
3690
+ }
3691
+ });
3692
+
2958
3693
  function useFormGroup({
2959
3694
  ids,
2960
3695
  onData,
@@ -3015,6 +3750,124 @@ function useFormGroup({
3015
3750
  return;
3016
3751
  }
3017
3752
 
3753
+ /**
3754
+ * Adapter do manage repeated list elements on form
3755
+ *
3756
+ * @param {TAsFormFieldRepeaterProps} props Repeater properties to configure the elements repeater
3757
+ * @returns {ReactElement}
3758
+ */
3759
+ const AsFormFieldRepeater = ({
3760
+ RepeaterComponent,
3761
+ addFieldName,
3762
+ removeFieldName,
3763
+ existingElements,
3764
+ initialElements,
3765
+ stateUpdater,
3766
+ formPrefix,
3767
+ RepeaterFooter
3768
+ }) => {
3769
+ const {
3770
+ getForm,
3771
+ formGroupInstance
3772
+ } = useFormGroupContext();
3773
+ const [elements, setElements] = useState(typeof existingElements === 'object' && existingElements !== null ? Object.keys(existingElements).map(() => uniqueIdGen()) : typeof initialElements === 'number' ? Array.from(Array(initialElements), () => uniqueIdGen()) : []);
3774
+ const mountedRef = useRef(false);
3775
+ const prevElements = useRef(0);
3776
+ const REPEATER_FOOTER_ID = useMemo(() => uniqueIdGen(), []);
3777
+ const listeningElements = useMemo(() => {
3778
+ return [...elements, REPEATER_FOOTER_ID];
3779
+ }, [elements]);
3780
+ useFormGroup({
3781
+ ids: listeningElements,
3782
+ onData: payload => {
3783
+ if (stateUpdater) {
3784
+ if (formPrefix) {
3785
+ stateUpdater(elements.reduce((acc, curr, index) => {
3786
+ const value = payload[curr];
3787
+ acc[`${formPrefix}${index + 1}`] = value;
3788
+ return acc;
3789
+ }, {}));
3790
+ return;
3791
+ }
3792
+ stateUpdater(payload);
3793
+ }
3794
+ }
3795
+ }, [listeningElements]);
3796
+ useEffect(() => {
3797
+ // @TODO: refactor, quick workarount to emit data when removing a form from the list
3798
+ if (prevElements.current > elements.length) {
3799
+ formGroupInstance.dataSubject$.next({
3800
+ event: 'ON_FIELD_UNMOUNT',
3801
+ fieldIndex: 'unmounted_repeater_form',
3802
+ formIndex: elements[0]
3803
+ });
3804
+ }
3805
+ if (!mountedRef.current) {
3806
+ elements.forEach((key, index) => {
3807
+ const form = getForm({
3808
+ key
3809
+ });
3810
+ if (form && (existingElements === null || existingElements === void 0 ? void 0 : existingElements[index])) {
3811
+ form.initialValues = existingElements[index];
3812
+ }
3813
+ });
3814
+ }
3815
+ const subs = listeningElements.map(key => {
3816
+ var _a;
3817
+ return (_a = getForm({
3818
+ key
3819
+ })) === null || _a === void 0 ? void 0 : _a.subscribeFieldEvent({
3820
+ callback({
3821
+ event,
3822
+ fieldName,
3823
+ fieldInstance
3824
+ }) {
3825
+ if (fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.formIndex) {
3826
+ if (event === 'ON_FIELD_CLICK' && fieldInstance.formIndex === REPEATER_FOOTER_ID) {
3827
+ setElements(prev => {
3828
+ prev.push(uniqueIdGen());
3829
+ return [...prev];
3830
+ });
3831
+ return;
3832
+ }
3833
+ if (event === 'ON_FIELD_CLICK' && fieldName === addFieldName) {
3834
+ setElements(prev => {
3835
+ const index = prev.indexOf(fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.formIndex);
3836
+ prev.splice(index + 1, 0, uniqueIdGen());
3837
+ return [...prev];
3838
+ });
3839
+ }
3840
+ if (event === 'ON_FIELD_CLICK' && fieldName === removeFieldName) {
3841
+ if ((fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.formIndex) && elements.length > 0) setElements(prev => {
3842
+ const index = prev.indexOf(fieldInstance === null || fieldInstance === void 0 ? void 0 : fieldInstance.formIndex);
3843
+ prev.splice(index, 1);
3844
+ return [...prev];
3845
+ });
3846
+ }
3847
+ }
3848
+ }
3849
+ });
3850
+ });
3851
+ mountedRef.current = true;
3852
+ prevElements.current = elements.length;
3853
+ return () => {
3854
+ subs.map(sub => sub === null || sub === void 0 ? void 0 : sub.unsubscribe());
3855
+ };
3856
+ }, [elements]);
3857
+ return jsxs("div", {
3858
+ style: {
3859
+ display: 'flex',
3860
+ flexDirection: 'column'
3861
+ },
3862
+ children: [elements.map((el, index) => jsx(RepeaterComponent, {
3863
+ formIndex: el,
3864
+ index: index
3865
+ }, el)), RepeaterFooter && jsx(RepeaterFooter, {
3866
+ formIndex: REPEATER_FOOTER_ID
3867
+ })]
3868
+ });
3869
+ };
3870
+
3018
3871
  const defaultChangeEvent = event => {
3019
3872
  return event.currentTarget.value;
3020
3873
  };
@@ -3024,6 +3877,11 @@ const checkedChangeEvent = event => {
3024
3877
  const valueChangeEvent = event => {
3025
3878
  return event.target.value;
3026
3879
  };
3880
+ const numberInputChangeEvent = number => {
3881
+ if (number) {
3882
+ return Number(number);
3883
+ }
3884
+ };
3027
3885
  const datepickerChangeEvent = event => event;
3028
3886
  const dropdownChangeEvent = (event, opts) => {
3029
3887
  if (typeof event === 'object' && event !== null && 'value' in event && 'id' in event) {
@@ -3031,7 +3889,7 @@ const dropdownChangeEvent = (event, opts) => {
3031
3889
  _value: event === null || event === void 0 ? void 0 : event.id,
3032
3890
  _metadata: event
3033
3891
  };
3034
- } else if (typeof event === 'string' && typeof opts === 'object' && 'props' in opts && typeof opts.props === 'object' && 'optionList' in opts.props && Array.isArray(opts.props.optionList)) {
3892
+ } else if ((typeof event === 'string' || typeof event === 'number') && typeof opts === 'object' && 'props' in opts && typeof opts.props === 'object' && 'optionList' in opts.props && Array.isArray(opts.props.optionList)) {
3035
3893
  const option = opts.props.optionList.find(el => el.value === event);
3036
3894
  if (option) {
3037
3895
  return {
@@ -3044,7 +3902,12 @@ const dropdownChangeEvent = (event, opts) => {
3044
3902
  _metadata: event
3045
3903
  };
3046
3904
  }
3905
+ } else {
3906
+ return {
3907
+ _value: event,
3908
+ _metadata: event
3909
+ };
3047
3910
  }
3048
3911
  };
3049
3912
 
3050
- export { AsFormField, AsFormFieldBuilder, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };
3913
+ export { AsFormField, AsFormFieldBuilder, AsFormFieldRepeater, Form, FormGroupContext, FormGroupContextProvider, checkedChangeEvent, datepickerChangeEvent, defaultChangeEvent, dropdownChangeEvent, numberInputChangeEvent, useForm, useFormGroup, useFormGroupContext, valueChangeEvent };