@openclaw/slack 2026.7.2-beta.3 → 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 (152) hide show
  1. package/dist/account-inspect-api.js +1 -1
  2. package/dist/{account-inspect-Bvbtu3iH.js → account-inspect-jn1xLaVi.js} +2 -2
  3. package/dist/account-reply-mode-DrUXogvO.js +14 -0
  4. package/dist/{accounts-DQEbYKh9.js → accounts-BSr252c_.js} +6 -27
  5. package/dist/{accounts.runtime-BIKmJdtJ.js → accounts.runtime-CjULMLTa.js} +1 -1
  6. package/dist/{action-runtime-DqkRwO3Z.js → action-runtime-CFU52n4W.js} +7 -7
  7. package/dist/action-runtime.runtime-9-17zvKH.js +2 -0
  8. package/dist/{actions-CF0tUY5q.js → actions-D51foiwR.js} +5 -5
  9. package/dist/{actions.runtime-hCbx4RXg.js → actions.runtime-BMJwtf5C.js} +1 -1
  10. package/dist/api.js +15 -14
  11. package/dist/{approval-handler.runtime-Em8I1-8-.js → approval-handler.runtime-3b4-wxMl.js} +2 -2
  12. package/dist/{channel-4-TRi1D6.js → channel-Ds8NKvfr.js} +26 -24
  13. package/dist/channel-config-api.js +1 -1
  14. package/dist/channel-plugin-api.js +1 -1
  15. package/dist/{channel-type-Cu1yjNg2.js → channel-type-DXkUajFP.js} +3 -3
  16. package/dist/{channel.setup-CgkADtZg.js → channel.setup-DOSTEDfA.js} +6 -5
  17. package/dist/{config-schema-XjJGfwQC.js → config-schema-B4j4tCOI.js} +231 -26
  18. package/dist/{directory-config-Bv0lcUlH.js → directory-config-B08pm5ZT.js} +1 -1
  19. package/dist/directory-contract-api.js +1 -1
  20. package/dist/{directory-live-CzUIB7th.js → directory-live-DpPKzPrn.js} +2 -2
  21. package/dist/{doctor-contract-DKpe5VBr.js → doctor-contract-U6oVntbM.js} +60 -89
  22. package/dist/doctor-contract-api.js +1 -1
  23. package/dist/{group-policy-Bw-65m3V.js → group-policy-CdnQzQBI.js} +32 -5
  24. package/dist/{interactive-replies-Dm_t2R9S.js → interactive-replies-C3ffk6oN.js} +1 -1
  25. package/dist/interactive-replies-api.js +1 -1
  26. package/dist/{message-tool-api-C2pcf5du.js → message-tool-api-ByVyIVOh.js} +2 -2
  27. package/dist/message-tool-api.js +1 -1
  28. package/dist/{monitor-CNFeF30h.js → monitor-CnB_WKvF.js} +3 -3
  29. package/dist/{outbound-adapter-CVi2uok0.js → outbound-adapter-DuPz2HHt.js} +3 -3
  30. package/dist/{pipeline.runtime-CTvokbty.js → pipeline.runtime-5rRYZuX5.js} +110 -77
  31. package/dist/{policy-b_dOPDCq.js → policy-C31RYSuT.js} +1 -1
  32. package/dist/{probe-Borhn9PQ.js → probe-CVRuArHA.js} +1 -1
  33. package/dist/{provider-B-HVL5ZE.js → provider-htuIJGFD.js} +365 -200
  34. package/dist/{relay-source-Ea_P9VcO.js → relay-source-Df9EaiTF.js} +1 -1
  35. package/dist/{replies-B4bOdrYb.js → replies-Cgr2Gli4.js} +3 -3
  36. package/dist/{resolve-channels-KTc568SU.js → resolve-channels-DodP2TFx.js} +1 -1
  37. package/dist/{resolve-users-DeGJf1yp.js → resolve-users-M9eF8891.js} +1 -1
  38. package/dist/{runtime-api-BFfNpzDe.js → runtime-api-D5XYMMsf.js} +3 -2
  39. package/dist/runtime-api.js +11 -11
  40. package/dist/{scopes-lx08L56K.js → scopes-CJRpHkDC.js} +1 -1
  41. package/dist/{security-audit-CikQhBUY.js → security-audit-Cz6erklv.js} +0 -10
  42. package/dist/security-contract-api.js +1 -1
  43. package/dist/{send-KuTDky7i.js → send-BZ1tPv7-.js} +4 -4
  44. package/dist/{send.runtime-CXyxws1D.js → send.runtime-a2pilFor.js} +1 -1
  45. package/dist/{setup-core-CeiAVwQ3.js → setup-core-tPxMuFez.js} +138 -40
  46. package/dist/setup-plugin-api.js +1 -1
  47. package/dist/{setup-surface-DLA0vHXp.js → setup-surface-wV-S1dE_.js} +43 -27
  48. package/dist/{shared-C4yVB0Q-.js → shared-BfMskaMx.js} +9 -8
  49. package/dist/{slash-dispatch.runtime-BT-mMm-f.js → slash-dispatch.runtime-lfeIsXTX.js} +1 -1
  50. package/node_modules/@types/node/README.md +1 -1
  51. package/node_modules/@types/node/fs/promises.d.ts +16 -6
  52. package/node_modules/@types/node/package.json +2 -2
  53. package/node_modules/agent-base/README.md +145 -0
  54. package/node_modules/agent-base/dist/src/index.d.ts +78 -0
  55. package/node_modules/agent-base/dist/src/index.js +203 -0
  56. package/node_modules/agent-base/dist/src/index.js.map +1 -0
  57. package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  58. package/node_modules/agent-base/dist/src/promisify.js +18 -0
  59. package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  60. package/node_modules/agent-base/package.json +64 -0
  61. package/node_modules/agent-base/src/index.ts +345 -0
  62. package/node_modules/agent-base/src/promisify.ts +33 -0
  63. package/node_modules/axios/CHANGELOG.md +197 -1
  64. package/node_modules/axios/README.md +424 -256
  65. package/node_modules/axios/dist/axios.js +589 -204
  66. package/node_modules/axios/dist/axios.min.js +3 -3
  67. package/node_modules/axios/dist/axios.min.js.map +1 -1
  68. package/node_modules/axios/dist/browser/axios.cjs +630 -185
  69. package/node_modules/axios/dist/esm/axios.js +630 -185
  70. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  71. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  72. package/node_modules/axios/dist/node/axios.cjs +949 -301
  73. package/node_modules/axios/index.d.cts +28 -5
  74. package/node_modules/axios/index.d.ts +24 -3
  75. package/node_modules/axios/lib/adapters/adapters.js +1 -1
  76. package/node_modules/axios/lib/adapters/fetch.js +223 -49
  77. package/node_modules/axios/lib/adapters/http.js +408 -193
  78. package/node_modules/axios/lib/adapters/xhr.js +3 -1
  79. package/node_modules/axios/lib/core/Axios.js +4 -2
  80. package/node_modules/axios/lib/core/AxiosError.js +13 -1
  81. package/node_modules/axios/lib/core/AxiosHeaders.js +13 -42
  82. package/node_modules/axios/lib/core/buildFullPath.js +29 -1
  83. package/node_modules/axios/lib/core/mergeConfig.js +35 -0
  84. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  85. package/node_modules/axios/lib/env/data.js +1 -1
  86. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
  87. package/node_modules/axios/lib/helpers/Http2Sessions.js +119 -0
  88. package/node_modules/axios/lib/helpers/buildURL.js +7 -4
  89. package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
  90. package/node_modules/axios/lib/helpers/cookies.js +5 -1
  91. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
  92. package/node_modules/axios/lib/helpers/formDataToJSON.js +26 -4
  93. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -2
  94. package/node_modules/axios/lib/helpers/fromDataURI.js +20 -5
  95. package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
  96. package/node_modules/axios/lib/helpers/resolveConfig.js +26 -13
  97. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  98. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
  99. package/node_modules/axios/lib/helpers/toFormData.js +48 -12
  100. package/node_modules/axios/lib/helpers/validator.js +1 -1
  101. package/node_modules/axios/lib/utils.js +105 -19
  102. package/node_modules/axios/package.json +31 -13
  103. package/node_modules/https-proxy-agent/README.md +137 -0
  104. package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  105. package/node_modules/https-proxy-agent/dist/agent.js +177 -0
  106. package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  107. package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  108. package/node_modules/https-proxy-agent/dist/index.js +14 -0
  109. package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  110. package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  111. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  112. package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  113. package/node_modules/https-proxy-agent/package.json +56 -0
  114. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  115. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  116. package/node_modules/iconv-lite/package.json +2 -2
  117. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  118. package/node_modules/path-to-regexp/Readme.md +3 -3
  119. package/node_modules/path-to-regexp/dist/index.js +135 -158
  120. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  121. package/node_modules/path-to-regexp/package.json +2 -2
  122. package/node_modules/qs/CHANGELOG.md +11 -0
  123. package/node_modules/qs/dist/qs.js +17 -17
  124. package/node_modules/qs/lib/parse.js +19 -8
  125. package/node_modules/qs/lib/utils.js +47 -8
  126. package/node_modules/qs/package.json +6 -5
  127. package/node_modules/qs/test/parse.js +230 -0
  128. package/node_modules/qs/test/utils.js +194 -0
  129. package/node_modules/typebox/build/compile/validator.d.mts +1 -4
  130. package/node_modules/typebox/build/guard/guard.d.mts +1 -1
  131. package/node_modules/typebox/build/guard/guard.mjs +5 -2
  132. package/node_modules/typebox/build/guard/string.mjs +16 -4
  133. package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
  134. package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
  135. package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
  136. package/node_modules/typebox/build/typebox.d.mts +1 -1
  137. package/node_modules/typebox/build/typebox.mjs +1 -1
  138. package/node_modules/typebox/package.json +1 -1
  139. package/node_modules/typebox/readme.md +29 -32
  140. package/node_modules/ws/lib/receiver.js +15 -32
  141. package/node_modules/ws/lib/websocket-server.js +4 -4
  142. package/node_modules/ws/lib/websocket.js +4 -4
  143. package/node_modules/ws/package.json +5 -1
  144. package/npm-shrinkwrap.json +54 -27
  145. package/openclaw.plugin.json +1759 -1908
  146. package/package.json +92 -14
  147. package/dist/action-runtime.runtime-DEWOcFM4.js +0 -2
  148. package/dist/config-api-Df9a1B8C.js +0 -3
  149. package/node_modules/axios/dist/axios.js.map +0 -1
  150. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  151. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  152. 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
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -463,55 +463,42 @@
463
463
  };
464
464
  }
465
465
  function AsyncGenerator(e) {
466
- var r, t;
467
- function resume(r, t) {
466
+ var t, n;
467
+ function resume(t, n) {
468
468
  try {
469
- var n = e[r](t),
470
- o = n.value,
469
+ var r = e[t](n),
470
+ o = r.value,
471
471
  u = o instanceof _OverloadYield;
472
- Promise.resolve(u ? o.v : o).then(function (t) {
472
+ Promise.resolve(u ? o.v : o).then(function (n) {
473
473
  if (u) {
474
- var i = "return" === r ? "return" : "next";
475
- if (!o.k || t.done) return resume(i, t);
476
- t = e[i](t).value;
474
+ var i = "return" === t && o.k ? t : "next";
475
+ if (!o.k || n.done) return resume(i, n);
476
+ n = e[i](n).value;
477
477
  }
478
- settle(n.done ? "return" : "normal", t);
478
+ settle(!!r.done, n);
479
479
  }, function (e) {
480
480
  resume("throw", e);
481
481
  });
482
482
  } catch (e) {
483
- settle("throw", e);
483
+ settle(2, e);
484
484
  }
485
485
  }
486
- function settle(e, n) {
487
- switch (e) {
488
- case "return":
489
- r.resolve({
490
- value: n,
491
- done: true
492
- });
493
- break;
494
- case "throw":
495
- r.reject(n);
496
- break;
497
- default:
498
- r.resolve({
499
- value: n,
500
- done: false
501
- });
502
- }
503
- (r = r.next) ? resume(r.key, r.arg) : t = null;
486
+ function settle(e, r) {
487
+ 2 === e ? t.reject(r) : t.resolve({
488
+ value: r,
489
+ done: e
490
+ }), (t = t.next) ? resume(t.key, t.arg) : n = null;
504
491
  }
505
- this._invoke = function (e, n) {
492
+ this._invoke = function (e, r) {
506
493
  return new Promise(function (o, u) {
507
494
  var i = {
508
495
  key: e,
509
- arg: n,
496
+ arg: r,
510
497
  resolve: o,
511
498
  reject: u,
512
499
  next: null
513
500
  };
514
- t ? t = t.next = i : (r = t = i, resume(e, n));
501
+ n ? n = n.next = i : (t = n = i, resume(e, r));
515
502
  });
516
503
  }, "function" != typeof e.return && (this.return = void 0);
517
504
  }
@@ -566,6 +553,57 @@
566
553
  var getPrototypeOf = Object.getPrototypeOf;
567
554
  var iterator = Symbol.iterator,
568
555
  toStringTag = Symbol.toStringTag;
556
+
557
+ /* Creating a function that will check if an object has a property. */
558
+ var hasOwnProperty = function (_ref) {
559
+ var hasOwnProperty = _ref.hasOwnProperty;
560
+ return function (obj, prop) {
561
+ return hasOwnProperty.call(obj, prop);
562
+ };
563
+ }(Object.prototype);
564
+
565
+ /**
566
+ * Walk the prototype chain (excluding the shared Object.prototype) looking for
567
+ * an own `prop`. This distinguishes genuine own/inherited members — including
568
+ * class accessors and template prototypes — from members injected via
569
+ * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
570
+ * live on Object.prototype itself and are therefore never matched.
571
+ *
572
+ * @param {*} thing The value whose chain to inspect
573
+ * @param {string|symbol} prop The property key to look for
574
+ *
575
+ * @returns {boolean} True when `prop` is owned below Object.prototype
576
+ */
577
+ var hasOwnInPrototypeChain = function hasOwnInPrototypeChain(thing, prop) {
578
+ var obj = thing;
579
+ var seen = [];
580
+ while (obj != null && obj !== Object.prototype) {
581
+ if (seen.indexOf(obj) !== -1) {
582
+ return false;
583
+ }
584
+ seen.push(obj);
585
+ if (hasOwnProperty(obj, prop)) {
586
+ return true;
587
+ }
588
+ obj = getPrototypeOf(obj);
589
+ }
590
+ return false;
591
+ };
592
+
593
+ /**
594
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
595
+ * properties and members inherited from a non-Object.prototype source (a class
596
+ * instance or template object) are honored; a value reachable only through a
597
+ * polluted Object.prototype is ignored and `undefined` is returned.
598
+ *
599
+ * @param {*} obj The source object
600
+ * @param {string|symbol} prop The property key to read
601
+ *
602
+ * @returns {*} The resolved value, or undefined when unsafe/absent
603
+ */
604
+ var getSafeProp = function getSafeProp(obj, prop) {
605
+ return obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
606
+ };
569
607
  var kindOf = function (cache) {
570
608
  return function (thing) {
571
609
  var str = toString.call(thing);
@@ -694,11 +732,15 @@
694
732
  * @returns {boolean} True if value is a plain Object, otherwise false
695
733
  */
696
734
  var isPlainObject = function isPlainObject(val) {
697
- if (kindOf(val) !== 'object') {
735
+ if (!isObject(val)) {
698
736
  return false;
699
737
  }
700
738
  var prototype = getPrototypeOf(val);
701
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
739
+ return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
740
+ // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
741
+ // Symbol.iterator as evidence the value is a tagged/iterable type rather
742
+ // than a plain object, while ignoring keys injected onto Object.prototype.
743
+ !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
702
744
  };
703
745
 
704
746
  /**
@@ -866,9 +908,9 @@
866
908
  * @returns {any}
867
909
  */
868
910
  function forEach(obj, fn) {
869
- var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
870
- _ref$allOwnKeys = _ref.allOwnKeys,
871
- allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys;
911
+ var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
912
+ _ref2$allOwnKeys = _ref2.allOwnKeys,
913
+ allOwnKeys = _ref2$allOwnKeys === void 0 ? false : _ref2$allOwnKeys;
872
914
  // Don't bother if no value provided
873
915
  if (obj === null || typeof obj === 'undefined') {
874
916
  return;
@@ -955,16 +997,19 @@
955
997
  * @returns {Object} Result of all merge properties
956
998
  */
957
999
  function merge() {
958
- var _ref2 = isContextDefined(this) && this || {},
959
- caseless = _ref2.caseless,
960
- skipUndefined = _ref2.skipUndefined;
1000
+ var _ref3 = isContextDefined(this) && this || {},
1001
+ caseless = _ref3.caseless,
1002
+ skipUndefined = _ref3.skipUndefined;
961
1003
  var result = {};
962
1004
  var assignValue = function assignValue(val, key) {
963
1005
  // Skip dangerous property names to prevent prototype pollution
964
1006
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
965
1007
  return;
966
1008
  }
967
- var targetKey = caseless && findKey(result, key) || key;
1009
+
1010
+ // findKey lowercases the key, so caseless lookup only applies to strings —
1011
+ // symbol keys are identity-matched.
1012
+ var targetKey = caseless && typeof key === 'string' && findKey(result, key) || key;
968
1013
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
969
1014
  // chain, so a polluted Object.prototype value could surface here and get
970
1015
  // copied into the merged result.
@@ -979,11 +1024,22 @@
979
1024
  result[targetKey] = val;
980
1025
  }
981
1026
  };
982
- for (var _len = arguments.length, objs = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
983
- objs[_key2] = arguments[_key2];
984
- }
985
- for (var i = 0, l = objs.length; i < l; i++) {
986
- objs[i] && forEach(objs[i], assignValue);
1027
+ for (var i = 0, l = arguments.length; i < l; i++) {
1028
+ var source = i < 0 || arguments.length <= i ? undefined : arguments[i];
1029
+ if (!source || isBuffer(source)) {
1030
+ continue;
1031
+ }
1032
+ forEach(source, assignValue);
1033
+ if (_typeof(source) !== 'object' || isArray(source)) {
1034
+ continue;
1035
+ }
1036
+ var symbols = Object.getOwnPropertySymbols(source);
1037
+ for (var j = 0; j < symbols.length; j++) {
1038
+ var symbol = symbols[j];
1039
+ if (propertyIsEnumerable.call(source, symbol)) {
1040
+ assignValue(source[symbol], symbol);
1041
+ }
1042
+ }
987
1043
  }
988
1044
  return result;
989
1045
  }
@@ -1000,8 +1056,8 @@
1000
1056
  * @returns {Object} The resulting value of object a
1001
1057
  */
1002
1058
  var extend = function extend(a, b, thisArg) {
1003
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1004
- allOwnKeys = _ref3.allOwnKeys;
1059
+ var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
1060
+ allOwnKeys = _ref4.allOwnKeys;
1005
1061
  forEach(b, function (val, key) {
1006
1062
  if (thisArg && isFunction$1(val)) {
1007
1063
  Object.defineProperty(a, key, {
@@ -1195,14 +1251,7 @@
1195
1251
  return p1.toUpperCase() + p2;
1196
1252
  });
1197
1253
  };
1198
-
1199
- /* Creating a function that will check if an object has a property. */
1200
- var hasOwnProperty = function (_ref4) {
1201
- var hasOwnProperty = _ref4.hasOwnProperty;
1202
- return function (obj, prop) {
1203
- return hasOwnProperty.call(obj, prop);
1204
- };
1205
- }(Object.prototype);
1254
+ var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
1206
1255
 
1207
1256
  /**
1208
1257
  * Determine if a value is a RegExp object
@@ -1291,10 +1340,10 @@
1291
1340
  * @returns {Object} The JSON-compatible object.
1292
1341
  */
1293
1342
  var toJSONObject = function toJSONObject(obj) {
1294
- var stack = new Array(10);
1295
- var _visit = function visit(source, i) {
1343
+ var visited = new WeakSet();
1344
+ var _visit = function visit(source) {
1296
1345
  if (isObject(source)) {
1297
- if (stack.indexOf(source) >= 0) {
1346
+ if (visited.has(source)) {
1298
1347
  return;
1299
1348
  }
1300
1349
 
@@ -1303,19 +1352,20 @@
1303
1352
  return source;
1304
1353
  }
1305
1354
  if (!('toJSON' in source)) {
1306
- stack[i] = source;
1355
+ // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
1356
+ visited.add(source);
1307
1357
  var target = isArray(source) ? [] : {};
1308
1358
  forEach(source, function (value, key) {
1309
- var reducedValue = _visit(value, i + 1);
1359
+ var reducedValue = _visit(value);
1310
1360
  !isUndefined(reducedValue) && (target[key] = reducedValue);
1311
1361
  });
1312
- stack[i] = undefined;
1362
+ visited["delete"](source);
1313
1363
  return target;
1314
1364
  }
1315
1365
  }
1316
1366
  return source;
1317
1367
  };
1318
- return _visit(obj, 0);
1368
+ return _visit(obj);
1319
1369
  };
1320
1370
 
1321
1371
  /**
@@ -1381,6 +1431,21 @@
1381
1431
  var isIterable = function isIterable(thing) {
1382
1432
  return thing != null && isFunction$1(thing[iterator]);
1383
1433
  };
1434
+
1435
+ /**
1436
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
1437
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
1438
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
1439
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
1440
+ * into an attacker-controlled entries iterator.
1441
+ *
1442
+ * @param {*} thing The value to test
1443
+ *
1444
+ * @returns {boolean} True if value has a non-polluted iterator
1445
+ */
1446
+ var isSafeIterable = function isSafeIterable(thing) {
1447
+ return thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
1448
+ };
1384
1449
  var utils$1 = {
1385
1450
  isArray: isArray,
1386
1451
  isArrayBuffer: isArrayBuffer,
@@ -1426,6 +1491,8 @@
1426
1491
  hasOwnProperty: hasOwnProperty,
1427
1492
  hasOwnProp: hasOwnProperty,
1428
1493
  // an alias to avoid ESLint no-prototype-builtins detection
1494
+ hasOwnInPrototypeChain: hasOwnInPrototypeChain,
1495
+ getSafeProp: getSafeProp,
1429
1496
  reduceDescriptors: reduceDescriptors,
1430
1497
  freezeMethods: freezeMethods,
1431
1498
  toObjectSet: toObjectSet,
@@ -1441,7 +1508,8 @@
1441
1508
  isThenable: isThenable,
1442
1509
  setImmediate: _setImmediate,
1443
1510
  asap: asap,
1444
- isIterable: isIterable
1511
+ isIterable: isIterable,
1512
+ isSafeIterable: isSafeIterable
1445
1513
  };
1446
1514
 
1447
1515
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -1487,8 +1555,6 @@
1487
1555
  return parsed;
1488
1556
  });
1489
1557
 
1490
- var $internals = Symbol('internals');
1491
- var INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1492
1558
  function trimSPorHTAB(str) {
1493
1559
  var start = 0;
1494
1560
  var end = str.length;
@@ -1508,12 +1574,38 @@
1508
1574
  }
1509
1575
  return start === 0 && end === str.length ? str : str.slice(start, end);
1510
1576
  }
1577
+
1578
+ // The control-code ranges are intentional: header sanitization strips C0/DEL bytes.
1579
+ // eslint-disable-next-line no-control-regex
1580
+ var INVALID_UNICODE_HEADER_VALUE_CHARS = new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+", 'g');
1581
+ // eslint-disable-next-line no-control-regex
1582
+ var INVALID_BYTE_STRING_HEADER_VALUE_CHARS = new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+", 'g');
1583
+ function sanitizeValue(value, invalidChars) {
1584
+ if (utils$1.isArray(value)) {
1585
+ return value.map(function (item) {
1586
+ return sanitizeValue(item, invalidChars);
1587
+ });
1588
+ }
1589
+ return trimSPorHTAB(String(value).replace(invalidChars, ''));
1590
+ }
1591
+ var sanitizeHeaderValue = function sanitizeHeaderValue(value) {
1592
+ return sanitizeValue(value, INVALID_UNICODE_HEADER_VALUE_CHARS);
1593
+ };
1594
+ var sanitizeByteStringHeaderValue = function sanitizeByteStringHeaderValue(value) {
1595
+ return sanitizeValue(value, INVALID_BYTE_STRING_HEADER_VALUE_CHARS);
1596
+ };
1597
+ function toByteStringHeaderObject(headers) {
1598
+ var byteStringHeaders = Object.create(null);
1599
+ utils$1.forEach(headers.toJSON(), function (value, header) {
1600
+ byteStringHeaders[header] = sanitizeByteStringHeaderValue(value);
1601
+ });
1602
+ return byteStringHeaders;
1603
+ }
1604
+
1605
+ var $internals = Symbol('internals');
1511
1606
  function normalizeHeader(header) {
1512
1607
  return header && String(header).trim().toLowerCase();
1513
1608
  }
1514
- function sanitizeHeaderValue(str) {
1515
- return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1516
- }
1517
1609
  function normalizeValue(value) {
1518
1610
  if (value === false || value == null) {
1519
1611
  return value;
@@ -1578,7 +1670,7 @@
1578
1670
  function setHeader(_value, _header, _rewrite) {
1579
1671
  var lHeader = normalizeHeader(_header);
1580
1672
  if (!lHeader) {
1581
- throw new Error('header name must be a non-empty string');
1673
+ return;
1582
1674
  }
1583
1675
  var key = utils$1.findKey(self, lHeader);
1584
1676
  if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
@@ -1594,8 +1686,8 @@
1594
1686
  setHeaders(header, valueOrRewrite);
1595
1687
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1596
1688
  setHeaders(parseHeaders(header), valueOrRewrite);
1597
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1598
- var obj = {},
1689
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1690
+ var obj = Object.create(null),
1599
1691
  dest,
1600
1692
  key;
1601
1693
  var _iterator = _createForOfIteratorHelper(header),
@@ -1604,9 +1696,15 @@
1604
1696
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
1605
1697
  var entry = _step.value;
1606
1698
  if (!utils$1.isArray(entry)) {
1607
- throw TypeError('Object iterator must return a key-value pair');
1699
+ throw new TypeError('Object iterator must return a key-value pair');
1700
+ }
1701
+ key = entry[0];
1702
+ if (utils$1.hasOwnProp(obj, key)) {
1703
+ dest = obj[key];
1704
+ obj[key] = utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]];
1705
+ } else {
1706
+ obj[key] = entry[1];
1608
1707
  }
1609
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [].concat(_toConsumableArray(dest), [entry[1]]) : [dest, entry[1]] : entry[1];
1610
1708
  }
1611
1709
  } catch (err) {
1612
1710
  _iterator.e(err);
@@ -1942,7 +2040,19 @@
1942
2040
  key: "from",
1943
2041
  value: function from(error, code, config, request, response, customProps) {
1944
2042
  var axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1945
- axiosError.cause = error;
2043
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
2044
+ // error often carries circular internals (sockets, requests, agents), so
2045
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
2046
+ // own-property walk throw "Converting circular structure to JSON".
2047
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
2048
+ // `message` descriptor below (prototype-pollution-safe descriptor).
2049
+ Object.defineProperty(axiosError, 'cause', {
2050
+ __proto__: null,
2051
+ value: error,
2052
+ writable: true,
2053
+ enumerable: false,
2054
+ configurable: true
2055
+ });
1946
2056
  axiosError.name = error.name;
1947
2057
 
1948
2058
  // Preserve status from the original error if not already set from response
@@ -1972,6 +2082,10 @@
1972
2082
  // eslint-disable-next-line strict
1973
2083
  var httpAdapter = null;
1974
2084
 
2085
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
2086
+ // the FormData <-> JSON round-trip stays symmetric.
2087
+ var DEFAULT_FORM_DATA_MAX_DEPTH = 100;
2088
+
1975
2089
  /**
1976
2090
  * Determines if the given thing is a array or js object.
1977
2091
  *
@@ -2072,8 +2186,9 @@
2072
2186
  var dots = options.dots;
2073
2187
  var indexes = options.indexes;
2074
2188
  var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2075
- var maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
2189
+ var maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
2076
2190
  var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2191
+ var stack = [];
2077
2192
  if (!utils$1.isFunction(visitor)) {
2078
2193
  throw new TypeError('visitor must be a function');
2079
2194
  }
@@ -2089,10 +2204,38 @@
2089
2204
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
2090
2205
  }
2091
2206
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
2092
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
2207
+ if (useBlob && typeof _Blob === 'function') {
2208
+ return new _Blob([value]);
2209
+ }
2210
+ if (typeof Buffer !== 'undefined') {
2211
+ return Buffer.from(value);
2212
+ }
2213
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);
2093
2214
  }
2094
2215
  return value;
2095
2216
  }
2217
+ function throwIfMaxDepthExceeded(depth) {
2218
+ if (depth > maxDepth) {
2219
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2220
+ }
2221
+ }
2222
+ function stringifyWithDepthLimit(value, depth) {
2223
+ if (maxDepth === Infinity) {
2224
+ return JSON.stringify(value);
2225
+ }
2226
+ var ancestors = [];
2227
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
2228
+ if (!utils$1.isObject(currentValue)) {
2229
+ return currentValue;
2230
+ }
2231
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
2232
+ ancestors.pop();
2233
+ }
2234
+ ancestors.push(currentValue);
2235
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
2236
+ return currentValue;
2237
+ });
2238
+ }
2096
2239
 
2097
2240
  /**
2098
2241
  * Default visitor.
@@ -2115,7 +2258,7 @@
2115
2258
  // eslint-disable-next-line no-param-reassign
2116
2259
  key = metaTokens ? key : key.slice(0, -2);
2117
2260
  // eslint-disable-next-line no-param-reassign
2118
- value = JSON.stringify(value);
2261
+ value = stringifyWithDepthLimit(value, 1);
2119
2262
  } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
2120
2263
  // eslint-disable-next-line no-param-reassign
2121
2264
  key = removeBrackets(key);
@@ -2133,7 +2276,6 @@
2133
2276
  formData.append(renderKey(path, key, dots), convertValue(value));
2134
2277
  return false;
2135
2278
  }
2136
- var stack = [];
2137
2279
  var exposedHelpers = Object.assign(predicates, {
2138
2280
  defaultVisitor: defaultVisitor,
2139
2281
  convertValue: convertValue,
@@ -2142,11 +2284,9 @@
2142
2284
  function build(value, path) {
2143
2285
  var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2144
2286
  if (utils$1.isUndefined(value)) return;
2145
- if (depth > maxDepth) {
2146
- throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2147
- }
2287
+ throwIfMaxDepthExceeded(depth);
2148
2288
  if (stack.indexOf(value) !== -1) {
2149
- throw Error('Circular reference detected in ' + path.join('.'));
2289
+ throw new Error('Circular reference detected in ' + path.join('.'));
2150
2290
  }
2151
2291
  stack.push(value);
2152
2292
  utils$1.forEach(value, function each(el, key) {
@@ -2203,8 +2343,9 @@
2203
2343
  this._pairs.push([name, value]);
2204
2344
  };
2205
2345
  prototype.toString = function toString(encoder) {
2346
+ var _this = this;
2206
2347
  var _encode = encoder ? function (value) {
2207
- return encoder.call(this, value, encode$1);
2348
+ return encoder.call(_this, value, encode$1);
2208
2349
  } : encode$1;
2209
2350
  return this._pairs.map(function each(pair) {
2210
2351
  return _encode(pair[0]) + '=' + _encode(pair[1]);
@@ -2236,11 +2377,16 @@
2236
2377
  if (!params) {
2237
2378
  return url;
2238
2379
  }
2239
- var _encode = options && options.encode || encode;
2380
+ url = url || '';
2240
2381
  var _options = utils$1.isFunction(options) ? {
2241
2382
  serialize: options
2242
2383
  } : options;
2243
- var serializeFn = _options && _options.serialize;
2384
+
2385
+ // Read serializer options pollution-safely: own properties and methods on a
2386
+ // class/template prototype are honored, but values injected onto a polluted
2387
+ // Object.prototype are ignored.
2388
+ var _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2389
+ var serializeFn = utils$1.getSafeProp(_options, 'serialize');
2244
2390
  var serializedParams;
2245
2391
  if (serializeFn) {
2246
2392
  serializedParams = serializeFn(params, _options);
@@ -2338,7 +2484,9 @@
2338
2484
  silentJSONParsing: true,
2339
2485
  forcedJSONParsing: true,
2340
2486
  clarifyTimeoutError: false,
2341
- legacyInterceptorReqResOrdering: true
2487
+ legacyInterceptorReqResOrdering: true,
2488
+ advertiseZstdAcceptEncoding: false,
2489
+ validateStatusUndefinedResolves: true
2342
2490
  };
2343
2491
 
2344
2492
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2418,6 +2566,13 @@
2418
2566
  }, options));
2419
2567
  }
2420
2568
 
2569
+ var MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2570
+ function throwIfDepthExceeded(index) {
2571
+ if (index > MAX_DEPTH) {
2572
+ throw new AxiosError('FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2573
+ }
2574
+ }
2575
+
2421
2576
  /**
2422
2577
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
2423
2578
  *
@@ -2430,9 +2585,14 @@
2430
2585
  // foo.x.y.z
2431
2586
  // foo-x-y-z
2432
2587
  // foo x y z
2433
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) {
2434
- return match[0] === '[]' ? '' : match[1] || match[0];
2435
- });
2588
+ var path = [];
2589
+ var pattern = /\w+|\[(\w*)]/g;
2590
+ var match;
2591
+ while ((match = pattern.exec(name)) !== null) {
2592
+ throwIfDepthExceeded(path.length);
2593
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2594
+ }
2595
+ return path;
2436
2596
  }
2437
2597
 
2438
2598
  /**
@@ -2464,6 +2624,7 @@
2464
2624
  */
2465
2625
  function formDataToJSON(formData) {
2466
2626
  function buildPath(path, value, target, index) {
2627
+ throwIfDepthExceeded(index);
2467
2628
  var name = path[index++];
2468
2629
  if (name === '__proto__') return true;
2469
2630
  var isNumericKey = Number.isFinite(+name);
@@ -2477,7 +2638,7 @@
2477
2638
  }
2478
2639
  return !isNumericKey;
2479
2640
  }
2480
- if (!target[name] || !utils$1.isObject(target[name])) {
2641
+ if (!utils$1.hasOwnProp(target, name) || !utils$1.isObject(target[name])) {
2481
2642
  target[name] = [];
2482
2643
  }
2483
2644
  var result = buildPath(path, value, target[name], index);
@@ -2777,6 +2938,9 @@
2777
2938
  var bytesNotified = 0;
2778
2939
  var _speedometer = speedometer(50, 250);
2779
2940
  return throttle(function (e) {
2941
+ if (!e || typeof e.loaded !== 'number') {
2942
+ return;
2943
+ }
2780
2944
  var rawLoaded = e.loaded;
2781
2945
  var total = e.lengthComputable ? e.total : undefined;
2782
2946
  var loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
@@ -2861,7 +3025,11 @@
2861
3025
  var cookie = cookies[i].replace(/^\s+/, '');
2862
3026
  var eq = cookie.indexOf('=');
2863
3027
  if (eq !== -1 && cookie.slice(0, eq) === name) {
2864
- return decodeURIComponent(cookie.slice(eq + 1));
3028
+ try {
3029
+ return decodeURIComponent(cookie.slice(eq + 1));
3030
+ } catch (e) {
3031
+ return cookie.slice(eq + 1);
3032
+ }
2865
3033
  }
2866
3034
  }
2867
3035
  return null;
@@ -2908,6 +3076,24 @@
2908
3076
  return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
2909
3077
  }
2910
3078
 
3079
+ var malformedHttpProtocol = /^https?:(?!\/\/)/i;
3080
+ var httpProtocolControlCharacters = /[\t\n\r]/g;
3081
+ function stripLeadingC0ControlOrSpace(url) {
3082
+ var i = 0;
3083
+ while (i < url.length && url.charCodeAt(i) <= 0x20) {
3084
+ i++;
3085
+ }
3086
+ return url.slice(i);
3087
+ }
3088
+ function normalizeURLForProtocolCheck(url) {
3089
+ return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
3090
+ }
3091
+ function assertValidHttpProtocolURL(url, config) {
3092
+ if (typeof url === 'string' && malformedHttpProtocol.test(normalizeURLForProtocolCheck(url))) {
3093
+ throw new AxiosError('Invalid URL: missing "//" after protocol', AxiosError.ERR_INVALID_URL, config);
3094
+ }
3095
+ }
3096
+
2911
3097
  /**
2912
3098
  * Creates a new URL by combining the baseURL with the requestedURL,
2913
3099
  * only when the requestedURL is not already an absolute URL.
@@ -2918,9 +3104,11 @@
2918
3104
  *
2919
3105
  * @returns {string} The combined full path
2920
3106
  */
2921
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
3107
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
3108
+ assertValidHttpProtocolURL(requestedURL, config);
2922
3109
  var isRelativeUrl = !isAbsoluteURL(requestedURL);
2923
3110
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
3111
+ assertValidHttpProtocolURL(baseURL, config);
2924
3112
  return combineURLs(baseURL, requestedURL);
2925
3113
  }
2926
3114
  return requestedURL;
@@ -2941,6 +3129,7 @@
2941
3129
  */
2942
3130
  function mergeConfig(config1, config2) {
2943
3131
  // eslint-disable-next-line no-param-reassign
3132
+ config1 = config1 || {};
2944
3133
  config2 = config2 || {};
2945
3134
 
2946
3135
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -2992,6 +3181,23 @@
2992
3181
  return getMergedValue(undefined, a);
2993
3182
  }
2994
3183
  }
3184
+ function getMergedTransitionalOption(prop) {
3185
+ var transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
3186
+ if (!utils$1.isUndefined(transitional2)) {
3187
+ if (utils$1.isPlainObject(transitional2)) {
3188
+ if (utils$1.hasOwnProp(transitional2, prop)) {
3189
+ return transitional2[prop];
3190
+ }
3191
+ } else {
3192
+ return undefined;
3193
+ }
3194
+ }
3195
+ var transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
3196
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
3197
+ return transitional1[prop];
3198
+ }
3199
+ return undefined;
3200
+ }
2995
3201
 
2996
3202
  // eslint-disable-next-line consistent-return
2997
3203
  function mergeDirectKeys(a, b, prop) {
@@ -3043,6 +3249,13 @@
3043
3249
  var configValue = merge(a, b, prop);
3044
3250
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
3045
3251
  });
3252
+ if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption('validateStatusUndefinedResolves') === false) {
3253
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3254
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3255
+ } else {
3256
+ delete config.validateStatus;
3257
+ }
3258
+ }
3046
3259
  return config;
3047
3260
  }
3048
3261
 
@@ -3052,7 +3265,7 @@
3052
3265
  headers.set(formHeaders);
3053
3266
  return;
3054
3267
  }
3055
- Object.entries(formHeaders).forEach(function (_ref) {
3268
+ Object.entries(formHeaders || {}).forEach(function (_ref) {
3056
3269
  var _ref2 = _slicedToArray(_ref, 2),
3057
3270
  key = _ref2[0],
3058
3271
  val = _ref2[1];
@@ -3070,12 +3283,12 @@
3070
3283
  *
3071
3284
  * @returns {string} UTF-8 bytes as a Latin-1 string
3072
3285
  */
3073
- var encodeUTF8 = function encodeUTF8(str) {
3286
+ var encodeUTF8$1 = function encodeUTF8(str) {
3074
3287
  return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3075
3288
  return String.fromCharCode(parseInt(hex, 16));
3076
3289
  });
3077
3290
  };
3078
- var resolveConfig = (function (config) {
3291
+ function resolveConfig(config) {
3079
3292
  var newConfig = mergeConfig({}, config);
3080
3293
 
3081
3294
  // Read only own properties to prevent prototype pollution gadgets
@@ -3093,15 +3306,21 @@
3093
3306
  var allowAbsoluteUrls = own('allowAbsoluteUrls');
3094
3307
  var url = own('url');
3095
3308
  newConfig.headers = headers = AxiosHeaders.from(headers);
3096
- newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), config.params, config.paramsSerializer);
3309
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig), own('params'), own('paramsSerializer'));
3097
3310
 
3098
3311
  // HTTP basic authentication
3099
3312
  if (auth) {
3100
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8(auth.password) : '')));
3313
+ var username = utils$1.getSafeProp(auth, 'username') || '';
3314
+ var password = utils$1.getSafeProp(auth, 'password') || '';
3315
+ try {
3316
+ headers.set('Authorization', 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : '')));
3317
+ } catch (e) {
3318
+ throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
3319
+ }
3101
3320
  }
3102
3321
  if (utils$1.isFormData(data)) {
3103
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3104
- headers.setContentType(undefined); // browser handles it
3322
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
3323
+ headers.setContentType(undefined); // browser/web worker/RN handles it
3105
3324
  } else if (utils$1.isFunction(data.getHeaders)) {
3106
3325
  // Node.js FormData (like form-data package)
3107
3326
  setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
@@ -3129,7 +3348,7 @@
3129
3348
  }
3130
3349
  }
3131
3350
  return newConfig;
3132
- });
3351
+ }
3133
3352
 
3134
3353
  var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3135
3354
  var xhrAdapter = isXHRAdapterSupported && function (config) {
@@ -3249,7 +3468,7 @@
3249
3468
 
3250
3469
  // Add headers to the request
3251
3470
  if ('setRequestHeader' in request) {
3252
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3471
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3253
3472
  request.setRequestHeader(key, val);
3254
3473
  });
3255
3474
  }
@@ -3302,6 +3521,7 @@
3302
3521
  var protocol = parseProtocol(_config.url);
3303
3522
  if (protocol && !platform.protocols.includes(protocol)) {
3304
3523
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3524
+ done();
3305
3525
  return;
3306
3526
  }
3307
3527
 
@@ -3311,42 +3531,45 @@
3311
3531
  };
3312
3532
 
3313
3533
  var composeSignals = function composeSignals(signals, timeout) {
3314
- var _signals = signals = signals ? signals.filter(Boolean) : [],
3315
- length = _signals.length;
3316
- if (timeout || length) {
3317
- var controller = new AbortController();
3318
- var aborted;
3319
- var onabort = function onabort(reason) {
3320
- if (!aborted) {
3321
- aborted = true;
3322
- unsubscribe();
3323
- var err = reason instanceof Error ? reason : this.reason;
3324
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3325
- }
3326
- };
3327
- var timer = timeout && setTimeout(function () {
3328
- timer = null;
3329
- onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
3330
- }, timeout);
3331
- var unsubscribe = function unsubscribe() {
3332
- if (signals) {
3333
- timer && clearTimeout(timer);
3334
- timer = null;
3335
- signals.forEach(function (signal) {
3336
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3337
- });
3338
- signals = null;
3339
- }
3340
- };
3534
+ signals = signals ? signals.filter(Boolean) : [];
3535
+ if (!timeout && !signals.length) {
3536
+ return;
3537
+ }
3538
+ var controller = new AbortController();
3539
+ var aborted = false;
3540
+ var onabort = function onabort(reason) {
3541
+ if (!aborted) {
3542
+ aborted = true;
3543
+ unsubscribe();
3544
+ var err = reason instanceof Error ? reason : this.reason;
3545
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3546
+ }
3547
+ };
3548
+ var timer = timeout && setTimeout(function () {
3549
+ timer = null;
3550
+ onabort(new AxiosError("timeout of ".concat(timeout, "ms exceeded"), AxiosError.ETIMEDOUT));
3551
+ }, timeout);
3552
+ var unsubscribe = function unsubscribe() {
3553
+ if (!signals) {
3554
+ return;
3555
+ }
3556
+ timer && clearTimeout(timer);
3557
+ timer = null;
3341
3558
  signals.forEach(function (signal) {
3342
- return signal.addEventListener('abort', onabort);
3559
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3343
3560
  });
3344
- var signal = controller.signal;
3345
- signal.unsubscribe = function () {
3346
- return utils$1.asap(unsubscribe);
3347
- };
3348
- return signal;
3349
- }
3561
+ signals = null;
3562
+ };
3563
+ signals.forEach(function (signal) {
3564
+ return signal.addEventListener('abort', onabort, {
3565
+ once: true
3566
+ });
3567
+ });
3568
+ var signal = controller.signal;
3569
+ signal.unsubscribe = function () {
3570
+ return utils$1.asap(unsubscribe);
3571
+ };
3572
+ return signal;
3350
3573
  };
3351
3574
 
3352
3575
  var streamChunk = /*#__PURE__*/_regenerator().m(function streamChunk(chunk, chunkSize) {
@@ -3556,11 +3779,17 @@
3556
3779
  * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
3557
3780
  * - For base64: compute exact decoded size using length and padding;
3558
3781
  * handle %XX at the character-count level (no string allocation).
3559
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
3782
+ * - For non-base64: compute the exact percent-decoded UTF-8 byte length.
3560
3783
  *
3561
3784
  * @param {string} url
3562
3785
  * @returns {number}
3563
3786
  */
3787
+ var isHexDigit = function isHexDigit(charCode) {
3788
+ return charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
3789
+ };
3790
+ var isPercentEncodedByte = function isPercentEncodedByte(str, i, len) {
3791
+ return i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3792
+ };
3564
3793
  function estimateDataURLDecodedBytes(url) {
3565
3794
  if (!url || typeof url !== 'string') return 0;
3566
3795
  if (!url.startsWith('data:')) return 0;
@@ -3577,7 +3806,7 @@
3577
3806
  if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
3578
3807
  var a = body.charCodeAt(i + 1);
3579
3808
  var b = body.charCodeAt(i + 2);
3580
- var isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
3809
+ var isHex = isHexDigit(a) && isHexDigit(b);
3581
3810
  if (isHex) {
3582
3811
  effectiveLen -= 2;
3583
3812
  i += 2;
@@ -3614,18 +3843,18 @@
3614
3843
  var _bytes = groups * 3 - (pad || 0);
3615
3844
  return _bytes > 0 ? _bytes : 0;
3616
3845
  }
3617
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
3618
- return Buffer.byteLength(body, 'utf8');
3619
- }
3620
3846
 
3621
3847
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
3622
3848
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
3623
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
3624
- // but 3 UTF-8 bytes).
3849
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3850
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
3625
3851
  var bytes = 0;
3626
3852
  for (var _i = 0, _len = body.length; _i < _len; _i++) {
3627
3853
  var c = body.charCodeAt(_i);
3628
- if (c < 0x80) {
3854
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, _i, _len)) {
3855
+ bytes += 1;
3856
+ _i += 2;
3857
+ } else if (c < 0x80) {
3629
3858
  bytes += 1;
3630
3859
  } else if (c < 0x800) {
3631
3860
  bytes += 2;
@@ -3644,10 +3873,39 @@
3644
3873
  return bytes;
3645
3874
  }
3646
3875
 
3647
- var VERSION = "1.16.0";
3876
+ var VERSION = "1.18.1";
3648
3877
 
3649
3878
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
3650
3879
  var isFunction = utils$1.isFunction;
3880
+
3881
+ /**
3882
+ * Encode a UTF-8 string to a Latin-1 byte string for use with btoa().
3883
+ * This is a modern replacement for the deprecated unescape(encodeURIComponent(str)) pattern.
3884
+ *
3885
+ * @param {string} str The string to encode
3886
+ *
3887
+ * @returns {string} UTF-8 bytes as a Latin-1 string
3888
+ */
3889
+ var encodeUTF8 = function encodeUTF8(str) {
3890
+ return encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, function (_, hex) {
3891
+ return String.fromCharCode(parseInt(hex, 16));
3892
+ });
3893
+ };
3894
+
3895
+ // Node's WHATWG URL parser returns `username` and `password` percent-encoded.
3896
+ // Decode before composing the `auth` option so credentials such as
3897
+ // `my%40email.com:pass` are sent as `my@email.com:pass`. Falls back to the
3898
+ // original value for malformed input so a bad encoding never throws.
3899
+ var decodeURIComponentSafe = function decodeURIComponentSafe(value) {
3900
+ if (!utils$1.isString(value)) {
3901
+ return value;
3902
+ }
3903
+ try {
3904
+ return decodeURIComponent(value);
3905
+ } catch (error) {
3906
+ return value;
3907
+ }
3908
+ };
3651
3909
  var test = function test(fn) {
3652
3910
  try {
3653
3911
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -3658,9 +3916,16 @@
3658
3916
  return false;
3659
3917
  }
3660
3918
  };
3919
+ var maybeWithAuthCredentials = function maybeWithAuthCredentials(url) {
3920
+ var protocolIndex = url.indexOf('://');
3921
+ var urlToCheck = url;
3922
+ if (protocolIndex !== -1) {
3923
+ urlToCheck = urlToCheck.slice(protocolIndex + 3);
3924
+ }
3925
+ return urlToCheck.includes('@') || urlToCheck.includes(':');
3926
+ };
3661
3927
  var factory = function factory(env) {
3662
- var _utils$global;
3663
- var globalObject = (_utils$global = utils$1.global) !== null && _utils$global !== void 0 ? _utils$global : globalThis;
3928
+ var globalObject = utils$1.global !== undefined && utils$1.global !== null ? utils$1.global : globalThis;
3664
3929
  var ReadableStream = globalObject.ReadableStream,
3665
3930
  TextEncoder = globalObject.TextEncoder;
3666
3931
  env = utils$1.merge.call({
@@ -3812,13 +4077,16 @@
3812
4077
  }();
3813
4078
  return /*#__PURE__*/function () {
3814
4079
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
3815
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, _fetch, composedSignal, request, unsubscribe, requestContentLength, estimated, outboundLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, declaredLength, isStreamResponse, options, responseContentLength, _ref5, _ref6, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, _t3, _t4, _t5;
4080
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, networkError, _t3, _t4;
3816
4081
  return _regenerator().w(function (_context4) {
3817
4082
  while (1) switch (_context4.p = _context4.n) {
3818
4083
  case 0:
3819
4084
  _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
3820
4085
  hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
3821
4086
  hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
4087
+ own = function own(key) {
4088
+ return utils$1.hasOwnProp(config, key) ? config[key] : undefined;
4089
+ };
3822
4090
  _fetch = envFetch || fetch;
3823
4091
  responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3824
4092
  composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
@@ -3826,7 +4094,50 @@
3826
4094
  unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
3827
4095
  composedSignal.unsubscribe();
3828
4096
  };
4097
+ // AxiosError we raise while the request body is being streamed. Captured
4098
+ // by identity so the catch block can surface it directly, regardless of
4099
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
4100
+ // as `err.cause`; some browsers drop the original error entirely).
4101
+ pendingBodyError = null;
4102
+ maxBodyLengthError = function maxBodyLengthError() {
4103
+ return new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4104
+ };
3829
4105
  _context4.p = 1;
4106
+ // HTTP basic authentication
4107
+ auth = undefined;
4108
+ configAuth = own('auth');
4109
+ if (configAuth) {
4110
+ username = utils$1.getSafeProp(configAuth, 'username') || '';
4111
+ password = utils$1.getSafeProp(configAuth, 'password') || '';
4112
+ auth = {
4113
+ username: username,
4114
+ password: password
4115
+ };
4116
+ }
4117
+ if (maybeWithAuthCredentials(url)) {
4118
+ parsedURL = new URL(url, platform.origin);
4119
+ if (!auth && (parsedURL.username || parsedURL.password)) {
4120
+ urlUsername = decodeURIComponentSafe(parsedURL.username);
4121
+ urlPassword = decodeURIComponentSafe(parsedURL.password);
4122
+ auth = {
4123
+ username: urlUsername,
4124
+ password: urlPassword
4125
+ };
4126
+ }
4127
+ if (parsedURL.username || parsedURL.password) {
4128
+ parsedURL.username = '';
4129
+ parsedURL.password = '';
4130
+ url = parsedURL.href;
4131
+ }
4132
+ }
4133
+ if (auth) {
4134
+ headers["delete"]('authorization');
4135
+ headers.set('Authorization', 'Basic ' + btoa(encodeUTF8((auth.username || '') + ':' + (auth.password || ''))));
4136
+ }
4137
+
4138
+ // Enforce maxContentLength for data: URLs up-front so we never materialize
4139
+ // an oversized payload. The HTTP adapter applies the same check (see http.js
4140
+ // "if (protocol === 'data:')" branch).
3830
4141
  if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
3831
4142
  _context4.n = 2;
3832
4143
  break;
@@ -3843,43 +4154,82 @@
3843
4154
  break;
3844
4155
  }
3845
4156
  _context4.n = 3;
3846
- return resolveBodyLength(headers, data);
4157
+ return getBodyLength(data);
3847
4158
  case 3:
3848
4159
  outboundLength = _context4.v;
3849
- if (!(typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength)) {
4160
+ if (!(typeof outboundLength === 'number' && isFinite(outboundLength))) {
4161
+ _context4.n = 4;
4162
+ break;
4163
+ }
4164
+ requestContentLength = outboundLength;
4165
+ if (!(outboundLength > maxBodyLength)) {
3850
4166
  _context4.n = 4;
3851
4167
  break;
3852
4168
  }
3853
- throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4169
+ throw maxBodyLengthError();
3854
4170
  case 4:
3855
- _t3 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
3856
- if (!_t3) {
4171
+ // A streamed body under maxBodyLength must be counted as fetch consumes
4172
+ // it; its size is never trusted from a caller-declared Content-Length.
4173
+ mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
4174
+ trackRequestStream = function trackRequestStream(stream, onProgress, flush) {
4175
+ return trackStream(stream, DEFAULT_CHUNK_SIZE, function (loadedBytes) {
4176
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
4177
+ throw pendingBodyError = maxBodyLengthError();
4178
+ }
4179
+ onProgress && onProgress(loadedBytes);
4180
+ }, flush);
4181
+ };
4182
+ if (!(supportsRequestStream && method !== 'get' && method !== 'head' && (onUploadProgress || mustEnforceStreamBody))) {
4183
+ _context4.n = 8;
4184
+ break;
4185
+ }
4186
+ if (!(requestContentLength == null)) {
3857
4187
  _context4.n = 6;
3858
4188
  break;
3859
4189
  }
3860
4190
  _context4.n = 5;
3861
4191
  return resolveBodyLength(headers, data);
3862
4192
  case 5:
3863
- _t4 = requestContentLength = _context4.v;
3864
- _t3 = _t4 !== 0;
4193
+ _t3 = _context4.v;
4194
+ _context4.n = 7;
4195
+ break;
3865
4196
  case 6:
3866
- if (!_t3) {
3867
- _context4.n = 7;
3868
- break;
4197
+ _t3 = requestContentLength;
4198
+ case 7:
4199
+ requestContentLength = _t3;
4200
+ // A declared length of 0 is only trusted to skip the wrap when we are
4201
+ // not enforcing a stream limit (which must not rely on that header).
4202
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
4203
+ _request = new Request(url, {
4204
+ method: 'POST',
4205
+ body: data,
4206
+ duplex: 'half'
4207
+ });
4208
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
4209
+ headers.setContentType(contentTypeHeader);
4210
+ }
4211
+ if (_request.body) {
4212
+ _ref5 = onUploadProgress && progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))) || [], _ref6 = _slicedToArray(_ref5, 2), onProgress = _ref6[0], flush = _ref6[1];
4213
+ data = trackRequestStream(_request.body, onProgress, flush);
4214
+ }
3869
4215
  }
3870
- _request = new Request(url, {
3871
- method: 'POST',
3872
- body: data,
3873
- duplex: 'half'
3874
- });
3875
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3876
- headers.setContentType(contentTypeHeader);
4216
+ _context4.n = 10;
4217
+ break;
4218
+ case 8:
4219
+ if (!(mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== 'get' && method !== 'head')) {
4220
+ _context4.n = 9;
4221
+ break;
3877
4222
  }
3878
- if (_request.body) {
3879
- _progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
3880
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
4223
+ data = trackRequestStream(data);
4224
+ _context4.n = 10;
4225
+ break;
4226
+ case 9:
4227
+ if (!(mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== 'get' && method !== 'head')) {
4228
+ _context4.n = 10;
4229
+ break;
3881
4230
  }
3882
- case 7:
4231
+ throw new AxiosError('Stream request bodies are not supported by the current fetch implementation', AxiosError.ERR_NOT_SUPPORT, config, request);
4232
+ case 10:
3883
4233
  if (!utils$1.isString(withCredentials)) {
3884
4234
  withCredentials = withCredentials ? 'include' : 'omit';
3885
4235
  }
@@ -3900,35 +4250,37 @@
3900
4250
  resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
3901
4251
  signal: composedSignal,
3902
4252
  method: method.toUpperCase(),
3903
- headers: headers.normalize().toJSON(),
4253
+ headers: toByteStringHeaderObject(headers.normalize()),
3904
4254
  body: data,
3905
4255
  duplex: 'half',
3906
4256
  credentials: isCredentialsSupported ? withCredentials : undefined
3907
4257
  });
3908
4258
  request = isRequestSupported && new Request(url, resolvedOptions);
3909
- _context4.n = 8;
4259
+ _context4.n = 11;
3910
4260
  return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
3911
- case 8:
4261
+ case 11:
3912
4262
  response = _context4.v;
4263
+ responseHeaders = AxiosHeaders.from(response.headers); // Cheap pre-check: if the server honestly declares a content-length that
4264
+ // already exceeds the cap, reject before we start streaming.
3913
4265
  if (!hasMaxContentLength) {
3914
- _context4.n = 9;
4266
+ _context4.n = 12;
3915
4267
  break;
3916
4268
  }
3917
- declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4269
+ declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
3918
4270
  if (!(declaredLength != null && declaredLength > maxContentLength)) {
3919
- _context4.n = 9;
4271
+ _context4.n = 12;
3920
4272
  break;
3921
4273
  }
3922
4274
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3923
- case 9:
4275
+ case 12:
3924
4276
  isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
3925
4277
  if (supportsResponseStream && response.body && (onDownloadProgress || hasMaxContentLength || isStreamResponse && unsubscribe)) {
3926
4278
  options = {};
3927
4279
  ['status', 'statusText', 'headers'].forEach(function (prop) {
3928
4280
  options[prop] = response[prop];
3929
4281
  });
3930
- responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
3931
- _ref5 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref6 = _slicedToArray(_ref5, 2), _onProgress = _ref6[0], _flush = _ref6[1];
4282
+ responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
4283
+ _ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
3932
4284
  bytesRead = 0;
3933
4285
  onChunkProgress = function onChunkProgress(loadedBytes) {
3934
4286
  if (hasMaxContentLength) {
@@ -3945,12 +4297,12 @@
3945
4297
  }), options);
3946
4298
  }
3947
4299
  responseType = responseType || 'text';
3948
- _context4.n = 10;
4300
+ _context4.n = 13;
3949
4301
  return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
3950
- case 10:
4302
+ case 13:
3951
4303
  responseData = _context4.v;
3952
4304
  if (!(hasMaxContentLength && !supportsResponseStream && !isStreamResponse)) {
3953
- _context4.n = 11;
4305
+ _context4.n = 14;
3954
4306
  break;
3955
4307
  }
3956
4308
  if (responseData != null) {
@@ -3963,13 +4315,13 @@
3963
4315
  }
3964
4316
  }
3965
4317
  if (!(typeof materializedSize === 'number' && materializedSize > maxContentLength)) {
3966
- _context4.n = 11;
4318
+ _context4.n = 14;
3967
4319
  break;
3968
4320
  }
3969
4321
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
3970
- case 11:
4322
+ case 14:
3971
4323
  !isStreamResponse && unsubscribe && unsubscribe();
3972
- _context4.n = 12;
4324
+ _context4.n = 15;
3973
4325
  return new Promise(function (resolve, reject) {
3974
4326
  settle(resolve, reject, {
3975
4327
  data: responseData,
@@ -3980,39 +4332,70 @@
3980
4332
  request: request
3981
4333
  });
3982
4334
  });
3983
- case 12:
4335
+ case 15:
3984
4336
  return _context4.a(2, _context4.v);
3985
- case 13:
3986
- _context4.p = 13;
3987
- _t5 = _context4.v;
4337
+ case 16:
4338
+ _context4.p = 16;
4339
+ _t4 = _context4.v;
3988
4340
  unsubscribe && unsubscribe();
3989
4341
 
3990
4342
  // Safari can surface fetch aborts as a DOMException-like object whose
3991
4343
  // branded getters throw. Prefer our composed signal reason before reading
3992
4344
  // the caught error, preserving timeout vs cancellation semantics.
3993
4345
  if (!(composedSignal && composedSignal.aborted && composedSignal.reason instanceof AxiosError)) {
3994
- _context4.n = 14;
4346
+ _context4.n = 17;
3995
4347
  break;
3996
4348
  }
3997
4349
  canceledError = composedSignal.reason;
3998
4350
  canceledError.config = config;
3999
4351
  request && (canceledError.request = request);
4000
- _t5 !== canceledError && (canceledError.cause = _t5);
4352
+ if (_t4 !== canceledError) {
4353
+ // Non-enumerable to match native Error `cause` semantics so loggers
4354
+ // don't recurse into circular fetch internals (see #7205).
4355
+ Object.defineProperty(canceledError, 'cause', {
4356
+ __proto__: null,
4357
+ value: _t4,
4358
+ writable: true,
4359
+ enumerable: false,
4360
+ configurable: true
4361
+ });
4362
+ }
4001
4363
  throw canceledError;
4002
- case 14:
4003
- if (!(_t5 && _t5.name === 'TypeError' && /Load failed|fetch/i.test(_t5.message))) {
4004
- _context4.n = 15;
4364
+ case 17:
4365
+ if (!pendingBodyError) {
4366
+ _context4.n = 18;
4367
+ break;
4368
+ }
4369
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
4370
+ throw pendingBodyError;
4371
+ case 18:
4372
+ if (!(_t4 instanceof AxiosError)) {
4373
+ _context4.n = 19;
4005
4374
  break;
4006
4375
  }
4007
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t5 && _t5.response), {
4008
- cause: _t5.cause || _t5
4376
+ request && !_t4.request && (_t4.request = request);
4377
+ throw _t4;
4378
+ case 19:
4379
+ if (!(_t4 && _t4.name === 'TypeError' && /Load failed|fetch/i.test(_t4.message))) {
4380
+ _context4.n = 20;
4381
+ break;
4382
+ }
4383
+ networkError = new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t4 && _t4.response); // Non-enumerable to match native Error `cause` semantics so loggers
4384
+ // don't recurse into circular fetch internals (see #7205).
4385
+ Object.defineProperty(networkError, 'cause', {
4386
+ __proto__: null,
4387
+ value: _t4.cause || _t4,
4388
+ writable: true,
4389
+ enumerable: false,
4390
+ configurable: true
4009
4391
  });
4010
- case 15:
4011
- throw AxiosError.from(_t5, _t5 && _t5.code, config, request, _t5 && _t5.response);
4012
- case 16:
4392
+ throw networkError;
4393
+ case 20:
4394
+ throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
4395
+ case 21:
4013
4396
  return _context4.a(2);
4014
4397
  }
4015
- }, _callee4, null, [[1, 13]]);
4398
+ }, _callee4, null, [[1, 16]]);
4016
4399
  }));
4017
4400
  return function (_x5) {
4018
4401
  return _ref4.apply(this, arguments);
@@ -4138,7 +4521,7 @@
4138
4521
  return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build');
4139
4522
  });
4140
4523
  var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
4141
- throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT');
4524
+ throw new AxiosError("There is no suitable adapter to dispatch the request " + s, AxiosError.ERR_NOT_SUPPORT);
4142
4525
  }
4143
4526
  return adapter;
4144
4527
  }
@@ -4281,7 +4664,7 @@
4281
4664
  */
4282
4665
 
4283
4666
  function assertOptions(options, schema, allowUnknown) {
4284
- if (_typeof(options) !== 'object') {
4667
+ if (_typeof(options) !== 'object' || options === null) {
4285
4668
  throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
4286
4669
  }
4287
4670
  var keys = Object.keys(options);
@@ -4412,7 +4795,9 @@
4412
4795
  silentJSONParsing: validators.transitional(validators["boolean"]),
4413
4796
  forcedJSONParsing: validators.transitional(validators["boolean"]),
4414
4797
  clarifyTimeoutError: validators.transitional(validators["boolean"]),
4415
- legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"])
4798
+ legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"]),
4799
+ advertiseZstdAcceptEncoding: validators.transitional(validators["boolean"]),
4800
+ validateStatusUndefinedResolves: validators.transitional(validators["boolean"])
4416
4801
  }, false);
4417
4802
  }
4418
4803
  if (paramsSerializer != null) {
@@ -4511,7 +4896,7 @@
4511
4896
  key: "getUri",
4512
4897
  value: function getUri(config) {
4513
4898
  config = mergeConfig(this.defaults, config);
4514
- var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4899
+ var fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
4515
4900
  return buildURL(fullPath, config.params, config.paramsSerializer);
4516
4901
  }
4517
4902
  }]);
@@ -4522,7 +4907,7 @@
4522
4907
  return this.request(mergeConfig(config || {}, {
4523
4908
  method: method,
4524
4909
  url: url,
4525
- data: (config || {}).data
4910
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
4526
4911
  }));
4527
4912
  };
4528
4913
  });