@openclaw/feishu 2026.6.11 → 2026.6.34

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 (109) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/{channel-C1MthXp0.js → channel-CJZM55mB.js} +3 -3
  3. package/dist/channel-plugin-api.js +1 -1
  4. package/dist/{channel.runtime-CiQqumBC.js → channel.runtime-DC21Vx4J.js} +1 -1
  5. package/dist/{monitor-CxUQtU--.js → monitor-BZS7ekeI.js} +1 -1
  6. package/dist/{monitor.account-C3SH96dD.js → monitor.account-D5SNO1bC.js} +1 -1
  7. package/dist/{secret-contract-ChjJKAJ9.js → secret-contract-DLaBl9m4.js} +26 -8
  8. package/dist/secret-contract-api.js +1 -1
  9. package/dist/setup-api.js +1 -1
  10. package/node_modules/agent-base/README.md +145 -0
  11. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  12. package/node_modules/agent-base/dist/src/index.js +203 -0
  13. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  14. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  15. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  16. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  17. package/node_modules/agent-base/package.json +64 -0
  18. package/node_modules/agent-base/src/index.ts +345 -0
  19. package/node_modules/agent-base/src/promisify.ts +33 -0
  20. package/node_modules/axios/CHANGELOG.md +165 -1
  21. package/node_modules/axios/README.md +310 -247
  22. package/node_modules/axios/dist/axios.js +533 -197
  23. package/node_modules/axios/dist/axios.min.js +3 -3
  24. package/node_modules/axios/dist/axios.min.js.map +1 -1
  25. package/node_modules/axios/dist/browser/axios.cjs +564 -161
  26. package/node_modules/axios/dist/esm/axios.js +564 -161
  27. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  28. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  29. package/node_modules/axios/dist/node/axios.cjs +839 -281
  30. package/node_modules/axios/index.d.cts +11 -4
  31. package/node_modules/axios/index.d.ts +7 -2
  32. package/node_modules/axios/lib/adapters/fetch.js +196 -37
  33. package/node_modules/axios/lib/adapters/http.js +328 -185
  34. package/node_modules/axios/lib/adapters/xhr.js +2 -1
  35. package/node_modules/axios/lib/core/Axios.js +4 -2
  36. package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
  37. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  38. package/node_modules/axios/lib/core/mergeConfig.js +34 -0
  39. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  40. package/node_modules/axios/lib/env/data.js +1 -1
  41. package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
  42. package/node_modules/axios/lib/helpers/buildURL.js +6 -4
  43. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  44. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  45. package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
  46. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
  47. package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
  48. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  49. package/node_modules/axios/lib/helpers/resolveConfig.js +17 -9
  50. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  51. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  52. package/node_modules/axios/lib/helpers/toFormData.js +41 -11
  53. package/node_modules/axios/lib/utils.js +105 -19
  54. package/node_modules/axios/package.json +31 -13
  55. package/node_modules/debug/LICENSE +20 -0
  56. package/node_modules/debug/README.md +481 -0
  57. package/node_modules/debug/package.json +64 -0
  58. package/node_modules/debug/src/browser.js +272 -0
  59. package/node_modules/debug/src/common.js +292 -0
  60. package/node_modules/debug/src/index.js +10 -0
  61. package/node_modules/debug/src/node.js +263 -0
  62. package/node_modules/https-proxy-agent/README.md +137 -0
  63. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  64. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  65. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  66. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  67. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  68. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  69. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  70. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  71. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  72. package/node_modules/https-proxy-agent/package.json +56 -0
  73. package/node_modules/ms/index.js +162 -0
  74. package/node_modules/ms/license.md +21 -0
  75. package/node_modules/ms/package.json +38 -0
  76. package/node_modules/ms/readme.md +59 -0
  77. package/node_modules/protobufjs/dist/light/protobuf.js +145 -188
  78. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  79. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  80. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  81. package/node_modules/protobufjs/dist/minimal/protobuf.js +33 -76
  82. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  83. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  84. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  85. package/node_modules/protobufjs/dist/protobuf.js +168 -208
  86. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  87. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  88. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  89. package/node_modules/protobufjs/index.d.ts +0 -8
  90. package/node_modules/protobufjs/package.json +2 -3
  91. package/node_modules/protobufjs/src/parse.js +3 -0
  92. package/node_modules/protobufjs/src/util/minimal.js +0 -3
  93. package/npm-shrinkwrap.json +58 -16
  94. package/package.json +4 -4
  95. package/node_modules/@protobufjs/inquire/CHANGELOG.md +0 -8
  96. package/node_modules/@protobufjs/inquire/LICENSE +0 -26
  97. package/node_modules/@protobufjs/inquire/README.md +0 -13
  98. package/node_modules/@protobufjs/inquire/index.d.ts +0 -10
  99. package/node_modules/@protobufjs/inquire/index.js +0 -38
  100. package/node_modules/@protobufjs/inquire/package.json +0 -21
  101. package/node_modules/@protobufjs/inquire/tests/data/array.js +0 -1
  102. package/node_modules/@protobufjs/inquire/tests/data/emptyArray.js +0 -1
  103. package/node_modules/@protobufjs/inquire/tests/data/emptyObject.js +0 -1
  104. package/node_modules/@protobufjs/inquire/tests/data/object.js +0 -1
  105. package/node_modules/@protobufjs/inquire/tests/index.js +0 -20
  106. package/node_modules/axios/dist/axios.js.map +0 -1
  107. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  108. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  109. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- /*! Axios v1.16.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.18.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) :
@@ -463,55 +463,42 @@
463
463
  };
464
464
  }
465
465
  function AsyncGenerator(e) {
466
- var r, t;
467
- function resume(r, t) {
466
+ var t, n;
467
+ function resume(t, n) {
468
468
  try {
469
- var n = e[r](t),
470
- o = n.value,
469
+ var r = e[t](n),
470
+ o = r.value,
471
471
  u = o instanceof _OverloadYield;
472
- Promise.resolve(u ? o.v : o).then(function (t) {
472
+ Promise.resolve(u ? o.v : o).then(function (n) {
473
473
  if (u) {
474
- var i = "return" === r ? "return" : "next";
475
- if (!o.k || t.done) return resume(i, t);
476
- t = e[i](t).value;
474
+ var i = "return" === t && o.k ? t : "next";
475
+ if (!o.k || n.done) return resume(i, n);
476
+ n = e[i](n).value;
477
477
  }
478
- settle(n.done ? "return" : "normal", t);
478
+ settle(!!r.done, n);
479
479
  }, function (e) {
480
480
  resume("throw", e);
481
481
  });
482
482
  } catch (e) {
483
- settle("throw", e);
483
+ settle(2, e);
484
484
  }
485
485
  }
486
- function settle(e, n) {
487
- switch (e) {
488
- case "return":
489
- r.resolve({
490
- value: n,
491
- done: true
492
- });
493
- break;
494
- case "throw":
495
- r.reject(n);
496
- break;
497
- default:
498
- r.resolve({
499
- value: n,
500
- done: false
501
- });
502
- }
503
- (r = r.next) ? resume(r.key, r.arg) : t = null;
486
+ function settle(e, r) {
487
+ 2 === e ? t.reject(r) : t.resolve({
488
+ value: r,
489
+ done: e
490
+ }), (t = t.next) ? resume(t.key, t.arg) : n = null;
504
491
  }
505
- this._invoke = function (e, n) {
492
+ this._invoke = function (e, r) {
506
493
  return new Promise(function (o, u) {
507
494
  var i = {
508
495
  key: e,
509
- arg: n,
496
+ arg: r,
510
497
  resolve: o,
511
498
  reject: u,
512
499
  next: null
513
500
  };
514
- t ? t = t.next = i : (r = t = i, resume(e, n));
501
+ n ? n = n.next = i : (t = n = i, resume(e, r));
515
502
  });
516
503
  }, "function" != typeof e.return && (this.return = void 0);
517
504
  }
@@ -566,6 +553,57 @@
566
553
  var getPrototypeOf = Object.getPrototypeOf;
567
554
  var iterator = Symbol.iterator,
568
555
  toStringTag = Symbol.toStringTag;
556
+
557
+ /* Creating a function that will check if an object has a property. */
558
+ var hasOwnProperty = function (_ref) {
559
+ var hasOwnProperty = _ref.hasOwnProperty;
560
+ return function (obj, prop) {
561
+ return hasOwnProperty.call(obj, prop);
562
+ };
563
+ }(Object.prototype);
564
+
565
+ /**
566
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
567
+ * an own `prop`. This distinguishes genuine own/inherited members — including
568
+ * class accessors and template prototypes — from members injected via
569
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
570
+ * live on Object.prototype itself and are therefore never matched.
571
+ *
572
+ * @param {*} thing The value whose chain to inspect
573
+ * @param {string|symbol} prop The property key to look for
574
+ *
575
+ * @returns {boolean} True when `prop` is owned below Object.prototype
576
+ */
577
+ var hasOwnInPrototypeChain = function hasOwnInPrototypeChain(thing, prop) {
578
+ var obj = thing;
579
+ var seen = [];
580
+ while (obj != null && obj !== Object.prototype) {
581
+ if (seen.indexOf(obj) !== -1) {
582
+ return false;
583
+ }
584
+ seen.push(obj);
585
+ if (hasOwnProperty(obj, prop)) {
586
+ return true;
587
+ }
588
+ obj = getPrototypeOf(obj);
589
+ }
590
+ return false;
591
+ };
592
+
593
+ /**
594
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
595
+ * properties and members inherited from a non-Object.prototype source (a class
596
+ * instance or template object) are honored; a value reachable only through a
597
+ * polluted Object.prototype is ignored and `undefined` is returned.
598
+ *
599
+ * @param {*} obj The source object
600
+ * @param {string|symbol} prop The property key to read
601
+ *
602
+ * @returns {*} The resolved value, or undefined when unsafe/absent
603
+ */
604
+ var getSafeProp = function getSafeProp(obj, prop) {
605
+ return obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
606
+ };
569
607
  var kindOf = function (cache) {
570
608
  return function (thing) {
571
609
  var str = toString.call(thing);
@@ -694,11 +732,15 @@
694
732
  * @returns {boolean} True if value is a plain Object, otherwise false
695
733
  */
696
734
  var isPlainObject = function isPlainObject(val) {
697
- if (kindOf(val) !== 'object') {
735
+ if (!isObject(val)) {
698
736
  return false;
699
737
  }
700
738
  var prototype = getPrototypeOf(val);
701
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
739
+ return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
740
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
741
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
742
+ // than a plain object, while ignoring keys injected onto Object.prototype.
743
+ !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
702
744
  };
703
745
 
704
746
  /**
@@ -866,9 +908,9 @@
866
908
  * @returns {any}
867
909
  */
868
910
  function forEach(obj, fn) {
869
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
870
- _ref$allOwnKeys = _ref.allOwnKeys,
871
- allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
911
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
912
+ _ref2$allOwnKeys = _ref2.allOwnKeys,
913
+ allOwnKeys = _ref2$allOwnKeys === void 0 ? false : _ref2$allOwnKeys;
872
914
  // Don't bother if no value provided
873
915
  if (obj === null || typeof obj === 'undefined') {
874
916
  return;
@@ -955,16 +997,19 @@
955
997
  * @returns {Object} Result of all merge properties
956
998
  */
957
999
  function merge() {
958
- var _ref2 = isContextDefined(this) && this || {},
959
- caseless = _ref2.caseless,
960
- skipUndefined = _ref2.skipUndefined;
1000
+ var _ref3 = isContextDefined(this) && this || {},
1001
+ caseless = _ref3.caseless,
1002
+ skipUndefined = _ref3.skipUndefined;
961
1003
  var result = {};
962
1004
  var assignValue = function assignValue(val, key) {
963
1005
  // Skip dangerous property names to prevent prototype pollution
964
1006
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
965
1007
  return;
966
1008
  }
967
- var targetKey = caseless && findKey(result, key) || key;
1009
+
1010
+ // findKey lowercases the key, so caseless lookup only applies to strings —
1011
+ // symbol keys are identity-matched.
1012
+ var targetKey = caseless && typeof key === 'string' && findKey(result, key) || key;
968
1013
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
969
1014
  // chain, so a polluted Object.prototype value could surface here and get
970
1015
  // copied into the merged result.
@@ -979,11 +1024,22 @@
979
1024
  result[targetKey] = val;
980
1025
  }
981
1026
  };
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);
1027
+ for (var i = 0, l = arguments.length; i < l; i++) {
1028
+ var source = i < 0 || arguments.length <= i ? undefined : arguments[i];
1029
+ if (!source || isBuffer(source)) {
1030
+ continue;
1031
+ }
1032
+ forEach(source, assignValue);
1033
+ if (_typeof(source) !== 'object' || isArray(source)) {
1034
+ continue;
1035
+ }
1036
+ var symbols = Object.getOwnPropertySymbols(source);
1037
+ for (var j = 0; j < symbols.length; j++) {
1038
+ var symbol = symbols[j];
1039
+ if (propertyIsEnumerable.call(source, symbol)) {
1040
+ assignValue(source[symbol], symbol);
1041
+ }
1042
+ }
987
1043
  }
988
1044
  return result;
989
1045
  }
@@ -1000,8 +1056,8 @@
1000
1056
  * @returns {Object} The resulting value of object a
1001
1057
  */
1002
1058
  var extend = function extend(a, b, thisArg) {
1003
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1004
- allOwnKeys = _ref3.allOwnKeys;
1059
+ var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1060
+ allOwnKeys = _ref4.allOwnKeys;
1005
1061
  forEach(b, function (val, key) {
1006
1062
  if (thisArg && isFunction$1(val)) {
1007
1063
  Object.defineProperty(a, key, {
@@ -1195,14 +1251,7 @@
1195
1251
  return p1.toUpperCase() + p2;
1196
1252
  });
1197
1253
  };
1198
-
1199
- /* Creating a function that will check if an object has a property. */
1200
- var hasOwnProperty = function (_ref4) {
1201
- var hasOwnProperty = _ref4.hasOwnProperty;
1202
- return function (obj, prop) {
1203
- return hasOwnProperty.call(obj, prop);
1204
- };
1205
- }(Object.prototype);
1254
+ var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
1206
1255
 
1207
1256
  /**
1208
1257
  * Determine if a value is a RegExp object
@@ -1291,10 +1340,10 @@
1291
1340
  * @returns {Object} The JSON-compatible object.
1292
1341
  */
1293
1342
  var toJSONObject = function toJSONObject(obj) {
1294
- var stack = new Array(10);
1295
- var _visit = function visit(source, i) {
1343
+ var visited = new WeakSet();
1344
+ var _visit = function visit(source) {
1296
1345
  if (isObject(source)) {
1297
- if (stack.indexOf(source) >= 0) {
1346
+ if (visited.has(source)) {
1298
1347
  return;
1299
1348
  }
1300
1349
 
@@ -1303,19 +1352,20 @@
1303
1352
  return source;
1304
1353
  }
1305
1354
  if (!('toJSON' in source)) {
1306
- stack[i] = source;
1355
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
1356
+ visited.add(source);
1307
1357
  var target = isArray(source) ? [] : {};
1308
1358
  forEach(source, function (value, key) {
1309
- var reducedValue = _visit(value, i + 1);
1359
+ var reducedValue = _visit(value);
1310
1360
  !isUndefined(reducedValue) && (target[key] = reducedValue);
1311
1361
  });
1312
- stack[i] = undefined;
1362
+ visited["delete"](source);
1313
1363
  return target;
1314
1364
  }
1315
1365
  }
1316
1366
  return source;
1317
1367
  };
1318
- return _visit(obj, 0);
1368
+ return _visit(obj);
1319
1369
  };
1320
1370
 
1321
1371
  /**
@@ -1381,6 +1431,21 @@
1381
1431
  var isIterable = function isIterable(thing) {
1382
1432
  return thing != null && isFunction$1(thing[iterator]);
1383
1433
  };
1434
+
1435
+ /**
1436
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
1437
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
1438
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
1439
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
1440
+ * into an attacker-controlled entries iterator.
1441
+ *
1442
+ * @param {*} thing The value to test
1443
+ *
1444
+ * @returns {boolean} True if value has a non-polluted iterator
1445
+ */
1446
+ var isSafeIterable = function isSafeIterable(thing) {
1447
+ return thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
1448
+ };
1384
1449
  var utils$1 = {
1385
1450
  isArray: isArray,
1386
1451
  isArrayBuffer: isArrayBuffer,
@@ -1426,6 +1491,8 @@
1426
1491
  hasOwnProperty: hasOwnProperty,
1427
1492
  hasOwnProp: hasOwnProperty,
1428
1493
  // an alias to avoid ESLint no-prototype-builtins detection
1494
+ hasOwnInPrototypeChain: hasOwnInPrototypeChain,
1495
+ getSafeProp: getSafeProp,
1429
1496
  reduceDescriptors: reduceDescriptors,
1430
1497
  freezeMethods: freezeMethods,
1431
1498
  toObjectSet: toObjectSet,
@@ -1441,7 +1508,8 @@
1441
1508
  isThenable: isThenable,
1442
1509
  setImmediate: _setImmediate,
1443
1510
  asap: asap,
1444
- isIterable: isIterable
1511
+ isIterable: isIterable,
1512
+ isSafeIterable: isSafeIterable
1445
1513
  };
1446
1514
 
1447
1515
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1487,8 +1555,6 @@
1487
1555
  return parsed;
1488
1556
  });
1489
1557
 
1490
- var $internals = Symbol('internals');
1491
- var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1492
1558
  function trimSPorHTAB(str) {
1493
1559
  var start = 0;
1494
1560
  var end = str.length;
@@ -1508,12 +1574,38 @@
1508
1574
  }
1509
1575
  return start === 0 && end === str.length ? str : str.slice(start, end);
1510
1576
  }
1577
+
1578
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
1579
+ // eslint-disable-next-line no-control-regex
1580
+ var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", 'g');
1581
+ // eslint-disable-next-line no-control-regex
1582
+ var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", 'g');
1583
+ function sanitizeValue(value, invalidChars) {
1584
+ if (utils$1.isArray(value)) {
1585
+ return value.map(function (item) {
1586
+ return sanitizeValue(item, invalidChars);
1587
+ });
1588
+ }
1589
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
1590
+ }
1591
+ var sanitizeHeaderValue = function sanitizeHeaderValue(value) {
1592
+ return sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
1593
+ };
1594
+ var sanitizeByteStringHeaderValue = function sanitizeByteStringHeaderValue(value) {
1595
+ return sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
1596
+ };
1597
+ function toByteStringHeaderObject(headers) {
1598
+ var byteStringHeaders = Object.create(null);
1599
+ utils$1.forEach(headers.toJSON(), function (value, header) {
1600
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
1601
+ });
1602
+ return byteStringHeaders;
1603
+ }
1604
+
1605
+ var $internals = Symbol('internals');
1511
1606
  function normalizeHeader(header) {
1512
1607
  return header && String(header).trim().toLowerCase();
1513
1608
  }
1514
- function sanitizeHeaderValue(str) {
1515
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1516
- }
1517
1609
  function normalizeValue(value) {
1518
1610
  if (value === false || value == null) {
1519
1611
  return value;
@@ -1578,7 +1670,7 @@
1578
1670
  function setHeader(_value, _header, _rewrite) {
1579
1671
  var lHeader = normalizeHeader(_header);
1580
1672
  if (!lHeader) {
1581
- throw new Error('header name must be a non-empty string');
1673
+ return;
1582
1674
  }
1583
1675
  var key = utils$1.findKey(self, lHeader);
1584
1676
  if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
@@ -1594,8 +1686,8 @@
1594
1686
  setHeaders(header, valueOrRewrite);
1595
1687
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1596
1688
  setHeaders(parseHeaders(header), valueOrRewrite);
1597
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1598
- var obj = {},
1689
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1690
+ var obj = Object.create(null),
1599
1691
  dest,
1600
1692
  key;
1601
1693
  var _iterator = _createForOfIteratorHelper(header),
@@ -1604,9 +1696,15 @@
1604
1696
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
1605
1697
  var entry = _step.value;
1606
1698
  if (!utils$1.isArray(entry)) {
1607
- throw TypeError('Object iterator must return a key-value pair');
1699
+ throw new TypeError('Object iterator must return a key-value pair');
1700
+ }
1701
+ key = entry[0];
1702
+ if (utils$1.hasOwnProp(obj, key)) {
1703
+ dest = obj[key];
1704
+ obj[key] = utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]];
1705
+ } else {
1706
+ obj[key] = entry[1];
1608
1707
  }
1609
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
1610
1708
  }
1611
1709
  } catch (err) {
1612
1710
  _iterator.e(err);
@@ -1972,6 +2070,10 @@
1972
2070
  // eslint-disable-next-line strict
1973
2071
  var httpAdapter = null;
1974
2072
 
2073
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
2074
+ // the FormData <-> JSON round-trip stays symmetric.
2075
+ var DEFAULT_FORM_DATA_MAX_DEPTH = 100;
2076
+
1975
2077
  /**
1976
2078
  * Determines if the given thing is a array or js object.
1977
2079
  *
@@ -2072,8 +2174,9 @@
2072
2174
  var dots = options.dots;
2073
2175
  var indexes = options.indexes;
2074
2176
  var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2075
- var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2177
+ var maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
2076
2178
  var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2179
+ var stack = [];
2077
2180
  if (!utils$1.isFunction(visitor)) {
2078
2181
  throw new TypeError('visitor must be a function');
2079
2182
  }
@@ -2093,6 +2196,28 @@
2093
2196
  }
2094
2197
  return value;
2095
2198
  }
2199
+ function throwIfMaxDepthExceeded(depth) {
2200
+ if (depth > maxDepth) {
2201
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2202
+ }
2203
+ }
2204
+ function stringifyWithDepthLimit(value, depth) {
2205
+ if (maxDepth === Infinity) {
2206
+ return JSON.stringify(value);
2207
+ }
2208
+ var ancestors = [];
2209
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
2210
+ if (!utils$1.isObject(currentValue)) {
2211
+ return currentValue;
2212
+ }
2213
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
2214
+ ancestors.pop();
2215
+ }
2216
+ ancestors.push(currentValue);
2217
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
2218
+ return currentValue;
2219
+ });
2220
+ }
2096
2221
 
2097
2222
  /**
2098
2223
  * Default visitor.
@@ -2115,7 +2240,7 @@
2115
2240
  // eslint-disable-next-line no-param-reassign
2116
2241
  key = metaTokens ? key : key.slice(0, -2);
2117
2242
  // eslint-disable-next-line no-param-reassign
2118
- value = JSON.stringify(value);
2243
+ value = stringifyWithDepthLimit(value, 1);
2119
2244
  } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2120
2245
  // eslint-disable-next-line no-param-reassign
2121
2246
  key = removeBrackets(key);
@@ -2133,7 +2258,6 @@
2133
2258
  formData.append(renderKey(path, key, dots), convertValue(value));
2134
2259
  return false;
2135
2260
  }
2136
- var stack = [];
2137
2261
  var exposedHelpers = Object.assign(predicates, {
2138
2262
  defaultVisitor: defaultVisitor,
2139
2263
  convertValue: convertValue,
@@ -2142,11 +2266,9 @@
2142
2266
  function build(value, path) {
2143
2267
  var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2144
2268
  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
- }
2269
+ throwIfMaxDepthExceeded(depth);
2148
2270
  if (stack.indexOf(value) !== -1) {
2149
- throw Error('Circular reference detected in ' + path.join('.'));
2271
+ throw new Error('Circular reference detected in ' + path.join('.'));
2150
2272
  }
2151
2273
  stack.push(value);
2152
2274
  utils$1.forEach(value, function each(el, key) {
@@ -2236,11 +2358,15 @@
2236
2358
  if (!params) {
2237
2359
  return url;
2238
2360
  }
2239
- var _encode = options && options.encode || encode;
2240
2361
  var _options = utils$1.isFunction(options) ? {
2241
2362
  serialize: options
2242
2363
  } : options;
2243
- var serializeFn = _options && _options.serialize;
2364
+
2365
+ // Read serializer options pollution-safely: own properties and methods on a
2366
+ // class/template prototype are honored, but values injected onto a polluted
2367
+ // Object.prototype are ignored.
2368
+ var _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2369
+ var serializeFn = utils$1.getSafeProp(_options, 'serialize');
2244
2370
  var serializedParams;
2245
2371
  if (serializeFn) {
2246
2372
  serializedParams = serializeFn(params, _options);
@@ -2338,7 +2464,9 @@
2338
2464
  silentJSONParsing: true,
2339
2465
  forcedJSONParsing: true,
2340
2466
  clarifyTimeoutError: false,
2341
- legacyInterceptorReqResOrdering: true
2467
+ legacyInterceptorReqResOrdering: true,
2468
+ advertiseZstdAcceptEncoding: false,
2469
+ validateStatusUndefinedResolves: true
2342
2470
  };
2343
2471
 
2344
2472
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2418,6 +2546,13 @@
2418
2546
  }, options));
2419
2547
  }
2420
2548
 
2549
+ var MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2550
+ function throwIfDepthExceeded(index) {
2551
+ if (index > MAX_DEPTH) {
2552
+ throw new AxiosError('FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2553
+ }
2554
+ }
2555
+
2421
2556
  /**
2422
2557
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2423
2558
  *
@@ -2430,9 +2565,14 @@
2430
2565
  // foo.x.y.z
2431
2566
  // foo-x-y-z
2432
2567
  // 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
- });
2568
+ var path = [];
2569
+ var pattern = /\w+|\[(\w*)]/g;
2570
+ var match;
2571
+ while ((match = pattern.exec(name)) !== null) {
2572
+ throwIfDepthExceeded(path.length);
2573
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2574
+ }
2575
+ return path;
2436
2576
  }
2437
2577
 
2438
2578
  /**
@@ -2464,6 +2604,7 @@
2464
2604
  */
2465
2605
  function formDataToJSON(formData) {
2466
2606
  function buildPath(path, value, target, index) {
2607
+ throwIfDepthExceeded(index);
2467
2608
  var name = path[index++];
2468
2609
  if (name === '__proto__') return true;
2469
2610
  var isNumericKey = Number.isFinite(+name);
@@ -2477,7 +2618,7 @@
2477
2618
  }
2478
2619
  return !isNumericKey;
2479
2620
  }
2480
- if (!target[name] || !utils$1.isObject(target[name])) {
2621
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
2481
2622
  target[name] = [];
2482
2623
  }
2483
2624
  var result = buildPath(path, value, target[name], index);
@@ -2777,6 +2918,9 @@
2777
2918
  var bytesNotified = 0;
2778
2919
  var _speedometer = speedometer(50, 250);
2779
2920
  return throttle(function (e) {
2921
+ if (!e || typeof e.loaded !== 'number') {
2922
+ return;
2923
+ }
2780
2924
  var rawLoaded = e.loaded;
2781
2925
  var total = e.lengthComputable ? e.total : undefined;
2782
2926
  var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -2908,6 +3052,24 @@
2908
3052
  return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
2909
3053
  }
2910
3054
 
3055
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
3056
+ var httpProtocolControlCharacters = /[\t\n\r]/g;
3057
+ function stripLeadingC0ControlOrSpace(url) {
3058
+ var i = 0;
3059
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
3060
+ i++;
3061
+ }
3062
+ return url.slice(i);
3063
+ }
3064
+ function normalizeURLForProtocolCheck(url) {
3065
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
3066
+ }
3067
+ function assertValidHttpProtocolURL(url, config) {
3068
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
3069
+ throw new AxiosError('Invalid URL: missing "//" after protocol', AxiosError.ERR_INVALID_URL, config);
3070
+ }
3071
+ }
3072
+
2911
3073
  /**
2912
3074
  * Creates a new URL by combining the baseURL with the requestedURL,
2913
3075
  * only when the requestedURL is not already an absolute URL.
@@ -2918,9 +3080,11 @@
2918
3080
  *
2919
3081
  * @returns {string} The combined full path
2920
3082
  */
2921
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3083
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
3084
+ assertValidHttpProtocolURL(requestedURL, config);
2922
3085
  var isRelativeUrl = !isAbsoluteURL(requestedURL);
2923
3086
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
3087
+ assertValidHttpProtocolURL(baseURL, config);
2924
3088
  return combineURLs(baseURL, requestedURL);
2925
3089
  }
2926
3090
  return requestedURL;
@@ -2992,6 +3156,23 @@
2992
3156
  return getMergedValue(undefined, a);
2993
3157
  }
2994
3158
  }
3159
+ function getMergedTransitionalOption(prop) {
3160
+ var transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
3161
+ if (!utils$1.isUndefined(transitional2)) {
3162
+ if (utils$1.isPlainObject(transitional2)) {
3163
+ if (utils$1.hasOwnProp(transitional2, prop)) {
3164
+ return transitional2[prop];
3165
+ }
3166
+ } else {
3167
+ return undefined;
3168
+ }
3169
+ }
3170
+ var transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
3171
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
3172
+ return transitional1[prop];
3173
+ }
3174
+ return undefined;
3175
+ }
2995
3176
 
2996
3177
  // eslint-disable-next-line consistent-return
2997
3178
  function mergeDirectKeys(a, b, prop) {
@@ -3043,6 +3224,13 @@
3043
3224
  var configValue = merge(a, b, prop);
3044
3225
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
3045
3226
  });
3227
+ if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption('validateStatusUndefinedResolves') === false) {
3228
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3229
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3230
+ } else {
3231
+ delete config.validateStatus;
3232
+ }
3233
+ }
3046
3234
  return config;
3047
3235
  }
3048
3236
 
@@ -3070,12 +3258,12 @@
3070
3258
  *
3071
3259
  * @returns {string} UTF-8 bytes as a Latin-1 string
3072
3260
  */
3073
- var encodeUTF8 = function encodeUTF8(str) {
3261
+ var encodeUTF8$1 = function encodeUTF8(str) {
3074
3262
  return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3075
3263
  return String.fromCharCode(parseInt(hex, 16));
3076
3264
  });
3077
3265
  };
3078
- var resolveConfig = (function (config) {
3266
+ function resolveConfig(config) {
3079
3267
  var newConfig = mergeConfig({}, config);
3080
3268
 
3081
3269
  // Read only own properties to prevent prototype pollution gadgets
@@ -3093,15 +3281,17 @@
3093
3281
  var allowAbsoluteUrls = own('allowAbsoluteUrls');
3094
3282
  var url = own('url');
3095
3283
  newConfig.headers = headers = AxiosHeaders.from(headers);
3096
- newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
3284
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig), own('params'), own('paramsSerializer'));
3097
3285
 
3098
3286
  // HTTP basic authentication
3099
3287
  if (auth) {
3100
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
3288
+ var username = utils$1.getSafeProp(auth, 'username') || '';
3289
+ var password = utils$1.getSafeProp(auth, 'password') || '';
3290
+ headers.set('Authorization', 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : '')));
3101
3291
  }
3102
3292
  if (utils$1.isFormData(data)) {
3103
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3104
- headers.setContentType(undefined); // browser handles it
3293
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
3294
+ headers.setContentType(undefined); // browser/web worker/RN handles it
3105
3295
  } else if (utils$1.isFunction(data.getHeaders)) {
3106
3296
  // Node.js FormData (like form-data package)
3107
3297
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -3129,7 +3319,7 @@
3129
3319
  }
3130
3320
  }
3131
3321
  return newConfig;
3132
- });
3322
+ }
3133
3323
 
3134
3324
  var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3135
3325
  var xhrAdapter = isXHRAdapterSupported && function (config) {
@@ -3249,7 +3439,7 @@
3249
3439
 
3250
3440
  // Add headers to the request
3251
3441
  if ('setRequestHeader' in request) {
3252
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3442
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3253
3443
  request.setRequestHeader(key, val);
3254
3444
  });
3255
3445
  }
@@ -3311,42 +3501,43 @@
3311
3501
  };
3312
3502
 
3313
3503
  var composeSignals = function composeSignals(signals, timeout) {
3314
- var _signals = signals = signals ? signals.filter(Boolean) : [],
3315
- length = _signals.length;
3316
- if (timeout || length) {
3317
- var controller = new AbortController();
3318
- var aborted;
3319
- var onabort = function onabort(reason) {
3320
- if (!aborted) {
3321
- aborted = true;
3322
- unsubscribe();
3323
- var err = reason instanceof Error ? reason : this.reason;
3324
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3325
- }
3326
- };
3327
- var timer = timeout && setTimeout(function () {
3328
- timer = null;
3329
- onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
3330
- }, timeout);
3331
- var unsubscribe = function unsubscribe() {
3332
- if (signals) {
3333
- timer && clearTimeout(timer);
3334
- timer = null;
3335
- signals.forEach(function (signal) {
3336
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3337
- });
3338
- signals = null;
3339
- }
3340
- };
3504
+ signals = signals ? signals.filter(Boolean) : [];
3505
+ if (!timeout && !signals.length) {
3506
+ return;
3507
+ }
3508
+ var controller = new AbortController();
3509
+ var aborted = false;
3510
+ var onabort = function onabort(reason) {
3511
+ if (!aborted) {
3512
+ aborted = true;
3513
+ unsubscribe();
3514
+ var err = reason instanceof Error ? reason : this.reason;
3515
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3516
+ }
3517
+ };
3518
+ var timer = timeout && setTimeout(function () {
3519
+ timer = null;
3520
+ onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
3521
+ }, timeout);
3522
+ var unsubscribe = function unsubscribe() {
3523
+ if (!signals) {
3524
+ return;
3525
+ }
3526
+ timer && clearTimeout(timer);
3527
+ timer = null;
3341
3528
  signals.forEach(function (signal) {
3342
- return signal.addEventListener('abort', onabort);
3529
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3343
3530
  });
3344
- var signal = controller.signal;
3345
- signal.unsubscribe = function () {
3346
- return utils$1.asap(unsubscribe);
3347
- };
3348
- return signal;
3349
- }
3531
+ signals = null;
3532
+ };
3533
+ signals.forEach(function (signal) {
3534
+ return signal.addEventListener('abort', onabort);
3535
+ });
3536
+ var signal = controller.signal;
3537
+ signal.unsubscribe = function () {
3538
+ return utils$1.asap(unsubscribe);
3539
+ };
3540
+ return signal;
3350
3541
  };
3351
3542
 
3352
3543
  var streamChunk = /*#__PURE__*/_regenerator().m(function streamChunk(chunk, chunkSize) {
@@ -3556,11 +3747,17 @@
3556
3747
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3557
3748
  * - For base64: compute exact decoded size using length and padding;
3558
3749
  * 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.
3750
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
3560
3751
  *
3561
3752
  * @param {string} url
3562
3753
  * @returns {number}
3563
3754
  */
3755
+ var isHexDigit = function isHexDigit(charCode) {
3756
+ return charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
3757
+ };
3758
+ var isPercentEncodedByte = function isPercentEncodedByte(str, i, len) {
3759
+ return i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3760
+ };
3564
3761
  function estimateDataURLDecodedBytes(url) {
3565
3762
  if (!url || typeof url !== 'string') return 0;
3566
3763
  if (!url.startsWith('data:')) return 0;
@@ -3577,7 +3774,7 @@
3577
3774
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3578
3775
  var a = body.charCodeAt(i + 1);
3579
3776
  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);
3777
+ var isHex = isHexDigit(a) && isHexDigit(b);
3581
3778
  if (isHex) {
3582
3779
  effectiveLen -= 2;
3583
3780
  i += 2;
@@ -3614,18 +3811,18 @@
3614
3811
  var _bytes = groups * 3 - (pad || 0);
3615
3812
  return _bytes > 0 ? _bytes : 0;
3616
3813
  }
3617
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3618
- return Buffer.byteLength(body, 'utf8');
3619
- }
3620
3814
 
3621
3815
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3622
3816
  // 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).
3817
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3818
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3625
3819
  var bytes = 0;
3626
3820
  for (var _i = 0, _len = body.length; _i < _len; _i++) {
3627
3821
  var c = body.charCodeAt(_i);
3628
- if (c < 0x80) {
3822
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, _i, _len)) {
3823
+ bytes += 1;
3824
+ _i += 2;
3825
+ } else if (c < 0x80) {
3629
3826
  bytes += 1;
3630
3827
  } else if (c < 0x800) {
3631
3828
  bytes += 2;
@@ -3644,10 +3841,39 @@
3644
3841
  return bytes;
3645
3842
  }
3646
3843
 
3647
- var VERSION = "1.16.0";
3844
+ var VERSION = "1.18.0";
3648
3845
 
3649
3846
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
3650
3847
  var isFunction = utils$1.isFunction;
3848
+
3849
+ /**
3850
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3851
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3852
+ *
3853
+ * @param {string} str The string to encode
3854
+ *
3855
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3856
+ */
3857
+ var encodeUTF8 = function encodeUTF8(str) {
3858
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3859
+ return String.fromCharCode(parseInt(hex, 16));
3860
+ });
3861
+ };
3862
+
3863
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
3864
+ // Decode before composing the `auth` option so credentials such as
3865
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
3866
+ // original value for malformed input so a bad encoding never throws.
3867
+ var decodeURIComponentSafe = function decodeURIComponentSafe(value) {
3868
+ if (!utils$1.isString(value)) {
3869
+ return value;
3870
+ }
3871
+ try {
3872
+ return decodeURIComponent(value);
3873
+ } catch (error) {
3874
+ return value;
3875
+ }
3876
+ };
3651
3877
  var test = function test(fn) {
3652
3878
  try {
3653
3879
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -3658,9 +3884,16 @@
3658
3884
  return false;
3659
3885
  }
3660
3886
  };
3887
+ var maybeWithAuthCredentials = function maybeWithAuthCredentials(url) {
3888
+ var protocolIndex = url.indexOf('://');
3889
+ var urlToCheck = url;
3890
+ if (protocolIndex !== -1) {
3891
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
3892
+ }
3893
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
3894
+ };
3661
3895
  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;
3896
+ var globalObject = utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
3664
3897
  var ReadableStream = globalObject.ReadableStream,
3665
3898
  TextEncoder = globalObject.TextEncoder;
3666
3899
  env = utils$1.merge.call({
@@ -3812,13 +4045,16 @@
3812
4045
  }();
3813
4046
  return /*#__PURE__*/function () {
3814
4047
  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;
4048
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4;
3816
4049
  return _regenerator().w(function (_context4) {
3817
4050
  while (1) switch (_context4.p = _context4.n) {
3818
4051
  case 0:
3819
4052
  _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
4053
  hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3821
4054
  hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
4055
+ own = function own(key) {
4056
+ return utils$1.hasOwnProp(config, key) ? config[key] : undefined;
4057
+ };
3822
4058
  _fetch = envFetch || fetch;
3823
4059
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3824
4060
  composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
@@ -3826,7 +4062,50 @@
3826
4062
  unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3827
4063
  composedSignal.unsubscribe();
3828
4064
  };
4065
+ // AxiosError we raise while the request body is being streamed. Captured
4066
+ // by identity so the catch block can surface it directly, regardless of
4067
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
4068
+ // as `err.cause`; some browsers drop the original error entirely).
4069
+ pendingBodyError = null;
4070
+ maxBodyLengthError = function maxBodyLengthError() {
4071
+ return new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4072
+ };
3829
4073
  _context4.p = 1;
4074
+ // HTTP basic authentication
4075
+ auth = undefined;
4076
+ configAuth = own('auth');
4077
+ if (configAuth) {
4078
+ username = utils$1.getSafeProp(configAuth, 'username') || '';
4079
+ password = utils$1.getSafeProp(configAuth, 'password') || '';
4080
+ auth = {
4081
+ username: username,
4082
+ password: password
4083
+ };
4084
+ }
4085
+ if (maybeWithAuthCredentials(url)) {
4086
+ parsedURL = new URL(url, platform.origin);
4087
+ if (!auth && (parsedURL.username || parsedURL.password)) {
4088
+ urlUsername = decodeURIComponentSafe(parsedURL.username);
4089
+ urlPassword = decodeURIComponentSafe(parsedURL.password);
4090
+ auth = {
4091
+ username: urlUsername,
4092
+ password: urlPassword
4093
+ };
4094
+ }
4095
+ if (parsedURL.username || parsedURL.password) {
4096
+ parsedURL.username = '';
4097
+ parsedURL.password = '';
4098
+ url = parsedURL.href;
4099
+ }
4100
+ }
4101
+ if (auth) {
4102
+ headers["delete"]('authorization');
4103
+ headers.set('Authorization', 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || ''))));
4104
+ }
4105
+
4106
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
4107
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
4108
+ // "if (protocol === 'data:')" branch).
3830
4109
  if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
3831
4110
  _context4.n = 2;
3832
4111
  break;
@@ -3843,43 +4122,82 @@
3843
4122
  break;
3844
4123
  }
3845
4124
  _context4.n = 3;
3846
- return resolveBodyLength(headers, data);
4125
+ return getBodyLength(data);
3847
4126
  case 3:
3848
4127
  outboundLength = _context4.v;
3849
- if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
4128
+ if (!(typeof outboundLength === 'number' && isFinite(outboundLength))) {
4129
+ _context4.n = 4;
4130
+ break;
4131
+ }
4132
+ requestContentLength = outboundLength;
4133
+ if (!(outboundLength > maxBodyLength)) {
3850
4134
  _context4.n = 4;
3851
4135
  break;
3852
4136
  }
3853
- throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4137
+ throw maxBodyLengthError();
3854
4138
  case 4:
3855
- _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3856
- if (!_t3) {
4139
+ // A streamed body under maxBodyLength must be counted as fetch consumes
4140
+ // it; its size is never trusted from a caller-declared Content-Length.
4141
+ mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
4142
+ trackRequestStream = function trackRequestStream(stream, onProgress, flush) {
4143
+ return trackStream(stream, DEFAULT_CHUNK_SIZE, function (loadedBytes) {
4144
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
4145
+ throw pendingBodyError = maxBodyLengthError();
4146
+ }
4147
+ onProgress && onProgress(loadedBytes);
4148
+ }, flush);
4149
+ };
4150
+ if (!(supportsRequestStream && method !== 'get' && method !== 'head' && (onUploadProgress || mustEnforceStreamBody))) {
4151
+ _context4.n = 8;
4152
+ break;
4153
+ }
4154
+ if (!(requestContentLength == null)) {
3857
4155
  _context4.n = 6;
3858
4156
  break;
3859
4157
  }
3860
4158
  _context4.n = 5;
3861
4159
  return resolveBodyLength(headers, data);
3862
4160
  case 5:
3863
- _t4 = requestContentLength = _context4.v;
3864
- _t3 = _t4 !== 0;
4161
+ _t3 = _context4.v;
4162
+ _context4.n = 7;
4163
+ break;
3865
4164
  case 6:
3866
- if (!_t3) {
3867
- _context4.n = 7;
3868
- break;
4165
+ _t3 = requestContentLength;
4166
+ case 7:
4167
+ requestContentLength = _t3;
4168
+ // A declared length of 0 is only trusted to skip the wrap when we are
4169
+ // not enforcing a stream limit (which must not rely on that header).
4170
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
4171
+ _request = new Request(url, {
4172
+ method: 'POST',
4173
+ body: data,
4174
+ duplex: 'half'
4175
+ });
4176
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
4177
+ headers.setContentType(contentTypeHeader);
4178
+ }
4179
+ if (_request.body) {
4180
+ _ref5 = onUploadProgress && progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))) || [], _ref6 = _slicedToArray(_ref5, 2), onProgress = _ref6[0], flush = _ref6[1];
4181
+ data = trackRequestStream(_request.body, onProgress, flush);
4182
+ }
3869
4183
  }
3870
- _request = new Request(url, {
3871
- method: 'POST',
3872
- body: data,
3873
- duplex: 'half'
3874
- });
3875
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3876
- headers.setContentType(contentTypeHeader);
4184
+ _context4.n = 10;
4185
+ break;
4186
+ case 8:
4187
+ if (!(mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== 'get' && method !== 'head')) {
4188
+ _context4.n = 9;
4189
+ break;
3877
4190
  }
3878
- if (_request.body) {
3879
- _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3880
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
4191
+ data = trackRequestStream(data);
4192
+ _context4.n = 10;
4193
+ break;
4194
+ case 9:
4195
+ if (!(mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== 'get' && method !== 'head')) {
4196
+ _context4.n = 10;
4197
+ break;
3881
4198
  }
3882
- case 7:
4199
+ throw new AxiosError('Stream request bodies are not supported by the current fetch implementation', AxiosError.ERR_NOT_SUPPORT, config, request);
4200
+ case 10:
3883
4201
  if (!utils$1.isString(withCredentials)) {
3884
4202
  withCredentials = withCredentials ? 'include' : 'omit';
3885
4203
  }
@@ -3900,35 +4218,37 @@
3900
4218
  resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3901
4219
  signal: composedSignal,
3902
4220
  method: method.toUpperCase(),
3903
- headers: headers.normalize().toJSON(),
4221
+ headers: toByteStringHeaderObject(headers.normalize()),
3904
4222
  body: data,
3905
4223
  duplex: 'half',
3906
4224
  credentials: isCredentialsSupported ? withCredentials : undefined
3907
4225
  });
3908
4226
  request = isRequestSupported && new Request(url, resolvedOptions);
3909
- _context4.n = 8;
4227
+ _context4.n = 11;
3910
4228
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3911
- case 8:
4229
+ case 11:
3912
4230
  response = _context4.v;
4231
+ responseHeaders = AxiosHeaders.from(response.headers); // Cheap pre-check: if the server honestly declares a content-length that
4232
+ // already exceeds the cap, reject before we start streaming.
3913
4233
  if (!hasMaxContentLength) {
3914
- _context4.n = 9;
4234
+ _context4.n = 12;
3915
4235
  break;
3916
4236
  }
3917
- declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4237
+ declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3918
4238
  if (!(declaredLength != null && declaredLength > maxContentLength)) {
3919
- _context4.n = 9;
4239
+ _context4.n = 12;
3920
4240
  break;
3921
4241
  }
3922
4242
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3923
- case 9:
4243
+ case 12:
3924
4244
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3925
4245
  if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
3926
4246
  options = {};
3927
4247
  ['status', 'statusText', 'headers'].forEach(function (prop) {
3928
4248
  options[prop] = response[prop];
3929
4249
  });
3930
- responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3931
- _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
4250
+ responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
4251
+ _ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
3932
4252
  bytesRead = 0;
3933
4253
  onChunkProgress = function onChunkProgress(loadedBytes) {
3934
4254
  if (hasMaxContentLength) {
@@ -3945,12 +4265,12 @@
3945
4265
  }), options);
3946
4266
  }
3947
4267
  responseType = responseType || 'text';
3948
- _context4.n = 10;
4268
+ _context4.n = 13;
3949
4269
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3950
- case 10:
4270
+ case 13:
3951
4271
  responseData = _context4.v;
3952
4272
  if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
3953
- _context4.n = 11;
4273
+ _context4.n = 14;
3954
4274
  break;
3955
4275
  }
3956
4276
  if (responseData != null) {
@@ -3963,13 +4283,13 @@
3963
4283
  }
3964
4284
  }
3965
4285
  if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
3966
- _context4.n = 11;
4286
+ _context4.n = 14;
3967
4287
  break;
3968
4288
  }
3969
4289
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3970
- case 11:
4290
+ case 14:
3971
4291
  !isStreamResponse && unsubscribe && unsubscribe();
3972
- _context4.n = 12;
4292
+ _context4.n = 15;
3973
4293
  return new Promise(function (resolve, reject) {
3974
4294
  settle(resolve, reject, {
3975
4295
  data: responseData,
@@ -3980,39 +4300,53 @@
3980
4300
  request: request
3981
4301
  });
3982
4302
  });
3983
- case 12:
4303
+ case 15:
3984
4304
  return _context4.a(2, _context4.v);
3985
- case 13:
3986
- _context4.p = 13;
3987
- _t5 = _context4.v;
4305
+ case 16:
4306
+ _context4.p = 16;
4307
+ _t4 = _context4.v;
3988
4308
  unsubscribe && unsubscribe();
3989
4309
 
3990
4310
  // Safari can surface fetch aborts as a DOMException-like object whose
3991
4311
  // branded getters throw. Prefer our composed signal reason before reading
3992
4312
  // the caught error, preserving timeout vs cancellation semantics.
3993
4313
  if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
3994
- _context4.n = 14;
4314
+ _context4.n = 17;
3995
4315
  break;
3996
4316
  }
3997
4317
  canceledError = composedSignal.reason;
3998
4318
  canceledError.config = config;
3999
4319
  request && (canceledError.request = request);
4000
- _t5 !== canceledError && (canceledError.cause = _t5);
4320
+ _t4 !== canceledError && (canceledError.cause = _t4);
4001
4321
  throw canceledError;
4002
- case 14:
4003
- if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
4004
- _context4.n = 15;
4322
+ case 17:
4323
+ if (!pendingBodyError) {
4324
+ _context4.n = 18;
4005
4325
  break;
4006
4326
  }
4007
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t5 && _t5.response), {
4008
- cause: _t5.cause || _t5
4327
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
4328
+ throw pendingBodyError;
4329
+ case 18:
4330
+ if (!(_t4 instanceof AxiosError)) {
4331
+ _context4.n = 19;
4332
+ break;
4333
+ }
4334
+ request && !_t4.request && (_t4.request = request);
4335
+ throw _t4;
4336
+ case 19:
4337
+ if (!(_t4 && _t4.name === 'TypeError' && /Load failed|fetch/i.test(_t4.message))) {
4338
+ _context4.n = 20;
4339
+ break;
4340
+ }
4341
+ throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t4 && _t4.response), {
4342
+ cause: _t4.cause || _t4
4009
4343
  });
4010
- case 15:
4011
- throw AxiosError.from(_t5, _t5 && _t5.code, config, request, _t5 && _t5.response);
4012
- case 16:
4344
+ case 20:
4345
+ throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
4346
+ case 21:
4013
4347
  return _context4.a(2);
4014
4348
  }
4015
- }, _callee4, null, [[1, 13]]);
4349
+ }, _callee4, null, [[1, 16]]);
4016
4350
  }));
4017
4351
  return function (_x5) {
4018
4352
  return _ref4.apply(this, arguments);
@@ -4412,7 +4746,9 @@
4412
4746
  silentJSONParsing: validators.transitional(validators["boolean"]),
4413
4747
  forcedJSONParsing: validators.transitional(validators["boolean"]),
4414
4748
  clarifyTimeoutError: validators.transitional(validators["boolean"]),
4415
- legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"])
4749
+ legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"]),
4750
+ advertiseZstdAcceptEncoding: validators.transitional(validators["boolean"]),
4751
+ validateStatusUndefinedResolves: validators.transitional(validators["boolean"])
4416
4752
  }, false);
4417
4753
  }
4418
4754
  if (paramsSerializer != null) {
@@ -4511,7 +4847,7 @@
4511
4847
  key: "getUri",
4512
4848
  value: function getUri(config) {
4513
4849
  config = mergeConfig(this.defaults, config);
4514
- var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4850
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4515
4851
  return buildURL(fullPath, config.params, config.paramsSerializer);
4516
4852
  }
4517
4853
  }]);
@@ -4522,7 +4858,7 @@
4522
4858
  return this.request(mergeConfig(config || {}, {
4523
4859
  method: method,
4524
4860
  url: url,
4525
- data: (config || {}).data
4861
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
4526
4862
  }));
4527
4863
  };
4528
4864
  });