node-red-contrib-tak-registration 0.3.1 → 0.6.0

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 (412) hide show
  1. package/README.md +1 -1
  2. package/node_modules/@turf/along/package.json +41 -69
  3. package/node_modules/@turf/angle/package.json +44 -75
  4. package/node_modules/@turf/area/package.json +38 -68
  5. package/node_modules/@turf/bbox/package.json +37 -81
  6. package/node_modules/@turf/bbox-clip/package.json +44 -81
  7. package/node_modules/@turf/bbox-polygon/package.json +36 -66
  8. package/node_modules/@turf/bearing/package.json +36 -70
  9. package/node_modules/@turf/bezier-spline/package.json +39 -67
  10. package/node_modules/@turf/boolean-clockwise/package.json +42 -83
  11. package/node_modules/@turf/boolean-contains/package.json +46 -80
  12. package/node_modules/@turf/boolean-crosses/package.json +45 -79
  13. package/node_modules/@turf/boolean-disjoint/package.json +44 -79
  14. package/node_modules/@turf/boolean-equal/package.json +47 -84
  15. package/node_modules/@turf/boolean-intersects/package.json +42 -77
  16. package/node_modules/@turf/boolean-overlap/package.json +48 -82
  17. package/node_modules/@turf/boolean-parallel/package.json +42 -73
  18. package/node_modules/@turf/boolean-point-in-polygon/package.json +37 -77
  19. package/node_modules/@turf/boolean-point-on-line/package.json +39 -73
  20. package/node_modules/@turf/boolean-within/package.json +46 -79
  21. package/node_modules/@turf/buffer/package.json +47 -84
  22. package/node_modules/@turf/center/package.json +42 -73
  23. package/node_modules/@turf/center-mean/package.json +45 -78
  24. package/node_modules/@turf/center-median/package.json +45 -76
  25. package/node_modules/@turf/center-of-mass/package.json +40 -68
  26. package/node_modules/@turf/centroid/package.json +40 -74
  27. package/node_modules/@turf/circle/package.json +41 -71
  28. package/node_modules/@turf/clean-coords/package.json +40 -75
  29. package/node_modules/@turf/clone/package.json +36 -81
  30. package/node_modules/@turf/clusters/package.json +39 -70
  31. package/node_modules/@turf/clusters-dbscan/package.json +51 -88
  32. package/node_modules/@turf/clusters-kmeans/package.json +53 -90
  33. package/node_modules/@turf/collect/package.json +42 -73
  34. package/node_modules/@turf/combine/package.json +37 -65
  35. package/node_modules/@turf/concave/package.json +56 -111
  36. package/node_modules/@turf/convex/package.json +39 -68
  37. package/node_modules/@turf/destination/package.json +41 -75
  38. package/node_modules/@turf/difference/package.json +35 -63
  39. package/node_modules/@turf/dissolve/package.json +38 -66
  40. package/node_modules/@turf/distance/package.json +38 -83
  41. package/node_modules/@turf/distance-weight/package.json +40 -72
  42. package/node_modules/@turf/ellipse/package.json +43 -75
  43. package/node_modules/@turf/envelope/package.json +36 -65
  44. package/node_modules/@turf/explode/package.json +36 -67
  45. package/node_modules/@turf/flatten/package.json +39 -73
  46. package/node_modules/@turf/flip/package.json +36 -64
  47. package/node_modules/@turf/great-circle/package.json +41 -78
  48. package/node_modules/@turf/helpers/package.json +38 -184
  49. package/node_modules/@turf/hex-grid/package.json +50 -97
  50. package/node_modules/@turf/interpolate/package.json +47 -78
  51. package/node_modules/@turf/intersect/package.json +39 -69
  52. package/node_modules/@turf/invariant/package.json +36 -126
  53. package/node_modules/@turf/isobands/package.json +52 -83
  54. package/node_modules/@turf/isolines/package.json +48 -79
  55. package/node_modules/@turf/kinks/package.json +35 -63
  56. package/node_modules/@turf/length/package.json +43 -78
  57. package/node_modules/@turf/line-arc/package.json +36 -65
  58. package/node_modules/@turf/line-chunk/package.json +44 -84
  59. package/node_modules/@turf/line-intersect/package.json +46 -85
  60. package/node_modules/@turf/line-offset/package.json +41 -78
  61. package/node_modules/@turf/line-overlap/package.json +48 -80
  62. package/node_modules/@turf/line-segment/package.json +38 -70
  63. package/node_modules/@turf/line-slice/package.json +39 -67
  64. package/node_modules/@turf/line-slice-along/package.json +36 -65
  65. package/node_modules/@turf/line-split/package.json +46 -77
  66. package/node_modules/@turf/line-to-polygon/package.json +43 -74
  67. package/node_modules/@turf/mask/package.json +35 -63
  68. package/node_modules/@turf/meta/package.json +39 -128
  69. package/node_modules/@turf/midpoint/package.json +36 -64
  70. package/node_modules/@turf/moran-index/package.json +39 -70
  71. package/node_modules/@turf/nearest-point/package.json +39 -69
  72. package/node_modules/@turf/nearest-point-on-line/package.json +40 -71
  73. package/node_modules/@turf/nearest-point-to-line/package.json +47 -78
  74. package/node_modules/@turf/planepoint/package.json +34 -62
  75. package/node_modules/@turf/point-grid/package.json +45 -80
  76. package/node_modules/@turf/point-on-feature/package.json +40 -68
  77. package/node_modules/@turf/point-to-line-distance/package.json +46 -78
  78. package/node_modules/@turf/points-within-polygon/package.json +35 -64
  79. package/node_modules/@turf/polygon-smooth/package.json +37 -68
  80. package/node_modules/@turf/polygon-tangents/package.json +43 -77
  81. package/node_modules/@turf/polygon-to-line/package.json +39 -69
  82. package/node_modules/@turf/polygonize/package.json +43 -77
  83. package/node_modules/@turf/projection/package.json +44 -77
  84. package/node_modules/@turf/random/package.json +34 -62
  85. package/node_modules/@turf/rectangle-grid/package.json +43 -77
  86. package/node_modules/@turf/rewind/package.json +43 -83
  87. package/node_modules/@turf/rhumb-bearing/package.json +43 -85
  88. package/node_modules/@turf/rhumb-destination/package.json +44 -85
  89. package/node_modules/@turf/rhumb-distance/package.json +44 -84
  90. package/node_modules/@turf/sample/package.json +32 -60
  91. package/node_modules/@turf/sector/package.json +37 -65
  92. package/node_modules/@turf/shortest-path/package.json +45 -79
  93. package/node_modules/@turf/simplify/package.json +43 -77
  94. package/node_modules/@turf/square/package.json +33 -62
  95. package/node_modules/@turf/square-grid/package.json +40 -69
  96. package/node_modules/@turf/standard-deviational-ellipse/package.json +43 -74
  97. package/node_modules/@turf/tag/package.json +38 -66
  98. package/node_modules/@turf/tesselate/package.json +40 -80
  99. package/node_modules/@turf/tin/package.json +34 -63
  100. package/node_modules/@turf/transform-rotate/package.json +45 -80
  101. package/node_modules/@turf/transform-scale/package.json +51 -86
  102. package/node_modules/@turf/transform-translate/package.json +44 -78
  103. package/node_modules/@turf/triangle-grid/package.json +42 -71
  104. package/node_modules/@turf/truncate/package.json +40 -72
  105. package/node_modules/@turf/turf/package.json +74 -102
  106. package/node_modules/@turf/union/package.json +39 -67
  107. package/node_modules/@turf/unkink-polygon/package.json +40 -68
  108. package/node_modules/@turf/voronoi/package.json +43 -83
  109. package/node_modules/@types/geojson/package.json +42 -66
  110. package/node_modules/adm-zip/LICENSE +21 -21
  111. package/node_modules/adm-zip/adm-zip.js +25 -22
  112. package/node_modules/adm-zip/headers/mainHeader.js +2 -1
  113. package/node_modules/adm-zip/package.json +28 -57
  114. package/node_modules/adm-zip/util/utils.js +1 -0
  115. package/node_modules/asynckit/package.json +40 -68
  116. package/node_modules/axios/CHANGELOG.md +473 -837
  117. package/node_modules/axios/LICENSE +4 -16
  118. package/node_modules/axios/MIGRATION_GUIDE.md +3 -0
  119. package/node_modules/axios/README.md +518 -114
  120. package/node_modules/axios/SECURITY.md +4 -3
  121. package/node_modules/axios/dist/axios.js +2759 -2070
  122. package/node_modules/axios/dist/axios.js.map +1 -0
  123. package/node_modules/axios/dist/axios.min.js +2 -2
  124. package/node_modules/axios/dist/axios.min.js.map +1 -0
  125. package/node_modules/axios/dist/browser/axios.cjs +3210 -0
  126. package/node_modules/axios/dist/browser/axios.cjs.map +1 -0
  127. package/node_modules/axios/dist/esm/axios.js +3232 -0
  128. package/node_modules/axios/dist/esm/axios.js.map +1 -0
  129. package/node_modules/axios/dist/esm/axios.min.js +2 -0
  130. package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  131. package/node_modules/axios/dist/node/axios.cjs +4237 -0
  132. package/node_modules/axios/dist/node/axios.cjs.map +1 -0
  133. package/node_modules/axios/index.d.cts +532 -0
  134. package/node_modules/axios/index.d.ts +398 -72
  135. package/node_modules/axios/index.js +41 -1
  136. package/node_modules/axios/lib/adapters/adapters.js +59 -0
  137. package/node_modules/axios/lib/adapters/http.js +479 -217
  138. package/node_modules/axios/lib/adapters/xhr.js +95 -54
  139. package/node_modules/axios/lib/axios.js +49 -20
  140. package/node_modules/axios/lib/cancel/CancelToken.js +91 -89
  141. package/node_modules/axios/lib/cancel/CanceledError.js +25 -0
  142. package/node_modules/axios/lib/cancel/isCancel.js +2 -2
  143. package/node_modules/axios/lib/core/Axios.js +155 -100
  144. package/node_modules/axios/lib/core/AxiosError.js +100 -0
  145. package/node_modules/axios/lib/core/AxiosHeaders.js +288 -0
  146. package/node_modules/axios/lib/core/InterceptorManager.js +62 -45
  147. package/node_modules/axios/lib/core/buildFullPath.js +5 -4
  148. package/node_modules/axios/lib/core/dispatchRequest.js +27 -33
  149. package/node_modules/axios/lib/core/mergeConfig.js +58 -52
  150. package/node_modules/axios/lib/core/settle.js +8 -6
  151. package/node_modules/axios/lib/core/transformData.js +15 -9
  152. package/node_modules/axios/lib/defaults/index.js +76 -41
  153. package/node_modules/axios/lib/defaults/transitional.js +1 -1
  154. package/node_modules/axios/lib/env/classes/FormData.js +2 -0
  155. package/node_modules/axios/lib/env/data.js +1 -3
  156. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +191 -0
  157. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +58 -0
  158. package/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
  159. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +28 -0
  160. package/node_modules/axios/lib/helpers/bind.js +3 -7
  161. package/node_modules/axios/lib/helpers/buildURL.js +26 -33
  162. package/node_modules/axios/lib/helpers/callbackify.js +16 -0
  163. package/node_modules/axios/lib/helpers/combineURLs.js +3 -2
  164. package/node_modules/axios/lib/helpers/cookies.js +43 -44
  165. package/node_modules/axios/lib/helpers/deprecatedMethod.js +4 -2
  166. package/node_modules/axios/lib/helpers/formDataToJSON.js +92 -0
  167. package/node_modules/axios/lib/helpers/formDataToStream.js +111 -0
  168. package/node_modules/axios/lib/helpers/fromDataURI.js +53 -0
  169. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +3 -2
  170. package/node_modules/axios/lib/helpers/isAxiosError.js +4 -3
  171. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +44 -45
  172. package/node_modules/axios/lib/helpers/null.js +2 -0
  173. package/node_modules/axios/lib/helpers/parseHeaders.js +24 -22
  174. package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  175. package/node_modules/axios/lib/helpers/readBlob.js +15 -0
  176. package/node_modules/axios/lib/helpers/speedometer.js +55 -0
  177. package/node_modules/axios/lib/helpers/spread.js +3 -2
  178. package/node_modules/axios/lib/helpers/throttle.js +33 -0
  179. package/node_modules/axios/lib/helpers/toFormData.js +203 -39
  180. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
  181. package/node_modules/axios/lib/helpers/validator.js +27 -18
  182. package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  183. package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  184. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  185. package/node_modules/axios/lib/platform/browser/index.js +64 -0
  186. package/node_modules/axios/lib/platform/index.js +3 -0
  187. package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  188. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  189. package/node_modules/axios/lib/platform/node/index.js +12 -0
  190. package/node_modules/axios/lib/utils.js +517 -144
  191. package/node_modules/axios/package.json +194 -93
  192. package/node_modules/call-bind/package.json +78 -109
  193. package/node_modules/combined-stream/package.json +14 -46
  194. package/node_modules/commander/package.json +20 -53
  195. package/node_modules/concaveman/node_modules/quickselect/package.json +43 -0
  196. package/node_modules/{@turf/collect → concaveman}/node_modules/rbush/README.md +22 -95
  197. package/node_modules/{@turf/unkink-polygon → concaveman}/node_modules/rbush/index.js +131 -181
  198. package/node_modules/concaveman/node_modules/rbush/package.json +56 -0
  199. package/node_modules/concaveman/node_modules/rbush/rbush.js +574 -0
  200. package/node_modules/concaveman/node_modules/rbush/rbush.min.js +1 -0
  201. package/node_modules/concaveman/package.json +15 -46
  202. package/node_modules/d3-array/package.json +19 -47
  203. package/node_modules/d3-geo/package.json +24 -52
  204. package/node_modules/d3-voronoi/package.json +19 -47
  205. package/node_modules/deep-equal/package.json +34 -64
  206. package/node_modules/define-properties/.eslintrc +10 -3
  207. package/node_modules/define-properties/.github/FUNDING.yml +12 -0
  208. package/node_modules/define-properties/.nycrc +9 -0
  209. package/node_modules/define-properties/CHANGELOG.md +39 -0
  210. package/node_modules/define-properties/README.md +11 -13
  211. package/node_modules/define-properties/index.js +12 -17
  212. package/node_modules/define-properties/package.json +85 -95
  213. package/node_modules/delayed-stream/package.json +14 -49
  214. package/node_modules/density-clustering/package.json +46 -70
  215. package/node_modules/earcut/README.md +12 -3
  216. package/node_modules/earcut/dist/earcut.dev.js +47 -50
  217. package/node_modules/earcut/dist/earcut.min.js +1 -1
  218. package/node_modules/earcut/package.json +26 -60
  219. package/node_modules/earcut/src/earcut.js +46 -49
  220. package/node_modules/follow-redirects/README.md +8 -1
  221. package/node_modules/follow-redirects/index.js +83 -36
  222. package/node_modules/follow-redirects/package.json +38 -74
  223. package/node_modules/form-data/package.json +37 -70
  224. package/node_modules/function-bind/package.json +23 -56
  225. package/node_modules/functions-have-names/.editorconfig +20 -0
  226. package/node_modules/functions-have-names/.eslintrc +19 -0
  227. package/node_modules/functions-have-names/.github/FUNDING.yml +12 -0
  228. package/node_modules/functions-have-names/.nycrc +9 -0
  229. package/node_modules/functions-have-names/CHANGELOG.md +89 -0
  230. package/node_modules/functions-have-names/LICENSE +21 -0
  231. package/node_modules/functions-have-names/README.md +40 -0
  232. package/node_modules/functions-have-names/index.js +31 -0
  233. package/node_modules/functions-have-names/package.json +55 -0
  234. package/node_modules/functions-have-names/test/index.js +65 -0
  235. package/node_modules/geojson-equality/package.json +23 -55
  236. package/node_modules/geojson-rbush/node_modules/quickselect/package.json +43 -0
  237. package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/rbush/README.md +22 -95
  238. package/node_modules/{@turf/collect → geojson-rbush}/node_modules/rbush/index.js +131 -181
  239. package/node_modules/geojson-rbush/node_modules/rbush/package.json +56 -0
  240. package/node_modules/geojson-rbush/node_modules/rbush/rbush.js +574 -0
  241. package/node_modules/geojson-rbush/node_modules/rbush/rbush.min.js +1 -0
  242. package/node_modules/geojson-rbush/package.json +32 -71
  243. package/node_modules/get-intrinsic/.eslintrc +3 -8
  244. package/node_modules/get-intrinsic/.nycrc +0 -4
  245. package/node_modules/get-intrinsic/CHANGELOG.md +53 -0
  246. package/node_modules/get-intrinsic/README.md +7 -1
  247. package/node_modules/get-intrinsic/index.js +29 -8
  248. package/node_modules/get-intrinsic/package.json +91 -104
  249. package/node_modules/get-intrinsic/test/GetIntrinsic.js +26 -12
  250. package/node_modules/has/package.json +21 -46
  251. package/node_modules/has-property-descriptors/.eslintrc +13 -0
  252. package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
  253. package/node_modules/has-property-descriptors/.nycrc +9 -0
  254. package/node_modules/has-property-descriptors/CHANGELOG.md +16 -0
  255. package/node_modules/has-property-descriptors/LICENSE +21 -0
  256. package/node_modules/has-property-descriptors/README.md +43 -0
  257. package/node_modules/has-property-descriptors/index.js +33 -0
  258. package/node_modules/has-property-descriptors/package.json +70 -0
  259. package/node_modules/has-property-descriptors/test/index.js +57 -0
  260. package/node_modules/has-proto/.eslintrc +5 -0
  261. package/node_modules/has-proto/.github/FUNDING.yml +12 -0
  262. package/node_modules/has-proto/CHANGELOG.md +23 -0
  263. package/node_modules/has-proto/LICENSE +21 -0
  264. package/node_modules/has-proto/README.md +38 -0
  265. package/node_modules/has-proto/index.js +11 -0
  266. package/node_modules/has-proto/package.json +74 -0
  267. package/node_modules/has-proto/test/index.js +19 -0
  268. package/node_modules/has-symbols/package.json +99 -125
  269. package/node_modules/has-tostringtag/package.json +82 -109
  270. package/node_modules/is-arguments/package.json +89 -114
  271. package/node_modules/is-date-object/package.json +77 -108
  272. package/node_modules/is-regex/package.json +84 -112
  273. package/node_modules/mime-db/HISTORY.md +8 -0
  274. package/node_modules/mime-db/LICENSE +19 -18
  275. package/node_modules/mime-db/README.md +1 -1
  276. package/node_modules/mime-db/db.json +54 -6
  277. package/node_modules/mime-db/index.js +1 -0
  278. package/node_modules/mime-db/package.json +24 -66
  279. package/node_modules/mime-types/HISTORY.md +9 -0
  280. package/node_modules/mime-types/README.md +1 -1
  281. package/node_modules/mime-types/package.json +19 -62
  282. package/node_modules/object-assign/package.json +15 -49
  283. package/node_modules/object-is/package.json +85 -112
  284. package/node_modules/object-keys/package.json +86 -116
  285. package/node_modules/point-in-polygon/package.json +19 -48
  286. package/node_modules/polygon-clipping/package.json +41 -80
  287. package/node_modules/proxy-from-env/.eslintrc +29 -0
  288. package/node_modules/proxy-from-env/.travis.yml +10 -0
  289. package/node_modules/proxy-from-env/LICENSE +20 -0
  290. package/node_modules/proxy-from-env/README.md +131 -0
  291. package/node_modules/proxy-from-env/index.js +108 -0
  292. package/node_modules/proxy-from-env/package.json +34 -0
  293. package/node_modules/proxy-from-env/test.js +483 -0
  294. package/node_modules/quickselect/package.json +13 -41
  295. package/node_modules/rbush/README.md +95 -22
  296. package/node_modules/rbush/index.js +181 -131
  297. package/node_modules/rbush/package.json +39 -71
  298. package/node_modules/rbush/rbush.js +412 -360
  299. package/node_modules/rbush/rbush.min.js +1 -1
  300. package/node_modules/regexp.prototype.flags/.eslintrc +1 -0
  301. package/node_modules/regexp.prototype.flags/CHANGELOG.md +19 -0
  302. package/node_modules/regexp.prototype.flags/implementation.js +9 -0
  303. package/node_modules/regexp.prototype.flags/package.json +98 -122
  304. package/node_modules/regexp.prototype.flags/test/shimmed.js +2 -1
  305. package/node_modules/regexp.prototype.flags/test/tests.js +7 -5
  306. package/node_modules/robust-predicates/package.json +25 -52
  307. package/node_modules/skmeans/package.json +18 -53
  308. package/node_modules/splaytree/Readme.md +58 -57
  309. package/node_modules/splaytree/dist/splay.esm.js +21 -8
  310. package/node_modules/splaytree/dist/splay.esm.js.map +1 -1
  311. package/node_modules/splaytree/dist/splay.js +21 -8
  312. package/node_modules/splaytree/dist/splay.js.map +1 -1
  313. package/node_modules/splaytree/package.json +36 -68
  314. package/node_modules/splaytree/src/index.ts +16 -4
  315. package/node_modules/tinyqueue/package.json +34 -59
  316. package/node_modules/topojson-client/package.json +28 -56
  317. package/node_modules/topojson-server/package.json +27 -55
  318. package/node_modules/turf-jsts/package.json +33 -68
  319. package/node_modules/uuid/CHANGELOG.md +39 -0
  320. package/node_modules/uuid/README.md +30 -73
  321. package/node_modules/uuid/dist/commonjs-browser/index.js +79 -0
  322. package/node_modules/uuid/dist/commonjs-browser/md5.js +223 -0
  323. package/node_modules/uuid/dist/commonjs-browser/native.js +11 -0
  324. package/node_modules/uuid/dist/commonjs-browser/nil.js +8 -0
  325. package/node_modules/uuid/dist/commonjs-browser/parse.js +45 -0
  326. package/node_modules/uuid/dist/commonjs-browser/regex.js +8 -0
  327. package/node_modules/uuid/dist/commonjs-browser/rng.js +25 -0
  328. package/node_modules/uuid/dist/commonjs-browser/sha1.js +104 -0
  329. package/node_modules/uuid/dist/commonjs-browser/stringify.js +44 -0
  330. package/node_modules/uuid/dist/commonjs-browser/v1.js +107 -0
  331. package/node_modules/uuid/dist/commonjs-browser/v3.js +16 -0
  332. package/node_modules/uuid/dist/commonjs-browser/v35.js +80 -0
  333. package/node_modules/uuid/dist/commonjs-browser/v4.js +43 -0
  334. package/node_modules/uuid/dist/commonjs-browser/v5.js +16 -0
  335. package/node_modules/uuid/dist/commonjs-browser/validate.js +17 -0
  336. package/node_modules/uuid/dist/commonjs-browser/version.js +21 -0
  337. package/node_modules/uuid/dist/esm-browser/md5.js +23 -23
  338. package/node_modules/uuid/dist/esm-browser/native.js +4 -0
  339. package/node_modules/uuid/dist/esm-browser/parse.js +2 -2
  340. package/node_modules/uuid/dist/esm-browser/rng.js +4 -5
  341. package/node_modules/uuid/dist/esm-browser/sha1.js +26 -26
  342. package/node_modules/uuid/dist/esm-browser/stringify.js +9 -6
  343. package/node_modules/uuid/dist/esm-browser/v1.js +17 -17
  344. package/node_modules/uuid/dist/esm-browser/v3.js +1 -1
  345. package/node_modules/uuid/dist/esm-browser/v35.js +12 -10
  346. package/node_modules/uuid/dist/esm-browser/v4.js +9 -4
  347. package/node_modules/uuid/dist/esm-browser/v5.js +1 -1
  348. package/node_modules/uuid/dist/esm-browser/version.js +1 -1
  349. package/node_modules/uuid/dist/esm-node/native.js +4 -0
  350. package/node_modules/uuid/dist/esm-node/stringify.js +7 -3
  351. package/node_modules/uuid/dist/esm-node/v1.js +2 -2
  352. package/node_modules/uuid/dist/esm-node/v35.js +6 -4
  353. package/node_modules/uuid/dist/esm-node/v4.js +7 -2
  354. package/node_modules/uuid/dist/esm-node/version.js +1 -1
  355. package/node_modules/uuid/dist/index.js +18 -18
  356. package/node_modules/uuid/dist/native-browser.js +11 -0
  357. package/node_modules/uuid/dist/native.js +15 -0
  358. package/node_modules/uuid/dist/rng-browser.js +2 -3
  359. package/node_modules/uuid/dist/stringify.js +8 -3
  360. package/node_modules/uuid/dist/v1.js +2 -2
  361. package/node_modules/uuid/dist/v35.js +7 -5
  362. package/node_modules/uuid/dist/v4.js +8 -2
  363. package/node_modules/uuid/dist/version.js +1 -1
  364. package/node_modules/uuid/package.json +87 -120
  365. package/package.json +12 -8
  366. package/tak-ingest.html +40 -0
  367. package/tak-ingest.js +48 -0
  368. package/tak-registration.html +13 -2
  369. package/tak-registration.js +55 -7
  370. package/node_modules/@turf/collect/node_modules/quickselect/package.json +0 -69
  371. package/node_modules/@turf/collect/node_modules/rbush/package.json +0 -85
  372. package/node_modules/@turf/collect/node_modules/rbush/rbush.js +0 -626
  373. package/node_modules/@turf/collect/node_modules/rbush/rbush.min.js +0 -1
  374. package/node_modules/@turf/unkink-polygon/node_modules/quickselect/package.json +0 -69
  375. package/node_modules/@turf/unkink-polygon/node_modules/rbush/package.json +0 -85
  376. package/node_modules/@turf/unkink-polygon/node_modules/rbush/rbush.js +0 -626
  377. package/node_modules/@turf/unkink-polygon/node_modules/rbush/rbush.min.js +0 -1
  378. package/node_modules/axios/UPGRADE_GUIDE.md +0 -168
  379. package/node_modules/axios/dist/axios.map +0 -1
  380. package/node_modules/axios/dist/axios.min.map +0 -1
  381. package/node_modules/axios/lib/cancel/Cancel.js +0 -19
  382. package/node_modules/axios/lib/core/createError.js +0 -18
  383. package/node_modules/axios/lib/core/enhanceError.js +0 -43
  384. package/node_modules/axios/lib/helpers/normalizeHeaderName.js +0 -12
  385. package/node_modules/axios/tsconfig.json +0 -14
  386. package/node_modules/axios/tslint.json +0 -6
  387. package/node_modules/combined-stream/yarn.lock +0 -17
  388. package/node_modules/d3-array/yarn.lock +0 -939
  389. package/node_modules/define-properties/.jscs.json +0 -175
  390. package/node_modules/define-properties/.travis.yml +0 -233
  391. package/node_modules/define-properties/test/index.js +0 -125
  392. package/node_modules/get-intrinsic/.eslintignore +0 -1
  393. package/node_modules/uuid/dist/umd/uuid.min.js +0 -1
  394. package/node_modules/uuid/dist/umd/uuidNIL.min.js +0 -1
  395. package/node_modules/uuid/dist/umd/uuidParse.min.js +0 -1
  396. package/node_modules/uuid/dist/umd/uuidStringify.min.js +0 -1
  397. package/node_modules/uuid/dist/umd/uuidValidate.min.js +0 -1
  398. package/node_modules/uuid/dist/umd/uuidVersion.min.js +0 -1
  399. package/node_modules/uuid/dist/umd/uuidv1.min.js +0 -1
  400. package/node_modules/uuid/dist/umd/uuidv3.min.js +0 -1
  401. package/node_modules/uuid/dist/umd/uuidv4.min.js +0 -1
  402. package/node_modules/uuid/dist/umd/uuidv5.min.js +0 -1
  403. /package/node_modules/{@turf/collect → concaveman}/node_modules/quickselect/LICENSE +0 -0
  404. /package/node_modules/{@turf/collect → concaveman}/node_modules/quickselect/README.md +0 -0
  405. /package/node_modules/{@turf/collect → concaveman}/node_modules/quickselect/index.js +0 -0
  406. /package/node_modules/{@turf/collect → concaveman}/node_modules/quickselect/quickselect.js +0 -0
  407. /package/node_modules/{@turf/collect → concaveman}/node_modules/rbush/LICENSE +0 -0
  408. /package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/quickselect/LICENSE +0 -0
  409. /package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/quickselect/README.md +0 -0
  410. /package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/quickselect/index.js +0 -0
  411. /package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/quickselect/quickselect.js +0 -0
  412. /package/node_modules/{@turf/unkink-polygon → geojson-rbush}/node_modules/rbush/LICENSE +0 -0
@@ -0,0 +1,4237 @@
1
+ // Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
2
+ 'use strict';
3
+
4
+ const FormData$1 = require('form-data');
5
+ const url = require('url');
6
+ const proxyFromEnv = require('proxy-from-env');
7
+ const http = require('http');
8
+ const https = require('https');
9
+ const util = require('util');
10
+ const followRedirects = require('follow-redirects');
11
+ const zlib = require('zlib');
12
+ const stream = require('stream');
13
+ const EventEmitter = require('events');
14
+
15
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
+
17
+ const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1);
18
+ const url__default = /*#__PURE__*/_interopDefaultLegacy(url);
19
+ const http__default = /*#__PURE__*/_interopDefaultLegacy(http);
20
+ const https__default = /*#__PURE__*/_interopDefaultLegacy(https);
21
+ const util__default = /*#__PURE__*/_interopDefaultLegacy(util);
22
+ const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects);
23
+ const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib);
24
+ const stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
25
+ const EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
26
+
27
+ function bind(fn, thisArg) {
28
+ return function wrap() {
29
+ return fn.apply(thisArg, arguments);
30
+ };
31
+ }
32
+
33
+ // utils is a library of generic helper functions non-specific to axios
34
+
35
+ const {toString} = Object.prototype;
36
+ const {getPrototypeOf} = Object;
37
+
38
+ const kindOf = (cache => thing => {
39
+ const str = toString.call(thing);
40
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
41
+ })(Object.create(null));
42
+
43
+ const kindOfTest = (type) => {
44
+ type = type.toLowerCase();
45
+ return (thing) => kindOf(thing) === type
46
+ };
47
+
48
+ const typeOfTest = type => thing => typeof thing === type;
49
+
50
+ /**
51
+ * Determine if a value is an Array
52
+ *
53
+ * @param {Object} val The value to test
54
+ *
55
+ * @returns {boolean} True if value is an Array, otherwise false
56
+ */
57
+ const {isArray} = Array;
58
+
59
+ /**
60
+ * Determine if a value is undefined
61
+ *
62
+ * @param {*} val The value to test
63
+ *
64
+ * @returns {boolean} True if the value is undefined, otherwise false
65
+ */
66
+ const isUndefined = typeOfTest('undefined');
67
+
68
+ /**
69
+ * Determine if a value is a Buffer
70
+ *
71
+ * @param {*} val The value to test
72
+ *
73
+ * @returns {boolean} True if value is a Buffer, otherwise false
74
+ */
75
+ function isBuffer(val) {
76
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
77
+ && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
78
+ }
79
+
80
+ /**
81
+ * Determine if a value is an ArrayBuffer
82
+ *
83
+ * @param {*} val The value to test
84
+ *
85
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
86
+ */
87
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
88
+
89
+
90
+ /**
91
+ * Determine if a value is a view on an ArrayBuffer
92
+ *
93
+ * @param {*} val The value to test
94
+ *
95
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
96
+ */
97
+ function isArrayBufferView(val) {
98
+ let result;
99
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
100
+ result = ArrayBuffer.isView(val);
101
+ } else {
102
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
103
+ }
104
+ return result;
105
+ }
106
+
107
+ /**
108
+ * Determine if a value is a String
109
+ *
110
+ * @param {*} val The value to test
111
+ *
112
+ * @returns {boolean} True if value is a String, otherwise false
113
+ */
114
+ const isString = typeOfTest('string');
115
+
116
+ /**
117
+ * Determine if a value is a Function
118
+ *
119
+ * @param {*} val The value to test
120
+ * @returns {boolean} True if value is a Function, otherwise false
121
+ */
122
+ const isFunction = typeOfTest('function');
123
+
124
+ /**
125
+ * Determine if a value is a Number
126
+ *
127
+ * @param {*} val The value to test
128
+ *
129
+ * @returns {boolean} True if value is a Number, otherwise false
130
+ */
131
+ const isNumber = typeOfTest('number');
132
+
133
+ /**
134
+ * Determine if a value is an Object
135
+ *
136
+ * @param {*} thing The value to test
137
+ *
138
+ * @returns {boolean} True if value is an Object, otherwise false
139
+ */
140
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
141
+
142
+ /**
143
+ * Determine if a value is a Boolean
144
+ *
145
+ * @param {*} thing The value to test
146
+ * @returns {boolean} True if value is a Boolean, otherwise false
147
+ */
148
+ const isBoolean = thing => thing === true || thing === false;
149
+
150
+ /**
151
+ * Determine if a value is a plain Object
152
+ *
153
+ * @param {*} val The value to test
154
+ *
155
+ * @returns {boolean} True if value is a plain Object, otherwise false
156
+ */
157
+ const isPlainObject = (val) => {
158
+ if (kindOf(val) !== 'object') {
159
+ return false;
160
+ }
161
+
162
+ const prototype = getPrototypeOf(val);
163
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
164
+ };
165
+
166
+ /**
167
+ * Determine if a value is a Date
168
+ *
169
+ * @param {*} val The value to test
170
+ *
171
+ * @returns {boolean} True if value is a Date, otherwise false
172
+ */
173
+ const isDate = kindOfTest('Date');
174
+
175
+ /**
176
+ * Determine if a value is a File
177
+ *
178
+ * @param {*} val The value to test
179
+ *
180
+ * @returns {boolean} True if value is a File, otherwise false
181
+ */
182
+ const isFile = kindOfTest('File');
183
+
184
+ /**
185
+ * Determine if a value is a Blob
186
+ *
187
+ * @param {*} val The value to test
188
+ *
189
+ * @returns {boolean} True if value is a Blob, otherwise false
190
+ */
191
+ const isBlob = kindOfTest('Blob');
192
+
193
+ /**
194
+ * Determine if a value is a FileList
195
+ *
196
+ * @param {*} val The value to test
197
+ *
198
+ * @returns {boolean} True if value is a File, otherwise false
199
+ */
200
+ const isFileList = kindOfTest('FileList');
201
+
202
+ /**
203
+ * Determine if a value is a Stream
204
+ *
205
+ * @param {*} val The value to test
206
+ *
207
+ * @returns {boolean} True if value is a Stream, otherwise false
208
+ */
209
+ const isStream = (val) => isObject(val) && isFunction(val.pipe);
210
+
211
+ /**
212
+ * Determine if a value is a FormData
213
+ *
214
+ * @param {*} thing The value to test
215
+ *
216
+ * @returns {boolean} True if value is an FormData, otherwise false
217
+ */
218
+ const isFormData = (thing) => {
219
+ let kind;
220
+ return thing && (
221
+ (typeof FormData === 'function' && thing instanceof FormData) || (
222
+ isFunction(thing.append) && (
223
+ (kind = kindOf(thing)) === 'formdata' ||
224
+ // detect form-data instance
225
+ (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
226
+ )
227
+ )
228
+ )
229
+ };
230
+
231
+ /**
232
+ * Determine if a value is a URLSearchParams object
233
+ *
234
+ * @param {*} val The value to test
235
+ *
236
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
237
+ */
238
+ const isURLSearchParams = kindOfTest('URLSearchParams');
239
+
240
+ /**
241
+ * Trim excess whitespace off the beginning and end of a string
242
+ *
243
+ * @param {String} str The String to trim
244
+ *
245
+ * @returns {String} The String freed of excess whitespace
246
+ */
247
+ const trim = (str) => str.trim ?
248
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
249
+
250
+ /**
251
+ * Iterate over an Array or an Object invoking a function for each item.
252
+ *
253
+ * If `obj` is an Array callback will be called passing
254
+ * the value, index, and complete array for each item.
255
+ *
256
+ * If 'obj' is an Object callback will be called passing
257
+ * the value, key, and complete object for each property.
258
+ *
259
+ * @param {Object|Array} obj The object to iterate
260
+ * @param {Function} fn The callback to invoke for each item
261
+ *
262
+ * @param {Boolean} [allOwnKeys = false]
263
+ * @returns {any}
264
+ */
265
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
266
+ // Don't bother if no value provided
267
+ if (obj === null || typeof obj === 'undefined') {
268
+ return;
269
+ }
270
+
271
+ let i;
272
+ let l;
273
+
274
+ // Force an array if not already something iterable
275
+ if (typeof obj !== 'object') {
276
+ /*eslint no-param-reassign:0*/
277
+ obj = [obj];
278
+ }
279
+
280
+ if (isArray(obj)) {
281
+ // Iterate over array values
282
+ for (i = 0, l = obj.length; i < l; i++) {
283
+ fn.call(null, obj[i], i, obj);
284
+ }
285
+ } else {
286
+ // Iterate over object keys
287
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
288
+ const len = keys.length;
289
+ let key;
290
+
291
+ for (i = 0; i < len; i++) {
292
+ key = keys[i];
293
+ fn.call(null, obj[key], key, obj);
294
+ }
295
+ }
296
+ }
297
+
298
+ function findKey(obj, key) {
299
+ key = key.toLowerCase();
300
+ const keys = Object.keys(obj);
301
+ let i = keys.length;
302
+ let _key;
303
+ while (i-- > 0) {
304
+ _key = keys[i];
305
+ if (key === _key.toLowerCase()) {
306
+ return _key;
307
+ }
308
+ }
309
+ return null;
310
+ }
311
+
312
+ const _global = (() => {
313
+ /*eslint no-undef:0*/
314
+ if (typeof globalThis !== "undefined") return globalThis;
315
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
316
+ })();
317
+
318
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
319
+
320
+ /**
321
+ * Accepts varargs expecting each argument to be an object, then
322
+ * immutably merges the properties of each object and returns result.
323
+ *
324
+ * When multiple objects contain the same key the later object in
325
+ * the arguments list will take precedence.
326
+ *
327
+ * Example:
328
+ *
329
+ * ```js
330
+ * var result = merge({foo: 123}, {foo: 456});
331
+ * console.log(result.foo); // outputs 456
332
+ * ```
333
+ *
334
+ * @param {Object} obj1 Object to merge
335
+ *
336
+ * @returns {Object} Result of all merge properties
337
+ */
338
+ function merge(/* obj1, obj2, obj3, ... */) {
339
+ const {caseless} = isContextDefined(this) && this || {};
340
+ const result = {};
341
+ const assignValue = (val, key) => {
342
+ const targetKey = caseless && findKey(result, key) || key;
343
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
344
+ result[targetKey] = merge(result[targetKey], val);
345
+ } else if (isPlainObject(val)) {
346
+ result[targetKey] = merge({}, val);
347
+ } else if (isArray(val)) {
348
+ result[targetKey] = val.slice();
349
+ } else {
350
+ result[targetKey] = val;
351
+ }
352
+ };
353
+
354
+ for (let i = 0, l = arguments.length; i < l; i++) {
355
+ arguments[i] && forEach(arguments[i], assignValue);
356
+ }
357
+ return result;
358
+ }
359
+
360
+ /**
361
+ * Extends object a by mutably adding to it the properties of object b.
362
+ *
363
+ * @param {Object} a The object to be extended
364
+ * @param {Object} b The object to copy properties from
365
+ * @param {Object} thisArg The object to bind function to
366
+ *
367
+ * @param {Boolean} [allOwnKeys]
368
+ * @returns {Object} The resulting value of object a
369
+ */
370
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
371
+ forEach(b, (val, key) => {
372
+ if (thisArg && isFunction(val)) {
373
+ a[key] = bind(val, thisArg);
374
+ } else {
375
+ a[key] = val;
376
+ }
377
+ }, {allOwnKeys});
378
+ return a;
379
+ };
380
+
381
+ /**
382
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
383
+ *
384
+ * @param {string} content with BOM
385
+ *
386
+ * @returns {string} content value without BOM
387
+ */
388
+ const stripBOM = (content) => {
389
+ if (content.charCodeAt(0) === 0xFEFF) {
390
+ content = content.slice(1);
391
+ }
392
+ return content;
393
+ };
394
+
395
+ /**
396
+ * Inherit the prototype methods from one constructor into another
397
+ * @param {function} constructor
398
+ * @param {function} superConstructor
399
+ * @param {object} [props]
400
+ * @param {object} [descriptors]
401
+ *
402
+ * @returns {void}
403
+ */
404
+ const inherits = (constructor, superConstructor, props, descriptors) => {
405
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
406
+ constructor.prototype.constructor = constructor;
407
+ Object.defineProperty(constructor, 'super', {
408
+ value: superConstructor.prototype
409
+ });
410
+ props && Object.assign(constructor.prototype, props);
411
+ };
412
+
413
+ /**
414
+ * Resolve object with deep prototype chain to a flat object
415
+ * @param {Object} sourceObj source object
416
+ * @param {Object} [destObj]
417
+ * @param {Function|Boolean} [filter]
418
+ * @param {Function} [propFilter]
419
+ *
420
+ * @returns {Object}
421
+ */
422
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
423
+ let props;
424
+ let i;
425
+ let prop;
426
+ const merged = {};
427
+
428
+ destObj = destObj || {};
429
+ // eslint-disable-next-line no-eq-null,eqeqeq
430
+ if (sourceObj == null) return destObj;
431
+
432
+ do {
433
+ props = Object.getOwnPropertyNames(sourceObj);
434
+ i = props.length;
435
+ while (i-- > 0) {
436
+ prop = props[i];
437
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
438
+ destObj[prop] = sourceObj[prop];
439
+ merged[prop] = true;
440
+ }
441
+ }
442
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
443
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
444
+
445
+ return destObj;
446
+ };
447
+
448
+ /**
449
+ * Determines whether a string ends with the characters of a specified string
450
+ *
451
+ * @param {String} str
452
+ * @param {String} searchString
453
+ * @param {Number} [position= 0]
454
+ *
455
+ * @returns {boolean}
456
+ */
457
+ const endsWith = (str, searchString, position) => {
458
+ str = String(str);
459
+ if (position === undefined || position > str.length) {
460
+ position = str.length;
461
+ }
462
+ position -= searchString.length;
463
+ const lastIndex = str.indexOf(searchString, position);
464
+ return lastIndex !== -1 && lastIndex === position;
465
+ };
466
+
467
+
468
+ /**
469
+ * Returns new array from array like object or null if failed
470
+ *
471
+ * @param {*} [thing]
472
+ *
473
+ * @returns {?Array}
474
+ */
475
+ const toArray = (thing) => {
476
+ if (!thing) return null;
477
+ if (isArray(thing)) return thing;
478
+ let i = thing.length;
479
+ if (!isNumber(i)) return null;
480
+ const arr = new Array(i);
481
+ while (i-- > 0) {
482
+ arr[i] = thing[i];
483
+ }
484
+ return arr;
485
+ };
486
+
487
+ /**
488
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
489
+ * thing passed in is an instance of Uint8Array
490
+ *
491
+ * @param {TypedArray}
492
+ *
493
+ * @returns {Array}
494
+ */
495
+ // eslint-disable-next-line func-names
496
+ const isTypedArray = (TypedArray => {
497
+ // eslint-disable-next-line func-names
498
+ return thing => {
499
+ return TypedArray && thing instanceof TypedArray;
500
+ };
501
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
502
+
503
+ /**
504
+ * For each entry in the object, call the function with the key and value.
505
+ *
506
+ * @param {Object<any, any>} obj - The object to iterate over.
507
+ * @param {Function} fn - The function to call for each entry.
508
+ *
509
+ * @returns {void}
510
+ */
511
+ const forEachEntry = (obj, fn) => {
512
+ const generator = obj && obj[Symbol.iterator];
513
+
514
+ const iterator = generator.call(obj);
515
+
516
+ let result;
517
+
518
+ while ((result = iterator.next()) && !result.done) {
519
+ const pair = result.value;
520
+ fn.call(obj, pair[0], pair[1]);
521
+ }
522
+ };
523
+
524
+ /**
525
+ * It takes a regular expression and a string, and returns an array of all the matches
526
+ *
527
+ * @param {string} regExp - The regular expression to match against.
528
+ * @param {string} str - The string to search.
529
+ *
530
+ * @returns {Array<boolean>}
531
+ */
532
+ const matchAll = (regExp, str) => {
533
+ let matches;
534
+ const arr = [];
535
+
536
+ while ((matches = regExp.exec(str)) !== null) {
537
+ arr.push(matches);
538
+ }
539
+
540
+ return arr;
541
+ };
542
+
543
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
544
+ const isHTMLForm = kindOfTest('HTMLFormElement');
545
+
546
+ const toCamelCase = str => {
547
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
548
+ function replacer(m, p1, p2) {
549
+ return p1.toUpperCase() + p2;
550
+ }
551
+ );
552
+ };
553
+
554
+ /* Creating a function that will check if an object has a property. */
555
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
556
+
557
+ /**
558
+ * Determine if a value is a RegExp object
559
+ *
560
+ * @param {*} val The value to test
561
+ *
562
+ * @returns {boolean} True if value is a RegExp object, otherwise false
563
+ */
564
+ const isRegExp = kindOfTest('RegExp');
565
+
566
+ const reduceDescriptors = (obj, reducer) => {
567
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
568
+ const reducedDescriptors = {};
569
+
570
+ forEach(descriptors, (descriptor, name) => {
571
+ if (reducer(descriptor, name, obj) !== false) {
572
+ reducedDescriptors[name] = descriptor;
573
+ }
574
+ });
575
+
576
+ Object.defineProperties(obj, reducedDescriptors);
577
+ };
578
+
579
+ /**
580
+ * Makes all methods read-only
581
+ * @param {Object} obj
582
+ */
583
+
584
+ const freezeMethods = (obj) => {
585
+ reduceDescriptors(obj, (descriptor, name) => {
586
+ // skip restricted props in strict mode
587
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
588
+ return false;
589
+ }
590
+
591
+ const value = obj[name];
592
+
593
+ if (!isFunction(value)) return;
594
+
595
+ descriptor.enumerable = false;
596
+
597
+ if ('writable' in descriptor) {
598
+ descriptor.writable = false;
599
+ return;
600
+ }
601
+
602
+ if (!descriptor.set) {
603
+ descriptor.set = () => {
604
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
605
+ };
606
+ }
607
+ });
608
+ };
609
+
610
+ const toObjectSet = (arrayOrString, delimiter) => {
611
+ const obj = {};
612
+
613
+ const define = (arr) => {
614
+ arr.forEach(value => {
615
+ obj[value] = true;
616
+ });
617
+ };
618
+
619
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
620
+
621
+ return obj;
622
+ };
623
+
624
+ const noop = () => {};
625
+
626
+ const toFiniteNumber = (value, defaultValue) => {
627
+ value = +value;
628
+ return Number.isFinite(value) ? value : defaultValue;
629
+ };
630
+
631
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
632
+
633
+ const DIGIT = '0123456789';
634
+
635
+ const ALPHABET = {
636
+ DIGIT,
637
+ ALPHA,
638
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
639
+ };
640
+
641
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
642
+ let str = '';
643
+ const {length} = alphabet;
644
+ while (size--) {
645
+ str += alphabet[Math.random() * length|0];
646
+ }
647
+
648
+ return str;
649
+ };
650
+
651
+ /**
652
+ * If the thing is a FormData object, return true, otherwise return false.
653
+ *
654
+ * @param {unknown} thing - The thing to check.
655
+ *
656
+ * @returns {boolean}
657
+ */
658
+ function isSpecCompliantForm(thing) {
659
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
660
+ }
661
+
662
+ const toJSONObject = (obj) => {
663
+ const stack = new Array(10);
664
+
665
+ const visit = (source, i) => {
666
+
667
+ if (isObject(source)) {
668
+ if (stack.indexOf(source) >= 0) {
669
+ return;
670
+ }
671
+
672
+ if(!('toJSON' in source)) {
673
+ stack[i] = source;
674
+ const target = isArray(source) ? [] : {};
675
+
676
+ forEach(source, (value, key) => {
677
+ const reducedValue = visit(value, i + 1);
678
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
679
+ });
680
+
681
+ stack[i] = undefined;
682
+
683
+ return target;
684
+ }
685
+ }
686
+
687
+ return source;
688
+ };
689
+
690
+ return visit(obj, 0);
691
+ };
692
+
693
+ const isAsyncFn = kindOfTest('AsyncFunction');
694
+
695
+ const isThenable = (thing) =>
696
+ thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
697
+
698
+ const utils = {
699
+ isArray,
700
+ isArrayBuffer,
701
+ isBuffer,
702
+ isFormData,
703
+ isArrayBufferView,
704
+ isString,
705
+ isNumber,
706
+ isBoolean,
707
+ isObject,
708
+ isPlainObject,
709
+ isUndefined,
710
+ isDate,
711
+ isFile,
712
+ isBlob,
713
+ isRegExp,
714
+ isFunction,
715
+ isStream,
716
+ isURLSearchParams,
717
+ isTypedArray,
718
+ isFileList,
719
+ forEach,
720
+ merge,
721
+ extend,
722
+ trim,
723
+ stripBOM,
724
+ inherits,
725
+ toFlatObject,
726
+ kindOf,
727
+ kindOfTest,
728
+ endsWith,
729
+ toArray,
730
+ forEachEntry,
731
+ matchAll,
732
+ isHTMLForm,
733
+ hasOwnProperty,
734
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
735
+ reduceDescriptors,
736
+ freezeMethods,
737
+ toObjectSet,
738
+ toCamelCase,
739
+ noop,
740
+ toFiniteNumber,
741
+ findKey,
742
+ global: _global,
743
+ isContextDefined,
744
+ ALPHABET,
745
+ generateString,
746
+ isSpecCompliantForm,
747
+ toJSONObject,
748
+ isAsyncFn,
749
+ isThenable
750
+ };
751
+
752
+ /**
753
+ * Create an Error with the specified message, config, error code, request and response.
754
+ *
755
+ * @param {string} message The error message.
756
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
757
+ * @param {Object} [config] The config.
758
+ * @param {Object} [request] The request.
759
+ * @param {Object} [response] The response.
760
+ *
761
+ * @returns {Error} The created error.
762
+ */
763
+ function AxiosError(message, code, config, request, response) {
764
+ Error.call(this);
765
+
766
+ if (Error.captureStackTrace) {
767
+ Error.captureStackTrace(this, this.constructor);
768
+ } else {
769
+ this.stack = (new Error()).stack;
770
+ }
771
+
772
+ this.message = message;
773
+ this.name = 'AxiosError';
774
+ code && (this.code = code);
775
+ config && (this.config = config);
776
+ request && (this.request = request);
777
+ response && (this.response = response);
778
+ }
779
+
780
+ utils.inherits(AxiosError, Error, {
781
+ toJSON: function toJSON() {
782
+ return {
783
+ // Standard
784
+ message: this.message,
785
+ name: this.name,
786
+ // Microsoft
787
+ description: this.description,
788
+ number: this.number,
789
+ // Mozilla
790
+ fileName: this.fileName,
791
+ lineNumber: this.lineNumber,
792
+ columnNumber: this.columnNumber,
793
+ stack: this.stack,
794
+ // Axios
795
+ config: utils.toJSONObject(this.config),
796
+ code: this.code,
797
+ status: this.response && this.response.status ? this.response.status : null
798
+ };
799
+ }
800
+ });
801
+
802
+ const prototype$1 = AxiosError.prototype;
803
+ const descriptors = {};
804
+
805
+ [
806
+ 'ERR_BAD_OPTION_VALUE',
807
+ 'ERR_BAD_OPTION',
808
+ 'ECONNABORTED',
809
+ 'ETIMEDOUT',
810
+ 'ERR_NETWORK',
811
+ 'ERR_FR_TOO_MANY_REDIRECTS',
812
+ 'ERR_DEPRECATED',
813
+ 'ERR_BAD_RESPONSE',
814
+ 'ERR_BAD_REQUEST',
815
+ 'ERR_CANCELED',
816
+ 'ERR_NOT_SUPPORT',
817
+ 'ERR_INVALID_URL'
818
+ // eslint-disable-next-line func-names
819
+ ].forEach(code => {
820
+ descriptors[code] = {value: code};
821
+ });
822
+
823
+ Object.defineProperties(AxiosError, descriptors);
824
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
825
+
826
+ // eslint-disable-next-line func-names
827
+ AxiosError.from = (error, code, config, request, response, customProps) => {
828
+ const axiosError = Object.create(prototype$1);
829
+
830
+ utils.toFlatObject(error, axiosError, function filter(obj) {
831
+ return obj !== Error.prototype;
832
+ }, prop => {
833
+ return prop !== 'isAxiosError';
834
+ });
835
+
836
+ AxiosError.call(axiosError, error.message, code, config, request, response);
837
+
838
+ axiosError.cause = error;
839
+
840
+ axiosError.name = error.name;
841
+
842
+ customProps && Object.assign(axiosError, customProps);
843
+
844
+ return axiosError;
845
+ };
846
+
847
+ /**
848
+ * Determines if the given thing is a array or js object.
849
+ *
850
+ * @param {string} thing - The object or array to be visited.
851
+ *
852
+ * @returns {boolean}
853
+ */
854
+ function isVisitable(thing) {
855
+ return utils.isPlainObject(thing) || utils.isArray(thing);
856
+ }
857
+
858
+ /**
859
+ * It removes the brackets from the end of a string
860
+ *
861
+ * @param {string} key - The key of the parameter.
862
+ *
863
+ * @returns {string} the key without the brackets.
864
+ */
865
+ function removeBrackets(key) {
866
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
867
+ }
868
+
869
+ /**
870
+ * It takes a path, a key, and a boolean, and returns a string
871
+ *
872
+ * @param {string} path - The path to the current key.
873
+ * @param {string} key - The key of the current object being iterated over.
874
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
875
+ *
876
+ * @returns {string} The path to the current key.
877
+ */
878
+ function renderKey(path, key, dots) {
879
+ if (!path) return key;
880
+ return path.concat(key).map(function each(token, i) {
881
+ // eslint-disable-next-line no-param-reassign
882
+ token = removeBrackets(token);
883
+ return !dots && i ? '[' + token + ']' : token;
884
+ }).join(dots ? '.' : '');
885
+ }
886
+
887
+ /**
888
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
889
+ *
890
+ * @param {Array<any>} arr - The array to check
891
+ *
892
+ * @returns {boolean}
893
+ */
894
+ function isFlatArray(arr) {
895
+ return utils.isArray(arr) && !arr.some(isVisitable);
896
+ }
897
+
898
+ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
899
+ return /^is[A-Z]/.test(prop);
900
+ });
901
+
902
+ /**
903
+ * Convert a data object to FormData
904
+ *
905
+ * @param {Object} obj
906
+ * @param {?Object} [formData]
907
+ * @param {?Object} [options]
908
+ * @param {Function} [options.visitor]
909
+ * @param {Boolean} [options.metaTokens = true]
910
+ * @param {Boolean} [options.dots = false]
911
+ * @param {?Boolean} [options.indexes = false]
912
+ *
913
+ * @returns {Object}
914
+ **/
915
+
916
+ /**
917
+ * It converts an object into a FormData object
918
+ *
919
+ * @param {Object<any, any>} obj - The object to convert to form data.
920
+ * @param {string} formData - The FormData object to append to.
921
+ * @param {Object<string, any>} options
922
+ *
923
+ * @returns
924
+ */
925
+ function toFormData(obj, formData, options) {
926
+ if (!utils.isObject(obj)) {
927
+ throw new TypeError('target must be an object');
928
+ }
929
+
930
+ // eslint-disable-next-line no-param-reassign
931
+ formData = formData || new (FormData__default["default"] || FormData)();
932
+
933
+ // eslint-disable-next-line no-param-reassign
934
+ options = utils.toFlatObject(options, {
935
+ metaTokens: true,
936
+ dots: false,
937
+ indexes: false
938
+ }, false, function defined(option, source) {
939
+ // eslint-disable-next-line no-eq-null,eqeqeq
940
+ return !utils.isUndefined(source[option]);
941
+ });
942
+
943
+ const metaTokens = options.metaTokens;
944
+ // eslint-disable-next-line no-use-before-define
945
+ const visitor = options.visitor || defaultVisitor;
946
+ const dots = options.dots;
947
+ const indexes = options.indexes;
948
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
949
+ const useBlob = _Blob && utils.isSpecCompliantForm(formData);
950
+
951
+ if (!utils.isFunction(visitor)) {
952
+ throw new TypeError('visitor must be a function');
953
+ }
954
+
955
+ function convertValue(value) {
956
+ if (value === null) return '';
957
+
958
+ if (utils.isDate(value)) {
959
+ return value.toISOString();
960
+ }
961
+
962
+ if (!useBlob && utils.isBlob(value)) {
963
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
964
+ }
965
+
966
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
967
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
968
+ }
969
+
970
+ return value;
971
+ }
972
+
973
+ /**
974
+ * Default visitor.
975
+ *
976
+ * @param {*} value
977
+ * @param {String|Number} key
978
+ * @param {Array<String|Number>} path
979
+ * @this {FormData}
980
+ *
981
+ * @returns {boolean} return true to visit the each prop of the value recursively
982
+ */
983
+ function defaultVisitor(value, key, path) {
984
+ let arr = value;
985
+
986
+ if (value && !path && typeof value === 'object') {
987
+ if (utils.endsWith(key, '{}')) {
988
+ // eslint-disable-next-line no-param-reassign
989
+ key = metaTokens ? key : key.slice(0, -2);
990
+ // eslint-disable-next-line no-param-reassign
991
+ value = JSON.stringify(value);
992
+ } else if (
993
+ (utils.isArray(value) && isFlatArray(value)) ||
994
+ ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
995
+ )) {
996
+ // eslint-disable-next-line no-param-reassign
997
+ key = removeBrackets(key);
998
+
999
+ arr.forEach(function each(el, index) {
1000
+ !(utils.isUndefined(el) || el === null) && formData.append(
1001
+ // eslint-disable-next-line no-nested-ternary
1002
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1003
+ convertValue(el)
1004
+ );
1005
+ });
1006
+ return false;
1007
+ }
1008
+ }
1009
+
1010
+ if (isVisitable(value)) {
1011
+ return true;
1012
+ }
1013
+
1014
+ formData.append(renderKey(path, key, dots), convertValue(value));
1015
+
1016
+ return false;
1017
+ }
1018
+
1019
+ const stack = [];
1020
+
1021
+ const exposedHelpers = Object.assign(predicates, {
1022
+ defaultVisitor,
1023
+ convertValue,
1024
+ isVisitable
1025
+ });
1026
+
1027
+ function build(value, path) {
1028
+ if (utils.isUndefined(value)) return;
1029
+
1030
+ if (stack.indexOf(value) !== -1) {
1031
+ throw Error('Circular reference detected in ' + path.join('.'));
1032
+ }
1033
+
1034
+ stack.push(value);
1035
+
1036
+ utils.forEach(value, function each(el, key) {
1037
+ const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1038
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1039
+ );
1040
+
1041
+ if (result === true) {
1042
+ build(el, path ? path.concat(key) : [key]);
1043
+ }
1044
+ });
1045
+
1046
+ stack.pop();
1047
+ }
1048
+
1049
+ if (!utils.isObject(obj)) {
1050
+ throw new TypeError('data must be an object');
1051
+ }
1052
+
1053
+ build(obj);
1054
+
1055
+ return formData;
1056
+ }
1057
+
1058
+ /**
1059
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1060
+ * their percent-encoded equivalents
1061
+ *
1062
+ * @param {string} str - The string to encode.
1063
+ *
1064
+ * @returns {string} The encoded string.
1065
+ */
1066
+ function encode$1(str) {
1067
+ const charMap = {
1068
+ '!': '%21',
1069
+ "'": '%27',
1070
+ '(': '%28',
1071
+ ')': '%29',
1072
+ '~': '%7E',
1073
+ '%20': '+',
1074
+ '%00': '\x00'
1075
+ };
1076
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1077
+ return charMap[match];
1078
+ });
1079
+ }
1080
+
1081
+ /**
1082
+ * It takes a params object and converts it to a FormData object
1083
+ *
1084
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1085
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1086
+ *
1087
+ * @returns {void}
1088
+ */
1089
+ function AxiosURLSearchParams(params, options) {
1090
+ this._pairs = [];
1091
+
1092
+ params && toFormData(params, this, options);
1093
+ }
1094
+
1095
+ const prototype = AxiosURLSearchParams.prototype;
1096
+
1097
+ prototype.append = function append(name, value) {
1098
+ this._pairs.push([name, value]);
1099
+ };
1100
+
1101
+ prototype.toString = function toString(encoder) {
1102
+ const _encode = encoder ? function(value) {
1103
+ return encoder.call(this, value, encode$1);
1104
+ } : encode$1;
1105
+
1106
+ return this._pairs.map(function each(pair) {
1107
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1108
+ }, '').join('&');
1109
+ };
1110
+
1111
+ /**
1112
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1113
+ * URI encoded counterparts
1114
+ *
1115
+ * @param {string} val The value to be encoded.
1116
+ *
1117
+ * @returns {string} The encoded value.
1118
+ */
1119
+ function encode(val) {
1120
+ return encodeURIComponent(val).
1121
+ replace(/%3A/gi, ':').
1122
+ replace(/%24/g, '$').
1123
+ replace(/%2C/gi, ',').
1124
+ replace(/%20/g, '+').
1125
+ replace(/%5B/gi, '[').
1126
+ replace(/%5D/gi, ']');
1127
+ }
1128
+
1129
+ /**
1130
+ * Build a URL by appending params to the end
1131
+ *
1132
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1133
+ * @param {object} [params] The params to be appended
1134
+ * @param {?object} options
1135
+ *
1136
+ * @returns {string} The formatted url
1137
+ */
1138
+ function buildURL(url, params, options) {
1139
+ /*eslint no-param-reassign:0*/
1140
+ if (!params) {
1141
+ return url;
1142
+ }
1143
+
1144
+ const _encode = options && options.encode || encode;
1145
+
1146
+ const serializeFn = options && options.serialize;
1147
+
1148
+ let serializedParams;
1149
+
1150
+ if (serializeFn) {
1151
+ serializedParams = serializeFn(params, options);
1152
+ } else {
1153
+ serializedParams = utils.isURLSearchParams(params) ?
1154
+ params.toString() :
1155
+ new AxiosURLSearchParams(params, options).toString(_encode);
1156
+ }
1157
+
1158
+ if (serializedParams) {
1159
+ const hashmarkIndex = url.indexOf("#");
1160
+
1161
+ if (hashmarkIndex !== -1) {
1162
+ url = url.slice(0, hashmarkIndex);
1163
+ }
1164
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1165
+ }
1166
+
1167
+ return url;
1168
+ }
1169
+
1170
+ class InterceptorManager {
1171
+ constructor() {
1172
+ this.handlers = [];
1173
+ }
1174
+
1175
+ /**
1176
+ * Add a new interceptor to the stack
1177
+ *
1178
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1179
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1180
+ *
1181
+ * @return {Number} An ID used to remove interceptor later
1182
+ */
1183
+ use(fulfilled, rejected, options) {
1184
+ this.handlers.push({
1185
+ fulfilled,
1186
+ rejected,
1187
+ synchronous: options ? options.synchronous : false,
1188
+ runWhen: options ? options.runWhen : null
1189
+ });
1190
+ return this.handlers.length - 1;
1191
+ }
1192
+
1193
+ /**
1194
+ * Remove an interceptor from the stack
1195
+ *
1196
+ * @param {Number} id The ID that was returned by `use`
1197
+ *
1198
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1199
+ */
1200
+ eject(id) {
1201
+ if (this.handlers[id]) {
1202
+ this.handlers[id] = null;
1203
+ }
1204
+ }
1205
+
1206
+ /**
1207
+ * Clear all interceptors from the stack
1208
+ *
1209
+ * @returns {void}
1210
+ */
1211
+ clear() {
1212
+ if (this.handlers) {
1213
+ this.handlers = [];
1214
+ }
1215
+ }
1216
+
1217
+ /**
1218
+ * Iterate over all the registered interceptors
1219
+ *
1220
+ * This method is particularly useful for skipping over any
1221
+ * interceptors that may have become `null` calling `eject`.
1222
+ *
1223
+ * @param {Function} fn The function to call for each interceptor
1224
+ *
1225
+ * @returns {void}
1226
+ */
1227
+ forEach(fn) {
1228
+ utils.forEach(this.handlers, function forEachHandler(h) {
1229
+ if (h !== null) {
1230
+ fn(h);
1231
+ }
1232
+ });
1233
+ }
1234
+ }
1235
+
1236
+ const InterceptorManager$1 = InterceptorManager;
1237
+
1238
+ const transitionalDefaults = {
1239
+ silentJSONParsing: true,
1240
+ forcedJSONParsing: true,
1241
+ clarifyTimeoutError: false
1242
+ };
1243
+
1244
+ const URLSearchParams = url__default["default"].URLSearchParams;
1245
+
1246
+ const platform = {
1247
+ isNode: true,
1248
+ classes: {
1249
+ URLSearchParams,
1250
+ FormData: FormData__default["default"],
1251
+ Blob: typeof Blob !== 'undefined' && Blob || null
1252
+ },
1253
+ protocols: [ 'http', 'https', 'file', 'data' ]
1254
+ };
1255
+
1256
+ function toURLEncodedForm(data, options) {
1257
+ return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1258
+ visitor: function(value, key, path, helpers) {
1259
+ if (utils.isBuffer(value)) {
1260
+ this.append(key, value.toString('base64'));
1261
+ return false;
1262
+ }
1263
+
1264
+ return helpers.defaultVisitor.apply(this, arguments);
1265
+ }
1266
+ }, options));
1267
+ }
1268
+
1269
+ /**
1270
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1271
+ *
1272
+ * @param {string} name - The name of the property to get.
1273
+ *
1274
+ * @returns An array of strings.
1275
+ */
1276
+ function parsePropPath(name) {
1277
+ // foo[x][y][z]
1278
+ // foo.x.y.z
1279
+ // foo-x-y-z
1280
+ // foo x y z
1281
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1282
+ return match[0] === '[]' ? '' : match[1] || match[0];
1283
+ });
1284
+ }
1285
+
1286
+ /**
1287
+ * Convert an array to an object.
1288
+ *
1289
+ * @param {Array<any>} arr - The array to convert to an object.
1290
+ *
1291
+ * @returns An object with the same keys and values as the array.
1292
+ */
1293
+ function arrayToObject(arr) {
1294
+ const obj = {};
1295
+ const keys = Object.keys(arr);
1296
+ let i;
1297
+ const len = keys.length;
1298
+ let key;
1299
+ for (i = 0; i < len; i++) {
1300
+ key = keys[i];
1301
+ obj[key] = arr[key];
1302
+ }
1303
+ return obj;
1304
+ }
1305
+
1306
+ /**
1307
+ * It takes a FormData object and returns a JavaScript object
1308
+ *
1309
+ * @param {string} formData The FormData object to convert to JSON.
1310
+ *
1311
+ * @returns {Object<string, any> | null} The converted object.
1312
+ */
1313
+ function formDataToJSON(formData) {
1314
+ function buildPath(path, value, target, index) {
1315
+ let name = path[index++];
1316
+ const isNumericKey = Number.isFinite(+name);
1317
+ const isLast = index >= path.length;
1318
+ name = !name && utils.isArray(target) ? target.length : name;
1319
+
1320
+ if (isLast) {
1321
+ if (utils.hasOwnProp(target, name)) {
1322
+ target[name] = [target[name], value];
1323
+ } else {
1324
+ target[name] = value;
1325
+ }
1326
+
1327
+ return !isNumericKey;
1328
+ }
1329
+
1330
+ if (!target[name] || !utils.isObject(target[name])) {
1331
+ target[name] = [];
1332
+ }
1333
+
1334
+ const result = buildPath(path, value, target[name], index);
1335
+
1336
+ if (result && utils.isArray(target[name])) {
1337
+ target[name] = arrayToObject(target[name]);
1338
+ }
1339
+
1340
+ return !isNumericKey;
1341
+ }
1342
+
1343
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1344
+ const obj = {};
1345
+
1346
+ utils.forEachEntry(formData, (name, value) => {
1347
+ buildPath(parsePropPath(name), value, obj, 0);
1348
+ });
1349
+
1350
+ return obj;
1351
+ }
1352
+
1353
+ return null;
1354
+ }
1355
+
1356
+ const DEFAULT_CONTENT_TYPE = {
1357
+ 'Content-Type': undefined
1358
+ };
1359
+
1360
+ /**
1361
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1362
+ * of the input
1363
+ *
1364
+ * @param {any} rawValue - The value to be stringified.
1365
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1366
+ * @param {Function} encoder - A function that takes a value and returns a string.
1367
+ *
1368
+ * @returns {string} A stringified version of the rawValue.
1369
+ */
1370
+ function stringifySafely(rawValue, parser, encoder) {
1371
+ if (utils.isString(rawValue)) {
1372
+ try {
1373
+ (parser || JSON.parse)(rawValue);
1374
+ return utils.trim(rawValue);
1375
+ } catch (e) {
1376
+ if (e.name !== 'SyntaxError') {
1377
+ throw e;
1378
+ }
1379
+ }
1380
+ }
1381
+
1382
+ return (encoder || JSON.stringify)(rawValue);
1383
+ }
1384
+
1385
+ const defaults = {
1386
+
1387
+ transitional: transitionalDefaults,
1388
+
1389
+ adapter: ['xhr', 'http'],
1390
+
1391
+ transformRequest: [function transformRequest(data, headers) {
1392
+ const contentType = headers.getContentType() || '';
1393
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1394
+ const isObjectPayload = utils.isObject(data);
1395
+
1396
+ if (isObjectPayload && utils.isHTMLForm(data)) {
1397
+ data = new FormData(data);
1398
+ }
1399
+
1400
+ const isFormData = utils.isFormData(data);
1401
+
1402
+ if (isFormData) {
1403
+ if (!hasJSONContentType) {
1404
+ return data;
1405
+ }
1406
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1407
+ }
1408
+
1409
+ if (utils.isArrayBuffer(data) ||
1410
+ utils.isBuffer(data) ||
1411
+ utils.isStream(data) ||
1412
+ utils.isFile(data) ||
1413
+ utils.isBlob(data)
1414
+ ) {
1415
+ return data;
1416
+ }
1417
+ if (utils.isArrayBufferView(data)) {
1418
+ return data.buffer;
1419
+ }
1420
+ if (utils.isURLSearchParams(data)) {
1421
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1422
+ return data.toString();
1423
+ }
1424
+
1425
+ let isFileList;
1426
+
1427
+ if (isObjectPayload) {
1428
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1429
+ return toURLEncodedForm(data, this.formSerializer).toString();
1430
+ }
1431
+
1432
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1433
+ const _FormData = this.env && this.env.FormData;
1434
+
1435
+ return toFormData(
1436
+ isFileList ? {'files[]': data} : data,
1437
+ _FormData && new _FormData(),
1438
+ this.formSerializer
1439
+ );
1440
+ }
1441
+ }
1442
+
1443
+ if (isObjectPayload || hasJSONContentType ) {
1444
+ headers.setContentType('application/json', false);
1445
+ return stringifySafely(data);
1446
+ }
1447
+
1448
+ return data;
1449
+ }],
1450
+
1451
+ transformResponse: [function transformResponse(data) {
1452
+ const transitional = this.transitional || defaults.transitional;
1453
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1454
+ const JSONRequested = this.responseType === 'json';
1455
+
1456
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1457
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1458
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1459
+
1460
+ try {
1461
+ return JSON.parse(data);
1462
+ } catch (e) {
1463
+ if (strictJSONParsing) {
1464
+ if (e.name === 'SyntaxError') {
1465
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1466
+ }
1467
+ throw e;
1468
+ }
1469
+ }
1470
+ }
1471
+
1472
+ return data;
1473
+ }],
1474
+
1475
+ /**
1476
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1477
+ * timeout is not created.
1478
+ */
1479
+ timeout: 0,
1480
+
1481
+ xsrfCookieName: 'XSRF-TOKEN',
1482
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1483
+
1484
+ maxContentLength: -1,
1485
+ maxBodyLength: -1,
1486
+
1487
+ env: {
1488
+ FormData: platform.classes.FormData,
1489
+ Blob: platform.classes.Blob
1490
+ },
1491
+
1492
+ validateStatus: function validateStatus(status) {
1493
+ return status >= 200 && status < 300;
1494
+ },
1495
+
1496
+ headers: {
1497
+ common: {
1498
+ 'Accept': 'application/json, text/plain, */*'
1499
+ }
1500
+ }
1501
+ };
1502
+
1503
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1504
+ defaults.headers[method] = {};
1505
+ });
1506
+
1507
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1508
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1509
+ });
1510
+
1511
+ const defaults$1 = defaults;
1512
+
1513
+ // RawAxiosHeaders whose duplicates are ignored by node
1514
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1515
+ const ignoreDuplicateOf = utils.toObjectSet([
1516
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1517
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1518
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1519
+ 'referer', 'retry-after', 'user-agent'
1520
+ ]);
1521
+
1522
+ /**
1523
+ * Parse headers into an object
1524
+ *
1525
+ * ```
1526
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1527
+ * Content-Type: application/json
1528
+ * Connection: keep-alive
1529
+ * Transfer-Encoding: chunked
1530
+ * ```
1531
+ *
1532
+ * @param {String} rawHeaders Headers needing to be parsed
1533
+ *
1534
+ * @returns {Object} Headers parsed into an object
1535
+ */
1536
+ const parseHeaders = rawHeaders => {
1537
+ const parsed = {};
1538
+ let key;
1539
+ let val;
1540
+ let i;
1541
+
1542
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1543
+ i = line.indexOf(':');
1544
+ key = line.substring(0, i).trim().toLowerCase();
1545
+ val = line.substring(i + 1).trim();
1546
+
1547
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1548
+ return;
1549
+ }
1550
+
1551
+ if (key === 'set-cookie') {
1552
+ if (parsed[key]) {
1553
+ parsed[key].push(val);
1554
+ } else {
1555
+ parsed[key] = [val];
1556
+ }
1557
+ } else {
1558
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1559
+ }
1560
+ });
1561
+
1562
+ return parsed;
1563
+ };
1564
+
1565
+ const $internals = Symbol('internals');
1566
+
1567
+ function normalizeHeader(header) {
1568
+ return header && String(header).trim().toLowerCase();
1569
+ }
1570
+
1571
+ function normalizeValue(value) {
1572
+ if (value === false || value == null) {
1573
+ return value;
1574
+ }
1575
+
1576
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1577
+ }
1578
+
1579
+ function parseTokens(str) {
1580
+ const tokens = Object.create(null);
1581
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1582
+ let match;
1583
+
1584
+ while ((match = tokensRE.exec(str))) {
1585
+ tokens[match[1]] = match[2];
1586
+ }
1587
+
1588
+ return tokens;
1589
+ }
1590
+
1591
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1592
+
1593
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1594
+ if (utils.isFunction(filter)) {
1595
+ return filter.call(this, value, header);
1596
+ }
1597
+
1598
+ if (isHeaderNameFilter) {
1599
+ value = header;
1600
+ }
1601
+
1602
+ if (!utils.isString(value)) return;
1603
+
1604
+ if (utils.isString(filter)) {
1605
+ return value.indexOf(filter) !== -1;
1606
+ }
1607
+
1608
+ if (utils.isRegExp(filter)) {
1609
+ return filter.test(value);
1610
+ }
1611
+ }
1612
+
1613
+ function formatHeader(header) {
1614
+ return header.trim()
1615
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1616
+ return char.toUpperCase() + str;
1617
+ });
1618
+ }
1619
+
1620
+ function buildAccessors(obj, header) {
1621
+ const accessorName = utils.toCamelCase(' ' + header);
1622
+
1623
+ ['get', 'set', 'has'].forEach(methodName => {
1624
+ Object.defineProperty(obj, methodName + accessorName, {
1625
+ value: function(arg1, arg2, arg3) {
1626
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1627
+ },
1628
+ configurable: true
1629
+ });
1630
+ });
1631
+ }
1632
+
1633
+ class AxiosHeaders {
1634
+ constructor(headers) {
1635
+ headers && this.set(headers);
1636
+ }
1637
+
1638
+ set(header, valueOrRewrite, rewrite) {
1639
+ const self = this;
1640
+
1641
+ function setHeader(_value, _header, _rewrite) {
1642
+ const lHeader = normalizeHeader(_header);
1643
+
1644
+ if (!lHeader) {
1645
+ throw new Error('header name must be a non-empty string');
1646
+ }
1647
+
1648
+ const key = utils.findKey(self, lHeader);
1649
+
1650
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1651
+ self[key || _header] = normalizeValue(_value);
1652
+ }
1653
+ }
1654
+
1655
+ const setHeaders = (headers, _rewrite) =>
1656
+ utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1657
+
1658
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
1659
+ setHeaders(header, valueOrRewrite);
1660
+ } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1661
+ setHeaders(parseHeaders(header), valueOrRewrite);
1662
+ } else {
1663
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1664
+ }
1665
+
1666
+ return this;
1667
+ }
1668
+
1669
+ get(header, parser) {
1670
+ header = normalizeHeader(header);
1671
+
1672
+ if (header) {
1673
+ const key = utils.findKey(this, header);
1674
+
1675
+ if (key) {
1676
+ const value = this[key];
1677
+
1678
+ if (!parser) {
1679
+ return value;
1680
+ }
1681
+
1682
+ if (parser === true) {
1683
+ return parseTokens(value);
1684
+ }
1685
+
1686
+ if (utils.isFunction(parser)) {
1687
+ return parser.call(this, value, key);
1688
+ }
1689
+
1690
+ if (utils.isRegExp(parser)) {
1691
+ return parser.exec(value);
1692
+ }
1693
+
1694
+ throw new TypeError('parser must be boolean|regexp|function');
1695
+ }
1696
+ }
1697
+ }
1698
+
1699
+ has(header, matcher) {
1700
+ header = normalizeHeader(header);
1701
+
1702
+ if (header) {
1703
+ const key = utils.findKey(this, header);
1704
+
1705
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1706
+ }
1707
+
1708
+ return false;
1709
+ }
1710
+
1711
+ delete(header, matcher) {
1712
+ const self = this;
1713
+ let deleted = false;
1714
+
1715
+ function deleteHeader(_header) {
1716
+ _header = normalizeHeader(_header);
1717
+
1718
+ if (_header) {
1719
+ const key = utils.findKey(self, _header);
1720
+
1721
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1722
+ delete self[key];
1723
+
1724
+ deleted = true;
1725
+ }
1726
+ }
1727
+ }
1728
+
1729
+ if (utils.isArray(header)) {
1730
+ header.forEach(deleteHeader);
1731
+ } else {
1732
+ deleteHeader(header);
1733
+ }
1734
+
1735
+ return deleted;
1736
+ }
1737
+
1738
+ clear(matcher) {
1739
+ const keys = Object.keys(this);
1740
+ let i = keys.length;
1741
+ let deleted = false;
1742
+
1743
+ while (i--) {
1744
+ const key = keys[i];
1745
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1746
+ delete this[key];
1747
+ deleted = true;
1748
+ }
1749
+ }
1750
+
1751
+ return deleted;
1752
+ }
1753
+
1754
+ normalize(format) {
1755
+ const self = this;
1756
+ const headers = {};
1757
+
1758
+ utils.forEach(this, (value, header) => {
1759
+ const key = utils.findKey(headers, header);
1760
+
1761
+ if (key) {
1762
+ self[key] = normalizeValue(value);
1763
+ delete self[header];
1764
+ return;
1765
+ }
1766
+
1767
+ const normalized = format ? formatHeader(header) : String(header).trim();
1768
+
1769
+ if (normalized !== header) {
1770
+ delete self[header];
1771
+ }
1772
+
1773
+ self[normalized] = normalizeValue(value);
1774
+
1775
+ headers[normalized] = true;
1776
+ });
1777
+
1778
+ return this;
1779
+ }
1780
+
1781
+ concat(...targets) {
1782
+ return this.constructor.concat(this, ...targets);
1783
+ }
1784
+
1785
+ toJSON(asStrings) {
1786
+ const obj = Object.create(null);
1787
+
1788
+ utils.forEach(this, (value, header) => {
1789
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1790
+ });
1791
+
1792
+ return obj;
1793
+ }
1794
+
1795
+ [Symbol.iterator]() {
1796
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1797
+ }
1798
+
1799
+ toString() {
1800
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1801
+ }
1802
+
1803
+ get [Symbol.toStringTag]() {
1804
+ return 'AxiosHeaders';
1805
+ }
1806
+
1807
+ static from(thing) {
1808
+ return thing instanceof this ? thing : new this(thing);
1809
+ }
1810
+
1811
+ static concat(first, ...targets) {
1812
+ const computed = new this(first);
1813
+
1814
+ targets.forEach((target) => computed.set(target));
1815
+
1816
+ return computed;
1817
+ }
1818
+
1819
+ static accessor(header) {
1820
+ const internals = this[$internals] = (this[$internals] = {
1821
+ accessors: {}
1822
+ });
1823
+
1824
+ const accessors = internals.accessors;
1825
+ const prototype = this.prototype;
1826
+
1827
+ function defineAccessor(_header) {
1828
+ const lHeader = normalizeHeader(_header);
1829
+
1830
+ if (!accessors[lHeader]) {
1831
+ buildAccessors(prototype, _header);
1832
+ accessors[lHeader] = true;
1833
+ }
1834
+ }
1835
+
1836
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1837
+
1838
+ return this;
1839
+ }
1840
+ }
1841
+
1842
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1843
+
1844
+ utils.freezeMethods(AxiosHeaders.prototype);
1845
+ utils.freezeMethods(AxiosHeaders);
1846
+
1847
+ const AxiosHeaders$1 = AxiosHeaders;
1848
+
1849
+ /**
1850
+ * Transform the data for a request or a response
1851
+ *
1852
+ * @param {Array|Function} fns A single function or Array of functions
1853
+ * @param {?Object} response The response object
1854
+ *
1855
+ * @returns {*} The resulting transformed data
1856
+ */
1857
+ function transformData(fns, response) {
1858
+ const config = this || defaults$1;
1859
+ const context = response || config;
1860
+ const headers = AxiosHeaders$1.from(context.headers);
1861
+ let data = context.data;
1862
+
1863
+ utils.forEach(fns, function transform(fn) {
1864
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1865
+ });
1866
+
1867
+ headers.normalize();
1868
+
1869
+ return data;
1870
+ }
1871
+
1872
+ function isCancel(value) {
1873
+ return !!(value && value.__CANCEL__);
1874
+ }
1875
+
1876
+ /**
1877
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1878
+ *
1879
+ * @param {string=} message The message.
1880
+ * @param {Object=} config The config.
1881
+ * @param {Object=} request The request.
1882
+ *
1883
+ * @returns {CanceledError} The created error.
1884
+ */
1885
+ function CanceledError(message, config, request) {
1886
+ // eslint-disable-next-line no-eq-null,eqeqeq
1887
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1888
+ this.name = 'CanceledError';
1889
+ }
1890
+
1891
+ utils.inherits(CanceledError, AxiosError, {
1892
+ __CANCEL__: true
1893
+ });
1894
+
1895
+ /**
1896
+ * Resolve or reject a Promise based on response status.
1897
+ *
1898
+ * @param {Function} resolve A function that resolves the promise.
1899
+ * @param {Function} reject A function that rejects the promise.
1900
+ * @param {object} response The response.
1901
+ *
1902
+ * @returns {object} The response.
1903
+ */
1904
+ function settle(resolve, reject, response) {
1905
+ const validateStatus = response.config.validateStatus;
1906
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
1907
+ resolve(response);
1908
+ } else {
1909
+ reject(new AxiosError(
1910
+ 'Request failed with status code ' + response.status,
1911
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1912
+ response.config,
1913
+ response.request,
1914
+ response
1915
+ ));
1916
+ }
1917
+ }
1918
+
1919
+ /**
1920
+ * Determines whether the specified URL is absolute
1921
+ *
1922
+ * @param {string} url The URL to test
1923
+ *
1924
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
1925
+ */
1926
+ function isAbsoluteURL(url) {
1927
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1928
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1929
+ // by any combination of letters, digits, plus, period, or hyphen.
1930
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1931
+ }
1932
+
1933
+ /**
1934
+ * Creates a new URL by combining the specified URLs
1935
+ *
1936
+ * @param {string} baseURL The base URL
1937
+ * @param {string} relativeURL The relative URL
1938
+ *
1939
+ * @returns {string} The combined URL
1940
+ */
1941
+ function combineURLs(baseURL, relativeURL) {
1942
+ return relativeURL
1943
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
1944
+ : baseURL;
1945
+ }
1946
+
1947
+ /**
1948
+ * Creates a new URL by combining the baseURL with the requestedURL,
1949
+ * only when the requestedURL is not already an absolute URL.
1950
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
1951
+ *
1952
+ * @param {string} baseURL The base URL
1953
+ * @param {string} requestedURL Absolute or relative URL to combine
1954
+ *
1955
+ * @returns {string} The combined full path
1956
+ */
1957
+ function buildFullPath(baseURL, requestedURL) {
1958
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
1959
+ return combineURLs(baseURL, requestedURL);
1960
+ }
1961
+ return requestedURL;
1962
+ }
1963
+
1964
+ const VERSION = "1.4.0";
1965
+
1966
+ function parseProtocol(url) {
1967
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1968
+ return match && match[1] || '';
1969
+ }
1970
+
1971
+ const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
1972
+
1973
+ /**
1974
+ * Parse data uri to a Buffer or Blob
1975
+ *
1976
+ * @param {String} uri
1977
+ * @param {?Boolean} asBlob
1978
+ * @param {?Object} options
1979
+ * @param {?Function} options.Blob
1980
+ *
1981
+ * @returns {Buffer|Blob}
1982
+ */
1983
+ function fromDataURI(uri, asBlob, options) {
1984
+ const _Blob = options && options.Blob || platform.classes.Blob;
1985
+ const protocol = parseProtocol(uri);
1986
+
1987
+ if (asBlob === undefined && _Blob) {
1988
+ asBlob = true;
1989
+ }
1990
+
1991
+ if (protocol === 'data') {
1992
+ uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
1993
+
1994
+ const match = DATA_URL_PATTERN.exec(uri);
1995
+
1996
+ if (!match) {
1997
+ throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
1998
+ }
1999
+
2000
+ const mime = match[1];
2001
+ const isBase64 = match[2];
2002
+ const body = match[3];
2003
+ const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
2004
+
2005
+ if (asBlob) {
2006
+ if (!_Blob) {
2007
+ throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
2008
+ }
2009
+
2010
+ return new _Blob([buffer], {type: mime});
2011
+ }
2012
+
2013
+ return buffer;
2014
+ }
2015
+
2016
+ throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
2017
+ }
2018
+
2019
+ /**
2020
+ * Throttle decorator
2021
+ * @param {Function} fn
2022
+ * @param {Number} freq
2023
+ * @return {Function}
2024
+ */
2025
+ function throttle(fn, freq) {
2026
+ let timestamp = 0;
2027
+ const threshold = 1000 / freq;
2028
+ let timer = null;
2029
+ return function throttled(force, args) {
2030
+ const now = Date.now();
2031
+ if (force || now - timestamp > threshold) {
2032
+ if (timer) {
2033
+ clearTimeout(timer);
2034
+ timer = null;
2035
+ }
2036
+ timestamp = now;
2037
+ return fn.apply(null, args);
2038
+ }
2039
+ if (!timer) {
2040
+ timer = setTimeout(() => {
2041
+ timer = null;
2042
+ timestamp = Date.now();
2043
+ return fn.apply(null, args);
2044
+ }, threshold - (now - timestamp));
2045
+ }
2046
+ };
2047
+ }
2048
+
2049
+ /**
2050
+ * Calculate data maxRate
2051
+ * @param {Number} [samplesCount= 10]
2052
+ * @param {Number} [min= 1000]
2053
+ * @returns {Function}
2054
+ */
2055
+ function speedometer(samplesCount, min) {
2056
+ samplesCount = samplesCount || 10;
2057
+ const bytes = new Array(samplesCount);
2058
+ const timestamps = new Array(samplesCount);
2059
+ let head = 0;
2060
+ let tail = 0;
2061
+ let firstSampleTS;
2062
+
2063
+ min = min !== undefined ? min : 1000;
2064
+
2065
+ return function push(chunkLength) {
2066
+ const now = Date.now();
2067
+
2068
+ const startedAt = timestamps[tail];
2069
+
2070
+ if (!firstSampleTS) {
2071
+ firstSampleTS = now;
2072
+ }
2073
+
2074
+ bytes[head] = chunkLength;
2075
+ timestamps[head] = now;
2076
+
2077
+ let i = tail;
2078
+ let bytesCount = 0;
2079
+
2080
+ while (i !== head) {
2081
+ bytesCount += bytes[i++];
2082
+ i = i % samplesCount;
2083
+ }
2084
+
2085
+ head = (head + 1) % samplesCount;
2086
+
2087
+ if (head === tail) {
2088
+ tail = (tail + 1) % samplesCount;
2089
+ }
2090
+
2091
+ if (now - firstSampleTS < min) {
2092
+ return;
2093
+ }
2094
+
2095
+ const passed = startedAt && now - startedAt;
2096
+
2097
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2098
+ };
2099
+ }
2100
+
2101
+ const kInternals = Symbol('internals');
2102
+
2103
+ class AxiosTransformStream extends stream__default["default"].Transform{
2104
+ constructor(options) {
2105
+ options = utils.toFlatObject(options, {
2106
+ maxRate: 0,
2107
+ chunkSize: 64 * 1024,
2108
+ minChunkSize: 100,
2109
+ timeWindow: 500,
2110
+ ticksRate: 2,
2111
+ samplesCount: 15
2112
+ }, null, (prop, source) => {
2113
+ return !utils.isUndefined(source[prop]);
2114
+ });
2115
+
2116
+ super({
2117
+ readableHighWaterMark: options.chunkSize
2118
+ });
2119
+
2120
+ const self = this;
2121
+
2122
+ const internals = this[kInternals] = {
2123
+ length: options.length,
2124
+ timeWindow: options.timeWindow,
2125
+ ticksRate: options.ticksRate,
2126
+ chunkSize: options.chunkSize,
2127
+ maxRate: options.maxRate,
2128
+ minChunkSize: options.minChunkSize,
2129
+ bytesSeen: 0,
2130
+ isCaptured: false,
2131
+ notifiedBytesLoaded: 0,
2132
+ ts: Date.now(),
2133
+ bytes: 0,
2134
+ onReadCallback: null
2135
+ };
2136
+
2137
+ const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
2138
+
2139
+ this.on('newListener', event => {
2140
+ if (event === 'progress') {
2141
+ if (!internals.isCaptured) {
2142
+ internals.isCaptured = true;
2143
+ }
2144
+ }
2145
+ });
2146
+
2147
+ let bytesNotified = 0;
2148
+
2149
+ internals.updateProgress = throttle(function throttledHandler() {
2150
+ const totalBytes = internals.length;
2151
+ const bytesTransferred = internals.bytesSeen;
2152
+ const progressBytes = bytesTransferred - bytesNotified;
2153
+ if (!progressBytes || self.destroyed) return;
2154
+
2155
+ const rate = _speedometer(progressBytes);
2156
+
2157
+ bytesNotified = bytesTransferred;
2158
+
2159
+ process.nextTick(() => {
2160
+ self.emit('progress', {
2161
+ 'loaded': bytesTransferred,
2162
+ 'total': totalBytes,
2163
+ 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
2164
+ 'bytes': progressBytes,
2165
+ 'rate': rate ? rate : undefined,
2166
+ 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
2167
+ (totalBytes - bytesTransferred) / rate : undefined
2168
+ });
2169
+ });
2170
+ }, internals.ticksRate);
2171
+
2172
+ const onFinish = () => {
2173
+ internals.updateProgress(true);
2174
+ };
2175
+
2176
+ this.once('end', onFinish);
2177
+ this.once('error', onFinish);
2178
+ }
2179
+
2180
+ _read(size) {
2181
+ const internals = this[kInternals];
2182
+
2183
+ if (internals.onReadCallback) {
2184
+ internals.onReadCallback();
2185
+ }
2186
+
2187
+ return super._read(size);
2188
+ }
2189
+
2190
+ _transform(chunk, encoding, callback) {
2191
+ const self = this;
2192
+ const internals = this[kInternals];
2193
+ const maxRate = internals.maxRate;
2194
+
2195
+ const readableHighWaterMark = this.readableHighWaterMark;
2196
+
2197
+ const timeWindow = internals.timeWindow;
2198
+
2199
+ const divider = 1000 / timeWindow;
2200
+ const bytesThreshold = (maxRate / divider);
2201
+ const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
2202
+
2203
+ function pushChunk(_chunk, _callback) {
2204
+ const bytes = Buffer.byteLength(_chunk);
2205
+ internals.bytesSeen += bytes;
2206
+ internals.bytes += bytes;
2207
+
2208
+ if (internals.isCaptured) {
2209
+ internals.updateProgress();
2210
+ }
2211
+
2212
+ if (self.push(_chunk)) {
2213
+ process.nextTick(_callback);
2214
+ } else {
2215
+ internals.onReadCallback = () => {
2216
+ internals.onReadCallback = null;
2217
+ process.nextTick(_callback);
2218
+ };
2219
+ }
2220
+ }
2221
+
2222
+ const transformChunk = (_chunk, _callback) => {
2223
+ const chunkSize = Buffer.byteLength(_chunk);
2224
+ let chunkRemainder = null;
2225
+ let maxChunkSize = readableHighWaterMark;
2226
+ let bytesLeft;
2227
+ let passed = 0;
2228
+
2229
+ if (maxRate) {
2230
+ const now = Date.now();
2231
+
2232
+ if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {
2233
+ internals.ts = now;
2234
+ bytesLeft = bytesThreshold - internals.bytes;
2235
+ internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
2236
+ passed = 0;
2237
+ }
2238
+
2239
+ bytesLeft = bytesThreshold - internals.bytes;
2240
+ }
2241
+
2242
+ if (maxRate) {
2243
+ if (bytesLeft <= 0) {
2244
+ // next time window
2245
+ return setTimeout(() => {
2246
+ _callback(null, _chunk);
2247
+ }, timeWindow - passed);
2248
+ }
2249
+
2250
+ if (bytesLeft < maxChunkSize) {
2251
+ maxChunkSize = bytesLeft;
2252
+ }
2253
+ }
2254
+
2255
+ if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {
2256
+ chunkRemainder = _chunk.subarray(maxChunkSize);
2257
+ _chunk = _chunk.subarray(0, maxChunkSize);
2258
+ }
2259
+
2260
+ pushChunk(_chunk, chunkRemainder ? () => {
2261
+ process.nextTick(_callback, null, chunkRemainder);
2262
+ } : _callback);
2263
+ };
2264
+
2265
+ transformChunk(chunk, function transformNextChunk(err, _chunk) {
2266
+ if (err) {
2267
+ return callback(err);
2268
+ }
2269
+
2270
+ if (_chunk) {
2271
+ transformChunk(_chunk, transformNextChunk);
2272
+ } else {
2273
+ callback(null);
2274
+ }
2275
+ });
2276
+ }
2277
+
2278
+ setLength(length) {
2279
+ this[kInternals].length = +length;
2280
+ return this;
2281
+ }
2282
+ }
2283
+
2284
+ const AxiosTransformStream$1 = AxiosTransformStream;
2285
+
2286
+ const {asyncIterator} = Symbol;
2287
+
2288
+ const readBlob = async function* (blob) {
2289
+ if (blob.stream) {
2290
+ yield* blob.stream();
2291
+ } else if (blob.arrayBuffer) {
2292
+ yield await blob.arrayBuffer();
2293
+ } else if (blob[asyncIterator]) {
2294
+ yield* blob[asyncIterator]();
2295
+ } else {
2296
+ yield blob;
2297
+ }
2298
+ };
2299
+
2300
+ const readBlob$1 = readBlob;
2301
+
2302
+ const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
2303
+
2304
+ const textEncoder = new util.TextEncoder();
2305
+
2306
+ const CRLF = '\r\n';
2307
+ const CRLF_BYTES = textEncoder.encode(CRLF);
2308
+ const CRLF_BYTES_COUNT = 2;
2309
+
2310
+ class FormDataPart {
2311
+ constructor(name, value) {
2312
+ const {escapeName} = this.constructor;
2313
+ const isStringValue = utils.isString(value);
2314
+
2315
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
2316
+ !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
2317
+ }${CRLF}`;
2318
+
2319
+ if (isStringValue) {
2320
+ value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
2321
+ } else {
2322
+ headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
2323
+ }
2324
+
2325
+ this.headers = textEncoder.encode(headers + CRLF);
2326
+
2327
+ this.contentLength = isStringValue ? value.byteLength : value.size;
2328
+
2329
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
2330
+
2331
+ this.name = name;
2332
+ this.value = value;
2333
+ }
2334
+
2335
+ async *encode(){
2336
+ yield this.headers;
2337
+
2338
+ const {value} = this;
2339
+
2340
+ if(utils.isTypedArray(value)) {
2341
+ yield value;
2342
+ } else {
2343
+ yield* readBlob$1(value);
2344
+ }
2345
+
2346
+ yield CRLF_BYTES;
2347
+ }
2348
+
2349
+ static escapeName(name) {
2350
+ return String(name).replace(/[\r\n"]/g, (match) => ({
2351
+ '\r' : '%0D',
2352
+ '\n' : '%0A',
2353
+ '"' : '%22',
2354
+ }[match]));
2355
+ }
2356
+ }
2357
+
2358
+ const formDataToStream = (form, headersHandler, options) => {
2359
+ const {
2360
+ tag = 'form-data-boundary',
2361
+ size = 25,
2362
+ boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
2363
+ } = options || {};
2364
+
2365
+ if(!utils.isFormData(form)) {
2366
+ throw TypeError('FormData instance required');
2367
+ }
2368
+
2369
+ if (boundary.length < 1 || boundary.length > 70) {
2370
+ throw Error('boundary must be 10-70 characters long')
2371
+ }
2372
+
2373
+ const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2374
+ const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
2375
+ let contentLength = footerBytes.byteLength;
2376
+
2377
+ const parts = Array.from(form.entries()).map(([name, value]) => {
2378
+ const part = new FormDataPart(name, value);
2379
+ contentLength += part.size;
2380
+ return part;
2381
+ });
2382
+
2383
+ contentLength += boundaryBytes.byteLength * parts.length;
2384
+
2385
+ contentLength = utils.toFiniteNumber(contentLength);
2386
+
2387
+ const computedHeaders = {
2388
+ 'Content-Type': `multipart/form-data; boundary=${boundary}`
2389
+ };
2390
+
2391
+ if (Number.isFinite(contentLength)) {
2392
+ computedHeaders['Content-Length'] = contentLength;
2393
+ }
2394
+
2395
+ headersHandler && headersHandler(computedHeaders);
2396
+
2397
+ return stream.Readable.from((async function *() {
2398
+ for(const part of parts) {
2399
+ yield boundaryBytes;
2400
+ yield* part.encode();
2401
+ }
2402
+
2403
+ yield footerBytes;
2404
+ })());
2405
+ };
2406
+
2407
+ const formDataToStream$1 = formDataToStream;
2408
+
2409
+ class ZlibHeaderTransformStream extends stream__default["default"].Transform {
2410
+ __transform(chunk, encoding, callback) {
2411
+ this.push(chunk);
2412
+ callback();
2413
+ }
2414
+
2415
+ _transform(chunk, encoding, callback) {
2416
+ if (chunk.length !== 0) {
2417
+ this._transform = this.__transform;
2418
+
2419
+ // Add Default Compression headers if no zlib headers are present
2420
+ if (chunk[0] !== 120) { // Hex: 78
2421
+ const header = Buffer.alloc(2);
2422
+ header[0] = 120; // Hex: 78
2423
+ header[1] = 156; // Hex: 9C
2424
+ this.push(header, encoding);
2425
+ }
2426
+ }
2427
+
2428
+ this.__transform(chunk, encoding, callback);
2429
+ }
2430
+ }
2431
+
2432
+ const ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream;
2433
+
2434
+ const callbackify = (fn, reducer) => {
2435
+ return utils.isAsyncFn(fn) ? function (...args) {
2436
+ const cb = args.pop();
2437
+ fn.apply(this, args).then((value) => {
2438
+ try {
2439
+ reducer ? cb(null, ...reducer(value)) : cb(null, value);
2440
+ } catch (err) {
2441
+ cb(err);
2442
+ }
2443
+ }, cb);
2444
+ } : fn;
2445
+ };
2446
+
2447
+ const callbackify$1 = callbackify;
2448
+
2449
+ const zlibOptions = {
2450
+ flush: zlib__default["default"].constants.Z_SYNC_FLUSH,
2451
+ finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH
2452
+ };
2453
+
2454
+ const brotliOptions = {
2455
+ flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH,
2456
+ finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH
2457
+ };
2458
+
2459
+ const isBrotliSupported = utils.isFunction(zlib__default["default"].createBrotliDecompress);
2460
+
2461
+ const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"];
2462
+
2463
+ const isHttps = /https:?/;
2464
+
2465
+ const supportedProtocols = platform.protocols.map(protocol => {
2466
+ return protocol + ':';
2467
+ });
2468
+
2469
+ /**
2470
+ * If the proxy or config beforeRedirects functions are defined, call them with the options
2471
+ * object.
2472
+ *
2473
+ * @param {Object<string, any>} options - The options object that was passed to the request.
2474
+ *
2475
+ * @returns {Object<string, any>}
2476
+ */
2477
+ function dispatchBeforeRedirect(options) {
2478
+ if (options.beforeRedirects.proxy) {
2479
+ options.beforeRedirects.proxy(options);
2480
+ }
2481
+ if (options.beforeRedirects.config) {
2482
+ options.beforeRedirects.config(options);
2483
+ }
2484
+ }
2485
+
2486
+ /**
2487
+ * If the proxy or config afterRedirects functions are defined, call them with the options
2488
+ *
2489
+ * @param {http.ClientRequestArgs} options
2490
+ * @param {AxiosProxyConfig} configProxy configuration from Axios options object
2491
+ * @param {string} location
2492
+ *
2493
+ * @returns {http.ClientRequestArgs}
2494
+ */
2495
+ function setProxy(options, configProxy, location) {
2496
+ let proxy = configProxy;
2497
+ if (!proxy && proxy !== false) {
2498
+ const proxyUrl = proxyFromEnv.getProxyForUrl(location);
2499
+ if (proxyUrl) {
2500
+ proxy = new URL(proxyUrl);
2501
+ }
2502
+ }
2503
+ if (proxy) {
2504
+ // Basic proxy authorization
2505
+ if (proxy.username) {
2506
+ proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
2507
+ }
2508
+
2509
+ if (proxy.auth) {
2510
+ // Support proxy auth object form
2511
+ if (proxy.auth.username || proxy.auth.password) {
2512
+ proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
2513
+ }
2514
+ const base64 = Buffer
2515
+ .from(proxy.auth, 'utf8')
2516
+ .toString('base64');
2517
+ options.headers['Proxy-Authorization'] = 'Basic ' + base64;
2518
+ }
2519
+
2520
+ options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
2521
+ const proxyHost = proxy.hostname || proxy.host;
2522
+ options.hostname = proxyHost;
2523
+ // Replace 'host' since options is not a URL object
2524
+ options.host = proxyHost;
2525
+ options.port = proxy.port;
2526
+ options.path = location;
2527
+ if (proxy.protocol) {
2528
+ options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
2529
+ }
2530
+ }
2531
+
2532
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
2533
+ // Configure proxy for redirected request, passing the original config proxy to apply
2534
+ // the exact same logic as if the redirected request was performed by axios directly.
2535
+ setProxy(redirectOptions, configProxy, redirectOptions.href);
2536
+ };
2537
+ }
2538
+
2539
+ const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
2540
+
2541
+ // temporary hotfix
2542
+
2543
+ const wrapAsync = (asyncExecutor) => {
2544
+ return new Promise((resolve, reject) => {
2545
+ let onDone;
2546
+ let isDone;
2547
+
2548
+ const done = (value, isRejected) => {
2549
+ if (isDone) return;
2550
+ isDone = true;
2551
+ onDone && onDone(value, isRejected);
2552
+ };
2553
+
2554
+ const _resolve = (value) => {
2555
+ done(value);
2556
+ resolve(value);
2557
+ };
2558
+
2559
+ const _reject = (reason) => {
2560
+ done(reason, true);
2561
+ reject(reason);
2562
+ };
2563
+
2564
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
2565
+ })
2566
+ };
2567
+
2568
+ /*eslint consistent-return:0*/
2569
+ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2570
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
2571
+ let {data, lookup, family} = config;
2572
+ const {responseType, responseEncoding} = config;
2573
+ const method = config.method.toUpperCase();
2574
+ let isDone;
2575
+ let rejected = false;
2576
+ let req;
2577
+
2578
+ if (lookup && utils.isAsyncFn(lookup)) {
2579
+ lookup = callbackify$1(lookup, (entry) => {
2580
+ if(utils.isString(entry)) {
2581
+ entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
2582
+ } else if (!utils.isArray(entry)) {
2583
+ throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
2584
+ }
2585
+ return entry;
2586
+ });
2587
+ }
2588
+
2589
+ // temporary internal emitter until the AxiosRequest class will be implemented
2590
+ const emitter = new EventEmitter__default["default"]();
2591
+
2592
+ const onFinished = () => {
2593
+ if (config.cancelToken) {
2594
+ config.cancelToken.unsubscribe(abort);
2595
+ }
2596
+
2597
+ if (config.signal) {
2598
+ config.signal.removeEventListener('abort', abort);
2599
+ }
2600
+
2601
+ emitter.removeAllListeners();
2602
+ };
2603
+
2604
+ onDone((value, isRejected) => {
2605
+ isDone = true;
2606
+ if (isRejected) {
2607
+ rejected = true;
2608
+ onFinished();
2609
+ }
2610
+ });
2611
+
2612
+ function abort(reason) {
2613
+ emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
2614
+ }
2615
+
2616
+ emitter.once('abort', reject);
2617
+
2618
+ if (config.cancelToken || config.signal) {
2619
+ config.cancelToken && config.cancelToken.subscribe(abort);
2620
+ if (config.signal) {
2621
+ config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
2622
+ }
2623
+ }
2624
+
2625
+ // Parse url
2626
+ const fullPath = buildFullPath(config.baseURL, config.url);
2627
+ const parsed = new URL(fullPath, 'http://localhost');
2628
+ const protocol = parsed.protocol || supportedProtocols[0];
2629
+
2630
+ if (protocol === 'data:') {
2631
+ let convertedData;
2632
+
2633
+ if (method !== 'GET') {
2634
+ return settle(resolve, reject, {
2635
+ status: 405,
2636
+ statusText: 'method not allowed',
2637
+ headers: {},
2638
+ config
2639
+ });
2640
+ }
2641
+
2642
+ try {
2643
+ convertedData = fromDataURI(config.url, responseType === 'blob', {
2644
+ Blob: config.env && config.env.Blob
2645
+ });
2646
+ } catch (err) {
2647
+ throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
2648
+ }
2649
+
2650
+ if (responseType === 'text') {
2651
+ convertedData = convertedData.toString(responseEncoding);
2652
+
2653
+ if (!responseEncoding || responseEncoding === 'utf8') {
2654
+ convertedData = utils.stripBOM(convertedData);
2655
+ }
2656
+ } else if (responseType === 'stream') {
2657
+ convertedData = stream__default["default"].Readable.from(convertedData);
2658
+ }
2659
+
2660
+ return settle(resolve, reject, {
2661
+ data: convertedData,
2662
+ status: 200,
2663
+ statusText: 'OK',
2664
+ headers: new AxiosHeaders$1(),
2665
+ config
2666
+ });
2667
+ }
2668
+
2669
+ if (supportedProtocols.indexOf(protocol) === -1) {
2670
+ return reject(new AxiosError(
2671
+ 'Unsupported protocol ' + protocol,
2672
+ AxiosError.ERR_BAD_REQUEST,
2673
+ config
2674
+ ));
2675
+ }
2676
+
2677
+ const headers = AxiosHeaders$1.from(config.headers).normalize();
2678
+
2679
+ // Set User-Agent (required by some servers)
2680
+ // See https://github.com/axios/axios/issues/69
2681
+ // User-Agent is specified; handle case where no UA header is desired
2682
+ // Only set header if it hasn't been set in config
2683
+ headers.set('User-Agent', 'axios/' + VERSION, false);
2684
+
2685
+ const onDownloadProgress = config.onDownloadProgress;
2686
+ const onUploadProgress = config.onUploadProgress;
2687
+ const maxRate = config.maxRate;
2688
+ let maxUploadRate = undefined;
2689
+ let maxDownloadRate = undefined;
2690
+
2691
+ // support for spec compliant FormData objects
2692
+ if (utils.isSpecCompliantForm(data)) {
2693
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
2694
+
2695
+ data = formDataToStream$1(data, (formHeaders) => {
2696
+ headers.set(formHeaders);
2697
+ }, {
2698
+ tag: `axios-${VERSION}-boundary`,
2699
+ boundary: userBoundary && userBoundary[1] || undefined
2700
+ });
2701
+ // support for https://www.npmjs.com/package/form-data api
2702
+ } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
2703
+ headers.set(data.getHeaders());
2704
+
2705
+ if (!headers.hasContentLength()) {
2706
+ try {
2707
+ const knownLength = await util__default["default"].promisify(data.getLength).call(data);
2708
+ Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
2709
+ /*eslint no-empty:0*/
2710
+ } catch (e) {
2711
+ }
2712
+ }
2713
+ } else if (utils.isBlob(data)) {
2714
+ data.size && headers.setContentType(data.type || 'application/octet-stream');
2715
+ headers.setContentLength(data.size || 0);
2716
+ data = stream__default["default"].Readable.from(readBlob$1(data));
2717
+ } else if (data && !utils.isStream(data)) {
2718
+ if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
2719
+ data = Buffer.from(new Uint8Array(data));
2720
+ } else if (utils.isString(data)) {
2721
+ data = Buffer.from(data, 'utf-8');
2722
+ } else {
2723
+ return reject(new AxiosError(
2724
+ 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
2725
+ AxiosError.ERR_BAD_REQUEST,
2726
+ config
2727
+ ));
2728
+ }
2729
+
2730
+ // Add Content-Length header if data exists
2731
+ headers.setContentLength(data.length, false);
2732
+
2733
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
2734
+ return reject(new AxiosError(
2735
+ 'Request body larger than maxBodyLength limit',
2736
+ AxiosError.ERR_BAD_REQUEST,
2737
+ config
2738
+ ));
2739
+ }
2740
+ }
2741
+
2742
+ const contentLength = utils.toFiniteNumber(headers.getContentLength());
2743
+
2744
+ if (utils.isArray(maxRate)) {
2745
+ maxUploadRate = maxRate[0];
2746
+ maxDownloadRate = maxRate[1];
2747
+ } else {
2748
+ maxUploadRate = maxDownloadRate = maxRate;
2749
+ }
2750
+
2751
+ if (data && (onUploadProgress || maxUploadRate)) {
2752
+ if (!utils.isStream(data)) {
2753
+ data = stream__default["default"].Readable.from(data, {objectMode: false});
2754
+ }
2755
+
2756
+ data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({
2757
+ length: contentLength,
2758
+ maxRate: utils.toFiniteNumber(maxUploadRate)
2759
+ })], utils.noop);
2760
+
2761
+ onUploadProgress && data.on('progress', progress => {
2762
+ onUploadProgress(Object.assign(progress, {
2763
+ upload: true
2764
+ }));
2765
+ });
2766
+ }
2767
+
2768
+ // HTTP basic authentication
2769
+ let auth = undefined;
2770
+ if (config.auth) {
2771
+ const username = config.auth.username || '';
2772
+ const password = config.auth.password || '';
2773
+ auth = username + ':' + password;
2774
+ }
2775
+
2776
+ if (!auth && parsed.username) {
2777
+ const urlUsername = parsed.username;
2778
+ const urlPassword = parsed.password;
2779
+ auth = urlUsername + ':' + urlPassword;
2780
+ }
2781
+
2782
+ auth && headers.delete('authorization');
2783
+
2784
+ let path;
2785
+
2786
+ try {
2787
+ path = buildURL(
2788
+ parsed.pathname + parsed.search,
2789
+ config.params,
2790
+ config.paramsSerializer
2791
+ ).replace(/^\?/, '');
2792
+ } catch (err) {
2793
+ const customErr = new Error(err.message);
2794
+ customErr.config = config;
2795
+ customErr.url = config.url;
2796
+ customErr.exists = true;
2797
+ return reject(customErr);
2798
+ }
2799
+
2800
+ headers.set(
2801
+ 'Accept-Encoding',
2802
+ 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false
2803
+ );
2804
+
2805
+ const options = {
2806
+ path,
2807
+ method: method,
2808
+ headers: headers.toJSON(),
2809
+ agents: { http: config.httpAgent, https: config.httpsAgent },
2810
+ auth,
2811
+ protocol,
2812
+ family,
2813
+ lookup,
2814
+ beforeRedirect: dispatchBeforeRedirect,
2815
+ beforeRedirects: {}
2816
+ };
2817
+
2818
+ if (config.socketPath) {
2819
+ options.socketPath = config.socketPath;
2820
+ } else {
2821
+ options.hostname = parsed.hostname;
2822
+ options.port = parsed.port;
2823
+ setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
2824
+ }
2825
+
2826
+ let transport;
2827
+ const isHttpsRequest = isHttps.test(options.protocol);
2828
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
2829
+ if (config.transport) {
2830
+ transport = config.transport;
2831
+ } else if (config.maxRedirects === 0) {
2832
+ transport = isHttpsRequest ? https__default["default"] : http__default["default"];
2833
+ } else {
2834
+ if (config.maxRedirects) {
2835
+ options.maxRedirects = config.maxRedirects;
2836
+ }
2837
+ if (config.beforeRedirect) {
2838
+ options.beforeRedirects.config = config.beforeRedirect;
2839
+ }
2840
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
2841
+ }
2842
+
2843
+ if (config.maxBodyLength > -1) {
2844
+ options.maxBodyLength = config.maxBodyLength;
2845
+ } else {
2846
+ // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
2847
+ options.maxBodyLength = Infinity;
2848
+ }
2849
+
2850
+ if (config.insecureHTTPParser) {
2851
+ options.insecureHTTPParser = config.insecureHTTPParser;
2852
+ }
2853
+
2854
+ // Create the request
2855
+ req = transport.request(options, function handleResponse(res) {
2856
+ if (req.destroyed) return;
2857
+
2858
+ const streams = [res];
2859
+
2860
+ const responseLength = +res.headers['content-length'];
2861
+
2862
+ if (onDownloadProgress) {
2863
+ const transformStream = new AxiosTransformStream$1({
2864
+ length: utils.toFiniteNumber(responseLength),
2865
+ maxRate: utils.toFiniteNumber(maxDownloadRate)
2866
+ });
2867
+
2868
+ onDownloadProgress && transformStream.on('progress', progress => {
2869
+ onDownloadProgress(Object.assign(progress, {
2870
+ download: true
2871
+ }));
2872
+ });
2873
+
2874
+ streams.push(transformStream);
2875
+ }
2876
+
2877
+ // decompress the response body transparently if required
2878
+ let responseStream = res;
2879
+
2880
+ // return the last request in case of redirects
2881
+ const lastRequest = res.req || req;
2882
+
2883
+ // if decompress disabled we should not decompress
2884
+ if (config.decompress !== false && res.headers['content-encoding']) {
2885
+ // if no content, but headers still say that it is encoded,
2886
+ // remove the header not confuse downstream operations
2887
+ if (method === 'HEAD' || res.statusCode === 204) {
2888
+ delete res.headers['content-encoding'];
2889
+ }
2890
+
2891
+ switch (res.headers['content-encoding']) {
2892
+ /*eslint default-case:0*/
2893
+ case 'gzip':
2894
+ case 'x-gzip':
2895
+ case 'compress':
2896
+ case 'x-compress':
2897
+ // add the unzipper to the body stream processing pipeline
2898
+ streams.push(zlib__default["default"].createUnzip(zlibOptions));
2899
+
2900
+ // remove the content-encoding in order to not confuse downstream operations
2901
+ delete res.headers['content-encoding'];
2902
+ break;
2903
+ case 'deflate':
2904
+ streams.push(new ZlibHeaderTransformStream$1());
2905
+
2906
+ // add the unzipper to the body stream processing pipeline
2907
+ streams.push(zlib__default["default"].createUnzip(zlibOptions));
2908
+
2909
+ // remove the content-encoding in order to not confuse downstream operations
2910
+ delete res.headers['content-encoding'];
2911
+ break;
2912
+ case 'br':
2913
+ if (isBrotliSupported) {
2914
+ streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions));
2915
+ delete res.headers['content-encoding'];
2916
+ }
2917
+ }
2918
+ }
2919
+
2920
+ responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils.noop) : streams[0];
2921
+
2922
+ const offListeners = stream__default["default"].finished(responseStream, () => {
2923
+ offListeners();
2924
+ onFinished();
2925
+ });
2926
+
2927
+ const response = {
2928
+ status: res.statusCode,
2929
+ statusText: res.statusMessage,
2930
+ headers: new AxiosHeaders$1(res.headers),
2931
+ config,
2932
+ request: lastRequest
2933
+ };
2934
+
2935
+ if (responseType === 'stream') {
2936
+ response.data = responseStream;
2937
+ settle(resolve, reject, response);
2938
+ } else {
2939
+ const responseBuffer = [];
2940
+ let totalResponseBytes = 0;
2941
+
2942
+ responseStream.on('data', function handleStreamData(chunk) {
2943
+ responseBuffer.push(chunk);
2944
+ totalResponseBytes += chunk.length;
2945
+
2946
+ // make sure the content length is not over the maxContentLength if specified
2947
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
2948
+ // stream.destroy() emit aborted event before calling reject() on Node.js v16
2949
+ rejected = true;
2950
+ responseStream.destroy();
2951
+ reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',
2952
+ AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
2953
+ }
2954
+ });
2955
+
2956
+ responseStream.on('aborted', function handlerStreamAborted() {
2957
+ if (rejected) {
2958
+ return;
2959
+ }
2960
+
2961
+ const err = new AxiosError(
2962
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
2963
+ AxiosError.ERR_BAD_RESPONSE,
2964
+ config,
2965
+ lastRequest
2966
+ );
2967
+ responseStream.destroy(err);
2968
+ reject(err);
2969
+ });
2970
+
2971
+ responseStream.on('error', function handleStreamError(err) {
2972
+ if (req.destroyed) return;
2973
+ reject(AxiosError.from(err, null, config, lastRequest));
2974
+ });
2975
+
2976
+ responseStream.on('end', function handleStreamEnd() {
2977
+ try {
2978
+ let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
2979
+ if (responseType !== 'arraybuffer') {
2980
+ responseData = responseData.toString(responseEncoding);
2981
+ if (!responseEncoding || responseEncoding === 'utf8') {
2982
+ responseData = utils.stripBOM(responseData);
2983
+ }
2984
+ }
2985
+ response.data = responseData;
2986
+ } catch (err) {
2987
+ reject(AxiosError.from(err, null, config, response.request, response));
2988
+ }
2989
+ settle(resolve, reject, response);
2990
+ });
2991
+ }
2992
+
2993
+ emitter.once('abort', err => {
2994
+ if (!responseStream.destroyed) {
2995
+ responseStream.emit('error', err);
2996
+ responseStream.destroy();
2997
+ }
2998
+ });
2999
+ });
3000
+
3001
+ emitter.once('abort', err => {
3002
+ reject(err);
3003
+ req.destroy(err);
3004
+ });
3005
+
3006
+ // Handle errors
3007
+ req.on('error', function handleRequestError(err) {
3008
+ // @todo remove
3009
+ // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;
3010
+ reject(AxiosError.from(err, null, config, req));
3011
+ });
3012
+
3013
+ // set tcp keep alive to prevent drop connection by peer
3014
+ req.on('socket', function handleRequestSocket(socket) {
3015
+ // default interval of sending ack packet is 1 minute
3016
+ socket.setKeepAlive(true, 1000 * 60);
3017
+ });
3018
+
3019
+ // Handle request timeout
3020
+ if (config.timeout) {
3021
+ // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
3022
+ const timeout = parseInt(config.timeout, 10);
3023
+
3024
+ if (isNaN(timeout)) {
3025
+ reject(new AxiosError(
3026
+ 'error trying to parse `config.timeout` to int',
3027
+ AxiosError.ERR_BAD_OPTION_VALUE,
3028
+ config,
3029
+ req
3030
+ ));
3031
+
3032
+ return;
3033
+ }
3034
+
3035
+ // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
3036
+ // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
3037
+ // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
3038
+ // And then these socket which be hang up will devouring CPU little by little.
3039
+ // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
3040
+ req.setTimeout(timeout, function handleRequestTimeout() {
3041
+ if (isDone) return;
3042
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3043
+ const transitional = config.transitional || transitionalDefaults;
3044
+ if (config.timeoutErrorMessage) {
3045
+ timeoutErrorMessage = config.timeoutErrorMessage;
3046
+ }
3047
+ reject(new AxiosError(
3048
+ timeoutErrorMessage,
3049
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
3050
+ config,
3051
+ req
3052
+ ));
3053
+ abort();
3054
+ });
3055
+ }
3056
+
3057
+
3058
+ // Send the request
3059
+ if (utils.isStream(data)) {
3060
+ let ended = false;
3061
+ let errored = false;
3062
+
3063
+ data.on('end', () => {
3064
+ ended = true;
3065
+ });
3066
+
3067
+ data.once('error', err => {
3068
+ errored = true;
3069
+ req.destroy(err);
3070
+ });
3071
+
3072
+ data.on('close', () => {
3073
+ if (!ended && !errored) {
3074
+ abort(new CanceledError('Request stream has been aborted', config, req));
3075
+ }
3076
+ });
3077
+
3078
+ data.pipe(req);
3079
+ } else {
3080
+ req.end(data);
3081
+ }
3082
+ });
3083
+ };
3084
+
3085
+ const cookies = platform.isStandardBrowserEnv ?
3086
+
3087
+ // Standard browser envs support document.cookie
3088
+ (function standardBrowserEnv() {
3089
+ return {
3090
+ write: function write(name, value, expires, path, domain, secure) {
3091
+ const cookie = [];
3092
+ cookie.push(name + '=' + encodeURIComponent(value));
3093
+
3094
+ if (utils.isNumber(expires)) {
3095
+ cookie.push('expires=' + new Date(expires).toGMTString());
3096
+ }
3097
+
3098
+ if (utils.isString(path)) {
3099
+ cookie.push('path=' + path);
3100
+ }
3101
+
3102
+ if (utils.isString(domain)) {
3103
+ cookie.push('domain=' + domain);
3104
+ }
3105
+
3106
+ if (secure === true) {
3107
+ cookie.push('secure');
3108
+ }
3109
+
3110
+ document.cookie = cookie.join('; ');
3111
+ },
3112
+
3113
+ read: function read(name) {
3114
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
3115
+ return (match ? decodeURIComponent(match[3]) : null);
3116
+ },
3117
+
3118
+ remove: function remove(name) {
3119
+ this.write(name, '', Date.now() - 86400000);
3120
+ }
3121
+ };
3122
+ })() :
3123
+
3124
+ // Non standard browser env (web workers, react-native) lack needed support.
3125
+ (function nonStandardBrowserEnv() {
3126
+ return {
3127
+ write: function write() {},
3128
+ read: function read() { return null; },
3129
+ remove: function remove() {}
3130
+ };
3131
+ })();
3132
+
3133
+ const isURLSameOrigin = platform.isStandardBrowserEnv ?
3134
+
3135
+ // Standard browser envs have full support of the APIs needed to test
3136
+ // whether the request URL is of the same origin as current location.
3137
+ (function standardBrowserEnv() {
3138
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
3139
+ const urlParsingNode = document.createElement('a');
3140
+ let originURL;
3141
+
3142
+ /**
3143
+ * Parse a URL to discover it's components
3144
+ *
3145
+ * @param {String} url The URL to be parsed
3146
+ * @returns {Object}
3147
+ */
3148
+ function resolveURL(url) {
3149
+ let href = url;
3150
+
3151
+ if (msie) {
3152
+ // IE needs attribute set twice to normalize properties
3153
+ urlParsingNode.setAttribute('href', href);
3154
+ href = urlParsingNode.href;
3155
+ }
3156
+
3157
+ urlParsingNode.setAttribute('href', href);
3158
+
3159
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
3160
+ return {
3161
+ href: urlParsingNode.href,
3162
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
3163
+ host: urlParsingNode.host,
3164
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
3165
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
3166
+ hostname: urlParsingNode.hostname,
3167
+ port: urlParsingNode.port,
3168
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
3169
+ urlParsingNode.pathname :
3170
+ '/' + urlParsingNode.pathname
3171
+ };
3172
+ }
3173
+
3174
+ originURL = resolveURL(window.location.href);
3175
+
3176
+ /**
3177
+ * Determine if a URL shares the same origin as the current location
3178
+ *
3179
+ * @param {String} requestURL The URL to test
3180
+ * @returns {boolean} True if URL shares the same origin, otherwise false
3181
+ */
3182
+ return function isURLSameOrigin(requestURL) {
3183
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
3184
+ return (parsed.protocol === originURL.protocol &&
3185
+ parsed.host === originURL.host);
3186
+ };
3187
+ })() :
3188
+
3189
+ // Non standard browser envs (web workers, react-native) lack needed support.
3190
+ (function nonStandardBrowserEnv() {
3191
+ return function isURLSameOrigin() {
3192
+ return true;
3193
+ };
3194
+ })();
3195
+
3196
+ function progressEventReducer(listener, isDownloadStream) {
3197
+ let bytesNotified = 0;
3198
+ const _speedometer = speedometer(50, 250);
3199
+
3200
+ return e => {
3201
+ const loaded = e.loaded;
3202
+ const total = e.lengthComputable ? e.total : undefined;
3203
+ const progressBytes = loaded - bytesNotified;
3204
+ const rate = _speedometer(progressBytes);
3205
+ const inRange = loaded <= total;
3206
+
3207
+ bytesNotified = loaded;
3208
+
3209
+ const data = {
3210
+ loaded,
3211
+ total,
3212
+ progress: total ? (loaded / total) : undefined,
3213
+ bytes: progressBytes,
3214
+ rate: rate ? rate : undefined,
3215
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
3216
+ event: e
3217
+ };
3218
+
3219
+ data[isDownloadStream ? 'download' : 'upload'] = true;
3220
+
3221
+ listener(data);
3222
+ };
3223
+ }
3224
+
3225
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3226
+
3227
+ const xhrAdapter = isXHRAdapterSupported && function (config) {
3228
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
3229
+ let requestData = config.data;
3230
+ const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
3231
+ const responseType = config.responseType;
3232
+ let onCanceled;
3233
+ function done() {
3234
+ if (config.cancelToken) {
3235
+ config.cancelToken.unsubscribe(onCanceled);
3236
+ }
3237
+
3238
+ if (config.signal) {
3239
+ config.signal.removeEventListener('abort', onCanceled);
3240
+ }
3241
+ }
3242
+
3243
+ if (utils.isFormData(requestData)) {
3244
+ if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
3245
+ requestHeaders.setContentType(false); // Let the browser set it
3246
+ } else {
3247
+ requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
3248
+ }
3249
+ }
3250
+
3251
+ let request = new XMLHttpRequest();
3252
+
3253
+ // HTTP basic authentication
3254
+ if (config.auth) {
3255
+ const username = config.auth.username || '';
3256
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
3257
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
3258
+ }
3259
+
3260
+ const fullPath = buildFullPath(config.baseURL, config.url);
3261
+
3262
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
3263
+
3264
+ // Set the request timeout in MS
3265
+ request.timeout = config.timeout;
3266
+
3267
+ function onloadend() {
3268
+ if (!request) {
3269
+ return;
3270
+ }
3271
+ // Prepare the response
3272
+ const responseHeaders = AxiosHeaders$1.from(
3273
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
3274
+ );
3275
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
3276
+ request.responseText : request.response;
3277
+ const response = {
3278
+ data: responseData,
3279
+ status: request.status,
3280
+ statusText: request.statusText,
3281
+ headers: responseHeaders,
3282
+ config,
3283
+ request
3284
+ };
3285
+
3286
+ settle(function _resolve(value) {
3287
+ resolve(value);
3288
+ done();
3289
+ }, function _reject(err) {
3290
+ reject(err);
3291
+ done();
3292
+ }, response);
3293
+
3294
+ // Clean up request
3295
+ request = null;
3296
+ }
3297
+
3298
+ if ('onloadend' in request) {
3299
+ // Use onloadend if available
3300
+ request.onloadend = onloadend;
3301
+ } else {
3302
+ // Listen for ready state to emulate onloadend
3303
+ request.onreadystatechange = function handleLoad() {
3304
+ if (!request || request.readyState !== 4) {
3305
+ return;
3306
+ }
3307
+
3308
+ // The request errored out and we didn't get a response, this will be
3309
+ // handled by onerror instead
3310
+ // With one exception: request that using file: protocol, most browsers
3311
+ // will return status as 0 even though it's a successful request
3312
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3313
+ return;
3314
+ }
3315
+ // readystate handler is calling before onerror or ontimeout handlers,
3316
+ // so we should call onloadend on the next 'tick'
3317
+ setTimeout(onloadend);
3318
+ };
3319
+ }
3320
+
3321
+ // Handle browser request cancellation (as opposed to a manual cancellation)
3322
+ request.onabort = function handleAbort() {
3323
+ if (!request) {
3324
+ return;
3325
+ }
3326
+
3327
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
3328
+
3329
+ // Clean up request
3330
+ request = null;
3331
+ };
3332
+
3333
+ // Handle low level network errors
3334
+ request.onerror = function handleError() {
3335
+ // Real errors are hidden from us by the browser
3336
+ // onerror should only fire if it's a network error
3337
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
3338
+
3339
+ // Clean up request
3340
+ request = null;
3341
+ };
3342
+
3343
+ // Handle timeout
3344
+ request.ontimeout = function handleTimeout() {
3345
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3346
+ const transitional = config.transitional || transitionalDefaults;
3347
+ if (config.timeoutErrorMessage) {
3348
+ timeoutErrorMessage = config.timeoutErrorMessage;
3349
+ }
3350
+ reject(new AxiosError(
3351
+ timeoutErrorMessage,
3352
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
3353
+ config,
3354
+ request));
3355
+
3356
+ // Clean up request
3357
+ request = null;
3358
+ };
3359
+
3360
+ // Add xsrf header
3361
+ // This is only done if running in a standard browser environment.
3362
+ // Specifically not if we're in a web worker, or react-native.
3363
+ if (platform.isStandardBrowserEnv) {
3364
+ // Add xsrf header
3365
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
3366
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
3367
+
3368
+ if (xsrfValue) {
3369
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
3370
+ }
3371
+ }
3372
+
3373
+ // Remove Content-Type if data is undefined
3374
+ requestData === undefined && requestHeaders.setContentType(null);
3375
+
3376
+ // Add headers to the request
3377
+ if ('setRequestHeader' in request) {
3378
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3379
+ request.setRequestHeader(key, val);
3380
+ });
3381
+ }
3382
+
3383
+ // Add withCredentials to request if needed
3384
+ if (!utils.isUndefined(config.withCredentials)) {
3385
+ request.withCredentials = !!config.withCredentials;
3386
+ }
3387
+
3388
+ // Add responseType to request if needed
3389
+ if (responseType && responseType !== 'json') {
3390
+ request.responseType = config.responseType;
3391
+ }
3392
+
3393
+ // Handle progress if needed
3394
+ if (typeof config.onDownloadProgress === 'function') {
3395
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
3396
+ }
3397
+
3398
+ // Not all browsers support upload events
3399
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
3400
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
3401
+ }
3402
+
3403
+ if (config.cancelToken || config.signal) {
3404
+ // Handle cancellation
3405
+ // eslint-disable-next-line func-names
3406
+ onCanceled = cancel => {
3407
+ if (!request) {
3408
+ return;
3409
+ }
3410
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3411
+ request.abort();
3412
+ request = null;
3413
+ };
3414
+
3415
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
3416
+ if (config.signal) {
3417
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
3418
+ }
3419
+ }
3420
+
3421
+ const protocol = parseProtocol(fullPath);
3422
+
3423
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
3424
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3425
+ return;
3426
+ }
3427
+
3428
+
3429
+ // Send the request
3430
+ request.send(requestData || null);
3431
+ });
3432
+ };
3433
+
3434
+ const knownAdapters = {
3435
+ http: httpAdapter,
3436
+ xhr: xhrAdapter
3437
+ };
3438
+
3439
+ utils.forEach(knownAdapters, (fn, value) => {
3440
+ if(fn) {
3441
+ try {
3442
+ Object.defineProperty(fn, 'name', {value});
3443
+ } catch (e) {
3444
+ // eslint-disable-next-line no-empty
3445
+ }
3446
+ Object.defineProperty(fn, 'adapterName', {value});
3447
+ }
3448
+ });
3449
+
3450
+ const adapters = {
3451
+ getAdapter: (adapters) => {
3452
+ adapters = utils.isArray(adapters) ? adapters : [adapters];
3453
+
3454
+ const {length} = adapters;
3455
+ let nameOrAdapter;
3456
+ let adapter;
3457
+
3458
+ for (let i = 0; i < length; i++) {
3459
+ nameOrAdapter = adapters[i];
3460
+ if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
3461
+ break;
3462
+ }
3463
+ }
3464
+
3465
+ if (!adapter) {
3466
+ if (adapter === false) {
3467
+ throw new AxiosError(
3468
+ `Adapter ${nameOrAdapter} is not supported by the environment`,
3469
+ 'ERR_NOT_SUPPORT'
3470
+ );
3471
+ }
3472
+
3473
+ throw new Error(
3474
+ utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
3475
+ `Adapter '${nameOrAdapter}' is not available in the build` :
3476
+ `Unknown adapter '${nameOrAdapter}'`
3477
+ );
3478
+ }
3479
+
3480
+ if (!utils.isFunction(adapter)) {
3481
+ throw new TypeError('adapter is not a function');
3482
+ }
3483
+
3484
+ return adapter;
3485
+ },
3486
+ adapters: knownAdapters
3487
+ };
3488
+
3489
+ /**
3490
+ * Throws a `CanceledError` if cancellation has been requested.
3491
+ *
3492
+ * @param {Object} config The config that is to be used for the request
3493
+ *
3494
+ * @returns {void}
3495
+ */
3496
+ function throwIfCancellationRequested(config) {
3497
+ if (config.cancelToken) {
3498
+ config.cancelToken.throwIfRequested();
3499
+ }
3500
+
3501
+ if (config.signal && config.signal.aborted) {
3502
+ throw new CanceledError(null, config);
3503
+ }
3504
+ }
3505
+
3506
+ /**
3507
+ * Dispatch a request to the server using the configured adapter.
3508
+ *
3509
+ * @param {object} config The config that is to be used for the request
3510
+ *
3511
+ * @returns {Promise} The Promise to be fulfilled
3512
+ */
3513
+ function dispatchRequest(config) {
3514
+ throwIfCancellationRequested(config);
3515
+
3516
+ config.headers = AxiosHeaders$1.from(config.headers);
3517
+
3518
+ // Transform request data
3519
+ config.data = transformData.call(
3520
+ config,
3521
+ config.transformRequest
3522
+ );
3523
+
3524
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
3525
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
3526
+ }
3527
+
3528
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
3529
+
3530
+ return adapter(config).then(function onAdapterResolution(response) {
3531
+ throwIfCancellationRequested(config);
3532
+
3533
+ // Transform response data
3534
+ response.data = transformData.call(
3535
+ config,
3536
+ config.transformResponse,
3537
+ response
3538
+ );
3539
+
3540
+ response.headers = AxiosHeaders$1.from(response.headers);
3541
+
3542
+ return response;
3543
+ }, function onAdapterRejection(reason) {
3544
+ if (!isCancel(reason)) {
3545
+ throwIfCancellationRequested(config);
3546
+
3547
+ // Transform response data
3548
+ if (reason && reason.response) {
3549
+ reason.response.data = transformData.call(
3550
+ config,
3551
+ config.transformResponse,
3552
+ reason.response
3553
+ );
3554
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
3555
+ }
3556
+ }
3557
+
3558
+ return Promise.reject(reason);
3559
+ });
3560
+ }
3561
+
3562
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
3563
+
3564
+ /**
3565
+ * Config-specific merge-function which creates a new config-object
3566
+ * by merging two configuration objects together.
3567
+ *
3568
+ * @param {Object} config1
3569
+ * @param {Object} config2
3570
+ *
3571
+ * @returns {Object} New object resulting from merging config2 to config1
3572
+ */
3573
+ function mergeConfig(config1, config2) {
3574
+ // eslint-disable-next-line no-param-reassign
3575
+ config2 = config2 || {};
3576
+ const config = {};
3577
+
3578
+ function getMergedValue(target, source, caseless) {
3579
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
3580
+ return utils.merge.call({caseless}, target, source);
3581
+ } else if (utils.isPlainObject(source)) {
3582
+ return utils.merge({}, source);
3583
+ } else if (utils.isArray(source)) {
3584
+ return source.slice();
3585
+ }
3586
+ return source;
3587
+ }
3588
+
3589
+ // eslint-disable-next-line consistent-return
3590
+ function mergeDeepProperties(a, b, caseless) {
3591
+ if (!utils.isUndefined(b)) {
3592
+ return getMergedValue(a, b, caseless);
3593
+ } else if (!utils.isUndefined(a)) {
3594
+ return getMergedValue(undefined, a, caseless);
3595
+ }
3596
+ }
3597
+
3598
+ // eslint-disable-next-line consistent-return
3599
+ function valueFromConfig2(a, b) {
3600
+ if (!utils.isUndefined(b)) {
3601
+ return getMergedValue(undefined, b);
3602
+ }
3603
+ }
3604
+
3605
+ // eslint-disable-next-line consistent-return
3606
+ function defaultToConfig2(a, b) {
3607
+ if (!utils.isUndefined(b)) {
3608
+ return getMergedValue(undefined, b);
3609
+ } else if (!utils.isUndefined(a)) {
3610
+ return getMergedValue(undefined, a);
3611
+ }
3612
+ }
3613
+
3614
+ // eslint-disable-next-line consistent-return
3615
+ function mergeDirectKeys(a, b, prop) {
3616
+ if (prop in config2) {
3617
+ return getMergedValue(a, b);
3618
+ } else if (prop in config1) {
3619
+ return getMergedValue(undefined, a);
3620
+ }
3621
+ }
3622
+
3623
+ const mergeMap = {
3624
+ url: valueFromConfig2,
3625
+ method: valueFromConfig2,
3626
+ data: valueFromConfig2,
3627
+ baseURL: defaultToConfig2,
3628
+ transformRequest: defaultToConfig2,
3629
+ transformResponse: defaultToConfig2,
3630
+ paramsSerializer: defaultToConfig2,
3631
+ timeout: defaultToConfig2,
3632
+ timeoutMessage: defaultToConfig2,
3633
+ withCredentials: defaultToConfig2,
3634
+ adapter: defaultToConfig2,
3635
+ responseType: defaultToConfig2,
3636
+ xsrfCookieName: defaultToConfig2,
3637
+ xsrfHeaderName: defaultToConfig2,
3638
+ onUploadProgress: defaultToConfig2,
3639
+ onDownloadProgress: defaultToConfig2,
3640
+ decompress: defaultToConfig2,
3641
+ maxContentLength: defaultToConfig2,
3642
+ maxBodyLength: defaultToConfig2,
3643
+ beforeRedirect: defaultToConfig2,
3644
+ transport: defaultToConfig2,
3645
+ httpAgent: defaultToConfig2,
3646
+ httpsAgent: defaultToConfig2,
3647
+ cancelToken: defaultToConfig2,
3648
+ socketPath: defaultToConfig2,
3649
+ responseEncoding: defaultToConfig2,
3650
+ validateStatus: mergeDirectKeys,
3651
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
3652
+ };
3653
+
3654
+ utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
3655
+ const merge = mergeMap[prop] || mergeDeepProperties;
3656
+ const configValue = merge(config1[prop], config2[prop], prop);
3657
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
3658
+ });
3659
+
3660
+ return config;
3661
+ }
3662
+
3663
+ const validators$1 = {};
3664
+
3665
+ // eslint-disable-next-line func-names
3666
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
3667
+ validators$1[type] = function validator(thing) {
3668
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
3669
+ };
3670
+ });
3671
+
3672
+ const deprecatedWarnings = {};
3673
+
3674
+ /**
3675
+ * Transitional option validator
3676
+ *
3677
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
3678
+ * @param {string?} version - deprecated version / removed since version
3679
+ * @param {string?} message - some message with additional info
3680
+ *
3681
+ * @returns {function}
3682
+ */
3683
+ validators$1.transitional = function transitional(validator, version, message) {
3684
+ function formatMessage(opt, desc) {
3685
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
3686
+ }
3687
+
3688
+ // eslint-disable-next-line func-names
3689
+ return (value, opt, opts) => {
3690
+ if (validator === false) {
3691
+ throw new AxiosError(
3692
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
3693
+ AxiosError.ERR_DEPRECATED
3694
+ );
3695
+ }
3696
+
3697
+ if (version && !deprecatedWarnings[opt]) {
3698
+ deprecatedWarnings[opt] = true;
3699
+ // eslint-disable-next-line no-console
3700
+ console.warn(
3701
+ formatMessage(
3702
+ opt,
3703
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
3704
+ )
3705
+ );
3706
+ }
3707
+
3708
+ return validator ? validator(value, opt, opts) : true;
3709
+ };
3710
+ };
3711
+
3712
+ /**
3713
+ * Assert object's properties type
3714
+ *
3715
+ * @param {object} options
3716
+ * @param {object} schema
3717
+ * @param {boolean?} allowUnknown
3718
+ *
3719
+ * @returns {object}
3720
+ */
3721
+
3722
+ function assertOptions(options, schema, allowUnknown) {
3723
+ if (typeof options !== 'object') {
3724
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
3725
+ }
3726
+ const keys = Object.keys(options);
3727
+ let i = keys.length;
3728
+ while (i-- > 0) {
3729
+ const opt = keys[i];
3730
+ const validator = schema[opt];
3731
+ if (validator) {
3732
+ const value = options[opt];
3733
+ const result = value === undefined || validator(value, opt, options);
3734
+ if (result !== true) {
3735
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
3736
+ }
3737
+ continue;
3738
+ }
3739
+ if (allowUnknown !== true) {
3740
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
3741
+ }
3742
+ }
3743
+ }
3744
+
3745
+ const validator = {
3746
+ assertOptions,
3747
+ validators: validators$1
3748
+ };
3749
+
3750
+ const validators = validator.validators;
3751
+
3752
+ /**
3753
+ * Create a new instance of Axios
3754
+ *
3755
+ * @param {Object} instanceConfig The default config for the instance
3756
+ *
3757
+ * @return {Axios} A new instance of Axios
3758
+ */
3759
+ class Axios {
3760
+ constructor(instanceConfig) {
3761
+ this.defaults = instanceConfig;
3762
+ this.interceptors = {
3763
+ request: new InterceptorManager$1(),
3764
+ response: new InterceptorManager$1()
3765
+ };
3766
+ }
3767
+
3768
+ /**
3769
+ * Dispatch a request
3770
+ *
3771
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
3772
+ * @param {?Object} config
3773
+ *
3774
+ * @returns {Promise} The Promise to be fulfilled
3775
+ */
3776
+ request(configOrUrl, config) {
3777
+ /*eslint no-param-reassign:0*/
3778
+ // Allow for axios('example/url'[, config]) a la fetch API
3779
+ if (typeof configOrUrl === 'string') {
3780
+ config = config || {};
3781
+ config.url = configOrUrl;
3782
+ } else {
3783
+ config = configOrUrl || {};
3784
+ }
3785
+
3786
+ config = mergeConfig(this.defaults, config);
3787
+
3788
+ const {transitional, paramsSerializer, headers} = config;
3789
+
3790
+ if (transitional !== undefined) {
3791
+ validator.assertOptions(transitional, {
3792
+ silentJSONParsing: validators.transitional(validators.boolean),
3793
+ forcedJSONParsing: validators.transitional(validators.boolean),
3794
+ clarifyTimeoutError: validators.transitional(validators.boolean)
3795
+ }, false);
3796
+ }
3797
+
3798
+ if (paramsSerializer != null) {
3799
+ if (utils.isFunction(paramsSerializer)) {
3800
+ config.paramsSerializer = {
3801
+ serialize: paramsSerializer
3802
+ };
3803
+ } else {
3804
+ validator.assertOptions(paramsSerializer, {
3805
+ encode: validators.function,
3806
+ serialize: validators.function
3807
+ }, true);
3808
+ }
3809
+ }
3810
+
3811
+ // Set config.method
3812
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
3813
+
3814
+ let contextHeaders;
3815
+
3816
+ // Flatten headers
3817
+ contextHeaders = headers && utils.merge(
3818
+ headers.common,
3819
+ headers[config.method]
3820
+ );
3821
+
3822
+ contextHeaders && utils.forEach(
3823
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
3824
+ (method) => {
3825
+ delete headers[method];
3826
+ }
3827
+ );
3828
+
3829
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
3830
+
3831
+ // filter out skipped interceptors
3832
+ const requestInterceptorChain = [];
3833
+ let synchronousRequestInterceptors = true;
3834
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
3835
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
3836
+ return;
3837
+ }
3838
+
3839
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
3840
+
3841
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
3842
+ });
3843
+
3844
+ const responseInterceptorChain = [];
3845
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
3846
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
3847
+ });
3848
+
3849
+ let promise;
3850
+ let i = 0;
3851
+ let len;
3852
+
3853
+ if (!synchronousRequestInterceptors) {
3854
+ const chain = [dispatchRequest.bind(this), undefined];
3855
+ chain.unshift.apply(chain, requestInterceptorChain);
3856
+ chain.push.apply(chain, responseInterceptorChain);
3857
+ len = chain.length;
3858
+
3859
+ promise = Promise.resolve(config);
3860
+
3861
+ while (i < len) {
3862
+ promise = promise.then(chain[i++], chain[i++]);
3863
+ }
3864
+
3865
+ return promise;
3866
+ }
3867
+
3868
+ len = requestInterceptorChain.length;
3869
+
3870
+ let newConfig = config;
3871
+
3872
+ i = 0;
3873
+
3874
+ while (i < len) {
3875
+ const onFulfilled = requestInterceptorChain[i++];
3876
+ const onRejected = requestInterceptorChain[i++];
3877
+ try {
3878
+ newConfig = onFulfilled(newConfig);
3879
+ } catch (error) {
3880
+ onRejected.call(this, error);
3881
+ break;
3882
+ }
3883
+ }
3884
+
3885
+ try {
3886
+ promise = dispatchRequest.call(this, newConfig);
3887
+ } catch (error) {
3888
+ return Promise.reject(error);
3889
+ }
3890
+
3891
+ i = 0;
3892
+ len = responseInterceptorChain.length;
3893
+
3894
+ while (i < len) {
3895
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
3896
+ }
3897
+
3898
+ return promise;
3899
+ }
3900
+
3901
+ getUri(config) {
3902
+ config = mergeConfig(this.defaults, config);
3903
+ const fullPath = buildFullPath(config.baseURL, config.url);
3904
+ return buildURL(fullPath, config.params, config.paramsSerializer);
3905
+ }
3906
+ }
3907
+
3908
+ // Provide aliases for supported request methods
3909
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
3910
+ /*eslint func-names:0*/
3911
+ Axios.prototype[method] = function(url, config) {
3912
+ return this.request(mergeConfig(config || {}, {
3913
+ method,
3914
+ url,
3915
+ data: (config || {}).data
3916
+ }));
3917
+ };
3918
+ });
3919
+
3920
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
3921
+ /*eslint func-names:0*/
3922
+
3923
+ function generateHTTPMethod(isForm) {
3924
+ return function httpMethod(url, data, config) {
3925
+ return this.request(mergeConfig(config || {}, {
3926
+ method,
3927
+ headers: isForm ? {
3928
+ 'Content-Type': 'multipart/form-data'
3929
+ } : {},
3930
+ url,
3931
+ data
3932
+ }));
3933
+ };
3934
+ }
3935
+
3936
+ Axios.prototype[method] = generateHTTPMethod();
3937
+
3938
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
3939
+ });
3940
+
3941
+ const Axios$1 = Axios;
3942
+
3943
+ /**
3944
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
3945
+ *
3946
+ * @param {Function} executor The executor function.
3947
+ *
3948
+ * @returns {CancelToken}
3949
+ */
3950
+ class CancelToken {
3951
+ constructor(executor) {
3952
+ if (typeof executor !== 'function') {
3953
+ throw new TypeError('executor must be a function.');
3954
+ }
3955
+
3956
+ let resolvePromise;
3957
+
3958
+ this.promise = new Promise(function promiseExecutor(resolve) {
3959
+ resolvePromise = resolve;
3960
+ });
3961
+
3962
+ const token = this;
3963
+
3964
+ // eslint-disable-next-line func-names
3965
+ this.promise.then(cancel => {
3966
+ if (!token._listeners) return;
3967
+
3968
+ let i = token._listeners.length;
3969
+
3970
+ while (i-- > 0) {
3971
+ token._listeners[i](cancel);
3972
+ }
3973
+ token._listeners = null;
3974
+ });
3975
+
3976
+ // eslint-disable-next-line func-names
3977
+ this.promise.then = onfulfilled => {
3978
+ let _resolve;
3979
+ // eslint-disable-next-line func-names
3980
+ const promise = new Promise(resolve => {
3981
+ token.subscribe(resolve);
3982
+ _resolve = resolve;
3983
+ }).then(onfulfilled);
3984
+
3985
+ promise.cancel = function reject() {
3986
+ token.unsubscribe(_resolve);
3987
+ };
3988
+
3989
+ return promise;
3990
+ };
3991
+
3992
+ executor(function cancel(message, config, request) {
3993
+ if (token.reason) {
3994
+ // Cancellation has already been requested
3995
+ return;
3996
+ }
3997
+
3998
+ token.reason = new CanceledError(message, config, request);
3999
+ resolvePromise(token.reason);
4000
+ });
4001
+ }
4002
+
4003
+ /**
4004
+ * Throws a `CanceledError` if cancellation has been requested.
4005
+ */
4006
+ throwIfRequested() {
4007
+ if (this.reason) {
4008
+ throw this.reason;
4009
+ }
4010
+ }
4011
+
4012
+ /**
4013
+ * Subscribe to the cancel signal
4014
+ */
4015
+
4016
+ subscribe(listener) {
4017
+ if (this.reason) {
4018
+ listener(this.reason);
4019
+ return;
4020
+ }
4021
+
4022
+ if (this._listeners) {
4023
+ this._listeners.push(listener);
4024
+ } else {
4025
+ this._listeners = [listener];
4026
+ }
4027
+ }
4028
+
4029
+ /**
4030
+ * Unsubscribe from the cancel signal
4031
+ */
4032
+
4033
+ unsubscribe(listener) {
4034
+ if (!this._listeners) {
4035
+ return;
4036
+ }
4037
+ const index = this._listeners.indexOf(listener);
4038
+ if (index !== -1) {
4039
+ this._listeners.splice(index, 1);
4040
+ }
4041
+ }
4042
+
4043
+ /**
4044
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
4045
+ * cancels the `CancelToken`.
4046
+ */
4047
+ static source() {
4048
+ let cancel;
4049
+ const token = new CancelToken(function executor(c) {
4050
+ cancel = c;
4051
+ });
4052
+ return {
4053
+ token,
4054
+ cancel
4055
+ };
4056
+ }
4057
+ }
4058
+
4059
+ const CancelToken$1 = CancelToken;
4060
+
4061
+ /**
4062
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
4063
+ *
4064
+ * Common use case would be to use `Function.prototype.apply`.
4065
+ *
4066
+ * ```js
4067
+ * function f(x, y, z) {}
4068
+ * var args = [1, 2, 3];
4069
+ * f.apply(null, args);
4070
+ * ```
4071
+ *
4072
+ * With `spread` this example can be re-written.
4073
+ *
4074
+ * ```js
4075
+ * spread(function(x, y, z) {})([1, 2, 3]);
4076
+ * ```
4077
+ *
4078
+ * @param {Function} callback
4079
+ *
4080
+ * @returns {Function}
4081
+ */
4082
+ function spread(callback) {
4083
+ return function wrap(arr) {
4084
+ return callback.apply(null, arr);
4085
+ };
4086
+ }
4087
+
4088
+ /**
4089
+ * Determines whether the payload is an error thrown by Axios
4090
+ *
4091
+ * @param {*} payload The value to test
4092
+ *
4093
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4094
+ */
4095
+ function isAxiosError(payload) {
4096
+ return utils.isObject(payload) && (payload.isAxiosError === true);
4097
+ }
4098
+
4099
+ const HttpStatusCode = {
4100
+ Continue: 100,
4101
+ SwitchingProtocols: 101,
4102
+ Processing: 102,
4103
+ EarlyHints: 103,
4104
+ Ok: 200,
4105
+ Created: 201,
4106
+ Accepted: 202,
4107
+ NonAuthoritativeInformation: 203,
4108
+ NoContent: 204,
4109
+ ResetContent: 205,
4110
+ PartialContent: 206,
4111
+ MultiStatus: 207,
4112
+ AlreadyReported: 208,
4113
+ ImUsed: 226,
4114
+ MultipleChoices: 300,
4115
+ MovedPermanently: 301,
4116
+ Found: 302,
4117
+ SeeOther: 303,
4118
+ NotModified: 304,
4119
+ UseProxy: 305,
4120
+ Unused: 306,
4121
+ TemporaryRedirect: 307,
4122
+ PermanentRedirect: 308,
4123
+ BadRequest: 400,
4124
+ Unauthorized: 401,
4125
+ PaymentRequired: 402,
4126
+ Forbidden: 403,
4127
+ NotFound: 404,
4128
+ MethodNotAllowed: 405,
4129
+ NotAcceptable: 406,
4130
+ ProxyAuthenticationRequired: 407,
4131
+ RequestTimeout: 408,
4132
+ Conflict: 409,
4133
+ Gone: 410,
4134
+ LengthRequired: 411,
4135
+ PreconditionFailed: 412,
4136
+ PayloadTooLarge: 413,
4137
+ UriTooLong: 414,
4138
+ UnsupportedMediaType: 415,
4139
+ RangeNotSatisfiable: 416,
4140
+ ExpectationFailed: 417,
4141
+ ImATeapot: 418,
4142
+ MisdirectedRequest: 421,
4143
+ UnprocessableEntity: 422,
4144
+ Locked: 423,
4145
+ FailedDependency: 424,
4146
+ TooEarly: 425,
4147
+ UpgradeRequired: 426,
4148
+ PreconditionRequired: 428,
4149
+ TooManyRequests: 429,
4150
+ RequestHeaderFieldsTooLarge: 431,
4151
+ UnavailableForLegalReasons: 451,
4152
+ InternalServerError: 500,
4153
+ NotImplemented: 501,
4154
+ BadGateway: 502,
4155
+ ServiceUnavailable: 503,
4156
+ GatewayTimeout: 504,
4157
+ HttpVersionNotSupported: 505,
4158
+ VariantAlsoNegotiates: 506,
4159
+ InsufficientStorage: 507,
4160
+ LoopDetected: 508,
4161
+ NotExtended: 510,
4162
+ NetworkAuthenticationRequired: 511,
4163
+ };
4164
+
4165
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
4166
+ HttpStatusCode[value] = key;
4167
+ });
4168
+
4169
+ const HttpStatusCode$1 = HttpStatusCode;
4170
+
4171
+ /**
4172
+ * Create an instance of Axios
4173
+ *
4174
+ * @param {Object} defaultConfig The default config for the instance
4175
+ *
4176
+ * @returns {Axios} A new instance of Axios
4177
+ */
4178
+ function createInstance(defaultConfig) {
4179
+ const context = new Axios$1(defaultConfig);
4180
+ const instance = bind(Axios$1.prototype.request, context);
4181
+
4182
+ // Copy axios.prototype to instance
4183
+ utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
4184
+
4185
+ // Copy context to instance
4186
+ utils.extend(instance, context, null, {allOwnKeys: true});
4187
+
4188
+ // Factory for creating new instances
4189
+ instance.create = function create(instanceConfig) {
4190
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
4191
+ };
4192
+
4193
+ return instance;
4194
+ }
4195
+
4196
+ // Create the default instance to be exported
4197
+ const axios = createInstance(defaults$1);
4198
+
4199
+ // Expose Axios class to allow class inheritance
4200
+ axios.Axios = Axios$1;
4201
+
4202
+ // Expose Cancel & CancelToken
4203
+ axios.CanceledError = CanceledError;
4204
+ axios.CancelToken = CancelToken$1;
4205
+ axios.isCancel = isCancel;
4206
+ axios.VERSION = VERSION;
4207
+ axios.toFormData = toFormData;
4208
+
4209
+ // Expose AxiosError class
4210
+ axios.AxiosError = AxiosError;
4211
+
4212
+ // alias for CanceledError for backward compatibility
4213
+ axios.Cancel = axios.CanceledError;
4214
+
4215
+ // Expose all/spread
4216
+ axios.all = function all(promises) {
4217
+ return Promise.all(promises);
4218
+ };
4219
+
4220
+ axios.spread = spread;
4221
+
4222
+ // Expose isAxiosError
4223
+ axios.isAxiosError = isAxiosError;
4224
+
4225
+ // Expose mergeConfig
4226
+ axios.mergeConfig = mergeConfig;
4227
+
4228
+ axios.AxiosHeaders = AxiosHeaders$1;
4229
+
4230
+ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
4231
+
4232
+ axios.HttpStatusCode = HttpStatusCode$1;
4233
+
4234
+ axios.default = axios;
4235
+
4236
+ module.exports = axios;
4237
+ //# sourceMappingURL=axios.cjs.map