contentful 11.12.0 → 11.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,36 +27,6 @@ var contentful = (function (exports) {
27
27
  };
28
28
  }
29
29
 
30
- function _arrayLikeToArray$4(r, a) {
31
- (null == a || a > r.length) && (a = r.length);
32
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
33
- return n;
34
- }
35
-
36
- function _arrayWithoutHoles(r) {
37
- if (Array.isArray(r)) return _arrayLikeToArray$4(r);
38
- }
39
-
40
- function _iterableToArray(r) {
41
- if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
42
- }
43
-
44
- function _unsupportedIterableToArray$4(r, a) {
45
- if (r) {
46
- if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
47
- var t = {}.toString.call(r).slice(8, -1);
48
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
49
- }
50
- }
51
-
52
- function _nonIterableSpread() {
53
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
54
- }
55
-
56
- function _toConsumableArray$1(r) {
57
- return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread();
58
- }
59
-
60
30
  function _typeof$2(o) {
61
31
  "@babel/helpers - typeof";
62
32
 
@@ -92,22 +62,6 @@ var contentful = (function (exports) {
92
62
  }) : e[r] = t, e;
93
63
  }
94
64
 
95
- function _classCallCheck(a, n) {
96
- if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
97
- }
98
-
99
- function _defineProperties(e, r) {
100
- for (var t = 0; t < r.length; t++) {
101
- var o = r[t];
102
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
103
- }
104
- }
105
- function _createClass(e, r, t) {
106
- return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
107
- writable: false
108
- }), e;
109
- }
110
-
111
65
  function _assertThisInitialized(e) {
112
66
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
113
67
  return e;
@@ -192,6 +146,52 @@ var contentful = (function (exports) {
192
146
  }, _wrapNativeSuper(t);
193
147
  }
194
148
 
149
+ function _arrayLikeToArray$4(r, a) {
150
+ (null == a || a > r.length) && (a = r.length);
151
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
152
+ return n;
153
+ }
154
+
155
+ function _arrayWithoutHoles(r) {
156
+ if (Array.isArray(r)) return _arrayLikeToArray$4(r);
157
+ }
158
+
159
+ function _iterableToArray(r) {
160
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
161
+ }
162
+
163
+ function _unsupportedIterableToArray$4(r, a) {
164
+ if (r) {
165
+ if ("string" == typeof r) return _arrayLikeToArray$4(r, a);
166
+ var t = {}.toString.call(r).slice(8, -1);
167
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0;
168
+ }
169
+ }
170
+
171
+ function _nonIterableSpread() {
172
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
173
+ }
174
+
175
+ function _toConsumableArray$1(r) {
176
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$4(r) || _nonIterableSpread();
177
+ }
178
+
179
+ function _classCallCheck(a, n) {
180
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
181
+ }
182
+
183
+ function _defineProperties(e, r) {
184
+ for (var t = 0; t < r.length; t++) {
185
+ var o = r[t];
186
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, toPropertyKey(o.key), o);
187
+ }
188
+ }
189
+ function _createClass(e, r, t) {
190
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
191
+ writable: false
192
+ }), e;
193
+ }
194
+
195
195
  function _arrayWithHoles(r) {
196
196
  if (Array.isArray(r)) return r;
197
197
  }
@@ -693,13 +693,13 @@ var contentful = (function (exports) {
693
693
  }
694
694
  var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
695
695
 
696
- function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
697
- function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
698
- function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
699
696
  function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
700
697
  function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
701
698
  function _callSuper$3(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct$3() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
702
699
  function _isNativeReflectConstruct$3() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct$3 = function _isNativeReflectConstruct() { return !!t; })(); }
700
+ function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: true } : { done: false, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = true, u = false; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = true, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
701
+ function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
702
+ function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
703
703
  function _asyncIterator(r) { var n, t, o, e = 2; for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { if (t && null != (n = r[t])) return n.call(r); if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); t = "@@asyncIterator", o = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
704
704
  function AsyncFromSyncIterator(r) { function AsyncFromSyncIteratorContinuation(r) { if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); var n = r.done; return Promise.resolve(r.value).then(function (r) { return { value: r, done: n }; }); } return AsyncFromSyncIterator = function AsyncFromSyncIterator(r) { this.s = r, this.n = r.next; }, AsyncFromSyncIterator.prototype = { s: null, n: null, next: function next() { return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); }, return: function _return(r) { var n = this.s.return; return void 0 === n ? Promise.resolve({ value: r, done: true }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); }, throw: function _throw(r) { var n = this.s.return; return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); } }, new AsyncFromSyncIterator(r); }
705
705
 
@@ -901,9 +901,9 @@ var contentful = (function (exports) {
901
901
  * also have a `name` and `type` attribute to specify filename and content type
902
902
  *
903
903
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
904
- *
904
+ *
905
905
  * @param {*} value The value to test
906
- *
906
+ *
907
907
  * @returns {boolean} True if value is a React Native Blob, otherwise false
908
908
  */
909
909
  var isReactNativeBlob = function isReactNativeBlob(value) {
@@ -913,9 +913,9 @@ var contentful = (function (exports) {
913
913
  /**
914
914
  * Determine if environment is React Native
915
915
  * ReactNative `FormData` has a non-standard `getParts()` method
916
- *
916
+ *
917
917
  * @param {*} formData The formData to test
918
- *
918
+ *
919
919
  * @returns {boolean} True if environment is React Native, otherwise false
920
920
  */
921
921
  var isReactNative$1 = function isReactNative(formData) {
@@ -936,7 +936,7 @@ var contentful = (function (exports) {
936
936
  *
937
937
  * @param {*} val The value to test
938
938
  *
939
- * @returns {boolean} True if value is a File, otherwise false
939
+ * @returns {boolean} True if value is a FileList, otherwise false
940
940
  */
941
941
  var isFileList = kindOfTest('FileList');
942
942
 
@@ -968,10 +968,16 @@ var contentful = (function (exports) {
968
968
  var G$1 = getGlobal();
969
969
  var FormDataCtor = typeof G$1.FormData !== 'undefined' ? G$1.FormData : undefined;
970
970
  var isFormData = function isFormData(thing) {
971
- var kind;
972
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
971
+ if (!thing) return false;
972
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
973
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
974
+ var proto = getPrototypeOf$1(thing);
975
+ if (!proto || proto === Object.prototype) return false;
976
+ if (!isFunction$1(thing.append)) return false;
977
+ var kind = kindOf(thing);
978
+ return kind === 'formdata' ||
973
979
  // detect form-data instance
974
- kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
980
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]';
975
981
  };
976
982
 
977
983
  /**
@@ -1104,8 +1110,7 @@ var contentful = (function (exports) {
1104
1110
  *
1105
1111
  * @returns {Object} Result of all merge properties
1106
1112
  */
1107
- function merge$1(/* obj1, obj2, obj3, ... */
1108
- ) {
1113
+ function merge$1() {
1109
1114
  var _ref4 = isContextDefined(this) && this || {},
1110
1115
  caseless = _ref4.caseless,
1111
1116
  skipUndefined = _ref4.skipUndefined;
@@ -1116,8 +1121,12 @@ var contentful = (function (exports) {
1116
1121
  return;
1117
1122
  }
1118
1123
  var targetKey = caseless && findKey(result, key) || key;
1119
- if (isPlainObject$2(result[targetKey]) && isPlainObject$2(val)) {
1120
- result[targetKey] = merge$1(result[targetKey], val);
1124
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
1125
+ // chain, so a polluted Object.prototype value could surface here and get
1126
+ // copied into the merged result.
1127
+ var existing = hasOwnProperty$3(result, targetKey) ? result[targetKey] : undefined;
1128
+ if (isPlainObject$2(existing) && isPlainObject$2(val)) {
1129
+ result[targetKey] = merge$1(existing, val);
1121
1130
  } else if (isPlainObject$2(val)) {
1122
1131
  result[targetKey] = merge$1({}, val);
1123
1132
  } else if (isArray$7(val)) {
@@ -1126,8 +1135,11 @@ var contentful = (function (exports) {
1126
1135
  result[targetKey] = val;
1127
1136
  }
1128
1137
  };
1129
- for (var i = 0, l = arguments.length; i < l; i++) {
1130
- arguments[i] && forEach(arguments[i], assignValue);
1138
+ for (var _len = arguments.length, objs = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
1139
+ objs[_key2] = arguments[_key2];
1140
+ }
1141
+ for (var i = 0, l = objs.length; i < l; i++) {
1142
+ objs[i] && forEach(objs[i], assignValue);
1131
1143
  }
1132
1144
  return result;
1133
1145
  }
@@ -1149,6 +1161,9 @@ var contentful = (function (exports) {
1149
1161
  forEach(b, function (val, key) {
1150
1162
  if (thisArg && isFunction$1(val)) {
1151
1163
  Object.defineProperty(a, key, {
1164
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
1165
+ // hijack defineProperty's accessor-vs-data resolution.
1166
+ __proto__: null,
1152
1167
  value: bind$3(val, thisArg),
1153
1168
  writable: true,
1154
1169
  enumerable: true,
@@ -1156,6 +1171,7 @@ var contentful = (function (exports) {
1156
1171
  });
1157
1172
  } else {
1158
1173
  Object.defineProperty(a, key, {
1174
+ __proto__: null,
1159
1175
  value: val,
1160
1176
  writable: true,
1161
1177
  enumerable: true,
@@ -1194,12 +1210,14 @@ var contentful = (function (exports) {
1194
1210
  var inherits = function inherits(constructor, superConstructor, props, descriptors) {
1195
1211
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1196
1212
  Object.defineProperty(constructor.prototype, 'constructor', {
1213
+ __proto__: null,
1197
1214
  value: constructor,
1198
1215
  writable: true,
1199
1216
  enumerable: false,
1200
1217
  configurable: true
1201
1218
  });
1202
1219
  Object.defineProperty(constructor, 'super', {
1220
+ __proto__: null,
1203
1221
  value: superConstructor.prototype
1204
1222
  });
1205
1223
  props && Object.assign(constructor.prototype, props);
@@ -1370,7 +1388,7 @@ var contentful = (function (exports) {
1370
1388
  var freezeMethods = function freezeMethods(obj) {
1371
1389
  reduceDescriptors(obj, function (descriptor, name) {
1372
1390
  // skip restricted props in strict mode
1373
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1391
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
1374
1392
  return false;
1375
1393
  }
1376
1394
  var value = obj[name];
@@ -1581,1062 +1599,1167 @@ var contentful = (function (exports) {
1581
1599
  asap: asap,
1582
1600
  isIterable: isIterable
1583
1601
  };
1584
- var AxiosError = /*#__PURE__*/function (_Error) {
1585
- /**
1586
- * Create an Error with the specified message, config, error code, request and response.
1587
- *
1588
- * @param {string} message The error message.
1589
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1590
- * @param {Object} [config] The config.
1591
- * @param {Object} [request] The request.
1592
- * @param {Object} [response] The response.
1593
- *
1594
- * @returns {Error} The created error.
1595
- */
1596
- function AxiosError(message, code, config, request, response) {
1597
- var _this;
1598
- _classCallCheck(this, AxiosError);
1599
- _this = _callSuper$3(this, AxiosError, [message]);
1600
-
1601
- // Make message enumerable to maintain backward compatibility
1602
- // The native Error constructor sets message as non-enumerable,
1603
- // but axios < v1.13.3 had it as enumerable
1604
- Object.defineProperty(_this, 'message', {
1605
- value: message,
1606
- enumerable: true,
1607
- writable: true,
1608
- configurable: true
1609
- });
1610
- _this.name = 'AxiosError';
1611
- _this.isAxiosError = true;
1612
- code && (_this.code = code);
1613
- config && (_this.config = config);
1614
- request && (_this.request = request);
1615
- if (response) {
1616
- _this.response = response;
1617
- _this.status = response.status;
1618
- }
1619
- return _this;
1620
- }
1621
- _inherits(AxiosError, _Error);
1622
- return _createClass(AxiosError, [{
1623
- key: "toJSON",
1624
- value: function toJSON() {
1625
- return {
1626
- // Standard
1627
- message: this.message,
1628
- name: this.name,
1629
- // Microsoft
1630
- description: this.description,
1631
- number: this.number,
1632
- // Mozilla
1633
- fileName: this.fileName,
1634
- lineNumber: this.lineNumber,
1635
- columnNumber: this.columnNumber,
1636
- stack: this.stack,
1637
- // Axios
1638
- config: utils$1$1.toJSONObject(this.config),
1639
- code: this.code,
1640
- status: this.status
1641
- };
1642
- }
1643
- }], [{
1644
- key: "from",
1645
- value: function from(error, code, config, request, response, customProps) {
1646
- var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1647
- axiosError.cause = error;
1648
- axiosError.name = error.name;
1649
-
1650
- // Preserve status from the original error if not already set from response
1651
- if (error.status != null && axiosError.status == null) {
1652
- axiosError.status = error.status;
1653
- }
1654
- customProps && Object.assign(axiosError, customProps);
1655
- return axiosError;
1656
- }
1657
- }]);
1658
- }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1659
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1660
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1661
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1662
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1663
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1664
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1665
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1666
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1667
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1668
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1669
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1670
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1671
- var AxiosError$1 = AxiosError;
1672
1602
 
1673
- // eslint-disable-next-line strict
1674
- var httpAdapter = null;
1603
+ // RawAxiosHeaders whose duplicates are ignored by node
1604
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1605
+ var ignoreDuplicateOf = utils$1$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
1675
1606
 
1676
1607
  /**
1677
- * Determines if the given thing is a array or js object.
1678
- *
1679
- * @param {string} thing - The object or array to be visited.
1608
+ * Parse headers into an object
1680
1609
  *
1681
- * @returns {boolean}
1682
- */
1683
- function isVisitable(thing) {
1684
- return utils$1$1.isPlainObject(thing) || utils$1$1.isArray(thing);
1685
- }
1686
-
1687
- /**
1688
- * It removes the brackets from the end of a string
1610
+ * ```
1611
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1612
+ * Content-Type: application/json
1613
+ * Connection: keep-alive
1614
+ * Transfer-Encoding: chunked
1615
+ * ```
1689
1616
  *
1690
- * @param {string} key - The key of the parameter.
1617
+ * @param {String} rawHeaders Headers needing to be parsed
1691
1618
  *
1692
- * @returns {string} the key without the brackets.
1619
+ * @returns {Object} Headers parsed into an object
1693
1620
  */
1694
- function removeBrackets(key) {
1695
- return utils$1$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1621
+ var parseHeaders = function parseHeaders(rawHeaders) {
1622
+ var parsed = {};
1623
+ var key;
1624
+ var val;
1625
+ var i;
1626
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1627
+ i = line.indexOf(':');
1628
+ key = line.substring(0, i).trim().toLowerCase();
1629
+ val = line.substring(i + 1).trim();
1630
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1631
+ return;
1632
+ }
1633
+ if (key === 'set-cookie') {
1634
+ if (parsed[key]) {
1635
+ parsed[key].push(val);
1636
+ } else {
1637
+ parsed[key] = [val];
1638
+ }
1639
+ } else {
1640
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1641
+ }
1642
+ });
1643
+ return parsed;
1644
+ };
1645
+ var $internals = Symbol('internals');
1646
+ var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1647
+ function trimSPorHTAB(str) {
1648
+ var start = 0;
1649
+ var end = str.length;
1650
+ while (start < end) {
1651
+ var code = str.charCodeAt(start);
1652
+ if (code !== 0x09 && code !== 0x20) {
1653
+ break;
1654
+ }
1655
+ start += 1;
1656
+ }
1657
+ while (end > start) {
1658
+ var _code = str.charCodeAt(end - 1);
1659
+ if (_code !== 0x09 && _code !== 0x20) {
1660
+ break;
1661
+ }
1662
+ end -= 1;
1663
+ }
1664
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1696
1665
  }
1697
-
1698
- /**
1699
- * It takes a path, a key, and a boolean, and returns a string
1700
- *
1701
- * @param {string} path - The path to the current key.
1702
- * @param {string} key - The key of the current object being iterated over.
1703
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1704
- *
1705
- * @returns {string} The path to the current key.
1706
- */
1707
- function renderKey(path, key, dots) {
1708
- if (!path) return key;
1709
- return path.concat(key).map(function each(token, i) {
1710
- // eslint-disable-next-line no-param-reassign
1711
- token = removeBrackets(token);
1712
- return !dots && i ? '[' + token + ']' : token;
1713
- }).join(dots ? '.' : '');
1666
+ function normalizeHeader(header) {
1667
+ return header && String(header).trim().toLowerCase();
1714
1668
  }
1715
-
1716
- /**
1717
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1718
- *
1719
- * @param {Array<any>} arr - The array to check
1720
- *
1721
- * @returns {boolean}
1722
- */
1723
- function isFlatArray(arr) {
1724
- return utils$1$1.isArray(arr) && !arr.some(isVisitable);
1669
+ function sanitizeHeaderValue(str) {
1670
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1725
1671
  }
1726
- var predicates = utils$1$1.toFlatObject(utils$1$1, {}, null, function filter(prop) {
1727
- return /^is[A-Z]/.test(prop);
1728
- });
1729
-
1730
- /**
1731
- * Convert a data object to FormData
1732
- *
1733
- * @param {Object} obj
1734
- * @param {?Object} [formData]
1735
- * @param {?Object} [options]
1736
- * @param {Function} [options.visitor]
1737
- * @param {Boolean} [options.metaTokens = true]
1738
- * @param {Boolean} [options.dots = false]
1739
- * @param {?Boolean} [options.indexes = false]
1740
- *
1741
- * @returns {Object}
1742
- **/
1743
-
1744
- /**
1745
- * It converts an object into a FormData object
1746
- *
1747
- * @param {Object<any, any>} obj - The object to convert to form data.
1748
- * @param {string} formData - The FormData object to append to.
1749
- * @param {Object<string, any>} options
1750
- *
1751
- * @returns
1752
- */
1753
- function toFormData(obj, formData, options) {
1754
- if (!utils$1$1.isObject(obj)) {
1755
- throw new TypeError('target must be an object');
1672
+ function normalizeValue(value) {
1673
+ if (value === false || value == null) {
1674
+ return value;
1756
1675
  }
1757
-
1758
- // eslint-disable-next-line no-param-reassign
1759
- formData = formData || new FormData();
1760
-
1761
- // eslint-disable-next-line no-param-reassign
1762
- options = utils$1$1.toFlatObject(options, {
1763
- metaTokens: true,
1764
- dots: false,
1765
- indexes: false
1766
- }, false, function defined(option, source) {
1767
- // eslint-disable-next-line no-eq-null,eqeqeq
1768
- return !utils$1$1.isUndefined(source[option]);
1769
- });
1770
- var metaTokens = options.metaTokens;
1771
- // eslint-disable-next-line no-use-before-define
1772
- var visitor = options.visitor || defaultVisitor;
1773
- var dots = options.dots;
1774
- var indexes = options.indexes;
1775
- var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1776
- var useBlob = _Blob && utils$1$1.isSpecCompliantForm(formData);
1777
- if (!utils$1$1.isFunction(visitor)) {
1778
- throw new TypeError('visitor must be a function');
1676
+ return utils$1$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1677
+ }
1678
+ function parseTokens(str) {
1679
+ var tokens = Object.create(null);
1680
+ var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1681
+ var match;
1682
+ while (match = tokensRE.exec(str)) {
1683
+ tokens[match[1]] = match[2];
1779
1684
  }
1780
- function convertValue(value) {
1781
- if (value === null) return '';
1782
- if (utils$1$1.isDate(value)) {
1783
- return value.toISOString();
1784
- }
1785
- if (utils$1$1.isBoolean(value)) {
1786
- return value.toString();
1787
- }
1788
- if (!useBlob && utils$1$1.isBlob(value)) {
1789
- throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
1790
- }
1791
- if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
1792
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1793
- }
1794
- return value;
1685
+ return tokens;
1686
+ }
1687
+ var isValidHeaderName = function isValidHeaderName(str) {
1688
+ return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1689
+ };
1690
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1691
+ if (utils$1$1.isFunction(filter)) {
1692
+ return filter.call(this, value, header);
1795
1693
  }
1796
-
1797
- /**
1798
- * Default visitor.
1799
- *
1800
- * @param {*} value
1801
- * @param {String|Number} key
1802
- * @param {Array<String|Number>} path
1803
- * @this {FormData}
1804
- *
1805
- * @returns {boolean} return true to visit the each prop of the value recursively
1806
- */
1807
- function defaultVisitor(value, key, path) {
1808
- var arr = value;
1809
- if (utils$1$1.isReactNative(formData) && utils$1$1.isReactNativeBlob(value)) {
1810
- formData.append(renderKey(path, key, dots), convertValue(value));
1811
- return false;
1812
- }
1813
- if (value && !path && _typeof$2(value) === 'object') {
1814
- if (utils$1$1.endsWith(key, '{}')) {
1815
- // eslint-disable-next-line no-param-reassign
1816
- key = metaTokens ? key : key.slice(0, -2);
1817
- // eslint-disable-next-line no-param-reassign
1818
- value = JSON.stringify(value);
1819
- } else if (utils$1$1.isArray(value) && isFlatArray(value) || (utils$1$1.isFileList(value) || utils$1$1.endsWith(key, '[]')) && (arr = utils$1$1.toArray(value))) {
1820
- // eslint-disable-next-line no-param-reassign
1821
- key = removeBrackets(key);
1822
- arr.forEach(function each(el, index) {
1823
- !(utils$1$1.isUndefined(el) || el === null) && formData.append(
1824
- // eslint-disable-next-line no-nested-ternary
1825
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1826
- });
1827
- return false;
1828
- }
1829
- }
1830
- if (isVisitable(value)) {
1831
- return true;
1832
- }
1833
- formData.append(renderKey(path, key, dots), convertValue(value));
1834
- return false;
1694
+ if (isHeaderNameFilter) {
1695
+ value = header;
1835
1696
  }
1836
- var stack = [];
1837
- var exposedHelpers = Object.assign(predicates, {
1838
- defaultVisitor: defaultVisitor,
1839
- convertValue: convertValue,
1840
- isVisitable: isVisitable
1841
- });
1842
- function build(value, path) {
1843
- if (utils$1$1.isUndefined(value)) return;
1844
- if (stack.indexOf(value) !== -1) {
1845
- throw Error('Circular reference detected in ' + path.join('.'));
1846
- }
1847
- stack.push(value);
1848
- utils$1$1.forEach(value, function each(el, key) {
1849
- var result = !(utils$1$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1850
- if (result === true) {
1851
- build(el, path ? path.concat(key) : [key]);
1852
- }
1853
- });
1854
- stack.pop();
1697
+ if (!utils$1$1.isString(value)) return;
1698
+ if (utils$1$1.isString(filter)) {
1699
+ return value.indexOf(filter) !== -1;
1855
1700
  }
1856
- if (!utils$1$1.isObject(obj)) {
1857
- throw new TypeError('data must be an object');
1701
+ if (utils$1$1.isRegExp(filter)) {
1702
+ return filter.test(value);
1858
1703
  }
1859
- build(obj);
1860
- return formData;
1861
1704
  }
1862
-
1863
- /**
1864
- * It encodes a string by replacing all characters that are not in the unreserved set with
1865
- * their percent-encoded equivalents
1866
- *
1867
- * @param {string} str - The string to encode.
1868
- *
1869
- * @returns {string} The encoded string.
1870
- */
1871
- function encode$1(str) {
1872
- var charMap = {
1873
- '!': '%21',
1874
- "'": '%27',
1875
- '(': '%28',
1876
- ')': '%29',
1877
- '~': '%7E',
1878
- '%20': '+',
1879
- '%00': '\x00'
1880
- };
1881
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1882
- return charMap[match];
1705
+ function formatHeader(header) {
1706
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
1707
+ return char.toUpperCase() + str;
1883
1708
  });
1884
1709
  }
1885
-
1886
- /**
1887
- * It takes a params object and converts it to a FormData object
1888
- *
1889
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1890
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1891
- *
1892
- * @returns {void}
1893
- */
1894
- function AxiosURLSearchParams(params, options) {
1895
- this._pairs = [];
1896
- params && toFormData(params, this, options);
1897
- }
1898
- var prototype = AxiosURLSearchParams.prototype;
1899
- prototype.append = function append(name, value) {
1900
- this._pairs.push([name, value]);
1901
- };
1902
- prototype.toString = function toString(encoder) {
1903
- var _encode = encoder ? function (value) {
1904
- return encoder.call(this, value, encode$1);
1905
- } : encode$1;
1906
- return this._pairs.map(function each(pair) {
1907
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1908
- }, '').join('&');
1909
- };
1910
-
1911
- /**
1912
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1913
- * URI encoded counterparts
1914
- *
1915
- * @param {string} val The value to be encoded.
1916
- *
1917
- * @returns {string} The encoded value.
1918
- */
1919
- function encode$2(val) {
1920
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1710
+ function buildAccessors(obj, header) {
1711
+ var accessorName = utils$1$1.toCamelCase(' ' + header);
1712
+ ['get', 'set', 'has'].forEach(function (methodName) {
1713
+ Object.defineProperty(obj, methodName + accessorName, {
1714
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1715
+ // this data descriptor into an accessor descriptor on the way in.
1716
+ __proto__: null,
1717
+ value: function value(arg1, arg2, arg3) {
1718
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1719
+ },
1720
+ configurable: true
1721
+ });
1722
+ });
1921
1723
  }
1922
-
1923
- /**
1924
- * Build a URL by appending params to the end
1925
- *
1926
- * @param {string} url The base of the url (e.g., http://www.google.com)
1927
- * @param {object} [params] The params to be appended
1928
- * @param {?(object|Function)} options
1929
- *
1930
- * @returns {string} The formatted url
1931
- */
1932
- function buildURL(url, params, options) {
1933
- if (!params) {
1934
- return url;
1935
- }
1936
- var _encode = options && options.encode || encode$2;
1937
- var _options = utils$1$1.isFunction(options) ? {
1938
- serialize: options
1939
- } : options;
1940
- var serializeFn = _options && _options.serialize;
1941
- var serializedParams;
1942
- if (serializeFn) {
1943
- serializedParams = serializeFn(params, _options);
1944
- } else {
1945
- serializedParams = utils$1$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1724
+ var AxiosHeaders = /*#__PURE__*/function () {
1725
+ function AxiosHeaders(headers) {
1726
+ _classCallCheck(this, AxiosHeaders);
1727
+ headers && this.set(headers);
1946
1728
  }
1947
- if (serializedParams) {
1948
- var hashmarkIndex = url.indexOf('#');
1949
- if (hashmarkIndex !== -1) {
1950
- url = url.slice(0, hashmarkIndex);
1729
+ return _createClass(AxiosHeaders, [{
1730
+ key: "set",
1731
+ value: function set(header, valueOrRewrite, rewrite) {
1732
+ var self = this;
1733
+ function setHeader(_value, _header, _rewrite) {
1734
+ var lHeader = normalizeHeader(_header);
1735
+ if (!lHeader) {
1736
+ throw new Error('header name must be a non-empty string');
1737
+ }
1738
+ var key = utils$1$1.findKey(self, lHeader);
1739
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1740
+ self[key || _header] = normalizeValue(_value);
1741
+ }
1742
+ }
1743
+ var setHeaders = function setHeaders(headers, _rewrite) {
1744
+ return utils$1$1.forEach(headers, function (_value, _header) {
1745
+ return setHeader(_value, _header, _rewrite);
1746
+ });
1747
+ };
1748
+ if (utils$1$1.isPlainObject(header) || header instanceof this.constructor) {
1749
+ setHeaders(header, valueOrRewrite);
1750
+ } else if (utils$1$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1751
+ setHeaders(parseHeaders(header), valueOrRewrite);
1752
+ } else if (utils$1$1.isObject(header) && utils$1$1.isIterable(header)) {
1753
+ var obj = {},
1754
+ dest,
1755
+ key;
1756
+ var _iterator3 = _createForOfIteratorHelper$3(header),
1757
+ _step2;
1758
+ try {
1759
+ for (_iterator3.s(); !(_step2 = _iterator3.n()).done;) {
1760
+ var entry = _step2.value;
1761
+ if (!utils$1$1.isArray(entry)) {
1762
+ throw TypeError('Object iterator must return a key-value pair');
1763
+ }
1764
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1$1.isArray(dest) ? [].concat(_toConsumableArray$1(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
1765
+ }
1766
+ } catch (err) {
1767
+ _iterator3.e(err);
1768
+ } finally {
1769
+ _iterator3.f();
1770
+ }
1771
+ setHeaders(obj, valueOrRewrite);
1772
+ } else {
1773
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1774
+ }
1775
+ return this;
1951
1776
  }
1952
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1953
- }
1954
- return url;
1955
- }
1956
- var InterceptorManager = /*#__PURE__*/function () {
1957
- function InterceptorManager() {
1958
- _classCallCheck(this, InterceptorManager);
1959
- this.handlers = [];
1960
- }
1961
-
1962
- /**
1963
- * Add a new interceptor to the stack
1964
- *
1965
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1966
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1967
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1968
- *
1969
- * @return {Number} An ID used to remove interceptor later
1970
- */
1971
- return _createClass(InterceptorManager, [{
1972
- key: "use",
1973
- value: function use(fulfilled, rejected, options) {
1974
- this.handlers.push({
1975
- fulfilled: fulfilled,
1976
- rejected: rejected,
1977
- synchronous: options ? options.synchronous : false,
1978
- runWhen: options ? options.runWhen : null
1979
- });
1980
- return this.handlers.length - 1;
1777
+ }, {
1778
+ key: "get",
1779
+ value: function get(header, parser) {
1780
+ header = normalizeHeader(header);
1781
+ if (header) {
1782
+ var key = utils$1$1.findKey(this, header);
1783
+ if (key) {
1784
+ var value = this[key];
1785
+ if (!parser) {
1786
+ return value;
1787
+ }
1788
+ if (parser === true) {
1789
+ return parseTokens(value);
1790
+ }
1791
+ if (utils$1$1.isFunction(parser)) {
1792
+ return parser.call(this, value, key);
1793
+ }
1794
+ if (utils$1$1.isRegExp(parser)) {
1795
+ return parser.exec(value);
1796
+ }
1797
+ throw new TypeError('parser must be boolean|regexp|function');
1798
+ }
1799
+ }
1981
1800
  }
1982
-
1983
- /**
1984
- * Remove an interceptor from the stack
1985
- *
1986
- * @param {Number} id The ID that was returned by `use`
1987
- *
1988
- * @returns {void}
1989
- */
1990
1801
  }, {
1991
- key: "eject",
1992
- value: function eject(id) {
1993
- if (this.handlers[id]) {
1994
- this.handlers[id] = null;
1802
+ key: "has",
1803
+ value: function has(header, matcher) {
1804
+ header = normalizeHeader(header);
1805
+ if (header) {
1806
+ var key = utils$1$1.findKey(this, header);
1807
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1995
1808
  }
1809
+ return false;
1810
+ }
1811
+ }, {
1812
+ key: "delete",
1813
+ value: function _delete(header, matcher) {
1814
+ var self = this;
1815
+ var deleted = false;
1816
+ function deleteHeader(_header) {
1817
+ _header = normalizeHeader(_header);
1818
+ if (_header) {
1819
+ var key = utils$1$1.findKey(self, _header);
1820
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1821
+ delete self[key];
1822
+ deleted = true;
1823
+ }
1824
+ }
1825
+ }
1826
+ if (utils$1$1.isArray(header)) {
1827
+ header.forEach(deleteHeader);
1828
+ } else {
1829
+ deleteHeader(header);
1830
+ }
1831
+ return deleted;
1996
1832
  }
1997
-
1998
- /**
1999
- * Clear all interceptors from the stack
2000
- *
2001
- * @returns {void}
2002
- */
2003
1833
  }, {
2004
1834
  key: "clear",
2005
- value: function clear() {
2006
- if (this.handlers) {
2007
- this.handlers = [];
1835
+ value: function clear(matcher) {
1836
+ var keys = Object.keys(this);
1837
+ var i = keys.length;
1838
+ var deleted = false;
1839
+ while (i--) {
1840
+ var key = keys[i];
1841
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1842
+ delete this[key];
1843
+ deleted = true;
1844
+ }
2008
1845
  }
1846
+ return deleted;
2009
1847
  }
2010
-
2011
- /**
2012
- * Iterate over all the registered interceptors
2013
- *
2014
- * This method is particularly useful for skipping over any
2015
- * interceptors that may have become `null` calling `eject`.
2016
- *
2017
- * @param {Function} fn The function to call for each interceptor
2018
- *
2019
- * @returns {void}
2020
- */
2021
1848
  }, {
2022
- key: "forEach",
2023
- value: function forEach(fn) {
2024
- utils$1$1.forEach(this.handlers, function forEachHandler(h) {
2025
- if (h !== null) {
2026
- fn(h);
1849
+ key: "normalize",
1850
+ value: function normalize(format) {
1851
+ var self = this;
1852
+ var headers = {};
1853
+ utils$1$1.forEach(this, function (value, header) {
1854
+ var key = utils$1$1.findKey(headers, header);
1855
+ if (key) {
1856
+ self[key] = normalizeValue(value);
1857
+ delete self[header];
1858
+ return;
1859
+ }
1860
+ var normalized = format ? formatHeader(header) : String(header).trim();
1861
+ if (normalized !== header) {
1862
+ delete self[header];
2027
1863
  }
1864
+ self[normalized] = normalizeValue(value);
1865
+ headers[normalized] = true;
2028
1866
  });
1867
+ return this;
2029
1868
  }
2030
- }]);
2031
- }();
2032
- var InterceptorManager$1 = InterceptorManager;
2033
- var transitionalDefaults = {
2034
- silentJSONParsing: true,
2035
- forcedJSONParsing: true,
2036
- clarifyTimeoutError: false,
2037
- legacyInterceptorReqResOrdering: true
2038
- };
2039
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2040
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2041
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2042
- var platform$1 = {
2043
- isBrowser: true,
2044
- classes: {
2045
- URLSearchParams: URLSearchParams$1,
2046
- FormData: FormData$1,
2047
- Blob: Blob$1
2048
- },
2049
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2050
- };
2051
- var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2052
- var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === 'object' && navigator || undefined;
2053
-
2054
- /**
2055
- * Determine if we're running in a standard browser environment
2056
- *
2057
- * This allows axios to run in a web worker, and react-native.
2058
- * Both environments support XMLHttpRequest, but not fully standard globals.
2059
- *
2060
- * web workers:
2061
- * typeof window -> undefined
2062
- * typeof document -> undefined
2063
- *
2064
- * react-native:
2065
- * navigator.product -> 'ReactNative'
2066
- * nativescript
2067
- * navigator.product -> 'NativeScript' or 'NS'
2068
- *
2069
- * @returns {boolean}
2070
- */
2071
- var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2072
-
2073
- /**
2074
- * Determine if we're running in a standard browser webWorker environment
2075
- *
2076
- * Although the `isStandardBrowserEnv` method indicates that
2077
- * `allows axios to run in a web worker`, the WebWorker will still be
2078
- * filtered out due to its judgment standard
2079
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2080
- * This leads to a problem when axios post `FormData` in webWorker
2081
- */
2082
- var hasStandardBrowserWebWorkerEnv = function () {
2083
- return typeof WorkerGlobalScope !== 'undefined' &&
2084
- // eslint-disable-next-line no-undef
2085
- self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1869
+ }, {
1870
+ key: "concat",
1871
+ value: function concat() {
1872
+ var _this$constructor;
1873
+ for (var _len2 = arguments.length, targets = new Array(_len2), _key3 = 0; _key3 < _len2; _key3++) {
1874
+ targets[_key3] = arguments[_key3];
1875
+ }
1876
+ return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
1877
+ }
1878
+ }, {
1879
+ key: "toJSON",
1880
+ value: function toJSON(asStrings) {
1881
+ var obj = Object.create(null);
1882
+ utils$1$1.forEach(this, function (value, header) {
1883
+ value != null && value !== false && (obj[header] = asStrings && utils$1$1.isArray(value) ? value.join(', ') : value);
1884
+ });
1885
+ return obj;
1886
+ }
1887
+ }, {
1888
+ key: Symbol.iterator,
1889
+ value: function value() {
1890
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1891
+ }
1892
+ }, {
1893
+ key: "toString",
1894
+ value: function toString() {
1895
+ return Object.entries(this.toJSON()).map(function (_ref8) {
1896
+ var _ref9 = _slicedToArray$1(_ref8, 2),
1897
+ header = _ref9[0],
1898
+ value = _ref9[1];
1899
+ return header + ': ' + value;
1900
+ }).join('\n');
1901
+ }
1902
+ }, {
1903
+ key: "getSetCookie",
1904
+ value: function getSetCookie() {
1905
+ return this.get('set-cookie') || [];
1906
+ }
1907
+ }, {
1908
+ key: Symbol.toStringTag,
1909
+ get: function get() {
1910
+ return 'AxiosHeaders';
1911
+ }
1912
+ }], [{
1913
+ key: "from",
1914
+ value: function from(thing) {
1915
+ return thing instanceof this ? thing : new this(thing);
1916
+ }
1917
+ }, {
1918
+ key: "concat",
1919
+ value: function concat(first) {
1920
+ var computed = new this(first);
1921
+ for (var _len3 = arguments.length, targets = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
1922
+ targets[_key4 - 1] = arguments[_key4];
1923
+ }
1924
+ targets.forEach(function (target) {
1925
+ return computed.set(target);
1926
+ });
1927
+ return computed;
1928
+ }
1929
+ }, {
1930
+ key: "accessor",
1931
+ value: function accessor(header) {
1932
+ var internals = this[$internals] = this[$internals] = {
1933
+ accessors: {}
1934
+ };
1935
+ var accessors = internals.accessors;
1936
+ var prototype = this.prototype;
1937
+ function defineAccessor(_header) {
1938
+ var lHeader = normalizeHeader(_header);
1939
+ if (!accessors[lHeader]) {
1940
+ buildAccessors(prototype, _header);
1941
+ accessors[lHeader] = true;
1942
+ }
1943
+ }
1944
+ utils$1$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1945
+ return this;
1946
+ }
1947
+ }]);
2086
1948
  }();
2087
- var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2088
- var utils$3 = /*#__PURE__*/Object.freeze({
2089
- __proto__: null,
2090
- hasBrowserEnv: hasBrowserEnv,
2091
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2092
- hasStandardBrowserEnv: hasStandardBrowserEnv,
2093
- navigator: _navigator,
2094
- origin: origin
1949
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1950
+
1951
+ // reserved names hotfix
1952
+ utils$1$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref10, key) {
1953
+ var value = _ref10.value;
1954
+ var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1955
+ return {
1956
+ get: function get() {
1957
+ return value;
1958
+ },
1959
+ set: function set(headerValue) {
1960
+ this[mapped] = headerValue;
1961
+ }
1962
+ };
2095
1963
  });
2096
- var platform = _objectSpread$2(_objectSpread$2({}, utils$3), platform$1);
2097
- function toURLEncodedForm(data, options) {
2098
- return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$2({
2099
- visitor: function visitor(value, key, path, helpers) {
2100
- if (platform.isNode && utils$1$1.isBuffer(value)) {
2101
- this.append(key, value.toString('base64'));
2102
- return false;
1964
+ utils$1$1.freezeMethods(AxiosHeaders);
1965
+ var REDACTED = '[REDACTED ****]';
1966
+ function hasOwnOrPrototypeToJSON(source) {
1967
+ if (utils$1$1.hasOwnProp(source, 'toJSON')) {
1968
+ return true;
1969
+ }
1970
+ var prototype = Object.getPrototypeOf(source);
1971
+ while (prototype && prototype !== Object.prototype) {
1972
+ if (utils$1$1.hasOwnProp(prototype, 'toJSON')) {
1973
+ return true;
1974
+ }
1975
+ prototype = Object.getPrototypeOf(prototype);
1976
+ }
1977
+ return false;
1978
+ }
1979
+
1980
+ // Build a plain-object snapshot of `config` and replace the value of any key
1981
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
1982
+ // and AxiosHeaders, and short-circuits on circular references.
1983
+ function redactConfig(config, redactKeys) {
1984
+ var lowerKeys = new Set(redactKeys.map(function (k) {
1985
+ return String(k).toLowerCase();
1986
+ }));
1987
+ var seen = [];
1988
+ var _visit2 = function visit(source) {
1989
+ if (source === null || _typeof$2(source) !== 'object') return source;
1990
+ if (utils$1$1.isBuffer(source)) return source;
1991
+ if (seen.indexOf(source) !== -1) return undefined;
1992
+ if (source instanceof AxiosHeaders) {
1993
+ source = source.toJSON();
1994
+ }
1995
+ seen.push(source);
1996
+ var result;
1997
+ if (utils$1$1.isArray(source)) {
1998
+ result = [];
1999
+ source.forEach(function (v, i) {
2000
+ var reducedValue = _visit2(v);
2001
+ if (!utils$1$1.isUndefined(reducedValue)) {
2002
+ result[i] = reducedValue;
2003
+ }
2004
+ });
2005
+ } else {
2006
+ if (!utils$1$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
2007
+ seen.pop();
2008
+ return source;
2009
+ }
2010
+ result = Object.create(null);
2011
+ for (var _i = 0, _Object$entries = Object.entries(source); _i < _Object$entries.length; _i++) {
2012
+ var _Object$entries$_i = _slicedToArray$1(_Object$entries[_i], 2),
2013
+ key = _Object$entries$_i[0],
2014
+ value = _Object$entries$_i[1];
2015
+ var reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : _visit2(value);
2016
+ if (!utils$1$1.isUndefined(reducedValue)) {
2017
+ result[key] = reducedValue;
2018
+ }
2103
2019
  }
2104
- return helpers.defaultVisitor.apply(this, arguments);
2105
2020
  }
2106
- }, options));
2021
+ seen.pop();
2022
+ return result;
2023
+ };
2024
+ return _visit2(config);
2107
2025
  }
2026
+ var AxiosError = /*#__PURE__*/function (_Error) {
2027
+ /**
2028
+ * Create an Error with the specified message, config, error code, request and response.
2029
+ *
2030
+ * @param {string} message The error message.
2031
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
2032
+ * @param {Object} [config] The config.
2033
+ * @param {Object} [request] The request.
2034
+ * @param {Object} [response] The response.
2035
+ *
2036
+ * @returns {Error} The created error.
2037
+ */
2038
+ function AxiosError(message, code, config, request, response) {
2039
+ var _this;
2040
+ _classCallCheck(this, AxiosError);
2041
+ _this = _callSuper$3(this, AxiosError, [message]);
2042
+
2043
+ // Make message enumerable to maintain backward compatibility
2044
+ // The native Error constructor sets message as non-enumerable,
2045
+ // but axios < v1.13.3 had it as enumerable
2046
+ Object.defineProperty(_this, 'message', {
2047
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2048
+ // this data descriptor into an accessor descriptor on the way in.
2049
+ __proto__: null,
2050
+ value: message,
2051
+ enumerable: true,
2052
+ writable: true,
2053
+ configurable: true
2054
+ });
2055
+ _this.name = 'AxiosError';
2056
+ _this.isAxiosError = true;
2057
+ code && (_this.code = code);
2058
+ config && (_this.config = config);
2059
+ request && (_this.request = request);
2060
+ if (response) {
2061
+ _this.response = response;
2062
+ _this.status = response.status;
2063
+ }
2064
+ return _this;
2065
+ }
2066
+ _inherits(AxiosError, _Error);
2067
+ return _createClass(AxiosError, [{
2068
+ key: "toJSON",
2069
+ value: function toJSON() {
2070
+ // Opt-in redaction: when the request config carries a `redact` array, the
2071
+ // value of any matching key (case-insensitive, at any depth) is replaced
2072
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
2073
+ // existing serialization behavior unchanged.
2074
+ var config = this.config;
2075
+ var redactKeys = config && utils$1$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
2076
+ var serializedConfig = utils$1$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1$1.toJSONObject(config);
2077
+ return {
2078
+ // Standard
2079
+ message: this.message,
2080
+ name: this.name,
2081
+ // Microsoft
2082
+ description: this.description,
2083
+ number: this.number,
2084
+ // Mozilla
2085
+ fileName: this.fileName,
2086
+ lineNumber: this.lineNumber,
2087
+ columnNumber: this.columnNumber,
2088
+ stack: this.stack,
2089
+ // Axios
2090
+ config: serializedConfig,
2091
+ code: this.code,
2092
+ status: this.status
2093
+ };
2094
+ }
2095
+ }], [{
2096
+ key: "from",
2097
+ value: function from(error, code, config, request, response, customProps) {
2098
+ var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
2099
+ axiosError.cause = error;
2100
+ axiosError.name = error.name;
2101
+
2102
+ // Preserve status from the original error if not already set from response
2103
+ if (error.status != null && axiosError.status == null) {
2104
+ axiosError.status = error.status;
2105
+ }
2106
+ customProps && Object.assign(axiosError, customProps);
2107
+ return axiosError;
2108
+ }
2109
+ }]);
2110
+ }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
2111
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
2112
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
2113
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
2114
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
2115
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
2116
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
2117
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
2118
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
2119
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
2120
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
2121
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
2122
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
2123
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
2124
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
2125
+
2126
+ // eslint-disable-next-line strict
2127
+ var httpAdapter = null;
2108
2128
 
2109
2129
  /**
2110
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2130
+ * Determines if the given thing is a array or js object.
2111
2131
  *
2112
- * @param {string} name - The name of the property to get.
2132
+ * @param {string} thing - The object or array to be visited.
2113
2133
  *
2114
- * @returns An array of strings.
2134
+ * @returns {boolean}
2115
2135
  */
2116
- function parsePropPath(name) {
2117
- // foo[x][y][z]
2118
- // foo.x.y.z
2119
- // foo-x-y-z
2120
- // foo x y z
2121
- return utils$1$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2122
- return match[0] === '[]' ? '' : match[1] || match[0];
2123
- });
2136
+ function isVisitable(thing) {
2137
+ return utils$1$1.isPlainObject(thing) || utils$1$1.isArray(thing);
2124
2138
  }
2125
2139
 
2126
2140
  /**
2127
- * Convert an array to an object.
2141
+ * It removes the brackets from the end of a string
2128
2142
  *
2129
- * @param {Array<any>} arr - The array to convert to an object.
2143
+ * @param {string} key - The key of the parameter.
2130
2144
  *
2131
- * @returns An object with the same keys and values as the array.
2145
+ * @returns {string} the key without the brackets.
2132
2146
  */
2133
- function arrayToObject$1(arr) {
2134
- var obj = {};
2135
- var keys = Object.keys(arr);
2136
- var i;
2137
- var len = keys.length;
2138
- var key;
2139
- for (i = 0; i < len; i++) {
2140
- key = keys[i];
2141
- obj[key] = arr[key];
2142
- }
2143
- return obj;
2144
- }
2147
+ function removeBrackets(key) {
2148
+ return utils$1$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
2149
+ }
2145
2150
 
2146
2151
  /**
2147
- * It takes a FormData object and returns a JavaScript object
2152
+ * It takes a path, a key, and a boolean, and returns a string
2148
2153
  *
2149
- * @param {string} formData The FormData object to convert to JSON.
2154
+ * @param {string} path - The path to the current key.
2155
+ * @param {string} key - The key of the current object being iterated over.
2156
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
2150
2157
  *
2151
- * @returns {Object<string, any> | null} The converted object.
2158
+ * @returns {string} The path to the current key.
2152
2159
  */
2153
- function formDataToJSON(formData) {
2154
- function buildPath(path, value, target, index) {
2155
- var name = path[index++];
2156
- if (name === '__proto__') return true;
2157
- var isNumericKey = Number.isFinite(+name);
2158
- var isLast = index >= path.length;
2159
- name = !name && utils$1$1.isArray(target) ? target.length : name;
2160
- if (isLast) {
2161
- if (utils$1$1.hasOwnProp(target, name)) {
2162
- target[name] = [target[name], value];
2163
- } else {
2164
- target[name] = value;
2165
- }
2166
- return !isNumericKey;
2167
- }
2168
- if (!target[name] || !utils$1$1.isObject(target[name])) {
2169
- target[name] = [];
2170
- }
2171
- var result = buildPath(path, value, target[name], index);
2172
- if (result && utils$1$1.isArray(target[name])) {
2173
- target[name] = arrayToObject$1(target[name]);
2174
- }
2175
- return !isNumericKey;
2176
- }
2177
- if (utils$1$1.isFormData(formData) && utils$1$1.isFunction(formData.entries)) {
2178
- var obj = {};
2179
- utils$1$1.forEachEntry(formData, function (name, value) {
2180
- buildPath(parsePropPath(name), value, obj, 0);
2181
- });
2182
- return obj;
2183
- }
2184
- return null;
2160
+ function renderKey(path, key, dots) {
2161
+ if (!path) return key;
2162
+ return path.concat(key).map(function each(token, i) {
2163
+ // eslint-disable-next-line no-param-reassign
2164
+ token = removeBrackets(token);
2165
+ return !dots && i ? '[' + token + ']' : token;
2166
+ }).join(dots ? '.' : '');
2185
2167
  }
2186
2168
 
2187
2169
  /**
2188
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2189
- * of the input
2170
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
2190
2171
  *
2191
- * @param {any} rawValue - The value to be stringified.
2192
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2193
- * @param {Function} encoder - A function that takes a value and returns a string.
2172
+ * @param {Array<any>} arr - The array to check
2194
2173
  *
2195
- * @returns {string} A stringified version of the rawValue.
2174
+ * @returns {boolean}
2196
2175
  */
2197
- function stringifySafely(rawValue, parser, encoder) {
2198
- if (utils$1$1.isString(rawValue)) {
2199
- try {
2200
- (parser || JSON.parse)(rawValue);
2201
- return utils$1$1.trim(rawValue);
2202
- } catch (e) {
2203
- if (e.name !== 'SyntaxError') {
2204
- throw e;
2205
- }
2206
- }
2207
- }
2208
- return (encoder || JSON.stringify)(rawValue);
2176
+ function isFlatArray(arr) {
2177
+ return utils$1$1.isArray(arr) && !arr.some(isVisitable);
2209
2178
  }
2210
- var defaults$2 = {
2211
- transitional: transitionalDefaults,
2212
- adapter: ['xhr', 'http', 'fetch'],
2213
- transformRequest: [function transformRequest(data, headers) {
2214
- var contentType = headers.getContentType() || '';
2215
- var hasJSONContentType = contentType.indexOf('application/json') > -1;
2216
- var isObjectPayload = utils$1$1.isObject(data);
2217
- if (isObjectPayload && utils$1$1.isHTMLForm(data)) {
2218
- data = new FormData(data);
2219
- }
2220
- var isFormData = utils$1$1.isFormData(data);
2221
- if (isFormData) {
2222
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2223
- }
2224
- if (utils$1$1.isArrayBuffer(data) || utils$1$1.isBuffer(data) || utils$1$1.isStream(data) || utils$1$1.isFile(data) || utils$1$1.isBlob(data) || utils$1$1.isReadableStream(data)) {
2225
- return data;
2226
- }
2227
- if (utils$1$1.isArrayBufferView(data)) {
2228
- return data.buffer;
2229
- }
2230
- if (utils$1$1.isURLSearchParams(data)) {
2231
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2232
- return data.toString();
2233
- }
2234
- var isFileList;
2235
- if (isObjectPayload) {
2236
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2237
- return toURLEncodedForm(data, this.formSerializer).toString();
2238
- }
2239
- if ((isFileList = utils$1$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2240
- var _FormData = this.env && this.env.FormData;
2241
- return toFormData(isFileList ? {
2242
- 'files[]': data
2243
- } : data, _FormData && new _FormData(), this.formSerializer);
2244
- }
2245
- }
2246
- if (isObjectPayload || hasJSONContentType) {
2247
- headers.setContentType('application/json', false);
2248
- return stringifySafely(data);
2249
- }
2250
- return data;
2251
- }],
2252
- transformResponse: [function transformResponse(data) {
2253
- var transitional = this.transitional || defaults$2.transitional;
2254
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2255
- var JSONRequested = this.responseType === 'json';
2256
- if (utils$1$1.isResponse(data) || utils$1$1.isReadableStream(data)) {
2257
- return data;
2258
- }
2259
- if (data && utils$1$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2260
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
2261
- var strictJSONParsing = !silentJSONParsing && JSONRequested;
2262
- try {
2263
- return JSON.parse(data, this.parseReviver);
2264
- } catch (e) {
2265
- if (strictJSONParsing) {
2266
- if (e.name === 'SyntaxError') {
2267
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
2268
- }
2269
- throw e;
2270
- }
2271
- }
2272
- }
2273
- return data;
2274
- }],
2275
- /**
2276
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2277
- * timeout is not created.
2278
- */
2279
- timeout: 0,
2280
- xsrfCookieName: 'XSRF-TOKEN',
2281
- xsrfHeaderName: 'X-XSRF-TOKEN',
2282
- maxContentLength: -1,
2283
- maxBodyLength: -1,
2284
- env: {
2285
- FormData: platform.classes.FormData,
2286
- Blob: platform.classes.Blob
2287
- },
2288
- validateStatus: function validateStatus(status) {
2289
- return status >= 200 && status < 300;
2290
- },
2291
- headers: {
2292
- common: {
2293
- Accept: 'application/json, text/plain, */*',
2294
- 'Content-Type': undefined
2295
- }
2296
- }
2297
- };
2298
- utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
2299
- defaults$2.headers[method] = {};
2179
+ var predicates = utils$1$1.toFlatObject(utils$1$1, {}, null, function filter(prop) {
2180
+ return /^is[A-Z]/.test(prop);
2300
2181
  });
2301
- var defaults$1$1 = defaults$2;
2302
-
2303
- // RawAxiosHeaders whose duplicates are ignored by node
2304
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2305
- var ignoreDuplicateOf = utils$1$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
2306
2182
 
2307
2183
  /**
2308
- * Parse headers into an object
2184
+ * Convert a data object to FormData
2309
2185
  *
2310
- * ```
2311
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
2312
- * Content-Type: application/json
2313
- * Connection: keep-alive
2314
- * Transfer-Encoding: chunked
2315
- * ```
2186
+ * @param {Object} obj
2187
+ * @param {?Object} [formData]
2188
+ * @param {?Object} [options]
2189
+ * @param {Function} [options.visitor]
2190
+ * @param {Boolean} [options.metaTokens = true]
2191
+ * @param {Boolean} [options.dots = false]
2192
+ * @param {?Boolean} [options.indexes = false]
2316
2193
  *
2317
- * @param {String} rawHeaders Headers needing to be parsed
2194
+ * @returns {Object}
2195
+ **/
2196
+
2197
+ /**
2198
+ * It converts an object into a FormData object
2318
2199
  *
2319
- * @returns {Object} Headers parsed into an object
2200
+ * @param {Object<any, any>} obj - The object to convert to form data.
2201
+ * @param {string} formData - The FormData object to append to.
2202
+ * @param {Object<string, any>} options
2203
+ *
2204
+ * @returns
2320
2205
  */
2321
- var parseHeaders = function parseHeaders(rawHeaders) {
2322
- var parsed = {};
2323
- var key;
2324
- var val;
2325
- var i;
2326
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2327
- i = line.indexOf(':');
2328
- key = line.substring(0, i).trim().toLowerCase();
2329
- val = line.substring(i + 1).trim();
2330
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2331
- return;
2206
+ function toFormData(obj, formData, options) {
2207
+ if (!utils$1$1.isObject(obj)) {
2208
+ throw new TypeError('target must be an object');
2209
+ }
2210
+
2211
+ // eslint-disable-next-line no-param-reassign
2212
+ formData = formData || new FormData();
2213
+
2214
+ // eslint-disable-next-line no-param-reassign
2215
+ options = utils$1$1.toFlatObject(options, {
2216
+ metaTokens: true,
2217
+ dots: false,
2218
+ indexes: false
2219
+ }, false, function defined(option, source) {
2220
+ // eslint-disable-next-line no-eq-null,eqeqeq
2221
+ return !utils$1$1.isUndefined(source[option]);
2222
+ });
2223
+ var metaTokens = options.metaTokens;
2224
+ // eslint-disable-next-line no-use-before-define
2225
+ var visitor = options.visitor || defaultVisitor;
2226
+ var dots = options.dots;
2227
+ var indexes = options.indexes;
2228
+ var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2229
+ var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2230
+ var useBlob = _Blob && utils$1$1.isSpecCompliantForm(formData);
2231
+ if (!utils$1$1.isFunction(visitor)) {
2232
+ throw new TypeError('visitor must be a function');
2233
+ }
2234
+ function convertValue(value) {
2235
+ if (value === null) return '';
2236
+ if (utils$1$1.isDate(value)) {
2237
+ return value.toISOString();
2332
2238
  }
2333
- if (key === 'set-cookie') {
2334
- if (parsed[key]) {
2335
- parsed[key].push(val);
2336
- } else {
2337
- parsed[key] = [val];
2338
- }
2339
- } else {
2340
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2239
+ if (utils$1$1.isBoolean(value)) {
2240
+ return value.toString();
2241
+ }
2242
+ if (!useBlob && utils$1$1.isBlob(value)) {
2243
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
2244
+ }
2245
+ if (utils$1$1.isArrayBuffer(value) || utils$1$1.isTypedArray(value)) {
2246
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2341
2247
  }
2342
- });
2343
- return parsed;
2344
- };
2345
- var $internals = Symbol('internals');
2346
- function normalizeHeader(header) {
2347
- return header && String(header).trim().toLowerCase();
2348
- }
2349
- function normalizeValue(value) {
2350
- if (value === false || value == null) {
2351
2248
  return value;
2352
2249
  }
2353
- return utils$1$1.isArray(value) ? value.map(normalizeValue) : String(value);
2354
- }
2355
- function parseTokens(str) {
2356
- var tokens = Object.create(null);
2357
- var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2358
- var match;
2359
- while (match = tokensRE.exec(str)) {
2360
- tokens[match[1]] = match[2];
2361
- }
2362
- return tokens;
2363
- }
2364
- var isValidHeaderName = function isValidHeaderName(str) {
2365
- return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2366
- };
2367
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2368
- if (utils$1$1.isFunction(filter)) {
2369
- return filter.call(this, value, header);
2370
- }
2371
- if (isHeaderNameFilter) {
2372
- value = header;
2250
+
2251
+ /**
2252
+ * Default visitor.
2253
+ *
2254
+ * @param {*} value
2255
+ * @param {String|Number} key
2256
+ * @param {Array<String|Number>} path
2257
+ * @this {FormData}
2258
+ *
2259
+ * @returns {boolean} return true to visit the each prop of the value recursively
2260
+ */
2261
+ function defaultVisitor(value, key, path) {
2262
+ var arr = value;
2263
+ if (utils$1$1.isReactNative(formData) && utils$1$1.isReactNativeBlob(value)) {
2264
+ formData.append(renderKey(path, key, dots), convertValue(value));
2265
+ return false;
2266
+ }
2267
+ if (value && !path && _typeof$2(value) === 'object') {
2268
+ if (utils$1$1.endsWith(key, '{}')) {
2269
+ // eslint-disable-next-line no-param-reassign
2270
+ key = metaTokens ? key : key.slice(0, -2);
2271
+ // eslint-disable-next-line no-param-reassign
2272
+ value = JSON.stringify(value);
2273
+ } else if (utils$1$1.isArray(value) && isFlatArray(value) || (utils$1$1.isFileList(value) || utils$1$1.endsWith(key, '[]')) && (arr = utils$1$1.toArray(value))) {
2274
+ // eslint-disable-next-line no-param-reassign
2275
+ key = removeBrackets(key);
2276
+ arr.forEach(function each(el, index) {
2277
+ !(utils$1$1.isUndefined(el) || el === null) && formData.append(
2278
+ // eslint-disable-next-line no-nested-ternary
2279
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2280
+ });
2281
+ return false;
2282
+ }
2283
+ }
2284
+ if (isVisitable(value)) {
2285
+ return true;
2286
+ }
2287
+ formData.append(renderKey(path, key, dots), convertValue(value));
2288
+ return false;
2373
2289
  }
2374
- if (!utils$1$1.isString(value)) return;
2375
- if (utils$1$1.isString(filter)) {
2376
- return value.indexOf(filter) !== -1;
2290
+ var stack = [];
2291
+ var exposedHelpers = Object.assign(predicates, {
2292
+ defaultVisitor: defaultVisitor,
2293
+ convertValue: convertValue,
2294
+ isVisitable: isVisitable
2295
+ });
2296
+ function build(value, path) {
2297
+ var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2298
+ if (utils$1$1.isUndefined(value)) return;
2299
+ if (depth > maxDepth) {
2300
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2301
+ }
2302
+ if (stack.indexOf(value) !== -1) {
2303
+ throw Error('Circular reference detected in ' + path.join('.'));
2304
+ }
2305
+ stack.push(value);
2306
+ utils$1$1.forEach(value, function each(el, key) {
2307
+ var result = !(utils$1$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1$1.isString(key) ? key.trim() : key, path, exposedHelpers);
2308
+ if (result === true) {
2309
+ build(el, path ? path.concat(key) : [key], depth + 1);
2310
+ }
2311
+ });
2312
+ stack.pop();
2377
2313
  }
2378
- if (utils$1$1.isRegExp(filter)) {
2379
- return filter.test(value);
2314
+ if (!utils$1$1.isObject(obj)) {
2315
+ throw new TypeError('data must be an object');
2380
2316
  }
2317
+ build(obj);
2318
+ return formData;
2381
2319
  }
2382
- function formatHeader(header) {
2383
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, char, str) {
2384
- return char.toUpperCase() + str;
2320
+
2321
+ /**
2322
+ * It encodes a string by replacing all characters that are not in the unreserved set with
2323
+ * their percent-encoded equivalents
2324
+ *
2325
+ * @param {string} str - The string to encode.
2326
+ *
2327
+ * @returns {string} The encoded string.
2328
+ */
2329
+ function encode$1(str) {
2330
+ var charMap = {
2331
+ '!': '%21',
2332
+ "'": '%27',
2333
+ '(': '%28',
2334
+ ')': '%29',
2335
+ '~': '%7E',
2336
+ '%20': '+'
2337
+ };
2338
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
2339
+ return charMap[match];
2385
2340
  });
2386
2341
  }
2387
- function buildAccessors(obj, header) {
2388
- var accessorName = utils$1$1.toCamelCase(' ' + header);
2389
- ['get', 'set', 'has'].forEach(function (methodName) {
2390
- Object.defineProperty(obj, methodName + accessorName, {
2391
- value: function value(arg1, arg2, arg3) {
2392
- return this[methodName].call(this, header, arg1, arg2, arg3);
2393
- },
2394
- configurable: true
2395
- });
2396
- });
2342
+
2343
+ /**
2344
+ * It takes a params object and converts it to a FormData object
2345
+ *
2346
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2347
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2348
+ *
2349
+ * @returns {void}
2350
+ */
2351
+ function AxiosURLSearchParams(params, options) {
2352
+ this._pairs = [];
2353
+ params && toFormData(params, this, options);
2397
2354
  }
2398
- var AxiosHeaders = /*#__PURE__*/function () {
2399
- function AxiosHeaders(headers) {
2400
- _classCallCheck(this, AxiosHeaders);
2401
- headers && this.set(headers);
2355
+ var prototype = AxiosURLSearchParams.prototype;
2356
+ prototype.append = function append(name, value) {
2357
+ this._pairs.push([name, value]);
2358
+ };
2359
+ prototype.toString = function toString(encoder) {
2360
+ var _encode = encoder ? function (value) {
2361
+ return encoder.call(this, value, encode$1);
2362
+ } : encode$1;
2363
+ return this._pairs.map(function each(pair) {
2364
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
2365
+ }, '').join('&');
2366
+ };
2367
+
2368
+ /**
2369
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
2370
+ * their plain counterparts (`:`, `$`, `,`, `+`).
2371
+ *
2372
+ * @param {string} val The value to be encoded.
2373
+ *
2374
+ * @returns {string} The encoded value.
2375
+ */
2376
+ function encode$2(val) {
2377
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
2378
+ }
2379
+
2380
+ /**
2381
+ * Build a URL by appending params to the end
2382
+ *
2383
+ * @param {string} url The base of the url (e.g., http://www.google.com)
2384
+ * @param {object} [params] The params to be appended
2385
+ * @param {?(object|Function)} options
2386
+ *
2387
+ * @returns {string} The formatted url
2388
+ */
2389
+ function buildURL(url, params, options) {
2390
+ if (!params) {
2391
+ return url;
2402
2392
  }
2403
- return _createClass(AxiosHeaders, [{
2404
- key: "set",
2405
- value: function set(header, valueOrRewrite, rewrite) {
2406
- var self = this;
2407
- function setHeader(_value, _header, _rewrite) {
2408
- var lHeader = normalizeHeader(_header);
2409
- if (!lHeader) {
2410
- throw new Error('header name must be a non-empty string');
2411
- }
2412
- var key = utils$1$1.findKey(self, lHeader);
2413
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2414
- self[key || _header] = normalizeValue(_value);
2415
- }
2416
- }
2417
- var setHeaders = function setHeaders(headers, _rewrite) {
2418
- return utils$1$1.forEach(headers, function (_value, _header) {
2419
- return setHeader(_value, _header, _rewrite);
2420
- });
2421
- };
2422
- if (utils$1$1.isPlainObject(header) || header instanceof this.constructor) {
2423
- setHeaders(header, valueOrRewrite);
2424
- } else if (utils$1$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2425
- setHeaders(parseHeaders(header), valueOrRewrite);
2426
- } else if (utils$1$1.isObject(header) && utils$1$1.isIterable(header)) {
2427
- var obj = {},
2428
- dest,
2429
- key;
2430
- var _iterator3 = _createForOfIteratorHelper$3(header),
2431
- _step2;
2432
- try {
2433
- for (_iterator3.s(); !(_step2 = _iterator3.n()).done;) {
2434
- var entry = _step2.value;
2435
- if (!utils$1$1.isArray(entry)) {
2436
- throw TypeError('Object iterator must return a key-value pair');
2437
- }
2438
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1$1.isArray(dest) ? [].concat(_toConsumableArray$1(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
2439
- }
2440
- } catch (err) {
2441
- _iterator3.e(err);
2442
- } finally {
2443
- _iterator3.f();
2444
- }
2445
- setHeaders(obj, valueOrRewrite);
2446
- } else {
2447
- header != null && setHeader(valueOrRewrite, header, rewrite);
2448
- }
2449
- return this;
2450
- }
2451
- }, {
2452
- key: "get",
2453
- value: function get(header, parser) {
2454
- header = normalizeHeader(header);
2455
- if (header) {
2456
- var key = utils$1$1.findKey(this, header);
2457
- if (key) {
2458
- var value = this[key];
2459
- if (!parser) {
2460
- return value;
2461
- }
2462
- if (parser === true) {
2463
- return parseTokens(value);
2464
- }
2465
- if (utils$1$1.isFunction(parser)) {
2466
- return parser.call(this, value, key);
2467
- }
2468
- if (utils$1$1.isRegExp(parser)) {
2469
- return parser.exec(value);
2470
- }
2471
- throw new TypeError('parser must be boolean|regexp|function');
2472
- }
2473
- }
2393
+ var _encode = options && options.encode || encode$2;
2394
+ var _options = utils$1$1.isFunction(options) ? {
2395
+ serialize: options
2396
+ } : options;
2397
+ var serializeFn = _options && _options.serialize;
2398
+ var serializedParams;
2399
+ if (serializeFn) {
2400
+ serializedParams = serializeFn(params, _options);
2401
+ } else {
2402
+ serializedParams = utils$1$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
2403
+ }
2404
+ if (serializedParams) {
2405
+ var hashmarkIndex = url.indexOf('#');
2406
+ if (hashmarkIndex !== -1) {
2407
+ url = url.slice(0, hashmarkIndex);
2474
2408
  }
2475
- }, {
2476
- key: "has",
2477
- value: function has(header, matcher) {
2478
- header = normalizeHeader(header);
2479
- if (header) {
2480
- var key = utils$1$1.findKey(this, header);
2481
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2482
- }
2483
- return false;
2409
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2410
+ }
2411
+ return url;
2412
+ }
2413
+ var InterceptorManager = /*#__PURE__*/function () {
2414
+ function InterceptorManager() {
2415
+ _classCallCheck(this, InterceptorManager);
2416
+ this.handlers = [];
2417
+ }
2418
+
2419
+ /**
2420
+ * Add a new interceptor to the stack
2421
+ *
2422
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
2423
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
2424
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
2425
+ *
2426
+ * @return {Number} An ID used to remove interceptor later
2427
+ */
2428
+ return _createClass(InterceptorManager, [{
2429
+ key: "use",
2430
+ value: function use(fulfilled, rejected, options) {
2431
+ this.handlers.push({
2432
+ fulfilled: fulfilled,
2433
+ rejected: rejected,
2434
+ synchronous: options ? options.synchronous : false,
2435
+ runWhen: options ? options.runWhen : null
2436
+ });
2437
+ return this.handlers.length - 1;
2484
2438
  }
2485
- }, {
2486
- key: "delete",
2487
- value: function _delete(header, matcher) {
2488
- var self = this;
2489
- var deleted = false;
2490
- function deleteHeader(_header) {
2491
- _header = normalizeHeader(_header);
2492
- if (_header) {
2493
- var key = utils$1$1.findKey(self, _header);
2494
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2495
- delete self[key];
2496
- deleted = true;
2497
- }
2498
- }
2499
- }
2500
- if (utils$1$1.isArray(header)) {
2501
- header.forEach(deleteHeader);
2502
- } else {
2503
- deleteHeader(header);
2439
+
2440
+ /**
2441
+ * Remove an interceptor from the stack
2442
+ *
2443
+ * @param {Number} id The ID that was returned by `use`
2444
+ *
2445
+ * @returns {void}
2446
+ */
2447
+ }, {
2448
+ key: "eject",
2449
+ value: function eject(id) {
2450
+ if (this.handlers[id]) {
2451
+ this.handlers[id] = null;
2504
2452
  }
2505
- return deleted;
2506
2453
  }
2454
+
2455
+ /**
2456
+ * Clear all interceptors from the stack
2457
+ *
2458
+ * @returns {void}
2459
+ */
2507
2460
  }, {
2508
2461
  key: "clear",
2509
- value: function clear(matcher) {
2510
- var keys = Object.keys(this);
2511
- var i = keys.length;
2512
- var deleted = false;
2513
- while (i--) {
2514
- var key = keys[i];
2515
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2516
- delete this[key];
2517
- deleted = true;
2518
- }
2462
+ value: function clear() {
2463
+ if (this.handlers) {
2464
+ this.handlers = [];
2519
2465
  }
2520
- return deleted;
2521
2466
  }
2467
+
2468
+ /**
2469
+ * Iterate over all the registered interceptors
2470
+ *
2471
+ * This method is particularly useful for skipping over any
2472
+ * interceptors that may have become `null` calling `eject`.
2473
+ *
2474
+ * @param {Function} fn The function to call for each interceptor
2475
+ *
2476
+ * @returns {void}
2477
+ */
2522
2478
  }, {
2523
- key: "normalize",
2524
- value: function normalize(format) {
2525
- var self = this;
2526
- var headers = {};
2527
- utils$1$1.forEach(this, function (value, header) {
2528
- var key = utils$1$1.findKey(headers, header);
2529
- if (key) {
2530
- self[key] = normalizeValue(value);
2531
- delete self[header];
2532
- return;
2533
- }
2534
- var normalized = format ? formatHeader(header) : String(header).trim();
2535
- if (normalized !== header) {
2536
- delete self[header];
2479
+ key: "forEach",
2480
+ value: function forEach(fn) {
2481
+ utils$1$1.forEach(this.handlers, function forEachHandler(h) {
2482
+ if (h !== null) {
2483
+ fn(h);
2537
2484
  }
2538
- self[normalized] = normalizeValue(value);
2539
- headers[normalized] = true;
2540
2485
  });
2541
- return this;
2542
2486
  }
2543
- }, {
2544
- key: "concat",
2545
- value: function concat() {
2546
- var _this$constructor;
2547
- for (var _len = arguments.length, targets = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
2548
- targets[_key2] = arguments[_key2];
2487
+ }]);
2488
+ }();
2489
+ var transitionalDefaults = {
2490
+ silentJSONParsing: true,
2491
+ forcedJSONParsing: true,
2492
+ clarifyTimeoutError: false,
2493
+ legacyInterceptorReqResOrdering: true
2494
+ };
2495
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2496
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2497
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2498
+ var platform$1 = {
2499
+ isBrowser: true,
2500
+ classes: {
2501
+ URLSearchParams: URLSearchParams$1,
2502
+ FormData: FormData$1,
2503
+ Blob: Blob$1
2504
+ },
2505
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2506
+ };
2507
+ var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2508
+ var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof$2(navigator)) === 'object' && navigator || undefined;
2509
+
2510
+ /**
2511
+ * Determine if we're running in a standard browser environment
2512
+ *
2513
+ * This allows axios to run in a web worker, and react-native.
2514
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2515
+ *
2516
+ * web workers:
2517
+ * typeof window -> undefined
2518
+ * typeof document -> undefined
2519
+ *
2520
+ * react-native:
2521
+ * navigator.product -> 'ReactNative'
2522
+ * nativescript
2523
+ * navigator.product -> 'NativeScript' or 'NS'
2524
+ *
2525
+ * @returns {boolean}
2526
+ */
2527
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2528
+
2529
+ /**
2530
+ * Determine if we're running in a standard browser webWorker environment
2531
+ *
2532
+ * Although the `isStandardBrowserEnv` method indicates that
2533
+ * `allows axios to run in a web worker`, the WebWorker will still be
2534
+ * filtered out due to its judgment standard
2535
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2536
+ * This leads to a problem when axios post `FormData` in webWorker
2537
+ */
2538
+ var hasStandardBrowserWebWorkerEnv = function () {
2539
+ return typeof WorkerGlobalScope !== 'undefined' &&
2540
+ // eslint-disable-next-line no-undef
2541
+ self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
2542
+ }();
2543
+ var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2544
+ var utils$3 = /*#__PURE__*/Object.freeze({
2545
+ __proto__: null,
2546
+ hasBrowserEnv: hasBrowserEnv,
2547
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2548
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2549
+ navigator: _navigator,
2550
+ origin: origin
2551
+ });
2552
+ var platform = _objectSpread$2(_objectSpread$2({}, utils$3), platform$1);
2553
+ function toURLEncodedForm(data, options) {
2554
+ return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread$2({
2555
+ visitor: function visitor(value, key, path, helpers) {
2556
+ if (platform.isNode && utils$1$1.isBuffer(value)) {
2557
+ this.append(key, value.toString('base64'));
2558
+ return false;
2549
2559
  }
2550
- return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2560
+ return helpers.defaultVisitor.apply(this, arguments);
2561
+ }
2562
+ }, options));
2563
+ }
2564
+
2565
+ /**
2566
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2567
+ *
2568
+ * @param {string} name - The name of the property to get.
2569
+ *
2570
+ * @returns An array of strings.
2571
+ */
2572
+ function parsePropPath(name) {
2573
+ // foo[x][y][z]
2574
+ // foo.x.y.z
2575
+ // foo-x-y-z
2576
+ // foo x y z
2577
+ return utils$1$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2578
+ return match[0] === '[]' ? '' : match[1] || match[0];
2579
+ });
2580
+ }
2581
+
2582
+ /**
2583
+ * Convert an array to an object.
2584
+ *
2585
+ * @param {Array<any>} arr - The array to convert to an object.
2586
+ *
2587
+ * @returns An object with the same keys and values as the array.
2588
+ */
2589
+ function arrayToObject$1(arr) {
2590
+ var obj = {};
2591
+ var keys = Object.keys(arr);
2592
+ var i;
2593
+ var len = keys.length;
2594
+ var key;
2595
+ for (i = 0; i < len; i++) {
2596
+ key = keys[i];
2597
+ obj[key] = arr[key];
2598
+ }
2599
+ return obj;
2600
+ }
2601
+
2602
+ /**
2603
+ * It takes a FormData object and returns a JavaScript object
2604
+ *
2605
+ * @param {string} formData The FormData object to convert to JSON.
2606
+ *
2607
+ * @returns {Object<string, any> | null} The converted object.
2608
+ */
2609
+ function formDataToJSON(formData) {
2610
+ function buildPath(path, value, target, index) {
2611
+ var name = path[index++];
2612
+ if (name === '__proto__') return true;
2613
+ var isNumericKey = Number.isFinite(+name);
2614
+ var isLast = index >= path.length;
2615
+ name = !name && utils$1$1.isArray(target) ? target.length : name;
2616
+ if (isLast) {
2617
+ if (utils$1$1.hasOwnProp(target, name)) {
2618
+ target[name] = utils$1$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
2619
+ } else {
2620
+ target[name] = value;
2621
+ }
2622
+ return !isNumericKey;
2623
+ }
2624
+ if (!target[name] || !utils$1$1.isObject(target[name])) {
2625
+ target[name] = [];
2626
+ }
2627
+ var result = buildPath(path, value, target[name], index);
2628
+ if (result && utils$1$1.isArray(target[name])) {
2629
+ target[name] = arrayToObject$1(target[name]);
2630
+ }
2631
+ return !isNumericKey;
2632
+ }
2633
+ if (utils$1$1.isFormData(formData) && utils$1$1.isFunction(formData.entries)) {
2634
+ var obj = {};
2635
+ utils$1$1.forEachEntry(formData, function (name, value) {
2636
+ buildPath(parsePropPath(name), value, obj, 0);
2637
+ });
2638
+ return obj;
2639
+ }
2640
+ return null;
2641
+ }
2642
+ var own = function own(obj, key) {
2643
+ return obj != null && utils$1$1.hasOwnProp(obj, key) ? obj[key] : undefined;
2644
+ };
2645
+
2646
+ /**
2647
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2648
+ * of the input
2649
+ *
2650
+ * @param {any} rawValue - The value to be stringified.
2651
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
2652
+ * @param {Function} encoder - A function that takes a value and returns a string.
2653
+ *
2654
+ * @returns {string} A stringified version of the rawValue.
2655
+ */
2656
+ function stringifySafely(rawValue, parser, encoder) {
2657
+ if (utils$1$1.isString(rawValue)) {
2658
+ try {
2659
+ (parser || JSON.parse)(rawValue);
2660
+ return utils$1$1.trim(rawValue);
2661
+ } catch (e) {
2662
+ if (e.name !== 'SyntaxError') {
2663
+ throw e;
2664
+ }
2665
+ }
2666
+ }
2667
+ return (encoder || JSON.stringify)(rawValue);
2668
+ }
2669
+ var defaults$2 = {
2670
+ transitional: transitionalDefaults,
2671
+ adapter: ['xhr', 'http', 'fetch'],
2672
+ transformRequest: [function transformRequest(data, headers) {
2673
+ var contentType = headers.getContentType() || '';
2674
+ var hasJSONContentType = contentType.indexOf('application/json') > -1;
2675
+ var isObjectPayload = utils$1$1.isObject(data);
2676
+ if (isObjectPayload && utils$1$1.isHTMLForm(data)) {
2677
+ data = new FormData(data);
2551
2678
  }
2552
- }, {
2553
- key: "toJSON",
2554
- value: function toJSON(asStrings) {
2555
- var obj = Object.create(null);
2556
- utils$1$1.forEach(this, function (value, header) {
2557
- value != null && value !== false && (obj[header] = asStrings && utils$1$1.isArray(value) ? value.join(', ') : value);
2558
- });
2559
- return obj;
2679
+ var isFormData = utils$1$1.isFormData(data);
2680
+ if (isFormData) {
2681
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2560
2682
  }
2561
- }, {
2562
- key: Symbol.iterator,
2563
- value: function value() {
2564
- return Object.entries(this.toJSON())[Symbol.iterator]();
2683
+ if (utils$1$1.isArrayBuffer(data) || utils$1$1.isBuffer(data) || utils$1$1.isStream(data) || utils$1$1.isFile(data) || utils$1$1.isBlob(data) || utils$1$1.isReadableStream(data)) {
2684
+ return data;
2565
2685
  }
2566
- }, {
2567
- key: "toString",
2568
- value: function toString() {
2569
- return Object.entries(this.toJSON()).map(function (_ref8) {
2570
- var _ref9 = _slicedToArray$1(_ref8, 2),
2571
- header = _ref9[0],
2572
- value = _ref9[1];
2573
- return header + ': ' + value;
2574
- }).join('\n');
2686
+ if (utils$1$1.isArrayBufferView(data)) {
2687
+ return data.buffer;
2575
2688
  }
2576
- }, {
2577
- key: "getSetCookie",
2578
- value: function getSetCookie() {
2579
- return this.get('set-cookie') || [];
2689
+ if (utils$1$1.isURLSearchParams(data)) {
2690
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2691
+ return data.toString();
2580
2692
  }
2581
- }, {
2582
- key: Symbol.toStringTag,
2583
- get: function get() {
2584
- return 'AxiosHeaders';
2693
+ var isFileList;
2694
+ if (isObjectPayload) {
2695
+ var formSerializer = own(this, 'formSerializer');
2696
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2697
+ return toURLEncodedForm(data, formSerializer).toString();
2698
+ }
2699
+ if ((isFileList = utils$1$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2700
+ var env = own(this, 'env');
2701
+ var _FormData = env && env.FormData;
2702
+ return toFormData(isFileList ? {
2703
+ 'files[]': data
2704
+ } : data, _FormData && new _FormData(), formSerializer);
2705
+ }
2585
2706
  }
2586
- }], [{
2587
- key: "from",
2588
- value: function from(thing) {
2589
- return thing instanceof this ? thing : new this(thing);
2707
+ if (isObjectPayload || hasJSONContentType) {
2708
+ headers.setContentType('application/json', false);
2709
+ return stringifySafely(data);
2590
2710
  }
2591
- }, {
2592
- key: "concat",
2593
- value: function concat(first) {
2594
- var computed = new this(first);
2595
- for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
2596
- targets[_key3 - 1] = arguments[_key3];
2597
- }
2598
- targets.forEach(function (target) {
2599
- return computed.set(target);
2600
- });
2601
- return computed;
2711
+ return data;
2712
+ }],
2713
+ transformResponse: [function transformResponse(data) {
2714
+ var transitional = own(this, 'transitional') || defaults$2.transitional;
2715
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2716
+ var responseType = own(this, 'responseType');
2717
+ var JSONRequested = responseType === 'json';
2718
+ if (utils$1$1.isResponse(data) || utils$1$1.isReadableStream(data)) {
2719
+ return data;
2602
2720
  }
2603
- }, {
2604
- key: "accessor",
2605
- value: function accessor(header) {
2606
- var internals = this[$internals] = this[$internals] = {
2607
- accessors: {}
2608
- };
2609
- var accessors = internals.accessors;
2610
- var prototype = this.prototype;
2611
- function defineAccessor(_header) {
2612
- var lHeader = normalizeHeader(_header);
2613
- if (!accessors[lHeader]) {
2614
- buildAccessors(prototype, _header);
2615
- accessors[lHeader] = true;
2721
+ if (data && utils$1$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
2722
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
2723
+ var strictJSONParsing = !silentJSONParsing && JSONRequested;
2724
+ try {
2725
+ return JSON.parse(data, own(this, 'parseReviver'));
2726
+ } catch (e) {
2727
+ if (strictJSONParsing) {
2728
+ if (e.name === 'SyntaxError') {
2729
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
2730
+ }
2731
+ throw e;
2616
2732
  }
2617
2733
  }
2618
- utils$1$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2619
- return this;
2620
2734
  }
2621
- }]);
2622
- }();
2623
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2624
-
2625
- // reserved names hotfix
2626
- utils$1$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref10, key) {
2627
- var value = _ref10.value;
2628
- var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2629
- return {
2630
- get: function get() {
2631
- return value;
2632
- },
2633
- set: function set(headerValue) {
2634
- this[mapped] = headerValue;
2735
+ return data;
2736
+ }],
2737
+ /**
2738
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
2739
+ * timeout is not created.
2740
+ */
2741
+ timeout: 0,
2742
+ xsrfCookieName: 'XSRF-TOKEN',
2743
+ xsrfHeaderName: 'X-XSRF-TOKEN',
2744
+ maxContentLength: -1,
2745
+ maxBodyLength: -1,
2746
+ env: {
2747
+ FormData: platform.classes.FormData,
2748
+ Blob: platform.classes.Blob
2749
+ },
2750
+ validateStatus: function validateStatus(status) {
2751
+ return status >= 200 && status < 300;
2752
+ },
2753
+ headers: {
2754
+ common: {
2755
+ Accept: 'application/json, text/plain, */*',
2756
+ 'Content-Type': undefined
2635
2757
  }
2636
- };
2758
+ }
2759
+ };
2760
+ utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
2761
+ defaults$2.headers[method] = {};
2637
2762
  });
2638
- utils$1$1.freezeMethods(AxiosHeaders);
2639
- var AxiosHeaders$1 = AxiosHeaders;
2640
2763
 
2641
2764
  /**
2642
2765
  * Transform the data for a request or a response
@@ -2647,9 +2770,9 @@ var contentful = (function (exports) {
2647
2770
  * @returns {*} The resulting transformed data
2648
2771
  */
2649
2772
  function transformData(fns, response) {
2650
- var config = this || defaults$1$1;
2773
+ var config = this || defaults$2;
2651
2774
  var context = response || config;
2652
- var headers = AxiosHeaders$1.from(context.headers);
2775
+ var headers = AxiosHeaders.from(context.headers);
2653
2776
  var data = context.data;
2654
2777
  utils$1$1.forEach(fns, function transform(fn) {
2655
2778
  data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
@@ -2660,7 +2783,7 @@ var contentful = (function (exports) {
2660
2783
  function isCancel(value) {
2661
2784
  return !!(value && value.__CANCEL__);
2662
2785
  }
2663
- var CanceledError = /*#__PURE__*/function (_AxiosError$) {
2786
+ var CanceledError = /*#__PURE__*/function (_AxiosError) {
2664
2787
  /**
2665
2788
  * A `CanceledError` is an object that is thrown when an operation is canceled.
2666
2789
  *
@@ -2673,16 +2796,14 @@ var contentful = (function (exports) {
2673
2796
  function CanceledError(message, config, request) {
2674
2797
  var _this2;
2675
2798
  _classCallCheck(this, CanceledError);
2676
- _this2 = _callSuper$3(this, CanceledError, [message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request]);
2799
+ _this2 = _callSuper$3(this, CanceledError, [message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request]);
2677
2800
  _this2.name = 'CanceledError';
2678
2801
  _this2.__CANCEL__ = true;
2679
2802
  return _this2;
2680
2803
  }
2681
- _inherits(CanceledError, _AxiosError$);
2804
+ _inherits(CanceledError, _AxiosError);
2682
2805
  return _createClass(CanceledError);
2683
- }(AxiosError$1);
2684
- var CanceledError$1 = CanceledError;
2685
-
2806
+ }(AxiosError);
2686
2807
  /**
2687
2808
  * Resolve or reject a Promise based on response status.
2688
2809
  *
@@ -2697,11 +2818,11 @@ var contentful = (function (exports) {
2697
2818
  if (!response.status || !validateStatus || validateStatus(response.status)) {
2698
2819
  resolve(response);
2699
2820
  } else {
2700
- reject(new AxiosError$1('Request failed with status code ' + response.status, [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
2821
+ reject(new AxiosError('Request failed with status code ' + response.status, response.status >= 400 && response.status < 500 ? AxiosError.ERR_BAD_REQUEST : AxiosError.ERR_BAD_RESPONSE, response.config, response.request, response));
2701
2822
  }
2702
2823
  }
2703
2824
  function parseProtocol(url) {
2704
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2825
+ var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2705
2826
  return match && match[1] || '';
2706
2827
  }
2707
2828
 
@@ -2769,8 +2890,8 @@ var contentful = (function (exports) {
2769
2890
  var throttled = function throttled() {
2770
2891
  var now = Date.now();
2771
2892
  var passed = now - timestamp;
2772
- for (var _len3 = arguments.length, args = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) {
2773
- args[_key4] = arguments[_key4];
2893
+ for (var _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
2894
+ args[_key5] = arguments[_key5];
2774
2895
  }
2775
2896
  if (passed >= threshold) {
2776
2897
  invoke(args, now);
@@ -2794,19 +2915,19 @@ var contentful = (function (exports) {
2794
2915
  var bytesNotified = 0;
2795
2916
  var _speedometer = speedometer(50, 250);
2796
2917
  return throttle(function (e) {
2797
- var loaded = e.loaded;
2918
+ var rawLoaded = e.loaded;
2798
2919
  var total = e.lengthComputable ? e.total : undefined;
2799
- var progressBytes = loaded - bytesNotified;
2920
+ var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2921
+ var progressBytes = Math.max(0, loaded - bytesNotified);
2800
2922
  var rate = _speedometer(progressBytes);
2801
- var inRange = loaded <= total;
2802
- bytesNotified = loaded;
2923
+ bytesNotified = Math.max(bytesNotified, loaded);
2803
2924
  var data = _defineProperty({
2804
2925
  loaded: loaded,
2805
2926
  total: total,
2806
2927
  progress: total ? loaded / total : undefined,
2807
2928
  bytes: progressBytes,
2808
2929
  rate: rate ? rate : undefined,
2809
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2930
+ estimated: rate && total ? (total - loaded) / rate : undefined,
2810
2931
  event: e,
2811
2932
  lengthComputable: total != null
2812
2933
  }, isDownloadStream ? 'download' : 'upload', true);
@@ -2825,8 +2946,8 @@ var contentful = (function (exports) {
2825
2946
  };
2826
2947
  var asyncDecorator = function asyncDecorator(fn) {
2827
2948
  return function () {
2828
- for (var _len4 = arguments.length, args = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) {
2829
- args[_key5] = arguments[_key5];
2949
+ for (var _len5 = arguments.length, args = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) {
2950
+ args[_key6] = arguments[_key6];
2830
2951
  }
2831
2952
  return utils$1$1.asap(function () {
2832
2953
  return fn.apply(void 0, args);
@@ -2866,8 +2987,20 @@ var contentful = (function (exports) {
2866
2987
  },
2867
2988
  read: function read(name) {
2868
2989
  if (typeof document === 'undefined') return null;
2869
- var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2870
- return match ? decodeURIComponent(match[1]) : null;
2990
+ // Match name=value by splitting on the semicolon separator instead of building a
2991
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
2992
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
2993
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
2994
+ // "; ", so ignore optional whitespace before each cookie name.
2995
+ var cookies = document.cookie.split(';');
2996
+ for (var i = 0; i < cookies.length; i++) {
2997
+ var cookie = cookies[i].replace(/^\s+/, '');
2998
+ var eq = cookie.indexOf('=');
2999
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
3000
+ return decodeURIComponent(cookie.slice(eq + 1));
3001
+ }
3002
+ }
3003
+ return null;
2871
3004
  },
2872
3005
  remove: function remove(name) {
2873
3006
  this.write(name, '', Date.now() - 86400000, '/');
@@ -2923,13 +3056,13 @@ var contentful = (function (exports) {
2923
3056
  */
2924
3057
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2925
3058
  var isRelativeUrl = !isAbsoluteURL(requestedURL);
2926
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
3059
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2927
3060
  return combineURLs(baseURL, requestedURL);
2928
3061
  }
2929
3062
  return requestedURL;
2930
3063
  }
2931
3064
  var headersToObject = function headersToObject(thing) {
2932
- return thing instanceof AxiosHeaders$1 ? _objectSpread$2({}, thing) : thing;
3065
+ return thing instanceof AxiosHeaders ? _objectSpread$2({}, thing) : thing;
2933
3066
  };
2934
3067
 
2935
3068
  /**
@@ -2944,7 +3077,21 @@ var contentful = (function (exports) {
2944
3077
  function mergeConfig(config1, config2) {
2945
3078
  // eslint-disable-next-line no-param-reassign
2946
3079
  config2 = config2 || {};
2947
- var config = {};
3080
+
3081
+ // Use a null-prototype object so that downstream reads such as `config.auth`
3082
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
3083
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
3084
+ // ergonomics for user code that relies on it.
3085
+ var config = Object.create(null);
3086
+ Object.defineProperty(config, 'hasOwnProperty', {
3087
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
3088
+ // this data descriptor into an accessor descriptor on the way in.
3089
+ __proto__: null,
3090
+ value: Object.prototype.hasOwnProperty,
3091
+ enumerable: false,
3092
+ writable: true,
3093
+ configurable: true
3094
+ });
2948
3095
  function getMergedValue(target, source, prop, caseless) {
2949
3096
  if (utils$1$1.isPlainObject(target) && utils$1$1.isPlainObject(source)) {
2950
3097
  return utils$1$1.merge.call({
@@ -2983,9 +3130,9 @@ var contentful = (function (exports) {
2983
3130
 
2984
3131
  // eslint-disable-next-line consistent-return
2985
3132
  function mergeDirectKeys(a, b, prop) {
2986
- if (prop in config2) {
3133
+ if (utils$1$1.hasOwnProp(config2, prop)) {
2987
3134
  return getMergedValue(a, b);
2988
- } else if (prop in config1) {
3135
+ } else if (utils$1$1.hasOwnProp(config1, prop)) {
2989
3136
  return getMergedValue(undefined, a);
2990
3137
  }
2991
3138
  }
@@ -3016,6 +3163,7 @@ var contentful = (function (exports) {
3016
3163
  httpsAgent: defaultToConfig2,
3017
3164
  cancelToken: defaultToConfig2,
3018
3165
  socketPath: defaultToConfig2,
3166
+ allowedSocketPaths: defaultToConfig2,
3019
3167
  responseEncoding: defaultToConfig2,
3020
3168
  validateStatus: mergeDirectKeys,
3021
3169
  headers: function headers(a, b, prop) {
@@ -3025,42 +3173,72 @@ var contentful = (function (exports) {
3025
3173
  utils$1$1.forEach(Object.keys(_objectSpread$2(_objectSpread$2({}, config1), config2)), function computeConfigValue(prop) {
3026
3174
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
3027
3175
  var merge = utils$1$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
3028
- var configValue = merge(config1[prop], config2[prop], prop);
3176
+ var a = utils$1$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
3177
+ var b = utils$1$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
3178
+ var configValue = merge(a, b, prop);
3029
3179
  utils$1$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
3030
3180
  });
3031
3181
  return config;
3032
3182
  }
3183
+ var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
3184
+ function setFormDataHeaders(headers, formHeaders, policy) {
3185
+ if (policy !== 'content-only') {
3186
+ headers.set(formHeaders);
3187
+ return;
3188
+ }
3189
+ Object.entries(formHeaders).forEach(function (_ref11) {
3190
+ var _ref12 = _slicedToArray$1(_ref11, 2),
3191
+ key = _ref12[0],
3192
+ val = _ref12[1];
3193
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
3194
+ headers.set(key, val);
3195
+ }
3196
+ });
3197
+ }
3198
+
3199
+ /**
3200
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3201
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3202
+ *
3203
+ * @param {string} str The string to encode
3204
+ *
3205
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3206
+ */
3207
+ var encodeUTF8 = function encodeUTF8(str) {
3208
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3209
+ return String.fromCharCode(parseInt(hex, 16));
3210
+ });
3211
+ };
3033
3212
  var resolveConfig = function resolveConfig(config) {
3034
3213
  var newConfig = mergeConfig({}, config);
3035
- var data = newConfig.data,
3036
- withXSRFToken = newConfig.withXSRFToken,
3037
- xsrfHeaderName = newConfig.xsrfHeaderName,
3038
- xsrfCookieName = newConfig.xsrfCookieName,
3039
- headers = newConfig.headers,
3040
- auth = newConfig.auth;
3041
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
3042
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3214
+
3215
+ // Read only own properties to prevent prototype pollution gadgets
3216
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
3217
+ var own = function own(key) {
3218
+ return utils$1$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
3219
+ };
3220
+ var data = own('data');
3221
+ var withXSRFToken = own('withXSRFToken');
3222
+ var xsrfHeaderName = own('xsrfHeaderName');
3223
+ var xsrfCookieName = own('xsrfCookieName');
3224
+ var headers = own('headers');
3225
+ var auth = own('auth');
3226
+ var baseURL = own('baseURL');
3227
+ var allowAbsoluteUrls = own('allowAbsoluteUrls');
3228
+ var url = own('url');
3229
+ newConfig.headers = headers = AxiosHeaders.from(headers);
3230
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
3043
3231
 
3044
3232
  // HTTP basic authentication
3045
3233
  if (auth) {
3046
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3234
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
3047
3235
  }
3048
3236
  if (utils$1$1.isFormData(data)) {
3049
3237
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3050
3238
  headers.setContentType(undefined); // browser handles it
3051
3239
  } else if (utils$1$1.isFunction(data.getHeaders)) {
3052
3240
  // Node.js FormData (like form-data package)
3053
- var formHeaders = data.getHeaders();
3054
- // Only set safe headers to avoid overwriting security headers
3055
- var allowedHeaders = ['content-type', 'content-length'];
3056
- Object.entries(formHeaders).forEach(function (_ref11) {
3057
- var _ref12 = _slicedToArray$1(_ref11, 2),
3058
- key = _ref12[0],
3059
- val = _ref12[1];
3060
- if (allowedHeaders.includes(key.toLowerCase())) {
3061
- headers.set(key, val);
3062
- }
3063
- });
3241
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3064
3242
  }
3065
3243
  }
3066
3244
 
@@ -3069,9 +3247,15 @@ var contentful = (function (exports) {
3069
3247
  // Specifically not if we're in a web worker, or react-native.
3070
3248
 
3071
3249
  if (platform.hasStandardBrowserEnv) {
3072
- withXSRFToken && utils$1$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3073
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
3074
- // Add xsrf header
3250
+ if (utils$1$1.isFunction(withXSRFToken)) {
3251
+ withXSRFToken = withXSRFToken(newConfig);
3252
+ }
3253
+
3254
+ // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
3255
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
3256
+ // the XSRF token cross-origin.
3257
+ var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
3258
+ if (shouldSendXSRF) {
3075
3259
  var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
3076
3260
  if (xsrfValue) {
3077
3261
  headers.set(xsrfHeaderName, xsrfValue);
@@ -3085,7 +3269,7 @@ var contentful = (function (exports) {
3085
3269
  return new Promise(function dispatchXhrRequest(resolve, reject) {
3086
3270
  var _config = resolveConfig(config);
3087
3271
  var requestData = _config.data;
3088
- var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
3272
+ var requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3089
3273
  var responseType = _config.responseType,
3090
3274
  onUploadProgress = _config.onUploadProgress,
3091
3275
  onDownloadProgress = _config.onDownloadProgress;
@@ -3109,7 +3293,7 @@ var contentful = (function (exports) {
3109
3293
  return;
3110
3294
  }
3111
3295
  // Prepare the response
3112
- var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
3296
+ var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
3113
3297
  var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
3114
3298
  var response = {
3115
3299
  data: responseData,
@@ -3144,7 +3328,7 @@ var contentful = (function (exports) {
3144
3328
  // handled by onerror instead
3145
3329
  // With one exception: request that using file: protocol, most browsers
3146
3330
  // will return status as 0 even though it's a successful request
3147
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3331
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
3148
3332
  return;
3149
3333
  }
3150
3334
  // readystate handler is calling before onerror or ontimeout handlers,
@@ -3158,7 +3342,8 @@ var contentful = (function (exports) {
3158
3342
  if (!request) {
3159
3343
  return;
3160
3344
  }
3161
- reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
3345
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
3346
+ done();
3162
3347
 
3163
3348
  // Clean up request
3164
3349
  request = null;
@@ -3170,10 +3355,11 @@ var contentful = (function (exports) {
3170
3355
  // (message may be empty; when present, surface it)
3171
3356
  // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3172
3357
  var msg = event && event.message ? event.message : 'Network Error';
3173
- var err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
3358
+ var err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
3174
3359
  // attach the underlying event for consumers who want details
3175
3360
  err.event = event || null;
3176
3361
  reject(err);
3362
+ done();
3177
3363
  request = null;
3178
3364
  };
3179
3365
 
@@ -3184,7 +3370,8 @@ var contentful = (function (exports) {
3184
3370
  if (_config.timeoutErrorMessage) {
3185
3371
  timeoutErrorMessage = _config.timeoutErrorMessage;
3186
3372
  }
3187
- reject(new AxiosError$1(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, config, request));
3373
+ reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
3374
+ done();
3188
3375
 
3189
3376
  // Clean up request
3190
3377
  request = null;
@@ -3235,8 +3422,9 @@ var contentful = (function (exports) {
3235
3422
  if (!request) {
3236
3423
  return;
3237
3424
  }
3238
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
3425
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3239
3426
  request.abort();
3427
+ done();
3240
3428
  request = null;
3241
3429
  };
3242
3430
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -3245,8 +3433,8 @@ var contentful = (function (exports) {
3245
3433
  }
3246
3434
  }
3247
3435
  var protocol = parseProtocol(_config.url);
3248
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3249
- reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
3436
+ if (protocol && !platform.protocols.includes(protocol)) {
3437
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3250
3438
  return;
3251
3439
  }
3252
3440
 
@@ -3265,12 +3453,12 @@ var contentful = (function (exports) {
3265
3453
  aborted = true;
3266
3454
  unsubscribe();
3267
3455
  var err = reason instanceof Error ? reason : this.reason;
3268
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
3456
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3269
3457
  }
3270
3458
  };
3271
3459
  var timer = timeout && setTimeout(function () {
3272
3460
  timer = null;
3273
- onabort(new AxiosError$1("timeout of ".concat(timeout, "ms exceeded"), AxiosError$1.ETIMEDOUT));
3461
+ onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
3274
3462
  }, timeout);
3275
3463
  var unsubscribe = function unsubscribe() {
3276
3464
  if (signals) {
@@ -3292,14 +3480,13 @@ var contentful = (function (exports) {
3292
3480
  return signal;
3293
3481
  }
3294
3482
  };
3295
- var composeSignals$1 = composeSignals;
3296
3483
  var streamChunk = /*#__PURE__*/_regeneratorRuntime.mark(function streamChunk(chunk, chunkSize) {
3297
3484
  var len, pos, end;
3298
3485
  return _regeneratorRuntime.wrap(function streamChunk$(_context) {
3299
3486
  while (1) switch (_context.prev = _context.next) {
3300
3487
  case 0:
3301
3488
  len = chunk.byteLength;
3302
- if (!(!chunkSize || len < chunkSize)) {
3489
+ if (!(len < chunkSize)) {
3303
3490
  _context.next = 5;
3304
3491
  break;
3305
3492
  }
@@ -3499,23 +3686,105 @@ var contentful = (function (exports) {
3499
3686
  highWaterMark: 2
3500
3687
  });
3501
3688
  };
3689
+
3690
+ /**
3691
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3692
+ * - For base64: compute exact decoded size using length and padding;
3693
+ * handle %XX at the character-count level (no string allocation).
3694
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3695
+ *
3696
+ * @param {string} url
3697
+ * @returns {number}
3698
+ */
3699
+ function estimateDataURLDecodedBytes(url) {
3700
+ if (!url || typeof url !== 'string') return 0;
3701
+ if (!url.startsWith('data:')) return 0;
3702
+ var comma = url.indexOf(',');
3703
+ if (comma < 0) return 0;
3704
+ var meta = url.slice(5, comma);
3705
+ var body = url.slice(comma + 1);
3706
+ var isBase64 = /;base64/i.test(meta);
3707
+ if (isBase64) {
3708
+ var effectiveLen = body.length;
3709
+ var len = body.length; // cache length
3710
+
3711
+ for (var i = 0; i < len; i++) {
3712
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3713
+ var a = body.charCodeAt(i + 1);
3714
+ var b = body.charCodeAt(i + 2);
3715
+ var isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
3716
+ if (isHex) {
3717
+ effectiveLen -= 2;
3718
+ i += 2;
3719
+ }
3720
+ }
3721
+ }
3722
+ var pad = 0;
3723
+ var idx = len - 1;
3724
+ var tailIsPct3D = function tailIsPct3D(j) {
3725
+ return j >= 2 && body.charCodeAt(j - 2) === 37 &&
3726
+ // '%'
3727
+ body.charCodeAt(j - 1) === 51 && (
3728
+ // '3'
3729
+ body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
3730
+ }; // 'D' or 'd'
3731
+
3732
+ if (idx >= 0) {
3733
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3734
+ pad++;
3735
+ idx--;
3736
+ } else if (tailIsPct3D(idx)) {
3737
+ pad++;
3738
+ idx -= 3;
3739
+ }
3740
+ }
3741
+ if (pad === 1 && idx >= 0) {
3742
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3743
+ pad++;
3744
+ } else if (tailIsPct3D(idx)) {
3745
+ pad++;
3746
+ }
3747
+ }
3748
+ var groups = Math.floor(effectiveLen / 4);
3749
+ var _bytes = groups * 3 - (pad || 0);
3750
+ return _bytes > 0 ? _bytes : 0;
3751
+ }
3752
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3753
+ return Buffer.byteLength(body, 'utf8');
3754
+ }
3755
+
3756
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3757
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3758
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3759
+ // but 3 UTF-8 bytes).
3760
+ var bytes = 0;
3761
+ for (var _i2 = 0, _len6 = body.length; _i2 < _len6; _i2++) {
3762
+ var c = body.charCodeAt(_i2);
3763
+ if (c < 0x80) {
3764
+ bytes += 1;
3765
+ } else if (c < 0x800) {
3766
+ bytes += 2;
3767
+ } else if (c >= 0xd800 && c <= 0xdbff && _i2 + 1 < _len6) {
3768
+ var next = body.charCodeAt(_i2 + 1);
3769
+ if (next >= 0xdc00 && next <= 0xdfff) {
3770
+ bytes += 4;
3771
+ _i2++;
3772
+ } else {
3773
+ bytes += 3;
3774
+ }
3775
+ } else {
3776
+ bytes += 3;
3777
+ }
3778
+ }
3779
+ return bytes;
3780
+ }
3781
+ var VERSION = "1.16.0";
3502
3782
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
3503
3783
  var isFunction = utils$1$1.isFunction;
3504
- var globalFetchAPI = function (_ref13) {
3505
- var Request = _ref13.Request,
3506
- Response = _ref13.Response;
3507
- return {
3508
- Request: Request,
3509
- Response: Response
3510
- };
3511
- }(utils$1$1.global);
3512
- var _utils$1$global = utils$1$1.global,
3513
- ReadableStream$1 = _utils$1$global.ReadableStream,
3514
- TextEncoder = _utils$1$global.TextEncoder;
3515
3784
  var test = function test(fn) {
3516
3785
  try {
3517
- for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {
3518
- args[_key6 - 1] = arguments[_key6];
3786
+ for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
3787
+ args[_key7 - 1] = arguments[_key7];
3519
3788
  }
3520
3789
  return !!fn.apply(void 0, args);
3521
3790
  } catch (e) {
@@ -3523,9 +3792,16 @@ var contentful = (function (exports) {
3523
3792
  }
3524
3793
  };
3525
3794
  var factory = function factory(env) {
3795
+ var _utils$1$global;
3796
+ var globalObject = (_utils$1$global = utils$1$1.global) !== null && _utils$1$global !== void 0 ? _utils$1$global : globalThis;
3797
+ var ReadableStream = globalObject.ReadableStream,
3798
+ TextEncoder = globalObject.TextEncoder;
3526
3799
  env = utils$1$1.merge.call({
3527
3800
  skipUndefined: true
3528
- }, globalFetchAPI, env);
3801
+ }, {
3802
+ Request: globalObject.Request,
3803
+ Response: globalObject.Response
3804
+ }, env);
3529
3805
  var _env = env,
3530
3806
  envFetch = _env.fetch,
3531
3807
  Request = _env.Request,
@@ -3536,13 +3812,13 @@ var contentful = (function (exports) {
3536
3812
  if (!isFetchSupported) {
3537
3813
  return false;
3538
3814
  }
3539
- var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3815
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
3540
3816
  var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3541
3817
  return function (str) {
3542
3818
  return encoder.encode(str);
3543
3819
  };
3544
3820
  }(new TextEncoder()) : (/*#__PURE__*/function () {
3545
- var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(str) {
3821
+ var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(str) {
3546
3822
  return _regeneratorRuntime.wrap(function _callee4$(_context5) {
3547
3823
  while (1) switch (_context5.prev = _context5.next) {
3548
3824
  case 0:
@@ -3559,19 +3835,23 @@ var contentful = (function (exports) {
3559
3835
  }, _callee4);
3560
3836
  }));
3561
3837
  return function (_x4) {
3562
- return _ref14.apply(this, arguments);
3838
+ return _ref13.apply(this, arguments);
3563
3839
  };
3564
3840
  }()));
3565
3841
  var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
3566
3842
  var duplexAccessed = false;
3567
- var hasContentType = new Request(platform.origin, {
3568
- body: new ReadableStream$1(),
3843
+ var request = new Request(platform.origin, {
3844
+ body: new ReadableStream(),
3569
3845
  method: 'POST',
3570
3846
  get duplex() {
3571
3847
  duplexAccessed = true;
3572
3848
  return 'half';
3573
3849
  }
3574
- }).headers.has('Content-Type');
3850
+ });
3851
+ var hasContentType = request.headers.has('Content-Type');
3852
+ if (request.body != null) {
3853
+ request.body.cancel();
3854
+ }
3575
3855
  return duplexAccessed && !hasContentType;
3576
3856
  });
3577
3857
  var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
@@ -3589,12 +3869,12 @@ var contentful = (function (exports) {
3589
3869
  if (method) {
3590
3870
  return method.call(res);
3591
3871
  }
3592
- throw new AxiosError$1("Response type '".concat(type, "' is not supported"), AxiosError$1.ERR_NOT_SUPPORT, config);
3872
+ throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
3593
3873
  });
3594
3874
  });
3595
3875
  }();
3596
3876
  var getBodyLength = /*#__PURE__*/function () {
3597
- var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
3877
+ var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
3598
3878
  var _request;
3599
3879
  return _regeneratorRuntime.wrap(function _callee5$(_context6) {
3600
3880
  while (1) switch (_context6.prev = _context6.next) {
@@ -3648,11 +3928,11 @@ var contentful = (function (exports) {
3648
3928
  }, _callee5);
3649
3929
  }));
3650
3930
  return function getBodyLength(_x5) {
3651
- return _ref15.apply(this, arguments);
3931
+ return _ref14.apply(this, arguments);
3652
3932
  };
3653
3933
  }();
3654
3934
  var resolveBodyLength = /*#__PURE__*/function () {
3655
- var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(headers, body) {
3935
+ var _ref15 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(headers, body) {
3656
3936
  var length;
3657
3937
  return _regeneratorRuntime.wrap(function _callee6$(_context7) {
3658
3938
  while (1) switch (_context7.prev = _context7.next) {
@@ -3666,37 +3946,64 @@ var contentful = (function (exports) {
3666
3946
  }, _callee6);
3667
3947
  }));
3668
3948
  return function resolveBodyLength(_x6, _x7) {
3669
- return _ref16.apply(this, arguments);
3949
+ return _ref15.apply(this, arguments);
3670
3950
  };
3671
3951
  }();
3672
3952
  return /*#__PURE__*/function () {
3673
- var _ref17 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(config) {
3674
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _fetch, composedSignal, request, unsubscribe, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, resolvedOptions, response, isStreamResponse, options, responseContentLength, _ref18, _ref19, _onProgress, _flush, responseData;
3953
+ var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(config) {
3954
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, _fetch, composedSignal, request, unsubscribe, requestContentLength, estimated, outboundLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, declaredLength, isStreamResponse, options, responseContentLength, _ref17, _ref18, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError;
3675
3955
  return _regeneratorRuntime.wrap(function _callee7$(_context8) {
3676
3956
  while (1) switch (_context8.prev = _context8.next) {
3677
3957
  case 0:
3678
- _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
3958
+ _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
3959
+ hasMaxContentLength = utils$1$1.isNumber(maxContentLength) && maxContentLength > -1;
3960
+ hasMaxBodyLength = utils$1$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3679
3961
  _fetch = envFetch || fetch;
3680
3962
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3681
- composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3963
+ composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3682
3964
  request = null;
3683
3965
  unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3684
3966
  composedSignal.unsubscribe();
3685
3967
  };
3686
- _context8.prev = 6;
3968
+ _context8.prev = 8;
3969
+ if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
3970
+ _context8.next = 13;
3971
+ break;
3972
+ }
3973
+ estimated = estimateDataURLDecodedBytes(url);
3974
+ if (!(estimated > maxContentLength)) {
3975
+ _context8.next = 13;
3976
+ break;
3977
+ }
3978
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3979
+ case 13:
3980
+ if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
3981
+ _context8.next = 19;
3982
+ break;
3983
+ }
3984
+ _context8.next = 16;
3985
+ return resolveBodyLength(headers, data);
3986
+ case 16:
3987
+ outboundLength = _context8.sent;
3988
+ if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
3989
+ _context8.next = 19;
3990
+ break;
3991
+ }
3992
+ throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
3993
+ case 19:
3687
3994
  _context8.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3688
3995
  if (!_context8.t0) {
3689
- _context8.next = 13;
3996
+ _context8.next = 25;
3690
3997
  break;
3691
3998
  }
3692
- _context8.next = 11;
3999
+ _context8.next = 23;
3693
4000
  return resolveBodyLength(headers, data);
3694
- case 11:
4001
+ case 23:
3695
4002
  _context8.t1 = requestContentLength = _context8.sent;
3696
4003
  _context8.t0 = _context8.t1 !== 0;
3697
- case 13:
4004
+ case 25:
3698
4005
  if (!_context8.t0) {
3699
- _context8.next = 17;
4006
+ _context8.next = 29;
3700
4007
  break;
3701
4008
  }
3702
4009
  _request = new Request(url, {
@@ -3711,14 +4018,24 @@ var contentful = (function (exports) {
3711
4018
  _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray$1(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3712
4019
  data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3713
4020
  }
3714
- case 17:
4021
+ case 29:
3715
4022
  if (!utils$1$1.isString(withCredentials)) {
3716
4023
  withCredentials = withCredentials ? 'include' : 'omit';
3717
4024
  }
3718
4025
 
3719
4026
  // Cloudflare Workers throws when credentials are defined
3720
4027
  // see https://github.com/cloudflare/workerd/issues/902
3721
- isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
4028
+ isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype; // If data is FormData and Content-Type is multipart/form-data without boundary,
4029
+ // delete it so fetch can set it correctly with the boundary
4030
+ if (utils$1$1.isFormData(data)) {
4031
+ contentType = headers.getContentType();
4032
+ if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
4033
+ headers.delete('content-type');
4034
+ }
4035
+ }
4036
+
4037
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
4038
+ headers.set('User-Agent', 'axios/' + VERSION, false);
3722
4039
  resolvedOptions = _objectSpread$2(_objectSpread$2({}, fetchOptions), {}, {
3723
4040
  signal: composedSignal,
3724
4041
  method: method.toUpperCase(),
@@ -3728,63 +4045,117 @@ var contentful = (function (exports) {
3728
4045
  credentials: isCredentialsSupported ? withCredentials : undefined
3729
4046
  });
3730
4047
  request = isRequestSupported && new Request(url, resolvedOptions);
3731
- _context8.next = 23;
4048
+ _context8.next = 37;
3732
4049
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3733
- case 23:
4050
+ case 37:
3734
4051
  response = _context8.sent;
4052
+ if (!hasMaxContentLength) {
4053
+ _context8.next = 42;
4054
+ break;
4055
+ }
4056
+ declaredLength = utils$1$1.toFiniteNumber(response.headers.get('content-length'));
4057
+ if (!(declaredLength != null && declaredLength > maxContentLength)) {
4058
+ _context8.next = 42;
4059
+ break;
4060
+ }
4061
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4062
+ case 42:
3735
4063
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3736
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
4064
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
3737
4065
  options = {};
3738
4066
  ['status', 'statusText', 'headers'].forEach(function (prop) {
3739
4067
  options[prop] = response[prop];
3740
4068
  });
3741
4069
  responseContentLength = utils$1$1.toFiniteNumber(response.headers.get('content-length'));
3742
- _ref18 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref19 = _slicedToArray$1(_ref18, 2), _onProgress = _ref19[0], _flush = _ref19[1];
3743
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
4070
+ _ref17 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref18 = _slicedToArray$1(_ref17, 2), _onProgress = _ref18[0], _flush = _ref18[1];
4071
+ bytesRead = 0;
4072
+ onChunkProgress = function onChunkProgress(loadedBytes) {
4073
+ if (hasMaxContentLength) {
4074
+ bytesRead = loadedBytes;
4075
+ if (bytesRead > maxContentLength) {
4076
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4077
+ }
4078
+ }
4079
+ _onProgress && _onProgress(loadedBytes);
4080
+ };
4081
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, function () {
3744
4082
  _flush && _flush();
3745
4083
  unsubscribe && unsubscribe();
3746
4084
  }), options);
3747
4085
  }
3748
4086
  responseType = responseType || 'text';
3749
- _context8.next = 29;
4087
+ _context8.next = 47;
3750
4088
  return resolvers[utils$1$1.findKey(resolvers, responseType) || 'text'](response, config);
3751
- case 29:
4089
+ case 47:
3752
4090
  responseData = _context8.sent;
4091
+ if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
4092
+ _context8.next = 52;
4093
+ break;
4094
+ }
4095
+ if (responseData != null) {
4096
+ if (typeof responseData.byteLength === 'number') {
4097
+ materializedSize = responseData.byteLength;
4098
+ } else if (typeof responseData.size === 'number') {
4099
+ materializedSize = responseData.size;
4100
+ } else if (typeof responseData === 'string') {
4101
+ materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
4102
+ }
4103
+ }
4104
+ if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
4105
+ _context8.next = 52;
4106
+ break;
4107
+ }
4108
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4109
+ case 52:
3753
4110
  !isStreamResponse && unsubscribe && unsubscribe();
3754
- _context8.next = 33;
4111
+ _context8.next = 55;
3755
4112
  return new Promise(function (resolve, reject) {
3756
4113
  settle(resolve, reject, {
3757
4114
  data: responseData,
3758
- headers: AxiosHeaders$1.from(response.headers),
4115
+ headers: AxiosHeaders.from(response.headers),
3759
4116
  status: response.status,
3760
4117
  statusText: response.statusText,
3761
4118
  config: config,
3762
4119
  request: request
3763
4120
  });
3764
4121
  });
3765
- case 33:
4122
+ case 55:
3766
4123
  return _context8.abrupt("return", _context8.sent);
3767
- case 36:
3768
- _context8.prev = 36;
3769
- _context8.t2 = _context8["catch"](6);
4124
+ case 58:
4125
+ _context8.prev = 58;
4126
+ _context8.t2 = _context8["catch"](8);
3770
4127
  unsubscribe && unsubscribe();
4128
+
4129
+ // Safari can surface fetch aborts as a DOMException-like object whose
4130
+ // branded getters throw. Prefer our composed signal reason before reading
4131
+ // the caught error, preserving timeout vs cancellation semantics.
4132
+ if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
4133
+ _context8.next = 67;
4134
+ break;
4135
+ }
4136
+ canceledError = composedSignal.reason;
4137
+ canceledError.config = config;
4138
+ request && (canceledError.request = request);
4139
+ _context8.t2 !== canceledError && (canceledError.cause = _context8.t2);
4140
+ throw canceledError;
4141
+ case 67:
3771
4142
  if (!(_context8.t2 && _context8.t2.name === 'TypeError' && /Load failed|fetch/i.test(_context8.t2.message))) {
3772
- _context8.next = 41;
4143
+ _context8.next = 69;
3773
4144
  break;
3774
4145
  }
3775
- throw Object.assign(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, _context8.t2 && _context8.t2.response), {
4146
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _context8.t2 && _context8.t2.response), {
3776
4147
  cause: _context8.t2.cause || _context8.t2
3777
4148
  });
3778
- case 41:
3779
- throw AxiosError$1.from(_context8.t2, _context8.t2 && _context8.t2.code, config, request, _context8.t2 && _context8.t2.response);
3780
- case 42:
4149
+ case 69:
4150
+ throw AxiosError.from(_context8.t2, _context8.t2 && _context8.t2.code, config, request, _context8.t2 && _context8.t2.response);
4151
+ case 70:
3781
4152
  case "end":
3782
4153
  return _context8.stop();
3783
4154
  }
3784
- }, _callee7, null, [[6, 36]]);
4155
+ }, _callee7, null, [[8, 58]]);
3785
4156
  }));
3786
4157
  return function (_x8) {
3787
- return _ref17.apply(this, arguments);
4158
+ return _ref16.apply(this, arguments);
3788
4159
  };
3789
4160
  }();
3790
4161
  };
@@ -3831,13 +4202,17 @@ var contentful = (function (exports) {
3831
4202
  utils$1$1.forEach(knownAdapters, function (fn, value) {
3832
4203
  if (fn) {
3833
4204
  try {
4205
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
4206
+ // these data descriptors into accessor descriptors on the way in.
3834
4207
  Object.defineProperty(fn, 'name', {
4208
+ __proto__: null,
3835
4209
  value: value
3836
4210
  });
3837
4211
  } catch (e) {
3838
4212
  // eslint-disable-next-line no-empty
3839
4213
  }
3840
4214
  Object.defineProperty(fn, 'adapterName', {
4215
+ __proto__: null,
3841
4216
  value: value
3842
4217
  });
3843
4218
  }
@@ -3887,7 +4262,7 @@ var contentful = (function (exports) {
3887
4262
  if (!isResolvedHandle(nameOrAdapter)) {
3888
4263
  adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
3889
4264
  if (adapter === undefined) {
3890
- throw new AxiosError$1("Unknown adapter '".concat(id, "'"));
4265
+ throw new AxiosError("Unknown adapter '".concat(id, "'"));
3891
4266
  }
3892
4267
  }
3893
4268
  if (adapter && (utils$1$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
@@ -3896,14 +4271,14 @@ var contentful = (function (exports) {
3896
4271
  rejectedReasons[id || '#' + i] = adapter;
3897
4272
  }
3898
4273
  if (!adapter) {
3899
- var reasons = Object.entries(rejectedReasons).map(function (_ref20) {
3900
- var _ref21 = _slicedToArray$1(_ref20, 2),
3901
- id = _ref21[0],
3902
- state = _ref21[1];
4274
+ var reasons = Object.entries(rejectedReasons).map(function (_ref19) {
4275
+ var _ref20 = _slicedToArray$1(_ref19, 2),
4276
+ id = _ref20[0],
4277
+ state = _ref20[1];
3903
4278
  return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
3904
4279
  });
3905
4280
  var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
3906
- throw new AxiosError$1("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
4281
+ throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
3907
4282
  }
3908
4283
  return adapter;
3909
4284
  }
@@ -3936,7 +4311,7 @@ var contentful = (function (exports) {
3936
4311
  config.cancelToken.throwIfRequested();
3937
4312
  }
3938
4313
  if (config.signal && config.signal.aborted) {
3939
- throw new CanceledError$1(null, config);
4314
+ throw new CanceledError(null, config);
3940
4315
  }
3941
4316
  }
3942
4317
 
@@ -3949,20 +4324,27 @@ var contentful = (function (exports) {
3949
4324
  */
3950
4325
  function dispatchRequest(config) {
3951
4326
  throwIfCancellationRequested(config);
3952
- config.headers = AxiosHeaders$1.from(config.headers);
4327
+ config.headers = AxiosHeaders.from(config.headers);
3953
4328
 
3954
4329
  // Transform request data
3955
4330
  config.data = transformData.call(config, config.transformRequest);
3956
4331
  if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3957
4332
  config.headers.setContentType('application/x-www-form-urlencoded', false);
3958
4333
  }
3959
- var adapter = adapters.getAdapter(config.adapter || defaults$1$1.adapter, config);
4334
+ var adapter = adapters.getAdapter(config.adapter || defaults$2.adapter, config);
3960
4335
  return adapter(config).then(function onAdapterResolution(response) {
3961
4336
  throwIfCancellationRequested(config);
3962
4337
 
3963
- // Transform response data
3964
- response.data = transformData.call(config, config.transformResponse, response);
3965
- response.headers = AxiosHeaders$1.from(response.headers);
4338
+ // Expose the current response on config so that transformResponse can
4339
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
4340
+ // We clean it up afterwards to avoid polluting the config object.
4341
+ config.response = response;
4342
+ try {
4343
+ response.data = transformData.call(config, config.transformResponse, response);
4344
+ } finally {
4345
+ delete config.response;
4346
+ }
4347
+ response.headers = AxiosHeaders.from(response.headers);
3966
4348
  return response;
3967
4349
  }, function onAdapterRejection(reason) {
3968
4350
  if (!isCancel(reason)) {
@@ -3970,14 +4352,18 @@ var contentful = (function (exports) {
3970
4352
 
3971
4353
  // Transform response data
3972
4354
  if (reason && reason.response) {
3973
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
3974
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
4355
+ config.response = reason.response;
4356
+ try {
4357
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4358
+ } finally {
4359
+ delete config.response;
4360
+ }
4361
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
3975
4362
  }
3976
4363
  }
3977
4364
  return Promise.reject(reason);
3978
4365
  });
3979
4366
  }
3980
- var VERSION = "1.13.6";
3981
4367
  var validators$1 = {};
3982
4368
 
3983
4369
  // eslint-disable-next-line func-names
@@ -4005,7 +4391,7 @@ var contentful = (function (exports) {
4005
4391
  // eslint-disable-next-line func-names
4006
4392
  return function (value, opt, opts) {
4007
4393
  if (validator === false) {
4008
- throw new AxiosError$1(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError$1.ERR_DEPRECATED);
4394
+ throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
4009
4395
  }
4010
4396
  if (version && !deprecatedWarnings[opt]) {
4011
4397
  deprecatedWarnings[opt] = true;
@@ -4035,23 +4421,25 @@ var contentful = (function (exports) {
4035
4421
 
4036
4422
  function assertOptions(options, schema, allowUnknown) {
4037
4423
  if (_typeof$2(options) !== 'object') {
4038
- throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
4424
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
4039
4425
  }
4040
4426
  var keys = Object.keys(options);
4041
4427
  var i = keys.length;
4042
4428
  while (i-- > 0) {
4043
4429
  var opt = keys[i];
4044
- var _validator = schema[opt];
4430
+ // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4431
+ // a non-function validator and cause a TypeError.
4432
+ var _validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
4045
4433
  if (_validator) {
4046
4434
  var value = options[opt];
4047
4435
  var result = value === undefined || _validator(value, opt, options);
4048
4436
  if (result !== true) {
4049
- throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
4437
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
4050
4438
  }
4051
4439
  continue;
4052
4440
  }
4053
4441
  if (allowUnknown !== true) {
4054
- throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
4442
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
4055
4443
  }
4056
4444
  }
4057
4445
  }
@@ -4073,8 +4461,8 @@ var contentful = (function (exports) {
4073
4461
  _classCallCheck(this, Axios);
4074
4462
  this.defaults = instanceConfig || {};
4075
4463
  this.interceptors = {
4076
- request: new InterceptorManager$1(),
4077
- response: new InterceptorManager$1()
4464
+ request: new InterceptorManager(),
4465
+ response: new InterceptorManager()
4078
4466
  };
4079
4467
  }
4080
4468
 
@@ -4090,7 +4478,7 @@ var contentful = (function (exports) {
4090
4478
  key: "request",
4091
4479
  value: (function () {
4092
4480
  var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(configOrUrl, config) {
4093
- var dummy, stack;
4481
+ var dummy, stack, firstNewlineIndex, secondNewlineIndex, stackWithoutTwoTopLines;
4094
4482
  return _regeneratorRuntime.wrap(function _callee8$(_context9) {
4095
4483
  while (1) switch (_context9.prev = _context9.next) {
4096
4484
  case 0:
@@ -4107,13 +4495,24 @@ var contentful = (function (exports) {
4107
4495
  Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
4108
4496
 
4109
4497
  // slice off the Error: ... line
4110
- stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
4498
+ stack = function () {
4499
+ if (!dummy.stack) {
4500
+ return '';
4501
+ }
4502
+ var firstNewlineIndex = dummy.stack.indexOf('\n');
4503
+ return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4504
+ }();
4111
4505
  try {
4112
4506
  if (!_context9.t0.stack) {
4113
4507
  _context9.t0.stack = stack;
4114
4508
  // match without the 2 top stack lines
4115
- } else if (stack && !String(_context9.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
4116
- _context9.t0.stack += '\n' + stack;
4509
+ } else if (stack) {
4510
+ firstNewlineIndex = stack.indexOf('\n');
4511
+ secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
4512
+ stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
4513
+ if (!String(_context9.t0.stack).endsWith(stackWithoutTwoTopLines)) {
4514
+ _context9.t0.stack += '\n' + stack;
4515
+ }
4117
4516
  }
4118
4517
  } catch (e) {
4119
4518
  // ignore the case where "stack" is an un-writable property
@@ -4184,10 +4583,10 @@ var contentful = (function (exports) {
4184
4583
 
4185
4584
  // Flatten headers
4186
4585
  var contextHeaders = headers && utils$1$1.merge(headers.common, headers[config.method]);
4187
- headers && utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
4586
+ headers && utils$1$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
4188
4587
  delete headers[method];
4189
4588
  });
4190
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
4589
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
4191
4590
 
4192
4591
  // filter out skipped interceptors
4193
4592
  var requestInterceptorChain = [];
@@ -4266,9 +4665,7 @@ var contentful = (function (exports) {
4266
4665
  }));
4267
4666
  };
4268
4667
  });
4269
- utils$1$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4270
- /*eslint func-names:0*/
4271
-
4668
+ utils$1$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4272
4669
  function generateHTTPMethod(isForm) {
4273
4670
  return function httpMethod(url, data, config) {
4274
4671
  return this.request(mergeConfig(config || {}, {
@@ -4282,9 +4679,13 @@ var contentful = (function (exports) {
4282
4679
  };
4283
4680
  }
4284
4681
  Axios.prototype[method] = generateHTTPMethod();
4285
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4682
+
4683
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
4684
+ // its semantics, so no queryForm shorthand is generated.
4685
+ if (method !== 'query') {
4686
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4687
+ }
4286
4688
  });
4287
- var Axios$1 = Axios;
4288
4689
 
4289
4690
  /**
4290
4691
  * A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -4333,7 +4734,7 @@ var contentful = (function (exports) {
4333
4734
  // Cancellation has already been requested
4334
4735
  return;
4335
4736
  }
4336
- token.reason = new CanceledError$1(message, config, request);
4737
+ token.reason = new CanceledError(message, config, request);
4337
4738
  resolvePromise(token.reason);
4338
4739
  });
4339
4740
  }
@@ -4413,8 +4814,6 @@ var contentful = (function (exports) {
4413
4814
  }
4414
4815
  }]);
4415
4816
  }();
4416
- var CancelToken$1 = CancelToken;
4417
-
4418
4817
  /**
4419
4818
  * Syntactic sugar for invoking a function and expanding an array for arguments.
4420
4819
  *
@@ -4523,13 +4922,12 @@ var contentful = (function (exports) {
4523
4922
  SslHandshakeFailed: 525,
4524
4923
  InvalidSslCertificate: 526
4525
4924
  };
4526
- Object.entries(HttpStatusCode).forEach(function (_ref22) {
4527
- var _ref23 = _slicedToArray$1(_ref22, 2),
4528
- key = _ref23[0],
4529
- value = _ref23[1];
4925
+ Object.entries(HttpStatusCode).forEach(function (_ref21) {
4926
+ var _ref22 = _slicedToArray$1(_ref21, 2),
4927
+ key = _ref22[0],
4928
+ value = _ref22[1];
4530
4929
  HttpStatusCode[value] = key;
4531
4930
  });
4532
- var HttpStatusCode$1 = HttpStatusCode;
4533
4931
 
4534
4932
  /**
4535
4933
  * Create an instance of Axios
@@ -4539,11 +4937,11 @@ var contentful = (function (exports) {
4539
4937
  * @returns {Axios} A new instance of Axios
4540
4938
  */
4541
4939
  function createInstance(defaultConfig) {
4542
- var context = new Axios$1(defaultConfig);
4543
- var instance = bind$3(Axios$1.prototype.request, context);
4940
+ var context = new Axios(defaultConfig);
4941
+ var instance = bind$3(Axios.prototype.request, context);
4544
4942
 
4545
4943
  // Copy axios.prototype to instance
4546
- utils$1$1.extend(instance, Axios$1.prototype, context, {
4944
+ utils$1$1.extend(instance, Axios.prototype, context, {
4547
4945
  allOwnKeys: true
4548
4946
  });
4549
4947
 
@@ -4560,20 +4958,20 @@ var contentful = (function (exports) {
4560
4958
  }
4561
4959
 
4562
4960
  // Create the default instance to be exported
4563
- var axios = createInstance(defaults$1$1);
4961
+ var axios = createInstance(defaults$2);
4564
4962
 
4565
4963
  // Expose Axios class to allow class inheritance
4566
- axios.Axios = Axios$1;
4964
+ axios.Axios = Axios;
4567
4965
 
4568
4966
  // Expose Cancel & CancelToken
4569
- axios.CanceledError = CanceledError$1;
4570
- axios.CancelToken = CancelToken$1;
4967
+ axios.CanceledError = CanceledError;
4968
+ axios.CancelToken = CancelToken;
4571
4969
  axios.isCancel = isCancel;
4572
4970
  axios.VERSION = VERSION;
4573
4971
  axios.toFormData = toFormData;
4574
4972
 
4575
4973
  // Expose AxiosError class
4576
- axios.AxiosError = AxiosError$1;
4974
+ axios.AxiosError = AxiosError;
4577
4975
 
4578
4976
  // alias for CanceledError for backward compatibility
4579
4977
  axios.Cancel = axios.CanceledError;
@@ -4589,12 +4987,12 @@ var contentful = (function (exports) {
4589
4987
 
4590
4988
  // Expose mergeConfig
4591
4989
  axios.mergeConfig = mergeConfig;
4592
- axios.AxiosHeaders = AxiosHeaders$1;
4990
+ axios.AxiosHeaders = AxiosHeaders;
4593
4991
  axios.formToJSON = function (thing) {
4594
4992
  return formDataToJSON(utils$1$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4595
4993
  };
4596
4994
  axios.getAdapter = adapters.getAdapter;
4597
- axios.HttpStatusCode = HttpStatusCode$1;
4995
+ axios.HttpStatusCode = HttpStatusCode;
4598
4996
  axios.default = axios;
4599
4997
  var axios_1 = axios;
4600
4998
  var axios$1 = /*@__PURE__*/getDefaultExportFromCjs(axios_1);
@@ -9222,7 +9620,7 @@ var contentful = (function (exports) {
9222
9620
  }
9223
9621
  var responseClone = index(response);
9224
9622
  var allIncludes = Object.keys(responseClone.includes || {}).reduce(function (all, type) {
9225
- return [].concat(_toConsumableArray(all), _toConsumableArray(response.includes[type]));
9623
+ return [].concat(_toConsumableArray(all), _toConsumableArray(responseClone.includes[type]));
9226
9624
  }, []);
9227
9625
  var allEntries = [].concat(_toConsumableArray(responseClone.items), _toConsumableArray(allIncludes)).filter(function (entity) {
9228
9626
  return Boolean(entity.sys);