@intrig/react 1.0.7 → 1.0.11

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 DELETED
@@ -1,4677 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { createContext, useContext, useReducer, useMemo, useState, useCallback, useEffect, useRef, useId } from 'react';
3
- import axios, { isAxiosError } from 'axios';
4
- import { XMLParser } from 'fast-xml-parser';
5
-
6
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
7
-
8
- function getDefaultExportFromCjs (x) {
9
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
10
- }
11
-
12
- var check = function (it) {
13
- return it && it.Math === Math && it;
14
- };
15
-
16
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
17
- var globalThis_1 =
18
- // eslint-disable-next-line es/no-global-this -- safe
19
- check(typeof globalThis == 'object' && globalThis) ||
20
- check(typeof window == 'object' && window) ||
21
- // eslint-disable-next-line no-restricted-globals -- safe
22
- check(typeof self == 'object' && self) ||
23
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
24
- check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
25
- // eslint-disable-next-line no-new-func -- fallback
26
- (function () { return this; })() || Function('return this')();
27
-
28
- var objectGetOwnPropertyDescriptor = {};
29
-
30
- var fails$i = function (exec) {
31
- try {
32
- return !!exec();
33
- } catch (error) {
34
- return true;
35
- }
36
- };
37
-
38
- var fails$h = fails$i;
39
-
40
- // Detect IE8's incomplete defineProperty implementation
41
- var descriptors = !fails$h(function () {
42
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
43
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] !== 7;
44
- });
45
-
46
- var fails$g = fails$i;
47
-
48
- var functionBindNative = !fails$g(function () {
49
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
50
- var test = (function () { /* empty */ }).bind();
51
- // eslint-disable-next-line no-prototype-builtins -- safe
52
- return typeof test != 'function' || test.hasOwnProperty('prototype');
53
- });
54
-
55
- var NATIVE_BIND$3 = functionBindNative;
56
-
57
- var call$g = Function.prototype.call;
58
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
59
- var functionCall = NATIVE_BIND$3 ? call$g.bind(call$g) : function () {
60
- return call$g.apply(call$g, arguments);
61
- };
62
-
63
- var objectPropertyIsEnumerable = {};
64
-
65
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
66
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
67
- var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor;
68
-
69
- // Nashorn ~ JDK8 bug
70
- var NASHORN_BUG = getOwnPropertyDescriptor$3 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
71
-
72
- // `Object.prototype.propertyIsEnumerable` method implementation
73
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
74
- objectPropertyIsEnumerable.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
75
- var descriptor = getOwnPropertyDescriptor$3(this, V);
76
- return !!descriptor && descriptor.enumerable;
77
- } : $propertyIsEnumerable;
78
-
79
- var createPropertyDescriptor$5 = function (bitmap, value) {
80
- return {
81
- enumerable: !(bitmap & 1),
82
- configurable: !(bitmap & 2),
83
- writable: !(bitmap & 4),
84
- value: value
85
- };
86
- };
87
-
88
- var NATIVE_BIND$2 = functionBindNative;
89
-
90
- var FunctionPrototype$2 = Function.prototype;
91
- var call$f = FunctionPrototype$2.call;
92
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
93
- var uncurryThisWithBind = NATIVE_BIND$2 && FunctionPrototype$2.bind.bind(call$f, call$f);
94
-
95
- var functionUncurryThis = NATIVE_BIND$2 ? uncurryThisWithBind : function (fn) {
96
- return function () {
97
- return call$f.apply(fn, arguments);
98
- };
99
- };
100
-
101
- var uncurryThis$g = functionUncurryThis;
102
-
103
- var toString$4 = uncurryThis$g({}.toString);
104
- var stringSlice$1 = uncurryThis$g(''.slice);
105
-
106
- var classofRaw$2 = function (it) {
107
- return stringSlice$1(toString$4(it), 8, -1);
108
- };
109
-
110
- var uncurryThis$f = functionUncurryThis;
111
- var fails$f = fails$i;
112
- var classof$7 = classofRaw$2;
113
-
114
- var $Object$4 = Object;
115
- var split = uncurryThis$f(''.split);
116
-
117
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
118
- var indexedObject = fails$f(function () {
119
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
120
- // eslint-disable-next-line no-prototype-builtins -- safe
121
- return !$Object$4('z').propertyIsEnumerable(0);
122
- }) ? function (it) {
123
- return classof$7(it) === 'String' ? split(it, '') : $Object$4(it);
124
- } : $Object$4;
125
-
126
- // we can't use just `it == null` since of `document.all` special case
127
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
128
- var isNullOrUndefined$4 = function (it) {
129
- return it === null || it === undefined;
130
- };
131
-
132
- var isNullOrUndefined$3 = isNullOrUndefined$4;
133
-
134
- var $TypeError$i = TypeError;
135
-
136
- // `RequireObjectCoercible` abstract operation
137
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
138
- var requireObjectCoercible$4 = function (it) {
139
- if (isNullOrUndefined$3(it)) throw new $TypeError$i("Can't call method on " + it);
140
- return it;
141
- };
142
-
143
- // toObject with fallback for non-array-like ES3 strings
144
- var IndexedObject$2 = indexedObject;
145
- var requireObjectCoercible$3 = requireObjectCoercible$4;
146
-
147
- var toIndexedObject$5 = function (it) {
148
- return IndexedObject$2(requireObjectCoercible$3(it));
149
- };
150
-
151
- // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
152
- var documentAll = typeof document == 'object' && document.all;
153
-
154
- // `IsCallable` abstract operation
155
- // https://tc39.es/ecma262/#sec-iscallable
156
- // eslint-disable-next-line unicorn/no-typeof-undefined -- required for testing
157
- var isCallable$l = typeof documentAll == 'undefined' && documentAll !== undefined ? function (argument) {
158
- return typeof argument == 'function' || argument === documentAll;
159
- } : function (argument) {
160
- return typeof argument == 'function';
161
- };
162
-
163
- var isCallable$k = isCallable$l;
164
-
165
- var isObject$d = function (it) {
166
- return typeof it == 'object' ? it !== null : isCallable$k(it);
167
- };
168
-
169
- var globalThis$l = globalThis_1;
170
- var isCallable$j = isCallable$l;
171
-
172
- var aFunction = function (argument) {
173
- return isCallable$j(argument) ? argument : undefined;
174
- };
175
-
176
- var getBuiltIn$8 = function (namespace, method) {
177
- return arguments.length < 2 ? aFunction(globalThis$l[namespace]) : globalThis$l[namespace] && globalThis$l[namespace][method];
178
- };
179
-
180
- var uncurryThis$e = functionUncurryThis;
181
-
182
- var objectIsPrototypeOf = uncurryThis$e({}.isPrototypeOf);
183
-
184
- var globalThis$k = globalThis_1;
185
-
186
- var navigator = globalThis$k.navigator;
187
- var userAgent$5 = navigator && navigator.userAgent;
188
-
189
- var environmentUserAgent = userAgent$5 ? String(userAgent$5) : '';
190
-
191
- var globalThis$j = globalThis_1;
192
- var userAgent$4 = environmentUserAgent;
193
-
194
- var process$4 = globalThis$j.process;
195
- var Deno$1 = globalThis$j.Deno;
196
- var versions = process$4 && process$4.versions || Deno$1 && Deno$1.version;
197
- var v8 = versions && versions.v8;
198
- var match, version;
199
-
200
- if (v8) {
201
- match = v8.split('.');
202
- // in old Chrome, versions of V8 isn't V8 = Chrome / 10
203
- // but their correct versions are not interesting for us
204
- version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
205
- }
206
-
207
- // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
208
- // so check `userAgent` even if `.v8` exists, but 0
209
- if (!version && userAgent$4) {
210
- match = userAgent$4.match(/Edge\/(\d+)/);
211
- if (!match || match[1] >= 74) {
212
- match = userAgent$4.match(/Chrome\/(\d+)/);
213
- if (match) version = +match[1];
214
- }
215
- }
216
-
217
- var environmentV8Version = version;
218
-
219
- /* eslint-disable es/no-symbol -- required for testing */
220
- var V8_VERSION$1 = environmentV8Version;
221
- var fails$e = fails$i;
222
- var globalThis$i = globalThis_1;
223
-
224
- var $String$5 = globalThis$i.String;
225
-
226
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
227
- var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$e(function () {
228
- var symbol = Symbol('symbol detection');
229
- // Chrome 38 Symbol has incorrect toString conversion
230
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
231
- // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
232
- // of course, fail.
233
- return !$String$5(symbol) || !(Object(symbol) instanceof Symbol) ||
234
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
235
- !Symbol.sham && V8_VERSION$1 && V8_VERSION$1 < 41;
236
- });
237
-
238
- /* eslint-disable es/no-symbol -- required for testing */
239
- var NATIVE_SYMBOL$1 = symbolConstructorDetection;
240
-
241
- var useSymbolAsUid = NATIVE_SYMBOL$1 &&
242
- !Symbol.sham &&
243
- typeof Symbol.iterator == 'symbol';
244
-
245
- var getBuiltIn$7 = getBuiltIn$8;
246
- var isCallable$i = isCallable$l;
247
- var isPrototypeOf$3 = objectIsPrototypeOf;
248
- var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
249
-
250
- var $Object$3 = Object;
251
-
252
- var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
253
- return typeof it == 'symbol';
254
- } : function (it) {
255
- var $Symbol = getBuiltIn$7('Symbol');
256
- return isCallable$i($Symbol) && isPrototypeOf$3($Symbol.prototype, $Object$3(it));
257
- };
258
-
259
- var $String$4 = String;
260
-
261
- var tryToString$4 = function (argument) {
262
- try {
263
- return $String$4(argument);
264
- } catch (error) {
265
- return 'Object';
266
- }
267
- };
268
-
269
- var isCallable$h = isCallable$l;
270
- var tryToString$3 = tryToString$4;
271
-
272
- var $TypeError$h = TypeError;
273
-
274
- // `Assert: IsCallable(argument) is true`
275
- var aCallable$d = function (argument) {
276
- if (isCallable$h(argument)) return argument;
277
- throw new $TypeError$h(tryToString$3(argument) + ' is not a function');
278
- };
279
-
280
- var aCallable$c = aCallable$d;
281
- var isNullOrUndefined$2 = isNullOrUndefined$4;
282
-
283
- // `GetMethod` abstract operation
284
- // https://tc39.es/ecma262/#sec-getmethod
285
- var getMethod$4 = function (V, P) {
286
- var func = V[P];
287
- return isNullOrUndefined$2(func) ? undefined : aCallable$c(func);
288
- };
289
-
290
- var call$e = functionCall;
291
- var isCallable$g = isCallable$l;
292
- var isObject$c = isObject$d;
293
-
294
- var $TypeError$g = TypeError;
295
-
296
- // `OrdinaryToPrimitive` abstract operation
297
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
298
- var ordinaryToPrimitive$1 = function (input, pref) {
299
- var fn, val;
300
- if (pref === 'string' && isCallable$g(fn = input.toString) && !isObject$c(val = call$e(fn, input))) return val;
301
- if (isCallable$g(fn = input.valueOf) && !isObject$c(val = call$e(fn, input))) return val;
302
- if (pref !== 'string' && isCallable$g(fn = input.toString) && !isObject$c(val = call$e(fn, input))) return val;
303
- throw new $TypeError$g("Can't convert object to primitive value");
304
- };
305
-
306
- var sharedStore = {exports: {}};
307
-
308
- var isPure = false;
309
-
310
- var globalThis$h = globalThis_1;
311
-
312
- // eslint-disable-next-line es/no-object-defineproperty -- safe
313
- var defineProperty$7 = Object.defineProperty;
314
-
315
- var defineGlobalProperty$3 = function (key, value) {
316
- try {
317
- defineProperty$7(globalThis$h, key, { value: value, configurable: true, writable: true });
318
- } catch (error) {
319
- globalThis$h[key] = value;
320
- } return value;
321
- };
322
-
323
- var globalThis$g = globalThis_1;
324
- var defineGlobalProperty$2 = defineGlobalProperty$3;
325
-
326
- var SHARED = '__core-js_shared__';
327
- var store$3 = sharedStore.exports = globalThis$g[SHARED] || defineGlobalProperty$2(SHARED, {});
328
-
329
- (store$3.versions || (store$3.versions = [])).push({
330
- version: '3.40.0',
331
- mode: 'global',
332
- copyright: '© 2014-2025 Denis Pushkarev (zloirock.ru)',
333
- license: 'https://github.com/zloirock/core-js/blob/v3.40.0/LICENSE',
334
- source: 'https://github.com/zloirock/core-js'
335
- });
336
-
337
- var sharedStoreExports = sharedStore.exports;
338
-
339
- var store$2 = sharedStoreExports;
340
-
341
- var shared$3 = function (key, value) {
342
- return store$2[key] || (store$2[key] = value || {});
343
- };
344
-
345
- var requireObjectCoercible$2 = requireObjectCoercible$4;
346
-
347
- var $Object$2 = Object;
348
-
349
- // `ToObject` abstract operation
350
- // https://tc39.es/ecma262/#sec-toobject
351
- var toObject$5 = function (argument) {
352
- return $Object$2(requireObjectCoercible$2(argument));
353
- };
354
-
355
- var uncurryThis$d = functionUncurryThis;
356
- var toObject$4 = toObject$5;
357
-
358
- var hasOwnProperty = uncurryThis$d({}.hasOwnProperty);
359
-
360
- // `HasOwnProperty` abstract operation
361
- // https://tc39.es/ecma262/#sec-hasownproperty
362
- // eslint-disable-next-line es/no-object-hasown -- safe
363
- var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
364
- return hasOwnProperty(toObject$4(it), key);
365
- };
366
-
367
- var uncurryThis$c = functionUncurryThis;
368
-
369
- var id = 0;
370
- var postfix = Math.random();
371
- var toString$3 = uncurryThis$c(1.0.toString);
372
-
373
- var uid$2 = function (key) {
374
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
375
- };
376
-
377
- var globalThis$f = globalThis_1;
378
- var shared$2 = shared$3;
379
- var hasOwn$b = hasOwnProperty_1;
380
- var uid$1 = uid$2;
381
- var NATIVE_SYMBOL = symbolConstructorDetection;
382
- var USE_SYMBOL_AS_UID = useSymbolAsUid;
383
-
384
- var Symbol$1 = globalThis$f.Symbol;
385
- var WellKnownSymbolsStore = shared$2('wks');
386
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
387
-
388
- var wellKnownSymbol$i = function (name) {
389
- if (!hasOwn$b(WellKnownSymbolsStore, name)) {
390
- WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$b(Symbol$1, name)
391
- ? Symbol$1[name]
392
- : createWellKnownSymbol('Symbol.' + name);
393
- } return WellKnownSymbolsStore[name];
394
- };
395
-
396
- var call$d = functionCall;
397
- var isObject$b = isObject$d;
398
- var isSymbol$1 = isSymbol$2;
399
- var getMethod$3 = getMethod$4;
400
- var ordinaryToPrimitive = ordinaryToPrimitive$1;
401
- var wellKnownSymbol$h = wellKnownSymbol$i;
402
-
403
- var $TypeError$f = TypeError;
404
- var TO_PRIMITIVE = wellKnownSymbol$h('toPrimitive');
405
-
406
- // `ToPrimitive` abstract operation
407
- // https://tc39.es/ecma262/#sec-toprimitive
408
- var toPrimitive$1 = function (input, pref) {
409
- if (!isObject$b(input) || isSymbol$1(input)) return input;
410
- var exoticToPrim = getMethod$3(input, TO_PRIMITIVE);
411
- var result;
412
- if (exoticToPrim) {
413
- if (pref === undefined) pref = 'default';
414
- result = call$d(exoticToPrim, input, pref);
415
- if (!isObject$b(result) || isSymbol$1(result)) return result;
416
- throw new $TypeError$f("Can't convert object to primitive value");
417
- }
418
- if (pref === undefined) pref = 'number';
419
- return ordinaryToPrimitive(input, pref);
420
- };
421
-
422
- var toPrimitive = toPrimitive$1;
423
- var isSymbol = isSymbol$2;
424
-
425
- // `ToPropertyKey` abstract operation
426
- // https://tc39.es/ecma262/#sec-topropertykey
427
- var toPropertyKey$2 = function (argument) {
428
- var key = toPrimitive(argument, 'string');
429
- return isSymbol(key) ? key : key + '';
430
- };
431
-
432
- var globalThis$e = globalThis_1;
433
- var isObject$a = isObject$d;
434
-
435
- var document$3 = globalThis$e.document;
436
- // typeof document.createElement is 'object' in old IE
437
- var EXISTS$1 = isObject$a(document$3) && isObject$a(document$3.createElement);
438
-
439
- var documentCreateElement$2 = function (it) {
440
- return EXISTS$1 ? document$3.createElement(it) : {};
441
- };
442
-
443
- var DESCRIPTORS$f = descriptors;
444
- var fails$d = fails$i;
445
- var createElement$1 = documentCreateElement$2;
446
-
447
- // Thanks to IE8 for its funny defineProperty
448
- var ie8DomDefine = !DESCRIPTORS$f && !fails$d(function () {
449
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
450
- return Object.defineProperty(createElement$1('div'), 'a', {
451
- get: function () { return 7; }
452
- }).a !== 7;
453
- });
454
-
455
- var DESCRIPTORS$e = descriptors;
456
- var call$c = functionCall;
457
- var propertyIsEnumerableModule$1 = objectPropertyIsEnumerable;
458
- var createPropertyDescriptor$4 = createPropertyDescriptor$5;
459
- var toIndexedObject$4 = toIndexedObject$5;
460
- var toPropertyKey$1 = toPropertyKey$2;
461
- var hasOwn$a = hasOwnProperty_1;
462
- var IE8_DOM_DEFINE$1 = ie8DomDefine;
463
-
464
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
465
- var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
466
-
467
- // `Object.getOwnPropertyDescriptor` method
468
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
469
- objectGetOwnPropertyDescriptor.f = DESCRIPTORS$e ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
470
- O = toIndexedObject$4(O);
471
- P = toPropertyKey$1(P);
472
- if (IE8_DOM_DEFINE$1) try {
473
- return $getOwnPropertyDescriptor$1(O, P);
474
- } catch (error) { /* empty */ }
475
- if (hasOwn$a(O, P)) return createPropertyDescriptor$4(!call$c(propertyIsEnumerableModule$1.f, O, P), O[P]);
476
- };
477
-
478
- var objectDefineProperty = {};
479
-
480
- var DESCRIPTORS$d = descriptors;
481
- var fails$c = fails$i;
482
-
483
- // V8 ~ Chrome 36-
484
- // https://bugs.chromium.org/p/v8/issues/detail?id=3334
485
- var v8PrototypeDefineBug = DESCRIPTORS$d && fails$c(function () {
486
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
487
- return Object.defineProperty(function () { /* empty */ }, 'prototype', {
488
- value: 42,
489
- writable: false
490
- }).prototype !== 42;
491
- });
492
-
493
- var isObject$9 = isObject$d;
494
-
495
- var $String$3 = String;
496
- var $TypeError$e = TypeError;
497
-
498
- // `Assert: Type(argument) is Object`
499
- var anObject$f = function (argument) {
500
- if (isObject$9(argument)) return argument;
501
- throw new $TypeError$e($String$3(argument) + ' is not an object');
502
- };
503
-
504
- var DESCRIPTORS$c = descriptors;
505
- var IE8_DOM_DEFINE = ie8DomDefine;
506
- var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
507
- var anObject$e = anObject$f;
508
- var toPropertyKey = toPropertyKey$2;
509
-
510
- var $TypeError$d = TypeError;
511
- // eslint-disable-next-line es/no-object-defineproperty -- safe
512
- var $defineProperty = Object.defineProperty;
513
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
514
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
515
- var ENUMERABLE = 'enumerable';
516
- var CONFIGURABLE$1 = 'configurable';
517
- var WRITABLE = 'writable';
518
-
519
- // `Object.defineProperty` method
520
- // https://tc39.es/ecma262/#sec-object.defineproperty
521
- objectDefineProperty.f = DESCRIPTORS$c ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
522
- anObject$e(O);
523
- P = toPropertyKey(P);
524
- anObject$e(Attributes);
525
- if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
526
- var current = $getOwnPropertyDescriptor(O, P);
527
- if (current && current[WRITABLE]) {
528
- O[P] = Attributes.value;
529
- Attributes = {
530
- configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
531
- enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
532
- writable: false
533
- };
534
- }
535
- } return $defineProperty(O, P, Attributes);
536
- } : $defineProperty : function defineProperty(O, P, Attributes) {
537
- anObject$e(O);
538
- P = toPropertyKey(P);
539
- anObject$e(Attributes);
540
- if (IE8_DOM_DEFINE) try {
541
- return $defineProperty(O, P, Attributes);
542
- } catch (error) { /* empty */ }
543
- if ('get' in Attributes || 'set' in Attributes) throw new $TypeError$d('Accessors not supported');
544
- if ('value' in Attributes) O[P] = Attributes.value;
545
- return O;
546
- };
547
-
548
- var DESCRIPTORS$b = descriptors;
549
- var definePropertyModule$4 = objectDefineProperty;
550
- var createPropertyDescriptor$3 = createPropertyDescriptor$5;
551
-
552
- var createNonEnumerableProperty$8 = DESCRIPTORS$b ? function (object, key, value) {
553
- return definePropertyModule$4.f(object, key, createPropertyDescriptor$3(1, value));
554
- } : function (object, key, value) {
555
- object[key] = value;
556
- return object;
557
- };
558
-
559
- var makeBuiltIn$3 = {exports: {}};
560
-
561
- var DESCRIPTORS$a = descriptors;
562
- var hasOwn$9 = hasOwnProperty_1;
563
-
564
- var FunctionPrototype$1 = Function.prototype;
565
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
566
- var getDescriptor = DESCRIPTORS$a && Object.getOwnPropertyDescriptor;
567
-
568
- var EXISTS = hasOwn$9(FunctionPrototype$1, 'name');
569
- // additional protection from minified / mangled / dropped function names
570
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
571
- var CONFIGURABLE = EXISTS && (!DESCRIPTORS$a || (DESCRIPTORS$a && getDescriptor(FunctionPrototype$1, 'name').configurable));
572
-
573
- var functionName = {
574
- EXISTS: EXISTS,
575
- PROPER: PROPER,
576
- CONFIGURABLE: CONFIGURABLE
577
- };
578
-
579
- var uncurryThis$b = functionUncurryThis;
580
- var isCallable$f = isCallable$l;
581
- var store$1 = sharedStoreExports;
582
-
583
- var functionToString = uncurryThis$b(Function.toString);
584
-
585
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
586
- if (!isCallable$f(store$1.inspectSource)) {
587
- store$1.inspectSource = function (it) {
588
- return functionToString(it);
589
- };
590
- }
591
-
592
- var inspectSource$3 = store$1.inspectSource;
593
-
594
- var globalThis$d = globalThis_1;
595
- var isCallable$e = isCallable$l;
596
-
597
- var WeakMap$1 = globalThis$d.WeakMap;
598
-
599
- var weakMapBasicDetection = isCallable$e(WeakMap$1) && /native code/.test(String(WeakMap$1));
600
-
601
- var shared$1 = shared$3;
602
- var uid = uid$2;
603
-
604
- var keys = shared$1('keys');
605
-
606
- var sharedKey$3 = function (key) {
607
- return keys[key] || (keys[key] = uid(key));
608
- };
609
-
610
- var hiddenKeys$4 = {};
611
-
612
- var NATIVE_WEAK_MAP = weakMapBasicDetection;
613
- var globalThis$c = globalThis_1;
614
- var isObject$8 = isObject$d;
615
- var createNonEnumerableProperty$7 = createNonEnumerableProperty$8;
616
- var hasOwn$8 = hasOwnProperty_1;
617
- var shared = sharedStoreExports;
618
- var sharedKey$2 = sharedKey$3;
619
- var hiddenKeys$3 = hiddenKeys$4;
620
-
621
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
622
- var TypeError$2 = globalThis$c.TypeError;
623
- var WeakMap = globalThis$c.WeakMap;
624
- var set$1, get, has;
625
-
626
- var enforce = function (it) {
627
- return has(it) ? get(it) : set$1(it, {});
628
- };
629
-
630
- var getterFor = function (TYPE) {
631
- return function (it) {
632
- var state;
633
- if (!isObject$8(it) || (state = get(it)).type !== TYPE) {
634
- throw new TypeError$2('Incompatible receiver, ' + TYPE + ' required');
635
- } return state;
636
- };
637
- };
638
-
639
- if (NATIVE_WEAK_MAP || shared.state) {
640
- var store = shared.state || (shared.state = new WeakMap());
641
- /* eslint-disable no-self-assign -- prototype methods protection */
642
- store.get = store.get;
643
- store.has = store.has;
644
- store.set = store.set;
645
- /* eslint-enable no-self-assign -- prototype methods protection */
646
- set$1 = function (it, metadata) {
647
- if (store.has(it)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
648
- metadata.facade = it;
649
- store.set(it, metadata);
650
- return metadata;
651
- };
652
- get = function (it) {
653
- return store.get(it) || {};
654
- };
655
- has = function (it) {
656
- return store.has(it);
657
- };
658
- } else {
659
- var STATE = sharedKey$2('state');
660
- hiddenKeys$3[STATE] = true;
661
- set$1 = function (it, metadata) {
662
- if (hasOwn$8(it, STATE)) throw new TypeError$2(OBJECT_ALREADY_INITIALIZED);
663
- metadata.facade = it;
664
- createNonEnumerableProperty$7(it, STATE, metadata);
665
- return metadata;
666
- };
667
- get = function (it) {
668
- return hasOwn$8(it, STATE) ? it[STATE] : {};
669
- };
670
- has = function (it) {
671
- return hasOwn$8(it, STATE);
672
- };
673
- }
674
-
675
- var internalState = {
676
- set: set$1,
677
- get: get,
678
- has: has,
679
- enforce: enforce,
680
- getterFor: getterFor
681
- };
682
-
683
- var uncurryThis$a = functionUncurryThis;
684
- var fails$b = fails$i;
685
- var isCallable$d = isCallable$l;
686
- var hasOwn$7 = hasOwnProperty_1;
687
- var DESCRIPTORS$9 = descriptors;
688
- var CONFIGURABLE_FUNCTION_NAME$1 = functionName.CONFIGURABLE;
689
- var inspectSource$2 = inspectSource$3;
690
- var InternalStateModule$3 = internalState;
691
-
692
- var enforceInternalState = InternalStateModule$3.enforce;
693
- var getInternalState$1 = InternalStateModule$3.get;
694
- var $String$2 = String;
695
- // eslint-disable-next-line es/no-object-defineproperty -- safe
696
- var defineProperty$6 = Object.defineProperty;
697
- var stringSlice = uncurryThis$a(''.slice);
698
- var replace$1 = uncurryThis$a(''.replace);
699
- var join = uncurryThis$a([].join);
700
-
701
- var CONFIGURABLE_LENGTH = DESCRIPTORS$9 && !fails$b(function () {
702
- return defineProperty$6(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
703
- });
704
-
705
- var TEMPLATE = String(String).split('String');
706
-
707
- var makeBuiltIn$2 = makeBuiltIn$3.exports = function (value, name, options) {
708
- if (stringSlice($String$2(name), 0, 7) === 'Symbol(') {
709
- name = '[' + replace$1($String$2(name), /^Symbol\(([^)]*)\).*$/, '$1') + ']';
710
- }
711
- if (options && options.getter) name = 'get ' + name;
712
- if (options && options.setter) name = 'set ' + name;
713
- if (!hasOwn$7(value, 'name') || (CONFIGURABLE_FUNCTION_NAME$1 && value.name !== name)) {
714
- if (DESCRIPTORS$9) defineProperty$6(value, 'name', { value: name, configurable: true });
715
- else value.name = name;
716
- }
717
- if (CONFIGURABLE_LENGTH && options && hasOwn$7(options, 'arity') && value.length !== options.arity) {
718
- defineProperty$6(value, 'length', { value: options.arity });
719
- }
720
- try {
721
- if (options && hasOwn$7(options, 'constructor') && options.constructor) {
722
- if (DESCRIPTORS$9) defineProperty$6(value, 'prototype', { writable: false });
723
- // in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
724
- } else if (value.prototype) value.prototype = undefined;
725
- } catch (error) { /* empty */ }
726
- var state = enforceInternalState(value);
727
- if (!hasOwn$7(state, 'source')) {
728
- state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
729
- } return value;
730
- };
731
-
732
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
733
- // eslint-disable-next-line no-extend-native -- required
734
- Function.prototype.toString = makeBuiltIn$2(function toString() {
735
- return isCallable$d(this) && getInternalState$1(this).source || inspectSource$2(this);
736
- }, 'toString');
737
-
738
- var makeBuiltInExports = makeBuiltIn$3.exports;
739
-
740
- var isCallable$c = isCallable$l;
741
- var definePropertyModule$3 = objectDefineProperty;
742
- var makeBuiltIn$1 = makeBuiltInExports;
743
- var defineGlobalProperty$1 = defineGlobalProperty$3;
744
-
745
- var defineBuiltIn$6 = function (O, key, value, options) {
746
- if (!options) options = {};
747
- var simple = options.enumerable;
748
- var name = options.name !== undefined ? options.name : key;
749
- if (isCallable$c(value)) makeBuiltIn$1(value, name, options);
750
- if (options.global) {
751
- if (simple) O[key] = value;
752
- else defineGlobalProperty$1(key, value);
753
- } else {
754
- try {
755
- if (!options.unsafe) delete O[key];
756
- else if (O[key]) simple = true;
757
- } catch (error) { /* empty */ }
758
- if (simple) O[key] = value;
759
- else definePropertyModule$3.f(O, key, {
760
- value: value,
761
- enumerable: false,
762
- configurable: !options.nonConfigurable,
763
- writable: !options.nonWritable
764
- });
765
- } return O;
766
- };
767
-
768
- var objectGetOwnPropertyNames = {};
769
-
770
- var ceil = Math.ceil;
771
- var floor = Math.floor;
772
-
773
- // `Math.trunc` method
774
- // https://tc39.es/ecma262/#sec-math.trunc
775
- // eslint-disable-next-line es/no-math-trunc -- safe
776
- var mathTrunc = Math.trunc || function trunc(x) {
777
- var n = +x;
778
- return (n > 0 ? floor : ceil)(n);
779
- };
780
-
781
- var trunc = mathTrunc;
782
-
783
- // `ToIntegerOrInfinity` abstract operation
784
- // https://tc39.es/ecma262/#sec-tointegerorinfinity
785
- var toIntegerOrInfinity$2 = function (argument) {
786
- var number = +argument;
787
- // eslint-disable-next-line no-self-compare -- NaN check
788
- return number !== number || number === 0 ? 0 : trunc(number);
789
- };
790
-
791
- var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
792
-
793
- var max = Math.max;
794
- var min$1 = Math.min;
795
-
796
- // Helper for a popular repeating case of the spec:
797
- // Let integer be ? ToInteger(index).
798
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
799
- var toAbsoluteIndex$1 = function (index, length) {
800
- var integer = toIntegerOrInfinity$1(index);
801
- return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
802
- };
803
-
804
- var toIntegerOrInfinity = toIntegerOrInfinity$2;
805
-
806
- var min = Math.min;
807
-
808
- // `ToLength` abstract operation
809
- // https://tc39.es/ecma262/#sec-tolength
810
- var toLength$1 = function (argument) {
811
- var len = toIntegerOrInfinity(argument);
812
- return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
813
- };
814
-
815
- var toLength = toLength$1;
816
-
817
- // `LengthOfArrayLike` abstract operation
818
- // https://tc39.es/ecma262/#sec-lengthofarraylike
819
- var lengthOfArrayLike$4 = function (obj) {
820
- return toLength(obj.length);
821
- };
822
-
823
- var toIndexedObject$3 = toIndexedObject$5;
824
- var toAbsoluteIndex = toAbsoluteIndex$1;
825
- var lengthOfArrayLike$3 = lengthOfArrayLike$4;
826
-
827
- // `Array.prototype.{ indexOf, includes }` methods implementation
828
- var createMethod$1 = function (IS_INCLUDES) {
829
- return function ($this, el, fromIndex) {
830
- var O = toIndexedObject$3($this);
831
- var length = lengthOfArrayLike$3(O);
832
- if (length === 0) return !IS_INCLUDES && -1;
833
- var index = toAbsoluteIndex(fromIndex, length);
834
- var value;
835
- // Array#includes uses SameValueZero equality algorithm
836
- // eslint-disable-next-line no-self-compare -- NaN check
837
- if (IS_INCLUDES && el !== el) while (length > index) {
838
- value = O[index++];
839
- // eslint-disable-next-line no-self-compare -- NaN check
840
- if (value !== value) return true;
841
- // Array#indexOf ignores holes, Array#includes - not
842
- } else for (;length > index; index++) {
843
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
844
- } return !IS_INCLUDES && -1;
845
- };
846
- };
847
-
848
- var arrayIncludes = {
849
- // `Array.prototype.includes` method
850
- // https://tc39.es/ecma262/#sec-array.prototype.includes
851
- includes: createMethod$1(true),
852
- // `Array.prototype.indexOf` method
853
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
854
- indexOf: createMethod$1(false)
855
- };
856
-
857
- var uncurryThis$9 = functionUncurryThis;
858
- var hasOwn$6 = hasOwnProperty_1;
859
- var toIndexedObject$2 = toIndexedObject$5;
860
- var indexOf = arrayIncludes.indexOf;
861
- var hiddenKeys$2 = hiddenKeys$4;
862
-
863
- var push = uncurryThis$9([].push);
864
-
865
- var objectKeysInternal = function (object, names) {
866
- var O = toIndexedObject$2(object);
867
- var i = 0;
868
- var result = [];
869
- var key;
870
- for (key in O) !hasOwn$6(hiddenKeys$2, key) && hasOwn$6(O, key) && push(result, key);
871
- // Don't enum bug & hidden keys
872
- while (names.length > i) if (hasOwn$6(O, key = names[i++])) {
873
- ~indexOf(result, key) || push(result, key);
874
- }
875
- return result;
876
- };
877
-
878
- // IE8- don't enum bug keys
879
- var enumBugKeys$3 = [
880
- 'constructor',
881
- 'hasOwnProperty',
882
- 'isPrototypeOf',
883
- 'propertyIsEnumerable',
884
- 'toLocaleString',
885
- 'toString',
886
- 'valueOf'
887
- ];
888
-
889
- var internalObjectKeys$1 = objectKeysInternal;
890
- var enumBugKeys$2 = enumBugKeys$3;
891
-
892
- var hiddenKeys$1 = enumBugKeys$2.concat('length', 'prototype');
893
-
894
- // `Object.getOwnPropertyNames` method
895
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
896
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
897
- objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
898
- return internalObjectKeys$1(O, hiddenKeys$1);
899
- };
900
-
901
- var objectGetOwnPropertySymbols = {};
902
-
903
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
904
- objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
905
-
906
- var getBuiltIn$6 = getBuiltIn$8;
907
- var uncurryThis$8 = functionUncurryThis;
908
- var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
909
- var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
910
- var anObject$d = anObject$f;
911
-
912
- var concat$1 = uncurryThis$8([].concat);
913
-
914
- // all object keys, includes non-enumerable and symbols
915
- var ownKeys$1 = getBuiltIn$6('Reflect', 'ownKeys') || function ownKeys(it) {
916
- var keys = getOwnPropertyNamesModule.f(anObject$d(it));
917
- var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
918
- return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
919
- };
920
-
921
- var hasOwn$5 = hasOwnProperty_1;
922
- var ownKeys = ownKeys$1;
923
- var getOwnPropertyDescriptorModule = objectGetOwnPropertyDescriptor;
924
- var definePropertyModule$2 = objectDefineProperty;
925
-
926
- var copyConstructorProperties$2 = function (target, source, exceptions) {
927
- var keys = ownKeys(source);
928
- var defineProperty = definePropertyModule$2.f;
929
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
930
- for (var i = 0; i < keys.length; i++) {
931
- var key = keys[i];
932
- if (!hasOwn$5(target, key) && !(exceptions && hasOwn$5(exceptions, key))) {
933
- defineProperty(target, key, getOwnPropertyDescriptor(source, key));
934
- }
935
- }
936
- };
937
-
938
- var fails$a = fails$i;
939
- var isCallable$b = isCallable$l;
940
-
941
- var replacement = /#|\.prototype\./;
942
-
943
- var isForced$2 = function (feature, detection) {
944
- var value = data[normalize(feature)];
945
- return value === POLYFILL ? true
946
- : value === NATIVE ? false
947
- : isCallable$b(detection) ? fails$a(detection)
948
- : !!detection;
949
- };
950
-
951
- var normalize = isForced$2.normalize = function (string) {
952
- return String(string).replace(replacement, '.').toLowerCase();
953
- };
954
-
955
- var data = isForced$2.data = {};
956
- var NATIVE = isForced$2.NATIVE = 'N';
957
- var POLYFILL = isForced$2.POLYFILL = 'P';
958
-
959
- var isForced_1 = isForced$2;
960
-
961
- var globalThis$b = globalThis_1;
962
- var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
963
- var createNonEnumerableProperty$6 = createNonEnumerableProperty$8;
964
- var defineBuiltIn$5 = defineBuiltIn$6;
965
- var defineGlobalProperty = defineGlobalProperty$3;
966
- var copyConstructorProperties$1 = copyConstructorProperties$2;
967
- var isForced$1 = isForced_1;
968
-
969
- /*
970
- options.target - name of the target object
971
- options.global - target is the global object
972
- options.stat - export as static methods of target
973
- options.proto - export as prototype methods of target
974
- options.real - real prototype method for the `pure` version
975
- options.forced - export even if the native feature is available
976
- options.bind - bind methods to the target, required for the `pure` version
977
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
978
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
979
- options.sham - add a flag to not completely full polyfills
980
- options.enumerable - export as enumerable property
981
- options.dontCallGetSet - prevent calling a getter on target
982
- options.name - the .name of the function if it does not match the key
983
- */
984
- var _export = function (options, source) {
985
- var TARGET = options.target;
986
- var GLOBAL = options.global;
987
- var STATIC = options.stat;
988
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
989
- if (GLOBAL) {
990
- target = globalThis$b;
991
- } else if (STATIC) {
992
- target = globalThis$b[TARGET] || defineGlobalProperty(TARGET, {});
993
- } else {
994
- target = globalThis$b[TARGET] && globalThis$b[TARGET].prototype;
995
- }
996
- if (target) for (key in source) {
997
- sourceProperty = source[key];
998
- if (options.dontCallGetSet) {
999
- descriptor = getOwnPropertyDescriptor$2(target, key);
1000
- targetProperty = descriptor && descriptor.value;
1001
- } else targetProperty = target[key];
1002
- FORCED = isForced$1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
1003
- // contained in target
1004
- if (!FORCED && targetProperty !== undefined) {
1005
- if (typeof sourceProperty == typeof targetProperty) continue;
1006
- copyConstructorProperties$1(sourceProperty, targetProperty);
1007
- }
1008
- // add a flag to not completely full polyfills
1009
- if (options.sham || (targetProperty && targetProperty.sham)) {
1010
- createNonEnumerableProperty$6(sourceProperty, 'sham', true);
1011
- }
1012
- defineBuiltIn$5(target, key, sourceProperty, options);
1013
- }
1014
- };
1015
-
1016
- var objectDefineProperties = {};
1017
-
1018
- var internalObjectKeys = objectKeysInternal;
1019
- var enumBugKeys$1 = enumBugKeys$3;
1020
-
1021
- // `Object.keys` method
1022
- // https://tc39.es/ecma262/#sec-object.keys
1023
- // eslint-disable-next-line es/no-object-keys -- safe
1024
- var objectKeys$2 = Object.keys || function keys(O) {
1025
- return internalObjectKeys(O, enumBugKeys$1);
1026
- };
1027
-
1028
- var DESCRIPTORS$8 = descriptors;
1029
- var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
1030
- var definePropertyModule$1 = objectDefineProperty;
1031
- var anObject$c = anObject$f;
1032
- var toIndexedObject$1 = toIndexedObject$5;
1033
- var objectKeys$1 = objectKeys$2;
1034
-
1035
- // `Object.defineProperties` method
1036
- // https://tc39.es/ecma262/#sec-object.defineproperties
1037
- // eslint-disable-next-line es/no-object-defineproperties -- safe
1038
- objectDefineProperties.f = DESCRIPTORS$8 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
1039
- anObject$c(O);
1040
- var props = toIndexedObject$1(Properties);
1041
- var keys = objectKeys$1(Properties);
1042
- var length = keys.length;
1043
- var index = 0;
1044
- var key;
1045
- while (length > index) definePropertyModule$1.f(O, key = keys[index++], props[key]);
1046
- return O;
1047
- };
1048
-
1049
- var getBuiltIn$5 = getBuiltIn$8;
1050
-
1051
- var html$2 = getBuiltIn$5('document', 'documentElement');
1052
-
1053
- /* global ActiveXObject -- old IE, WSH */
1054
- var anObject$b = anObject$f;
1055
- var definePropertiesModule = objectDefineProperties;
1056
- var enumBugKeys = enumBugKeys$3;
1057
- var hiddenKeys = hiddenKeys$4;
1058
- var html$1 = html$2;
1059
- var documentCreateElement$1 = documentCreateElement$2;
1060
- var sharedKey$1 = sharedKey$3;
1061
-
1062
- var GT = '>';
1063
- var LT = '<';
1064
- var PROTOTYPE = 'prototype';
1065
- var SCRIPT = 'script';
1066
- var IE_PROTO$1 = sharedKey$1('IE_PROTO');
1067
-
1068
- var EmptyConstructor = function () { /* empty */ };
1069
-
1070
- var scriptTag = function (content) {
1071
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
1072
- };
1073
-
1074
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
1075
- var NullProtoObjectViaActiveX = function (activeXDocument) {
1076
- activeXDocument.write(scriptTag(''));
1077
- activeXDocument.close();
1078
- var temp = activeXDocument.parentWindow.Object;
1079
- // eslint-disable-next-line no-useless-assignment -- avoid memory leak
1080
- activeXDocument = null;
1081
- return temp;
1082
- };
1083
-
1084
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
1085
- var NullProtoObjectViaIFrame = function () {
1086
- // Thrash, waste and sodomy: IE GC bug
1087
- var iframe = documentCreateElement$1('iframe');
1088
- var JS = 'java' + SCRIPT + ':';
1089
- var iframeDocument;
1090
- iframe.style.display = 'none';
1091
- html$1.appendChild(iframe);
1092
- // https://github.com/zloirock/core-js/issues/475
1093
- iframe.src = String(JS);
1094
- iframeDocument = iframe.contentWindow.document;
1095
- iframeDocument.open();
1096
- iframeDocument.write(scriptTag('document.F=Object'));
1097
- iframeDocument.close();
1098
- return iframeDocument.F;
1099
- };
1100
-
1101
- // Check for document.domain and active x support
1102
- // No need to use active x approach when document.domain is not set
1103
- // see https://github.com/es-shims/es5-shim/issues/150
1104
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
1105
- // avoid IE GC bug
1106
- var activeXDocument;
1107
- var NullProtoObject = function () {
1108
- try {
1109
- activeXDocument = new ActiveXObject('htmlfile');
1110
- } catch (error) { /* ignore */ }
1111
- NullProtoObject = typeof document != 'undefined'
1112
- ? document.domain && activeXDocument
1113
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
1114
- : NullProtoObjectViaIFrame()
1115
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
1116
- var length = enumBugKeys.length;
1117
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
1118
- return NullProtoObject();
1119
- };
1120
-
1121
- hiddenKeys[IE_PROTO$1] = true;
1122
-
1123
- // `Object.create` method
1124
- // https://tc39.es/ecma262/#sec-object.create
1125
- // eslint-disable-next-line es/no-object-create -- safe
1126
- var objectCreate = Object.create || function create(O, Properties) {
1127
- var result;
1128
- if (O !== null) {
1129
- EmptyConstructor[PROTOTYPE] = anObject$b(O);
1130
- result = new EmptyConstructor();
1131
- EmptyConstructor[PROTOTYPE] = null;
1132
- // add "__proto__" for Object.getPrototypeOf polyfill
1133
- result[IE_PROTO$1] = O;
1134
- } else result = NullProtoObject();
1135
- return Properties === undefined ? result : definePropertiesModule.f(result, Properties);
1136
- };
1137
-
1138
- var wellKnownSymbol$g = wellKnownSymbol$i;
1139
- var create$2 = objectCreate;
1140
- var defineProperty$5 = objectDefineProperty.f;
1141
-
1142
- var UNSCOPABLES = wellKnownSymbol$g('unscopables');
1143
- var ArrayPrototype$1 = Array.prototype;
1144
-
1145
- // Array.prototype[@@unscopables]
1146
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1147
- if (ArrayPrototype$1[UNSCOPABLES] === undefined) {
1148
- defineProperty$5(ArrayPrototype$1, UNSCOPABLES, {
1149
- configurable: true,
1150
- value: create$2(null)
1151
- });
1152
- }
1153
-
1154
- // add a key to Array.prototype[@@unscopables]
1155
- var addToUnscopables$2 = function (key) {
1156
- ArrayPrototype$1[UNSCOPABLES][key] = true;
1157
- };
1158
-
1159
- var $$i = _export;
1160
- var $includes = arrayIncludes.includes;
1161
- var fails$9 = fails$i;
1162
- var addToUnscopables$1 = addToUnscopables$2;
1163
-
1164
- // FF99+ bug
1165
- var BROKEN_ON_SPARSE = fails$9(function () {
1166
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
1167
- return !Array(1).includes();
1168
- });
1169
-
1170
- // `Array.prototype.includes` method
1171
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1172
- $$i({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1173
- includes: function includes(el /* , fromIndex = 0 */) {
1174
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1175
- }
1176
- });
1177
-
1178
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1179
- addToUnscopables$1('includes');
1180
-
1181
- var iterators = {};
1182
-
1183
- var fails$8 = fails$i;
1184
-
1185
- var correctPrototypeGetter = !fails$8(function () {
1186
- function F() { /* empty */ }
1187
- F.prototype.constructor = null;
1188
- // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
1189
- return Object.getPrototypeOf(new F()) !== F.prototype;
1190
- });
1191
-
1192
- var hasOwn$4 = hasOwnProperty_1;
1193
- var isCallable$a = isCallable$l;
1194
- var toObject$3 = toObject$5;
1195
- var sharedKey = sharedKey$3;
1196
- var CORRECT_PROTOTYPE_GETTER = correctPrototypeGetter;
1197
-
1198
- var IE_PROTO = sharedKey('IE_PROTO');
1199
- var $Object$1 = Object;
1200
- var ObjectPrototype = $Object$1.prototype;
1201
-
1202
- // `Object.getPrototypeOf` method
1203
- // https://tc39.es/ecma262/#sec-object.getprototypeof
1204
- // eslint-disable-next-line es/no-object-getprototypeof -- safe
1205
- var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf : function (O) {
1206
- var object = toObject$3(O);
1207
- if (hasOwn$4(object, IE_PROTO)) return object[IE_PROTO];
1208
- var constructor = object.constructor;
1209
- if (isCallable$a(constructor) && object instanceof constructor) {
1210
- return constructor.prototype;
1211
- } return object instanceof $Object$1 ? ObjectPrototype : null;
1212
- };
1213
-
1214
- var fails$7 = fails$i;
1215
- var isCallable$9 = isCallable$l;
1216
- var isObject$7 = isObject$d;
1217
- var getPrototypeOf$2 = objectGetPrototypeOf;
1218
- var defineBuiltIn$4 = defineBuiltIn$6;
1219
- var wellKnownSymbol$f = wellKnownSymbol$i;
1220
-
1221
- var ITERATOR$6 = wellKnownSymbol$f('iterator');
1222
- var BUGGY_SAFARI_ITERATORS$1 = false;
1223
-
1224
- // `%IteratorPrototype%` object
1225
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
1226
- var IteratorPrototype$4, PrototypeOfArrayIteratorPrototype, arrayIterator;
1227
-
1228
- /* eslint-disable es/no-array-prototype-keys -- safe */
1229
- if ([].keys) {
1230
- arrayIterator = [].keys();
1231
- // Safari 8 has buggy iterators w/o `next`
1232
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
1233
- else {
1234
- PrototypeOfArrayIteratorPrototype = getPrototypeOf$2(getPrototypeOf$2(arrayIterator));
1235
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$4 = PrototypeOfArrayIteratorPrototype;
1236
- }
1237
- }
1238
-
1239
- var NEW_ITERATOR_PROTOTYPE = !isObject$7(IteratorPrototype$4) || fails$7(function () {
1240
- var test = {};
1241
- // FF44- legacy iterators case
1242
- return IteratorPrototype$4[ITERATOR$6].call(test) !== test;
1243
- });
1244
-
1245
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$4 = {};
1246
-
1247
- // `%IteratorPrototype%[@@iterator]()` method
1248
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
1249
- if (!isCallable$9(IteratorPrototype$4[ITERATOR$6])) {
1250
- defineBuiltIn$4(IteratorPrototype$4, ITERATOR$6, function () {
1251
- return this;
1252
- });
1253
- }
1254
-
1255
- var iteratorsCore = {
1256
- IteratorPrototype: IteratorPrototype$4,
1257
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
1258
- };
1259
-
1260
- var defineProperty$4 = objectDefineProperty.f;
1261
- var hasOwn$3 = hasOwnProperty_1;
1262
- var wellKnownSymbol$e = wellKnownSymbol$i;
1263
-
1264
- var TO_STRING_TAG$4 = wellKnownSymbol$e('toStringTag');
1265
-
1266
- var setToStringTag$4 = function (target, TAG, STATIC) {
1267
- if (target && !STATIC) target = target.prototype;
1268
- if (target && !hasOwn$3(target, TO_STRING_TAG$4)) {
1269
- defineProperty$4(target, TO_STRING_TAG$4, { configurable: true, value: TAG });
1270
- }
1271
- };
1272
-
1273
- var IteratorPrototype$3 = iteratorsCore.IteratorPrototype;
1274
- var create$1 = objectCreate;
1275
- var createPropertyDescriptor$2 = createPropertyDescriptor$5;
1276
- var setToStringTag$3 = setToStringTag$4;
1277
- var Iterators$4 = iterators;
1278
-
1279
- var returnThis$1 = function () { return this; };
1280
-
1281
- var iteratorCreateConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
1282
- var TO_STRING_TAG = NAME + ' Iterator';
1283
- IteratorConstructor.prototype = create$1(IteratorPrototype$3, { next: createPropertyDescriptor$2(+!ENUMERABLE_NEXT, next) });
1284
- setToStringTag$3(IteratorConstructor, TO_STRING_TAG, false);
1285
- Iterators$4[TO_STRING_TAG] = returnThis$1;
1286
- return IteratorConstructor;
1287
- };
1288
-
1289
- var uncurryThis$7 = functionUncurryThis;
1290
- var aCallable$b = aCallable$d;
1291
-
1292
- var functionUncurryThisAccessor = function (object, key, method) {
1293
- try {
1294
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
1295
- return uncurryThis$7(aCallable$b(Object.getOwnPropertyDescriptor(object, key)[method]));
1296
- } catch (error) { /* empty */ }
1297
- };
1298
-
1299
- var isObject$6 = isObject$d;
1300
-
1301
- var isPossiblePrototype$1 = function (argument) {
1302
- return isObject$6(argument) || argument === null;
1303
- };
1304
-
1305
- var isPossiblePrototype = isPossiblePrototype$1;
1306
-
1307
- var $String$1 = String;
1308
- var $TypeError$c = TypeError;
1309
-
1310
- var aPossiblePrototype$1 = function (argument) {
1311
- if (isPossiblePrototype(argument)) return argument;
1312
- throw new $TypeError$c("Can't set " + $String$1(argument) + ' as a prototype');
1313
- };
1314
-
1315
- /* eslint-disable no-proto -- safe */
1316
- var uncurryThisAccessor = functionUncurryThisAccessor;
1317
- var isObject$5 = isObject$d;
1318
- var requireObjectCoercible$1 = requireObjectCoercible$4;
1319
- var aPossiblePrototype = aPossiblePrototype$1;
1320
-
1321
- // `Object.setPrototypeOf` method
1322
- // https://tc39.es/ecma262/#sec-object.setprototypeof
1323
- // Works with __proto__ only. Old v8 can't work with null proto objects.
1324
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
1325
- var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
1326
- var CORRECT_SETTER = false;
1327
- var test = {};
1328
- var setter;
1329
- try {
1330
- setter = uncurryThisAccessor(Object.prototype, '__proto__', 'set');
1331
- setter(test, []);
1332
- CORRECT_SETTER = test instanceof Array;
1333
- } catch (error) { /* empty */ }
1334
- return function setPrototypeOf(O, proto) {
1335
- requireObjectCoercible$1(O);
1336
- aPossiblePrototype(proto);
1337
- if (!isObject$5(O)) return O;
1338
- if (CORRECT_SETTER) setter(O, proto);
1339
- else O.__proto__ = proto;
1340
- return O;
1341
- };
1342
- }() : undefined);
1343
-
1344
- var $$h = _export;
1345
- var call$b = functionCall;
1346
- var FunctionName = functionName;
1347
- var isCallable$8 = isCallable$l;
1348
- var createIteratorConstructor = iteratorCreateConstructor;
1349
- var getPrototypeOf$1 = objectGetPrototypeOf;
1350
- var setPrototypeOf$3 = objectSetPrototypeOf;
1351
- var setToStringTag$2 = setToStringTag$4;
1352
- var createNonEnumerableProperty$5 = createNonEnumerableProperty$8;
1353
- var defineBuiltIn$3 = defineBuiltIn$6;
1354
- var wellKnownSymbol$d = wellKnownSymbol$i;
1355
- var Iterators$3 = iterators;
1356
- var IteratorsCore = iteratorsCore;
1357
-
1358
- var PROPER_FUNCTION_NAME = FunctionName.PROPER;
1359
- var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;
1360
- var IteratorPrototype$2 = IteratorsCore.IteratorPrototype;
1361
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
1362
- var ITERATOR$5 = wellKnownSymbol$d('iterator');
1363
- var KEYS = 'keys';
1364
- var VALUES = 'values';
1365
- var ENTRIES = 'entries';
1366
-
1367
- var returnThis = function () { return this; };
1368
-
1369
- var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
1370
- createIteratorConstructor(IteratorConstructor, NAME, next);
1371
-
1372
- var getIterationMethod = function (KIND) {
1373
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
1374
- if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND];
1375
-
1376
- switch (KIND) {
1377
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
1378
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
1379
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
1380
- }
1381
-
1382
- return function () { return new IteratorConstructor(this); };
1383
- };
1384
-
1385
- var TO_STRING_TAG = NAME + ' Iterator';
1386
- var INCORRECT_VALUES_NAME = false;
1387
- var IterablePrototype = Iterable.prototype;
1388
- var nativeIterator = IterablePrototype[ITERATOR$5]
1389
- || IterablePrototype['@@iterator']
1390
- || DEFAULT && IterablePrototype[DEFAULT];
1391
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
1392
- var anyNativeIterator = NAME === 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
1393
- var CurrentIteratorPrototype, methods, KEY;
1394
-
1395
- // fix native
1396
- if (anyNativeIterator) {
1397
- CurrentIteratorPrototype = getPrototypeOf$1(anyNativeIterator.call(new Iterable()));
1398
- if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
1399
- if (getPrototypeOf$1(CurrentIteratorPrototype) !== IteratorPrototype$2) {
1400
- if (setPrototypeOf$3) {
1401
- setPrototypeOf$3(CurrentIteratorPrototype, IteratorPrototype$2);
1402
- } else if (!isCallable$8(CurrentIteratorPrototype[ITERATOR$5])) {
1403
- defineBuiltIn$3(CurrentIteratorPrototype, ITERATOR$5, returnThis);
1404
- }
1405
- }
1406
- // Set @@toStringTag to native iterators
1407
- setToStringTag$2(CurrentIteratorPrototype, TO_STRING_TAG, true);
1408
- }
1409
- }
1410
-
1411
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
1412
- if (PROPER_FUNCTION_NAME && DEFAULT === VALUES && nativeIterator && nativeIterator.name !== VALUES) {
1413
- if (CONFIGURABLE_FUNCTION_NAME) {
1414
- createNonEnumerableProperty$5(IterablePrototype, 'name', VALUES);
1415
- } else {
1416
- INCORRECT_VALUES_NAME = true;
1417
- defaultIterator = function values() { return call$b(nativeIterator, this); };
1418
- }
1419
- }
1420
-
1421
- // export additional methods
1422
- if (DEFAULT) {
1423
- methods = {
1424
- values: getIterationMethod(VALUES),
1425
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
1426
- entries: getIterationMethod(ENTRIES)
1427
- };
1428
- if (FORCED) for (KEY in methods) {
1429
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
1430
- defineBuiltIn$3(IterablePrototype, KEY, methods[KEY]);
1431
- }
1432
- } else $$h({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
1433
- }
1434
-
1435
- // define iterator
1436
- if (IterablePrototype[ITERATOR$5] !== defaultIterator) {
1437
- defineBuiltIn$3(IterablePrototype, ITERATOR$5, defaultIterator, { name: DEFAULT });
1438
- }
1439
- Iterators$3[NAME] = defaultIterator;
1440
-
1441
- return methods;
1442
- };
1443
-
1444
- // `CreateIterResultObject` abstract operation
1445
- // https://tc39.es/ecma262/#sec-createiterresultobject
1446
- var createIterResultObject$2 = function (value, done) {
1447
- return { value: value, done: done };
1448
- };
1449
-
1450
- var toIndexedObject = toIndexedObject$5;
1451
- var addToUnscopables = addToUnscopables$2;
1452
- var Iterators$2 = iterators;
1453
- var InternalStateModule$2 = internalState;
1454
- var defineProperty$3 = objectDefineProperty.f;
1455
- var defineIterator = iteratorDefine;
1456
- var createIterResultObject$1 = createIterResultObject$2;
1457
- var DESCRIPTORS$7 = descriptors;
1458
-
1459
- var ARRAY_ITERATOR = 'Array Iterator';
1460
- var setInternalState$2 = InternalStateModule$2.set;
1461
- var getInternalState = InternalStateModule$2.getterFor(ARRAY_ITERATOR);
1462
-
1463
- // `Array.prototype.entries` method
1464
- // https://tc39.es/ecma262/#sec-array.prototype.entries
1465
- // `Array.prototype.keys` method
1466
- // https://tc39.es/ecma262/#sec-array.prototype.keys
1467
- // `Array.prototype.values` method
1468
- // https://tc39.es/ecma262/#sec-array.prototype.values
1469
- // `Array.prototype[@@iterator]` method
1470
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
1471
- // `CreateArrayIterator` internal method
1472
- // https://tc39.es/ecma262/#sec-createarrayiterator
1473
- var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
1474
- setInternalState$2(this, {
1475
- type: ARRAY_ITERATOR,
1476
- target: toIndexedObject(iterated), // target
1477
- index: 0, // next index
1478
- kind: kind // kind
1479
- });
1480
- // `%ArrayIteratorPrototype%.next` method
1481
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
1482
- }, function () {
1483
- var state = getInternalState(this);
1484
- var target = state.target;
1485
- var index = state.index++;
1486
- if (!target || index >= target.length) {
1487
- state.target = null;
1488
- return createIterResultObject$1(undefined, true);
1489
- }
1490
- switch (state.kind) {
1491
- case 'keys': return createIterResultObject$1(index, false);
1492
- case 'values': return createIterResultObject$1(target[index], false);
1493
- } return createIterResultObject$1([index, target[index]], false);
1494
- }, 'values');
1495
-
1496
- // argumentsList[@@iterator] is %ArrayProto_values%
1497
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
1498
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
1499
- var values = Iterators$2.Arguments = Iterators$2.Array;
1500
-
1501
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1502
- addToUnscopables('keys');
1503
- addToUnscopables('values');
1504
- addToUnscopables('entries');
1505
-
1506
- // V8 ~ Chrome 45- bug
1507
- if (DESCRIPTORS$7 && values.name !== 'values') try {
1508
- defineProperty$3(values, 'name', { value: 'values' });
1509
- } catch (error) { /* empty */ }
1510
-
1511
- var aCallable$a = aCallable$d;
1512
- var toObject$2 = toObject$5;
1513
- var IndexedObject$1 = indexedObject;
1514
- var lengthOfArrayLike$2 = lengthOfArrayLike$4;
1515
-
1516
- var $TypeError$b = TypeError;
1517
-
1518
- var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
1519
-
1520
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
1521
- var createMethod = function (IS_RIGHT) {
1522
- return function (that, callbackfn, argumentsLength, memo) {
1523
- var O = toObject$2(that);
1524
- var self = IndexedObject$1(O);
1525
- var length = lengthOfArrayLike$2(O);
1526
- aCallable$a(callbackfn);
1527
- if (length === 0 && argumentsLength < 2) throw new $TypeError$b(REDUCE_EMPTY);
1528
- var index = IS_RIGHT ? length - 1 : 0;
1529
- var i = IS_RIGHT ? -1 : 1;
1530
- if (argumentsLength < 2) while (true) {
1531
- if (index in self) {
1532
- memo = self[index];
1533
- index += i;
1534
- break;
1535
- }
1536
- index += i;
1537
- if (IS_RIGHT ? index < 0 : length <= index) {
1538
- throw new $TypeError$b(REDUCE_EMPTY);
1539
- }
1540
- }
1541
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
1542
- memo = callbackfn(memo, self[index], index, O);
1543
- }
1544
- return memo;
1545
- };
1546
- };
1547
-
1548
- var arrayReduce = {
1549
- // `Array.prototype.reduce` method
1550
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1551
- left: createMethod(false),
1552
- // `Array.prototype.reduceRight` method
1553
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
1554
- right: createMethod(true)
1555
- };
1556
-
1557
- var fails$6 = fails$i;
1558
-
1559
- var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
1560
- var method = [][METHOD_NAME];
1561
- return !!method && fails$6(function () {
1562
- // eslint-disable-next-line no-useless-call -- required for testing
1563
- method.call(null, argument || function () { return 1; }, 1);
1564
- });
1565
- };
1566
-
1567
- /* global Bun, Deno -- detection */
1568
- var globalThis$a = globalThis_1;
1569
- var userAgent$3 = environmentUserAgent;
1570
- var classof$6 = classofRaw$2;
1571
-
1572
- var userAgentStartsWith = function (string) {
1573
- return userAgent$3.slice(0, string.length) === string;
1574
- };
1575
-
1576
- var environment = (function () {
1577
- if (userAgentStartsWith('Bun/')) return 'BUN';
1578
- if (userAgentStartsWith('Cloudflare-Workers')) return 'CLOUDFLARE';
1579
- if (userAgentStartsWith('Deno/')) return 'DENO';
1580
- if (userAgentStartsWith('Node.js/')) return 'NODE';
1581
- if (globalThis$a.Bun && typeof Bun.version == 'string') return 'BUN';
1582
- if (globalThis$a.Deno && typeof Deno.version == 'object') return 'DENO';
1583
- if (classof$6(globalThis$a.process) === 'process') return 'NODE';
1584
- if (globalThis$a.window && globalThis$a.document) return 'BROWSER';
1585
- return 'REST';
1586
- })();
1587
-
1588
- var ENVIRONMENT$1 = environment;
1589
-
1590
- var environmentIsNode = ENVIRONMENT$1 === 'NODE';
1591
-
1592
- var $$g = _export;
1593
- var $reduce = arrayReduce.left;
1594
- var arrayMethodIsStrict = arrayMethodIsStrict$1;
1595
- var CHROME_VERSION = environmentV8Version;
1596
- var IS_NODE$3 = environmentIsNode;
1597
-
1598
- // Chrome 80-82 has a critical bug
1599
- // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
1600
- var CHROME_BUG = !IS_NODE$3 && CHROME_VERSION > 79 && CHROME_VERSION < 83;
1601
- var FORCED$3 = CHROME_BUG || !arrayMethodIsStrict('reduce');
1602
-
1603
- // `Array.prototype.reduce` method
1604
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
1605
- $$g({ target: 'Array', proto: true, forced: FORCED$3 }, {
1606
- reduce: function reduce(callbackfn /* , initialValue */) {
1607
- var length = arguments.length;
1608
- return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined);
1609
- }
1610
- });
1611
-
1612
- var DESCRIPTORS$6 = descriptors;
1613
- var uncurryThis$6 = functionUncurryThis;
1614
- var call$a = functionCall;
1615
- var fails$5 = fails$i;
1616
- var objectKeys = objectKeys$2;
1617
- var getOwnPropertySymbolsModule = objectGetOwnPropertySymbols;
1618
- var propertyIsEnumerableModule = objectPropertyIsEnumerable;
1619
- var toObject$1 = toObject$5;
1620
- var IndexedObject = indexedObject;
1621
-
1622
- // eslint-disable-next-line es/no-object-assign -- safe
1623
- var $assign = Object.assign;
1624
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
1625
- var defineProperty$2 = Object.defineProperty;
1626
- var concat = uncurryThis$6([].concat);
1627
-
1628
- // `Object.assign` method
1629
- // https://tc39.es/ecma262/#sec-object.assign
1630
- var objectAssign = !$assign || fails$5(function () {
1631
- // should have correct order of operations (Edge bug)
1632
- if (DESCRIPTORS$6 && $assign({ b: 1 }, $assign(defineProperty$2({}, 'a', {
1633
- enumerable: true,
1634
- get: function () {
1635
- defineProperty$2(this, 'b', {
1636
- value: 3,
1637
- enumerable: false
1638
- });
1639
- }
1640
- }), { b: 2 })).b !== 1) return true;
1641
- // should work with symbols and should have deterministic property order (V8 bug)
1642
- var A = {};
1643
- var B = {};
1644
- // eslint-disable-next-line es/no-symbol -- safe
1645
- var symbol = Symbol('assign detection');
1646
- var alphabet = 'abcdefghijklmnopqrst';
1647
- A[symbol] = 7;
1648
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
1649
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
1650
- return $assign({}, A)[symbol] !== 7 || objectKeys($assign({}, B)).join('') !== alphabet;
1651
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
1652
- var T = toObject$1(target);
1653
- var argumentsLength = arguments.length;
1654
- var index = 1;
1655
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
1656
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
1657
- while (argumentsLength > index) {
1658
- var S = IndexedObject(arguments[index++]);
1659
- var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
1660
- var length = keys.length;
1661
- var j = 0;
1662
- var key;
1663
- while (length > j) {
1664
- key = keys[j++];
1665
- if (!DESCRIPTORS$6 || call$a(propertyIsEnumerable, S, key)) T[key] = S[key];
1666
- }
1667
- } return T;
1668
- } : $assign;
1669
-
1670
- var $$f = _export;
1671
- var assign = objectAssign;
1672
-
1673
- // `Object.assign` method
1674
- // https://tc39.es/ecma262/#sec-object.assign
1675
- // eslint-disable-next-line es/no-object-assign -- required for testing
1676
- $$f({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {
1677
- assign: assign
1678
- });
1679
-
1680
- var classofRaw$1 = classofRaw$2;
1681
- var uncurryThis$5 = functionUncurryThis;
1682
-
1683
- var functionUncurryThisClause = function (fn) {
1684
- // Nashorn bug:
1685
- // https://github.com/zloirock/core-js/issues/1128
1686
- // https://github.com/zloirock/core-js/issues/1130
1687
- if (classofRaw$1(fn) === 'Function') return uncurryThis$5(fn);
1688
- };
1689
-
1690
- var uncurryThis$4 = functionUncurryThisClause;
1691
- var aCallable$9 = aCallable$d;
1692
- var NATIVE_BIND$1 = functionBindNative;
1693
-
1694
- var bind$4 = uncurryThis$4(uncurryThis$4.bind);
1695
-
1696
- // optional / simple context binding
1697
- var functionBindContext = function (fn, that) {
1698
- aCallable$9(fn);
1699
- return that === undefined ? fn : NATIVE_BIND$1 ? bind$4(fn, that) : function (/* ...args */) {
1700
- return fn.apply(that, arguments);
1701
- };
1702
- };
1703
-
1704
- var wellKnownSymbol$c = wellKnownSymbol$i;
1705
- var Iterators$1 = iterators;
1706
-
1707
- var ITERATOR$4 = wellKnownSymbol$c('iterator');
1708
- var ArrayPrototype = Array.prototype;
1709
-
1710
- // check on default Array iterator
1711
- var isArrayIteratorMethod$1 = function (it) {
1712
- return it !== undefined && (Iterators$1.Array === it || ArrayPrototype[ITERATOR$4] === it);
1713
- };
1714
-
1715
- var wellKnownSymbol$b = wellKnownSymbol$i;
1716
-
1717
- var TO_STRING_TAG$3 = wellKnownSymbol$b('toStringTag');
1718
- var test = {};
1719
-
1720
- test[TO_STRING_TAG$3] = 'z';
1721
-
1722
- var toStringTagSupport = String(test) === '[object z]';
1723
-
1724
- var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1725
- var isCallable$7 = isCallable$l;
1726
- var classofRaw = classofRaw$2;
1727
- var wellKnownSymbol$a = wellKnownSymbol$i;
1728
-
1729
- var TO_STRING_TAG$2 = wellKnownSymbol$a('toStringTag');
1730
- var $Object = Object;
1731
-
1732
- // ES3 wrong here
1733
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
1734
-
1735
- // fallback for IE11 Script Access Denied error
1736
- var tryGet = function (it, key) {
1737
- try {
1738
- return it[key];
1739
- } catch (error) { /* empty */ }
1740
- };
1741
-
1742
- // getting tag from ES6+ `Object.prototype.toString`
1743
- var classof$5 = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
1744
- var O, tag, result;
1745
- return it === undefined ? 'Undefined' : it === null ? 'Null'
1746
- // @@toStringTag case
1747
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$2)) == 'string' ? tag
1748
- // builtinTag case
1749
- : CORRECT_ARGUMENTS ? classofRaw(O)
1750
- // ES3 arguments fallback
1751
- : (result = classofRaw(O)) === 'Object' && isCallable$7(O.callee) ? 'Arguments' : result;
1752
- };
1753
-
1754
- var classof$4 = classof$5;
1755
- var getMethod$2 = getMethod$4;
1756
- var isNullOrUndefined$1 = isNullOrUndefined$4;
1757
- var Iterators = iterators;
1758
- var wellKnownSymbol$9 = wellKnownSymbol$i;
1759
-
1760
- var ITERATOR$3 = wellKnownSymbol$9('iterator');
1761
-
1762
- var getIteratorMethod$2 = function (it) {
1763
- if (!isNullOrUndefined$1(it)) return getMethod$2(it, ITERATOR$3)
1764
- || getMethod$2(it, '@@iterator')
1765
- || Iterators[classof$4(it)];
1766
- };
1767
-
1768
- var call$9 = functionCall;
1769
- var aCallable$8 = aCallable$d;
1770
- var anObject$a = anObject$f;
1771
- var tryToString$2 = tryToString$4;
1772
- var getIteratorMethod$1 = getIteratorMethod$2;
1773
-
1774
- var $TypeError$a = TypeError;
1775
-
1776
- var getIterator$1 = function (argument, usingIterator) {
1777
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod$1(argument) : usingIterator;
1778
- if (aCallable$8(iteratorMethod)) return anObject$a(call$9(iteratorMethod, argument));
1779
- throw new $TypeError$a(tryToString$2(argument) + ' is not iterable');
1780
- };
1781
-
1782
- var call$8 = functionCall;
1783
- var anObject$9 = anObject$f;
1784
- var getMethod$1 = getMethod$4;
1785
-
1786
- var iteratorClose$3 = function (iterator, kind, value) {
1787
- var innerResult, innerError;
1788
- anObject$9(iterator);
1789
- try {
1790
- innerResult = getMethod$1(iterator, 'return');
1791
- if (!innerResult) {
1792
- if (kind === 'throw') throw value;
1793
- return value;
1794
- }
1795
- innerResult = call$8(innerResult, iterator);
1796
- } catch (error) {
1797
- innerError = true;
1798
- innerResult = error;
1799
- }
1800
- if (kind === 'throw') throw value;
1801
- if (innerError) throw innerResult;
1802
- anObject$9(innerResult);
1803
- return value;
1804
- };
1805
-
1806
- var bind$3 = functionBindContext;
1807
- var call$7 = functionCall;
1808
- var anObject$8 = anObject$f;
1809
- var tryToString$1 = tryToString$4;
1810
- var isArrayIteratorMethod = isArrayIteratorMethod$1;
1811
- var lengthOfArrayLike$1 = lengthOfArrayLike$4;
1812
- var isPrototypeOf$2 = objectIsPrototypeOf;
1813
- var getIterator = getIterator$1;
1814
- var getIteratorMethod = getIteratorMethod$2;
1815
- var iteratorClose$2 = iteratorClose$3;
1816
-
1817
- var $TypeError$9 = TypeError;
1818
-
1819
- var Result = function (stopped, result) {
1820
- this.stopped = stopped;
1821
- this.result = result;
1822
- };
1823
-
1824
- var ResultPrototype = Result.prototype;
1825
-
1826
- var iterate$5 = function (iterable, unboundFunction, options) {
1827
- var that = options && options.that;
1828
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
1829
- var IS_RECORD = !!(options && options.IS_RECORD);
1830
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
1831
- var INTERRUPTED = !!(options && options.INTERRUPTED);
1832
- var fn = bind$3(unboundFunction, that);
1833
- var iterator, iterFn, index, length, result, next, step;
1834
-
1835
- var stop = function (condition) {
1836
- if (iterator) iteratorClose$2(iterator, 'normal', condition);
1837
- return new Result(true, condition);
1838
- };
1839
-
1840
- var callFn = function (value) {
1841
- if (AS_ENTRIES) {
1842
- anObject$8(value);
1843
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
1844
- } return INTERRUPTED ? fn(value, stop) : fn(value);
1845
- };
1846
-
1847
- if (IS_RECORD) {
1848
- iterator = iterable.iterator;
1849
- } else if (IS_ITERATOR) {
1850
- iterator = iterable;
1851
- } else {
1852
- iterFn = getIteratorMethod(iterable);
1853
- if (!iterFn) throw new $TypeError$9(tryToString$1(iterable) + ' is not iterable');
1854
- // optimisation for array iterators
1855
- if (isArrayIteratorMethod(iterFn)) {
1856
- for (index = 0, length = lengthOfArrayLike$1(iterable); length > index; index++) {
1857
- result = callFn(iterable[index]);
1858
- if (result && isPrototypeOf$2(ResultPrototype, result)) return result;
1859
- } return new Result(false);
1860
- }
1861
- iterator = getIterator(iterable, iterFn);
1862
- }
1863
-
1864
- next = IS_RECORD ? iterable.next : iterator.next;
1865
- while (!(step = call$7(next, iterator)).done) {
1866
- try {
1867
- result = callFn(step.value);
1868
- } catch (error) {
1869
- iteratorClose$2(iterator, 'throw', error);
1870
- }
1871
- if (typeof result == 'object' && result && isPrototypeOf$2(ResultPrototype, result)) return result;
1872
- } return new Result(false);
1873
- };
1874
-
1875
- var DESCRIPTORS$5 = descriptors;
1876
- var definePropertyModule = objectDefineProperty;
1877
- var createPropertyDescriptor$1 = createPropertyDescriptor$5;
1878
-
1879
- var createProperty$2 = function (object, key, value) {
1880
- if (DESCRIPTORS$5) definePropertyModule.f(object, key, createPropertyDescriptor$1(0, value));
1881
- else object[key] = value;
1882
- };
1883
-
1884
- var $$e = _export;
1885
- var iterate$4 = iterate$5;
1886
- var createProperty$1 = createProperty$2;
1887
-
1888
- // `Object.fromEntries` method
1889
- // https://tc39.es/ecma262/#sec-object.fromentries
1890
- $$e({ target: 'Object', stat: true }, {
1891
- fromEntries: function fromEntries(iterable) {
1892
- var obj = {};
1893
- iterate$4(iterable, function (k, v) {
1894
- createProperty$1(obj, k, v);
1895
- }, { AS_ENTRIES: true });
1896
- return obj;
1897
- }
1898
- });
1899
-
1900
- var makeBuiltIn = makeBuiltInExports;
1901
- var defineProperty$1 = objectDefineProperty;
1902
-
1903
- var defineBuiltInAccessor$2 = function (target, name, descriptor) {
1904
- if (descriptor.get) makeBuiltIn(descriptor.get, name, { getter: true });
1905
- if (descriptor.set) makeBuiltIn(descriptor.set, name, { setter: true });
1906
- return defineProperty$1.f(target, name, descriptor);
1907
- };
1908
-
1909
- var getBuiltIn$4 = getBuiltIn$8;
1910
- var defineBuiltInAccessor$1 = defineBuiltInAccessor$2;
1911
- var wellKnownSymbol$8 = wellKnownSymbol$i;
1912
- var DESCRIPTORS$4 = descriptors;
1913
-
1914
- var SPECIES$2 = wellKnownSymbol$8('species');
1915
-
1916
- var setSpecies$1 = function (CONSTRUCTOR_NAME) {
1917
- var Constructor = getBuiltIn$4(CONSTRUCTOR_NAME);
1918
-
1919
- if (DESCRIPTORS$4 && Constructor && !Constructor[SPECIES$2]) {
1920
- defineBuiltInAccessor$1(Constructor, SPECIES$2, {
1921
- configurable: true,
1922
- get: function () { return this; }
1923
- });
1924
- }
1925
- };
1926
-
1927
- var isPrototypeOf$1 = objectIsPrototypeOf;
1928
-
1929
- var $TypeError$8 = TypeError;
1930
-
1931
- var anInstance$2 = function (it, Prototype) {
1932
- if (isPrototypeOf$1(Prototype, it)) return it;
1933
- throw new $TypeError$8('Incorrect invocation');
1934
- };
1935
-
1936
- var uncurryThis$3 = functionUncurryThis;
1937
- var fails$4 = fails$i;
1938
- var isCallable$6 = isCallable$l;
1939
- var classof$3 = classof$5;
1940
- var getBuiltIn$3 = getBuiltIn$8;
1941
- var inspectSource$1 = inspectSource$3;
1942
-
1943
- var noop = function () { /* empty */ };
1944
- var construct = getBuiltIn$3('Reflect', 'construct');
1945
- var constructorRegExp = /^\s*(?:class|function)\b/;
1946
- var exec = uncurryThis$3(constructorRegExp.exec);
1947
- var INCORRECT_TO_STRING = !constructorRegExp.test(noop);
1948
-
1949
- var isConstructorModern = function isConstructor(argument) {
1950
- if (!isCallable$6(argument)) return false;
1951
- try {
1952
- construct(noop, [], argument);
1953
- return true;
1954
- } catch (error) {
1955
- return false;
1956
- }
1957
- };
1958
-
1959
- var isConstructorLegacy = function isConstructor(argument) {
1960
- if (!isCallable$6(argument)) return false;
1961
- switch (classof$3(argument)) {
1962
- case 'AsyncFunction':
1963
- case 'GeneratorFunction':
1964
- case 'AsyncGeneratorFunction': return false;
1965
- }
1966
- try {
1967
- // we can't check .prototype since constructors produced by .bind haven't it
1968
- // `Function#toString` throws on some built-it function in some legacy engines
1969
- // (for example, `DOMQuad` and similar in FF41-)
1970
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource$1(argument));
1971
- } catch (error) {
1972
- return true;
1973
- }
1974
- };
1975
-
1976
- isConstructorLegacy.sham = true;
1977
-
1978
- // `IsConstructor` abstract operation
1979
- // https://tc39.es/ecma262/#sec-isconstructor
1980
- var isConstructor$1 = !construct || fails$4(function () {
1981
- var called;
1982
- return isConstructorModern(isConstructorModern.call)
1983
- || !isConstructorModern(Object)
1984
- || !isConstructorModern(function () { called = true; })
1985
- || called;
1986
- }) ? isConstructorLegacy : isConstructorModern;
1987
-
1988
- var isConstructor = isConstructor$1;
1989
- var tryToString = tryToString$4;
1990
-
1991
- var $TypeError$7 = TypeError;
1992
-
1993
- // `Assert: IsConstructor(argument) is true`
1994
- var aConstructor$1 = function (argument) {
1995
- if (isConstructor(argument)) return argument;
1996
- throw new $TypeError$7(tryToString(argument) + ' is not a constructor');
1997
- };
1998
-
1999
- var anObject$7 = anObject$f;
2000
- var aConstructor = aConstructor$1;
2001
- var isNullOrUndefined = isNullOrUndefined$4;
2002
- var wellKnownSymbol$7 = wellKnownSymbol$i;
2003
-
2004
- var SPECIES$1 = wellKnownSymbol$7('species');
2005
-
2006
- // `SpeciesConstructor` abstract operation
2007
- // https://tc39.es/ecma262/#sec-speciesconstructor
2008
- var speciesConstructor$1 = function (O, defaultConstructor) {
2009
- var C = anObject$7(O).constructor;
2010
- var S;
2011
- return C === undefined || isNullOrUndefined(S = anObject$7(C)[SPECIES$1]) ? defaultConstructor : aConstructor(S);
2012
- };
2013
-
2014
- var NATIVE_BIND = functionBindNative;
2015
-
2016
- var FunctionPrototype = Function.prototype;
2017
- var apply$2 = FunctionPrototype.apply;
2018
- var call$6 = FunctionPrototype.call;
2019
-
2020
- // eslint-disable-next-line es/no-function-prototype-bind, es/no-reflect -- safe
2021
- var functionApply = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call$6.bind(apply$2) : function () {
2022
- return call$6.apply(apply$2, arguments);
2023
- });
2024
-
2025
- var uncurryThis$2 = functionUncurryThis;
2026
-
2027
- var arraySlice$1 = uncurryThis$2([].slice);
2028
-
2029
- var $TypeError$6 = TypeError;
2030
-
2031
- var validateArgumentsLength$1 = function (passed, required) {
2032
- if (passed < required) throw new $TypeError$6('Not enough arguments');
2033
- return passed;
2034
- };
2035
-
2036
- var userAgent$2 = environmentUserAgent;
2037
-
2038
- // eslint-disable-next-line redos/no-vulnerable -- safe
2039
- var environmentIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent$2);
2040
-
2041
- var globalThis$9 = globalThis_1;
2042
- var apply$1 = functionApply;
2043
- var bind$2 = functionBindContext;
2044
- var isCallable$5 = isCallable$l;
2045
- var hasOwn$2 = hasOwnProperty_1;
2046
- var fails$3 = fails$i;
2047
- var html = html$2;
2048
- var arraySlice = arraySlice$1;
2049
- var createElement = documentCreateElement$2;
2050
- var validateArgumentsLength = validateArgumentsLength$1;
2051
- var IS_IOS$1 = environmentIsIos;
2052
- var IS_NODE$2 = environmentIsNode;
2053
-
2054
- var set = globalThis$9.setImmediate;
2055
- var clear = globalThis$9.clearImmediate;
2056
- var process$3 = globalThis$9.process;
2057
- var Dispatch = globalThis$9.Dispatch;
2058
- var Function$1 = globalThis$9.Function;
2059
- var MessageChannel = globalThis$9.MessageChannel;
2060
- var String$1 = globalThis$9.String;
2061
- var counter = 0;
2062
- var queue$2 = {};
2063
- var ONREADYSTATECHANGE = 'onreadystatechange';
2064
- var $location, defer, channel, port;
2065
-
2066
- fails$3(function () {
2067
- // Deno throws a ReferenceError on `location` access without `--location` flag
2068
- $location = globalThis$9.location;
2069
- });
2070
-
2071
- var run = function (id) {
2072
- if (hasOwn$2(queue$2, id)) {
2073
- var fn = queue$2[id];
2074
- delete queue$2[id];
2075
- fn();
2076
- }
2077
- };
2078
-
2079
- var runner = function (id) {
2080
- return function () {
2081
- run(id);
2082
- };
2083
- };
2084
-
2085
- var eventListener = function (event) {
2086
- run(event.data);
2087
- };
2088
-
2089
- var globalPostMessageDefer = function (id) {
2090
- // old engines have not location.origin
2091
- globalThis$9.postMessage(String$1(id), $location.protocol + '//' + $location.host);
2092
- };
2093
-
2094
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
2095
- if (!set || !clear) {
2096
- set = function setImmediate(handler) {
2097
- validateArgumentsLength(arguments.length, 1);
2098
- var fn = isCallable$5(handler) ? handler : Function$1(handler);
2099
- var args = arraySlice(arguments, 1);
2100
- queue$2[++counter] = function () {
2101
- apply$1(fn, undefined, args);
2102
- };
2103
- defer(counter);
2104
- return counter;
2105
- };
2106
- clear = function clearImmediate(id) {
2107
- delete queue$2[id];
2108
- };
2109
- // Node.js 0.8-
2110
- if (IS_NODE$2) {
2111
- defer = function (id) {
2112
- process$3.nextTick(runner(id));
2113
- };
2114
- // Sphere (JS game engine) Dispatch API
2115
- } else if (Dispatch && Dispatch.now) {
2116
- defer = function (id) {
2117
- Dispatch.now(runner(id));
2118
- };
2119
- // Browsers with MessageChannel, includes WebWorkers
2120
- // except iOS - https://github.com/zloirock/core-js/issues/624
2121
- } else if (MessageChannel && !IS_IOS$1) {
2122
- channel = new MessageChannel();
2123
- port = channel.port2;
2124
- channel.port1.onmessage = eventListener;
2125
- defer = bind$2(port.postMessage, port);
2126
- // Browsers with postMessage, skip WebWorkers
2127
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
2128
- } else if (
2129
- globalThis$9.addEventListener &&
2130
- isCallable$5(globalThis$9.postMessage) &&
2131
- !globalThis$9.importScripts &&
2132
- $location && $location.protocol !== 'file:' &&
2133
- !fails$3(globalPostMessageDefer)
2134
- ) {
2135
- defer = globalPostMessageDefer;
2136
- globalThis$9.addEventListener('message', eventListener, false);
2137
- // IE8-
2138
- } else if (ONREADYSTATECHANGE in createElement('script')) {
2139
- defer = function (id) {
2140
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
2141
- html.removeChild(this);
2142
- run(id);
2143
- };
2144
- };
2145
- // Rest old browsers
2146
- } else {
2147
- defer = function (id) {
2148
- setTimeout(runner(id), 0);
2149
- };
2150
- }
2151
- }
2152
-
2153
- var task$1 = {
2154
- set: set,
2155
- clear: clear
2156
- };
2157
-
2158
- var globalThis$8 = globalThis_1;
2159
- var DESCRIPTORS$3 = descriptors;
2160
-
2161
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
2162
- var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
2163
-
2164
- // Avoid NodeJS experimental warning
2165
- var safeGetBuiltIn$1 = function (name) {
2166
- if (!DESCRIPTORS$3) return globalThis$8[name];
2167
- var descriptor = getOwnPropertyDescriptor$1(globalThis$8, name);
2168
- return descriptor && descriptor.value;
2169
- };
2170
-
2171
- var Queue$2 = function () {
2172
- this.head = null;
2173
- this.tail = null;
2174
- };
2175
-
2176
- Queue$2.prototype = {
2177
- add: function (item) {
2178
- var entry = { item: item, next: null };
2179
- var tail = this.tail;
2180
- if (tail) tail.next = entry;
2181
- else this.head = entry;
2182
- this.tail = entry;
2183
- },
2184
- get: function () {
2185
- var entry = this.head;
2186
- if (entry) {
2187
- var next = this.head = entry.next;
2188
- if (next === null) this.tail = null;
2189
- return entry.item;
2190
- }
2191
- }
2192
- };
2193
-
2194
- var queue$1 = Queue$2;
2195
-
2196
- var userAgent$1 = environmentUserAgent;
2197
-
2198
- var environmentIsIosPebble = /ipad|iphone|ipod/i.test(userAgent$1) && typeof Pebble != 'undefined';
2199
-
2200
- var userAgent = environmentUserAgent;
2201
-
2202
- var environmentIsWebosWebkit = /web0s(?!.*chrome)/i.test(userAgent);
2203
-
2204
- var globalThis$7 = globalThis_1;
2205
- var safeGetBuiltIn = safeGetBuiltIn$1;
2206
- var bind$1 = functionBindContext;
2207
- var macrotask = task$1.set;
2208
- var Queue$1 = queue$1;
2209
- var IS_IOS = environmentIsIos;
2210
- var IS_IOS_PEBBLE = environmentIsIosPebble;
2211
- var IS_WEBOS_WEBKIT = environmentIsWebosWebkit;
2212
- var IS_NODE$1 = environmentIsNode;
2213
-
2214
- var MutationObserver = globalThis$7.MutationObserver || globalThis$7.WebKitMutationObserver;
2215
- var document$2 = globalThis$7.document;
2216
- var process$2 = globalThis$7.process;
2217
- var Promise$1 = globalThis$7.Promise;
2218
- var microtask$1 = safeGetBuiltIn('queueMicrotask');
2219
- var notify$1, toggle, node, promise, then;
2220
-
2221
- // modern engines have queueMicrotask method
2222
- if (!microtask$1) {
2223
- var queue = new Queue$1();
2224
-
2225
- var flush = function () {
2226
- var parent, fn;
2227
- if (IS_NODE$1 && (parent = process$2.domain)) parent.exit();
2228
- while (fn = queue.get()) try {
2229
- fn();
2230
- } catch (error) {
2231
- if (queue.head) notify$1();
2232
- throw error;
2233
- }
2234
- if (parent) parent.enter();
2235
- };
2236
-
2237
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
2238
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
2239
- if (!IS_IOS && !IS_NODE$1 && !IS_WEBOS_WEBKIT && MutationObserver && document$2) {
2240
- toggle = true;
2241
- node = document$2.createTextNode('');
2242
- new MutationObserver(flush).observe(node, { characterData: true });
2243
- notify$1 = function () {
2244
- node.data = toggle = !toggle;
2245
- };
2246
- // environments with maybe non-completely correct, but existent Promise
2247
- } else if (!IS_IOS_PEBBLE && Promise$1 && Promise$1.resolve) {
2248
- // Promise.resolve without an argument throws an error in LG WebOS 2
2249
- promise = Promise$1.resolve(undefined);
2250
- // workaround of WebKit ~ iOS Safari 10.1 bug
2251
- promise.constructor = Promise$1;
2252
- then = bind$1(promise.then, promise);
2253
- notify$1 = function () {
2254
- then(flush);
2255
- };
2256
- // Node.js without promises
2257
- } else if (IS_NODE$1) {
2258
- notify$1 = function () {
2259
- process$2.nextTick(flush);
2260
- };
2261
- // for other environments - macrotask based on:
2262
- // - setImmediate
2263
- // - MessageChannel
2264
- // - window.postMessage
2265
- // - onreadystatechange
2266
- // - setTimeout
2267
- } else {
2268
- // `webpack` dev server bug on IE global methods - use bind(fn, global)
2269
- macrotask = bind$1(macrotask, globalThis$7);
2270
- notify$1 = function () {
2271
- macrotask(flush);
2272
- };
2273
- }
2274
-
2275
- microtask$1 = function (fn) {
2276
- if (!queue.head) notify$1();
2277
- queue.add(fn);
2278
- };
2279
- }
2280
-
2281
- var microtask_1 = microtask$1;
2282
-
2283
- var hostReportErrors$1 = function (a, b) {
2284
- try {
2285
- // eslint-disable-next-line no-console -- safe
2286
- arguments.length === 1 ? console.error(a) : console.error(a, b);
2287
- } catch (error) { /* empty */ }
2288
- };
2289
-
2290
- var perform$3 = function (exec) {
2291
- try {
2292
- return { error: false, value: exec() };
2293
- } catch (error) {
2294
- return { error: true, value: error };
2295
- }
2296
- };
2297
-
2298
- var globalThis$6 = globalThis_1;
2299
-
2300
- var promiseNativeConstructor = globalThis$6.Promise;
2301
-
2302
- var globalThis$5 = globalThis_1;
2303
- var NativePromiseConstructor$3 = promiseNativeConstructor;
2304
- var isCallable$4 = isCallable$l;
2305
- var isForced = isForced_1;
2306
- var inspectSource = inspectSource$3;
2307
- var wellKnownSymbol$6 = wellKnownSymbol$i;
2308
- var ENVIRONMENT = environment;
2309
- var V8_VERSION = environmentV8Version;
2310
-
2311
- NativePromiseConstructor$3 && NativePromiseConstructor$3.prototype;
2312
- var SPECIES = wellKnownSymbol$6('species');
2313
- var SUBCLASSING = false;
2314
- var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable$4(globalThis$5.PromiseRejectionEvent);
2315
-
2316
- var FORCED_PROMISE_CONSTRUCTOR$5 = isForced('Promise', function () {
2317
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(NativePromiseConstructor$3);
2318
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(NativePromiseConstructor$3);
2319
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
2320
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
2321
- // We can't detect it synchronously, so just check versions
2322
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
2323
- // We can't use @@species feature detection in V8 since it causes
2324
- // deoptimization and performance degradation
2325
- // https://github.com/zloirock/core-js/issues/679
2326
- if (!V8_VERSION || V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
2327
- // Detect correctness of subclassing with @@species support
2328
- var promise = new NativePromiseConstructor$3(function (resolve) { resolve(1); });
2329
- var FakePromise = function (exec) {
2330
- exec(function () { /* empty */ }, function () { /* empty */ });
2331
- };
2332
- var constructor = promise.constructor = {};
2333
- constructor[SPECIES] = FakePromise;
2334
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
2335
- if (!SUBCLASSING) return true;
2336
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
2337
- } return !GLOBAL_CORE_JS_PROMISE && (ENVIRONMENT === 'BROWSER' || ENVIRONMENT === 'DENO') && !NATIVE_PROMISE_REJECTION_EVENT$1;
2338
- });
2339
-
2340
- var promiseConstructorDetection = {
2341
- CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
2342
- REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
2343
- SUBCLASSING: SUBCLASSING
2344
- };
2345
-
2346
- var newPromiseCapability$2 = {};
2347
-
2348
- var aCallable$7 = aCallable$d;
2349
-
2350
- var $TypeError$5 = TypeError;
2351
-
2352
- var PromiseCapability = function (C) {
2353
- var resolve, reject;
2354
- this.promise = new C(function ($$resolve, $$reject) {
2355
- if (resolve !== undefined || reject !== undefined) throw new $TypeError$5('Bad Promise constructor');
2356
- resolve = $$resolve;
2357
- reject = $$reject;
2358
- });
2359
- this.resolve = aCallable$7(resolve);
2360
- this.reject = aCallable$7(reject);
2361
- };
2362
-
2363
- // `NewPromiseCapability` abstract operation
2364
- // https://tc39.es/ecma262/#sec-newpromisecapability
2365
- newPromiseCapability$2.f = function (C) {
2366
- return new PromiseCapability(C);
2367
- };
2368
-
2369
- var $$d = _export;
2370
- var IS_NODE = environmentIsNode;
2371
- var globalThis$4 = globalThis_1;
2372
- var call$5 = functionCall;
2373
- var defineBuiltIn$2 = defineBuiltIn$6;
2374
- var setPrototypeOf$2 = objectSetPrototypeOf;
2375
- var setToStringTag$1 = setToStringTag$4;
2376
- var setSpecies = setSpecies$1;
2377
- var aCallable$6 = aCallable$d;
2378
- var isCallable$3 = isCallable$l;
2379
- var isObject$4 = isObject$d;
2380
- var anInstance$1 = anInstance$2;
2381
- var speciesConstructor = speciesConstructor$1;
2382
- var task = task$1.set;
2383
- var microtask = microtask_1;
2384
- var hostReportErrors = hostReportErrors$1;
2385
- var perform$2 = perform$3;
2386
- var Queue = queue$1;
2387
- var InternalStateModule$1 = internalState;
2388
- var NativePromiseConstructor$2 = promiseNativeConstructor;
2389
- var PromiseConstructorDetection = promiseConstructorDetection;
2390
- var newPromiseCapabilityModule$3 = newPromiseCapability$2;
2391
-
2392
- var PROMISE = 'Promise';
2393
- var FORCED_PROMISE_CONSTRUCTOR$4 = PromiseConstructorDetection.CONSTRUCTOR;
2394
- var NATIVE_PROMISE_REJECTION_EVENT = PromiseConstructorDetection.REJECTION_EVENT;
2395
- var NATIVE_PROMISE_SUBCLASSING = PromiseConstructorDetection.SUBCLASSING;
2396
- var getInternalPromiseState = InternalStateModule$1.getterFor(PROMISE);
2397
- var setInternalState$1 = InternalStateModule$1.set;
2398
- var NativePromisePrototype$1 = NativePromiseConstructor$2 && NativePromiseConstructor$2.prototype;
2399
- var PromiseConstructor = NativePromiseConstructor$2;
2400
- var PromisePrototype = NativePromisePrototype$1;
2401
- var TypeError$1 = globalThis$4.TypeError;
2402
- var document$1 = globalThis$4.document;
2403
- var process$1 = globalThis$4.process;
2404
- var newPromiseCapability$1 = newPromiseCapabilityModule$3.f;
2405
- var newGenericPromiseCapability = newPromiseCapability$1;
2406
-
2407
- var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && globalThis$4.dispatchEvent);
2408
- var UNHANDLED_REJECTION = 'unhandledrejection';
2409
- var REJECTION_HANDLED = 'rejectionhandled';
2410
- var PENDING = 0;
2411
- var FULFILLED = 1;
2412
- var REJECTED = 2;
2413
- var HANDLED = 1;
2414
- var UNHANDLED = 2;
2415
-
2416
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
2417
-
2418
- // helpers
2419
- var isThenable = function (it) {
2420
- var then;
2421
- return isObject$4(it) && isCallable$3(then = it.then) ? then : false;
2422
- };
2423
-
2424
- var callReaction = function (reaction, state) {
2425
- var value = state.value;
2426
- var ok = state.state === FULFILLED;
2427
- var handler = ok ? reaction.ok : reaction.fail;
2428
- var resolve = reaction.resolve;
2429
- var reject = reaction.reject;
2430
- var domain = reaction.domain;
2431
- var result, then, exited;
2432
- try {
2433
- if (handler) {
2434
- if (!ok) {
2435
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
2436
- state.rejection = HANDLED;
2437
- }
2438
- if (handler === true) result = value;
2439
- else {
2440
- if (domain) domain.enter();
2441
- result = handler(value); // can throw
2442
- if (domain) {
2443
- domain.exit();
2444
- exited = true;
2445
- }
2446
- }
2447
- if (result === reaction.promise) {
2448
- reject(new TypeError$1('Promise-chain cycle'));
2449
- } else if (then = isThenable(result)) {
2450
- call$5(then, result, resolve, reject);
2451
- } else resolve(result);
2452
- } else reject(value);
2453
- } catch (error) {
2454
- if (domain && !exited) domain.exit();
2455
- reject(error);
2456
- }
2457
- };
2458
-
2459
- var notify = function (state, isReject) {
2460
- if (state.notified) return;
2461
- state.notified = true;
2462
- microtask(function () {
2463
- var reactions = state.reactions;
2464
- var reaction;
2465
- while (reaction = reactions.get()) {
2466
- callReaction(reaction, state);
2467
- }
2468
- state.notified = false;
2469
- if (isReject && !state.rejection) onUnhandled(state);
2470
- });
2471
- };
2472
-
2473
- var dispatchEvent = function (name, promise, reason) {
2474
- var event, handler;
2475
- if (DISPATCH_EVENT) {
2476
- event = document$1.createEvent('Event');
2477
- event.promise = promise;
2478
- event.reason = reason;
2479
- event.initEvent(name, false, true);
2480
- globalThis$4.dispatchEvent(event);
2481
- } else event = { promise: promise, reason: reason };
2482
- if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = globalThis$4['on' + name])) handler(event);
2483
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
2484
- };
2485
-
2486
- var onUnhandled = function (state) {
2487
- call$5(task, globalThis$4, function () {
2488
- var promise = state.facade;
2489
- var value = state.value;
2490
- var IS_UNHANDLED = isUnhandled(state);
2491
- var result;
2492
- if (IS_UNHANDLED) {
2493
- result = perform$2(function () {
2494
- if (IS_NODE) {
2495
- process$1.emit('unhandledRejection', value, promise);
2496
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
2497
- });
2498
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
2499
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
2500
- if (result.error) throw result.value;
2501
- }
2502
- });
2503
- };
2504
-
2505
- var isUnhandled = function (state) {
2506
- return state.rejection !== HANDLED && !state.parent;
2507
- };
2508
-
2509
- var onHandleUnhandled = function (state) {
2510
- call$5(task, globalThis$4, function () {
2511
- var promise = state.facade;
2512
- if (IS_NODE) {
2513
- process$1.emit('rejectionHandled', promise);
2514
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
2515
- });
2516
- };
2517
-
2518
- var bind = function (fn, state, unwrap) {
2519
- return function (value) {
2520
- fn(state, value, unwrap);
2521
- };
2522
- };
2523
-
2524
- var internalReject = function (state, value, unwrap) {
2525
- if (state.done) return;
2526
- state.done = true;
2527
- if (unwrap) state = unwrap;
2528
- state.value = value;
2529
- state.state = REJECTED;
2530
- notify(state, true);
2531
- };
2532
-
2533
- var internalResolve = function (state, value, unwrap) {
2534
- if (state.done) return;
2535
- state.done = true;
2536
- if (unwrap) state = unwrap;
2537
- try {
2538
- if (state.facade === value) throw new TypeError$1("Promise can't be resolved itself");
2539
- var then = isThenable(value);
2540
- if (then) {
2541
- microtask(function () {
2542
- var wrapper = { done: false };
2543
- try {
2544
- call$5(then, value,
2545
- bind(internalResolve, wrapper, state),
2546
- bind(internalReject, wrapper, state)
2547
- );
2548
- } catch (error) {
2549
- internalReject(wrapper, error, state);
2550
- }
2551
- });
2552
- } else {
2553
- state.value = value;
2554
- state.state = FULFILLED;
2555
- notify(state, false);
2556
- }
2557
- } catch (error) {
2558
- internalReject({ done: false }, error, state);
2559
- }
2560
- };
2561
-
2562
- // constructor polyfill
2563
- if (FORCED_PROMISE_CONSTRUCTOR$4) {
2564
- // 25.4.3.1 Promise(executor)
2565
- PromiseConstructor = function Promise(executor) {
2566
- anInstance$1(this, PromisePrototype);
2567
- aCallable$6(executor);
2568
- call$5(Internal, this);
2569
- var state = getInternalPromiseState(this);
2570
- try {
2571
- executor(bind(internalResolve, state), bind(internalReject, state));
2572
- } catch (error) {
2573
- internalReject(state, error);
2574
- }
2575
- };
2576
-
2577
- PromisePrototype = PromiseConstructor.prototype;
2578
-
2579
- // eslint-disable-next-line no-unused-vars -- required for `.length`
2580
- Internal = function Promise(executor) {
2581
- setInternalState$1(this, {
2582
- type: PROMISE,
2583
- done: false,
2584
- notified: false,
2585
- parent: false,
2586
- reactions: new Queue(),
2587
- rejection: false,
2588
- state: PENDING,
2589
- value: null
2590
- });
2591
- };
2592
-
2593
- // `Promise.prototype.then` method
2594
- // https://tc39.es/ecma262/#sec-promise.prototype.then
2595
- Internal.prototype = defineBuiltIn$2(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
2596
- var state = getInternalPromiseState(this);
2597
- var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
2598
- state.parent = true;
2599
- reaction.ok = isCallable$3(onFulfilled) ? onFulfilled : true;
2600
- reaction.fail = isCallable$3(onRejected) && onRejected;
2601
- reaction.domain = IS_NODE ? process$1.domain : undefined;
2602
- if (state.state === PENDING) state.reactions.add(reaction);
2603
- else microtask(function () {
2604
- callReaction(reaction, state);
2605
- });
2606
- return reaction.promise;
2607
- });
2608
-
2609
- OwnPromiseCapability = function () {
2610
- var promise = new Internal();
2611
- var state = getInternalPromiseState(promise);
2612
- this.promise = promise;
2613
- this.resolve = bind(internalResolve, state);
2614
- this.reject = bind(internalReject, state);
2615
- };
2616
-
2617
- newPromiseCapabilityModule$3.f = newPromiseCapability$1 = function (C) {
2618
- return C === PromiseConstructor || C === PromiseWrapper
2619
- ? new OwnPromiseCapability(C)
2620
- : newGenericPromiseCapability(C);
2621
- };
2622
-
2623
- if (isCallable$3(NativePromiseConstructor$2) && NativePromisePrototype$1 !== Object.prototype) {
2624
- nativeThen = NativePromisePrototype$1.then;
2625
-
2626
- if (!NATIVE_PROMISE_SUBCLASSING) {
2627
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
2628
- defineBuiltIn$2(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2629
- var that = this;
2630
- return new PromiseConstructor(function (resolve, reject) {
2631
- call$5(nativeThen, that, resolve, reject);
2632
- }).then(onFulfilled, onRejected);
2633
- // https://github.com/zloirock/core-js/issues/640
2634
- }, { unsafe: true });
2635
- }
2636
-
2637
- // make `.constructor === Promise` work for native promise-based APIs
2638
- try {
2639
- delete NativePromisePrototype$1.constructor;
2640
- } catch (error) { /* empty */ }
2641
-
2642
- // make `instanceof Promise` work for native promise-based APIs
2643
- if (setPrototypeOf$2) {
2644
- setPrototypeOf$2(NativePromisePrototype$1, PromisePrototype);
2645
- }
2646
- }
2647
- }
2648
-
2649
- // `Promise` constructor
2650
- // https://tc39.es/ecma262/#sec-promise-executor
2651
- $$d({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
2652
- Promise: PromiseConstructor
2653
- });
2654
-
2655
- setToStringTag$1(PromiseConstructor, PROMISE, false);
2656
- setSpecies(PROMISE);
2657
-
2658
- var wellKnownSymbol$5 = wellKnownSymbol$i;
2659
-
2660
- var ITERATOR$2 = wellKnownSymbol$5('iterator');
2661
- var SAFE_CLOSING = false;
2662
-
2663
- try {
2664
- var called = 0;
2665
- var iteratorWithReturn = {
2666
- next: function () {
2667
- return { done: !!called++ };
2668
- },
2669
- 'return': function () {
2670
- SAFE_CLOSING = true;
2671
- }
2672
- };
2673
- iteratorWithReturn[ITERATOR$2] = function () {
2674
- return this;
2675
- };
2676
- // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
2677
- Array.from(iteratorWithReturn, function () { throw 2; });
2678
- } catch (error) { /* empty */ }
2679
-
2680
- var checkCorrectnessOfIteration$1 = function (exec, SKIP_CLOSING) {
2681
- try {
2682
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
2683
- } catch (error) { return false; } // workaround of old WebKit + `eval` bug
2684
- var ITERATION_SUPPORT = false;
2685
- try {
2686
- var object = {};
2687
- object[ITERATOR$2] = function () {
2688
- return {
2689
- next: function () {
2690
- return { done: ITERATION_SUPPORT = true };
2691
- }
2692
- };
2693
- };
2694
- exec(object);
2695
- } catch (error) { /* empty */ }
2696
- return ITERATION_SUPPORT;
2697
- };
2698
-
2699
- var NativePromiseConstructor$1 = promiseNativeConstructor;
2700
- var checkCorrectnessOfIteration = checkCorrectnessOfIteration$1;
2701
- var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
2702
-
2703
- var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
2704
- NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
2705
- });
2706
-
2707
- var $$c = _export;
2708
- var call$4 = functionCall;
2709
- var aCallable$5 = aCallable$d;
2710
- var newPromiseCapabilityModule$2 = newPromiseCapability$2;
2711
- var perform$1 = perform$3;
2712
- var iterate$3 = iterate$5;
2713
- var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
2714
-
2715
- // `Promise.all` method
2716
- // https://tc39.es/ecma262/#sec-promise.all
2717
- $$c({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
2718
- all: function all(iterable) {
2719
- var C = this;
2720
- var capability = newPromiseCapabilityModule$2.f(C);
2721
- var resolve = capability.resolve;
2722
- var reject = capability.reject;
2723
- var result = perform$1(function () {
2724
- var $promiseResolve = aCallable$5(C.resolve);
2725
- var values = [];
2726
- var counter = 0;
2727
- var remaining = 1;
2728
- iterate$3(iterable, function (promise) {
2729
- var index = counter++;
2730
- var alreadyCalled = false;
2731
- remaining++;
2732
- call$4($promiseResolve, C, promise).then(function (value) {
2733
- if (alreadyCalled) return;
2734
- alreadyCalled = true;
2735
- values[index] = value;
2736
- --remaining || resolve(values);
2737
- }, reject);
2738
- });
2739
- --remaining || resolve(values);
2740
- });
2741
- if (result.error) reject(result.value);
2742
- return capability.promise;
2743
- }
2744
- });
2745
-
2746
- var $$b = _export;
2747
- var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
2748
- var NativePromiseConstructor = promiseNativeConstructor;
2749
- var getBuiltIn$2 = getBuiltIn$8;
2750
- var isCallable$2 = isCallable$l;
2751
- var defineBuiltIn$1 = defineBuiltIn$6;
2752
-
2753
- var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructor.prototype;
2754
-
2755
- // `Promise.prototype.catch` method
2756
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
2757
- $$b({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
2758
- 'catch': function (onRejected) {
2759
- return this.then(undefined, onRejected);
2760
- }
2761
- });
2762
-
2763
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
2764
- if (isCallable$2(NativePromiseConstructor)) {
2765
- var method = getBuiltIn$2('Promise').prototype['catch'];
2766
- if (NativePromisePrototype['catch'] !== method) {
2767
- defineBuiltIn$1(NativePromisePrototype, 'catch', method, { unsafe: true });
2768
- }
2769
- }
2770
-
2771
- var $$a = _export;
2772
- var call$3 = functionCall;
2773
- var aCallable$4 = aCallable$d;
2774
- var newPromiseCapabilityModule$1 = newPromiseCapability$2;
2775
- var perform = perform$3;
2776
- var iterate$2 = iterate$5;
2777
- var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
2778
-
2779
- // `Promise.race` method
2780
- // https://tc39.es/ecma262/#sec-promise.race
2781
- $$a({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
2782
- race: function race(iterable) {
2783
- var C = this;
2784
- var capability = newPromiseCapabilityModule$1.f(C);
2785
- var reject = capability.reject;
2786
- var result = perform(function () {
2787
- var $promiseResolve = aCallable$4(C.resolve);
2788
- iterate$2(iterable, function (promise) {
2789
- call$3($promiseResolve, C, promise).then(capability.resolve, reject);
2790
- });
2791
- });
2792
- if (result.error) reject(result.value);
2793
- return capability.promise;
2794
- }
2795
- });
2796
-
2797
- var $$9 = _export;
2798
- var newPromiseCapabilityModule = newPromiseCapability$2;
2799
- var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
2800
-
2801
- // `Promise.reject` method
2802
- // https://tc39.es/ecma262/#sec-promise.reject
2803
- $$9({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
2804
- reject: function reject(r) {
2805
- var capability = newPromiseCapabilityModule.f(this);
2806
- var capabilityReject = capability.reject;
2807
- capabilityReject(r);
2808
- return capability.promise;
2809
- }
2810
- });
2811
-
2812
- var anObject$6 = anObject$f;
2813
- var isObject$3 = isObject$d;
2814
- var newPromiseCapability = newPromiseCapability$2;
2815
-
2816
- var promiseResolve$1 = function (C, x) {
2817
- anObject$6(C);
2818
- if (isObject$3(x) && x.constructor === C) return x;
2819
- var promiseCapability = newPromiseCapability.f(C);
2820
- var resolve = promiseCapability.resolve;
2821
- resolve(x);
2822
- return promiseCapability.promise;
2823
- };
2824
-
2825
- var $$8 = _export;
2826
- var getBuiltIn$1 = getBuiltIn$8;
2827
- var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
2828
- var promiseResolve = promiseResolve$1;
2829
-
2830
- getBuiltIn$1('Promise');
2831
-
2832
- // `Promise.resolve` method
2833
- // https://tc39.es/ecma262/#sec-promise.resolve
2834
- $$8({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
2835
- resolve: function resolve(x) {
2836
- return promiseResolve(this, x);
2837
- }
2838
- });
2839
-
2840
- var isObject$2 = isObject$d;
2841
- var classof$2 = classofRaw$2;
2842
- var wellKnownSymbol$4 = wellKnownSymbol$i;
2843
-
2844
- var MATCH$1 = wellKnownSymbol$4('match');
2845
-
2846
- // `IsRegExp` abstract operation
2847
- // https://tc39.es/ecma262/#sec-isregexp
2848
- var isRegexp = function (it) {
2849
- var isRegExp;
2850
- return isObject$2(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classof$2(it) === 'RegExp');
2851
- };
2852
-
2853
- var isRegExp = isRegexp;
2854
-
2855
- var $TypeError$4 = TypeError;
2856
-
2857
- var notARegexp = function (it) {
2858
- if (isRegExp(it)) {
2859
- throw new $TypeError$4("The method doesn't accept regular expressions");
2860
- } return it;
2861
- };
2862
-
2863
- var classof$1 = classof$5;
2864
-
2865
- var $String = String;
2866
-
2867
- var toString$2 = function (argument) {
2868
- if (classof$1(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
2869
- return $String(argument);
2870
- };
2871
-
2872
- var wellKnownSymbol$3 = wellKnownSymbol$i;
2873
-
2874
- var MATCH = wellKnownSymbol$3('match');
2875
-
2876
- var correctIsRegexpLogic = function (METHOD_NAME) {
2877
- var regexp = /./;
2878
- try {
2879
- '/./'[METHOD_NAME](regexp);
2880
- } catch (error1) {
2881
- try {
2882
- regexp[MATCH] = false;
2883
- return '/./'[METHOD_NAME](regexp);
2884
- } catch (error2) { /* empty */ }
2885
- } return false;
2886
- };
2887
-
2888
- var $$7 = _export;
2889
- var uncurryThis$1 = functionUncurryThis;
2890
- var notARegExp = notARegexp;
2891
- var requireObjectCoercible = requireObjectCoercible$4;
2892
- var toString$1 = toString$2;
2893
- var correctIsRegExpLogic = correctIsRegexpLogic;
2894
-
2895
- var stringIndexOf = uncurryThis$1(''.indexOf);
2896
-
2897
- // `String.prototype.includes` method
2898
- // https://tc39.es/ecma262/#sec-string.prototype.includes
2899
- $$7({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
2900
- includes: function includes(searchString /* , position = 0 */) {
2901
- return !!~stringIndexOf(
2902
- toString$1(requireObjectCoercible(this)),
2903
- toString$1(notARegExp(searchString)),
2904
- arguments.length > 1 ? arguments[1] : undefined
2905
- );
2906
- }
2907
- });
2908
-
2909
- var $$6 = _export;
2910
- var globalThis$3 = globalThis_1;
2911
- var anInstance = anInstance$2;
2912
- var anObject$5 = anObject$f;
2913
- var isCallable$1 = isCallable$l;
2914
- var getPrototypeOf = objectGetPrototypeOf;
2915
- var defineBuiltInAccessor = defineBuiltInAccessor$2;
2916
- var createProperty = createProperty$2;
2917
- var fails$2 = fails$i;
2918
- var hasOwn$1 = hasOwnProperty_1;
2919
- var wellKnownSymbol$2 = wellKnownSymbol$i;
2920
- var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
2921
- var DESCRIPTORS$2 = descriptors;
2922
-
2923
- var CONSTRUCTOR = 'constructor';
2924
- var ITERATOR$1 = 'Iterator';
2925
- var TO_STRING_TAG$1 = wellKnownSymbol$2('toStringTag');
2926
-
2927
- var $TypeError$3 = TypeError;
2928
- var NativeIterator = globalThis$3[ITERATOR$1];
2929
-
2930
- // FF56- have non-standard global helper `Iterator`
2931
- var FORCED$2 = !isCallable$1(NativeIterator)
2932
- || NativeIterator.prototype !== IteratorPrototype$1
2933
- // FF44- non-standard `Iterator` passes previous tests
2934
- || !fails$2(function () { NativeIterator({}); });
2935
-
2936
- var IteratorConstructor = function Iterator() {
2937
- anInstance(this, IteratorPrototype$1);
2938
- if (getPrototypeOf(this) === IteratorPrototype$1) throw new $TypeError$3('Abstract class Iterator not directly constructable');
2939
- };
2940
-
2941
- var defineIteratorPrototypeAccessor = function (key, value) {
2942
- if (DESCRIPTORS$2) {
2943
- defineBuiltInAccessor(IteratorPrototype$1, key, {
2944
- configurable: true,
2945
- get: function () {
2946
- return value;
2947
- },
2948
- set: function (replacement) {
2949
- anObject$5(this);
2950
- if (this === IteratorPrototype$1) throw new $TypeError$3("You can't redefine this property");
2951
- if (hasOwn$1(this, key)) this[key] = replacement;
2952
- else createProperty(this, key, replacement);
2953
- }
2954
- });
2955
- } else IteratorPrototype$1[key] = value;
2956
- };
2957
-
2958
- if (!hasOwn$1(IteratorPrototype$1, TO_STRING_TAG$1)) defineIteratorPrototypeAccessor(TO_STRING_TAG$1, ITERATOR$1);
2959
-
2960
- if (FORCED$2 || !hasOwn$1(IteratorPrototype$1, CONSTRUCTOR) || IteratorPrototype$1[CONSTRUCTOR] === Object) {
2961
- defineIteratorPrototypeAccessor(CONSTRUCTOR, IteratorConstructor);
2962
- }
2963
-
2964
- IteratorConstructor.prototype = IteratorPrototype$1;
2965
-
2966
- // `Iterator` constructor
2967
- // https://tc39.es/ecma262/#sec-iterator
2968
- $$6({ global: true, constructor: true, forced: FORCED$2 }, {
2969
- Iterator: IteratorConstructor
2970
- });
2971
-
2972
- // `GetIteratorDirect(obj)` abstract operation
2973
- // https://tc39.es/proposal-iterator-helpers/#sec-getiteratordirect
2974
- var getIteratorDirect$4 = function (obj) {
2975
- return {
2976
- iterator: obj,
2977
- next: obj.next,
2978
- done: false
2979
- };
2980
- };
2981
-
2982
- var defineBuiltIn = defineBuiltIn$6;
2983
-
2984
- var defineBuiltIns$1 = function (target, src, options) {
2985
- for (var key in src) defineBuiltIn(target, key, src[key], options);
2986
- return target;
2987
- };
2988
-
2989
- var call$2 = functionCall;
2990
- var create = objectCreate;
2991
- var createNonEnumerableProperty$4 = createNonEnumerableProperty$8;
2992
- var defineBuiltIns = defineBuiltIns$1;
2993
- var wellKnownSymbol$1 = wellKnownSymbol$i;
2994
- var InternalStateModule = internalState;
2995
- var getMethod = getMethod$4;
2996
- var IteratorPrototype = iteratorsCore.IteratorPrototype;
2997
- var createIterResultObject = createIterResultObject$2;
2998
- var iteratorClose$1 = iteratorClose$3;
2999
-
3000
- var TO_STRING_TAG = wellKnownSymbol$1('toStringTag');
3001
- var ITERATOR_HELPER = 'IteratorHelper';
3002
- var WRAP_FOR_VALID_ITERATOR = 'WrapForValidIterator';
3003
- var setInternalState = InternalStateModule.set;
3004
-
3005
- var createIteratorProxyPrototype = function (IS_ITERATOR) {
3006
- var getInternalState = InternalStateModule.getterFor(IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER);
3007
-
3008
- return defineBuiltIns(create(IteratorPrototype), {
3009
- next: function next() {
3010
- var state = getInternalState(this);
3011
- // for simplification:
3012
- // for `%WrapForValidIteratorPrototype%.next` or with `state.returnHandlerResult` our `nextHandler` returns `IterResultObject`
3013
- // for `%IteratorHelperPrototype%.next` - just a value
3014
- if (IS_ITERATOR) return state.nextHandler();
3015
- if (state.done) return createIterResultObject(undefined, true);
3016
- try {
3017
- var result = state.nextHandler();
3018
- return state.returnHandlerResult ? result : createIterResultObject(result, state.done);
3019
- } catch (error) {
3020
- state.done = true;
3021
- throw error;
3022
- }
3023
- },
3024
- 'return': function () {
3025
- var state = getInternalState(this);
3026
- var iterator = state.iterator;
3027
- state.done = true;
3028
- if (IS_ITERATOR) {
3029
- var returnMethod = getMethod(iterator, 'return');
3030
- return returnMethod ? call$2(returnMethod, iterator) : createIterResultObject(undefined, true);
3031
- }
3032
- if (state.inner) try {
3033
- iteratorClose$1(state.inner.iterator, 'normal');
3034
- } catch (error) {
3035
- return iteratorClose$1(iterator, 'throw', error);
3036
- }
3037
- if (iterator) iteratorClose$1(iterator, 'normal');
3038
- return createIterResultObject(undefined, true);
3039
- }
3040
- });
3041
- };
3042
-
3043
- var WrapForValidIteratorPrototype = createIteratorProxyPrototype(true);
3044
- var IteratorHelperPrototype = createIteratorProxyPrototype(false);
3045
-
3046
- createNonEnumerableProperty$4(IteratorHelperPrototype, TO_STRING_TAG, 'Iterator Helper');
3047
-
3048
- var iteratorCreateProxy = function (nextHandler, IS_ITERATOR, RETURN_HANDLER_RESULT) {
3049
- var IteratorProxy = function Iterator(record, state) {
3050
- if (state) {
3051
- state.iterator = record.iterator;
3052
- state.next = record.next;
3053
- } else state = record;
3054
- state.type = IS_ITERATOR ? WRAP_FOR_VALID_ITERATOR : ITERATOR_HELPER;
3055
- state.returnHandlerResult = !!RETURN_HANDLER_RESULT;
3056
- state.nextHandler = nextHandler;
3057
- state.counter = 0;
3058
- state.done = false;
3059
- setInternalState(this, state);
3060
- };
3061
-
3062
- IteratorProxy.prototype = IS_ITERATOR ? WrapForValidIteratorPrototype : IteratorHelperPrototype;
3063
-
3064
- return IteratorProxy;
3065
- };
3066
-
3067
- var anObject$4 = anObject$f;
3068
- var iteratorClose = iteratorClose$3;
3069
-
3070
- // call something on iterator step with safe closing on error
3071
- var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
3072
- try {
3073
- return ENTRIES ? fn(anObject$4(value)[0], value[1]) : fn(value);
3074
- } catch (error) {
3075
- iteratorClose(iterator, 'throw', error);
3076
- }
3077
- };
3078
-
3079
- var $$5 = _export;
3080
- var call$1 = functionCall;
3081
- var aCallable$3 = aCallable$d;
3082
- var anObject$3 = anObject$f;
3083
- var getIteratorDirect$3 = getIteratorDirect$4;
3084
- var createIteratorProxy$1 = iteratorCreateProxy;
3085
- var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
3086
- var IS_PURE$1 = isPure;
3087
-
3088
- var IteratorProxy$1 = createIteratorProxy$1(function () {
3089
- var iterator = this.iterator;
3090
- var predicate = this.predicate;
3091
- var next = this.next;
3092
- var result, done, value;
3093
- while (true) {
3094
- result = anObject$3(call$1(next, iterator));
3095
- done = this.done = !!result.done;
3096
- if (done) return;
3097
- value = result.value;
3098
- if (callWithSafeIterationClosing$1(iterator, predicate, [value, this.counter++], true)) return value;
3099
- }
3100
- });
3101
-
3102
- // `Iterator.prototype.filter` method
3103
- // https://tc39.es/ecma262/#sec-iterator.prototype.filter
3104
- $$5({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
3105
- filter: function filter(predicate) {
3106
- anObject$3(this);
3107
- aCallable$3(predicate);
3108
- return new IteratorProxy$1(getIteratorDirect$3(this), {
3109
- predicate: predicate
3110
- });
3111
- }
3112
- });
3113
-
3114
- var call = functionCall;
3115
- var aCallable$2 = aCallable$d;
3116
- var anObject$2 = anObject$f;
3117
- var getIteratorDirect$2 = getIteratorDirect$4;
3118
- var createIteratorProxy = iteratorCreateProxy;
3119
- var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
3120
-
3121
- var IteratorProxy = createIteratorProxy(function () {
3122
- var iterator = this.iterator;
3123
- var result = anObject$2(call(this.next, iterator));
3124
- var done = this.done = !!result.done;
3125
- if (!done) return callWithSafeIterationClosing(iterator, this.mapper, [result.value, this.counter++], true);
3126
- });
3127
-
3128
- // `Iterator.prototype.map` method
3129
- // https://github.com/tc39/proposal-iterator-helpers
3130
- var iteratorMap = function map(mapper) {
3131
- anObject$2(this);
3132
- aCallable$2(mapper);
3133
- return new IteratorProxy(getIteratorDirect$2(this), {
3134
- mapper: mapper
3135
- });
3136
- };
3137
-
3138
- var $$4 = _export;
3139
- var map = iteratorMap;
3140
- var IS_PURE = isPure;
3141
-
3142
- // `Iterator.prototype.map` method
3143
- // https://tc39.es/ecma262/#sec-iterator.prototype.map
3144
- $$4({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
3145
- map: map
3146
- });
3147
-
3148
- var $$3 = _export;
3149
- var iterate$1 = iterate$5;
3150
- var aCallable$1 = aCallable$d;
3151
- var anObject$1 = anObject$f;
3152
- var getIteratorDirect$1 = getIteratorDirect$4;
3153
-
3154
- var $TypeError$2 = TypeError;
3155
-
3156
- // `Iterator.prototype.reduce` method
3157
- // https://tc39.es/ecma262/#sec-iterator.prototype.reduce
3158
- $$3({ target: 'Iterator', proto: true, real: true }, {
3159
- reduce: function reduce(reducer /* , initialValue */) {
3160
- anObject$1(this);
3161
- aCallable$1(reducer);
3162
- var record = getIteratorDirect$1(this);
3163
- var noInitial = arguments.length < 2;
3164
- var accumulator = noInitial ? undefined : arguments[1];
3165
- var counter = 0;
3166
- iterate$1(record, function (value) {
3167
- if (noInitial) {
3168
- noInitial = false;
3169
- accumulator = value;
3170
- } else {
3171
- accumulator = reducer(accumulator, value, counter);
3172
- }
3173
- counter++;
3174
- }, { IS_RECORD: true });
3175
- if (noInitial) throw new $TypeError$2('Reduce of empty iterator with no initial value');
3176
- return accumulator;
3177
- }
3178
- });
3179
-
3180
- // iterable DOM collections
3181
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
3182
- var domIterables = {
3183
- CSSRuleList: 0,
3184
- CSSStyleDeclaration: 0,
3185
- CSSValueList: 0,
3186
- ClientRectList: 0,
3187
- DOMRectList: 0,
3188
- DOMStringList: 0,
3189
- DOMTokenList: 1,
3190
- DataTransferItemList: 0,
3191
- FileList: 0,
3192
- HTMLAllCollection: 0,
3193
- HTMLCollection: 0,
3194
- HTMLFormElement: 0,
3195
- HTMLSelectElement: 0,
3196
- MediaList: 0,
3197
- MimeTypeArray: 0,
3198
- NamedNodeMap: 0,
3199
- NodeList: 1,
3200
- PaintRequestList: 0,
3201
- Plugin: 0,
3202
- PluginArray: 0,
3203
- SVGLengthList: 0,
3204
- SVGNumberList: 0,
3205
- SVGPathSegList: 0,
3206
- SVGPointList: 0,
3207
- SVGStringList: 0,
3208
- SVGTransformList: 0,
3209
- SourceBufferList: 0,
3210
- StyleSheetList: 0,
3211
- TextTrackCueList: 0,
3212
- TextTrackList: 0,
3213
- TouchList: 0
3214
- };
3215
-
3216
- // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
3217
- var documentCreateElement = documentCreateElement$2;
3218
-
3219
- var classList = documentCreateElement('span').classList;
3220
- var DOMTokenListPrototype$1 = classList && classList.constructor && classList.constructor.prototype;
3221
-
3222
- var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
3223
-
3224
- var globalThis$2 = globalThis_1;
3225
- var DOMIterables = domIterables;
3226
- var DOMTokenListPrototype = domTokenListPrototype;
3227
- var ArrayIteratorMethods = es_array_iterator;
3228
- var createNonEnumerableProperty$3 = createNonEnumerableProperty$8;
3229
- var setToStringTag = setToStringTag$4;
3230
- var wellKnownSymbol = wellKnownSymbol$i;
3231
-
3232
- var ITERATOR = wellKnownSymbol('iterator');
3233
- var ArrayValues = ArrayIteratorMethods.values;
3234
-
3235
- var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
3236
- if (CollectionPrototype) {
3237
- // some Chrome versions have non-configurable methods on DOMTokenList
3238
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
3239
- createNonEnumerableProperty$3(CollectionPrototype, ITERATOR, ArrayValues);
3240
- } catch (error) {
3241
- CollectionPrototype[ITERATOR] = ArrayValues;
3242
- }
3243
- setToStringTag(CollectionPrototype, COLLECTION_NAME, true);
3244
- if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
3245
- // some Chrome versions have non-configurable methods on DOMTokenList
3246
- if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
3247
- createNonEnumerableProperty$3(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
3248
- } catch (error) {
3249
- CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
3250
- }
3251
- }
3252
- }
3253
- };
3254
-
3255
- for (var COLLECTION_NAME in DOMIterables) {
3256
- handlePrototype(globalThis$2[COLLECTION_NAME] && globalThis$2[COLLECTION_NAME].prototype, COLLECTION_NAME);
3257
- }
3258
-
3259
- handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
3260
-
3261
- /**
3262
- * Checks whether the state is init state
3263
- * @param state
3264
- */
3265
- function isInit(state) {
3266
- return state.state === 'init';
3267
- }
3268
- /**
3269
- * Initializes a new state.
3270
- *
3271
- * @template T The type of the state.
3272
- * @return {InitState<T>} An object representing the initial state.
3273
- */
3274
- function init() {
3275
- return {
3276
- state: 'init'
3277
- };
3278
- }
3279
- /**
3280
- * Checks whether the state is pending state
3281
- * @param state
3282
- */
3283
- function isPending(state) {
3284
- return state.state === 'pending';
3285
- }
3286
- /**
3287
- * Generates a PendingState object with a state of "pending".
3288
- *
3289
- * @return {PendingState<T>} An object representing the pending state.
3290
- */
3291
- function pending(progress = undefined) {
3292
- return {
3293
- state: 'pending',
3294
- progress
3295
- };
3296
- }
3297
- /**
3298
- * Checks whether the state is success response
3299
- * @param state
3300
- */
3301
- function isSuccess(state) {
3302
- return state.state === 'success';
3303
- }
3304
- /**
3305
- * Creates a success state object with the provided data.
3306
- *
3307
- * @param {T} data - The data to be included in the success state.
3308
- * @return {SuccessState<T>} An object representing a success state containing the provided data.
3309
- */
3310
- function success(data) {
3311
- return {
3312
- state: 'success',
3313
- data
3314
- };
3315
- }
3316
- /**
3317
- * Checks whether the state is error state
3318
- * @param state
3319
- */
3320
- function isError(state) {
3321
- return state.state === 'error';
3322
- }
3323
- /**
3324
- * Constructs an ErrorState object representing an error.
3325
- *
3326
- * @param {any} error - The error object or message.
3327
- * @param {string} [statusCode] - An optional status code associated with the error.
3328
- * @return {ErrorState<T>} An object representing the error state.
3329
- */
3330
- function error(error, statusCode, request) {
3331
- return {
3332
- state: 'error',
3333
- error,
3334
- statusCode,
3335
- request
3336
- };
3337
- }
3338
- /**
3339
- * Indicates a successful dispatch state.
3340
- *
3341
- * @return {DispatchState<T>} An object representing a successful state.
3342
- */
3343
- function successfulDispatch() {
3344
- return {
3345
- state: 'success'
3346
- };
3347
- }
3348
- /**
3349
- * Determines if the provided dispatch state represents a successful dispatch.
3350
- *
3351
- * @param {DispatchState<T>} value - The dispatch state to check.
3352
- * @return {value is SuccessfulDispatch<T>} - True if the dispatch state indicates success, false otherwise.
3353
- */
3354
- function isSuccessfulDispatch(value) {
3355
- return value.state === 'success';
3356
- }
3357
- /**
3358
- * Generates a ValidationError object.
3359
- *
3360
- * @param error The error details that caused the validation to fail.
3361
- * @return The ValidationError object containing the error state and details.
3362
- */
3363
- function validationError(error) {
3364
- return {
3365
- state: 'validation-error',
3366
- error
3367
- };
3368
- }
3369
- /**
3370
- * Determines if a provided DispatchState object is a ValidationError.
3371
- *
3372
- * @param {DispatchState<T>} value - The DispatchState object to evaluate.
3373
- * @return {boolean} - Returns true if the provided DispatchState object is a ValidationError, otherwise returns false.
3374
- */
3375
- function isValidationError(value) {
3376
- return value.state === 'validation-error';
3377
- }
3378
- /**
3379
- * Constructs a network error object.
3380
- *
3381
- * @param error The error object corresponding to the network request.
3382
- * @param statusCode A string representing the HTTP status code returned.
3383
- * @param request The request object associated with the network operation.
3384
- * @return A NetworkError object containing the error type, status code, error details, and the original request.
3385
- */
3386
- function networkError(error, statusCode, request) {
3387
- return {
3388
- type: 'network',
3389
- statusCode,
3390
- error,
3391
- request
3392
- };
3393
- }
3394
- /**
3395
- * Determines if the provided IntrigError is of type 'network'.
3396
- *
3397
- * @param {IntrigError<T, E>} value - The error value to check the type of.
3398
- * @return {boolean} - Returns true if the error is of type 'network', otherwise false.
3399
- */
3400
- function isNetworkError(value) {
3401
- return value.type === 'network';
3402
- }
3403
- /**
3404
- * Constructs a RequestValidationError object encapsulating the ZodError.
3405
- *
3406
- * @param {ZodError} error - The error object resulting from Zod schema validation.
3407
- * @return {RequestValidationError<T, E>} A RequestValidationError object containing the validation error information.
3408
- */
3409
- function requestValidationError(error) {
3410
- return {
3411
- type: 'request-validation',
3412
- error
3413
- };
3414
- }
3415
- /**
3416
- * Determines if a given error is of type RequestValidationError.
3417
- *
3418
- * @param value The error object to check, which implements the IntrigError interface.
3419
- * @return A boolean indicating whether the error is a RequestValidationError.
3420
- */
3421
- function isRequestValidationError(value) {
3422
- return value.type === 'request-validation';
3423
- }
3424
- /**
3425
- * Constructs a ResponseValidationError object with a specified error.
3426
- *
3427
- * @param {ZodError} error - The validation error encountered during response validation.
3428
- * @return {ResponseValidationError<T, E>} An error object containing the type of error and the validation error details.
3429
- */
3430
- function responseValidationError(error) {
3431
- return {
3432
- type: 'response-validation',
3433
- error
3434
- };
3435
- }
3436
- /**
3437
- * Determines if the given error is a response validation error.
3438
- *
3439
- * @param {IntrigError<T, E>} value - The error object to assess.
3440
- * @return {boolean} True if the error is a response validation error, otherwise false.
3441
- */
3442
- function isResponseValidationError(value) {
3443
- return value.type === 'response-validation';
3444
- }
3445
-
3446
- /**
3447
- * Context object created using `createContext` function. Provides a way to share state, dispatch functions,
3448
- * and axios instance across components without having to pass props down manually at every level.
3449
- *
3450
- * @type {ContextType}
3451
- */
3452
- let Context = /*#__PURE__*/createContext({
3453
- state: {},
3454
- filteredState: {},
3455
- dispatch() {},
3456
- configs: {},
3457
- async execute() {}
3458
- });
3459
- function useIntrigContext() {
3460
- return useContext(Context);
3461
- }
3462
-
3463
- var loglevel = {exports: {}};
3464
-
3465
- /*
3466
- * loglevel - https://github.com/pimterry/loglevel
3467
- *
3468
- * Copyright (c) 2013 Tim Perry
3469
- * Licensed under the MIT license.
3470
- */
3471
-
3472
- (function (module) {
3473
- (function (root, definition) {
3474
- if (module.exports) {
3475
- module.exports = definition();
3476
- } else {
3477
- root.log = definition();
3478
- }
3479
- }(commonjsGlobal, function () {
3480
-
3481
- // Slightly dubious tricks to cut down minimized file size
3482
- var noop = function() {};
3483
- var undefinedType = "undefined";
3484
- var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
3485
- /Trident\/|MSIE /.test(window.navigator.userAgent)
3486
- );
3487
-
3488
- var logMethods = [
3489
- "trace",
3490
- "debug",
3491
- "info",
3492
- "warn",
3493
- "error"
3494
- ];
3495
-
3496
- var _loggersByName = {};
3497
- var defaultLogger = null;
3498
-
3499
- // Cross-browser bind equivalent that works at least back to IE6
3500
- function bindMethod(obj, methodName) {
3501
- var method = obj[methodName];
3502
- if (typeof method.bind === 'function') {
3503
- return method.bind(obj);
3504
- } else {
3505
- try {
3506
- return Function.prototype.bind.call(method, obj);
3507
- } catch (e) {
3508
- // Missing bind shim or IE8 + Modernizr, fallback to wrapping
3509
- return function() {
3510
- return Function.prototype.apply.apply(method, [obj, arguments]);
3511
- };
3512
- }
3513
- }
3514
- }
3515
-
3516
- // Trace() doesn't print the message in IE, so for that case we need to wrap it
3517
- function traceForIE() {
3518
- if (console.log) {
3519
- if (console.log.apply) {
3520
- console.log.apply(console, arguments);
3521
- } else {
3522
- // In old IE, native console methods themselves don't have apply().
3523
- Function.prototype.apply.apply(console.log, [console, arguments]);
3524
- }
3525
- }
3526
- if (console.trace) console.trace();
3527
- }
3528
-
3529
- // Build the best logging method possible for this env
3530
- // Wherever possible we want to bind, not wrap, to preserve stack traces
3531
- function realMethod(methodName) {
3532
- if (methodName === 'debug') {
3533
- methodName = 'log';
3534
- }
3535
-
3536
- if (typeof console === undefinedType) {
3537
- return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
3538
- } else if (methodName === 'trace' && isIE) {
3539
- return traceForIE;
3540
- } else if (console[methodName] !== undefined) {
3541
- return bindMethod(console, methodName);
3542
- } else if (console.log !== undefined) {
3543
- return bindMethod(console, 'log');
3544
- } else {
3545
- return noop;
3546
- }
3547
- }
3548
-
3549
- // These private functions always need `this` to be set properly
3550
-
3551
- function replaceLoggingMethods() {
3552
- /*jshint validthis:true */
3553
- var level = this.getLevel();
3554
-
3555
- // Replace the actual methods.
3556
- for (var i = 0; i < logMethods.length; i++) {
3557
- var methodName = logMethods[i];
3558
- this[methodName] = (i < level) ?
3559
- noop :
3560
- this.methodFactory(methodName, level, this.name);
3561
- }
3562
-
3563
- // Define log.log as an alias for log.debug
3564
- this.log = this.debug;
3565
-
3566
- // Return any important warnings.
3567
- if (typeof console === undefinedType && level < this.levels.SILENT) {
3568
- return "No console available for logging";
3569
- }
3570
- }
3571
-
3572
- // In old IE versions, the console isn't present until you first open it.
3573
- // We build realMethod() replacements here that regenerate logging methods
3574
- function enableLoggingWhenConsoleArrives(methodName) {
3575
- return function () {
3576
- if (typeof console !== undefinedType) {
3577
- replaceLoggingMethods.call(this);
3578
- this[methodName].apply(this, arguments);
3579
- }
3580
- };
3581
- }
3582
-
3583
- // By default, we use closely bound real methods wherever possible, and
3584
- // otherwise we wait for a console to appear, and then try again.
3585
- function defaultMethodFactory(methodName, _level, _loggerName) {
3586
- /*jshint validthis:true */
3587
- return realMethod(methodName) ||
3588
- enableLoggingWhenConsoleArrives.apply(this, arguments);
3589
- }
3590
-
3591
- function Logger(name, factory) {
3592
- // Private instance variables.
3593
- var self = this;
3594
- /**
3595
- * The level inherited from a parent logger (or a global default). We
3596
- * cache this here rather than delegating to the parent so that it stays
3597
- * in sync with the actual logging methods that we have installed (the
3598
- * parent could change levels but we might not have rebuilt the loggers
3599
- * in this child yet).
3600
- * @type {number}
3601
- */
3602
- var inheritedLevel;
3603
- /**
3604
- * The default level for this logger, if any. If set, this overrides
3605
- * `inheritedLevel`.
3606
- * @type {number|null}
3607
- */
3608
- var defaultLevel;
3609
- /**
3610
- * A user-specific level for this logger. If set, this overrides
3611
- * `defaultLevel`.
3612
- * @type {number|null}
3613
- */
3614
- var userLevel;
3615
-
3616
- var storageKey = "loglevel";
3617
- if (typeof name === "string") {
3618
- storageKey += ":" + name;
3619
- } else if (typeof name === "symbol") {
3620
- storageKey = undefined;
3621
- }
3622
-
3623
- function persistLevelIfPossible(levelNum) {
3624
- var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
3625
-
3626
- if (typeof window === undefinedType || !storageKey) return;
3627
-
3628
- // Use localStorage if available
3629
- try {
3630
- window.localStorage[storageKey] = levelName;
3631
- return;
3632
- } catch (ignore) {}
3633
-
3634
- // Use session cookie as fallback
3635
- try {
3636
- window.document.cookie =
3637
- encodeURIComponent(storageKey) + "=" + levelName + ";";
3638
- } catch (ignore) {}
3639
- }
3640
-
3641
- function getPersistedLevel() {
3642
- var storedLevel;
3643
-
3644
- if (typeof window === undefinedType || !storageKey) return;
3645
-
3646
- try {
3647
- storedLevel = window.localStorage[storageKey];
3648
- } catch (ignore) {}
3649
-
3650
- // Fallback to cookies if local storage gives us nothing
3651
- if (typeof storedLevel === undefinedType) {
3652
- try {
3653
- var cookie = window.document.cookie;
3654
- var cookieName = encodeURIComponent(storageKey);
3655
- var location = cookie.indexOf(cookieName + "=");
3656
- if (location !== -1) {
3657
- storedLevel = /^([^;]+)/.exec(
3658
- cookie.slice(location + cookieName.length + 1)
3659
- )[1];
3660
- }
3661
- } catch (ignore) {}
3662
- }
3663
-
3664
- // If the stored level is not valid, treat it as if nothing was stored.
3665
- if (self.levels[storedLevel] === undefined) {
3666
- storedLevel = undefined;
3667
- }
3668
-
3669
- return storedLevel;
3670
- }
3671
-
3672
- function clearPersistedLevel() {
3673
- if (typeof window === undefinedType || !storageKey) return;
3674
-
3675
- // Use localStorage if available
3676
- try {
3677
- window.localStorage.removeItem(storageKey);
3678
- } catch (ignore) {}
3679
-
3680
- // Use session cookie as fallback
3681
- try {
3682
- window.document.cookie =
3683
- encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
3684
- } catch (ignore) {}
3685
- }
3686
-
3687
- function normalizeLevel(input) {
3688
- var level = input;
3689
- if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
3690
- level = self.levels[level.toUpperCase()];
3691
- }
3692
- if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
3693
- return level;
3694
- } else {
3695
- throw new TypeError("log.setLevel() called with invalid level: " + input);
3696
- }
3697
- }
3698
-
3699
- /*
3700
- *
3701
- * Public logger API - see https://github.com/pimterry/loglevel for details
3702
- *
3703
- */
3704
-
3705
- self.name = name;
3706
-
3707
- self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
3708
- "ERROR": 4, "SILENT": 5};
3709
-
3710
- self.methodFactory = factory || defaultMethodFactory;
3711
-
3712
- self.getLevel = function () {
3713
- if (userLevel != null) {
3714
- return userLevel;
3715
- } else if (defaultLevel != null) {
3716
- return defaultLevel;
3717
- } else {
3718
- return inheritedLevel;
3719
- }
3720
- };
3721
-
3722
- self.setLevel = function (level, persist) {
3723
- userLevel = normalizeLevel(level);
3724
- if (persist !== false) { // defaults to true
3725
- persistLevelIfPossible(userLevel);
3726
- }
3727
-
3728
- // NOTE: in v2, this should call rebuild(), which updates children.
3729
- return replaceLoggingMethods.call(self);
3730
- };
3731
-
3732
- self.setDefaultLevel = function (level) {
3733
- defaultLevel = normalizeLevel(level);
3734
- if (!getPersistedLevel()) {
3735
- self.setLevel(level, false);
3736
- }
3737
- };
3738
-
3739
- self.resetLevel = function () {
3740
- userLevel = null;
3741
- clearPersistedLevel();
3742
- replaceLoggingMethods.call(self);
3743
- };
3744
-
3745
- self.enableAll = function(persist) {
3746
- self.setLevel(self.levels.TRACE, persist);
3747
- };
3748
-
3749
- self.disableAll = function(persist) {
3750
- self.setLevel(self.levels.SILENT, persist);
3751
- };
3752
-
3753
- self.rebuild = function () {
3754
- if (defaultLogger !== self) {
3755
- inheritedLevel = normalizeLevel(defaultLogger.getLevel());
3756
- }
3757
- replaceLoggingMethods.call(self);
3758
-
3759
- if (defaultLogger === self) {
3760
- for (var childName in _loggersByName) {
3761
- _loggersByName[childName].rebuild();
3762
- }
3763
- }
3764
- };
3765
-
3766
- // Initialize all the internal levels.
3767
- inheritedLevel = normalizeLevel(
3768
- defaultLogger ? defaultLogger.getLevel() : "WARN"
3769
- );
3770
- var initialLevel = getPersistedLevel();
3771
- if (initialLevel != null) {
3772
- userLevel = normalizeLevel(initialLevel);
3773
- }
3774
- replaceLoggingMethods.call(self);
3775
- }
3776
-
3777
- /*
3778
- *
3779
- * Top-level API
3780
- *
3781
- */
3782
-
3783
- defaultLogger = new Logger();
3784
-
3785
- defaultLogger.getLogger = function getLogger(name) {
3786
- if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
3787
- throw new TypeError("You must supply a name when creating a logger.");
3788
- }
3789
-
3790
- var logger = _loggersByName[name];
3791
- if (!logger) {
3792
- logger = _loggersByName[name] = new Logger(
3793
- name,
3794
- defaultLogger.methodFactory
3795
- );
3796
- }
3797
- return logger;
3798
- };
3799
-
3800
- // Grab the current global log variable in case of overwrite
3801
- var _log = (typeof window !== undefinedType) ? window.log : undefined;
3802
- defaultLogger.noConflict = function() {
3803
- if (typeof window !== undefinedType &&
3804
- window.log === defaultLogger) {
3805
- window.log = _log;
3806
- }
3807
-
3808
- return defaultLogger;
3809
- };
3810
-
3811
- defaultLogger.getLoggers = function getLoggers() {
3812
- return _loggersByName;
3813
- };
3814
-
3815
- // ES6 default export, for compatibility
3816
- defaultLogger['default'] = defaultLogger;
3817
-
3818
- return defaultLogger;
3819
- }));
3820
- } (loglevel));
3821
-
3822
- var loglevelExports = loglevel.exports;
3823
- var log = /*@__PURE__*/getDefaultExportFromCjs(loglevelExports);
3824
-
3825
- // Set the default logging level (can be overridden via environment variables)
3826
- log.setLevel(process.env.LOG_LEVEL || 'info');
3827
- const logWrapper = {
3828
- info: (msg, meta) => meta ? log.info(msg, meta) : log.info(msg),
3829
- warn: (msg, meta) => meta ? log.warn(msg, meta) : log.warn(msg),
3830
- error: (msg, meta) => meta ? log.error(msg, meta) : log.error(msg),
3831
- debug: (msg, meta) => meta ? log.debug(msg, meta) : log.debug(msg)
3832
- };
3833
-
3834
- /**
3835
- * Handles state updates for network requests based on the provided action.
3836
- *
3837
- * @param {GlobalState} state - The current state of the application.
3838
- * @param {NetworkAction<unknown>} action - The action containing source, operation, key, and state.
3839
- * @return {GlobalState} - The updated state after applying the action.
3840
- */
3841
- function requestReducer(state, action) {
3842
- return Object.assign({}, state, {
3843
- [`${action.source}:${action.operation}:${action.key}`]: action.state
3844
- });
3845
- }
3846
- /**
3847
- * IntrigProvider is a context provider component that sets up global state management
3848
- * and provides Axios instances for API requests.
3849
- *
3850
- * @param {Object} props - The properties object.
3851
- * @param {React.ReactNode} props.children - The child components to be wrapped by the provider.
3852
- * @param {Object} [props.configs={}] - Configuration object for Axios instances.
3853
- * @param {Object} [props.configs.defaults={}] - Default configuration for Axios.
3854
- * @param {Object} [props.configs.petstore={}] - Configuration specific to the petstore API.
3855
- * @return {JSX.Element} A context provider component that wraps the provided children.
3856
- */
3857
- function IntrigProvider({
3858
- children,
3859
- configs = {}
3860
- }) {
3861
- const [state, dispatch] = useReducer(requestReducer, {});
3862
- const axiosInstances = useMemo(() => {
3863
- return {};
3864
- }, [configs]);
3865
- const contextValue = useMemo(() => {
3866
- async function execute(request, dispatch, schema, errorSchema) {
3867
- try {
3868
- dispatch(pending());
3869
- let response = await axiosInstances[request.source].request(request);
3870
- if (response.status >= 200 && response.status < 300) {
3871
- if (schema) {
3872
- let data = schema.safeParse(response.data);
3873
- if (!data.success) {
3874
- dispatch(error(data.error.issues, response.status, request));
3875
- return;
3876
- }
3877
- dispatch(success(data.data));
3878
- } else {
3879
- dispatch(success(response.data));
3880
- }
3881
- } else {
3882
- var _errorSchema$safePars, _response$data, _ref;
3883
- let {
3884
- data,
3885
- error: validationError
3886
- } = (_errorSchema$safePars = errorSchema == null ? void 0 : errorSchema.safeParse((_response$data = response.data) != null ? _response$data : {})) != null ? _errorSchema$safePars : {};
3887
- //todo: handle error validation error.
3888
- dispatch(error((_ref = data != null ? data : response.data) != null ? _ref : response.statusText, response.status));
3889
- }
3890
- } catch (e) {
3891
- if (isAxiosError(e)) {
3892
- var _errorSchema$safePars2, _e$response$data, _e$response, _e$response2, _e$response3;
3893
- let {
3894
- data,
3895
- error: validationError
3896
- } = (_errorSchema$safePars2 = errorSchema == null ? undefined : errorSchema.safeParse((_e$response$data = (_e$response = e.response) == null ? undefined : _e$response.data) != null ? _e$response$data : {})) != null ? _errorSchema$safePars2 : {};
3897
- dispatch(error(data != null ? data : (_e$response2 = e.response) == null ? undefined : _e$response2.data, (_e$response3 = e.response) == null ? undefined : _e$response3.status, request));
3898
- } else {
3899
- dispatch(error(e));
3900
- }
3901
- }
3902
- }
3903
- return {
3904
- state,
3905
- dispatch,
3906
- filteredState: state,
3907
- configs,
3908
- execute
3909
- };
3910
- }, [state, axiosInstances]);
3911
- return jsx(Context.Provider, {
3912
- value: contextValue,
3913
- children: children
3914
- });
3915
- }
3916
- function IntrigProviderStub({
3917
- children,
3918
- configs = {},
3919
- stubs = () => {}
3920
- }) {
3921
- const [state, dispatch] = useReducer(requestReducer, {});
3922
- const collectedStubs = useMemo(() => {
3923
- let fns = {};
3924
- function stub(hook, fn) {
3925
- fns[hook.key] = fn;
3926
- }
3927
- stubs(stub);
3928
- return fns;
3929
- }, [stubs]);
3930
- const contextValue = useMemo(() => {
3931
- async function execute(request, dispatch, schema) {
3932
- let stub = collectedStubs[request.key];
3933
- if (!!stub) {
3934
- try {
3935
- await stub(request.params, request.data, dispatch);
3936
- } catch (e) {
3937
- dispatch(error(e));
3938
- }
3939
- } else {
3940
- dispatch(init());
3941
- }
3942
- }
3943
- return {
3944
- state,
3945
- dispatch,
3946
- filteredState: state,
3947
- configs,
3948
- execute
3949
- };
3950
- }, [state, dispatch, configs, collectedStubs]);
3951
- return jsx(Context.Provider, {
3952
- value: contextValue,
3953
- children: children
3954
- });
3955
- }
3956
- /**
3957
- * StatusTrap component is used to track and manage network request states.
3958
- *
3959
- * @param {Object} props - The properties object.
3960
- * @param {React.ReactNode} props.children - The child elements to be rendered.
3961
- * @param {string} props.type - The type of network state to handle ("error", "pending", "pending + error").
3962
- * @param {boolean} [props.propagate=true] - Whether to propagate the event to the parent context.
3963
- * @return {React.ReactElement} The context provider component with filtered state and custom dispatch.
3964
- */
3965
- function StatusTrap({
3966
- children,
3967
- type,
3968
- propagate = true
3969
- }) {
3970
- const ctx = useContext(Context);
3971
- const [requests, setRequests] = useState([]);
3972
- const shouldHandleEvent = useCallback(state => {
3973
- switch (type) {
3974
- case 'error':
3975
- return isError(state);
3976
- case 'pending':
3977
- return isPending(state);
3978
- case 'pending + error':
3979
- return isPending(state) || isError(state);
3980
- default:
3981
- return false;
3982
- }
3983
- }, [type]);
3984
- const dispatch = useCallback(event => {
3985
- if (!event.handled) {
3986
- if (shouldHandleEvent(event.state)) {
3987
- setRequests(prev => [...prev, event.key]);
3988
- if (!propagate) {
3989
- ctx.dispatch(Object.assign({}, event, {
3990
- handled: true
3991
- }));
3992
- return;
3993
- }
3994
- } else {
3995
- setRequests(prev => prev.filter(k => k !== event.key));
3996
- }
3997
- }
3998
- ctx.dispatch(event);
3999
- }, [ctx, propagate, shouldHandleEvent]);
4000
- const filteredState = useMemo(() => {
4001
- return Object.fromEntries(Object.entries(ctx.state).filter(([key]) => requests.includes(key)));
4002
- }, [ctx.state, requests]);
4003
- return jsx(Context.Provider, {
4004
- value: Object.assign({}, ctx, {
4005
- dispatch,
4006
- filteredState
4007
- }),
4008
- children: children
4009
- });
4010
- }
4011
- /**
4012
- * useNetworkState is a custom hook that manages the network state within the specified context.
4013
- * It handles making network requests, dispatching appropriate states based on the request lifecycle,
4014
- * and allows aborting ongoing requests.
4015
- *
4016
- * @param {Object} params - The parameters required to configure and use the network state.
4017
- * @param {string} params.key - A unique identifier for the network request.
4018
- * @param {string} params.operation - The operation type related to the request.
4019
- * @param {string} params.source - The source or endpoint for the network request.
4020
- * @param {Object} params.schema - The schema used for validating the response data.
4021
- * @param {number} [params.debounceDelay] - The debounce delay for executing the network request.
4022
- *
4023
- * @return {[NetworkState<T>, (request: AxiosRequestConfig) => void, () => void]}
4024
- * Returns a state object representing the current network state,
4025
- * a function to execute the network request, and a function to clear the request.
4026
- */
4027
- function useNetworkState({
4028
- key,
4029
- operation,
4030
- source,
4031
- schema,
4032
- errorSchema,
4033
- debounceDelay: requestDebounceDelay
4034
- }) {
4035
- var _context$state4;
4036
- const context = useContext(Context);
4037
- const [abortController, setAbortController] = useState();
4038
- const networkState = useMemo(() => {
4039
- var _context$state, _context$state2, _context$state3;
4040
- logWrapper.info(`Updating status ${key} ${operation} ${source}`);
4041
- logWrapper.debug(`<=`, (_context$state = context.state) == null ? undefined : _context$state[`${source}:${operation}:${key}`]);
4042
- return (_context$state2 = (_context$state3 = context.state) == null ? undefined : _context$state3[`${source}:${operation}:${key}`]) != null ? _context$state2 : init();
4043
- }, [(_context$state4 = context.state) == null ? undefined : _context$state4[`${source}:${operation}:${key}`]]);
4044
- const dispatch = useCallback(state => {
4045
- context.dispatch({
4046
- key,
4047
- operation,
4048
- source,
4049
- state
4050
- });
4051
- }, [key, operation, source, context.dispatch]);
4052
- const debounceDelay = useMemo(() => {
4053
- var _ref2, _context$configs;
4054
- return (_ref2 = requestDebounceDelay != null ? requestDebounceDelay : (_context$configs = context.configs) == null ? undefined : _context$configs.debounceDelay) != null ? _ref2 : 0;
4055
- }, [context.configs, requestDebounceDelay]);
4056
- const execute = useCallback(async request => {
4057
- logWrapper.info(`Executing request ${key} ${operation} ${source}`);
4058
- logWrapper.debug(`=>`, request);
4059
- let abortController = new AbortController();
4060
- setAbortController(abortController);
4061
- let requestConfig = Object.assign({}, request, {
4062
- onUploadProgress(event) {
4063
- dispatch(pending({
4064
- type: 'upload',
4065
- loaded: event.loaded,
4066
- total: event.total
4067
- }));
4068
- request.onUploadProgress == null || request.onUploadProgress(event);
4069
- },
4070
- onDownloadProgress(event) {
4071
- dispatch(pending({
4072
- type: 'download',
4073
- loaded: event.loaded,
4074
- total: event.total
4075
- }));
4076
- request.onDownloadProgress == null || request.onDownloadProgress(event);
4077
- },
4078
- signal: abortController.signal
4079
- });
4080
- await context.execute(requestConfig, dispatch, schema, errorSchema);
4081
- }, [networkState, context.dispatch, axios]);
4082
- const deboundedExecute = useMemo(() => debounce(execute, debounceDelay != null ? debounceDelay : 0), [execute]);
4083
- const clear = useCallback(() => {
4084
- logWrapper.info(`Clearing request ${key} ${operation} ${source}`);
4085
- dispatch(init());
4086
- setAbortController(abortController => {
4087
- logWrapper.info(`Aborting request ${key} ${operation} ${source}`);
4088
- abortController == null || abortController.abort();
4089
- return undefined;
4090
- });
4091
- }, [dispatch, abortController]);
4092
- return [networkState, deboundedExecute, clear, dispatch];
4093
- }
4094
- function debounce(func, delay) {
4095
- let timeoutId;
4096
- return (...args) => {
4097
- if (timeoutId) {
4098
- clearTimeout(timeoutId);
4099
- }
4100
- timeoutId = setTimeout(() => {
4101
- func(...args);
4102
- }, delay);
4103
- };
4104
- }
4105
- /**
4106
- * Handles central error extraction from the provided context.
4107
- * It filters the state to retain error states and maps them to a structured error object with additional context information.
4108
- * @return {Object[]} An array of objects representing the error states with context information such as source, operation, and key.
4109
- */
4110
- function useCentralError() {
4111
- const ctx = useContext(Context);
4112
- return useMemo(() => {
4113
- return Object.entries(ctx.filteredState).filter(([, state]) => isError(state)).map(([k, state]) => {
4114
- let [source, operation, key] = k.split(':');
4115
- return Object.assign({}, state, {
4116
- source,
4117
- operation,
4118
- key
4119
- });
4120
- });
4121
- }, [ctx.filteredState]);
4122
- }
4123
- /**
4124
- * Uses central pending state handling by aggregating pending states from context.
4125
- * It calculates the overall progress of pending states if any, or returns an initial state otherwise.
4126
- *
4127
- * @return {NetworkState} The aggregated network state based on the pending states and their progress.
4128
- */
4129
- function useCentralPendingState() {
4130
- const ctx = useContext(Context);
4131
- const result = useMemo(() => {
4132
- let pendingStates = Object.values(ctx.filteredState).filter(isPending);
4133
- if (!pendingStates.length) {
4134
- return init();
4135
- }
4136
- let progress = pendingStates.filter(a => a.progress).reduce((progress, current) => {
4137
- var _current$progress$tot, _current$progress, _current$progress$loa, _current$progress2;
4138
- return {
4139
- total: progress.total + ((_current$progress$tot = (_current$progress = current.progress) == null ? undefined : _current$progress.total) != null ? _current$progress$tot : 0),
4140
- loaded: progress.loaded + ((_current$progress$loa = (_current$progress2 = current.progress) == null ? undefined : _current$progress2.loaded) != null ? _current$progress$loa : 0)
4141
- };
4142
- }, {
4143
- total: 0,
4144
- loaded: 0
4145
- });
4146
- return pending(!!progress.total ? progress : undefined);
4147
- }, [ctx.filteredState]);
4148
- return result;
4149
- }
4150
-
4151
- // **Implementation**
4152
- function useResolvedValue(hook, options) {
4153
- const [value, setValue] = useState();
4154
- let [state] = hook(options); // Ensure compatibility with different hook types
4155
- useEffect(() => {
4156
- if (isSuccess(state)) {
4157
- setValue(state.data);
4158
- } else {
4159
- setValue(undefined);
4160
- }
4161
- }, [state]); // Add `state` to the dependency array to ensure updates
4162
- return value;
4163
- }
4164
-
4165
- // **Implementation**
4166
- function useResolvedCachedValue(hook, options) {
4167
- const [cachedValue, setCachedValue] = useState();
4168
- let [state] = hook(options); // Ensure compatibility with different hook types
4169
- useEffect(() => {
4170
- if (isSuccess(state)) {
4171
- setCachedValue(state.data);
4172
- }
4173
- // Do not clear cached value if state is unsuccessful
4174
- }, [state]);
4175
- return cachedValue;
4176
- }
4177
-
4178
- // **Implementation**
4179
- function useAsPromise(hook, options) {
4180
- const resolveRef = useRef();
4181
- const rejectRef = useRef();
4182
- let [state, dispatch, clear] = hook(options); // Casting to `any` to match all overloads
4183
- useEffect(() => {
4184
- if (isSuccess(state)) {
4185
- resolveRef.current == null || resolveRef.current(state.data);
4186
- clear();
4187
- } else if (isError(state)) {
4188
- rejectRef.current == null || rejectRef.current(state.error);
4189
- clear();
4190
- }
4191
- }, [state]);
4192
- const promiseFn = useCallback((...args) => {
4193
- return new Promise((resolve, reject) => {
4194
- resolveRef.current = resolve;
4195
- rejectRef.current = reject;
4196
- let dispatchState = dispatch(...args);
4197
- if (isValidationError(dispatchState)) {
4198
- reject(dispatchState.error);
4199
- }
4200
- });
4201
- }, [dispatch]);
4202
- return [promiseFn, clear];
4203
- }
4204
-
4205
- /**
4206
- * A custom hook that integrates a promise-based operation with a network state management system.
4207
- * Tracks the network state (e.g., pending, success, error) for a given asynchronous function.
4208
- *
4209
- * @param fn A promise-based function that performs an asynchronous operation.
4210
- * @param key An optional string key to identify the network state uniquely. Defaults to 'default'.
4211
- * @return A tuple containing:
4212
- * 1. The current network state of the operation.
4213
- * 2. A function to execute the provided asynchronous operation.
4214
- * 3. A function to reset the network state back to the initial state.
4215
- */
4216
- function useAsNetworkState(fn, key = 'default') {
4217
- var _context$state3;
4218
- let id = useId();
4219
- let context = useIntrigContext();
4220
- const networkState = useMemo(() => {
4221
- var _context$state, _context$state2;
4222
- return (_context$state = (_context$state2 = context.state) == null ? undefined : _context$state2[`promiseState:${id}:${key}}`]) != null ? _context$state : init();
4223
- }, [(_context$state3 = context.state) == null ? undefined : _context$state3[`promiseState:${id}:${key}}`]]);
4224
- const dispatch = useCallback(state => {
4225
- context.dispatch({
4226
- key,
4227
- operation: id,
4228
- source: 'promiseState',
4229
- state
4230
- });
4231
- }, [key, context.dispatch]);
4232
- const execute = useCallback((...args) => {
4233
- dispatch(pending());
4234
- return fn(...args).then(data => {
4235
- dispatch(success(data));
4236
- }, e => {
4237
- dispatch(error(e));
4238
- });
4239
- }, []);
4240
- const clear = useCallback(() => {
4241
- dispatch(init());
4242
- }, []);
4243
- return [networkState, execute, clear];
4244
- }
4245
-
4246
- var defineProperty = objectDefineProperty.f;
4247
-
4248
- var proxyAccessor$1 = function (Target, Source, key) {
4249
- key in Target || defineProperty(Target, key, {
4250
- configurable: true,
4251
- get: function () { return Source[key]; },
4252
- set: function (it) { Source[key] = it; }
4253
- });
4254
- };
4255
-
4256
- var isCallable = isCallable$l;
4257
- var isObject$1 = isObject$d;
4258
- var setPrototypeOf$1 = objectSetPrototypeOf;
4259
-
4260
- // makes subclassing work correct for wrapped built-ins
4261
- var inheritIfRequired$1 = function ($this, dummy, Wrapper) {
4262
- var NewTarget, NewTargetPrototype;
4263
- if (
4264
- // it can work only with native `setPrototypeOf`
4265
- setPrototypeOf$1 &&
4266
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
4267
- isCallable(NewTarget = dummy.constructor) &&
4268
- NewTarget !== Wrapper &&
4269
- isObject$1(NewTargetPrototype = NewTarget.prototype) &&
4270
- NewTargetPrototype !== Wrapper.prototype
4271
- ) setPrototypeOf$1($this, NewTargetPrototype);
4272
- return $this;
4273
- };
4274
-
4275
- var toString = toString$2;
4276
-
4277
- var normalizeStringArgument$1 = function (argument, $default) {
4278
- return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument);
4279
- };
4280
-
4281
- var isObject = isObject$d;
4282
- var createNonEnumerableProperty$2 = createNonEnumerableProperty$8;
4283
-
4284
- // `InstallErrorCause` abstract operation
4285
- // https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
4286
- var installErrorCause$1 = function (O, options) {
4287
- if (isObject(options) && 'cause' in options) {
4288
- createNonEnumerableProperty$2(O, 'cause', options.cause);
4289
- }
4290
- };
4291
-
4292
- var uncurryThis = functionUncurryThis;
4293
-
4294
- var $Error = Error;
4295
- var replace = uncurryThis(''.replace);
4296
-
4297
- var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
4298
- // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe
4299
- var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
4300
- var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
4301
-
4302
- var errorStackClear = function (stack, dropEntries) {
4303
- if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
4304
- while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
4305
- } return stack;
4306
- };
4307
-
4308
- var fails$1 = fails$i;
4309
- var createPropertyDescriptor = createPropertyDescriptor$5;
4310
-
4311
- var errorStackInstallable = !fails$1(function () {
4312
- var error = new Error('a');
4313
- if (!('stack' in error)) return true;
4314
- // eslint-disable-next-line es/no-object-defineproperty -- safe
4315
- Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7));
4316
- return error.stack !== 7;
4317
- });
4318
-
4319
- var createNonEnumerableProperty$1 = createNonEnumerableProperty$8;
4320
- var clearErrorStack = errorStackClear;
4321
- var ERROR_STACK_INSTALLABLE = errorStackInstallable;
4322
-
4323
- // non-standard V8
4324
- var captureStackTrace = Error.captureStackTrace;
4325
-
4326
- var errorStackInstall = function (error, C, stack, dropEntries) {
4327
- if (ERROR_STACK_INSTALLABLE) {
4328
- if (captureStackTrace) captureStackTrace(error, C);
4329
- else createNonEnumerableProperty$1(error, 'stack', clearErrorStack(stack, dropEntries));
4330
- }
4331
- };
4332
-
4333
- var getBuiltIn = getBuiltIn$8;
4334
- var hasOwn = hasOwnProperty_1;
4335
- var createNonEnumerableProperty = createNonEnumerableProperty$8;
4336
- var isPrototypeOf = objectIsPrototypeOf;
4337
- var setPrototypeOf = objectSetPrototypeOf;
4338
- var copyConstructorProperties = copyConstructorProperties$2;
4339
- var proxyAccessor = proxyAccessor$1;
4340
- var inheritIfRequired = inheritIfRequired$1;
4341
- var normalizeStringArgument = normalizeStringArgument$1;
4342
- var installErrorCause = installErrorCause$1;
4343
- var installErrorStack = errorStackInstall;
4344
- var DESCRIPTORS$1 = descriptors;
4345
-
4346
- var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
4347
- var STACK_TRACE_LIMIT = 'stackTraceLimit';
4348
- var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
4349
- var path = FULL_NAME.split('.');
4350
- var ERROR_NAME = path[path.length - 1];
4351
- var OriginalError = getBuiltIn.apply(null, path);
4352
-
4353
- if (!OriginalError) return;
4354
-
4355
- var OriginalErrorPrototype = OriginalError.prototype;
4356
-
4357
- // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
4358
- if (hasOwn(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;
4359
-
4360
- if (!FORCED) return OriginalError;
4361
-
4362
- var BaseError = getBuiltIn('Error');
4363
-
4364
- var WrappedError = wrapper(function (a, b) {
4365
- var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
4366
- var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
4367
- if (message !== undefined) createNonEnumerableProperty(result, 'message', message);
4368
- installErrorStack(result, WrappedError, result.stack, 2);
4369
- if (this && isPrototypeOf(OriginalErrorPrototype, this)) inheritIfRequired(result, this, WrappedError);
4370
- if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
4371
- return result;
4372
- });
4373
-
4374
- WrappedError.prototype = OriginalErrorPrototype;
4375
-
4376
- if (ERROR_NAME !== 'Error') {
4377
- if (setPrototypeOf) setPrototypeOf(WrappedError, BaseError);
4378
- else copyConstructorProperties(WrappedError, BaseError, { name: true });
4379
- } else if (DESCRIPTORS$1 && STACK_TRACE_LIMIT in OriginalError) {
4380
- proxyAccessor(WrappedError, OriginalError, STACK_TRACE_LIMIT);
4381
- proxyAccessor(WrappedError, OriginalError, 'prepareStackTrace');
4382
- }
4383
-
4384
- copyConstructorProperties(WrappedError, OriginalError);
4385
-
4386
- try {
4387
- // Safari 13- bug: WebAssembly errors does not have a proper `.name`
4388
- if (OriginalErrorPrototype.name !== ERROR_NAME) {
4389
- createNonEnumerableProperty(OriginalErrorPrototype, 'name', ERROR_NAME);
4390
- }
4391
- OriginalErrorPrototype.constructor = WrappedError;
4392
- } catch (error) { /* empty */ }
4393
-
4394
- return WrappedError;
4395
- };
4396
-
4397
- /* eslint-disable no-unused-vars -- required for functions `.length` */
4398
- var $$2 = _export;
4399
- var globalThis$1 = globalThis_1;
4400
- var apply = functionApply;
4401
- var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
4402
-
4403
- var WEB_ASSEMBLY = 'WebAssembly';
4404
- var WebAssembly = globalThis$1[WEB_ASSEMBLY];
4405
-
4406
- // eslint-disable-next-line es/no-error-cause -- feature detection
4407
- var FORCED$1 = new Error('e', { cause: 7 }).cause !== 7;
4408
-
4409
- var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
4410
- var O = {};
4411
- O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$1);
4412
- $$2({ global: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
4413
- };
4414
-
4415
- var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
4416
- if (WebAssembly && WebAssembly[ERROR_NAME]) {
4417
- var O = {};
4418
- O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$1);
4419
- $$2({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
4420
- }
4421
- };
4422
-
4423
- // https://tc39.es/ecma262/#sec-nativeerror
4424
- exportGlobalErrorCauseWrapper('Error', function (init) {
4425
- return function Error(message) { return apply(init, this, arguments); };
4426
- });
4427
- exportGlobalErrorCauseWrapper('EvalError', function (init) {
4428
- return function EvalError(message) { return apply(init, this, arguments); };
4429
- });
4430
- exportGlobalErrorCauseWrapper('RangeError', function (init) {
4431
- return function RangeError(message) { return apply(init, this, arguments); };
4432
- });
4433
- exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
4434
- return function ReferenceError(message) { return apply(init, this, arguments); };
4435
- });
4436
- exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
4437
- return function SyntaxError(message) { return apply(init, this, arguments); };
4438
- });
4439
- exportGlobalErrorCauseWrapper('TypeError', function (init) {
4440
- return function TypeError(message) { return apply(init, this, arguments); };
4441
- });
4442
- exportGlobalErrorCauseWrapper('URIError', function (init) {
4443
- return function URIError(message) { return apply(init, this, arguments); };
4444
- });
4445
- exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
4446
- return function CompileError(message) { return apply(init, this, arguments); };
4447
- });
4448
- exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
4449
- return function LinkError(message) { return apply(init, this, arguments); };
4450
- });
4451
- exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
4452
- return function RuntimeError(message) { return apply(init, this, arguments); };
4453
- });
4454
-
4455
- var classof = classofRaw$2;
4456
-
4457
- // `IsArray` abstract operation
4458
- // https://tc39.es/ecma262/#sec-isarray
4459
- // eslint-disable-next-line es/no-array-isarray -- safe
4460
- var isArray$1 = Array.isArray || function isArray(argument) {
4461
- return classof(argument) === 'Array';
4462
- };
4463
-
4464
- var DESCRIPTORS = descriptors;
4465
- var isArray = isArray$1;
4466
-
4467
- var $TypeError$1 = TypeError;
4468
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
4469
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
4470
-
4471
- // Safari < 13 does not throw an error in this case
4472
- var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS && !function () {
4473
- // makes no sense without proper strict mode support
4474
- if (this !== undefined) return true;
4475
- try {
4476
- // eslint-disable-next-line es/no-object-defineproperty -- safe
4477
- Object.defineProperty([], 'length', { writable: false }).length = 1;
4478
- } catch (error) {
4479
- return error instanceof TypeError;
4480
- }
4481
- }();
4482
-
4483
- var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
4484
- if (isArray(O) && !getOwnPropertyDescriptor(O, 'length').writable) {
4485
- throw new $TypeError$1('Cannot set read only .length');
4486
- } return O.length = length;
4487
- } : function (O, length) {
4488
- return O.length = length;
4489
- };
4490
-
4491
- var $TypeError = TypeError;
4492
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; // 2 ** 53 - 1 == 9007199254740991
4493
-
4494
- var doesNotExceedSafeInteger$1 = function (it) {
4495
- if (it > MAX_SAFE_INTEGER) throw $TypeError('Maximum allowed index exceeded');
4496
- return it;
4497
- };
4498
-
4499
- var $$1 = _export;
4500
- var toObject = toObject$5;
4501
- var lengthOfArrayLike = lengthOfArrayLike$4;
4502
- var setArrayLength = arraySetLength;
4503
- var doesNotExceedSafeInteger = doesNotExceedSafeInteger$1;
4504
- var fails = fails$i;
4505
-
4506
- var INCORRECT_TO_LENGTH = fails(function () {
4507
- return [].push.call({ length: 0x100000000 }, 1) !== 4294967297;
4508
- });
4509
-
4510
- // V8 <= 121 and Safari <= 15.4; FF < 23 throws InternalError
4511
- // https://bugs.chromium.org/p/v8/issues/detail?id=12681
4512
- var properErrorOnNonWritableLength = function () {
4513
- try {
4514
- // eslint-disable-next-line es/no-object-defineproperty -- safe
4515
- Object.defineProperty([], 'length', { writable: false }).push();
4516
- } catch (error) {
4517
- return error instanceof TypeError;
4518
- }
4519
- };
4520
-
4521
- var FORCED = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
4522
-
4523
- // `Array.prototype.push` method
4524
- // https://tc39.es/ecma262/#sec-array.prototype.push
4525
- $$1({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
4526
- // eslint-disable-next-line no-unused-vars -- required for `.length`
4527
- push: function push(item) {
4528
- var O = toObject(this);
4529
- var len = lengthOfArrayLike(O);
4530
- var argCount = arguments.length;
4531
- doesNotExceedSafeInteger(len + argCount);
4532
- for (var i = 0; i < argCount; i++) {
4533
- O[len] = arguments[i];
4534
- len++;
4535
- }
4536
- setArrayLength(O, len);
4537
- return len;
4538
- }
4539
- });
4540
-
4541
- var $ = _export;
4542
- var iterate = iterate$5;
4543
- var aCallable = aCallable$d;
4544
- var anObject = anObject$f;
4545
- var getIteratorDirect = getIteratorDirect$4;
4546
-
4547
- // `Iterator.prototype.forEach` method
4548
- // https://tc39.es/ecma262/#sec-iterator.prototype.foreach
4549
- $({ target: 'Iterator', proto: true, real: true }, {
4550
- forEach: function forEach(fn) {
4551
- anObject(this);
4552
- aCallable(fn);
4553
- var record = getIteratorDirect(this);
4554
- var counter = 0;
4555
- iterate(record, function (value) {
4556
- fn(value, counter++);
4557
- }, { IS_RECORD: true });
4558
- }
4559
- });
4560
-
4561
- const encoders = {};
4562
- function encode(request, mediaType, schema) {
4563
- if (encoders[mediaType]) {
4564
- return encoders[mediaType](request, mediaType, schema);
4565
- }
4566
- return request;
4567
- }
4568
- encoders['application/json'] = async (request, mediaType, schema) => {
4569
- return request;
4570
- };
4571
- function appendFormData(formData, data, parentKey) {
4572
- if (data instanceof Blob || typeof data === 'string') {
4573
- formData.append(parentKey, data);
4574
- } else if (data !== null && typeof data === 'object') {
4575
- if (Array.isArray(data)) {
4576
- data.forEach((item, index) => {
4577
- const key = `${parentKey}`;
4578
- appendFormData(formData, item, key);
4579
- });
4580
- } else {
4581
- Object.keys(data).forEach(key => {
4582
- const newKey = parentKey ? `${parentKey}[${key}]` : key;
4583
- appendFormData(formData, data[key], newKey);
4584
- });
4585
- }
4586
- } else {
4587
- formData.append(parentKey, data == null ? '' : String(data));
4588
- }
4589
- }
4590
- encoders['multipart/form-data'] = async (request, mediaType, schema) => {
4591
- let _request = request;
4592
- let formData = new FormData();
4593
- Object.keys(_request).forEach(key => {
4594
- appendFormData(formData, _request[key], key);
4595
- });
4596
- return formData;
4597
- };
4598
- encoders['application/octet-stream'] = async (request, mediaType, schema) => {
4599
- return request;
4600
- };
4601
- encoders['application/x-www-form-urlencoded'] = async (request, mediaType, schema) => {
4602
- let formData = new FormData();
4603
- for (let key in request) {
4604
- const value = request[key];
4605
- formData.append(key, value instanceof Blob || typeof value === 'string' ? value : String(value));
4606
- }
4607
- return formData;
4608
- };
4609
- const transformers = {};
4610
- function transform(request, mediaType, schema) {
4611
- if (transformers[mediaType]) {
4612
- return transformers[mediaType](request, mediaType, schema);
4613
- }
4614
- throw new Error(`Unsupported media type: ` + mediaType);
4615
- }
4616
- transformers['application/json'] = async (request, mediaType, schema) => {
4617
- return schema.parse(await request.json());
4618
- };
4619
- transformers['multipart/form-data'] = async (request, mediaType, schema) => {
4620
- let formData = await request.formData();
4621
- let content = {};
4622
- formData.forEach((value, key) => {
4623
- if (content[key]) {
4624
- if (!(content[key] instanceof Array)) {
4625
- content[key] = [content[key]];
4626
- }
4627
- content[key].push(value);
4628
- } else {
4629
- content[key] = value;
4630
- }
4631
- });
4632
- return schema.parse(content);
4633
- };
4634
- transformers['application/octet-stream'] = async (request, mediaType, schema) => {
4635
- return schema.parse(new Blob([await request.arrayBuffer()], {
4636
- type: 'application/octet-stream'
4637
- }));
4638
- };
4639
- transformers['application/x-www-form-urlencoded'] = async (request, mediaType, schema) => {
4640
- let formData = await request.formData();
4641
- let content = {};
4642
- formData.forEach((value, key) => content[key] = value);
4643
- return schema.parse(content);
4644
- };
4645
- transformers['application/xml'] = async (request, mediaType, schema) => {
4646
- let xmlParser = new XMLParser();
4647
- let content = await xmlParser.parse(await request.text());
4648
- return schema.parse(await content);
4649
- };
4650
- transformers['text/plain'] = async (request, mediaType, schema) => {
4651
- return schema.parse(await request.text());
4652
- };
4653
- transformers['text/html'] = async (request, mediaType, schema) => {
4654
- return schema.parse(await request.text());
4655
- };
4656
- transformers['text/css'] = async (request, mediaType, schema) => {
4657
- return schema.parse(await request.text());
4658
- };
4659
- transformers['text/javascript'] = async (request, mediaType, schema) => {
4660
- return schema.parse(await request.text());
4661
- };
4662
- const responseTransformers = {};
4663
- responseTransformers['application/json'] = async (data, mediaType, schema) => {
4664
- return schema.parse(data);
4665
- };
4666
- responseTransformers['application/xml'] = async (data, mediaType, schema) => {
4667
- let parsed = new XMLParser().parse(data);
4668
- return schema.parse(parsed);
4669
- };
4670
- async function transformResponse(data, mediaType, schema) {
4671
- if (responseTransformers[mediaType]) {
4672
- return await responseTransformers[mediaType](data, mediaType, schema);
4673
- }
4674
- return data;
4675
- }
4676
-
4677
- export { IntrigProvider, IntrigProviderStub, StatusTrap, encode, error, init, isError, isInit, isNetworkError, isPending, isRequestValidationError, isResponseValidationError, isSuccess, isSuccessfulDispatch, isValidationError, networkError, pending, requestValidationError, responseValidationError, success, successfulDispatch, transform, transformResponse, useAsNetworkState, useAsPromise, useCentralError, useCentralPendingState, useNetworkState, useResolvedCachedValue, useResolvedValue, validationError };