@tryghost/content-api 1.6.2 → 1.7.1
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 +80 -50
- package/es/content-api.js +393 -453
- package/es/content-api.js.map +1 -1
- package/lib/index.js +80 -50
- package/package.json +4 -4
- package/umd/content-api.min.js +1 -1
- package/umd/content-api.min.js.map +1 -1
package/es/content-api.js
CHANGED
|
@@ -48,15 +48,9 @@ var descriptors = !fails(function () {
|
|
|
48
48
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
var functionBindNative = !fails(function () {
|
|
52
|
-
var test = (function () { /* empty */ }).bind();
|
|
53
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
54
|
-
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
51
|
var call$2 = Function.prototype.call;
|
|
58
52
|
|
|
59
|
-
var functionCall =
|
|
53
|
+
var functionCall = call$2.bind ? call$2.bind(call$2) : function () {
|
|
60
54
|
return call$2.apply(call$2, arguments);
|
|
61
55
|
};
|
|
62
56
|
|
|
@@ -69,13 +63,13 @@ var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1:
|
|
|
69
63
|
|
|
70
64
|
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
71
65
|
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
72
|
-
var f$
|
|
66
|
+
var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
|
73
67
|
var descriptor = getOwnPropertyDescriptor$4(this, V);
|
|
74
68
|
return !!descriptor && descriptor.enumerable;
|
|
75
69
|
} : $propertyIsEnumerable;
|
|
76
70
|
|
|
77
71
|
var objectPropertyIsEnumerable = {
|
|
78
|
-
f: f$
|
|
72
|
+
f: f$5
|
|
79
73
|
};
|
|
80
74
|
|
|
81
75
|
var createPropertyDescriptor = function (bitmap, value) {
|
|
@@ -88,12 +82,12 @@ var createPropertyDescriptor = function (bitmap, value) {
|
|
|
88
82
|
};
|
|
89
83
|
|
|
90
84
|
var FunctionPrototype$3 = Function.prototype;
|
|
91
|
-
var bind$
|
|
85
|
+
var bind$4 = FunctionPrototype$3.bind;
|
|
92
86
|
var call$1 = FunctionPrototype$3.call;
|
|
93
|
-
var
|
|
87
|
+
var callBind = bind$4 && bind$4.bind(call$1);
|
|
94
88
|
|
|
95
|
-
var functionUncurryThis =
|
|
96
|
-
return fn &&
|
|
89
|
+
var functionUncurryThis = bind$4 ? function (fn) {
|
|
90
|
+
return fn && callBind(call$1, fn);
|
|
97
91
|
} : function (fn) {
|
|
98
92
|
return fn && function () {
|
|
99
93
|
return call$1.apply(fn, arguments);
|
|
@@ -119,12 +113,12 @@ var indexedObject = fails(function () {
|
|
|
119
113
|
return classofRaw(it) == 'String' ? split(it, '') : Object$4(it);
|
|
120
114
|
} : Object$4;
|
|
121
115
|
|
|
122
|
-
var TypeError$
|
|
116
|
+
var TypeError$f = global_1.TypeError;
|
|
123
117
|
|
|
124
118
|
// `RequireObjectCoercible` abstract operation
|
|
125
119
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
126
120
|
var requireObjectCoercible = function (it) {
|
|
127
|
-
if (it == undefined) throw TypeError$
|
|
121
|
+
if (it == undefined) throw TypeError$f("Can't call method on " + it);
|
|
128
122
|
return it;
|
|
129
123
|
};
|
|
130
124
|
|
|
@@ -223,12 +217,12 @@ var tryToString = function (argument) {
|
|
|
223
217
|
}
|
|
224
218
|
};
|
|
225
219
|
|
|
226
|
-
var TypeError$
|
|
220
|
+
var TypeError$e = global_1.TypeError;
|
|
227
221
|
|
|
228
222
|
// `Assert: IsCallable(argument) is true`
|
|
229
223
|
var aCallable = function (argument) {
|
|
230
224
|
if (isCallable(argument)) return argument;
|
|
231
|
-
throw TypeError$
|
|
225
|
+
throw TypeError$e(tryToString(argument) + ' is not a function');
|
|
232
226
|
};
|
|
233
227
|
|
|
234
228
|
// `GetMethod` abstract operation
|
|
@@ -238,7 +232,7 @@ var getMethod = function (V, P) {
|
|
|
238
232
|
return func == null ? undefined : aCallable(func);
|
|
239
233
|
};
|
|
240
234
|
|
|
241
|
-
var TypeError$
|
|
235
|
+
var TypeError$d = global_1.TypeError;
|
|
242
236
|
|
|
243
237
|
// `OrdinaryToPrimitive` abstract operation
|
|
244
238
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -247,7 +241,7 @@ var ordinaryToPrimitive = function (input, pref) {
|
|
|
247
241
|
if (pref === 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
248
242
|
if (isCallable(fn = input.valueOf) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
249
243
|
if (pref !== 'string' && isCallable(fn = input.toString) && !isObject$1(val = functionCall(fn, input))) return val;
|
|
250
|
-
throw TypeError$
|
|
244
|
+
throw TypeError$d("Can't convert object to primitive value");
|
|
251
245
|
};
|
|
252
246
|
|
|
253
247
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
@@ -270,11 +264,9 @@ var shared = createCommonjsModule(function (module) {
|
|
|
270
264
|
(module.exports = function (key, value) {
|
|
271
265
|
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
|
|
272
266
|
})('versions', []).push({
|
|
273
|
-
version: '3.
|
|
267
|
+
version: '3.19.1',
|
|
274
268
|
mode: 'global',
|
|
275
|
-
copyright: '©
|
|
276
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
|
|
277
|
-
source: 'https://github.com/zloirock/core-js'
|
|
269
|
+
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
|
|
278
270
|
});
|
|
279
271
|
});
|
|
280
272
|
|
|
@@ -320,7 +312,7 @@ var wellKnownSymbol = function (name) {
|
|
|
320
312
|
} return WellKnownSymbolsStore[name];
|
|
321
313
|
};
|
|
322
314
|
|
|
323
|
-
var TypeError$
|
|
315
|
+
var TypeError$c = global_1.TypeError;
|
|
324
316
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
325
317
|
|
|
326
318
|
// `ToPrimitive` abstract operation
|
|
@@ -333,7 +325,7 @@ var toPrimitive = function (input, pref) {
|
|
|
333
325
|
if (pref === undefined) pref = 'default';
|
|
334
326
|
result = functionCall(exoticToPrim, input, pref);
|
|
335
327
|
if (!isObject$1(result) || isSymbol(result)) return result;
|
|
336
|
-
throw TypeError$
|
|
328
|
+
throw TypeError$c("Can't convert object to primitive value");
|
|
337
329
|
}
|
|
338
330
|
if (pref === undefined) pref = 'number';
|
|
339
331
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -354,91 +346,61 @@ var documentCreateElement = function (it) {
|
|
|
354
346
|
return EXISTS$1 ? document$3.createElement(it) : {};
|
|
355
347
|
};
|
|
356
348
|
|
|
357
|
-
//
|
|
349
|
+
// Thank's IE8 for his funny defineProperty
|
|
358
350
|
var ie8DomDefine = !descriptors && !fails(function () {
|
|
359
|
-
// eslint-disable-next-line es/no-object-defineproperty --
|
|
351
|
+
// eslint-disable-next-line es/no-object-defineproperty -- requied for testing
|
|
360
352
|
return Object.defineProperty(documentCreateElement('div'), 'a', {
|
|
361
353
|
get: function () { return 7; }
|
|
362
354
|
}).a != 7;
|
|
363
355
|
});
|
|
364
356
|
|
|
365
357
|
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
366
|
-
var $getOwnPropertyDescriptor
|
|
358
|
+
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
367
359
|
|
|
368
360
|
// `Object.getOwnPropertyDescriptor` method
|
|
369
361
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
370
|
-
var f$
|
|
362
|
+
var f$4 = descriptors ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
|
371
363
|
O = toIndexedObject(O);
|
|
372
364
|
P = toPropertyKey(P);
|
|
373
365
|
if (ie8DomDefine) try {
|
|
374
|
-
return $getOwnPropertyDescriptor
|
|
366
|
+
return $getOwnPropertyDescriptor(O, P);
|
|
375
367
|
} catch (error) { /* empty */ }
|
|
376
368
|
if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
|
|
377
369
|
};
|
|
378
370
|
|
|
379
371
|
var objectGetOwnPropertyDescriptor = {
|
|
380
|
-
f: f$
|
|
372
|
+
f: f$4
|
|
381
373
|
};
|
|
382
374
|
|
|
383
|
-
// V8 ~ Chrome 36-
|
|
384
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
385
|
-
var v8PrototypeDefineBug = descriptors && fails(function () {
|
|
386
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
387
|
-
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
388
|
-
value: 42,
|
|
389
|
-
writable: false
|
|
390
|
-
}).prototype != 42;
|
|
391
|
-
});
|
|
392
|
-
|
|
393
375
|
var String$4 = global_1.String;
|
|
394
|
-
var TypeError$
|
|
376
|
+
var TypeError$b = global_1.TypeError;
|
|
395
377
|
|
|
396
378
|
// `Assert: Type(argument) is Object`
|
|
397
379
|
var anObject = function (argument) {
|
|
398
380
|
if (isObject$1(argument)) return argument;
|
|
399
|
-
throw TypeError$
|
|
381
|
+
throw TypeError$b(String$4(argument) + ' is not an object');
|
|
400
382
|
};
|
|
401
383
|
|
|
402
|
-
var TypeError$
|
|
384
|
+
var TypeError$a = global_1.TypeError;
|
|
403
385
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
404
386
|
var $defineProperty = Object.defineProperty;
|
|
405
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
406
|
-
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
407
|
-
var ENUMERABLE = 'enumerable';
|
|
408
|
-
var CONFIGURABLE$1 = 'configurable';
|
|
409
|
-
var WRITABLE = 'writable';
|
|
410
387
|
|
|
411
388
|
// `Object.defineProperty` method
|
|
412
389
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
413
|
-
var f$
|
|
414
|
-
anObject(O);
|
|
415
|
-
P = toPropertyKey(P);
|
|
416
|
-
anObject(Attributes);
|
|
417
|
-
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
418
|
-
var current = $getOwnPropertyDescriptor(O, P);
|
|
419
|
-
if (current && current[WRITABLE]) {
|
|
420
|
-
O[P] = Attributes.value;
|
|
421
|
-
Attributes = {
|
|
422
|
-
configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
|
|
423
|
-
enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
|
424
|
-
writable: false
|
|
425
|
-
};
|
|
426
|
-
}
|
|
427
|
-
} return $defineProperty(O, P, Attributes);
|
|
428
|
-
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
390
|
+
var f$3 = descriptors ? $defineProperty : function defineProperty(O, P, Attributes) {
|
|
429
391
|
anObject(O);
|
|
430
392
|
P = toPropertyKey(P);
|
|
431
393
|
anObject(Attributes);
|
|
432
394
|
if (ie8DomDefine) try {
|
|
433
395
|
return $defineProperty(O, P, Attributes);
|
|
434
396
|
} catch (error) { /* empty */ }
|
|
435
|
-
if ('get' in Attributes || 'set' in Attributes) throw TypeError$
|
|
397
|
+
if ('get' in Attributes || 'set' in Attributes) throw TypeError$a('Accessors not supported');
|
|
436
398
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
437
399
|
return O;
|
|
438
400
|
};
|
|
439
401
|
|
|
440
402
|
var objectDefineProperty = {
|
|
441
|
-
f: f$
|
|
403
|
+
f: f$3
|
|
442
404
|
};
|
|
443
405
|
|
|
444
406
|
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
|
|
@@ -472,7 +434,7 @@ var sharedKey = function (key) {
|
|
|
472
434
|
var hiddenKeys$1 = {};
|
|
473
435
|
|
|
474
436
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
475
|
-
var TypeError$
|
|
437
|
+
var TypeError$9 = global_1.TypeError;
|
|
476
438
|
var WeakMap = global_1.WeakMap;
|
|
477
439
|
var set$1, get, has;
|
|
478
440
|
|
|
@@ -484,7 +446,7 @@ var getterFor = function (TYPE) {
|
|
|
484
446
|
return function (it) {
|
|
485
447
|
var state;
|
|
486
448
|
if (!isObject$1(it) || (state = get(it)).type !== TYPE) {
|
|
487
|
-
throw TypeError$
|
|
449
|
+
throw TypeError$9('Incompatible receiver, ' + TYPE + ' required');
|
|
488
450
|
} return state;
|
|
489
451
|
};
|
|
490
452
|
};
|
|
@@ -495,7 +457,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
495
457
|
var wmhas = functionUncurryThis(store.has);
|
|
496
458
|
var wmset = functionUncurryThis(store.set);
|
|
497
459
|
set$1 = function (it, metadata) {
|
|
498
|
-
if (wmhas(store, it)) throw new TypeError$
|
|
460
|
+
if (wmhas(store, it)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
|
|
499
461
|
metadata.facade = it;
|
|
500
462
|
wmset(store, it, metadata);
|
|
501
463
|
return metadata;
|
|
@@ -510,7 +472,7 @@ if (nativeWeakMap || sharedStore.state) {
|
|
|
510
472
|
var STATE = sharedKey('state');
|
|
511
473
|
hiddenKeys$1[STATE] = true;
|
|
512
474
|
set$1 = function (it, metadata) {
|
|
513
|
-
if (hasOwnProperty_1(it, STATE)) throw new TypeError$
|
|
475
|
+
if (hasOwnProperty_1(it, STATE)) throw new TypeError$9(OBJECT_ALREADY_INITIALIZED);
|
|
514
476
|
metadata.facade = it;
|
|
515
477
|
createNonEnumerableProperty(it, STATE, metadata);
|
|
516
478
|
return metadata;
|
|
@@ -687,19 +649,19 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
687
649
|
// `Object.getOwnPropertyNames` method
|
|
688
650
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
689
651
|
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
690
|
-
var f$
|
|
652
|
+
var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
691
653
|
return objectKeysInternal(O, hiddenKeys);
|
|
692
654
|
};
|
|
693
655
|
|
|
694
656
|
var objectGetOwnPropertyNames = {
|
|
695
|
-
f: f$
|
|
657
|
+
f: f$2
|
|
696
658
|
};
|
|
697
659
|
|
|
698
660
|
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
699
|
-
var f$
|
|
661
|
+
var f$1 = Object.getOwnPropertySymbols;
|
|
700
662
|
|
|
701
663
|
var objectGetOwnPropertySymbols = {
|
|
702
|
-
f: f$
|
|
664
|
+
f: f$1
|
|
703
665
|
};
|
|
704
666
|
|
|
705
667
|
var concat$1 = functionUncurryThis([].concat);
|
|
@@ -711,15 +673,13 @@ var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
|
711
673
|
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
|
|
712
674
|
};
|
|
713
675
|
|
|
714
|
-
var copyConstructorProperties = function (target, source
|
|
676
|
+
var copyConstructorProperties = function (target, source) {
|
|
715
677
|
var keys = ownKeys(source);
|
|
716
678
|
var defineProperty = objectDefineProperty.f;
|
|
717
679
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
718
680
|
for (var i = 0; i < keys.length; i++) {
|
|
719
681
|
var key = keys[i];
|
|
720
|
-
if (!hasOwnProperty_1(target, key)
|
|
721
|
-
defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
722
|
-
}
|
|
682
|
+
if (!hasOwnProperty_1(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
|
723
683
|
}
|
|
724
684
|
};
|
|
725
685
|
|
|
@@ -801,8 +761,8 @@ var _export = function (options, source) {
|
|
|
801
761
|
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
|
|
802
762
|
var method = [][METHOD_NAME];
|
|
803
763
|
return !!method && fails(function () {
|
|
804
|
-
// eslint-disable-next-line no-useless-call -- required for testing
|
|
805
|
-
method.call(null, argument || function () {
|
|
764
|
+
// eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
|
|
765
|
+
method.call(null, argument || function () { throw 1; }, 1);
|
|
806
766
|
});
|
|
807
767
|
};
|
|
808
768
|
|
|
@@ -819,6 +779,50 @@ _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1
|
|
|
819
779
|
}
|
|
820
780
|
});
|
|
821
781
|
|
|
782
|
+
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
783
|
+
var test = {};
|
|
784
|
+
|
|
785
|
+
test[TO_STRING_TAG$2] = 'z';
|
|
786
|
+
|
|
787
|
+
var toStringTagSupport = String(test) === '[object z]';
|
|
788
|
+
|
|
789
|
+
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
790
|
+
var Object$1 = global_1.Object;
|
|
791
|
+
|
|
792
|
+
// ES3 wrong here
|
|
793
|
+
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
794
|
+
|
|
795
|
+
// fallback for IE11 Script Access Denied error
|
|
796
|
+
var tryGet = function (it, key) {
|
|
797
|
+
try {
|
|
798
|
+
return it[key];
|
|
799
|
+
} catch (error) { /* empty */ }
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
// getting tag from ES6+ `Object.prototype.toString`
|
|
803
|
+
var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
804
|
+
var O, tag, result;
|
|
805
|
+
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
806
|
+
// @@toStringTag case
|
|
807
|
+
: typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
|
|
808
|
+
// builtinTag case
|
|
809
|
+
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
810
|
+
// ES3 arguments fallback
|
|
811
|
+
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
// `Object.prototype.toString` method implementation
|
|
815
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
816
|
+
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
817
|
+
return '[object ' + classof(this) + ']';
|
|
818
|
+
};
|
|
819
|
+
|
|
820
|
+
// `Object.prototype.toString` method
|
|
821
|
+
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
822
|
+
if (!toStringTagSupport) {
|
|
823
|
+
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
824
|
+
}
|
|
825
|
+
|
|
822
826
|
// `Object.keys` method
|
|
823
827
|
// https://tc39.es/ecma262/#sec-object.keys
|
|
824
828
|
// eslint-disable-next-line es/no-object-keys -- safe
|
|
@@ -826,10 +830,160 @@ var objectKeys = Object.keys || function keys(O) {
|
|
|
826
830
|
return objectKeysInternal(O, enumBugKeys);
|
|
827
831
|
};
|
|
828
832
|
|
|
833
|
+
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
834
|
+
|
|
835
|
+
// `Object.keys` method
|
|
836
|
+
// https://tc39.es/ecma262/#sec-object.keys
|
|
837
|
+
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
838
|
+
keys: function keys(it) {
|
|
839
|
+
return objectKeys(toObject(it));
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
// `IsArray` abstract operation
|
|
844
|
+
// https://tc39.es/ecma262/#sec-isarray
|
|
845
|
+
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
846
|
+
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
847
|
+
return classofRaw(argument) == 'Array';
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
var createProperty = function (object, key, value) {
|
|
851
|
+
var propertyKey = toPropertyKey(key);
|
|
852
|
+
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
853
|
+
else object[propertyKey] = value;
|
|
854
|
+
};
|
|
855
|
+
|
|
856
|
+
var noop = function () { /* empty */ };
|
|
857
|
+
var empty = [];
|
|
858
|
+
var construct = getBuiltIn('Reflect', 'construct');
|
|
859
|
+
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
860
|
+
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
861
|
+
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
862
|
+
|
|
863
|
+
var isConstructorModern = function (argument) {
|
|
864
|
+
if (!isCallable(argument)) return false;
|
|
865
|
+
try {
|
|
866
|
+
construct(noop, empty, argument);
|
|
867
|
+
return true;
|
|
868
|
+
} catch (error) {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
var isConstructorLegacy = function (argument) {
|
|
874
|
+
if (!isCallable(argument)) return false;
|
|
875
|
+
switch (classof(argument)) {
|
|
876
|
+
case 'AsyncFunction':
|
|
877
|
+
case 'GeneratorFunction':
|
|
878
|
+
case 'AsyncGeneratorFunction': return false;
|
|
879
|
+
// we can't check .prototype since constructors produced by .bind haven't it
|
|
880
|
+
} return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// `IsConstructor` abstract operation
|
|
884
|
+
// https://tc39.es/ecma262/#sec-isconstructor
|
|
885
|
+
var isConstructor = !construct || fails(function () {
|
|
886
|
+
var called;
|
|
887
|
+
return isConstructorModern(isConstructorModern.call)
|
|
888
|
+
|| !isConstructorModern(Object)
|
|
889
|
+
|| !isConstructorModern(function () { called = true; })
|
|
890
|
+
|| called;
|
|
891
|
+
}) ? isConstructorLegacy : isConstructorModern;
|
|
892
|
+
|
|
893
|
+
var SPECIES$4 = wellKnownSymbol('species');
|
|
894
|
+
var Array$1 = global_1.Array;
|
|
895
|
+
|
|
896
|
+
// a part of `ArraySpeciesCreate` abstract operation
|
|
897
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
898
|
+
var arraySpeciesConstructor = function (originalArray) {
|
|
899
|
+
var C;
|
|
900
|
+
if (isArray$1(originalArray)) {
|
|
901
|
+
C = originalArray.constructor;
|
|
902
|
+
// cross-realm fallback
|
|
903
|
+
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
904
|
+
else if (isObject$1(C)) {
|
|
905
|
+
C = C[SPECIES$4];
|
|
906
|
+
if (C === null) C = undefined;
|
|
907
|
+
}
|
|
908
|
+
} return C === undefined ? Array$1 : C;
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
// `ArraySpeciesCreate` abstract operation
|
|
912
|
+
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
913
|
+
var arraySpeciesCreate = function (originalArray, length) {
|
|
914
|
+
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
var SPECIES$3 = wellKnownSymbol('species');
|
|
918
|
+
|
|
919
|
+
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
920
|
+
// We can't use this feature detection in V8 since it causes
|
|
921
|
+
// deoptimization and serious performance degradation
|
|
922
|
+
// https://github.com/zloirock/core-js/issues/677
|
|
923
|
+
return engineV8Version >= 51 || !fails(function () {
|
|
924
|
+
var array = [];
|
|
925
|
+
var constructor = array.constructor = {};
|
|
926
|
+
constructor[SPECIES$3] = function () {
|
|
927
|
+
return { foo: 1 };
|
|
928
|
+
};
|
|
929
|
+
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
930
|
+
});
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
934
|
+
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
935
|
+
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
936
|
+
var TypeError$8 = global_1.TypeError;
|
|
937
|
+
|
|
938
|
+
// We can't use this feature detection in V8 since it causes
|
|
939
|
+
// deoptimization and serious performance degradation
|
|
940
|
+
// https://github.com/zloirock/core-js/issues/679
|
|
941
|
+
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
942
|
+
var array = [];
|
|
943
|
+
array[IS_CONCAT_SPREADABLE] = false;
|
|
944
|
+
return array.concat()[0] !== array;
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
948
|
+
|
|
949
|
+
var isConcatSpreadable = function (O) {
|
|
950
|
+
if (!isObject$1(O)) return false;
|
|
951
|
+
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
952
|
+
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
var FORCED$1 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
956
|
+
|
|
957
|
+
// `Array.prototype.concat` method
|
|
958
|
+
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
959
|
+
// with adding support of @@isConcatSpreadable and @@species
|
|
960
|
+
_export({ target: 'Array', proto: true, forced: FORCED$1 }, {
|
|
961
|
+
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
962
|
+
concat: function concat(arg) {
|
|
963
|
+
var O = toObject(this);
|
|
964
|
+
var A = arraySpeciesCreate(O, 0);
|
|
965
|
+
var n = 0;
|
|
966
|
+
var i, k, length, len, E;
|
|
967
|
+
for (i = -1, length = arguments.length; i < length; i++) {
|
|
968
|
+
E = i === -1 ? O : arguments[i];
|
|
969
|
+
if (isConcatSpreadable(E)) {
|
|
970
|
+
len = lengthOfArrayLike(E);
|
|
971
|
+
if (n + len > MAX_SAFE_INTEGER) throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
972
|
+
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
973
|
+
} else {
|
|
974
|
+
if (n >= MAX_SAFE_INTEGER) throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
975
|
+
createProperty(A, n++, E);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
A.length = n;
|
|
979
|
+
return A;
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
|
|
829
983
|
// `Object.defineProperties` method
|
|
830
984
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
831
985
|
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
832
|
-
var
|
|
986
|
+
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
833
987
|
anObject(O);
|
|
834
988
|
var props = toIndexedObject(Properties);
|
|
835
989
|
var keys = objectKeys(Properties);
|
|
@@ -840,10 +994,6 @@ var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : funct
|
|
|
840
994
|
return O;
|
|
841
995
|
};
|
|
842
996
|
|
|
843
|
-
var objectDefineProperties = {
|
|
844
|
-
f: f$1
|
|
845
|
-
};
|
|
846
|
-
|
|
847
997
|
var html = getBuiltIn('document', 'documentElement');
|
|
848
998
|
|
|
849
999
|
/* global ActiveXObject -- old IE, WSH */
|
|
@@ -926,7 +1076,7 @@ var objectCreate = Object.create || function create(O, Properties) {
|
|
|
926
1076
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
927
1077
|
result[IE_PROTO] = O;
|
|
928
1078
|
} else result = NullProtoObject();
|
|
929
|
-
return Properties === undefined ? result : objectDefineProperties
|
|
1079
|
+
return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
|
930
1080
|
};
|
|
931
1081
|
|
|
932
1082
|
var UNSCOPABLES = wellKnownSymbol('unscopables');
|
|
@@ -960,38 +1110,6 @@ _export({ target: 'Array', proto: true }, {
|
|
|
960
1110
|
// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
|
|
961
1111
|
addToUnscopables('includes');
|
|
962
1112
|
|
|
963
|
-
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
|
|
964
|
-
var test = {};
|
|
965
|
-
|
|
966
|
-
test[TO_STRING_TAG$2] = 'z';
|
|
967
|
-
|
|
968
|
-
var toStringTagSupport = String(test) === '[object z]';
|
|
969
|
-
|
|
970
|
-
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
|
|
971
|
-
var Object$1 = global_1.Object;
|
|
972
|
-
|
|
973
|
-
// ES3 wrong here
|
|
974
|
-
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
|
|
975
|
-
|
|
976
|
-
// fallback for IE11 Script Access Denied error
|
|
977
|
-
var tryGet = function (it, key) {
|
|
978
|
-
try {
|
|
979
|
-
return it[key];
|
|
980
|
-
} catch (error) { /* empty */ }
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
// getting tag from ES6+ `Object.prototype.toString`
|
|
984
|
-
var classof = toStringTagSupport ? classofRaw : function (it) {
|
|
985
|
-
var O, tag, result;
|
|
986
|
-
return it === undefined ? 'Undefined' : it === null ? 'Null'
|
|
987
|
-
// @@toStringTag case
|
|
988
|
-
: typeof (tag = tryGet(O = Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
|
|
989
|
-
// builtinTag case
|
|
990
|
-
: CORRECT_ARGUMENTS ? classofRaw(O)
|
|
991
|
-
// ES3 arguments fallback
|
|
992
|
-
: (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
|
993
|
-
};
|
|
994
|
-
|
|
995
1113
|
var String$3 = global_1.String;
|
|
996
1114
|
|
|
997
1115
|
var toString_1 = function (argument) {
|
|
@@ -1022,13 +1140,7 @@ var UNSUPPORTED_Y$1 = fails(function () {
|
|
|
1022
1140
|
return re.exec('abcd') != null;
|
|
1023
1141
|
});
|
|
1024
1142
|
|
|
1025
|
-
|
|
1026
|
-
// https://github.com/zloirock/core-js/issues/1008
|
|
1027
|
-
var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
|
|
1028
|
-
return !$RegExp$2('a', 'y').sticky;
|
|
1029
|
-
});
|
|
1030
|
-
|
|
1031
|
-
var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
1143
|
+
var BROKEN_CARET = fails(function () {
|
|
1032
1144
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=773687
|
|
1033
1145
|
var re = $RegExp$2('^r', 'gy');
|
|
1034
1146
|
re.lastIndex = 2;
|
|
@@ -1036,9 +1148,8 @@ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
|
|
|
1036
1148
|
});
|
|
1037
1149
|
|
|
1038
1150
|
var regexpStickyHelpers = {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
UNSUPPORTED_Y: UNSUPPORTED_Y$1
|
|
1151
|
+
UNSUPPORTED_Y: UNSUPPORTED_Y$1,
|
|
1152
|
+
BROKEN_CARET: BROKEN_CARET
|
|
1042
1153
|
};
|
|
1043
1154
|
|
|
1044
1155
|
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
@@ -1087,7 +1198,7 @@ var UPDATES_LAST_INDEX_WRONG = (function () {
|
|
|
1087
1198
|
return re1.lastIndex !== 0 || re2.lastIndex !== 0;
|
|
1088
1199
|
})();
|
|
1089
1200
|
|
|
1090
|
-
var UNSUPPORTED_Y = regexpStickyHelpers.BROKEN_CARET;
|
|
1201
|
+
var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
|
|
1091
1202
|
|
|
1092
1203
|
// nonparticipating capturing group, copied from es5-shim's String#split patch.
|
|
1093
1204
|
var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
@@ -1095,6 +1206,7 @@ var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
|
|
|
1095
1206
|
var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || regexpUnsupportedDotAll || regexpUnsupportedNcg;
|
|
1096
1207
|
|
|
1097
1208
|
if (PATCH) {
|
|
1209
|
+
// eslint-disable-next-line max-statements -- TODO
|
|
1098
1210
|
patchedExec = function exec(string) {
|
|
1099
1211
|
var re = this;
|
|
1100
1212
|
var state = getInternalState$1(re);
|
|
@@ -1190,11 +1302,11 @@ var isRegexp = function (it) {
|
|
|
1190
1302
|
return isObject$1(it) && ((isRegExp = it[MATCH$1]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
|
|
1191
1303
|
};
|
|
1192
1304
|
|
|
1193
|
-
var TypeError$
|
|
1305
|
+
var TypeError$7 = global_1.TypeError;
|
|
1194
1306
|
|
|
1195
1307
|
var notARegexp = function (it) {
|
|
1196
1308
|
if (isRegexp(it)) {
|
|
1197
|
-
throw TypeError$
|
|
1309
|
+
throw TypeError$7("The method doesn't accept regular expressions");
|
|
1198
1310
|
} return it;
|
|
1199
1311
|
};
|
|
1200
1312
|
|
|
@@ -1282,18 +1394,6 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
|
|
|
1282
1394
|
}
|
|
1283
1395
|
});
|
|
1284
1396
|
|
|
1285
|
-
// `Object.prototype.toString` method implementation
|
|
1286
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1287
|
-
var objectToString = toStringTagSupport ? {}.toString : function toString() {
|
|
1288
|
-
return '[object ' + classof(this) + ']';
|
|
1289
|
-
};
|
|
1290
|
-
|
|
1291
|
-
// `Object.prototype.toString` method
|
|
1292
|
-
// https://tc39.es/ecma262/#sec-object.prototype.tostring
|
|
1293
|
-
if (!toStringTagSupport) {
|
|
1294
|
-
redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
1397
|
var nativePromiseConstructor = global_1.Promise;
|
|
1298
1398
|
|
|
1299
1399
|
var redefineAll = function (target, src, options) {
|
|
@@ -1302,11 +1402,11 @@ var redefineAll = function (target, src, options) {
|
|
|
1302
1402
|
};
|
|
1303
1403
|
|
|
1304
1404
|
var String$2 = global_1.String;
|
|
1305
|
-
var TypeError$
|
|
1405
|
+
var TypeError$6 = global_1.TypeError;
|
|
1306
1406
|
|
|
1307
1407
|
var aPossiblePrototype = function (argument) {
|
|
1308
1408
|
if (typeof argument == 'object' || isCallable(argument)) return argument;
|
|
1309
|
-
throw TypeError$
|
|
1409
|
+
throw TypeError$6("Can't set " + String$2(argument) + ' as a prototype');
|
|
1310
1410
|
};
|
|
1311
1411
|
|
|
1312
1412
|
/* eslint-disable no-proto -- safe */
|
|
@@ -1343,40 +1443,39 @@ var defineProperty$2 = objectDefineProperty.f;
|
|
|
1343
1443
|
|
|
1344
1444
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
1345
1445
|
|
|
1346
|
-
var setToStringTag = function (
|
|
1347
|
-
if (
|
|
1348
|
-
|
|
1349
|
-
defineProperty$2(target, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1446
|
+
var setToStringTag = function (it, TAG, STATIC) {
|
|
1447
|
+
if (it && !hasOwnProperty_1(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
|
1448
|
+
defineProperty$2(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
|
1350
1449
|
}
|
|
1351
1450
|
};
|
|
1352
1451
|
|
|
1353
|
-
var SPECIES$
|
|
1452
|
+
var SPECIES$2 = wellKnownSymbol('species');
|
|
1354
1453
|
|
|
1355
1454
|
var setSpecies = function (CONSTRUCTOR_NAME) {
|
|
1356
1455
|
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
|
|
1357
1456
|
var defineProperty = objectDefineProperty.f;
|
|
1358
1457
|
|
|
1359
|
-
if (descriptors && Constructor && !Constructor[SPECIES$
|
|
1360
|
-
defineProperty(Constructor, SPECIES$
|
|
1458
|
+
if (descriptors && Constructor && !Constructor[SPECIES$2]) {
|
|
1459
|
+
defineProperty(Constructor, SPECIES$2, {
|
|
1361
1460
|
configurable: true,
|
|
1362
1461
|
get: function () { return this; }
|
|
1363
1462
|
});
|
|
1364
1463
|
}
|
|
1365
1464
|
};
|
|
1366
1465
|
|
|
1367
|
-
var TypeError$
|
|
1466
|
+
var TypeError$5 = global_1.TypeError;
|
|
1368
1467
|
|
|
1369
1468
|
var anInstance = function (it, Prototype) {
|
|
1370
1469
|
if (objectIsPrototypeOf(Prototype, it)) return it;
|
|
1371
|
-
throw TypeError$
|
|
1470
|
+
throw TypeError$5('Incorrect invocation');
|
|
1372
1471
|
};
|
|
1373
1472
|
|
|
1374
|
-
var bind$
|
|
1473
|
+
var bind$3 = functionUncurryThis(functionUncurryThis.bind);
|
|
1375
1474
|
|
|
1376
1475
|
// optional / simple context binding
|
|
1377
1476
|
var functionBindContext = function (fn, that) {
|
|
1378
1477
|
aCallable(fn);
|
|
1379
|
-
return that === undefined ? fn :
|
|
1478
|
+
return that === undefined ? fn : bind$3 ? bind$3(fn, that) : function (/* ...args */) {
|
|
1380
1479
|
return fn.apply(that, arguments);
|
|
1381
1480
|
};
|
|
1382
1481
|
};
|
|
@@ -1399,12 +1498,12 @@ var getIteratorMethod = function (it) {
|
|
|
1399
1498
|
|| iterators[classof(it)];
|
|
1400
1499
|
};
|
|
1401
1500
|
|
|
1402
|
-
var TypeError$
|
|
1501
|
+
var TypeError$4 = global_1.TypeError;
|
|
1403
1502
|
|
|
1404
1503
|
var getIterator = function (argument, usingIterator) {
|
|
1405
1504
|
var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
|
1406
1505
|
if (aCallable(iteratorMethod)) return anObject(functionCall(iteratorMethod, argument));
|
|
1407
|
-
throw TypeError$
|
|
1506
|
+
throw TypeError$4(tryToString(argument) + ' is not iterable');
|
|
1408
1507
|
};
|
|
1409
1508
|
|
|
1410
1509
|
var iteratorClose = function (iterator, kind, value) {
|
|
@@ -1427,7 +1526,7 @@ var iteratorClose = function (iterator, kind, value) {
|
|
|
1427
1526
|
return value;
|
|
1428
1527
|
};
|
|
1429
1528
|
|
|
1430
|
-
var TypeError$
|
|
1529
|
+
var TypeError$3 = global_1.TypeError;
|
|
1431
1530
|
|
|
1432
1531
|
var Result = function (stopped, result) {
|
|
1433
1532
|
this.stopped = stopped;
|
|
@@ -1460,7 +1559,7 @@ var iterate = function (iterable, unboundFunction, options) {
|
|
|
1460
1559
|
iterator = iterable;
|
|
1461
1560
|
} else {
|
|
1462
1561
|
iterFn = getIteratorMethod(iterable);
|
|
1463
|
-
if (!iterFn) throw TypeError$
|
|
1562
|
+
if (!iterFn) throw TypeError$3(tryToString(iterable) + ' is not iterable');
|
|
1464
1563
|
// optimisation for array iterators
|
|
1465
1564
|
if (isArrayIteratorMethod(iterFn)) {
|
|
1466
1565
|
for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
|
@@ -1519,88 +1618,36 @@ var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
|
|
|
1519
1618
|
return ITERATION_SUPPORT;
|
|
1520
1619
|
};
|
|
1521
1620
|
|
|
1522
|
-
var
|
|
1523
|
-
var empty = [];
|
|
1524
|
-
var construct = getBuiltIn('Reflect', 'construct');
|
|
1525
|
-
var constructorRegExp = /^\s*(?:class|function)\b/;
|
|
1526
|
-
var exec = functionUncurryThis(constructorRegExp.exec);
|
|
1527
|
-
var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
|
1528
|
-
|
|
1529
|
-
var isConstructorModern = function isConstructor(argument) {
|
|
1530
|
-
if (!isCallable(argument)) return false;
|
|
1531
|
-
try {
|
|
1532
|
-
construct(noop, empty, argument);
|
|
1533
|
-
return true;
|
|
1534
|
-
} catch (error) {
|
|
1535
|
-
return false;
|
|
1536
|
-
}
|
|
1537
|
-
};
|
|
1538
|
-
|
|
1539
|
-
var isConstructorLegacy = function isConstructor(argument) {
|
|
1540
|
-
if (!isCallable(argument)) return false;
|
|
1541
|
-
switch (classof(argument)) {
|
|
1542
|
-
case 'AsyncFunction':
|
|
1543
|
-
case 'GeneratorFunction':
|
|
1544
|
-
case 'AsyncGeneratorFunction': return false;
|
|
1545
|
-
}
|
|
1546
|
-
try {
|
|
1547
|
-
// we can't check .prototype since constructors produced by .bind haven't it
|
|
1548
|
-
// `Function#toString` throws on some built-it function in some legacy engines
|
|
1549
|
-
// (for example, `DOMQuad` and similar in FF41-)
|
|
1550
|
-
return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
|
1551
|
-
} catch (error) {
|
|
1552
|
-
return true;
|
|
1553
|
-
}
|
|
1554
|
-
};
|
|
1555
|
-
|
|
1556
|
-
isConstructorLegacy.sham = true;
|
|
1557
|
-
|
|
1558
|
-
// `IsConstructor` abstract operation
|
|
1559
|
-
// https://tc39.es/ecma262/#sec-isconstructor
|
|
1560
|
-
var isConstructor = !construct || fails(function () {
|
|
1561
|
-
var called;
|
|
1562
|
-
return isConstructorModern(isConstructorModern.call)
|
|
1563
|
-
|| !isConstructorModern(Object)
|
|
1564
|
-
|| !isConstructorModern(function () { called = true; })
|
|
1565
|
-
|| called;
|
|
1566
|
-
}) ? isConstructorLegacy : isConstructorModern;
|
|
1567
|
-
|
|
1568
|
-
var TypeError$4 = global_1.TypeError;
|
|
1621
|
+
var TypeError$2 = global_1.TypeError;
|
|
1569
1622
|
|
|
1570
1623
|
// `Assert: IsConstructor(argument) is true`
|
|
1571
1624
|
var aConstructor = function (argument) {
|
|
1572
1625
|
if (isConstructor(argument)) return argument;
|
|
1573
|
-
throw TypeError$
|
|
1626
|
+
throw TypeError$2(tryToString(argument) + ' is not a constructor');
|
|
1574
1627
|
};
|
|
1575
1628
|
|
|
1576
|
-
var SPECIES$
|
|
1629
|
+
var SPECIES$1 = wellKnownSymbol('species');
|
|
1577
1630
|
|
|
1578
1631
|
// `SpeciesConstructor` abstract operation
|
|
1579
1632
|
// https://tc39.es/ecma262/#sec-speciesconstructor
|
|
1580
1633
|
var speciesConstructor = function (O, defaultConstructor) {
|
|
1581
1634
|
var C = anObject(O).constructor;
|
|
1582
1635
|
var S;
|
|
1583
|
-
return C === undefined || (S = anObject(C)[SPECIES$
|
|
1636
|
+
return C === undefined || (S = anObject(C)[SPECIES$1]) == undefined ? defaultConstructor : aConstructor(S);
|
|
1584
1637
|
};
|
|
1585
1638
|
|
|
1586
1639
|
var FunctionPrototype$1 = Function.prototype;
|
|
1587
1640
|
var apply = FunctionPrototype$1.apply;
|
|
1641
|
+
var bind$2 = FunctionPrototype$1.bind;
|
|
1588
1642
|
var call = FunctionPrototype$1.call;
|
|
1589
1643
|
|
|
1590
1644
|
// eslint-disable-next-line es/no-reflect -- safe
|
|
1591
|
-
var functionApply = typeof Reflect == 'object' && Reflect.apply || (
|
|
1645
|
+
var functionApply = typeof Reflect == 'object' && Reflect.apply || (bind$2 ? call.bind(apply) : function () {
|
|
1592
1646
|
return call.apply(apply, arguments);
|
|
1593
1647
|
});
|
|
1594
1648
|
|
|
1595
1649
|
var arraySlice = functionUncurryThis([].slice);
|
|
1596
1650
|
|
|
1597
|
-
var TypeError$3 = global_1.TypeError;
|
|
1598
|
-
|
|
1599
|
-
var validateArgumentsLength = function (passed, required) {
|
|
1600
|
-
if (passed < required) throw TypeError$3('Not enough arguments');
|
|
1601
|
-
return passed;
|
|
1602
|
-
};
|
|
1603
|
-
|
|
1604
1651
|
var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
|
|
1605
1652
|
|
|
1606
1653
|
var engineIsNode = classofRaw(global_1.process) == 'process';
|
|
@@ -1613,7 +1660,7 @@ var Function$1 = global_1.Function;
|
|
|
1613
1660
|
var MessageChannel = global_1.MessageChannel;
|
|
1614
1661
|
var String$1 = global_1.String;
|
|
1615
1662
|
var counter = 0;
|
|
1616
|
-
var queue
|
|
1663
|
+
var queue = {};
|
|
1617
1664
|
var ONREADYSTATECHANGE = 'onreadystatechange';
|
|
1618
1665
|
var location, defer, channel, port;
|
|
1619
1666
|
|
|
@@ -1623,9 +1670,9 @@ try {
|
|
|
1623
1670
|
} catch (error) { /* empty */ }
|
|
1624
1671
|
|
|
1625
1672
|
var run = function (id) {
|
|
1626
|
-
if (hasOwnProperty_1(queue
|
|
1627
|
-
var fn = queue
|
|
1628
|
-
delete queue
|
|
1673
|
+
if (hasOwnProperty_1(queue, id)) {
|
|
1674
|
+
var fn = queue[id];
|
|
1675
|
+
delete queue[id];
|
|
1629
1676
|
fn();
|
|
1630
1677
|
}
|
|
1631
1678
|
};
|
|
@@ -1647,18 +1694,16 @@ var post = function (id) {
|
|
|
1647
1694
|
|
|
1648
1695
|
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
|
|
1649
1696
|
if (!set || !clear) {
|
|
1650
|
-
set = function setImmediate(
|
|
1651
|
-
validateArgumentsLength(arguments.length, 1);
|
|
1652
|
-
var fn = isCallable(handler) ? handler : Function$1(handler);
|
|
1697
|
+
set = function setImmediate(fn) {
|
|
1653
1698
|
var args = arraySlice(arguments, 1);
|
|
1654
|
-
queue
|
|
1655
|
-
functionApply(fn, undefined, args);
|
|
1699
|
+
queue[++counter] = function () {
|
|
1700
|
+
functionApply(isCallable(fn) ? fn : Function$1(fn), undefined, args);
|
|
1656
1701
|
};
|
|
1657
1702
|
defer(counter);
|
|
1658
1703
|
return counter;
|
|
1659
1704
|
};
|
|
1660
1705
|
clear = function clearImmediate(id) {
|
|
1661
|
-
delete queue
|
|
1706
|
+
delete queue[id];
|
|
1662
1707
|
};
|
|
1663
1708
|
// Node.js 0.8-
|
|
1664
1709
|
if (engineIsNode) {
|
|
@@ -1842,30 +1887,6 @@ var perform = function (exec) {
|
|
|
1842
1887
|
}
|
|
1843
1888
|
};
|
|
1844
1889
|
|
|
1845
|
-
var Queue = function () {
|
|
1846
|
-
this.head = null;
|
|
1847
|
-
this.tail = null;
|
|
1848
|
-
};
|
|
1849
|
-
|
|
1850
|
-
Queue.prototype = {
|
|
1851
|
-
add: function (item) {
|
|
1852
|
-
var entry = { item: item, next: null };
|
|
1853
|
-
if (this.head) this.tail.next = entry;
|
|
1854
|
-
else this.head = entry;
|
|
1855
|
-
this.tail = entry;
|
|
1856
|
-
},
|
|
1857
|
-
get: function () {
|
|
1858
|
-
var entry = this.head;
|
|
1859
|
-
if (entry) {
|
|
1860
|
-
this.head = entry.next;
|
|
1861
|
-
if (this.tail === entry) this.tail = null;
|
|
1862
|
-
return entry.item;
|
|
1863
|
-
}
|
|
1864
|
-
}
|
|
1865
|
-
};
|
|
1866
|
-
|
|
1867
|
-
var queue = Queue;
|
|
1868
|
-
|
|
1869
1890
|
var engineIsBrowser = typeof window == 'object';
|
|
1870
1891
|
|
|
1871
1892
|
var task = task$1.set;
|
|
@@ -1881,17 +1902,16 @@ var task = task$1.set;
|
|
|
1881
1902
|
|
|
1882
1903
|
|
|
1883
1904
|
|
|
1884
|
-
|
|
1885
|
-
var SPECIES$2 = wellKnownSymbol('species');
|
|
1905
|
+
var SPECIES = wellKnownSymbol('species');
|
|
1886
1906
|
var PROMISE = 'Promise';
|
|
1887
1907
|
|
|
1888
|
-
var getInternalState = internalState.
|
|
1908
|
+
var getInternalState = internalState.get;
|
|
1889
1909
|
var setInternalState = internalState.set;
|
|
1890
1910
|
var getInternalPromiseState = internalState.getterFor(PROMISE);
|
|
1891
1911
|
var NativePromisePrototype = nativePromiseConstructor && nativePromiseConstructor.prototype;
|
|
1892
1912
|
var PromiseConstructor = nativePromiseConstructor;
|
|
1893
1913
|
var PromisePrototype = NativePromisePrototype;
|
|
1894
|
-
var TypeError$
|
|
1914
|
+
var TypeError$1 = global_1.TypeError;
|
|
1895
1915
|
var document$1 = global_1.document;
|
|
1896
1916
|
var process$1 = global_1.process;
|
|
1897
1917
|
var newPromiseCapability = newPromiseCapability$1.f;
|
|
@@ -1910,7 +1930,7 @@ var SUBCLASSING = false;
|
|
|
1910
1930
|
|
|
1911
1931
|
var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
|
|
1912
1932
|
|
|
1913
|
-
var FORCED
|
|
1933
|
+
var FORCED = isForced_1(PROMISE, function () {
|
|
1914
1934
|
var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
|
|
1915
1935
|
var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
|
|
1916
1936
|
// V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
|
|
@@ -1927,14 +1947,14 @@ var FORCED$1 = isForced_1(PROMISE, function () {
|
|
|
1927
1947
|
exec(function () { /* empty */ }, function () { /* empty */ });
|
|
1928
1948
|
};
|
|
1929
1949
|
var constructor = promise.constructor = {};
|
|
1930
|
-
constructor[SPECIES
|
|
1950
|
+
constructor[SPECIES] = FakePromise;
|
|
1931
1951
|
SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
|
|
1932
1952
|
if (!SUBCLASSING) return true;
|
|
1933
1953
|
// Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
|
|
1934
1954
|
return !GLOBAL_CORE_JS_PROMISE && engineIsBrowser && !NATIVE_REJECTION_EVENT;
|
|
1935
1955
|
});
|
|
1936
1956
|
|
|
1937
|
-
var INCORRECT_ITERATION = FORCED
|
|
1957
|
+
var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
|
|
1938
1958
|
PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
|
|
1939
1959
|
});
|
|
1940
1960
|
|
|
@@ -1944,50 +1964,49 @@ var isThenable = function (it) {
|
|
|
1944
1964
|
return isObject$1(it) && isCallable(then = it.then) ? then : false;
|
|
1945
1965
|
};
|
|
1946
1966
|
|
|
1947
|
-
var callReaction = function (reaction, state) {
|
|
1948
|
-
var value = state.value;
|
|
1949
|
-
var ok = state.state == FULFILLED;
|
|
1950
|
-
var handler = ok ? reaction.ok : reaction.fail;
|
|
1951
|
-
var resolve = reaction.resolve;
|
|
1952
|
-
var reject = reaction.reject;
|
|
1953
|
-
var domain = reaction.domain;
|
|
1954
|
-
var result, then, exited;
|
|
1955
|
-
try {
|
|
1956
|
-
if (handler) {
|
|
1957
|
-
if (!ok) {
|
|
1958
|
-
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
1959
|
-
state.rejection = HANDLED;
|
|
1960
|
-
}
|
|
1961
|
-
if (handler === true) result = value;
|
|
1962
|
-
else {
|
|
1963
|
-
if (domain) domain.enter();
|
|
1964
|
-
result = handler(value); // can throw
|
|
1965
|
-
if (domain) {
|
|
1966
|
-
domain.exit();
|
|
1967
|
-
exited = true;
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
if (result === reaction.promise) {
|
|
1971
|
-
reject(TypeError$2('Promise-chain cycle'));
|
|
1972
|
-
} else if (then = isThenable(result)) {
|
|
1973
|
-
functionCall(then, result, resolve, reject);
|
|
1974
|
-
} else resolve(result);
|
|
1975
|
-
} else reject(value);
|
|
1976
|
-
} catch (error) {
|
|
1977
|
-
if (domain && !exited) domain.exit();
|
|
1978
|
-
reject(error);
|
|
1979
|
-
}
|
|
1980
|
-
};
|
|
1981
|
-
|
|
1982
1967
|
var notify = function (state, isReject) {
|
|
1983
1968
|
if (state.notified) return;
|
|
1984
1969
|
state.notified = true;
|
|
1970
|
+
var chain = state.reactions;
|
|
1985
1971
|
microtask(function () {
|
|
1986
|
-
var
|
|
1987
|
-
var
|
|
1988
|
-
|
|
1989
|
-
|
|
1972
|
+
var value = state.value;
|
|
1973
|
+
var ok = state.state == FULFILLED;
|
|
1974
|
+
var index = 0;
|
|
1975
|
+
// variable length - can't use forEach
|
|
1976
|
+
while (chain.length > index) {
|
|
1977
|
+
var reaction = chain[index++];
|
|
1978
|
+
var handler = ok ? reaction.ok : reaction.fail;
|
|
1979
|
+
var resolve = reaction.resolve;
|
|
1980
|
+
var reject = reaction.reject;
|
|
1981
|
+
var domain = reaction.domain;
|
|
1982
|
+
var result, then, exited;
|
|
1983
|
+
try {
|
|
1984
|
+
if (handler) {
|
|
1985
|
+
if (!ok) {
|
|
1986
|
+
if (state.rejection === UNHANDLED) onHandleUnhandled(state);
|
|
1987
|
+
state.rejection = HANDLED;
|
|
1988
|
+
}
|
|
1989
|
+
if (handler === true) result = value;
|
|
1990
|
+
else {
|
|
1991
|
+
if (domain) domain.enter();
|
|
1992
|
+
result = handler(value); // can throw
|
|
1993
|
+
if (domain) {
|
|
1994
|
+
domain.exit();
|
|
1995
|
+
exited = true;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
if (result === reaction.promise) {
|
|
1999
|
+
reject(TypeError$1('Promise-chain cycle'));
|
|
2000
|
+
} else if (then = isThenable(result)) {
|
|
2001
|
+
functionCall(then, result, resolve, reject);
|
|
2002
|
+
} else resolve(result);
|
|
2003
|
+
} else reject(value);
|
|
2004
|
+
} catch (error) {
|
|
2005
|
+
if (domain && !exited) domain.exit();
|
|
2006
|
+
reject(error);
|
|
2007
|
+
}
|
|
1990
2008
|
}
|
|
2009
|
+
state.reactions = [];
|
|
1991
2010
|
state.notified = false;
|
|
1992
2011
|
if (isReject && !state.rejection) onUnhandled(state);
|
|
1993
2012
|
});
|
|
@@ -2058,7 +2077,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2058
2077
|
state.done = true;
|
|
2059
2078
|
if (unwrap) state = unwrap;
|
|
2060
2079
|
try {
|
|
2061
|
-
if (state.facade === value) throw TypeError$
|
|
2080
|
+
if (state.facade === value) throw TypeError$1("Promise can't be resolved itself");
|
|
2062
2081
|
var then = isThenable(value);
|
|
2063
2082
|
if (then) {
|
|
2064
2083
|
microtask(function () {
|
|
@@ -2083,7 +2102,7 @@ var internalResolve = function (state, value, unwrap) {
|
|
|
2083
2102
|
};
|
|
2084
2103
|
|
|
2085
2104
|
// constructor polyfill
|
|
2086
|
-
if (FORCED
|
|
2105
|
+
if (FORCED) {
|
|
2087
2106
|
// 25.4.3.1 Promise(executor)
|
|
2088
2107
|
PromiseConstructor = function Promise(executor) {
|
|
2089
2108
|
anInstance(this, PromisePrototype);
|
|
@@ -2104,7 +2123,7 @@ if (FORCED$1) {
|
|
|
2104
2123
|
done: false,
|
|
2105
2124
|
notified: false,
|
|
2106
2125
|
parent: false,
|
|
2107
|
-
reactions:
|
|
2126
|
+
reactions: [],
|
|
2108
2127
|
rejection: false,
|
|
2109
2128
|
state: PENDING,
|
|
2110
2129
|
value: undefined
|
|
@@ -2113,18 +2132,16 @@ if (FORCED$1) {
|
|
|
2113
2132
|
Internal.prototype = redefineAll(PromisePrototype, {
|
|
2114
2133
|
// `Promise.prototype.then` method
|
|
2115
2134
|
// https://tc39.es/ecma262/#sec-promise.prototype.then
|
|
2116
|
-
// eslint-disable-next-line unicorn/no-thenable -- safe
|
|
2117
2135
|
then: function then(onFulfilled, onRejected) {
|
|
2118
2136
|
var state = getInternalPromiseState(this);
|
|
2137
|
+
var reactions = state.reactions;
|
|
2119
2138
|
var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
|
|
2120
|
-
state.parent = true;
|
|
2121
2139
|
reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
|
|
2122
2140
|
reaction.fail = isCallable(onRejected) && onRejected;
|
|
2123
2141
|
reaction.domain = engineIsNode ? process$1.domain : undefined;
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
});
|
|
2142
|
+
state.parent = true;
|
|
2143
|
+
reactions[reactions.length] = reaction;
|
|
2144
|
+
if (state.state != PENDING) notify(state, false);
|
|
2128
2145
|
return reaction.promise;
|
|
2129
2146
|
},
|
|
2130
2147
|
// `Promise.prototype.catch` method
|
|
@@ -2175,7 +2192,7 @@ if (FORCED$1) {
|
|
|
2175
2192
|
}
|
|
2176
2193
|
}
|
|
2177
2194
|
|
|
2178
|
-
_export({ global: true, wrap: true, forced: FORCED
|
|
2195
|
+
_export({ global: true, wrap: true, forced: FORCED }, {
|
|
2179
2196
|
Promise: PromiseConstructor
|
|
2180
2197
|
});
|
|
2181
2198
|
|
|
@@ -2185,7 +2202,7 @@ setSpecies(PROMISE);
|
|
|
2185
2202
|
PromiseWrapper = getBuiltIn(PROMISE);
|
|
2186
2203
|
|
|
2187
2204
|
// statics
|
|
2188
|
-
_export({ target: PROMISE, stat: true, forced: FORCED
|
|
2205
|
+
_export({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
2189
2206
|
// `Promise.reject` method
|
|
2190
2207
|
// https://tc39.es/ecma262/#sec-promise.reject
|
|
2191
2208
|
reject: function reject(r) {
|
|
@@ -2195,7 +2212,7 @@ _export({ target: PROMISE, stat: true, forced: FORCED$1 }, {
|
|
|
2195
2212
|
}
|
|
2196
2213
|
});
|
|
2197
2214
|
|
|
2198
|
-
_export({ target: PROMISE, stat: true, forced: FORCED
|
|
2215
|
+
_export({ target: PROMISE, stat: true, forced: FORCED }, {
|
|
2199
2216
|
// `Promise.resolve` method
|
|
2200
2217
|
// https://tc39.es/ecma262/#sec-promise.resolve
|
|
2201
2218
|
resolve: function resolve(x) {
|
|
@@ -2303,126 +2320,13 @@ _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }
|
|
|
2303
2320
|
assign: objectAssign
|
|
2304
2321
|
});
|
|
2305
2322
|
|
|
2306
|
-
// `IsArray` abstract operation
|
|
2307
|
-
// https://tc39.es/ecma262/#sec-isarray
|
|
2308
|
-
// eslint-disable-next-line es/no-array-isarray -- safe
|
|
2309
|
-
var isArray$1 = Array.isArray || function isArray(argument) {
|
|
2310
|
-
return classofRaw(argument) == 'Array';
|
|
2311
|
-
};
|
|
2312
|
-
|
|
2313
|
-
var createProperty = function (object, key, value) {
|
|
2314
|
-
var propertyKey = toPropertyKey(key);
|
|
2315
|
-
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
|
|
2316
|
-
else object[propertyKey] = value;
|
|
2317
|
-
};
|
|
2318
|
-
|
|
2319
|
-
var SPECIES$1 = wellKnownSymbol('species');
|
|
2320
|
-
var Array$1 = global_1.Array;
|
|
2321
|
-
|
|
2322
|
-
// a part of `ArraySpeciesCreate` abstract operation
|
|
2323
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
2324
|
-
var arraySpeciesConstructor = function (originalArray) {
|
|
2325
|
-
var C;
|
|
2326
|
-
if (isArray$1(originalArray)) {
|
|
2327
|
-
C = originalArray.constructor;
|
|
2328
|
-
// cross-realm fallback
|
|
2329
|
-
if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
|
|
2330
|
-
else if (isObject$1(C)) {
|
|
2331
|
-
C = C[SPECIES$1];
|
|
2332
|
-
if (C === null) C = undefined;
|
|
2333
|
-
}
|
|
2334
|
-
} return C === undefined ? Array$1 : C;
|
|
2335
|
-
};
|
|
2336
|
-
|
|
2337
|
-
// `ArraySpeciesCreate` abstract operation
|
|
2338
|
-
// https://tc39.es/ecma262/#sec-arrayspeciescreate
|
|
2339
|
-
var arraySpeciesCreate = function (originalArray, length) {
|
|
2340
|
-
return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
|
2341
|
-
};
|
|
2342
|
-
|
|
2343
|
-
var SPECIES = wellKnownSymbol('species');
|
|
2344
|
-
|
|
2345
|
-
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
|
|
2346
|
-
// We can't use this feature detection in V8 since it causes
|
|
2347
|
-
// deoptimization and serious performance degradation
|
|
2348
|
-
// https://github.com/zloirock/core-js/issues/677
|
|
2349
|
-
return engineV8Version >= 51 || !fails(function () {
|
|
2350
|
-
var array = [];
|
|
2351
|
-
var constructor = array.constructor = {};
|
|
2352
|
-
constructor[SPECIES] = function () {
|
|
2353
|
-
return { foo: 1 };
|
|
2354
|
-
};
|
|
2355
|
-
return array[METHOD_NAME](Boolean).foo !== 1;
|
|
2356
|
-
});
|
|
2357
|
-
};
|
|
2358
|
-
|
|
2359
|
-
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
|
|
2360
|
-
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
|
|
2361
|
-
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
|
|
2362
|
-
var TypeError$1 = global_1.TypeError;
|
|
2363
|
-
|
|
2364
|
-
// We can't use this feature detection in V8 since it causes
|
|
2365
|
-
// deoptimization and serious performance degradation
|
|
2366
|
-
// https://github.com/zloirock/core-js/issues/679
|
|
2367
|
-
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
|
|
2368
|
-
var array = [];
|
|
2369
|
-
array[IS_CONCAT_SPREADABLE] = false;
|
|
2370
|
-
return array.concat()[0] !== array;
|
|
2371
|
-
});
|
|
2372
|
-
|
|
2373
|
-
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
|
|
2374
|
-
|
|
2375
|
-
var isConcatSpreadable = function (O) {
|
|
2376
|
-
if (!isObject$1(O)) return false;
|
|
2377
|
-
var spreadable = O[IS_CONCAT_SPREADABLE];
|
|
2378
|
-
return spreadable !== undefined ? !!spreadable : isArray$1(O);
|
|
2379
|
-
};
|
|
2380
|
-
|
|
2381
|
-
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
|
|
2382
|
-
|
|
2383
|
-
// `Array.prototype.concat` method
|
|
2384
|
-
// https://tc39.es/ecma262/#sec-array.prototype.concat
|
|
2385
|
-
// with adding support of @@isConcatSpreadable and @@species
|
|
2386
|
-
_export({ target: 'Array', proto: true, forced: FORCED }, {
|
|
2387
|
-
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
|
2388
|
-
concat: function concat(arg) {
|
|
2389
|
-
var O = toObject(this);
|
|
2390
|
-
var A = arraySpeciesCreate(O, 0);
|
|
2391
|
-
var n = 0;
|
|
2392
|
-
var i, k, length, len, E;
|
|
2393
|
-
for (i = -1, length = arguments.length; i < length; i++) {
|
|
2394
|
-
E = i === -1 ? O : arguments[i];
|
|
2395
|
-
if (isConcatSpreadable(E)) {
|
|
2396
|
-
len = lengthOfArrayLike(E);
|
|
2397
|
-
if (n + len > MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
2398
|
-
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
|
|
2399
|
-
} else {
|
|
2400
|
-
if (n >= MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
|
|
2401
|
-
createProperty(A, n++, E);
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
A.length = n;
|
|
2405
|
-
return A;
|
|
2406
|
-
}
|
|
2407
|
-
});
|
|
2408
|
-
|
|
2409
|
-
var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
|
|
2410
|
-
|
|
2411
|
-
// `Object.keys` method
|
|
2412
|
-
// https://tc39.es/ecma262/#sec-object.keys
|
|
2413
|
-
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
|
|
2414
|
-
keys: function keys(it) {
|
|
2415
|
-
return objectKeys(toObject(it));
|
|
2416
|
-
}
|
|
2417
|
-
});
|
|
2418
|
-
|
|
2419
2323
|
var FUNCTION_NAME_EXISTS = functionName.EXISTS;
|
|
2420
2324
|
|
|
2421
2325
|
var defineProperty = objectDefineProperty.f;
|
|
2422
2326
|
|
|
2423
2327
|
var FunctionPrototype = Function.prototype;
|
|
2424
2328
|
var functionToString = functionUncurryThis(FunctionPrototype.toString);
|
|
2425
|
-
var nameRE =
|
|
2329
|
+
var nameRE = /^\s*function ([^ (]*)/;
|
|
2426
2330
|
var regExpExec = functionUncurryThis(nameRE.exec);
|
|
2427
2331
|
var NAME = 'name';
|
|
2428
2332
|
|
|
@@ -4038,17 +3942,52 @@ axios_1.default = default_1;
|
|
|
4038
3942
|
|
|
4039
3943
|
var axios = axios_1;
|
|
4040
3944
|
|
|
4041
|
-
var supportedVersions = ['v2', 'v3', 'v4', 'canary'];
|
|
3945
|
+
var supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
|
|
4042
3946
|
var name = '@tryghost/content-api';
|
|
4043
|
-
|
|
3947
|
+
|
|
3948
|
+
var defaultMakeRequest = function defaultMakeRequest(_ref) {
|
|
4044
3949
|
var url = _ref.url,
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
3950
|
+
method = _ref.method,
|
|
3951
|
+
params = _ref.params,
|
|
3952
|
+
headers = _ref.headers;
|
|
3953
|
+
return axios[method](url, {
|
|
3954
|
+
params: params,
|
|
3955
|
+
paramsSerializer: function paramsSerializer(parameters) {
|
|
3956
|
+
return Object.keys(parameters).reduce(function (parts, k) {
|
|
3957
|
+
var val = encodeURIComponent([].concat(parameters[k]).join(','));
|
|
3958
|
+
return parts.concat("".concat(k, "=").concat(val));
|
|
3959
|
+
}, []).join('&');
|
|
3960
|
+
},
|
|
3961
|
+
headers: headers
|
|
3962
|
+
});
|
|
3963
|
+
};
|
|
3964
|
+
/**
|
|
3965
|
+
*
|
|
3966
|
+
* @param {Object} options
|
|
3967
|
+
* @param {String} options.url
|
|
3968
|
+
* @param {String} options.key
|
|
3969
|
+
* @param {String} [options.ghostPath]
|
|
3970
|
+
* @param {String} [options.version]
|
|
3971
|
+
* @param {Function} [options.makeRequest]
|
|
3972
|
+
* @param {String} [options.host] Deprecated
|
|
3973
|
+
* @returns
|
|
3974
|
+
*/
|
|
4050
3975
|
|
|
4051
|
-
|
|
3976
|
+
|
|
3977
|
+
function GhostContentAPI(_ref2) {
|
|
3978
|
+
var url = _ref2.url,
|
|
3979
|
+
key = _ref2.key,
|
|
3980
|
+
host = _ref2.host,
|
|
3981
|
+
version = _ref2.version,
|
|
3982
|
+
_ref2$ghostPath = _ref2.ghostPath,
|
|
3983
|
+
ghostPath = _ref2$ghostPath === void 0 ? 'ghost' : _ref2$ghostPath,
|
|
3984
|
+
_ref2$makeRequest = _ref2.makeRequest,
|
|
3985
|
+
makeRequest = _ref2$makeRequest === void 0 ? defaultMakeRequest : _ref2$makeRequest;
|
|
3986
|
+
|
|
3987
|
+
/**
|
|
3988
|
+
* host parameter is deprecated
|
|
3989
|
+
* @deprecated use "url" instead
|
|
3990
|
+
*/
|
|
4052
3991
|
if (host) {
|
|
4053
3992
|
// eslint-disable-next-line
|
|
4054
3993
|
console.warn("".concat(name, ": The 'host' parameter is deprecated, please use 'url' instead"));
|
|
@@ -4061,16 +4000,14 @@ function GhostContentAPI(_ref) {
|
|
|
4061
4000
|
if (this instanceof GhostContentAPI) {
|
|
4062
4001
|
return GhostContentAPI({
|
|
4063
4002
|
url: url,
|
|
4003
|
+
key: key,
|
|
4064
4004
|
version: version,
|
|
4065
|
-
|
|
4005
|
+
ghostPath: ghostPath,
|
|
4006
|
+
makeRequest: makeRequest
|
|
4066
4007
|
});
|
|
4067
4008
|
}
|
|
4068
4009
|
|
|
4069
|
-
if (!version) {
|
|
4070
|
-
throw new Error("".concat(name, " Config Missing: 'version' is required. E.g. ").concat(supportedVersions.join(',')));
|
|
4071
|
-
}
|
|
4072
|
-
|
|
4073
|
-
if (!supportedVersions.includes(version)) {
|
|
4010
|
+
if (version && !supportedVersions.includes(version)) {
|
|
4074
4011
|
throw new Error("".concat(name, " Config Invalid: 'version' ").concat(version, " is not supported"));
|
|
4075
4012
|
}
|
|
4076
4013
|
|
|
@@ -4098,7 +4035,7 @@ function GhostContentAPI(_ref) {
|
|
|
4098
4035
|
function browse() {
|
|
4099
4036
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
4100
4037
|
var memberToken = arguments.length > 1 ? arguments[1] : undefined;
|
|
4101
|
-
return
|
|
4038
|
+
return makeApiRequest(resourceType, options, null, memberToken);
|
|
4102
4039
|
}
|
|
4103
4040
|
|
|
4104
4041
|
function read(data) {
|
|
@@ -4110,7 +4047,7 @@ function GhostContentAPI(_ref) {
|
|
|
4110
4047
|
}
|
|
4111
4048
|
|
|
4112
4049
|
var params = Object.assign({}, data, options);
|
|
4113
|
-
return
|
|
4050
|
+
return makeApiRequest(resourceType, params, data.id || "slug/".concat(data.slug), memberToken);
|
|
4114
4051
|
}
|
|
4115
4052
|
|
|
4116
4053
|
return Object.assign(apiObject, _defineProperty({}, resourceType, {
|
|
@@ -4121,7 +4058,7 @@ function GhostContentAPI(_ref) {
|
|
|
4121
4058
|
delete api.settings.read;
|
|
4122
4059
|
return api;
|
|
4123
4060
|
|
|
4124
|
-
function
|
|
4061
|
+
function makeApiRequest(resourceType, params, id) {
|
|
4125
4062
|
var membersToken = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
4126
4063
|
|
|
4127
4064
|
if (!membersToken && !key) {
|
|
@@ -4131,17 +4068,20 @@ function GhostContentAPI(_ref) {
|
|
|
4131
4068
|
delete params.id;
|
|
4132
4069
|
var headers = membersToken ? {
|
|
4133
4070
|
Authorization: "GhostMembers ".concat(membersToken)
|
|
4134
|
-
} :
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4071
|
+
} : {};
|
|
4072
|
+
|
|
4073
|
+
if (!version || ['v4', 'v5', 'canary'].includes(version)) {
|
|
4074
|
+
headers['Accept-Version'] = version || 'v5';
|
|
4075
|
+
}
|
|
4076
|
+
|
|
4077
|
+
params = Object.assign({
|
|
4078
|
+
key: key
|
|
4079
|
+
}, params);
|
|
4080
|
+
var apiUrl = version ? "".concat(url, "/").concat(ghostPath, "/api/").concat(version, "/content/").concat(resourceType, "/").concat(id ? id + '/' : '') : "".concat(url, "/").concat(ghostPath, "/api/content/").concat(resourceType, "/").concat(id ? id + '/' : '');
|
|
4081
|
+
return makeRequest({
|
|
4082
|
+
url: apiUrl,
|
|
4083
|
+
method: 'get',
|
|
4084
|
+
params: params,
|
|
4145
4085
|
headers: headers
|
|
4146
4086
|
}).then(function (res) {
|
|
4147
4087
|
if (!Array.isArray(res.data[resourceType])) {
|