@openclaw/slack 2026.7.2-beta.2 → 2026.7.2-beta.4

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 (161) hide show
  1. package/dist/{account-configured-DzC407uv.js → account-configured-BwfXBo_F.js} +1 -1
  2. package/dist/account-inspect-api.js +1 -1
  3. package/dist/{account-inspect-Di7ditqZ.js → account-inspect-jn1xLaVi.js} +9 -2
  4. package/dist/account-reply-mode-DrUXogvO.js +14 -0
  5. package/dist/{accounts-BOJJiHSr.js → accounts-BSr252c_.js} +13 -25
  6. package/dist/accounts.runtime-CjULMLTa.js +2 -0
  7. package/dist/{action-runtime-Cee2ih0s.js → action-runtime-CFU52n4W.js} +11 -17
  8. package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
  9. package/dist/{actions-BZiuSTIq.js → actions-D51foiwR.js} +5 -5
  10. package/dist/{actions.runtime-DoD0-gxw.js → actions.runtime-BMJwtf5C.js} +1 -1
  11. package/dist/api.js +15 -15
  12. package/dist/{approval-handler.runtime-CUPtIM4k.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
  13. package/dist/{channel-DaIiGUOp.js → channel-Ds8NKvfr.js} +75 -41
  14. package/dist/channel-config-api.js +1 -1
  15. package/dist/channel-plugin-api.js +1 -1
  16. package/dist/{channel-type-Cfm6_6n1.js → channel-type-DXkUajFP.js} +3 -3
  17. package/dist/{channel.setup-C-mLz50O.js → channel.setup-DOSTEDfA.js} +8 -5
  18. package/dist/{config-schema-xPSnK2VK.js → config-schema-B4j4tCOI.js} +236 -30
  19. package/dist/{directory-config-DRkFujwG.js → directory-config-B08pm5ZT.js} +1 -1
  20. package/dist/directory-contract-api.js +1 -1
  21. package/dist/{directory-live-D_yZhjgp.js → directory-live-DpPKzPrn.js} +2 -2
  22. package/dist/doctor-contract-U6oVntbM.js +173 -0
  23. package/dist/doctor-contract-api.js +1 -1
  24. package/dist/{group-policy-85UWiriS.js → group-policy-CdnQzQBI.js} +98 -125
  25. package/dist/{interactive-replies-BilWUdcI.js → interactive-replies-C3ffk6oN.js} +1 -1
  26. package/dist/interactive-replies-api.js +1 -1
  27. package/dist/{message-tool-api-CA9jZrCY.js → message-tool-api-ByVyIVOh.js} +3 -3
  28. package/dist/message-tool-api.js +1 -1
  29. package/dist/{monitor-CalGciTs.js → monitor-CnB_WKvF.js} +3 -3
  30. package/dist/{outbound-adapter-BiLKcnyH.js → outbound-adapter-DuPz2HHt.js} +49 -5
  31. package/dist/{pipeline.runtime-DofAvTtb.js → pipeline.runtime-5rRYZuX5.js} +490 -345
  32. package/dist/{policy-BVs4LiSa.js → policy-C31RYSuT.js} +1 -1
  33. package/dist/probe-CVRuArHA.js +340 -0
  34. package/dist/{provider-CmeoUiIM.js → provider-htuIJGFD.js} +791 -359
  35. package/dist/{relay-source-DMmgtvg4.js → relay-source-Df9EaiTF.js} +6 -11
  36. package/dist/{replies-CJJCp6qz.js → replies-Cgr2Gli4.js} +3 -3
  37. package/dist/{resolve-channels-Rfts6POK.js → resolve-channels-DodP2TFx.js} +1 -1
  38. package/dist/{resolve-users-y6wAxR8E.js → resolve-users-M9eF8891.js} +1 -1
  39. package/dist/{runtime-api-BGDyOt1D.js → runtime-api-D5XYMMsf.js} +3 -2
  40. package/dist/runtime-api.js +11 -11
  41. package/dist/{scopes-CuxNQZ6v.js → scopes-CJRpHkDC.js} +1 -2
  42. package/dist/{secret-contract-CMohXFWS.js → secret-contract-DxmvbxBF.js} +1 -0
  43. package/dist/secret-contract-api.js +1 -1
  44. package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
  45. package/dist/security-contract-api.js +1 -1
  46. package/dist/{send-DYp8ca-l.js → send-BZ1tPv7-.js} +28 -11
  47. package/dist/send.runtime-a2pilFor.js +2 -0
  48. package/dist/setup-core-tPxMuFez.js +600 -0
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/dist/{setup-surface-oSd3NX9J.js → setup-surface-wV-S1dE_.js} +58 -32
  51. package/dist/{shared-D9yz5Otg.js → shared-BfMskaMx.js} +57 -10
  52. package/dist/{slash-dispatch.runtime-CSja9VuD.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
  53. package/node_modules/@types/node/README.md +1 -1
  54. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  55. package/node_modules/@types/node/package.json +2 -2
  56. package/node_modules/agent-base/README.md +145 -0
  57. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  58. package/node_modules/agent-base/dist/src/index.js +203 -0
  59. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  60. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  61. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  62. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  63. package/node_modules/agent-base/package.json +64 -0
  64. package/node_modules/agent-base/src/index.ts +345 -0
  65. package/node_modules/agent-base/src/promisify.ts +33 -0
  66. package/node_modules/axios/CHANGELOG.md +197 -1
  67. package/node_modules/axios/README.md +424 -256
  68. package/node_modules/axios/dist/axios.js +589 -204
  69. package/node_modules/axios/dist/axios.min.js +3 -3
  70. package/node_modules/axios/dist/axios.min.js.map +1 -1
  71. package/node_modules/axios/dist/browser/axios.cjs +630 -185
  72. package/node_modules/axios/dist/esm/axios.js +630 -185
  73. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  74. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  75. package/node_modules/axios/dist/node/axios.cjs +949 -301
  76. package/node_modules/axios/index.d.cts +28 -5
  77. package/node_modules/axios/index.d.ts +24 -3
  78. package/node_modules/axios/lib/adapters/adapters.js +1 -1
  79. package/node_modules/axios/lib/adapters/fetch.js +223 -49
  80. package/node_modules/axios/lib/adapters/http.js +408 -193
  81. package/node_modules/axios/lib/adapters/xhr.js +3 -1
  82. package/node_modules/axios/lib/core/Axios.js +4 -2
  83. package/node_modules/axios/lib/core/AxiosError.js +13 -1
  84. package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
  85. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  86. package/node_modules/axios/lib/core/mergeConfig.js +35 -0
  87. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  88. package/node_modules/axios/lib/env/data.js +1 -1
  89. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
  90. package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
  91. package/node_modules/axios/lib/helpers/buildURL.js +7 -4
  92. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  93. package/node_modules/axios/lib/helpers/cookies.js +5 -1
  94. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  95. package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
  96. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
  97. package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
  98. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  99. package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
  100. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  101. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  102. package/node_modules/axios/lib/helpers/toFormData.js +48 -12
  103. package/node_modules/axios/lib/helpers/validator.js +1 -1
  104. package/node_modules/axios/lib/utils.js +105 -19
  105. package/node_modules/axios/package.json +31 -13
  106. package/node_modules/https-proxy-agent/README.md +137 -0
  107. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  108. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  109. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  110. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  111. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  112. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  113. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  114. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  115. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  116. package/node_modules/https-proxy-agent/package.json +56 -0
  117. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  118. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  119. package/node_modules/iconv-lite/package.json +2 -2
  120. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  121. package/node_modules/path-to-regexp/Readme.md +3 -3
  122. package/node_modules/path-to-regexp/dist/index.js +135 -158
  123. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  124. package/node_modules/path-to-regexp/package.json +2 -2
  125. package/node_modules/qs/CHANGELOG.md +11 -0
  126. package/node_modules/qs/dist/qs.js +17 -17
  127. package/node_modules/qs/lib/parse.js +19 -8
  128. package/node_modules/qs/lib/utils.js +47 -8
  129. package/node_modules/qs/package.json +6 -5
  130. package/node_modules/qs/test/parse.js +230 -0
  131. package/node_modules/qs/test/utils.js +194 -0
  132. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  133. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  134. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  135. package/node_modules/typebox/build/guard/string.mjs +16 -4
  136. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  137. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  138. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  139. package/node_modules/typebox/build/typebox.d.mts +1 -1
  140. package/node_modules/typebox/build/typebox.mjs +1 -1
  141. package/node_modules/typebox/package.json +1 -1
  142. package/node_modules/typebox/readme.md +29 -32
  143. package/node_modules/ws/lib/receiver.js +15 -32
  144. package/node_modules/ws/lib/websocket-server.js +4 -4
  145. package/node_modules/ws/lib/websocket.js +4 -4
  146. package/node_modules/ws/package.json +5 -1
  147. package/npm-shrinkwrap.json +54 -27
  148. package/openclaw.plugin.json +1331 -1424
  149. package/package.json +92 -14
  150. package/dist/accounts.runtime-KvftRRek.js +0 -2
  151. package/dist/action-runtime.runtime-DZfd7IFr.js +0 -2
  152. package/dist/client-WIPAS3Yr.js +0 -160
  153. package/dist/config-api-Df9a1B8C.js +0 -3
  154. package/dist/doctor-contract-DddfkMlF.js +0 -134
  155. package/dist/probe-CN0ssfLN.js +0 -48
  156. package/dist/send.runtime-CJLxAt26.js +0 -2
  157. package/dist/setup-core-CkwVLzFO.js +0 -337
  158. package/node_modules/axios/dist/axios.js.map +0 -1
  159. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  160. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  161. 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.1 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, ''));
1042
1134
  }
1043
1135
 
1044
- function sanitizeHeaderValue(str) {
1045
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
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;
1150
+ }
1151
+
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);
@@ -1452,7 +1565,19 @@ function redactConfig(config, redactKeys) {
1452
1565
  let AxiosError$1 = class AxiosError extends Error {
1453
1566
  static from(error, code, config, request, response, customProps) {
1454
1567
  const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1455
- axiosError.cause = error;
1568
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
1569
+ // error often carries circular internals (sockets, requests, agents), so
1570
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
1571
+ // own-property walk throw "Converting circular structure to JSON".
1572
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
1573
+ // `message` descriptor below (prototype-pollution-safe descriptor).
1574
+ Object.defineProperty(axiosError, 'cause', {
1575
+ __proto__: null,
1576
+ value: error,
1577
+ writable: true,
1578
+ enumerable: false,
1579
+ configurable: true,
1580
+ });
1456
1581
  axiosError.name = error.name;
1457
1582
 
1458
1583
  // Preserve status from the original error if not already set from response
@@ -1553,6 +1678,10 @@ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1553
1678
  // eslint-disable-next-line strict
1554
1679
  var httpAdapter = null;
1555
1680
 
1681
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
1682
+ // the FormData <-> JSON round-trip stays symmetric.
1683
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1684
+
1556
1685
  /**
1557
1686
  * Determines if the given thing is a array or js object.
1558
1687
  *
@@ -1663,8 +1792,9 @@ function toFormData$1(obj, formData, options) {
1663
1792
  const dots = options.dots;
1664
1793
  const indexes = options.indexes;
1665
1794
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1666
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1795
+ const maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
1667
1796
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1797
+ const stack = [];
1668
1798
 
1669
1799
  if (!utils$1.isFunction(visitor)) {
1670
1800
  throw new TypeError('visitor must be a function');
@@ -1686,12 +1816,50 @@ function toFormData$1(obj, formData, options) {
1686
1816
  }
1687
1817
 
1688
1818
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1689
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1819
+ if (useBlob && typeof _Blob === 'function') {
1820
+ return new _Blob([value]);
1821
+ }
1822
+ if (typeof Buffer !== 'undefined') {
1823
+ return Buffer.from(value);
1824
+ }
1825
+ throw new AxiosError$1('Blob is not supported. Use a Buffer instead.', AxiosError$1.ERR_NOT_SUPPORT);
1690
1826
  }
1691
1827
 
1692
1828
  return value;
1693
1829
  }
1694
1830
 
1831
+ function throwIfMaxDepthExceeded(depth) {
1832
+ if (depth > maxDepth) {
1833
+ throw new AxiosError$1(
1834
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1835
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1836
+ );
1837
+ }
1838
+ }
1839
+
1840
+ function stringifyWithDepthLimit(value, depth) {
1841
+ if (maxDepth === Infinity) {
1842
+ return JSON.stringify(value);
1843
+ }
1844
+
1845
+ const ancestors = [];
1846
+
1847
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1848
+ if (!utils$1.isObject(currentValue)) {
1849
+ return currentValue;
1850
+ }
1851
+
1852
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1853
+ ancestors.pop();
1854
+ }
1855
+
1856
+ ancestors.push(currentValue);
1857
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1858
+
1859
+ return currentValue;
1860
+ });
1861
+ }
1862
+
1695
1863
  /**
1696
1864
  * Default visitor.
1697
1865
  *
@@ -1715,7 +1883,7 @@ function toFormData$1(obj, formData, options) {
1715
1883
  // eslint-disable-next-line no-param-reassign
1716
1884
  key = metaTokens ? key : key.slice(0, -2);
1717
1885
  // eslint-disable-next-line no-param-reassign
1718
- value = JSON.stringify(value);
1886
+ value = stringifyWithDepthLimit(value, 1);
1719
1887
  } else if (
1720
1888
  (utils$1.isArray(value) && isFlatArray(value)) ||
1721
1889
  ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)))
@@ -1748,8 +1916,6 @@ function toFormData$1(obj, formData, options) {
1748
1916
  return false;
1749
1917
  }
1750
1918
 
1751
- const stack = [];
1752
-
1753
1919
  const exposedHelpers = Object.assign(predicates, {
1754
1920
  defaultVisitor,
1755
1921
  convertValue,
@@ -1759,15 +1925,10 @@ function toFormData$1(obj, formData, options) {
1759
1925
  function build(value, path, depth = 0) {
1760
1926
  if (utils$1.isUndefined(value)) return;
1761
1927
 
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
- }
1928
+ throwIfMaxDepthExceeded(depth);
1768
1929
 
1769
1930
  if (stack.indexOf(value) !== -1) {
1770
- throw Error('Circular reference detected in ' + path.join('.'));
1931
+ throw new Error('Circular reference detected in ' + path.join('.'));
1771
1932
  }
1772
1933
 
1773
1934
  stack.push(value);
@@ -1838,9 +1999,7 @@ prototype.append = function append(name, value) {
1838
1999
 
1839
2000
  prototype.toString = function toString(encoder) {
1840
2001
  const _encode = encoder
1841
- ? function (value) {
1842
- return encoder.call(this, value, encode$1);
1843
- }
2002
+ ? (value) => encoder.call(this, value, encode$1)
1844
2003
  : encode$1;
1845
2004
 
1846
2005
  return this._pairs
@@ -1879,8 +2038,7 @@ function buildURL(url, params, options) {
1879
2038
  if (!params) {
1880
2039
  return url;
1881
2040
  }
1882
-
1883
- const _encode = (options && options.encode) || encode;
2041
+ url = url || '';
1884
2042
 
1885
2043
  const _options = utils$1.isFunction(options)
1886
2044
  ? {
@@ -1888,7 +2046,11 @@ function buildURL(url, params, options) {
1888
2046
  }
1889
2047
  : options;
1890
2048
 
1891
- const serializeFn = _options && _options.serialize;
2049
+ // Read serializer options pollution-safely: own properties and methods on a
2050
+ // class/template prototype are honored, but values injected onto a polluted
2051
+ // Object.prototype are ignored.
2052
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2053
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
1892
2054
 
1893
2055
  let serializedParams;
1894
2056
 
@@ -1984,6 +2146,8 @@ var transitionalDefaults = {
1984
2146
  forcedJSONParsing: true,
1985
2147
  clarifyTimeoutError: false,
1986
2148
  legacyInterceptorReqResOrdering: true,
2149
+ advertiseZstdAcceptEncoding: false,
2150
+ validateStatusUndefinedResolves: true,
1987
2151
  };
1988
2152
 
1989
2153
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2075,6 +2239,17 @@ function toURLEncodedForm(data, options) {
2075
2239
  });
2076
2240
  }
2077
2241
 
2242
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2243
+
2244
+ function throwIfDepthExceeded(index) {
2245
+ if (index > MAX_DEPTH) {
2246
+ throw new AxiosError$1(
2247
+ 'FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH,
2248
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
2249
+ );
2250
+ }
2251
+ }
2252
+
2078
2253
  /**
2079
2254
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2080
2255
  *
@@ -2087,9 +2262,16 @@ function parsePropPath(name) {
2087
2262
  // foo.x.y.z
2088
2263
  // foo-x-y-z
2089
2264
  // foo x y z
2090
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
2091
- return match[0] === '[]' ? '' : match[1] || match[0];
2092
- });
2265
+ const path = [];
2266
+ const pattern = /\w+|\[(\w*)]/g;
2267
+ let match;
2268
+
2269
+ while ((match = pattern.exec(name)) !== null) {
2270
+ throwIfDepthExceeded(path.length);
2271
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2272
+ }
2273
+
2274
+ return path;
2093
2275
  }
2094
2276
 
2095
2277
  /**
@@ -2121,6 +2303,8 @@ function arrayToObject(arr) {
2121
2303
  */
2122
2304
  function formDataToJSON(formData) {
2123
2305
  function buildPath(path, value, target, index) {
2306
+ throwIfDepthExceeded(index);
2307
+
2124
2308
  let name = path[index++];
2125
2309
 
2126
2310
  if (name === '__proto__') return true;
@@ -2141,7 +2325,7 @@ function formDataToJSON(formData) {
2141
2325
  return !isNumericKey;
2142
2326
  }
2143
2327
 
2144
- if (!target[name] || !utils$1.isObject(target[name])) {
2328
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
2145
2329
  target[name] = [];
2146
2330
  }
2147
2331
 
@@ -2506,6 +2690,9 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2506
2690
  const _speedometer = speedometer(50, 250);
2507
2691
 
2508
2692
  return throttle((e) => {
2693
+ if (!e || typeof e.loaded !== 'number') {
2694
+ return;
2695
+ }
2509
2696
  const rawLoaded = e.loaded;
2510
2697
  const total = e.lengthComputable ? e.total : undefined;
2511
2698
  const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -2603,7 +2790,11 @@ var cookies = platform.hasStandardBrowserEnv
2603
2790
  const cookie = cookies[i].replace(/^\s+/, '');
2604
2791
  const eq = cookie.indexOf('=');
2605
2792
  if (eq !== -1 && cookie.slice(0, eq) === name) {
2606
- return decodeURIComponent(cookie.slice(eq + 1));
2793
+ try {
2794
+ return decodeURIComponent(cookie.slice(eq + 1));
2795
+ } catch (e) {
2796
+ return cookie.slice(eq + 1);
2797
+ }
2607
2798
  }
2608
2799
  }
2609
2800
  return null;
@@ -2654,6 +2845,31 @@ function combineURLs(baseURL, relativeURL) {
2654
2845
  : baseURL;
2655
2846
  }
2656
2847
 
2848
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
2849
+ const httpProtocolControlCharacters = /[\t\n\r]/g;
2850
+
2851
+ function stripLeadingC0ControlOrSpace(url) {
2852
+ let i = 0;
2853
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
2854
+ i++;
2855
+ }
2856
+ return url.slice(i);
2857
+ }
2858
+
2859
+ function normalizeURLForProtocolCheck(url) {
2860
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
2861
+ }
2862
+
2863
+ function assertValidHttpProtocolURL(url, config) {
2864
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
2865
+ throw new AxiosError$1(
2866
+ 'Invalid URL: missing "//" after protocol',
2867
+ AxiosError$1.ERR_INVALID_URL,
2868
+ config
2869
+ );
2870
+ }
2871
+ }
2872
+
2657
2873
  /**
2658
2874
  * Creates a new URL by combining the baseURL with the requestedURL,
2659
2875
  * only when the requestedURL is not already an absolute URL.
@@ -2664,9 +2880,11 @@ function combineURLs(baseURL, relativeURL) {
2664
2880
  *
2665
2881
  * @returns {string} The combined full path
2666
2882
  */
2667
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2883
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2884
+ assertValidHttpProtocolURL(requestedURL, config);
2668
2885
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2669
2886
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2887
+ assertValidHttpProtocolURL(baseURL, config);
2670
2888
  return combineURLs(baseURL, requestedURL);
2671
2889
  }
2672
2890
  return requestedURL;
@@ -2685,6 +2903,7 @@ const headersToObject = (thing) => (thing instanceof AxiosHeaders$1 ? { ...thing
2685
2903
  */
2686
2904
  function mergeConfig$1(config1, config2) {
2687
2905
  // eslint-disable-next-line no-param-reassign
2906
+ config1 = config1 || {};
2688
2907
  config2 = config2 || {};
2689
2908
 
2690
2909
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -2737,6 +2956,28 @@ function mergeConfig$1(config1, config2) {
2737
2956
  }
2738
2957
  }
2739
2958
 
2959
+ function getMergedTransitionalOption(prop) {
2960
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
2961
+
2962
+ if (!utils$1.isUndefined(transitional2)) {
2963
+ if (utils$1.isPlainObject(transitional2)) {
2964
+ if (utils$1.hasOwnProp(transitional2, prop)) {
2965
+ return transitional2[prop];
2966
+ }
2967
+ } else {
2968
+ return undefined;
2969
+ }
2970
+ }
2971
+
2972
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
2973
+
2974
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
2975
+ return transitional1[prop];
2976
+ }
2977
+
2978
+ return undefined;
2979
+ }
2980
+
2740
2981
  // eslint-disable-next-line consistent-return
2741
2982
  function mergeDirectKeys(a, b, prop) {
2742
2983
  if (utils$1.hasOwnProp(config2, prop)) {
@@ -2789,6 +3030,18 @@ function mergeConfig$1(config1, config2) {
2789
3030
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2790
3031
  });
2791
3032
 
3033
+ if (
3034
+ utils$1.hasOwnProp(config2, 'validateStatus') &&
3035
+ utils$1.isUndefined(config2.validateStatus) &&
3036
+ getMergedTransitionalOption('validateStatusUndefinedResolves') === false
3037
+ ) {
3038
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3039
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3040
+ } else {
3041
+ delete config.validateStatus;
3042
+ }
3043
+ }
3044
+
2792
3045
  return config;
2793
3046
  }
2794
3047
 
@@ -2800,7 +3053,7 @@ function setFormDataHeaders(headers, formHeaders, policy) {
2800
3053
  return;
2801
3054
  }
2802
3055
 
2803
- Object.entries(formHeaders).forEach(([key, val]) => {
3056
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
2804
3057
  if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2805
3058
  headers.set(key, val);
2806
3059
  }
@@ -2815,12 +3068,12 @@ function setFormDataHeaders(headers, formHeaders, policy) {
2815
3068
  *
2816
3069
  * @returns {string} UTF-8 bytes as a Latin-1 string
2817
3070
  */
2818
- const encodeUTF8 = (str) =>
3071
+ const encodeUTF8$1 = (str) =>
2819
3072
  encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
2820
3073
  String.fromCharCode(parseInt(hex, 16))
2821
3074
  );
2822
3075
 
2823
- var resolveConfig = (config) => {
3076
+ function resolveConfig(config) {
2824
3077
  const newConfig = mergeConfig$1({}, config);
2825
3078
 
2826
3079
  // Read only own properties to prevent prototype pollution gadgets
@@ -2840,23 +3093,33 @@ var resolveConfig = (config) => {
2840
3093
  newConfig.headers = headers = AxiosHeaders$1.from(headers);
2841
3094
 
2842
3095
  newConfig.url = buildURL(
2843
- buildFullPath(baseURL, url, allowAbsoluteUrls),
2844
- config.params,
2845
- config.paramsSerializer
3096
+ buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig),
3097
+ own('params'),
3098
+ own('paramsSerializer')
2846
3099
  );
2847
3100
 
2848
3101
  // HTTP basic authentication
2849
3102
  if (auth) {
2850
- headers.set(
2851
- 'Authorization',
2852
- 'Basic ' +
2853
- btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : ''))
2854
- );
3103
+ const username = utils$1.getSafeProp(auth, 'username') || '';
3104
+ const password = utils$1.getSafeProp(auth, 'password') || '';
3105
+
3106
+ try {
3107
+ headers.set(
3108
+ 'Authorization',
3109
+ 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : ''))
3110
+ );
3111
+ } catch (e) {
3112
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_OPTION_VALUE, config);
3113
+ }
2855
3114
  }
2856
3115
 
2857
3116
  if (utils$1.isFormData(data)) {
2858
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
2859
- headers.setContentType(undefined); // browser handles it
3117
+ if (
3118
+ platform.hasStandardBrowserEnv ||
3119
+ platform.hasStandardBrowserWebWorkerEnv ||
3120
+ utils$1.isReactNative(data)
3121
+ ) {
3122
+ headers.setContentType(undefined); // browser/web worker/RN handles it
2860
3123
  } else if (utils$1.isFunction(data.getHeaders)) {
2861
3124
  // Node.js FormData (like form-data package)
2862
3125
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -2888,7 +3151,7 @@ var resolveConfig = (config) => {
2888
3151
  }
2889
3152
 
2890
3153
  return newConfig;
2891
- };
3154
+ }
2892
3155
 
2893
3156
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2894
3157
 
@@ -3037,7 +3300,7 @@ var xhrAdapter = isXHRAdapterSupported &&
3037
3300
 
3038
3301
  // Add headers to the request
3039
3302
  if ('setRequestHeader' in request) {
3040
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3303
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3041
3304
  request.setRequestHeader(key, val);
3042
3305
  });
3043
3306
  }
@@ -3098,6 +3361,7 @@ var xhrAdapter = isXHRAdapterSupported &&
3098
3361
  config
3099
3362
  )
3100
3363
  );
3364
+ done();
3101
3365
  return;
3102
3366
  }
3103
3367
 
@@ -3107,54 +3371,55 @@ var xhrAdapter = isXHRAdapterSupported &&
3107
3371
  };
3108
3372
 
3109
3373
  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
- };
3374
+ signals = signals ? signals.filter(Boolean) : [];
3129
3375
 
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
- };
3376
+ if (!timeout && !signals.length) {
3377
+ return;
3378
+ }
3149
3379
 
3150
- signals.forEach((signal) => signal.addEventListener('abort', onabort));
3380
+ const controller = new AbortController();
3151
3381
 
3152
- const { signal } = controller;
3382
+ let aborted = false;
3153
3383
 
3154
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
3384
+ const onabort = function (reason) {
3385
+ if (!aborted) {
3386
+ aborted = true;
3387
+ unsubscribe();
3388
+ const err = reason instanceof Error ? reason : this.reason;
3389
+ controller.abort(
3390
+ err instanceof AxiosError$1
3391
+ ? err
3392
+ : new CanceledError$1(err instanceof Error ? err.message : err)
3393
+ );
3394
+ }
3395
+ };
3155
3396
 
3156
- return signal;
3157
- }
3397
+ let timer =
3398
+ timeout &&
3399
+ setTimeout(() => {
3400
+ timer = null;
3401
+ onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
3402
+ }, timeout);
3403
+
3404
+ const unsubscribe = () => {
3405
+ if (!signals) { return; }
3406
+ timer && clearTimeout(timer);
3407
+ timer = null;
3408
+ signals.forEach((signal) => {
3409
+ signal.unsubscribe
3410
+ ? signal.unsubscribe(onabort)
3411
+ : signal.removeEventListener('abort', onabort);
3412
+ });
3413
+ signals = null;
3414
+ };
3415
+
3416
+ signals.forEach((signal) => signal.addEventListener('abort', onabort, { once: true }));
3417
+
3418
+ const { signal } = controller;
3419
+
3420
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
3421
+
3422
+ return signal;
3158
3423
  };
3159
3424
 
3160
3425
  const streamChunk = function* (chunk, chunkSize) {
@@ -3251,11 +3516,19 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3251
3516
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3252
3517
  * - For base64: compute exact decoded size using length and padding;
3253
3518
  * 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.
3519
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
3255
3520
  *
3256
3521
  * @param {string} url
3257
3522
  * @returns {number}
3258
3523
  */
3524
+ const isHexDigit = (charCode) =>
3525
+ (charCode >= 48 && charCode <= 57) ||
3526
+ (charCode >= 65 && charCode <= 70) ||
3527
+ (charCode >= 97 && charCode <= 102);
3528
+
3529
+ const isPercentEncodedByte = (str, i, len) =>
3530
+ i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3531
+
3259
3532
  function estimateDataURLDecodedBytes(url) {
3260
3533
  if (!url || typeof url !== 'string') return 0;
3261
3534
  if (!url.startsWith('data:')) return 0;
@@ -3275,9 +3548,7 @@ function estimateDataURLDecodedBytes(url) {
3275
3548
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3276
3549
  const a = body.charCodeAt(i + 1);
3277
3550
  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));
3551
+ const isHex = isHexDigit(a) && isHexDigit(b);
3281
3552
 
3282
3553
  if (isHex) {
3283
3554
  effectiveLen -= 2;
@@ -3318,18 +3589,17 @@ function estimateDataURLDecodedBytes(url) {
3318
3589
  return bytes > 0 ? bytes : 0;
3319
3590
  }
3320
3591
 
3321
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3322
- return Buffer.byteLength(body, 'utf8');
3323
- }
3324
-
3325
3592
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3326
3593
  // 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).
3594
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3595
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3329
3596
  let bytes = 0;
3330
3597
  for (let i = 0, len = body.length; i < len; i++) {
3331
3598
  const c = body.charCodeAt(i);
3332
- if (c < 0x80) {
3599
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3600
+ bytes += 1;
3601
+ i += 2;
3602
+ } else if (c < 0x80) {
3333
3603
  bytes += 1;
3334
3604
  } else if (c < 0x800) {
3335
3605
  bytes += 2;
@@ -3348,12 +3618,41 @@ function estimateDataURLDecodedBytes(url) {
3348
3618
  return bytes;
3349
3619
  }
3350
3620
 
3351
- const VERSION$1 = "1.16.0";
3621
+ const VERSION$1 = "1.18.1";
3352
3622
 
3353
3623
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
3354
3624
 
3355
3625
  const { isFunction } = utils$1;
3356
3626
 
3627
+ /**
3628
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3629
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3630
+ *
3631
+ * @param {string} str The string to encode
3632
+ *
3633
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3634
+ */
3635
+ const encodeUTF8 = (str) =>
3636
+ encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) =>
3637
+ String.fromCharCode(parseInt(hex, 16))
3638
+ );
3639
+
3640
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
3641
+ // Decode before composing the `auth` option so credentials such as
3642
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
3643
+ // original value for malformed input so a bad encoding never throws.
3644
+ const decodeURIComponentSafe = (value) => {
3645
+ if (!utils$1.isString(value)) {
3646
+ return value;
3647
+ }
3648
+
3649
+ try {
3650
+ return decodeURIComponent(value);
3651
+ } catch (error) {
3652
+ return value;
3653
+ }
3654
+ };
3655
+
3357
3656
  const test = (fn, ...args) => {
3358
3657
  try {
3359
3658
  return !!fn(...args);
@@ -3362,8 +3661,20 @@ const test = (fn, ...args) => {
3362
3661
  }
3363
3662
  };
3364
3663
 
3664
+ const maybeWithAuthCredentials = (url) => {
3665
+ const protocolIndex = url.indexOf('://');
3666
+ let urlToCheck = url;
3667
+ if (protocolIndex !== -1) {
3668
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
3669
+ }
3670
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
3671
+ };
3672
+
3365
3673
  const factory = (env) => {
3366
- const globalObject = utils$1.global ?? globalThis;
3674
+ const globalObject =
3675
+ utils$1.global !== undefined && utils$1.global !== null
3676
+ ? utils$1.global
3677
+ : globalThis;
3367
3678
  const { ReadableStream, TextEncoder } = globalObject;
3368
3679
 
3369
3680
  env = utils$1.merge.call(
@@ -3506,6 +3817,7 @@ const factory = (env) => {
3506
3817
 
3507
3818
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3508
3819
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
3820
+ const own = (key) => (utils$1.hasOwnProp(config, key) ? config[key] : undefined);
3509
3821
 
3510
3822
  let _fetch = envFetch || fetch;
3511
3823
 
@@ -3527,7 +3839,61 @@ const factory = (env) => {
3527
3839
 
3528
3840
  let requestContentLength;
3529
3841
 
3842
+ // AxiosError we raise while the request body is being streamed. Captured
3843
+ // by identity so the catch block can surface it directly, regardless of
3844
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
3845
+ // as `err.cause`; some browsers drop the original error entirely).
3846
+ let pendingBodyError = null;
3847
+
3848
+ const maxBodyLengthError = () =>
3849
+ new AxiosError$1(
3850
+ 'Request body larger than maxBodyLength limit',
3851
+ AxiosError$1.ERR_BAD_REQUEST,
3852
+ config,
3853
+ request
3854
+ );
3855
+
3530
3856
  try {
3857
+ // HTTP basic authentication
3858
+ let auth = undefined;
3859
+ const configAuth = own('auth');
3860
+
3861
+ if (configAuth) {
3862
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
3863
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
3864
+ auth = {
3865
+ username,
3866
+ password
3867
+ };
3868
+ }
3869
+
3870
+ if (maybeWithAuthCredentials(url)) {
3871
+ const parsedURL = new URL(url, platform.origin);
3872
+
3873
+ if (!auth && (parsedURL.username || parsedURL.password)) {
3874
+ const urlUsername = decodeURIComponentSafe(parsedURL.username);
3875
+ const urlPassword = decodeURIComponentSafe(parsedURL.password);
3876
+ auth = {
3877
+ username: urlUsername,
3878
+ password: urlPassword
3879
+ };
3880
+ }
3881
+
3882
+ if (parsedURL.username || parsedURL.password) {
3883
+ parsedURL.username = '';
3884
+ parsedURL.password = '';
3885
+ url = parsedURL.href;
3886
+ }
3887
+ }
3888
+
3889
+ if (auth) {
3890
+ headers.delete('authorization');
3891
+ headers.set(
3892
+ 'Authorization',
3893
+ 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || '')))
3894
+ );
3895
+ }
3896
+
3531
3897
  // Enforce maxContentLength for data: URLs up-front so we never materialize
3532
3898
  // an oversized payload. The HTTP adapter applies the same check (see http.js
3533
3899
  // "if (protocol === 'data:')" branch).
@@ -3543,53 +3909,96 @@ const factory = (env) => {
3543
3909
  }
3544
3910
  }
3545
3911
 
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).
3912
+ // Enforce maxBodyLength against known-size bodies before dispatch using
3913
+ // the body's *actual* size never a caller-declared Content-Length,
3914
+ // which could under-report to slip an oversized body past the check.
3915
+ // Unknown-size streams return undefined here and are counted per-chunk
3916
+ // below as fetch consumes them.
3550
3917
  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
- );
3918
+ const outboundLength = await getBodyLength(data);
3919
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
3920
+ requestContentLength = outboundLength;
3921
+ if (outboundLength > maxBodyLength) {
3922
+ throw maxBodyLengthError();
3923
+ }
3563
3924
  }
3564
3925
  }
3565
3926
 
3927
+ // A streamed body under maxBodyLength must be counted as fetch consumes
3928
+ // it; its size is never trusted from a caller-declared Content-Length.
3929
+ const mustEnforceStreamBody =
3930
+ hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
3931
+
3932
+ const trackRequestStream = (stream, onProgress, flush) =>
3933
+ trackStream(
3934
+ stream,
3935
+ DEFAULT_CHUNK_SIZE,
3936
+ (loadedBytes) => {
3937
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
3938
+ throw (pendingBodyError = maxBodyLengthError());
3939
+ }
3940
+ onProgress && onProgress(loadedBytes);
3941
+ },
3942
+ flush
3943
+ );
3944
+
3566
3945
  if (
3567
- onUploadProgress &&
3568
3946
  supportsRequestStream &&
3569
3947
  method !== 'get' &&
3570
3948
  method !== 'head' &&
3571
- (requestContentLength = await resolveBodyLength(headers, data)) !== 0
3949
+ (onUploadProgress || mustEnforceStreamBody)
3572
3950
  ) {
3573
- let _request = new Request(url, {
3574
- method: 'POST',
3575
- body: data,
3576
- duplex: 'half',
3577
- });
3951
+ requestContentLength =
3952
+ requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
3953
+
3954
+ // A declared length of 0 is only trusted to skip the wrap when we are
3955
+ // not enforcing a stream limit (which must not rely on that header).
3956
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
3957
+ let _request = new Request(url, {
3958
+ method: 'POST',
3959
+ body: data,
3960
+ duplex: 'half',
3961
+ });
3578
3962
 
3579
- let contentTypeHeader;
3963
+ let contentTypeHeader;
3580
3964
 
3581
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3582
- headers.setContentType(contentTypeHeader);
3583
- }
3965
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3966
+ headers.setContentType(contentTypeHeader);
3967
+ }
3584
3968
 
3585
- if (_request.body) {
3586
- const [onProgress, flush] = progressEventDecorator(
3587
- requestContentLength,
3588
- progressEventReducer(asyncDecorator(onUploadProgress))
3589
- );
3969
+ if (_request.body) {
3970
+ const [onProgress, flush] =
3971
+ (onUploadProgress &&
3972
+ progressEventDecorator(
3973
+ requestContentLength,
3974
+ progressEventReducer(asyncDecorator(onUploadProgress))
3975
+ )) ||
3976
+ [];
3590
3977
 
3591
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3978
+ data = trackRequestStream(_request.body, onProgress, flush);
3979
+ }
3592
3980
  }
3981
+ } else if (
3982
+ mustEnforceStreamBody &&
3983
+ !isRequestSupported &&
3984
+ isReadableStreamSupported &&
3985
+ method !== 'get' &&
3986
+ method !== 'head'
3987
+ ) {
3988
+ data = trackRequestStream(data);
3989
+ } else if (
3990
+ mustEnforceStreamBody &&
3991
+ isRequestSupported &&
3992
+ !supportsRequestStream &&
3993
+ method !== 'get' &&
3994
+ method !== 'head'
3995
+ ) {
3996
+ throw new AxiosError$1(
3997
+ 'Stream request bodies are not supported by the current fetch implementation',
3998
+ AxiosError$1.ERR_NOT_SUPPORT,
3999
+ config,
4000
+ request
4001
+ );
3593
4002
  }
3594
4003
 
3595
4004
  if (!utils$1.isString(withCredentials)) {
@@ -3620,7 +4029,7 @@ const factory = (env) => {
3620
4029
  ...fetchOptions,
3621
4030
  signal: composedSignal,
3622
4031
  method: method.toUpperCase(),
3623
- headers: headers.normalize().toJSON(),
4032
+ headers: toByteStringHeaderObject(headers.normalize()),
3624
4033
  body: data,
3625
4034
  duplex: 'half',
3626
4035
  credentials: isCredentialsSupported ? withCredentials : undefined,
@@ -3632,10 +4041,12 @@ const factory = (env) => {
3632
4041
  ? _fetch(request, fetchOptions)
3633
4042
  : _fetch(url, resolvedOptions));
3634
4043
 
4044
+ const responseHeaders = AxiosHeaders$1.from(response.headers);
4045
+
3635
4046
  // Cheap pre-check: if the server honestly declares a content-length that
3636
4047
  // already exceeds the cap, reject before we start streaming.
3637
4048
  if (hasMaxContentLength) {
3638
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4049
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3639
4050
  if (declaredLength != null && declaredLength > maxContentLength) {
3640
4051
  throw new AxiosError$1(
3641
4052
  'maxContentLength size of ' + maxContentLength + ' exceeded',
@@ -3660,7 +4071,7 @@ const factory = (env) => {
3660
4071
  options[prop] = response[prop];
3661
4072
  });
3662
4073
 
3663
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4074
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3664
4075
 
3665
4076
  const [onProgress, flush] =
3666
4077
  (onDownloadProgress &&
@@ -3751,23 +4162,55 @@ const factory = (env) => {
3751
4162
  const canceledError = composedSignal.reason;
3752
4163
  canceledError.config = config;
3753
4164
  request && (canceledError.request = request);
3754
- err !== canceledError && (canceledError.cause = err);
4165
+ if (err !== canceledError) {
4166
+ // Non-enumerable to match native Error `cause` semantics so loggers
4167
+ // don't recurse into circular fetch internals (see #7205).
4168
+ Object.defineProperty(canceledError, 'cause', {
4169
+ __proto__: null,
4170
+ value: err,
4171
+ writable: true,
4172
+ enumerable: false,
4173
+ configurable: true,
4174
+ });
4175
+ }
3755
4176
  throw canceledError;
3756
4177
  }
3757
4178
 
4179
+ // Surface a maxBodyLength violation we raised while the request body was
4180
+ // being streamed. Matching by identity (rather than reading
4181
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
4182
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
4183
+ // AxiosError that merely happened to land in `err.cause`.
4184
+ if (pendingBodyError) {
4185
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
4186
+ throw pendingBodyError;
4187
+ }
4188
+
4189
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
4190
+ // pre-checks, response size enforcement) without re-wrapping them.
4191
+ if (err instanceof AxiosError$1) {
4192
+ request && !err.request && (err.request = request);
4193
+ throw err;
4194
+ }
4195
+
3758
4196
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
3759
- throw Object.assign(
3760
- new AxiosError$1(
3761
- 'Network Error',
3762
- AxiosError$1.ERR_NETWORK,
3763
- config,
3764
- request,
3765
- err && err.response
3766
- ),
3767
- {
3768
- cause: err.cause || err,
3769
- }
4197
+ const networkError = new AxiosError$1(
4198
+ 'Network Error',
4199
+ AxiosError$1.ERR_NETWORK,
4200
+ config,
4201
+ request,
4202
+ err && err.response
3770
4203
  );
4204
+ // Non-enumerable to match native Error `cause` semantics so loggers
4205
+ // don't recurse into circular fetch internals (see #7205).
4206
+ Object.defineProperty(networkError, 'cause', {
4207
+ __proto__: null,
4208
+ value: err.cause || err,
4209
+ writable: true,
4210
+ enumerable: false,
4211
+ configurable: true,
4212
+ });
4213
+ throw networkError;
3771
4214
  }
3772
4215
 
3773
4216
  throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
@@ -3905,7 +4348,7 @@ function getAdapter$1(adapters, config) {
3905
4348
 
3906
4349
  throw new AxiosError$1(
3907
4350
  `There is no suitable adapter to dispatch the request ` + s,
3908
- 'ERR_NOT_SUPPORT'
4351
+ AxiosError$1.ERR_NOT_SUPPORT
3909
4352
  );
3910
4353
  }
3911
4354
 
@@ -4086,7 +4529,7 @@ validators$1.spelling = function spelling(correctSpelling) {
4086
4529
  */
4087
4530
 
4088
4531
  function assertOptions(options, schema, allowUnknown) {
4089
- if (typeof options !== 'object') {
4532
+ if (typeof options !== 'object' || options === null) {
4090
4533
  throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
4091
4534
  }
4092
4535
  const keys = Object.keys(options);
@@ -4209,6 +4652,8 @@ let Axios$1 = class Axios {
4209
4652
  forcedJSONParsing: validators.transitional(validators.boolean),
4210
4653
  clarifyTimeoutError: validators.transitional(validators.boolean),
4211
4654
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
4655
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
4656
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
4212
4657
  },
4213
4658
  false
4214
4659
  );
@@ -4338,7 +4783,7 @@ let Axios$1 = class Axios {
4338
4783
 
4339
4784
  getUri(config) {
4340
4785
  config = mergeConfig$1(this.defaults, config);
4341
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4786
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4342
4787
  return buildURL(fullPath, config.params, config.paramsSerializer);
4343
4788
  }
4344
4789
  };
@@ -4351,7 +4796,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
4351
4796
  mergeConfig$1(config || {}, {
4352
4797
  method,
4353
4798
  url,
4354
- data: (config || {}).data,
4799
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined,
4355
4800
  })
4356
4801
  );
4357
4802
  };