@tryghost/content-api 1.8.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/content-api.js +97 -3
- package/es/content-api.js +1232 -748
- package/es/content-api.js.map +1 -1
- package/lib/{index.js → content-api.js} +28 -3
- package/package.json +13 -12
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -19,13 +19,17 @@ function createCommonjsModule(fn, module) {
|
|
|
19
19
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
function getCjsExportFromNamespace (n) {
|
|
23
|
+
return n && n['default'] || n;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
var check = function (it) {
|
|
23
27
|
return it && it.Math == Math && it;
|
|
24
28
|
};
|
|
25
29
|
|
|
26
30
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
27
31
|
var global_1 =
|
|
28
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
32
|
+
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
29
33
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
30
34
|
check(typeof window == 'object' && window) ||
|
|
31
35
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -44,11 +48,12 @@ var fails = function (exec) {
|
|
|
44
48
|
|
|
45
49
|
// Detect IE8's incomplete defineProperty implementation
|
|
46
50
|
var descriptors = !fails(function () {
|
|
47
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
51
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
48
52
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
49
53
|
});
|
|
50
54
|
|
|
51
55
|
var functionBindNative = !fails(function () {
|
|
56
|
+
// eslint-disable-next-line es-x/no-function-prototype-bind -- safe
|
|
52
57
|
var test = (function () { /* empty */ }).bind();
|
|
53
58
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
54
59
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -61,7 +66,7 @@ var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
|
|
|
61
66
|
};
|
|
62
67
|
|
|
63
68
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
64
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
69
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
65
70
|
var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
|
|
66
71
|
|
|
67
72
|
// Nashorn ~ JDK8 bug
|
|
@@ -159,35 +164,35 @@ var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
|
|
|
159
164
|
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
|
|
160
165
|
|
|
161
166
|
var process$4 = global_1.process;
|
|
162
|
-
var Deno = global_1.Deno;
|
|
163
|
-
var versions = process$4 && process$4.versions || Deno && Deno.version;
|
|
167
|
+
var Deno$1 = global_1.Deno;
|
|
168
|
+
var versions = process$4 && process$4.versions || Deno$1 && Deno$1.version;
|
|
164
169
|
var v8 = versions && versions.v8;
|
|
165
|
-
var match, version;
|
|
170
|
+
var match, version$2;
|
|
166
171
|
|
|
167
172
|
if (v8) {
|
|
168
173
|
match = v8.split('.');
|
|
169
174
|
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
170
175
|
// but their correct versions are not interesting for us
|
|
171
|
-
version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
176
|
+
version$2 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
175
180
|
// so check `userAgent` even if `.v8` exists, but 0
|
|
176
|
-
if (!version && engineUserAgent) {
|
|
181
|
+
if (!version$2 && engineUserAgent) {
|
|
177
182
|
match = engineUserAgent.match(/Edge\/(\d+)/);
|
|
178
183
|
if (!match || match[1] >= 74) {
|
|
179
184
|
match = engineUserAgent.match(/Chrome\/(\d+)/);
|
|
180
|
-
if (match) version = +match[1];
|
|
185
|
+
if (match) version$2 = +match[1];
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
|
|
184
|
-
var engineV8Version = version;
|
|
189
|
+
var engineV8Version = version$2;
|
|
185
190
|
|
|
186
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
191
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
187
192
|
|
|
188
193
|
|
|
189
194
|
|
|
190
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
195
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing
|
|
191
196
|
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
192
197
|
var symbol = Symbol();
|
|
193
198
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -197,7 +202,7 @@ var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
|
197
202
|
!Symbol.sham && engineV8Version && engineV8Version < 41;
|
|
198
203
|
});
|
|
199
204
|
|
|
200
|
-
/* eslint-disable es/no-symbol -- required for testing */
|
|
205
|
+
/* eslint-disable es-x/no-symbol -- required for testing */
|
|
201
206
|
|
|
202
207
|
|
|
203
208
|
var useSymbolAsUid = nativeSymbol
|
|
@@ -250,7 +255,7 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
250
255
|
throw TypeError$f("Can't convert object to primitive value");
|
|
251
256
|
};
|
|
252
257
|
|
|
253
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
258
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
254
259
|
var defineProperty$3 = Object.defineProperty;
|
|
255
260
|
|
|
256
261
|
var setGlobal = function (key, value) {
|
|
@@ -270,10 +275,10 @@ var shared = createCommonjsModule(function (module) {
|
|
|
270
275
|
(module.exports = function (key, value) {
|
|
271
276
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
272
277
|
})('versions', []).push({
|
|
273
|
-
version: '3.
|
|
278
|
+
version: '3.22.4',
|
|
274
279
|
mode: 'global',
|
|
275
280
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
276
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
281
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
|
|
277
282
|
source: 'https://github.com/zloirock/core-js'
|
|
278
283
|
});
|
|
279
284
|
});
|
|
@@ -290,6 +295,7 @@ var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
|
|
|
290
295
|
|
|
291
296
|
// `HasOwnProperty` abstract operation
|
|
292
297
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
298
|
+
// eslint-disable-next-line es-x/no-object-hasown -- safe
|
|
293
299
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
294
300
|
return hasOwnProperty(toObject(it), key);
|
|
295
301
|
};
|
|
@@ -356,13 +362,13 @@ var documentCreateElement = function (it) {
|
|
|
356
362
|
|
|
357
363
|
// Thanks to IE8 for its funny defineProperty
|
|
358
364
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
359
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
365
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
360
366
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
361
367
|
get: function () { return 7; }
|
|
362
368
|
}).a != 7;
|
|
363
369
|
});
|
|
364
370
|
|
|
365
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
371
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
366
372
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
367
373
|
|
|
368
374
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -383,7 +389,7 @@ var objectGetOwnPropertyDescriptor = {
|
|
|
383
389
|
// V8 ~ Chrome 36-
|
|
384
390
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
385
391
|
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
386
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
392
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
387
393
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
388
394
|
value: 42,
|
|
389
395
|
writable: false
|
|
@@ -400,9 +406,9 @@ var anObject = function (argument) {
|
|
|
400
406
|
};
|
|
401
407
|
|
|
402
408
|
var TypeError$c = global_1.TypeError;
|
|
403
|
-
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
409
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
404
410
|
var $defineProperty = Object.defineProperty;
|
|
405
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
411
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
406
412
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
407
413
|
var ENUMERABLE = 'enumerable';
|
|
408
414
|
var CONFIGURABLE$1 = 'configurable';
|
|
@@ -448,6 +454,21 @@ var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
|
448
454
|
return object;
|
|
449
455
|
};
|
|
450
456
|
|
|
457
|
+
var FunctionPrototype$2 = Function.prototype;
|
|
458
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
459
|
+
var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
|
|
460
|
+
|
|
461
|
+
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
462
|
+
// additional protection from minified / mangled / dropped function names
|
|
463
|
+
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
464
|
+
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
465
|
+
|
|
466
|
+
var functionName = {
|
|
467
|
+
EXISTS: EXISTS,
|
|
468
|
+
PROPER: PROPER,
|
|
469
|
+
CONFIGURABLE: CONFIGURABLE
|
|
470
|
+
};
|
|
471
|
+
|
|
451
472
|
var functionToString$1 = functionUncurryThis(Function.toString);
|
|
452
473
|
|
|
453
474
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
@@ -531,50 +552,56 @@ var internalState = {
|
|
|
531
552
|
getterFor: getterFor
|
|
532
553
|
};
|
|
533
554
|
|
|
534
|
-
var
|
|
535
|
-
|
|
536
|
-
var
|
|
537
|
-
|
|
538
|
-
var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
|
|
539
|
-
// additional protection from minified / mangled / dropped function names
|
|
540
|
-
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
541
|
-
var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
|
|
555
|
+
var makeBuiltIn_1 = createCommonjsModule(function (module) {
|
|
556
|
+
var defineProperty = objectDefineProperty.f;
|
|
557
|
+
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
542
558
|
|
|
543
|
-
var functionName = {
|
|
544
|
-
EXISTS: EXISTS,
|
|
545
|
-
PROPER: PROPER,
|
|
546
|
-
CONFIGURABLE: CONFIGURABLE
|
|
547
|
-
};
|
|
548
559
|
|
|
549
|
-
var redefine = createCommonjsModule(function (module) {
|
|
550
|
-
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
551
560
|
|
|
552
|
-
var getInternalState = internalState.get;
|
|
553
561
|
var enforceInternalState = internalState.enforce;
|
|
562
|
+
var getInternalState = internalState.get;
|
|
563
|
+
|
|
564
|
+
var CONFIGURABLE_LENGTH = !fails(function () {
|
|
565
|
+
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
566
|
+
});
|
|
567
|
+
|
|
554
568
|
var TEMPLATE = String(String).split('String');
|
|
555
569
|
|
|
556
|
-
|
|
570
|
+
var makeBuiltIn = module.exports = function (value, name, options) {
|
|
571
|
+
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
572
|
+
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
573
|
+
}
|
|
574
|
+
if (options && options.getter) name = 'get ' + name;
|
|
575
|
+
if (options && options.setter) name = 'set ' + name;
|
|
576
|
+
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
577
|
+
defineProperty(value, 'name', { value: name, configurable: true });
|
|
578
|
+
}
|
|
579
|
+
if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
|
|
580
|
+
defineProperty(value, 'length', { value: options.arity });
|
|
581
|
+
}
|
|
582
|
+
var state = enforceInternalState(value);
|
|
583
|
+
if (!hasOwnProperty_1(state, 'source')) {
|
|
584
|
+
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
585
|
+
} return value;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
|
|
589
|
+
// eslint-disable-next-line no-extend-native -- required
|
|
590
|
+
Function.prototype.toString = makeBuiltIn(function toString() {
|
|
591
|
+
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
592
|
+
}, 'toString');
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
var defineBuiltIn = function (O, key, value, options) {
|
|
557
596
|
var unsafe = options ? !!options.unsafe : false;
|
|
558
597
|
var simple = options ? !!options.enumerable : false;
|
|
559
598
|
var noTargetGet = options ? !!options.noTargetGet : false;
|
|
560
599
|
var name = options && options.name !== undefined ? options.name : key;
|
|
561
|
-
|
|
562
|
-
if (isCallable(value)) {
|
|
563
|
-
if (String(name).slice(0, 7) === 'Symbol(') {
|
|
564
|
-
name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
|
|
565
|
-
}
|
|
566
|
-
if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
|
|
567
|
-
createNonEnumerableProperty(value, 'name', name);
|
|
568
|
-
}
|
|
569
|
-
state = enforceInternalState(value);
|
|
570
|
-
if (!state.source) {
|
|
571
|
-
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
572
|
-
}
|
|
573
|
-
}
|
|
600
|
+
if (isCallable(value)) makeBuiltIn_1(value, name, options);
|
|
574
601
|
if (O === global_1) {
|
|
575
602
|
if (simple) O[key] = value;
|
|
576
603
|
else setGlobal(key, value);
|
|
577
|
-
return;
|
|
604
|
+
return O;
|
|
578
605
|
} else if (!unsafe) {
|
|
579
606
|
delete O[key];
|
|
580
607
|
} else if (!noTargetGet && O[key]) {
|
|
@@ -582,11 +609,8 @@ var TEMPLATE = String(String).split('String');
|
|
|
582
609
|
}
|
|
583
610
|
if (simple) O[key] = value;
|
|
584
611
|
else createNonEnumerableProperty(O, key, value);
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
|
588
|
-
});
|
|
589
|
-
});
|
|
612
|
+
return O;
|
|
613
|
+
};
|
|
590
614
|
|
|
591
615
|
var ceil = Math.ceil;
|
|
592
616
|
var floor = Math.floor;
|
|
@@ -686,7 +710,7 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
686
710
|
|
|
687
711
|
// `Object.getOwnPropertyNames` method
|
|
688
712
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
689
|
-
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
713
|
+
// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe
|
|
690
714
|
var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
691
715
|
return objectKeysInternal(O, hiddenKeys);
|
|
692
716
|
};
|
|
@@ -695,7 +719,7 @@ var objectGetOwnPropertyNames = {
|
|
|
695
719
|
f: f$3
|
|
696
720
|
};
|
|
697
721
|
|
|
698
|
-
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
722
|
+
// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe
|
|
699
723
|
var f$2 = Object.getOwnPropertySymbols;
|
|
700
724
|
|
|
701
725
|
var objectGetOwnPropertySymbols = {
|
|
@@ -793,32 +817,10 @@ var _export = function (options, source) {
|
|
|
793
817
|
if (options.sham || (targetProperty && targetProperty.sham)) {
|
|
794
818
|
createNonEnumerableProperty(sourceProperty, 'sham', true);
|
|
795
819
|
}
|
|
796
|
-
|
|
797
|
-
redefine(target, key, sourceProperty, options);
|
|
820
|
+
defineBuiltIn(target, key, sourceProperty, options);
|
|
798
821
|
}
|
|
799
822
|
};
|
|
800
823
|
|
|
801
|
-
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
802
|
-
var method = [][METHOD_NAME];
|
|
803
|
-
return !!method && fails(function () {
|
|
804
|
-
// eslint-disable-next-line no-useless-call -- required for testing
|
|
805
|
-
method.call(null, argument || function () { return 1; }, 1);
|
|
806
|
-
});
|
|
807
|
-
};
|
|
808
|
-
|
|
809
|
-
var un$Join = functionUncurryThis([].join);
|
|
810
|
-
|
|
811
|
-
var ES3_STRINGS = indexedObject != Object;
|
|
812
|
-
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
|
|
813
|
-
|
|
814
|
-
// `Array.prototype.join` method
|
|
815
|
-
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
816
|
-
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
|
|
817
|
-
join: function join(separator) {
|
|
818
|
-
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
819
|
-
}
|
|
820
|
-
});
|
|
821
|
-
|
|
822
824
|
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
823
825
|
var test = {};
|
|
824
826
|
|
|
@@ -851,205 +853,84 @@ var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
|
851
853
|
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
852
854
|
};
|
|
853
855
|
|
|
854
|
-
|
|
855
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
856
|
-
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
857
|
-
return '[object ' + classof(this) + ']';
|
|
858
|
-
};
|
|
856
|
+
var String$3 = global_1.String;
|
|
859
857
|
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
}
|
|
858
|
+
var toString_1 = function (argument) {
|
|
859
|
+
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
860
|
+
return String$3(argument);
|
|
861
|
+
};
|
|
865
862
|
|
|
866
|
-
// `
|
|
867
|
-
// https://tc39.es/ecma262/#sec-
|
|
868
|
-
|
|
869
|
-
var
|
|
870
|
-
|
|
863
|
+
// `RegExp.prototype.flags` getter implementation
|
|
864
|
+
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
865
|
+
var regexpFlags = function () {
|
|
866
|
+
var that = anObject(this);
|
|
867
|
+
var result = '';
|
|
868
|
+
if (that.hasIndices) result += 'd';
|
|
869
|
+
if (that.global) result += 'g';
|
|
870
|
+
if (that.ignoreCase) result += 'i';
|
|
871
|
+
if (that.multiline) result += 'm';
|
|
872
|
+
if (that.dotAll) result += 's';
|
|
873
|
+
if (that.unicode) result += 'u';
|
|
874
|
+
if (that.sticky) result += 'y';
|
|
875
|
+
return result;
|
|
871
876
|
};
|
|
872
877
|
|
|
873
|
-
|
|
878
|
+
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
879
|
+
var $RegExp$2 = global_1.RegExp;
|
|
874
880
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
return objectKeys(toObject(it));
|
|
880
|
-
}
|
|
881
|
+
var UNSUPPORTED_Y$1 = fails(function () {
|
|
882
|
+
var re = $RegExp$2('a', 'y');
|
|
883
|
+
re.lastIndex = 2;
|
|
884
|
+
return re.exec('abcd') != null;
|
|
881
885
|
});
|
|
882
886
|
|
|
883
|
-
//
|
|
884
|
-
// https://
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
};
|
|
887
|
+
// UC Browser bug
|
|
888
|
+
// https://github.com/zloirock/core-js/issues/1008
|
|
889
|
+
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
|
|
890
|
+
return !$RegExp$2('a', 'y').sticky;
|
|
891
|
+
});
|
|
889
892
|
|
|
890
|
-
var
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
893
|
+
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
894
|
+
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
895
|
+
var re = $RegExp$2('^r', 'gy');
|
|
896
|
+
re.lastIndex = 2;
|
|
897
|
+
return re.exec('str') != null;
|
|
898
|
+
});
|
|
895
899
|
|
|
896
|
-
var
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
900
|
+
var regexpStickyHelpers = {
|
|
901
|
+
BROKEN_CARET: BROKEN_CARET,
|
|
902
|
+
MISSED_STICKY: MISSED_STICKY,
|
|
903
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
904
|
+
};
|
|
902
905
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
} catch (error) {
|
|
909
|
-
return false;
|
|
910
|
-
}
|
|
906
|
+
// `Object.keys` method
|
|
907
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
908
|
+
// eslint-disable-next-line es-x/no-object-keys -- safe
|
|
909
|
+
var objectKeys = Object.keys || function keys(O) {
|
|
910
|
+
return objectKeysInternal(O, enumBugKeys);
|
|
911
911
|
};
|
|
912
912
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
} catch (error) {
|
|
926
|
-
return true;
|
|
927
|
-
}
|
|
913
|
+
// `Object.defineProperties` method
|
|
914
|
+
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
915
|
+
// eslint-disable-next-line es-x/no-object-defineproperties -- safe
|
|
916
|
+
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
917
|
+
anObject(O);
|
|
918
|
+
var props = toIndexedObject(Properties);
|
|
919
|
+
var keys = objectKeys(Properties);
|
|
920
|
+
var length = keys.length;
|
|
921
|
+
var index = 0;
|
|
922
|
+
var key;
|
|
923
|
+
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
924
|
+
return O;
|
|
928
925
|
};
|
|
929
926
|
|
|
930
|
-
|
|
927
|
+
var objectDefineProperties = {
|
|
928
|
+
f: f$1
|
|
929
|
+
};
|
|
931
930
|
|
|
932
|
-
|
|
933
|
-
// https://tc39.es/ecma262/#sec-isconstructor
|
|
934
|
-
var isConstructor = !construct || fails(function () {
|
|
935
|
-
var called;
|
|
936
|
-
return isConstructorModern(isConstructorModern.call)
|
|
937
|
-
|| !isConstructorModern(Object)
|
|
938
|
-
|| !isConstructorModern(function () { called = true; })
|
|
939
|
-
|| called;
|
|
940
|
-
}) ? isConstructorLegacy : isConstructorModern;
|
|
931
|
+
var html = getBuiltIn('document', 'documentElement');
|
|
941
932
|
|
|
942
|
-
|
|
943
|
-
var Array$1 = global_1.Array;
|
|
944
|
-
|
|
945
|
-
// a part of `ArraySpeciesCreate` abstract operation
|
|
946
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
947
|
-
var arraySpeciesConstructor = function (originalArray) {
|
|
948
|
-
var C;
|
|
949
|
-
if (isArray$1(originalArray)) {
|
|
950
|
-
C = originalArray.constructor;
|
|
951
|
-
// cross-realm fallback
|
|
952
|
-
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
953
|
-
else if (isObject$1(C)) {
|
|
954
|
-
C = C[SPECIES$5];
|
|
955
|
-
if (C === null) C = undefined;
|
|
956
|
-
}
|
|
957
|
-
} return C === undefined ? Array$1 : C;
|
|
958
|
-
};
|
|
959
|
-
|
|
960
|
-
// `ArraySpeciesCreate` abstract operation
|
|
961
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
962
|
-
var arraySpeciesCreate = function (originalArray, length) {
|
|
963
|
-
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
var SPECIES$4 = wellKnownSymbol('species');
|
|
967
|
-
|
|
968
|
-
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
969
|
-
// We can't use this feature detection in V8 since it causes
|
|
970
|
-
// deoptimization and serious performance degradation
|
|
971
|
-
// https://github.com/zloirock/core-js/issues/677
|
|
972
|
-
return engineV8Version >= 51 || !fails(function () {
|
|
973
|
-
var array = [];
|
|
974
|
-
var constructor = array.constructor = {};
|
|
975
|
-
constructor[SPECIES$4] = function () {
|
|
976
|
-
return { foo: 1 };
|
|
977
|
-
};
|
|
978
|
-
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
979
|
-
});
|
|
980
|
-
};
|
|
981
|
-
|
|
982
|
-
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
983
|
-
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
984
|
-
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
985
|
-
var TypeError$a = global_1.TypeError;
|
|
986
|
-
|
|
987
|
-
// We can't use this feature detection in V8 since it causes
|
|
988
|
-
// deoptimization and serious performance degradation
|
|
989
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
990
|
-
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
991
|
-
var array = [];
|
|
992
|
-
array[IS_CONCAT_SPREADABLE] = false;
|
|
993
|
-
return array.concat()[0] !== array;
|
|
994
|
-
});
|
|
995
|
-
|
|
996
|
-
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
997
|
-
|
|
998
|
-
var isConcatSpreadable = function (O) {
|
|
999
|
-
if (!isObject$1(O)) return false;
|
|
1000
|
-
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1001
|
-
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
1005
|
-
|
|
1006
|
-
// `Array.prototype.concat` method
|
|
1007
|
-
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1008
|
-
// with adding support of @@isConcatSpreadable and @@species
|
|
1009
|
-
_export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
1010
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1011
|
-
concat: function concat(arg) {
|
|
1012
|
-
var O = toObject(this);
|
|
1013
|
-
var A = arraySpeciesCreate(O, 0);
|
|
1014
|
-
var n = 0;
|
|
1015
|
-
var i, k, length, len, E;
|
|
1016
|
-
for (i = -1, length = arguments.length; i < length; i++) {
|
|
1017
|
-
E = i === -1 ? O : arguments[i];
|
|
1018
|
-
if (isConcatSpreadable(E)) {
|
|
1019
|
-
len = lengthOfArrayLike(E);
|
|
1020
|
-
if (n + len > MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1021
|
-
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
1022
|
-
} else {
|
|
1023
|
-
if (n >= MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1024
|
-
createProperty(A, n++, E);
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
A.length = n;
|
|
1028
|
-
return A;
|
|
1029
|
-
}
|
|
1030
|
-
});
|
|
1031
|
-
|
|
1032
|
-
// `Object.defineProperties` method
|
|
1033
|
-
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
1034
|
-
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
1035
|
-
var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
1036
|
-
anObject(O);
|
|
1037
|
-
var props = toIndexedObject(Properties);
|
|
1038
|
-
var keys = objectKeys(Properties);
|
|
1039
|
-
var length = keys.length;
|
|
1040
|
-
var index = 0;
|
|
1041
|
-
var key;
|
|
1042
|
-
while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
|
|
1043
|
-
return O;
|
|
1044
|
-
};
|
|
1045
|
-
|
|
1046
|
-
var objectDefineProperties = {
|
|
1047
|
-
f: f$1
|
|
1048
|
-
};
|
|
1049
|
-
|
|
1050
|
-
var html = getBuiltIn('document', 'documentElement');
|
|
1051
|
-
|
|
1052
|
-
/* global ActiveXObject -- old IE, WSH */
|
|
933
|
+
/* global ActiveXObject -- old IE, WSH */
|
|
1053
934
|
|
|
1054
935
|
|
|
1055
936
|
|
|
@@ -1120,6 +1001,7 @@ hiddenKeys$1[IE_PROTO] = true;
|
|
|
1120
1001
|
|
|
1121
1002
|
// `Object.create` method
|
|
1122
1003
|
// https://tc39.es/ecma262/#sec-object.create
|
|
1004
|
+
// eslint-disable-next-line es-x/no-object-create -- safe
|
|
1123
1005
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1124
1006
|
var result;
|
|
1125
1007
|
if (O !== null) {
|
|
@@ -1132,86 +1014,6 @@ var objectCreate = Object.create || function create(O, Properties) {
|
|
|
1132
1014
|
return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
|
|
1133
1015
|
};
|
|
1134
1016
|
|
|
1135
|
-
var UNSCOPABLES = wellKnownSymbol('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
|
-
objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
|
|
1142
|
-
configurable: true,
|
|
1143
|
-
value: objectCreate(null)
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
// add a key to Array.prototype[@@unscopables]
|
|
1148
|
-
var addToUnscopables = function (key) {
|
|
1149
|
-
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
var $includes = arrayIncludes.includes;
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
// `Array.prototype.includes` method
|
|
1156
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1157
|
-
_export({ target: 'Array', proto: true }, {
|
|
1158
|
-
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1159
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1160
|
-
}
|
|
1161
|
-
});
|
|
1162
|
-
|
|
1163
|
-
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1164
|
-
addToUnscopables('includes');
|
|
1165
|
-
|
|
1166
|
-
var String$3 = global_1.String;
|
|
1167
|
-
|
|
1168
|
-
var toString_1 = function (argument) {
|
|
1169
|
-
if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
|
|
1170
|
-
return String$3(argument);
|
|
1171
|
-
};
|
|
1172
|
-
|
|
1173
|
-
// `RegExp.prototype.flags` getter implementation
|
|
1174
|
-
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
1175
|
-
var regexpFlags = function () {
|
|
1176
|
-
var that = anObject(this);
|
|
1177
|
-
var result = '';
|
|
1178
|
-
if (that.global) result += 'g';
|
|
1179
|
-
if (that.ignoreCase) result += 'i';
|
|
1180
|
-
if (that.multiline) result += 'm';
|
|
1181
|
-
if (that.dotAll) result += 's';
|
|
1182
|
-
if (that.unicode) result += 'u';
|
|
1183
|
-
if (that.sticky) result += 'y';
|
|
1184
|
-
return result;
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
1188
|
-
var $RegExp$2 = global_1.RegExp;
|
|
1189
|
-
|
|
1190
|
-
var UNSUPPORTED_Y$1 = fails(function () {
|
|
1191
|
-
var re = $RegExp$2('a', 'y');
|
|
1192
|
-
re.lastIndex = 2;
|
|
1193
|
-
return re.exec('abcd') != null;
|
|
1194
|
-
});
|
|
1195
|
-
|
|
1196
|
-
// UC Browser bug
|
|
1197
|
-
// https://github.com/zloirock/core-js/issues/1008
|
|
1198
|
-
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
|
|
1199
|
-
return !$RegExp$2('a', 'y').sticky;
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
1203
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1204
|
-
var re = $RegExp$2('^r', 'gy');
|
|
1205
|
-
re.lastIndex = 2;
|
|
1206
|
-
return re.exec('str') != null;
|
|
1207
|
-
});
|
|
1208
|
-
|
|
1209
|
-
var regexpStickyHelpers = {
|
|
1210
|
-
BROKEN_CARET: BROKEN_CARET,
|
|
1211
|
-
MISSED_STICKY: MISSED_STICKY,
|
|
1212
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
1017
|
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
1216
1018
|
var $RegExp$1 = global_1.RegExp;
|
|
1217
1019
|
|
|
@@ -1238,7 +1040,7 @@ var regexpUnsupportedNcg = fails(function () {
|
|
|
1238
1040
|
|
|
1239
1041
|
|
|
1240
1042
|
|
|
1241
|
-
var getInternalState
|
|
1043
|
+
var getInternalState = internalState.get;
|
|
1242
1044
|
|
|
1243
1045
|
|
|
1244
1046
|
|
|
@@ -1268,7 +1070,7 @@ var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexp
|
|
|
1268
1070
|
if (PATCH) {
|
|
1269
1071
|
patchedExec = function exec(string) {
|
|
1270
1072
|
var re = this;
|
|
1271
|
-
var state = getInternalState
|
|
1073
|
+
var state = getInternalState(re);
|
|
1272
1074
|
var str = toString_1(string);
|
|
1273
1075
|
var raw = state.raw;
|
|
1274
1076
|
var result, reCopy, lastIndex, match, i, object, group;
|
|
@@ -1361,7 +1163,7 @@ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
|
|
|
1361
1163
|
|
|
1362
1164
|
|
|
1363
1165
|
|
|
1364
|
-
var SPECIES$
|
|
1166
|
+
var SPECIES$5 = wellKnownSymbol('species');
|
|
1365
1167
|
var RegExpPrototype = RegExp.prototype;
|
|
1366
1168
|
|
|
1367
1169
|
var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
@@ -1387,7 +1189,7 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
1387
1189
|
// RegExp[@@split] doesn't call the regex's exec method, but first creates
|
|
1388
1190
|
// a new one. We need to return the patched regex when creating the new one.
|
|
1389
1191
|
re.constructor = {};
|
|
1390
|
-
re.constructor[SPECIES$
|
|
1192
|
+
re.constructor[SPECIES$5] = function () { return re; };
|
|
1391
1193
|
re.flags = '';
|
|
1392
1194
|
re[SYMBOL] = /./[SYMBOL];
|
|
1393
1195
|
}
|
|
@@ -1419,8 +1221,8 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
|
|
|
1419
1221
|
return { done: false };
|
|
1420
1222
|
});
|
|
1421
1223
|
|
|
1422
|
-
|
|
1423
|
-
|
|
1224
|
+
defineBuiltIn(String.prototype, KEY, methods[0]);
|
|
1225
|
+
defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
|
|
1424
1226
|
}
|
|
1425
1227
|
|
|
1426
1228
|
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
@@ -1466,7 +1268,7 @@ var advanceStringIndex = function (S, index, unicode) {
|
|
|
1466
1268
|
return index + (unicode ? charAt(S, index).length : 1);
|
|
1467
1269
|
};
|
|
1468
1270
|
|
|
1469
|
-
var TypeError$
|
|
1271
|
+
var TypeError$a = global_1.TypeError;
|
|
1470
1272
|
|
|
1471
1273
|
// `RegExpExec` abstract operation
|
|
1472
1274
|
// https://tc39.es/ecma262/#sec-regexpexec
|
|
@@ -1478,7 +1280,7 @@ var regexpExecAbstract = function (R, S) {
|
|
|
1478
1280
|
return result;
|
|
1479
1281
|
}
|
|
1480
1282
|
if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
|
|
1481
|
-
throw TypeError$
|
|
1283
|
+
throw TypeError$a('RegExp#exec called on incompatible receiver');
|
|
1482
1284
|
};
|
|
1483
1285
|
|
|
1484
1286
|
// @@match logic
|
|
@@ -1518,6 +1320,235 @@ fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa
|
|
|
1518
1320
|
];
|
|
1519
1321
|
});
|
|
1520
1322
|
|
|
1323
|
+
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
1324
|
+
var method = [][METHOD_NAME];
|
|
1325
|
+
return !!method && fails(function () {
|
|
1326
|
+
// eslint-disable-next-line no-useless-call -- required for testing
|
|
1327
|
+
method.call(null, argument || function () { return 1; }, 1);
|
|
1328
|
+
});
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
var un$Join = functionUncurryThis([].join);
|
|
1332
|
+
|
|
1333
|
+
var ES3_STRINGS = indexedObject != Object;
|
|
1334
|
+
var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
|
|
1335
|
+
|
|
1336
|
+
// `Array.prototype.join` method
|
|
1337
|
+
// https://tc39.es/ecma262/#sec-array.prototype.join
|
|
1338
|
+
_export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
|
|
1339
|
+
join: function join(separator) {
|
|
1340
|
+
return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
// `Object.prototype.toString` method implementation
|
|
1345
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1346
|
+
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
1347
|
+
return '[object ' + classof(this) + ']';
|
|
1348
|
+
};
|
|
1349
|
+
|
|
1350
|
+
// `Object.prototype.toString` method
|
|
1351
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1352
|
+
if (!toStringTagSupport) {
|
|
1353
|
+
defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
1357
|
+
|
|
1358
|
+
// `Object.keys` method
|
|
1359
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
1360
|
+
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
1361
|
+
keys: function keys(it) {
|
|
1362
|
+
return objectKeys(toObject(it));
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
|
|
1366
|
+
// `IsArray` abstract operation
|
|
1367
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
1368
|
+
// eslint-disable-next-line es-x/no-array-isarray -- safe
|
|
1369
|
+
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
1370
|
+
return classofRaw(argument) == 'Array';
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
var createProperty = function (object, key, value) {
|
|
1374
|
+
var propertyKey = toPropertyKey(key);
|
|
1375
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
1376
|
+
else object[propertyKey] = value;
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
var noop = function () { /* empty */ };
|
|
1380
|
+
var empty = [];
|
|
1381
|
+
var construct = getBuiltIn('Reflect', 'construct');
|
|
1382
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1383
|
+
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
1384
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1385
|
+
|
|
1386
|
+
var isConstructorModern = function isConstructor(argument) {
|
|
1387
|
+
if (!isCallable(argument)) return false;
|
|
1388
|
+
try {
|
|
1389
|
+
construct(noop, empty, argument);
|
|
1390
|
+
return true;
|
|
1391
|
+
} catch (error) {
|
|
1392
|
+
return false;
|
|
1393
|
+
}
|
|
1394
|
+
};
|
|
1395
|
+
|
|
1396
|
+
var isConstructorLegacy = function isConstructor(argument) {
|
|
1397
|
+
if (!isCallable(argument)) return false;
|
|
1398
|
+
switch (classof(argument)) {
|
|
1399
|
+
case 'AsyncFunction':
|
|
1400
|
+
case 'GeneratorFunction':
|
|
1401
|
+
case 'AsyncGeneratorFunction': return false;
|
|
1402
|
+
}
|
|
1403
|
+
try {
|
|
1404
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1405
|
+
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1406
|
+
// (for example, `DOMQuad` and similar in FF41-)
|
|
1407
|
+
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
1408
|
+
} catch (error) {
|
|
1409
|
+
return true;
|
|
1410
|
+
}
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
isConstructorLegacy.sham = true;
|
|
1414
|
+
|
|
1415
|
+
// `IsConstructor` abstract operation
|
|
1416
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1417
|
+
var isConstructor = !construct || fails(function () {
|
|
1418
|
+
var called;
|
|
1419
|
+
return isConstructorModern(isConstructorModern.call)
|
|
1420
|
+
|| !isConstructorModern(Object)
|
|
1421
|
+
|| !isConstructorModern(function () { called = true; })
|
|
1422
|
+
|| called;
|
|
1423
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
1424
|
+
|
|
1425
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
1426
|
+
var Array$1 = global_1.Array;
|
|
1427
|
+
|
|
1428
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
1429
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1430
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
1431
|
+
var C;
|
|
1432
|
+
if (isArray$1(originalArray)) {
|
|
1433
|
+
C = originalArray.constructor;
|
|
1434
|
+
// cross-realm fallback
|
|
1435
|
+
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
1436
|
+
else if (isObject$1(C)) {
|
|
1437
|
+
C = C[SPECIES$4];
|
|
1438
|
+
if (C === null) C = undefined;
|
|
1439
|
+
}
|
|
1440
|
+
} return C === undefined ? Array$1 : C;
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
// `ArraySpeciesCreate` abstract operation
|
|
1444
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
1445
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
1446
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
1450
|
+
|
|
1451
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
1452
|
+
// We can't use this feature detection in V8 since it causes
|
|
1453
|
+
// deoptimization and serious performance degradation
|
|
1454
|
+
// https://github.com/zloirock/core-js/issues/677
|
|
1455
|
+
return engineV8Version >= 51 || !fails(function () {
|
|
1456
|
+
var array = [];
|
|
1457
|
+
var constructor = array.constructor = {};
|
|
1458
|
+
constructor[SPECIES$3] = function () {
|
|
1459
|
+
return { foo: 1 };
|
|
1460
|
+
};
|
|
1461
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
1462
|
+
});
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
1466
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
1467
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
1468
|
+
var TypeError$9 = global_1.TypeError;
|
|
1469
|
+
|
|
1470
|
+
// We can't use this feature detection in V8 since it causes
|
|
1471
|
+
// deoptimization and serious performance degradation
|
|
1472
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
1473
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
1474
|
+
var array = [];
|
|
1475
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
1476
|
+
return array.concat()[0] !== array;
|
|
1477
|
+
});
|
|
1478
|
+
|
|
1479
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
1480
|
+
|
|
1481
|
+
var isConcatSpreadable = function (O) {
|
|
1482
|
+
if (!isObject$1(O)) return false;
|
|
1483
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
1484
|
+
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
1485
|
+
};
|
|
1486
|
+
|
|
1487
|
+
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
1488
|
+
|
|
1489
|
+
// `Array.prototype.concat` method
|
|
1490
|
+
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
1491
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
1492
|
+
_export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
|
|
1493
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
1494
|
+
concat: function concat(arg) {
|
|
1495
|
+
var O = toObject(this);
|
|
1496
|
+
var A = arraySpeciesCreate(O, 0);
|
|
1497
|
+
var n = 0;
|
|
1498
|
+
var i, k, length, len, E;
|
|
1499
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
1500
|
+
E = i === -1 ? O : arguments[i];
|
|
1501
|
+
if (isConcatSpreadable(E)) {
|
|
1502
|
+
len = lengthOfArrayLike(E);
|
|
1503
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1504
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
1505
|
+
} else {
|
|
1506
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
1507
|
+
createProperty(A, n++, E);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
A.length = n;
|
|
1511
|
+
return A;
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
1516
|
+
var ArrayPrototype$1 = Array.prototype;
|
|
1517
|
+
|
|
1518
|
+
// Array.prototype[@@unscopables]
|
|
1519
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1520
|
+
if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
|
|
1521
|
+
objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
|
|
1522
|
+
configurable: true,
|
|
1523
|
+
value: objectCreate(null)
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
// add a key to Array.prototype[@@unscopables]
|
|
1528
|
+
var addToUnscopables = function (key) {
|
|
1529
|
+
ArrayPrototype$1[UNSCOPABLES][key] = true;
|
|
1530
|
+
};
|
|
1531
|
+
|
|
1532
|
+
var $includes = arrayIncludes.includes;
|
|
1533
|
+
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
// FF99+ bug
|
|
1537
|
+
var BROKEN_ON_SPARSE = fails(function () {
|
|
1538
|
+
return !Array(1).includes();
|
|
1539
|
+
});
|
|
1540
|
+
|
|
1541
|
+
// `Array.prototype.includes` method
|
|
1542
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1543
|
+
_export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
|
|
1544
|
+
includes: function includes(el /* , fromIndex = 0 */) {
|
|
1545
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
|
|
1549
|
+
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
1550
|
+
addToUnscopables('includes');
|
|
1551
|
+
|
|
1521
1552
|
var MATCH$1 = wellKnownSymbol('match');
|
|
1522
1553
|
|
|
1523
1554
|
// `IsRegExp` abstract operation
|
|
@@ -1557,7 +1588,7 @@ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
|
|
|
1557
1588
|
|
|
1558
1589
|
|
|
1559
1590
|
|
|
1560
|
-
// eslint-disable-next-line es/no-string-prototype-endswith -- safe
|
|
1591
|
+
// eslint-disable-next-line es-x/no-string-prototype-endswith -- safe
|
|
1561
1592
|
var un$EndsWith = functionUncurryThis(''.endsWith);
|
|
1562
1593
|
var slice = functionUncurryThis(''.slice);
|
|
1563
1594
|
var min$1 = Math.min;
|
|
@@ -1593,7 +1624,7 @@ var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
|
1593
1624
|
|
|
1594
1625
|
|
|
1595
1626
|
|
|
1596
|
-
// eslint-disable-next-line es/no-string-prototype-startswith -- safe
|
|
1627
|
+
// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe
|
|
1597
1628
|
var un$StartsWith = functionUncurryThis(''.startsWith);
|
|
1598
1629
|
var stringSlice = functionUncurryThis(''.slice);
|
|
1599
1630
|
var min = Math.min;
|
|
@@ -1619,12 +1650,7 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
|
|
|
1619
1650
|
}
|
|
1620
1651
|
});
|
|
1621
1652
|
|
|
1622
|
-
var
|
|
1623
|
-
|
|
1624
|
-
var redefineAll = function (target, src, options) {
|
|
1625
|
-
for (var key in src) redefine(target, key, src[key], options);
|
|
1626
|
-
return target;
|
|
1627
|
-
};
|
|
1653
|
+
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1628
1654
|
|
|
1629
1655
|
var String$2 = global_1.String;
|
|
1630
1656
|
var TypeError$7 = global_1.TypeError;
|
|
@@ -1642,13 +1668,13 @@ var aPossiblePrototype = function (argument) {
|
|
|
1642
1668
|
// `Object.setPrototypeOf` method
|
|
1643
1669
|
// https://tc39.es/ecma262/#sec-object.setprototypeof
|
|
1644
1670
|
// Works with __proto__ only. Old v8 can't work with null proto objects.
|
|
1645
|
-
// eslint-disable-next-line es/no-object-setprototypeof -- safe
|
|
1671
|
+
// eslint-disable-next-line es-x/no-object-setprototypeof -- safe
|
|
1646
1672
|
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
|
1647
1673
|
var CORRECT_SETTER = false;
|
|
1648
1674
|
var test = {};
|
|
1649
1675
|
var setter;
|
|
1650
1676
|
try {
|
|
1651
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
1677
|
+
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
1652
1678
|
setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
|
|
1653
1679
|
setter(test, []);
|
|
1654
1680
|
CORRECT_SETTER = test instanceof Array;
|
|
@@ -1682,174 +1708,26 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
|
1682
1708
|
var defineProperty = objectDefineProperty.f;
|
|
1683
1709
|
|
|
1684
1710
|
if (descriptors && Constructor && !Constructor[SPECIES$2]) {
|
|
1685
|
-
defineProperty(Constructor, SPECIES$2, {
|
|
1686
|
-
configurable: true,
|
|
1687
|
-
get: function () { return this; }
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
};
|
|
1691
|
-
|
|
1692
|
-
var TypeError$6 = global_1.TypeError;
|
|
1693
|
-
|
|
1694
|
-
var anInstance = function (it, Prototype) {
|
|
1695
|
-
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
1696
|
-
throw TypeError$6('Incorrect invocation');
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
var bind$2 = functionUncurryThis(functionUncurryThis.bind);
|
|
1700
|
-
|
|
1701
|
-
// optional / simple context binding
|
|
1702
|
-
var functionBindContext = function (fn, that) {
|
|
1703
|
-
aCallable(fn);
|
|
1704
|
-
return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
|
|
1705
|
-
return fn.apply(that, arguments);
|
|
1706
|
-
};
|
|
1707
|
-
};
|
|
1708
|
-
|
|
1709
|
-
var iterators = {};
|
|
1710
|
-
|
|
1711
|
-
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
1712
|
-
var ArrayPrototype = Array.prototype;
|
|
1713
|
-
|
|
1714
|
-
// check on default Array iterator
|
|
1715
|
-
var isArrayIteratorMethod = function (it) {
|
|
1716
|
-
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
1717
|
-
};
|
|
1718
|
-
|
|
1719
|
-
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
1720
|
-
|
|
1721
|
-
var getIteratorMethod = function (it) {
|
|
1722
|
-
if (it != undefined) return getMethod(it, ITERATOR$1)
|
|
1723
|
-
|| getMethod(it, '@@iterator')
|
|
1724
|
-
|| iterators[classof(it)];
|
|
1725
|
-
};
|
|
1726
|
-
|
|
1727
|
-
var TypeError$5 = global_1.TypeError;
|
|
1728
|
-
|
|
1729
|
-
var getIterator = function (argument, usingIterator) {
|
|
1730
|
-
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
1731
|
-
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
1732
|
-
throw TypeError$5(tryToString(argument) + ' is not iterable');
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
|
-
var iteratorClose = function (iterator, kind, value) {
|
|
1736
|
-
var innerResult, innerError;
|
|
1737
|
-
anObject(iterator);
|
|
1738
|
-
try {
|
|
1739
|
-
innerResult = getMethod(iterator, 'return');
|
|
1740
|
-
if (!innerResult) {
|
|
1741
|
-
if (kind === 'throw') throw value;
|
|
1742
|
-
return value;
|
|
1743
|
-
}
|
|
1744
|
-
innerResult = functionCall(innerResult, iterator);
|
|
1745
|
-
} catch (error) {
|
|
1746
|
-
innerError = true;
|
|
1747
|
-
innerResult = error;
|
|
1748
|
-
}
|
|
1749
|
-
if (kind === 'throw') throw value;
|
|
1750
|
-
if (innerError) throw innerResult;
|
|
1751
|
-
anObject(innerResult);
|
|
1752
|
-
return value;
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
|
-
var TypeError$4 = global_1.TypeError;
|
|
1756
|
-
|
|
1757
|
-
var Result = function (stopped, result) {
|
|
1758
|
-
this.stopped = stopped;
|
|
1759
|
-
this.result = result;
|
|
1760
|
-
};
|
|
1761
|
-
|
|
1762
|
-
var ResultPrototype = Result.prototype;
|
|
1763
|
-
|
|
1764
|
-
var iterate = function (iterable, unboundFunction, options) {
|
|
1765
|
-
var that = options && options.that;
|
|
1766
|
-
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
1767
|
-
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
1768
|
-
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
1769
|
-
var fn = functionBindContext(unboundFunction, that);
|
|
1770
|
-
var iterator, iterFn, index, length, result, next, step;
|
|
1771
|
-
|
|
1772
|
-
var stop = function (condition) {
|
|
1773
|
-
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
1774
|
-
return new Result(true, condition);
|
|
1775
|
-
};
|
|
1776
|
-
|
|
1777
|
-
var callFn = function (value) {
|
|
1778
|
-
if (AS_ENTRIES) {
|
|
1779
|
-
anObject(value);
|
|
1780
|
-
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
1781
|
-
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
1782
|
-
};
|
|
1783
|
-
|
|
1784
|
-
if (IS_ITERATOR) {
|
|
1785
|
-
iterator = iterable;
|
|
1786
|
-
} else {
|
|
1787
|
-
iterFn = getIteratorMethod(iterable);
|
|
1788
|
-
if (!iterFn) throw TypeError$4(tryToString(iterable) + ' is not iterable');
|
|
1789
|
-
// optimisation for array iterators
|
|
1790
|
-
if (isArrayIteratorMethod(iterFn)) {
|
|
1791
|
-
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
1792
|
-
result = callFn(iterable[index]);
|
|
1793
|
-
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1794
|
-
} return new Result(false);
|
|
1795
|
-
}
|
|
1796
|
-
iterator = getIterator(iterable, iterFn);
|
|
1797
|
-
}
|
|
1798
|
-
|
|
1799
|
-
next = iterator.next;
|
|
1800
|
-
while (!(step = functionCall(next, iterator)).done) {
|
|
1801
|
-
try {
|
|
1802
|
-
result = callFn(step.value);
|
|
1803
|
-
} catch (error) {
|
|
1804
|
-
iteratorClose(iterator, 'throw', error);
|
|
1805
|
-
}
|
|
1806
|
-
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
1807
|
-
} return new Result(false);
|
|
1808
|
-
};
|
|
1809
|
-
|
|
1810
|
-
var ITERATOR = wellKnownSymbol('iterator');
|
|
1811
|
-
var SAFE_CLOSING = false;
|
|
1812
|
-
|
|
1813
|
-
try {
|
|
1814
|
-
var called = 0;
|
|
1815
|
-
var iteratorWithReturn = {
|
|
1816
|
-
next: function () {
|
|
1817
|
-
return { done: !!called++ };
|
|
1818
|
-
},
|
|
1819
|
-
'return': function () {
|
|
1820
|
-
SAFE_CLOSING = true;
|
|
1821
|
-
}
|
|
1822
|
-
};
|
|
1823
|
-
iteratorWithReturn[ITERATOR] = function () {
|
|
1824
|
-
return this;
|
|
1825
|
-
};
|
|
1826
|
-
// eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
|
|
1827
|
-
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
1828
|
-
} catch (error) { /* empty */ }
|
|
1711
|
+
defineProperty(Constructor, SPECIES$2, {
|
|
1712
|
+
configurable: true,
|
|
1713
|
+
get: function () { return this; }
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
};
|
|
1829
1717
|
|
|
1830
|
-
var
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
object[ITERATOR] = function () {
|
|
1836
|
-
return {
|
|
1837
|
-
next: function () {
|
|
1838
|
-
return { done: ITERATION_SUPPORT = true };
|
|
1839
|
-
}
|
|
1840
|
-
};
|
|
1841
|
-
};
|
|
1842
|
-
exec(object);
|
|
1843
|
-
} catch (error) { /* empty */ }
|
|
1844
|
-
return ITERATION_SUPPORT;
|
|
1718
|
+
var TypeError$6 = global_1.TypeError;
|
|
1719
|
+
|
|
1720
|
+
var anInstance = function (it, Prototype) {
|
|
1721
|
+
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
1722
|
+
throw TypeError$6('Incorrect invocation');
|
|
1845
1723
|
};
|
|
1846
1724
|
|
|
1847
|
-
var TypeError$
|
|
1725
|
+
var TypeError$5 = global_1.TypeError;
|
|
1848
1726
|
|
|
1849
1727
|
// `Assert: IsConstructor(argument) is true`
|
|
1850
1728
|
var aConstructor = function (argument) {
|
|
1851
1729
|
if (isConstructor(argument)) return argument;
|
|
1852
|
-
throw TypeError$
|
|
1730
|
+
throw TypeError$5(tryToString(argument) + ' is not a constructor');
|
|
1853
1731
|
};
|
|
1854
1732
|
|
|
1855
1733
|
var SPECIES$1 = wellKnownSymbol('species');
|
|
@@ -1866,24 +1744,32 @@ var FunctionPrototype$1 = Function.prototype;
|
|
|
1866
1744
|
var apply = FunctionPrototype$1.apply;
|
|
1867
1745
|
var call = FunctionPrototype$1.call;
|
|
1868
1746
|
|
|
1869
|
-
// eslint-disable-next-line es/no-reflect -- safe
|
|
1747
|
+
// eslint-disable-next-line es-x/no-reflect -- safe
|
|
1870
1748
|
var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
|
|
1871
1749
|
return call.apply(apply, arguments);
|
|
1872
1750
|
});
|
|
1873
1751
|
|
|
1752
|
+
var bind$2 = functionUncurryThis(functionUncurryThis.bind);
|
|
1753
|
+
|
|
1754
|
+
// optional / simple context binding
|
|
1755
|
+
var functionBindContext = function (fn, that) {
|
|
1756
|
+
aCallable(fn);
|
|
1757
|
+
return that === undefined ? fn : functionBindNative ? bind$2(fn, that) : function (/* ...args */) {
|
|
1758
|
+
return fn.apply(that, arguments);
|
|
1759
|
+
};
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1874
1762
|
var arraySlice = functionUncurryThis([].slice);
|
|
1875
1763
|
|
|
1876
|
-
var TypeError$
|
|
1764
|
+
var TypeError$4 = global_1.TypeError;
|
|
1877
1765
|
|
|
1878
1766
|
var validateArgumentsLength = function (passed, required) {
|
|
1879
|
-
if (passed < required) throw TypeError$
|
|
1767
|
+
if (passed < required) throw TypeError$4('Not enough arguments');
|
|
1880
1768
|
return passed;
|
|
1881
1769
|
};
|
|
1882
1770
|
|
|
1883
1771
|
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
1884
1772
|
|
|
1885
|
-
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
1886
|
-
|
|
1887
1773
|
var set = global_1.setImmediate;
|
|
1888
1774
|
var clear = global_1.clearImmediate;
|
|
1889
1775
|
var process$3 = global_1.process;
|
|
@@ -2055,7 +1941,7 @@ if (!queueMicrotask) {
|
|
|
2055
1941
|
// for other environments - macrotask based on:
|
|
2056
1942
|
// - setImmediate
|
|
2057
1943
|
// - MessageChannel
|
|
2058
|
-
// - window.
|
|
1944
|
+
// - window.postMessage
|
|
2059
1945
|
// - onreadystatechange
|
|
2060
1946
|
// - setTimeout
|
|
2061
1947
|
} else {
|
|
@@ -2076,36 +1962,6 @@ var microtask = queueMicrotask || function (fn) {
|
|
|
2076
1962
|
} last = task;
|
|
2077
1963
|
};
|
|
2078
1964
|
|
|
2079
|
-
var PromiseCapability = function (C) {
|
|
2080
|
-
var resolve, reject;
|
|
2081
|
-
this.promise = new C(function ($$resolve, $$reject) {
|
|
2082
|
-
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
2083
|
-
resolve = $$resolve;
|
|
2084
|
-
reject = $$reject;
|
|
2085
|
-
});
|
|
2086
|
-
this.resolve = aCallable(resolve);
|
|
2087
|
-
this.reject = aCallable(reject);
|
|
2088
|
-
};
|
|
2089
|
-
|
|
2090
|
-
// `NewPromiseCapability` abstract operation
|
|
2091
|
-
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
2092
|
-
var f = function (C) {
|
|
2093
|
-
return new PromiseCapability(C);
|
|
2094
|
-
};
|
|
2095
|
-
|
|
2096
|
-
var newPromiseCapability$1 = {
|
|
2097
|
-
f: f
|
|
2098
|
-
};
|
|
2099
|
-
|
|
2100
|
-
var promiseResolve = function (C, x) {
|
|
2101
|
-
anObject(C);
|
|
2102
|
-
if (isObject$1(x) && x.constructor === C) return x;
|
|
2103
|
-
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2104
|
-
var resolve = promiseCapability.resolve;
|
|
2105
|
-
resolve(x);
|
|
2106
|
-
return promiseCapability.promise;
|
|
2107
|
-
};
|
|
2108
|
-
|
|
2109
1965
|
var hostReportErrors = function (a, b) {
|
|
2110
1966
|
var console = global_1.console;
|
|
2111
1967
|
if (console && console.error) {
|
|
@@ -2145,13 +2001,67 @@ Queue.prototype = {
|
|
|
2145
2001
|
|
|
2146
2002
|
var queue = Queue;
|
|
2147
2003
|
|
|
2148
|
-
var
|
|
2004
|
+
var promiseNativeConstructor = global_1.Promise;
|
|
2149
2005
|
|
|
2150
|
-
var
|
|
2006
|
+
var engineIsBrowser = typeof window == 'object' && typeof Deno != 'object';
|
|
2007
|
+
|
|
2008
|
+
promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2009
|
+
var SPECIES = wellKnownSymbol('species');
|
|
2010
|
+
var SUBCLASSING = false;
|
|
2011
|
+
var NATIVE_PROMISE_REJECTION_EVENT$1 = isCallable(global_1.PromiseRejectionEvent);
|
|
2012
|
+
|
|
2013
|
+
var FORCED_PROMISE_CONSTRUCTOR$5 = isForced_1('Promise', function () {
|
|
2014
|
+
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(promiseNativeConstructor);
|
|
2015
|
+
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(promiseNativeConstructor);
|
|
2016
|
+
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
2017
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
2018
|
+
// We can't detect it synchronously, so just check versions
|
|
2019
|
+
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
2020
|
+
// We can't use @@species feature detection in V8 since it causes
|
|
2021
|
+
// deoptimization and performance degradation
|
|
2022
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
2023
|
+
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
2024
|
+
// Detect correctness of subclassing with @@species support
|
|
2025
|
+
var promise = new promiseNativeConstructor(function (resolve) { resolve(1); });
|
|
2026
|
+
var FakePromise = function (exec) {
|
|
2027
|
+
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
2028
|
+
};
|
|
2029
|
+
var constructor = promise.constructor = {};
|
|
2030
|
+
constructor[SPECIES] = FakePromise;
|
|
2031
|
+
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
2032
|
+
if (!SUBCLASSING) return true;
|
|
2033
|
+
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
2034
|
+
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_PROMISE_REJECTION_EVENT$1;
|
|
2035
|
+
});
|
|
2036
|
+
|
|
2037
|
+
var promiseConstructorDetection = {
|
|
2038
|
+
CONSTRUCTOR: FORCED_PROMISE_CONSTRUCTOR$5,
|
|
2039
|
+
REJECTION_EVENT: NATIVE_PROMISE_REJECTION_EVENT$1,
|
|
2040
|
+
SUBCLASSING: SUBCLASSING
|
|
2041
|
+
};
|
|
2151
2042
|
|
|
2043
|
+
var PromiseCapability = function (C) {
|
|
2044
|
+
var resolve, reject;
|
|
2045
|
+
this.promise = new C(function ($$resolve, $$reject) {
|
|
2046
|
+
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
|
|
2047
|
+
resolve = $$resolve;
|
|
2048
|
+
reject = $$reject;
|
|
2049
|
+
});
|
|
2050
|
+
this.resolve = aCallable(resolve);
|
|
2051
|
+
this.reject = aCallable(reject);
|
|
2052
|
+
};
|
|
2152
2053
|
|
|
2054
|
+
// `NewPromiseCapability` abstract operation
|
|
2055
|
+
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
2056
|
+
var f = function (C) {
|
|
2057
|
+
return new PromiseCapability(C);
|
|
2058
|
+
};
|
|
2153
2059
|
|
|
2060
|
+
var newPromiseCapability$1 = {
|
|
2061
|
+
f: f
|
|
2062
|
+
};
|
|
2154
2063
|
|
|
2064
|
+
var task = task$1.set;
|
|
2155
2065
|
|
|
2156
2066
|
|
|
2157
2067
|
|
|
@@ -2161,23 +2071,22 @@ var task = task$1.set;
|
|
|
2161
2071
|
|
|
2162
2072
|
|
|
2163
2073
|
|
|
2164
|
-
var SPECIES = wellKnownSymbol('species');
|
|
2165
2074
|
var PROMISE = 'Promise';
|
|
2166
|
-
|
|
2167
|
-
var
|
|
2168
|
-
var
|
|
2075
|
+
var FORCED_PROMISE_CONSTRUCTOR$4 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2076
|
+
var NATIVE_PROMISE_REJECTION_EVENT = promiseConstructorDetection.REJECTION_EVENT;
|
|
2077
|
+
var NATIVE_PROMISE_SUBCLASSING = promiseConstructorDetection.SUBCLASSING;
|
|
2169
2078
|
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
2170
|
-
var
|
|
2171
|
-
var
|
|
2172
|
-
var
|
|
2173
|
-
var
|
|
2079
|
+
var setInternalState = internalState.set;
|
|
2080
|
+
var NativePromisePrototype$1 = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2081
|
+
var PromiseConstructor = promiseNativeConstructor;
|
|
2082
|
+
var PromisePrototype = NativePromisePrototype$1;
|
|
2083
|
+
var TypeError$3 = global_1.TypeError;
|
|
2174
2084
|
var document$1 = global_1.document;
|
|
2175
2085
|
var process$1 = global_1.process;
|
|
2176
2086
|
var newPromiseCapability = newPromiseCapability$1.f;
|
|
2177
2087
|
var newGenericPromiseCapability = newPromiseCapability;
|
|
2178
2088
|
|
|
2179
2089
|
var DISPATCH_EVENT = !!(document$1 && document$1.createEvent && global_1.dispatchEvent);
|
|
2180
|
-
var NATIVE_REJECTION_EVENT = isCallable(global_1.PromiseRejectionEvent);
|
|
2181
2090
|
var UNHANDLED_REJECTION = 'unhandledrejection';
|
|
2182
2091
|
var REJECTION_HANDLED = 'rejectionhandled';
|
|
2183
2092
|
var PENDING = 0;
|
|
@@ -2185,38 +2094,9 @@ var FULFILLED = 1;
|
|
|
2185
2094
|
var REJECTED = 2;
|
|
2186
2095
|
var HANDLED = 1;
|
|
2187
2096
|
var UNHANDLED = 2;
|
|
2188
|
-
var SUBCLASSING = false;
|
|
2189
2097
|
|
|
2190
2098
|
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
2191
2099
|
|
|
2192
|
-
var FORCED = isForced_1(PROMISE, function () {
|
|
2193
|
-
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
2194
|
-
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
2195
|
-
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
2196
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
|
|
2197
|
-
// We can't detect it synchronously, so just check versions
|
|
2198
|
-
if (!GLOBAL_CORE_JS_PROMISE && engineV8Version === 66) return true;
|
|
2199
|
-
// We can't use @@species feature detection in V8 since it causes
|
|
2200
|
-
// deoptimization and performance degradation
|
|
2201
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
2202
|
-
if (engineV8Version >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
|
|
2203
|
-
// Detect correctness of subclassing with @@species support
|
|
2204
|
-
var promise = new PromiseConstructor(function (resolve) { resolve(1); });
|
|
2205
|
-
var FakePromise = function (exec) {
|
|
2206
|
-
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
2207
|
-
};
|
|
2208
|
-
var constructor = promise.constructor = {};
|
|
2209
|
-
constructor[SPECIES] = FakePromise;
|
|
2210
|
-
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
2211
|
-
if (!SUBCLASSING) return true;
|
|
2212
|
-
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
2213
|
-
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT;
|
|
2214
|
-
});
|
|
2215
|
-
|
|
2216
|
-
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
2217
|
-
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
2218
|
-
});
|
|
2219
|
-
|
|
2220
2100
|
// helpers
|
|
2221
2101
|
var isThenable = function (it) {
|
|
2222
2102
|
var then;
|
|
@@ -2247,7 +2127,7 @@ var callReaction = function (reaction, state) {
|
|
|
2247
2127
|
}
|
|
2248
2128
|
}
|
|
2249
2129
|
if (result === reaction.promise) {
|
|
2250
|
-
reject(TypeError$
|
|
2130
|
+
reject(TypeError$3('Promise-chain cycle'));
|
|
2251
2131
|
} else if (then = isThenable(result)) {
|
|
2252
2132
|
functionCall(then, result, resolve, reject);
|
|
2253
2133
|
} else resolve(result);
|
|
@@ -2281,7 +2161,7 @@ var dispatchEvent = function (name, promise, reason) {
|
|
|
2281
2161
|
event.initEvent(name, false, true);
|
|
2282
2162
|
global_1.dispatchEvent(event);
|
|
2283
2163
|
} else event = { promise: promise, reason: reason };
|
|
2284
|
-
if (!
|
|
2164
|
+
if (!NATIVE_PROMISE_REJECTION_EVENT && (handler = global_1['on' + name])) handler(event);
|
|
2285
2165
|
else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
|
|
2286
2166
|
};
|
|
2287
2167
|
|
|
@@ -2337,7 +2217,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2337
2217
|
state.done = true;
|
|
2338
2218
|
if (unwrap) state = unwrap;
|
|
2339
2219
|
try {
|
|
2340
|
-
if (state.facade === value) throw TypeError$
|
|
2220
|
+
if (state.facade === value) throw TypeError$3("Promise can't be resolved itself");
|
|
2341
2221
|
var then = isThenable(value);
|
|
2342
2222
|
if (then) {
|
|
2343
2223
|
microtask(function () {
|
|
@@ -2362,20 +2242,22 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2362
2242
|
};
|
|
2363
2243
|
|
|
2364
2244
|
// constructor polyfill
|
|
2365
|
-
if (
|
|
2245
|
+
if (FORCED_PROMISE_CONSTRUCTOR$4) {
|
|
2366
2246
|
// 25.4.3.1 Promise(executor)
|
|
2367
2247
|
PromiseConstructor = function Promise(executor) {
|
|
2368
2248
|
anInstance(this, PromisePrototype);
|
|
2369
2249
|
aCallable(executor);
|
|
2370
2250
|
functionCall(Internal, this);
|
|
2371
|
-
var state =
|
|
2251
|
+
var state = getInternalPromiseState(this);
|
|
2372
2252
|
try {
|
|
2373
2253
|
executor(bind$1(internalResolve, state), bind$1(internalReject, state));
|
|
2374
2254
|
} catch (error) {
|
|
2375
2255
|
internalReject(state, error);
|
|
2376
2256
|
}
|
|
2377
2257
|
};
|
|
2258
|
+
|
|
2378
2259
|
PromisePrototype = PromiseConstructor.prototype;
|
|
2260
|
+
|
|
2379
2261
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2380
2262
|
Internal = function Promise(executor) {
|
|
2381
2263
|
setInternalState(this, {
|
|
@@ -2389,105 +2271,220 @@ if (FORCED) {
|
|
|
2389
2271
|
value: undefined
|
|
2390
2272
|
});
|
|
2391
2273
|
};
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
return reaction.promise;
|
|
2408
|
-
},
|
|
2409
|
-
// `Promise.prototype.catch` method
|
|
2410
|
-
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2411
|
-
'catch': function (onRejected) {
|
|
2412
|
-
return this.then(undefined, onRejected);
|
|
2413
|
-
}
|
|
2274
|
+
|
|
2275
|
+
// `Promise.prototype.then` method
|
|
2276
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
2277
|
+
Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
|
|
2278
|
+
var state = getInternalPromiseState(this);
|
|
2279
|
+
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
2280
|
+
state.parent = true;
|
|
2281
|
+
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
2282
|
+
reaction.fail = isCallable(onRejected) && onRejected;
|
|
2283
|
+
reaction.domain = engineIsNode ? process$1.domain : undefined;
|
|
2284
|
+
if (state.state == PENDING) state.reactions.add(reaction);
|
|
2285
|
+
else microtask(function () {
|
|
2286
|
+
callReaction(reaction, state);
|
|
2287
|
+
});
|
|
2288
|
+
return reaction.promise;
|
|
2414
2289
|
});
|
|
2290
|
+
|
|
2415
2291
|
OwnPromiseCapability = function () {
|
|
2416
2292
|
var promise = new Internal();
|
|
2417
|
-
var state =
|
|
2293
|
+
var state = getInternalPromiseState(promise);
|
|
2418
2294
|
this.promise = promise;
|
|
2419
2295
|
this.resolve = bind$1(internalResolve, state);
|
|
2420
2296
|
this.reject = bind$1(internalReject, state);
|
|
2421
2297
|
};
|
|
2298
|
+
|
|
2422
2299
|
newPromiseCapability$1.f = newPromiseCapability = function (C) {
|
|
2423
2300
|
return C === PromiseConstructor || C === PromiseWrapper
|
|
2424
2301
|
? new OwnPromiseCapability(C)
|
|
2425
2302
|
: newGenericPromiseCapability(C);
|
|
2426
2303
|
};
|
|
2427
2304
|
|
|
2428
|
-
if (isCallable(
|
|
2429
|
-
nativeThen = NativePromisePrototype.then;
|
|
2305
|
+
if (isCallable(promiseNativeConstructor) && NativePromisePrototype$1 !== Object.prototype) {
|
|
2306
|
+
nativeThen = NativePromisePrototype$1.then;
|
|
2430
2307
|
|
|
2431
|
-
if (!
|
|
2308
|
+
if (!NATIVE_PROMISE_SUBCLASSING) {
|
|
2432
2309
|
// make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
|
|
2433
|
-
|
|
2310
|
+
defineBuiltIn(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
|
|
2434
2311
|
var that = this;
|
|
2435
2312
|
return new PromiseConstructor(function (resolve, reject) {
|
|
2436
2313
|
functionCall(nativeThen, that, resolve, reject);
|
|
2437
2314
|
}).then(onFulfilled, onRejected);
|
|
2438
2315
|
// https://github.com/zloirock/core-js/issues/640
|
|
2439
2316
|
}, { unsafe: true });
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
// make `.constructor === Promise` work for native promise-based APIs
|
|
2320
|
+
try {
|
|
2321
|
+
delete NativePromisePrototype$1.constructor;
|
|
2322
|
+
} catch (error) { /* empty */ }
|
|
2323
|
+
|
|
2324
|
+
// make `instanceof Promise` work for native promise-based APIs
|
|
2325
|
+
if (objectSetPrototypeOf) {
|
|
2326
|
+
objectSetPrototypeOf(NativePromisePrototype$1, PromisePrototype);
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
_export({ global: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
|
|
2332
|
+
Promise: PromiseConstructor
|
|
2333
|
+
});
|
|
2334
|
+
|
|
2335
|
+
setToStringTag(PromiseConstructor, PROMISE, false);
|
|
2336
|
+
setSpecies(PROMISE);
|
|
2337
|
+
|
|
2338
|
+
var iterators = {};
|
|
2339
|
+
|
|
2340
|
+
var ITERATOR$2 = wellKnownSymbol('iterator');
|
|
2341
|
+
var ArrayPrototype = Array.prototype;
|
|
2342
|
+
|
|
2343
|
+
// check on default Array iterator
|
|
2344
|
+
var isArrayIteratorMethod = function (it) {
|
|
2345
|
+
return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR$2] === it);
|
|
2346
|
+
};
|
|
2347
|
+
|
|
2348
|
+
var ITERATOR$1 = wellKnownSymbol('iterator');
|
|
2349
|
+
|
|
2350
|
+
var getIteratorMethod = function (it) {
|
|
2351
|
+
if (it != undefined) return getMethod(it, ITERATOR$1)
|
|
2352
|
+
|| getMethod(it, '@@iterator')
|
|
2353
|
+
|| iterators[classof(it)];
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
var TypeError$2 = global_1.TypeError;
|
|
2357
|
+
|
|
2358
|
+
var getIterator = function (argument, usingIterator) {
|
|
2359
|
+
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
2360
|
+
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
2361
|
+
throw TypeError$2(tryToString(argument) + ' is not iterable');
|
|
2362
|
+
};
|
|
2363
|
+
|
|
2364
|
+
var iteratorClose = function (iterator, kind, value) {
|
|
2365
|
+
var innerResult, innerError;
|
|
2366
|
+
anObject(iterator);
|
|
2367
|
+
try {
|
|
2368
|
+
innerResult = getMethod(iterator, 'return');
|
|
2369
|
+
if (!innerResult) {
|
|
2370
|
+
if (kind === 'throw') throw value;
|
|
2371
|
+
return value;
|
|
2372
|
+
}
|
|
2373
|
+
innerResult = functionCall(innerResult, iterator);
|
|
2374
|
+
} catch (error) {
|
|
2375
|
+
innerError = true;
|
|
2376
|
+
innerResult = error;
|
|
2377
|
+
}
|
|
2378
|
+
if (kind === 'throw') throw value;
|
|
2379
|
+
if (innerError) throw innerResult;
|
|
2380
|
+
anObject(innerResult);
|
|
2381
|
+
return value;
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2384
|
+
var TypeError$1 = global_1.TypeError;
|
|
2385
|
+
|
|
2386
|
+
var Result = function (stopped, result) {
|
|
2387
|
+
this.stopped = stopped;
|
|
2388
|
+
this.result = result;
|
|
2389
|
+
};
|
|
2390
|
+
|
|
2391
|
+
var ResultPrototype = Result.prototype;
|
|
2392
|
+
|
|
2393
|
+
var iterate = function (iterable, unboundFunction, options) {
|
|
2394
|
+
var that = options && options.that;
|
|
2395
|
+
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
|
2396
|
+
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
|
2397
|
+
var INTERRUPTED = !!(options && options.INTERRUPTED);
|
|
2398
|
+
var fn = functionBindContext(unboundFunction, that);
|
|
2399
|
+
var iterator, iterFn, index, length, result, next, step;
|
|
2400
|
+
|
|
2401
|
+
var stop = function (condition) {
|
|
2402
|
+
if (iterator) iteratorClose(iterator, 'normal', condition);
|
|
2403
|
+
return new Result(true, condition);
|
|
2404
|
+
};
|
|
2405
|
+
|
|
2406
|
+
var callFn = function (value) {
|
|
2407
|
+
if (AS_ENTRIES) {
|
|
2408
|
+
anObject(value);
|
|
2409
|
+
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
|
2410
|
+
} return INTERRUPTED ? fn(value, stop) : fn(value);
|
|
2411
|
+
};
|
|
2440
2412
|
|
|
2441
|
-
|
|
2442
|
-
|
|
2413
|
+
if (IS_ITERATOR) {
|
|
2414
|
+
iterator = iterable;
|
|
2415
|
+
} else {
|
|
2416
|
+
iterFn = getIteratorMethod(iterable);
|
|
2417
|
+
if (!iterFn) throw TypeError$1(tryToString(iterable) + ' is not iterable');
|
|
2418
|
+
// optimisation for array iterators
|
|
2419
|
+
if (isArrayIteratorMethod(iterFn)) {
|
|
2420
|
+
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
2421
|
+
result = callFn(iterable[index]);
|
|
2422
|
+
if (result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2423
|
+
} return new Result(false);
|
|
2443
2424
|
}
|
|
2425
|
+
iterator = getIterator(iterable, iterFn);
|
|
2426
|
+
}
|
|
2444
2427
|
|
|
2445
|
-
|
|
2428
|
+
next = iterator.next;
|
|
2429
|
+
while (!(step = functionCall(next, iterator)).done) {
|
|
2446
2430
|
try {
|
|
2447
|
-
|
|
2448
|
-
} catch (error) {
|
|
2449
|
-
|
|
2450
|
-
// make `instanceof Promise` work for native promise-based APIs
|
|
2451
|
-
if (objectSetPrototypeOf) {
|
|
2452
|
-
objectSetPrototypeOf(NativePromisePrototype, PromisePrototype);
|
|
2431
|
+
result = callFn(step.value);
|
|
2432
|
+
} catch (error) {
|
|
2433
|
+
iteratorClose(iterator, 'throw', error);
|
|
2453
2434
|
}
|
|
2454
|
-
|
|
2455
|
-
}
|
|
2435
|
+
if (typeof result == 'object' && result && objectIsPrototypeOf(ResultPrototype, result)) return result;
|
|
2436
|
+
} return new Result(false);
|
|
2437
|
+
};
|
|
2456
2438
|
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
});
|
|
2439
|
+
var ITERATOR = wellKnownSymbol('iterator');
|
|
2440
|
+
var SAFE_CLOSING = false;
|
|
2460
2441
|
|
|
2461
|
-
|
|
2462
|
-
|
|
2442
|
+
try {
|
|
2443
|
+
var called = 0;
|
|
2444
|
+
var iteratorWithReturn = {
|
|
2445
|
+
next: function () {
|
|
2446
|
+
return { done: !!called++ };
|
|
2447
|
+
},
|
|
2448
|
+
'return': function () {
|
|
2449
|
+
SAFE_CLOSING = true;
|
|
2450
|
+
}
|
|
2451
|
+
};
|
|
2452
|
+
iteratorWithReturn[ITERATOR] = function () {
|
|
2453
|
+
return this;
|
|
2454
|
+
};
|
|
2455
|
+
// eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing
|
|
2456
|
+
Array.from(iteratorWithReturn, function () { throw 2; });
|
|
2457
|
+
} catch (error) { /* empty */ }
|
|
2463
2458
|
|
|
2464
|
-
|
|
2459
|
+
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
2460
|
+
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
|
|
2461
|
+
var ITERATION_SUPPORT = false;
|
|
2462
|
+
try {
|
|
2463
|
+
var object = {};
|
|
2464
|
+
object[ITERATOR] = function () {
|
|
2465
|
+
return {
|
|
2466
|
+
next: function () {
|
|
2467
|
+
return { done: ITERATION_SUPPORT = true };
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
};
|
|
2471
|
+
exec(object);
|
|
2472
|
+
} catch (error) { /* empty */ }
|
|
2473
|
+
return ITERATION_SUPPORT;
|
|
2474
|
+
};
|
|
2465
2475
|
|
|
2466
|
-
|
|
2467
|
-
_export({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
2468
|
-
// `Promise.reject` method
|
|
2469
|
-
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2470
|
-
reject: function reject(r) {
|
|
2471
|
-
var capability = newPromiseCapability(this);
|
|
2472
|
-
functionCall(capability.reject, undefined, r);
|
|
2473
|
-
return capability.promise;
|
|
2474
|
-
}
|
|
2475
|
-
});
|
|
2476
|
+
var FORCED_PROMISE_CONSTRUCTOR$3 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2476
2477
|
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2480
|
-
resolve: function resolve(x) {
|
|
2481
|
-
return promiseResolve(this, x);
|
|
2482
|
-
}
|
|
2478
|
+
var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCorrectnessOfIteration(function (iterable) {
|
|
2479
|
+
promiseNativeConstructor.all(iterable).then(undefined, function () { /* empty */ });
|
|
2483
2480
|
});
|
|
2484
2481
|
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2482
|
+
// `Promise.all` method
|
|
2483
|
+
// https://tc39.es/ecma262/#sec-promise.all
|
|
2484
|
+
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2488
2485
|
all: function all(iterable) {
|
|
2489
2486
|
var C = this;
|
|
2490
|
-
var capability = newPromiseCapability(C);
|
|
2487
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2491
2488
|
var resolve = capability.resolve;
|
|
2492
2489
|
var reject = capability.reject;
|
|
2493
2490
|
var result = perform(function () {
|
|
@@ -2510,12 +2507,39 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2510
2507
|
});
|
|
2511
2508
|
if (result.error) reject(result.value);
|
|
2512
2509
|
return capability.promise;
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
|
-
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
|
|
2513
|
+
var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2514
|
+
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
|
|
2518
|
+
|
|
2519
|
+
var NativePromisePrototype = promiseNativeConstructor && promiseNativeConstructor.prototype;
|
|
2520
|
+
|
|
2521
|
+
// `Promise.prototype.catch` method
|
|
2522
|
+
// https://tc39.es/ecma262/#sec-promise.prototype.catch
|
|
2523
|
+
_export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
|
|
2524
|
+
'catch': function (onRejected) {
|
|
2525
|
+
return this.then(undefined, onRejected);
|
|
2526
|
+
}
|
|
2527
|
+
});
|
|
2528
|
+
|
|
2529
|
+
// makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
|
|
2530
|
+
if (isCallable(promiseNativeConstructor)) {
|
|
2531
|
+
var method = getBuiltIn('Promise').prototype['catch'];
|
|
2532
|
+
if (NativePromisePrototype['catch'] !== method) {
|
|
2533
|
+
defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
// `Promise.race` method
|
|
2538
|
+
// https://tc39.es/ecma262/#sec-promise.race
|
|
2539
|
+
_export({ target: 'Promise', stat: true, forced: promiseStaticsIncorrectIteration }, {
|
|
2516
2540
|
race: function race(iterable) {
|
|
2517
2541
|
var C = this;
|
|
2518
|
-
var capability = newPromiseCapability(C);
|
|
2542
|
+
var capability = newPromiseCapability$1.f(C);
|
|
2519
2543
|
var reject = capability.reject;
|
|
2520
2544
|
var result = perform(function () {
|
|
2521
2545
|
var $promiseResolve = aCallable(C.resolve);
|
|
@@ -2528,9 +2552,43 @@ _export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
|
|
|
2528
2552
|
}
|
|
2529
2553
|
});
|
|
2530
2554
|
|
|
2531
|
-
|
|
2555
|
+
var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
|
|
2556
|
+
|
|
2557
|
+
// `Promise.reject` method
|
|
2558
|
+
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2559
|
+
_export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
|
|
2560
|
+
reject: function reject(r) {
|
|
2561
|
+
var capability = newPromiseCapability$1.f(this);
|
|
2562
|
+
functionCall(capability.reject, undefined, r);
|
|
2563
|
+
return capability.promise;
|
|
2564
|
+
}
|
|
2565
|
+
});
|
|
2566
|
+
|
|
2567
|
+
var promiseResolve = function (C, x) {
|
|
2568
|
+
anObject(C);
|
|
2569
|
+
if (isObject$1(x) && x.constructor === C) return x;
|
|
2570
|
+
var promiseCapability = newPromiseCapability$1.f(C);
|
|
2571
|
+
var resolve = promiseCapability.resolve;
|
|
2572
|
+
resolve(x);
|
|
2573
|
+
return promiseCapability.promise;
|
|
2574
|
+
};
|
|
2575
|
+
|
|
2576
|
+
var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
|
|
2577
|
+
|
|
2578
|
+
|
|
2579
|
+
getBuiltIn('Promise');
|
|
2580
|
+
|
|
2581
|
+
// `Promise.resolve` method
|
|
2582
|
+
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2583
|
+
_export({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
2584
|
+
resolve: function resolve(x) {
|
|
2585
|
+
return promiseResolve(this, x);
|
|
2586
|
+
}
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
// eslint-disable-next-line es-x/no-object-assign -- safe
|
|
2532
2590
|
var $assign = Object.assign;
|
|
2533
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2591
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
2534
2592
|
var defineProperty$1 = Object.defineProperty;
|
|
2535
2593
|
var concat = functionUncurryThis([].concat);
|
|
2536
2594
|
|
|
@@ -2550,7 +2608,7 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2550
2608
|
// should work with symbols and should have deterministic property order (V8 bug)
|
|
2551
2609
|
var A = {};
|
|
2552
2610
|
var B = {};
|
|
2553
|
-
// eslint-disable-next-line es/no-symbol -- safe
|
|
2611
|
+
// eslint-disable-next-line es-x/no-symbol -- safe
|
|
2554
2612
|
var symbol = Symbol();
|
|
2555
2613
|
var alphabet = 'abcdefghijklmnopqrst';
|
|
2556
2614
|
A[symbol] = 7;
|
|
@@ -2577,8 +2635,8 @@ var objectAssign = !$assign || fails(function () {
|
|
|
2577
2635
|
|
|
2578
2636
|
// `Object.assign` method
|
|
2579
2637
|
// https://tc39.es/ecma262/#sec-object.assign
|
|
2580
|
-
// eslint-disable-next-line es/no-object-assign -- required for testing
|
|
2581
|
-
_export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
|
|
2638
|
+
// eslint-disable-next-line es-x/no-object-assign -- required for testing
|
|
2639
|
+
_export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
|
|
2582
2640
|
assign: objectAssign
|
|
2583
2641
|
});
|
|
2584
2642
|
|
|
@@ -2727,7 +2785,7 @@ var STRICT_METHOD = arrayMethodIsStrict('forEach');
|
|
|
2727
2785
|
// https://tc39.es/ecma262/#sec-array.prototype.foreach
|
|
2728
2786
|
var arrayForEach = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
|
|
2729
2787
|
return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
|
|
2730
|
-
// eslint-disable-next-line es/no-array-prototype-foreach -- safe
|
|
2788
|
+
// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe
|
|
2731
2789
|
} : [].forEach;
|
|
2732
2790
|
|
|
2733
2791
|
var handlePrototype = function (CollectionPrototype) {
|
|
@@ -2757,8 +2815,6 @@ var bind = function bind(fn, thisArg) {
|
|
|
2757
2815
|
};
|
|
2758
2816
|
};
|
|
2759
2817
|
|
|
2760
|
-
/*global toString:true*/
|
|
2761
|
-
|
|
2762
2818
|
// utils is a library of generic helper functions non-specific to axios
|
|
2763
2819
|
|
|
2764
2820
|
var toString = Object.prototype.toString;
|
|
@@ -2942,7 +2998,7 @@ function isURLSearchParams(val) {
|
|
|
2942
2998
|
* @returns {String} The String freed of excess whitespace
|
|
2943
2999
|
*/
|
|
2944
3000
|
function trim(str) {
|
|
2945
|
-
return str.
|
|
3001
|
+
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
|
|
2946
3002
|
}
|
|
2947
3003
|
|
|
2948
3004
|
/**
|
|
@@ -3184,10 +3240,12 @@ function InterceptorManager() {
|
|
|
3184
3240
|
*
|
|
3185
3241
|
* @return {Number} An ID used to remove interceptor later
|
|
3186
3242
|
*/
|
|
3187
|
-
InterceptorManager.prototype.use = function use(fulfilled, rejected) {
|
|
3243
|
+
InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
|
|
3188
3244
|
this.handlers.push({
|
|
3189
3245
|
fulfilled: fulfilled,
|
|
3190
|
-
rejected: rejected
|
|
3246
|
+
rejected: rejected,
|
|
3247
|
+
synchronous: options ? options.synchronous : false,
|
|
3248
|
+
runWhen: options ? options.runWhen : null
|
|
3191
3249
|
});
|
|
3192
3250
|
return this.handlers.length - 1;
|
|
3193
3251
|
};
|
|
@@ -3221,27 +3279,6 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
3221
3279
|
|
|
3222
3280
|
var InterceptorManager_1 = InterceptorManager;
|
|
3223
3281
|
|
|
3224
|
-
/**
|
|
3225
|
-
* Transform the data for a request or a response
|
|
3226
|
-
*
|
|
3227
|
-
* @param {Object|String} data The data to be transformed
|
|
3228
|
-
* @param {Array} headers The headers for the request or response
|
|
3229
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
3230
|
-
* @returns {*} The resulting transformed data
|
|
3231
|
-
*/
|
|
3232
|
-
var transformData = function transformData(data, headers, fns) {
|
|
3233
|
-
/*eslint no-param-reassign:0*/
|
|
3234
|
-
utils.forEach(fns, function transform(fn) {
|
|
3235
|
-
data = fn(data, headers);
|
|
3236
|
-
});
|
|
3237
|
-
|
|
3238
|
-
return data;
|
|
3239
|
-
};
|
|
3240
|
-
|
|
3241
|
-
var isCancel = function isCancel(value) {
|
|
3242
|
-
return !!(value && value.__CANCEL__);
|
|
3243
|
-
};
|
|
3244
|
-
|
|
3245
3282
|
var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
|
|
3246
3283
|
utils.forEach(headers, function processHeader(value, name) {
|
|
3247
3284
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
@@ -3540,6 +3577,7 @@ var xhr = function xhrAdapter(config) {
|
|
|
3540
3577
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
3541
3578
|
var requestData = config.data;
|
|
3542
3579
|
var requestHeaders = config.headers;
|
|
3580
|
+
var responseType = config.responseType;
|
|
3543
3581
|
|
|
3544
3582
|
if (utils.isFormData(requestData)) {
|
|
3545
3583
|
delete requestHeaders['Content-Type']; // Let the browser set it
|
|
@@ -3560,23 +3598,14 @@ var xhr = function xhrAdapter(config) {
|
|
|
3560
3598
|
// Set the request timeout in MS
|
|
3561
3599
|
request.timeout = config.timeout;
|
|
3562
3600
|
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
if (!request || request.readyState !== 4) {
|
|
3566
|
-
return;
|
|
3567
|
-
}
|
|
3568
|
-
|
|
3569
|
-
// The request errored out and we didn't get a response, this will be
|
|
3570
|
-
// handled by onerror instead
|
|
3571
|
-
// With one exception: request that using file: protocol, most browsers
|
|
3572
|
-
// will return status as 0 even though it's a successful request
|
|
3573
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3601
|
+
function onloadend() {
|
|
3602
|
+
if (!request) {
|
|
3574
3603
|
return;
|
|
3575
3604
|
}
|
|
3576
|
-
|
|
3577
3605
|
// Prepare the response
|
|
3578
3606
|
var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
3579
|
-
var responseData = !
|
|
3607
|
+
var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
3608
|
+
request.responseText : request.response;
|
|
3580
3609
|
var response = {
|
|
3581
3610
|
data: responseData,
|
|
3582
3611
|
status: request.status,
|
|
@@ -3590,7 +3619,30 @@ var xhr = function xhrAdapter(config) {
|
|
|
3590
3619
|
|
|
3591
3620
|
// Clean up request
|
|
3592
3621
|
request = null;
|
|
3593
|
-
}
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
if ('onloadend' in request) {
|
|
3625
|
+
// Use onloadend if available
|
|
3626
|
+
request.onloadend = onloadend;
|
|
3627
|
+
} else {
|
|
3628
|
+
// Listen for ready state to emulate onloadend
|
|
3629
|
+
request.onreadystatechange = function handleLoad() {
|
|
3630
|
+
if (!request || request.readyState !== 4) {
|
|
3631
|
+
return;
|
|
3632
|
+
}
|
|
3633
|
+
|
|
3634
|
+
// The request errored out and we didn't get a response, this will be
|
|
3635
|
+
// handled by onerror instead
|
|
3636
|
+
// With one exception: request that using file: protocol, most browsers
|
|
3637
|
+
// will return status as 0 even though it's a successful request
|
|
3638
|
+
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
// readystate handler is calling before onerror or ontimeout handlers,
|
|
3642
|
+
// so we should call onloadend on the next 'tick'
|
|
3643
|
+
setTimeout(onloadend);
|
|
3644
|
+
};
|
|
3645
|
+
}
|
|
3594
3646
|
|
|
3595
3647
|
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
3596
3648
|
request.onabort = function handleAbort() {
|
|
@@ -3620,7 +3672,10 @@ var xhr = function xhrAdapter(config) {
|
|
|
3620
3672
|
if (config.timeoutErrorMessage) {
|
|
3621
3673
|
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
3622
3674
|
}
|
|
3623
|
-
reject(createError(
|
|
3675
|
+
reject(createError(
|
|
3676
|
+
timeoutErrorMessage,
|
|
3677
|
+
config,
|
|
3678
|
+
config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',
|
|
3624
3679
|
request));
|
|
3625
3680
|
|
|
3626
3681
|
// Clean up request
|
|
@@ -3660,16 +3715,8 @@ var xhr = function xhrAdapter(config) {
|
|
|
3660
3715
|
}
|
|
3661
3716
|
|
|
3662
3717
|
// Add responseType to request if needed
|
|
3663
|
-
if (
|
|
3664
|
-
|
|
3665
|
-
request.responseType = config.responseType;
|
|
3666
|
-
} catch (e) {
|
|
3667
|
-
// Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
|
|
3668
|
-
// But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
|
|
3669
|
-
if (config.responseType !== 'json') {
|
|
3670
|
-
throw e;
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3718
|
+
if (responseType && responseType !== 'json') {
|
|
3719
|
+
request.responseType = config.responseType;
|
|
3673
3720
|
}
|
|
3674
3721
|
|
|
3675
3722
|
// Handle progress if needed
|
|
@@ -3727,12 +3774,35 @@ function getDefaultAdapter() {
|
|
|
3727
3774
|
return adapter;
|
|
3728
3775
|
}
|
|
3729
3776
|
|
|
3777
|
+
function stringifySafely(rawValue, parser, encoder) {
|
|
3778
|
+
if (utils.isString(rawValue)) {
|
|
3779
|
+
try {
|
|
3780
|
+
(parser || JSON.parse)(rawValue);
|
|
3781
|
+
return utils.trim(rawValue);
|
|
3782
|
+
} catch (e) {
|
|
3783
|
+
if (e.name !== 'SyntaxError') {
|
|
3784
|
+
throw e;
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
3790
|
+
}
|
|
3791
|
+
|
|
3730
3792
|
var defaults = {
|
|
3793
|
+
|
|
3794
|
+
transitional: {
|
|
3795
|
+
silentJSONParsing: true,
|
|
3796
|
+
forcedJSONParsing: true,
|
|
3797
|
+
clarifyTimeoutError: false
|
|
3798
|
+
},
|
|
3799
|
+
|
|
3731
3800
|
adapter: getDefaultAdapter(),
|
|
3732
3801
|
|
|
3733
3802
|
transformRequest: [function transformRequest(data, headers) {
|
|
3734
3803
|
normalizeHeaderName(headers, 'Accept');
|
|
3735
3804
|
normalizeHeaderName(headers, 'Content-Type');
|
|
3805
|
+
|
|
3736
3806
|
if (utils.isFormData(data) ||
|
|
3737
3807
|
utils.isArrayBuffer(data) ||
|
|
3738
3808
|
utils.isBuffer(data) ||
|
|
@@ -3749,20 +3819,32 @@ var defaults = {
|
|
|
3749
3819
|
setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
|
|
3750
3820
|
return data.toString();
|
|
3751
3821
|
}
|
|
3752
|
-
if (utils.isObject(data)) {
|
|
3753
|
-
setContentTypeIfUnset(headers, 'application/json
|
|
3754
|
-
return
|
|
3822
|
+
if (utils.isObject(data) || (headers && headers['Content-Type'] === 'application/json')) {
|
|
3823
|
+
setContentTypeIfUnset(headers, 'application/json');
|
|
3824
|
+
return stringifySafely(data);
|
|
3755
3825
|
}
|
|
3756
3826
|
return data;
|
|
3757
3827
|
}],
|
|
3758
3828
|
|
|
3759
3829
|
transformResponse: [function transformResponse(data) {
|
|
3760
|
-
|
|
3761
|
-
|
|
3830
|
+
var transitional = this.transitional;
|
|
3831
|
+
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
3832
|
+
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
3833
|
+
var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
|
|
3834
|
+
|
|
3835
|
+
if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
|
|
3762
3836
|
try {
|
|
3763
|
-
|
|
3764
|
-
} catch (e) {
|
|
3837
|
+
return JSON.parse(data);
|
|
3838
|
+
} catch (e) {
|
|
3839
|
+
if (strictJSONParsing) {
|
|
3840
|
+
if (e.name === 'SyntaxError') {
|
|
3841
|
+
throw enhanceError(e, this, 'E_JSON_PARSE');
|
|
3842
|
+
}
|
|
3843
|
+
throw e;
|
|
3844
|
+
}
|
|
3845
|
+
}
|
|
3765
3846
|
}
|
|
3847
|
+
|
|
3766
3848
|
return data;
|
|
3767
3849
|
}],
|
|
3768
3850
|
|
|
@@ -3799,6 +3881,28 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
3799
3881
|
|
|
3800
3882
|
var defaults_1 = defaults;
|
|
3801
3883
|
|
|
3884
|
+
/**
|
|
3885
|
+
* Transform the data for a request or a response
|
|
3886
|
+
*
|
|
3887
|
+
* @param {Object|String} data The data to be transformed
|
|
3888
|
+
* @param {Array} headers The headers for the request or response
|
|
3889
|
+
* @param {Array|Function} fns A single function or Array of functions
|
|
3890
|
+
* @returns {*} The resulting transformed data
|
|
3891
|
+
*/
|
|
3892
|
+
var transformData = function transformData(data, headers, fns) {
|
|
3893
|
+
var context = this || defaults_1;
|
|
3894
|
+
/*eslint no-param-reassign:0*/
|
|
3895
|
+
utils.forEach(fns, function transform(fn) {
|
|
3896
|
+
data = fn.call(context, data, headers);
|
|
3897
|
+
});
|
|
3898
|
+
|
|
3899
|
+
return data;
|
|
3900
|
+
};
|
|
3901
|
+
|
|
3902
|
+
var isCancel = function isCancel(value) {
|
|
3903
|
+
return !!(value && value.__CANCEL__);
|
|
3904
|
+
};
|
|
3905
|
+
|
|
3802
3906
|
/**
|
|
3803
3907
|
* Throws a `Cancel` if cancellation has been requested.
|
|
3804
3908
|
*/
|
|
@@ -3821,7 +3925,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3821
3925
|
config.headers = config.headers || {};
|
|
3822
3926
|
|
|
3823
3927
|
// Transform request data
|
|
3824
|
-
config.data = transformData(
|
|
3928
|
+
config.data = transformData.call(
|
|
3929
|
+
config,
|
|
3825
3930
|
config.data,
|
|
3826
3931
|
config.headers,
|
|
3827
3932
|
config.transformRequest
|
|
@@ -3847,7 +3952,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3847
3952
|
throwIfCancellationRequested(config);
|
|
3848
3953
|
|
|
3849
3954
|
// Transform response data
|
|
3850
|
-
response.data = transformData(
|
|
3955
|
+
response.data = transformData.call(
|
|
3956
|
+
config,
|
|
3851
3957
|
response.data,
|
|
3852
3958
|
response.headers,
|
|
3853
3959
|
config.transformResponse
|
|
@@ -3860,7 +3966,8 @@ var dispatchRequest = function dispatchRequest(config) {
|
|
|
3860
3966
|
|
|
3861
3967
|
// Transform response data
|
|
3862
3968
|
if (reason && reason.response) {
|
|
3863
|
-
reason.response.data = transformData(
|
|
3969
|
+
reason.response.data = transformData.call(
|
|
3970
|
+
config,
|
|
3864
3971
|
reason.response.data,
|
|
3865
3972
|
reason.response.headers,
|
|
3866
3973
|
config.transformResponse
|
|
@@ -3956,6 +4063,237 @@ var mergeConfig = function mergeConfig(config1, config2) {
|
|
|
3956
4063
|
return config;
|
|
3957
4064
|
};
|
|
3958
4065
|
|
|
4066
|
+
var name$2 = "axios";
|
|
4067
|
+
var version$1 = "0.21.4";
|
|
4068
|
+
var description = "Promise based HTTP client for the browser and node.js";
|
|
4069
|
+
var main$1 = "index.js";
|
|
4070
|
+
var scripts$1 = {
|
|
4071
|
+
test: "grunt test",
|
|
4072
|
+
start: "node ./sandbox/server.js",
|
|
4073
|
+
build: "NODE_ENV=production grunt build",
|
|
4074
|
+
preversion: "npm test",
|
|
4075
|
+
version: "npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",
|
|
4076
|
+
postversion: "git push && git push --tags",
|
|
4077
|
+
examples: "node ./examples/server.js",
|
|
4078
|
+
coveralls: "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
|
|
4079
|
+
fix: "eslint --fix lib/**/*.js"
|
|
4080
|
+
};
|
|
4081
|
+
var repository$1 = {
|
|
4082
|
+
type: "git",
|
|
4083
|
+
url: "https://github.com/axios/axios.git"
|
|
4084
|
+
};
|
|
4085
|
+
var keywords = [
|
|
4086
|
+
"xhr",
|
|
4087
|
+
"http",
|
|
4088
|
+
"ajax",
|
|
4089
|
+
"promise",
|
|
4090
|
+
"node"
|
|
4091
|
+
];
|
|
4092
|
+
var author$1 = "Matt Zabriskie";
|
|
4093
|
+
var license$1 = "MIT";
|
|
4094
|
+
var bugs = {
|
|
4095
|
+
url: "https://github.com/axios/axios/issues"
|
|
4096
|
+
};
|
|
4097
|
+
var homepage = "https://axios-http.com";
|
|
4098
|
+
var devDependencies$1 = {
|
|
4099
|
+
coveralls: "^3.0.0",
|
|
4100
|
+
"es6-promise": "^4.2.4",
|
|
4101
|
+
grunt: "^1.3.0",
|
|
4102
|
+
"grunt-banner": "^0.6.0",
|
|
4103
|
+
"grunt-cli": "^1.2.0",
|
|
4104
|
+
"grunt-contrib-clean": "^1.1.0",
|
|
4105
|
+
"grunt-contrib-watch": "^1.0.0",
|
|
4106
|
+
"grunt-eslint": "^23.0.0",
|
|
4107
|
+
"grunt-karma": "^4.0.0",
|
|
4108
|
+
"grunt-mocha-test": "^0.13.3",
|
|
4109
|
+
"grunt-ts": "^6.0.0-beta.19",
|
|
4110
|
+
"grunt-webpack": "^4.0.2",
|
|
4111
|
+
"istanbul-instrumenter-loader": "^1.0.0",
|
|
4112
|
+
"jasmine-core": "^2.4.1",
|
|
4113
|
+
karma: "^6.3.2",
|
|
4114
|
+
"karma-chrome-launcher": "^3.1.0",
|
|
4115
|
+
"karma-firefox-launcher": "^2.1.0",
|
|
4116
|
+
"karma-jasmine": "^1.1.1",
|
|
4117
|
+
"karma-jasmine-ajax": "^0.1.13",
|
|
4118
|
+
"karma-safari-launcher": "^1.0.0",
|
|
4119
|
+
"karma-sauce-launcher": "^4.3.6",
|
|
4120
|
+
"karma-sinon": "^1.0.5",
|
|
4121
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
4122
|
+
"karma-webpack": "^4.0.2",
|
|
4123
|
+
"load-grunt-tasks": "^3.5.2",
|
|
4124
|
+
minimist: "^1.2.0",
|
|
4125
|
+
mocha: "^8.2.1",
|
|
4126
|
+
sinon: "^4.5.0",
|
|
4127
|
+
"terser-webpack-plugin": "^4.2.3",
|
|
4128
|
+
typescript: "^4.0.5",
|
|
4129
|
+
"url-search-params": "^0.10.0",
|
|
4130
|
+
webpack: "^4.44.2",
|
|
4131
|
+
"webpack-dev-server": "^3.11.0"
|
|
4132
|
+
};
|
|
4133
|
+
var browser = {
|
|
4134
|
+
"./lib/adapters/http.js": "./lib/adapters/xhr.js"
|
|
4135
|
+
};
|
|
4136
|
+
var jsdelivr = "dist/axios.min.js";
|
|
4137
|
+
var unpkg$1 = "dist/axios.min.js";
|
|
4138
|
+
var typings = "./index.d.ts";
|
|
4139
|
+
var dependencies$1 = {
|
|
4140
|
+
"follow-redirects": "^1.14.0"
|
|
4141
|
+
};
|
|
4142
|
+
var bundlesize = [
|
|
4143
|
+
{
|
|
4144
|
+
path: "./dist/axios.min.js",
|
|
4145
|
+
threshold: "5kB"
|
|
4146
|
+
}
|
|
4147
|
+
];
|
|
4148
|
+
var _package = {
|
|
4149
|
+
name: name$2,
|
|
4150
|
+
version: version$1,
|
|
4151
|
+
description: description,
|
|
4152
|
+
main: main$1,
|
|
4153
|
+
scripts: scripts$1,
|
|
4154
|
+
repository: repository$1,
|
|
4155
|
+
keywords: keywords,
|
|
4156
|
+
author: author$1,
|
|
4157
|
+
license: license$1,
|
|
4158
|
+
bugs: bugs,
|
|
4159
|
+
homepage: homepage,
|
|
4160
|
+
devDependencies: devDependencies$1,
|
|
4161
|
+
browser: browser,
|
|
4162
|
+
jsdelivr: jsdelivr,
|
|
4163
|
+
unpkg: unpkg$1,
|
|
4164
|
+
typings: typings,
|
|
4165
|
+
dependencies: dependencies$1,
|
|
4166
|
+
bundlesize: bundlesize
|
|
4167
|
+
};
|
|
4168
|
+
|
|
4169
|
+
var _package$1 = /*#__PURE__*/Object.freeze({
|
|
4170
|
+
__proto__: null,
|
|
4171
|
+
name: name$2,
|
|
4172
|
+
version: version$1,
|
|
4173
|
+
description: description,
|
|
4174
|
+
main: main$1,
|
|
4175
|
+
scripts: scripts$1,
|
|
4176
|
+
repository: repository$1,
|
|
4177
|
+
keywords: keywords,
|
|
4178
|
+
author: author$1,
|
|
4179
|
+
license: license$1,
|
|
4180
|
+
bugs: bugs,
|
|
4181
|
+
homepage: homepage,
|
|
4182
|
+
devDependencies: devDependencies$1,
|
|
4183
|
+
browser: browser,
|
|
4184
|
+
jsdelivr: jsdelivr,
|
|
4185
|
+
unpkg: unpkg$1,
|
|
4186
|
+
typings: typings,
|
|
4187
|
+
dependencies: dependencies$1,
|
|
4188
|
+
bundlesize: bundlesize,
|
|
4189
|
+
'default': _package
|
|
4190
|
+
});
|
|
4191
|
+
|
|
4192
|
+
var pkg = getCjsExportFromNamespace(_package$1);
|
|
4193
|
+
|
|
4194
|
+
var validators$1 = {};
|
|
4195
|
+
|
|
4196
|
+
// eslint-disable-next-line func-names
|
|
4197
|
+
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
|
|
4198
|
+
validators$1[type] = function validator(thing) {
|
|
4199
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
4200
|
+
};
|
|
4201
|
+
});
|
|
4202
|
+
|
|
4203
|
+
var deprecatedWarnings = {};
|
|
4204
|
+
var currentVerArr = pkg.version.split('.');
|
|
4205
|
+
|
|
4206
|
+
/**
|
|
4207
|
+
* Compare package versions
|
|
4208
|
+
* @param {string} version
|
|
4209
|
+
* @param {string?} thanVersion
|
|
4210
|
+
* @returns {boolean}
|
|
4211
|
+
*/
|
|
4212
|
+
function isOlderVersion(version, thanVersion) {
|
|
4213
|
+
var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;
|
|
4214
|
+
var destVer = version.split('.');
|
|
4215
|
+
for (var i = 0; i < 3; i++) {
|
|
4216
|
+
if (pkgVersionArr[i] > destVer[i]) {
|
|
4217
|
+
return true;
|
|
4218
|
+
} else if (pkgVersionArr[i] < destVer[i]) {
|
|
4219
|
+
return false;
|
|
4220
|
+
}
|
|
4221
|
+
}
|
|
4222
|
+
return false;
|
|
4223
|
+
}
|
|
4224
|
+
|
|
4225
|
+
/**
|
|
4226
|
+
* Transitional option validator
|
|
4227
|
+
* @param {function|boolean?} validator
|
|
4228
|
+
* @param {string?} version
|
|
4229
|
+
* @param {string} message
|
|
4230
|
+
* @returns {function}
|
|
4231
|
+
*/
|
|
4232
|
+
validators$1.transitional = function transitional(validator, version, message) {
|
|
4233
|
+
var isDeprecated = version && isOlderVersion(version);
|
|
4234
|
+
|
|
4235
|
+
function formatMessage(opt, desc) {
|
|
4236
|
+
return '[Axios v' + pkg.version + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
4237
|
+
}
|
|
4238
|
+
|
|
4239
|
+
// eslint-disable-next-line func-names
|
|
4240
|
+
return function(value, opt, opts) {
|
|
4241
|
+
if (validator === false) {
|
|
4242
|
+
throw new Error(formatMessage(opt, ' has been removed in ' + version));
|
|
4243
|
+
}
|
|
4244
|
+
|
|
4245
|
+
if (isDeprecated && !deprecatedWarnings[opt]) {
|
|
4246
|
+
deprecatedWarnings[opt] = true;
|
|
4247
|
+
// eslint-disable-next-line no-console
|
|
4248
|
+
console.warn(
|
|
4249
|
+
formatMessage(
|
|
4250
|
+
opt,
|
|
4251
|
+
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
4252
|
+
)
|
|
4253
|
+
);
|
|
4254
|
+
}
|
|
4255
|
+
|
|
4256
|
+
return validator ? validator(value, opt, opts) : true;
|
|
4257
|
+
};
|
|
4258
|
+
};
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
* Assert object's properties type
|
|
4262
|
+
* @param {object} options
|
|
4263
|
+
* @param {object} schema
|
|
4264
|
+
* @param {boolean?} allowUnknown
|
|
4265
|
+
*/
|
|
4266
|
+
|
|
4267
|
+
function assertOptions(options, schema, allowUnknown) {
|
|
4268
|
+
if (typeof options !== 'object') {
|
|
4269
|
+
throw new TypeError('options must be an object');
|
|
4270
|
+
}
|
|
4271
|
+
var keys = Object.keys(options);
|
|
4272
|
+
var i = keys.length;
|
|
4273
|
+
while (i-- > 0) {
|
|
4274
|
+
var opt = keys[i];
|
|
4275
|
+
var validator = schema[opt];
|
|
4276
|
+
if (validator) {
|
|
4277
|
+
var value = options[opt];
|
|
4278
|
+
var result = value === undefined || validator(value, opt, options);
|
|
4279
|
+
if (result !== true) {
|
|
4280
|
+
throw new TypeError('option ' + opt + ' must be ' + result);
|
|
4281
|
+
}
|
|
4282
|
+
continue;
|
|
4283
|
+
}
|
|
4284
|
+
if (allowUnknown !== true) {
|
|
4285
|
+
throw Error('Unknown option ' + opt);
|
|
4286
|
+
}
|
|
4287
|
+
}
|
|
4288
|
+
}
|
|
4289
|
+
|
|
4290
|
+
var validator = {
|
|
4291
|
+
isOlderVersion: isOlderVersion,
|
|
4292
|
+
assertOptions: assertOptions,
|
|
4293
|
+
validators: validators$1
|
|
4294
|
+
};
|
|
4295
|
+
|
|
4296
|
+
var validators = validator.validators;
|
|
3959
4297
|
/**
|
|
3960
4298
|
* Create a new instance of Axios
|
|
3961
4299
|
*
|
|
@@ -3995,20 +4333,71 @@ Axios.prototype.request = function request(config) {
|
|
|
3995
4333
|
config.method = 'get';
|
|
3996
4334
|
}
|
|
3997
4335
|
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4336
|
+
var transitional = config.transitional;
|
|
4337
|
+
|
|
4338
|
+
if (transitional !== undefined) {
|
|
4339
|
+
validator.assertOptions(transitional, {
|
|
4340
|
+
silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
4341
|
+
forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),
|
|
4342
|
+
clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')
|
|
4343
|
+
}, false);
|
|
4344
|
+
}
|
|
4001
4345
|
|
|
4346
|
+
// filter out skipped interceptors
|
|
4347
|
+
var requestInterceptorChain = [];
|
|
4348
|
+
var synchronousRequestInterceptors = true;
|
|
4002
4349
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
4003
|
-
|
|
4350
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
4351
|
+
return;
|
|
4352
|
+
}
|
|
4353
|
+
|
|
4354
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
4355
|
+
|
|
4356
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
4004
4357
|
});
|
|
4005
4358
|
|
|
4359
|
+
var responseInterceptorChain = [];
|
|
4006
4360
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
4007
|
-
|
|
4361
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
4008
4362
|
});
|
|
4009
4363
|
|
|
4010
|
-
|
|
4011
|
-
|
|
4364
|
+
var promise;
|
|
4365
|
+
|
|
4366
|
+
if (!synchronousRequestInterceptors) {
|
|
4367
|
+
var chain = [dispatchRequest, undefined];
|
|
4368
|
+
|
|
4369
|
+
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
4370
|
+
chain = chain.concat(responseInterceptorChain);
|
|
4371
|
+
|
|
4372
|
+
promise = Promise.resolve(config);
|
|
4373
|
+
while (chain.length) {
|
|
4374
|
+
promise = promise.then(chain.shift(), chain.shift());
|
|
4375
|
+
}
|
|
4376
|
+
|
|
4377
|
+
return promise;
|
|
4378
|
+
}
|
|
4379
|
+
|
|
4380
|
+
|
|
4381
|
+
var newConfig = config;
|
|
4382
|
+
while (requestInterceptorChain.length) {
|
|
4383
|
+
var onFulfilled = requestInterceptorChain.shift();
|
|
4384
|
+
var onRejected = requestInterceptorChain.shift();
|
|
4385
|
+
try {
|
|
4386
|
+
newConfig = onFulfilled(newConfig);
|
|
4387
|
+
} catch (error) {
|
|
4388
|
+
onRejected(error);
|
|
4389
|
+
break;
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4393
|
+
try {
|
|
4394
|
+
promise = dispatchRequest(newConfig);
|
|
4395
|
+
} catch (error) {
|
|
4396
|
+
return Promise.reject(error);
|
|
4397
|
+
}
|
|
4398
|
+
|
|
4399
|
+
while (responseInterceptorChain.length) {
|
|
4400
|
+
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
4012
4401
|
}
|
|
4013
4402
|
|
|
4014
4403
|
return promise;
|
|
@@ -4204,9 +4593,103 @@ axios_1.default = default_1;
|
|
|
4204
4593
|
|
|
4205
4594
|
var axios = axios_1;
|
|
4206
4595
|
|
|
4596
|
+
var name$1 = "@tryghost/content-api";
|
|
4597
|
+
var version = "1.9.2";
|
|
4598
|
+
var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
|
|
4599
|
+
var author = "Ghost Foundation";
|
|
4600
|
+
var license = "MIT";
|
|
4601
|
+
var main = "cjs/content-api.js";
|
|
4602
|
+
var unpkg = "umd/content-api.min.js";
|
|
4603
|
+
var module = "es/content-api.js";
|
|
4604
|
+
var source = "lib/content-api.js";
|
|
4605
|
+
var files = [
|
|
4606
|
+
"LICENSE",
|
|
4607
|
+
"README.md",
|
|
4608
|
+
"cjs/",
|
|
4609
|
+
"lib/",
|
|
4610
|
+
"umd/",
|
|
4611
|
+
"es/"
|
|
4612
|
+
];
|
|
4613
|
+
var scripts = {
|
|
4614
|
+
dev: "echo \"Implement me!\"",
|
|
4615
|
+
pretest: "yarn build",
|
|
4616
|
+
test: "NODE_ENV=testing c8 --all --reporter text --reporter cobertura mocha './test/**/*.test.js'",
|
|
4617
|
+
build: "rollup -c",
|
|
4618
|
+
lint: "eslint . --ext .js --cache",
|
|
4619
|
+
prepare: "NODE_ENV=production yarn build",
|
|
4620
|
+
posttest: "yarn lint"
|
|
4621
|
+
};
|
|
4622
|
+
var publishConfig = {
|
|
4623
|
+
access: "public"
|
|
4624
|
+
};
|
|
4625
|
+
var devDependencies = {
|
|
4626
|
+
"@babel/core": "7.17.10",
|
|
4627
|
+
"@babel/polyfill": "7.12.1",
|
|
4628
|
+
"@babel/preset-env": "7.17.10",
|
|
4629
|
+
"@rollup/plugin-json": "4.1.0",
|
|
4630
|
+
c8: "7.11.2",
|
|
4631
|
+
"core-js": "3.22.4",
|
|
4632
|
+
"eslint-plugin-ghost": "2.13.0",
|
|
4633
|
+
mocha: "10.0.0",
|
|
4634
|
+
rollup: "2.71.1",
|
|
4635
|
+
"rollup-plugin-babel": "4.4.0",
|
|
4636
|
+
"rollup-plugin-commonjs": "10.1.0",
|
|
4637
|
+
"rollup-plugin-node-resolve": "5.2.0",
|
|
4638
|
+
"rollup-plugin-replace": "2.2.0",
|
|
4639
|
+
"rollup-plugin-terser": "7.0.2",
|
|
4640
|
+
should: "13.2.3",
|
|
4641
|
+
sinon: "13.0.2"
|
|
4642
|
+
};
|
|
4643
|
+
var dependencies = {
|
|
4644
|
+
axios: "^0.27.0"
|
|
4645
|
+
};
|
|
4646
|
+
var gitHead = "0a30384f3d568a43bfe0cee5fcf7e21c17a17842";
|
|
4647
|
+
var packageInfo = {
|
|
4648
|
+
name: name$1,
|
|
4649
|
+
version: version,
|
|
4650
|
+
repository: repository,
|
|
4651
|
+
author: author,
|
|
4652
|
+
license: license,
|
|
4653
|
+
main: main,
|
|
4654
|
+
"umd:main": "umd/content-api.min.js",
|
|
4655
|
+
unpkg: unpkg,
|
|
4656
|
+
module: module,
|
|
4657
|
+
source: source,
|
|
4658
|
+
files: files,
|
|
4659
|
+
scripts: scripts,
|
|
4660
|
+
publishConfig: publishConfig,
|
|
4661
|
+
devDependencies: devDependencies,
|
|
4662
|
+
dependencies: dependencies,
|
|
4663
|
+
gitHead: gitHead
|
|
4664
|
+
};
|
|
4665
|
+
|
|
4666
|
+
var packageVersion = packageInfo.version; // NOTE: bump this default when Ghost v5 is released
|
|
4667
|
+
|
|
4207
4668
|
var defaultAcceptVersionHeader = 'v4.0';
|
|
4208
4669
|
var supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
|
|
4209
4670
|
var name = '@tryghost/content-api';
|
|
4671
|
+
/**
|
|
4672
|
+
* This method can go away in favor of only sending 'Accept-Version` headers
|
|
4673
|
+
* once the Ghost API removes a concept of version from it's URLS (with Ghost v5)
|
|
4674
|
+
*
|
|
4675
|
+
* @param {string} [version] version in `v{major}` format
|
|
4676
|
+
* @returns {string}
|
|
4677
|
+
*/
|
|
4678
|
+
|
|
4679
|
+
var resolveAPIPrefix = function resolveAPIPrefix(version) {
|
|
4680
|
+
var prefix; // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
|
|
4681
|
+
|
|
4682
|
+
if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
|
|
4683
|
+
prefix = "/content/";
|
|
4684
|
+
} else if (version.match(/^v\d+\.\d+/)) {
|
|
4685
|
+
var versionPrefix = /^(v\d+)\.\d+/.exec(version)[1];
|
|
4686
|
+
prefix = "/".concat(versionPrefix, "/content/");
|
|
4687
|
+
} else {
|
|
4688
|
+
prefix = "/".concat(version, "/content/");
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
return prefix;
|
|
4692
|
+
};
|
|
4210
4693
|
|
|
4211
4694
|
var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
4212
4695
|
var url = _ref.url,
|
|
@@ -4355,6 +4838,7 @@ function GhostContentAPI(_ref2) {
|
|
|
4355
4838
|
var headers = membersToken ? {
|
|
4356
4839
|
Authorization: "GhostMembers ".concat(membersToken)
|
|
4357
4840
|
} : {};
|
|
4841
|
+
headers['User-Agent'] = "GhostContentSDK/".concat(packageVersion);
|
|
4358
4842
|
|
|
4359
4843
|
if (acceptVersionHeader) {
|
|
4360
4844
|
headers['Accept-Version'] = acceptVersionHeader;
|
|
@@ -4363,7 +4847,7 @@ function GhostContentAPI(_ref2) {
|
|
|
4363
4847
|
params = Object.assign({
|
|
4364
4848
|
key: key
|
|
4365
4849
|
}, params);
|
|
4366
|
-
var apiUrl =
|
|
4850
|
+
var apiUrl = "".concat(url, "/").concat(ghostPath, "/api").concat(resolveAPIPrefix(version)).concat(resourceType, "/").concat(id ? id + '/' : '');
|
|
4367
4851
|
return makeRequest({
|
|
4368
4852
|
url: apiUrl,
|
|
4369
4853
|
method: 'get',
|