@mindstone/mcp-server-xero 0.1.3 → 0.1.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 (1072) hide show
  1. package/dist/auth/token-grant.js +10 -8
  2. package/dist/bridge-reader.js +35 -78
  3. package/dist/clients/sdk-axios.js +30 -0
  4. package/dist/clients/xero-client.js +14 -8
  5. package/dist/handlers/create-xero-bank-transaction.handler.js +2 -1
  6. package/dist/handlers/create-xero-contact.handler.js +2 -1
  7. package/dist/handlers/create-xero-credit-note.handler.js +2 -1
  8. package/dist/handlers/create-xero-invoice.handler.js +2 -1
  9. package/dist/handlers/create-xero-manual-journal.handler.js +2 -1
  10. package/dist/handlers/create-xero-payment.handler.js +2 -1
  11. package/dist/handlers/create-xero-purchase-order.handler.js +2 -1
  12. package/dist/handlers/create-xero-quote.handler.js +2 -1
  13. package/dist/handlers/create-xero-tracking-category.handler.js +2 -1
  14. package/dist/handlers/history-handler-factory.js +2 -1
  15. package/dist/handlers/list-xero-organisation-details.handler.js +2 -1
  16. package/dist/handlers/list-xero-payroll-employee-leave-balances.handler.js +2 -1
  17. package/dist/handlers/list-xero-payroll-employee-leave-types.handler.js +2 -1
  18. package/dist/handlers/list-xero-payroll-employee-leave.handler.js +2 -1
  19. package/dist/handlers/list-xero-payroll-leave-periods.handler.js +2 -1
  20. package/dist/handlers/list-xero-profit-and-loss.handler.js +1 -1
  21. package/dist/handlers/update-xero-bank-transaction.handler.js +3 -2
  22. package/dist/handlers/update-xero-contact.handler.js +2 -1
  23. package/dist/handlers/update-xero-credit-note.handler.js +2 -1
  24. package/dist/handlers/update-xero-invoice.handler.js +2 -1
  25. package/dist/handlers/update-xero-manual-journal.handler.js +2 -1
  26. package/dist/handlers/update-xero-quote.handler.js +2 -1
  27. package/dist/handlers/update-xero-tracking-category.handler.js +3 -2
  28. package/dist/handlers/update-xero-tracking-options.handler.js +3 -2
  29. package/dist/hardened-json-file.js +91 -0
  30. package/dist/helpers/connector-error.js +11 -0
  31. package/dist/helpers/format-error.js +41 -14
  32. package/dist/helpers/format-token-error.js +4 -0
  33. package/dist/helpers/xero-currencies.js +2 -1
  34. package/dist/tools/sign-in.tool.js +1 -1
  35. package/node_modules/@hono/node-server/README.md +118 -26
  36. package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
  37. package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
  38. package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
  39. package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
  40. package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
  41. package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
  42. package/node_modules/@hono/node-server/dist/early-hints.cjs +35 -0
  43. package/node_modules/@hono/node-server/dist/early-hints.d.cts +16 -0
  44. package/node_modules/@hono/node-server/dist/early-hints.d.mts +16 -0
  45. package/node_modules/@hono/node-server/dist/early-hints.mjs +33 -0
  46. package/node_modules/@hono/node-server/dist/index.cjs +1365 -0
  47. package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
  48. package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
  49. package/node_modules/@hono/node-server/dist/index.mjs +1335 -637
  50. package/node_modules/@hono/node-server/dist/serve-static.cjs +153 -0
  51. package/node_modules/@hono/node-server/dist/serve-static.d.cts +19 -0
  52. package/node_modules/@hono/node-server/dist/serve-static.d.mts +15 -13
  53. package/node_modules/@hono/node-server/dist/serve-static.mjs +145 -145
  54. package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
  55. package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
  56. package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
  57. package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
  58. package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
  59. package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
  60. package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
  61. package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
  62. package/node_modules/@hono/node-server/package.json +80 -55
  63. package/node_modules/@modelcontextprotocol/sdk/README.md +8 -2
  64. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts +43 -2
  65. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts.map +1 -1
  66. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js +26 -5
  67. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js.map +1 -1
  68. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts +26 -4
  69. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts.map +1 -1
  70. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js +127 -24
  71. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js.map +1 -1
  72. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
  73. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
  74. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
  75. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts +13 -0
  76. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.d.ts.map +1 -1
  77. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js +17 -4
  78. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/sse.js.map +1 -1
  79. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
  80. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
  81. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
  82. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
  83. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts +13 -0
  84. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  85. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +28 -13
  86. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
  87. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts +1 -0
  88. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts.map +1 -1
  89. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js +11 -2
  90. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js.map +1 -1
  91. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
  92. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  93. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js +63 -20
  94. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationFormExample.js.map +1 -1
  95. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js +71 -29
  96. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/elicitationUrlExample.js.map +1 -1
  97. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js +45 -6
  98. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  99. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js +71 -31
  100. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleStreamableHttp.js.map +1 -1
  101. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js +61 -18
  102. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/simpleTaskInteractive.js.map +1 -1
  103. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
  104. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  105. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js +64 -17
  106. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/ssePollingExample.js.map +1 -1
  107. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
  108. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  109. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts +4 -0
  110. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.d.ts.map +1 -1
  111. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/interfaces.js.map +1 -1
  112. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts +17 -8
  113. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.d.ts.map +1 -1
  114. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js +31 -14
  115. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/experimental/tasks/stores/in-memory.js.map +1 -1
  116. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts +9 -1
  117. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  118. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js +17 -1
  119. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/middleware/bearerAuth.js.map +1 -1
  120. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -1
  121. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js +6 -3
  122. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
  123. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.d.ts.map +1 -1
  124. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js +3 -1
  125. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/express.js.map +1 -1
  126. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
  127. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
  128. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
  129. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts +12 -1
  130. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.d.ts.map +1 -1
  131. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js +56 -2
  132. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/mcp.js.map +1 -1
  133. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts +25 -0
  134. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.d.ts.map +1 -0
  135. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js +64 -0
  136. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/requestBody.js.map +1 -0
  137. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
  138. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
  139. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
  140. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
  141. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
  142. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
  143. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
  144. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
  145. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +31 -1
  146. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
  147. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +252 -42
  148. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
  149. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
  150. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
  151. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
  152. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts +3 -0
  153. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map +1 -1
  154. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js +12 -2
  155. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map +1 -1
  156. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
  157. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
  158. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
  159. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
  160. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts +1 -0
  161. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.d.ts.map +1 -1
  162. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js +39 -9
  163. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/protocol.js.map +1 -1
  164. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
  165. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
  166. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
  167. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
  168. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts +18 -8
  169. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.d.ts.map +1 -1
  170. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js +77 -0
  171. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/transport.js.map +1 -1
  172. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts +43 -2
  173. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts.map +1 -1
  174. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js +26 -5
  175. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js.map +1 -1
  176. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts +26 -4
  177. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts.map +1 -1
  178. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +127 -24
  179. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
  180. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
  181. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
  182. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
  183. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts +13 -0
  184. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.d.ts.map +1 -1
  185. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js +18 -5
  186. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js.map +1 -1
  187. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
  188. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
  189. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
  190. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
  191. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts +13 -0
  192. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
  193. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +29 -14
  194. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
  195. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts +1 -0
  196. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts.map +1 -1
  197. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js +11 -2
  198. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js.map +1 -1
  199. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
  200. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
  201. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js +63 -20
  202. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationFormExample.js.map +1 -1
  203. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js +71 -29
  204. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/elicitationUrlExample.js.map +1 -1
  205. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js +45 -6
  206. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/jsonResponseStreamableHttp.js.map +1 -1
  207. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js +71 -31
  208. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleStreamableHttp.js.map +1 -1
  209. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js +61 -18
  210. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/simpleTaskInteractive.js.map +1 -1
  211. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js +57 -19
  212. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/sseAndStreamableHttpCompatibleServer.js.map +1 -1
  213. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js +64 -17
  214. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/ssePollingExample.js.map +1 -1
  215. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js +61 -13
  216. package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/standaloneSseWithGetStreamableHttp.js.map +1 -1
  217. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts +4 -0
  218. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map +1 -1
  219. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -1
  220. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts +17 -8
  221. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map +1 -1
  222. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js +31 -14
  223. package/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map +1 -1
  224. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts +9 -1
  225. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map +1 -1
  226. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js +17 -1
  227. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map +1 -1
  228. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -1
  229. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js +6 -3
  230. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
  231. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map +1 -1
  232. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js +3 -1
  233. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map +1 -1
  234. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
  235. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
  236. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
  237. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts +12 -1
  238. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map +1 -1
  239. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +56 -2
  240. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -1
  241. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts +25 -0
  242. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.d.ts.map +1 -0
  243. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js +58 -0
  244. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/requestBody.js.map +1 -0
  245. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
  246. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
  247. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
  248. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
  249. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
  250. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
  251. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
  252. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
  253. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +31 -1
  254. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
  255. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +252 -42
  256. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
  257. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
  258. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
  259. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
  260. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts +3 -0
  261. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map +1 -1
  262. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +12 -2
  263. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
  264. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
  265. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
  266. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
  267. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
  268. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts +1 -0
  269. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map +1 -1
  270. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +39 -9
  271. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -1
  272. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
  273. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
  274. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
  275. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
  276. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts +18 -8
  277. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map +1 -1
  278. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js +72 -0
  279. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map +1 -1
  280. package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
  281. package/node_modules/axios/CHANGELOG.md +214 -1
  282. package/node_modules/axios/README.md +471 -82
  283. package/node_modules/axios/dist/axios.js +2009 -516
  284. package/node_modules/axios/dist/axios.min.js +3 -3
  285. package/node_modules/axios/dist/axios.min.js.map +1 -1
  286. package/node_modules/axios/dist/browser/axios.cjs +2174 -487
  287. package/node_modules/axios/dist/esm/axios.js +2174 -487
  288. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  289. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  290. package/node_modules/axios/dist/node/axios.cjs +2410 -515
  291. package/node_modules/axios/index.d.cts +150 -75
  292. package/node_modules/axios/index.d.ts +144 -69
  293. package/node_modules/axios/lib/adapters/adapters.js +1 -1
  294. package/node_modules/axios/lib/adapters/fetch.js +272 -75
  295. package/node_modules/axios/lib/adapters/http.js +475 -122
  296. package/node_modules/axios/lib/adapters/xhr.js +173 -16
  297. package/node_modules/axios/lib/core/Axios.js +114 -35
  298. package/node_modules/axios/lib/core/AxiosError.js +105 -3
  299. package/node_modules/axios/lib/core/AxiosHeaders.js +151 -12
  300. package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
  301. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  302. package/node_modules/axios/lib/core/buildFullPath.js +55 -1
  303. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  304. package/node_modules/axios/lib/core/dispatchRequest.js +45 -2
  305. package/node_modules/axios/lib/core/mergeConfig.js +203 -90
  306. package/node_modules/axios/lib/core/methodList.js +17 -0
  307. package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  308. package/node_modules/axios/lib/defaults/index.js +2 -1
  309. package/node_modules/axios/lib/defaults/transitional.js +2 -0
  310. package/node_modules/axios/lib/env/data.js +1 -1
  311. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
  312. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -3
  313. package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
  314. package/node_modules/axios/lib/helpers/HttpStatusCode.js +12 -1
  315. package/node_modules/axios/lib/helpers/buildURL.js +6 -3
  316. package/node_modules/axios/lib/helpers/combineURLs.js +11 -3
  317. package/node_modules/axios/lib/helpers/composeSignals.js +18 -4
  318. package/node_modules/axios/lib/helpers/cookies.js +30 -2
  319. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +156 -63
  320. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  321. package/node_modules/axios/lib/helpers/formDataToJSON.js +60 -8
  322. package/node_modules/axios/lib/helpers/fromDataURI.js +12 -3
  323. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
  324. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  325. package/node_modules/axios/lib/helpers/parseHeaders.js +7 -4
  326. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  327. package/node_modules/axios/lib/helpers/progressEventReducer.js +4 -4
  328. package/node_modules/axios/lib/helpers/resolveConfig.js +33 -25
  329. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +345 -3
  330. package/node_modules/axios/lib/helpers/throttle.js +3 -2
  331. package/node_modules/axios/lib/helpers/toFormData.js +60 -30
  332. package/node_modules/axios/lib/helpers/validator.js +1 -1
  333. package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  334. package/node_modules/axios/lib/utils.js +271 -23
  335. package/node_modules/axios/package.json +31 -30
  336. package/node_modules/body-parser/README.md +33 -14
  337. package/node_modules/body-parser/index.js +4 -20
  338. package/node_modules/body-parser/lib/read.js +85 -68
  339. package/node_modules/body-parser/lib/types/json.js +67 -39
  340. package/node_modules/body-parser/lib/types/raw.js +3 -3
  341. package/node_modules/body-parser/lib/types/text.js +3 -3
  342. package/node_modules/body-parser/lib/types/urlencoded.js +21 -25
  343. package/node_modules/body-parser/lib/utils.js +14 -27
  344. package/node_modules/body-parser/node_modules/content-type/LICENSE +22 -0
  345. package/node_modules/body-parser/node_modules/content-type/README.md +71 -0
  346. package/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +46 -0
  347. package/node_modules/body-parser/node_modules/content-type/dist/index.js +176 -0
  348. package/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -0
  349. package/node_modules/body-parser/node_modules/content-type/package.json +52 -0
  350. package/node_modules/body-parser/package.json +24 -16
  351. package/node_modules/es-object-atoms/CHANGELOG.md +21 -14
  352. package/node_modules/es-object-atoms/isObject.d.ts +1 -1
  353. package/node_modules/es-object-atoms/package.json +6 -7
  354. package/node_modules/es-object-atoms/tsconfig.json +1 -0
  355. package/node_modules/express-rate-limit/dist/index.cjs +90 -12
  356. package/node_modules/express-rate-limit/dist/index.d.cts +27 -0
  357. package/node_modules/express-rate-limit/dist/index.d.mts +27 -0
  358. package/node_modules/express-rate-limit/dist/index.d.ts +27 -0
  359. package/node_modules/express-rate-limit/dist/index.mjs +76 -12
  360. package/node_modules/express-rate-limit/{license.md → license} +7 -6
  361. package/node_modules/express-rate-limit/package.json +19 -16
  362. package/node_modules/express-rate-limit/readme.md +1 -0
  363. package/node_modules/fast-uri/.github/workflows/release.yml +35 -0
  364. package/node_modules/fast-uri/README.md +8 -0
  365. package/node_modules/fast-uri/index.js +355 -50
  366. package/node_modules/fast-uri/lib/schemes.js +9 -4
  367. package/node_modules/fast-uri/lib/utils.js +448 -92
  368. package/node_modules/fast-uri/package.json +1 -1
  369. package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
  370. package/node_modules/fast-uri/test/equal.test.js +31 -3
  371. package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
  372. package/node_modules/fast-uri/test/host-delimiter-security.test.js +94 -0
  373. package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
  374. package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
  375. package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
  376. package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
  377. package/node_modules/fast-uri/test/parse.test.js +7 -3
  378. package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
  379. package/node_modules/fast-uri/test/relative-normalization-security.test.js +156 -0
  380. package/node_modules/fast-uri/test/reserved-path-normalization.test.js +137 -0
  381. package/node_modules/fast-uri/test/scheme-validation.test.js +163 -0
  382. package/node_modules/fast-uri/test/security-normalization.test.js +139 -0
  383. package/node_modules/fast-uri/test/security.test.js +301 -3
  384. package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
  385. package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
  386. package/node_modules/follow-redirects/README.md +27 -1
  387. package/node_modules/follow-redirects/index.js +12 -6
  388. package/node_modules/follow-redirects/package.json +1 -1
  389. package/node_modules/form-data/CHANGELOG.md +29 -2
  390. package/node_modules/form-data/README.md +4 -4
  391. package/node_modules/form-data/lib/form_data.js +14 -2
  392. package/node_modules/form-data/package.json +7 -7
  393. package/node_modules/hasown/CHANGELOG.md +18 -0
  394. package/node_modules/hasown/eslint.config.mjs +6 -0
  395. package/node_modules/hasown/package.json +13 -14
  396. package/node_modules/hono/README.md +2 -3
  397. package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
  398. package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
  399. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +320 -351
  400. package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
  401. package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
  402. package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
  403. package/node_modules/hono/dist/adapter/bun/index.js +3 -13
  404. package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
  405. package/node_modules/hono/dist/adapter/bun/server.js +11 -5
  406. package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
  407. package/node_modules/hono/dist/adapter/bun/websocket.js +61 -66
  408. package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
  409. package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
  410. package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
  411. package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
  412. package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
  413. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
  414. package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
  415. package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
  416. package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
  417. package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
  418. package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
  419. package/node_modules/hono/dist/adapter/deno/index.js +3 -10
  420. package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
  421. package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
  422. package/node_modules/hono/dist/adapter/deno/websocket.js +30 -30
  423. package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
  424. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -71
  425. package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
  426. package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
  427. package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
  428. package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
  429. package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
  430. package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
  431. package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
  432. package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
  433. package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
  434. package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
  435. package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
  436. package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
  437. package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
  438. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +328 -380
  439. package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
  440. package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
  441. package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
  442. package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
  443. package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +29 -50
  444. package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
  445. package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
  446. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -89
  447. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
  448. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
  449. package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
  450. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
  451. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
  452. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
  453. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +27 -42
  454. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
  455. package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
  456. package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
  457. package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
  458. package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +33 -59
  459. package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
  460. package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
  461. package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
  462. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +105 -103
  463. package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
  464. package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
  465. package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
  466. package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
  467. package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
  468. package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
  469. package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
  470. package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
  471. package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
  472. package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
  473. package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
  474. package/node_modules/hono/dist/cjs/client/client.js +140 -190
  475. package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
  476. package/node_modules/hono/dist/cjs/client/index.js +7 -32
  477. package/node_modules/hono/dist/cjs/client/types.js +0 -15
  478. package/node_modules/hono/dist/cjs/client/utils.js +54 -89
  479. package/node_modules/hono/dist/cjs/compose.js +49 -66
  480. package/node_modules/hono/dist/cjs/context.js +379 -431
  481. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +50 -38
  482. package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
  483. package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
  484. package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
  485. package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
  486. package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
  487. package/node_modules/hono/dist/cjs/helper/css/common.js +167 -241
  488. package/node_modules/hono/dist/cjs/helper/css/index.js +136 -143
  489. package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
  490. package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
  491. package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
  492. package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -102
  493. package/node_modules/hono/dist/cjs/helper/route/index.js +125 -66
  494. package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
  495. package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
  496. package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
  497. package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +200 -298
  498. package/node_modules/hono/dist/cjs/helper/ssg/utils.js +53 -76
  499. package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
  500. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -84
  501. package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
  502. package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
  503. package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
  504. package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
  505. package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
  506. package/node_modules/hono/dist/cjs/hono-base.js +346 -401
  507. package/node_modules/hono/dist/cjs/hono.js +27 -42
  508. package/node_modules/hono/dist/cjs/http-exception.js +55 -56
  509. package/node_modules/hono/dist/cjs/index.js +22 -30
  510. package/node_modules/hono/dist/cjs/jsx/base.js +264 -359
  511. package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
  512. package/node_modules/hono/dist/cjs/jsx/components.js +120 -174
  513. package/node_modules/hono/dist/cjs/jsx/constants.js +17 -42
  514. package/node_modules/hono/dist/cjs/jsx/context.js +166 -58
  515. package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
  516. package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
  517. package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
  518. package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
  519. package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
  520. package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
  521. package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
  522. package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
  523. package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
  524. package/node_modules/hono/dist/cjs/jsx/dom/render.js +471 -587
  525. package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -60
  526. package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
  527. package/node_modules/hono/dist/cjs/jsx/hooks/index.js +227 -317
  528. package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
  529. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
  530. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
  531. package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
  532. package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
  533. package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +29 -67
  534. package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -165
  535. package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
  536. package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
  537. package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
  538. package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +100 -109
  539. package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +65 -72
  540. package/node_modules/hono/dist/cjs/middleware/cache/index.js +166 -117
  541. package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
  542. package/node_modules/hono/dist/cjs/middleware/compress/index.js +74 -83
  543. package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
  544. package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
  545. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +103 -74
  546. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -51
  547. package/node_modules/hono/dist/cjs/middleware/etag/index.js +73 -87
  548. package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +161 -169
  549. package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
  550. package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
  551. package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -130
  552. package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
  553. package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -136
  554. package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
  555. package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -197
  556. package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
  557. package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +84 -0
  558. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -100
  559. package/node_modules/hono/dist/cjs/middleware/mount/index.js +72 -0
  560. package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
  561. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +40 -35
  562. package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
  563. package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
  564. package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
  565. package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
  566. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +143 -166
  567. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +58 -93
  568. package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
  569. package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
  570. package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
  571. package/node_modules/hono/dist/cjs/middleware/timing/timing.js +178 -116
  572. package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
  573. package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
  574. package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
  575. package/node_modules/hono/dist/cjs/request/constants.js +5 -27
  576. package/node_modules/hono/dist/cjs/request.js +334 -336
  577. package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
  578. package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -138
  579. package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
  580. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -69
  581. package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
  582. package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
  583. package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +95 -131
  584. package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
  585. package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +88 -206
  586. package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +83 -80
  587. package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
  588. package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
  589. package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
  590. package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -200
  591. package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -47
  592. package/node_modules/hono/dist/cjs/router/utils.js +5 -0
  593. package/node_modules/hono/dist/cjs/router.js +37 -37
  594. package/node_modules/hono/dist/cjs/types.js +5 -28
  595. package/node_modules/hono/dist/cjs/utils/accept.js +177 -228
  596. package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
  597. package/node_modules/hono/dist/cjs/utils/body.js +89 -89
  598. package/node_modules/hono/dist/cjs/utils/buffer.js +43 -90
  599. package/node_modules/hono/dist/cjs/utils/color.js +35 -44
  600. package/node_modules/hono/dist/cjs/utils/compress.js +11 -26
  601. package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
  602. package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
  603. package/node_modules/hono/dist/cjs/utils/cookie.js +108 -177
  604. package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
  605. package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
  606. package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
  607. package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
  608. package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
  609. package/node_modules/hono/dist/cjs/utils/html.js +96 -137
  610. package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
  611. package/node_modules/hono/dist/cjs/utils/ipaddr.js +213 -279
  612. package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
  613. package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
  614. package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
  615. package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +123 -205
  616. package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
  617. package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
  618. package/node_modules/hono/dist/cjs/utils/mime.js +75 -101
  619. package/node_modules/hono/dist/cjs/utils/mount.js +51 -0
  620. package/node_modules/hono/dist/cjs/utils/stream.js +88 -102
  621. package/node_modules/hono/dist/cjs/utils/types.js +0 -15
  622. package/node_modules/hono/dist/cjs/utils/url.js +199 -228
  623. package/node_modules/hono/dist/cjs/validator/index.js +3 -27
  624. package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
  625. package/node_modules/hono/dist/cjs/validator/validator.js +63 -106
  626. package/node_modules/hono/dist/client/client.js +139 -175
  627. package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
  628. package/node_modules/hono/dist/client/index.js +3 -7
  629. package/node_modules/hono/dist/client/types.js +1 -0
  630. package/node_modules/hono/dist/client/utils.js +51 -65
  631. package/node_modules/hono/dist/compose.js +49 -45
  632. package/node_modules/hono/dist/context.js +376 -407
  633. package/node_modules/hono/dist/helper/accepts/accepts.js +49 -16
  634. package/node_modules/hono/dist/helper/accepts/index.js +1 -4
  635. package/node_modules/hono/dist/helper/adapter/index.js +33 -52
  636. package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
  637. package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
  638. package/node_modules/hono/dist/helper/cookie/index.js +74 -94
  639. package/node_modules/hono/dist/helper/css/common.js +169 -222
  640. package/node_modules/hono/dist/helper/css/index.js +132 -129
  641. package/node_modules/hono/dist/helper/dev/index.js +44 -49
  642. package/node_modules/hono/dist/helper/factory/index.js +27 -27
  643. package/node_modules/hono/dist/helper/html/index.js +30 -39
  644. package/node_modules/hono/dist/helper/proxy/index.js +116 -84
  645. package/node_modules/hono/dist/helper/route/index.js +123 -43
  646. package/node_modules/hono/dist/helper/ssg/index.js +3 -18
  647. package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
  648. package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
  649. package/node_modules/hono/dist/helper/ssg/ssg.js +200 -283
  650. package/node_modules/hono/dist/helper/ssg/utils.js +54 -56
  651. package/node_modules/hono/dist/helper/streaming/index.js +2 -8
  652. package/node_modules/hono/dist/helper/streaming/sse.js +50 -60
  653. package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
  654. package/node_modules/hono/dist/helper/streaming/text.js +9 -10
  655. package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
  656. package/node_modules/hono/dist/helper/testing/index.js +16 -10
  657. package/node_modules/hono/dist/helper/websocket/index.js +49 -53
  658. package/node_modules/hono/dist/hono-base.js +343 -377
  659. package/node_modules/hono/dist/hono.js +26 -20
  660. package/node_modules/hono/dist/http-exception.js +53 -33
  661. package/node_modules/hono/dist/index.js +19 -6
  662. package/node_modules/hono/dist/jsx/base.js +252 -326
  663. package/node_modules/hono/dist/jsx/children.js +16 -20
  664. package/node_modules/hono/dist/jsx/components.js +119 -152
  665. package/node_modules/hono/dist/jsx/constants.js +10 -15
  666. package/node_modules/hono/dist/jsx/context.js +162 -35
  667. package/node_modules/hono/dist/jsx/dom/client.js +45 -48
  668. package/node_modules/hono/dist/jsx/dom/components.js +21 -29
  669. package/node_modules/hono/dist/jsx/dom/context.js +37 -44
  670. package/node_modules/hono/dist/jsx/dom/css.js +142 -147
  671. package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
  672. package/node_modules/hono/dist/jsx/dom/index.js +71 -134
  673. package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
  674. package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
  675. package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
  676. package/node_modules/hono/dist/jsx/dom/render.js +492 -593
  677. package/node_modules/hono/dist/jsx/dom/server.js +33 -29
  678. package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
  679. package/node_modules/hono/dist/jsx/hooks/index.js +238 -307
  680. package/node_modules/hono/dist/jsx/index.js +45 -98
  681. package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
  682. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
  683. package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
  684. package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
  685. package/node_modules/hono/dist/jsx/jsx-runtime.js +25 -42
  686. package/node_modules/hono/dist/jsx/streaming.js +121 -142
  687. package/node_modules/hono/dist/jsx/types.js +1 -0
  688. package/node_modules/hono/dist/jsx/utils.js +105 -168
  689. package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
  690. package/node_modules/hono/dist/middleware/bearer-auth/index.js +101 -89
  691. package/node_modules/hono/dist/middleware/body-limit/index.js +65 -51
  692. package/node_modules/hono/dist/middleware/cache/index.js +169 -99
  693. package/node_modules/hono/dist/middleware/combine/index.js +134 -73
  694. package/node_modules/hono/dist/middleware/compress/index.js +75 -63
  695. package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
  696. package/node_modules/hono/dist/middleware/cors/index.js +107 -86
  697. package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
  698. package/node_modules/hono/dist/middleware/etag/digest.js +59 -31
  699. package/node_modules/hono/dist/middleware/etag/index.js +73 -66
  700. package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -158
  701. package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
  702. package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
  703. package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -107
  704. package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
  705. package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -109
  706. package/node_modules/hono/dist/middleware/language/index.js +2 -15
  707. package/node_modules/hono/dist/middleware/language/language.js +180 -172
  708. package/node_modules/hono/dist/middleware/logger/index.js +43 -37
  709. package/node_modules/hono/dist/middleware/method-not-allowed/index.js +83 -0
  710. package/node_modules/hono/dist/middleware/method-override/index.js +101 -79
  711. package/node_modules/hono/dist/middleware/mount/index.js +71 -0
  712. package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
  713. package/node_modules/hono/dist/middleware/pretty-json/index.js +40 -14
  714. package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
  715. package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
  716. package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
  717. package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
  718. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +145 -147
  719. package/node_modules/hono/dist/middleware/serve-static/index.js +58 -72
  720. package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
  721. package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
  722. package/node_modules/hono/dist/middleware/timing/index.js +2 -9
  723. package/node_modules/hono/dist/middleware/timing/timing.js +178 -95
  724. package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
  725. package/node_modules/hono/dist/preset/quick.js +17 -15
  726. package/node_modules/hono/dist/preset/tiny.js +14 -11
  727. package/node_modules/hono/dist/request/constants.js +4 -5
  728. package/node_modules/hono/dist/request.js +329 -310
  729. package/node_modules/hono/dist/router/linear-router/index.js +1 -4
  730. package/node_modules/hono/dist/router/linear-router/router.js +93 -115
  731. package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
  732. package/node_modules/hono/dist/router/pattern-router/router.js +39 -46
  733. package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
  734. package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
  735. package/node_modules/hono/dist/router/reg-exp-router/node.js +90 -108
  736. package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
  737. package/node_modules/hono/dist/router/reg-exp-router/router.js +82 -183
  738. package/node_modules/hono/dist/router/reg-exp-router/trie.js +80 -56
  739. package/node_modules/hono/dist/router/smart-router/index.js +1 -4
  740. package/node_modules/hono/dist/router/smart-router/router.js +46 -55
  741. package/node_modules/hono/dist/router/trie-router/index.js +1 -4
  742. package/node_modules/hono/dist/router/trie-router/node.js +132 -177
  743. package/node_modules/hono/dist/router/trie-router/router.js +11 -22
  744. package/node_modules/hono/dist/router/utils.js +4 -0
  745. package/node_modules/hono/dist/router.js +35 -14
  746. package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
  747. package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -104
  748. package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
  749. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -113
  750. package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
  751. package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
  752. package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +7 -2
  753. package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
  754. package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
  755. package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -16
  756. package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
  757. package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -17
  758. package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
  759. package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
  760. package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
  761. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -2
  762. package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +10 -5
  763. package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
  764. package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
  765. package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
  766. package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
  767. package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
  768. package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +7 -2
  769. package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
  770. package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
  771. package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
  772. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +84 -58
  773. package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
  774. package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
  775. package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
  776. package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
  777. package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
  778. package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -7
  779. package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +7 -9
  780. package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -7
  781. package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
  782. package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
  783. package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
  784. package/node_modules/hono/dist/types/client/client.d.ts +5 -3
  785. package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
  786. package/node_modules/hono/dist/types/client/index.d.ts +5 -7
  787. package/node_modules/hono/dist/types/client/types.d.ts +135 -160
  788. package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
  789. package/node_modules/hono/dist/types/compose.d.ts +4 -2
  790. package/node_modules/hono/dist/types/context.d.ts +335 -331
  791. package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
  792. package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
  793. package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
  794. package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
  795. package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
  796. package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -12
  797. package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -9
  798. package/node_modules/hono/dist/types/helper/css/index.d.ts +26 -28
  799. package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -12
  800. package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -73
  801. package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
  802. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +20 -22
  803. package/node_modules/hono/dist/types/helper/route/index.d.ts +6 -4
  804. package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
  805. package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -6
  806. package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
  807. package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +44 -37
  808. package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -3
  809. package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
  810. package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
  811. package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
  812. package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
  813. package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
  814. package/node_modules/hono/dist/types/helper/testing/index.d.ts +8 -9
  815. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
  816. package/node_modules/hono/dist/types/hono-base.d.ts +225 -210
  817. package/node_modules/hono/dist/types/hono.d.ts +11 -10
  818. package/node_modules/hono/dist/types/http-exception.d.ts +20 -22
  819. package/node_modules/hono/dist/types/index.d.ts +6 -37
  820. package/node_modules/hono/dist/types/jsx/base.d.ts +43 -36
  821. package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
  822. package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
  823. package/node_modules/hono/dist/types/jsx/constants.d.ts +3 -0
  824. package/node_modules/hono/dist/types/jsx/context.d.ts +48 -6
  825. package/node_modules/hono/dist/types/jsx/dom/client.d.ts +9 -10
  826. package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
  827. package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
  828. package/node_modules/hono/dist/types/jsx/dom/css.d.ts +27 -30
  829. package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -12
  830. package/node_modules/hono/dist/types/jsx/dom/index.d.ts +79 -83
  831. package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +10 -6
  832. package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
  833. package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
  834. package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -50
  835. package/node_modules/hono/dist/types/jsx/dom/server.d.ts +87 -85
  836. package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
  837. package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +22 -20
  838. package/node_modules/hono/dist/types/jsx/index.d.ts +71 -73
  839. package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
  840. package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
  841. package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
  842. package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
  843. package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +8 -10
  844. package/node_modules/hono/dist/types/jsx/streaming.d.ts +10 -10
  845. package/node_modules/hono/dist/types/jsx/types.d.ts +12 -13
  846. package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
  847. package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -19
  848. package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +48 -49
  849. package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -8
  850. package/node_modules/hono/dist/types/middleware/cache/index.d.ts +17 -17
  851. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +8 -8
  852. package/node_modules/hono/dist/types/middleware/compress/index.d.ts +9 -10
  853. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +6 -8
  854. package/node_modules/hono/dist/types/middleware/cors/index.d.ts +11 -13
  855. package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -8
  856. package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
  857. package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -8
  858. package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -12
  859. package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +13 -13
  860. package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
  861. package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +21 -22
  862. package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +7 -6
  863. package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +29 -29
  864. package/node_modules/hono/dist/types/middleware/language/index.d.ts +6 -5
  865. package/node_modules/hono/dist/types/middleware/language/language.d.ts +60 -44
  866. package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -5
  867. package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +47 -0
  868. package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -16
  869. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +48 -0
  870. package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -10
  871. package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -20
  872. package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +6 -5
  873. package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
  874. package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +6 -6
  875. package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +5 -3
  876. package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -57
  877. package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
  878. package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
  879. package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
  880. package/node_modules/hono/dist/types/middleware/timing/index.d.ts +6 -5
  881. package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -20
  882. package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -37
  883. package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
  884. package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
  885. package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
  886. package/node_modules/hono/dist/types/request.d.ts +288 -286
  887. package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
  888. package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
  889. package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
  890. package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
  891. package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
  892. package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
  893. package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +9 -4
  894. package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -10
  895. package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
  896. package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -4
  897. package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
  898. package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
  899. package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
  900. package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -5
  901. package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -6
  902. package/node_modules/hono/dist/types/router/utils.d.ts +3 -0
  903. package/node_modules/hono/dist/types/router.d.ts +24 -23
  904. package/node_modules/hono/dist/types/types.d.ts +146 -505
  905. package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
  906. package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
  907. package/node_modules/hono/dist/types/utils/body.d.ts +46 -50
  908. package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -5
  909. package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
  910. package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
  911. package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
  912. package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
  913. package/node_modules/hono/dist/types/utils/cookie.d.ts +21 -19
  914. package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -7
  915. package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
  916. package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -3
  917. package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
  918. package/node_modules/hono/dist/types/utils/headers.d.ts +4 -2
  919. package/node_modules/hono/dist/types/utils/html.d.ts +11 -9
  920. package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
  921. package/node_modules/hono/dist/types/utils/ipaddr.d.ts +4 -6
  922. package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
  923. package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
  924. package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
  925. package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
  926. package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
  927. package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
  928. package/node_modules/hono/dist/types/utils/mime.d.ts +60 -57
  929. package/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
  930. package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
  931. package/node_modules/hono/dist/types/utils/types.d.ts +15 -27
  932. package/node_modules/hono/dist/types/utils/url.d.ts +7 -0
  933. package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
  934. package/node_modules/hono/dist/types/validator/utils.d.ts +6 -8
  935. package/node_modules/hono/dist/types/validator/validator.d.ts +11 -9
  936. package/node_modules/hono/dist/types.js +4 -6
  937. package/node_modules/hono/dist/utils/accept.js +185 -215
  938. package/node_modules/hono/dist/utils/basic-auth.js +18 -21
  939. package/node_modules/hono/dist/utils/body.js +88 -67
  940. package/node_modules/hono/dist/utils/buffer.js +44 -70
  941. package/node_modules/hono/dist/utils/color.js +33 -21
  942. package/node_modules/hono/dist/utils/compress.js +11 -5
  943. package/node_modules/hono/dist/utils/concurrent.js +29 -38
  944. package/node_modules/hono/dist/utils/constants.js +7 -5
  945. package/node_modules/hono/dist/utils/cookie.js +115 -163
  946. package/node_modules/hono/dist/utils/crypto.js +30 -40
  947. package/node_modules/hono/dist/utils/encode.js +30 -26
  948. package/node_modules/hono/dist/utils/filepath.js +23 -33
  949. package/node_modules/hono/dist/utils/handler.js +10 -11
  950. package/node_modules/hono/dist/utils/headers.js +1 -0
  951. package/node_modules/hono/dist/utils/html.js +97 -117
  952. package/node_modules/hono/dist/utils/http-status.js +1 -0
  953. package/node_modules/hono/dist/utils/ipaddr.js +227 -272
  954. package/node_modules/hono/dist/utils/jwt/index.js +12 -4
  955. package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
  956. package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
  957. package/node_modules/hono/dist/utils/jwt/jwt.js +121 -197
  958. package/node_modules/hono/dist/utils/jwt/types.js +79 -95
  959. package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
  960. package/node_modules/hono/dist/utils/mime.js +74 -79
  961. package/node_modules/hono/dist/utils/mount.js +50 -0
  962. package/node_modules/hono/dist/utils/stream.js +86 -79
  963. package/node_modules/hono/dist/utils/types.js +1 -0
  964. package/node_modules/hono/dist/utils/url.js +199 -208
  965. package/node_modules/hono/dist/validator/index.js +1 -4
  966. package/node_modules/hono/dist/validator/utils.js +1 -0
  967. package/node_modules/hono/dist/validator/validator.js +61 -83
  968. package/node_modules/hono/package.json +69 -47
  969. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  970. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  971. package/node_modules/iconv-lite/package.json +2 -2
  972. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  973. package/node_modules/ip-address/README.md +173 -143
  974. package/node_modules/ip-address/dist/address-error.d.ts +11 -0
  975. package/node_modules/ip-address/dist/address-error.js.map +1 -1
  976. package/node_modules/ip-address/dist/common.d.ts +54 -0
  977. package/node_modules/ip-address/dist/common.js +93 -6
  978. package/node_modules/ip-address/dist/common.js.map +1 -1
  979. package/node_modules/ip-address/dist/ipv4.d.ts +88 -8
  980. package/node_modules/ip-address/dist/ipv4.js +146 -29
  981. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  982. package/node_modules/ip-address/dist/ipv6.d.ts +156 -11
  983. package/node_modules/ip-address/dist/ipv6.js +340 -96
  984. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  985. package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
  986. package/node_modules/ip-address/dist/v4/constants.js +45 -2
  987. package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
  988. package/node_modules/ip-address/dist/v6/constants.d.ts +17 -0
  989. package/node_modules/ip-address/dist/v6/constants.js +53 -3
  990. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  991. package/node_modules/ip-address/package.json +8 -5
  992. package/node_modules/proxy-addr/HISTORY.md +60 -54
  993. package/node_modules/proxy-addr/README.md +1 -1
  994. package/node_modules/proxy-addr/index.js +32 -0
  995. package/node_modules/proxy-addr/package.json +8 -4
  996. package/node_modules/qs/.editorconfig +1 -1
  997. package/node_modules/qs/.github/THREAT_MODEL.md +6 -4
  998. package/node_modules/qs/CHANGELOG.md +116 -1
  999. package/node_modules/qs/README.md +107 -8
  1000. package/node_modules/qs/dist/qs.js +28 -28
  1001. package/node_modules/qs/eslint.config.mjs +61 -50
  1002. package/node_modules/qs/lib/formats.js +7 -2
  1003. package/node_modules/qs/lib/parse.js +137 -18
  1004. package/node_modules/qs/lib/stringify.js +32 -15
  1005. package/node_modules/qs/lib/utils.js +213 -24
  1006. package/node_modules/qs/package.json +11 -10
  1007. package/node_modules/qs/test/parse.js +928 -2
  1008. package/node_modules/qs/test/stringify.js +769 -0
  1009. package/node_modules/qs/test/utils.js +450 -2
  1010. package/node_modules/side-channel/CHANGELOG.md +10 -0
  1011. package/node_modules/side-channel/README.md +1 -1
  1012. package/node_modules/side-channel/index.js +5 -2
  1013. package/node_modules/side-channel/package.json +10 -10
  1014. package/node_modules/side-channel/test/index.js +16 -0
  1015. package/node_modules/side-channel-list/CHANGELOG.md +25 -4
  1016. package/node_modules/side-channel-list/index.js +1 -3
  1017. package/node_modules/side-channel-list/package.json +8 -8
  1018. package/node_modules/side-channel-list/test/index.js +50 -0
  1019. package/node_modules/type-is/index.js +8 -18
  1020. package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  1021. package/node_modules/type-is/node_modules/content-type/README.md +71 -0
  1022. package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +46 -0
  1023. package/node_modules/type-is/node_modules/content-type/dist/index.js +176 -0
  1024. package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  1025. package/node_modules/type-is/node_modules/content-type/package.json +52 -0
  1026. package/node_modules/type-is/package.json +9 -5
  1027. package/package.json +1 -1
  1028. package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
  1029. package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
  1030. package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
  1031. package/node_modules/@hono/node-server/dist/globals.js +0 -29
  1032. package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
  1033. package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
  1034. package/node_modules/@hono/node-server/dist/index.js +0 -702
  1035. package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
  1036. package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
  1037. package/node_modules/@hono/node-server/dist/listener.js +0 -670
  1038. package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
  1039. package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
  1040. package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
  1041. package/node_modules/@hono/node-server/dist/request.js +0 -238
  1042. package/node_modules/@hono/node-server/dist/request.mjs +0 -206
  1043. package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
  1044. package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
  1045. package/node_modules/@hono/node-server/dist/response.js +0 -112
  1046. package/node_modules/@hono/node-server/dist/response.mjs +0 -85
  1047. package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
  1048. package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
  1049. package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
  1050. package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
  1051. package/node_modules/@hono/node-server/dist/server.js +0 -696
  1052. package/node_modules/@hono/node-server/dist/server.mjs +0 -660
  1053. package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
  1054. package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
  1055. package/node_modules/@hono/node-server/dist/types.js +0 -18
  1056. package/node_modules/@hono/node-server/dist/types.mjs +0 -0
  1057. package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
  1058. package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
  1059. package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
  1060. package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
  1061. package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
  1062. package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
  1063. package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
  1064. package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
  1065. package/node_modules/@hono/node-server/dist/utils.js +0 -99
  1066. package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
  1067. package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
  1068. package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
  1069. package/node_modules/@hono/node-server/dist/vercel.js +0 -677
  1070. package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
  1071. package/node_modules/hasown/.eslintrc +0 -5
  1072. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -1,4 +1,4 @@
1
- /*! Axios v1.17.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.21.1 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  'use strict';
3
3
 
4
4
  var FormData$1 = require('form-data');
@@ -40,6 +40,150 @@ const {
40
40
  iterator,
41
41
  toStringTag
42
42
  } = Symbol;
43
+
44
+ /* Creating a function that will check if an object has a property. */
45
+ const hasOwnProperty = (({
46
+ hasOwnProperty
47
+ }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
48
+ const isUnsafeObjectKey = prop => typeof prop === 'string' && (prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
49
+
50
+ /**
51
+ * Determine whether an inherited object must be treated as a shared-prototype
52
+ * boundary. Cross-realm Object.prototype objects cannot be distinguished
53
+ * reliably from application-created null-prototype objects because their
54
+ * properties are mutable, so all inherited terminal prototypes are excluded
55
+ * as a fail-closed boundary. A null-prototype source still keeps its own
56
+ * properties, as produced by mergeConfig and other safe materialization paths.
57
+ *
58
+ * @param {*} obj The object to inspect
59
+ * @param {*} prototype The object's prototype
60
+ * @param {boolean} source Whether obj is the original traversal source
61
+ *
62
+ * @returns {boolean} True when obj is a safe prototype traversal boundary
63
+ */
64
+ const isPrototypeBoundary = (obj, prototype, source) => obj === Object.prototype || !source && prototype === null;
65
+
66
+ /**
67
+ * Determine whether an object can retain its identity through code paths that
68
+ * add, replace, and remove config properties without bypassing unsafe-key
69
+ * filtering. Immutable objects, unsafe-key-bearing objects, and objects with
70
+ * accessor or restricted data properties must be materialized instead.
71
+ *
72
+ * @param {*} obj The object to inspect
73
+ *
74
+ * @returns {boolean} True when every own property is safe and fully mutable
75
+ */
76
+ const isSafeAndFullyMutable = obj => {
77
+ if (!Object.isExtensible(obj)) {
78
+ return false;
79
+ }
80
+ const props = Object.getOwnPropertyNames(obj);
81
+ if (Object.getOwnPropertySymbols) {
82
+ props.push(...Object.getOwnPropertySymbols(obj));
83
+ }
84
+ return props.every(prop => {
85
+ if (isUnsafeObjectKey(prop)) {
86
+ return false;
87
+ }
88
+ const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
89
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
90
+ });
91
+ };
92
+
93
+ /**
94
+ * Walk the prototype chain (excluding the source realm's Object.prototype)
95
+ * looking for an own `prop`. This distinguishes genuine own/inherited members
96
+ * — including class accessors and template prototypes — from members injected
97
+ * via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
98
+ * which live on Object.prototype itself and are therefore never matched.
99
+ *
100
+ * @param {*} thing The value whose chain to inspect
101
+ * @param {string|symbol} prop The property key to look for
102
+ *
103
+ * @returns {boolean} True when `prop` is owned below Object.prototype
104
+ */
105
+ const hasOwnInPrototypeChain = (thing, prop) => {
106
+ let obj = thing;
107
+ const seen = [];
108
+ while (obj != null) {
109
+ if (seen.indexOf(obj) !== -1) {
110
+ return false;
111
+ }
112
+ seen.push(obj);
113
+ const prototype = getPrototypeOf(obj);
114
+ if (isPrototypeBoundary(obj, prototype, obj === thing)) {
115
+ return false;
116
+ }
117
+ if (hasOwnProperty(obj, prop)) {
118
+ return true;
119
+ }
120
+ obj = prototype;
121
+ }
122
+ return false;
123
+ };
124
+
125
+ /**
126
+ * Read `obj[prop]` only when it is safe from Object.prototype pollution. Own
127
+ * properties and members inherited from a non-Object.prototype source (a class
128
+ * instance or template object) are honored; a value reachable only through a
129
+ * polluted Object.prototype is ignored and `undefined` is returned.
130
+ *
131
+ * @param {*} obj The source object
132
+ * @param {string|symbol} prop The property key to read
133
+ *
134
+ * @returns {*} The resolved value, or undefined when unsafe/absent
135
+ */
136
+ const getSafeProp = (obj, prop) => obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
137
+
138
+ /**
139
+ * Flatten an object and its application-defined prototype chain into a
140
+ * null-prototype object. Members inherited only from the source realm's
141
+ * Object.prototype are deliberately excluded, while class/template members
142
+ * below that boundary are preserved.
143
+ *
144
+ * @param {*} thing The value to flatten
145
+ *
146
+ * @returns {*} A null-prototype copy, or the original value when it is already
147
+ * structurally safe or is not an object
148
+ */
149
+ const toSafeFlatObject = thing => {
150
+ if (thing == null || typeof thing !== 'object' && typeof thing !== 'function') {
151
+ return thing;
152
+ }
153
+ const sourcePrototype = getPrototypeOf(thing);
154
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
155
+ return thing;
156
+ }
157
+ const result = Object.create(null);
158
+ const merged = Object.create(null);
159
+ const seen = [];
160
+ let current = thing;
161
+ while (current != null) {
162
+ if (seen.indexOf(current) !== -1) {
163
+ break;
164
+ }
165
+ seen.push(current);
166
+ const prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
167
+ if (isPrototypeBoundary(current, prototype, current === thing)) {
168
+ break;
169
+ }
170
+ const props = Object.getOwnPropertyNames(current);
171
+ if (Object.getOwnPropertySymbols) {
172
+ props.push(...Object.getOwnPropertySymbols(current));
173
+ }
174
+ for (const prop of props) {
175
+ if (isUnsafeObjectKey(prop)) {
176
+ continue;
177
+ }
178
+ if (!hasOwnProperty(merged, prop)) {
179
+ result[prop] = thing[prop];
180
+ merged[prop] = true;
181
+ }
182
+ }
183
+ current = prototype;
184
+ }
185
+ return result;
186
+ };
43
187
  const kindOf = (cache => thing => {
44
188
  const str = toString.call(thing);
45
189
  return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
@@ -158,11 +302,21 @@ const isBoolean = thing => thing === true || thing === false;
158
302
  * @returns {boolean} True if value is a plain Object, otherwise false
159
303
  */
160
304
  const isPlainObject = val => {
161
- if (kindOf(val) !== 'object') {
305
+ if (!isObject(val)) {
162
306
  return false;
163
307
  }
164
308
  const prototype = getPrototypeOf(val);
165
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
309
+ return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) && (
310
+ // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
311
+ // value is tagged/iterable, ignoring members reachable only through shared
312
+ // or terminal prototype boundaries. This is exactly what
313
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
314
+ // above (null, Object.prototype, or a terminal null-prototype template) is
315
+ // a boundary, so the walk never inspects anything but `val`'s own members,
316
+ // and stops before even those when `val` is itself the boundary
317
+ // Object.prototype. Checking that inline avoids allocating the walker's
318
+ // `seen` list twice per call on the mergeConfig / merge hot path.
319
+ isPrototypeBoundary(val, prototype, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
166
320
  };
167
321
 
168
322
  /**
@@ -245,6 +399,7 @@ const isBlob = kindOfTest('Blob');
245
399
  * @returns {boolean} True if value is a FileList, otherwise false
246
400
  */
247
401
  const isFileList = kindOfTest('FileList');
402
+ const isSet = kindOfTest('Set');
248
403
 
249
404
  /**
250
405
  * Determine if a value is a Stream
@@ -412,15 +567,29 @@ function merge(...objs) {
412
567
  skipUndefined
413
568
  } = isContextDefined(this) && this || {};
414
569
  const result = {};
570
+ // Caseless lookup only applies to string keys — symbol keys are
571
+ // identity-matched. Every string key that reaches `result` passes through
572
+ // this index first, so it can never hold two case variants of one key and a
573
+ // lowercase -> key map is exactly what findKey(result, key) would rescan
574
+ // Object.keys(result) for on each assignment.
575
+ const lowerCaseKeys = caseless ? Object.create(null) : null;
415
576
  const assignValue = (val, key) => {
416
577
  // Skip dangerous property names to prevent prototype pollution
417
578
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
418
579
  return;
419
580
  }
420
-
421
- // findKey lowercases the key, so caseless lookup only applies to strings —
422
- // symbol keys are identity-matched.
423
- const targetKey = caseless && typeof key === 'string' && findKey(result, key) || key;
581
+ let targetKey = key;
582
+ if (lowerCaseKeys && typeof key === 'string') {
583
+ const lowerKey = key.toLowerCase();
584
+ const knownKey = lowerCaseKeys[lowerKey];
585
+ // A key recorded but absent from `result` was skipped by skipUndefined;
586
+ // the later spelling wins then, as it does for findKey.
587
+ if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
588
+ targetKey = knownKey;
589
+ } else {
590
+ lowerCaseKeys[lowerKey] = key;
591
+ }
592
+ }
424
593
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
425
594
  // chain, so a polluted Object.prototype value could surface here and get
426
595
  // copied into the merged result.
@@ -441,7 +610,7 @@ function merge(...objs) {
441
610
  continue;
442
611
  }
443
612
  forEach(source, assignValue);
444
- if (typeof source !== 'object' || isArray(source)) {
613
+ if (typeof source !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
445
614
  continue;
446
615
  }
447
616
  const symbols = Object.getOwnPropertySymbols(source);
@@ -596,7 +765,27 @@ const toArray = thing => {
596
765
  if (!thing) return null;
597
766
  if (isArray(thing)) return thing;
598
767
  let i = thing.length;
599
- if (!isNumber(i)) return null;
768
+ if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
769
+
770
+ // Bound the copy by actual indexed properties, including hidden and inherited
771
+ // members of array-like collections, rather than by the declared length alone.
772
+ const indexes = new Set();
773
+ const seen = new Set();
774
+ let source = thing;
775
+ while (source != null && indexes.size < i) {
776
+ if (seen.has(source)) return null;
777
+ seen.add(source);
778
+ const prototype = getPrototypeOf(source);
779
+ if (isPrototypeBoundary(source, prototype, source === thing)) break;
780
+ Object.getOwnPropertyNames(source).forEach(key => {
781
+ const index = +key;
782
+ if (Number.isInteger(index) && index >= 0 && index < i && String(index) === key && hasOwnProperty(source, key)) {
783
+ indexes.add(index);
784
+ }
785
+ });
786
+ source = prototype;
787
+ }
788
+ if (indexes.size !== i) return null;
600
789
  const arr = new Array(i);
601
790
  while (i-- > 0) {
602
791
  arr[i] = thing[i];
@@ -662,11 +851,6 @@ const toCamelCase = str => {
662
851
  return p1.toUpperCase() + p2;
663
852
  });
664
853
  };
665
-
666
- /* Creating a function that will check if an object has a property. */
667
- const hasOwnProperty = (({
668
- hasOwnProperty
669
- }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
670
854
  const {
671
855
  propertyIsEnumerable
672
856
  } = Object.prototype;
@@ -772,11 +956,20 @@ const toJSONObject = obj => {
772
956
  if (!('toJSON' in source)) {
773
957
  // add-on descent / delete-on-ascent: preserves path semantics, so DAG nodes serialise at every occurrence (see #7230).
774
958
  visited.add(source);
775
- const target = isArray(source) ? [] : {};
776
- forEach(source, (value, key) => {
777
- const reducedValue = visit(value);
778
- !isUndefined(reducedValue) && (target[key] = reducedValue);
779
- });
959
+ let target;
960
+ if (isSet(source)) {
961
+ target = [];
962
+ for (const value of source) {
963
+ const reducedValue = visit(value);
964
+ !isUndefined(reducedValue) && target.push(reducedValue);
965
+ }
966
+ } else {
967
+ target = isArray(source) ? [] : {};
968
+ forEach(source, (value, key) => {
969
+ const reducedValue = visit(value);
970
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
971
+ });
972
+ }
780
973
  visited.delete(source);
781
974
  return target;
782
975
  }
@@ -844,6 +1037,19 @@ const asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global
844
1037
  // *********************
845
1038
 
846
1039
  const isIterable = thing => thing != null && isFunction$1(thing[iterator]);
1040
+
1041
+ /**
1042
+ * Determine if a value is iterable via an iterator that is NOT sourced solely
1043
+ * from a polluted Object.prototype. Use this instead of `isIterable` whenever
1044
+ * the iterable comes from untrusted input (e.g. user-supplied header sources),
1045
+ * so `Object.prototype[Symbol.iterator] = ...` cannot turn an ordinary object
1046
+ * into an attacker-controlled entries iterator.
1047
+ *
1048
+ * @param {*} thing The value to test
1049
+ *
1050
+ * @returns {boolean} True if value has a non-polluted iterator
1051
+ */
1052
+ const isSafeIterable = thing => thing != null && hasOwnInPrototypeChain(thing, iterator) && isIterable(thing);
847
1053
  var utils$1 = {
848
1054
  isArray,
849
1055
  isArrayBuffer,
@@ -889,6 +1095,9 @@ var utils$1 = {
889
1095
  hasOwnProperty,
890
1096
  hasOwnProp: hasOwnProperty,
891
1097
  // an alias to avoid ESLint no-prototype-builtins detection
1098
+ hasOwnInPrototypeChain,
1099
+ getSafeProp,
1100
+ toSafeFlatObject,
892
1101
  reduceDescriptors,
893
1102
  freezeMethods,
894
1103
  toObjectSet,
@@ -904,7 +1113,8 @@ var utils$1 = {
904
1113
  isThenable,
905
1114
  setImmediate: _setImmediate,
906
1115
  asap,
907
- isIterable
1116
+ isIterable,
1117
+ isSafeIterable
908
1118
  };
909
1119
 
910
1120
  // RawAxiosHeaders whose duplicates are ignored by node
@@ -926,7 +1136,8 @@ const ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-
926
1136
  * @returns {Object} Headers parsed into an object
927
1137
  */
928
1138
  var parseHeaders = rawHeaders => {
929
- const parsed = {};
1139
+ // Header names are data, including __proto__; avoid inherited setters.
1140
+ const parsed = Object.create(null);
930
1141
  let key;
931
1142
  let val;
932
1143
  let i;
@@ -934,17 +1145,18 @@ var parseHeaders = rawHeaders => {
934
1145
  i = line.indexOf(':');
935
1146
  key = line.substring(0, i).trim().toLowerCase();
936
1147
  val = line.substring(i + 1).trim();
937
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1148
+ const hasKey = utils$1.hasOwnProp(parsed, key);
1149
+ if (!key || hasKey && utils$1.hasOwnProp(ignoreDuplicateOf, key)) {
938
1150
  return;
939
1151
  }
940
1152
  if (key === 'set-cookie') {
941
- if (parsed[key]) {
1153
+ if (hasKey) {
942
1154
  parsed[key].push(val);
943
1155
  } else {
944
1156
  parsed[key] = [val];
945
1157
  }
946
1158
  } else {
947
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1159
+ parsed[key] = hasKey ? parsed[key] + ', ' + val : val;
948
1160
  }
949
1161
  });
950
1162
  return parsed;
@@ -991,7 +1203,7 @@ function toByteStringHeaderObject(headers) {
991
1203
  return byteStringHeaders;
992
1204
  }
993
1205
 
994
- const $internals = Symbol('internals');
1206
+ const $internals$1 = Symbol('internals');
995
1207
  function normalizeHeader(header) {
996
1208
  return header && String(header).trim().toLowerCase();
997
1209
  }
@@ -1010,10 +1222,106 @@ function parseTokens(str) {
1010
1222
  }
1011
1223
  return tokens;
1012
1224
  }
1225
+ const parameterNameRE = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
1226
+ function trimOWS(value) {
1227
+ let start = 0;
1228
+ let end = value.length;
1229
+ while (start < end) {
1230
+ const code = value.charCodeAt(start);
1231
+ if (code !== 0x09 && code !== 0x20) {
1232
+ break;
1233
+ }
1234
+ start += 1;
1235
+ }
1236
+ while (end > start) {
1237
+ const code = value.charCodeAt(end - 1);
1238
+ if (code !== 0x09 && code !== 0x20) {
1239
+ break;
1240
+ }
1241
+ end -= 1;
1242
+ }
1243
+ return start === 0 && end === value.length ? value : value.slice(start, end);
1244
+ }
1245
+ function decodeQuotedString(value) {
1246
+ const last = value.length - 1;
1247
+ if (last < 1 || value.charCodeAt(0) !== 0x22 || value.charCodeAt(last) !== 0x22) {
1248
+ return value;
1249
+ }
1250
+ let decoded = '';
1251
+ for (let i = 1; i < last; i++) {
1252
+ const code = value.charCodeAt(i);
1253
+ if (code === 0x22) {
1254
+ return value;
1255
+ }
1256
+ if (code === 0x5c) {
1257
+ i += 1;
1258
+ if (i >= last) {
1259
+ return value;
1260
+ }
1261
+ }
1262
+ decoded += value[i];
1263
+ }
1264
+ return decoded;
1265
+ }
1266
+ function parseParameters(value) {
1267
+ const parameters = Object.create(null);
1268
+ const str = String(value);
1269
+ let start = 0;
1270
+ let quoted = false;
1271
+ let escaped = false;
1272
+ function parseParameter(end) {
1273
+ const part = trimOWS(str.slice(start, end));
1274
+ const equals = part.indexOf('=');
1275
+ if (equals < 1) {
1276
+ return;
1277
+ }
1278
+ const name = trimOWS(part.slice(0, equals));
1279
+ if (!parameterNameRE.test(name)) {
1280
+ return;
1281
+ }
1282
+ const normalizedName = name.toLowerCase();
1283
+ if (normalizedName === '__proto__' || normalizedName === 'constructor' || normalizedName === 'prototype') {
1284
+ return;
1285
+ }
1286
+ const parameterValue = trimOWS(part.slice(equals + 1));
1287
+ parameters[normalizedName] = decodeQuotedString(parameterValue);
1288
+ }
1289
+ for (let i = 0; i < str.length; i++) {
1290
+ const code = str.charCodeAt(i);
1291
+ if (quoted) {
1292
+ if (escaped) {
1293
+ escaped = false;
1294
+ } else if (code === 0x5c) {
1295
+ escaped = true;
1296
+ } else if (code === 0x22) {
1297
+ quoted = false;
1298
+ }
1299
+ } else if (code === 0x22) {
1300
+ quoted = true;
1301
+ } else if (code === 0x2c || code === 0x3b) {
1302
+ parseParameter(i);
1303
+ start = i + 1;
1304
+ }
1305
+ }
1306
+ parseParameter(str.length);
1307
+ return parameters;
1308
+ }
1013
1309
  const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1310
+
1311
+ // `__proto__` is a valid field name, and the one name the uppercase mapping at
1312
+ // the bottom of this file cannot reach: it is inherited from Object.prototype
1313
+ // instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
1314
+ // runs the inherited setter. That silently discards the header, and an array
1315
+ // value replaces the instance prototype, taking every method with it.
1316
+ // Store it under the same kind of case variant that mapping uses for `set` and
1317
+ // `constructor`. Header lookup is caseless, so it reads back under either
1318
+ // spelling, and no own `__proto__` slot is ever created for a later
1319
+ // `Object.assign` to copy onto a plain object through the same setter.
1320
+ const PROTO_HEADER_SLOT = '__Proto__';
1321
+ const headerSlot = name => name === '__proto__' ? PROTO_HEADER_SLOT : name;
1014
1322
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1015
1323
  if (utils$1.isFunction(filter)) {
1016
- return filter.call(this, value, header);
1324
+ return filter.call(context, value, header);
1017
1325
  }
1018
1326
  if (isHeaderNameFilter) {
1019
1327
  value = header;
@@ -1058,7 +1366,7 @@ class AxiosHeaders {
1058
1366
  }
1059
1367
  const key = utils$1.findKey(self, lHeader);
1060
1368
  if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1061
- self[key || _header] = normalizeValue(_value);
1369
+ self[headerSlot(key || _header)] = normalizeValue(_value);
1062
1370
  }
1063
1371
  }
1064
1372
  const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
@@ -1066,15 +1374,21 @@ class AxiosHeaders {
1066
1374
  setHeaders(header, valueOrRewrite);
1067
1375
  } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1068
1376
  setHeaders(parseHeaders(header), valueOrRewrite);
1069
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1070
- let obj = {},
1377
+ } else if (utils$1.isObject(header) && utils$1.isSafeIterable(header)) {
1378
+ let obj = Object.create(null),
1071
1379
  dest,
1072
1380
  key;
1073
1381
  for (const entry of header) {
1074
1382
  if (!utils$1.isArray(entry)) {
1075
1383
  throw new TypeError('Object iterator must return a key-value pair');
1076
1384
  }
1077
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1385
+ key = entry[0];
1386
+ if (utils$1.hasOwnProp(obj, key)) {
1387
+ dest = obj[key];
1388
+ obj[key] = utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]];
1389
+ } else {
1390
+ obj[key] = entry[1];
1391
+ }
1078
1392
  }
1079
1393
  setHeaders(obj, valueOrRewrite);
1080
1394
  } else {
@@ -1147,7 +1461,7 @@ class AxiosHeaders {
1147
1461
  }
1148
1462
  normalize(format) {
1149
1463
  const self = this;
1150
- const headers = {};
1464
+ const headers = Object.create(null);
1151
1465
  utils$1.forEach(this, (value, header) => {
1152
1466
  const key = utils$1.findKey(headers, header);
1153
1467
  if (key) {
@@ -1155,7 +1469,7 @@ class AxiosHeaders {
1155
1469
  delete self[header];
1156
1470
  return;
1157
1471
  }
1158
- const normalized = format ? formatHeader(header) : String(header).trim();
1472
+ const normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
1159
1473
  if (normalized !== header) {
1160
1474
  delete self[header];
1161
1475
  }
@@ -1181,7 +1495,8 @@ class AxiosHeaders {
1181
1495
  return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1182
1496
  }
1183
1497
  getSetCookie() {
1184
- return this.get('set-cookie') || [];
1498
+ const value = this.get('set-cookie');
1499
+ return utils$1.isArray(value) ? value : value == null || value === false ? [] : [value];
1185
1500
  }
1186
1501
  get [Symbol.toStringTag]() {
1187
1502
  return 'AxiosHeaders';
@@ -1189,13 +1504,16 @@ class AxiosHeaders {
1189
1504
  static from(thing) {
1190
1505
  return thing instanceof this ? thing : new this(thing);
1191
1506
  }
1507
+ static parseParameters(value) {
1508
+ return parseParameters(value);
1509
+ }
1192
1510
  static concat(first, ...targets) {
1193
1511
  const computed = new this(first);
1194
1512
  targets.forEach(target => computed.set(target));
1195
1513
  return computed;
1196
1514
  }
1197
1515
  static accessor(header) {
1198
- const internals = this[$internals] = this[$internals] = {
1516
+ const internals = this[$internals$1] = this[$internals$1] = {
1199
1517
  accessors: {}
1200
1518
  };
1201
1519
  const accessors = internals.accessors;
@@ -1283,12 +1601,106 @@ function redactConfig(config, redactKeys) {
1283
1601
  };
1284
1602
  return visit(config);
1285
1603
  }
1604
+ function stringifySafely$1(value) {
1605
+ try {
1606
+ return String(value);
1607
+ } catch (err) {
1608
+ return '';
1609
+ }
1610
+ }
1611
+ function aggregateErrorMessage(error) {
1612
+ const message = error.errors.map(entry => {
1613
+ try {
1614
+ return entry && entry.message ? stringifySafely$1(entry.message) : stringifySafely$1(entry);
1615
+ } catch (err) {
1616
+ return '';
1617
+ }
1618
+ }).filter(Boolean).join('; ');
1619
+ return message || error.name || 'AggregateError';
1620
+ }
1621
+
1622
+ // Shared with `Axios.prototype.request`, which splices the reconstructed
1623
+ // caller frames in ahead of this marker.
1624
+ const CAUSED_BY_SEPARATOR = '\nCaused by: ';
1625
+ const $causeStack = Symbol('causeStack');
1626
+
1627
+ // Match the section we appended, not marker-like text in an error message or
1628
+ // a replacement stack supplied by the caller. Do not re-read the cause's stack.
1629
+ function getCauseStackIndex(error, stack) {
1630
+ const causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
1631
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
1632
+ }
1633
+
1634
+ /**
1635
+ * Append the stack of a wrapped error to `target.stack`.
1636
+ *
1637
+ * `cause` already exposes the original error for tooling that walks the standard
1638
+ * cause chain, but many error reporters read `stack` and nothing else. Inlining
1639
+ * the wrapped stack there means those reporters surface the underlying failure
1640
+ * instead of the axios frames that normalized it (see #6670).
1641
+ *
1642
+ * Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
1643
+ * without stack support, or a replaced `stack` property can leave the value
1644
+ * missing, non-string, or read-only, and normalizing an error must not throw
1645
+ * because of that.
1646
+ *
1647
+ * @param {Error} target The AxiosError being built.
1648
+ * @param {Error} source The error being wrapped.
1649
+ *
1650
+ * @returns {void}
1651
+ */
1652
+ function appendCauseStack(target, source) {
1653
+ try {
1654
+ const sourceStack = source && source.stack;
1655
+ if (typeof sourceStack !== 'string' || !sourceStack) {
1656
+ return;
1657
+ }
1658
+ const targetStack = target.stack;
1659
+ if (typeof targetStack !== 'string' || !targetStack) {
1660
+ return;
1661
+ }
1662
+
1663
+ // Each call to `from()` creates a fresh target. Re-wrapping includes the
1664
+ // previous stack verbatim, adding one cause section per wrap.
1665
+ const causeStack = CAUSED_BY_SEPARATOR + sourceStack;
1666
+ target.stack = targetStack + causeStack;
1667
+ Object.defineProperty(target, $causeStack, {
1668
+ __proto__: null,
1669
+ value: causeStack
1670
+ });
1671
+ } catch (e) {
1672
+ // Ignore failures from custom stack hooks or un-writable stack properties.
1673
+ }
1674
+ }
1286
1675
  class AxiosError extends Error {
1287
1676
  static from(error, code, config, request, response, customProps) {
1288
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
1289
- axiosError.cause = error;
1677
+ // `AggregateError` (thrown by Node on dual-stack/Happy-Eyeballs connection
1678
+ // failures) has an empty `message`; its detail lives in `errors[]`. Without
1679
+ // this, the wrapped error surfaces with a blank message (see #6721).
1680
+ let message = error.message;
1681
+ if (!message && utils$1.isArray(error.errors) && error.errors.length) {
1682
+ message = aggregateErrorMessage(error);
1683
+ }
1684
+ const axiosError = new AxiosError(message, code || error.code, config, request, response);
1685
+ // Match native `Error` `cause` semantics: non-enumerable. The wrapped
1686
+ // error often carries circular internals (sockets, requests, agents), so
1687
+ // an enumerable `cause` makes structured loggers (pino/winston) and any
1688
+ // own-property walk throw "Converting circular structure to JSON".
1689
+ // Regression from #6982; see #7205. `__proto__: null` mirrors the
1690
+ // `message` descriptor below (prototype-pollution-safe descriptor).
1691
+ Object.defineProperty(axiosError, 'cause', {
1692
+ __proto__: null,
1693
+ value: error,
1694
+ writable: true,
1695
+ enumerable: false,
1696
+ configurable: true
1697
+ });
1290
1698
  axiosError.name = error.name;
1291
1699
 
1700
+ // Inline the wrapped stack for reporters that read only `stack`; the `cause`
1701
+ // property above already covers cause-aware tooling.
1702
+ appendCauseStack(axiosError, error);
1703
+
1292
1704
  // Preserve status from the original error if not already set from response
1293
1705
  if (error.status != null && axiosError.status == null) {
1294
1706
  axiosError.status = error.status;
@@ -1377,6 +1789,19 @@ AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1377
1789
  AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1378
1790
  AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1379
1791
 
1792
+ var PlatformBuffer = {
1793
+ isBufferAvailable() {
1794
+ return typeof Buffer !== 'undefined';
1795
+ },
1796
+ from(value) {
1797
+ return Buffer.from(value);
1798
+ }
1799
+ };
1800
+
1801
+ // Default nesting limit shared with the inverse transform (formDataToJSON) so
1802
+ // the FormData <-> JSON round-trip stays symmetric.
1803
+ const DEFAULT_FORM_DATA_MAX_DEPTH = 100;
1804
+
1380
1805
  /**
1381
1806
  * Determines if the given thing is a array or js object.
1382
1807
  *
@@ -1461,24 +1886,19 @@ function toFormData(obj, formData, options) {
1461
1886
 
1462
1887
  // eslint-disable-next-line no-param-reassign
1463
1888
  formData = formData || new (FormData$1 || FormData)();
1464
-
1465
- // eslint-disable-next-line no-param-reassign
1466
- options = utils$1.toFlatObject(options, {
1467
- metaTokens: true,
1468
- dots: false,
1469
- indexes: false
1470
- }, false, function defined(option, source) {
1471
- // eslint-disable-next-line no-eq-null,eqeqeq
1472
- return !utils$1.isUndefined(source[option]);
1473
- });
1474
- const metaTokens = options.metaTokens;
1889
+ const option = (name, fallback) => {
1890
+ const value = utils$1.getSafeProp(options, name);
1891
+ return utils$1.isUndefined(value) ? fallback : value;
1892
+ };
1893
+ const metaTokens = option('metaTokens', true);
1475
1894
  // eslint-disable-next-line no-use-before-define
1476
- const visitor = options.visitor || defaultVisitor;
1477
- const dots = options.dots;
1478
- const indexes = options.indexes;
1479
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1480
- const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1895
+ const visitor = option('visitor') || defaultVisitor;
1896
+ const dots = option('dots', false);
1897
+ const indexes = option('indexes', false);
1898
+ const _Blob = option('Blob') || typeof Blob !== 'undefined' && Blob;
1899
+ const maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
1481
1900
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1901
+ const stack = [];
1482
1902
  if (!utils$1.isFunction(visitor)) {
1483
1903
  throw new TypeError('visitor must be a function');
1484
1904
  }
@@ -1494,10 +1914,38 @@ function toFormData(obj, formData, options) {
1494
1914
  throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1495
1915
  }
1496
1916
  if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1497
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1917
+ if (useBlob && typeof _Blob === 'function') {
1918
+ return new _Blob([value]);
1919
+ }
1920
+ if (PlatformBuffer && PlatformBuffer.isBufferAvailable()) {
1921
+ return PlatformBuffer.from(value);
1922
+ }
1923
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.', AxiosError.ERR_NOT_SUPPORT);
1498
1924
  }
1499
1925
  return value;
1500
1926
  }
1927
+ function throwIfMaxDepthExceeded(depth) {
1928
+ if (depth > maxDepth) {
1929
+ throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
1930
+ }
1931
+ }
1932
+ function stringifyWithDepthLimit(value, depth) {
1933
+ if (maxDepth === Infinity) {
1934
+ return JSON.stringify(value);
1935
+ }
1936
+ const ancestors = [];
1937
+ return JSON.stringify(value, function limitDepth(_key, currentValue) {
1938
+ if (!utils$1.isObject(currentValue)) {
1939
+ return currentValue;
1940
+ }
1941
+ while (ancestors.length && ancestors[ancestors.length - 1] !== this) {
1942
+ ancestors.pop();
1943
+ }
1944
+ ancestors.push(currentValue);
1945
+ throwIfMaxDepthExceeded(depth + ancestors.length - 1);
1946
+ return currentValue;
1947
+ });
1948
+ }
1501
1949
 
1502
1950
  /**
1503
1951
  * Default visitor.
@@ -1520,7 +1968,7 @@ function toFormData(obj, formData, options) {
1520
1968
  // eslint-disable-next-line no-param-reassign
1521
1969
  key = metaTokens ? key : key.slice(0, -2);
1522
1970
  // eslint-disable-next-line no-param-reassign
1523
- value = JSON.stringify(value);
1971
+ value = stringifyWithDepthLimit(value, 1);
1524
1972
  } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
1525
1973
  // eslint-disable-next-line no-param-reassign
1526
1974
  key = removeBrackets(key);
@@ -1538,7 +1986,6 @@ function toFormData(obj, formData, options) {
1538
1986
  formData.append(renderKey(path, key, dots), convertValue(value));
1539
1987
  return false;
1540
1988
  }
1541
- const stack = [];
1542
1989
  const exposedHelpers = Object.assign(predicates, {
1543
1990
  defaultVisitor,
1544
1991
  convertValue,
@@ -1546,9 +1993,7 @@ function toFormData(obj, formData, options) {
1546
1993
  });
1547
1994
  function build(value, path, depth = 0) {
1548
1995
  if (utils$1.isUndefined(value)) return;
1549
- if (depth > maxDepth) {
1550
- throw new AxiosError('Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
1551
- }
1996
+ throwIfMaxDepthExceeded(depth);
1552
1997
  if (stack.indexOf(value) !== -1) {
1553
1998
  throw new Error('Circular reference detected in ' + path.join('.'));
1554
1999
  }
@@ -1607,9 +2052,7 @@ prototype.append = function append(name, value) {
1607
2052
  this._pairs.push([name, value]);
1608
2053
  };
1609
2054
  prototype.toString = function toString(encoder) {
1610
- const _encode = encoder ? function (value) {
1611
- return encoder.call(this, value, encode$1);
1612
- } : encode$1;
2055
+ const _encode = encoder ? value => encoder.call(this, value, encode$1) : encode$1;
1613
2056
  return this._pairs.map(function each(pair) {
1614
2057
  return _encode(pair[0]) + '=' + _encode(pair[1]);
1615
2058
  }, '').join('&');
@@ -1640,11 +2083,16 @@ function buildURL(url, params, options) {
1640
2083
  if (!params) {
1641
2084
  return url;
1642
2085
  }
1643
- const _encode = options && options.encode || encode;
2086
+ url = url || '';
1644
2087
  const _options = utils$1.isFunction(options) ? {
1645
2088
  serialize: options
1646
2089
  } : options;
1647
- const serializeFn = _options && _options.serialize;
2090
+
2091
+ // Read serializer options pollution-safely: own properties and methods on a
2092
+ // class/template prototype are honored, but values injected onto a polluted
2093
+ // Object.prototype are ignored.
2094
+ const _encode = utils$1.getSafeProp(_options, 'encode') || encode;
2095
+ const serializeFn = utils$1.getSafeProp(_options, 'serialize');
1648
2096
  let serializedParams;
1649
2097
  if (serializeFn) {
1650
2098
  serializedParams = serializeFn(params, _options);
@@ -1661,9 +2109,60 @@ function buildURL(url, params, options) {
1661
2109
  return url;
1662
2110
  }
1663
2111
 
2112
+ const $internals = Symbol('internals');
2113
+
2114
+ // `handlers` is public and may be replaced with a nullish value by user code;
2115
+ // `clear()` has always tolerated that. Treat it as an empty stack rather than
2116
+ // dereferencing it.
2117
+ function countHandlers(handlers) {
2118
+ return handlers ? handlers.length : 0;
2119
+ }
2120
+ function trimHandlers(handlers) {
2121
+ if (!handlers) {
2122
+ return;
2123
+ }
2124
+ while (handlers.length && handlers[handlers.length - 1] === null) {
2125
+ handlers.pop();
2126
+ }
2127
+ }
2128
+
2129
+ // Preserve the array-key coercion used before IDs were stored in a Map, without
2130
+ // treating null, empty strings, or noncanonical numeric strings as ID zero.
2131
+ function normalizeHandlerId(id) {
2132
+ if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
2133
+ return Number(id);
2134
+ }
2135
+ return id;
2136
+ }
2137
+ function syncHandlerEntries(manager, internals) {
2138
+ const handlers = manager.handlers;
2139
+ const length = countHandlers(handlers);
2140
+ if (handlers !== internals.handlersRef) {
2141
+ internals.handlersRef = handlers;
2142
+ internals.handlerEntries.clear();
2143
+ } else if (length !== internals.handlersLength) {
2144
+ if (!length) {
2145
+ internals.handlerEntries.clear();
2146
+ } else {
2147
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
2148
+ if (handlers[entry.index] !== entry.handler) {
2149
+ internals.handlerEntries.delete(id);
2150
+ }
2151
+ });
2152
+ }
2153
+ }
2154
+ internals.handlersLength = length;
2155
+ }
1664
2156
  class InterceptorManager {
1665
2157
  constructor() {
1666
2158
  this.handlers = [];
2159
+ this[$internals] = {
2160
+ handlersRef: this.handlers,
2161
+ handlersLength: this.handlers.length,
2162
+ handlerEntries: new Map(),
2163
+ iterationDepth: 0,
2164
+ nextId: 0
2165
+ };
1667
2166
  }
1668
2167
 
1669
2168
  /**
@@ -1676,13 +2175,25 @@ class InterceptorManager {
1676
2175
  * @return {Number} An ID used to remove interceptor later
1677
2176
  */
1678
2177
  use(fulfilled, rejected, options) {
1679
- this.handlers.push({
2178
+ const handler = {
1680
2179
  fulfilled,
1681
2180
  rejected,
1682
2181
  synchronous: options ? options.synchronous : false,
1683
2182
  runWhen: options ? options.runWhen : null
2183
+ };
2184
+ const internals = this[$internals];
2185
+ if (this.handlers == null) {
2186
+ this.handlers = [];
2187
+ }
2188
+ syncHandlerEntries(this, internals);
2189
+ const id = internals.nextId++;
2190
+ this.handlers.push(handler);
2191
+ internals.handlerEntries.set(id, {
2192
+ handler,
2193
+ index: this.handlers.length - 1
1684
2194
  });
1685
- return this.handlers.length - 1;
2195
+ internals.handlersLength = this.handlers.length;
2196
+ return id;
1686
2197
  }
1687
2198
 
1688
2199
  /**
@@ -1693,8 +2204,24 @@ class InterceptorManager {
1693
2204
  * @returns {void}
1694
2205
  */
1695
2206
  eject(id) {
1696
- if (this.handlers[id]) {
1697
- this.handlers[id] = null;
2207
+ const internals = this[$internals];
2208
+ syncHandlerEntries(this, internals);
2209
+ const handlerId = normalizeHandlerId(id);
2210
+ const entry = internals.handlerEntries.get(handlerId);
2211
+ if (entry) {
2212
+ internals.handlerEntries.delete(handlerId);
2213
+
2214
+ // Ignore IDs invalidated by clear or direct replacement of handlers.
2215
+ if (this.handlers[entry.index] !== entry.handler) {
2216
+ return;
2217
+ }
2218
+ this.handlers[entry.index] = null;
2219
+
2220
+ // Do not reuse an index while forEach is walking its length snapshot.
2221
+ if (!internals.iterationDepth) {
2222
+ trimHandlers(this.handlers);
2223
+ internals.handlersLength = this.handlers.length;
2224
+ }
1698
2225
  }
1699
2226
  }
1700
2227
 
@@ -1706,6 +2233,7 @@ class InterceptorManager {
1706
2233
  clear() {
1707
2234
  if (this.handlers) {
1708
2235
  this.handlers = [];
2236
+ syncHandlerEntries(this, this[$internals]);
1709
2237
  }
1710
2238
  }
1711
2239
 
@@ -1720,11 +2248,22 @@ class InterceptorManager {
1720
2248
  * @returns {void}
1721
2249
  */
1722
2250
  forEach(fn) {
1723
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1724
- if (h !== null) {
1725
- fn(h);
2251
+ const internals = this[$internals];
2252
+ syncHandlerEntries(this, internals);
2253
+ internals.iterationDepth++;
2254
+ try {
2255
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2256
+ if (h !== null) {
2257
+ fn(h);
2258
+ }
2259
+ });
2260
+ } finally {
2261
+ if (! --internals.iterationDepth) {
2262
+ syncHandlerEntries(this, internals);
2263
+ trimHandlers(this.handlers);
2264
+ internals.handlersLength = countHandlers(this.handlers);
1726
2265
  }
1727
- });
2266
+ }
1728
2267
  }
1729
2268
  }
1730
2269
 
@@ -1733,7 +2272,9 @@ var transitionalDefaults = {
1733
2272
  forcedJSONParsing: true,
1734
2273
  clarifyTimeoutError: false,
1735
2274
  legacyInterceptorReqResOrdering: true,
1736
- advertiseZstdAcceptEncoding: false
2275
+ advertiseZstdAcceptEncoding: false,
2276
+ validateStatusUndefinedResolves: true,
2277
+ encodeBasicAuthUsername: false
1737
2278
  };
1738
2279
 
1739
2280
  var URLSearchParams = url.URLSearchParams;
@@ -1834,6 +2375,13 @@ function toURLEncodedForm(data, options) {
1834
2375
  });
1835
2376
  }
1836
2377
 
2378
+ const MAX_DEPTH = DEFAULT_FORM_DATA_MAX_DEPTH;
2379
+ function throwIfDepthExceeded(index) {
2380
+ if (index > MAX_DEPTH) {
2381
+ throw new AxiosError('FormData field is too deeply nested (' + index + ' levels). Max depth: ' + MAX_DEPTH, AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED);
2382
+ }
2383
+ }
2384
+
1837
2385
  /**
1838
2386
  * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1839
2387
  *
@@ -1842,13 +2390,24 @@ function toURLEncodedForm(data, options) {
1842
2390
  * @returns An array of strings.
1843
2391
  */
1844
2392
  function parsePropPath(name) {
1845
- // foo[x][y][z]
1846
- // foo.x.y.z
1847
- // foo-x-y-z
1848
- // foo x y z
1849
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1850
- return match[0] === '[]' ? '' : match[1] || match[0];
1851
- });
2393
+ // foo[x][y][z] -> ['foo', 'x', 'y', 'z']
2394
+ // foo.x.y.z -> ['foo', 'x', 'y', 'z']
2395
+ // A path is split on `.` and on `[...]` groups. A segment — whether written
2396
+ // in dot notation or captured inside brackets — may contain any character
2397
+ // except `.`, `[` and `]`, so a key like `user-name` or `user name` is kept
2398
+ // literal instead of being split (#5402). `.`, `[` and `]` keep their existing
2399
+ // meaning, e.g. `foo[bar.baz]` -> ['foo', 'bar', 'baz'] and `[]` is an array push.
2400
+ // Excluding `[` from the bracket group also makes the match fail fast at the
2401
+ // next `[`, so a malformed name cannot rescan to the end of the string from
2402
+ // every unmatched `[` — parsing stays linear in the length of the name.
2403
+ const path = [];
2404
+ const pattern = /[^.[\]]+|\[([^.[\]]*)]/g;
2405
+ let match;
2406
+ while ((match = pattern.exec(name)) !== null) {
2407
+ throwIfDepthExceeded(path.length);
2408
+ path.push(match[0] === '[]' ? '' : match[1] || match[0]);
2409
+ }
2410
+ return path;
1852
2411
  }
1853
2412
 
1854
2413
  /**
@@ -1870,6 +2429,24 @@ function arrayToObject(arr) {
1870
2429
  }
1871
2430
  return obj;
1872
2431
  }
2432
+ function normalizeArray(value) {
2433
+ if (!utils$1.isArray(value)) return value;
2434
+ const keys = Object.keys(value);
2435
+ return keys.length !== value.length || keys.some((key, index) => key !== String(index)) ? arrayToObject(value) : value;
2436
+ }
2437
+ function normalizeArrays(obj) {
2438
+ const pending = [obj];
2439
+ while (pending.length) {
2440
+ const target = pending.pop();
2441
+ Object.keys(target).forEach(key => {
2442
+ const value = target[key] = normalizeArray(target[key]);
2443
+ if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
2444
+ pending.push(value);
2445
+ }
2446
+ });
2447
+ }
2448
+ return obj;
2449
+ }
1873
2450
 
1874
2451
  /**
1875
2452
  * It takes a FormData object and returns a JavaScript object
@@ -1880,6 +2457,7 @@ function arrayToObject(arr) {
1880
2457
  */
1881
2458
  function formDataToJSON(formData) {
1882
2459
  function buildPath(path, value, target, index) {
2460
+ throwIfDepthExceeded(index);
1883
2461
  let name = path[index++];
1884
2462
  if (name === '__proto__') return true;
1885
2463
  const isNumericKey = Number.isFinite(+name);
@@ -1887,6 +2465,7 @@ function formDataToJSON(formData) {
1887
2465
  name = !name && utils$1.isArray(target) ? target.length : name;
1888
2466
  if (isLast) {
1889
2467
  if (utils$1.hasOwnProp(target, name)) {
2468
+ target[name] = normalizeArray(target[name]);
1890
2469
  target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
1891
2470
  } else {
1892
2471
  target[name] = value;
@@ -1907,11 +2486,13 @@ function formDataToJSON(formData) {
1907
2486
  utils$1.forEachEntry(formData, (name, value) => {
1908
2487
  buildPath(parsePropPath(name), value, obj, 0);
1909
2488
  });
1910
- return obj;
2489
+ return normalizeArrays(obj);
1911
2490
  }
1912
2491
  return null;
1913
2492
  }
1914
2493
 
2494
+ const methodList = Object.freeze(['get', 'delete', 'head', 'options', 'post', 'put', 'patch', 'purge', 'link', 'unlink', 'query']);
2495
+
1915
2496
  const own = (obj, key) => obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
1916
2497
 
1917
2498
  /**
@@ -2028,7 +2609,7 @@ const defaults = {
2028
2609
  }
2029
2610
  }
2030
2611
  };
2031
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], method => {
2612
+ utils$1.forEach(methodList, method => {
2032
2613
  defaults.headers[method] = {};
2033
2614
  });
2034
2615
 
@@ -2117,7 +2698,71 @@ function isAbsoluteURL(url) {
2117
2698
  * @returns {string} The combined URL
2118
2699
  */
2119
2700
  function combineURLs(baseURL, relativeURL) {
2120
- return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
2701
+ if (!relativeURL) {
2702
+ return baseURL;
2703
+ }
2704
+ let end = baseURL.length;
2705
+ while (end > 0 && baseURL.charCodeAt(end - 1) === 47) {
2706
+ end--;
2707
+ }
2708
+ return baseURL.slice(0, end) + '/' + relativeURL.replace(/^\/+/, '');
2709
+ }
2710
+
2711
+ const urlParserControlCharacters = /[\t\n\r]/g;
2712
+
2713
+ /**
2714
+ * Match WHATWG URL preprocessing before checking a URL's protocol.
2715
+ *
2716
+ * @param {string} url
2717
+ *
2718
+ * @returns {string}
2719
+ */
2720
+ function normalizeURLForProtocolCheck(url) {
2721
+ if (typeof url !== 'string') {
2722
+ return url;
2723
+ }
2724
+ let start = 0;
2725
+ while (start < url.length && url.charCodeAt(start) <= 0x20) {
2726
+ start++;
2727
+ }
2728
+ return url.slice(start).replace(urlParserControlCharacters, '');
2729
+ }
2730
+
2731
+ const malformedHttpProtocol = /^https?:(?!\/\/)/i;
2732
+
2733
+ // Redact the parts of a URL that can carry secrets before it is embedded in an
2734
+ // error message. AxiosError.toJSON() serializes `message` verbatim and errors
2735
+ // are commonly logged, while the opt-in `config.redact` model only cleans
2736
+ // config keys — it cannot reach the message. Redact only the genuinely
2737
+ // sensitive substrings — userinfo (credentials), query parameter values and
2738
+ // fragment contents — with the same REDACTED marker the config redaction uses,
2739
+ // while keeping the scheme, host, path and parameter names so the offending
2740
+ // request stays accurately identifiable.
2741
+ function redactFragment(fragment) {
2742
+ if (!fragment) {
2743
+ return fragment;
2744
+ }
2745
+ return fragment.replace(/(^|&)([^=&]*=)?[^&]+/g, (match, separator, parameterName = '') => {
2746
+ return `${separator}${parameterName}${REDACTED}`;
2747
+ });
2748
+ }
2749
+ function redactSensitiveURLParts(url) {
2750
+ const redactedURL = url.replace(/^(https?:\/{0,2})[^/?#]*@/i, `$1${REDACTED}@`);
2751
+ const fragmentIndex = redactedURL.indexOf('#');
2752
+ const urlWithoutFragment = fragmentIndex === -1 ? redactedURL : redactedURL.slice(0, fragmentIndex);
2753
+ const redactedURLWithoutFragment = urlWithoutFragment.replace(/([?&][^=&#]*=)[^&#]*/g, `$1${REDACTED}`);
2754
+ if (fragmentIndex === -1) {
2755
+ return redactedURLWithoutFragment;
2756
+ }
2757
+ return `${redactedURLWithoutFragment}#${redactFragment(redactedURL.slice(fragmentIndex + 1))}`;
2758
+ }
2759
+ function assertValidHttpProtocolURL(url, config) {
2760
+ if (typeof url === 'string') {
2761
+ const normalizedURL = normalizeURLForProtocolCheck(url);
2762
+ if (malformedHttpProtocol.test(normalizedURL)) {
2763
+ throw new AxiosError(`Invalid URL ${JSON.stringify(redactSensitiveURLParts(normalizedURL))}: missing "//" after protocol`, AxiosError.ERR_INVALID_URL, config);
2764
+ }
2765
+ }
2121
2766
  }
2122
2767
 
2123
2768
  /**
@@ -2130,9 +2775,11 @@ function combineURLs(baseURL, relativeURL) {
2130
2775
  *
2131
2776
  * @returns {string} The combined full path
2132
2777
  */
2133
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2778
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls, config) {
2779
+ assertValidHttpProtocolURL(requestedURL, config);
2134
2780
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2135
2781
  if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2782
+ assertValidHttpProtocolURL(baseURL, config);
2136
2783
  return combineURLs(baseURL, requestedURL);
2137
2784
  }
2138
2785
  return requestedURL;
@@ -2234,16 +2881,19 @@ function getEnv(key) {
2234
2881
  return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
2235
2882
  }
2236
2883
 
2237
- const VERSION = "1.17.0";
2884
+ const VERSION = "1.21.1";
2238
2885
 
2239
2886
  function parseProtocol(url) {
2240
2887
  const match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2241
- return match && match[1] || '';
2888
+ return match && match[1].toLowerCase() || '';
2242
2889
  }
2243
2890
 
2244
2891
  // RFC 2397: data:[<mediatype>][;base64],<data>
2245
2892
  // mediatype = type/subtype followed by optional ;name=value parameters
2246
- const DATA_URL_PATTERN = /^([^,;]+\/[^,;]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/;
2893
+ // The `i` flag makes the `;base64` token case-insensitive, matching the WHATWG
2894
+ // URL/Fetch data URL processor (and therefore the fetch adapter and browsers).
2895
+ // The remaining character classes do not depend on letter case.
2896
+ const DATA_URL_PATTERN = /^([^,;/]+\/[^,;/]+)?((?:;[^,;=]+=[^,;]+)*)(;base64)?,([\s\S]*)$/i;
2247
2897
 
2248
2898
  /**
2249
2899
  * Parse data uri to a Buffer or Blob
@@ -2274,13 +2924,13 @@ function fromDataURI(uri, asBlob, options) {
2274
2924
 
2275
2925
  // RFC 2397 section 3: default mediatype is text/plain;charset=US-ASCII
2276
2926
  // Bare `data:,` leaves mime undefined; Blob normalises that to "" per spec.
2277
- let mime;
2927
+ let mime = '';
2278
2928
  if (type) {
2279
2929
  mime = params ? type + params : type;
2280
2930
  } else if (params) {
2281
2931
  mime = 'text/plain' + params;
2282
2932
  }
2283
- const buffer = Buffer.from(decodeURIComponent(body), encoding);
2933
+ const buffer = encoding === 'base64' ? Buffer.from(body.replace(/%([\da-f]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16))), 'base64') : Buffer.from(decodeURIComponent(body), encoding);
2284
2934
  if (asBlob) {
2285
2935
  if (!_Blob) {
2286
2936
  throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
@@ -2294,17 +2944,42 @@ function fromDataURI(uri, asBlob, options) {
2294
2944
  throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
2295
2945
  }
2296
2946
 
2297
- const kInternals = Symbol('internals');
2298
- class AxiosTransformStream extends stream.Transform {
2299
- constructor(options) {
2300
- options = utils$1.toFlatObject(options, {
2301
- maxRate: 0,
2302
- chunkSize: 64 * 1024,
2303
- minChunkSize: 100,
2304
- timeWindow: 500,
2305
- ticksRate: 2,
2306
- samplesCount: 15
2307
- }, null, (prop, source) => {
2947
+ const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
2948
+
2949
+ /**
2950
+ * Apply the headers generated by a FormData implementation to the request headers,
2951
+ * honoring the `formDataHeaderPolicy` option: with 'content-only', copy only the
2952
+ * content-* headers; otherwise merge all of them.
2953
+ *
2954
+ * @param {AxiosHeaders} headers - the request headers to mutate
2955
+ * @param {Object | null | undefined} formHeaders - headers produced by the FormData implementation
2956
+ * @param {String} [policy] - the resolved `formDataHeaderPolicy` config value
2957
+ *
2958
+ * @returns {void}
2959
+ */
2960
+ function setFormDataHeaders(headers, formHeaders, policy) {
2961
+ if (policy !== 'content-only') {
2962
+ headers.set(formHeaders);
2963
+ return;
2964
+ }
2965
+ Object.entries(formHeaders || {}).forEach(([key, val]) => {
2966
+ if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
2967
+ headers.set(key, val);
2968
+ }
2969
+ });
2970
+ }
2971
+
2972
+ const kInternals = Symbol('internals');
2973
+ class AxiosTransformStream extends stream.Transform {
2974
+ constructor(options) {
2975
+ options = utils$1.toFlatObject(options, {
2976
+ maxRate: 0,
2977
+ chunkSize: 64 * 1024,
2978
+ minChunkSize: 100,
2979
+ timeWindow: 500,
2980
+ ticksRate: 2,
2981
+ samplesCount: 15
2982
+ }, null, (prop, source) => {
2308
2983
  return !utils$1.isUndefined(source[prop]);
2309
2984
  });
2310
2985
  super({
@@ -2344,7 +3019,10 @@ class AxiosTransformStream extends stream.Transform {
2344
3019
  const timeWindow = internals.timeWindow;
2345
3020
  const divider = 1000 / timeWindow;
2346
3021
  const bytesThreshold = maxRate / divider;
2347
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
3022
+ let minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
3023
+ if (maxRate) {
3024
+ minChunkSize = Math.min(bytesThreshold, minChunkSize);
3025
+ }
2348
3026
  const pushChunk = (_chunk, _callback) => {
2349
3027
  const bytes = Buffer.byteLength(_chunk);
2350
3028
  internals.bytesSeen += bytes;
@@ -2360,6 +3038,9 @@ class AxiosTransformStream extends stream.Transform {
2360
3038
  }
2361
3039
  };
2362
3040
  const transformChunk = (_chunk, _callback) => {
3041
+ if (this.destroyed) {
3042
+ return _callback();
3043
+ }
2363
3044
  const chunkSize = Buffer.byteLength(_chunk);
2364
3045
  let chunkRemainder = null;
2365
3046
  let maxChunkSize = readableHighWaterMark;
@@ -2383,7 +3064,9 @@ class AxiosTransformStream extends stream.Transform {
2383
3064
  }, timeWindow - passed);
2384
3065
  }
2385
3066
  if (bytesLeft < maxChunkSize) {
2386
- maxChunkSize = bytesLeft;
3067
+ // A buffer boundary must consume at least one byte. Carry any
3068
+ // fractional allowance forward in the next accounting window.
3069
+ maxChunkSize = Math.max(1, Math.floor(bytesLeft));
2387
3070
  }
2388
3071
  }
2389
3072
  if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
@@ -2424,8 +3107,8 @@ const readBlob = async function* (blob) {
2424
3107
 
2425
3108
  const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
2426
3109
  const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
2427
- const CRLF = '\r\n';
2428
- const CRLF_BYTES = textEncoder.encode(CRLF);
3110
+ const CRLF$1 = '\r\n';
3111
+ const CRLF_BYTES = textEncoder.encode(CRLF$1);
2429
3112
  const CRLF_BYTES_COUNT = 2;
2430
3113
  class FormDataPart {
2431
3114
  constructor(name, value) {
@@ -2433,14 +3116,14 @@ class FormDataPart {
2433
3116
  escapeName
2434
3117
  } = this.constructor;
2435
3118
  const isStringValue = utils$1.isString(value);
2436
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''}${CRLF}`;
3119
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''}${CRLF$1}`;
2437
3120
  if (isStringValue) {
2438
- value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
3121
+ value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF$1));
2439
3122
  } else {
2440
3123
  const safeType = String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
2441
- headers += `Content-Type: ${safeType}${CRLF}`;
3124
+ headers += `Content-Type: ${safeType}${CRLF$1}`;
2442
3125
  }
2443
- this.headers = textEncoder.encode(headers + CRLF);
3126
+ this.headers = textEncoder.encode(headers + CRLF$1);
2444
3127
  this.contentLength = isStringValue ? value.byteLength : value.size;
2445
3128
  this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
2446
3129
  this.name = name;
@@ -2478,8 +3161,8 @@ const formDataToStream = (form, headersHandler, options) => {
2478
3161
  if (boundary.length < 1 || boundary.length > 70) {
2479
3162
  throw new Error('boundary must be 1-70 characters long');
2480
3163
  }
2481
- const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2482
- const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
3164
+ const boundaryBytes = textEncoder.encode('--' + boundary + CRLF$1);
3165
+ const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF$1);
2483
3166
  let contentLength = footerBytes.byteLength;
2484
3167
  const parts = Array.from(form.entries()).map(([name, value]) => {
2485
3168
  const part = new FormDataPart(name, value);
@@ -2531,7 +3214,7 @@ class Http2Sessions {
2531
3214
  this.sessions = Object.create(null);
2532
3215
  }
2533
3216
  getSession(authority, options) {
2534
- options = Object.assign({
3217
+ options = Object.assign(Object.create(null), {
2535
3218
  sessionTimeout: 1000
2536
3219
  }, options);
2537
3220
  let authoritySessions = this.sessions[authority];
@@ -2587,7 +3270,7 @@ class Http2Sessions {
2587
3270
  timer = null;
2588
3271
  }
2589
3272
  stream.once('close', () => {
2590
- if (! --streamsCount) {
3273
+ if (! --streamsCount && !removed) {
2591
3274
  timer = setTimeout(() => {
2592
3275
  timer = null;
2593
3276
  removeSession();
@@ -2598,6 +3281,8 @@ class Http2Sessions {
2598
3281
  };
2599
3282
  }
2600
3283
  session.once('close', removeSession);
3284
+ session.once('error', removeSession);
3285
+ session.once('goaway', removeSession);
2601
3286
  let entry = [session, options];
2602
3287
  authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
2603
3288
  return session;
@@ -2617,13 +3302,139 @@ const callbackify = (fn, reducer) => {
2617
3302
  } : fn;
2618
3303
  };
2619
3304
 
2620
- const LOOPBACK_HOSTNAMES = new Set(['localhost']);
3305
+ const LOOPBACK_HOSTNAMES = new Set(['localhost', '0.0.0.0']);
3306
+ const trimTrailingDots = value => {
3307
+ let end = value.length;
3308
+ while (end && value.charCodeAt(end - 1) === 46) {
3309
+ end--;
3310
+ }
3311
+ return end === value.length ? value : value.slice(0, end);
3312
+ };
2621
3313
  const isIPv4Loopback = host => {
2622
3314
  const parts = host.split('.');
2623
3315
  if (parts.length !== 4) return false;
2624
3316
  if (parts[0] !== '127') return false;
2625
3317
  return parts.every(p => /^\d+$/.test(p) && Number(p) >= 0 && Number(p) <= 255);
2626
3318
  };
3319
+
3320
+ /**
3321
+ * Canonicalize an IPv4 address written in shorthand, octal, or hex form into
3322
+ * dotted-decimal. IPv6 addresses and non-IP strings are returned unchanged so
3323
+ * the existing IPv4-mapped IPv6 unmap path and the isLoopback path can still
3324
+ * see them.
3325
+ *
3326
+ * Shorthand expansion mirrors Node's URL parser: literal parts fill from the
3327
+ * left, the final part fills the remaining octets from the right with
3328
+ * zero-padding on the left.
3329
+ * 127.1 -> 127.0.0.1
3330
+ * 127.0.1 -> 127.0.0.1
3331
+ * 1.2.3 -> 1.2.0.3
3332
+ *
3333
+ * Each octet is parsed with an explicit base: 16 for `0x`/`0X` prefix, 8 for
3334
+ * zero-prefixed multi-digit all-`0-7` parts, 10 otherwise. Zero-prefixed
3335
+ * decimal-looking parts that contain `8` or `9` are rejected to match Node's
3336
+ * URL parser, and the comparison layer falls through to non-bypass if either
3337
+ * side rejects the form (fail-safe).
3338
+ *
3339
+ * Returns the input unchanged on any parse failure, out-of-range octet, or
3340
+ * unusual shape (1-part, 5+ parts) so the comparison layer fails closed.
3341
+ */
3342
+ const parseIPv4Octet = text => {
3343
+ if (/^0[xX][0-9a-fA-F]+$/.test(text)) {
3344
+ const n = parseInt(text.slice(2), 16);
3345
+ return Number.isFinite(n) ? n : null;
3346
+ }
3347
+ if (text.length > 1 && /^0[0-7]+$/.test(text)) {
3348
+ const n = parseInt(text, 8);
3349
+ return Number.isFinite(n) ? n : null;
3350
+ }
3351
+ if (text.length > 1 && /^0[0-9]+$/.test(text)) {
3352
+ return null;
3353
+ }
3354
+ if (/^[0-9]+$/.test(text)) {
3355
+ const n = parseInt(text, 10);
3356
+ return Number.isFinite(n) ? n : null;
3357
+ }
3358
+ return null;
3359
+ };
3360
+ const normalizeIPAddress = host => {
3361
+ if (typeof host !== 'string' || !host || host.indexOf(':') !== -1) {
3362
+ return host;
3363
+ }
3364
+ let h = host;
3365
+ if (h.charAt(0) === '[' && h.charAt(h.length - 1) === ']') {
3366
+ h = h.slice(1, -1);
3367
+ }
3368
+ h = trimTrailingDots(h);
3369
+
3370
+ // Allowed characters for any IPv4 shape: digits, dot, 'x', 'X', hex digits.
3371
+ if (!/^[0-9.xXa-fA-F]+$/.test(h)) return host;
3372
+ const parts = h.split('.');
3373
+
3374
+ // No part may be empty (e.g. "127..0.1" or "127.0.0."). Trailing dots are
3375
+ // already stripped above; this guards against the empty-middle case.
3376
+ if (parts.some(p => p === '')) return host;
3377
+ if (parts.length === 4) {
3378
+ // Full IPv4 form: each part is an octet.
3379
+ const octets = parts.map(parseIPv4Octet);
3380
+ if (octets.some(n => n === null || n < 0 || n > 255)) return host;
3381
+ return octets.join('.');
3382
+ }
3383
+ if (parts.length > 4) {
3384
+ return host;
3385
+ }
3386
+
3387
+ // Shorthand: 1..3 parts. Node's URL parser treats a 1-part input as a 32-bit
3388
+ // integer split into octets, which has surprising semantics (e.g. "127" ->
3389
+ // "0.0.0.127"). Reject 1-part inputs to keep the helper predictable: the
3390
+ // fail-safe returns the input unchanged and the comparison layer falls
3391
+ // through to non-bypass.
3392
+ if (parts.length === 1) return host;
3393
+
3394
+ // 2..3 parts: literal parts fill from the left, tail fills remaining octets
3395
+ // from the right with zero-padding.
3396
+ const literalOctets = parts.slice(0, -1);
3397
+ const tail = parts[parts.length - 1];
3398
+ const tailSlots = 4 - literalOctets.length;
3399
+
3400
+ // Tail is parsed as a full IPv4 number (hex/octal/decimal) and packed
3401
+ // low-byte-right into the remaining octets, matching Node's URL parser.
3402
+ // e.g. 127.65535 (tail 0xFFFF into 3 slots) -> 127.0.255.255;
3403
+ // 127.0x00ff (tail 0xFF into 3 slots) -> 127.0.0.255;
3404
+ // 127.0.65535 (tail 0xFFFF into 2 slots) -> 127.0.255.255.
3405
+ const tailValue = parseIPv4Octet(tail);
3406
+ if (tailValue === null) return host;
3407
+ const maxTail = (1 << 8 * tailSlots) - 1;
3408
+ if (tailValue < 0 || tailValue > maxTail) return host;
3409
+ const tailOctets = new Array(tailSlots).fill(0);
3410
+ for (let i = tailSlots - 1, v = tailValue; i >= 0; i--, v >>= 8) {
3411
+ tailOctets[i] = v & 0xff;
3412
+ }
3413
+ const literal = literalOctets.map(parseIPv4Octet);
3414
+ if (literal.some(n => n === null || n < 0 || n > 255)) return host;
3415
+ return [...literal, ...tailOctets].join('.');
3416
+ };
3417
+ const isIPv6ZeroGroup = group => /^0{1,4}$/.test(group);
3418
+
3419
+ // The unspecified address (IPv4 0.0.0.0 / IPv6 ::) resolves to the local host
3420
+ // for outbound connections, so treat it as loopback-equivalent for NO_PROXY
3421
+ // matching. 0.0.0.0 is covered by LOOPBACK_HOSTNAMES; this handles compressed
3422
+ // and full IPv6 all-zero forms so both families bypass symmetrically.
3423
+ const isIPv6Unspecified = host => {
3424
+ if (host === '::') return true;
3425
+ const compressionIndex = host.indexOf('::');
3426
+ if (compressionIndex !== -1) {
3427
+ if (compressionIndex !== host.lastIndexOf('::')) return false;
3428
+ const left = host.slice(0, compressionIndex);
3429
+ const right = host.slice(compressionIndex + 2);
3430
+ const leftGroups = left ? left.split(':') : [];
3431
+ const rightGroups = right ? right.split(':') : [];
3432
+ const explicitGroups = leftGroups.length + rightGroups.length;
3433
+ return explicitGroups < 8 && leftGroups.every(isIPv6ZeroGroup) && rightGroups.every(isIPv6ZeroGroup);
3434
+ }
3435
+ const groups = host.split(':');
3436
+ return groups.length === 8 && groups.every(isIPv6ZeroGroup);
3437
+ };
2627
3438
  const isIPv6Loopback = host => {
2628
3439
  // Collapse all-zero groups: any form of ::1 / 0:0:...:0:1
2629
3440
  // First, strip any leading "::" by normalising with Set lookup of common forms,
@@ -2656,6 +3467,7 @@ const isLoopback = host => {
2656
3467
  if (!host) return false;
2657
3468
  if (LOOPBACK_HOSTNAMES.has(host)) return true;
2658
3469
  if (isIPv4Loopback(host)) return true;
3470
+ if (isIPv6Unspecified(host)) return true;
2659
3471
  return isIPv6Loopback(host);
2660
3472
  };
2661
3473
  const DEFAULT_PORTS = {
@@ -2708,6 +3520,40 @@ const unmapIPv4MappedIPv6 = host => {
2708
3520
  }
2709
3521
  return host;
2710
3522
  };
3523
+ const IPV4_OCTET_RE = /^(?:0|[1-9]\d{0,2})$/;
3524
+ const ipv4ToBytes = host => {
3525
+ const parts = host.split('.');
3526
+ return parts.length === 4 && parts.every(part => IPV4_OCTET_RE.test(part) && Number(part) <= 255) ? parts.map(Number) : null;
3527
+ };
3528
+ const IPV6_GROUP_RE = /^[0-9a-f]{1,4}$/i;
3529
+ const ipv6ToBytes = host => {
3530
+ const halves = host.split('::');
3531
+ if (halves.length > 2) {
3532
+ return null;
3533
+ }
3534
+ const groups = halves[0] ? halves[0].split(':') : [];
3535
+ if (halves.length === 2) {
3536
+ const rear = halves[1] ? halves[1].split(':') : [];
3537
+ const missing = 8 - groups.length - rear.length;
3538
+ if (missing < 1) {
3539
+ return null;
3540
+ }
3541
+ groups.push(...new Array(missing).fill('0'), ...rear);
3542
+ }
3543
+ if (groups.length !== 8 || groups.some(group => !IPV6_GROUP_RE.test(group))) {
3544
+ return null;
3545
+ }
3546
+ return groups.flatMap(group => {
3547
+ const value = Number.parseInt(group, 16);
3548
+ return [value >> 8 & 0xff, value & 0xff];
3549
+ });
3550
+ };
3551
+ const ipToBytes = host => {
3552
+ if (typeof host !== 'string' || !host) {
3553
+ return null;
3554
+ }
3555
+ return host.indexOf(':') !== -1 ? ipv6ToBytes(host) : ipv4ToBytes(host);
3556
+ };
2711
3557
  const normalizeNoProxyHost = hostname => {
2712
3558
  if (!hostname) {
2713
3559
  return hostname;
@@ -2715,7 +3561,114 @@ const normalizeNoProxyHost = hostname => {
2715
3561
  if (hostname.charAt(0) === '[' && hostname.charAt(hostname.length - 1) === ']') {
2716
3562
  hostname = hostname.slice(1, -1);
2717
3563
  }
2718
- return unmapIPv4MappedIPv6(hostname.replace(/\.+$/, ''));
3564
+ let trimmed = trimTrailingDots(hostname);
3565
+ if (trimmed.indexOf(':') !== -1) {
3566
+ try {
3567
+ trimmed = new URL('http://[' + trimmed + ']/').hostname.slice(1, -1);
3568
+ } catch (_err) {
3569
+ return trimmed;
3570
+ }
3571
+ } else if (/[\u0080-\uffff]/.test(trimmed)) {
3572
+ const prefix = /^[*.]+/.exec(trimmed);
3573
+ const start = prefix ? prefix[0] : '';
3574
+ const ascii = url.domainToASCII(trimmed.slice(start.length));
3575
+ if (!ascii) return '';
3576
+ trimmed = start + trimTrailingDots(ascii);
3577
+ }
3578
+
3579
+ // IPv4 shorthand/octal/hex → dotted-decimal; helper is a no-op for inputs
3580
+ // containing ':' (IPv6 and IPv4-mapped IPv6) so we fall through to unmap.
3581
+ const ipv4 = normalizeIPAddress(trimmed);
3582
+ if (ipv4 !== trimmed) {
3583
+ return ipv4;
3584
+ }
3585
+ return unmapIPv4MappedIPv6(trimmed);
3586
+ };
3587
+ const normalizeCidrBase = input => {
3588
+ let base = input;
3589
+ const startsBracket = base.charAt(0) === '[';
3590
+ const endsBracket = base.charAt(base.length - 1) === ']';
3591
+ const hasBracket = base.includes('[') || base.includes(']');
3592
+ if (startsBracket || endsBracket) {
3593
+ if (!startsBracket || !endsBracket) {
3594
+ return null;
3595
+ }
3596
+ base = base.slice(1, -1);
3597
+ if (base.indexOf(':') === -1 || base.includes('[') || base.includes(']')) {
3598
+ return null;
3599
+ }
3600
+ } else if (hasBracket) {
3601
+ return null;
3602
+ }
3603
+ if (!base || base.charAt(base.length - 1) === '.') {
3604
+ return null;
3605
+ }
3606
+ const wasIPv6 = base.indexOf(':') !== -1;
3607
+ if (wasIPv6) {
3608
+ try {
3609
+ base = new URL(`http://[${base}]/`).hostname.slice(1, -1);
3610
+ } catch (_err) {
3611
+ return null;
3612
+ }
3613
+ } else {
3614
+ base = normalizeIPAddress(base);
3615
+ if (!ipv4ToBytes(base)) {
3616
+ return null;
3617
+ }
3618
+ }
3619
+ return {
3620
+ normalized: unmapIPv4MappedIPv6(base),
3621
+ wasIPv6
3622
+ };
3623
+ };
3624
+ const CIDR_ENTRY_RE = /^(.+)\/(0|[1-9]\d{0,2})$/;
3625
+ const parseCidrEntry = entry => {
3626
+ if (entry.indexOf('/') === -1) {
3627
+ return undefined;
3628
+ }
3629
+ const match = CIDR_ENTRY_RE.exec(entry);
3630
+ if (!match) {
3631
+ return null;
3632
+ }
3633
+ let prefix = Number(match[2]);
3634
+ const parsedBase = normalizeCidrBase(match[1]);
3635
+ if (!parsedBase) {
3636
+ return null;
3637
+ }
3638
+ const {
3639
+ normalized,
3640
+ wasIPv6
3641
+ } = parsedBase;
3642
+ if (wasIPv6 && normalized.indexOf(':') === -1) {
3643
+ if (prefix < 96) {
3644
+ return null;
3645
+ }
3646
+ prefix -= 96;
3647
+ }
3648
+ const bytes = ipToBytes(normalized);
3649
+ if (!bytes || prefix > bytes.length * 8) {
3650
+ return null;
3651
+ }
3652
+ return {
3653
+ bytes,
3654
+ prefix
3655
+ };
3656
+ };
3657
+ const isInSubnet = (addressBytes, networkBytes, prefix) => {
3658
+ const fullBytes = prefix >> 3;
3659
+ for (let i = 0; i < fullBytes; i++) {
3660
+ if (addressBytes[i] !== networkBytes[i]) {
3661
+ return false;
3662
+ }
3663
+ }
3664
+ const remainingBits = prefix & 7;
3665
+ if (remainingBits) {
3666
+ const mask = 0xff << 8 - remainingBits & 0xff;
3667
+ if ((addressBytes[fullBytes] & mask) !== (networkBytes[fullBytes] & mask)) {
3668
+ return false;
3669
+ }
3670
+ }
3671
+ return true;
2719
3672
  };
2720
3673
  function shouldBypassProxy(location) {
2721
3674
  let parsed;
@@ -2733,10 +3686,18 @@ function shouldBypassProxy(location) {
2733
3686
  }
2734
3687
  const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS[parsed.protocol.split(':', 1)[0]] || 0;
2735
3688
  const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
3689
+ const hostnameBytes = ipToBytes(hostname);
2736
3690
  return noProxy.split(/[\s,]+/).some(entry => {
2737
3691
  if (!entry) {
2738
3692
  return false;
2739
3693
  }
3694
+ if (entry === '*') {
3695
+ return true;
3696
+ }
3697
+ const cidr = parseCidrEntry(entry);
3698
+ if (cidr !== undefined) {
3699
+ return cidr !== null && !!hostnameBytes && hostnameBytes.length === cidr.bytes.length && isInSubnet(hostnameBytes, cidr.bytes, cidr.prefix);
3700
+ }
2740
3701
  let [entryHost, entryPort] = parseNoProxyEntry(entry);
2741
3702
  entryHost = normalizeNoProxyHost(entryHost);
2742
3703
  if (!entryHost) {
@@ -2799,7 +3760,7 @@ function speedometer(samplesCount, min) {
2799
3760
  * Throttle decorator
2800
3761
  * @param {Function} fn
2801
3762
  * @param {Number} freq
2802
- * @return {Function}
3763
+ * @return {Array<Function>}
2803
3764
  */
2804
3765
  function throttle(fn, freq) {
2805
3766
  let timestamp = 0;
@@ -2831,19 +3792,20 @@ function throttle(fn, freq) {
2831
3792
  }
2832
3793
  };
2833
3794
  const flush = () => lastArgs && invoke(lastArgs);
2834
- return [throttled, flush];
3795
+ const flushWith = (...args) => invoke(args);
3796
+ return [throttled, flush, flushWith];
2835
3797
  }
2836
3798
 
2837
3799
  const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2838
3800
  let bytesNotified = 0;
2839
3801
  const _speedometer = speedometer(50, 250);
2840
3802
  return throttle(e => {
2841
- if (!e || typeof e.loaded !== 'number') {
3803
+ if (!e || !utils$1.isNumber(e.loaded)) {
2842
3804
  return;
2843
3805
  }
2844
3806
  const rawLoaded = e.loaded;
2845
3807
  const total = e.lengthComputable ? e.total : undefined;
2846
- const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
3808
+ const loaded = Math.max(0, total != null ? Math.min(rawLoaded, total) : rawLoaded);
2847
3809
  const progressBytes = Math.max(0, loaded - bytesNotified);
2848
3810
  const rate = _speedometer(progressBytes);
2849
3811
  bytesNotified = Math.max(bytesNotified, loaded);
@@ -2869,80 +3831,128 @@ const progressEventDecorator = (total, throttled) => {
2869
3831
  loaded
2870
3832
  }), throttled[1]];
2871
3833
  };
2872
- const asyncDecorator = fn => (...args) => utils$1.asap(() => fn(...args));
3834
+ const asyncDecorator = (fn, scheduler = utils$1.asap) => (...args) => scheduler(() => fn(...args));
2873
3835
 
2874
3836
  /**
2875
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
2876
- * - For base64: compute exact decoded size using length and padding;
2877
- * handle %XX at the character-count level (no string allocation).
2878
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
2879
- *
2880
- * @param {string} url
2881
- * @returns {number}
3837
+ * Estimate data: URL byte lengths *without* allocating large buffers.
3838
+ * - Fetch percent-decodes a base64 body before decoding it.
3839
+ * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
3840
+ * percent-decoded body, including ignored characters and content after padding.
3841
+ * - Non-base64 data is percent-decoded and then encoded as UTF-8.
2882
3842
  */
2883
- function estimateDataURLDecodedBytes(url) {
3843
+ const isHexDigit = charCode => charCode >= 48 && charCode <= 57 || charCode >= 65 && charCode <= 70 || charCode >= 97 && charCode <= 102;
3844
+ const isPercentEncodedByte = (str, i, len) => i + 2 < len && isHexDigit(str.charCodeAt(i + 1)) && isHexDigit(str.charCodeAt(i + 2));
3845
+ const hexValue = charCode => charCode <= 57 ? charCode - 48 : (charCode & 0xdf) - 55;
3846
+ const isBase64Char = charCode => charCode >= 65 && charCode <= 90 ||
3847
+ // A-Z
3848
+ charCode >= 97 && charCode <= 122 ||
3849
+ // a-z
3850
+ charCode >= 48 && charCode <= 57 ||
3851
+ // 0-9
3852
+ charCode === 43 ||
3853
+ // +
3854
+ charCode === 47 ||
3855
+ // /
3856
+ charCode === 45 ||
3857
+ // - (base64url)
3858
+ charCode === 95; // _ (base64url)
3859
+
3860
+ const isBase64Whitespace = charCode => charCode === 9 || charCode === 10 || charCode === 12 || charCode === 13 || charCode === 32;
3861
+ const base64Bytes = significant => {
3862
+ const groups = Math.floor(significant / 4);
3863
+ const remainder = significant % 4;
3864
+ return groups * 3 + (remainder === 2 ? 1 : remainder === 3 ? 2 : 0);
3865
+ };
3866
+
3867
+ // Buffer.byteLength(body, 'base64') uses the raw string length as an allocation
3868
+ // upper bound even when Buffer.from later ignores characters or stops at '='.
3869
+ const estimateBase64BufferAllocation = body => {
3870
+ const len = body.length;
3871
+ let padding = 0;
3872
+ if (len > 0 && body.charCodeAt(len - 1) === 61 /* '=' */) {
3873
+ padding++;
3874
+ if (len > 1 && body.charCodeAt(len - 2) === 61 /* '=' */) {
3875
+ padding++;
3876
+ }
3877
+ }
3878
+ return Math.floor((len - padding) * 3 / 4);
3879
+ };
3880
+ const estimatePercentDecodedBase64BufferAllocation = body => {
3881
+ // Ordinary Base64 needs only its length and trailing padding.
3882
+ if (body.indexOf('%') === -1) {
3883
+ return estimateBase64BufferAllocation(body);
3884
+ }
3885
+ let length = 0;
3886
+ let previous = 0;
3887
+ let last = 0;
3888
+ for (let i = 0, len = body.length; i < len; i++) {
3889
+ let code = body.charCodeAt(i);
3890
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3891
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
3892
+ i += 2;
3893
+ }
3894
+ length++;
3895
+ previous = last;
3896
+ last = code;
3897
+ }
3898
+ const padding = last === 61 ? previous === 61 ? 2 : 1 : 0;
3899
+ return Math.floor((length - padding) * 3 / 4);
3900
+ };
3901
+ const estimatePercentDecodedBase64Bytes = body => {
3902
+ const len = body.length;
3903
+ let significant = 0;
3904
+ let padding = 0;
3905
+ let invalid = false;
3906
+ for (let i = 0; i < len; i++) {
3907
+ let code = body.charCodeAt(i);
3908
+ if (code === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3909
+ code = hexValue(body.charCodeAt(i + 1)) * 16 + hexValue(body.charCodeAt(i + 2));
3910
+ i += 2;
3911
+ }
3912
+ if (isBase64Whitespace(code)) {
3913
+ continue;
3914
+ }
3915
+ if (code === 61 /* '=' */) {
3916
+ padding++;
3917
+ continue;
3918
+ }
3919
+ if (!isBase64Char(code) || padding > 0) {
3920
+ invalid = true;
3921
+ continue;
3922
+ }
3923
+ significant++;
3924
+ }
3925
+
3926
+ // Fetch rejects malformed forgiving-base64 input. Returning the raw-size
3927
+ // allocation bound keeps that invalid input from becoming a pre-check bypass.
3928
+ if (invalid || padding > 2 || padding > 0 && (significant + padding) % 4 !== 0 || significant % 4 === 1) {
3929
+ return estimateBase64BufferAllocation(body);
3930
+ }
3931
+ return base64Bytes(significant);
3932
+ };
3933
+ const estimateDataURLBytes = (url, estimateBase64, base64Pattern) => {
2884
3934
  if (!url || typeof url !== 'string') return 0;
2885
- if (!url.startsWith('data:')) return 0;
3935
+ if (!/^data:/i.test(url)) return 0;
2886
3936
  const comma = url.indexOf(',');
2887
3937
  if (comma < 0) return 0;
2888
3938
  const meta = url.slice(5, comma);
2889
3939
  const body = url.slice(comma + 1);
2890
- const isBase64 = /;base64/i.test(meta);
3940
+ const isBase64 = base64Pattern.test(meta);
2891
3941
  if (isBase64) {
2892
- let effectiveLen = body.length;
2893
- const len = body.length; // cache length
2894
-
2895
- for (let i = 0; i < len; i++) {
2896
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
2897
- const a = body.charCodeAt(i + 1);
2898
- const b = body.charCodeAt(i + 2);
2899
- const 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);
2900
- if (isHex) {
2901
- effectiveLen -= 2;
2902
- i += 2;
2903
- }
2904
- }
2905
- }
2906
- let pad = 0;
2907
- let idx = len - 1;
2908
- const tailIsPct3D = j => j >= 2 && body.charCodeAt(j - 2) === 37 &&
2909
- // '%'
2910
- body.charCodeAt(j - 1) === 51 && (
2911
- // '3'
2912
- body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
2913
-
2914
- if (idx >= 0) {
2915
- if (body.charCodeAt(idx) === 61 /* '=' */) {
2916
- pad++;
2917
- idx--;
2918
- } else if (tailIsPct3D(idx)) {
2919
- pad++;
2920
- idx -= 3;
2921
- }
2922
- }
2923
- if (pad === 1 && idx >= 0) {
2924
- if (body.charCodeAt(idx) === 61 /* '=' */) {
2925
- pad++;
2926
- } else if (tailIsPct3D(idx)) {
2927
- pad++;
2928
- }
2929
- }
2930
- const groups = Math.floor(effectiveLen / 4);
2931
- const bytes = groups * 3 - (pad || 0);
2932
- return bytes > 0 ? bytes : 0;
2933
- }
2934
- if (typeof Buffer !== 'undefined' && typeof Buffer.byteLength === 'function') {
2935
- return Buffer.byteLength(body, 'utf8');
3942
+ return estimateBase64(body);
2936
3943
  }
2937
3944
 
2938
3945
  // Compute UTF-8 byte length directly from UTF-16 code units without allocating
2939
3946
  // a byte buffer (TextEncoder.encode would defeat the DoS guard on large bodies).
2940
- // Using body.length here would undercount non-ASCII (e.g. '€' is 1 code unit
2941
- // but 3 UTF-8 bytes).
3947
+ // Valid %XX triplets count as one decoded byte; this matches the bytes that
3948
+ // decodeURIComponent(body) would produce before Buffer re-encodes the string.
2942
3949
  let bytes = 0;
2943
3950
  for (let i = 0, len = body.length; i < len; i++) {
2944
3951
  const c = body.charCodeAt(i);
2945
- if (c < 0x80) {
3952
+ if (c === 37 /* '%' */ && isPercentEncodedByte(body, i, len)) {
3953
+ bytes += 1;
3954
+ i += 2;
3955
+ } else if (c < 0x80) {
2946
3956
  bytes += 1;
2947
3957
  } else if (c < 0x800) {
2948
3958
  bytes += 2;
@@ -2959,6 +3969,29 @@ function estimateDataURLDecodedBytes(url) {
2959
3969
  }
2960
3970
  }
2961
3971
  return bytes;
3972
+ };
3973
+
3974
+ /**
3975
+ * Estimate the percent-decoded payload size used by Fetch data: URLs.
3976
+ *
3977
+ * @param {string} url
3978
+ * @returns {number}
3979
+ */
3980
+ function estimateDataURLDecodedBytes(url) {
3981
+ // Fetch removes URL fragments before processing a data: URL.
3982
+ const fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
3983
+ return estimateDataURLBytes(fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), estimatePercentDecodedBase64Bytes, /; *base64[\t\n\f\r ]*$/i);
3984
+ }
3985
+
3986
+ /**
3987
+ * Estimate the Buffer backing allocation used after Node's percent-decoding step.
3988
+ *
3989
+ * @param {string} url
3990
+ * @returns {number}
3991
+ */
3992
+ function estimateDataURLBufferAllocation(url) {
3993
+ // Match fromDataURI's case-insensitive protocol and encoding suffix.
3994
+ return estimateDataURLBytes(url, estimatePercentDecodedBase64BufferAllocation, /;base64$/i);
2962
3995
  }
2963
3996
 
2964
3997
  const zlibOptions = {
@@ -2977,29 +4010,27 @@ const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
2977
4010
  const isZstdSupported = utils$1.isFunction(zlib.createZstdDecompress);
2978
4011
  const ACCEPT_ENCODING = 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : '');
2979
4012
  const ACCEPT_ENCODING_WITH_ZSTD = ACCEPT_ENCODING + (isZstdSupported ? ', zstd' : '');
4013
+ const scheduleProgress = typeof process !== 'undefined' && process.nextTick ? process.nextTick.bind(process) : utils$1.asap;
2980
4014
  const {
2981
4015
  http: httpFollow,
2982
4016
  https: httpsFollow
2983
4017
  } = followRedirects;
2984
4018
  const isHttps = /https:?/;
2985
- const FORM_DATA_CONTENT_HEADERS$1 = ['content-type', 'content-length'];
2986
- function setFormDataHeaders$1(headers, formHeaders, policy) {
2987
- if (policy !== 'content-only') {
2988
- headers.set(formHeaders);
2989
- return;
2990
- }
2991
- Object.entries(formHeaders).forEach(([key, val]) => {
2992
- if (FORM_DATA_CONTENT_HEADERS$1.includes(key.toLowerCase())) {
2993
- headers.set(key, val);
2994
- }
2995
- });
2996
- }
2997
4019
 
2998
4020
  // Symbols used to bind a single 'error' listener to a pooled socket and track
2999
4021
  // the request currently owning that socket across keep-alive reuse (issue #10780).
3000
4022
  const kAxiosSocketListener = Symbol('axios.http.socketListener');
3001
4023
  const kAxiosCurrentReq = Symbol('axios.http.currentReq');
3002
4024
 
4025
+ // A shared listener avoids retaining an adapter context for the lifetime of a
4026
+ // pooled socket. EventEmitter invokes listeners with `this` set to the emitter.
4027
+ function handleSocketError(err) {
4028
+ const current = this[kAxiosCurrentReq];
4029
+ if (current && !current.destroyed) {
4030
+ current.destroy(err);
4031
+ }
4032
+ }
4033
+
3003
4034
  // Tags HttpsProxyAgent instances installed by setProxy() so the redirect path
3004
4035
  // can strip them without clobbering a user-supplied agent that happens to be
3005
4036
  // an HttpsProxyAgent.
@@ -3011,32 +4042,121 @@ const kAxiosInstalledTunnel = Symbol('axios.http.installedTunnel');
3011
4042
  // so unbounded growth is not a concern in practice.
3012
4043
  const tunnelingAgentCache = new Map();
3013
4044
  const tunnelingAgentCacheUser = new WeakMap();
4045
+ const directAgents = new WeakMap();
4046
+ const directAgentHooks = ['createConnection', 'getName'];
4047
+ const nativeAgentPoolHooks = ['addRequest', 'createSocket', 'removeSocket', 'keepSocketAlive', 'reuseSocket', '_getSession', '_cacheSession', '_evictSession'];
4048
+ // Minimum minor versions where Node's HTTP Agent supports native proxyEnv
4049
+ // handling. Checking the selected agent below also covers startup modes such
4050
+ // as NODE_OPTIONS=--use-env-proxy and --no-use-env-proxy precedence.
4051
+ const NODE_NATIVE_ENV_PROXY_SUPPORT = {
4052
+ 22: 21,
4053
+ 24: 5
4054
+ };
4055
+ function isNodeNativeEnvProxySupported(nodeVersion = process.versions && process.versions.node) {
4056
+ if (!nodeVersion) {
4057
+ return false;
4058
+ }
4059
+ const [major, minor] = nodeVersion.split('.').map(part => Number(part));
4060
+ if (!Number.isInteger(major) || !Number.isInteger(minor)) {
4061
+ return false;
4062
+ }
4063
+ if (major > 24) {
4064
+ return true;
4065
+ }
4066
+ return NODE_NATIVE_ENV_PROXY_SUPPORT[major] != null && minor >= NODE_NATIVE_ENV_PROXY_SUPPORT[major];
4067
+ }
4068
+ function isNodeEnvProxyEnabled(agent, nodeVersion = process.versions && process.versions.node) {
4069
+ if (!isNodeNativeEnvProxySupported(nodeVersion)) {
4070
+ return false;
4071
+ }
4072
+ const agentOptions = agent && agent.options;
4073
+ return Boolean(agentOptions && utils$1.hasOwnProp(agentOptions, 'proxyEnv') && agentOptions.proxyEnv != null);
4074
+ }
4075
+ function getProxyEnvAgent(options, configHttpAgent, configHttpsAgent) {
4076
+ return isHttps.test(options.protocol) ? configHttpsAgent || https.globalAgent : configHttpAgent || http.globalAgent;
4077
+ }
4078
+ function getDirectAgent(configuredAgent, transport) {
4079
+ if (!process.allowedNodeEnvironmentFlags || !process.allowedNodeEnvironmentFlags.has('--use-env-proxy')) {
4080
+ return configuredAgent;
4081
+ }
4082
+ const agent = configuredAgent || transport.globalAgent;
4083
+ const options = agent && agent.options;
4084
+ if (!(agent instanceof transport.Agent) || agent.protocol !== transport.globalAgent.protocol || !options || !utils$1.hasOwnProp(options, 'proxyEnv') || typeof options.proxyEnv !== 'object' || options.proxyEnv === null) {
4085
+ return configuredAgent;
4086
+ }
4087
+
4088
+ // These hooks own pool queues or TLS session state. Neither binding them to
4089
+ // the source agent nor copying them without subclass state preserves their
4090
+ // behavior on a separate direct pool.
4091
+ for (const hook of nativeAgentPoolHooks) {
4092
+ if (utils$1.isFunction(transport.Agent.prototype[hook]) && agent[hook] !== transport.Agent.prototype[hook]) {
4093
+ throw new AxiosError('proxy: false cannot adapt an agent overriding ' + hook + '; use an agent constructed without proxyEnv', AxiosError.ERR_BAD_OPTION_VALUE);
4094
+ }
4095
+ }
4096
+
4097
+ // Node snapshots proxyEnv when constructing the agent. Keep this check
4098
+ // conservative even when the caller later removes protocol-specific entries.
4099
+ let direct = directAgents.get(agent);
4100
+ if (!direct) {
4101
+ direct = new transport.Agent({
4102
+ ...options,
4103
+ proxyEnv: undefined
4104
+ });
4105
+
4106
+ // Agent.destroy() does not emit an event. Keep the associated pool under
4107
+ // the configured agent's lifetime, including agents reused after destroy().
4108
+ const destroy = agent.destroy;
4109
+ agent.destroy = function destroyWithDirectAgent() {
4110
+ try {
4111
+ return destroy.apply(this, arguments);
4112
+ } finally {
4113
+ direct.destroy();
4114
+ }
4115
+ };
4116
+ directAgents.set(agent, direct);
4117
+ }
4118
+
4119
+ // Connections and pool keys do not own the direct pool's queues. Preserve
4120
+ // their configured receiver and refresh hooks that change between requests.
4121
+ for (const hook of directAgentHooks) {
4122
+ direct[hook] = agent[hook] === transport.Agent.prototype[hook] ? transport.Agent.prototype[hook] : bind(agent[hook], agent);
4123
+ }
4124
+ return direct;
4125
+ }
4126
+ function setDirectAgent(options, configHttpAgent, configHttpsAgent) {
4127
+ const secure = isHttps.test(options.protocol);
4128
+ const agent = getDirectAgent(secure ? configHttpsAgent : configHttpAgent, secure ? https : http);
4129
+ options.agent = agent;
4130
+ if (options.agents) {
4131
+ options.agents[secure ? 'https' : 'http'] = agent;
4132
+ }
4133
+ }
3014
4134
  function getTunnelingAgent(agentOptions, userHttpsAgent) {
3015
4135
  const key = agentOptions.protocol + '//' + agentOptions.hostname + ':' + (agentOptions.port || '') + '#' + (agentOptions.auth || '');
3016
4136
  const cache = userHttpsAgent ? tunnelingAgentCacheUser.get(userHttpsAgent) || tunnelingAgentCacheUser.set(userHttpsAgent, new Map()).get(userHttpsAgent) : tunnelingAgentCache;
3017
4137
  let agent = cache.get(key);
3018
4138
  if (agent) return agent;
3019
- // Forward the user's TLS options (custom CA, rejectUnauthorized, client cert,
3020
- // etc.) into the tunneling agent so they apply to the origin TLS upgrade
3021
- // performed after CONNECT. Our proxy fields take precedence on conflict.
4139
+ // Preserve per-request TLS options for the proxy connection, with our proxy
4140
+ // fields taking precedence. Global-agent options belong only to the origin
4141
+ // TLS upgrade in the callback below.
3022
4142
  const merged = userHttpsAgent && userHttpsAgent.options ? {
3023
4143
  ...userHttpsAgent.options,
3024
4144
  ...agentOptions
3025
4145
  } : agentOptions;
3026
4146
  agent = new HttpsProxyAgent(merged);
3027
- if (userHttpsAgent && userHttpsAgent.options) {
3028
- const originTLSOptions = {
3029
- ...userHttpsAgent.options
3030
- };
3031
- const callback = agent.callback;
3032
- agent.callback = function axiosTunnelingAgentCallback(req, opts) {
3033
- // HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
3034
- return callback.call(this, req, {
3035
- ...originTLSOptions,
3036
- ...opts
3037
- });
3038
- };
3039
- }
4147
+ const callback = agent.callback;
4148
+ agent.callback = function axiosTunnelingAgentCallback(req, opts) {
4149
+ // Without a proxy the origin TLS connection would be made by https.globalAgent,
4150
+ // so its options have to reach the tunneled origin too. Resolved per request
4151
+ // because the tunneling agent outlives any one of them.
4152
+ const originTLSAgent = userHttpsAgent || https.globalAgent;
4153
+ const originTLSOptions = originTLSAgent && originTLSAgent.options;
4154
+ // HttpsProxyAgent v5 reads callback opts for the post-CONNECT origin TLS upgrade.
4155
+ return callback.call(this, req, {
4156
+ ...originTLSOptions,
4157
+ ...opts
4158
+ });
4159
+ };
3040
4160
  agent[kAxiosInstalledTunnel] = true;
3041
4161
  cache.set(key, agent);
3042
4162
  return agent;
@@ -3066,24 +4186,55 @@ const flushOnFinish = (stream, [throttled, flush]) => {
3066
4186
  const http2Sessions = new Http2Sessions();
3067
4187
 
3068
4188
  /**
3069
- * If the proxy, auth, or config beforeRedirects functions are defined, call them
3070
- * with the options object.
4189
+ * If the proxy, auth, sensitive header, or config beforeRedirects functions are defined,
4190
+ * call them with the options object.
3071
4191
  *
3072
4192
  * @param {Object<string, any>} options - The options object that was passed to the request.
3073
4193
  *
3074
4194
  * @returns {Object<string, any>}
3075
4195
  */
3076
4196
  function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
4197
+ if (!isSameOriginRedirect(options, requestDetails)) {
4198
+ stripMatchingHeaders(options.headers, new Set(['authorization', 'cookie']));
4199
+ delete options.auth;
4200
+ }
3077
4201
  if (options.beforeRedirects.proxy) {
3078
4202
  options.beforeRedirects.proxy(options);
3079
4203
  }
3080
4204
  if (options.beforeRedirects.auth) {
3081
4205
  options.beforeRedirects.auth(options);
3082
4206
  }
4207
+ if (options.beforeRedirects.sensitiveHeaders) {
4208
+ options.beforeRedirects.sensitiveHeaders(options, requestDetails);
4209
+ }
4210
+ if (options.beforeRedirects.direct) {
4211
+ options.beforeRedirects.direct(options);
4212
+ }
3083
4213
  if (options.beforeRedirects.config) {
3084
4214
  options.beforeRedirects.config(options, responseDetails, requestDetails);
3085
4215
  }
3086
4216
  }
4217
+ function stripMatchingHeaders(headers, sensitiveSet) {
4218
+ if (!headers) {
4219
+ return;
4220
+ }
4221
+ Object.keys(headers).forEach(header => {
4222
+ if (sensitiveSet.has(header.toLowerCase())) {
4223
+ delete headers[header];
4224
+ }
4225
+ });
4226
+ }
4227
+ function isSameOriginRedirect(redirectOptions, requestDetails) {
4228
+ if (!requestDetails) {
4229
+ return false;
4230
+ }
4231
+ try {
4232
+ return new URL(requestDetails.url).origin === new URL(redirectOptions.href).origin;
4233
+ } catch (e) {
4234
+ // If origin comparison fails, treat the redirect as unsafe.
4235
+ return false;
4236
+ }
4237
+ }
3087
4238
 
3088
4239
  /**
3089
4240
  * If the proxy or config afterRedirects functions are defined, call them with the options
@@ -3091,12 +4242,14 @@ function dispatchBeforeRedirect(options, responseDetails, requestDetails) {
3091
4242
  * @param {http.ClientRequestArgs} options
3092
4243
  * @param {AxiosProxyConfig} configProxy configuration from Axios options object
3093
4244
  * @param {string} location
4245
+ * @param {boolean} [allowEnvProxy=true] whether environment proxy configuration can be used
3094
4246
  *
3095
- * @returns {http.ClientRequestArgs}
4247
+ * @returns {boolean} whether a proxy applies to the selected transport
3096
4248
  */
3097
- function setProxy(options, configProxy, location, isRedirect, configHttpsAgent) {
4249
+ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent, configHttpAgent, allowEnvProxy = true) {
3098
4250
  let proxy = configProxy;
3099
- if (!proxy && proxy !== false) {
4251
+ const proxyEnvAgent = getProxyEnvAgent(options, configHttpAgent, configHttpsAgent);
4252
+ if (!proxy && proxy !== false && allowEnvProxy && !isNodeEnvProxyEnabled(proxyEnvAgent)) {
3100
4253
  const proxyUrl = getProxyForUrl(location);
3101
4254
  if (proxyUrl) {
3102
4255
  if (!shouldBypassProxy(location)) {
@@ -3122,6 +4275,9 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent)
3122
4275
  if (isRedirect && options.agent && options.agent[kAxiosInstalledTunnel]) {
3123
4276
  options.agent = undefined;
3124
4277
  }
4278
+ if (isRedirect && options.agents && options.agents.https && options.agents.https[kAxiosInstalledTunnel]) {
4279
+ options.agents.https = configHttpsAgent;
4280
+ }
3125
4281
  if (proxy) {
3126
4282
  // Read proxy fields without traversing the prototype chain. URL instances expose
3127
4283
  // username/password/hostname/host/port/protocol via getters on URL.prototype (so
@@ -3187,7 +4343,7 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent)
3187
4343
  }
3188
4344
  const tunnelingAgent = getTunnelingAgent(agentOptions, configHttpsAgent);
3189
4345
  // Set both: `options.agent` is consumed by the native https.request path
3190
- // (config.maxRedirects === 0); `options.agents.https` is consumed by
4346
+ // (maxRedirects === 0); `options.agents.https` is consumed by
3191
4347
  // follow-redirects, which ignores `options.agent` when `options.agents`
3192
4348
  // is present.
3193
4349
  options.agent = tunnelingAgent;
@@ -3231,8 +4387,9 @@ function setProxy(options, configProxy, location, isRedirect, configHttpsAgent)
3231
4387
  options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
3232
4388
  // Configure proxy for redirected request, passing the original config proxy to apply
3233
4389
  // the exact same logic as if the redirected request was performed by axios directly.
3234
- setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent);
4390
+ setProxy(redirectOptions, configProxy, redirectOptions.href, true, configHttpsAgent, configHttpAgent, allowEnvProxy);
3235
4391
  };
4392
+ return Boolean(proxy || configProxy !== false && allowEnvProxy && isNodeEnvProxyEnabled(proxyEnvAgent));
3236
4393
  }
3237
4394
  const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
3238
4395
 
@@ -3263,7 +4420,7 @@ const resolveFamily = ({
3263
4420
  family
3264
4421
  }) => {
3265
4422
  if (!utils$1.isString(address)) {
3266
- throw TypeError('address must be a string');
4423
+ throw new AxiosError('address must be a string', AxiosError.ERR_BAD_OPTION_VALUE);
3267
4424
  }
3268
4425
  return {
3269
4426
  address,
@@ -3274,6 +4431,32 @@ const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(ad
3274
4431
  address,
3275
4432
  family
3276
4433
  });
4434
+ const normalizedLookupCache = new WeakMap();
4435
+ const normalizeLookup = lookup => {
4436
+ let normalized = normalizedLookupCache.get(lookup);
4437
+ if (normalized) {
4438
+ return normalized;
4439
+ }
4440
+ const callbackLookup = callbackify(lookup, value => utils$1.isArray(value) ? value : [value]);
4441
+
4442
+ // Support opt.all, which is required by current Node.js releases.
4443
+ normalized = (hostname, opt, cb) => {
4444
+ callbackLookup(hostname, opt, (err, arg0, arg1) => {
4445
+ if (err) {
4446
+ return cb(err);
4447
+ }
4448
+ let addresses;
4449
+ try {
4450
+ addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
4451
+ } catch (error) {
4452
+ return cb(error);
4453
+ }
4454
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
4455
+ });
4456
+ };
4457
+ normalizedLookupCache.set(lookup, normalized);
4458
+ return normalized;
4459
+ };
3277
4460
  const http2Transport = {
3278
4461
  request(options, cb) {
3279
4462
  const authority = options.protocol + '//' + options.hostname + ':' + (options.port || (options.protocol === 'https:' ? 443 : 80));
@@ -3314,41 +4497,49 @@ const http2Transport = {
3314
4497
  /*eslint consistent-return:0*/
3315
4498
  var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3316
4499
  return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
3317
- const own = key => utils$1.hasOwnProp(config, key) ? config[key] : undefined;
4500
+ // Read config pollution-safely: own properties and members inherited from
4501
+ // a non-Object.prototype source (e.g. an Object.create(defaults) template)
4502
+ // are honored, but values injected onto a polluted Object.prototype are
4503
+ // ignored. All behavior-affecting reads in this adapter go through own()
4504
+ // so the protection boundary stays consistent.
4505
+ const own = key => utils$1.getSafeProp(config, key);
3318
4506
  const transitional = own('transitional') || transitionalDefaults;
3319
4507
  let data = own('data');
3320
4508
  let lookup = own('lookup');
3321
4509
  let family = own('family');
3322
4510
  let httpVersion = own('httpVersion');
3323
4511
  if (httpVersion === undefined) httpVersion = 1;
4512
+ const rawHttpVersion = httpVersion;
3324
4513
  let http2Options = own('http2Options');
4514
+ const configProxy = own('proxy');
4515
+ const httpAgent = own('httpAgent');
4516
+ const httpsAgent = own('httpsAgent');
3325
4517
  const responseType = own('responseType');
3326
4518
  const responseEncoding = own('responseEncoding');
3327
- const method = config.method.toUpperCase();
4519
+ const socketPath = own('socketPath');
4520
+ const method = own('method').toUpperCase();
4521
+ const maxRedirects = own('maxRedirects');
4522
+ const maxBodyLength = own('maxBodyLength');
4523
+ const maxContentLength = own('maxContentLength');
4524
+ const decompress = own('decompress');
3328
4525
  let isDone;
3329
4526
  let rejected = false;
3330
4527
  let req;
3331
4528
  let connectPhaseTimer;
3332
- httpVersion = +httpVersion;
4529
+ try {
4530
+ httpVersion = +httpVersion;
4531
+ } catch (err) {
4532
+ throw new AxiosError('Invalid protocol version: value is not a number', AxiosError.ERR_BAD_OPTION_VALUE, config);
4533
+ }
3333
4534
  if (Number.isNaN(httpVersion)) {
3334
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
4535
+ throw new AxiosError(`Invalid protocol version: '${rawHttpVersion}' is not a number`, AxiosError.ERR_BAD_OPTION_VALUE, config);
3335
4536
  }
3336
4537
  if (httpVersion !== 1 && httpVersion !== 2) {
3337
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
4538
+ throw new AxiosError(`Unsupported protocol version '${httpVersion}'`, AxiosError.ERR_BAD_OPTION_VALUE, config);
3338
4539
  }
3339
4540
  const isHttp2 = httpVersion === 2;
3340
4541
  if (lookup) {
3341
- const _lookup = callbackify(lookup, value => utils$1.isArray(value) ? value : [value]);
3342
- // hotfix to support opt.all option which is required for node 20.x
3343
- lookup = (hostname, opt, cb) => {
3344
- _lookup(hostname, opt, (err, arg0, arg1) => {
3345
- if (err) {
3346
- return cb(err);
3347
- }
3348
- const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
3349
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
3350
- });
3351
- };
4542
+ lookup = normalizeLookup(lookup);
3352
4543
  }
3353
4544
  const abortEmitter = new events.EventEmitter();
3354
4545
  function abort(reason) {
@@ -3365,9 +4556,11 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3365
4556
  }
3366
4557
  }
3367
4558
  function createTimeoutError() {
3368
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3369
- if (config.timeoutErrorMessage) {
3370
- timeoutErrorMessage = config.timeoutErrorMessage;
4559
+ const configTimeout = own('timeout');
4560
+ let timeoutErrorMessage = configTimeout ? 'timeout of ' + configTimeout + 'ms exceeded' : 'timeout exceeded';
4561
+ const configTimeoutErrorMessage = own('timeoutErrorMessage');
4562
+ if (configTimeoutErrorMessage) {
4563
+ timeoutErrorMessage = configTimeoutErrorMessage;
3371
4564
  }
3372
4565
  return new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, req);
3373
4566
  }
@@ -3410,17 +4603,22 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3410
4603
  });
3411
4604
 
3412
4605
  // Parse url
3413
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
3414
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
4606
+ const fullPath = buildFullPath(own('baseURL'), own('url'), own('allowAbsoluteUrls'), config);
4607
+ // Unix-socket requests (own socketPath) commonly pass a path-only url
4608
+ // like '/foo'; supply a synthetic base so new URL() can still parse it.
4609
+ // Use the own-property value (not config.socketPath) so a polluted
4610
+ // prototype cannot influence URL base selection.
4611
+ const urlBase = socketPath ? 'http://localhost' : platform.hasBrowserEnv ? platform.origin : undefined;
4612
+ const parsed = new URL(fullPath, urlBase);
3415
4613
  const protocol = parsed.protocol || supportedProtocols[0];
3416
4614
  if (protocol === 'data:') {
3417
4615
  // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
3418
- if (config.maxContentLength > -1) {
3419
- // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
3420
- const dataUrl = String(config.url || fullPath || '');
3421
- const estimated = estimateDataURLDecodedBytes(dataUrl);
3422
- if (estimated > config.maxContentLength) {
3423
- return reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config));
4616
+ if (maxContentLength > -1) {
4617
+ // Use the exact string passed to fromDataURI (the configured url); fall back to fullPath if needed.
4618
+ const dataUrl = String(own('url') || fullPath || '');
4619
+ const estimated = estimateDataURLBufferAllocation(dataUrl);
4620
+ if (estimated > maxContentLength) {
4621
+ return reject(new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config));
3424
4622
  }
3425
4623
  }
3426
4624
  let convertedData;
@@ -3433,12 +4631,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3433
4631
  });
3434
4632
  }
3435
4633
  try {
3436
- convertedData = fromDataURI(config.url, responseType === 'blob', {
4634
+ convertedData = fromDataURI(own('url'), responseType === 'blob', {
3437
4635
  Blob: config.env && config.env.Blob
3438
4636
  });
3439
4637
  } catch (err) {
3440
4638
  throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
3441
4639
  }
4640
+
4641
+ // Check bytes before converting the result to text or a stream.
4642
+ if (maxContentLength > -1 && (responseType === 'blob' ? convertedData.size : convertedData.length) > maxContentLength) {
4643
+ return reject(new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config));
4644
+ }
3442
4645
  if (responseType === 'text') {
3443
4646
  convertedData = convertedData.toString(responseEncoding);
3444
4647
  if (!responseEncoding || responseEncoding === 'utf8') {
@@ -3484,7 +4687,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3484
4687
  });
3485
4688
  // support for https://www.npmjs.com/package/form-data api
3486
4689
  } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders) && data.getHeaders !== Object.prototype.getHeaders) {
3487
- setFormDataHeaders$1(headers, data.getHeaders(), own('formDataHeaderPolicy'));
4690
+ setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
3488
4691
  if (!headers.hasContentLength()) {
3489
4692
  try {
3490
4693
  const knownLength = await util.promisify(data.getLength).call(data);
@@ -3507,7 +4710,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3507
4710
 
3508
4711
  // Add Content-Length header if data exists
3509
4712
  headers.setContentLength(data.length, false);
3510
- if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
4713
+ if (maxBodyLength > -1 && data.length > maxBodyLength) {
3511
4714
  return reject(new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config));
3512
4715
  }
3513
4716
  }
@@ -3527,15 +4730,15 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3527
4730
  data = stream.pipeline([data, new AxiosTransformStream({
3528
4731
  maxRate: utils$1.toFiniteNumber(maxUploadRate)
3529
4732
  })], utils$1.noop);
3530
- onUploadProgress && data.on('progress', flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
4733
+ onUploadProgress && data.on('progress', flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress, scheduleProgress), false, 3))));
3531
4734
  }
3532
4735
 
3533
4736
  // HTTP basic authentication
3534
4737
  let auth = undefined;
3535
4738
  const configAuth = own('auth');
3536
4739
  if (configAuth) {
3537
- const username = configAuth.username || '';
3538
- const password = configAuth.password || '';
4740
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
4741
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
3539
4742
  auth = username + ':' + password;
3540
4743
  }
3541
4744
  if (!auth && (parsed.username || parsed.password)) {
@@ -3546,15 +4749,19 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3546
4749
  auth && headers.delete('authorization');
3547
4750
  let path$1;
3548
4751
  try {
3549
- path$1 = buildURL(parsed.pathname + parsed.search, config.params, config.paramsSerializer).replace(/^\?/, '');
4752
+ path$1 = buildURL(parsed.pathname + parsed.search, own('params'), own('paramsSerializer')).replace(/^\?/, '');
3550
4753
  } catch (err) {
3551
- const customErr = new Error(err.message);
3552
- customErr.config = config;
3553
- customErr.url = config.url;
3554
- customErr.exists = true;
3555
- return reject(customErr);
4754
+ return reject(AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config, null, null, {
4755
+ url: own('url'),
4756
+ exists: true
4757
+ }));
3556
4758
  }
3557
4759
  headers.set('Accept-Encoding', utils$1.hasOwnProp(transitional, 'advertiseZstdAcceptEncoding') && transitional.advertiseZstdAcceptEncoding === true ? ACCEPT_ENCODING_WITH_ZSTD : ACCEPT_ENCODING, false);
4760
+ if (isHttp2 && lookup) {
4761
+ http2Options = Object.assign(Object.create(null), http2Options, {
4762
+ lookup
4763
+ });
4764
+ }
3558
4765
 
3559
4766
  // Null-prototype to block prototype pollution gadgets on properties read
3560
4767
  // directly by Node's http.request (e.g. insecureHTTPParser, lookup).
@@ -3563,20 +4770,21 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3563
4770
  method: method,
3564
4771
  headers: toByteStringHeaderObject(headers),
3565
4772
  agents: {
3566
- http: config.httpAgent,
3567
- https: config.httpsAgent
4773
+ http: httpAgent,
4774
+ https: httpsAgent
3568
4775
  },
3569
4776
  auth,
3570
4777
  protocol,
3571
4778
  family,
3572
4779
  beforeRedirect: dispatchBeforeRedirect,
3573
4780
  beforeRedirects: Object.create(null),
3574
- http2Options
4781
+ http2Options,
4782
+ createConnection: undefined
3575
4783
  });
3576
4784
 
3577
4785
  // cacheable-lookup integration hotfix
3578
4786
  !utils$1.isUndefined(lookup) && (options.lookup = lookup);
3579
- const socketPath = own('socketPath');
4787
+ let proxyApplied = false;
3580
4788
  if (socketPath) {
3581
4789
  if (typeof socketPath !== 'string') {
3582
4790
  return reject(new AxiosError('socketPath must be a string', AxiosError.ERR_BAD_OPTION_VALUE, config));
@@ -3594,28 +4802,41 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3594
4802
  } else {
3595
4803
  options.hostname = parsed.hostname.startsWith('[') ? parsed.hostname.slice(1, -1) : parsed.hostname;
3596
4804
  options.port = parsed.port;
3597
- setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path, false, config.httpsAgent);
4805
+ proxyApplied = setProxy(options, configProxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path, false, httpsAgent, httpAgent,
4806
+ // The HTTP/2 transport connects independently of HTTP/1 agents, so it
4807
+ // cannot apply either axios-resolved or agent-local environment proxies.
4808
+ // Explicit proxy config is still processed and rejected below.
4809
+ !isHttp2);
3598
4810
  }
3599
4811
  let transport;
3600
4812
  let isNativeTransport = false;
3601
4813
  const isHttpsRequest = isHttps.test(options.protocol);
3602
4814
  // Don't clobber a CONNECT-tunneling agent installed by setProxy() for an
3603
4815
  // HTTPS target.
3604
- if (options.agent == null) {
3605
- options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
4816
+ if (!isHttp2 && configProxy === false) {
4817
+ setDirectAgent(options, httpAgent, httpsAgent);
4818
+ options.beforeRedirects.direct = redirectOptions => {
4819
+ setDirectAgent(redirectOptions, httpAgent, httpsAgent);
4820
+ };
4821
+ } else if (options.agent == null) {
4822
+ options.agent = isHttpsRequest ? httpsAgent : httpAgent;
3606
4823
  }
3607
4824
  if (isHttp2) {
4825
+ if (proxyApplied) {
4826
+ return reject(new AxiosError('HTTP/2 requests with a proxy are not supported', AxiosError.ERR_NOT_SUPPORT, config));
4827
+ }
3608
4828
  transport = http2Transport;
3609
4829
  } else {
3610
4830
  const configTransport = own('transport');
3611
4831
  if (configTransport) {
3612
4832
  transport = configTransport;
3613
- } else if (config.maxRedirects === 0) {
4833
+ } else if (maxRedirects === 0) {
3614
4834
  transport = isHttpsRequest ? https : http;
3615
4835
  isNativeTransport = true;
3616
4836
  } else {
3617
- if (config.maxRedirects) {
3618
- options.maxRedirects = config.maxRedirects;
4837
+ options.sensitiveHeaders = [];
4838
+ if (maxRedirects) {
4839
+ options.maxRedirects = maxRedirects;
3619
4840
  }
3620
4841
  const configBeforeRedirect = own('beforeRedirect');
3621
4842
  if (configBeforeRedirect) {
@@ -3638,13 +4859,37 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3638
4859
  }
3639
4860
  };
3640
4861
  }
4862
+ const sensitiveHeaders = own('sensitiveHeaders');
4863
+ if (sensitiveHeaders != null) {
4864
+ if (!utils$1.isArray(sensitiveHeaders)) {
4865
+ return reject(new AxiosError('sensitiveHeaders must be an array of strings', AxiosError.ERR_BAD_OPTION_VALUE, config));
4866
+ }
4867
+ const sensitiveSet = new Set();
4868
+ for (const header of sensitiveHeaders) {
4869
+ if (!utils$1.isString(header)) {
4870
+ return reject(new AxiosError('sensitiveHeaders must be an array of strings', AxiosError.ERR_BAD_OPTION_VALUE, config));
4871
+ }
4872
+ sensitiveSet.add(header.toLowerCase());
4873
+ }
4874
+ if (sensitiveSet.size) {
4875
+ options.sensitiveHeaders = Array.from(sensitiveSet);
4876
+ options.beforeRedirects.sensitiveHeaders = function beforeRedirectSensitiveHeaders(redirectOptions, requestDetails) {
4877
+ if (!isSameOriginRedirect(redirectOptions, requestDetails)) {
4878
+ stripMatchingHeaders(redirectOptions.headers, sensitiveSet);
4879
+ }
4880
+ };
4881
+ }
4882
+ }
3641
4883
  transport = isHttpsRequest ? httpsFollow : httpFollow;
3642
4884
  }
3643
4885
  }
3644
- if (config.maxBodyLength > -1) {
3645
- options.maxBodyLength = config.maxBodyLength;
4886
+
4887
+ // Set an explicit maxBodyLength option for transports that inspect it.
4888
+ // When maxBodyLength is -1 (default/unlimited), use Infinity so
4889
+ // follow-redirects does not fall back to its own 10MB default.
4890
+ if (maxBodyLength > -1) {
4891
+ options.maxBodyLength = maxBodyLength;
3646
4892
  } else {
3647
- // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
3648
4893
  options.maxBodyLength = Infinity;
3649
4894
  }
3650
4895
 
@@ -3663,7 +4908,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3663
4908
  const transformStream = new AxiosTransformStream({
3664
4909
  maxRate: utils$1.toFiniteNumber(maxDownloadRate)
3665
4910
  });
3666
- onDownloadProgress && transformStream.on('progress', flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
4911
+ onDownloadProgress && transformStream.on('progress', flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress, scheduleProgress), true, 3))));
3667
4912
  streams.push(transformStream);
3668
4913
  }
3669
4914
 
@@ -3674,7 +4919,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3674
4919
  const lastRequest = res.req || req;
3675
4920
 
3676
4921
  // if decompress disabled we should not decompress
3677
- if (config.decompress !== false && res.headers['content-encoding']) {
4922
+ if (decompress !== false && res.headers['content-encoding']) {
3678
4923
  // if no content, but headers still say that it is encoded,
3679
4924
  // remove the header not confuse downstream operations
3680
4925
  if (method === 'HEAD' || res.statusCode === 204) {
@@ -3726,8 +4971,8 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3726
4971
  if (responseType === 'stream') {
3727
4972
  // Enforce maxContentLength on streamed responses; previously this
3728
4973
  // was applied only to buffered responses.
3729
- if (config.maxContentLength > -1) {
3730
- const limit = config.maxContentLength;
4974
+ if (maxContentLength > -1) {
4975
+ const limit = maxContentLength;
3731
4976
  const source = responseStream;
3732
4977
  async function* enforceMaxContentLength() {
3733
4978
  let totalResponseBytes = 0;
@@ -3753,11 +4998,11 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3753
4998
  totalResponseBytes += chunk.length;
3754
4999
 
3755
5000
  // make sure the content length is not over the maxContentLength if specified
3756
- if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
5001
+ if (maxContentLength > -1 && totalResponseBytes > maxContentLength) {
3757
5002
  // stream.destroy() emit aborted event before calling reject() on Node.js v16
3758
5003
  rejected = true;
3759
5004
  responseStream.destroy();
3760
- abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
5005
+ abort(new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
3761
5006
  }
3762
5007
  });
3763
5008
  responseStream.on('aborted', function handlerStreamAborted() {
@@ -3820,20 +5065,16 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3820
5065
  const boundSockets = new Set();
3821
5066
  req.on('socket', function handleRequestSocket(socket) {
3822
5067
  // default interval of sending ack packet is 1 minute
3823
- socket.setKeepAlive(true, 1000 * 60);
5068
+ // proxy agents (e.g. agent-base) may return a generic Duplex stream
5069
+ // that doesn't have setKeepAlive, so guard before calling
5070
+ if (typeof socket.setKeepAlive === 'function') {
5071
+ socket.setKeepAlive(true, 1000 * 60);
5072
+ }
3824
5073
 
3825
- // Install a single 'error' listener per socket (not per request) to avoid
3826
- // accumulating listeners on pooled keep-alive sockets that get reassigned
3827
- // to new requests before the previous request's 'close' fires (issue #10780).
3828
- // The listener is bound to the socket's currently-active request via a
3829
- // symbol, which is swapped as the socket is reassigned.
5074
+ // Install one shared 'error' listener per socket. The symbol follows the
5075
+ // currently-active request as pooled sockets are reassigned (issue #10780).
3830
5076
  if (!socket[kAxiosSocketListener]) {
3831
- socket.on('error', function handleSocketError(err) {
3832
- const current = socket[kAxiosCurrentReq];
3833
- if (current && !current.destroyed) {
3834
- current.destroy(err);
3835
- }
3836
- });
5077
+ socket.on('error', handleSocketError);
3837
5078
  socket[kAxiosSocketListener] = true;
3838
5079
  }
3839
5080
  socket[kAxiosCurrentReq] = req;
@@ -3850,9 +5091,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3850
5091
  });
3851
5092
 
3852
5093
  // Handle request timeout
3853
- if (config.timeout) {
5094
+ if (own('timeout')) {
3854
5095
  // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
3855
- const timeout = parseInt(config.timeout, 10);
5096
+ const timeout = parseInt(own('timeout'), 10);
3856
5097
  if (Number.isNaN(timeout)) {
3857
5098
  abort(new AxiosError('error trying to parse `config.timeout` to int', AxiosError.ERR_BAD_OPTION_VALUE, config, req));
3858
5099
  return;
@@ -3896,12 +5137,11 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3896
5137
  }
3897
5138
  });
3898
5139
 
3899
- // Enforce maxBodyLength for streamed uploads on the native http/https
3900
- // transport (maxRedirects === 0); follow-redirects enforces it on the
3901
- // other path.
5140
+ // Transform decodes string chunks to Buffers before counting, so every
5141
+ // transport receives at most maxBodyLength encoded bytes.
3902
5142
  let uploadStream = data;
3903
- if (config.maxBodyLength > -1 && config.maxRedirects === 0) {
3904
- const limit = config.maxBodyLength;
5143
+ if (maxBodyLength > -1) {
5144
+ const limit = maxBodyLength;
3905
5145
  let bytesSent = 0;
3906
5146
  uploadStream = stream.pipeline([data, new stream.Transform({
3907
5147
  transform(chunk, _enc, cb) {
@@ -3924,16 +5164,18 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
3924
5164
  });
3925
5165
  };
3926
5166
 
3927
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => url => {
3928
- url = new URL(url, platform.origin);
3929
- return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
3930
- })(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : () => true;
3931
-
3932
- var cookies = platform.hasStandardBrowserEnv ?
3933
- // Standard browser envs support document.cookie
3934
- {
3935
- write(name, value, expires, path, domain, secure, sameSite) {
3936
- if (typeof document === 'undefined') return;
5167
+ const decodeCookieValue = value => {
5168
+ try {
5169
+ return decodeURIComponent(value);
5170
+ } catch (e) {
5171
+ return value;
5172
+ }
5173
+ };
5174
+ var cookies = platform.hasStandardBrowserEnv ?
5175
+ // Standard browser envs support document.cookie
5176
+ {
5177
+ write(name, value, expires, path, domain, secure, sameSite) {
5178
+ if (typeof document === 'undefined') return;
3937
5179
  const cookie = [`${name}=${encodeURIComponent(value)}`];
3938
5180
  if (utils$1.isNumber(expires)) {
3939
5181
  cookie.push(`expires=${new Date(expires).toUTCString()}`);
@@ -3954,21 +5196,36 @@ var cookies = platform.hasStandardBrowserEnv ?
3954
5196
  },
3955
5197
  read(name) {
3956
5198
  if (typeof document === 'undefined') return null;
5199
+ const cookieString = document.cookie;
5200
+ if (!cookieString) return null;
3957
5201
  // Match name=value by splitting on the semicolon separator instead of building a
3958
5202
  // RegExp from `name` — interpolating an unescaped string into a RegExp would let
3959
5203
  // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3960
5204
  // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3961
5205
  // "; ", so ignore optional whitespace before each cookie name.
3962
- const cookies = document.cookie.split(';');
5206
+ const cookies = cookieString.split(';');
3963
5207
  for (let i = 0; i < cookies.length; i++) {
3964
5208
  const cookie = cookies[i].replace(/^\s+/, '');
3965
5209
  const eq = cookie.indexOf('=');
3966
5210
  if (eq !== -1 && cookie.slice(0, eq) === name) {
3967
- return decodeURIComponent(cookie.slice(eq + 1));
5211
+ return decodeCookieValue(cookie.slice(eq + 1));
3968
5212
  }
3969
5213
  }
3970
5214
  return null;
3971
5215
  },
5216
+ async readAsync(name) {
5217
+ try {
5218
+ const store = typeof window !== 'undefined' && window.cookieStore;
5219
+ if (store && utils$1.isFunction(store.get)) {
5220
+ const cookie = await store.get(name);
5221
+ // Both APIs expose stored bytes; preserve Axios's existing URI decoding.
5222
+ return cookie ? decodeCookieValue(cookie.value) : null;
5223
+ }
5224
+ } catch (e) {
5225
+ // Restricted or unavailable storage retains the synchronous fallback.
5226
+ }
5227
+ return this.read(name);
5228
+ },
3972
5229
  remove(name) {
3973
5230
  this.write(name, '', Date.now() - 86400000, '/');
3974
5231
  }
@@ -3979,12 +5236,241 @@ var cookies = platform.hasStandardBrowserEnv ?
3979
5236
  read() {
3980
5237
  return null;
3981
5238
  },
5239
+ async readAsync() {
5240
+ return null;
5241
+ },
3982
5242
  remove() {}
3983
5243
  };
3984
5244
 
5245
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? (origin => url => {
5246
+ url = new URL(url, document.baseURI || platform.origin);
5247
+ return origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port;
5248
+ })(new URL(platform.origin)) : () => true;
5249
+
5250
+ function assertParamsAcyclic(params) {
5251
+ const pending = [{
5252
+ value: params
5253
+ }];
5254
+ const active = new WeakSet();
5255
+ const visited = new WeakSet();
5256
+ while (pending.length) {
5257
+ const {
5258
+ value,
5259
+ done
5260
+ } = pending.pop();
5261
+ if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) continue;
5262
+ if (done) {
5263
+ active.delete(value);
5264
+ continue;
5265
+ }
5266
+ if (active.has(value)) {
5267
+ throw new AxiosError('Circular reference detected in params', AxiosError.ERR_BAD_OPTION_VALUE);
5268
+ }
5269
+ if (visited.has(value)) continue;
5270
+ visited.add(value);
5271
+ active.add(value);
5272
+ pending.push({
5273
+ value,
5274
+ done: true
5275
+ });
5276
+ const keys = Object.keys(value);
5277
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
5278
+ Object.getOwnPropertySymbols(value).forEach(key => {
5279
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
5280
+ if (descriptor && descriptor.enumerable) keys.push(key);
5281
+ });
5282
+ }
5283
+ // Shallow array elements retain fields filtered during plain-object merges.
5284
+ // Inspect reserved data properties without evaluating their accessors.
5285
+ keys.forEach(key => {
5286
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
5287
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
5288
+ if (descriptor && utils$1.hasOwnProp(descriptor, 'value')) {
5289
+ pending.push({
5290
+ value: descriptor.value
5291
+ });
5292
+ }
5293
+ } else {
5294
+ pending.push({
5295
+ value: value[key]
5296
+ });
5297
+ }
5298
+ });
5299
+ }
5300
+ }
5301
+
3985
5302
  const headersToObject = thing => thing instanceof AxiosHeaders ? {
3986
5303
  ...thing
3987
5304
  } : thing;
5305
+ const ownEnumerableKeys = thing => {
5306
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
5307
+ return Object.keys(thing).concat(Object.getOwnPropertySymbols(thing).filter(symbol => {
5308
+ const descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
5309
+ return descriptor && descriptor.enumerable;
5310
+ }));
5311
+ }
5312
+ return Object.keys(thing);
5313
+ };
5314
+
5315
+ // Copy params without recursive merges so the serializer remains responsible
5316
+ // for its depth policy. Only visit defaults that contribute to the result.
5317
+ function mergeParams(a, b) {
5318
+ const pending = [];
5319
+ const copies = new WeakMap();
5320
+ const empty = {};
5321
+ function copy(target, source) {
5322
+ if (!utils$1.isPlainObject(source)) {
5323
+ return utils$1.isArray(source) ? source.slice() : source;
5324
+ }
5325
+ const base = utils$1.isPlainObject(target) ? target : empty;
5326
+ let bases = copies.get(source);
5327
+ if (!bases) {
5328
+ bases = new WeakMap();
5329
+ copies.set(source, bases);
5330
+ }
5331
+ if (bases.has(base)) return bases.get(base);
5332
+ const result = {};
5333
+ bases.set(base, result);
5334
+ pending.push({
5335
+ base,
5336
+ source,
5337
+ result
5338
+ });
5339
+ return result;
5340
+ }
5341
+ const result = utils$1.isUndefined(b) ? copy(undefined, a) : copy(a, b);
5342
+ while (pending.length) {
5343
+ const {
5344
+ base,
5345
+ source,
5346
+ result: target
5347
+ } = pending.pop();
5348
+ const baseKeys = new Set(ownEnumerableKeys(base));
5349
+ const sourceKeys = new Set(ownEnumerableKeys(source));
5350
+ const keys = new Set([...baseKeys, ...sourceKeys]);
5351
+ keys.forEach(key => {
5352
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
5353
+ const hasSource = sourceKeys.has(key);
5354
+ const value = hasSource ? source[key] : undefined;
5355
+ const previous = (!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
5356
+ target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
5357
+ });
5358
+ }
5359
+ assertParamsAcyclic(result);
5360
+ return result;
5361
+ }
5362
+ function getMergedValue(target, source, prop, caseless) {
5363
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
5364
+ return utils$1.merge.call({
5365
+ caseless
5366
+ }, target, source);
5367
+ } else if (utils$1.isPlainObject(source)) {
5368
+ return utils$1.merge({}, source);
5369
+ } else if (utils$1.isArray(source)) {
5370
+ return source.slice();
5371
+ }
5372
+ return source;
5373
+ }
5374
+ function mergeDeepProperties(a, b, prop, caseless) {
5375
+ if (!utils$1.isUndefined(b)) {
5376
+ return getMergedValue(a, b, prop, caseless);
5377
+ } else if (!utils$1.isUndefined(a)) {
5378
+ return getMergedValue(undefined, a, prop, caseless);
5379
+ }
5380
+ }
5381
+
5382
+ // eslint-disable-next-line consistent-return
5383
+ function valueFromConfig2(a, b) {
5384
+ if (!utils$1.isUndefined(b)) {
5385
+ return getMergedValue(undefined, b);
5386
+ }
5387
+ }
5388
+
5389
+ // eslint-disable-next-line consistent-return
5390
+ function defaultToConfig2(a, b) {
5391
+ if (!utils$1.isUndefined(b)) {
5392
+ return getMergedValue(undefined, b);
5393
+ } else if (!utils$1.isUndefined(a)) {
5394
+ return getMergedValue(undefined, a);
5395
+ }
5396
+ }
5397
+ function getMergedTransitionalOption(config1, config2, prop) {
5398
+ const transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
5399
+ if (!utils$1.isUndefined(transitional2)) {
5400
+ if (utils$1.isPlainObject(transitional2)) {
5401
+ if (utils$1.hasOwnProp(transitional2, prop)) {
5402
+ return transitional2[prop];
5403
+ }
5404
+ } else {
5405
+ return undefined;
5406
+ }
5407
+ }
5408
+ const transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
5409
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
5410
+ return transitional1[prop];
5411
+ }
5412
+ return undefined;
5413
+ }
5414
+
5415
+ // eslint-disable-next-line consistent-return
5416
+ function mergeDirectKeys(a, b, prop, config1, config2) {
5417
+ if (utils$1.hasOwnProp(config2, prop)) {
5418
+ return getMergedValue(a, b);
5419
+ } else if (utils$1.hasOwnProp(config1, prop)) {
5420
+ return getMergedValue(undefined, a);
5421
+ }
5422
+ }
5423
+ function mergeHeaders(a, b, prop) {
5424
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
5425
+ }
5426
+
5427
+ // Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
5428
+ // this data descriptor into an accessor descriptor on the way in.
5429
+ // defineProperty only reads it, so one shared instance serves every call.
5430
+ const hasOwnPropertyDescriptor = Object.freeze({
5431
+ __proto__: null,
5432
+ value: Object.prototype.hasOwnProperty,
5433
+ enumerable: false,
5434
+ writable: true,
5435
+ configurable: true
5436
+ });
5437
+
5438
+ // The strategy table and the strategies above are stateless, so they are
5439
+ // built once at module load instead of on every call: mergeConfig runs at
5440
+ // most twice per request (once from a method alias, once from `_request`).
5441
+ const mergeMap = {
5442
+ url: valueFromConfig2,
5443
+ method: valueFromConfig2,
5444
+ data: valueFromConfig2,
5445
+ baseURL: defaultToConfig2,
5446
+ transformRequest: defaultToConfig2,
5447
+ transformResponse: defaultToConfig2,
5448
+ params: mergeParams,
5449
+ paramsSerializer: defaultToConfig2,
5450
+ timeout: defaultToConfig2,
5451
+ timeoutErrorMessage: defaultToConfig2,
5452
+ withCredentials: defaultToConfig2,
5453
+ withXSRFToken: defaultToConfig2,
5454
+ adapter: defaultToConfig2,
5455
+ responseType: defaultToConfig2,
5456
+ xsrfCookieName: defaultToConfig2,
5457
+ xsrfHeaderName: defaultToConfig2,
5458
+ onUploadProgress: defaultToConfig2,
5459
+ onDownloadProgress: defaultToConfig2,
5460
+ decompress: defaultToConfig2,
5461
+ maxContentLength: defaultToConfig2,
5462
+ maxBodyLength: defaultToConfig2,
5463
+ beforeRedirect: defaultToConfig2,
5464
+ transport: defaultToConfig2,
5465
+ httpAgent: defaultToConfig2,
5466
+ httpsAgent: defaultToConfig2,
5467
+ cancelToken: defaultToConfig2,
5468
+ socketPath: defaultToConfig2,
5469
+ allowedSocketPaths: defaultToConfig2,
5470
+ responseEncoding: defaultToConfig2,
5471
+ validateStatus: mergeDirectKeys,
5472
+ headers: mergeHeaders
5473
+ };
3988
5474
 
3989
5475
  /**
3990
5476
  * Config-specific merge-function which creates a new config-object
@@ -3997,6 +5483,7 @@ const headersToObject = thing => thing instanceof AxiosHeaders ? {
3997
5483
  */
3998
5484
  function mergeConfig(config1, config2) {
3999
5485
  // eslint-disable-next-line no-param-reassign
5486
+ config1 = config1 || {};
4000
5487
  config2 = config2 || {};
4001
5488
 
4002
5489
  // Use a null-prototype object so that downstream reads such as `config.auth`
@@ -4004,116 +5491,28 @@ function mergeConfig(config1, config2) {
4004
5491
  // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
4005
5492
  // ergonomics for user code that relies on it.
4006
5493
  const config = Object.create(null);
4007
- Object.defineProperty(config, 'hasOwnProperty', {
4008
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
4009
- // this data descriptor into an accessor descriptor on the way in.
4010
- __proto__: null,
4011
- value: Object.prototype.hasOwnProperty,
4012
- enumerable: false,
4013
- writable: true,
4014
- configurable: true
4015
- });
4016
- function getMergedValue(target, source, prop, caseless) {
4017
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
4018
- return utils$1.merge.call({
4019
- caseless
4020
- }, target, source);
4021
- } else if (utils$1.isPlainObject(source)) {
4022
- return utils$1.merge({}, source);
4023
- } else if (utils$1.isArray(source)) {
4024
- return source.slice();
4025
- }
4026
- return source;
4027
- }
4028
- function mergeDeepProperties(a, b, prop, caseless) {
4029
- if (!utils$1.isUndefined(b)) {
4030
- return getMergedValue(a, b, prop, caseless);
4031
- } else if (!utils$1.isUndefined(a)) {
4032
- return getMergedValue(undefined, a, prop, caseless);
4033
- }
4034
- }
4035
-
4036
- // eslint-disable-next-line consistent-return
4037
- function valueFromConfig2(a, b) {
4038
- if (!utils$1.isUndefined(b)) {
4039
- return getMergedValue(undefined, b);
4040
- }
4041
- }
4042
-
4043
- // eslint-disable-next-line consistent-return
4044
- function defaultToConfig2(a, b) {
4045
- if (!utils$1.isUndefined(b)) {
4046
- return getMergedValue(undefined, b);
4047
- } else if (!utils$1.isUndefined(a)) {
4048
- return getMergedValue(undefined, a);
4049
- }
4050
- }
4051
-
4052
- // eslint-disable-next-line consistent-return
4053
- function mergeDirectKeys(a, b, prop) {
4054
- if (utils$1.hasOwnProp(config2, prop)) {
4055
- return getMergedValue(a, b);
4056
- } else if (utils$1.hasOwnProp(config1, prop)) {
4057
- return getMergedValue(undefined, a);
4058
- }
4059
- }
4060
- const mergeMap = {
4061
- url: valueFromConfig2,
4062
- method: valueFromConfig2,
4063
- data: valueFromConfig2,
4064
- baseURL: defaultToConfig2,
4065
- transformRequest: defaultToConfig2,
4066
- transformResponse: defaultToConfig2,
4067
- paramsSerializer: defaultToConfig2,
4068
- timeout: defaultToConfig2,
4069
- timeoutMessage: defaultToConfig2,
4070
- withCredentials: defaultToConfig2,
4071
- withXSRFToken: defaultToConfig2,
4072
- adapter: defaultToConfig2,
4073
- responseType: defaultToConfig2,
4074
- xsrfCookieName: defaultToConfig2,
4075
- xsrfHeaderName: defaultToConfig2,
4076
- onUploadProgress: defaultToConfig2,
4077
- onDownloadProgress: defaultToConfig2,
4078
- decompress: defaultToConfig2,
4079
- maxContentLength: defaultToConfig2,
4080
- maxBodyLength: defaultToConfig2,
4081
- beforeRedirect: defaultToConfig2,
4082
- transport: defaultToConfig2,
4083
- httpAgent: defaultToConfig2,
4084
- httpsAgent: defaultToConfig2,
4085
- cancelToken: defaultToConfig2,
4086
- socketPath: defaultToConfig2,
4087
- allowedSocketPaths: defaultToConfig2,
4088
- responseEncoding: defaultToConfig2,
4089
- validateStatus: mergeDirectKeys,
4090
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
4091
- };
4092
- utils$1.forEach(Object.keys({
5494
+ Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
5495
+ const keys = ownEnumerableKeys({
4093
5496
  ...config1,
4094
5497
  ...config2
4095
- }), function computeConfigValue(prop) {
4096
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
5498
+ });
5499
+ for (let i = 0, len = keys.length; i < len; i++) {
5500
+ const prop = keys[i];
5501
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
4097
5502
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
4098
5503
  const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
4099
5504
  const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
4100
- const configValue = merge(a, b, prop);
5505
+ const configValue = merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
4101
5506
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
4102
- });
4103
- return config;
4104
- }
4105
-
4106
- const FORM_DATA_CONTENT_HEADERS = ['content-type', 'content-length'];
4107
- function setFormDataHeaders(headers, formHeaders, policy) {
4108
- if (policy !== 'content-only') {
4109
- headers.set(formHeaders);
4110
- return;
4111
5507
  }
4112
- Object.entries(formHeaders).forEach(([key, val]) => {
4113
- if (FORM_DATA_CONTENT_HEADERS.includes(key.toLowerCase())) {
4114
- headers.set(key, val);
5508
+ if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false) {
5509
+ if (utils$1.hasOwnProp(config1, 'validateStatus')) {
5510
+ config.validateStatus = getMergedValue(undefined, config1.validateStatus);
5511
+ } else {
5512
+ delete config.validateStatus;
4115
5513
  }
4116
- });
5514
+ }
5515
+ return config;
4117
5516
  }
4118
5517
 
4119
5518
  /**
@@ -4125,7 +5524,8 @@ function setFormDataHeaders(headers, formHeaders, policy) {
4125
5524
  * @returns {string} UTF-8 bytes as a Latin-1 string
4126
5525
  */
4127
5526
  const encodeUTF8$1 = str => encodeURIComponent(str).replace(/%([0-9A-F]{2})/gi, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
4128
- function resolveConfig(config) {
5527
+ const readCookie = name => cookies.read(name);
5528
+ function resolveConfig(config, readXsrfCookie = readCookie) {
4129
5529
  const newConfig = mergeConfig({}, config);
4130
5530
 
4131
5531
  // Read only own properties to prevent prototype pollution gadgets
@@ -4141,18 +5541,29 @@ function resolveConfig(config) {
4141
5541
  const allowAbsoluteUrls = own('allowAbsoluteUrls');
4142
5542
  const url = own('url');
4143
5543
  newConfig.headers = headers = AxiosHeaders.from(headers);
4144
- newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls), own('params'), own('paramsSerializer'));
5544
+ newConfig.url = buildURL(buildFullPath(baseURL, url, allowAbsoluteUrls, newConfig), own('params'), own('paramsSerializer'));
4145
5545
 
4146
5546
  // HTTP basic authentication
4147
5547
  if (auth) {
4148
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? encodeUTF8$1(auth.password) : '')));
5548
+ const username = utils$1.getSafeProp(auth, 'username') || '';
5549
+ const password = utils$1.getSafeProp(auth, 'password') || '';
5550
+ const transitional = own('transitional');
5551
+ const encodeUsername = transitional && utils$1.hasOwnProp(transitional, 'encodeBasicAuthUsername') && transitional.encodeBasicAuthUsername === true;
5552
+ try {
5553
+ headers.set('Authorization',
5554
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
5555
+ 'Basic ' + btoa((encodeUsername ? encodeUTF8$1(username) : username) + ':' + (password ? encodeUTF8$1(password) : '')));
5556
+ } catch (e) {
5557
+ throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
5558
+ }
4149
5559
  }
4150
5560
  if (utils$1.isFormData(data)) {
5561
+ const getHeaders = utils$1.getSafeProp(data, 'getHeaders');
4151
5562
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
4152
5563
  headers.setContentType(undefined); // browser/web worker/RN handles it
4153
- } else if (utils$1.isFunction(data.getHeaders)) {
5564
+ } else if (utils$1.isFunction(getHeaders)) {
4154
5565
  // Node.js FormData (like form-data package)
4155
- setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
5566
+ setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
4156
5567
  }
4157
5568
  }
4158
5569
 
@@ -4170,7 +5581,7 @@ function resolveConfig(config) {
4170
5581
  // the XSRF token cross-origin.
4171
5582
  const shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
4172
5583
  if (shouldSendXSRF) {
4173
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
5584
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
4174
5585
  if (xsrfValue) {
4175
5586
  headers.set(xsrfHeaderName, xsrfValue);
4176
5587
  }
@@ -4182,7 +5593,18 @@ function resolveConfig(config) {
4182
5593
  const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
4183
5594
  var xhrAdapter = isXHRAdapterSupported && function (config) {
4184
5595
  return new Promise(function dispatchXhrRequest(resolve, reject) {
4185
- const _config = resolveConfig(config);
5596
+ let useAsyncXsrf;
5597
+ try {
5598
+ const store = platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
5599
+ useAsyncXsrf = store && utils$1.isFunction(store.get);
5600
+ } catch (e) {
5601
+ // A restricted Cookie Store getter must retain the synchronous fallback.
5602
+ }
5603
+ let xsrfCookieName;
5604
+ const _config = resolveConfig(config, useAsyncXsrf ? name => {
5605
+ xsrfCookieName = name;
5606
+ return null;
5607
+ } : undefined);
4186
5608
  let requestData = _config.data;
4187
5609
  const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
4188
5610
  let {
@@ -4191,12 +5613,37 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4191
5613
  onDownloadProgress
4192
5614
  } = _config;
4193
5615
  let onCanceled;
5616
+ let timeoutId;
4194
5617
  let uploadThrottled, downloadThrottled;
4195
- let flushUpload, flushDownload;
5618
+ let flushUpload, flushDownload, flushDownloadWithEvent;
4196
5619
  function done() {
4197
- flushUpload && flushUpload(); // flush events
4198
- flushDownload && flushDownload(); // flush events
5620
+ clearTimeout(timeoutId);
5621
+ // A final progress callback must not prevent the remaining cleanup.
5622
+ // Report errors asynchronously, as onloadend and the throttle timer do.
5623
+ try {
5624
+ flushUpload && flushUpload(); // flush events
5625
+ } catch (err) {
5626
+ setTimeout(() => {
5627
+ throw err;
5628
+ });
5629
+ }
5630
+ try {
5631
+ flushDownload && flushDownload(); // flush events
5632
+ } catch (err) {
5633
+ setTimeout(() => {
5634
+ throw err;
5635
+ });
5636
+ }
4199
5637
 
5638
+ // A flush can synchronously cancel the request and reenter done().
5639
+ // In that case the inner call has already detached these listeners.
5640
+ if (request) {
5641
+ downloadThrottled && request.removeEventListener('progress', downloadThrottled);
5642
+ if (request.upload) {
5643
+ uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
5644
+ flushUpload && request.upload.removeEventListener('loadend', flushUpload);
5645
+ }
5646
+ }
4200
5647
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
4201
5648
  _config.signal && _config.signal.removeEventListener('abort', onCanceled);
4202
5649
  }
@@ -4205,10 +5652,50 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4205
5652
 
4206
5653
  // Set the request timeout in MS
4207
5654
  request.timeout = _config.timeout;
4208
- function onloadend() {
5655
+ function onloadend(event) {
4209
5656
  if (!request) {
4210
5657
  return;
4211
5658
  }
5659
+
5660
+ // Status 0 means no response was received, which onerror and onabort normally
5661
+ // reject before this runs. Firefox 152 fires only readystatechange and loadend for
5662
+ // navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
5663
+ // leaving settle() to resolve them as an empty success. ECONNABORTED is the error
5664
+ // onabort raised on Firefox 151. Reads over file:, which some environments report as
5665
+ // status 0 on success, are excluded by the request URL's scheme after browser-style
5666
+ // preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
5667
+ // by responseURL where implemented.
5668
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== 'file' && !(request.responseURL && request.responseURL.startsWith('file:'))) {
5669
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
5670
+ done();
5671
+
5672
+ // Clean up request
5673
+ request = null;
5674
+ return;
5675
+ }
5676
+
5677
+ // When loadend is still dispatching, flushing with it gives progress
5678
+ // listeners a final delivery whose event has a live target. The legacy
5679
+ // ready-state fallback has no event, so replay its pending progress.
5680
+ // A throwing listener must not block settlement; rethrow asynchronously,
5681
+ // matching how listener errors surface on the throttle timer path.
5682
+ try {
5683
+ if (event) {
5684
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
5685
+ } else {
5686
+ flushDownload && flushDownload();
5687
+ }
5688
+ } catch (err) {
5689
+ setTimeout(() => {
5690
+ throw err;
5691
+ });
5692
+ }
5693
+
5694
+ // A final progress callback can cancel the request synchronously.
5695
+ if (!request) {
5696
+ return;
5697
+ }
5698
+
4212
5699
  // Prepare the response
4213
5700
  const responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
4214
5701
  const responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
@@ -4282,6 +5769,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4282
5769
 
4283
5770
  // Handle timeout
4284
5771
  request.ontimeout = function handleTimeout() {
5772
+ if (!request) return;
4285
5773
  let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
4286
5774
  const transitional = _config.transitional || transitionalDefaults;
4287
5775
  if (_config.timeoutErrorMessage) {
@@ -4297,13 +5785,6 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4297
5785
  // Remove Content-Type if data is undefined
4298
5786
  requestData === undefined && requestHeaders.setContentType(null);
4299
5787
 
4300
- // Add headers to the request
4301
- if ('setRequestHeader' in request) {
4302
- utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
4303
- request.setRequestHeader(key, val);
4304
- });
4305
- }
4306
-
4307
5788
  // Add withCredentials to request if needed
4308
5789
  if (!utils$1.isUndefined(_config.withCredentials)) {
4309
5790
  request.withCredentials = !!_config.withCredentials;
@@ -4316,7 +5797,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4316
5797
 
4317
5798
  // Handle progress if needed
4318
5799
  if (onDownloadProgress) {
4319
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
5800
+ [downloadThrottled, flushDownload, flushDownloadWithEvent] = progressEventReducer(onDownloadProgress, true);
4320
5801
  request.addEventListener('progress', downloadThrottled);
4321
5802
  }
4322
5803
 
@@ -4334,23 +5815,79 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
4334
5815
  return;
4335
5816
  }
4336
5817
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
4337
- request.abort();
5818
+ const xhr = request;
4338
5819
  done();
4339
5820
  request = null;
5821
+ xhr.abort();
4340
5822
  };
4341
5823
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
5824
+ if (!request) return;
4342
5825
  if (_config.signal) {
4343
5826
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
4344
5827
  }
4345
5828
  }
5829
+ if (!request) return;
4346
5830
  const protocol = parseProtocol(_config.url);
4347
5831
  if (protocol && !platform.protocols.includes(protocol)) {
4348
5832
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
5833
+ done();
4349
5834
  return;
4350
5835
  }
4351
-
4352
- // Send the request
4353
- request.send(requestData || null);
5836
+ const sendRequest = () => {
5837
+ if (!request) return;
5838
+ // Apply headers after an asynchronous XSRF read so existing headers are
5839
+ // replaced through AxiosHeaders rather than appended by the native XHR.
5840
+ if ('setRequestHeader' in request) {
5841
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
5842
+ request.setRequestHeader(key, val);
5843
+ });
5844
+ }
5845
+ request.send(requestData || null);
5846
+ };
5847
+ if (xsrfCookieName) {
5848
+ // Native XHR timeout starts at send(). Cover cookie preparation and the
5849
+ // subsequent request with the same budget and existing timeout handler.
5850
+ const now = typeof performance !== 'undefined' && utils$1.isFunction(performance.now) ? () => performance.now() : Date.now;
5851
+ const deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
5852
+ const abortOnTimeout = () => {
5853
+ if (!request) return;
5854
+ const xhr = request;
5855
+ xhr.ontimeout();
5856
+ xhr.abort();
5857
+ };
5858
+ if (deadline !== undefined) {
5859
+ const scheduleTimeout = () => {
5860
+ const remaining = deadline - now();
5861
+ if (remaining > 0) {
5862
+ // Browser timers overflow above the signed 32-bit delay limit.
5863
+ timeoutId = setTimeout(scheduleTimeout, Math.min(remaining, 0x7fffffff));
5864
+ } else {
5865
+ abortOnTimeout();
5866
+ }
5867
+ };
5868
+ scheduleTimeout();
5869
+ }
5870
+ cookies.readAsync(xsrfCookieName).then(value => {
5871
+ if (!request) return;
5872
+ // Promise callbacks may run before an overdue timer after a busy task.
5873
+ if (deadline !== undefined && now() >= deadline) {
5874
+ abortOnTimeout();
5875
+ return;
5876
+ }
5877
+ if (value) {
5878
+ const headerName = utils$1.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
5879
+ requestHeaders.set(headerName, value);
5880
+ }
5881
+ sendRequest();
5882
+ }).catch(error => {
5883
+ if (!request) return;
5884
+ reject(AxiosError.from(error, null, config, request));
5885
+ done();
5886
+ request = null;
5887
+ });
5888
+ } else {
5889
+ sendRequest();
5890
+ }
4354
5891
  });
4355
5892
  };
4356
5893
 
@@ -4380,11 +5917,23 @@ const composeSignals = (signals, timeout) => {
4380
5917
  timer && clearTimeout(timer);
4381
5918
  timer = null;
4382
5919
  signals.forEach(signal => {
4383
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
5920
+ const unsubscribeSignal = utils$1.getSafeProp(signal, 'unsubscribe');
5921
+ utils$1.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal, onabort) : signal.removeEventListener('abort', onabort);
4384
5922
  });
4385
5923
  signals = null;
4386
5924
  };
4387
- signals.forEach(signal => signal.addEventListener('abort', onabort));
5925
+ signals.forEach(signal => {
5926
+ if (aborted) {
5927
+ return;
5928
+ }
5929
+ if (signal.aborted) {
5930
+ onabort.call(signal);
5931
+ return;
5932
+ }
5933
+ signal.addEventListener('abort', onabort, {
5934
+ once: true
5935
+ });
5936
+ });
4388
5937
  const {
4389
5938
  signal
4390
5939
  } = controller;
@@ -4474,7 +6023,133 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
4474
6023
  });
4475
6024
  };
4476
6025
 
6026
+ const CRLF = '\r\n';
6027
+ const normalizeLines = value => String(value).replace(/\r\n|\r|\n/g, CRLF);
6028
+ const escapeName = value => String(value).replace(/[\r\n"]/g, char => char === '\r' ? '%0D' : char === '\n' ? '%0A' : '%22');
6029
+
6030
+ // Count UTF-8 bytes without allocating an encoded copy of a field. FormData
6031
+ // string values normalize line endings; Blob/File contents remain unchanged.
6032
+ const stringBytes = (value, normalize) => {
6033
+ let length = 0;
6034
+ for (let i = 0; i < value.length; i++) {
6035
+ const code = value.charCodeAt(i);
6036
+ if (normalize && (code === 13 || code === 10)) {
6037
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
6038
+ length += 2;
6039
+ } else if (code < 0x80) {
6040
+ length++;
6041
+ } else if (code < 0x800) {
6042
+ length += 2;
6043
+ } else if (code >= 0xd800 && code <= 0xdbff && value.charCodeAt(i + 1) >= 0xdc00 && value.charCodeAt(i + 1) <= 0xdfff) {
6044
+ length += 4;
6045
+ i++;
6046
+ } else {
6047
+ length += 3;
6048
+ }
6049
+ }
6050
+ return length;
6051
+ };
6052
+
6053
+ // Describe serialization failures independently of any request library.
6054
+ class FormDataError extends TypeError {
6055
+ constructor(message, reason) {
6056
+ super(message);
6057
+ this.name = 'FormDataError';
6058
+ this.reason = reason;
6059
+ }
6060
+ }
6061
+
6062
+ // The caller supplies the boundary, Blob implementation, and limit error.
6063
+ function formDataToBlob(form, Blob, limit, limitError, boundary) {
6064
+ if (!utils$1.isFunction(Blob)) {
6065
+ throw new FormDataError('Blob is not supported', 'blob');
6066
+ }
6067
+ if (!utils$1.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
6068
+ throw new FormDataError('Invalid multipart boundary', 'boundary');
6069
+ }
6070
+ const footer = '--' + boundary + '--' + CRLF;
6071
+ let length = footer.length;
6072
+ const parts = [];
6073
+ const checkLength = extra => {
6074
+ if (length + extra > limit) throw limitError();
6075
+ };
6076
+ checkLength(0);
6077
+ for (const [name, value] of form) {
6078
+ const isString = utils$1.isString(value);
6079
+ const valueLength = isString ? stringBytes(value, true) : value.size;
6080
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
6081
+ throw new FormDataError('Unsupported FormData part size', 'part');
6082
+ }
6083
+ // Reject large values and names before building normalized header strings.
6084
+ checkLength(valueLength + stringBytes(name, true) + (!isString && value.name ? stringBytes(value.name, false) : 0) + (!isString && value.type ? stringBytes(value.type, false) : 0));
6085
+ let header = '--' + boundary + CRLF + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
6086
+ if (!isString) {
6087
+ header += '; filename="' + escapeName(utils$1.isString(value.name) ? value.name : 'blob') + '"' + CRLF + 'Content-Type: ' + String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
6088
+ }
6089
+ header += CRLF + CRLF;
6090
+ const partLength = stringBytes(header, false) + valueLength + CRLF.length;
6091
+ checkLength(partLength);
6092
+ length += partLength;
6093
+ parts.push({
6094
+ header,
6095
+ value,
6096
+ isString
6097
+ });
6098
+ }
6099
+
6100
+ // Native Blob composition retains existing Blob/File data. No file is read
6101
+ // and no complete multipart ArrayBuffer is created to determine its length.
6102
+ const blobParts = [];
6103
+ for (const part of parts) {
6104
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
6105
+ }
6106
+ blobParts.push(footer);
6107
+ return new Blob(blobParts, {
6108
+ type: 'multipart/form-data; boundary=' + boundary
6109
+ });
6110
+ }
6111
+
6112
+ function createMultipartBody(form, Blob, limit, limitError, boundary) {
6113
+ // Report missing Blob support before trying to select a random source.
6114
+ if (!utils$1.isFunction(Blob)) {
6115
+ throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
6116
+ }
6117
+ if (boundary === undefined) {
6118
+ if (utils$1.isFunction(platform.generateString)) {
6119
+ boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
6120
+ } else {
6121
+ const crypto = utils$1.global.crypto;
6122
+ if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
6123
+ throw new AxiosError('Random byte generation is not supported', AxiosError.ERR_NOT_SUPPORT);
6124
+ }
6125
+ const random = new Uint8Array(18);
6126
+ crypto.getRandomValues(random);
6127
+ boundary = 'axios-' + Array.from(random, value => ('0' + value.toString(16)).slice(-2)).join('');
6128
+ }
6129
+ }
6130
+ try {
6131
+ return formDataToBlob(form, Blob, limit, limitError, boundary);
6132
+ } catch (error) {
6133
+ if (error instanceof FormDataError) {
6134
+ const code = error.reason === 'boundary' ? AxiosError.ERR_BAD_OPTION_VALUE : AxiosError.ERR_BAD_REQUEST;
6135
+ throw new AxiosError(error.message, code);
6136
+ }
6137
+ throw error;
6138
+ }
6139
+ }
6140
+
4477
6141
  const DEFAULT_CHUNK_SIZE = 64 * 1024;
6142
+ const DEFAULT_REQUEST_OPTIONS = {
6143
+ cache: 'default',
6144
+ redirect: 'follow',
6145
+ referrer: 'about:client',
6146
+ referrerPolicy: '',
6147
+ mode: 'cors',
6148
+ integrity: '',
6149
+ keepalive: false,
6150
+ priority: 'auto',
6151
+ window: null
6152
+ };
4478
6153
  const {
4479
6154
  isFunction
4480
6155
  } = utils$1;
@@ -4528,12 +6203,14 @@ const factory = env => {
4528
6203
  skipUndefined: true
4529
6204
  }, {
4530
6205
  Request: globalObject.Request,
4531
- Response: globalObject.Response
6206
+ Response: globalObject.Response,
6207
+ Blob: globalObject.Blob
4532
6208
  }, env);
6209
+ const envFetch = utils$1.hasOwnProp(env, 'fetch') ? env.fetch : undefined;
4533
6210
  const {
4534
- fetch: envFetch,
4535
6211
  Request,
4536
- Response
6212
+ Response,
6213
+ Blob
4537
6214
  } = env;
4538
6215
  const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
4539
6216
  const isRequestSupported = isFunction(Request);
@@ -4560,6 +6237,19 @@ const factory = env => {
4560
6237
  return duplexAccessed && !hasContentType;
4561
6238
  });
4562
6239
  const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
6240
+
6241
+ // Some runtimes reject every explicit cache mode. Use own defaults for both
6242
+ // probes so unrelated polluted options cannot affect cache-mode detection.
6243
+ const requestDefaults = Object.assign(Object.create(null), DEFAULT_REQUEST_OPTIONS);
6244
+ if (isRequestSupported && !test(() => new Request(platform.origin, requestDefaults))) {
6245
+ delete requestDefaults.cache;
6246
+
6247
+ // Only omit cache when that makes Request construction succeed. Otherwise
6248
+ // retain the explicit default that protects supporting runtimes from pollution.
6249
+ if (!test(() => new Request(platform.origin, requestDefaults))) {
6250
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
6251
+ }
6252
+ }
4563
6253
  const resolvers = {
4564
6254
  stream: supportsResponseStream && (res => res.body)
4565
6255
  };
@@ -4581,13 +6271,6 @@ const factory = env => {
4581
6271
  if (utils$1.isBlob(body)) {
4582
6272
  return body.size;
4583
6273
  }
4584
- if (utils$1.isSpecCompliantForm(body)) {
4585
- const _request = new Request(platform.origin, {
4586
- method: 'POST',
4587
- body
4588
- });
4589
- return (await _request.arrayBuffer()).byteLength;
4590
- }
4591
6274
  if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
4592
6275
  return body.byteLength;
4593
6276
  }
@@ -4617,7 +6300,8 @@ const factory = env => {
4617
6300
  withCredentials = 'same-origin',
4618
6301
  fetchOptions,
4619
6302
  maxContentLength,
4620
- maxBodyLength
6303
+ maxBodyLength,
6304
+ maxRedirects
4621
6305
  } = resolveConfig(config);
4622
6306
  const hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
4623
6307
  const hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
@@ -4630,20 +6314,29 @@ const factory = env => {
4630
6314
  composedSignal.unsubscribe();
4631
6315
  });
4632
6316
  let requestContentLength;
6317
+
6318
+ // AxiosErrors we raise while request or response bodies are being streamed. Captured
6319
+ // by identity so the catch block can surface it directly, regardless of
6320
+ // how the runtime wraps the resulting fetch rejection (undici exposes it
6321
+ // as `err.cause`; some browsers drop the original error entirely).
6322
+ let pendingBodyError = null;
6323
+ let pendingResponseError = null;
6324
+ const maxBodyLengthError = () => new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4633
6325
  try {
4634
6326
  // HTTP basic authentication
4635
6327
  let auth = undefined;
4636
6328
  const configAuth = own('auth');
4637
6329
  if (configAuth) {
4638
- const username = configAuth.username || '';
4639
- const password = configAuth.password || '';
6330
+ const username = utils$1.getSafeProp(configAuth, 'username') || '';
6331
+ const password = utils$1.getSafeProp(configAuth, 'password') || '';
4640
6332
  auth = {
4641
6333
  username,
4642
6334
  password
4643
6335
  };
4644
6336
  }
6337
+ let parsedURL;
4645
6338
  if (maybeWithAuthCredentials(url)) {
4646
- const parsedURL = new URL(url, platform.origin);
6339
+ parsedURL = new URL(url, platform.origin);
4647
6340
  if (!auth && (parsedURL.username || parsedURL.password)) {
4648
6341
  const urlUsername = decodeURIComponentSafe(parsedURL.username);
4649
6342
  const urlPassword = decodeURIComponentSafe(parsedURL.password);
@@ -4666,37 +6359,74 @@ const factory = env => {
4666
6359
  // Enforce maxContentLength for data: URLs up-front so we never materialize
4667
6360
  // an oversized payload. The HTTP adapter applies the same check (see http.js
4668
6361
  // "if (protocol === 'data:')" branch).
4669
- if (hasMaxContentLength && typeof url === 'string' && url.startsWith('data:')) {
4670
- const estimated = estimateDataURLDecodedBytes(url);
6362
+ if (hasMaxContentLength && parsedURL && parsedURL.protocol === 'data:') {
6363
+ const estimated = estimateDataURLDecodedBytes(parsedURL.href);
4671
6364
  if (estimated > maxContentLength) {
4672
6365
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4673
6366
  }
4674
6367
  }
6368
+ const formContentType = utils$1.isSpecCompliantForm(data) && AxiosHeaders.from(own('headers')).getContentType();
6369
+ let formBoundary;
6370
+ if (utils$1.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
6371
+ const parameters = AxiosHeaders.parseParameters(formContentType);
6372
+ if (utils$1.hasOwnProp(parameters, 'boundary')) formBoundary = parameters.boundary;
6373
+ }
6374
+ if (utils$1.isSpecCompliantForm(data) && method !== 'get' && method !== 'head' && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== undefined)) {
6375
+ data = createMultipartBody(data, Blob, hasMaxBodyLength ? maxBodyLength : Infinity, maxBodyLengthError, formBoundary);
6376
+ // Blob.type lowercases its value, including a case-sensitive boundary.
6377
+ // Retain the caller's header when an explicit boundary was serialized.
6378
+ headers.setContentType(formBoundary === undefined ? data.type : formContentType);
6379
+ requestContentLength = data.size;
6380
+ }
4675
6381
 
4676
- // Enforce maxBodyLength against the outbound request body before dispatch.
4677
- // Mirrors http.js behavior (ERR_BAD_REQUEST / 'Request body larger than
4678
- // maxBodyLength limit'). Skip when the body length cannot be determined
4679
- // (e.g. a live ReadableStream supplied by the caller).
6382
+ // Enforce maxBodyLength against known-size bodies before dispatch using
6383
+ // the body's *actual* size — never a caller-declared Content-Length,
6384
+ // which could under-report to slip an oversized body past the check.
6385
+ // Unknown-size streams return undefined here and are counted per-chunk
6386
+ // below as fetch consumes them.
4680
6387
  if (hasMaxBodyLength && method !== 'get' && method !== 'head') {
4681
- const outboundLength = await resolveBodyLength(headers, data);
4682
- if (typeof outboundLength === 'number' && isFinite(outboundLength) && outboundLength > maxBodyLength) {
4683
- throw new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
6388
+ const outboundLength = await getBodyLength(data);
6389
+ if (typeof outboundLength === 'number' && isFinite(outboundLength)) {
6390
+ requestContentLength = outboundLength;
6391
+ if (outboundLength > maxBodyLength) {
6392
+ throw maxBodyLengthError();
6393
+ }
4684
6394
  }
4685
6395
  }
4686
- if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
4687
- let _request = new Request(url, {
4688
- method: 'POST',
4689
- body: data,
4690
- duplex: 'half'
4691
- });
4692
- let contentTypeHeader;
4693
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
4694
- headers.setContentType(contentTypeHeader);
6396
+
6397
+ // A streamed body under maxBodyLength must be counted as fetch consumes
6398
+ // it; its size is never trusted from a caller-declared Content-Length.
6399
+ const mustEnforceStreamBody = hasMaxBodyLength && (utils$1.isReadableStream(data) || utils$1.isStream(data));
6400
+ const trackRequestStream = (stream, onProgress, flush) => trackStream(stream, DEFAULT_CHUNK_SIZE, loadedBytes => {
6401
+ if (hasMaxBodyLength && loadedBytes > maxBodyLength) {
6402
+ throw pendingBodyError = maxBodyLengthError();
4695
6403
  }
4696
- if (_request.body) {
4697
- const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
4698
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
6404
+ onProgress && onProgress(loadedBytes);
6405
+ }, flush);
6406
+ if (supportsRequestStream && method !== 'get' && method !== 'head' && (onUploadProgress || mustEnforceStreamBody)) {
6407
+ requestContentLength = requestContentLength == null ? await resolveBodyLength(headers, data) : requestContentLength;
6408
+
6409
+ // A declared length of 0 is only trusted to skip the wrap when we are
6410
+ // not enforcing a stream limit (which must not rely on that header).
6411
+ if (requestContentLength !== 0 || mustEnforceStreamBody) {
6412
+ let _request = new Request(url, {
6413
+ method: 'POST',
6414
+ body: data,
6415
+ duplex: 'half'
6416
+ });
6417
+ let contentTypeHeader;
6418
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
6419
+ headers.setContentType(contentTypeHeader);
6420
+ }
6421
+ if (_request.body) {
6422
+ const [onProgress, flush] = onUploadProgress && progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))) || [];
6423
+ data = trackRequestStream(_request.body, onProgress, flush);
6424
+ }
4699
6425
  }
6426
+ } else if (mustEnforceStreamBody && !isRequestSupported && isReadableStreamSupported && method !== 'get' && method !== 'head') {
6427
+ data = trackRequestStream(data);
6428
+ } else if (mustEnforceStreamBody && isRequestSupported && !supportsRequestStream && method !== 'get' && method !== 'head') {
6429
+ throw new AxiosError('Stream request bodies are not supported by the current fetch implementation', AxiosError.ERR_NOT_SUPPORT, config, request);
4700
6430
  }
4701
6431
  if (!utils$1.isString(withCredentials)) {
4702
6432
  withCredentials = withCredentials ? 'include' : 'omit';
@@ -4717,22 +6447,52 @@ const factory = env => {
4717
6447
 
4718
6448
  // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
4719
6449
  headers.set('User-Agent', 'axios/' + VERSION, false);
4720
- const resolvedOptions = {
4721
- ...fetchOptions,
6450
+ const safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
6451
+ if (safeFetchOptions) {
6452
+ // These options are owned by Axios and are already reflected in the
6453
+ // resolved Request passed to fetch.
6454
+ delete safeFetchOptions.body;
6455
+ delete safeFetchOptions.headers;
6456
+ delete safeFetchOptions.method;
6457
+ delete safeFetchOptions.signal;
6458
+ delete safeFetchOptions.duplex;
6459
+ delete safeFetchOptions.credentials;
6460
+ }
6461
+ const resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
4722
6462
  signal: composedSignal,
4723
6463
  method: method.toUpperCase(),
4724
6464
  headers: toByteStringHeaderObject(headers.normalize()),
4725
6465
  body: data,
4726
6466
  duplex: 'half',
4727
6467
  credentials: isCredentialsSupported ? withCredentials : undefined
4728
- };
6468
+ });
6469
+ if (isRequestSupported) {
6470
+ utils$1.forEach(requestDefaults, (value, key) => {
6471
+ if (resolvedOptions[key] === undefined) {
6472
+ resolvedOptions[key] = value;
6473
+ }
6474
+ });
6475
+ if (resolvedOptions.signal === undefined) {
6476
+ resolvedOptions.signal = null;
6477
+ }
6478
+ if (resolvedOptions.body === undefined) {
6479
+ resolvedOptions.body = null;
6480
+ }
6481
+ }
6482
+ if (maxRedirects === 0) {
6483
+ resolvedOptions.redirect = 'manual';
6484
+ if (safeFetchOptions) {
6485
+ safeFetchOptions.redirect = 'manual';
6486
+ }
6487
+ }
4729
6488
  request = isRequestSupported && new Request(url, resolvedOptions);
4730
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
6489
+ let response = await (isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url, resolvedOptions));
6490
+ const responseHeaders = AxiosHeaders.from(response.headers);
4731
6491
 
4732
6492
  // Cheap pre-check: if the server honestly declares a content-length that
4733
6493
  // already exceeds the cap, reject before we start streaming.
4734
6494
  if (hasMaxContentLength) {
4735
- const declaredLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6495
+ const declaredLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
4736
6496
  if (declaredLength != null && declaredLength > maxContentLength) {
4737
6497
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4738
6498
  }
@@ -4743,14 +6503,14 @@ const factory = env => {
4743
6503
  ['status', 'statusText', 'headers'].forEach(prop => {
4744
6504
  options[prop] = response[prop];
4745
6505
  });
4746
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
6506
+ const responseContentLength = utils$1.toFiniteNumber(responseHeaders.getContentLength());
4747
6507
  const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
4748
6508
  let bytesRead = 0;
4749
6509
  const onChunkProgress = loadedBytes => {
4750
6510
  if (hasMaxContentLength) {
4751
6511
  bytesRead = loadedBytes;
4752
6512
  if (bytesRead > maxContentLength) {
4753
- throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
6513
+ throw pendingResponseError = new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4754
6514
  }
4755
6515
  }
4756
6516
  onProgress && onProgress(loadedBytes);
@@ -4802,13 +6562,51 @@ const factory = env => {
4802
6562
  const canceledError = composedSignal.reason;
4803
6563
  canceledError.config = config;
4804
6564
  request && (canceledError.request = request);
4805
- err !== canceledError && (canceledError.cause = err);
6565
+ if (err !== canceledError) {
6566
+ // Non-enumerable to match native Error `cause` semantics so loggers
6567
+ // don't recurse into circular fetch internals (see #7205).
6568
+ Object.defineProperty(canceledError, 'cause', {
6569
+ __proto__: null,
6570
+ value: err,
6571
+ writable: true,
6572
+ enumerable: false,
6573
+ configurable: true
6574
+ });
6575
+ }
4806
6576
  throw canceledError;
4807
6577
  }
6578
+
6579
+ // Surface a maxBodyLength violation we raised while the request body was
6580
+ // being streamed. Keeping the original error (rather than reading
6581
+ // `err.cause.isAxiosError`) keeps the error deterministic across runtimes
6582
+ // and avoids both prototype-pollution reads and mis-attributing a foreign
6583
+ // AxiosError that merely happened to land in `err.cause`.
6584
+ if (pendingBodyError) {
6585
+ request && !pendingBodyError.request && (pendingBodyError.request = request);
6586
+ throw pendingBodyError;
6587
+ }
6588
+ if (pendingResponseError) {
6589
+ throw pendingResponseError;
6590
+ }
6591
+
6592
+ // Re-throw AxiosErrors we raised synchronously (data: URL / content-length
6593
+ // pre-checks, response size enforcement) without re-wrapping them.
6594
+ if (err instanceof AxiosError) {
6595
+ request && !err.request && (err.request = request);
6596
+ throw err;
6597
+ }
4808
6598
  if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
4809
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response), {
4810
- cause: err.cause || err
6599
+ const networkError = new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response);
6600
+ // Non-enumerable to match native Error `cause` semantics so loggers
6601
+ // don't recurse into circular fetch internals (see #7205).
6602
+ Object.defineProperty(networkError, 'cause', {
6603
+ __proto__: null,
6604
+ value: err.cause || err,
6605
+ writable: true,
6606
+ enumerable: false,
6607
+ configurable: true
4811
6608
  });
6609
+ throw networkError;
4812
6610
  }
4813
6611
  throw AxiosError.from(err, err && err.code, config, request, err && err.response);
4814
6612
  }
@@ -4816,13 +6614,20 @@ const factory = env => {
4816
6614
  };
4817
6615
  const seedCache = new Map();
4818
6616
  const getFetch = config => {
4819
- let env = config && config.env || {};
6617
+ const env = Object.create(null);
6618
+ const configuredEnv = config && utils$1.hasOwnProp(config, 'env') && config.env;
6619
+ ['fetch', 'Request', 'Response', 'Blob'].forEach(key => {
6620
+ if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
6621
+ env[key] = configuredEnv[key];
6622
+ }
6623
+ });
4820
6624
  const {
4821
6625
  fetch,
4822
6626
  Request,
4823
- Response
6627
+ Response,
6628
+ Blob
4824
6629
  } = env;
4825
- const seeds = [Request, Response, fetch];
6630
+ const seeds = [Request, Response, fetch, Blob];
4826
6631
  let len = seeds.length,
4827
6632
  i = len,
4828
6633
  seed,
@@ -4927,7 +6732,7 @@ function getAdapter(adapters, config) {
4927
6732
  if (!adapter) {
4928
6733
  const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? 'is not supported by the environment' : 'is not available in the build'));
4929
6734
  let s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
4930
- throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s, 'ERR_NOT_SUPPORT');
6735
+ throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s, AxiosError.ERR_NOT_SUPPORT);
4931
6736
  }
4932
6737
  return adapter;
4933
6738
  }
@@ -4964,6 +6769,35 @@ function throwIfCancellationRequested(config) {
4964
6769
  }
4965
6770
  }
4966
6771
 
6772
+ /**
6773
+ * Resolve the clock used to time adapter execution.
6774
+ *
6775
+ * Prefers the monotonic `performance.now()` so wall-clock adjustments do not
6776
+ * skew the measurement, and so frameworks that forbid reading the current
6777
+ * time during prerendering (e.g. Next.js Cache Components) accept it. Falls
6778
+ * back to `Date.now()` in runtimes without the High Resolution Time API.
6779
+ *
6780
+ * @returns {() => number} Millisecond clock
6781
+ */
6782
+ function resolveClock() {
6783
+ return typeof performance !== 'undefined' && utils$1.isFunction(performance.now) ? () => performance.now() : Date.now;
6784
+ }
6785
+
6786
+ /**
6787
+ * Whole milliseconds elapsed since `start`, floored at zero.
6788
+ *
6789
+ * Rounded so the value stays an integer as with `Date.now()`. The fallback
6790
+ * wall clock can move backwards mid-request, so the result is clamped.
6791
+ *
6792
+ * @param {() => number} now Clock returned by `resolveClock()`
6793
+ * @param {number} start Timestamp read from `now`
6794
+ *
6795
+ * @returns {number} Non-negative elapsed milliseconds
6796
+ */
6797
+ function elapsedSince(now, start) {
6798
+ return Math.max(0, Math.round(now() - start));
6799
+ }
6800
+
4967
6801
  /**
4968
6802
  * Dispatch a request to the server using the configured adapter.
4969
6803
  *
@@ -4971,9 +6805,13 @@ function throwIfCancellationRequested(config) {
4971
6805
  *
4972
6806
  * @returns {Promise} The Promise to be fulfilled
4973
6807
  */
4974
- function dispatchRequest(config) {
6808
+ function dispatchRequest(_config) {
6809
+ // Interceptors may replace the merged config with an ordinary object. Flatten
6810
+ // it at the dispatch boundary so shared prototype members cannot become
6811
+ // request behavior, while preserving intentional template/class members.
6812
+ const config = utils$1.toSafeFlatObject(_config);
4975
6813
  throwIfCancellationRequested(config);
4976
- config.headers = AxiosHeaders.from(config.headers);
6814
+ config.headers = AxiosHeaders.from(utils$1.getSafeProp(config, 'headers'));
4977
6815
 
4978
6816
  // Transform request data
4979
6817
  config.data = transformData.call(config, config.transformRequest);
@@ -4981,8 +6819,11 @@ function dispatchRequest(config) {
4981
6819
  config.headers.setContentType('application/x-www-form-urlencoded', false);
4982
6820
  }
4983
6821
  const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
6822
+ const now = resolveClock();
6823
+ const start = now();
4984
6824
  return adapter(config).then(function onAdapterResolution(response) {
4985
6825
  throwIfCancellationRequested(config);
6826
+ response.duration = elapsedSince(now, start);
4986
6827
 
4987
6828
  // Expose the current response on config so that transformResponse can
4988
6829
  // attach it to any AxiosError it throws (e.g. on JSON parse failure).
@@ -5001,6 +6842,7 @@ function dispatchRequest(config) {
5001
6842
 
5002
6843
  // Transform response data
5003
6844
  if (reason && reason.response) {
6845
+ reason.response.duration = elapsedSince(now, start);
5004
6846
  config.response = reason.response;
5005
6847
  try {
5006
6848
  reason.response.data = transformData.call(config, config.transformResponse, reason.response);
@@ -5070,7 +6912,7 @@ validators$1.spelling = function spelling(correctSpelling) {
5070
6912
  */
5071
6913
 
5072
6914
  function assertOptions(options, schema, allowUnknown) {
5073
- if (typeof options !== 'object') {
6915
+ if (typeof options !== 'object' || options === null) {
5074
6916
  throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
5075
6917
  }
5076
6918
  const keys = Object.keys(options);
@@ -5100,6 +6942,21 @@ var validator = {
5100
6942
 
5101
6943
  const validators = validator.validators;
5102
6944
 
6945
+ // Recognize header maps without consuming objects intended as literal values.
6946
+ // AxiosHeaders from other builds share a brand and header-container interface,
6947
+ // but not constructor identity. A tag and toJSON alone can describe a literal.
6948
+ const isHeadersBucket = value => {
6949
+ if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders) {
6950
+ return true;
6951
+ }
6952
+ try {
6953
+ return utils$1.isObject(value) && utils$1.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' && ['toJSON', 'set', 'get', 'has', 'delete', 'clear', 'normalize', 'concat', 'toString', Symbol.iterator].every(method => utils$1.isFunction(utils$1.getSafeProp(value, method)));
6954
+ } catch (e) {
6955
+ // A failed optional brand probe must not prevent literal header serialization.
6956
+ return false;
6957
+ }
6958
+ };
6959
+
5103
6960
  /**
5104
6961
  * Create a new instance of Axios
5105
6962
  *
@@ -5129,31 +6986,40 @@ class Axios {
5129
6986
  return await this._request(configOrUrl, config);
5130
6987
  } catch (err) {
5131
6988
  if (err instanceof Error) {
5132
- let dummy = {};
5133
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
5134
-
5135
- // slice off the Error: ... line
5136
- const stack = (() => {
5137
- if (!dummy.stack) {
5138
- return '';
5139
- }
5140
- const firstNewlineIndex = dummy.stack.indexOf('\n');
5141
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
5142
- })();
5143
6989
  try {
6990
+ let dummy = {};
6991
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
6992
+ const dummyStack = dummy.stack;
6993
+ let stack = '';
6994
+
6995
+ // slice off the Error: ... line
6996
+ if (typeof dummyStack === 'string') {
6997
+ const firstNewlineIndex = dummyStack.indexOf('\n');
6998
+ stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
6999
+ }
5144
7000
  if (!err.stack) {
5145
7001
  err.stack = stack;
5146
- // match without the 2 top stack lines
5147
7002
  } else if (stack) {
7003
+ // Match a common suffix after the 2 top frames when available,
7004
+ // otherwise compare the full reconstructed stack.
5148
7005
  const firstNewlineIndex = stack.indexOf('\n');
5149
7006
  const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
5150
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
5151
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
5152
- err.stack += '\n' + stack;
7007
+ const duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1);
7008
+
7009
+ // `AxiosError.from()` may have already inlined the wrapped error's
7010
+ // stack under a `Caused by:` marker. Keep the reconstructed caller
7011
+ // frames ahead of that marker so stack-only reporters do not read
7012
+ // them as part of the low-level cause.
7013
+ const currentStack = String(err.stack);
7014
+ const causeIndex = getCauseStackIndex(err, currentStack);
7015
+ const stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
7016
+ const causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
7017
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
7018
+ err.stack = stackHead + '\n' + stack + causeSection;
5153
7019
  }
5154
7020
  }
5155
7021
  } catch (e) {
5156
- // ignore the case where "stack" is an un-writable property
7022
+ // Ignore failures from custom stack hooks or un-writable stack properties.
5157
7023
  }
5158
7024
  }
5159
7025
  throw err;
@@ -5180,7 +7046,9 @@ class Axios {
5180
7046
  forcedJSONParsing: validators.transitional(validators.boolean),
5181
7047
  clarifyTimeoutError: validators.transitional(validators.boolean),
5182
7048
  legacyInterceptorReqResOrdering: validators.transitional(validators.boolean),
5183
- advertiseZstdAcceptEncoding: validators.transitional(validators.boolean)
7049
+ advertiseZstdAcceptEncoding: validators.transitional(validators.boolean),
7050
+ validateStatusUndefinedResolves: validators.transitional(validators.boolean),
7051
+ encodeBasicAuthUsername: validators.transitional(validators.boolean)
5184
7052
  }, false);
5185
7053
  }
5186
7054
  if (paramsSerializer != null) {
@@ -5197,7 +7065,7 @@ class Axios {
5197
7065
  }
5198
7066
 
5199
7067
  // Set config.allowAbsoluteUrls
5200
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
7068
+ if (config.allowAbsoluteUrls !== undefined) ; else if (utils$1.hasOwnProp(this.defaults, 'allowAbsoluteUrls') && this.defaults.allowAbsoluteUrls !== undefined) {
5201
7069
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
5202
7070
  } else {
5203
7071
  config.allowAbsoluteUrls = true;
@@ -5208,12 +7076,16 @@ class Axios {
5208
7076
  }, true);
5209
7077
 
5210
7078
  // Set config.method
5211
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
5212
-
5213
- // Flatten headers
5214
- let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
5215
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], method => {
5216
- delete headers[method];
7079
+ config.method = (utils$1.getSafeProp(config, 'method') || utils$1.getSafeProp(this.defaults, 'method') || 'get').toLowerCase();
7080
+
7081
+ // Flatten header defaults without consuming literal method-named headers.
7082
+ const commonHeaders = utils$1.getSafeProp(headers, 'common');
7083
+ const methodHeaders = utils$1.getSafeProp(headers, config.method);
7084
+ const contextHeaders = headers && utils$1.merge(isHeadersBucket(commonHeaders) ? commonHeaders : undefined, isHeadersBucket(methodHeaders) ? methodHeaders : undefined);
7085
+ headers && utils$1.forEach(methodList.concat('common'), method => {
7086
+ if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
7087
+ delete headers[method];
7088
+ }
5217
7089
  });
5218
7090
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
5219
7091
 
@@ -5257,16 +7129,29 @@ class Axios {
5257
7129
  const onFulfilled = requestInterceptorChain[i++];
5258
7130
  const onRejected = requestInterceptorChain[i++];
5259
7131
  try {
5260
- newConfig = onFulfilled(newConfig);
7132
+ newConfig = onFulfilled ? onFulfilled(newConfig) : newConfig;
5261
7133
  } catch (error) {
5262
- onRejected.call(this, error);
7134
+ if (!onRejected) {
7135
+ promise = Promise.reject(error);
7136
+ break;
7137
+ }
7138
+ try {
7139
+ const rejectedResult = onRejected.call(this, error);
7140
+ if (utils$1.isThenable(rejectedResult)) {
7141
+ promise = Promise.resolve(rejectedResult).then(() => dispatchRequest.call(this, newConfig));
7142
+ }
7143
+ } catch (rejectedError) {
7144
+ promise = Promise.reject(rejectedError);
7145
+ }
5263
7146
  break;
5264
7147
  }
5265
7148
  }
5266
- try {
5267
- promise = dispatchRequest.call(this, newConfig);
5268
- } catch (error) {
5269
- return Promise.reject(error);
7149
+ if (!promise) {
7150
+ try {
7151
+ promise = dispatchRequest.call(this, newConfig);
7152
+ } catch (error) {
7153
+ promise = Promise.reject(error);
7154
+ }
5270
7155
  }
5271
7156
  i = 0;
5272
7157
  len = responseInterceptorChain.length;
@@ -5277,7 +7162,7 @@ class Axios {
5277
7162
  }
5278
7163
  getUri(config) {
5279
7164
  config = mergeConfig(this.defaults, config);
5280
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
7165
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls, config);
5281
7166
  return buildURL(fullPath, config.params, config.paramsSerializer);
5282
7167
  }
5283
7168
  }
@@ -5285,17 +7170,17 @@ class Axios {
5285
7170
  // Provide aliases for supported request methods
5286
7171
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
5287
7172
  /*eslint func-names:0*/
5288
- Axios.prototype[method] = function (url, config) {
7173
+ Axios.prototype[method] = async function (url, config) {
5289
7174
  return this.request(mergeConfig(config || {}, {
5290
7175
  method,
5291
7176
  url,
5292
- data: (config || {}).data
7177
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
5293
7178
  }));
5294
7179
  };
5295
7180
  });
5296
7181
  utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
5297
7182
  function generateHTTPMethod(isForm) {
5298
- return function httpMethod(url, data, config) {
7183
+ return async function httpMethod(url, data, config) {
5299
7184
  return this.request(mergeConfig(config || {}, {
5300
7185
  method,
5301
7186
  headers: isForm ? {
@@ -5505,14 +7390,22 @@ const HttpStatusCode = {
5505
7390
  Gone: 410,
5506
7391
  LengthRequired: 411,
5507
7392
  PreconditionFailed: 412,
7393
+ /**
7394
+ * @deprecated Use `ContentTooLarge` instead.
7395
+ */
5508
7396
  PayloadTooLarge: 413,
7397
+ ContentTooLarge: 413,
5509
7398
  UriTooLong: 414,
5510
7399
  UnsupportedMediaType: 415,
5511
7400
  RangeNotSatisfiable: 416,
5512
7401
  ExpectationFailed: 417,
5513
7402
  ImATeapot: 418,
5514
7403
  MisdirectedRequest: 421,
7404
+ /**
7405
+ * @deprecated Use `UnprocessableContent` instead.
7406
+ */
5515
7407
  UnprocessableEntity: 422,
7408
+ UnprocessableContent: 422,
5516
7409
  Locked: 423,
5517
7410
  FailedDependency: 424,
5518
7411
  TooEarly: 425,
@@ -5532,6 +7425,7 @@ const HttpStatusCode = {
5532
7425
  LoopDetected: 508,
5533
7426
  NotExtended: 510,
5534
7427
  NetworkAuthenticationRequired: 511,
7428
+ WebServerReturnsAnUnknownError: 520,
5535
7429
  WebServerIsDown: 521,
5536
7430
  ConnectionTimedOut: 522,
5537
7431
  OriginIsUnreachable: 523,
@@ -5540,7 +7434,9 @@ const HttpStatusCode = {
5540
7434
  InvalidSslCertificate: 526
5541
7435
  };
5542
7436
  Object.entries(HttpStatusCode).forEach(([key, value]) => {
5543
- HttpStatusCode[value] = key;
7437
+ if (HttpStatusCode[value] === undefined) {
7438
+ HttpStatusCode[value] = key;
7439
+ }
5544
7440
  });
5545
7441
 
5546
7442
  /**
@@ -5608,4 +7504,3 @@ axios.HttpStatusCode = HttpStatusCode;
5608
7504
  axios.default = axios;
5609
7505
 
5610
7506
  module.exports = axios;
5611
- //# sourceMappingURL=axios.cjs.map