@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
  /**
3
3
  * Create a bound version of a function with a specified `this` context
4
4
  *
@@ -18,6 +18,57 @@ const { toString } = Object.prototype;
18
18
  const { getPrototypeOf } = Object;
19
19
  const { iterator, toStringTag } = Symbol;
20
20
 
21
+ /* Creating a function that will check if an object has a property. */
22
+ const hasOwnProperty = (
23
+ ({ hasOwnProperty }) =>
24
+ (obj, prop) =>
25
+ hasOwnProperty.call(obj, prop)
26
+ )(Object.prototype);
27
+
28
+ /**
29
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
30
+ * an own `prop`. This distinguishes genuine own/inherited members — including
31
+ * class accessors and template prototypes — from members injected via
32
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
33
+ * live on Object.prototype itself and are therefore never matched.
34
+ *
35
+ * @param {*} thing The value whose chain to inspect
36
+ * @param {string|symbol} prop The property key to look for
37
+ *
38
+ * @returns {boolean} True when `prop` is owned below Object.prototype
39
+ */
40
+ const hasOwnInPrototypeChain = (thing, prop) => {
41
+ let obj = thing;
42
+ const seen = [];
43
+
44
+ while (obj != null && obj !== Object.prototype) {
45
+ if (seen.indexOf(obj) !== -1) {
46
+ return false;
47
+ }
48
+ seen.push(obj);
49
+
50
+ if (hasOwnProperty(obj, prop)) {
51
+ return true;
52
+ }
53
+ obj = getPrototypeOf(obj);
54
+ }
55
+ return false;
56
+ };
57
+
58
+ /**
59
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
60
+ * properties and members inherited from a non-Object.prototype source (a class
61
+ * instance or template object) are honored; a value reachable only through a
62
+ * polluted Object.prototype is ignored and `undefined` is returned.
63
+ *
64
+ * @param {*} obj The source object
65
+ * @param {string|symbol} prop The property key to read
66
+ *
67
+ * @returns {*} The resolved value, or undefined when unsafe/absent
68
+ */
69
+ const getSafeProp = (obj, prop) =>
70
+ obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
71
+
21
72
  const kindOf = ((cache) => (thing) => {
22
73
  const str = toString.call(thing);
23
74
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -143,7 +194,7 @@ const isBoolean = (thing) => thing === true || thing === false;
143
194
  * @returns {boolean} True if value is a plain Object, otherwise false
144
195
  */
145
196
  const isPlainObject = (val) => {
146
- if (kindOf(val) !== 'object') {
197
+ if (!isObject(val)) {
147
198
  return false;
148
199
  }
149
200
 
@@ -151,9 +202,12 @@ const isPlainObject = (val) => {
151
202
  return (
152
203
  (prototype === null ||
153
204
  prototype === Object.prototype ||
154
- Object.getPrototypeOf(prototype) === null) &&
155
- !(toStringTag in val) &&
156
- !(iterator in val)
205
+ getPrototypeOf(prototype) === null) &&
206
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
207
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
208
+ // than a plain object, while ignoring keys injected onto Object.prototype.
209
+ !hasOwnInPrototypeChain(val, toStringTag) &&
210
+ !hasOwnInPrototypeChain(val, iterator)
157
211
  );
158
212
  };
159
213
 
@@ -422,7 +476,9 @@ function merge(...objs) {
422
476
  return;
423
477
  }
424
478
 
425
- const targetKey = (caseless && findKey(result, key)) || key;
479
+ // findKey lowercases the key, so caseless lookup only applies to strings —
480
+ // symbol keys are identity-matched.
481
+ const targetKey = (caseless && typeof key === 'string' && findKey(result, key)) || key;
426
482
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
427
483
  // chain, so a polluted Object.prototype value could surface here and get
428
484
  // copied into the merged result.
@@ -439,7 +495,24 @@ function merge(...objs) {
439
495
  };
440
496
 
441
497
  for (let i = 0, l = objs.length; i < l; i++) {
442
- objs[i] && forEach(objs[i], assignValue);
498
+ const source = objs[i];
499
+ if (!source || isBuffer(source)) {
500
+ continue;
501
+ }
502
+
503
+ forEach(source, assignValue);
504
+
505
+ if (typeof source !== 'object' || isArray(source)) {
506
+ continue;
507
+ }
508
+
509
+ const symbols = Object.getOwnPropertySymbols(source);
510
+ for (let j = 0; j < symbols.length; j++) {
511
+ const symbol = symbols[j];
512
+ if (propertyIsEnumerable.call(source, symbol)) {
513
+ assignValue(source[symbol], symbol);
514
+ }
515
+ }
443
516
  }
444
517
  return result;
445
518
  }
@@ -661,12 +734,7 @@ const toCamelCase = (str) => {
661
734
  });
662
735
  };
663
736
 
664
- /* Creating a function that will check if an object has a property. */
665
- const hasOwnProperty = (
666
- ({ hasOwnProperty }) =>
667
- (obj, prop) =>
668
- hasOwnProperty.call(obj, prop)
669
- )(Object.prototype);
737
+ const { propertyIsEnumerable } = Object.prototype;
670
738
 
671
739
  /**
672
740
  * Determine if a value is a RegExp object
@@ -773,11 +841,11 @@ function isSpecCompliantForm(thing) {
773
841
  * @returns {Object} The JSON-compatible object.
774
842
  */
775
843
  const toJSONObject = (obj) => {
776
- const stack = new Array(10);
844
+ const visited = new WeakSet();
777
845
 
778
- const visit = (source, i) => {
846
+ const visit = (source) => {
779
847
  if (isObject(source)) {
780
- if (stack.indexOf(source) >= 0) {
848
+ if (visited.has(source)) {
781
849
  return;
782
850
  }
783
851
 
@@ -787,15 +855,16 @@ const toJSONObject = (obj) => {
787
855
  }
788
856
 
789
857
  if (!('toJSON' in source)) {
790
- stack[i] = source;
858
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
859
+ visited.add(source);
791
860
  const target = isArray(source) ? [] : {};
792
861
 
793
862
  forEach(source, (value, key) => {
794
- const reducedValue = visit(value, i + 1);
863
+ const reducedValue = visit(value);
795
864
  !isUndefined(reducedValue) && (target[key] = reducedValue);
796
865
  });
797
866
 
798
- stack[i] = undefined;
867
+ visited.delete(source);
799
868
 
800
869
  return target;
801
870
  }
@@ -804,7 +873,7 @@ const toJSONObject = (obj) => {
804
873
  return source;
805
874
  };
806
875
 
807
- return visit(obj, 0);
876
+ return visit(obj);
808
877
  };
809
878
 
810
879
  /**
@@ -878,6 +947,20 @@ const asap =
878
947
 
879
948
  const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
880
949
 
950
+ /**
951
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
952
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
953
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
954
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
955
+ * into an attacker-controlled entries iterator.
956
+ *
957
+ * @param {*} thing The value to test
958
+ *
959
+ * @returns {boolean} True if value has a non-polluted iterator
960
+ */
961
+ const isSafeIterable = (thing) =>
962
+ thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
963
+
881
964
  var utils$1 = {
882
965
  isArray,
883
966
  isArrayBuffer,
@@ -922,6 +1005,8 @@ var utils$1 = {
922
1005
  isHTMLForm,
923
1006
  hasOwnProperty,
924
1007
  hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
1008
+ hasOwnInPrototypeChain,
1009
+ getSafeProp,
925
1010
  reduceDescriptors,
926
1011
  freezeMethods,
927
1012
  toObjectSet,
@@ -938,6 +1023,7 @@ var utils$1 = {
938
1023
  setImmediate: _setImmediate,
939
1024
  asap,
940
1025
  isIterable,
1026
+ isSafeIterable,
941
1027
  };
942
1028
 
943
1029
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1006,10 +1092,6 @@ var parseHeaders = (rawHeaders) => {
1006
1092
  return parsed;
1007
1093
  };
1008
1094
 
1009
- const $internals = Symbol('internals');
1010
-
1011
- const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1012
-
1013
1095
  function trimSPorHTAB(str) {
1014
1096
  let start = 0;
1015
1097
  let end = str.length;
@@ -1037,12 +1119,40 @@ function trimSPorHTAB(str) {
1037
1119
  return start === 0 && end === str.length ? str : str.slice(start, end);
1038
1120
  }
1039
1121
 
1040
- function normalizeHeader(header) {
1041
- return header && String(header).trim().toLowerCase();
1122
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
1123
+ // eslint-disable-next-line no-control-regex
1124
+ const INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp('[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+', 'g');
1125
+ // eslint-disable-next-line no-control-regex
1126
+ const INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp('[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+', 'g');
1127
+
1128
+ function sanitizeValue(value, invalidChars) {
1129
+ if (utils$1.isArray(value)) {
1130
+ return value.map((item) => sanitizeValue(item, invalidChars));
1131
+ }
1132
+
1133
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
1134
+ }
1135
+
1136
+ const sanitizeHeaderValue = (value) =>
1137
+ sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
1138
+
1139
+ const sanitizeByteStringHeaderValue = (value) =>
1140
+ sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
1141
+
1142
+ function toByteStringHeaderObject(headers) {
1143
+ const byteStringHeaders = Object.create(null);
1144
+
1145
+ utils$1.forEach(headers.toJSON(), (value, header) => {
1146
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
1147
+ });
1148
+
1149
+ return byteStringHeaders;
1042
1150
  }
1043
1151
 
1044
- function sanitizeHeaderValue(str) {
1045
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1152
+ const $internals = Symbol('internals');
1153
+
1154
+ function normalizeHeader(header) {
1155
+ return header && String(header).trim().toLowerCase();
1046
1156
  }
1047
1157
 
1048
1158
  function normalizeValue(value) {
@@ -1124,7 +1234,7 @@ let AxiosHeaders$1 = class AxiosHeaders {
1124
1234
  const lHeader = normalizeHeader(_header);
1125
1235
 
1126
1236
  if (!lHeader) {
1127
- throw new Error('header name must be a non-empty string');
1237
+ return;
1128
1238
  }
1129
1239
 
1130
1240
  const key = utils$1.findKey(self, lHeader);
@@ -1146,20 +1256,23 @@ let AxiosHeaders$1 = class AxiosHeaders {
1146
1256
  setHeaders(header, valueOrRewrite);
1147
1257
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1148
1258
  setHeaders(parseHeaders(header), valueOrRewrite);
1149
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1150
- let obj = {},
1259
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1260
+ let obj = Object.create(null),
1151
1261
  dest,
1152
1262
  key;
1153
1263
  for (const entry of header) {
1154
1264
  if (!utils$1.isArray(entry)) {
1155
- throw TypeError('Object iterator must return a key-value pair');
1265
+ throw new TypeError('Object iterator must return a key-value pair');
1156
1266
  }
1157
1267
 
1158
- obj[(key = entry[0])] = (dest = obj[key])
1159
- ? utils$1.isArray(dest)
1160
- ? [...dest, entry[1]]
1161
- : [dest, entry[1]]
1162
- : entry[1];
1268
+ key = entry[0];
1269
+
1270
+ if (utils$1.hasOwnProp(obj, key)) {
1271
+ dest = obj[key];
1272
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
1273
+ } else {
1274
+ obj[key] = entry[1];
1275
+ }
1163
1276
  }
1164
1277
 
1165
1278
  setHeaders(obj, valueOrRewrite);
@@ -1553,6 +1666,10 @@ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1553
1666
  // eslint-disable-next-line strict
1554
1667
  var httpAdapter = null;
1555
1668
 
1669
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
1670
+ // the FormData <-> JSON round-trip stays symmetric.
1671
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1672
+
1556
1673
  /**
1557
1674
  * Determines if the given thing is a array or js object.
1558
1675
  *
@@ -1663,8 +1780,9 @@ function toFormData$1(obj, formData, options) {
1663
1780
  const dots = options.dots;
1664
1781
  const indexes = options.indexes;
1665
1782
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1666
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1783
+ const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
1667
1784
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1785
+ const stack = [];
1668
1786
 
1669
1787
  if (!utils$1.isFunction(visitor)) {
1670
1788
  throw new TypeError('visitor must be a function');
@@ -1692,6 +1810,38 @@ function toFormData$1(obj, formData, options) {
1692
1810
  return value;
1693
1811
  }
1694
1812
 
1813
+ function throwIfMaxDepthExceeded(depth) {
1814
+ if (depth > maxDepth) {
1815
+ throw new AxiosError$1(
1816
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1817
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1818
+ );
1819
+ }
1820
+ }
1821
+
1822
+ function stringifyWithDepthLimit(value, depth) {
1823
+ if (maxDepth === Infinity) {
1824
+ return JSON.stringify(value);
1825
+ }
1826
+
1827
+ const ancestors = [];
1828
+
1829
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1830
+ if (!utils$1.isObject(currentValue)) {
1831
+ return currentValue;
1832
+ }
1833
+
1834
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1835
+ ancestors.pop();
1836
+ }
1837
+
1838
+ ancestors.push(currentValue);
1839
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1840
+
1841
+ return currentValue;
1842
+ });
1843
+ }
1844
+
1695
1845
  /**
1696
1846
  * Default visitor.
1697
1847
  *
@@ -1715,7 +1865,7 @@ function toFormData$1(obj, formData, options) {
1715
1865
  // eslint-disable-next-line no-param-reassign
1716
1866
  key = metaTokens ? key : key.slice(0, -2);
1717
1867
  // eslint-disable-next-line no-param-reassign
1718
- value = JSON.stringify(value);
1868
+ value = stringifyWithDepthLimit(value, 1);
1719
1869
  } else if (
1720
1870
  (utils$1.isArray(value) && isFlatArray(value)) ||
1721
1871
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -1748,8 +1898,6 @@ function toFormData$1(obj, formData, options) {
1748
1898
  return false;
1749
1899
  }
1750
1900
 
1751
- const stack = [];
1752
-
1753
1901
  const exposedHelpers = Object.assign(predicates, {
1754
1902
  defaultVisitor,
1755
1903
  convertValue,
@@ -1759,15 +1907,10 @@ function toFormData$1(obj, formData, options) {
1759
1907
  function build(value, path, depth = 0) {
1760
1908
  if (utils$1.isUndefined(value)) return;
1761
1909
 
1762
- if (depth > maxDepth) {
1763
- throw new AxiosError$1(
1764
- 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1765
- AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1766
- );
1767
- }
1910
+ throwIfMaxDepthExceeded(depth);
1768
1911
 
1769
1912
  if (stack.indexOf(value) !== -1) {
1770
- throw Error('Circular reference detected in ' + path.join('.'));
1913
+ throw new Error('Circular reference detected in ' + path.join('.'));
1771
1914
  }
1772
1915
 
1773
1916
  stack.push(value);
@@ -1880,15 +2023,17 @@ function buildURL(url, params, options) {
1880
2023
  return url;
1881
2024
  }
1882
2025
 
1883
- const _encode = (options && options.encode) || encode;
1884
-
1885
2026
  const _options = utils$1.isFunction(options)
1886
2027
  ? {
1887
2028
  serialize: options,
1888
2029
  }
1889
2030
  : options;
1890
2031
 
1891
- const serializeFn = _options && _options.serialize;
2032
+ // Read serializer options pollution-safely: own properties and methods on a
2033
+ // class/template prototype are honored, but values injected onto a polluted
2034
+ // Object.prototype are ignored.
2035
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2036
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
1892
2037
 
1893
2038
  let serializedParams;
1894
2039
 
@@ -1984,6 +2129,8 @@ var transitionalDefaults = {
1984
2129
  forcedJSONParsing: true,
1985
2130
  clarifyTimeoutError: false,
1986
2131
  legacyInterceptorReqResOrdering: true,
2132
+ advertiseZstdAcceptEncoding: false,
2133
+ validateStatusUndefinedResolves: true,
1987
2134
  };
1988
2135
 
1989
2136
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2075,6 +2222,17 @@ function toURLEncodedForm(data, options) {
2075
2222
  });
2076
2223
  }
2077
2224
 
2225
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2226
+
2227
+ function throwIfDepthExceeded(index) {
2228
+ if (index > MAX_DEPTH) {
2229
+ throw new AxiosError$1(
2230
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
2231
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
2232
+ );
2233
+ }
2234
+ }
2235
+
2078
2236
  /**
2079
2237
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2080
2238
  *
@@ -2087,9 +2245,16 @@ function parsePropPath(name) {
2087
2245
  // foo.x.y.z
2088
2246
  // foo-x-y-z
2089
2247
  // foo x y z
2090
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2091
- return match[0] === '[]' ? '' : match[1] || match[0];
2092
- });
2248
+ const path = [];
2249
+ const pattern = /\w+|\[(\w*)]/g;
2250
+ let match;
2251
+
2252
+ while ((match = pattern.exec(name)) !== null) {
2253
+ throwIfDepthExceeded(path.length);
2254
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2255
+ }
2256
+
2257
+ return path;
2093
2258
  }
2094
2259
 
2095
2260
  /**
@@ -2121,6 +2286,8 @@ function arrayToObject(arr) {
2121
2286
  */
2122
2287
  function formDataToJSON(formData) {
2123
2288
  function buildPath(path, value, target, index) {
2289
+ throwIfDepthExceeded(index);
2290
+
2124
2291
  let name = path[index++];
2125
2292
 
2126
2293
  if (name === '__proto__') return true;
@@ -2141,7 +2308,7 @@ function formDataToJSON(formData) {
2141
2308
  return !isNumericKey;
2142
2309
  }
2143
2310
 
2144
- if (!target[name] || !utils$1.isObject(target[name])) {
2311
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
2145
2312
  target[name] = [];
2146
2313
  }
2147
2314
 
@@ -2506,6 +2673,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2506
2673
  const _speedometer = speedometer(50, 250);
2507
2674
 
2508
2675
  return throttle((e) => {
2676
+ if (!e || typeof e.loaded !== 'number') {
2677
+ return;
2678
+ }
2509
2679
  const rawLoaded = e.loaded;
2510
2680
  const total = e.lengthComputable ? e.total : undefined;
2511
2681
  const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -2654,6 +2824,31 @@ function combineURLs(baseURL, relativeURL) {
2654
2824
  : baseURL;
2655
2825
  }
2656
2826
 
2827
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
2828
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
2829
+
2830
+ function stripLeadingC0ControlOrSpace(url) {
2831
+ let i = 0;
2832
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
2833
+ i++;
2834
+ }
2835
+ return url.slice(i);
2836
+ }
2837
+
2838
+ function normalizeURLForProtocolCheck(url) {
2839
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
2840
+ }
2841
+
2842
+ function assertValidHttpProtocolURL(url, config) {
2843
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
2844
+ throw new AxiosError$1(
2845
+ 'Invalid URL: missing "//" after protocol',
2846
+ AxiosError$1.ERR_INVALID_URL,
2847
+ config
2848
+ );
2849
+ }
2850
+ }
2851
+
2657
2852
  /**
2658
2853
  * Creates a new URL by combining the baseURL with the requestedURL,
2659
2854
  * only when the requestedURL is not already an absolute URL.
@@ -2664,9 +2859,11 @@ function combineURLs(baseURL, relativeURL) {
2664
2859
  *
2665
2860
  * @returns {string} The combined full path
2666
2861
  */
2667
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2862
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2863
+ assertValidHttpProtocolURL(requestedURL, config);
2668
2864
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2669
2865
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2866
+ assertValidHttpProtocolURL(baseURL, config);
2670
2867
  return combineURLs(baseURL, requestedURL);
2671
2868
  }
2672
2869
  return requestedURL;
@@ -2737,6 +2934,28 @@ function mergeConfig$1(config1, config2) {
2737
2934
  }
2738
2935
  }
2739
2936
 
2937
+ function getMergedTransitionalOption(prop) {
2938
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
2939
+
2940
+ if (!utils$1.isUndefined(transitional2)) {
2941
+ if (utils$1.isPlainObject(transitional2)) {
2942
+ if (utils$1.hasOwnProp(transitional2, prop)) {
2943
+ return transitional2[prop];
2944
+ }
2945
+ } else {
2946
+ return undefined;
2947
+ }
2948
+ }
2949
+
2950
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
2951
+
2952
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2953
+ return transitional1[prop];
2954
+ }
2955
+
2956
+ return undefined;
2957
+ }
2958
+
2740
2959
  // eslint-disable-next-line consistent-return
2741
2960
  function mergeDirectKeys(a, b, prop) {
2742
2961
  if (utils$1.hasOwnProp(config2, prop)) {
@@ -2789,6 +3008,18 @@ function mergeConfig$1(config1, config2) {
2789
3008
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2790
3009
  });
2791
3010
 
3011
+ if (
3012
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
3013
+ utils$1.isUndefined(config2.validateStatus) &&
3014
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
3015
+ ) {
3016
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3017
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3018
+ } else {
3019
+ delete config.validateStatus;
3020
+ }
3021
+ }
3022
+
2792
3023
  return config;
2793
3024
  }
2794
3025
 
@@ -2815,12 +3046,12 @@ function setFormDataHeaders(headers, formHeaders, policy) {
2815
3046
  *
2816
3047
  * @returns {string} UTF-8 bytes as a Latin-1 string
2817
3048
  */
2818
- const encodeUTF8 = (str) =>
3049
+ const encodeUTF8$1 = (str) =>
2819
3050
  encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
2820
3051
  String.fromCharCode(parseInt(hex, 16))
2821
3052
  );
2822
3053
 
2823
- var resolveConfig = (config) => {
3054
+ function resolveConfig(config) {
2824
3055
  const newConfig = mergeConfig$1({}, config);
2825
3056
 
2826
3057
  // Read only own properties to prevent prototype pollution gadgets
@@ -2840,23 +3071,29 @@ var resolveConfig = (config) => {
2840
3071
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2841
3072
 
2842
3073
  newConfig.url = buildURL(
2843
- buildFullPath(baseURL, url, allowAbsoluteUrls),
2844
- config.params,
2845
- config.paramsSerializer
3074
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
3075
+ own('params'),
3076
+ own('paramsSerializer')
2846
3077
  );
2847
3078
 
2848
3079
  // HTTP basic authentication
2849
3080
  if (auth) {
3081
+ const username = utils$1.getSafeProp(auth, 'username') || '';
3082
+ const password = utils$1.getSafeProp(auth, 'password') || '';
3083
+
2850
3084
  headers.set(
2851
3085
  'Authorization',
2852
- 'Basic ' +
2853
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
3086
+ 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
2854
3087
  );
2855
3088
  }
2856
3089
 
2857
3090
  if (utils$1.isFormData(data)) {
2858
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2859
- headers.setContentType(undefined); // browser handles it
3091
+ if (
3092
+ platform.hasStandardBrowserEnv ||
3093
+ platform.hasStandardBrowserWebWorkerEnv ||
3094
+ utils$1.isReactNative(data)
3095
+ ) {
3096
+ headers.setContentType(undefined); // browser/web worker/RN handles it
2860
3097
  } else if (utils$1.isFunction(data.getHeaders)) {
2861
3098
  // Node.js FormData (like form-data package)
2862
3099
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -2888,7 +3125,7 @@ var resolveConfig = (config) => {
2888
3125
  }
2889
3126
 
2890
3127
  return newConfig;
2891
- };
3128
+ }
2892
3129
 
2893
3130
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2894
3131
 
@@ -3037,7 +3274,7 @@ var xhrAdapter = isXHRAdapterSupported &&
3037
3274
 
3038
3275
  // Add headers to the request
3039
3276
  if ('setRequestHeader' in request) {
3040
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3277
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3041
3278
  request.setRequestHeader(key, val);
3042
3279
  });
3043
3280
  }
@@ -3107,54 +3344,55 @@ var xhrAdapter = isXHRAdapterSupported &&
3107
3344
  };
3108
3345
 
3109
3346
  const composeSignals = (signals, timeout) => {
3110
- const { length } = (signals = signals ? signals.filter(Boolean) : []);
3111
-
3112
- if (timeout || length) {
3113
- let controller = new AbortController();
3114
-
3115
- let aborted;
3116
-
3117
- const onabort = function (reason) {
3118
- if (!aborted) {
3119
- aborted = true;
3120
- unsubscribe();
3121
- const err = reason instanceof Error ? reason : this.reason;
3122
- controller.abort(
3123
- err instanceof AxiosError$1
3124
- ? err
3125
- : new CanceledError$1(err instanceof Error ? err.message : err)
3126
- );
3127
- }
3128
- };
3347
+ signals = signals ? signals.filter(Boolean) : [];
3129
3348
 
3130
- let timer =
3131
- timeout &&
3132
- setTimeout(() => {
3133
- timer = null;
3134
- onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
3135
- }, timeout);
3136
-
3137
- const unsubscribe = () => {
3138
- if (signals) {
3139
- timer && clearTimeout(timer);
3140
- timer = null;
3141
- signals.forEach((signal) => {
3142
- signal.unsubscribe
3143
- ? signal.unsubscribe(onabort)
3144
- : signal.removeEventListener('abort', onabort);
3145
- });
3146
- signals = null;
3147
- }
3148
- };
3349
+ if (!timeout && !signals.length) {
3350
+ return;
3351
+ }
3149
3352
 
3150
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
3353
+ const controller = new AbortController();
3151
3354
 
3152
- const { signal } = controller;
3355
+ let aborted = false;
3153
3356
 
3154
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
3357
+ const onabort = function (reason) {
3358
+ if (!aborted) {
3359
+ aborted = true;
3360
+ unsubscribe();
3361
+ const err = reason instanceof Error ? reason : this.reason;
3362
+ controller.abort(
3363
+ err instanceof AxiosError$1
3364
+ ? err
3365
+ : new CanceledError$1(err instanceof Error ? err.message : err)
3366
+ );
3367
+ }
3368
+ };
3155
3369
 
3156
- return signal;
3157
- }
3370
+ let timer =
3371
+ timeout &&
3372
+ setTimeout(() => {
3373
+ timer = null;
3374
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
3375
+ }, timeout);
3376
+
3377
+ const unsubscribe = () => {
3378
+ if (!signals) { return; }
3379
+ timer && clearTimeout(timer);
3380
+ timer = null;
3381
+ signals.forEach((signal) => {
3382
+ signal.unsubscribe
3383
+ ? signal.unsubscribe(onabort)
3384
+ : signal.removeEventListener('abort', onabort);
3385
+ });
3386
+ signals = null;
3387
+ };
3388
+
3389
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
3390
+
3391
+ const { signal } = controller;
3392
+
3393
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
3394
+
3395
+ return signal;
3158
3396
  };
3159
3397
 
3160
3398
  const streamChunk = function* (chunk, chunkSize) {
@@ -3251,11 +3489,19 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3251
3489
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3252
3490
  * - For base64: compute exact decoded size using length and padding;
3253
3491
  * handle %XX at the character-count level (no string allocation).
3254
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3492
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
3255
3493
  *
3256
3494
  * @param {string} url
3257
3495
  * @returns {number}
3258
3496
  */
3497
+ const isHexDigit = (charCode) =>
3498
+ (charCode >= 48 && charCode <= 57) ||
3499
+ (charCode >= 65 && charCode <= 70) ||
3500
+ (charCode >= 97 && charCode <= 102);
3501
+
3502
+ const isPercentEncodedByte = (str, i, len) =>
3503
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3504
+
3259
3505
  function estimateDataURLDecodedBytes(url) {
3260
3506
  if (!url || typeof url !== 'string') return 0;
3261
3507
  if (!url.startsWith('data:')) return 0;
@@ -3275,9 +3521,7 @@ function estimateDataURLDecodedBytes(url) {
3275
3521
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3276
3522
  const a = body.charCodeAt(i + 1);
3277
3523
  const b = body.charCodeAt(i + 2);
3278
- const isHex =
3279
- ((a >= 48 && a <= 57) || (a >= 65 && a <= 70) || (a >= 97 && a <= 102)) &&
3280
- ((b >= 48 && b <= 57) || (b >= 65 && b <= 70) || (b >= 97 && b <= 102));
3524
+ const isHex = isHexDigit(a) && isHexDigit(b);
3281
3525
 
3282
3526
  if (isHex) {
3283
3527
  effectiveLen -= 2;
@@ -3318,18 +3562,17 @@ function estimateDataURLDecodedBytes(url) {
3318
3562
  return bytes > 0 ? bytes : 0;
3319
3563
  }
3320
3564
 
3321
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3322
- return Buffer.byteLength(body, 'utf8');
3323
- }
3324
-
3325
3565
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3326
3566
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3327
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3328
- // but 3 UTF-8 bytes).
3567
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3568
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3329
3569
  let bytes = 0;
3330
3570
  for (let i = 0, len = body.length; i < len; i++) {
3331
3571
  const c = body.charCodeAt(i);
3332
- if (c < 0x80) {
3572
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3573
+ bytes += 1;
3574
+ i += 2;
3575
+ } else if (c < 0x80) {
3333
3576
  bytes += 1;
3334
3577
  } else if (c < 0x800) {
3335
3578
  bytes += 2;
@@ -3348,12 +3591,41 @@ function estimateDataURLDecodedBytes(url) {
3348
3591
  return bytes;
3349
3592
  }
3350
3593
 
3351
- const VERSION$1 = "1.16.0";
3594
+ const VERSION$1 = "1.18.0";
3352
3595
 
3353
3596
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
3354
3597
 
3355
3598
  const { isFunction } = utils$1;
3356
3599
 
3600
+ /**
3601
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3602
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3603
+ *
3604
+ * @param {string} str The string to encode
3605
+ *
3606
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3607
+ */
3608
+ const encodeUTF8 = (str) =>
3609
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
3610
+ String.fromCharCode(parseInt(hex, 16))
3611
+ );
3612
+
3613
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
3614
+ // Decode before composing the `auth` option so credentials such as
3615
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
3616
+ // original value for malformed input so a bad encoding never throws.
3617
+ const decodeURIComponentSafe = (value) => {
3618
+ if (!utils$1.isString(value)) {
3619
+ return value;
3620
+ }
3621
+
3622
+ try {
3623
+ return decodeURIComponent(value);
3624
+ } catch (error) {
3625
+ return value;
3626
+ }
3627
+ };
3628
+
3357
3629
  const test = (fn, ...args) => {
3358
3630
  try {
3359
3631
  return !!fn(...args);
@@ -3362,8 +3634,20 @@ const test = (fn, ...args) => {
3362
3634
  }
3363
3635
  };
3364
3636
 
3637
+ const maybeWithAuthCredentials = (url) => {
3638
+ const protocolIndex = url.indexOf('://');
3639
+ let urlToCheck = url;
3640
+ if (protocolIndex !== -1) {
3641
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
3642
+ }
3643
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
3644
+ };
3645
+
3365
3646
  const factory = (env) => {
3366
- const globalObject = utils$1.global ?? globalThis;
3647
+ const globalObject =
3648
+ utils$1.global !== undefined && utils$1.global !== null
3649
+ ? utils$1.global
3650
+ : globalThis;
3367
3651
  const { ReadableStream, TextEncoder } = globalObject;
3368
3652
 
3369
3653
  env = utils$1.merge.call(
@@ -3506,6 +3790,7 @@ const factory = (env) => {
3506
3790
 
3507
3791
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3508
3792
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3793
+ const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
3509
3794
 
3510
3795
  let _fetch = envFetch || fetch;
3511
3796
 
@@ -3527,7 +3812,61 @@ const factory = (env) => {
3527
3812
 
3528
3813
  let requestContentLength;
3529
3814
 
3815
+ // AxiosError we raise while the request body is being streamed. Captured
3816
+ // by identity so the catch block can surface it directly, regardless of
3817
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
3818
+ // as `err.cause`; some browsers drop the original error entirely).
3819
+ let pendingBodyError = null;
3820
+
3821
+ const maxBodyLengthError = () =>
3822
+ new AxiosError$1(
3823
+ 'Request body larger than maxBodyLength limit',
3824
+ AxiosError$1.ERR_BAD_REQUEST,
3825
+ config,
3826
+ request
3827
+ );
3828
+
3530
3829
  try {
3830
+ // HTTP basic authentication
3831
+ let auth = undefined;
3832
+ const configAuth = own('auth');
3833
+
3834
+ if (configAuth) {
3835
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
3836
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
3837
+ auth = {
3838
+ username,
3839
+ password
3840
+ };
3841
+ }
3842
+
3843
+ if (maybeWithAuthCredentials(url)) {
3844
+ const parsedURL = new URL(url, platform.origin);
3845
+
3846
+ if (!auth && (parsedURL.username || parsedURL.password)) {
3847
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
3848
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
3849
+ auth = {
3850
+ username: urlUsername,
3851
+ password: urlPassword
3852
+ };
3853
+ }
3854
+
3855
+ if (parsedURL.username || parsedURL.password) {
3856
+ parsedURL.username = '';
3857
+ parsedURL.password = '';
3858
+ url = parsedURL.href;
3859
+ }
3860
+ }
3861
+
3862
+ if (auth) {
3863
+ headers.delete('authorization');
3864
+ headers.set(
3865
+ 'Authorization',
3866
+ 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
3867
+ );
3868
+ }
3869
+
3531
3870
  // Enforce maxContentLength for data: URLs up-front so we never materialize
3532
3871
  // an oversized payload. The HTTP adapter applies the same check (see http.js
3533
3872
  // "if (protocol === 'data:')" branch).
@@ -3543,53 +3882,96 @@ const factory = (env) => {
3543
3882
  }
3544
3883
  }
3545
3884
 
3546
- // Enforce maxBodyLength against the outbound request body before dispatch.
3547
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
3548
- // maxBodyLength limit'). Skip when the body length cannot be determined
3549
- // (e.g. a live ReadableStream supplied by the caller).
3885
+ // Enforce maxBodyLength against known-size bodies before dispatch using
3886
+ // the body's *actual* size never a caller-declared Content-Length,
3887
+ // which could under-report to slip an oversized body past the check.
3888
+ // Unknown-size streams return undefined here and are counted per-chunk
3889
+ // below as fetch consumes them.
3550
3890
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
3551
- const outboundLength = await resolveBodyLength(headers, data);
3552
- if (
3553
- typeof outboundLength === 'number' &&
3554
- isFinite(outboundLength) &&
3555
- outboundLength > maxBodyLength
3556
- ) {
3557
- throw new AxiosError$1(
3558
- 'Request body larger than maxBodyLength limit',
3559
- AxiosError$1.ERR_BAD_REQUEST,
3560
- config,
3561
- request
3562
- );
3891
+ const outboundLength = await getBodyLength(data);
3892
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
3893
+ requestContentLength = outboundLength;
3894
+ if (outboundLength > maxBodyLength) {
3895
+ throw maxBodyLengthError();
3896
+ }
3563
3897
  }
3564
3898
  }
3565
3899
 
3900
+ // A streamed body under maxBodyLength must be counted as fetch consumes
3901
+ // it; its size is never trusted from a caller-declared Content-Length.
3902
+ const mustEnforceStreamBody =
3903
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
3904
+
3905
+ const trackRequestStream = (stream, onProgress, flush) =>
3906
+ trackStream(
3907
+ stream,
3908
+ DEFAULT_CHUNK_SIZE,
3909
+ (loadedBytes) => {
3910
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
3911
+ throw (pendingBodyError = maxBodyLengthError());
3912
+ }
3913
+ onProgress && onProgress(loadedBytes);
3914
+ },
3915
+ flush
3916
+ );
3917
+
3566
3918
  if (
3567
- onUploadProgress &&
3568
3919
  supportsRequestStream &&
3569
3920
  method !== 'get' &&
3570
3921
  method !== 'head' &&
3571
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3922
+ (onUploadProgress || mustEnforceStreamBody)
3572
3923
  ) {
3573
- let _request = new Request(url, {
3574
- method: 'POST',
3575
- body: data,
3576
- duplex: 'half',
3577
- });
3924
+ requestContentLength =
3925
+ requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
3926
+
3927
+ // A declared length of 0 is only trusted to skip the wrap when we are
3928
+ // not enforcing a stream limit (which must not rely on that header).
3929
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
3930
+ let _request = new Request(url, {
3931
+ method: 'POST',
3932
+ body: data,
3933
+ duplex: 'half',
3934
+ });
3578
3935
 
3579
- let contentTypeHeader;
3936
+ let contentTypeHeader;
3580
3937
 
3581
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3582
- headers.setContentType(contentTypeHeader);
3583
- }
3938
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3939
+ headers.setContentType(contentTypeHeader);
3940
+ }
3584
3941
 
3585
- if (_request.body) {
3586
- const [onProgress, flush] = progressEventDecorator(
3587
- requestContentLength,
3588
- progressEventReducer(asyncDecorator(onUploadProgress))
3589
- );
3942
+ if (_request.body) {
3943
+ const [onProgress, flush] =
3944
+ (onUploadProgress &&
3945
+ progressEventDecorator(
3946
+ requestContentLength,
3947
+ progressEventReducer(asyncDecorator(onUploadProgress))
3948
+ )) ||
3949
+ [];
3590
3950
 
3591
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3951
+ data = trackRequestStream(_request.body, onProgress, flush);
3952
+ }
3592
3953
  }
3954
+ } else if (
3955
+ mustEnforceStreamBody &&
3956
+ !isRequestSupported &&
3957
+ isReadableStreamSupported &&
3958
+ method !== 'get' &&
3959
+ method !== 'head'
3960
+ ) {
3961
+ data = trackRequestStream(data);
3962
+ } else if (
3963
+ mustEnforceStreamBody &&
3964
+ isRequestSupported &&
3965
+ !supportsRequestStream &&
3966
+ method !== 'get' &&
3967
+ method !== 'head'
3968
+ ) {
3969
+ throw new AxiosError$1(
3970
+ 'Stream request bodies are not supported by the current fetch implementation',
3971
+ AxiosError$1.ERR_NOT_SUPPORT,
3972
+ config,
3973
+ request
3974
+ );
3593
3975
  }
3594
3976
 
3595
3977
  if (!utils$1.isString(withCredentials)) {
@@ -3620,7 +4002,7 @@ const factory = (env) => {
3620
4002
  ...fetchOptions,
3621
4003
  signal: composedSignal,
3622
4004
  method: method.toUpperCase(),
3623
- headers: headers.normalize().toJSON(),
4005
+ headers: toByteStringHeaderObject(headers.normalize()),
3624
4006
  body: data,
3625
4007
  duplex: 'half',
3626
4008
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -3632,10 +4014,12 @@ const factory = (env) => {
3632
4014
  ? _fetch(request, fetchOptions)
3633
4015
  : _fetch(url, resolvedOptions));
3634
4016
 
4017
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
4018
+
3635
4019
  // Cheap pre-check: if the server honestly declares a content-length that
3636
4020
  // already exceeds the cap, reject before we start streaming.
3637
4021
  if (hasMaxContentLength) {
3638
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4022
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3639
4023
  if (declaredLength != null && declaredLength > maxContentLength) {
3640
4024
  throw new AxiosError$1(
3641
4025
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -3660,7 +4044,7 @@ const factory = (env) => {
3660
4044
  options[prop] = response[prop];
3661
4045
  });
3662
4046
 
3663
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4047
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3664
4048
 
3665
4049
  const [onProgress, flush] =
3666
4050
  (onDownloadProgress &&
@@ -3755,6 +4139,23 @@ const factory = (env) => {
3755
4139
  throw canceledError;
3756
4140
  }
3757
4141
 
4142
+ // Surface a maxBodyLength violation we raised while the request body was
4143
+ // being streamed. Matching by identity (rather than reading
4144
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
4145
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
4146
+ // AxiosError that merely happened to land in `err.cause`.
4147
+ if (pendingBodyError) {
4148
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
4149
+ throw pendingBodyError;
4150
+ }
4151
+
4152
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
4153
+ // pre-checks, response size enforcement) without re-wrapping them.
4154
+ if (err instanceof AxiosError$1) {
4155
+ request && !err.request && (err.request = request);
4156
+ throw err;
4157
+ }
4158
+
3758
4159
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3759
4160
  throw Object.assign(
3760
4161
  new AxiosError$1(
@@ -4209,6 +4610,8 @@ let Axios$1 = class Axios {
4209
4610
  forcedJSONParsing: validators.transitional(validators.boolean),
4210
4611
  clarifyTimeoutError: validators.transitional(validators.boolean),
4211
4612
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4613
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
4614
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
4212
4615
  },
4213
4616
  false
4214
4617
  );
@@ -4338,7 +4741,7 @@ let Axios$1 = class Axios {
4338
4741
 
4339
4742
  getUri(config) {
4340
4743
  config = mergeConfig$1(this.defaults, config);
4341
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4744
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4342
4745
  return buildURL(fullPath, config.params, config.paramsSerializer);
4343
4746
  }
4344
4747
  };
@@ -4351,7 +4754,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
4351
4754
  mergeConfig$1(config || {}, {
4352
4755
  method,
4353
4756
  url,
4354
- data: (config || {}).data,
4757
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
4355
4758
  })
4356
4759
  );
4357
4760
  };