@tryghost/content-api 1.9.0 → 1.9.3

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/es/content-api.js CHANGED
@@ -1,3 +1,5 @@
1
+ import url from 'url';
2
+
1
3
  function _defineProperty(obj, key, value) {
2
4
  if (key in obj) {
3
5
  Object.defineProperty(obj, key, {
@@ -43,7 +45,7 @@ var fails = function (exec) {
43
45
  };
44
46
 
45
47
  // Detect IE8's incomplete defineProperty implementation
46
- var descriptors = !fails(function () {
48
+ var descriptors$1 = !fails(function () {
47
49
  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
48
50
  return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
49
51
  });
@@ -271,10 +273,10 @@ var shared = createCommonjsModule(function (module) {
271
273
  (module.exports = function (key, value) {
272
274
  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
273
275
  })('versions', []).push({
274
- version: '3.22.0',
276
+ version: '3.22.4',
275
277
  mode: 'global',
276
278
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
277
- license: 'https://github.com/zloirock/core-js/blob/v3.22.0/LICENSE',
279
+ license: 'https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE',
278
280
  source: 'https://github.com/zloirock/core-js'
279
281
  });
280
282
  });
@@ -357,7 +359,7 @@ var documentCreateElement = function (it) {
357
359
  };
358
360
 
359
361
  // Thanks to IE8 for its funny defineProperty
360
- var ie8DomDefine = !descriptors && !fails(function () {
362
+ var ie8DomDefine = !descriptors$1 && !fails(function () {
361
363
  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
362
364
  return Object.defineProperty(documentCreateElement('div'), 'a', {
363
365
  get: function () { return 7; }
@@ -369,7 +371,7 @@ var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
369
371
 
370
372
  // `Object.getOwnPropertyDescriptor` method
371
373
  // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
372
- var f$5 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
374
+ var f$5 = descriptors$1 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
373
375
  O = toIndexedObject(O);
374
376
  P = toPropertyKey(P);
375
377
  if (ie8DomDefine) try {
@@ -384,7 +386,7 @@ var objectGetOwnPropertyDescriptor = {
384
386
 
385
387
  // V8 ~ Chrome 36-
386
388
  // https://bugs.chromium.org/p/v8/issues/detail?id=3334
387
- var v8PrototypeDefineBug = descriptors && fails(function () {
389
+ var v8PrototypeDefineBug = descriptors$1 && fails(function () {
388
390
  // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
389
391
  return Object.defineProperty(function () { /* empty */ }, 'prototype', {
390
392
  value: 42,
@@ -412,7 +414,7 @@ var WRITABLE = 'writable';
412
414
 
413
415
  // `Object.defineProperty` method
414
416
  // https://tc39.es/ecma262/#sec-object.defineproperty
415
- var f$4 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
417
+ var f$4 = descriptors$1 ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
416
418
  anObject(O);
417
419
  P = toPropertyKey(P);
418
420
  anObject(Attributes);
@@ -443,13 +445,28 @@ var objectDefineProperty = {
443
445
  f: f$4
444
446
  };
445
447
 
446
- var createNonEnumerableProperty = descriptors ? function (object, key, value) {
448
+ var createNonEnumerableProperty = descriptors$1 ? function (object, key, value) {
447
449
  return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
448
450
  } : function (object, key, value) {
449
451
  object[key] = value;
450
452
  return object;
451
453
  };
452
454
 
455
+ var FunctionPrototype$2 = Function.prototype;
456
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
457
+ var getDescriptor = descriptors$1 && Object.getOwnPropertyDescriptor;
458
+
459
+ var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
460
+ // additional protection from minified / mangled / dropped function names
461
+ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
462
+ var CONFIGURABLE = EXISTS && (!descriptors$1 || (descriptors$1 && getDescriptor(FunctionPrototype$2, 'name').configurable));
463
+
464
+ var functionName = {
465
+ EXISTS: EXISTS,
466
+ PROPER: PROPER,
467
+ CONFIGURABLE: CONFIGURABLE
468
+ };
469
+
453
470
  var functionToString$1 = functionUncurryThis(Function.toString);
454
471
 
455
472
  // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
@@ -533,50 +550,56 @@ var internalState = {
533
550
  getterFor: getterFor
534
551
  };
535
552
 
536
- var FunctionPrototype$2 = Function.prototype;
537
- // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
538
- var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
539
-
540
- var EXISTS = hasOwnProperty_1(FunctionPrototype$2, 'name');
541
- // additional protection from minified / mangled / dropped function names
542
- var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
543
- var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$2, 'name').configurable));
553
+ var makeBuiltIn_1 = createCommonjsModule(function (module) {
554
+ var defineProperty = objectDefineProperty.f;
555
+ var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
544
556
 
545
- var functionName = {
546
- EXISTS: EXISTS,
547
- PROPER: PROPER,
548
- CONFIGURABLE: CONFIGURABLE
549
- };
550
557
 
551
- var redefine = createCommonjsModule(function (module) {
552
- var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
553
558
 
554
- var getInternalState = internalState.get;
555
559
  var enforceInternalState = internalState.enforce;
560
+ var getInternalState = internalState.get;
561
+
562
+ var CONFIGURABLE_LENGTH = !fails(function () {
563
+ return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
564
+ });
565
+
556
566
  var TEMPLATE = String(String).split('String');
557
567
 
558
- (module.exports = function (O, key, value, options) {
568
+ var makeBuiltIn = module.exports = function (value, name, options) {
569
+ if (String(name).slice(0, 7) === 'Symbol(') {
570
+ name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
571
+ }
572
+ if (options && options.getter) name = 'get ' + name;
573
+ if (options && options.setter) name = 'set ' + name;
574
+ if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
575
+ defineProperty(value, 'name', { value: name, configurable: true });
576
+ }
577
+ if (CONFIGURABLE_LENGTH && options && hasOwnProperty_1(options, 'arity') && value.length !== options.arity) {
578
+ defineProperty(value, 'length', { value: options.arity });
579
+ }
580
+ var state = enforceInternalState(value);
581
+ if (!hasOwnProperty_1(state, 'source')) {
582
+ state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
583
+ } return value;
584
+ };
585
+
586
+ // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
587
+ // eslint-disable-next-line no-extend-native -- required
588
+ Function.prototype.toString = makeBuiltIn(function toString() {
589
+ return isCallable(this) && getInternalState(this).source || inspectSource(this);
590
+ }, 'toString');
591
+ });
592
+
593
+ var defineBuiltIn = function (O, key, value, options) {
559
594
  var unsafe = options ? !!options.unsafe : false;
560
595
  var simple = options ? !!options.enumerable : false;
561
596
  var noTargetGet = options ? !!options.noTargetGet : false;
562
597
  var name = options && options.name !== undefined ? options.name : key;
563
- var state;
564
- if (isCallable(value)) {
565
- if (String(name).slice(0, 7) === 'Symbol(') {
566
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
567
- }
568
- if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
569
- createNonEnumerableProperty(value, 'name', name);
570
- }
571
- state = enforceInternalState(value);
572
- if (!state.source) {
573
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
574
- }
575
- }
598
+ if (isCallable(value)) makeBuiltIn_1(value, name, options);
576
599
  if (O === global_1) {
577
600
  if (simple) O[key] = value;
578
601
  else setGlobal(key, value);
579
- return;
602
+ return O;
580
603
  } else if (!unsafe) {
581
604
  delete O[key];
582
605
  } else if (!noTargetGet && O[key]) {
@@ -584,11 +607,8 @@ var TEMPLATE = String(String).split('String');
584
607
  }
585
608
  if (simple) O[key] = value;
586
609
  else createNonEnumerableProperty(O, key, value);
587
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
588
- })(Function.prototype, 'toString', function toString() {
589
- return isCallable(this) && getInternalState(this).source || inspectSource(this);
590
- });
591
- });
610
+ return O;
611
+ };
592
612
 
593
613
  var ceil = Math.ceil;
594
614
  var floor = Math.floor;
@@ -728,7 +748,7 @@ var copyConstructorProperties = function (target, source, exceptions) {
728
748
  var replacement = /#|\.prototype\./;
729
749
 
730
750
  var isForced = function (feature, detection) {
731
- var value = data[normalize(feature)];
751
+ var value = data$1[normalize(feature)];
732
752
  return value == POLYFILL ? true
733
753
  : value == NATIVE ? false
734
754
  : isCallable(detection) ? fails(detection)
@@ -739,7 +759,7 @@ var normalize = isForced.normalize = function (string) {
739
759
  return String(string).replace(replacement, '.').toLowerCase();
740
760
  };
741
761
 
742
- var data = isForced.data = {};
762
+ var data$1 = isForced.data = {};
743
763
  var NATIVE = isForced.NATIVE = 'N';
744
764
  var POLYFILL = isForced.POLYFILL = 'P';
745
765
 
@@ -795,32 +815,10 @@ var _export = function (options, source) {
795
815
  if (options.sham || (targetProperty && targetProperty.sham)) {
796
816
  createNonEnumerableProperty(sourceProperty, 'sham', true);
797
817
  }
798
- // extend global
799
- redefine(target, key, sourceProperty, options);
818
+ defineBuiltIn(target, key, sourceProperty, options);
800
819
  }
801
820
  };
802
821
 
803
- var arrayMethodIsStrict = function (METHOD_NAME, argument) {
804
- var method = [][METHOD_NAME];
805
- return !!method && fails(function () {
806
- // eslint-disable-next-line no-useless-call -- required for testing
807
- method.call(null, argument || function () { return 1; }, 1);
808
- });
809
- };
810
-
811
- var un$Join = functionUncurryThis([].join);
812
-
813
- var ES3_STRINGS = indexedObject != Object;
814
- var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
815
-
816
- // `Array.prototype.join` method
817
- // https://tc39.es/ecma262/#sec-array.prototype.join
818
- _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
819
- join: function join(separator) {
820
- return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
821
- }
822
- });
823
-
824
822
  var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
825
823
  var test = {};
826
824
 
@@ -853,17 +851,55 @@ var classof = toStringTagSupport ? classofRaw : function (it) {
853
851
  : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
854
852
  };
855
853
 
856
- // `Object.prototype.toString` method implementation
857
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
858
- var objectToString = toStringTagSupport ? {}.toString : function toString() {
859
- return '[object ' + classof(this) + ']';
854
+ var String$3 = global_1.String;
855
+
856
+ var toString_1 = function (argument) {
857
+ if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
858
+ return String$3(argument);
860
859
  };
861
860
 
862
- // `Object.prototype.toString` method
863
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
864
- if (!toStringTagSupport) {
865
- redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
866
- }
861
+ // `RegExp.prototype.flags` getter implementation
862
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
863
+ var regexpFlags = function () {
864
+ var that = anObject(this);
865
+ var result = '';
866
+ if (that.hasIndices) result += 'd';
867
+ if (that.global) result += 'g';
868
+ if (that.ignoreCase) result += 'i';
869
+ if (that.multiline) result += 'm';
870
+ if (that.dotAll) result += 's';
871
+ if (that.unicode) result += 'u';
872
+ if (that.sticky) result += 'y';
873
+ return result;
874
+ };
875
+
876
+ // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
877
+ var $RegExp$2 = global_1.RegExp;
878
+
879
+ var UNSUPPORTED_Y$1 = fails(function () {
880
+ var re = $RegExp$2('a', 'y');
881
+ re.lastIndex = 2;
882
+ return re.exec('abcd') != null;
883
+ });
884
+
885
+ // UC Browser bug
886
+ // https://github.com/zloirock/core-js/issues/1008
887
+ var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
888
+ return !$RegExp$2('a', 'y').sticky;
889
+ });
890
+
891
+ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
892
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
893
+ var re = $RegExp$2('^r', 'gy');
894
+ re.lastIndex = 2;
895
+ return re.exec('str') != null;
896
+ });
897
+
898
+ var regexpStickyHelpers = {
899
+ BROKEN_CARET: BROKEN_CARET,
900
+ MISSED_STICKY: MISSED_STICKY,
901
+ UNSUPPORTED_Y: UNSUPPORTED_Y$1
902
+ };
867
903
 
868
904
  // `Object.keys` method
869
905
  // https://tc39.es/ecma262/#sec-object.keys
@@ -872,201 +908,42 @@ var objectKeys = Object.keys || function keys(O) {
872
908
  return objectKeysInternal(O, enumBugKeys);
873
909
  };
874
910
 
875
- var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
876
-
877
- // `Object.keys` method
878
- // https://tc39.es/ecma262/#sec-object.keys
879
- _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
880
- keys: function keys(it) {
881
- return objectKeys(toObject(it));
882
- }
883
- });
884
-
885
- // `IsArray` abstract operation
886
- // https://tc39.es/ecma262/#sec-isarray
887
- // eslint-disable-next-line es-x/no-array-isarray -- safe
888
- var isArray$1 = Array.isArray || function isArray(argument) {
889
- return classofRaw(argument) == 'Array';
911
+ // `Object.defineProperties` method
912
+ // https://tc39.es/ecma262/#sec-object.defineproperties
913
+ // eslint-disable-next-line es-x/no-object-defineproperties -- safe
914
+ var f$1 = descriptors$1 && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
915
+ anObject(O);
916
+ var props = toIndexedObject(Properties);
917
+ var keys = objectKeys(Properties);
918
+ var length = keys.length;
919
+ var index = 0;
920
+ var key;
921
+ while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
922
+ return O;
890
923
  };
891
924
 
892
- var createProperty = function (object, key, value) {
893
- var propertyKey = toPropertyKey(key);
894
- if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
895
- else object[propertyKey] = value;
925
+ var objectDefineProperties = {
926
+ f: f$1
896
927
  };
897
928
 
898
- var noop = function () { /* empty */ };
899
- var empty = [];
900
- var construct = getBuiltIn('Reflect', 'construct');
901
- var constructorRegExp = /^\s*(?:class|function)\b/;
902
- var exec = functionUncurryThis(constructorRegExp.exec);
903
- var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
929
+ var html = getBuiltIn('document', 'documentElement');
904
930
 
905
- var isConstructorModern = function isConstructor(argument) {
906
- if (!isCallable(argument)) return false;
907
- try {
908
- construct(noop, empty, argument);
909
- return true;
910
- } catch (error) {
911
- return false;
912
- }
913
- };
931
+ /* global ActiveXObject -- old IE, WSH */
914
932
 
915
- var isConstructorLegacy = function isConstructor(argument) {
916
- if (!isCallable(argument)) return false;
917
- switch (classof(argument)) {
918
- case 'AsyncFunction':
919
- case 'GeneratorFunction':
920
- case 'AsyncGeneratorFunction': return false;
921
- }
922
- try {
923
- // we can't check .prototype since constructors produced by .bind haven't it
924
- // `Function#toString` throws on some built-it function in some legacy engines
925
- // (for example, `DOMQuad` and similar in FF41-)
926
- return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
927
- } catch (error) {
928
- return true;
929
- }
930
- };
931
933
 
932
- isConstructorLegacy.sham = true;
933
934
 
934
- // `IsConstructor` abstract operation
935
- // https://tc39.es/ecma262/#sec-isconstructor
936
- var isConstructor = !construct || fails(function () {
937
- var called;
938
- return isConstructorModern(isConstructorModern.call)
939
- || !isConstructorModern(Object)
940
- || !isConstructorModern(function () { called = true; })
941
- || called;
942
- }) ? isConstructorLegacy : isConstructorModern;
943
935
 
944
- var SPECIES$5 = wellKnownSymbol('species');
945
- var Array$1 = global_1.Array;
946
936
 
947
- // a part of `ArraySpeciesCreate` abstract operation
948
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
949
- var arraySpeciesConstructor = function (originalArray) {
950
- var C;
951
- if (isArray$1(originalArray)) {
952
- C = originalArray.constructor;
953
- // cross-realm fallback
954
- if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
955
- else if (isObject$1(C)) {
956
- C = C[SPECIES$5];
957
- if (C === null) C = undefined;
958
- }
959
- } return C === undefined ? Array$1 : C;
960
- };
961
937
 
962
- // `ArraySpeciesCreate` abstract operation
963
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
964
- var arraySpeciesCreate = function (originalArray, length) {
965
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
966
- };
967
938
 
968
- var SPECIES$4 = wellKnownSymbol('species');
969
939
 
970
- var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
971
- // We can't use this feature detection in V8 since it causes
972
- // deoptimization and serious performance degradation
973
- // https://github.com/zloirock/core-js/issues/677
974
- return engineV8Version >= 51 || !fails(function () {
975
- var array = [];
976
- var constructor = array.constructor = {};
977
- constructor[SPECIES$4] = function () {
978
- return { foo: 1 };
979
- };
980
- return array[METHOD_NAME](Boolean).foo !== 1;
981
- });
982
- };
940
+ var GT = '>';
941
+ var LT = '<';
942
+ var PROTOTYPE = 'prototype';
943
+ var SCRIPT = 'script';
944
+ var IE_PROTO = sharedKey('IE_PROTO');
983
945
 
984
- var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
985
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
986
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
987
- var TypeError$a = global_1.TypeError;
988
-
989
- // We can't use this feature detection in V8 since it causes
990
- // deoptimization and serious performance degradation
991
- // https://github.com/zloirock/core-js/issues/679
992
- var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
993
- var array = [];
994
- array[IS_CONCAT_SPREADABLE] = false;
995
- return array.concat()[0] !== array;
996
- });
997
-
998
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
999
-
1000
- var isConcatSpreadable = function (O) {
1001
- if (!isObject$1(O)) return false;
1002
- var spreadable = O[IS_CONCAT_SPREADABLE];
1003
- return spreadable !== undefined ? !!spreadable : isArray$1(O);
1004
- };
1005
-
1006
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1007
-
1008
- // `Array.prototype.concat` method
1009
- // https://tc39.es/ecma262/#sec-array.prototype.concat
1010
- // with adding support of @@isConcatSpreadable and @@species
1011
- _export({ target: 'Array', proto: true, forced: FORCED }, {
1012
- // eslint-disable-next-line no-unused-vars -- required for `.length`
1013
- concat: function concat(arg) {
1014
- var O = toObject(this);
1015
- var A = arraySpeciesCreate(O, 0);
1016
- var n = 0;
1017
- var i, k, length, len, E;
1018
- for (i = -1, length = arguments.length; i < length; i++) {
1019
- E = i === -1 ? O : arguments[i];
1020
- if (isConcatSpreadable(E)) {
1021
- len = lengthOfArrayLike(E);
1022
- if (n + len > MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1023
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1024
- } else {
1025
- if (n >= MAX_SAFE_INTEGER) throw TypeError$a(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1026
- createProperty(A, n++, E);
1027
- }
1028
- }
1029
- A.length = n;
1030
- return A;
1031
- }
1032
- });
1033
-
1034
- // `Object.defineProperties` method
1035
- // https://tc39.es/ecma262/#sec-object.defineproperties
1036
- // eslint-disable-next-line es-x/no-object-defineproperties -- safe
1037
- var f$1 = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
1038
- anObject(O);
1039
- var props = toIndexedObject(Properties);
1040
- var keys = objectKeys(Properties);
1041
- var length = keys.length;
1042
- var index = 0;
1043
- var key;
1044
- while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
1045
- return O;
1046
- };
1047
-
1048
- var objectDefineProperties = {
1049
- f: f$1
1050
- };
1051
-
1052
- var html = getBuiltIn('document', 'documentElement');
1053
-
1054
- /* global ActiveXObject -- old IE, WSH */
1055
-
1056
-
1057
-
1058
-
1059
-
1060
-
1061
-
1062
-
1063
- var GT = '>';
1064
- var LT = '<';
1065
- var PROTOTYPE = 'prototype';
1066
- var SCRIPT = 'script';
1067
- var IE_PROTO = sharedKey('IE_PROTO');
1068
-
1069
- var EmptyConstructor = function () { /* empty */ };
946
+ var EmptyConstructor = function () { /* empty */ };
1070
947
 
1071
948
  var scriptTag = function (content) {
1072
949
  return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
@@ -1135,86 +1012,6 @@ var objectCreate = Object.create || function create(O, Properties) {
1135
1012
  return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
1136
1013
  };
1137
1014
 
1138
- var UNSCOPABLES = wellKnownSymbol('unscopables');
1139
- var ArrayPrototype$1 = Array.prototype;
1140
-
1141
- // Array.prototype[@@unscopables]
1142
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1143
- if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
1144
- objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
1145
- configurable: true,
1146
- value: objectCreate(null)
1147
- });
1148
- }
1149
-
1150
- // add a key to Array.prototype[@@unscopables]
1151
- var addToUnscopables = function (key) {
1152
- ArrayPrototype$1[UNSCOPABLES][key] = true;
1153
- };
1154
-
1155
- var $includes = arrayIncludes.includes;
1156
-
1157
-
1158
- // `Array.prototype.includes` method
1159
- // https://tc39.es/ecma262/#sec-array.prototype.includes
1160
- _export({ target: 'Array', proto: true }, {
1161
- includes: function includes(el /* , fromIndex = 0 */) {
1162
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1163
- }
1164
- });
1165
-
1166
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1167
- addToUnscopables('includes');
1168
-
1169
- var String$3 = global_1.String;
1170
-
1171
- var toString_1 = function (argument) {
1172
- if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
1173
- return String$3(argument);
1174
- };
1175
-
1176
- // `RegExp.prototype.flags` getter implementation
1177
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
1178
- var regexpFlags = function () {
1179
- var that = anObject(this);
1180
- var result = '';
1181
- if (that.global) result += 'g';
1182
- if (that.ignoreCase) result += 'i';
1183
- if (that.multiline) result += 'm';
1184
- if (that.dotAll) result += 's';
1185
- if (that.unicode) result += 'u';
1186
- if (that.sticky) result += 'y';
1187
- return result;
1188
- };
1189
-
1190
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
1191
- var $RegExp$2 = global_1.RegExp;
1192
-
1193
- var UNSUPPORTED_Y$1 = fails(function () {
1194
- var re = $RegExp$2('a', 'y');
1195
- re.lastIndex = 2;
1196
- return re.exec('abcd') != null;
1197
- });
1198
-
1199
- // UC Browser bug
1200
- // https://github.com/zloirock/core-js/issues/1008
1201
- var MISSED_STICKY = UNSUPPORTED_Y$1 || fails(function () {
1202
- return !$RegExp$2('a', 'y').sticky;
1203
- });
1204
-
1205
- var BROKEN_CARET = UNSUPPORTED_Y$1 || fails(function () {
1206
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
1207
- var re = $RegExp$2('^r', 'gy');
1208
- re.lastIndex = 2;
1209
- return re.exec('str') != null;
1210
- });
1211
-
1212
- var regexpStickyHelpers = {
1213
- BROKEN_CARET: BROKEN_CARET,
1214
- MISSED_STICKY: MISSED_STICKY,
1215
- UNSUPPORTED_Y: UNSUPPORTED_Y$1
1216
- };
1217
-
1218
1015
  // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
1219
1016
  var $RegExp$1 = global_1.RegExp;
1220
1017
 
@@ -1364,7 +1161,7 @@ _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
1364
1161
 
1365
1162
 
1366
1163
 
1367
- var SPECIES$3 = wellKnownSymbol('species');
1164
+ var SPECIES$5 = wellKnownSymbol('species');
1368
1165
  var RegExpPrototype = RegExp.prototype;
1369
1166
 
1370
1167
  var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
@@ -1390,7 +1187,7 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1390
1187
  // RegExp[@@split] doesn't call the regex's exec method, but first creates
1391
1188
  // a new one. We need to return the patched regex when creating the new one.
1392
1189
  re.constructor = {};
1393
- re.constructor[SPECIES$3] = function () { return re; };
1190
+ re.constructor[SPECIES$5] = function () { return re; };
1394
1191
  re.flags = '';
1395
1192
  re[SYMBOL] = /./[SYMBOL];
1396
1193
  }
@@ -1422,8 +1219,8 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
1422
1219
  return { done: false };
1423
1220
  });
1424
1221
 
1425
- redefine(String.prototype, KEY, methods[0]);
1426
- redefine(RegExpPrototype, SYMBOL, methods[1]);
1222
+ defineBuiltIn(String.prototype, KEY, methods[0]);
1223
+ defineBuiltIn(RegExpPrototype, SYMBOL, methods[1]);
1427
1224
  }
1428
1225
 
1429
1226
  if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
@@ -1461,66 +1258,295 @@ var stringMultibyte = {
1461
1258
  charAt: createMethod$1(true)
1462
1259
  };
1463
1260
 
1464
- var charAt = stringMultibyte.charAt;
1261
+ var charAt = stringMultibyte.charAt;
1262
+
1263
+ // `AdvanceStringIndex` abstract operation
1264
+ // https://tc39.es/ecma262/#sec-advancestringindex
1265
+ var advanceStringIndex = function (S, index, unicode) {
1266
+ return index + (unicode ? charAt(S, index).length : 1);
1267
+ };
1268
+
1269
+ var TypeError$a = global_1.TypeError;
1270
+
1271
+ // `RegExpExec` abstract operation
1272
+ // https://tc39.es/ecma262/#sec-regexpexec
1273
+ var regexpExecAbstract = function (R, S) {
1274
+ var exec = R.exec;
1275
+ if (isCallable(exec)) {
1276
+ var result = functionCall(exec, R, S);
1277
+ if (result !== null) anObject(result);
1278
+ return result;
1279
+ }
1280
+ if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
1281
+ throw TypeError$a('RegExp#exec called on incompatible receiver');
1282
+ };
1283
+
1284
+ // @@match logic
1285
+ fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
1286
+ return [
1287
+ // `String.prototype.match` method
1288
+ // https://tc39.es/ecma262/#sec-string.prototype.match
1289
+ function match(regexp) {
1290
+ var O = requireObjectCoercible(this);
1291
+ var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
1292
+ return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
1293
+ },
1294
+ // `RegExp.prototype[@@match]` method
1295
+ // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
1296
+ function (string) {
1297
+ var rx = anObject(this);
1298
+ var S = toString_1(string);
1299
+ var res = maybeCallNative(nativeMatch, rx, S);
1300
+
1301
+ if (res.done) return res.value;
1302
+
1303
+ if (!rx.global) return regexpExecAbstract(rx, S);
1304
+
1305
+ var fullUnicode = rx.unicode;
1306
+ rx.lastIndex = 0;
1307
+ var A = [];
1308
+ var n = 0;
1309
+ var result;
1310
+ while ((result = regexpExecAbstract(rx, S)) !== null) {
1311
+ var matchStr = toString_1(result[0]);
1312
+ A[n] = matchStr;
1313
+ if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1314
+ n++;
1315
+ }
1316
+ return n === 0 ? null : A;
1317
+ }
1318
+ ];
1319
+ });
1320
+
1321
+ var arrayMethodIsStrict = function (METHOD_NAME, argument) {
1322
+ var method = [][METHOD_NAME];
1323
+ return !!method && fails(function () {
1324
+ // eslint-disable-next-line no-useless-call -- required for testing
1325
+ method.call(null, argument || function () { return 1; }, 1);
1326
+ });
1327
+ };
1328
+
1329
+ var un$Join = functionUncurryThis([].join);
1330
+
1331
+ var ES3_STRINGS = indexedObject != Object;
1332
+ var STRICT_METHOD$1 = arrayMethodIsStrict('join', ',');
1333
+
1334
+ // `Array.prototype.join` method
1335
+ // https://tc39.es/ecma262/#sec-array.prototype.join
1336
+ _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$1 }, {
1337
+ join: function join(separator) {
1338
+ return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
1339
+ }
1340
+ });
1341
+
1342
+ // `Object.prototype.toString` method implementation
1343
+ // https://tc39.es/ecma262/#sec-object.prototype.tostring
1344
+ var objectToString = toStringTagSupport ? {}.toString : function toString() {
1345
+ return '[object ' + classof(this) + ']';
1346
+ };
1347
+
1348
+ // `Object.prototype.toString` method
1349
+ // https://tc39.es/ecma262/#sec-object.prototype.tostring
1350
+ if (!toStringTagSupport) {
1351
+ defineBuiltIn(Object.prototype, 'toString', objectToString, { unsafe: true });
1352
+ }
1353
+
1354
+ var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
1355
+
1356
+ // `Object.keys` method
1357
+ // https://tc39.es/ecma262/#sec-object.keys
1358
+ _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
1359
+ keys: function keys(it) {
1360
+ return objectKeys(toObject(it));
1361
+ }
1362
+ });
1363
+
1364
+ // `IsArray` abstract operation
1365
+ // https://tc39.es/ecma262/#sec-isarray
1366
+ // eslint-disable-next-line es-x/no-array-isarray -- safe
1367
+ var isArray$1 = Array.isArray || function isArray(argument) {
1368
+ return classofRaw(argument) == 'Array';
1369
+ };
1370
+
1371
+ var createProperty = function (object, key, value) {
1372
+ var propertyKey = toPropertyKey(key);
1373
+ if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
1374
+ else object[propertyKey] = value;
1375
+ };
1376
+
1377
+ var noop = function () { /* empty */ };
1378
+ var empty = [];
1379
+ var construct = getBuiltIn('Reflect', 'construct');
1380
+ var constructorRegExp = /^\s*(?:class|function)\b/;
1381
+ var exec = functionUncurryThis(constructorRegExp.exec);
1382
+ var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
1383
+
1384
+ var isConstructorModern = function isConstructor(argument) {
1385
+ if (!isCallable(argument)) return false;
1386
+ try {
1387
+ construct(noop, empty, argument);
1388
+ return true;
1389
+ } catch (error) {
1390
+ return false;
1391
+ }
1392
+ };
1393
+
1394
+ var isConstructorLegacy = function isConstructor(argument) {
1395
+ if (!isCallable(argument)) return false;
1396
+ switch (classof(argument)) {
1397
+ case 'AsyncFunction':
1398
+ case 'GeneratorFunction':
1399
+ case 'AsyncGeneratorFunction': return false;
1400
+ }
1401
+ try {
1402
+ // we can't check .prototype since constructors produced by .bind haven't it
1403
+ // `Function#toString` throws on some built-it function in some legacy engines
1404
+ // (for example, `DOMQuad` and similar in FF41-)
1405
+ return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
1406
+ } catch (error) {
1407
+ return true;
1408
+ }
1409
+ };
1410
+
1411
+ isConstructorLegacy.sham = true;
1412
+
1413
+ // `IsConstructor` abstract operation
1414
+ // https://tc39.es/ecma262/#sec-isconstructor
1415
+ var isConstructor = !construct || fails(function () {
1416
+ var called;
1417
+ return isConstructorModern(isConstructorModern.call)
1418
+ || !isConstructorModern(Object)
1419
+ || !isConstructorModern(function () { called = true; })
1420
+ || called;
1421
+ }) ? isConstructorLegacy : isConstructorModern;
1422
+
1423
+ var SPECIES$4 = wellKnownSymbol('species');
1424
+ var Array$1 = global_1.Array;
1425
+
1426
+ // a part of `ArraySpeciesCreate` abstract operation
1427
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
1428
+ var arraySpeciesConstructor = function (originalArray) {
1429
+ var C;
1430
+ if (isArray$1(originalArray)) {
1431
+ C = originalArray.constructor;
1432
+ // cross-realm fallback
1433
+ if (isConstructor(C) && (C === Array$1 || isArray$1(C.prototype))) C = undefined;
1434
+ else if (isObject$1(C)) {
1435
+ C = C[SPECIES$4];
1436
+ if (C === null) C = undefined;
1437
+ }
1438
+ } return C === undefined ? Array$1 : C;
1439
+ };
1440
+
1441
+ // `ArraySpeciesCreate` abstract operation
1442
+ // https://tc39.es/ecma262/#sec-arrayspeciescreate
1443
+ var arraySpeciesCreate = function (originalArray, length) {
1444
+ return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1445
+ };
1446
+
1447
+ var SPECIES$3 = wellKnownSymbol('species');
1465
1448
 
1466
- // `AdvanceStringIndex` abstract operation
1467
- // https://tc39.es/ecma262/#sec-advancestringindex
1468
- var advanceStringIndex = function (S, index, unicode) {
1469
- return index + (unicode ? charAt(S, index).length : 1);
1449
+ var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
1450
+ // We can't use this feature detection in V8 since it causes
1451
+ // deoptimization and serious performance degradation
1452
+ // https://github.com/zloirock/core-js/issues/677
1453
+ return engineV8Version >= 51 || !fails(function () {
1454
+ var array = [];
1455
+ var constructor = array.constructor = {};
1456
+ constructor[SPECIES$3] = function () {
1457
+ return { foo: 1 };
1458
+ };
1459
+ return array[METHOD_NAME](Boolean).foo !== 1;
1460
+ });
1470
1461
  };
1471
1462
 
1463
+ var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
1464
+ var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
1465
+ var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
1472
1466
  var TypeError$9 = global_1.TypeError;
1473
1467
 
1474
- // `RegExpExec` abstract operation
1475
- // https://tc39.es/ecma262/#sec-regexpexec
1476
- var regexpExecAbstract = function (R, S) {
1477
- var exec = R.exec;
1478
- if (isCallable(exec)) {
1479
- var result = functionCall(exec, R, S);
1480
- if (result !== null) anObject(result);
1481
- return result;
1482
- }
1483
- if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
1484
- throw TypeError$9('RegExp#exec called on incompatible receiver');
1485
- };
1468
+ // We can't use this feature detection in V8 since it causes
1469
+ // deoptimization and serious performance degradation
1470
+ // https://github.com/zloirock/core-js/issues/679
1471
+ var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
1472
+ var array = [];
1473
+ array[IS_CONCAT_SPREADABLE] = false;
1474
+ return array.concat()[0] !== array;
1475
+ });
1486
1476
 
1487
- // @@match logic
1488
- fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
1489
- return [
1490
- // `String.prototype.match` method
1491
- // https://tc39.es/ecma262/#sec-string.prototype.match
1492
- function match(regexp) {
1493
- var O = requireObjectCoercible(this);
1494
- var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
1495
- return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
1496
- },
1497
- // `RegExp.prototype[@@match]` method
1498
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
1499
- function (string) {
1500
- var rx = anObject(this);
1501
- var S = toString_1(string);
1502
- var res = maybeCallNative(nativeMatch, rx, S);
1477
+ var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
1503
1478
 
1504
- if (res.done) return res.value;
1479
+ var isConcatSpreadable = function (O) {
1480
+ if (!isObject$1(O)) return false;
1481
+ var spreadable = O[IS_CONCAT_SPREADABLE];
1482
+ return spreadable !== undefined ? !!spreadable : isArray$1(O);
1483
+ };
1505
1484
 
1506
- if (!rx.global) return regexpExecAbstract(rx, S);
1485
+ var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
1507
1486
 
1508
- var fullUnicode = rx.unicode;
1509
- rx.lastIndex = 0;
1510
- var A = [];
1511
- var n = 0;
1512
- var result;
1513
- while ((result = regexpExecAbstract(rx, S)) !== null) {
1514
- var matchStr = toString_1(result[0]);
1515
- A[n] = matchStr;
1516
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
1517
- n++;
1487
+ // `Array.prototype.concat` method
1488
+ // https://tc39.es/ecma262/#sec-array.prototype.concat
1489
+ // with adding support of @@isConcatSpreadable and @@species
1490
+ _export({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {
1491
+ // eslint-disable-next-line no-unused-vars -- required for `.length`
1492
+ concat: function concat(arg) {
1493
+ var O = toObject(this);
1494
+ var A = arraySpeciesCreate(O, 0);
1495
+ var n = 0;
1496
+ var i, k, length, len, E;
1497
+ for (i = -1, length = arguments.length; i < length; i++) {
1498
+ E = i === -1 ? O : arguments[i];
1499
+ if (isConcatSpreadable(E)) {
1500
+ len = lengthOfArrayLike(E);
1501
+ if (n + len > MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1502
+ for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
1503
+ } else {
1504
+ if (n >= MAX_SAFE_INTEGER) throw TypeError$9(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
1505
+ createProperty(A, n++, E);
1518
1506
  }
1519
- return n === 0 ? null : A;
1520
1507
  }
1521
- ];
1508
+ A.length = n;
1509
+ return A;
1510
+ }
1511
+ });
1512
+
1513
+ var UNSCOPABLES = wellKnownSymbol('unscopables');
1514
+ var ArrayPrototype$1 = Array.prototype;
1515
+
1516
+ // Array.prototype[@@unscopables]
1517
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1518
+ if (ArrayPrototype$1[UNSCOPABLES] == undefined) {
1519
+ objectDefineProperty.f(ArrayPrototype$1, UNSCOPABLES, {
1520
+ configurable: true,
1521
+ value: objectCreate(null)
1522
+ });
1523
+ }
1524
+
1525
+ // add a key to Array.prototype[@@unscopables]
1526
+ var addToUnscopables = function (key) {
1527
+ ArrayPrototype$1[UNSCOPABLES][key] = true;
1528
+ };
1529
+
1530
+ var $includes = arrayIncludes.includes;
1531
+
1532
+
1533
+
1534
+ // FF99+ bug
1535
+ var BROKEN_ON_SPARSE = fails(function () {
1536
+ return !Array(1).includes();
1537
+ });
1538
+
1539
+ // `Array.prototype.includes` method
1540
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
1541
+ _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
1542
+ includes: function includes(el /* , fromIndex = 0 */) {
1543
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
1544
+ }
1522
1545
  });
1523
1546
 
1547
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
1548
+ addToUnscopables('includes');
1549
+
1524
1550
  var MATCH$1 = wellKnownSymbol('match');
1525
1551
 
1526
1552
  // `IsRegExp` abstract operation
@@ -1624,11 +1650,6 @@ _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_I
1624
1650
 
1625
1651
  var engineIsNode = classofRaw(global_1.process) == 'process';
1626
1652
 
1627
- var redefineAll = function (target, src, options) {
1628
- for (var key in src) redefine(target, key, src[key], options);
1629
- return target;
1630
- };
1631
-
1632
1653
  var String$2 = global_1.String;
1633
1654
  var TypeError$7 = global_1.TypeError;
1634
1655
 
@@ -1684,7 +1705,7 @@ var setSpecies = function (CONSTRUCTOR_NAME) {
1684
1705
  var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
1685
1706
  var defineProperty = objectDefineProperty.f;
1686
1707
 
1687
- if (descriptors && Constructor && !Constructor[SPECIES$2]) {
1708
+ if (descriptors$1 && Constructor && !Constructor[SPECIES$2]) {
1688
1709
  defineProperty(Constructor, SPECIES$2, {
1689
1710
  configurable: true,
1690
1711
  get: function () { return this; }
@@ -2249,23 +2270,20 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2249
2270
  });
2250
2271
  };
2251
2272
 
2252
- Internal.prototype = redefineAll(PromisePrototype, {
2253
- // `Promise.prototype.then` method
2254
- // https://tc39.es/ecma262/#sec-promise.prototype.then
2255
- // eslint-disable-next-line unicorn/no-thenable -- safe
2256
- then: function then(onFulfilled, onRejected) {
2257
- var state = getInternalPromiseState(this);
2258
- var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
2259
- state.parent = true;
2260
- reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
2261
- reaction.fail = isCallable(onRejected) && onRejected;
2262
- reaction.domain = engineIsNode ? process$1.domain : undefined;
2263
- if (state.state == PENDING) state.reactions.add(reaction);
2264
- else microtask(function () {
2265
- callReaction(reaction, state);
2266
- });
2267
- return reaction.promise;
2268
- }
2273
+ // `Promise.prototype.then` method
2274
+ // https://tc39.es/ecma262/#sec-promise.prototype.then
2275
+ Internal.prototype = defineBuiltIn(PromisePrototype, 'then', function then(onFulfilled, onRejected) {
2276
+ var state = getInternalPromiseState(this);
2277
+ var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
2278
+ state.parent = true;
2279
+ reaction.ok = isCallable(onFulfilled) ? onFulfilled : true;
2280
+ reaction.fail = isCallable(onRejected) && onRejected;
2281
+ reaction.domain = engineIsNode ? process$1.domain : undefined;
2282
+ if (state.state == PENDING) state.reactions.add(reaction);
2283
+ else microtask(function () {
2284
+ callReaction(reaction, state);
2285
+ });
2286
+ return reaction.promise;
2269
2287
  });
2270
2288
 
2271
2289
  OwnPromiseCapability = function () {
@@ -2287,7 +2305,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
2287
2305
 
2288
2306
  if (!NATIVE_PROMISE_SUBCLASSING) {
2289
2307
  // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
2290
- redefine(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2308
+ defineBuiltIn(NativePromisePrototype$1, 'then', function then(onFulfilled, onRejected) {
2291
2309
  var that = this;
2292
2310
  return new PromiseConstructor(function (resolve, reject) {
2293
2311
  functionCall(nativeThen, that, resolve, reject);
@@ -2510,7 +2528,7 @@ _export({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2,
2510
2528
  if (isCallable(promiseNativeConstructor)) {
2511
2529
  var method = getBuiltIn('Promise').prototype['catch'];
2512
2530
  if (NativePromisePrototype['catch'] !== method) {
2513
- redefine(NativePromisePrototype, 'catch', method, { unsafe: true });
2531
+ defineBuiltIn(NativePromisePrototype, 'catch', method, { unsafe: true });
2514
2532
  }
2515
2533
  }
2516
2534
 
@@ -2576,7 +2594,7 @@ var concat = functionUncurryThis([].concat);
2576
2594
  // https://tc39.es/ecma262/#sec-object.assign
2577
2595
  var objectAssign = !$assign || fails(function () {
2578
2596
  // should have correct order of operations (Edge bug)
2579
- if (descriptors && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
2597
+ if (descriptors$1 && $assign({ b: 1 }, $assign(defineProperty$1({}, 'a', {
2580
2598
  enumerable: true,
2581
2599
  get: function () {
2582
2600
  defineProperty$1(this, 'b', {
@@ -2608,7 +2626,7 @@ var objectAssign = !$assign || fails(function () {
2608
2626
  var key;
2609
2627
  while (length > j) {
2610
2628
  key = keys[j++];
2611
- if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
2629
+ if (!descriptors$1 || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
2612
2630
  }
2613
2631
  } return T;
2614
2632
  } : $assign;
@@ -2616,7 +2634,7 @@ var objectAssign = !$assign || fails(function () {
2616
2634
  // `Object.assign` method
2617
2635
  // https://tc39.es/ecma262/#sec-object.assign
2618
2636
  // eslint-disable-next-line es-x/no-object-assign -- required for testing
2619
- _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
2637
+ _export({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== objectAssign }, {
2620
2638
  assign: objectAssign
2621
2639
  });
2622
2640
 
@@ -2632,7 +2650,7 @@ var NAME = 'name';
2632
2650
 
2633
2651
  // Function instances `.name` property
2634
2652
  // https://tc39.es/ecma262/#sec-function-instances-name
2635
- if (descriptors && !FUNCTION_NAME_EXISTS) {
2653
+ if (descriptors$1 && !FUNCTION_NAME_EXISTS) {
2636
2654
  defineProperty(FunctionPrototype, NAME, {
2637
2655
  configurable: true,
2638
2656
  get: function () {
@@ -2795,12 +2813,42 @@ var bind = function bind(fn, thisArg) {
2795
2813
  };
2796
2814
  };
2797
2815
 
2798
- /*global toString:true*/
2799
-
2800
2816
  // utils is a library of generic helper functions non-specific to axios
2801
2817
 
2802
2818
  var toString = Object.prototype.toString;
2803
2819
 
2820
+ // eslint-disable-next-line func-names
2821
+ var kindOf = (function(cache) {
2822
+ // eslint-disable-next-line func-names
2823
+ return function(thing) {
2824
+ var str = toString.call(thing);
2825
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
2826
+ };
2827
+ })(Object.create(null));
2828
+
2829
+ function kindOfTest(type) {
2830
+ type = type.toLowerCase();
2831
+ return function isKindOf(thing) {
2832
+ return kindOf(thing) === type;
2833
+ };
2834
+ }
2835
+
2836
+ /**
2837
+ * Array with axios supported protocols.
2838
+ */
2839
+ var supportedProtocols = [ 'http:', 'https:', 'file:' ];
2840
+
2841
+ /**
2842
+ * Returns URL protocol passed as param if is not undefined or null,
2843
+ * otherwise just returns 'http:'
2844
+ *
2845
+ * @param {String} protocol The String value of URL protocol
2846
+ * @returns {String} Protocol if the value is not undefined or null
2847
+ */
2848
+ function getProtocol(protocol) {
2849
+ return protocol || 'http:';
2850
+ }
2851
+
2804
2852
  /**
2805
2853
  * Determine if a value is an Array
2806
2854
  *
@@ -2808,7 +2856,7 @@ var toString = Object.prototype.toString;
2808
2856
  * @returns {boolean} True if value is an Array, otherwise false
2809
2857
  */
2810
2858
  function isArray(val) {
2811
- return toString.call(val) === '[object Array]';
2859
+ return Array.isArray(val);
2812
2860
  }
2813
2861
 
2814
2862
  /**
@@ -2835,22 +2883,12 @@ function isBuffer(val) {
2835
2883
  /**
2836
2884
  * Determine if a value is an ArrayBuffer
2837
2885
  *
2886
+ * @function
2838
2887
  * @param {Object} val The value to test
2839
2888
  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
2840
2889
  */
2841
- function isArrayBuffer(val) {
2842
- return toString.call(val) === '[object ArrayBuffer]';
2843
- }
2890
+ var isArrayBuffer = kindOfTest('ArrayBuffer');
2844
2891
 
2845
- /**
2846
- * Determine if a value is a FormData
2847
- *
2848
- * @param {Object} val The value to test
2849
- * @returns {boolean} True if value is an FormData, otherwise false
2850
- */
2851
- function isFormData(val) {
2852
- return (typeof FormData !== 'undefined') && (val instanceof FormData);
2853
- }
2854
2892
 
2855
2893
  /**
2856
2894
  * Determine if a value is a view on an ArrayBuffer
@@ -2863,7 +2901,7 @@ function isArrayBufferView(val) {
2863
2901
  if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
2864
2902
  result = ArrayBuffer.isView(val);
2865
2903
  } else {
2866
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
2904
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
2867
2905
  }
2868
2906
  return result;
2869
2907
  }
@@ -2905,7 +2943,7 @@ function isObject(val) {
2905
2943
  * @return {boolean} True if value is a plain Object, otherwise false
2906
2944
  */
2907
2945
  function isPlainObject(val) {
2908
- if (toString.call(val) !== '[object Object]') {
2946
+ if (kindOf(val) !== 'object') {
2909
2947
  return false;
2910
2948
  }
2911
2949
 
@@ -2916,32 +2954,38 @@ function isPlainObject(val) {
2916
2954
  /**
2917
2955
  * Determine if a value is a Date
2918
2956
  *
2957
+ * @function
2919
2958
  * @param {Object} val The value to test
2920
2959
  * @returns {boolean} True if value is a Date, otherwise false
2921
2960
  */
2922
- function isDate(val) {
2923
- return toString.call(val) === '[object Date]';
2924
- }
2961
+ var isDate = kindOfTest('Date');
2925
2962
 
2926
2963
  /**
2927
2964
  * Determine if a value is a File
2928
2965
  *
2966
+ * @function
2929
2967
  * @param {Object} val The value to test
2930
2968
  * @returns {boolean} True if value is a File, otherwise false
2931
2969
  */
2932
- function isFile(val) {
2933
- return toString.call(val) === '[object File]';
2934
- }
2970
+ var isFile = kindOfTest('File');
2935
2971
 
2936
2972
  /**
2937
2973
  * Determine if a value is a Blob
2938
2974
  *
2975
+ * @function
2939
2976
  * @param {Object} val The value to test
2940
2977
  * @returns {boolean} True if value is a Blob, otherwise false
2941
2978
  */
2942
- function isBlob(val) {
2943
- return toString.call(val) === '[object Blob]';
2944
- }
2979
+ var isBlob = kindOfTest('Blob');
2980
+
2981
+ /**
2982
+ * Determine if a value is a FileList
2983
+ *
2984
+ * @function
2985
+ * @param {Object} val The value to test
2986
+ * @returns {boolean} True if value is a File, otherwise false
2987
+ */
2988
+ var isFileList = kindOfTest('FileList');
2945
2989
 
2946
2990
  /**
2947
2991
  * Determine if a value is a Function
@@ -2964,14 +3008,27 @@ function isStream(val) {
2964
3008
  }
2965
3009
 
2966
3010
  /**
2967
- * Determine if a value is a URLSearchParams object
3011
+ * Determine if a value is a FormData
2968
3012
  *
3013
+ * @param {Object} thing The value to test
3014
+ * @returns {boolean} True if value is an FormData, otherwise false
3015
+ */
3016
+ function isFormData(thing) {
3017
+ var pattern = '[object FormData]';
3018
+ return thing && (
3019
+ (typeof FormData === 'function' && thing instanceof FormData) ||
3020
+ toString.call(thing) === pattern ||
3021
+ (isFunction(thing.toString) && thing.toString() === pattern)
3022
+ );
3023
+ }
3024
+
3025
+ /**
3026
+ * Determine if a value is a URLSearchParams object
3027
+ * @function
2969
3028
  * @param {Object} val The value to test
2970
3029
  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
2971
3030
  */
2972
- function isURLSearchParams(val) {
2973
- return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
2974
- }
3031
+ var isURLSearchParams = kindOfTest('URLSearchParams');
2975
3032
 
2976
3033
  /**
2977
3034
  * Trim excess whitespace off the beginning and end of a string
@@ -2980,7 +3037,7 @@ function isURLSearchParams(val) {
2980
3037
  * @returns {String} The String freed of excess whitespace
2981
3038
  */
2982
3039
  function trim(str) {
2983
- return str.replace(/^\s*/, '').replace(/\s*$/, '');
3040
+ return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, '');
2984
3041
  }
2985
3042
 
2986
3043
  /**
@@ -3118,7 +3175,97 @@ function stripBOM(content) {
3118
3175
  return content;
3119
3176
  }
3120
3177
 
3178
+ /**
3179
+ * Inherit the prototype methods from one constructor into another
3180
+ * @param {function} constructor
3181
+ * @param {function} superConstructor
3182
+ * @param {object} [props]
3183
+ * @param {object} [descriptors]
3184
+ */
3185
+
3186
+ function inherits(constructor, superConstructor, props, descriptors) {
3187
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
3188
+ constructor.prototype.constructor = constructor;
3189
+ props && Object.assign(constructor.prototype, props);
3190
+ }
3191
+
3192
+ /**
3193
+ * Resolve object with deep prototype chain to a flat object
3194
+ * @param {Object} sourceObj source object
3195
+ * @param {Object} [destObj]
3196
+ * @param {Function} [filter]
3197
+ * @returns {Object}
3198
+ */
3199
+
3200
+ function toFlatObject(sourceObj, destObj, filter) {
3201
+ var props;
3202
+ var i;
3203
+ var prop;
3204
+ var merged = {};
3205
+
3206
+ destObj = destObj || {};
3207
+
3208
+ do {
3209
+ props = Object.getOwnPropertyNames(sourceObj);
3210
+ i = props.length;
3211
+ while (i-- > 0) {
3212
+ prop = props[i];
3213
+ if (!merged[prop]) {
3214
+ destObj[prop] = sourceObj[prop];
3215
+ merged[prop] = true;
3216
+ }
3217
+ }
3218
+ sourceObj = Object.getPrototypeOf(sourceObj);
3219
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
3220
+
3221
+ return destObj;
3222
+ }
3223
+
3224
+ /*
3225
+ * determines whether a string ends with the characters of a specified string
3226
+ * @param {String} str
3227
+ * @param {String} searchString
3228
+ * @param {Number} [position= 0]
3229
+ * @returns {boolean}
3230
+ */
3231
+ function endsWith(str, searchString, position) {
3232
+ str = String(str);
3233
+ if (position === undefined || position > str.length) {
3234
+ position = str.length;
3235
+ }
3236
+ position -= searchString.length;
3237
+ var lastIndex = str.indexOf(searchString, position);
3238
+ return lastIndex !== -1 && lastIndex === position;
3239
+ }
3240
+
3241
+
3242
+ /**
3243
+ * Returns new array from array like object
3244
+ * @param {*} [thing]
3245
+ * @returns {Array}
3246
+ */
3247
+ function toArray(thing) {
3248
+ if (!thing) return null;
3249
+ var i = thing.length;
3250
+ if (isUndefined(i)) return null;
3251
+ var arr = new Array(i);
3252
+ while (i-- > 0) {
3253
+ arr[i] = thing[i];
3254
+ }
3255
+ return arr;
3256
+ }
3257
+
3258
+ // eslint-disable-next-line func-names
3259
+ var isTypedArray = (function(TypedArray) {
3260
+ // eslint-disable-next-line func-names
3261
+ return function(thing) {
3262
+ return TypedArray && thing instanceof TypedArray;
3263
+ };
3264
+ })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array));
3265
+
3121
3266
  var utils = {
3267
+ supportedProtocols: supportedProtocols,
3268
+ getProtocol: getProtocol,
3122
3269
  isArray: isArray,
3123
3270
  isArrayBuffer: isArrayBuffer,
3124
3271
  isBuffer: isBuffer,
@@ -3140,7 +3287,15 @@ var utils = {
3140
3287
  merge: merge,
3141
3288
  extend: extend,
3142
3289
  trim: trim,
3143
- stripBOM: stripBOM
3290
+ stripBOM: stripBOM,
3291
+ inherits: inherits,
3292
+ toFlatObject: toFlatObject,
3293
+ kindOf: kindOf,
3294
+ kindOfTest: kindOfTest,
3295
+ endsWith: endsWith,
3296
+ toArray: toArray,
3297
+ isTypedArray: isTypedArray,
3298
+ isFileList: isFileList
3144
3299
  };
3145
3300
 
3146
3301
  function encode(val) {
@@ -3222,10 +3377,12 @@ function InterceptorManager() {
3222
3377
  *
3223
3378
  * @return {Number} An ID used to remove interceptor later
3224
3379
  */
3225
- InterceptorManager.prototype.use = function use(fulfilled, rejected) {
3380
+ InterceptorManager.prototype.use = function use(fulfilled, rejected, options) {
3226
3381
  this.handlers.push({
3227
3382
  fulfilled: fulfilled,
3228
- rejected: rejected
3383
+ rejected: rejected,
3384
+ synchronous: options ? options.synchronous : false,
3385
+ runWhen: options ? options.runWhen : null
3229
3386
  });
3230
3387
  return this.handlers.length - 1;
3231
3388
  };
@@ -3259,27 +3416,6 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
3259
3416
 
3260
3417
  var InterceptorManager_1 = InterceptorManager;
3261
3418
 
3262
- /**
3263
- * Transform the data for a request or a response
3264
- *
3265
- * @param {Object|String} data The data to be transformed
3266
- * @param {Array} headers The headers for the request or response
3267
- * @param {Array|Function} fns A single function or Array of functions
3268
- * @returns {*} The resulting transformed data
3269
- */
3270
- var transformData = function transformData(data, headers, fns) {
3271
- /*eslint no-param-reassign:0*/
3272
- utils.forEach(fns, function transform(fn) {
3273
- data = fn(data, headers);
3274
- });
3275
-
3276
- return data;
3277
- };
3278
-
3279
- var isCancel = function isCancel(value) {
3280
- return !!(value && value.__CANCEL__);
3281
- };
3282
-
3283
3419
  var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) {
3284
3420
  utils.forEach(headers, function processHeader(value, name) {
3285
3421
  if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
@@ -3290,26 +3426,27 @@ var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName)
3290
3426
  };
3291
3427
 
3292
3428
  /**
3293
- * Update an Error with the specified config, error code, and response.
3429
+ * Create an Error with the specified message, config, error code, request and response.
3294
3430
  *
3295
- * @param {Error} error The error to update.
3296
- * @param {Object} config The config.
3431
+ * @param {string} message The error message.
3297
3432
  * @param {string} [code] The error code (for example, 'ECONNABORTED').
3433
+ * @param {Object} [config] The config.
3298
3434
  * @param {Object} [request] The request.
3299
3435
  * @param {Object} [response] The response.
3300
- * @returns {Error} The error.
3436
+ * @returns {Error} The created error.
3301
3437
  */
3302
- var enhanceError = function enhanceError(error, config, code, request, response) {
3303
- error.config = config;
3304
- if (code) {
3305
- error.code = code;
3306
- }
3307
-
3308
- error.request = request;
3309
- error.response = response;
3310
- error.isAxiosError = true;
3438
+ function AxiosError(message, code, config, request, response) {
3439
+ Error.call(this);
3440
+ this.message = message;
3441
+ this.name = 'AxiosError';
3442
+ code && (this.code = code);
3443
+ config && (this.config = config);
3444
+ request && (this.request = request);
3445
+ response && (this.response = response);
3446
+ }
3311
3447
 
3312
- error.toJSON = function toJSON() {
3448
+ utils.inherits(AxiosError, Error, {
3449
+ toJSON: function toJSON() {
3313
3450
  return {
3314
3451
  // Standard
3315
3452
  message: this.message,
@@ -3324,26 +3461,130 @@ var enhanceError = function enhanceError(error, config, code, request, response)
3324
3461
  stack: this.stack,
3325
3462
  // Axios
3326
3463
  config: this.config,
3327
- code: this.code
3464
+ code: this.code,
3465
+ status: this.response && this.response.status ? this.response.status : null
3328
3466
  };
3329
- };
3330
- return error;
3467
+ }
3468
+ });
3469
+
3470
+ var prototype = AxiosError.prototype;
3471
+ var descriptors = {};
3472
+
3473
+ [
3474
+ 'ERR_BAD_OPTION_VALUE',
3475
+ 'ERR_BAD_OPTION',
3476
+ 'ECONNABORTED',
3477
+ 'ETIMEDOUT',
3478
+ 'ERR_NETWORK',
3479
+ 'ERR_FR_TOO_MANY_REDIRECTS',
3480
+ 'ERR_DEPRECATED',
3481
+ 'ERR_BAD_RESPONSE',
3482
+ 'ERR_BAD_REQUEST',
3483
+ 'ERR_CANCELED'
3484
+ // eslint-disable-next-line func-names
3485
+ ].forEach(function(code) {
3486
+ descriptors[code] = {value: code};
3487
+ });
3488
+
3489
+ Object.defineProperties(AxiosError, descriptors);
3490
+ Object.defineProperty(prototype, 'isAxiosError', {value: true});
3491
+
3492
+ // eslint-disable-next-line func-names
3493
+ AxiosError.from = function(error, code, config, request, response, customProps) {
3494
+ var axiosError = Object.create(prototype);
3495
+
3496
+ utils.toFlatObject(error, axiosError, function filter(obj) {
3497
+ return obj !== Error.prototype;
3498
+ });
3499
+
3500
+ AxiosError.call(axiosError, error.message, code, config, request, response);
3501
+
3502
+ axiosError.name = error.name;
3503
+
3504
+ customProps && Object.assign(axiosError, customProps);
3505
+
3506
+ return axiosError;
3331
3507
  };
3332
3508
 
3333
- /**
3334
- * Create an Error with the specified message, config, error code, request and response.
3335
- *
3336
- * @param {string} message The error message.
3337
- * @param {Object} config The config.
3338
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
3339
- * @param {Object} [request] The request.
3340
- * @param {Object} [response] The response.
3341
- * @returns {Error} The created error.
3342
- */
3343
- var createError = function createError(message, config, code, request, response) {
3344
- var error = new Error(message);
3345
- return enhanceError(error, config, code, request, response);
3509
+ var AxiosError_1 = AxiosError;
3510
+
3511
+ var transitional = {
3512
+ silentJSONParsing: true,
3513
+ forcedJSONParsing: true,
3514
+ clarifyTimeoutError: false
3346
3515
  };
3516
+ transitional.silentJSONParsing;
3517
+ transitional.forcedJSONParsing;
3518
+ transitional.clarifyTimeoutError;
3519
+
3520
+ /**
3521
+ * Convert a data object to FormData
3522
+ * @param {Object} obj
3523
+ * @param {?Object} [formData]
3524
+ * @returns {Object}
3525
+ **/
3526
+
3527
+ function toFormData(obj, formData) {
3528
+ // eslint-disable-next-line no-param-reassign
3529
+ formData = formData || new FormData();
3530
+
3531
+ var stack = [];
3532
+
3533
+ function convertValue(value) {
3534
+ if (value === null) return '';
3535
+
3536
+ if (utils.isDate(value)) {
3537
+ return value.toISOString();
3538
+ }
3539
+
3540
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
3541
+ return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
3542
+ }
3543
+
3544
+ return value;
3545
+ }
3546
+
3547
+ function build(data, parentKey) {
3548
+ if (utils.isPlainObject(data) || utils.isArray(data)) {
3549
+ if (stack.indexOf(data) !== -1) {
3550
+ throw Error('Circular reference detected in ' + parentKey);
3551
+ }
3552
+
3553
+ stack.push(data);
3554
+
3555
+ utils.forEach(data, function each(value, key) {
3556
+ if (utils.isUndefined(value)) return;
3557
+ var fullKey = parentKey ? parentKey + '.' + key : key;
3558
+ var arr;
3559
+
3560
+ if (value && !parentKey && typeof value === 'object') {
3561
+ if (utils.endsWith(key, '{}')) {
3562
+ // eslint-disable-next-line no-param-reassign
3563
+ value = JSON.stringify(value);
3564
+ } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) {
3565
+ // eslint-disable-next-line func-names
3566
+ arr.forEach(function(el) {
3567
+ !utils.isUndefined(el) && formData.append(fullKey, convertValue(el));
3568
+ });
3569
+ return;
3570
+ }
3571
+ }
3572
+
3573
+ build(value, fullKey);
3574
+ });
3575
+
3576
+ stack.pop();
3577
+ } else {
3578
+ formData.append(parentKey, convertValue(data));
3579
+ }
3580
+ }
3581
+
3582
+ build(obj);
3583
+
3584
+ return formData;
3585
+ }
3586
+
3587
+ var toFormData_1 = toFormData;
3347
3588
 
3348
3589
  /**
3349
3590
  * Resolve or reject a Promise based on response status.
@@ -3357,10 +3598,10 @@ var settle = function settle(resolve, reject, response) {
3357
3598
  if (!response.status || !validateStatus || validateStatus(response.status)) {
3358
3599
  resolve(response);
3359
3600
  } else {
3360
- reject(createError(
3601
+ reject(new AxiosError_1(
3361
3602
  'Request failed with status code ' + response.status,
3603
+ [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
3362
3604
  response.config,
3363
- null,
3364
3605
  response.request,
3365
3606
  response
3366
3607
  ));
@@ -3427,7 +3668,7 @@ var isAbsoluteURL = function isAbsoluteURL(url) {
3427
3668
  // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
3428
3669
  // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
3429
3670
  // by any combination of letters, digits, plus, period, or hyphen.
3430
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
3671
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
3431
3672
  };
3432
3673
 
3433
3674
  /**
@@ -3574,13 +3815,38 @@ var isURLSameOrigin = (
3574
3815
  })()
3575
3816
  );
3576
3817
 
3818
+ /**
3819
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
3820
+ *
3821
+ * @class
3822
+ * @param {string=} message The message.
3823
+ */
3824
+ function CanceledError(message) {
3825
+ // eslint-disable-next-line no-eq-null,eqeqeq
3826
+ AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED);
3827
+ this.name = 'CanceledError';
3828
+ }
3829
+
3830
+ utils.inherits(CanceledError, AxiosError_1, {
3831
+ __CANCEL__: true
3832
+ });
3833
+
3834
+ var CanceledError_1 = CanceledError;
3835
+
3577
3836
  var xhr = function xhrAdapter(config) {
3578
3837
  return new Promise(function dispatchXhrRequest(resolve, reject) {
3579
3838
  var requestData = config.data;
3580
3839
  var requestHeaders = config.headers;
3840
+ var responseType = config.responseType;
3841
+ var onCanceled;
3842
+ function done() {
3843
+ if (config.cancelToken) {
3844
+ config.cancelToken.unsubscribe(onCanceled);
3845
+ }
3581
3846
 
3582
- if (utils.isFormData(requestData)) {
3583
- delete requestHeaders['Content-Type']; // Let the browser set it
3847
+ if (config.signal) {
3848
+ config.signal.removeEventListener('abort', onCanceled);
3849
+ }
3584
3850
  }
3585
3851
 
3586
3852
  var request = new XMLHttpRequest();
@@ -3593,28 +3859,22 @@ var xhr = function xhrAdapter(config) {
3593
3859
  }
3594
3860
 
3595
3861
  var fullPath = buildFullPath(config.baseURL, config.url);
3862
+ var parsed = url.parse(fullPath);
3863
+ var protocol = utils.getProtocol(parsed.protocol);
3864
+
3596
3865
  request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
3597
3866
 
3598
3867
  // Set the request timeout in MS
3599
3868
  request.timeout = config.timeout;
3600
3869
 
3601
- // Listen for ready state
3602
- request.onreadystatechange = function handleLoad() {
3603
- if (!request || request.readyState !== 4) {
3604
- return;
3605
- }
3606
-
3607
- // The request errored out and we didn't get a response, this will be
3608
- // handled by onerror instead
3609
- // With one exception: request that using file: protocol, most browsers
3610
- // will return status as 0 even though it's a successful request
3611
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3870
+ function onloadend() {
3871
+ if (!request) {
3612
3872
  return;
3613
3873
  }
3614
-
3615
3874
  // Prepare the response
3616
3875
  var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
3617
- var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
3876
+ var responseData = !responseType || responseType === 'text' || responseType === 'json' ?
3877
+ request.responseText : request.response;
3618
3878
  var response = {
3619
3879
  data: responseData,
3620
3880
  status: request.status,
@@ -3624,11 +3884,40 @@ var xhr = function xhrAdapter(config) {
3624
3884
  request: request
3625
3885
  };
3626
3886
 
3627
- settle(resolve, reject, response);
3887
+ settle(function _resolve(value) {
3888
+ resolve(value);
3889
+ done();
3890
+ }, function _reject(err) {
3891
+ reject(err);
3892
+ done();
3893
+ }, response);
3628
3894
 
3629
3895
  // Clean up request
3630
3896
  request = null;
3631
- };
3897
+ }
3898
+
3899
+ if ('onloadend' in request) {
3900
+ // Use onloadend if available
3901
+ request.onloadend = onloadend;
3902
+ } else {
3903
+ // Listen for ready state to emulate onloadend
3904
+ request.onreadystatechange = function handleLoad() {
3905
+ if (!request || request.readyState !== 4) {
3906
+ return;
3907
+ }
3908
+
3909
+ // The request errored out and we didn't get a response, this will be
3910
+ // handled by onerror instead
3911
+ // With one exception: request that using file: protocol, most browsers
3912
+ // will return status as 0 even though it's a successful request
3913
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3914
+ return;
3915
+ }
3916
+ // readystate handler is calling before onerror or ontimeout handlers,
3917
+ // so we should call onloadend on the next 'tick'
3918
+ setTimeout(onloadend);
3919
+ };
3920
+ }
3632
3921
 
3633
3922
  // Handle browser request cancellation (as opposed to a manual cancellation)
3634
3923
  request.onabort = function handleAbort() {
@@ -3636,7 +3925,7 @@ var xhr = function xhrAdapter(config) {
3636
3925
  return;
3637
3926
  }
3638
3927
 
3639
- reject(createError('Request aborted', config, 'ECONNABORTED', request));
3928
+ reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request));
3640
3929
 
3641
3930
  // Clean up request
3642
3931
  request = null;
@@ -3646,7 +3935,7 @@ var xhr = function xhrAdapter(config) {
3646
3935
  request.onerror = function handleError() {
3647
3936
  // Real errors are hidden from us by the browser
3648
3937
  // onerror should only fire if it's a network error
3649
- reject(createError('Network Error', config, null, request));
3938
+ reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request));
3650
3939
 
3651
3940
  // Clean up request
3652
3941
  request = null;
@@ -3654,11 +3943,15 @@ var xhr = function xhrAdapter(config) {
3654
3943
 
3655
3944
  // Handle timeout
3656
3945
  request.ontimeout = function handleTimeout() {
3657
- var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
3946
+ var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3947
+ var transitional$1 = config.transitional || transitional;
3658
3948
  if (config.timeoutErrorMessage) {
3659
3949
  timeoutErrorMessage = config.timeoutErrorMessage;
3660
3950
  }
3661
- reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
3951
+ reject(new AxiosError_1(
3952
+ timeoutErrorMessage,
3953
+ transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED,
3954
+ config,
3662
3955
  request));
3663
3956
 
3664
3957
  // Clean up request
@@ -3698,16 +3991,8 @@ var xhr = function xhrAdapter(config) {
3698
3991
  }
3699
3992
 
3700
3993
  // Add responseType to request if needed
3701
- if (config.responseType) {
3702
- try {
3703
- request.responseType = config.responseType;
3704
- } catch (e) {
3705
- // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
3706
- // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
3707
- if (config.responseType !== 'json') {
3708
- throw e;
3709
- }
3710
- }
3994
+ if (responseType && responseType !== 'json') {
3995
+ request.responseType = config.responseType;
3711
3996
  }
3712
3997
 
3713
3998
  // Handle progress if needed
@@ -3720,29 +4005,46 @@ var xhr = function xhrAdapter(config) {
3720
4005
  request.upload.addEventListener('progress', config.onUploadProgress);
3721
4006
  }
3722
4007
 
3723
- if (config.cancelToken) {
4008
+ if (config.cancelToken || config.signal) {
3724
4009
  // Handle cancellation
3725
- config.cancelToken.promise.then(function onCanceled(cancel) {
4010
+ // eslint-disable-next-line func-names
4011
+ onCanceled = function(cancel) {
3726
4012
  if (!request) {
3727
4013
  return;
3728
4014
  }
3729
-
4015
+ reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel);
3730
4016
  request.abort();
3731
- reject(cancel);
3732
- // Clean up request
3733
4017
  request = null;
3734
- });
4018
+ };
4019
+
4020
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
4021
+ if (config.signal) {
4022
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
4023
+ }
3735
4024
  }
3736
4025
 
3737
4026
  if (!requestData) {
3738
4027
  requestData = null;
3739
4028
  }
3740
4029
 
4030
+ if (parsed.path === null) {
4031
+ reject(new AxiosError_1('Malformed URL ' + fullPath, AxiosError_1.ERR_BAD_REQUEST, config));
4032
+ return;
4033
+ }
4034
+
4035
+ if (!utils.supportedProtocols.includes(protocol)) {
4036
+ reject(new AxiosError_1('Unsupported protocol ' + protocol, AxiosError_1.ERR_BAD_REQUEST, config));
4037
+ return;
4038
+ }
4039
+
3741
4040
  // Send the request
3742
4041
  request.send(requestData);
3743
4042
  });
3744
4043
  };
3745
4044
 
4045
+ // eslint-disable-next-line strict
4046
+ var _null = null;
4047
+
3746
4048
  var DEFAULT_CONTENT_TYPE = {
3747
4049
  'Content-Type': 'application/x-www-form-urlencoded'
3748
4050
  };
@@ -3765,12 +4067,31 @@ function getDefaultAdapter() {
3765
4067
  return adapter;
3766
4068
  }
3767
4069
 
4070
+ function stringifySafely(rawValue, parser, encoder) {
4071
+ if (utils.isString(rawValue)) {
4072
+ try {
4073
+ (parser || JSON.parse)(rawValue);
4074
+ return utils.trim(rawValue);
4075
+ } catch (e) {
4076
+ if (e.name !== 'SyntaxError') {
4077
+ throw e;
4078
+ }
4079
+ }
4080
+ }
4081
+
4082
+ return (encoder || JSON.stringify)(rawValue);
4083
+ }
4084
+
3768
4085
  var defaults = {
4086
+
4087
+ transitional: transitional,
4088
+
3769
4089
  adapter: getDefaultAdapter(),
3770
4090
 
3771
4091
  transformRequest: [function transformRequest(data, headers) {
3772
4092
  normalizeHeaderName(headers, 'Accept');
3773
4093
  normalizeHeaderName(headers, 'Content-Type');
4094
+
3774
4095
  if (utils.isFormData(data) ||
3775
4096
  utils.isArrayBuffer(data) ||
3776
4097
  utils.isBuffer(data) ||
@@ -3787,20 +4108,42 @@ var defaults = {
3787
4108
  setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
3788
4109
  return data.toString();
3789
4110
  }
3790
- if (utils.isObject(data)) {
3791
- setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
3792
- return JSON.stringify(data);
4111
+
4112
+ var isObjectPayload = utils.isObject(data);
4113
+ var contentType = headers && headers['Content-Type'];
4114
+
4115
+ var isFileList;
4116
+
4117
+ if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) {
4118
+ var _FormData = this.env && this.env.FormData;
4119
+ return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData());
4120
+ } else if (isObjectPayload || contentType === 'application/json') {
4121
+ setContentTypeIfUnset(headers, 'application/json');
4122
+ return stringifySafely(data);
3793
4123
  }
4124
+
3794
4125
  return data;
3795
4126
  }],
3796
4127
 
3797
4128
  transformResponse: [function transformResponse(data) {
3798
- /*eslint no-param-reassign:0*/
3799
- if (typeof data === 'string') {
4129
+ var transitional = this.transitional || defaults.transitional;
4130
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
4131
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
4132
+ var strictJSONParsing = !silentJSONParsing && this.responseType === 'json';
4133
+
4134
+ if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) {
3800
4135
  try {
3801
- data = JSON.parse(data);
3802
- } catch (e) { /* Ignore */ }
4136
+ return JSON.parse(data);
4137
+ } catch (e) {
4138
+ if (strictJSONParsing) {
4139
+ if (e.name === 'SyntaxError') {
4140
+ throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response);
4141
+ }
4142
+ throw e;
4143
+ }
4144
+ }
3803
4145
  }
4146
+
3804
4147
  return data;
3805
4148
  }],
3806
4149
 
@@ -3816,14 +4159,18 @@ var defaults = {
3816
4159
  maxContentLength: -1,
3817
4160
  maxBodyLength: -1,
3818
4161
 
4162
+ env: {
4163
+ FormData: _null
4164
+ },
4165
+
3819
4166
  validateStatus: function validateStatus(status) {
3820
4167
  return status >= 200 && status < 300;
3821
- }
3822
- };
4168
+ },
3823
4169
 
3824
- defaults.headers = {
3825
- common: {
3826
- 'Accept': 'application/json, text/plain, */*'
4170
+ headers: {
4171
+ common: {
4172
+ 'Accept': 'application/json, text/plain, */*'
4173
+ }
3827
4174
  }
3828
4175
  };
3829
4176
 
@@ -3838,12 +4185,38 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3838
4185
  var defaults_1 = defaults;
3839
4186
 
3840
4187
  /**
3841
- * Throws a `Cancel` if cancellation has been requested.
4188
+ * Transform the data for a request or a response
4189
+ *
4190
+ * @param {Object|String} data The data to be transformed
4191
+ * @param {Array} headers The headers for the request or response
4192
+ * @param {Array|Function} fns A single function or Array of functions
4193
+ * @returns {*} The resulting transformed data
4194
+ */
4195
+ var transformData = function transformData(data, headers, fns) {
4196
+ var context = this || defaults_1;
4197
+ /*eslint no-param-reassign:0*/
4198
+ utils.forEach(fns, function transform(fn) {
4199
+ data = fn.call(context, data, headers);
4200
+ });
4201
+
4202
+ return data;
4203
+ };
4204
+
4205
+ var isCancel = function isCancel(value) {
4206
+ return !!(value && value.__CANCEL__);
4207
+ };
4208
+
4209
+ /**
4210
+ * Throws a `CanceledError` if cancellation has been requested.
3842
4211
  */
3843
4212
  function throwIfCancellationRequested(config) {
3844
4213
  if (config.cancelToken) {
3845
4214
  config.cancelToken.throwIfRequested();
3846
4215
  }
4216
+
4217
+ if (config.signal && config.signal.aborted) {
4218
+ throw new CanceledError_1();
4219
+ }
3847
4220
  }
3848
4221
 
3849
4222
  /**
@@ -3859,7 +4232,8 @@ var dispatchRequest = function dispatchRequest(config) {
3859
4232
  config.headers = config.headers || {};
3860
4233
 
3861
4234
  // Transform request data
3862
- config.data = transformData(
4235
+ config.data = transformData.call(
4236
+ config,
3863
4237
  config.data,
3864
4238
  config.headers,
3865
4239
  config.transformRequest
@@ -3885,7 +4259,8 @@ var dispatchRequest = function dispatchRequest(config) {
3885
4259
  throwIfCancellationRequested(config);
3886
4260
 
3887
4261
  // Transform response data
3888
- response.data = transformData(
4262
+ response.data = transformData.call(
4263
+ config,
3889
4264
  response.data,
3890
4265
  response.headers,
3891
4266
  config.transformResponse
@@ -3898,7 +4273,8 @@ var dispatchRequest = function dispatchRequest(config) {
3898
4273
 
3899
4274
  // Transform response data
3900
4275
  if (reason && reason.response) {
3901
- reason.response.data = transformData(
4276
+ reason.response.data = transformData.call(
4277
+ config,
3902
4278
  reason.response.data,
3903
4279
  reason.response.headers,
3904
4280
  config.transformResponse
@@ -3923,17 +4299,6 @@ var mergeConfig = function mergeConfig(config1, config2) {
3923
4299
  config2 = config2 || {};
3924
4300
  var config = {};
3925
4301
 
3926
- var valueFromConfig2Keys = ['url', 'method', 'data'];
3927
- var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];
3928
- var defaultToConfig2Keys = [
3929
- 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',
3930
- 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
3931
- 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',
3932
- 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',
3933
- 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
3934
- ];
3935
- var directMergeKeys = ['validateStatus'];
3936
-
3937
4302
  function getMergedValue(target, source) {
3938
4303
  if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
3939
4304
  return utils.merge(target, source);
@@ -3945,55 +4310,169 @@ var mergeConfig = function mergeConfig(config1, config2) {
3945
4310
  return source;
3946
4311
  }
3947
4312
 
4313
+ // eslint-disable-next-line consistent-return
3948
4314
  function mergeDeepProperties(prop) {
3949
4315
  if (!utils.isUndefined(config2[prop])) {
3950
- config[prop] = getMergedValue(config1[prop], config2[prop]);
4316
+ return getMergedValue(config1[prop], config2[prop]);
3951
4317
  } else if (!utils.isUndefined(config1[prop])) {
3952
- config[prop] = getMergedValue(undefined, config1[prop]);
4318
+ return getMergedValue(undefined, config1[prop]);
3953
4319
  }
3954
4320
  }
3955
4321
 
3956
- utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
4322
+ // eslint-disable-next-line consistent-return
4323
+ function valueFromConfig2(prop) {
3957
4324
  if (!utils.isUndefined(config2[prop])) {
3958
- config[prop] = getMergedValue(undefined, config2[prop]);
4325
+ return getMergedValue(undefined, config2[prop]);
3959
4326
  }
3960
- });
3961
-
3962
- utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);
4327
+ }
3963
4328
 
3964
- utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
4329
+ // eslint-disable-next-line consistent-return
4330
+ function defaultToConfig2(prop) {
3965
4331
  if (!utils.isUndefined(config2[prop])) {
3966
- config[prop] = getMergedValue(undefined, config2[prop]);
4332
+ return getMergedValue(undefined, config2[prop]);
3967
4333
  } else if (!utils.isUndefined(config1[prop])) {
3968
- config[prop] = getMergedValue(undefined, config1[prop]);
4334
+ return getMergedValue(undefined, config1[prop]);
3969
4335
  }
3970
- });
4336
+ }
3971
4337
 
3972
- utils.forEach(directMergeKeys, function merge(prop) {
4338
+ // eslint-disable-next-line consistent-return
4339
+ function mergeDirectKeys(prop) {
3973
4340
  if (prop in config2) {
3974
- config[prop] = getMergedValue(config1[prop], config2[prop]);
4341
+ return getMergedValue(config1[prop], config2[prop]);
3975
4342
  } else if (prop in config1) {
3976
- config[prop] = getMergedValue(undefined, config1[prop]);
4343
+ return getMergedValue(undefined, config1[prop]);
3977
4344
  }
4345
+ }
4346
+
4347
+ var mergeMap = {
4348
+ 'url': valueFromConfig2,
4349
+ 'method': valueFromConfig2,
4350
+ 'data': valueFromConfig2,
4351
+ 'baseURL': defaultToConfig2,
4352
+ 'transformRequest': defaultToConfig2,
4353
+ 'transformResponse': defaultToConfig2,
4354
+ 'paramsSerializer': defaultToConfig2,
4355
+ 'timeout': defaultToConfig2,
4356
+ 'timeoutMessage': defaultToConfig2,
4357
+ 'withCredentials': defaultToConfig2,
4358
+ 'adapter': defaultToConfig2,
4359
+ 'responseType': defaultToConfig2,
4360
+ 'xsrfCookieName': defaultToConfig2,
4361
+ 'xsrfHeaderName': defaultToConfig2,
4362
+ 'onUploadProgress': defaultToConfig2,
4363
+ 'onDownloadProgress': defaultToConfig2,
4364
+ 'decompress': defaultToConfig2,
4365
+ 'maxContentLength': defaultToConfig2,
4366
+ 'maxBodyLength': defaultToConfig2,
4367
+ 'beforeRedirect': defaultToConfig2,
4368
+ 'transport': defaultToConfig2,
4369
+ 'httpAgent': defaultToConfig2,
4370
+ 'httpsAgent': defaultToConfig2,
4371
+ 'cancelToken': defaultToConfig2,
4372
+ 'socketPath': defaultToConfig2,
4373
+ 'responseEncoding': defaultToConfig2,
4374
+ 'validateStatus': mergeDirectKeys
4375
+ };
4376
+
4377
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
4378
+ var merge = mergeMap[prop] || mergeDeepProperties;
4379
+ var configValue = merge(prop);
4380
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3978
4381
  });
3979
4382
 
3980
- var axiosKeys = valueFromConfig2Keys
3981
- .concat(mergeDeepPropertiesKeys)
3982
- .concat(defaultToConfig2Keys)
3983
- .concat(directMergeKeys);
4383
+ return config;
4384
+ };
4385
+
4386
+ var data = {
4387
+ "version": "0.27.0"
4388
+ };
3984
4389
 
3985
- var otherKeys = Object
3986
- .keys(config1)
3987
- .concat(Object.keys(config2))
3988
- .filter(function filterAxiosKeys(key) {
3989
- return axiosKeys.indexOf(key) === -1;
3990
- });
4390
+ var VERSION = data.version;
3991
4391
 
3992
- utils.forEach(otherKeys, mergeDeepProperties);
3993
4392
 
3994
- return config;
4393
+ var validators$1 = {};
4394
+
4395
+ // eslint-disable-next-line func-names
4396
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {
4397
+ validators$1[type] = function validator(thing) {
4398
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
4399
+ };
4400
+ });
4401
+
4402
+ var deprecatedWarnings = {};
4403
+
4404
+ /**
4405
+ * Transitional option validator
4406
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
4407
+ * @param {string?} version - deprecated version / removed since version
4408
+ * @param {string?} message - some message with additional info
4409
+ * @returns {function}
4410
+ */
4411
+ validators$1.transitional = function transitional(validator, version, message) {
4412
+ function formatMessage(opt, desc) {
4413
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
4414
+ }
4415
+
4416
+ // eslint-disable-next-line func-names
4417
+ return function(value, opt, opts) {
4418
+ if (validator === false) {
4419
+ throw new AxiosError_1(
4420
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
4421
+ AxiosError_1.ERR_DEPRECATED
4422
+ );
4423
+ }
4424
+
4425
+ if (version && !deprecatedWarnings[opt]) {
4426
+ deprecatedWarnings[opt] = true;
4427
+ // eslint-disable-next-line no-console
4428
+ console.warn(
4429
+ formatMessage(
4430
+ opt,
4431
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
4432
+ )
4433
+ );
4434
+ }
4435
+
4436
+ return validator ? validator(value, opt, opts) : true;
4437
+ };
4438
+ };
4439
+
4440
+ /**
4441
+ * Assert object's properties type
4442
+ * @param {object} options
4443
+ * @param {object} schema
4444
+ * @param {boolean?} allowUnknown
4445
+ */
4446
+
4447
+ function assertOptions(options, schema, allowUnknown) {
4448
+ if (typeof options !== 'object') {
4449
+ throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE);
4450
+ }
4451
+ var keys = Object.keys(options);
4452
+ var i = keys.length;
4453
+ while (i-- > 0) {
4454
+ var opt = keys[i];
4455
+ var validator = schema[opt];
4456
+ if (validator) {
4457
+ var value = options[opt];
4458
+ var result = value === undefined || validator(value, opt, options);
4459
+ if (result !== true) {
4460
+ throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE);
4461
+ }
4462
+ continue;
4463
+ }
4464
+ if (allowUnknown !== true) {
4465
+ throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION);
4466
+ }
4467
+ }
4468
+ }
4469
+
4470
+ var validator = {
4471
+ assertOptions: assertOptions,
4472
+ validators: validators$1
3995
4473
  };
3996
4474
 
4475
+ var validators = validator.validators;
3997
4476
  /**
3998
4477
  * Create a new instance of Axios
3999
4478
  *
@@ -4012,14 +4491,14 @@ function Axios(instanceConfig) {
4012
4491
  *
4013
4492
  * @param {Object} config The config specific for this request (merged with this.defaults)
4014
4493
  */
4015
- Axios.prototype.request = function request(config) {
4494
+ Axios.prototype.request = function request(configOrUrl, config) {
4016
4495
  /*eslint no-param-reassign:0*/
4017
4496
  // Allow for axios('example/url'[, config]) a la fetch API
4018
- if (typeof config === 'string') {
4019
- config = arguments[1] || {};
4020
- config.url = arguments[0];
4021
- } else {
4497
+ if (typeof configOrUrl === 'string') {
4022
4498
  config = config || {};
4499
+ config.url = configOrUrl;
4500
+ } else {
4501
+ config = configOrUrl || {};
4023
4502
  }
4024
4503
 
4025
4504
  config = mergeConfig(this.defaults, config);
@@ -4033,20 +4512,71 @@ Axios.prototype.request = function request(config) {
4033
4512
  config.method = 'get';
4034
4513
  }
4035
4514
 
4036
- // Hook up interceptors middleware
4037
- var chain = [dispatchRequest, undefined];
4038
- var promise = Promise.resolve(config);
4515
+ var transitional = config.transitional;
4039
4516
 
4517
+ if (transitional !== undefined) {
4518
+ validator.assertOptions(transitional, {
4519
+ silentJSONParsing: validators.transitional(validators.boolean),
4520
+ forcedJSONParsing: validators.transitional(validators.boolean),
4521
+ clarifyTimeoutError: validators.transitional(validators.boolean)
4522
+ }, false);
4523
+ }
4524
+
4525
+ // filter out skipped interceptors
4526
+ var requestInterceptorChain = [];
4527
+ var synchronousRequestInterceptors = true;
4040
4528
  this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
4041
- chain.unshift(interceptor.fulfilled, interceptor.rejected);
4529
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
4530
+ return;
4531
+ }
4532
+
4533
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
4534
+
4535
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4042
4536
  });
4043
4537
 
4538
+ var responseInterceptorChain = [];
4044
4539
  this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
4045
- chain.push(interceptor.fulfilled, interceptor.rejected);
4540
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4046
4541
  });
4047
4542
 
4048
- while (chain.length) {
4049
- promise = promise.then(chain.shift(), chain.shift());
4543
+ var promise;
4544
+
4545
+ if (!synchronousRequestInterceptors) {
4546
+ var chain = [dispatchRequest, undefined];
4547
+
4548
+ Array.prototype.unshift.apply(chain, requestInterceptorChain);
4549
+ chain = chain.concat(responseInterceptorChain);
4550
+
4551
+ promise = Promise.resolve(config);
4552
+ while (chain.length) {
4553
+ promise = promise.then(chain.shift(), chain.shift());
4554
+ }
4555
+
4556
+ return promise;
4557
+ }
4558
+
4559
+
4560
+ var newConfig = config;
4561
+ while (requestInterceptorChain.length) {
4562
+ var onFulfilled = requestInterceptorChain.shift();
4563
+ var onRejected = requestInterceptorChain.shift();
4564
+ try {
4565
+ newConfig = onFulfilled(newConfig);
4566
+ } catch (error) {
4567
+ onRejected(error);
4568
+ break;
4569
+ }
4570
+ }
4571
+
4572
+ try {
4573
+ promise = dispatchRequest(newConfig);
4574
+ } catch (error) {
4575
+ return Promise.reject(error);
4576
+ }
4577
+
4578
+ while (responseInterceptorChain.length) {
4579
+ promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
4050
4580
  }
4051
4581
 
4052
4582
  return promise;
@@ -4054,7 +4584,8 @@ Axios.prototype.request = function request(config) {
4054
4584
 
4055
4585
  Axios.prototype.getUri = function getUri(config) {
4056
4586
  config = mergeConfig(this.defaults, config);
4057
- return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
4587
+ var fullPath = buildFullPath(config.baseURL, config.url);
4588
+ return buildURL(fullPath, config.params, config.paramsSerializer);
4058
4589
  };
4059
4590
 
4060
4591
  // Provide aliases for supported request methods
@@ -4071,34 +4602,26 @@ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData
4071
4602
 
4072
4603
  utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4073
4604
  /*eslint func-names:0*/
4074
- Axios.prototype[method] = function(url, data, config) {
4075
- return this.request(mergeConfig(config || {}, {
4076
- method: method,
4077
- url: url,
4078
- data: data
4079
- }));
4080
- };
4081
- });
4082
-
4083
- var Axios_1 = Axios;
4084
4605
 
4085
- /**
4086
- * A `Cancel` is an object that is thrown when an operation is canceled.
4087
- *
4088
- * @class
4089
- * @param {string=} message The message.
4090
- */
4091
- function Cancel(message) {
4092
- this.message = message;
4093
- }
4606
+ function generateHTTPMethod(isForm) {
4607
+ return function httpMethod(url, data, config) {
4608
+ return this.request(mergeConfig(config || {}, {
4609
+ method: method,
4610
+ headers: isForm ? {
4611
+ 'Content-Type': 'multipart/form-data'
4612
+ } : {},
4613
+ url: url,
4614
+ data: data
4615
+ }));
4616
+ };
4617
+ }
4094
4618
 
4095
- Cancel.prototype.toString = function toString() {
4096
- return 'Cancel' + (this.message ? ': ' + this.message : '');
4097
- };
4619
+ Axios.prototype[method] = generateHTTPMethod();
4098
4620
 
4099
- Cancel.prototype.__CANCEL__ = true;
4621
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4622
+ });
4100
4623
 
4101
- var Cancel_1 = Cancel;
4624
+ var Axios_1 = Axios;
4102
4625
 
4103
4626
  /**
4104
4627
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -4112,24 +4635,55 @@ function CancelToken(executor) {
4112
4635
  }
4113
4636
 
4114
4637
  var resolvePromise;
4638
+
4115
4639
  this.promise = new Promise(function promiseExecutor(resolve) {
4116
4640
  resolvePromise = resolve;
4117
4641
  });
4118
4642
 
4119
4643
  var token = this;
4644
+
4645
+ // eslint-disable-next-line func-names
4646
+ this.promise.then(function(cancel) {
4647
+ if (!token._listeners) return;
4648
+
4649
+ var i;
4650
+ var l = token._listeners.length;
4651
+
4652
+ for (i = 0; i < l; i++) {
4653
+ token._listeners[i](cancel);
4654
+ }
4655
+ token._listeners = null;
4656
+ });
4657
+
4658
+ // eslint-disable-next-line func-names
4659
+ this.promise.then = function(onfulfilled) {
4660
+ var _resolve;
4661
+ // eslint-disable-next-line func-names
4662
+ var promise = new Promise(function(resolve) {
4663
+ token.subscribe(resolve);
4664
+ _resolve = resolve;
4665
+ }).then(onfulfilled);
4666
+
4667
+ promise.cancel = function reject() {
4668
+ token.unsubscribe(_resolve);
4669
+ };
4670
+
4671
+ return promise;
4672
+ };
4673
+
4120
4674
  executor(function cancel(message) {
4121
4675
  if (token.reason) {
4122
4676
  // Cancellation has already been requested
4123
4677
  return;
4124
4678
  }
4125
4679
 
4126
- token.reason = new Cancel_1(message);
4680
+ token.reason = new CanceledError_1(message);
4127
4681
  resolvePromise(token.reason);
4128
4682
  });
4129
4683
  }
4130
4684
 
4131
4685
  /**
4132
- * Throws a `Cancel` if cancellation has been requested.
4686
+ * Throws a `CanceledError` if cancellation has been requested.
4133
4687
  */
4134
4688
  CancelToken.prototype.throwIfRequested = function throwIfRequested() {
4135
4689
  if (this.reason) {
@@ -4137,6 +4691,37 @@ CancelToken.prototype.throwIfRequested = function throwIfRequested() {
4137
4691
  }
4138
4692
  };
4139
4693
 
4694
+ /**
4695
+ * Subscribe to the cancel signal
4696
+ */
4697
+
4698
+ CancelToken.prototype.subscribe = function subscribe(listener) {
4699
+ if (this.reason) {
4700
+ listener(this.reason);
4701
+ return;
4702
+ }
4703
+
4704
+ if (this._listeners) {
4705
+ this._listeners.push(listener);
4706
+ } else {
4707
+ this._listeners = [listener];
4708
+ }
4709
+ };
4710
+
4711
+ /**
4712
+ * Unsubscribe from the cancel signal
4713
+ */
4714
+
4715
+ CancelToken.prototype.unsubscribe = function unsubscribe(listener) {
4716
+ if (!this._listeners) {
4717
+ return;
4718
+ }
4719
+ var index = this._listeners.indexOf(listener);
4720
+ if (index !== -1) {
4721
+ this._listeners.splice(index, 1);
4722
+ }
4723
+ };
4724
+
4140
4725
  /**
4141
4726
  * Returns an object that contains a new `CancelToken` and a function that, when called,
4142
4727
  * cancels the `CancelToken`.
@@ -4187,7 +4772,7 @@ var spread = function spread(callback) {
4187
4772
  * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4188
4773
  */
4189
4774
  var isAxiosError = function isAxiosError(payload) {
4190
- return (typeof payload === 'object') && (payload.isAxiosError === true);
4775
+ return utils.isObject(payload) && (payload.isAxiosError === true);
4191
4776
  };
4192
4777
 
4193
4778
  /**
@@ -4206,6 +4791,11 @@ function createInstance(defaultConfig) {
4206
4791
  // Copy context to instance
4207
4792
  utils.extend(instance, context);
4208
4793
 
4794
+ // Factory for creating new instances
4795
+ instance.create = function create(instanceConfig) {
4796
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
4797
+ };
4798
+
4209
4799
  return instance;
4210
4800
  }
4211
4801
 
@@ -4215,15 +4805,18 @@ var axios$1 = createInstance(defaults_1);
4215
4805
  // Expose Axios class to allow class inheritance
4216
4806
  axios$1.Axios = Axios_1;
4217
4807
 
4218
- // Factory for creating new instances
4219
- axios$1.create = function create(instanceConfig) {
4220
- return createInstance(mergeConfig(axios$1.defaults, instanceConfig));
4221
- };
4222
-
4223
4808
  // Expose Cancel & CancelToken
4224
- axios$1.Cancel = Cancel_1;
4809
+ axios$1.CanceledError = CanceledError_1;
4225
4810
  axios$1.CancelToken = CancelToken_1;
4226
4811
  axios$1.isCancel = isCancel;
4812
+ axios$1.VERSION = data.version;
4813
+ axios$1.toFormData = toFormData_1;
4814
+
4815
+ // Expose AxiosError class
4816
+ axios$1.AxiosError = AxiosError_1;
4817
+
4818
+ // alias for CanceledError for backward compatibility
4819
+ axios$1.Cancel = axios$1.CanceledError;
4227
4820
 
4228
4821
  // Expose all/spread
4229
4822
  axios$1.all = function all(promises) {
@@ -4243,14 +4836,14 @@ axios_1.default = default_1;
4243
4836
  var axios = axios_1;
4244
4837
 
4245
4838
  var name$1 = "@tryghost/content-api";
4246
- var version = "1.9.0";
4839
+ var version = "1.9.3";
4247
4840
  var repository = "https://github.com/TryGhost/SDK/tree/master/packages/content-api";
4248
4841
  var author = "Ghost Foundation";
4249
4842
  var license = "MIT";
4250
4843
  var main = "cjs/content-api.js";
4251
4844
  var unpkg = "umd/content-api.min.js";
4252
4845
  var module = "es/content-api.js";
4253
- var source = "lib/index.js";
4846
+ var source = "lib/content-api.js";
4254
4847
  var files = [
4255
4848
  "LICENSE",
4256
4849
  "README.md",
@@ -4272,27 +4865,27 @@ var publishConfig = {
4272
4865
  access: "public"
4273
4866
  };
4274
4867
  var devDependencies = {
4275
- "@babel/core": "7.17.9",
4868
+ "@babel/core": "7.17.10",
4276
4869
  "@babel/polyfill": "7.12.1",
4277
- "@babel/preset-env": "7.16.11",
4278
- "@rollup/plugin-json": "^4.1.0",
4279
- c8: "7.11.0",
4280
- "core-js": "3.22.0",
4281
- "eslint-plugin-ghost": "1.5.0",
4282
- mocha: "7.2.0",
4283
- rollup: "2.70.2",
4870
+ "@babel/preset-env": "7.17.10",
4871
+ "@rollup/plugin-json": "4.1.0",
4872
+ c8: "7.11.2",
4873
+ "core-js": "3.22.4",
4874
+ "eslint-plugin-ghost": "2.13.0",
4875
+ mocha: "10.0.0",
4876
+ rollup: "2.72.1",
4284
4877
  "rollup-plugin-babel": "4.4.0",
4285
4878
  "rollup-plugin-commonjs": "10.1.0",
4286
4879
  "rollup-plugin-node-resolve": "5.2.0",
4287
4880
  "rollup-plugin-replace": "2.2.0",
4288
4881
  "rollup-plugin-terser": "7.0.2",
4289
4882
  should: "13.2.3",
4290
- sinon: "9.2.4"
4883
+ sinon: "13.0.2"
4291
4884
  };
4292
4885
  var dependencies = {
4293
- axios: "^0.21.1"
4886
+ axios: "^0.27.0"
4294
4887
  };
4295
- var gitHead = "f699f18279c596be384760adccbbf90a659bd4bc";
4888
+ var gitHead = "1b8c08ab41c317f79bff2b1be65fab6ee638d9d5";
4296
4889
  var packageInfo = {
4297
4890
  name: name$1,
4298
4891
  version: version,
@@ -4317,6 +4910,28 @@ var packageVersion = packageInfo.version; // NOTE: bump this default when Ghost
4317
4910
  var defaultAcceptVersionHeader = 'v4.0';
4318
4911
  var supportedVersions = ['v2', 'v3', 'v4', 'v5', 'canary'];
4319
4912
  var name = '@tryghost/content-api';
4913
+ /**
4914
+ * This method can go away in favor of only sending 'Accept-Version` headers
4915
+ * once the Ghost API removes a concept of version from it's URLS (with Ghost v5)
4916
+ *
4917
+ * @param {string} [version] version in `v{major}` format
4918
+ * @returns {string}
4919
+ */
4920
+
4921
+ var resolveAPIPrefix = function resolveAPIPrefix(version) {
4922
+ var prefix; // NOTE: the "version.match(/^v5\.\d+/)" expression should be changed to "version.match(/^v\d+\.\d+/)" once Ghost v5 is out
4923
+
4924
+ if (version === 'v5' || version === undefined || version.match(/^v5\.\d+/)) {
4925
+ prefix = "/content/";
4926
+ } else if (version.match(/^v\d+\.\d+/)) {
4927
+ var versionPrefix = /^(v\d+)\.\d+/.exec(version)[1];
4928
+ prefix = "/".concat(versionPrefix, "/content/");
4929
+ } else {
4930
+ prefix = "/".concat(version, "/content/");
4931
+ }
4932
+
4933
+ return prefix;
4934
+ };
4320
4935
 
4321
4936
  var defaultMakeRequest = function defaultMakeRequest(_ref) {
4322
4937
  var url = _ref.url,
@@ -4474,7 +5089,7 @@ function GhostContentAPI(_ref2) {
4474
5089
  params = Object.assign({
4475
5090
  key: key
4476
5091
  }, params);
4477
- 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 + '/' : '');
5092
+ var apiUrl = "".concat(url, "/").concat(ghostPath, "/api").concat(resolveAPIPrefix(version)).concat(resourceType, "/").concat(id ? id + '/' : '');
4478
5093
  return makeRequest({
4479
5094
  url: apiUrl,
4480
5095
  method: 'get',