@openclaw/slack 2026.6.11-beta.2 → 2026.6.33

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