groove-dev 0.27.144 → 0.27.145

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.
Files changed (100) hide show
  1. package/node_modules/@groove-dev/cli/package.json +1 -1
  2. package/node_modules/@groove-dev/daemon/package.json +1 -1
  3. package/node_modules/@groove-dev/daemon/src/conversations.js +18 -48
  4. package/node_modules/@groove-dev/daemon/src/routes/agents.js +6 -83
  5. package/node_modules/@groove-dev/gui/dist/assets/{index-BcoF6_eF.js → index-Bxc0gU06.js} +232 -238
  6. package/node_modules/@groove-dev/gui/dist/assets/index-C0pztKBn.css +1 -0
  7. package/node_modules/@groove-dev/gui/dist/index.html +2 -2
  8. package/node_modules/@groove-dev/gui/package.json +1 -1
  9. package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +80 -95
  10. package/node_modules/@groove-dev/gui/src/components/agents/agent-panel.jsx +2 -70
  11. package/node_modules/@groove-dev/gui/src/components/chat/chat-header.jsx +2 -0
  12. package/node_modules/@groove-dev/gui/src/components/chat/chat-input.jsx +68 -66
  13. package/node_modules/@groove-dev/gui/src/components/chat/chat-view.jsx +4 -8
  14. package/node_modules/@groove-dev/gui/src/components/lab/chat-playground.jsx +39 -31
  15. package/node_modules/@groove-dev/gui/src/components/lab/parameter-panel.jsx +66 -65
  16. package/node_modules/@groove-dev/gui/src/components/lab/preset-manager.jsx +17 -14
  17. package/node_modules/@groove-dev/gui/src/components/lab/runtime-config.jsx +126 -127
  18. package/node_modules/@groove-dev/gui/src/components/lab/system-prompt-editor.jsx +10 -8
  19. package/node_modules/@groove-dev/gui/src/components/ui/slider.jsx +8 -8
  20. package/node_modules/@groove-dev/gui/src/lib/status.js +1 -0
  21. package/node_modules/@groove-dev/gui/src/stores/groove.js +17 -0
  22. package/node_modules/@groove-dev/gui/src/stores/slices/agents-slice.js +8 -1
  23. package/node_modules/@groove-dev/gui/src/stores/slices/chat-slice.js +13 -14
  24. package/node_modules/@groove-dev/gui/src/views/model-lab.jsx +41 -10
  25. package/node_modules/@groove-dev/gui/src/views/models.jsx +57 -36
  26. package/node_modules/axios/CHANGELOG.md +260 -0
  27. package/node_modules/axios/README.md +595 -223
  28. package/node_modules/axios/dist/axios.js +1460 -1090
  29. package/node_modules/axios/dist/axios.js.map +1 -1
  30. package/node_modules/axios/dist/axios.min.js +3 -3
  31. package/node_modules/axios/dist/axios.min.js.map +1 -1
  32. package/node_modules/axios/dist/browser/axios.cjs +1560 -1132
  33. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  34. package/node_modules/axios/dist/esm/axios.js +1557 -1128
  35. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  36. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  37. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  38. package/node_modules/axios/dist/node/axios.cjs +1594 -1057
  39. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  40. package/node_modules/axios/index.d.cts +40 -41
  41. package/node_modules/axios/index.d.ts +151 -227
  42. package/node_modules/axios/index.js +2 -0
  43. package/node_modules/axios/lib/adapters/adapters.js +4 -2
  44. package/node_modules/axios/lib/adapters/fetch.js +147 -16
  45. package/node_modules/axios/lib/adapters/http.js +306 -58
  46. package/node_modules/axios/lib/adapters/xhr.js +6 -2
  47. package/node_modules/axios/lib/core/Axios.js +7 -3
  48. package/node_modules/axios/lib/core/AxiosError.js +120 -34
  49. package/node_modules/axios/lib/core/AxiosHeaders.js +27 -25
  50. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  51. package/node_modules/axios/lib/core/dispatchRequest.js +19 -7
  52. package/node_modules/axios/lib/core/mergeConfig.js +21 -4
  53. package/node_modules/axios/lib/core/settle.js +7 -11
  54. package/node_modules/axios/lib/defaults/index.js +14 -9
  55. package/node_modules/axios/lib/env/data.js +1 -1
  56. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  57. package/node_modules/axios/lib/helpers/buildURL.js +1 -1
  58. package/node_modules/axios/lib/helpers/cookies.js +14 -2
  59. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +28 -1
  60. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  61. package/node_modules/axios/lib/helpers/formDataToStream.js +3 -2
  62. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  63. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  64. package/node_modules/axios/lib/helpers/resolveConfig.js +54 -18
  65. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +74 -2
  66. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  67. package/node_modules/axios/lib/helpers/validator.js +3 -1
  68. package/node_modules/axios/lib/utils.js +33 -21
  69. package/node_modules/axios/package.json +17 -24
  70. package/node_modules/follow-redirects/README.md +7 -5
  71. package/node_modules/follow-redirects/index.js +24 -1
  72. package/node_modules/follow-redirects/package.json +1 -1
  73. package/package.json +1 -1
  74. package/packages/cli/package.json +1 -1
  75. package/packages/daemon/package.json +1 -1
  76. package/packages/daemon/src/conversations.js +18 -48
  77. package/packages/daemon/src/routes/agents.js +6 -83
  78. package/packages/gui/dist/assets/{index-BcoF6_eF.js → index-Bxc0gU06.js} +232 -238
  79. package/packages/gui/dist/assets/index-C0pztKBn.css +1 -0
  80. package/packages/gui/dist/index.html +2 -2
  81. package/packages/gui/package.json +1 -1
  82. package/packages/gui/src/components/agents/agent-feed.jsx +80 -95
  83. package/packages/gui/src/components/agents/agent-panel.jsx +2 -70
  84. package/packages/gui/src/components/chat/chat-header.jsx +2 -0
  85. package/packages/gui/src/components/chat/chat-input.jsx +68 -66
  86. package/packages/gui/src/components/chat/chat-view.jsx +4 -8
  87. package/packages/gui/src/components/lab/chat-playground.jsx +39 -31
  88. package/packages/gui/src/components/lab/parameter-panel.jsx +66 -65
  89. package/packages/gui/src/components/lab/preset-manager.jsx +17 -14
  90. package/packages/gui/src/components/lab/runtime-config.jsx +126 -127
  91. package/packages/gui/src/components/lab/system-prompt-editor.jsx +10 -8
  92. package/packages/gui/src/components/ui/slider.jsx +8 -8
  93. package/packages/gui/src/lib/status.js +1 -0
  94. package/packages/gui/src/stores/groove.js +17 -0
  95. package/packages/gui/src/stores/slices/agents-slice.js +8 -1
  96. package/packages/gui/src/stores/slices/chat-slice.js +13 -14
  97. package/packages/gui/src/views/model-lab.jsx +41 -10
  98. package/packages/gui/src/views/models.jsx +57 -36
  99. package/node_modules/@groove-dev/gui/dist/assets/index-Dd7qhiEd.css +0 -1
  100. package/packages/gui/dist/assets/index-Dd7qhiEd.css +0 -1
@@ -1,4 +1,4 @@
1
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -745,9 +745,9 @@
745
745
  * also have a `name` and `type` attribute to specify filename and content type
746
746
  *
747
747
  * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
748
- *
748
+ *
749
749
  * @param {*} value The value to test
750
- *
750
+ *
751
751
  * @returns {boolean} True if value is a React Native Blob, otherwise false
752
752
  */
753
753
  var isReactNativeBlob = function isReactNativeBlob(value) {
@@ -757,9 +757,9 @@
757
757
  /**
758
758
  * Determine if environment is React Native
759
759
  * ReactNative `FormData` has a non-standard `getParts()` method
760
- *
760
+ *
761
761
  * @param {*} formData The formData to test
762
- *
762
+ *
763
763
  * @returns {boolean} True if environment is React Native, otherwise false
764
764
  */
765
765
  var isReactNative = function isReactNative(formData) {
@@ -780,7 +780,7 @@
780
780
  *
781
781
  * @param {*} val The value to test
782
782
  *
783
- * @returns {boolean} True if value is a File, otherwise false
783
+ * @returns {boolean} True if value is a FileList, otherwise false
784
784
  */
785
785
  var isFileList = kindOfTest('FileList');
786
786
 
@@ -812,10 +812,16 @@
812
812
  var G = getGlobal();
813
813
  var FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
814
814
  var isFormData = function isFormData(thing) {
815
- var kind;
816
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
815
+ if (!thing) return false;
816
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
817
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData.
818
+ var proto = getPrototypeOf(thing);
819
+ if (!proto || proto === Object.prototype) return false;
820
+ if (!isFunction$1(thing.append)) return false;
821
+ var kind = kindOf(thing);
822
+ return kind === 'formdata' ||
817
823
  // detect form-data instance
818
- kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
824
+ kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]';
819
825
  };
820
826
 
821
827
  /**
@@ -948,8 +954,7 @@
948
954
  *
949
955
  * @returns {Object} Result of all merge properties
950
956
  */
951
- function merge(/* obj1, obj2, obj3, ... */
952
- ) {
957
+ function merge() {
953
958
  var _ref2 = isContextDefined(this) && this || {},
954
959
  caseless = _ref2.caseless,
955
960
  skipUndefined = _ref2.skipUndefined;
@@ -960,8 +965,12 @@
960
965
  return;
961
966
  }
962
967
  var targetKey = caseless && findKey(result, key) || key;
963
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
964
- result[targetKey] = merge(result[targetKey], val);
968
+ // Read via own-prop only — a bare `result[targetKey]` walks the prototype
969
+ // chain, so a polluted Object.prototype value could surface here and get
970
+ // copied into the merged result.
971
+ var existing = hasOwnProperty(result, targetKey) ? result[targetKey] : undefined;
972
+ if (isPlainObject(existing) && isPlainObject(val)) {
973
+ result[targetKey] = merge(existing, val);
965
974
  } else if (isPlainObject(val)) {
966
975
  result[targetKey] = merge({}, val);
967
976
  } else if (isArray(val)) {
@@ -970,8 +979,11 @@
970
979
  result[targetKey] = val;
971
980
  }
972
981
  };
973
- for (var i = 0, l = arguments.length; i < l; i++) {
974
- arguments[i] && forEach(arguments[i], assignValue);
982
+ for (var _len = arguments.length, objs = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
983
+ objs[_key2] = arguments[_key2];
984
+ }
985
+ for (var i = 0, l = objs.length; i < l; i++) {
986
+ objs[i] && forEach(objs[i], assignValue);
975
987
  }
976
988
  return result;
977
989
  }
@@ -993,6 +1005,9 @@
993
1005
  forEach(b, function (val, key) {
994
1006
  if (thisArg && isFunction$1(val)) {
995
1007
  Object.defineProperty(a, key, {
1008
+ // Null-proto descriptor so a polluted Object.prototype.get cannot
1009
+ // hijack defineProperty's accessor-vs-data resolution.
1010
+ __proto__: null,
996
1011
  value: bind(val, thisArg),
997
1012
  writable: true,
998
1013
  enumerable: true,
@@ -1000,6 +1015,7 @@
1000
1015
  });
1001
1016
  } else {
1002
1017
  Object.defineProperty(a, key, {
1018
+ __proto__: null,
1003
1019
  value: val,
1004
1020
  writable: true,
1005
1021
  enumerable: true,
@@ -1038,12 +1054,14 @@
1038
1054
  var inherits = function inherits(constructor, superConstructor, props, descriptors) {
1039
1055
  constructor.prototype = Object.create(superConstructor.prototype, descriptors);
1040
1056
  Object.defineProperty(constructor.prototype, 'constructor', {
1057
+ __proto__: null,
1041
1058
  value: constructor,
1042
1059
  writable: true,
1043
1060
  enumerable: false,
1044
1061
  configurable: true
1045
1062
  });
1046
1063
  Object.defineProperty(constructor, 'super', {
1064
+ __proto__: null,
1047
1065
  value: superConstructor.prototype
1048
1066
  });
1049
1067
  props && Object.assign(constructor.prototype, props);
@@ -1214,7 +1232,7 @@
1214
1232
  var freezeMethods = function freezeMethods(obj) {
1215
1233
  reduceDescriptors(obj, function (descriptor, name) {
1216
1234
  // skip restricted props in strict mode
1217
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
1235
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].includes(name)) {
1218
1236
  return false;
1219
1237
  }
1220
1238
  var value = obj[name];
@@ -1426,1098 +1444,1179 @@
1426
1444
  isIterable: isIterable
1427
1445
  };
1428
1446
 
1429
- var AxiosError = /*#__PURE__*/function (_Error) {
1430
- /**
1431
- * Create an Error with the specified message, config, error code, request and response.
1432
- *
1433
- * @param {string} message The error message.
1434
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
1435
- * @param {Object} [config] The config.
1436
- * @param {Object} [request] The request.
1437
- * @param {Object} [response] The response.
1438
- *
1439
- * @returns {Error} The created error.
1440
- */
1441
- function AxiosError(message, code, config, request, response) {
1442
- var _this;
1443
- _classCallCheck(this, AxiosError);
1444
- _this = _callSuper(this, AxiosError, [message]);
1445
-
1446
- // Make message enumerable to maintain backward compatibility
1447
- // The native Error constructor sets message as non-enumerable,
1448
- // but axios < v1.13.3 had it as enumerable
1449
- Object.defineProperty(_this, 'message', {
1450
- value: message,
1451
- enumerable: true,
1452
- writable: true,
1453
- configurable: true
1454
- });
1455
- _this.name = 'AxiosError';
1456
- _this.isAxiosError = true;
1457
- code && (_this.code = code);
1458
- config && (_this.config = config);
1459
- request && (_this.request = request);
1460
- if (response) {
1461
- _this.response = response;
1462
- _this.status = response.status;
1463
- }
1464
- return _this;
1465
- }
1466
- _inherits(AxiosError, _Error);
1467
- return _createClass(AxiosError, [{
1468
- key: "toJSON",
1469
- value: function toJSON() {
1470
- return {
1471
- // Standard
1472
- message: this.message,
1473
- name: this.name,
1474
- // Microsoft
1475
- description: this.description,
1476
- number: this.number,
1477
- // Mozilla
1478
- fileName: this.fileName,
1479
- lineNumber: this.lineNumber,
1480
- columnNumber: this.columnNumber,
1481
- stack: this.stack,
1482
- // Axios
1483
- config: utils$1.toJSONObject(this.config),
1484
- code: this.code,
1485
- status: this.status
1486
- };
1487
- }
1488
- }], [{
1489
- key: "from",
1490
- value: function from(error, code, config, request, response, customProps) {
1491
- var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1492
- axiosError.cause = error;
1493
- axiosError.name = error.name;
1494
-
1495
- // Preserve status from the original error if not already set from response
1496
- if (error.status != null && axiosError.status == null) {
1497
- axiosError.status = error.status;
1498
- }
1499
- customProps && Object.assign(axiosError, customProps);
1500
- return axiosError;
1501
- }
1502
- }]);
1503
- }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1504
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1505
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1506
- AxiosError.ECONNABORTED = 'ECONNABORTED';
1507
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1508
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1509
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1510
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1511
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1512
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1513
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1514
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1515
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1516
-
1517
- // eslint-disable-next-line strict
1518
- var httpAdapter = null;
1519
-
1520
- /**
1521
- * Determines if the given thing is a array or js object.
1522
- *
1523
- * @param {string} thing - The object or array to be visited.
1524
- *
1525
- * @returns {boolean}
1526
- */
1527
- function isVisitable(thing) {
1528
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1529
- }
1530
-
1531
- /**
1532
- * It removes the brackets from the end of a string
1533
- *
1534
- * @param {string} key - The key of the parameter.
1535
- *
1536
- * @returns {string} the key without the brackets.
1537
- */
1538
- function removeBrackets(key) {
1539
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1540
- }
1541
-
1542
- /**
1543
- * It takes a path, a key, and a boolean, and returns a string
1544
- *
1545
- * @param {string} path - The path to the current key.
1546
- * @param {string} key - The key of the current object being iterated over.
1547
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1548
- *
1549
- * @returns {string} The path to the current key.
1550
- */
1551
- function renderKey(path, key, dots) {
1552
- if (!path) return key;
1553
- return path.concat(key).map(function each(token, i) {
1554
- // eslint-disable-next-line no-param-reassign
1555
- token = removeBrackets(token);
1556
- return !dots && i ? '[' + token + ']' : token;
1557
- }).join(dots ? '.' : '');
1558
- }
1559
-
1560
- /**
1561
- * If the array is an array and none of its elements are visitable, then it's a flat array.
1562
- *
1563
- * @param {Array<any>} arr - The array to check
1564
- *
1565
- * @returns {boolean}
1566
- */
1567
- function isFlatArray(arr) {
1568
- return utils$1.isArray(arr) && !arr.some(isVisitable);
1569
- }
1570
- var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1571
- return /^is[A-Z]/.test(prop);
1572
- });
1447
+ // RawAxiosHeaders whose duplicates are ignored by node
1448
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1449
+ var ignoreDuplicateOf = utils$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']);
1573
1450
 
1574
1451
  /**
1575
- * Convert a data object to FormData
1576
- *
1577
- * @param {Object} obj
1578
- * @param {?Object} [formData]
1579
- * @param {?Object} [options]
1580
- * @param {Function} [options.visitor]
1581
- * @param {Boolean} [options.metaTokens = true]
1582
- * @param {Boolean} [options.dots = false]
1583
- * @param {?Boolean} [options.indexes = false]
1452
+ * Parse headers into an object
1584
1453
  *
1585
- * @returns {Object}
1586
- **/
1587
-
1588
- /**
1589
- * It converts an object into a FormData object
1454
+ * ```
1455
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1456
+ * Content-Type: application/json
1457
+ * Connection: keep-alive
1458
+ * Transfer-Encoding: chunked
1459
+ * ```
1590
1460
  *
1591
- * @param {Object<any, any>} obj - The object to convert to form data.
1592
- * @param {string} formData - The FormData object to append to.
1593
- * @param {Object<string, any>} options
1461
+ * @param {String} rawHeaders Headers needing to be parsed
1594
1462
  *
1595
- * @returns
1463
+ * @returns {Object} Headers parsed into an object
1596
1464
  */
1597
- function toFormData(obj, formData, options) {
1598
- if (!utils$1.isObject(obj)) {
1599
- throw new TypeError('target must be an object');
1600
- }
1601
-
1602
- // eslint-disable-next-line no-param-reassign
1603
- formData = formData || new (FormData)();
1604
-
1605
- // eslint-disable-next-line no-param-reassign
1606
- options = utils$1.toFlatObject(options, {
1607
- metaTokens: true,
1608
- dots: false,
1609
- indexes: false
1610
- }, false, function defined(option, source) {
1611
- // eslint-disable-next-line no-eq-null,eqeqeq
1612
- return !utils$1.isUndefined(source[option]);
1613
- });
1614
- var metaTokens = options.metaTokens;
1615
- // eslint-disable-next-line no-use-before-define
1616
- var visitor = options.visitor || defaultVisitor;
1617
- var dots = options.dots;
1618
- var indexes = options.indexes;
1619
- var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1620
- var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1621
- if (!utils$1.isFunction(visitor)) {
1622
- throw new TypeError('visitor must be a function');
1623
- }
1624
- function convertValue(value) {
1625
- if (value === null) return '';
1626
- if (utils$1.isDate(value)) {
1627
- return value.toISOString();
1465
+ var parseHeaders = (function (rawHeaders) {
1466
+ var parsed = {};
1467
+ var key;
1468
+ var val;
1469
+ var i;
1470
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1471
+ i = line.indexOf(':');
1472
+ key = line.substring(0, i).trim().toLowerCase();
1473
+ val = line.substring(i + 1).trim();
1474
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1475
+ return;
1628
1476
  }
1629
- if (utils$1.isBoolean(value)) {
1630
- return value.toString();
1477
+ if (key === 'set-cookie') {
1478
+ if (parsed[key]) {
1479
+ parsed[key].push(val);
1480
+ } else {
1481
+ parsed[key] = [val];
1482
+ }
1483
+ } else {
1484
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1631
1485
  }
1632
- if (!useBlob && utils$1.isBlob(value)) {
1633
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1486
+ });
1487
+ return parsed;
1488
+ });
1489
+
1490
+ var $internals = Symbol('internals');
1491
+ var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1492
+ function trimSPorHTAB(str) {
1493
+ var start = 0;
1494
+ var end = str.length;
1495
+ while (start < end) {
1496
+ var code = str.charCodeAt(start);
1497
+ if (code !== 0x09 && code !== 0x20) {
1498
+ break;
1634
1499
  }
1635
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1636
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1500
+ start += 1;
1501
+ }
1502
+ while (end > start) {
1503
+ var _code = str.charCodeAt(end - 1);
1504
+ if (_code !== 0x09 && _code !== 0x20) {
1505
+ break;
1637
1506
  }
1507
+ end -= 1;
1508
+ }
1509
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1510
+ }
1511
+ function normalizeHeader(header) {
1512
+ return header && String(header).trim().toLowerCase();
1513
+ }
1514
+ function sanitizeHeaderValue(str) {
1515
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1516
+ }
1517
+ function normalizeValue(value) {
1518
+ if (value === false || value == null) {
1638
1519
  return value;
1639
1520
  }
1640
-
1641
- /**
1642
- * Default visitor.
1643
- *
1644
- * @param {*} value
1645
- * @param {String|Number} key
1646
- * @param {Array<String|Number>} path
1647
- * @this {FormData}
1648
- *
1649
- * @returns {boolean} return true to visit the each prop of the value recursively
1650
- */
1651
- function defaultVisitor(value, key, path) {
1652
- var arr = value;
1653
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1654
- formData.append(renderKey(path, key, dots), convertValue(value));
1521
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1522
+ }
1523
+ function parseTokens(str) {
1524
+ var tokens = Object.create(null);
1525
+ var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1526
+ var match;
1527
+ while (match = tokensRE.exec(str)) {
1528
+ tokens[match[1]] = match[2];
1529
+ }
1530
+ return tokens;
1531
+ }
1532
+ var isValidHeaderName = function isValidHeaderName(str) {
1533
+ return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1534
+ };
1535
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1536
+ if (utils$1.isFunction(filter)) {
1537
+ return filter.call(this, value, header);
1538
+ }
1539
+ if (isHeaderNameFilter) {
1540
+ value = header;
1541
+ }
1542
+ if (!utils$1.isString(value)) return;
1543
+ if (utils$1.isString(filter)) {
1544
+ return value.indexOf(filter) !== -1;
1545
+ }
1546
+ if (utils$1.isRegExp(filter)) {
1547
+ return filter.test(value);
1548
+ }
1549
+ }
1550
+ function formatHeader(header) {
1551
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
1552
+ return _char.toUpperCase() + str;
1553
+ });
1554
+ }
1555
+ function buildAccessors(obj, header) {
1556
+ var accessorName = utils$1.toCamelCase(' ' + header);
1557
+ ['get', 'set', 'has'].forEach(function (methodName) {
1558
+ Object.defineProperty(obj, methodName + accessorName, {
1559
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1560
+ // this data descriptor into an accessor descriptor on the way in.
1561
+ __proto__: null,
1562
+ value: function value(arg1, arg2, arg3) {
1563
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1564
+ },
1565
+ configurable: true
1566
+ });
1567
+ });
1568
+ }
1569
+ var AxiosHeaders = /*#__PURE__*/function () {
1570
+ function AxiosHeaders(headers) {
1571
+ _classCallCheck(this, AxiosHeaders);
1572
+ headers && this.set(headers);
1573
+ }
1574
+ return _createClass(AxiosHeaders, [{
1575
+ key: "set",
1576
+ value: function set(header, valueOrRewrite, rewrite) {
1577
+ var self = this;
1578
+ function setHeader(_value, _header, _rewrite) {
1579
+ var lHeader = normalizeHeader(_header);
1580
+ if (!lHeader) {
1581
+ throw new Error('header name must be a non-empty string');
1582
+ }
1583
+ var key = utils$1.findKey(self, lHeader);
1584
+ if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1585
+ self[key || _header] = normalizeValue(_value);
1586
+ }
1587
+ }
1588
+ var setHeaders = function setHeaders(headers, _rewrite) {
1589
+ return utils$1.forEach(headers, function (_value, _header) {
1590
+ return setHeader(_value, _header, _rewrite);
1591
+ });
1592
+ };
1593
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1594
+ setHeaders(header, valueOrRewrite);
1595
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1596
+ setHeaders(parseHeaders(header), valueOrRewrite);
1597
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1598
+ var obj = {},
1599
+ dest,
1600
+ key;
1601
+ var _iterator = _createForOfIteratorHelper(header),
1602
+ _step;
1603
+ try {
1604
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1605
+ var entry = _step.value;
1606
+ if (!utils$1.isArray(entry)) {
1607
+ throw TypeError('Object iterator must return a key-value pair');
1608
+ }
1609
+ obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
1610
+ }
1611
+ } catch (err) {
1612
+ _iterator.e(err);
1613
+ } finally {
1614
+ _iterator.f();
1615
+ }
1616
+ setHeaders(obj, valueOrRewrite);
1617
+ } else {
1618
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1619
+ }
1620
+ return this;
1621
+ }
1622
+ }, {
1623
+ key: "get",
1624
+ value: function get(header, parser) {
1625
+ header = normalizeHeader(header);
1626
+ if (header) {
1627
+ var key = utils$1.findKey(this, header);
1628
+ if (key) {
1629
+ var value = this[key];
1630
+ if (!parser) {
1631
+ return value;
1632
+ }
1633
+ if (parser === true) {
1634
+ return parseTokens(value);
1635
+ }
1636
+ if (utils$1.isFunction(parser)) {
1637
+ return parser.call(this, value, key);
1638
+ }
1639
+ if (utils$1.isRegExp(parser)) {
1640
+ return parser.exec(value);
1641
+ }
1642
+ throw new TypeError('parser must be boolean|regexp|function');
1643
+ }
1644
+ }
1645
+ }
1646
+ }, {
1647
+ key: "has",
1648
+ value: function has(header, matcher) {
1649
+ header = normalizeHeader(header);
1650
+ if (header) {
1651
+ var key = utils$1.findKey(this, header);
1652
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1653
+ }
1655
1654
  return false;
1656
1655
  }
1657
- if (value && !path && _typeof(value) === 'object') {
1658
- if (utils$1.endsWith(key, '{}')) {
1659
- // eslint-disable-next-line no-param-reassign
1660
- key = metaTokens ? key : key.slice(0, -2);
1661
- // eslint-disable-next-line no-param-reassign
1662
- value = JSON.stringify(value);
1663
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
1664
- // eslint-disable-next-line no-param-reassign
1665
- key = removeBrackets(key);
1666
- arr.forEach(function each(el, index) {
1667
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1668
- // eslint-disable-next-line no-nested-ternary
1669
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1670
- });
1671
- return false;
1656
+ }, {
1657
+ key: "delete",
1658
+ value: function _delete(header, matcher) {
1659
+ var self = this;
1660
+ var deleted = false;
1661
+ function deleteHeader(_header) {
1662
+ _header = normalizeHeader(_header);
1663
+ if (_header) {
1664
+ var key = utils$1.findKey(self, _header);
1665
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1666
+ delete self[key];
1667
+ deleted = true;
1668
+ }
1669
+ }
1672
1670
  }
1671
+ if (utils$1.isArray(header)) {
1672
+ header.forEach(deleteHeader);
1673
+ } else {
1674
+ deleteHeader(header);
1675
+ }
1676
+ return deleted;
1673
1677
  }
1674
- if (isVisitable(value)) {
1675
- return true;
1678
+ }, {
1679
+ key: "clear",
1680
+ value: function clear(matcher) {
1681
+ var keys = Object.keys(this);
1682
+ var i = keys.length;
1683
+ var deleted = false;
1684
+ while (i--) {
1685
+ var key = keys[i];
1686
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1687
+ delete this[key];
1688
+ deleted = true;
1689
+ }
1690
+ }
1691
+ return deleted;
1676
1692
  }
1677
- formData.append(renderKey(path, key, dots), convertValue(value));
1678
- return false;
1679
- }
1680
- var stack = [];
1681
- var exposedHelpers = Object.assign(predicates, {
1682
- defaultVisitor: defaultVisitor,
1683
- convertValue: convertValue,
1684
- isVisitable: isVisitable
1685
- });
1686
- function build(value, path) {
1687
- if (utils$1.isUndefined(value)) return;
1688
- if (stack.indexOf(value) !== -1) {
1689
- throw Error('Circular reference detected in ' + path.join('.'));
1693
+ }, {
1694
+ key: "normalize",
1695
+ value: function normalize(format) {
1696
+ var self = this;
1697
+ var headers = {};
1698
+ utils$1.forEach(this, function (value, header) {
1699
+ var key = utils$1.findKey(headers, header);
1700
+ if (key) {
1701
+ self[key] = normalizeValue(value);
1702
+ delete self[header];
1703
+ return;
1704
+ }
1705
+ var normalized = format ? formatHeader(header) : String(header).trim();
1706
+ if (normalized !== header) {
1707
+ delete self[header];
1708
+ }
1709
+ self[normalized] = normalizeValue(value);
1710
+ headers[normalized] = true;
1711
+ });
1712
+ return this;
1690
1713
  }
1691
- stack.push(value);
1692
- utils$1.forEach(value, function each(el, key) {
1693
- var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1694
- if (result === true) {
1695
- build(el, path ? path.concat(key) : [key]);
1714
+ }, {
1715
+ key: "concat",
1716
+ value: function concat() {
1717
+ var _this$constructor;
1718
+ for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
1719
+ targets[_key] = arguments[_key];
1696
1720
  }
1697
- });
1698
- stack.pop();
1699
- }
1700
- if (!utils$1.isObject(obj)) {
1701
- throw new TypeError('data must be an object');
1702
- }
1703
- build(obj);
1704
- return formData;
1705
- }
1721
+ return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
1722
+ }
1723
+ }, {
1724
+ key: "toJSON",
1725
+ value: function toJSON(asStrings) {
1726
+ var obj = Object.create(null);
1727
+ utils$1.forEach(this, function (value, header) {
1728
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1729
+ });
1730
+ return obj;
1731
+ }
1732
+ }, {
1733
+ key: Symbol.iterator,
1734
+ value: function value() {
1735
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1736
+ }
1737
+ }, {
1738
+ key: "toString",
1739
+ value: function toString() {
1740
+ return Object.entries(this.toJSON()).map(function (_ref) {
1741
+ var _ref2 = _slicedToArray(_ref, 2),
1742
+ header = _ref2[0],
1743
+ value = _ref2[1];
1744
+ return header + ': ' + value;
1745
+ }).join('\n');
1746
+ }
1747
+ }, {
1748
+ key: "getSetCookie",
1749
+ value: function getSetCookie() {
1750
+ return this.get('set-cookie') || [];
1751
+ }
1752
+ }, {
1753
+ key: Symbol.toStringTag,
1754
+ get: function get() {
1755
+ return 'AxiosHeaders';
1756
+ }
1757
+ }], [{
1758
+ key: "from",
1759
+ value: function from(thing) {
1760
+ return thing instanceof this ? thing : new this(thing);
1761
+ }
1762
+ }, {
1763
+ key: "concat",
1764
+ value: function concat(first) {
1765
+ var computed = new this(first);
1766
+ for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
1767
+ targets[_key2 - 1] = arguments[_key2];
1768
+ }
1769
+ targets.forEach(function (target) {
1770
+ return computed.set(target);
1771
+ });
1772
+ return computed;
1773
+ }
1774
+ }, {
1775
+ key: "accessor",
1776
+ value: function accessor(header) {
1777
+ var internals = this[$internals] = this[$internals] = {
1778
+ accessors: {}
1779
+ };
1780
+ var accessors = internals.accessors;
1781
+ var prototype = this.prototype;
1782
+ function defineAccessor(_header) {
1783
+ var lHeader = normalizeHeader(_header);
1784
+ if (!accessors[lHeader]) {
1785
+ buildAccessors(prototype, _header);
1786
+ accessors[lHeader] = true;
1787
+ }
1788
+ }
1789
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1790
+ return this;
1791
+ }
1792
+ }]);
1793
+ }();
1794
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1706
1795
 
1707
- /**
1708
- * It encodes a string by replacing all characters that are not in the unreserved set with
1709
- * their percent-encoded equivalents
1710
- *
1711
- * @param {string} str - The string to encode.
1712
- *
1713
- * @returns {string} The encoded string.
1714
- */
1715
- function encode$1(str) {
1716
- var charMap = {
1717
- '!': '%21',
1718
- "'": '%27',
1719
- '(': '%28',
1720
- ')': '%29',
1721
- '~': '%7E',
1722
- '%20': '+',
1723
- '%00': '\x00'
1796
+ // reserved names hotfix
1797
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
1798
+ var value = _ref3.value;
1799
+ var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1800
+ return {
1801
+ get: function get() {
1802
+ return value;
1803
+ },
1804
+ set: function set(headerValue) {
1805
+ this[mapped] = headerValue;
1806
+ }
1724
1807
  };
1725
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1726
- return charMap[match];
1727
- });
1728
- }
1729
-
1730
- /**
1731
- * It takes a params object and converts it to a FormData object
1732
- *
1733
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1734
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1735
- *
1736
- * @returns {void}
1737
- */
1738
- function AxiosURLSearchParams(params, options) {
1739
- this._pairs = [];
1740
- params && toFormData(params, this, options);
1741
- }
1742
- var prototype = AxiosURLSearchParams.prototype;
1743
- prototype.append = function append(name, value) {
1744
- this._pairs.push([name, value]);
1745
- };
1746
- prototype.toString = function toString(encoder) {
1747
- var _encode = encoder ? function (value) {
1748
- return encoder.call(this, value, encode$1);
1749
- } : encode$1;
1750
- return this._pairs.map(function each(pair) {
1751
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1752
- }, '').join('&');
1753
- };
1754
-
1755
- /**
1756
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1757
- * their plain counterparts (`:`, `$`, `,`, `+`).
1758
- *
1759
- * @param {string} val The value to be encoded.
1760
- *
1761
- * @returns {string} The encoded value.
1762
- */
1763
- function encode(val) {
1764
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1765
- }
1808
+ });
1809
+ utils$1.freezeMethods(AxiosHeaders);
1766
1810
 
1767
- /**
1768
- * Build a URL by appending params to the end
1769
- *
1770
- * @param {string} url The base of the url (e.g., http://www.google.com)
1771
- * @param {object} [params] The params to be appended
1772
- * @param {?(object|Function)} options
1773
- *
1774
- * @returns {string} The formatted url
1775
- */
1776
- function buildURL(url, params, options) {
1777
- if (!params) {
1778
- return url;
1779
- }
1780
- var _encode = options && options.encode || encode;
1781
- var _options = utils$1.isFunction(options) ? {
1782
- serialize: options
1783
- } : options;
1784
- var serializeFn = _options && _options.serialize;
1785
- var serializedParams;
1786
- if (serializeFn) {
1787
- serializedParams = serializeFn(params, _options);
1788
- } else {
1789
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1811
+ var REDACTED = '[REDACTED ****]';
1812
+ function hasOwnOrPrototypeToJSON(source) {
1813
+ if (utils$1.hasOwnProp(source, 'toJSON')) {
1814
+ return true;
1790
1815
  }
1791
- if (serializedParams) {
1792
- var hashmarkIndex = url.indexOf('#');
1793
- if (hashmarkIndex !== -1) {
1794
- url = url.slice(0, hashmarkIndex);
1816
+ var prototype = Object.getPrototypeOf(source);
1817
+ while (prototype && prototype !== Object.prototype) {
1818
+ if (utils$1.hasOwnProp(prototype, 'toJSON')) {
1819
+ return true;
1795
1820
  }
1796
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1821
+ prototype = Object.getPrototypeOf(prototype);
1797
1822
  }
1798
- return url;
1823
+ return false;
1799
1824
  }
1800
1825
 
1801
- var InterceptorManager = /*#__PURE__*/function () {
1802
- function InterceptorManager() {
1803
- _classCallCheck(this, InterceptorManager);
1804
- this.handlers = [];
1805
- }
1806
-
1826
+ // Build a plain-object snapshot of `config` and replace the value of any key
1827
+ // (case-insensitive) listed in `redactKeys` with REDACTED. Walks through arrays
1828
+ // and AxiosHeaders, and short-circuits on circular references.
1829
+ function redactConfig(config, redactKeys) {
1830
+ var lowerKeys = new Set(redactKeys.map(function (k) {
1831
+ return String(k).toLowerCase();
1832
+ }));
1833
+ var seen = [];
1834
+ var _visit = function visit(source) {
1835
+ if (source === null || _typeof(source) !== 'object') return source;
1836
+ if (utils$1.isBuffer(source)) return source;
1837
+ if (seen.indexOf(source) !== -1) return undefined;
1838
+ if (source instanceof AxiosHeaders) {
1839
+ source = source.toJSON();
1840
+ }
1841
+ seen.push(source);
1842
+ var result;
1843
+ if (utils$1.isArray(source)) {
1844
+ result = [];
1845
+ source.forEach(function (v, i) {
1846
+ var reducedValue = _visit(v);
1847
+ if (!utils$1.isUndefined(reducedValue)) {
1848
+ result[i] = reducedValue;
1849
+ }
1850
+ });
1851
+ } else {
1852
+ if (!utils$1.isPlainObject(source) && hasOwnOrPrototypeToJSON(source)) {
1853
+ seen.pop();
1854
+ return source;
1855
+ }
1856
+ result = Object.create(null);
1857
+ for (var _i = 0, _Object$entries = Object.entries(source); _i < _Object$entries.length; _i++) {
1858
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
1859
+ key = _Object$entries$_i[0],
1860
+ value = _Object$entries$_i[1];
1861
+ var reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED : _visit(value);
1862
+ if (!utils$1.isUndefined(reducedValue)) {
1863
+ result[key] = reducedValue;
1864
+ }
1865
+ }
1866
+ }
1867
+ seen.pop();
1868
+ return result;
1869
+ };
1870
+ return _visit(config);
1871
+ }
1872
+ var AxiosError = /*#__PURE__*/function (_Error) {
1807
1873
  /**
1808
- * Add a new interceptor to the stack
1874
+ * Create an Error with the specified message, config, error code, request and response.
1809
1875
  *
1810
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1811
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1812
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1876
+ * @param {string} message The error message.
1877
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
1878
+ * @param {Object} [config] The config.
1879
+ * @param {Object} [request] The request.
1880
+ * @param {Object} [response] The response.
1813
1881
  *
1814
- * @return {Number} An ID used to remove interceptor later
1882
+ * @returns {Error} The created error.
1815
1883
  */
1816
- return _createClass(InterceptorManager, [{
1817
- key: "use",
1818
- value: function use(fulfilled, rejected, options) {
1819
- this.handlers.push({
1820
- fulfilled: fulfilled,
1821
- rejected: rejected,
1822
- synchronous: options ? options.synchronous : false,
1823
- runWhen: options ? options.runWhen : null
1824
- });
1825
- return this.handlers.length - 1;
1826
- }
1884
+ function AxiosError(message, code, config, request, response) {
1885
+ var _this;
1886
+ _classCallCheck(this, AxiosError);
1887
+ _this = _callSuper(this, AxiosError, [message]);
1827
1888
 
1828
- /**
1829
- * Remove an interceptor from the stack
1830
- *
1831
- * @param {Number} id The ID that was returned by `use`
1832
- *
1833
- * @returns {void}
1834
- */
1835
- }, {
1836
- key: "eject",
1837
- value: function eject(id) {
1838
- if (this.handlers[id]) {
1839
- this.handlers[id] = null;
1840
- }
1889
+ // Make message enumerable to maintain backward compatibility
1890
+ // The native Error constructor sets message as non-enumerable,
1891
+ // but axios < v1.13.3 had it as enumerable
1892
+ Object.defineProperty(_this, 'message', {
1893
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
1894
+ // this data descriptor into an accessor descriptor on the way in.
1895
+ __proto__: null,
1896
+ value: message,
1897
+ enumerable: true,
1898
+ writable: true,
1899
+ configurable: true
1900
+ });
1901
+ _this.name = 'AxiosError';
1902
+ _this.isAxiosError = true;
1903
+ code && (_this.code = code);
1904
+ config && (_this.config = config);
1905
+ request && (_this.request = request);
1906
+ if (response) {
1907
+ _this.response = response;
1908
+ _this.status = response.status;
1909
+ }
1910
+ return _this;
1911
+ }
1912
+ _inherits(AxiosError, _Error);
1913
+ return _createClass(AxiosError, [{
1914
+ key: "toJSON",
1915
+ value: function toJSON() {
1916
+ // Opt-in redaction: when the request config carries a `redact` array, the
1917
+ // value of any matching key (case-insensitive, at any depth) is replaced
1918
+ // with REDACTED in the serialized snapshot. Undefined or empty leaves the
1919
+ // existing serialization behavior unchanged.
1920
+ var config = this.config;
1921
+ var redactKeys = config && utils$1.hasOwnProp(config, 'redact') ? config.redact : undefined;
1922
+ var serializedConfig = utils$1.isArray(redactKeys) && redactKeys.length > 0 ? redactConfig(config, redactKeys) : utils$1.toJSONObject(config);
1923
+ return {
1924
+ // Standard
1925
+ message: this.message,
1926
+ name: this.name,
1927
+ // Microsoft
1928
+ description: this.description,
1929
+ number: this.number,
1930
+ // Mozilla
1931
+ fileName: this.fileName,
1932
+ lineNumber: this.lineNumber,
1933
+ columnNumber: this.columnNumber,
1934
+ stack: this.stack,
1935
+ // Axios
1936
+ config: serializedConfig,
1937
+ code: this.code,
1938
+ status: this.status
1939
+ };
1841
1940
  }
1941
+ }], [{
1942
+ key: "from",
1943
+ value: function from(error, code, config, request, response, customProps) {
1944
+ var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1945
+ axiosError.cause = error;
1946
+ axiosError.name = error.name;
1842
1947
 
1843
- /**
1844
- * Clear all interceptors from the stack
1845
- *
1846
- * @returns {void}
1847
- */
1848
- }, {
1849
- key: "clear",
1850
- value: function clear() {
1851
- if (this.handlers) {
1852
- this.handlers = [];
1948
+ // Preserve status from the original error if not already set from response
1949
+ if (error.status != null && axiosError.status == null) {
1950
+ axiosError.status = error.status;
1853
1951
  }
1854
- }
1855
-
1856
- /**
1857
- * Iterate over all the registered interceptors
1858
- *
1859
- * This method is particularly useful for skipping over any
1860
- * interceptors that may have become `null` calling `eject`.
1861
- *
1862
- * @param {Function} fn The function to call for each interceptor
1863
- *
1864
- * @returns {void}
1865
- */
1866
- }, {
1867
- key: "forEach",
1868
- value: function forEach(fn) {
1869
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1870
- if (h !== null) {
1871
- fn(h);
1872
- }
1873
- });
1952
+ customProps && Object.assign(axiosError, customProps);
1953
+ return axiosError;
1874
1954
  }
1875
1955
  }]);
1876
- }();
1877
-
1878
- var transitionalDefaults = {
1879
- silentJSONParsing: true,
1880
- forcedJSONParsing: true,
1881
- clarifyTimeoutError: false,
1882
- legacyInterceptorReqResOrdering: true
1883
- };
1884
-
1885
- var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1886
-
1887
- var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1956
+ }(/*#__PURE__*/_wrapNativeSuper(Error)); // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
1957
+ AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
1958
+ AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
1959
+ AxiosError.ECONNABORTED = 'ECONNABORTED';
1960
+ AxiosError.ETIMEDOUT = 'ETIMEDOUT';
1961
+ AxiosError.ECONNREFUSED = 'ECONNREFUSED';
1962
+ AxiosError.ERR_NETWORK = 'ERR_NETWORK';
1963
+ AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
1964
+ AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
1965
+ AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
1966
+ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1967
+ AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1968
+ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1969
+ AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1970
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1888
1971
 
1889
- var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1972
+ // eslint-disable-next-line strict
1973
+ var httpAdapter = null;
1890
1974
 
1891
- var platform$1 = {
1892
- isBrowser: true,
1893
- classes: {
1894
- URLSearchParams: URLSearchParams$1,
1895
- FormData: FormData$1,
1896
- Blob: Blob$1
1897
- },
1898
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1899
- };
1975
+ /**
1976
+ * Determines if the given thing is a array or js object.
1977
+ *
1978
+ * @param {string} thing - The object or array to be visited.
1979
+ *
1980
+ * @returns {boolean}
1981
+ */
1982
+ function isVisitable(thing) {
1983
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
1984
+ }
1900
1985
 
1901
- var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1902
- var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
1986
+ /**
1987
+ * It removes the brackets from the end of a string
1988
+ *
1989
+ * @param {string} key - The key of the parameter.
1990
+ *
1991
+ * @returns {string} the key without the brackets.
1992
+ */
1993
+ function removeBrackets(key) {
1994
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
1995
+ }
1903
1996
 
1904
1997
  /**
1905
- * Determine if we're running in a standard browser environment
1998
+ * It takes a path, a key, and a boolean, and returns a string
1906
1999
  *
1907
- * This allows axios to run in a web worker, and react-native.
1908
- * Both environments support XMLHttpRequest, but not fully standard globals.
2000
+ * @param {string} path - The path to the current key.
2001
+ * @param {string} key - The key of the current object being iterated over.
2002
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
1909
2003
  *
1910
- * web workers:
1911
- * typeof window -> undefined
1912
- * typeof document -> undefined
2004
+ * @returns {string} The path to the current key.
2005
+ */
2006
+ function renderKey(path, key, dots) {
2007
+ if (!path) return key;
2008
+ return path.concat(key).map(function each(token, i) {
2009
+ // eslint-disable-next-line no-param-reassign
2010
+ token = removeBrackets(token);
2011
+ return !dots && i ? '[' + token + ']' : token;
2012
+ }).join(dots ? '.' : '');
2013
+ }
2014
+
2015
+ /**
2016
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
1913
2017
  *
1914
- * react-native:
1915
- * navigator.product -> 'ReactNative'
1916
- * nativescript
1917
- * navigator.product -> 'NativeScript' or 'NS'
2018
+ * @param {Array<any>} arr - The array to check
1918
2019
  *
1919
2020
  * @returns {boolean}
1920
2021
  */
1921
- var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2022
+ function isFlatArray(arr) {
2023
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
2024
+ }
2025
+ var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
2026
+ return /^is[A-Z]/.test(prop);
2027
+ });
1922
2028
 
1923
2029
  /**
1924
- * Determine if we're running in a standard browser webWorker environment
2030
+ * Convert a data object to FormData
1925
2031
  *
1926
- * Although the `isStandardBrowserEnv` method indicates that
1927
- * `allows axios to run in a web worker`, the WebWorker will still be
1928
- * filtered out due to its judgment standard
1929
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1930
- * This leads to a problem when axios post `FormData` in webWorker
2032
+ * @param {Object} obj
2033
+ * @param {?Object} [formData]
2034
+ * @param {?Object} [options]
2035
+ * @param {Function} [options.visitor]
2036
+ * @param {Boolean} [options.metaTokens = true]
2037
+ * @param {Boolean} [options.dots = false]
2038
+ * @param {?Boolean} [options.indexes = false]
2039
+ *
2040
+ * @returns {Object}
2041
+ **/
2042
+
2043
+ /**
2044
+ * It converts an object into a FormData object
2045
+ *
2046
+ * @param {Object<any, any>} obj - The object to convert to form data.
2047
+ * @param {string} formData - The FormData object to append to.
2048
+ * @param {Object<string, any>} options
2049
+ *
2050
+ * @returns
1931
2051
  */
1932
- var hasStandardBrowserWebWorkerEnv = function () {
1933
- return typeof WorkerGlobalScope !== 'undefined' &&
1934
- // eslint-disable-next-line no-undef
1935
- self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1936
- }();
1937
- var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2052
+ function toFormData(obj, formData, options) {
2053
+ if (!utils$1.isObject(obj)) {
2054
+ throw new TypeError('target must be an object');
2055
+ }
1938
2056
 
1939
- var utils = /*#__PURE__*/Object.freeze({
1940
- __proto__: null,
1941
- hasBrowserEnv: hasBrowserEnv,
1942
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1943
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1944
- navigator: _navigator,
1945
- origin: origin
1946
- });
2057
+ // eslint-disable-next-line no-param-reassign
2058
+ formData = formData || new (FormData)();
1947
2059
 
1948
- var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
2060
+ // eslint-disable-next-line no-param-reassign
2061
+ options = utils$1.toFlatObject(options, {
2062
+ metaTokens: true,
2063
+ dots: false,
2064
+ indexes: false
2065
+ }, false, function defined(option, source) {
2066
+ // eslint-disable-next-line no-eq-null,eqeqeq
2067
+ return !utils$1.isUndefined(source[option]);
2068
+ });
2069
+ var metaTokens = options.metaTokens;
2070
+ // eslint-disable-next-line no-use-before-define
2071
+ var visitor = options.visitor || defaultVisitor;
2072
+ var dots = options.dots;
2073
+ var indexes = options.indexes;
2074
+ var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2075
+ var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2076
+ var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2077
+ if (!utils$1.isFunction(visitor)) {
2078
+ throw new TypeError('visitor must be a function');
2079
+ }
2080
+ function convertValue(value) {
2081
+ if (value === null) return '';
2082
+ if (utils$1.isDate(value)) {
2083
+ return value.toISOString();
2084
+ }
2085
+ if (utils$1.isBoolean(value)) {
2086
+ return value.toString();
2087
+ }
2088
+ if (!useBlob && utils$1.isBlob(value)) {
2089
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
2090
+ }
2091
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2092
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2093
+ }
2094
+ return value;
2095
+ }
1949
2096
 
1950
- function toURLEncodedForm(data, options) {
1951
- return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread2({
1952
- visitor: function visitor(value, key, path, helpers) {
1953
- if (platform.isNode && utils$1.isBuffer(value)) {
1954
- this.append(key, value.toString('base64'));
2097
+ /**
2098
+ * Default visitor.
2099
+ *
2100
+ * @param {*} value
2101
+ * @param {String|Number} key
2102
+ * @param {Array<String|Number>} path
2103
+ * @this {FormData}
2104
+ *
2105
+ * @returns {boolean} return true to visit the each prop of the value recursively
2106
+ */
2107
+ function defaultVisitor(value, key, path) {
2108
+ var arr = value;
2109
+ if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
2110
+ formData.append(renderKey(path, key, dots), convertValue(value));
2111
+ return false;
2112
+ }
2113
+ if (value && !path && _typeof(value) === 'object') {
2114
+ if (utils$1.endsWith(key, '{}')) {
2115
+ // eslint-disable-next-line no-param-reassign
2116
+ key = metaTokens ? key : key.slice(0, -2);
2117
+ // eslint-disable-next-line no-param-reassign
2118
+ value = JSON.stringify(value);
2119
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2120
+ // eslint-disable-next-line no-param-reassign
2121
+ key = removeBrackets(key);
2122
+ arr.forEach(function each(el, index) {
2123
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
2124
+ // eslint-disable-next-line no-nested-ternary
2125
+ indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
2126
+ });
1955
2127
  return false;
1956
2128
  }
1957
- return helpers.defaultVisitor.apply(this, arguments);
1958
2129
  }
1959
- }, options));
1960
- }
1961
-
1962
- /**
1963
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1964
- *
1965
- * @param {string} name - The name of the property to get.
1966
- *
1967
- * @returns An array of strings.
1968
- */
1969
- function parsePropPath(name) {
1970
- // foo[x][y][z]
1971
- // foo.x.y.z
1972
- // foo-x-y-z
1973
- // foo x y z
1974
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
1975
- return match[0] === '[]' ? '' : match[1] || match[0];
2130
+ if (isVisitable(value)) {
2131
+ return true;
2132
+ }
2133
+ formData.append(renderKey(path, key, dots), convertValue(value));
2134
+ return false;
2135
+ }
2136
+ var stack = [];
2137
+ var exposedHelpers = Object.assign(predicates, {
2138
+ defaultVisitor: defaultVisitor,
2139
+ convertValue: convertValue,
2140
+ isVisitable: isVisitable
1976
2141
  });
2142
+ function build(value, path) {
2143
+ var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2144
+ if (utils$1.isUndefined(value)) return;
2145
+ if (depth > maxDepth) {
2146
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2147
+ }
2148
+ if (stack.indexOf(value) !== -1) {
2149
+ throw Error('Circular reference detected in ' + path.join('.'));
2150
+ }
2151
+ stack.push(value);
2152
+ utils$1.forEach(value, function each(el, key) {
2153
+ var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
2154
+ if (result === true) {
2155
+ build(el, path ? path.concat(key) : [key], depth + 1);
2156
+ }
2157
+ });
2158
+ stack.pop();
2159
+ }
2160
+ if (!utils$1.isObject(obj)) {
2161
+ throw new TypeError('data must be an object');
2162
+ }
2163
+ build(obj);
2164
+ return formData;
1977
2165
  }
1978
2166
 
1979
2167
  /**
1980
- * Convert an array to an object.
2168
+ * It encodes a string by replacing all characters that are not in the unreserved set with
2169
+ * their percent-encoded equivalents
1981
2170
  *
1982
- * @param {Array<any>} arr - The array to convert to an object.
2171
+ * @param {string} str - The string to encode.
1983
2172
  *
1984
- * @returns An object with the same keys and values as the array.
2173
+ * @returns {string} The encoded string.
1985
2174
  */
1986
- function arrayToObject(arr) {
1987
- var obj = {};
1988
- var keys = Object.keys(arr);
1989
- var i;
1990
- var len = keys.length;
1991
- var key;
1992
- for (i = 0; i < len; i++) {
1993
- key = keys[i];
1994
- obj[key] = arr[key];
1995
- }
1996
- return obj;
2175
+ function encode$1(str) {
2176
+ var charMap = {
2177
+ '!': '%21',
2178
+ "'": '%27',
2179
+ '(': '%28',
2180
+ ')': '%29',
2181
+ '~': '%7E',
2182
+ '%20': '+'
2183
+ };
2184
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
2185
+ return charMap[match];
2186
+ });
1997
2187
  }
1998
2188
 
1999
2189
  /**
2000
- * It takes a FormData object and returns a JavaScript object
2190
+ * It takes a params object and converts it to a FormData object
2001
2191
  *
2002
- * @param {string} formData The FormData object to convert to JSON.
2192
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
2193
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
2003
2194
  *
2004
- * @returns {Object<string, any> | null} The converted object.
2195
+ * @returns {void}
2005
2196
  */
2006
- function formDataToJSON(formData) {
2007
- function buildPath(path, value, target, index) {
2008
- var name = path[index++];
2009
- if (name === '__proto__') return true;
2010
- var isNumericKey = Number.isFinite(+name);
2011
- var isLast = index >= path.length;
2012
- name = !name && utils$1.isArray(target) ? target.length : name;
2013
- if (isLast) {
2014
- if (utils$1.hasOwnProp(target, name)) {
2015
- target[name] = [target[name], value];
2016
- } else {
2017
- target[name] = value;
2018
- }
2019
- return !isNumericKey;
2020
- }
2021
- if (!target[name] || !utils$1.isObject(target[name])) {
2022
- target[name] = [];
2023
- }
2024
- var result = buildPath(path, value, target[name], index);
2025
- if (result && utils$1.isArray(target[name])) {
2026
- target[name] = arrayToObject(target[name]);
2027
- }
2028
- return !isNumericKey;
2029
- }
2030
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2031
- var obj = {};
2032
- utils$1.forEachEntry(formData, function (name, value) {
2033
- buildPath(parsePropPath(name), value, obj, 0);
2034
- });
2035
- return obj;
2036
- }
2037
- return null;
2197
+ function AxiosURLSearchParams(params, options) {
2198
+ this._pairs = [];
2199
+ params && toFormData(params, this, options);
2038
2200
  }
2201
+ var prototype = AxiosURLSearchParams.prototype;
2202
+ prototype.append = function append(name, value) {
2203
+ this._pairs.push([name, value]);
2204
+ };
2205
+ prototype.toString = function toString(encoder) {
2206
+ var _encode = encoder ? function (value) {
2207
+ return encoder.call(this, value, encode$1);
2208
+ } : encode$1;
2209
+ return this._pairs.map(function each(pair) {
2210
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
2211
+ }, '').join('&');
2212
+ };
2039
2213
 
2040
2214
  /**
2041
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2042
- * of the input
2215
+ * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
2216
+ * their plain counterparts (`:`, `$`, `,`, `+`).
2043
2217
  *
2044
- * @param {any} rawValue - The value to be stringified.
2045
- * @param {Function} parser - A function that parses a string into a JavaScript object.
2046
- * @param {Function} encoder - A function that takes a value and returns a string.
2218
+ * @param {string} val The value to be encoded.
2047
2219
  *
2048
- * @returns {string} A stringified version of the rawValue.
2220
+ * @returns {string} The encoded value.
2049
2221
  */
2050
- function stringifySafely(rawValue, parser, encoder) {
2051
- if (utils$1.isString(rawValue)) {
2052
- try {
2053
- (parser || JSON.parse)(rawValue);
2054
- return utils$1.trim(rawValue);
2055
- } catch (e) {
2056
- if (e.name !== 'SyntaxError') {
2057
- throw e;
2058
- }
2059
- }
2060
- }
2061
- return (encoder || JSON.stringify)(rawValue);
2222
+ function encode(val) {
2223
+ return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
2062
2224
  }
2063
- var defaults = {
2064
- transitional: transitionalDefaults,
2065
- adapter: ['xhr', 'http', 'fetch'],
2066
- transformRequest: [function transformRequest(data, headers) {
2067
- var contentType = headers.getContentType() || '';
2068
- var hasJSONContentType = contentType.indexOf('application/json') > -1;
2069
- var isObjectPayload = utils$1.isObject(data);
2070
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
2071
- data = new FormData(data);
2072
- }
2073
- var isFormData = utils$1.isFormData(data);
2074
- if (isFormData) {
2075
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2076
- }
2077
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
2078
- return data;
2079
- }
2080
- if (utils$1.isArrayBufferView(data)) {
2081
- return data.buffer;
2082
- }
2083
- if (utils$1.isURLSearchParams(data)) {
2084
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2085
- return data.toString();
2086
- }
2087
- var isFileList;
2088
- if (isObjectPayload) {
2089
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2090
- return toURLEncodedForm(data, this.formSerializer).toString();
2091
- }
2092
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2093
- var _FormData = this.env && this.env.FormData;
2094
- return toFormData(isFileList ? {
2095
- 'files[]': data
2096
- } : data, _FormData && new _FormData(), this.formSerializer);
2097
- }
2098
- }
2099
- if (isObjectPayload || hasJSONContentType) {
2100
- headers.setContentType('application/json', false);
2101
- return stringifySafely(data);
2102
- }
2103
- return data;
2104
- }],
2105
- transformResponse: [function transformResponse(data) {
2106
- var transitional = this.transitional || defaults.transitional;
2107
- var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2108
- var JSONRequested = this.responseType === 'json';
2109
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2110
- return data;
2111
- }
2112
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
2113
- var silentJSONParsing = transitional && transitional.silentJSONParsing;
2114
- var strictJSONParsing = !silentJSONParsing && JSONRequested;
2115
- try {
2116
- return JSON.parse(data, this.parseReviver);
2117
- } catch (e) {
2118
- if (strictJSONParsing) {
2119
- if (e.name === 'SyntaxError') {
2120
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
2121
- }
2122
- throw e;
2123
- }
2124
- }
2125
- }
2126
- return data;
2127
- }],
2128
- /**
2129
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
2130
- * timeout is not created.
2131
- */
2132
- timeout: 0,
2133
- xsrfCookieName: 'XSRF-TOKEN',
2134
- xsrfHeaderName: 'X-XSRF-TOKEN',
2135
- maxContentLength: -1,
2136
- maxBodyLength: -1,
2137
- env: {
2138
- FormData: platform.classes.FormData,
2139
- Blob: platform.classes.Blob
2140
- },
2141
- validateStatus: function validateStatus(status) {
2142
- return status >= 200 && status < 300;
2143
- },
2144
- headers: {
2145
- common: {
2146
- Accept: 'application/json, text/plain, */*',
2147
- 'Content-Type': undefined
2148
- }
2149
- }
2150
- };
2151
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) {
2152
- defaults.headers[method] = {};
2153
- });
2154
-
2155
- // RawAxiosHeaders whose duplicates are ignored by node
2156
- // c.f. https://nodejs.org/api/http.html#http_message_headers
2157
- var ignoreDuplicateOf = utils$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']);
2158
2225
 
2159
- /**
2160
- * Parse headers into an object
2161
- *
2162
- * ```
2163
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
2164
- * Content-Type: application/json
2165
- * Connection: keep-alive
2166
- * Transfer-Encoding: chunked
2167
- * ```
2226
+ /**
2227
+ * Build a URL by appending params to the end
2168
2228
  *
2169
- * @param {String} rawHeaders Headers needing to be parsed
2229
+ * @param {string} url The base of the url (e.g., http://www.google.com)
2230
+ * @param {object} [params] The params to be appended
2231
+ * @param {?(object|Function)} options
2170
2232
  *
2171
- * @returns {Object} Headers parsed into an object
2233
+ * @returns {string} The formatted url
2172
2234
  */
2173
- var parseHeaders = (function (rawHeaders) {
2174
- var parsed = {};
2175
- var key;
2176
- var val;
2177
- var i;
2178
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
2179
- i = line.indexOf(':');
2180
- key = line.substring(0, i).trim().toLowerCase();
2181
- val = line.substring(i + 1).trim();
2182
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
2183
- return;
2184
- }
2185
- if (key === 'set-cookie') {
2186
- if (parsed[key]) {
2187
- parsed[key].push(val);
2188
- } else {
2189
- parsed[key] = [val];
2190
- }
2191
- } else {
2192
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
2193
- }
2194
- });
2195
- return parsed;
2196
- });
2197
-
2198
- var $internals = Symbol('internals');
2199
- var isValidHeaderValue = function isValidHeaderValue(value) {
2200
- return !/[\r\n]/.test(value);
2201
- };
2202
- function assertValidHeaderValue(value, header) {
2203
- if (value === false || value == null) {
2204
- return;
2205
- }
2206
- if (utils$1.isArray(value)) {
2207
- value.forEach(function (v) {
2208
- return assertValidHeaderValue(v, header);
2209
- });
2210
- return;
2235
+ function buildURL(url, params, options) {
2236
+ if (!params) {
2237
+ return url;
2211
2238
  }
2212
- if (!isValidHeaderValue(String(value))) {
2213
- throw new Error("Invalid character in header content [\"".concat(header, "\"]"));
2239
+ var _encode = options && options.encode || encode;
2240
+ var _options = utils$1.isFunction(options) ? {
2241
+ serialize: options
2242
+ } : options;
2243
+ var serializeFn = _options && _options.serialize;
2244
+ var serializedParams;
2245
+ if (serializeFn) {
2246
+ serializedParams = serializeFn(params, _options);
2247
+ } else {
2248
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
2214
2249
  }
2215
- }
2216
- function normalizeHeader(header) {
2217
- return header && String(header).trim().toLowerCase();
2218
- }
2219
- function stripTrailingCRLF(str) {
2220
- var end = str.length;
2221
- while (end > 0) {
2222
- var charCode = str.charCodeAt(end - 1);
2223
- if (charCode !== 10 && charCode !== 13) {
2224
- break;
2250
+ if (serializedParams) {
2251
+ var hashmarkIndex = url.indexOf('#');
2252
+ if (hashmarkIndex !== -1) {
2253
+ url = url.slice(0, hashmarkIndex);
2225
2254
  }
2226
- end -= 1;
2227
- }
2228
- return end === str.length ? str : str.slice(0, end);
2229
- }
2230
- function normalizeValue(value) {
2231
- if (value === false || value == null) {
2232
- return value;
2233
- }
2234
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
2235
- }
2236
- function parseTokens(str) {
2237
- var tokens = Object.create(null);
2238
- var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
2239
- var match;
2240
- while (match = tokensRE.exec(str)) {
2241
- tokens[match[1]] = match[2];
2242
- }
2243
- return tokens;
2244
- }
2245
- var isValidHeaderName = function isValidHeaderName(str) {
2246
- return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
2247
- };
2248
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
2249
- if (utils$1.isFunction(filter)) {
2250
- return filter.call(this, value, header);
2251
- }
2252
- if (isHeaderNameFilter) {
2253
- value = header;
2254
- }
2255
- if (!utils$1.isString(value)) return;
2256
- if (utils$1.isString(filter)) {
2257
- return value.indexOf(filter) !== -1;
2258
- }
2259
- if (utils$1.isRegExp(filter)) {
2260
- return filter.test(value);
2255
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
2261
2256
  }
2257
+ return url;
2262
2258
  }
2263
- function formatHeader(header) {
2264
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) {
2265
- return _char.toUpperCase() + str;
2266
- });
2267
- }
2268
- function buildAccessors(obj, header) {
2269
- var accessorName = utils$1.toCamelCase(' ' + header);
2270
- ['get', 'set', 'has'].forEach(function (methodName) {
2271
- Object.defineProperty(obj, methodName + accessorName, {
2272
- value: function value(arg1, arg2, arg3) {
2273
- return this[methodName].call(this, header, arg1, arg2, arg3);
2274
- },
2275
- configurable: true
2276
- });
2277
- });
2278
- }
2279
- var AxiosHeaders = /*#__PURE__*/function () {
2280
- function AxiosHeaders(headers) {
2281
- _classCallCheck(this, AxiosHeaders);
2282
- headers && this.set(headers);
2259
+
2260
+ var InterceptorManager = /*#__PURE__*/function () {
2261
+ function InterceptorManager() {
2262
+ _classCallCheck(this, InterceptorManager);
2263
+ this.handlers = [];
2283
2264
  }
2284
- return _createClass(AxiosHeaders, [{
2285
- key: "set",
2286
- value: function set(header, valueOrRewrite, rewrite) {
2287
- var self = this;
2288
- function setHeader(_value, _header, _rewrite) {
2289
- var lHeader = normalizeHeader(_header);
2290
- if (!lHeader) {
2291
- throw new Error('header name must be a non-empty string');
2292
- }
2293
- var key = utils$1.findKey(self, lHeader);
2294
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
2295
- assertValidHeaderValue(_value, _header);
2296
- self[key || _header] = normalizeValue(_value);
2297
- }
2298
- }
2299
- var setHeaders = function setHeaders(headers, _rewrite) {
2300
- return utils$1.forEach(headers, function (_value, _header) {
2301
- return setHeader(_value, _header, _rewrite);
2302
- });
2303
- };
2304
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
2305
- setHeaders(header, valueOrRewrite);
2306
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
2307
- setHeaders(parseHeaders(header), valueOrRewrite);
2308
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
2309
- var obj = {},
2310
- dest,
2311
- key;
2312
- var _iterator = _createForOfIteratorHelper(header),
2313
- _step;
2314
- try {
2315
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2316
- var entry = _step.value;
2317
- if (!utils$1.isArray(entry)) {
2318
- throw TypeError('Object iterator must return a key-value pair');
2319
- }
2320
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
2321
- }
2322
- } catch (err) {
2323
- _iterator.e(err);
2324
- } finally {
2325
- _iterator.f();
2326
- }
2327
- setHeaders(obj, valueOrRewrite);
2328
- } else {
2329
- header != null && setHeader(valueOrRewrite, header, rewrite);
2330
- }
2331
- return this;
2332
- }
2333
- }, {
2334
- key: "get",
2335
- value: function get(header, parser) {
2336
- header = normalizeHeader(header);
2337
- if (header) {
2338
- var key = utils$1.findKey(this, header);
2339
- if (key) {
2340
- var value = this[key];
2341
- if (!parser) {
2342
- return value;
2343
- }
2344
- if (parser === true) {
2345
- return parseTokens(value);
2346
- }
2347
- if (utils$1.isFunction(parser)) {
2348
- return parser.call(this, value, key);
2349
- }
2350
- if (utils$1.isRegExp(parser)) {
2351
- return parser.exec(value);
2352
- }
2353
- throw new TypeError('parser must be boolean|regexp|function');
2354
- }
2355
- }
2356
- }
2357
- }, {
2358
- key: "has",
2359
- value: function has(header, matcher) {
2360
- header = normalizeHeader(header);
2361
- if (header) {
2362
- var key = utils$1.findKey(this, header);
2363
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
2364
- }
2365
- return false;
2265
+
2266
+ /**
2267
+ * Add a new interceptor to the stack
2268
+ *
2269
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
2270
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
2271
+ * @param {Object} options The options for the interceptor, synchronous and runWhen
2272
+ *
2273
+ * @return {Number} An ID used to remove interceptor later
2274
+ */
2275
+ return _createClass(InterceptorManager, [{
2276
+ key: "use",
2277
+ value: function use(fulfilled, rejected, options) {
2278
+ this.handlers.push({
2279
+ fulfilled: fulfilled,
2280
+ rejected: rejected,
2281
+ synchronous: options ? options.synchronous : false,
2282
+ runWhen: options ? options.runWhen : null
2283
+ });
2284
+ return this.handlers.length - 1;
2366
2285
  }
2286
+
2287
+ /**
2288
+ * Remove an interceptor from the stack
2289
+ *
2290
+ * @param {Number} id The ID that was returned by `use`
2291
+ *
2292
+ * @returns {void}
2293
+ */
2367
2294
  }, {
2368
- key: "delete",
2369
- value: function _delete(header, matcher) {
2370
- var self = this;
2371
- var deleted = false;
2372
- function deleteHeader(_header) {
2373
- _header = normalizeHeader(_header);
2374
- if (_header) {
2375
- var key = utils$1.findKey(self, _header);
2376
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
2377
- delete self[key];
2378
- deleted = true;
2379
- }
2380
- }
2381
- }
2382
- if (utils$1.isArray(header)) {
2383
- header.forEach(deleteHeader);
2384
- } else {
2385
- deleteHeader(header);
2295
+ key: "eject",
2296
+ value: function eject(id) {
2297
+ if (this.handlers[id]) {
2298
+ this.handlers[id] = null;
2386
2299
  }
2387
- return deleted;
2388
2300
  }
2301
+
2302
+ /**
2303
+ * Clear all interceptors from the stack
2304
+ *
2305
+ * @returns {void}
2306
+ */
2389
2307
  }, {
2390
2308
  key: "clear",
2391
- value: function clear(matcher) {
2392
- var keys = Object.keys(this);
2393
- var i = keys.length;
2394
- var deleted = false;
2395
- while (i--) {
2396
- var key = keys[i];
2397
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
2398
- delete this[key];
2399
- deleted = true;
2400
- }
2309
+ value: function clear() {
2310
+ if (this.handlers) {
2311
+ this.handlers = [];
2401
2312
  }
2402
- return deleted;
2403
2313
  }
2314
+
2315
+ /**
2316
+ * Iterate over all the registered interceptors
2317
+ *
2318
+ * This method is particularly useful for skipping over any
2319
+ * interceptors that may have become `null` calling `eject`.
2320
+ *
2321
+ * @param {Function} fn The function to call for each interceptor
2322
+ *
2323
+ * @returns {void}
2324
+ */
2404
2325
  }, {
2405
- key: "normalize",
2406
- value: function normalize(format) {
2407
- var self = this;
2408
- var headers = {};
2409
- utils$1.forEach(this, function (value, header) {
2410
- var key = utils$1.findKey(headers, header);
2411
- if (key) {
2412
- self[key] = normalizeValue(value);
2413
- delete self[header];
2414
- return;
2415
- }
2416
- var normalized = format ? formatHeader(header) : String(header).trim();
2417
- if (normalized !== header) {
2418
- delete self[header];
2326
+ key: "forEach",
2327
+ value: function forEach(fn) {
2328
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2329
+ if (h !== null) {
2330
+ fn(h);
2419
2331
  }
2420
- self[normalized] = normalizeValue(value);
2421
- headers[normalized] = true;
2422
2332
  });
2423
- return this;
2424
2333
  }
2425
- }, {
2426
- key: "concat",
2427
- value: function concat() {
2428
- var _this$constructor;
2429
- for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) {
2430
- targets[_key] = arguments[_key];
2334
+ }]);
2335
+ }();
2336
+
2337
+ var transitionalDefaults = {
2338
+ silentJSONParsing: true,
2339
+ forcedJSONParsing: true,
2340
+ clarifyTimeoutError: false,
2341
+ legacyInterceptorReqResOrdering: true
2342
+ };
2343
+
2344
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
2345
+
2346
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
2347
+
2348
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
2349
+
2350
+ var platform$1 = {
2351
+ isBrowser: true,
2352
+ classes: {
2353
+ URLSearchParams: URLSearchParams$1,
2354
+ FormData: FormData$1,
2355
+ Blob: Blob$1
2356
+ },
2357
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
2358
+ };
2359
+
2360
+ var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
2361
+ var _navigator = (typeof navigator === "undefined" ? "undefined" : _typeof(navigator)) === 'object' && navigator || undefined;
2362
+
2363
+ /**
2364
+ * Determine if we're running in a standard browser environment
2365
+ *
2366
+ * This allows axios to run in a web worker, and react-native.
2367
+ * Both environments support XMLHttpRequest, but not fully standard globals.
2368
+ *
2369
+ * web workers:
2370
+ * typeof window -> undefined
2371
+ * typeof document -> undefined
2372
+ *
2373
+ * react-native:
2374
+ * navigator.product -> 'ReactNative'
2375
+ * nativescript
2376
+ * navigator.product -> 'NativeScript' or 'NS'
2377
+ *
2378
+ * @returns {boolean}
2379
+ */
2380
+ var hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
2381
+
2382
+ /**
2383
+ * Determine if we're running in a standard browser webWorker environment
2384
+ *
2385
+ * Although the `isStandardBrowserEnv` method indicates that
2386
+ * `allows axios to run in a web worker`, the WebWorker will still be
2387
+ * filtered out due to its judgment standard
2388
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
2389
+ * This leads to a problem when axios post `FormData` in webWorker
2390
+ */
2391
+ var hasStandardBrowserWebWorkerEnv = function () {
2392
+ return typeof WorkerGlobalScope !== 'undefined' &&
2393
+ // eslint-disable-next-line no-undef
2394
+ self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
2395
+ }();
2396
+ var origin = hasBrowserEnv && window.location.href || 'http://localhost';
2397
+
2398
+ var utils = /*#__PURE__*/Object.freeze({
2399
+ __proto__: null,
2400
+ hasBrowserEnv: hasBrowserEnv,
2401
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
2402
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
2403
+ navigator: _navigator,
2404
+ origin: origin
2405
+ });
2406
+
2407
+ var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
2408
+
2409
+ function toURLEncodedForm(data, options) {
2410
+ return toFormData(data, new platform.classes.URLSearchParams(), _objectSpread2({
2411
+ visitor: function visitor(value, key, path, helpers) {
2412
+ if (platform.isNode && utils$1.isBuffer(value)) {
2413
+ this.append(key, value.toString('base64'));
2414
+ return false;
2431
2415
  }
2432
- return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets));
2416
+ return helpers.defaultVisitor.apply(this, arguments);
2433
2417
  }
2434
- }, {
2435
- key: "toJSON",
2436
- value: function toJSON(asStrings) {
2437
- var obj = Object.create(null);
2438
- utils$1.forEach(this, function (value, header) {
2439
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
2440
- });
2441
- return obj;
2418
+ }, options));
2419
+ }
2420
+
2421
+ /**
2422
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2423
+ *
2424
+ * @param {string} name - The name of the property to get.
2425
+ *
2426
+ * @returns An array of strings.
2427
+ */
2428
+ function parsePropPath(name) {
2429
+ // foo[x][y][z]
2430
+ // foo.x.y.z
2431
+ // foo-x-y-z
2432
+ // foo x y z
2433
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2434
+ return match[0] === '[]' ? '' : match[1] || match[0];
2435
+ });
2436
+ }
2437
+
2438
+ /**
2439
+ * Convert an array to an object.
2440
+ *
2441
+ * @param {Array<any>} arr - The array to convert to an object.
2442
+ *
2443
+ * @returns An object with the same keys and values as the array.
2444
+ */
2445
+ function arrayToObject(arr) {
2446
+ var obj = {};
2447
+ var keys = Object.keys(arr);
2448
+ var i;
2449
+ var len = keys.length;
2450
+ var key;
2451
+ for (i = 0; i < len; i++) {
2452
+ key = keys[i];
2453
+ obj[key] = arr[key];
2454
+ }
2455
+ return obj;
2456
+ }
2457
+
2458
+ /**
2459
+ * It takes a FormData object and returns a JavaScript object
2460
+ *
2461
+ * @param {string} formData The FormData object to convert to JSON.
2462
+ *
2463
+ * @returns {Object<string, any> | null} The converted object.
2464
+ */
2465
+ function formDataToJSON(formData) {
2466
+ function buildPath(path, value, target, index) {
2467
+ var name = path[index++];
2468
+ if (name === '__proto__') return true;
2469
+ var isNumericKey = Number.isFinite(+name);
2470
+ var isLast = index >= path.length;
2471
+ name = !name && utils$1.isArray(target) ? target.length : name;
2472
+ if (isLast) {
2473
+ if (utils$1.hasOwnProp(target, name)) {
2474
+ target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
2475
+ } else {
2476
+ target[name] = value;
2477
+ }
2478
+ return !isNumericKey;
2442
2479
  }
2443
- }, {
2444
- key: Symbol.iterator,
2445
- value: function value() {
2446
- return Object.entries(this.toJSON())[Symbol.iterator]();
2480
+ if (!target[name] || !utils$1.isObject(target[name])) {
2481
+ target[name] = [];
2482
+ }
2483
+ var result = buildPath(path, value, target[name], index);
2484
+ if (result && utils$1.isArray(target[name])) {
2485
+ target[name] = arrayToObject(target[name]);
2486
+ }
2487
+ return !isNumericKey;
2488
+ }
2489
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
2490
+ var obj = {};
2491
+ utils$1.forEachEntry(formData, function (name, value) {
2492
+ buildPath(parsePropPath(name), value, obj, 0);
2493
+ });
2494
+ return obj;
2495
+ }
2496
+ return null;
2497
+ }
2498
+
2499
+ var own = function own(obj, key) {
2500
+ return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
2501
+ };
2502
+
2503
+ /**
2504
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
2505
+ * of the input
2506
+ *
2507
+ * @param {any} rawValue - The value to be stringified.
2508
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
2509
+ * @param {Function} encoder - A function that takes a value and returns a string.
2510
+ *
2511
+ * @returns {string} A stringified version of the rawValue.
2512
+ */
2513
+ function stringifySafely(rawValue, parser, encoder) {
2514
+ if (utils$1.isString(rawValue)) {
2515
+ try {
2516
+ (parser || JSON.parse)(rawValue);
2517
+ return utils$1.trim(rawValue);
2518
+ } catch (e) {
2519
+ if (e.name !== 'SyntaxError') {
2520
+ throw e;
2521
+ }
2522
+ }
2523
+ }
2524
+ return (encoder || JSON.stringify)(rawValue);
2525
+ }
2526
+ var defaults = {
2527
+ transitional: transitionalDefaults,
2528
+ adapter: ['xhr', 'http', 'fetch'],
2529
+ transformRequest: [function transformRequest(data, headers) {
2530
+ var contentType = headers.getContentType() || '';
2531
+ var hasJSONContentType = contentType.indexOf('application/json') > -1;
2532
+ var isObjectPayload = utils$1.isObject(data);
2533
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
2534
+ data = new FormData(data);
2447
2535
  }
2448
- }, {
2449
- key: "toString",
2450
- value: function toString() {
2451
- return Object.entries(this.toJSON()).map(function (_ref) {
2452
- var _ref2 = _slicedToArray(_ref, 2),
2453
- header = _ref2[0],
2454
- value = _ref2[1];
2455
- return header + ': ' + value;
2456
- }).join('\n');
2536
+ var isFormData = utils$1.isFormData(data);
2537
+ if (isFormData) {
2538
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
2457
2539
  }
2458
- }, {
2459
- key: "getSetCookie",
2460
- value: function getSetCookie() {
2461
- return this.get('set-cookie') || [];
2540
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
2541
+ return data;
2462
2542
  }
2463
- }, {
2464
- key: Symbol.toStringTag,
2465
- get: function get() {
2466
- return 'AxiosHeaders';
2543
+ if (utils$1.isArrayBufferView(data)) {
2544
+ return data.buffer;
2467
2545
  }
2468
- }], [{
2469
- key: "from",
2470
- value: function from(thing) {
2471
- return thing instanceof this ? thing : new this(thing);
2546
+ if (utils$1.isURLSearchParams(data)) {
2547
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
2548
+ return data.toString();
2472
2549
  }
2473
- }, {
2474
- key: "concat",
2475
- value: function concat(first) {
2476
- var computed = new this(first);
2477
- for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2478
- targets[_key2 - 1] = arguments[_key2];
2550
+ var isFileList;
2551
+ if (isObjectPayload) {
2552
+ var formSerializer = own(this, 'formSerializer');
2553
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
2554
+ return toURLEncodedForm(data, formSerializer).toString();
2555
+ }
2556
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
2557
+ var env = own(this, 'env');
2558
+ var _FormData = env && env.FormData;
2559
+ return toFormData(isFileList ? {
2560
+ 'files[]': data
2561
+ } : data, _FormData && new _FormData(), formSerializer);
2479
2562
  }
2480
- targets.forEach(function (target) {
2481
- return computed.set(target);
2482
- });
2483
- return computed;
2484
2563
  }
2485
- }, {
2486
- key: "accessor",
2487
- value: function accessor(header) {
2488
- var internals = this[$internals] = this[$internals] = {
2489
- accessors: {}
2490
- };
2491
- var accessors = internals.accessors;
2492
- var prototype = this.prototype;
2493
- function defineAccessor(_header) {
2494
- var lHeader = normalizeHeader(_header);
2495
- if (!accessors[lHeader]) {
2496
- buildAccessors(prototype, _header);
2497
- accessors[lHeader] = true;
2564
+ if (isObjectPayload || hasJSONContentType) {
2565
+ headers.setContentType('application/json', false);
2566
+ return stringifySafely(data);
2567
+ }
2568
+ return data;
2569
+ }],
2570
+ transformResponse: [function transformResponse(data) {
2571
+ var transitional = own(this, 'transitional') || defaults.transitional;
2572
+ var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
2573
+ var responseType = own(this, 'responseType');
2574
+ var JSONRequested = responseType === 'json';
2575
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
2576
+ return data;
2577
+ }
2578
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !responseType || JSONRequested)) {
2579
+ var silentJSONParsing = transitional && transitional.silentJSONParsing;
2580
+ var strictJSONParsing = !silentJSONParsing && JSONRequested;
2581
+ try {
2582
+ return JSON.parse(data, own(this, 'parseReviver'));
2583
+ } catch (e) {
2584
+ if (strictJSONParsing) {
2585
+ if (e.name === 'SyntaxError') {
2586
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
2587
+ }
2588
+ throw e;
2498
2589
  }
2499
2590
  }
2500
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
2501
- return this;
2502
2591
  }
2503
- }]);
2504
- }();
2505
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
2506
-
2507
- // reserved names hotfix
2508
- utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) {
2509
- var value = _ref3.value;
2510
- var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
2511
- return {
2512
- get: function get() {
2513
- return value;
2514
- },
2515
- set: function set(headerValue) {
2516
- this[mapped] = headerValue;
2592
+ return data;
2593
+ }],
2594
+ /**
2595
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
2596
+ * timeout is not created.
2597
+ */
2598
+ timeout: 0,
2599
+ xsrfCookieName: 'XSRF-TOKEN',
2600
+ xsrfHeaderName: 'X-XSRF-TOKEN',
2601
+ maxContentLength: -1,
2602
+ maxBodyLength: -1,
2603
+ env: {
2604
+ FormData: platform.classes.FormData,
2605
+ Blob: platform.classes.Blob
2606
+ },
2607
+ validateStatus: function validateStatus(status) {
2608
+ return status >= 200 && status < 300;
2609
+ },
2610
+ headers: {
2611
+ common: {
2612
+ Accept: 'application/json, text/plain, */*',
2613
+ 'Content-Type': undefined
2517
2614
  }
2518
- };
2615
+ }
2616
+ };
2617
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
2618
+ defaults.headers[method] = {};
2519
2619
  });
2520
- utils$1.freezeMethods(AxiosHeaders);
2521
2620
 
2522
2621
  /**
2523
2622
  * Transform the data for a request or a response
@@ -2579,12 +2678,12 @@
2579
2678
  if (!response.status || !validateStatus || validateStatus(response.status)) {
2580
2679
  resolve(response);
2581
2680
  } else {
2582
- reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
2681
+ 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));
2583
2682
  }
2584
2683
  }
2585
2684
 
2586
2685
  function parseProtocol(url) {
2587
- var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2686
+ var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2588
2687
  return match && match[1] || '';
2589
2688
  }
2590
2689
 
@@ -2678,19 +2777,19 @@
2678
2777
  var bytesNotified = 0;
2679
2778
  var _speedometer = speedometer(50, 250);
2680
2779
  return throttle(function (e) {
2681
- var loaded = e.loaded;
2780
+ var rawLoaded = e.loaded;
2682
2781
  var total = e.lengthComputable ? e.total : undefined;
2683
- var progressBytes = loaded - bytesNotified;
2782
+ var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2783
+ var progressBytes = Math.max(0, loaded - bytesNotified);
2684
2784
  var rate = _speedometer(progressBytes);
2685
- var inRange = loaded <= total;
2686
- bytesNotified = loaded;
2785
+ bytesNotified = Math.max(bytesNotified, loaded);
2687
2786
  var data = _defineProperty({
2688
2787
  loaded: loaded,
2689
2788
  total: total,
2690
2789
  progress: total ? loaded / total : undefined,
2691
2790
  bytes: progressBytes,
2692
2791
  rate: rate ? rate : undefined,
2693
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2792
+ estimated: rate && total ? (total - loaded) / rate : undefined,
2694
2793
  event: e,
2695
2794
  lengthComputable: total != null
2696
2795
  }, isDownloadStream ? 'download' : 'upload', true);
@@ -2752,8 +2851,20 @@
2752
2851
  },
2753
2852
  read: function read(name) {
2754
2853
  if (typeof document === 'undefined') return null;
2755
- var match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
2756
- return match ? decodeURIComponent(match[1]) : null;
2854
+ // Match name=value by splitting on the semicolon separator instead of building a
2855
+ // RegExp from `name` interpolating an unescaped string into a RegExp would let
2856
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
2857
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
2858
+ // "; ", so ignore optional whitespace before each cookie name.
2859
+ var cookies = document.cookie.split(';');
2860
+ for (var i = 0; i < cookies.length; i++) {
2861
+ var cookie = cookies[i].replace(/^\s+/, '');
2862
+ var eq = cookie.indexOf('=');
2863
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
2864
+ return decodeURIComponent(cookie.slice(eq + 1));
2865
+ }
2866
+ }
2867
+ return null;
2757
2868
  },
2758
2869
  remove: function remove(name) {
2759
2870
  this.write(name, '', Date.now() - 86400000, '/');
@@ -2809,7 +2920,7 @@
2809
2920
  */
2810
2921
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2811
2922
  var isRelativeUrl = !isAbsoluteURL(requestedURL);
2812
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2923
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2813
2924
  return combineURLs(baseURL, requestedURL);
2814
2925
  }
2815
2926
  return requestedURL;
@@ -2831,7 +2942,21 @@
2831
2942
  function mergeConfig(config1, config2) {
2832
2943
  // eslint-disable-next-line no-param-reassign
2833
2944
  config2 = config2 || {};
2834
- var config = {};
2945
+
2946
+ // Use a null-prototype object so that downstream reads such as `config.auth`
2947
+ // or `config.baseURL` cannot inherit polluted values from Object.prototype.
2948
+ // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
2949
+ // ergonomics for user code that relies on it.
2950
+ var config = Object.create(null);
2951
+ Object.defineProperty(config, 'hasOwnProperty', {
2952
+ // Null-proto descriptor so a polluted Object.prototype.get cannot turn
2953
+ // this data descriptor into an accessor descriptor on the way in.
2954
+ __proto__: null,
2955
+ value: Object.prototype.hasOwnProperty,
2956
+ enumerable: false,
2957
+ writable: true,
2958
+ configurable: true
2959
+ });
2835
2960
  function getMergedValue(target, source, prop, caseless) {
2836
2961
  if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
2837
2962
  return utils$1.merge.call({
@@ -2870,9 +2995,9 @@
2870
2995
 
2871
2996
  // eslint-disable-next-line consistent-return
2872
2997
  function mergeDirectKeys(a, b, prop) {
2873
- if (prop in config2) {
2998
+ if (utils$1.hasOwnProp(config2, prop)) {
2874
2999
  return getMergedValue(a, b);
2875
- } else if (prop in config1) {
3000
+ } else if (utils$1.hasOwnProp(config1, prop)) {
2876
3001
  return getMergedValue(undefined, a);
2877
3002
  }
2878
3003
  }
@@ -2903,6 +3028,7 @@
2903
3028
  httpsAgent: defaultToConfig2,
2904
3029
  cancelToken: defaultToConfig2,
2905
3030
  socketPath: defaultToConfig2,
3031
+ allowedSocketPaths: defaultToConfig2,
2906
3032
  responseEncoding: defaultToConfig2,
2907
3033
  validateStatus: mergeDirectKeys,
2908
3034
  headers: function headers(a, b, prop) {
@@ -2912,43 +3038,73 @@
2912
3038
  utils$1.forEach(Object.keys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
2913
3039
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2914
3040
  var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2915
- var configValue = merge(config1[prop], config2[prop], prop);
3041
+ var a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
3042
+ var b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
3043
+ var configValue = merge(a, b, prop);
2916
3044
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
2917
3045
  });
2918
3046
  return config;
2919
3047
  }
2920
3048
 
3049
+ var FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
3050
+ function setFormDataHeaders(headers, formHeaders, policy) {
3051
+ if (policy !== 'content-only') {
3052
+ headers.set(formHeaders);
3053
+ return;
3054
+ }
3055
+ Object.entries(formHeaders).forEach(function (_ref) {
3056
+ var _ref2 = _slicedToArray(_ref, 2),
3057
+ key = _ref2[0],
3058
+ val = _ref2[1];
3059
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
3060
+ headers.set(key, val);
3061
+ }
3062
+ });
3063
+ }
3064
+
3065
+ /**
3066
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3067
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3068
+ *
3069
+ * @param {string} str The string to encode
3070
+ *
3071
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3072
+ */
3073
+ var encodeUTF8 = function encodeUTF8(str) {
3074
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3075
+ return String.fromCharCode(parseInt(hex, 16));
3076
+ });
3077
+ };
2921
3078
  var resolveConfig = (function (config) {
2922
3079
  var newConfig = mergeConfig({}, config);
2923
- var data = newConfig.data,
2924
- withXSRFToken = newConfig.withXSRFToken,
2925
- xsrfHeaderName = newConfig.xsrfHeaderName,
2926
- xsrfCookieName = newConfig.xsrfCookieName,
2927
- headers = newConfig.headers,
2928
- auth = newConfig.auth;
3080
+
3081
+ // Read only own properties to prevent prototype pollution gadgets
3082
+ // (e.g. Object.prototype.baseURL = 'https://evil.com').
3083
+ var own = function own(key) {
3084
+ return utils$1.hasOwnProp(newConfig, key) ? newConfig[key] : undefined;
3085
+ };
3086
+ var data = own('data');
3087
+ var withXSRFToken = own('withXSRFToken');
3088
+ var xsrfHeaderName = own('xsrfHeaderName');
3089
+ var xsrfCookieName = own('xsrfCookieName');
3090
+ var headers = own('headers');
3091
+ var auth = own('auth');
3092
+ var baseURL = own('baseURL');
3093
+ var allowAbsoluteUrls = own('allowAbsoluteUrls');
3094
+ var url = own('url');
2929
3095
  newConfig.headers = headers = AxiosHeaders.from(headers);
2930
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3096
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
2931
3097
 
2932
3098
  // HTTP basic authentication
2933
3099
  if (auth) {
2934
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3100
+ headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
2935
3101
  }
2936
3102
  if (utils$1.isFormData(data)) {
2937
3103
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2938
3104
  headers.setContentType(undefined); // browser handles it
2939
3105
  } else if (utils$1.isFunction(data.getHeaders)) {
2940
3106
  // Node.js FormData (like form-data package)
2941
- var formHeaders = data.getHeaders();
2942
- // Only set safe headers to avoid overwriting security headers
2943
- var allowedHeaders = ['content-type', 'content-length'];
2944
- Object.entries(formHeaders).forEach(function (_ref) {
2945
- var _ref2 = _slicedToArray(_ref, 2),
2946
- key = _ref2[0],
2947
- val = _ref2[1];
2948
- if (allowedHeaders.includes(key.toLowerCase())) {
2949
- headers.set(key, val);
2950
- }
2951
- });
3107
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
2952
3108
  }
2953
3109
  }
2954
3110
 
@@ -2957,9 +3113,15 @@
2957
3113
  // Specifically not if we're in a web worker, or react-native.
2958
3114
 
2959
3115
  if (platform.hasStandardBrowserEnv) {
2960
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2961
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
2962
- // Add xsrf header
3116
+ if (utils$1.isFunction(withXSRFToken)) {
3117
+ withXSRFToken = withXSRFToken(newConfig);
3118
+ }
3119
+
3120
+ // Strict boolean check — prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
3121
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
3122
+ // the XSRF token cross-origin.
3123
+ var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
3124
+ if (shouldSendXSRF) {
2963
3125
  var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2964
3126
  if (xsrfValue) {
2965
3127
  headers.set(xsrfHeaderName, xsrfValue);
@@ -3033,7 +3195,7 @@
3033
3195
  // handled by onerror instead
3034
3196
  // With one exception: request that using file: protocol, most browsers
3035
3197
  // will return status as 0 even though it's a successful request
3036
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3198
+ if (request.status === 0 && !(request.responseURL && request.responseURL.startsWith('file:'))) {
3037
3199
  return;
3038
3200
  }
3039
3201
  // readystate handler is calling before onerror or ontimeout handlers,
@@ -3048,6 +3210,7 @@
3048
3210
  return;
3049
3211
  }
3050
3212
  reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
3213
+ done();
3051
3214
 
3052
3215
  // Clean up request
3053
3216
  request = null;
@@ -3063,6 +3226,7 @@
3063
3226
  // attach the underlying event for consumers who want details
3064
3227
  err.event = event || null;
3065
3228
  reject(err);
3229
+ done();
3066
3230
  request = null;
3067
3231
  };
3068
3232
 
@@ -3074,6 +3238,7 @@
3074
3238
  timeoutErrorMessage = _config.timeoutErrorMessage;
3075
3239
  }
3076
3240
  reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
3241
+ done();
3077
3242
 
3078
3243
  // Clean up request
3079
3244
  request = null;
@@ -3126,6 +3291,7 @@
3126
3291
  }
3127
3292
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3128
3293
  request.abort();
3294
+ done();
3129
3295
  request = null;
3130
3296
  };
3131
3297
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
@@ -3134,7 +3300,7 @@
3134
3300
  }
3135
3301
  }
3136
3302
  var protocol = parseProtocol(_config.url);
3137
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3303
+ if (protocol && !platform.protocols.includes(protocol)) {
3138
3304
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3139
3305
  return;
3140
3306
  }
@@ -3386,19 +3552,102 @@
3386
3552
  });
3387
3553
  };
3388
3554
 
3555
+ /**
3556
+ * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3557
+ * - For base64: compute exact decoded size using length and padding;
3558
+ * handle %XX at the character-count level (no string allocation).
3559
+ * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3560
+ *
3561
+ * @param {string} url
3562
+ * @returns {number}
3563
+ */
3564
+ function estimateDataURLDecodedBytes(url) {
3565
+ if (!url || typeof url !== 'string') return 0;
3566
+ if (!url.startsWith('data:')) return 0;
3567
+ var comma = url.indexOf(',');
3568
+ if (comma < 0) return 0;
3569
+ var meta = url.slice(5, comma);
3570
+ var body = url.slice(comma + 1);
3571
+ var isBase64 = /;base64/i.test(meta);
3572
+ if (isBase64) {
3573
+ var effectiveLen = body.length;
3574
+ var len = body.length; // cache length
3575
+
3576
+ for (var i = 0; i < len; i++) {
3577
+ if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3578
+ var a = body.charCodeAt(i + 1);
3579
+ var b = body.charCodeAt(i + 2);
3580
+ 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);
3581
+ if (isHex) {
3582
+ effectiveLen -= 2;
3583
+ i += 2;
3584
+ }
3585
+ }
3586
+ }
3587
+ var pad = 0;
3588
+ var idx = len - 1;
3589
+ var tailIsPct3D = function tailIsPct3D(j) {
3590
+ return j >= 2 && body.charCodeAt(j - 2) === 37 &&
3591
+ // '%'
3592
+ body.charCodeAt(j - 1) === 51 && (
3593
+ // '3'
3594
+ body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100);
3595
+ }; // 'D' or 'd'
3596
+
3597
+ if (idx >= 0) {
3598
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3599
+ pad++;
3600
+ idx--;
3601
+ } else if (tailIsPct3D(idx)) {
3602
+ pad++;
3603
+ idx -= 3;
3604
+ }
3605
+ }
3606
+ if (pad === 1 && idx >= 0) {
3607
+ if (body.charCodeAt(idx) === 61 /* '=' */) {
3608
+ pad++;
3609
+ } else if (tailIsPct3D(idx)) {
3610
+ pad++;
3611
+ }
3612
+ }
3613
+ var groups = Math.floor(effectiveLen / 4);
3614
+ var _bytes = groups * 3 - (pad || 0);
3615
+ return _bytes > 0 ? _bytes : 0;
3616
+ }
3617
+ if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3618
+ return Buffer.byteLength(body, 'utf8');
3619
+ }
3620
+
3621
+ // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3622
+ // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3623
+ // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3624
+ // but 3 UTF-8 bytes).
3625
+ var bytes = 0;
3626
+ for (var _i = 0, _len = body.length; _i < _len; _i++) {
3627
+ var c = body.charCodeAt(_i);
3628
+ if (c < 0x80) {
3629
+ bytes += 1;
3630
+ } else if (c < 0x800) {
3631
+ bytes += 2;
3632
+ } else if (c >= 0xd800 && c <= 0xdbff && _i + 1 < _len) {
3633
+ var next = body.charCodeAt(_i + 1);
3634
+ if (next >= 0xdc00 && next <= 0xdfff) {
3635
+ bytes += 4;
3636
+ _i++;
3637
+ } else {
3638
+ bytes += 3;
3639
+ }
3640
+ } else {
3641
+ bytes += 3;
3642
+ }
3643
+ }
3644
+ return bytes;
3645
+ }
3646
+
3647
+ var VERSION = "1.16.0";
3648
+
3389
3649
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
3390
3650
  var isFunction = utils$1.isFunction;
3391
- var globalFetchAPI = function (_ref) {
3392
- var Request = _ref.Request,
3393
- Response = _ref.Response;
3394
- return {
3395
- Request: Request,
3396
- Response: Response
3397
- };
3398
- }(utils$1.global);
3399
- var _utils$global = utils$1.global,
3400
- ReadableStream$1 = _utils$global.ReadableStream,
3401
- TextEncoder = _utils$global.TextEncoder;
3402
3651
  var test = function test(fn) {
3403
3652
  try {
3404
3653
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -3410,9 +3659,16 @@
3410
3659
  }
3411
3660
  };
3412
3661
  var factory = function factory(env) {
3662
+ var _utils$global;
3663
+ var globalObject = (_utils$global = utils$1.global) !== null && _utils$global !== void 0 ? _utils$global : globalThis;
3664
+ var ReadableStream = globalObject.ReadableStream,
3665
+ TextEncoder = globalObject.TextEncoder;
3413
3666
  env = utils$1.merge.call({
3414
3667
  skipUndefined: true
3415
- }, globalFetchAPI, env);
3668
+ }, {
3669
+ Request: globalObject.Request,
3670
+ Response: globalObject.Response
3671
+ }, env);
3416
3672
  var _env = env,
3417
3673
  envFetch = _env.fetch,
3418
3674
  Request = _env.Request,
@@ -3423,13 +3679,13 @@
3423
3679
  if (!isFetchSupported) {
3424
3680
  return false;
3425
3681
  }
3426
- var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3682
+ var isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream);
3427
3683
  var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
3428
3684
  return function (str) {
3429
3685
  return encoder.encode(str);
3430
3686
  };
3431
3687
  }(new TextEncoder()) : (/*#__PURE__*/function () {
3432
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(str) {
3688
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(str) {
3433
3689
  var _t, _t2;
3434
3690
  return _regenerator().w(function (_context) {
3435
3691
  while (1) switch (_context.n) {
@@ -3444,21 +3700,23 @@
3444
3700
  }, _callee);
3445
3701
  }));
3446
3702
  return function (_x) {
3447
- return _ref2.apply(this, arguments);
3703
+ return _ref.apply(this, arguments);
3448
3704
  };
3449
3705
  }()));
3450
3706
  var supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(function () {
3451
3707
  var duplexAccessed = false;
3452
- var body = new ReadableStream$1();
3453
- var hasContentType = new Request(platform.origin, {
3454
- body: body,
3708
+ var request = new Request(platform.origin, {
3709
+ body: new ReadableStream(),
3455
3710
  method: 'POST',
3456
3711
  get duplex() {
3457
3712
  duplexAccessed = true;
3458
3713
  return 'half';
3459
3714
  }
3460
- }).headers.has('Content-Type');
3461
- body.cancel();
3715
+ });
3716
+ var hasContentType = request.headers.has('Content-Type');
3717
+ if (request.body != null) {
3718
+ request.body.cancel();
3719
+ }
3462
3720
  return duplexAccessed && !hasContentType;
3463
3721
  });
3464
3722
  var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
@@ -3481,7 +3739,7 @@
3481
3739
  });
3482
3740
  }();
3483
3741
  var getBodyLength = /*#__PURE__*/function () {
3484
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(body) {
3742
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(body) {
3485
3743
  var _request;
3486
3744
  return _regenerator().w(function (_context2) {
3487
3745
  while (1) switch (_context2.n) {
@@ -3534,11 +3792,11 @@
3534
3792
  }, _callee2);
3535
3793
  }));
3536
3794
  return function getBodyLength(_x2) {
3537
- return _ref3.apply(this, arguments);
3795
+ return _ref2.apply(this, arguments);
3538
3796
  };
3539
3797
  }();
3540
3798
  var resolveBodyLength = /*#__PURE__*/function () {
3541
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(headers, body) {
3799
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(headers, body) {
3542
3800
  var length;
3543
3801
  return _regenerator().w(function (_context3) {
3544
3802
  while (1) switch (_context3.n) {
@@ -3549,16 +3807,18 @@
3549
3807
  }, _callee3);
3550
3808
  }));
3551
3809
  return function resolveBodyLength(_x3, _x4) {
3552
- return _ref4.apply(this, arguments);
3810
+ return _ref3.apply(this, arguments);
3553
3811
  };
3554
3812
  }();
3555
3813
  return /*#__PURE__*/function () {
3556
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
3557
- 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, _ref6, _ref7, _onProgress, _flush, responseData, _t3, _t4, _t5;
3814
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
3815
+ 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, _ref5, _ref6, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4, _t5;
3558
3816
  return _regenerator().w(function (_context4) {
3559
3817
  while (1) switch (_context4.p = _context4.n) {
3560
3818
  case 0:
3561
- _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;
3819
+ _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;
3820
+ hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3821
+ hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3562
3822
  _fetch = envFetch || fetch;
3563
3823
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3564
3824
  composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
@@ -3567,19 +3827,44 @@
3567
3827
  composedSignal.unsubscribe();
3568
3828
  };
3569
3829
  _context4.p = 1;
3830
+ if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
3831
+ _context4.n = 2;
3832
+ break;
3833
+ }
3834
+ estimated = estimateDataURLDecodedBytes(url);
3835
+ if (!(estimated > maxContentLength)) {
3836
+ _context4.n = 2;
3837
+ break;
3838
+ }
3839
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3840
+ case 2:
3841
+ if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
3842
+ _context4.n = 4;
3843
+ break;
3844
+ }
3845
+ _context4.n = 3;
3846
+ return resolveBodyLength(headers, data);
3847
+ case 3:
3848
+ outboundLength = _context4.v;
3849
+ if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
3850
+ _context4.n = 4;
3851
+ break;
3852
+ }
3853
+ throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
3854
+ case 4:
3570
3855
  _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3571
3856
  if (!_t3) {
3572
- _context4.n = 3;
3857
+ _context4.n = 6;
3573
3858
  break;
3574
3859
  }
3575
- _context4.n = 2;
3860
+ _context4.n = 5;
3576
3861
  return resolveBodyLength(headers, data);
3577
- case 2:
3862
+ case 5:
3578
3863
  _t4 = requestContentLength = _context4.v;
3579
3864
  _t3 = _t4 !== 0;
3580
- case 3:
3865
+ case 6:
3581
3866
  if (!_t3) {
3582
- _context4.n = 4;
3867
+ _context4.n = 7;
3583
3868
  break;
3584
3869
  }
3585
3870
  _request = new Request(url, {
@@ -3594,14 +3879,24 @@
3594
3879
  _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3595
3880
  data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3596
3881
  }
3597
- case 4:
3882
+ case 7:
3598
3883
  if (!utils$1.isString(withCredentials)) {
3599
3884
  withCredentials = withCredentials ? 'include' : 'omit';
3600
3885
  }
3601
3886
 
3602
3887
  // Cloudflare Workers throws when credentials are defined
3603
3888
  // see https://github.com/cloudflare/workerd/issues/902
3604
- isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3889
+ isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype; // If data is FormData and Content-Type is multipart/form-data without boundary,
3890
+ // delete it so fetch can set it correctly with the boundary
3891
+ if (utils$1.isFormData(data)) {
3892
+ contentType = headers.getContentType();
3893
+ if (contentType && /^multipart\/form-data/i.test(contentType) && !/boundary=/i.test(contentType)) {
3894
+ headers["delete"]('content-type');
3895
+ }
3896
+ }
3897
+
3898
+ // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
3899
+ headers.set('User-Agent', 'axios/' + VERSION, false);
3605
3900
  resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3606
3901
  signal: composedSignal,
3607
3902
  method: method.toUpperCase(),
@@ -3611,30 +3906,70 @@
3611
3906
  credentials: isCredentialsSupported ? withCredentials : undefined
3612
3907
  });
3613
3908
  request = isRequestSupported && new Request(url, resolvedOptions);
3614
- _context4.n = 5;
3909
+ _context4.n = 8;
3615
3910
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3616
- case 5:
3911
+ case 8:
3617
3912
  response = _context4.v;
3913
+ if (!hasMaxContentLength) {
3914
+ _context4.n = 9;
3915
+ break;
3916
+ }
3917
+ declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3918
+ if (!(declaredLength != null && declaredLength > maxContentLength)) {
3919
+ _context4.n = 9;
3920
+ break;
3921
+ }
3922
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3923
+ case 9:
3618
3924
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3619
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
3925
+ if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
3620
3926
  options = {};
3621
3927
  ['status', 'statusText', 'headers'].forEach(function (prop) {
3622
3928
  options[prop] = response[prop];
3623
3929
  });
3624
3930
  responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3625
- _ref6 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref7 = _slicedToArray(_ref6, 2), _onProgress = _ref7[0], _flush = _ref7[1];
3626
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
3931
+ _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
3932
+ bytesRead = 0;
3933
+ onChunkProgress = function onChunkProgress(loadedBytes) {
3934
+ if (hasMaxContentLength) {
3935
+ bytesRead = loadedBytes;
3936
+ if (bytesRead > maxContentLength) {
3937
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3938
+ }
3939
+ }
3940
+ _onProgress && _onProgress(loadedBytes);
3941
+ };
3942
+ response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onChunkProgress, function () {
3627
3943
  _flush && _flush();
3628
3944
  unsubscribe && unsubscribe();
3629
3945
  }), options);
3630
3946
  }
3631
3947
  responseType = responseType || 'text';
3632
- _context4.n = 6;
3948
+ _context4.n = 10;
3633
3949
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3634
- case 6:
3950
+ case 10:
3635
3951
  responseData = _context4.v;
3952
+ if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
3953
+ _context4.n = 11;
3954
+ break;
3955
+ }
3956
+ if (responseData != null) {
3957
+ if (typeof responseData.byteLength === 'number') {
3958
+ materializedSize = responseData.byteLength;
3959
+ } else if (typeof responseData.size === 'number') {
3960
+ materializedSize = responseData.size;
3961
+ } else if (typeof responseData === 'string') {
3962
+ materializedSize = typeof TextEncoder === 'function' ? new TextEncoder().encode(responseData).byteLength : responseData.length;
3963
+ }
3964
+ }
3965
+ if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
3966
+ _context4.n = 11;
3967
+ break;
3968
+ }
3969
+ throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3970
+ case 11:
3636
3971
  !isStreamResponse && unsubscribe && unsubscribe();
3637
- _context4.n = 7;
3972
+ _context4.n = 12;
3638
3973
  return new Promise(function (resolve, reject) {
3639
3974
  settle(resolve, reject, {
3640
3975
  data: responseData,
@@ -3645,28 +3980,42 @@
3645
3980
  request: request
3646
3981
  });
3647
3982
  });
3648
- case 7:
3983
+ case 12:
3649
3984
  return _context4.a(2, _context4.v);
3650
- case 8:
3651
- _context4.p = 8;
3985
+ case 13:
3986
+ _context4.p = 13;
3652
3987
  _t5 = _context4.v;
3653
3988
  unsubscribe && unsubscribe();
3989
+
3990
+ // Safari can surface fetch aborts as a DOMException-like object whose
3991
+ // branded getters throw. Prefer our composed signal reason before reading
3992
+ // the caught error, preserving timeout vs cancellation semantics.
3993
+ if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
3994
+ _context4.n = 14;
3995
+ break;
3996
+ }
3997
+ canceledError = composedSignal.reason;
3998
+ canceledError.config = config;
3999
+ request && (canceledError.request = request);
4000
+ _t5 !== canceledError && (canceledError.cause = _t5);
4001
+ throw canceledError;
4002
+ case 14:
3654
4003
  if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
3655
- _context4.n = 9;
4004
+ _context4.n = 15;
3656
4005
  break;
3657
4006
  }
3658
4007
  throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t5 && _t5.response), {
3659
4008
  cause: _t5.cause || _t5
3660
4009
  });
3661
- case 9:
4010
+ case 15:
3662
4011
  throw AxiosError.from(_t5, _t5 && _t5.code, config, request, _t5 && _t5.response);
3663
- case 10:
4012
+ case 16:
3664
4013
  return _context4.a(2);
3665
4014
  }
3666
- }, _callee4, null, [[1, 8]]);
4015
+ }, _callee4, null, [[1, 13]]);
3667
4016
  }));
3668
4017
  return function (_x5) {
3669
- return _ref5.apply(this, arguments);
4018
+ return _ref4.apply(this, arguments);
3670
4019
  };
3671
4020
  }();
3672
4021
  };
@@ -3713,13 +4062,17 @@
3713
4062
  utils$1.forEach(knownAdapters, function (fn, value) {
3714
4063
  if (fn) {
3715
4064
  try {
4065
+ // Null-proto descriptors so a polluted Object.prototype.get cannot turn
4066
+ // these data descriptors into accessor descriptors on the way in.
3716
4067
  Object.defineProperty(fn, 'name', {
4068
+ __proto__: null,
3717
4069
  value: value
3718
4070
  });
3719
4071
  } catch (e) {
3720
4072
  // eslint-disable-next-line no-empty
3721
4073
  }
3722
4074
  Object.defineProperty(fn, 'adapterName', {
4075
+ __proto__: null,
3723
4076
  value: value
3724
4077
  });
3725
4078
  }
@@ -3842,8 +4195,15 @@
3842
4195
  return adapter(config).then(function onAdapterResolution(response) {
3843
4196
  throwIfCancellationRequested(config);
3844
4197
 
3845
- // Transform response data
3846
- response.data = transformData.call(config, config.transformResponse, response);
4198
+ // Expose the current response on config so that transformResponse can
4199
+ // attach it to any AxiosError it throws (e.g. on JSON parse failure).
4200
+ // We clean it up afterwards to avoid polluting the config object.
4201
+ config.response = response;
4202
+ try {
4203
+ response.data = transformData.call(config, config.transformResponse, response);
4204
+ } finally {
4205
+ delete config.response;
4206
+ }
3847
4207
  response.headers = AxiosHeaders.from(response.headers);
3848
4208
  return response;
3849
4209
  }, function onAdapterRejection(reason) {
@@ -3852,7 +4212,12 @@
3852
4212
 
3853
4213
  // Transform response data
3854
4214
  if (reason && reason.response) {
3855
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4215
+ config.response = reason.response;
4216
+ try {
4217
+ reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4218
+ } finally {
4219
+ delete config.response;
4220
+ }
3856
4221
  reason.response.headers = AxiosHeaders.from(reason.response.headers);
3857
4222
  }
3858
4223
  }
@@ -3860,8 +4225,6 @@
3860
4225
  });
3861
4226
  }
3862
4227
 
3863
- var VERSION = "1.15.0";
3864
-
3865
4228
  var validators$1 = {};
3866
4229
 
3867
4230
  // eslint-disable-next-line func-names
@@ -3925,7 +4288,9 @@
3925
4288
  var i = keys.length;
3926
4289
  while (i-- > 0) {
3927
4290
  var opt = keys[i];
3928
- var validator = schema[opt];
4291
+ // Use hasOwnProperty so a polluted Object.prototype.<opt> cannot supply
4292
+ // a non-function validator and cause a TypeError.
4293
+ var validator = Object.prototype.hasOwnProperty.call(schema, opt) ? schema[opt] : undefined;
3929
4294
  if (validator) {
3930
4295
  var value = options[opt];
3931
4296
  var result = value === undefined || validator(value, opt, options);
@@ -4079,7 +4444,7 @@
4079
4444
 
4080
4445
  // Flatten headers
4081
4446
  var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4082
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) {
4447
+ headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
4083
4448
  delete headers[method];
4084
4449
  });
4085
4450
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
@@ -4161,7 +4526,7 @@
4161
4526
  }));
4162
4527
  };
4163
4528
  });
4164
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4529
+ utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
4165
4530
  function generateHTTPMethod(isForm) {
4166
4531
  return function httpMethod(url, data, config) {
4167
4532
  return this.request(mergeConfig(config || {}, {
@@ -4175,7 +4540,12 @@
4175
4540
  };
4176
4541
  }
4177
4542
  Axios.prototype[method] = generateHTTPMethod();
4178
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4543
+
4544
+ // QUERY is a safe/idempotent read method; multipart form bodies don't fit
4545
+ // its semantics, so no queryForm shorthand is generated.
4546
+ if (method !== 'query') {
4547
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4548
+ }
4179
4549
  });
4180
4550
 
4181
4551
  /**