@zowe/db2-for-zowe-cli 6.1.17 → 6.1.19

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 (282) hide show
  1. package/README.md +12 -10
  2. package/lib/Db2PluginLifeCycle.d.ts +11 -9
  3. package/lib/Db2PluginLifeCycle.js +18 -13
  4. package/lib/Db2PluginLifeCycle.js.map +1 -1
  5. package/node_modules/adm-zip/adm-zip.js +32 -6
  6. package/node_modules/adm-zip/headers/entryHeader.js +13 -1
  7. package/node_modules/adm-zip/methods/inflater.js +33 -3
  8. package/node_modules/adm-zip/package.json +2 -2
  9. package/node_modules/adm-zip/util/errors.js +3 -0
  10. package/node_modules/adm-zip/util/utils.js +102 -14
  11. package/node_modules/adm-zip/zipEntry.js +43 -18
  12. package/node_modules/adm-zip/zipFile.js +10 -0
  13. package/node_modules/axios/CHANGELOG.md +62 -0
  14. package/node_modules/axios/README.md +236 -73
  15. package/node_modules/axios/dist/axios.js +1308 -357
  16. package/node_modules/axios/dist/axios.min.js +3 -3
  17. package/node_modules/axios/dist/axios.min.js.map +1 -1
  18. package/node_modules/axios/dist/browser/axios.cjs +1443 -403
  19. package/node_modules/axios/dist/esm/axios.js +1443 -403
  20. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  21. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  22. package/node_modules/axios/dist/node/axios.cjs +1483 -348
  23. package/node_modules/axios/index.d.cts +24 -1
  24. package/node_modules/axios/index.d.ts +22 -1
  25. package/node_modules/axios/lib/adapters/fetch.js +136 -30
  26. package/node_modules/axios/lib/adapters/http.js +277 -74
  27. package/node_modules/axios/lib/adapters/xhr.js +172 -16
  28. package/node_modules/axios/lib/core/Axios.js +87 -27
  29. package/node_modules/axios/lib/core/AxiosError.js +59 -0
  30. package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
  31. package/node_modules/axios/lib/core/InterceptorManager.js +118 -8
  32. package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
  33. package/node_modules/axios/lib/core/buildFullPath.js +1 -13
  34. package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
  35. package/node_modules/axios/lib/core/dispatchRequest.js +28 -2
  36. package/node_modules/axios/lib/core/mergeConfig.js +183 -120
  37. package/node_modules/axios/lib/core/methodList.js +17 -0
  38. package/node_modules/axios/lib/defaults/index.js +2 -1
  39. package/node_modules/axios/lib/defaults/transitional.js +1 -0
  40. package/node_modules/axios/lib/env/data.js +1 -1
  41. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
  42. package/node_modules/axios/lib/helpers/Http2Sessions.js +4 -1
  43. package/node_modules/axios/lib/helpers/HttpStatusCode.js +11 -1
  44. package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
  45. package/node_modules/axios/lib/helpers/cookies.js +30 -6
  46. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
  47. package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
  48. package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
  49. package/node_modules/axios/lib/helpers/fromDataURI.js +11 -4
  50. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
  51. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  52. package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
  53. package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
  54. package/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
  55. package/node_modules/axios/lib/helpers/resolveConfig.js +20 -5
  56. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +197 -6
  57. package/node_modules/axios/lib/helpers/throttle.js +3 -2
  58. package/node_modules/axios/lib/helpers/toFormData.js +14 -21
  59. package/node_modules/axios/lib/utils.js +192 -20
  60. package/node_modules/axios/package.json +1 -2
  61. package/node_modules/follow-redirects/README.md +27 -1
  62. package/node_modules/follow-redirects/index.js +11 -6
  63. package/node_modules/follow-redirects/package.json +1 -1
  64. package/node_modules/fs-extra/README.md +0 -1
  65. package/node_modules/fs-extra/lib/empty/index.js +4 -2
  66. package/node_modules/fs-extra/lib/util/stat.js +12 -2
  67. package/node_modules/fs-extra/package.json +1 -1
  68. package/node_modules/ibm_db/APIDocumentation.md +2883 -2024
  69. package/node_modules/ibm_db/LICENSE +23 -23
  70. package/node_modules/ibm_db/README.md +735 -735
  71. package/node_modules/ibm_db/binding.gyp +99 -98
  72. package/node_modules/ibm_db/installer/driverInstall.js +984 -958
  73. package/node_modules/ibm_db/installer/ifx.sh +38 -38
  74. package/node_modules/ibm_db/installer/setenv.sh +23 -23
  75. package/node_modules/ibm_db/installer/testODBCConnection.bat +51 -51
  76. package/node_modules/ibm_db/installer/testODBCConnection.sh +61 -61
  77. package/node_modules/ibm_db/lib/climacros.js +431 -431
  78. package/node_modules/ibm_db/lib/odbc.js +4293 -3487
  79. package/node_modules/ibm_db/lib/simple-queue.js +41 -41
  80. package/node_modules/ibm_db/package.json +70 -70
  81. package/node_modules/ibm_db/src/odbc.cpp +1495 -1396
  82. package/node_modules/ibm_db/src/odbc.h +477 -473
  83. package/node_modules/ibm_db/src/odbc_connection.cpp +1762 -1612
  84. package/node_modules/ibm_db/src/odbc_connection.h +228 -215
  85. package/node_modules/ibm_db/src/odbc_result.cpp +1547 -1547
  86. package/node_modules/ibm_db/src/odbc_result.h +152 -152
  87. package/node_modules/ibm_db/src/odbc_statement.cpp +2047 -861
  88. package/node_modules/ibm_db/src/odbc_statement.h +257 -135
  89. package/node_modules/ibm_db/src/strptime.c +389 -389
  90. package/node_modules/ibm_db/src/strptime.h +46 -46
  91. package/node_modules/ibm_db/test/README +23 -23
  92. package/node_modules/ibm_db/test/bench-insert.js +62 -62
  93. package/node_modules/ibm_db/test/bench-insertBatch10.js +74 -74
  94. package/node_modules/ibm_db/test/bench-insertBatch100.js +75 -75
  95. package/node_modules/ibm_db/test/bench-insertBatch1000.js +75 -75
  96. package/node_modules/ibm_db/test/bench-insertBatch10000.js +75 -75
  97. package/node_modules/ibm_db/test/bench-prepare-bind-execute-closeSync.js +60 -60
  98. package/node_modules/ibm_db/test/bench-prepare-bind-executeNonQuery.js +53 -53
  99. package/node_modules/ibm_db/test/bench-prepare-bindSync-execute-closeSync.js +50 -50
  100. package/node_modules/ibm_db/test/bench-prepare-bindSync-executeNonQuery.js +48 -48
  101. package/node_modules/ibm_db/test/bench-prepare-execute-closeSync.js +51 -51
  102. package/node_modules/ibm_db/test/bench-prepare-executeNonQuery.js +47 -47
  103. package/node_modules/ibm_db/test/bench-prepare-not.js +43 -43
  104. package/node_modules/ibm_db/test/bench-query-fetch.js +59 -59
  105. package/node_modules/ibm_db/test/bench-query-fetchAll.js +49 -49
  106. package/node_modules/ibm_db/test/bench-query-fetchAllSync.js +43 -43
  107. package/node_modules/ibm_db/test/bench-query.js +40 -40
  108. package/node_modules/ibm_db/test/bench-querySync-fetchArray.js +28 -28
  109. package/node_modules/ibm_db/test/bench-querySync.js +29 -29
  110. package/node_modules/ibm_db/test/common.d.ts +10 -10
  111. package/node_modules/ibm_db/test/common.js +127 -127
  112. package/node_modules/ibm_db/test/config.json +7 -7
  113. package/node_modules/ibm_db/test/config.zos.json +4 -4
  114. package/node_modules/ibm_db/test/data/sample1.txt +9 -9
  115. package/node_modules/ibm_db/test/data/trc.fmt +30114 -30114
  116. package/node_modules/ibm_db/test/nodeEE-leak-huge-query.js +152 -152
  117. package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-multiple-connections.js +148 -148
  118. package/node_modules/ibm_db/test/nodeEE-leak-multiple-query-pool-connections.js +154 -154
  119. package/node_modules/ibm_db/test/nodeEE-leak-multiple-query.js +133 -133
  120. package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall-multiple-connections.js +174 -174
  121. package/node_modules/ibm_db/test/nodeEE-stress-async-waterfall.js +169 -169
  122. package/node_modules/ibm_db/test/nodeEE-stress-mixed-query-multiple-connections.js +159 -159
  123. package/node_modules/ibm_db/test/nodeEE-stress-mixed-query.js +148 -148
  124. package/node_modules/ibm_db/test/odbc-bench.c +123 -123
  125. package/node_modules/ibm_db/test/perfTest.js +53 -53
  126. package/node_modules/ibm_db/test/quick-example.sh +30 -30
  127. package/node_modules/ibm_db/test/quick-example.ts +80 -80
  128. package/node_modules/ibm_db/test/run-bench.js +96 -96
  129. package/node_modules/ibm_db/test/run-nodeEE.js +132 -132
  130. package/node_modules/ibm_db/test/run-tests.js +132 -138
  131. package/node_modules/ibm_db/test/sql-cli.js +28 -28
  132. package/node_modules/ibm_db/test/test-all-data-types.js +109 -109
  133. package/node_modules/ibm_db/test/test-array-insert.js +178 -178
  134. package/node_modules/ibm_db/test/test-async-await.js +105 -105
  135. package/node_modules/ibm_db/test/test-attributes.js +34 -34
  136. package/node_modules/ibm_db/test/test-bad-pool-connection-prepare-execute.js +57 -57
  137. package/node_modules/ibm_db/test/test-basic-test.js +138 -138
  138. package/node_modules/ibm_db/test/test-binary-array-insert.js +73 -73
  139. package/node_modules/ibm_db/test/test-blob-from-file.js +90 -90
  140. package/node_modules/ibm_db/test/test-blob-insert.js +144 -144
  141. package/node_modules/ibm_db/test/test-blob-stream-insert.js +321 -299
  142. package/node_modules/ibm_db/test/test-blob-to-file.js +370 -370
  143. package/node_modules/ibm_db/test/test-block-fetch.js +364 -364
  144. package/node_modules/ibm_db/test/test-blocking-issue210.js +123 -123
  145. package/node_modules/ibm_db/test/test-call-async.js +64 -64
  146. package/node_modules/ibm_db/test/test-call-stmt.js +53 -53
  147. package/node_modules/ibm_db/test/test-cancel.js +703 -0
  148. package/node_modules/ibm_db/test/test-chinese-char.js +59 -59
  149. package/node_modules/ibm_db/test/test-connection.js +306 -0
  150. package/node_modules/ibm_db/test/test-date.js +32 -32
  151. package/node_modules/ibm_db/test/test-dbclob.js +93 -93
  152. package/node_modules/ibm_db/test/test-decimals.js +135 -135
  153. package/node_modules/ibm_db/test/test-describe-metadata.js +148 -0
  154. package/node_modules/ibm_db/test/test-executeFile.js +167 -167
  155. package/node_modules/ibm_db/test/test-executeFileSync.js +85 -85
  156. package/node_modules/ibm_db/test/test-fetch-apis.js +146 -146
  157. package/node_modules/ibm_db/test/test-fetchN.js +130 -130
  158. package/node_modules/ibm_db/test/test-getinfo.js +197 -197
  159. package/node_modules/ibm_db/test/test-ibm-db-issue14.js +58 -58
  160. package/node_modules/ibm_db/test/test-ibm-db-issue17.js +54 -54
  161. package/node_modules/ibm_db/test/test-ibm-db-issue18.js +54 -54
  162. package/node_modules/ibm_db/test/test-issue-1059-fetchAll-undefined.js +67 -67
  163. package/node_modules/ibm_db/test/test-issue-1080-array-blob-insert.js +40 -0
  164. package/node_modules/ibm_db/test/test-issue-54.js +39 -39
  165. package/node_modules/ibm_db/test/test-issue-get-column-value-2.js +44 -44
  166. package/node_modules/ibm_db/test/test-issue211.js +80 -80
  167. package/node_modules/ibm_db/test/test-issue253.js +39 -39
  168. package/node_modules/ibm_db/test/test-max-pool-size.js +96 -96
  169. package/node_modules/ibm_db/test/test-memory-leaks-new-objects.js +32 -32
  170. package/node_modules/ibm_db/test/test-multi-open-query-close.js +75 -75
  171. package/node_modules/ibm_db/test/test-param-put-data.js +713 -0
  172. package/node_modules/ibm_db/test/test-pool-idle-connection.js +72 -72
  173. package/node_modules/ibm_db/test/test-pool-operations.js +325 -0
  174. package/node_modules/ibm_db/test/test-pool-stale-connections.js +111 -111
  175. package/node_modules/ibm_db/test/test-pool-uncommited.js +33 -33
  176. package/node_modules/ibm_db/test/test-prepare-execute.js +339 -0
  177. package/node_modules/ibm_db/test/test-prepareSync-multiple-execution.js +93 -93
  178. package/node_modules/ibm_db/test/test-primary-foreign-keys.js +246 -0
  179. package/node_modules/ibm_db/test/test-procedures.js +243 -0
  180. package/node_modules/ibm_db/test/test-promise-all-data-types.js +42 -42
  181. package/node_modules/ibm_db/test/test-query-operations.js +405 -0
  182. package/node_modules/ibm_db/test/test-quick-example.js +25 -25
  183. package/node_modules/ibm_db/test/test-row-array-insert.js +167 -167
  184. package/node_modules/ibm_db/test/test-sp-array.js +54 -54
  185. package/node_modules/ibm_db/test/test-sp-dbc-6000.js +88 -88
  186. package/node_modules/ibm_db/test/test-sp-memleak.js +136 -136
  187. package/node_modules/ibm_db/test/test-sp-resultset-execute.js +269 -269
  188. package/node_modules/ibm_db/test/test-sp-resultset.js +228 -228
  189. package/node_modules/ibm_db/test/test-transactions.js +261 -0
  190. package/node_modules/ibm_db/test/test-typescript.js +48 -48
  191. package/node_modules/ibm_db/test/test-xml-datatype.js +70 -70
  192. package/node_modules/ibm_db/test/testWebApp.js +56 -56
  193. package/node_modules/ibm_db/test/trace +51 -51
  194. package/node_modules/ibm_db/test/typescript-apis-test.js +978 -978
  195. package/node_modules/ibm_db/test/webapp.html +17 -17
  196. package/node_modules/ibm_db/test/webapp.js +79 -79
  197. package/node_modules/ibm_db/typescript/README.md +28 -28
  198. package/node_modules/ibm_db/typescript/dist/Database.d.ts +26 -0
  199. package/node_modules/ibm_db/typescript/dist/ODBCStatement.d.ts +93 -0
  200. package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
  201. package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
  202. package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
  203. package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
  204. package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
  205. package/node_modules/which-typed-array/CHANGELOG.md +14 -0
  206. package/node_modules/which-typed-array/README.md +0 -2
  207. package/node_modules/which-typed-array/index.d.ts +288 -11
  208. package/node_modules/which-typed-array/index.js +6 -7
  209. package/node_modules/which-typed-array/package.json +12 -11
  210. package/package.json +10 -11
  211. package/node_modules/ibm_db/test/disabled/test-binding-statement-rebinding.js +0 -59
  212. package/node_modules/ibm_db/test/disabled/test-open-dont-close.js +0 -12
  213. package/node_modules/ibm_db/test/disabled/test-param-select-with-booleans-only.js +0 -21
  214. package/node_modules/ibm_db/test/disabled/test-param-select-with-decimals-only.js +0 -20
  215. package/node_modules/ibm_db/test/disabled/test-param-select-with-null.js +0 -21
  216. package/node_modules/ibm_db/test/disabled/test-param-select-with-nulls-mixed.js +0 -23
  217. package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-mixed.js +0 -22
  218. package/node_modules/ibm_db/test/disabled/test-param-select-with-numbers-only.js +0 -24
  219. package/node_modules/ibm_db/test/disabled/test-param-select-with-strings-only.js +0 -23
  220. package/node_modules/ibm_db/test/disabled/test-param-select-with-unicode.js +0 -15
  221. package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-closeSync.js +0 -62
  222. package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-error.js +0 -49
  223. package/node_modules/ibm_db/test/disabled/test-prepare-bind-execute-long-string.js +0 -63
  224. package/node_modules/ibm_db/test/disabled/test-prepare-bind-executeNonQuery.js +0 -63
  225. package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-execute-closeSync.js +0 -46
  226. package/node_modules/ibm_db/test/disabled/test-prepare-bindSync-executeNonQuery.js +0 -50
  227. package/node_modules/ibm_db/test/disabled/test-prepare.js +0 -34
  228. package/node_modules/ibm_db/test/disabled/test-prepareSync.js +0 -29
  229. package/node_modules/ibm_db/test/disabled/test-query-select-fetchAll.js +0 -23
  230. package/node_modules/ibm_db/test/disabled/test-query-select-fetchAllSync.js +0 -23
  231. package/node_modules/ibm_db/test/disabled/test-query-select-unicode.js +0 -15
  232. package/node_modules/ibm_db/test/disabled/test-querySync-select-unicode.js +0 -20
  233. package/node_modules/ibm_db/test/test-affected-rows.js +0 -55
  234. package/node_modules/ibm_db/test/test-bad-connection-string.js +0 -30
  235. package/node_modules/ibm_db/test/test-binding-connection-timeOut.js +0 -31
  236. package/node_modules/ibm_db/test/test-binding-statement-executeSync.js +0 -84
  237. package/node_modules/ibm_db/test/test-binding-transaction-commit.js +0 -79
  238. package/node_modules/ibm_db/test/test-binding-transaction-commitSync.js +0 -53
  239. package/node_modules/ibm_db/test/test-closed.js +0 -14
  240. package/node_modules/ibm_db/test/test-connection-object.js +0 -16
  241. package/node_modules/ibm_db/test/test-describe-column.js +0 -92
  242. package/node_modules/ibm_db/test/test-describe-database.js +0 -18
  243. package/node_modules/ibm_db/test/test-describe-table.js +0 -31
  244. package/node_modules/ibm_db/test/test-domains-open.js +0 -19
  245. package/node_modules/ibm_db/test/test-global-open-close.js +0 -11
  246. package/node_modules/ibm_db/test/test-instantiate-one-and-end.js +0 -9
  247. package/node_modules/ibm_db/test/test-multi-open-close.js +0 -45
  248. package/node_modules/ibm_db/test/test-multi-openSync-closeSync.js +0 -52
  249. package/node_modules/ibm_db/test/test-open-close.js +0 -29
  250. package/node_modules/ibm_db/test/test-open-connectTimeout.js +0 -33
  251. package/node_modules/ibm_db/test/test-openSync.js +0 -31
  252. package/node_modules/ibm_db/test/test-pool-close.js +0 -120
  253. package/node_modules/ibm_db/test/test-pool-connect.js +0 -36
  254. package/node_modules/ibm_db/test/test-pool-rollbackTransaction.js +0 -35
  255. package/node_modules/ibm_db/test/test-prepareSync-bad-sql.js +0 -34
  256. package/node_modules/ibm_db/test/test-promise-open-close.js +0 -33
  257. package/node_modules/ibm_db/test/test-query-create-table-fetchSync.js +0 -23
  258. package/node_modules/ibm_db/test/test-query-create-table.js +0 -12
  259. package/node_modules/ibm_db/test/test-query-drop-table.js +0 -13
  260. package/node_modules/ibm_db/test/test-query-insert.js +0 -38
  261. package/node_modules/ibm_db/test/test-query-select-fetch.js +0 -21
  262. package/node_modules/ibm_db/test/test-query-select-fetchMode-array.js +0 -17
  263. package/node_modules/ibm_db/test/test-query-select.js +0 -64
  264. package/node_modules/ibm_db/test/test-queryResult.js +0 -35
  265. package/node_modules/ibm_db/test/test-queryStream.js +0 -43
  266. package/node_modules/ibm_db/test/test-querySync-select-with-exception.js +0 -25
  267. package/node_modules/ibm_db/test/test-querySync-select.js +0 -28
  268. package/node_modules/ibm_db/test/test-require-and-end.js +0 -8
  269. package/node_modules/ibm_db/test/test-statement-close.js +0 -118
  270. package/node_modules/ibm_db/test/test-transaction-commit-sync.js +0 -54
  271. package/node_modules/ibm_db/test/test-transaction-commit.js +0 -79
  272. package/node_modules/which-typed-array/eslint.config.mjs +0 -12
  273. package/node_modules/which-typed-array/test/index.js +0 -105
  274. /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
  275. /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
  276. /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
  277. /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
  278. /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
  279. /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
  280. /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
  281. /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
  282. /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
@@ -1,4 +1,4 @@
1
- /*! Axios v1.19.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.21.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -561,13 +561,61 @@
561
561
  return hasOwnProperty.call(obj, prop);
562
562
  };
563
563
  }(Object.prototype);
564
+ var isUnsafeObjectKey = function isUnsafeObjectKey(prop) {
565
+ return typeof prop === 'string' && (prop === '__proto__' || prop === 'constructor' || prop === 'prototype');
566
+ };
567
+
568
+ /**
569
+ * Determine whether an inherited object must be treated as a shared-prototype
570
+ * boundary. Cross-realm Object.prototype objects cannot be distinguished
571
+ * reliably from application-created null-prototype objects because their
572
+ * properties are mutable, so all inherited terminal prototypes are excluded
573
+ * as a fail-closed boundary. A null-prototype source still keeps its own
574
+ * properties, as produced by mergeConfig and other safe materialization paths.
575
+ *
576
+ * @param {*} obj The object to inspect
577
+ * @param {*} prototype The object's prototype
578
+ * @param {boolean} source Whether obj is the original traversal source
579
+ *
580
+ * @returns {boolean} True when obj is a safe prototype traversal boundary
581
+ */
582
+ var isPrototypeBoundary = function isPrototypeBoundary(obj, prototype, source) {
583
+ return obj === Object.prototype || !source && prototype === null;
584
+ };
585
+
586
+ /**
587
+ * Determine whether an object can retain its identity through code paths that
588
+ * add, replace, and remove config properties without bypassing unsafe-key
589
+ * filtering. Immutable objects, unsafe-key-bearing objects, and objects with
590
+ * accessor or restricted data properties must be materialized instead.
591
+ *
592
+ * @param {*} obj The object to inspect
593
+ *
594
+ * @returns {boolean} True when every own property is safe and fully mutable
595
+ */
596
+ var isSafeAndFullyMutable = function isSafeAndFullyMutable(obj) {
597
+ if (!Object.isExtensible(obj)) {
598
+ return false;
599
+ }
600
+ var props = Object.getOwnPropertyNames(obj);
601
+ if (Object.getOwnPropertySymbols) {
602
+ props.push.apply(props, _toConsumableArray(Object.getOwnPropertySymbols(obj)));
603
+ }
604
+ return props.every(function (prop) {
605
+ if (isUnsafeObjectKey(prop)) {
606
+ return false;
607
+ }
608
+ var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
609
+ return !!descriptor && descriptor.configurable && descriptor.writable === true;
610
+ });
611
+ };
564
612
 
565
613
  /**
566
- * Walk the prototype chain (excluding the shared Object.prototype) looking for
567
- * an own `prop`. This distinguishes genuine own/inherited members — including
568
- * class accessors and template prototypes — from members injected via
569
- * Object.prototype pollution (e.g. `Object.prototype.username = '...'`), which
570
- * live on Object.prototype itself and are therefore never matched.
614
+ * Walk the prototype chain (excluding the source realm's Object.prototype)
615
+ * looking for an own `prop`. This distinguishes genuine own/inherited members
616
+ * — including class accessors and template prototypes — from members injected
617
+ * via Object.prototype pollution (e.g. `Object.prototype.username = '...'`),
618
+ * which live on Object.prototype itself and are therefore never matched.
571
619
  *
572
620
  * @param {*} thing The value whose chain to inspect
573
621
  * @param {string|symbol} prop The property key to look for
@@ -577,15 +625,19 @@
577
625
  var hasOwnInPrototypeChain = function hasOwnInPrototypeChain(thing, prop) {
578
626
  var obj = thing;
579
627
  var seen = [];
580
- while (obj != null && obj !== Object.prototype) {
628
+ while (obj != null) {
581
629
  if (seen.indexOf(obj) !== -1) {
582
630
  return false;
583
631
  }
584
632
  seen.push(obj);
633
+ var prototype = getPrototypeOf(obj);
634
+ if (isPrototypeBoundary(obj, prototype, obj === thing)) {
635
+ return false;
636
+ }
585
637
  if (hasOwnProperty(obj, prop)) {
586
638
  return true;
587
639
  }
588
- obj = getPrototypeOf(obj);
640
+ obj = prototype;
589
641
  }
590
642
  return false;
591
643
  };
@@ -604,6 +656,65 @@
604
656
  var getSafeProp = function getSafeProp(obj, prop) {
605
657
  return obj != null && hasOwnInPrototypeChain(obj, prop) ? obj[prop] : undefined;
606
658
  };
659
+
660
+ /**
661
+ * Flatten an object and its application-defined prototype chain into a
662
+ * null-prototype object. Members inherited only from the source realm's
663
+ * Object.prototype are deliberately excluded, while class/template members
664
+ * below that boundary are preserved.
665
+ *
666
+ * @param {*} thing The value to flatten
667
+ *
668
+ * @returns {*} A null-prototype copy, or the original value when it is already
669
+ * structurally safe or is not an object
670
+ */
671
+ var toSafeFlatObject = function toSafeFlatObject(thing) {
672
+ if (thing == null || _typeof(thing) !== 'object' && typeof thing !== 'function') {
673
+ return thing;
674
+ }
675
+ var sourcePrototype = getPrototypeOf(thing);
676
+ if (sourcePrototype === null && isSafeAndFullyMutable(thing)) {
677
+ return thing;
678
+ }
679
+ var result = Object.create(null);
680
+ var merged = Object.create(null);
681
+ var seen = [];
682
+ var current = thing;
683
+ while (current != null) {
684
+ if (seen.indexOf(current) !== -1) {
685
+ break;
686
+ }
687
+ seen.push(current);
688
+ var prototype = current === thing ? sourcePrototype : getPrototypeOf(current);
689
+ if (isPrototypeBoundary(current, prototype, current === thing)) {
690
+ break;
691
+ }
692
+ var props = Object.getOwnPropertyNames(current);
693
+ if (Object.getOwnPropertySymbols) {
694
+ props.push.apply(props, _toConsumableArray(Object.getOwnPropertySymbols(current)));
695
+ }
696
+ var _iterator2 = _createForOfIteratorHelper(props),
697
+ _step;
698
+ try {
699
+ for (_iterator2.s(); !(_step = _iterator2.n()).done;) {
700
+ var prop = _step.value;
701
+ if (isUnsafeObjectKey(prop)) {
702
+ continue;
703
+ }
704
+ if (!hasOwnProperty(merged, prop)) {
705
+ result[prop] = thing[prop];
706
+ merged[prop] = true;
707
+ }
708
+ }
709
+ } catch (err) {
710
+ _iterator2.e(err);
711
+ } finally {
712
+ _iterator2.f();
713
+ }
714
+ current = prototype;
715
+ }
716
+ return result;
717
+ };
607
718
  var kindOf = function (cache) {
608
719
  return function (thing) {
609
720
  var str = toString.call(thing);
@@ -736,11 +847,17 @@
736
847
  return false;
737
848
  }
738
849
  var prototype = getPrototypeOf(val);
739
- return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) &&
740
- // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or
741
- // Symbol.iterator as evidence the value is a tagged/iterable type rather
742
- // than a plain object, while ignoring keys injected onto Object.prototype.
743
- !hasOwnInPrototypeChain(val, toStringTag) && !hasOwnInPrototypeChain(val, iterator);
850
+ return (prototype === null || prototype === Object.prototype || getPrototypeOf(prototype) === null) && (
851
+ // Treat own Symbol.toStringTag or Symbol.iterator members as evidence the
852
+ // value is tagged/iterable, ignoring members reachable only through shared
853
+ // or terminal prototype boundaries. This is exactly what
854
+ // hasOwnInPrototypeChain(val, prop) computes here: every prototype admitted
855
+ // above (null, Object.prototype, or a terminal null-prototype template) is
856
+ // a boundary, so the walk never inspects anything but `val`'s own members,
857
+ // and stops before even those when `val` is itself the boundary
858
+ // Object.prototype. Checking that inline avoids allocating the walker's
859
+ // `seen` list twice per call on the mergeConfig / merge hot path.
860
+ isPrototypeBoundary(val, prototype, true) || !hasOwnProperty(val, toStringTag) && !hasOwnProperty(val, iterator));
744
861
  };
745
862
 
746
863
  /**
@@ -1002,15 +1119,29 @@
1002
1119
  caseless = _ref3.caseless,
1003
1120
  skipUndefined = _ref3.skipUndefined;
1004
1121
  var result = {};
1122
+ // Caseless lookup only applies to string keys — symbol keys are
1123
+ // identity-matched. Every string key that reaches `result` passes through
1124
+ // this index first, so it can never hold two case variants of one key and a
1125
+ // lowercase -> key map is exactly what findKey(result, key) would rescan
1126
+ // Object.keys(result) for on each assignment.
1127
+ var lowerCaseKeys = caseless ? Object.create(null) : null;
1005
1128
  var assignValue = function assignValue(val, key) {
1006
1129
  // Skip dangerous property names to prevent prototype pollution
1007
1130
  if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
1008
1131
  return;
1009
1132
  }
1010
-
1011
- // findKey lowercases the key, so caseless lookup only applies to strings —
1012
- // symbol keys are identity-matched.
1013
- var targetKey = caseless && typeof key === 'string' && findKey(result, key) || key;
1133
+ var targetKey = key;
1134
+ if (lowerCaseKeys && typeof key === 'string') {
1135
+ var lowerKey = key.toLowerCase();
1136
+ var knownKey = lowerCaseKeys[lowerKey];
1137
+ // A key recorded but absent from `result` was skipped by skipUndefined;
1138
+ // the later spelling wins then, as it does for findKey.
1139
+ if (knownKey !== undefined && hasOwnProperty(result, knownKey)) {
1140
+ targetKey = knownKey;
1141
+ } else {
1142
+ lowerCaseKeys[lowerKey] = key;
1143
+ }
1144
+ }
1014
1145
  // Read via own-prop only — a bare `result[targetKey]` walks the prototype
1015
1146
  // chain, so a polluted Object.prototype value could surface here and get
1016
1147
  // copied into the merged result.
@@ -1031,7 +1162,7 @@
1031
1162
  continue;
1032
1163
  }
1033
1164
  forEach(source, assignValue);
1034
- if (_typeof(source) !== 'object' || isArray(source)) {
1165
+ if (_typeof(source) !== 'object' || isArray(source) || !Object.getOwnPropertySymbols) {
1035
1166
  continue;
1036
1167
  }
1037
1168
  var symbols = Object.getOwnPropertySymbols(source);
@@ -1186,7 +1317,27 @@
1186
1317
  if (!thing) return null;
1187
1318
  if (isArray(thing)) return thing;
1188
1319
  var i = thing.length;
1189
- if (!isNumber(i)) return null;
1320
+ if (!Number.isSafeInteger(i) || i < 0 || i > 0xffffffff) return null;
1321
+
1322
+ // Bound the copy by actual indexed properties, including hidden and inherited
1323
+ // members of array-like collections, rather than by the declared length alone.
1324
+ var indexes = new Set();
1325
+ var seen = new Set();
1326
+ var source = thing;
1327
+ while (source != null && indexes.size < i) {
1328
+ if (seen.has(source)) return null;
1329
+ seen.add(source);
1330
+ var prototype = getPrototypeOf(source);
1331
+ if (isPrototypeBoundary(source, prototype, source === thing)) break;
1332
+ Object.getOwnPropertyNames(source).forEach(function (key) {
1333
+ var index = +key;
1334
+ if (Number.isInteger(index) && index >= 0 && index < i && String(index) === key && hasOwnProperty(source, key)) {
1335
+ indexes.add(index);
1336
+ }
1337
+ });
1338
+ source = prototype;
1339
+ }
1340
+ if (indexes.size !== i) return null;
1190
1341
  var arr = new Array(i);
1191
1342
  while (i-- > 0) {
1192
1343
  arr[i] = thing[i];
@@ -1358,18 +1509,18 @@
1358
1509
  var target;
1359
1510
  if (isSet(source)) {
1360
1511
  target = [];
1361
- var _iterator2 = _createForOfIteratorHelper(source),
1362
- _step;
1512
+ var _iterator3 = _createForOfIteratorHelper(source),
1513
+ _step2;
1363
1514
  try {
1364
- for (_iterator2.s(); !(_step = _iterator2.n()).done;) {
1365
- var value = _step.value;
1515
+ for (_iterator3.s(); !(_step2 = _iterator3.n()).done;) {
1516
+ var value = _step2.value;
1366
1517
  var reducedValue = _visit(value);
1367
1518
  !isUndefined(reducedValue) && target.push(reducedValue);
1368
1519
  }
1369
1520
  } catch (err) {
1370
- _iterator2.e(err);
1521
+ _iterator3.e(err);
1371
1522
  } finally {
1372
- _iterator2.f();
1523
+ _iterator3.f();
1373
1524
  }
1374
1525
  } else {
1375
1526
  target = isArray(source) ? [] : {};
@@ -1512,6 +1663,7 @@
1512
1663
  // an alias to avoid ESLint no-prototype-builtins detection
1513
1664
  hasOwnInPrototypeChain: hasOwnInPrototypeChain,
1514
1665
  getSafeProp: getSafeProp,
1666
+ toSafeFlatObject: toSafeFlatObject,
1515
1667
  reduceDescriptors: reduceDescriptors,
1516
1668
  freezeMethods: freezeMethods,
1517
1669
  toObjectSet: toObjectSet,
@@ -1550,7 +1702,8 @@
1550
1702
  * @returns {Object} Headers parsed into an object
1551
1703
  */
1552
1704
  var parseHeaders = (function (rawHeaders) {
1553
- var parsed = {};
1705
+ // Header names are data, including __proto__; avoid inherited setters.
1706
+ var parsed = Object.create(null);
1554
1707
  var key;
1555
1708
  var val;
1556
1709
  var i;
@@ -1622,7 +1775,7 @@
1622
1775
  return byteStringHeaders;
1623
1776
  }
1624
1777
 
1625
- var $internals = Symbol('internals');
1778
+ var $internals$1 = Symbol('internals');
1626
1779
  function normalizeHeader(header) {
1627
1780
  return header && String(header).trim().toLowerCase();
1628
1781
  }
@@ -1728,9 +1881,23 @@
1728
1881
  var isValidHeaderName = function isValidHeaderName(str) {
1729
1882
  return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1730
1883
  };
1884
+
1885
+ // `__proto__` is a valid field name, and the one name the uppercase mapping at
1886
+ // the bottom of this file cannot reach: it is inherited from Object.prototype
1887
+ // instead of being declared on AxiosHeaders.prototype, so `self.__proto__ = v`
1888
+ // runs the inherited setter. That silently discards the header, and an array
1889
+ // value replaces the instance prototype, taking every method with it.
1890
+ // Store it under the same kind of case variant that mapping uses for `set` and
1891
+ // `constructor`. Header lookup is caseless, so it reads back under either
1892
+ // spelling, and no own `__proto__` slot is ever created for a later
1893
+ // `Object.assign` to copy onto a plain object through the same setter.
1894
+ var PROTO_HEADER_SLOT = '__Proto__';
1895
+ var headerSlot = function headerSlot(name) {
1896
+ return name === '__proto__' ? PROTO_HEADER_SLOT : name;
1897
+ };
1731
1898
  function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1732
1899
  if (utils$1.isFunction(filter)) {
1733
- return filter.call(this, value, header);
1900
+ return filter.call(context, value, header);
1734
1901
  }
1735
1902
  if (isHeaderNameFilter) {
1736
1903
  value = header;
@@ -1778,7 +1945,7 @@
1778
1945
  }
1779
1946
  var key = utils$1.findKey(self, lHeader);
1780
1947
  if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1781
- self[key || _header] = normalizeValue(_value);
1948
+ self[headerSlot(key || _header)] = normalizeValue(_value);
1782
1949
  }
1783
1950
  }
1784
1951
  var setHeaders = function setHeaders(headers, _rewrite) {
@@ -1896,7 +2063,7 @@
1896
2063
  key: "normalize",
1897
2064
  value: function normalize(format) {
1898
2065
  var self = this;
1899
- var headers = {};
2066
+ var headers = Object.create(null);
1900
2067
  utils$1.forEach(this, function (value, header) {
1901
2068
  var key = utils$1.findKey(headers, header);
1902
2069
  if (key) {
@@ -1904,7 +2071,7 @@
1904
2071
  delete self[header];
1905
2072
  return;
1906
2073
  }
1907
- var normalized = format ? formatHeader(header) : String(header).trim();
2074
+ var normalized = headerSlot(format ? formatHeader(header) : String(header).trim());
1908
2075
  if (normalized !== header) {
1909
2076
  delete self[header];
1910
2077
  }
@@ -1982,7 +2149,7 @@
1982
2149
  }, {
1983
2150
  key: "accessor",
1984
2151
  value: function accessor(header) {
1985
- var internals = this[$internals] = this[$internals] = {
2152
+ var internals = this[$internals$1] = this[$internals$1] = {
1986
2153
  accessors: {}
1987
2154
  };
1988
2155
  var accessors = internals.accessors;
@@ -2094,6 +2261,60 @@
2094
2261
  }).filter(Boolean).join('; ');
2095
2262
  return message || error.name || 'AggregateError';
2096
2263
  }
2264
+
2265
+ // Shared with `Axios.prototype.request`, which splices the reconstructed
2266
+ // caller frames in ahead of this marker.
2267
+ var CAUSED_BY_SEPARATOR = '\nCaused by: ';
2268
+ var $causeStack = Symbol('causeStack');
2269
+
2270
+ // Match the section we appended, not marker-like text in an error message or
2271
+ // a replacement stack supplied by the caller. Do not re-read the cause's stack.
2272
+ function getCauseStackIndex(error, stack) {
2273
+ var causeStack = utils$1.hasOwnProp(error, $causeStack) && error[$causeStack];
2274
+ return causeStack && stack.endsWith(causeStack) ? stack.length - causeStack.length : -1;
2275
+ }
2276
+
2277
+ /**
2278
+ * Append the stack of a wrapped error to `target.stack`.
2279
+ *
2280
+ * `cause` already exposes the original error for tooling that walks the standard
2281
+ * cause chain, but many error reporters read `stack` and nothing else. Inlining
2282
+ * the wrapped stack there means those reporters surface the underlying failure
2283
+ * instead of the axios frames that normalized it (see #6670).
2284
+ *
2285
+ * Every read is defensive: a custom `Error.prepareStackTrace` hook, a runtime
2286
+ * without stack support, or a replaced `stack` property can leave the value
2287
+ * missing, non-string, or read-only, and normalizing an error must not throw
2288
+ * because of that.
2289
+ *
2290
+ * @param {Error} target The AxiosError being built.
2291
+ * @param {Error} source The error being wrapped.
2292
+ *
2293
+ * @returns {void}
2294
+ */
2295
+ function appendCauseStack(target, source) {
2296
+ try {
2297
+ var sourceStack = source && source.stack;
2298
+ if (typeof sourceStack !== 'string' || !sourceStack) {
2299
+ return;
2300
+ }
2301
+ var targetStack = target.stack;
2302
+ if (typeof targetStack !== 'string' || !targetStack) {
2303
+ return;
2304
+ }
2305
+
2306
+ // Each call to `from()` creates a fresh target. Re-wrapping includes the
2307
+ // previous stack verbatim, adding one cause section per wrap.
2308
+ var causeStack = CAUSED_BY_SEPARATOR + sourceStack;
2309
+ target.stack = targetStack + causeStack;
2310
+ Object.defineProperty(target, $causeStack, {
2311
+ __proto__: null,
2312
+ value: causeStack
2313
+ });
2314
+ } catch (e) {
2315
+ // Ignore failures from custom stack hooks or un-writable stack properties.
2316
+ }
2317
+ }
2097
2318
  var AxiosError = /*#__PURE__*/function (_Error) {
2098
2319
  /**
2099
2320
  * Create an Error with the specified message, config, error code, request and response.
@@ -2189,6 +2410,10 @@
2189
2410
  });
2190
2411
  axiosError.name = error.name;
2191
2412
 
2413
+ // Inline the wrapped stack for reporters that read only `stack`; the `cause`
2414
+ // property above already covers cause-aware tooling.
2415
+ appendCauseStack(axiosError, error);
2416
+
2192
2417
  // Preserve status from the original error if not already set from response
2193
2418
  if (error.status != null && axiosError.status == null) {
2194
2419
  axiosError.status = error.status;
@@ -2304,23 +2529,17 @@
2304
2529
 
2305
2530
  // eslint-disable-next-line no-param-reassign
2306
2531
  formData = formData || new (FormData)();
2307
-
2308
- // eslint-disable-next-line no-param-reassign
2309
- options = utils$1.toFlatObject(options, {
2310
- metaTokens: true,
2311
- dots: false,
2312
- indexes: false
2313
- }, false, function defined(option, source) {
2314
- // eslint-disable-next-line no-eq-null,eqeqeq
2315
- return !utils$1.isUndefined(source[option]);
2316
- });
2317
- var metaTokens = options.metaTokens;
2532
+ var option = function option(name, fallback) {
2533
+ var value = utils$1.getSafeProp(options, name);
2534
+ return utils$1.isUndefined(value) ? fallback : value;
2535
+ };
2536
+ var metaTokens = option('metaTokens', true);
2318
2537
  // eslint-disable-next-line no-use-before-define
2319
- var visitor = options.visitor || defaultVisitor;
2320
- var dots = options.dots;
2321
- var indexes = options.indexes;
2322
- var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
2323
- var maxDepth = options.maxDepth === undefined ? DEFAULT_FORM_DATA_MAX_DEPTH : options.maxDepth;
2538
+ var visitor = option('visitor') || defaultVisitor;
2539
+ var dots = option('dots', false);
2540
+ var indexes = option('indexes', false);
2541
+ var _Blob = option('Blob') || typeof Blob !== 'undefined' && Blob;
2542
+ var maxDepth = option('maxDepth', DEFAULT_FORM_DATA_MAX_DEPTH);
2324
2543
  var useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
2325
2544
  var stack = [];
2326
2545
  if (!utils$1.isFunction(visitor)) {
@@ -2534,10 +2753,61 @@
2534
2753
  return url;
2535
2754
  }
2536
2755
 
2756
+ var $internals = Symbol('internals');
2757
+
2758
+ // `handlers` is public and may be replaced with a nullish value by user code;
2759
+ // `clear()` has always tolerated that. Treat it as an empty stack rather than
2760
+ // dereferencing it.
2761
+ function countHandlers(handlers) {
2762
+ return handlers ? handlers.length : 0;
2763
+ }
2764
+ function trimHandlers(handlers) {
2765
+ if (!handlers) {
2766
+ return;
2767
+ }
2768
+ while (handlers.length && handlers[handlers.length - 1] === null) {
2769
+ handlers.pop();
2770
+ }
2771
+ }
2772
+
2773
+ // Preserve the array-key coercion used before IDs were stored in a Map, without
2774
+ // treating null, empty strings, or noncanonical numeric strings as ID zero.
2775
+ function normalizeHandlerId(id) {
2776
+ if (typeof id === 'string' && id !== '' && String(Number(id)) === id) {
2777
+ return Number(id);
2778
+ }
2779
+ return id;
2780
+ }
2781
+ function syncHandlerEntries(manager, internals) {
2782
+ var handlers = manager.handlers;
2783
+ var length = countHandlers(handlers);
2784
+ if (handlers !== internals.handlersRef) {
2785
+ internals.handlersRef = handlers;
2786
+ internals.handlerEntries.clear();
2787
+ } else if (length !== internals.handlersLength) {
2788
+ if (!length) {
2789
+ internals.handlerEntries.clear();
2790
+ } else {
2791
+ internals.handlerEntries.forEach(function removeStaleEntry(entry, id) {
2792
+ if (handlers[entry.index] !== entry.handler) {
2793
+ internals.handlerEntries["delete"](id);
2794
+ }
2795
+ });
2796
+ }
2797
+ }
2798
+ internals.handlersLength = length;
2799
+ }
2537
2800
  var InterceptorManager = /*#__PURE__*/function () {
2538
2801
  function InterceptorManager() {
2539
2802
  _classCallCheck(this, InterceptorManager);
2540
2803
  this.handlers = [];
2804
+ this[$internals] = {
2805
+ handlersRef: this.handlers,
2806
+ handlersLength: this.handlers.length,
2807
+ handlerEntries: new Map(),
2808
+ iterationDepth: 0,
2809
+ nextId: 0
2810
+ };
2541
2811
  }
2542
2812
 
2543
2813
  /**
@@ -2552,13 +2822,25 @@
2552
2822
  return _createClass(InterceptorManager, [{
2553
2823
  key: "use",
2554
2824
  value: function use(fulfilled, rejected, options) {
2555
- this.handlers.push({
2825
+ var handler = {
2556
2826
  fulfilled: fulfilled,
2557
2827
  rejected: rejected,
2558
2828
  synchronous: options ? options.synchronous : false,
2559
2829
  runWhen: options ? options.runWhen : null
2830
+ };
2831
+ var internals = this[$internals];
2832
+ if (this.handlers == null) {
2833
+ this.handlers = [];
2834
+ }
2835
+ syncHandlerEntries(this, internals);
2836
+ var id = internals.nextId++;
2837
+ this.handlers.push(handler);
2838
+ internals.handlerEntries.set(id, {
2839
+ handler: handler,
2840
+ index: this.handlers.length - 1
2560
2841
  });
2561
- return this.handlers.length - 1;
2842
+ internals.handlersLength = this.handlers.length;
2843
+ return id;
2562
2844
  }
2563
2845
 
2564
2846
  /**
@@ -2571,8 +2853,24 @@
2571
2853
  }, {
2572
2854
  key: "eject",
2573
2855
  value: function eject(id) {
2574
- if (this.handlers[id]) {
2575
- this.handlers[id] = null;
2856
+ var internals = this[$internals];
2857
+ syncHandlerEntries(this, internals);
2858
+ var handlerId = normalizeHandlerId(id);
2859
+ var entry = internals.handlerEntries.get(handlerId);
2860
+ if (entry) {
2861
+ internals.handlerEntries["delete"](handlerId);
2862
+
2863
+ // Ignore IDs invalidated by clear or direct replacement of handlers.
2864
+ if (this.handlers[entry.index] !== entry.handler) {
2865
+ return;
2866
+ }
2867
+ this.handlers[entry.index] = null;
2868
+
2869
+ // Do not reuse an index while forEach is walking its length snapshot.
2870
+ if (!internals.iterationDepth) {
2871
+ trimHandlers(this.handlers);
2872
+ internals.handlersLength = this.handlers.length;
2873
+ }
2576
2874
  }
2577
2875
  }
2578
2876
 
@@ -2586,6 +2884,7 @@
2586
2884
  value: function clear() {
2587
2885
  if (this.handlers) {
2588
2886
  this.handlers = [];
2887
+ syncHandlerEntries(this, this[$internals]);
2589
2888
  }
2590
2889
  }
2591
2890
 
@@ -2602,11 +2901,22 @@
2602
2901
  }, {
2603
2902
  key: "forEach",
2604
2903
  value: function forEach(fn) {
2605
- utils$1.forEach(this.handlers, function forEachHandler(h) {
2606
- if (h !== null) {
2607
- fn(h);
2904
+ var internals = this[$internals];
2905
+ syncHandlerEntries(this, internals);
2906
+ internals.iterationDepth++;
2907
+ try {
2908
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
2909
+ if (h !== null) {
2910
+ fn(h);
2911
+ }
2912
+ });
2913
+ } finally {
2914
+ if (! --internals.iterationDepth) {
2915
+ syncHandlerEntries(this, internals);
2916
+ trimHandlers(this.handlers);
2917
+ internals.handlersLength = countHandlers(this.handlers);
2608
2918
  }
2609
- });
2919
+ }
2610
2920
  }
2611
2921
  }]);
2612
2922
  }();
@@ -2617,7 +2927,8 @@
2617
2927
  clarifyTimeoutError: false,
2618
2928
  legacyInterceptorReqResOrdering: true,
2619
2929
  advertiseZstdAcceptEncoding: false,
2620
- validateStatusUndefinedResolves: true
2930
+ validateStatusUndefinedResolves: true,
2931
+ encodeBasicAuthUsername: false
2621
2932
  };
2622
2933
 
2623
2934
  var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
@@ -2751,6 +3062,29 @@
2751
3062
  }
2752
3063
  return obj;
2753
3064
  }
3065
+ function normalizeArray(value) {
3066
+ if (!utils$1.isArray(value)) return value;
3067
+ var keys = Object.keys(value);
3068
+ return keys.length !== value.length || keys.some(function (key, index) {
3069
+ return key !== String(index);
3070
+ }) ? arrayToObject(value) : value;
3071
+ }
3072
+ function normalizeArrays(obj) {
3073
+ var pending = [obj];
3074
+ var _loop = function _loop() {
3075
+ var target = pending.pop();
3076
+ Object.keys(target).forEach(function (key) {
3077
+ var value = target[key] = normalizeArray(target[key]);
3078
+ if (utils$1.isArray(value) || utils$1.isPlainObject(value)) {
3079
+ pending.push(value);
3080
+ }
3081
+ });
3082
+ };
3083
+ while (pending.length) {
3084
+ _loop();
3085
+ }
3086
+ return obj;
3087
+ }
2754
3088
 
2755
3089
  /**
2756
3090
  * It takes a FormData object and returns a JavaScript object
@@ -2769,6 +3103,7 @@
2769
3103
  name = !name && utils$1.isArray(target) ? target.length : name;
2770
3104
  if (isLast) {
2771
3105
  if (utils$1.hasOwnProp(target, name)) {
3106
+ target[name] = normalizeArray(target[name]);
2772
3107
  target[name] = utils$1.isArray(target[name]) ? target[name].concat(value) : [target[name], value];
2773
3108
  } else {
2774
3109
  target[name] = value;
@@ -2789,11 +3124,13 @@
2789
3124
  utils$1.forEachEntry(formData, function (name, value) {
2790
3125
  buildPath(parsePropPath(name), value, obj, 0);
2791
3126
  });
2792
- return obj;
3127
+ return normalizeArrays(obj);
2793
3128
  }
2794
3129
  return null;
2795
3130
  }
2796
3131
 
3132
+ var methodList = Object.freeze(['get', 'delete', 'head', 'options', 'post', 'put', 'patch', 'purge', 'link', 'unlink', 'query']);
3133
+
2797
3134
  var own = function own(obj, key) {
2798
3135
  return obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined;
2799
3136
  };
@@ -2912,7 +3249,7 @@
2912
3249
  }
2913
3250
  }
2914
3251
  };
2915
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query'], function (method) {
3252
+ utils$1.forEach(methodList, function (method) {
2916
3253
  defaults.headers[method] = {};
2917
3254
  });
2918
3255
 
@@ -2980,11 +3317,133 @@
2980
3317
  }
2981
3318
  }
2982
3319
 
3320
+ var urlParserControlCharacters = /[\t\n\r]/g;
3321
+
3322
+ /**
3323
+ * Match WHATWG URL preprocessing before checking a URL's protocol.
3324
+ *
3325
+ * @param {string} url
3326
+ *
3327
+ * @returns {string}
3328
+ */
3329
+ function normalizeURLForProtocolCheck(url) {
3330
+ if (typeof url !== 'string') {
3331
+ return url;
3332
+ }
3333
+ var start = 0;
3334
+ while (start < url.length && url.charCodeAt(start) <= 0x20) {
3335
+ start++;
3336
+ }
3337
+ return url.slice(start).replace(urlParserControlCharacters, '');
3338
+ }
3339
+
2983
3340
  function parseProtocol(url) {
2984
3341
  var match = /^([-+\w]{1,25}):(?:\/\/)?/.exec(url);
2985
- return match && match[1] || '';
3342
+ return match && match[1].toLowerCase() || '';
2986
3343
  }
2987
3344
 
3345
+ var decodeCookieValue = function decodeCookieValue(value) {
3346
+ try {
3347
+ return decodeURIComponent(value);
3348
+ } catch (e) {
3349
+ return value;
3350
+ }
3351
+ };
3352
+ var cookies = platform.hasStandardBrowserEnv ?
3353
+ // Standard browser envs support document.cookie
3354
+ {
3355
+ write: function write(name, value, expires, path, domain, secure, sameSite) {
3356
+ if (typeof document === 'undefined') return;
3357
+ var cookie = ["".concat(name, "=").concat(encodeURIComponent(value))];
3358
+ if (utils$1.isNumber(expires)) {
3359
+ cookie.push("expires=".concat(new Date(expires).toUTCString()));
3360
+ }
3361
+ if (utils$1.isString(path)) {
3362
+ cookie.push("path=".concat(path));
3363
+ }
3364
+ if (utils$1.isString(domain)) {
3365
+ cookie.push("domain=".concat(domain));
3366
+ }
3367
+ if (secure === true) {
3368
+ cookie.push('secure');
3369
+ }
3370
+ if (utils$1.isString(sameSite)) {
3371
+ cookie.push("SameSite=".concat(sameSite));
3372
+ }
3373
+ document.cookie = cookie.join('; ');
3374
+ },
3375
+ read: function read(name) {
3376
+ if (typeof document === 'undefined') return null;
3377
+ var cookieString = document.cookie;
3378
+ if (!cookieString) return null;
3379
+ // Match name=value by splitting on the semicolon separator instead of building a
3380
+ // RegExp from `name` — interpolating an unescaped string into a RegExp would let
3381
+ // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3382
+ // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3383
+ // "; ", so ignore optional whitespace before each cookie name.
3384
+ var cookies = cookieString.split(';');
3385
+ for (var i = 0; i < cookies.length; i++) {
3386
+ var cookie = cookies[i].replace(/^\s+/, '');
3387
+ var eq = cookie.indexOf('=');
3388
+ if (eq !== -1 && cookie.slice(0, eq) === name) {
3389
+ return decodeCookieValue(cookie.slice(eq + 1));
3390
+ }
3391
+ }
3392
+ return null;
3393
+ },
3394
+ readAsync: function readAsync(name) {
3395
+ var _this = this;
3396
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
3397
+ var store, cookie;
3398
+ return _regenerator().w(function (_context) {
3399
+ while (1) switch (_context.p = _context.n) {
3400
+ case 0:
3401
+ _context.p = 0;
3402
+ store = typeof window !== 'undefined' && window.cookieStore;
3403
+ if (!(store && utils$1.isFunction(store.get))) {
3404
+ _context.n = 2;
3405
+ break;
3406
+ }
3407
+ _context.n = 1;
3408
+ return store.get(name);
3409
+ case 1:
3410
+ cookie = _context.v;
3411
+ return _context.a(2, cookie ? decodeCookieValue(cookie.value) : null);
3412
+ case 2:
3413
+ _context.n = 4;
3414
+ break;
3415
+ case 3:
3416
+ _context.p = 3;
3417
+ _context.v;
3418
+ case 4:
3419
+ return _context.a(2, _this.read(name));
3420
+ }
3421
+ }, _callee, null, [[0, 3]]);
3422
+ }))();
3423
+ },
3424
+ remove: function remove(name) {
3425
+ this.write(name, '', Date.now() - 86400000, '/');
3426
+ }
3427
+ } :
3428
+ // Non-standard browser env (web workers, react-native) lack needed support.
3429
+ {
3430
+ write: function write() {},
3431
+ read: function read() {
3432
+ return null;
3433
+ },
3434
+ readAsync: function readAsync() {
3435
+ return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
3436
+ return _regenerator().w(function (_context2) {
3437
+ while (1) switch (_context2.n) {
3438
+ case 0:
3439
+ return _context2.a(2, null);
3440
+ }
3441
+ }, _callee2);
3442
+ }))();
3443
+ },
3444
+ remove: function remove() {}
3445
+ };
3446
+
2988
3447
  /**
2989
3448
  * Calculate data maxRate
2990
3449
  * @param {Number} [samplesCount= 10]
@@ -3029,7 +3488,7 @@
3029
3488
  * Throttle decorator
3030
3489
  * @param {Function} fn
3031
3490
  * @param {Number} freq
3032
- * @return {Function}
3491
+ * @return {Array<Function>}
3033
3492
  */
3034
3493
  function throttle(fn, freq) {
3035
3494
  var timestamp = 0;
@@ -3067,7 +3526,13 @@
3067
3526
  var flush = function flush() {
3068
3527
  return lastArgs && invoke(lastArgs);
3069
3528
  };
3070
- return [throttled, flush];
3529
+ var flushWith = function flushWith() {
3530
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
3531
+ args[_key2] = arguments[_key2];
3532
+ }
3533
+ return invoke(args);
3534
+ };
3535
+ return [throttled, flush, flushWith];
3071
3536
  }
3072
3537
 
3073
3538
  var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
@@ -3075,7 +3540,7 @@
3075
3540
  var bytesNotified = 0;
3076
3541
  var _speedometer = speedometer(50, 250);
3077
3542
  return throttle(function (e) {
3078
- if (!e || typeof e.loaded !== 'number') {
3543
+ if (!e || !utils$1.isNumber(e.loaded)) {
3079
3544
  return;
3080
3545
  }
3081
3546
  var rawLoaded = e.loaded;
@@ -3119,72 +3584,15 @@
3119
3584
  };
3120
3585
  };
3121
3586
 
3122
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin, isMSIE) {
3587
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? function (origin) {
3123
3588
  return function (url) {
3124
- url = new URL(url, platform.origin);
3125
- return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
3589
+ url = new URL(url, document.baseURI || platform.origin);
3590
+ return origin.protocol === url.protocol && origin.host === url.host && origin.port === url.port;
3126
3591
  };
3127
- }(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : function () {
3592
+ }(new URL(platform.origin)) : function () {
3128
3593
  return true;
3129
3594
  };
3130
3595
 
3131
- var cookies = platform.hasStandardBrowserEnv ?
3132
- // Standard browser envs support document.cookie
3133
- {
3134
- write: function write(name, value, expires, path, domain, secure, sameSite) {
3135
- if (typeof document === 'undefined') return;
3136
- var cookie = ["".concat(name, "=").concat(encodeURIComponent(value))];
3137
- if (utils$1.isNumber(expires)) {
3138
- cookie.push("expires=".concat(new Date(expires).toUTCString()));
3139
- }
3140
- if (utils$1.isString(path)) {
3141
- cookie.push("path=".concat(path));
3142
- }
3143
- if (utils$1.isString(domain)) {
3144
- cookie.push("domain=".concat(domain));
3145
- }
3146
- if (secure === true) {
3147
- cookie.push('secure');
3148
- }
3149
- if (utils$1.isString(sameSite)) {
3150
- cookie.push("SameSite=".concat(sameSite));
3151
- }
3152
- document.cookie = cookie.join('; ');
3153
- },
3154
- read: function read(name) {
3155
- if (typeof document === 'undefined') return null;
3156
- // Match name=value by splitting on the semicolon separator instead of building a
3157
- // RegExp from `name` — interpolating an unescaped string into a RegExp would let
3158
- // metacharacters (e.g. `.+?` in an attacker-influenced cookie name) cause ReDoS or
3159
- // match the wrong cookie. Browsers may serialize cookie pairs as either ";" or
3160
- // "; ", so ignore optional whitespace before each cookie name.
3161
- var cookies = document.cookie.split(';');
3162
- for (var i = 0; i < cookies.length; i++) {
3163
- var cookie = cookies[i].replace(/^\s+/, '');
3164
- var eq = cookie.indexOf('=');
3165
- if (eq !== -1 && cookie.slice(0, eq) === name) {
3166
- try {
3167
- return decodeURIComponent(cookie.slice(eq + 1));
3168
- } catch (e) {
3169
- return cookie.slice(eq + 1);
3170
- }
3171
- }
3172
- }
3173
- return null;
3174
- },
3175
- remove: function remove(name) {
3176
- this.write(name, '', Date.now() - 86400000, '/');
3177
- }
3178
- } :
3179
- // Non-standard browser env (web workers, react-native) lack needed support.
3180
- {
3181
- write: function write() {},
3182
- read: function read() {
3183
- return null;
3184
- },
3185
- remove: function remove() {}
3186
- };
3187
-
3188
3596
  /**
3189
3597
  * Determines whether the specified URL is absolute
3190
3598
  *
@@ -3222,17 +3630,6 @@
3222
3630
  }
3223
3631
 
3224
3632
  var malformedHttpProtocol = /^https?:(?!\/\/)/i;
3225
- var httpProtocolControlCharacters = /[\t\n\r]/g;
3226
- function stripLeadingC0ControlOrSpace(url) {
3227
- var i = 0;
3228
- while (i < url.length && url.charCodeAt(i) <= 0x20) {
3229
- i++;
3230
- }
3231
- return url.slice(i);
3232
- }
3233
- function normalizeURLForProtocolCheck(url) {
3234
- return stripLeadingC0ControlOrSpace(url).replace(httpProtocolControlCharacters, '');
3235
- }
3236
3633
 
3237
3634
  // Redact the parts of a URL that can carry secrets before it is embedded in an
3238
3635
  // error message. AxiosError.toJSON() serializes `message` verbatim and errors
@@ -3290,18 +3687,237 @@
3290
3687
  return requestedURL;
3291
3688
  }
3292
3689
 
3690
+ function assertParamsAcyclic(params) {
3691
+ var pending = [{
3692
+ value: params
3693
+ }];
3694
+ var active = new WeakSet();
3695
+ var visited = new WeakSet();
3696
+ var _loop = function _loop() {
3697
+ var _pending$pop = pending.pop(),
3698
+ value = _pending$pop.value,
3699
+ done = _pending$pop.done;
3700
+ if (!utils$1.isPlainObject(value) && !utils$1.isArray(value)) return 0; // continue
3701
+ if (done) {
3702
+ active["delete"](value);
3703
+ return 0; // continue
3704
+ }
3705
+ if (active.has(value)) {
3706
+ throw new AxiosError('Circular reference detected in params', AxiosError.ERR_BAD_OPTION_VALUE);
3707
+ }
3708
+ if (visited.has(value)) return 0; // continue
3709
+ visited.add(value);
3710
+ active.add(value);
3711
+ pending.push({
3712
+ value: value,
3713
+ done: true
3714
+ });
3715
+ var keys = Object.keys(value);
3716
+ if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
3717
+ Object.getOwnPropertySymbols(value).forEach(function (key) {
3718
+ var descriptor = Object.getOwnPropertyDescriptor(value, key);
3719
+ if (descriptor && descriptor.enumerable) keys.push(key);
3720
+ });
3721
+ }
3722
+ // Shallow array elements retain fields filtered during plain-object merges.
3723
+ // Inspect reserved data properties without evaluating their accessors.
3724
+ keys.forEach(function (key) {
3725
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
3726
+ var descriptor = Object.getOwnPropertyDescriptor(value, key);
3727
+ if (descriptor && utils$1.hasOwnProp(descriptor, 'value')) {
3728
+ pending.push({
3729
+ value: descriptor.value
3730
+ });
3731
+ }
3732
+ } else {
3733
+ pending.push({
3734
+ value: value[key]
3735
+ });
3736
+ }
3737
+ });
3738
+ },
3739
+ _ret;
3740
+ while (pending.length) {
3741
+ _ret = _loop();
3742
+ if (_ret === 0) continue;
3743
+ }
3744
+ }
3745
+
3293
3746
  var headersToObject = function headersToObject(thing) {
3294
3747
  return thing instanceof AxiosHeaders ? _objectSpread2({}, thing) : thing;
3295
3748
  };
3296
3749
  var ownEnumerableKeys = function ownEnumerableKeys(thing) {
3297
3750
  if (Object.getOwnPropertySymbols && Object.getOwnPropertyDescriptor) {
3298
3751
  return Object.keys(thing).concat(Object.getOwnPropertySymbols(thing).filter(function (symbol) {
3299
- return Object.getOwnPropertyDescriptor(thing, symbol).enumerable;
3752
+ var descriptor = Object.getOwnPropertyDescriptor(thing, symbol);
3753
+ return descriptor && descriptor.enumerable;
3300
3754
  }));
3301
3755
  }
3302
3756
  return Object.keys(thing);
3303
3757
  };
3304
3758
 
3759
+ // Copy params without recursive merges so the serializer remains responsible
3760
+ // for its depth policy. Only visit defaults that contribute to the result.
3761
+ function mergeParams(a, b) {
3762
+ var pending = [];
3763
+ var copies = new WeakMap();
3764
+ var empty = {};
3765
+ function copy(target, source) {
3766
+ if (!utils$1.isPlainObject(source)) {
3767
+ return utils$1.isArray(source) ? source.slice() : source;
3768
+ }
3769
+ var base = utils$1.isPlainObject(target) ? target : empty;
3770
+ var bases = copies.get(source);
3771
+ if (!bases) {
3772
+ bases = new WeakMap();
3773
+ copies.set(source, bases);
3774
+ }
3775
+ if (bases.has(base)) return bases.get(base);
3776
+ var result = {};
3777
+ bases.set(base, result);
3778
+ pending.push({
3779
+ base: base,
3780
+ source: source,
3781
+ result: result
3782
+ });
3783
+ return result;
3784
+ }
3785
+ var result = utils$1.isUndefined(b) ? copy(undefined, a) : copy(a, b);
3786
+ var _loop = function _loop() {
3787
+ var _pending$pop = pending.pop(),
3788
+ base = _pending$pop.base,
3789
+ source = _pending$pop.source,
3790
+ target = _pending$pop.result;
3791
+ var baseKeys = new Set(ownEnumerableKeys(base));
3792
+ var sourceKeys = new Set(ownEnumerableKeys(source));
3793
+ var keys = new Set([].concat(_toConsumableArray(baseKeys), _toConsumableArray(sourceKeys)));
3794
+ keys.forEach(function (key) {
3795
+ if (key === '__proto__' || key === 'constructor' || key === 'prototype') return;
3796
+ var hasSource = sourceKeys.has(key);
3797
+ var value = hasSource ? source[key] : undefined;
3798
+ var previous = (!hasSource || utils$1.isPlainObject(value)) && baseKeys.has(key) ? base[key] : undefined;
3799
+ target[key] = hasSource ? copy(previous, value) : copy(undefined, previous);
3800
+ });
3801
+ };
3802
+ while (pending.length) {
3803
+ _loop();
3804
+ }
3805
+ assertParamsAcyclic(result);
3806
+ return result;
3807
+ }
3808
+ function getMergedValue(target, source, prop, caseless) {
3809
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3810
+ return utils$1.merge.call({
3811
+ caseless: caseless
3812
+ }, target, source);
3813
+ } else if (utils$1.isPlainObject(source)) {
3814
+ return utils$1.merge({}, source);
3815
+ } else if (utils$1.isArray(source)) {
3816
+ return source.slice();
3817
+ }
3818
+ return source;
3819
+ }
3820
+ function mergeDeepProperties(a, b, prop, caseless) {
3821
+ if (!utils$1.isUndefined(b)) {
3822
+ return getMergedValue(a, b, prop, caseless);
3823
+ } else if (!utils$1.isUndefined(a)) {
3824
+ return getMergedValue(undefined, a, prop, caseless);
3825
+ }
3826
+ }
3827
+
3828
+ // eslint-disable-next-line consistent-return
3829
+ function valueFromConfig2(a, b) {
3830
+ if (!utils$1.isUndefined(b)) {
3831
+ return getMergedValue(undefined, b);
3832
+ }
3833
+ }
3834
+
3835
+ // eslint-disable-next-line consistent-return
3836
+ function defaultToConfig2(a, b) {
3837
+ if (!utils$1.isUndefined(b)) {
3838
+ return getMergedValue(undefined, b);
3839
+ } else if (!utils$1.isUndefined(a)) {
3840
+ return getMergedValue(undefined, a);
3841
+ }
3842
+ }
3843
+ function getMergedTransitionalOption(config1, config2, prop) {
3844
+ var transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
3845
+ if (!utils$1.isUndefined(transitional2)) {
3846
+ if (utils$1.isPlainObject(transitional2)) {
3847
+ if (utils$1.hasOwnProp(transitional2, prop)) {
3848
+ return transitional2[prop];
3849
+ }
3850
+ } else {
3851
+ return undefined;
3852
+ }
3853
+ }
3854
+ var transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
3855
+ if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
3856
+ return transitional1[prop];
3857
+ }
3858
+ return undefined;
3859
+ }
3860
+
3861
+ // eslint-disable-next-line consistent-return
3862
+ function mergeDirectKeys(a, b, prop, config1, config2) {
3863
+ if (utils$1.hasOwnProp(config2, prop)) {
3864
+ return getMergedValue(a, b);
3865
+ } else if (utils$1.hasOwnProp(config1, prop)) {
3866
+ return getMergedValue(undefined, a);
3867
+ }
3868
+ }
3869
+ function mergeHeaders(a, b, prop) {
3870
+ return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
3871
+ }
3872
+
3873
+ // Null-proto, frozen descriptor so a polluted Object.prototype.get cannot turn
3874
+ // this data descriptor into an accessor descriptor on the way in.
3875
+ // defineProperty only reads it, so one shared instance serves every call.
3876
+ var hasOwnPropertyDescriptor = Object.freeze({
3877
+ __proto__: null,
3878
+ value: Object.prototype.hasOwnProperty,
3879
+ enumerable: false,
3880
+ writable: true,
3881
+ configurable: true
3882
+ });
3883
+
3884
+ // The strategy table and the strategies above are stateless, so they are
3885
+ // built once at module load instead of on every call: mergeConfig runs at
3886
+ // most twice per request (once from a method alias, once from `_request`).
3887
+ var mergeMap = {
3888
+ url: valueFromConfig2,
3889
+ method: valueFromConfig2,
3890
+ data: valueFromConfig2,
3891
+ baseURL: defaultToConfig2,
3892
+ transformRequest: defaultToConfig2,
3893
+ transformResponse: defaultToConfig2,
3894
+ params: mergeParams,
3895
+ paramsSerializer: defaultToConfig2,
3896
+ timeout: defaultToConfig2,
3897
+ timeoutErrorMessage: defaultToConfig2,
3898
+ withCredentials: defaultToConfig2,
3899
+ withXSRFToken: defaultToConfig2,
3900
+ adapter: defaultToConfig2,
3901
+ responseType: defaultToConfig2,
3902
+ xsrfCookieName: defaultToConfig2,
3903
+ xsrfHeaderName: defaultToConfig2,
3904
+ onUploadProgress: defaultToConfig2,
3905
+ onDownloadProgress: defaultToConfig2,
3906
+ decompress: defaultToConfig2,
3907
+ maxContentLength: defaultToConfig2,
3908
+ maxBodyLength: defaultToConfig2,
3909
+ beforeRedirect: defaultToConfig2,
3910
+ transport: defaultToConfig2,
3911
+ httpAgent: defaultToConfig2,
3912
+ httpsAgent: defaultToConfig2,
3913
+ cancelToken: defaultToConfig2,
3914
+ socketPath: defaultToConfig2,
3915
+ allowedSocketPaths: defaultToConfig2,
3916
+ responseEncoding: defaultToConfig2,
3917
+ validateStatus: mergeDirectKeys,
3918
+ headers: mergeHeaders
3919
+ };
3920
+
3305
3921
  /**
3306
3922
  * Config-specific merge-function which creates a new config-object
3307
3923
  * by merging two configuration objects together.
@@ -3321,119 +3937,18 @@
3321
3937
  // `hasOwnProperty` is restored as a non-enumerable own slot to preserve
3322
3938
  // ergonomics for user code that relies on it.
3323
3939
  var config = Object.create(null);
3324
- Object.defineProperty(config, 'hasOwnProperty', {
3325
- // Null-proto descriptor so a polluted Object.prototype.get cannot turn
3326
- // this data descriptor into an accessor descriptor on the way in.
3327
- __proto__: null,
3328
- value: Object.prototype.hasOwnProperty,
3329
- enumerable: false,
3330
- writable: true,
3331
- configurable: true
3332
- });
3333
- function getMergedValue(target, source, prop, caseless) {
3334
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3335
- return utils$1.merge.call({
3336
- caseless: caseless
3337
- }, target, source);
3338
- } else if (utils$1.isPlainObject(source)) {
3339
- return utils$1.merge({}, source);
3340
- } else if (utils$1.isArray(source)) {
3341
- return source.slice();
3342
- }
3343
- return source;
3344
- }
3345
- function mergeDeepProperties(a, b, prop, caseless) {
3346
- if (!utils$1.isUndefined(b)) {
3347
- return getMergedValue(a, b, prop, caseless);
3348
- } else if (!utils$1.isUndefined(a)) {
3349
- return getMergedValue(undefined, a, prop, caseless);
3350
- }
3351
- }
3352
-
3353
- // eslint-disable-next-line consistent-return
3354
- function valueFromConfig2(a, b) {
3355
- if (!utils$1.isUndefined(b)) {
3356
- return getMergedValue(undefined, b);
3357
- }
3358
- }
3359
-
3360
- // eslint-disable-next-line consistent-return
3361
- function defaultToConfig2(a, b) {
3362
- if (!utils$1.isUndefined(b)) {
3363
- return getMergedValue(undefined, b);
3364
- } else if (!utils$1.isUndefined(a)) {
3365
- return getMergedValue(undefined, a);
3366
- }
3367
- }
3368
- function getMergedTransitionalOption(prop) {
3369
- var transitional2 = utils$1.hasOwnProp(config2, 'transitional') ? config2.transitional : undefined;
3370
- if (!utils$1.isUndefined(transitional2)) {
3371
- if (utils$1.isPlainObject(transitional2)) {
3372
- if (utils$1.hasOwnProp(transitional2, prop)) {
3373
- return transitional2[prop];
3374
- }
3375
- } else {
3376
- return undefined;
3377
- }
3378
- }
3379
- var transitional1 = utils$1.hasOwnProp(config1, 'transitional') ? config1.transitional : undefined;
3380
- if (utils$1.isPlainObject(transitional1) && utils$1.hasOwnProp(transitional1, prop)) {
3381
- return transitional1[prop];
3382
- }
3383
- return undefined;
3384
- }
3385
-
3386
- // eslint-disable-next-line consistent-return
3387
- function mergeDirectKeys(a, b, prop) {
3388
- if (utils$1.hasOwnProp(config2, prop)) {
3389
- return getMergedValue(a, b);
3390
- } else if (utils$1.hasOwnProp(config1, prop)) {
3391
- return getMergedValue(undefined, a);
3392
- }
3393
- }
3394
- var mergeMap = {
3395
- url: valueFromConfig2,
3396
- method: valueFromConfig2,
3397
- data: valueFromConfig2,
3398
- baseURL: defaultToConfig2,
3399
- transformRequest: defaultToConfig2,
3400
- transformResponse: defaultToConfig2,
3401
- paramsSerializer: defaultToConfig2,
3402
- timeout: defaultToConfig2,
3403
- timeoutMessage: defaultToConfig2,
3404
- withCredentials: defaultToConfig2,
3405
- withXSRFToken: defaultToConfig2,
3406
- adapter: defaultToConfig2,
3407
- responseType: defaultToConfig2,
3408
- xsrfCookieName: defaultToConfig2,
3409
- xsrfHeaderName: defaultToConfig2,
3410
- onUploadProgress: defaultToConfig2,
3411
- onDownloadProgress: defaultToConfig2,
3412
- decompress: defaultToConfig2,
3413
- maxContentLength: defaultToConfig2,
3414
- maxBodyLength: defaultToConfig2,
3415
- beforeRedirect: defaultToConfig2,
3416
- transport: defaultToConfig2,
3417
- httpAgent: defaultToConfig2,
3418
- httpsAgent: defaultToConfig2,
3419
- cancelToken: defaultToConfig2,
3420
- socketPath: defaultToConfig2,
3421
- allowedSocketPaths: defaultToConfig2,
3422
- responseEncoding: defaultToConfig2,
3423
- validateStatus: mergeDirectKeys,
3424
- headers: function headers(a, b, prop) {
3425
- return mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true);
3426
- }
3427
- };
3428
- utils$1.forEach(ownEnumerableKeys(_objectSpread2(_objectSpread2({}, config1), config2)), function computeConfigValue(prop) {
3429
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
3940
+ Object.defineProperty(config, 'hasOwnProperty', hasOwnPropertyDescriptor);
3941
+ var keys = ownEnumerableKeys(_objectSpread2(_objectSpread2({}, config1), config2));
3942
+ for (var i = 0, len = keys.length; i < len; i++) {
3943
+ var prop = keys[i];
3944
+ if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') continue;
3430
3945
  var merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
3431
3946
  var a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
3432
3947
  var b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
3433
- var configValue = merge(a, b, prop);
3948
+ var configValue = merge === mergeDirectKeys ? merge(a, b, prop, config1, config2) : merge(a, b, prop);
3434
3949
  utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
3435
- });
3436
- if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption('validateStatusUndefinedResolves') === false) {
3950
+ }
3951
+ if (utils$1.hasOwnProp(config2, 'validateStatus') && utils$1.isUndefined(config2.validateStatus) && getMergedTransitionalOption(config1, config2, 'validateStatusUndefinedResolves') === false) {
3437
3952
  if (utils$1.hasOwnProp(config1, 'validateStatus')) {
3438
3953
  config.validateStatus = getMergedValue(undefined, config1.validateStatus);
3439
3954
  } else {
@@ -3484,7 +3999,11 @@
3484
3999
  return String.fromCharCode(parseInt(hex, 16));
3485
4000
  });
3486
4001
  };
4002
+ var readCookie = function readCookie(name) {
4003
+ return cookies.read(name);
4004
+ };
3487
4005
  function resolveConfig(config) {
4006
+ var readXsrfCookie = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : readCookie;
3488
4007
  var newConfig = mergeConfig({}, config);
3489
4008
 
3490
4009
  // Read only own properties to prevent prototype pollution gadgets
@@ -3508,18 +4027,23 @@
3508
4027
  if (auth) {
3509
4028
  var username = utils$1.getSafeProp(auth, 'username') || '';
3510
4029
  var password = utils$1.getSafeProp(auth, 'password') || '';
4030
+ var transitional = own('transitional');
4031
+ var encodeUsername = transitional && utils$1.hasOwnProp(transitional, 'encodeBasicAuthUsername') && transitional.encodeBasicAuthUsername === true;
3511
4032
  try {
3512
- headers.set('Authorization', 'Basic ' + btoa(username + ':' + (password ? encodeUTF8$1(password) : '')));
4033
+ headers.set('Authorization',
4034
+ // Preserve legacy username bytes unless the caller opts in to UTF-8.
4035
+ 'Basic ' + btoa((encodeUsername ? encodeUTF8$1(username) : username) + ':' + (password ? encodeUTF8$1(password) : '')));
3513
4036
  } catch (e) {
3514
4037
  throw AxiosError.from(e, AxiosError.ERR_BAD_OPTION_VALUE, config);
3515
4038
  }
3516
4039
  }
3517
4040
  if (utils$1.isFormData(data)) {
4041
+ var getHeaders = utils$1.getSafeProp(data, 'getHeaders');
3518
4042
  if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv || utils$1.isReactNative(data)) {
3519
4043
  headers.setContentType(undefined); // browser/web worker/RN handles it
3520
- } else if (utils$1.isFunction(data.getHeaders)) {
4044
+ } else if (utils$1.isFunction(getHeaders)) {
3521
4045
  // Node.js FormData (like form-data package)
3522
- setFormDataHeaders(headers, data.getHeaders(), own('formDataHeaderPolicy'));
4046
+ setFormDataHeaders(headers, getHeaders.call(data), own('formDataHeaderPolicy'));
3523
4047
  }
3524
4048
  }
3525
4049
 
@@ -3537,7 +4061,7 @@
3537
4061
  // the XSRF token cross-origin.
3538
4062
  var shouldSendXSRF = withXSRFToken === true || withXSRFToken == null && isURLSameOrigin(newConfig.url);
3539
4063
  if (shouldSendXSRF) {
3540
- var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
4064
+ var xsrfValue = xsrfHeaderName && xsrfCookieName && readXsrfCookie(xsrfCookieName);
3541
4065
  if (xsrfValue) {
3542
4066
  headers.set(xsrfHeaderName, xsrfValue);
3543
4067
  }
@@ -3549,19 +4073,55 @@
3549
4073
  var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3550
4074
  var xhrAdapter = isXHRAdapterSupported && function (config) {
3551
4075
  return new Promise(function dispatchXhrRequest(resolve, reject) {
3552
- var _config = resolveConfig(config);
4076
+ var useAsyncXsrf;
4077
+ try {
4078
+ var store = platform.hasStandardBrowserEnv && typeof window !== 'undefined' && window.cookieStore;
4079
+ useAsyncXsrf = store && utils$1.isFunction(store.get);
4080
+ } catch (e) {
4081
+ // A restricted Cookie Store getter must retain the synchronous fallback.
4082
+ }
4083
+ var xsrfCookieName;
4084
+ var _config = resolveConfig(config, useAsyncXsrf ? function (name) {
4085
+ xsrfCookieName = name;
4086
+ return null;
4087
+ } : undefined);
3553
4088
  var requestData = _config.data;
3554
4089
  var requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3555
4090
  var responseType = _config.responseType,
3556
4091
  onUploadProgress = _config.onUploadProgress,
3557
4092
  onDownloadProgress = _config.onDownloadProgress;
3558
4093
  var onCanceled;
4094
+ var timeoutId;
3559
4095
  var uploadThrottled, downloadThrottled;
3560
- var flushUpload, flushDownload;
4096
+ var flushUpload, flushDownload, flushDownloadWithEvent;
3561
4097
  function done() {
3562
- flushUpload && flushUpload(); // flush events
3563
- flushDownload && flushDownload(); // flush events
4098
+ clearTimeout(timeoutId);
4099
+ // A final progress callback must not prevent the remaining cleanup.
4100
+ // Report errors asynchronously, as onloadend and the throttle timer do.
4101
+ try {
4102
+ flushUpload && flushUpload(); // flush events
4103
+ } catch (err) {
4104
+ setTimeout(function () {
4105
+ throw err;
4106
+ });
4107
+ }
4108
+ try {
4109
+ flushDownload && flushDownload(); // flush events
4110
+ } catch (err) {
4111
+ setTimeout(function () {
4112
+ throw err;
4113
+ });
4114
+ }
3564
4115
 
4116
+ // A flush can synchronously cancel the request and reenter done().
4117
+ // In that case the inner call has already detached these listeners.
4118
+ if (request) {
4119
+ downloadThrottled && request.removeEventListener('progress', downloadThrottled);
4120
+ if (request.upload) {
4121
+ uploadThrottled && request.upload.removeEventListener('progress', uploadThrottled);
4122
+ flushUpload && request.upload.removeEventListener('loadend', flushUpload);
4123
+ }
4124
+ }
3565
4125
  _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3566
4126
  _config.signal && _config.signal.removeEventListener('abort', onCanceled);
3567
4127
  }
@@ -3570,10 +4130,50 @@
3570
4130
 
3571
4131
  // Set the request timeout in MS
3572
4132
  request.timeout = _config.timeout;
3573
- function onloadend() {
4133
+ function onloadend(event) {
4134
+ if (!request) {
4135
+ return;
4136
+ }
4137
+
4138
+ // Status 0 means no response was received, which onerror and onabort normally
4139
+ // reject before this runs. Firefox 152 fires only readystatechange and loadend for
4140
+ // navigation-canceled requests (https://bugzilla.mozilla.org/show_bug.cgi?id=1505389),
4141
+ // leaving settle() to resolve them as an empty success. ECONNABORTED is the error
4142
+ // onabort raised on Firefox 151. Reads over file:, which some environments report as
4143
+ // status 0 on success, are excluded by the request URL's scheme after browser-style
4144
+ // preprocessing, by the page origin's scheme for relative URLs (which inherit it), or
4145
+ // by responseURL where implemented.
4146
+ if (request.status === 0 && (parseProtocol(normalizeURLForProtocolCheck(_config.url)) || parseProtocol(platform.origin)) !== 'file' && !(request.responseURL && request.responseURL.startsWith('file:'))) {
4147
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
4148
+ done();
4149
+
4150
+ // Clean up request
4151
+ request = null;
4152
+ return;
4153
+ }
4154
+
4155
+ // When loadend is still dispatching, flushing with it gives progress
4156
+ // listeners a final delivery whose event has a live target. The legacy
4157
+ // ready-state fallback has no event, so replay its pending progress.
4158
+ // A throwing listener must not block settlement; rethrow asynchronously,
4159
+ // matching how listener errors surface on the throttle timer path.
4160
+ try {
4161
+ if (event) {
4162
+ flushDownloadWithEvent && flushDownloadWithEvent(event);
4163
+ } else {
4164
+ flushDownload && flushDownload();
4165
+ }
4166
+ } catch (err) {
4167
+ setTimeout(function () {
4168
+ throw err;
4169
+ });
4170
+ }
4171
+
4172
+ // A final progress callback can cancel the request synchronously.
3574
4173
  if (!request) {
3575
4174
  return;
3576
4175
  }
4176
+
3577
4177
  // Prepare the response
3578
4178
  var responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
3579
4179
  var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
@@ -3647,6 +4247,7 @@
3647
4247
 
3648
4248
  // Handle timeout
3649
4249
  request.ontimeout = function handleTimeout() {
4250
+ if (!request) return;
3650
4251
  var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
3651
4252
  var transitional = _config.transitional || transitionalDefaults;
3652
4253
  if (_config.timeoutErrorMessage) {
@@ -3662,13 +4263,6 @@
3662
4263
  // Remove Content-Type if data is undefined
3663
4264
  requestData === undefined && requestHeaders.setContentType(null);
3664
4265
 
3665
- // Add headers to the request
3666
- if ('setRequestHeader' in request) {
3667
- utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
3668
- request.setRequestHeader(key, val);
3669
- });
3670
- }
3671
-
3672
4266
  // Add withCredentials to request if needed
3673
4267
  if (!utils$1.isUndefined(_config.withCredentials)) {
3674
4268
  request.withCredentials = !!_config.withCredentials;
@@ -3682,9 +4276,10 @@
3682
4276
  // Handle progress if needed
3683
4277
  if (onDownloadProgress) {
3684
4278
  var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
3685
- var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
4279
+ var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 3);
3686
4280
  downloadThrottled = _progressEventReducer2[0];
3687
4281
  flushDownload = _progressEventReducer2[1];
4282
+ flushDownloadWithEvent = _progressEventReducer2[2];
3688
4283
  request.addEventListener('progress', downloadThrottled);
3689
4284
  }
3690
4285
 
@@ -3705,24 +4300,81 @@
3705
4300
  return;
3706
4301
  }
3707
4302
  reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3708
- request.abort();
4303
+ var xhr = request;
3709
4304
  done();
3710
4305
  request = null;
4306
+ xhr.abort();
3711
4307
  };
3712
4308
  _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
4309
+ if (!request) return;
3713
4310
  if (_config.signal) {
3714
4311
  _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
3715
4312
  }
3716
4313
  }
4314
+ if (!request) return;
3717
4315
  var protocol = parseProtocol(_config.url);
3718
4316
  if (protocol && !platform.protocols.includes(protocol)) {
3719
4317
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3720
4318
  done();
3721
4319
  return;
3722
4320
  }
3723
-
3724
- // Send the request
3725
- request.send(requestData || null);
4321
+ var sendRequest = function sendRequest() {
4322
+ if (!request) return;
4323
+ // Apply headers after an asynchronous XSRF read so existing headers are
4324
+ // replaced through AxiosHeaders rather than appended by the native XHR.
4325
+ if ('setRequestHeader' in request) {
4326
+ utils$1.forEach(toByteStringHeaderObject(requestHeaders), function setRequestHeader(val, key) {
4327
+ request.setRequestHeader(key, val);
4328
+ });
4329
+ }
4330
+ request.send(requestData || null);
4331
+ };
4332
+ if (xsrfCookieName) {
4333
+ // Native XHR timeout starts at send(). Cover cookie preparation and the
4334
+ // subsequent request with the same budget and existing timeout handler.
4335
+ var now = typeof performance !== 'undefined' && utils$1.isFunction(performance.now) ? function () {
4336
+ return performance.now();
4337
+ } : Date.now;
4338
+ var deadline = request.timeout > 0 ? now() + Number(request.timeout) : undefined;
4339
+ var abortOnTimeout = function abortOnTimeout() {
4340
+ if (!request) return;
4341
+ var xhr = request;
4342
+ xhr.ontimeout();
4343
+ xhr.abort();
4344
+ };
4345
+ if (deadline !== undefined) {
4346
+ var _scheduleTimeout = function scheduleTimeout() {
4347
+ var remaining = deadline - now();
4348
+ if (remaining > 0) {
4349
+ // Browser timers overflow above the signed 32-bit delay limit.
4350
+ timeoutId = setTimeout(_scheduleTimeout, Math.min(remaining, 0x7fffffff));
4351
+ } else {
4352
+ abortOnTimeout();
4353
+ }
4354
+ };
4355
+ _scheduleTimeout();
4356
+ }
4357
+ cookies.readAsync(xsrfCookieName).then(function (value) {
4358
+ if (!request) return;
4359
+ // Promise callbacks may run before an overdue timer after a busy task.
4360
+ if (deadline !== undefined && now() >= deadline) {
4361
+ abortOnTimeout();
4362
+ return;
4363
+ }
4364
+ if (value) {
4365
+ var headerName = utils$1.hasOwnProp(_config, 'xsrfHeaderName') && _config.xsrfHeaderName;
4366
+ requestHeaders.set(headerName, value);
4367
+ }
4368
+ sendRequest();
4369
+ })["catch"](function (error) {
4370
+ if (!request) return;
4371
+ reject(AxiosError.from(error, null, config, request));
4372
+ done();
4373
+ request = null;
4374
+ });
4375
+ } else {
4376
+ sendRequest();
4377
+ }
3726
4378
  });
3727
4379
  };
3728
4380
 
@@ -3752,7 +4404,8 @@
3752
4404
  timer && clearTimeout(timer);
3753
4405
  timer = null;
3754
4406
  signals.forEach(function (signal) {
3755
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
4407
+ var unsubscribeSignal = utils$1.getSafeProp(signal, 'unsubscribe');
4408
+ utils$1.isFunction(unsubscribeSignal) ? unsubscribeSignal.call(signal, onabort) : signal.removeEventListener('abort', onabort);
3756
4409
  });
3757
4410
  signals = null;
3758
4411
  };
@@ -3978,11 +4631,151 @@
3978
4631
  });
3979
4632
  };
3980
4633
 
4634
+ var CRLF = '\r\n';
4635
+ var normalizeLines = function normalizeLines(value) {
4636
+ return String(value).replace(/\r\n|\r|\n/g, CRLF);
4637
+ };
4638
+ var escapeName = function escapeName(value) {
4639
+ return String(value).replace(/[\r\n"]/g, function (_char) {
4640
+ return _char === '\r' ? '%0D' : _char === '\n' ? '%0A' : '%22';
4641
+ });
4642
+ };
4643
+
4644
+ // Count UTF-8 bytes without allocating an encoded copy of a field. FormData
4645
+ // string values normalize line endings; Blob/File contents remain unchanged.
4646
+ var stringBytes = function stringBytes(value, normalize) {
4647
+ var length = 0;
4648
+ for (var i = 0; i < value.length; i++) {
4649
+ var code = value.charCodeAt(i);
4650
+ if (normalize && (code === 13 || code === 10)) {
4651
+ if (code === 13 && value.charCodeAt(i + 1) === 10) i++;
4652
+ length += 2;
4653
+ } else if (code < 0x80) {
4654
+ length++;
4655
+ } else if (code < 0x800) {
4656
+ length += 2;
4657
+ } else if (code >= 0xd800 && code <= 0xdbff && value.charCodeAt(i + 1) >= 0xdc00 && value.charCodeAt(i + 1) <= 0xdfff) {
4658
+ length += 4;
4659
+ i++;
4660
+ } else {
4661
+ length += 3;
4662
+ }
4663
+ }
4664
+ return length;
4665
+ };
4666
+
4667
+ // Describe serialization failures independently of any request library.
4668
+ var FormDataError = /*#__PURE__*/function (_TypeError) {
4669
+ function FormDataError(message, reason) {
4670
+ var _this;
4671
+ _classCallCheck(this, FormDataError);
4672
+ _this = _callSuper(this, FormDataError, [message]);
4673
+ _this.name = 'FormDataError';
4674
+ _this.reason = reason;
4675
+ return _this;
4676
+ }
4677
+ _inherits(FormDataError, _TypeError);
4678
+ return _createClass(FormDataError);
4679
+ }(/*#__PURE__*/_wrapNativeSuper(TypeError));
4680
+
4681
+ // The caller supplies the boundary, Blob implementation, and limit error.
4682
+ function formDataToBlob(form, Blob, limit, limitError, boundary) {
4683
+ if (!utils$1.isFunction(Blob)) {
4684
+ throw new FormDataError('Blob is not supported', 'blob');
4685
+ }
4686
+ if (!utils$1.isString(boundary) || !/^[A-Za-z0-9'()+_,./:=? -]{1,70}$/.test(boundary) || / $/.test(boundary)) {
4687
+ throw new FormDataError('Invalid multipart boundary', 'boundary');
4688
+ }
4689
+ var footer = '--' + boundary + '--' + CRLF;
4690
+ var length = footer.length;
4691
+ var parts = [];
4692
+ var checkLength = function checkLength(extra) {
4693
+ if (length + extra > limit) throw limitError();
4694
+ };
4695
+ checkLength(0);
4696
+ var _iterator = _createForOfIteratorHelper(form),
4697
+ _step;
4698
+ try {
4699
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
4700
+ var _step$value = _slicedToArray(_step.value, 2),
4701
+ name = _step$value[0],
4702
+ value = _step$value[1];
4703
+ var isString = utils$1.isString(value);
4704
+ var valueLength = isString ? stringBytes(value, true) : value.size;
4705
+ if (!Number.isFinite(valueLength) || valueLength < 0) {
4706
+ throw new FormDataError('Unsupported FormData part size', 'part');
4707
+ }
4708
+ // Reject large values and names before building normalized header strings.
4709
+ checkLength(valueLength + stringBytes(name, true) + (!isString && value.name ? stringBytes(value.name, false) : 0) + (!isString && value.type ? stringBytes(value.type, false) : 0));
4710
+ var header = '--' + boundary + CRLF + 'Content-Disposition: form-data; name="' + escapeName(normalizeLines(name)) + '"';
4711
+ if (!isString) {
4712
+ header += '; filename="' + escapeName(utils$1.isString(value.name) ? value.name : 'blob') + '"' + CRLF + 'Content-Type: ' + String(value.type || 'application/octet-stream').replace(/[\r\n]/g, '');
4713
+ }
4714
+ header += CRLF + CRLF;
4715
+ var partLength = stringBytes(header, false) + valueLength + CRLF.length;
4716
+ checkLength(partLength);
4717
+ length += partLength;
4718
+ parts.push({
4719
+ header: header,
4720
+ value: value,
4721
+ isString: isString
4722
+ });
4723
+ }
4724
+
4725
+ // Native Blob composition retains existing Blob/File data. No file is read
4726
+ // and no complete multipart ArrayBuffer is created to determine its length.
4727
+ } catch (err) {
4728
+ _iterator.e(err);
4729
+ } finally {
4730
+ _iterator.f();
4731
+ }
4732
+ var blobParts = [];
4733
+ for (var _i = 0, _parts = parts; _i < _parts.length; _i++) {
4734
+ var part = _parts[_i];
4735
+ blobParts.push(part.header, part.isString ? normalizeLines(part.value) : part.value, CRLF);
4736
+ }
4737
+ blobParts.push(footer);
4738
+ return new Blob(blobParts, {
4739
+ type: 'multipart/form-data; boundary=' + boundary
4740
+ });
4741
+ }
4742
+
4743
+ function createMultipartBody(form, Blob, limit, limitError, boundary) {
4744
+ // Report missing Blob support before trying to select a random source.
4745
+ if (!utils$1.isFunction(Blob)) {
4746
+ throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
4747
+ }
4748
+ if (boundary === undefined) {
4749
+ if (utils$1.isFunction(platform.generateString)) {
4750
+ boundary = 'axios-' + platform.generateString(36, '0123456789abcdef');
4751
+ } else {
4752
+ var crypto = utils$1.global.crypto;
4753
+ if (!crypto || !utils$1.isFunction(crypto.getRandomValues)) {
4754
+ throw new AxiosError('Random byte generation is not supported', AxiosError.ERR_NOT_SUPPORT);
4755
+ }
4756
+ var random = new Uint8Array(18);
4757
+ crypto.getRandomValues(random);
4758
+ boundary = 'axios-' + Array.from(random, function (value) {
4759
+ return ('0' + value.toString(16)).slice(-2);
4760
+ }).join('');
4761
+ }
4762
+ }
4763
+ try {
4764
+ return formDataToBlob(form, Blob, limit, limitError, boundary);
4765
+ } catch (error) {
4766
+ if (error instanceof FormDataError) {
4767
+ var code = error.reason === 'boundary' ? AxiosError.ERR_BAD_OPTION_VALUE : AxiosError.ERR_BAD_REQUEST;
4768
+ throw new AxiosError(error.message, code);
4769
+ }
4770
+ throw error;
4771
+ }
4772
+ }
4773
+
3981
4774
  /**
3982
4775
  * Estimate data: URL byte lengths *without* allocating large buffers.
3983
4776
  * - Fetch percent-decodes a base64 body before decoding it.
3984
4777
  * - Node's Buffer.from(body, 'base64') sizes its backing allocation from the
3985
- * raw body, including ignored characters and content after padding.
4778
+ * percent-decoded body, including ignored characters and content after padding.
3986
4779
  * - Non-base64 data is percent-decoded and then encoded as UTF-8.
3987
4780
  */
3988
4781
  var isHexDigit = function isHexDigit(charCode) {
@@ -4064,14 +4857,14 @@
4064
4857
  }
4065
4858
  return base64Bytes(significant);
4066
4859
  };
4067
- var estimateDataURLBytes = function estimateDataURLBytes(url, estimateBase64) {
4860
+ var estimateDataURLBytes = function estimateDataURLBytes(url, estimateBase64, base64Pattern) {
4068
4861
  if (!url || typeof url !== 'string') return 0;
4069
- if (!url.startsWith('data:')) return 0;
4862
+ if (!/^data:/i.test(url)) return 0;
4070
4863
  var comma = url.indexOf(',');
4071
4864
  if (comma < 0) return 0;
4072
4865
  var meta = url.slice(5, comma);
4073
4866
  var body = url.slice(comma + 1);
4074
- var isBase64 = /;base64/i.test(meta);
4867
+ var isBase64 = base64Pattern.test(meta);
4075
4868
  if (isBase64) {
4076
4869
  return estimateBase64(body);
4077
4870
  }
@@ -4114,12 +4907,23 @@
4114
4907
  function estimateDataURLDecodedBytes(url) {
4115
4908
  // Fetch removes URL fragments before processing a data: URL.
4116
4909
  var fragmentIndex = typeof url === 'string' ? url.indexOf('#') : -1;
4117
- return estimateDataURLBytes(fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), estimatePercentDecodedBase64Bytes);
4910
+ return estimateDataURLBytes(fragmentIndex === -1 ? url : url.slice(0, fragmentIndex), estimatePercentDecodedBase64Bytes, /; *base64[\t\n\f\r ]*$/i);
4118
4911
  }
4119
4912
 
4120
- var VERSION = "1.19.0";
4913
+ var VERSION = "1.21.0";
4121
4914
 
4122
4915
  var DEFAULT_CHUNK_SIZE = 64 * 1024;
4916
+ var DEFAULT_REQUEST_OPTIONS = {
4917
+ cache: 'default',
4918
+ redirect: 'follow',
4919
+ referrer: 'about:client',
4920
+ referrerPolicy: '',
4921
+ mode: 'cors',
4922
+ integrity: '',
4923
+ keepalive: false,
4924
+ priority: 'auto',
4925
+ window: null
4926
+ };
4123
4927
  var isFunction = utils$1.isFunction;
4124
4928
 
4125
4929
  /**
@@ -4176,12 +4980,14 @@
4176
4980
  skipUndefined: true
4177
4981
  }, {
4178
4982
  Request: globalObject.Request,
4179
- Response: globalObject.Response
4983
+ Response: globalObject.Response,
4984
+ Blob: globalObject.Blob
4180
4985
  }, env);
4986
+ var envFetch = utils$1.hasOwnProp(env, 'fetch') ? env.fetch : undefined;
4181
4987
  var _env = env,
4182
- envFetch = _env.fetch,
4183
4988
  Request = _env.Request,
4184
- Response = _env.Response;
4989
+ Response = _env.Response,
4990
+ Blob = _env.Blob;
4185
4991
  var isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
4186
4992
  var isRequestSupported = isFunction(Request);
4187
4993
  var isResponseSupported = isFunction(Response);
@@ -4231,6 +5037,23 @@
4231
5037
  var supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(function () {
4232
5038
  return utils$1.isReadableStream(new Response('').body);
4233
5039
  });
5040
+
5041
+ // Some runtimes reject every explicit cache mode. Use own defaults for both
5042
+ // probes so unrelated polluted options cannot affect cache-mode detection.
5043
+ var requestDefaults = Object.assign(Object.create(null), DEFAULT_REQUEST_OPTIONS);
5044
+ if (isRequestSupported && !test(function () {
5045
+ return new Request(platform.origin, requestDefaults);
5046
+ })) {
5047
+ delete requestDefaults.cache;
5048
+
5049
+ // Only omit cache when that makes Request construction succeed. Otherwise
5050
+ // retain the explicit default that protects supporting runtimes from pollution.
5051
+ if (!test(function () {
5052
+ return new Request(platform.origin, requestDefaults);
5053
+ })) {
5054
+ requestDefaults.cache = DEFAULT_REQUEST_OPTIONS.cache;
5055
+ }
5056
+ }
4234
5057
  var resolvers = {
4235
5058
  stream: supportsResponseStream && function (res) {
4236
5059
  return res.body;
@@ -4249,7 +5072,6 @@
4249
5072
  }();
4250
5073
  var getBodyLength = /*#__PURE__*/function () {
4251
5074
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(body) {
4252
- var _request;
4253
5075
  return _regenerator().w(function (_context2) {
4254
5076
  while (1) switch (_context2.n) {
4255
5077
  case 0:
@@ -4265,37 +5087,24 @@
4265
5087
  }
4266
5088
  return _context2.a(2, body.size);
4267
5089
  case 2:
4268
- if (!utils$1.isSpecCompliantForm(body)) {
4269
- _context2.n = 4;
4270
- break;
4271
- }
4272
- _request = new Request(platform.origin, {
4273
- method: 'POST',
4274
- body: body
4275
- });
4276
- _context2.n = 3;
4277
- return _request.arrayBuffer();
4278
- case 3:
4279
- return _context2.a(2, _context2.v.byteLength);
4280
- case 4:
4281
5090
  if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
4282
- _context2.n = 5;
5091
+ _context2.n = 3;
4283
5092
  break;
4284
5093
  }
4285
5094
  return _context2.a(2, body.byteLength);
4286
- case 5:
5095
+ case 3:
4287
5096
  if (utils$1.isURLSearchParams(body)) {
4288
5097
  body = body + '';
4289
5098
  }
4290
5099
  if (!utils$1.isString(body)) {
4291
- _context2.n = 7;
5100
+ _context2.n = 5;
4292
5101
  break;
4293
5102
  }
4294
- _context2.n = 6;
5103
+ _context2.n = 4;
4295
5104
  return encodeText(body);
4296
- case 6:
5105
+ case 4:
4297
5106
  return _context2.a(2, _context2.v.byteLength);
4298
- case 7:
5107
+ case 5:
4299
5108
  return _context2.a(2);
4300
5109
  }
4301
5110
  }, _callee2);
@@ -4321,11 +5130,11 @@
4321
5130
  }();
4322
5131
  return /*#__PURE__*/function () {
4323
5132
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(config) {
4324
- var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, networkError, _t3, _t4;
5133
+ var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, maxContentLength, maxBodyLength, maxRedirects, hasMaxContentLength, hasMaxBodyLength, own, _fetch, composedSignal, request, unsubscribe, requestContentLength, pendingBodyError, pendingResponseError, maxBodyLengthError, auth, configAuth, username, password, parsedURL, urlUsername, urlPassword, estimated, formContentType, formBoundary, parameters, outboundLength, mustEnforceStreamBody, trackRequestStream, _request, contentTypeHeader, _ref5, _ref6, onProgress, flush, isCredentialsSupported, contentType, safeFetchOptions, resolvedOptions, response, responseHeaders, declaredLength, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, bytesRead, onChunkProgress, responseData, materializedSize, canceledError, networkError, _t3, _t4;
4325
5134
  return _regenerator().w(function (_context4) {
4326
5135
  while (1) switch (_context4.p = _context4.n) {
4327
5136
  case 0:
4328
- _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength;
5137
+ _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions, maxContentLength = _resolveConfig.maxContentLength, maxBodyLength = _resolveConfig.maxBodyLength, maxRedirects = _resolveConfig.maxRedirects;
4329
5138
  hasMaxContentLength = utils$1.isNumber(maxContentLength) && maxContentLength > -1;
4330
5139
  hasMaxBodyLength = utils$1.isNumber(maxBodyLength) && maxBodyLength > -1;
4331
5140
  own = function own(key) {
@@ -4338,11 +5147,12 @@
4338
5147
  unsubscribe = composedSignal && composedSignal.unsubscribe && function () {
4339
5148
  composedSignal.unsubscribe();
4340
5149
  };
4341
- // AxiosError we raise while the request body is being streamed. Captured
5150
+ // AxiosErrors we raise while request or response bodies are being streamed. Captured
4342
5151
  // by identity so the catch block can surface it directly, regardless of
4343
5152
  // how the runtime wraps the resulting fetch rejection (undici exposes it
4344
5153
  // as `err.cause`; some browsers drop the original error entirely).
4345
5154
  pendingBodyError = null;
5155
+ pendingResponseError = null;
4346
5156
  maxBodyLengthError = function maxBodyLengthError() {
4347
5157
  return new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config, request);
4348
5158
  };
@@ -4382,17 +5192,35 @@
4382
5192
  // Enforce maxContentLength for data: URLs up-front so we never materialize
4383
5193
  // an oversized payload. The HTTP adapter applies the same check (see http.js
4384
5194
  // "if (protocol === 'data:')" branch).
4385
- if (!(hasMaxContentLength && typeof url === 'string' && url.startsWith('data:'))) {
5195
+ if (!(hasMaxContentLength && parsedURL && parsedURL.protocol === 'data:')) {
4386
5196
  _context4.n = 2;
4387
5197
  break;
4388
5198
  }
4389
- estimated = estimateDataURLDecodedBytes(url);
5199
+ estimated = estimateDataURLDecodedBytes(parsedURL.href);
4390
5200
  if (!(estimated > maxContentLength)) {
4391
5201
  _context4.n = 2;
4392
5202
  break;
4393
5203
  }
4394
5204
  throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4395
5205
  case 2:
5206
+ formContentType = utils$1.isSpecCompliantForm(data) && AxiosHeaders.from(own('headers')).getContentType();
5207
+ if (utils$1.isString(formContentType) && /^multipart\/form-data(?:\s*;|$)/i.test(formContentType.trim())) {
5208
+ parameters = AxiosHeaders.parseParameters(formContentType);
5209
+ if (utils$1.hasOwnProp(parameters, 'boundary')) formBoundary = parameters.boundary;
5210
+ }
5211
+ if (utils$1.isSpecCompliantForm(data) && method !== 'get' && method !== 'head' && (hasMaxBodyLength || onUploadProgress && supportsRequestStream || formBoundary !== undefined)) {
5212
+ data = createMultipartBody(data, Blob, hasMaxBodyLength ? maxBodyLength : Infinity, maxBodyLengthError, formBoundary);
5213
+ // Blob.type lowercases its value, including a case-sensitive boundary.
5214
+ // Retain the caller's header when an explicit boundary was serialized.
5215
+ headers.setContentType(formBoundary === undefined ? data.type : formContentType);
5216
+ requestContentLength = data.size;
5217
+ }
5218
+
5219
+ // Enforce maxBodyLength against known-size bodies before dispatch using
5220
+ // the body's *actual* size — never a caller-declared Content-Length,
5221
+ // which could under-report to slip an oversized body past the check.
5222
+ // Unknown-size streams return undefined here and are counted per-chunk
5223
+ // below as fetch consumes them.
4396
5224
  if (!(hasMaxBodyLength && method !== 'get' && method !== 'head')) {
4397
5225
  _context4.n = 4;
4398
5226
  break;
@@ -4491,7 +5319,18 @@
4491
5319
 
4492
5320
  // Set User-Agent header if not already set (fetch defaults to 'node' in Node.js)
4493
5321
  headers.set('User-Agent', 'axios/' + VERSION, false);
4494
- resolvedOptions = _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
5322
+ safeFetchOptions = fetchOptions == null ? fetchOptions : Object.assign(Object.create(null), fetchOptions);
5323
+ if (safeFetchOptions) {
5324
+ // These options are owned by Axios and are already reflected in the
5325
+ // resolved Request passed to fetch.
5326
+ delete safeFetchOptions.body;
5327
+ delete safeFetchOptions.headers;
5328
+ delete safeFetchOptions.method;
5329
+ delete safeFetchOptions.signal;
5330
+ delete safeFetchOptions.duplex;
5331
+ delete safeFetchOptions.credentials;
5332
+ }
5333
+ resolvedOptions = Object.assign(Object.create(null), safeFetchOptions, {
4495
5334
  signal: composedSignal,
4496
5335
  method: method.toUpperCase(),
4497
5336
  headers: toByteStringHeaderObject(headers.normalize()),
@@ -4499,9 +5338,28 @@
4499
5338
  duplex: 'half',
4500
5339
  credentials: isCredentialsSupported ? withCredentials : undefined
4501
5340
  });
5341
+ if (isRequestSupported) {
5342
+ utils$1.forEach(requestDefaults, function (value, key) {
5343
+ if (resolvedOptions[key] === undefined) {
5344
+ resolvedOptions[key] = value;
5345
+ }
5346
+ });
5347
+ if (resolvedOptions.signal === undefined) {
5348
+ resolvedOptions.signal = null;
5349
+ }
5350
+ if (resolvedOptions.body === undefined) {
5351
+ resolvedOptions.body = null;
5352
+ }
5353
+ }
5354
+ if (maxRedirects === 0) {
5355
+ resolvedOptions.redirect = 'manual';
5356
+ if (safeFetchOptions) {
5357
+ safeFetchOptions.redirect = 'manual';
5358
+ }
5359
+ }
4502
5360
  request = isRequestSupported && new Request(url, resolvedOptions);
4503
5361
  _context4.n = 11;
4504
- return isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions);
5362
+ return isRequestSupported ? _fetch(request, safeFetchOptions) : _fetch(url, resolvedOptions);
4505
5363
  case 11:
4506
5364
  response = _context4.v;
4507
5365
  responseHeaders = AxiosHeaders.from(response.headers); // Cheap pre-check: if the server honestly declares a content-length that
@@ -4530,7 +5388,7 @@
4530
5388
  if (hasMaxContentLength) {
4531
5389
  bytesRead = loadedBytes;
4532
5390
  if (bytesRead > maxContentLength) {
4533
- throw new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
5391
+ throw pendingResponseError = new AxiosError('maxContentLength size of ' + maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, request);
4534
5392
  }
4535
5393
  }
4536
5394
  _onProgress && _onProgress(loadedBytes);
@@ -4613,15 +5471,21 @@
4613
5471
  request && !pendingBodyError.request && (pendingBodyError.request = request);
4614
5472
  throw pendingBodyError;
4615
5473
  case 18:
4616
- if (!(_t4 instanceof AxiosError)) {
5474
+ if (!pendingResponseError) {
4617
5475
  _context4.n = 19;
4618
5476
  break;
4619
5477
  }
5478
+ throw pendingResponseError;
5479
+ case 19:
5480
+ if (!(_t4 instanceof AxiosError)) {
5481
+ _context4.n = 20;
5482
+ break;
5483
+ }
4620
5484
  request && !_t4.request && (_t4.request = request);
4621
5485
  throw _t4;
4622
- case 19:
5486
+ case 20:
4623
5487
  if (!(_t4 && _t4.name === 'TypeError' && /Load failed|fetch/i.test(_t4.message))) {
4624
- _context4.n = 20;
5488
+ _context4.n = 21;
4625
5489
  break;
4626
5490
  }
4627
5491
  networkError = new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, _t4 && _t4.response); // Non-enumerable to match native Error `cause` semantics so loggers
@@ -4634,9 +5498,9 @@
4634
5498
  configurable: true
4635
5499
  });
4636
5500
  throw networkError;
4637
- case 20:
4638
- throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
4639
5501
  case 21:
5502
+ throw AxiosError.from(_t4, _t4 && _t4.code, config, request, _t4 && _t4.response);
5503
+ case 22:
4640
5504
  return _context4.a(2);
4641
5505
  }
4642
5506
  }, _callee4, null, [[1, 16]]);
@@ -4648,11 +5512,18 @@
4648
5512
  };
4649
5513
  var seedCache = new Map();
4650
5514
  var getFetch = function getFetch(config) {
4651
- var env = config && config.env || {};
5515
+ var env = Object.create(null);
5516
+ var configuredEnv = config && utils$1.hasOwnProp(config, 'env') && config.env;
5517
+ ['fetch', 'Request', 'Response', 'Blob'].forEach(function (key) {
5518
+ if (configuredEnv && utils$1.hasOwnProp(configuredEnv, key)) {
5519
+ env[key] = configuredEnv[key];
5520
+ }
5521
+ });
4652
5522
  var fetch = env.fetch,
4653
5523
  Request = env.Request,
4654
- Response = env.Response;
4655
- var seeds = [Request, Response, fetch];
5524
+ Response = env.Response,
5525
+ Blob = env.Blob;
5526
+ var seeds = [Request, Response, fetch, Blob];
4656
5527
  var len = seeds.length,
4657
5528
  i = len,
4658
5529
  seed,
@@ -4802,6 +5673,21 @@
4802
5673
  }
4803
5674
  }
4804
5675
 
5676
+ /**
5677
+ * Milliseconds elapsed since `start`, floored at zero.
5678
+ *
5679
+ * Wall-clock, to match the rest of the codebase (speedometer, throttle,
5680
+ * AxiosTransformStream). A backwards clock adjustment mid-request would
5681
+ * otherwise produce a negative duration, so the result is clamped.
5682
+ *
5683
+ * @param {number} start Timestamp from `Date.now()`
5684
+ *
5685
+ * @returns {number} Non-negative elapsed milliseconds
5686
+ */
5687
+ function elapsedSince(start) {
5688
+ return Math.max(0, Date.now() - start);
5689
+ }
5690
+
4805
5691
  /**
4806
5692
  * Dispatch a request to the server using the configured adapter.
4807
5693
  *
@@ -4809,9 +5695,13 @@
4809
5695
  *
4810
5696
  * @returns {Promise} The Promise to be fulfilled
4811
5697
  */
4812
- function dispatchRequest(config) {
5698
+ function dispatchRequest(_config) {
5699
+ // Interceptors may replace the merged config with an ordinary object. Flatten
5700
+ // it at the dispatch boundary so shared prototype members cannot become
5701
+ // request behavior, while preserving intentional template/class members.
5702
+ var config = utils$1.toSafeFlatObject(_config);
4813
5703
  throwIfCancellationRequested(config);
4814
- config.headers = AxiosHeaders.from(config.headers);
5704
+ config.headers = AxiosHeaders.from(utils$1.getSafeProp(config, 'headers'));
4815
5705
 
4816
5706
  // Transform request data
4817
5707
  config.data = transformData.call(config, config.transformRequest);
@@ -4819,8 +5709,10 @@
4819
5709
  config.headers.setContentType('application/x-www-form-urlencoded', false);
4820
5710
  }
4821
5711
  var adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
5712
+ var start = Date.now();
4822
5713
  return adapter(config).then(function onAdapterResolution(response) {
4823
5714
  throwIfCancellationRequested(config);
5715
+ response.duration = elapsedSince(start);
4824
5716
 
4825
5717
  // Expose the current response on config so that transformResponse can
4826
5718
  // attach it to any AxiosError it throws (e.g. on JSON parse failure).
@@ -4839,6 +5731,7 @@
4839
5731
 
4840
5732
  // Transform response data
4841
5733
  if (reason && reason.response) {
5734
+ reason.response.duration = elapsedSince(start);
4842
5735
  config.response = reason.response;
4843
5736
  try {
4844
5737
  reason.response.data = transformData.call(config, config.transformResponse, reason.response);
@@ -4938,6 +5831,23 @@
4938
5831
 
4939
5832
  var validators = validator.validators;
4940
5833
 
5834
+ // Recognize header maps without consuming objects intended as literal values.
5835
+ // AxiosHeaders from other builds share a brand and header-container interface,
5836
+ // but not constructor identity. A tag and toJSON alone can describe a literal.
5837
+ var isHeadersBucket = function isHeadersBucket(value) {
5838
+ if (value == null || utils$1.isPlainObject(value) || value instanceof AxiosHeaders) {
5839
+ return true;
5840
+ }
5841
+ try {
5842
+ return utils$1.isObject(value) && utils$1.getSafeProp(value, Symbol.toStringTag) === 'AxiosHeaders' && ['toJSON', 'set', 'get', 'has', 'delete', 'clear', 'normalize', 'concat', 'toString', Symbol.iterator].every(function (method) {
5843
+ return utils$1.isFunction(utils$1.getSafeProp(value, method));
5844
+ });
5845
+ } catch (e) {
5846
+ // A failed optional brand probe must not prevent literal header serialization.
5847
+ return false;
5848
+ }
5849
+ };
5850
+
4941
5851
  /**
4942
5852
  * Create a new instance of Axios
4943
5853
  *
@@ -4967,7 +5877,7 @@
4967
5877
  key: "request",
4968
5878
  value: (function () {
4969
5879
  var _request2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(configOrUrl, config) {
4970
- var dummy, stack, firstNewlineIndex, secondNewlineIndex, stackWithoutTwoTopLines, _t;
5880
+ var dummy, dummyStack, stack, firstNewlineIndex, _firstNewlineIndex, secondNewlineIndex, duplicateCheckSuffix, currentStack, causeIndex, stackHead, causeSection, _t;
4971
5881
  return _regenerator().w(function (_context) {
4972
5882
  while (1) switch (_context.p = _context.n) {
4973
5883
  case 0:
@@ -4980,31 +5890,36 @@
4980
5890
  _context.p = 2;
4981
5891
  _t = _context.v;
4982
5892
  if (_t instanceof Error) {
4983
- dummy = {};
4984
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
4985
-
4986
- // slice off the Error: ... line
4987
- stack = function () {
4988
- if (!dummy.stack) {
4989
- return '';
4990
- }
4991
- var firstNewlineIndex = dummy.stack.indexOf('\n');
4992
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4993
- }();
4994
5893
  try {
5894
+ dummy = {};
5895
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
5896
+ dummyStack = dummy.stack;
5897
+ stack = ''; // slice off the Error: ... line
5898
+ if (typeof dummyStack === 'string') {
5899
+ firstNewlineIndex = dummyStack.indexOf('\n');
5900
+ stack = firstNewlineIndex === -1 ? '' : dummyStack.slice(firstNewlineIndex + 1);
5901
+ }
4995
5902
  if (!_t.stack) {
4996
5903
  _t.stack = stack;
4997
- // match without the 2 top stack lines
4998
5904
  } else if (stack) {
4999
- firstNewlineIndex = stack.indexOf('\n');
5000
- secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
5001
- stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
5002
- if (!String(_t.stack).endsWith(stackWithoutTwoTopLines)) {
5003
- _t.stack += '\n' + stack;
5905
+ // Match a common suffix after the 2 top frames when available,
5906
+ // otherwise compare the full reconstructed stack.
5907
+ _firstNewlineIndex = stack.indexOf('\n');
5908
+ secondNewlineIndex = _firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', _firstNewlineIndex + 1);
5909
+ duplicateCheckSuffix = secondNewlineIndex === -1 ? stack : stack.slice(secondNewlineIndex + 1); // `AxiosError.from()` may have already inlined the wrapped error's
5910
+ // stack under a `Caused by:` marker. Keep the reconstructed caller
5911
+ // frames ahead of that marker so stack-only reporters do not read
5912
+ // them as part of the low-level cause.
5913
+ currentStack = String(_t.stack);
5914
+ causeIndex = getCauseStackIndex(_t, currentStack);
5915
+ stackHead = causeIndex === -1 ? currentStack : currentStack.slice(0, causeIndex);
5916
+ causeSection = causeIndex === -1 ? '' : currentStack.slice(causeIndex);
5917
+ if (!stackHead.endsWith(duplicateCheckSuffix)) {
5918
+ _t.stack = stackHead + '\n' + stack + causeSection;
5004
5919
  }
5005
5920
  }
5006
5921
  } catch (e) {
5007
- // ignore the case where "stack" is an un-writable property
5922
+ // Ignore failures from custom stack hooks or un-writable stack properties.
5008
5923
  }
5009
5924
  }
5010
5925
  throw _t;
@@ -5042,7 +5957,8 @@
5042
5957
  clarifyTimeoutError: validators.transitional(validators["boolean"]),
5043
5958
  legacyInterceptorReqResOrdering: validators.transitional(validators["boolean"]),
5044
5959
  advertiseZstdAcceptEncoding: validators.transitional(validators["boolean"]),
5045
- validateStatusUndefinedResolves: validators.transitional(validators["boolean"])
5960
+ validateStatusUndefinedResolves: validators.transitional(validators["boolean"]),
5961
+ encodeBasicAuthUsername: validators.transitional(validators["boolean"])
5046
5962
  }, false);
5047
5963
  }
5048
5964
  if (paramsSerializer != null) {
@@ -5059,7 +5975,7 @@
5059
5975
  }
5060
5976
 
5061
5977
  // Set config.allowAbsoluteUrls
5062
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
5978
+ if (config.allowAbsoluteUrls !== undefined) ; else if (utils$1.hasOwnProp(this.defaults, 'allowAbsoluteUrls') && this.defaults.allowAbsoluteUrls !== undefined) {
5063
5979
  config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
5064
5980
  } else {
5065
5981
  config.allowAbsoluteUrls = true;
@@ -5070,12 +5986,16 @@
5070
5986
  }, true);
5071
5987
 
5072
5988
  // Set config.method
5073
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
5074
-
5075
- // Flatten headers
5076
- var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
5077
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'query', 'common'], function (method) {
5078
- delete headers[method];
5989
+ config.method = (utils$1.getSafeProp(config, 'method') || utils$1.getSafeProp(this.defaults, 'method') || 'get').toLowerCase();
5990
+
5991
+ // Flatten header defaults without consuming literal method-named headers.
5992
+ var commonHeaders = utils$1.getSafeProp(headers, 'common');
5993
+ var methodHeaders = utils$1.getSafeProp(headers, config.method);
5994
+ var contextHeaders = headers && utils$1.merge(isHeadersBucket(commonHeaders) ? commonHeaders : undefined, isHeadersBucket(methodHeaders) ? methodHeaders : undefined);
5995
+ headers && utils$1.forEach(methodList.concat('common'), function (method) {
5996
+ if (isHeadersBucket(utils$1.getSafeProp(headers, method))) {
5997
+ delete headers[method];
5998
+ }
5079
5999
  });
5080
6000
  config.headers = AxiosHeaders.concat(contextHeaders, headers);
5081
6001
 
@@ -5163,26 +6083,47 @@
5163
6083
  }(); // Provide aliases for supported request methods
5164
6084
  utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
5165
6085
  /*eslint func-names:0*/
5166
- Axios.prototype[method] = function (url, config) {
5167
- return this.request(mergeConfig(config || {}, {
5168
- method: method,
5169
- url: url,
5170
- data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
6086
+ Axios.prototype[method] = /*#__PURE__*/function () {
6087
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(url, config) {
6088
+ return _regenerator().w(function (_context2) {
6089
+ while (1) switch (_context2.n) {
6090
+ case 0:
6091
+ return _context2.a(2, this.request(mergeConfig(config || {}, {
6092
+ method: method,
6093
+ url: url,
6094
+ data: config && utils$1.hasOwnProp(config, 'data') ? config.data : undefined
6095
+ })));
6096
+ }
6097
+ }, _callee2, this);
5171
6098
  }));
5172
- };
6099
+ return function (_x3, _x4) {
6100
+ return _ref.apply(this, arguments);
6101
+ };
6102
+ }();
5173
6103
  });
5174
6104
  utils$1.forEach(['post', 'put', 'patch', 'query'], function forEachMethodWithData(method) {
5175
6105
  function generateHTTPMethod(isForm) {
5176
- return function httpMethod(url, data, config) {
5177
- return this.request(mergeConfig(config || {}, {
5178
- method: method,
5179
- headers: isForm ? {
5180
- 'Content-Type': 'multipart/form-data'
5181
- } : {},
5182
- url: url,
5183
- data: data
6106
+ return /*#__PURE__*/function () {
6107
+ var _httpMethod = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(url, data, config) {
6108
+ return _regenerator().w(function (_context3) {
6109
+ while (1) switch (_context3.n) {
6110
+ case 0:
6111
+ return _context3.a(2, this.request(mergeConfig(config || {}, {
6112
+ method: method,
6113
+ headers: isForm ? {
6114
+ 'Content-Type': 'multipart/form-data'
6115
+ } : {},
6116
+ url: url,
6117
+ data: data
6118
+ })));
6119
+ }
6120
+ }, _callee3, this);
5184
6121
  }));
5185
- };
6122
+ function httpMethod(_x5, _x6, _x7) {
6123
+ return _httpMethod.apply(this, arguments);
6124
+ }
6125
+ return httpMethod;
6126
+ }();
5186
6127
  }
5187
6128
  Axios.prototype[method] = generateHTTPMethod();
5188
6129
 
@@ -5396,14 +6337,22 @@
5396
6337
  Gone: 410,
5397
6338
  LengthRequired: 411,
5398
6339
  PreconditionFailed: 412,
6340
+ /**
6341
+ * @deprecated Use `ContentTooLarge` instead.
6342
+ */
5399
6343
  PayloadTooLarge: 413,
6344
+ ContentTooLarge: 413,
5400
6345
  UriTooLong: 414,
5401
6346
  UnsupportedMediaType: 415,
5402
6347
  RangeNotSatisfiable: 416,
5403
6348
  ExpectationFailed: 417,
5404
6349
  ImATeapot: 418,
5405
6350
  MisdirectedRequest: 421,
6351
+ /**
6352
+ * @deprecated Use `UnprocessableContent` instead.
6353
+ */
5406
6354
  UnprocessableEntity: 422,
6355
+ UnprocessableContent: 422,
5407
6356
  Locked: 423,
5408
6357
  FailedDependency: 424,
5409
6358
  TooEarly: 425,
@@ -5435,7 +6384,9 @@
5435
6384
  var _ref2 = _slicedToArray(_ref, 2),
5436
6385
  key = _ref2[0],
5437
6386
  value = _ref2[1];
5438
- HttpStatusCode[value] = key;
6387
+ if (HttpStatusCode[value] === undefined) {
6388
+ HttpStatusCode[value] = key;
6389
+ }
5439
6390
  });
5440
6391
 
5441
6392
  /**