@intrig/react 1.0.6 → 1.0.10

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