@ued_fpi/data-visual 1.1.0 → 1.1.1

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 (357) hide show
  1. package/dist/es/aims/service/request.mjs +1 -1
  2. package/dist/es/aims/src/AirQualityCalendar/index.mjs +12 -7
  3. package/dist/es/aims/src/AirQualityLevelMonthRatio/index.mjs +5 -5
  4. package/dist/es/aims/src/AirQualityLevelYearRatio/index.mjs +3 -3
  5. package/dist/es/aims/src/AirQualityPresentSituation/index.mjs +10 -13
  6. package/dist/es/aims/src/AirQualityRealTime/index.mjs +13 -16
  7. package/dist/es/aims/src/AirTimeSeriesAnalysis/index.mjs +1 -1
  8. package/dist/es/aims/src/CieqContributionMonthRatio/index.mjs +3 -3
  9. package/dist/es/aims/src/CieqContributionYearRatio/index.mjs +5 -5
  10. package/dist/es/aims/src/FactorRealTimeRankChart/index.mjs +6 -7
  11. package/dist/es/aims/src/FactorRealTimeRankList/index.mjs +7 -7
  12. package/dist/es/aims/src/FactorTargetYearPeriod/index.mjs +3 -3
  13. package/dist/es/aims/src/MainPollutionMonthRatio/index.mjs +3 -3
  14. package/dist/es/aims/src/MainPollutionYearRatio/index.mjs +3 -3
  15. package/dist/es/aims/src/MulGridAirQualityLevelMonthRatio/index.mjs +3 -3
  16. package/dist/es/aims/src/MulGridCieqContributionMonthRatio/index.mjs +3 -3
  17. package/dist/es/aims/src/TbHbAnalysis/index.mjs +4 -4
  18. package/dist/es/aims/src/WeatherCondition/index.mjs +5 -5
  19. package/dist/es/aims/src/common/BasicDialog/index.mjs +3 -3
  20. package/dist/es/aims/src/common/BasicEcharts/index.mjs +2 -2
  21. package/dist/es/aims/src/common/BasicPanel/index.mjs +3 -1
  22. package/dist/es/aims/utils/tools.mjs +1 -1
  23. package/dist/es/bmp/config/index.mjs +7 -0
  24. package/dist/es/bmp/service/base-serve.d.ts +4 -0
  25. package/dist/es/bmp/service/base-serve.mjs +12 -0
  26. package/dist/es/bmp/service/request.d.ts +3 -0
  27. package/dist/es/bmp/service/request.mjs +78 -0
  28. package/dist/es/bmp/service/types.d.ts +14 -0
  29. package/dist/es/bmp/src/AlgaeMonitoring/api/index.d.ts +6 -0
  30. package/dist/es/bmp/src/AlgaeMonitoring/api/index.mjs +12 -0
  31. package/dist/es/bmp/src/AlgaeMonitoring/api/types.d.ts +21 -0
  32. package/dist/es/bmp/src/AlgaeMonitoring/images/checked.mjs +3 -0
  33. package/dist/es/bmp/src/AlgaeMonitoring/images/today-alarm.mjs +3 -0
  34. package/dist/es/bmp/src/AlgaeMonitoring/index.d.ts +97 -0
  35. package/dist/es/bmp/src/AlgaeMonitoring/index.mjs +193 -0
  36. package/dist/es/bmp/src/AlgaeMonitoring/index.vue.d.ts +6 -0
  37. package/dist/es/bmp/src/index.d.ts +1 -1
  38. package/dist/es/bmp/src/index.mjs +2 -2
  39. package/dist/es/index.mjs +58 -20
  40. package/dist/es/ipes/service/request.mjs +2 -1
  41. package/dist/es/ipes/src/AccessVehicleManage/index.d.ts +81 -7
  42. package/dist/es/ipes/src/AccessVehicleManage/index.mjs +103 -40
  43. package/dist/es/ipes/src/AccessVehicleManage/index.vue.d.ts +48 -3
  44. package/dist/es/ipes/src/AirPollutionDischarge/images/new-nodata.mjs +3 -0
  45. package/dist/es/ipes/src/AirPollutionDischarge/index.d.ts +3 -107
  46. package/dist/es/ipes/src/AirPollutionDischarge/index.mjs +184 -127
  47. package/dist/es/ipes/src/AirPollutionDischarge/index.vue.d.ts +1 -64
  48. package/dist/es/ipes/src/AirQuality/index.mjs +25 -16
  49. package/dist/es/ipes/src/AirQualityManagement/index.mjs +31 -20
  50. package/dist/es/ipes/src/AlarmManage/images/alarm.mjs +3 -0
  51. package/dist/es/ipes/src/AlarmManage/images/modeluIcon.mjs +3 -0
  52. package/dist/es/ipes/src/AlarmManage/images/new-nodata.mjs +3 -0
  53. package/dist/es/ipes/src/AlarmManage/index.d.ts +89 -0
  54. package/dist/es/ipes/src/AlarmManage/index.mjs +175 -0
  55. package/dist/es/ipes/src/AlarmManage/index.vue.d.ts +2 -0
  56. package/dist/es/ipes/src/AlarmManage/type.d.ts +5 -0
  57. package/dist/es/ipes/src/BusinessManage/images/icon-percent.mjs +3 -0
  58. package/dist/es/ipes/src/BusinessManage/index.d.ts +89 -0
  59. package/dist/es/ipes/src/BusinessManage/index.mjs +196 -0
  60. package/dist/es/ipes/src/BusinessManage/index.vue.d.ts +2 -0
  61. package/dist/es/ipes/src/BusinessManage/type.d.ts +10 -0
  62. package/dist/es/ipes/src/EmergencyDuty/index.mjs +3 -3
  63. package/dist/es/ipes/src/EnterpriseProtectionCode/index.d.ts +38 -3
  64. package/dist/es/ipes/src/EnterpriseProtectionCode/index.mjs +52 -30
  65. package/dist/es/ipes/src/EnterpriseProtectionCode/index.vue.d.ts +22 -1
  66. package/dist/es/ipes/src/EnvManage/index.mjs +17 -14
  67. package/dist/es/ipes/src/EnvironmentalProtection/images/module-title-icon.mjs +3 -0
  68. package/dist/es/ipes/src/EnvironmentalProtection/images/piebottom.mjs +3 -0
  69. package/dist/es/ipes/src/EnvironmentalProtection/images/pietop.mjs +3 -0
  70. package/dist/es/ipes/src/EnvironmentalProtection/index.d.ts +101 -0
  71. package/dist/es/ipes/src/EnvironmentalProtection/index.mjs +177 -0
  72. package/dist/es/ipes/src/EnvironmentalProtection/index.vue.d.ts +6 -0
  73. package/dist/es/ipes/src/EnvironmentalRiskManagement/.mjs +2 -2
  74. package/dist/es/ipes/src/EnvironmentalRiskManagement/index.d.ts +23 -3
  75. package/dist/es/ipes/src/EnvironmentalRiskManagement/index.mjs +48 -12
  76. package/dist/es/ipes/src/EnvironmentalRiskManagement/index.vue.d.ts +13 -1
  77. package/dist/es/ipes/src/GasControl/.mjs +120 -0
  78. package/dist/es/ipes/src/GasControl/components/AlarmStatistics.vue.d.ts +22 -0
  79. package/dist/es/ipes/src/GasControl/components/SingleItem.vue.d.ts +16 -0
  80. package/dist/es/{bmp/src/test-com → ipes/src/GasControl}/index.d.ts +28 -24
  81. package/dist/es/ipes/src/GasControl/index.mjs +103 -0
  82. package/dist/es/ipes/src/GasControl/index.vue.d.ts +23 -0
  83. package/dist/es/ipes/src/GeneralManagement/.mjs +14 -17
  84. package/dist/es/ipes/src/GeneralManagement/components/Tabs.vue.d.ts +10 -6
  85. package/dist/es/ipes/src/GeneralManagement/index.d.ts +18 -9
  86. package/dist/es/ipes/src/GeneralManagement/index.mjs +9 -11
  87. package/dist/es/ipes/src/GeneralManagement/index.vue.d.ts +12 -6
  88. package/dist/es/ipes/src/HazardousVehicleManage/index.d.ts +82 -14
  89. package/dist/es/ipes/src/HazardousVehicleManage/index.mjs +67 -42
  90. package/dist/es/ipes/src/HazardousVehicleManage/index.vue.d.ts +48 -5
  91. package/dist/es/ipes/src/InspectionManage/images/module-title-icon.mjs +3 -0
  92. package/dist/es/ipes/src/InspectionManage/images/new-nodata.mjs +3 -0
  93. package/dist/es/ipes/src/InspectionManage/index.d.ts +136 -0
  94. package/dist/es/ipes/src/InspectionManage/index.mjs +267 -0
  95. package/dist/es/ipes/src/InspectionManage/index.vue.d.ts +27 -0
  96. package/dist/es/ipes/src/InspectionManage/types/index.d.ts +11 -0
  97. package/dist/es/ipes/src/Level3AirDefense/.mjs +38 -12
  98. package/dist/es/ipes/src/Level3AirDefense/components/EmptyData.vue.d.ts +14 -0
  99. package/dist/es/ipes/src/Level3AirDefense/images/empty.mjs +3 -0
  100. package/dist/es/ipes/src/Level3AirDefense/index.mjs +10 -9
  101. package/dist/es/ipes/src/OdorControl/index.mjs +1 -1
  102. package/dist/es/ipes/src/PollutantSourceManage/index.d.ts +168 -0
  103. package/dist/es/ipes/src/PollutantSourceManage/index.mjs +90 -0
  104. package/dist/es/ipes/src/PollutantSourceManage/index.vue.d.ts +42 -0
  105. package/dist/es/ipes/src/PollutantSourceManage/types.d.ts +18 -0
  106. package/dist/es/ipes/src/RealTimeAirQualityManage/index.mjs +1 -1
  107. package/dist/es/ipes/src/SealingManage/index.d.ts +121 -14
  108. package/dist/es/ipes/src/SealingManage/index.mjs +221 -83
  109. package/dist/es/ipes/src/SealingManage/index.vue.d.ts +72 -5
  110. package/dist/es/ipes/src/TaskDispose/.mjs +2 -2
  111. package/dist/es/ipes/src/VocStatistics/index.mjs +2 -2
  112. package/dist/es/ipes/src/WaterNetworkManage/index.d.ts +81 -7
  113. package/dist/es/ipes/src/WaterNetworkManage/index.mjs +71 -39
  114. package/dist/es/ipes/src/WaterNetworkManage/index.vue.d.ts +48 -3
  115. package/dist/es/ipes/src/common/Echarts.mjs +2 -2
  116. package/dist/es/ipes/src/common/IpesPercentBar.mjs +38 -0
  117. package/dist/es/ipes/src/common/IpesProgressBar.mjs +38 -0
  118. package/dist/es/ipes/src/common/LottieAnimation.mjs +3 -3
  119. package/dist/es/ipes/src/index.d.ts +6 -0
  120. package/dist/es/ipes/src/index.mjs +12 -0
  121. package/dist/es/style.css +1514 -909
  122. package/dist/es/wgms/service/request.mjs +1 -1
  123. package/dist/es/wgms/src/AuxiliaryJudgment/index.mjs +3 -3
  124. package/dist/es/wgms/src/ChangesAlongTheProcess/index.mjs +3 -3
  125. package/dist/es/wgms/src/ChlorophyllAchangeRate/index.mjs +5 -5
  126. package/dist/es/wgms/src/CrossSectionCorrelation/index.mjs +4 -4
  127. package/dist/es/wgms/src/DistributionPoints/index.mjs +4 -4
  128. package/dist/es/wgms/src/DrinkingWaterComplianceRate/index.mjs +2 -2
  129. package/dist/es/wgms/src/EnvironmentalAnalysis/index.mjs +7 -5
  130. package/dist/es/wgms/src/FactorTopThreeRanking/index.mjs +4 -4
  131. package/dist/es/wgms/src/FactorTrendComparison/index.mjs +2 -2
  132. package/dist/es/wgms/src/KeyRiverWaterQualityEvaluation/index.mjs +3 -3
  133. package/dist/es/wgms/src/LakeRiverIndex/index.mjs +4 -4
  134. package/dist/es/wgms/src/NPTrendChange/index.mjs +2 -2
  135. package/dist/es/wgms/src/SevenDayKline/index.mjs +4 -4
  136. package/dist/es/wgms/src/SewageOutletsOnlineMonitor/index.mjs +4 -4
  137. package/dist/es/wgms/src/SewageOutletsOnlineMonitor/index.vue.d.ts +0 -1
  138. package/dist/es/wgms/src/SubordinateRanking/index.mjs +7 -4
  139. package/dist/es/wgms/src/SurroundingPollution/index.mjs +5 -5
  140. package/dist/es/wgms/src/UpstreamImpact/index.mjs +3 -3
  141. package/dist/es/wgms/src/UpstreamSection/index.mjs +3 -3
  142. package/dist/es/wgms/src/WaterEnvironmentOnlineMonitor/index.mjs +2 -2
  143. package/dist/es/wgms/src/WaterQualityClassification/index.mjs +3 -3
  144. package/dist/es/wgms/src/WaterQualityRainfall/index.mjs +3 -3
  145. package/dist/es/wgms/src/WaterQualityStatus/index.mjs +3 -3
  146. package/dist/es/wgms/src/common/select-panel.mjs +3 -1
  147. package/dist/es/wgms/utils/echarts/index.mjs +14 -2
  148. package/dist/es/wgms/utils/tools.mjs +1 -1
  149. package/dist/lib/aims/service/request.js +3 -3
  150. package/dist/lib/aims/src/AirQualityCalendar/index.js +20 -15
  151. package/dist/lib/aims/src/AirQualityLevelMonthRatio/index.js +6 -6
  152. package/dist/lib/aims/src/AirQualityLevelYearRatio/index.js +4 -4
  153. package/dist/lib/aims/src/AirQualityPresentSituation/index.js +9 -12
  154. package/dist/lib/aims/src/AirQualityRealTime/index.js +12 -15
  155. package/dist/lib/aims/src/AirTimeSeriesAnalysis/index.js +5 -5
  156. package/dist/lib/aims/src/CieqContributionMonthRatio/index.js +4 -4
  157. package/dist/lib/aims/src/CieqContributionYearRatio/index.js +6 -6
  158. package/dist/lib/aims/src/FactorRealTimeRankChart/index.js +7 -8
  159. package/dist/lib/aims/src/FactorRealTimeRankList/index.js +8 -8
  160. package/dist/lib/aims/src/FactorTargetYearPeriod/index.js +4 -4
  161. package/dist/lib/aims/src/MainPollutionMonthRatio/index.js +4 -4
  162. package/dist/lib/aims/src/MainPollutionYearRatio/index.js +4 -4
  163. package/dist/lib/aims/src/MulGridAirQualityLevelMonthRatio/index.js +4 -4
  164. package/dist/lib/aims/src/MulGridCieqContributionMonthRatio/index.js +4 -4
  165. package/dist/lib/aims/src/TbHbAnalysis/index.js +6 -6
  166. package/dist/lib/aims/src/WeatherCondition/index.js +5 -5
  167. package/dist/lib/aims/src/common/BasicDialog/index.js +3 -3
  168. package/dist/lib/aims/src/common/BasicEcharts/index.js +21 -2
  169. package/dist/lib/aims/src/common/BasicPanel/index.js +4 -2
  170. package/dist/lib/aims/utils/tools.js +2 -2
  171. package/dist/lib/bmp/config/index.js +8 -0
  172. package/dist/lib/bmp/service/base-serve.d.ts +4 -0
  173. package/dist/lib/bmp/service/base-serve.js +14 -0
  174. package/dist/lib/bmp/service/request.d.ts +3 -0
  175. package/dist/lib/bmp/service/request.js +80 -0
  176. package/dist/lib/bmp/service/types.d.ts +14 -0
  177. package/dist/lib/bmp/src/AlgaeMonitoring/api/index.d.ts +6 -0
  178. package/dist/lib/bmp/src/AlgaeMonitoring/api/index.js +14 -0
  179. package/dist/lib/bmp/src/AlgaeMonitoring/api/types.d.ts +21 -0
  180. package/dist/lib/bmp/src/AlgaeMonitoring/images/checked.js +5 -0
  181. package/dist/lib/bmp/src/AlgaeMonitoring/images/today-alarm.js +5 -0
  182. package/dist/lib/bmp/src/AlgaeMonitoring/index.d.ts +97 -0
  183. package/dist/lib/bmp/src/AlgaeMonitoring/index.js +214 -0
  184. package/dist/lib/bmp/src/AlgaeMonitoring/index.vue.d.ts +6 -0
  185. package/dist/lib/bmp/src/index.d.ts +1 -1
  186. package/dist/lib/bmp/src/index.js +2 -2
  187. package/dist/lib/index.js +65 -21
  188. package/dist/lib/ipes/service/request.js +4 -3
  189. package/dist/lib/ipes/src/AccessVehicleManage/index.d.ts +81 -7
  190. package/dist/lib/ipes/src/AccessVehicleManage/index.js +107 -44
  191. package/dist/lib/ipes/src/AccessVehicleManage/index.vue.d.ts +48 -3
  192. package/dist/lib/ipes/src/AirPollutionDischarge/images/new-nodata.js +5 -0
  193. package/dist/lib/ipes/src/AirPollutionDischarge/index.d.ts +3 -107
  194. package/dist/lib/ipes/src/AirPollutionDischarge/index.js +183 -126
  195. package/dist/lib/ipes/src/AirPollutionDischarge/index.vue.d.ts +1 -64
  196. package/dist/lib/ipes/src/AirQuality/index.js +25 -16
  197. package/dist/lib/ipes/src/AirQualityManagement/index.js +31 -20
  198. package/dist/lib/ipes/src/AlarmManage/images/alarm.js +5 -0
  199. package/dist/lib/ipes/src/AlarmManage/images/modeluIcon.js +5 -0
  200. package/dist/lib/ipes/src/AlarmManage/images/new-nodata.js +5 -0
  201. package/dist/lib/ipes/src/AlarmManage/index.d.ts +89 -0
  202. package/dist/lib/ipes/src/AlarmManage/index.js +177 -0
  203. package/dist/lib/ipes/src/AlarmManage/index.vue.d.ts +2 -0
  204. package/dist/lib/ipes/src/AlarmManage/type.d.ts +5 -0
  205. package/dist/lib/ipes/src/BusinessManage/images/icon-percent.js +5 -0
  206. package/dist/lib/ipes/src/BusinessManage/index.d.ts +89 -0
  207. package/dist/lib/ipes/src/BusinessManage/index.js +198 -0
  208. package/dist/lib/ipes/src/BusinessManage/index.vue.d.ts +2 -0
  209. package/dist/lib/ipes/src/BusinessManage/type.d.ts +10 -0
  210. package/dist/lib/ipes/src/EmergencyDuty/index.js +3 -3
  211. package/dist/lib/ipes/src/EnterpriseProtectionCode/index.d.ts +38 -3
  212. package/dist/lib/ipes/src/EnterpriseProtectionCode/index.js +52 -30
  213. package/dist/lib/ipes/src/EnterpriseProtectionCode/index.vue.d.ts +22 -1
  214. package/dist/lib/ipes/src/EnvManage/index.js +19 -16
  215. package/dist/lib/ipes/src/EnvironmentalProtection/images/module-title-icon.js +5 -0
  216. package/dist/lib/ipes/src/EnvironmentalProtection/images/piebottom.js +5 -0
  217. package/dist/lib/ipes/src/EnvironmentalProtection/images/pietop.js +5 -0
  218. package/dist/lib/ipes/src/EnvironmentalProtection/index.d.ts +101 -0
  219. package/dist/lib/ipes/src/EnvironmentalProtection/index.js +179 -0
  220. package/dist/lib/ipes/src/EnvironmentalProtection/index.vue.d.ts +6 -0
  221. package/dist/lib/ipes/src/EnvironmentalRiskManagement/.js +2 -2
  222. package/dist/lib/ipes/src/EnvironmentalRiskManagement/index.d.ts +23 -3
  223. package/dist/lib/ipes/src/EnvironmentalRiskManagement/index.js +47 -11
  224. package/dist/lib/ipes/src/EnvironmentalRiskManagement/index.vue.d.ts +13 -1
  225. package/dist/lib/ipes/src/GasControl/.js +123 -0
  226. package/dist/lib/ipes/src/GasControl/components/AlarmStatistics.vue.d.ts +22 -0
  227. package/dist/lib/ipes/src/GasControl/components/SingleItem.vue.d.ts +16 -0
  228. package/dist/lib/{bmp/src/test-com → ipes/src/GasControl}/index.d.ts +28 -24
  229. package/dist/lib/ipes/src/GasControl/index.js +105 -0
  230. package/dist/lib/ipes/src/GasControl/index.vue.d.ts +23 -0
  231. package/dist/lib/ipes/src/GeneralManagement/.js +13 -16
  232. package/dist/lib/ipes/src/GeneralManagement/components/Tabs.vue.d.ts +10 -6
  233. package/dist/lib/ipes/src/GeneralManagement/index.d.ts +18 -9
  234. package/dist/lib/ipes/src/GeneralManagement/index.js +8 -10
  235. package/dist/lib/ipes/src/GeneralManagement/index.vue.d.ts +12 -6
  236. package/dist/lib/ipes/src/HazardousVehicleManage/index.d.ts +82 -14
  237. package/dist/lib/ipes/src/HazardousVehicleManage/index.js +74 -49
  238. package/dist/lib/ipes/src/HazardousVehicleManage/index.vue.d.ts +48 -5
  239. package/dist/lib/ipes/src/InspectionManage/images/module-title-icon.js +5 -0
  240. package/dist/lib/ipes/src/InspectionManage/images/new-nodata.js +5 -0
  241. package/dist/lib/ipes/src/InspectionManage/index.d.ts +136 -0
  242. package/dist/lib/ipes/src/InspectionManage/index.js +269 -0
  243. package/dist/lib/ipes/src/InspectionManage/index.vue.d.ts +27 -0
  244. package/dist/lib/ipes/src/InspectionManage/types/index.d.ts +11 -0
  245. package/dist/lib/ipes/src/Level3AirDefense/.js +37 -10
  246. package/dist/lib/ipes/src/Level3AirDefense/components/EmptyData.vue.d.ts +14 -0
  247. package/dist/lib/ipes/src/Level3AirDefense/images/empty.js +5 -0
  248. package/dist/lib/ipes/src/Level3AirDefense/index.js +9 -8
  249. package/dist/lib/ipes/src/OdorControl/index.js +2 -2
  250. package/dist/lib/ipes/src/PollutantSourceManage/index.d.ts +168 -0
  251. package/dist/lib/ipes/src/PollutantSourceManage/index.js +92 -0
  252. package/dist/lib/ipes/src/PollutantSourceManage/index.vue.d.ts +42 -0
  253. package/dist/lib/ipes/src/PollutantSourceManage/types.d.ts +18 -0
  254. package/dist/lib/ipes/src/RealTimeAirQualityManage/index.js +2 -2
  255. package/dist/lib/ipes/src/SealingManage/index.d.ts +121 -14
  256. package/dist/lib/ipes/src/SealingManage/index.js +222 -84
  257. package/dist/lib/ipes/src/SealingManage/index.vue.d.ts +72 -5
  258. package/dist/lib/ipes/src/TaskDispose/.js +21 -2
  259. package/dist/lib/ipes/src/VocStatistics/index.js +2 -2
  260. package/dist/lib/ipes/src/WaterNetworkManage/index.d.ts +81 -7
  261. package/dist/lib/ipes/src/WaterNetworkManage/index.js +73 -41
  262. package/dist/lib/ipes/src/WaterNetworkManage/index.vue.d.ts +48 -3
  263. package/dist/lib/ipes/src/common/Echarts.js +21 -2
  264. package/dist/lib/ipes/src/common/IpesPercentBar.js +40 -0
  265. package/dist/lib/ipes/src/common/IpesProgressBar.js +40 -0
  266. package/dist/lib/ipes/src/common/LottieAnimation.js +2 -2
  267. package/dist/lib/ipes/src/index.d.ts +6 -0
  268. package/dist/lib/ipes/src/index.js +12 -0
  269. package/dist/lib/style.css +1514 -909
  270. package/dist/lib/wgms/service/request.js +3 -3
  271. package/dist/lib/wgms/src/AuxiliaryJudgment/index.js +5 -5
  272. package/dist/lib/wgms/src/ChangesAlongTheProcess/index.js +4 -4
  273. package/dist/lib/wgms/src/ChlorophyllAchangeRate/index.js +4 -4
  274. package/dist/lib/wgms/src/CrossSectionCorrelation/index.js +6 -6
  275. package/dist/lib/wgms/src/DistributionPoints/index.js +3 -3
  276. package/dist/lib/wgms/src/DrinkingWaterComplianceRate/index.js +2 -2
  277. package/dist/lib/wgms/src/EnvironmentalAnalysis/index.js +10 -8
  278. package/dist/lib/wgms/src/FactorTopThreeRanking/index.js +3 -3
  279. package/dist/lib/wgms/src/FactorTrendComparison/index.js +2 -2
  280. package/dist/lib/wgms/src/KeyRiverWaterQualityEvaluation/index.js +3 -3
  281. package/dist/lib/wgms/src/LakeRiverIndex/index.js +6 -6
  282. package/dist/lib/wgms/src/NPTrendChange/index.js +2 -2
  283. package/dist/lib/wgms/src/SevenDayKline/index.js +9 -9
  284. package/dist/lib/wgms/src/SewageOutletsOnlineMonitor/index.js +4 -4
  285. package/dist/lib/wgms/src/SewageOutletsOnlineMonitor/index.vue.d.ts +0 -1
  286. package/dist/lib/wgms/src/SubordinateRanking/index.js +12 -9
  287. package/dist/lib/wgms/src/SurroundingPollution/index.js +8 -8
  288. package/dist/lib/wgms/src/UpstreamImpact/index.js +4 -4
  289. package/dist/lib/wgms/src/UpstreamSection/index.js +3 -3
  290. package/dist/lib/wgms/src/WaterEnvironmentOnlineMonitor/index.js +2 -2
  291. package/dist/lib/wgms/src/WaterQualityClassification/index.js +3 -3
  292. package/dist/lib/wgms/src/WaterQualityRainfall/index.js +5 -5
  293. package/dist/lib/wgms/src/WaterQualityStatus/index.js +3 -3
  294. package/dist/lib/wgms/src/common/select-panel.js +4 -2
  295. package/dist/lib/wgms/utils/echarts/index.js +34 -3
  296. package/dist/lib/wgms/utils/tools.js +2 -2
  297. package/package.json +2 -2
  298. package/dist/es/bmp/src/test-com/index.mjs +0 -33
  299. package/dist/es/bmp/src/test-com/index.vue.d.ts +0 -23
  300. package/dist/es/bmp/src/test-com/types.d.ts +0 -16
  301. package/dist/es/vendor/@ctrl_tinycolor@3.6.0.mjs +0 -1136
  302. package/dist/es/vendor/@element-plus_icons-vue@2.0.10_vue@3.3.4.mjs +0 -376
  303. package/dist/es/vendor/@floating-ui_core@1.3.1.mjs +0 -1
  304. package/dist/es/vendor/@floating-ui_dom@1.4.4.mjs +0 -1
  305. package/dist/es/vendor/@sxzz_popperjs-es@2.11.7.mjs +0 -3
  306. package/dist/es/vendor/@ued_fpi_element-plus-expand@0.7.19.mjs +0 -243
  307. package/dist/es/vendor/@vue_reactivity@3.3.4.mjs +0 -1
  308. package/dist/es/vendor/@vue_shared@3.3.4.mjs +0 -29
  309. package/dist/es/vendor/@vueuse_core@9.13.0_vue@3.3.4.mjs +0 -214
  310. package/dist/es/vendor/@vueuse_shared@9.13.0_vue@3.3.4.mjs +0 -72
  311. package/dist/es/vendor/async-validator@4.2.5.mjs +0 -1
  312. package/dist/es/vendor/axios@1.4.0.mjs +0 -3209
  313. package/dist/es/vendor/claygl@1.3.0.mjs +0 -24199
  314. package/dist/es/vendor/dayjs@1.11.9.mjs +0 -88
  315. package/dist/es/vendor/echarts-gl@2.0.9_echarts@5.4.2.mjs +0 -20973
  316. package/dist/es/vendor/echarts@5.4.2.mjs +0 -79359
  317. package/dist/es/vendor/element-plus@2.3.7_vue@3.3.4.mjs +0 -11032
  318. package/dist/es/vendor/escape-html@1.0.3.mjs +0 -1
  319. package/dist/es/vendor/fpi-tg-factor-tools@1.0.4.mjs +0 -195
  320. package/dist/es/vendor/lodash-es@4.17.21.mjs +0 -3255
  321. package/dist/es/vendor/lodash-unified@1.0.3_tknf7errc3xdqocd3ryzzla7vq.mjs +0 -1
  322. package/dist/es/vendor/memoize-one@6.0.0.mjs +0 -1
  323. package/dist/es/vendor/normalize-wheel-es@1.2.0.mjs +0 -1
  324. package/dist/es/vendor/tslib@2.3.0.mjs +0 -32
  325. package/dist/es/vendor/vue-demi@0.14.5_vue@3.3.4.mjs +0 -1
  326. package/dist/es/vendor/vue3-seamless-scroll@2.0.1.mjs +0 -562
  327. package/dist/es/vendor/zrender@5.4.3.mjs +0 -16894
  328. package/dist/lib/bmp/src/test-com/index.js +0 -35
  329. package/dist/lib/bmp/src/test-com/index.vue.d.ts +0 -23
  330. package/dist/lib/bmp/src/test-com/types.d.ts +0 -16
  331. package/dist/lib/vendor/@ctrl_tinycolor@3.6.0.js +0 -1138
  332. package/dist/lib/vendor/@element-plus_icons-vue@2.0.10_vue@3.3.4.js +0 -396
  333. package/dist/lib/vendor/@floating-ui_core@1.3.1.js +0 -2
  334. package/dist/lib/vendor/@floating-ui_dom@1.4.4.js +0 -2
  335. package/dist/lib/vendor/@sxzz_popperjs-es@2.11.7.js +0 -6
  336. package/dist/lib/vendor/@ued_fpi_element-plus-expand@0.7.19.js +0 -245
  337. package/dist/lib/vendor/@vue_reactivity@3.3.4.js +0 -2
  338. package/dist/lib/vendor/@vue_shared@3.3.4.js +0 -39
  339. package/dist/lib/vendor/@vueuse_core@9.13.0_vue@3.3.4.js +0 -219
  340. package/dist/lib/vendor/@vueuse_shared@9.13.0_vue@3.3.4.js +0 -82
  341. package/dist/lib/vendor/async-validator@4.2.5.js +0 -2
  342. package/dist/lib/vendor/axios@1.4.0.js +0 -3211
  343. package/dist/lib/vendor/claygl@1.3.0.js +0 -24255
  344. package/dist/lib/vendor/dayjs@1.11.9.js +0 -98
  345. package/dist/lib/vendor/echarts-gl@2.0.9_echarts@5.4.2.js +0 -20975
  346. package/dist/lib/vendor/echarts@5.4.2.js +0 -79400
  347. package/dist/lib/vendor/element-plus@2.3.7_vue@3.3.4.js +0 -11041
  348. package/dist/lib/vendor/escape-html@1.0.3.js +0 -2
  349. package/dist/lib/vendor/fpi-tg-factor-tools@1.0.4.js +0 -201
  350. package/dist/lib/vendor/lodash-es@4.17.21.js +0 -3265
  351. package/dist/lib/vendor/lodash-unified@1.0.3_tknf7errc3xdqocd3ryzzla7vq.js +0 -2
  352. package/dist/lib/vendor/memoize-one@6.0.0.js +0 -2
  353. package/dist/lib/vendor/normalize-wheel-es@1.2.0.js +0 -2
  354. package/dist/lib/vendor/tslib@2.3.0.js +0 -34
  355. package/dist/lib/vendor/vue-demi@0.14.5_vue@3.3.4.js +0 -4
  356. package/dist/lib/vendor/vue3-seamless-scroll@2.0.1.js +0 -564
  357. package/dist/lib/vendor/zrender@5.4.3.js +0 -17049
@@ -1,3211 +0,0 @@
1
- 'use strict';
2
-
3
- function bind(fn, thisArg) {
4
- return function wrap() {
5
- return fn.apply(thisArg, arguments);
6
- };
7
- }
8
-
9
- // utils is a library of generic helper functions non-specific to axios
10
-
11
- const {toString} = Object.prototype;
12
- const {getPrototypeOf} = Object;
13
-
14
- const kindOf = (cache => thing => {
15
- const str = toString.call(thing);
16
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
17
- })(Object.create(null));
18
-
19
- const kindOfTest = (type) => {
20
- type = type.toLowerCase();
21
- return (thing) => kindOf(thing) === type
22
- };
23
-
24
- const typeOfTest = type => thing => typeof thing === type;
25
-
26
- /**
27
- * Determine if a value is an Array
28
- *
29
- * @param {Object} val The value to test
30
- *
31
- * @returns {boolean} True if value is an Array, otherwise false
32
- */
33
- const {isArray} = Array;
34
-
35
- /**
36
- * Determine if a value is undefined
37
- *
38
- * @param {*} val The value to test
39
- *
40
- * @returns {boolean} True if the value is undefined, otherwise false
41
- */
42
- const isUndefined = typeOfTest('undefined');
43
-
44
- /**
45
- * Determine if a value is a Buffer
46
- *
47
- * @param {*} val The value to test
48
- *
49
- * @returns {boolean} True if value is a Buffer, otherwise false
50
- */
51
- function isBuffer(val) {
52
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
53
- && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
54
- }
55
-
56
- /**
57
- * Determine if a value is an ArrayBuffer
58
- *
59
- * @param {*} val The value to test
60
- *
61
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
62
- */
63
- const isArrayBuffer = kindOfTest('ArrayBuffer');
64
-
65
-
66
- /**
67
- * Determine if a value is a view on an ArrayBuffer
68
- *
69
- * @param {*} val The value to test
70
- *
71
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
72
- */
73
- function isArrayBufferView(val) {
74
- let result;
75
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
76
- result = ArrayBuffer.isView(val);
77
- } else {
78
- result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
79
- }
80
- return result;
81
- }
82
-
83
- /**
84
- * Determine if a value is a String
85
- *
86
- * @param {*} val The value to test
87
- *
88
- * @returns {boolean} True if value is a String, otherwise false
89
- */
90
- const isString = typeOfTest('string');
91
-
92
- /**
93
- * Determine if a value is a Function
94
- *
95
- * @param {*} val The value to test
96
- * @returns {boolean} True if value is a Function, otherwise false
97
- */
98
- const isFunction = typeOfTest('function');
99
-
100
- /**
101
- * Determine if a value is a Number
102
- *
103
- * @param {*} val The value to test
104
- *
105
- * @returns {boolean} True if value is a Number, otherwise false
106
- */
107
- const isNumber = typeOfTest('number');
108
-
109
- /**
110
- * Determine if a value is an Object
111
- *
112
- * @param {*} thing The value to test
113
- *
114
- * @returns {boolean} True if value is an Object, otherwise false
115
- */
116
- const isObject = (thing) => thing !== null && typeof thing === 'object';
117
-
118
- /**
119
- * Determine if a value is a Boolean
120
- *
121
- * @param {*} thing The value to test
122
- * @returns {boolean} True if value is a Boolean, otherwise false
123
- */
124
- const isBoolean = thing => thing === true || thing === false;
125
-
126
- /**
127
- * Determine if a value is a plain Object
128
- *
129
- * @param {*} val The value to test
130
- *
131
- * @returns {boolean} True if value is a plain Object, otherwise false
132
- */
133
- const isPlainObject = (val) => {
134
- if (kindOf(val) !== 'object') {
135
- return false;
136
- }
137
-
138
- const prototype = getPrototypeOf(val);
139
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
140
- };
141
-
142
- /**
143
- * Determine if a value is a Date
144
- *
145
- * @param {*} val The value to test
146
- *
147
- * @returns {boolean} True if value is a Date, otherwise false
148
- */
149
- const isDate = kindOfTest('Date');
150
-
151
- /**
152
- * Determine if a value is a File
153
- *
154
- * @param {*} val The value to test
155
- *
156
- * @returns {boolean} True if value is a File, otherwise false
157
- */
158
- const isFile = kindOfTest('File');
159
-
160
- /**
161
- * Determine if a value is a Blob
162
- *
163
- * @param {*} val The value to test
164
- *
165
- * @returns {boolean} True if value is a Blob, otherwise false
166
- */
167
- const isBlob = kindOfTest('Blob');
168
-
169
- /**
170
- * Determine if a value is a FileList
171
- *
172
- * @param {*} val The value to test
173
- *
174
- * @returns {boolean} True if value is a File, otherwise false
175
- */
176
- const isFileList = kindOfTest('FileList');
177
-
178
- /**
179
- * Determine if a value is a Stream
180
- *
181
- * @param {*} val The value to test
182
- *
183
- * @returns {boolean} True if value is a Stream, otherwise false
184
- */
185
- const isStream = (val) => isObject(val) && isFunction(val.pipe);
186
-
187
- /**
188
- * Determine if a value is a FormData
189
- *
190
- * @param {*} thing The value to test
191
- *
192
- * @returns {boolean} True if value is an FormData, otherwise false
193
- */
194
- const isFormData = (thing) => {
195
- let kind;
196
- return thing && (
197
- (typeof FormData === 'function' && thing instanceof FormData) || (
198
- isFunction(thing.append) && (
199
- (kind = kindOf(thing)) === 'formdata' ||
200
- // detect form-data instance
201
- (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
202
- )
203
- )
204
- )
205
- };
206
-
207
- /**
208
- * Determine if a value is a URLSearchParams object
209
- *
210
- * @param {*} val The value to test
211
- *
212
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
213
- */
214
- const isURLSearchParams = kindOfTest('URLSearchParams');
215
-
216
- /**
217
- * Trim excess whitespace off the beginning and end of a string
218
- *
219
- * @param {String} str The String to trim
220
- *
221
- * @returns {String} The String freed of excess whitespace
222
- */
223
- const trim = (str) => str.trim ?
224
- str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
225
-
226
- /**
227
- * Iterate over an Array or an Object invoking a function for each item.
228
- *
229
- * If `obj` is an Array callback will be called passing
230
- * the value, index, and complete array for each item.
231
- *
232
- * If 'obj' is an Object callback will be called passing
233
- * the value, key, and complete object for each property.
234
- *
235
- * @param {Object|Array} obj The object to iterate
236
- * @param {Function} fn The callback to invoke for each item
237
- *
238
- * @param {Boolean} [allOwnKeys = false]
239
- * @returns {any}
240
- */
241
- function forEach(obj, fn, {allOwnKeys = false} = {}) {
242
- // Don't bother if no value provided
243
- if (obj === null || typeof obj === 'undefined') {
244
- return;
245
- }
246
-
247
- let i;
248
- let l;
249
-
250
- // Force an array if not already something iterable
251
- if (typeof obj !== 'object') {
252
- /*eslint no-param-reassign:0*/
253
- obj = [obj];
254
- }
255
-
256
- if (isArray(obj)) {
257
- // Iterate over array values
258
- for (i = 0, l = obj.length; i < l; i++) {
259
- fn.call(null, obj[i], i, obj);
260
- }
261
- } else {
262
- // Iterate over object keys
263
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
264
- const len = keys.length;
265
- let key;
266
-
267
- for (i = 0; i < len; i++) {
268
- key = keys[i];
269
- fn.call(null, obj[key], key, obj);
270
- }
271
- }
272
- }
273
-
274
- function findKey(obj, key) {
275
- key = key.toLowerCase();
276
- const keys = Object.keys(obj);
277
- let i = keys.length;
278
- let _key;
279
- while (i-- > 0) {
280
- _key = keys[i];
281
- if (key === _key.toLowerCase()) {
282
- return _key;
283
- }
284
- }
285
- return null;
286
- }
287
-
288
- const _global = (() => {
289
- /*eslint no-undef:0*/
290
- if (typeof globalThis !== "undefined") return globalThis;
291
- return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
292
- })();
293
-
294
- const isContextDefined = (context) => !isUndefined(context) && context !== _global;
295
-
296
- /**
297
- * Accepts varargs expecting each argument to be an object, then
298
- * immutably merges the properties of each object and returns result.
299
- *
300
- * When multiple objects contain the same key the later object in
301
- * the arguments list will take precedence.
302
- *
303
- * Example:
304
- *
305
- * ```js
306
- * var result = merge({foo: 123}, {foo: 456});
307
- * console.log(result.foo); // outputs 456
308
- * ```
309
- *
310
- * @param {Object} obj1 Object to merge
311
- *
312
- * @returns {Object} Result of all merge properties
313
- */
314
- function merge(/* obj1, obj2, obj3, ... */) {
315
- const {caseless} = isContextDefined(this) && this || {};
316
- const result = {};
317
- const assignValue = (val, key) => {
318
- const targetKey = caseless && findKey(result, key) || key;
319
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
320
- result[targetKey] = merge(result[targetKey], val);
321
- } else if (isPlainObject(val)) {
322
- result[targetKey] = merge({}, val);
323
- } else if (isArray(val)) {
324
- result[targetKey] = val.slice();
325
- } else {
326
- result[targetKey] = val;
327
- }
328
- };
329
-
330
- for (let i = 0, l = arguments.length; i < l; i++) {
331
- arguments[i] && forEach(arguments[i], assignValue);
332
- }
333
- return result;
334
- }
335
-
336
- /**
337
- * Extends object a by mutably adding to it the properties of object b.
338
- *
339
- * @param {Object} a The object to be extended
340
- * @param {Object} b The object to copy properties from
341
- * @param {Object} thisArg The object to bind function to
342
- *
343
- * @param {Boolean} [allOwnKeys]
344
- * @returns {Object} The resulting value of object a
345
- */
346
- const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
347
- forEach(b, (val, key) => {
348
- if (thisArg && isFunction(val)) {
349
- a[key] = bind(val, thisArg);
350
- } else {
351
- a[key] = val;
352
- }
353
- }, {allOwnKeys});
354
- return a;
355
- };
356
-
357
- /**
358
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
359
- *
360
- * @param {string} content with BOM
361
- *
362
- * @returns {string} content value without BOM
363
- */
364
- const stripBOM = (content) => {
365
- if (content.charCodeAt(0) === 0xFEFF) {
366
- content = content.slice(1);
367
- }
368
- return content;
369
- };
370
-
371
- /**
372
- * Inherit the prototype methods from one constructor into another
373
- * @param {function} constructor
374
- * @param {function} superConstructor
375
- * @param {object} [props]
376
- * @param {object} [descriptors]
377
- *
378
- * @returns {void}
379
- */
380
- const inherits = (constructor, superConstructor, props, descriptors) => {
381
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
382
- constructor.prototype.constructor = constructor;
383
- Object.defineProperty(constructor, 'super', {
384
- value: superConstructor.prototype
385
- });
386
- props && Object.assign(constructor.prototype, props);
387
- };
388
-
389
- /**
390
- * Resolve object with deep prototype chain to a flat object
391
- * @param {Object} sourceObj source object
392
- * @param {Object} [destObj]
393
- * @param {Function|Boolean} [filter]
394
- * @param {Function} [propFilter]
395
- *
396
- * @returns {Object}
397
- */
398
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
399
- let props;
400
- let i;
401
- let prop;
402
- const merged = {};
403
-
404
- destObj = destObj || {};
405
- // eslint-disable-next-line no-eq-null,eqeqeq
406
- if (sourceObj == null) return destObj;
407
-
408
- do {
409
- props = Object.getOwnPropertyNames(sourceObj);
410
- i = props.length;
411
- while (i-- > 0) {
412
- prop = props[i];
413
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
414
- destObj[prop] = sourceObj[prop];
415
- merged[prop] = true;
416
- }
417
- }
418
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
419
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
420
-
421
- return destObj;
422
- };
423
-
424
- /**
425
- * Determines whether a string ends with the characters of a specified string
426
- *
427
- * @param {String} str
428
- * @param {String} searchString
429
- * @param {Number} [position= 0]
430
- *
431
- * @returns {boolean}
432
- */
433
- const endsWith = (str, searchString, position) => {
434
- str = String(str);
435
- if (position === undefined || position > str.length) {
436
- position = str.length;
437
- }
438
- position -= searchString.length;
439
- const lastIndex = str.indexOf(searchString, position);
440
- return lastIndex !== -1 && lastIndex === position;
441
- };
442
-
443
-
444
- /**
445
- * Returns new array from array like object or null if failed
446
- *
447
- * @param {*} [thing]
448
- *
449
- * @returns {?Array}
450
- */
451
- const toArray = (thing) => {
452
- if (!thing) return null;
453
- if (isArray(thing)) return thing;
454
- let i = thing.length;
455
- if (!isNumber(i)) return null;
456
- const arr = new Array(i);
457
- while (i-- > 0) {
458
- arr[i] = thing[i];
459
- }
460
- return arr;
461
- };
462
-
463
- /**
464
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
465
- * thing passed in is an instance of Uint8Array
466
- *
467
- * @param {TypedArray}
468
- *
469
- * @returns {Array}
470
- */
471
- // eslint-disable-next-line func-names
472
- const isTypedArray = (TypedArray => {
473
- // eslint-disable-next-line func-names
474
- return thing => {
475
- return TypedArray && thing instanceof TypedArray;
476
- };
477
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
478
-
479
- /**
480
- * For each entry in the object, call the function with the key and value.
481
- *
482
- * @param {Object<any, any>} obj - The object to iterate over.
483
- * @param {Function} fn - The function to call for each entry.
484
- *
485
- * @returns {void}
486
- */
487
- const forEachEntry = (obj, fn) => {
488
- const generator = obj && obj[Symbol.iterator];
489
-
490
- const iterator = generator.call(obj);
491
-
492
- let result;
493
-
494
- while ((result = iterator.next()) && !result.done) {
495
- const pair = result.value;
496
- fn.call(obj, pair[0], pair[1]);
497
- }
498
- };
499
-
500
- /**
501
- * It takes a regular expression and a string, and returns an array of all the matches
502
- *
503
- * @param {string} regExp - The regular expression to match against.
504
- * @param {string} str - The string to search.
505
- *
506
- * @returns {Array<boolean>}
507
- */
508
- const matchAll = (regExp, str) => {
509
- let matches;
510
- const arr = [];
511
-
512
- while ((matches = regExp.exec(str)) !== null) {
513
- arr.push(matches);
514
- }
515
-
516
- return arr;
517
- };
518
-
519
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
520
- const isHTMLForm = kindOfTest('HTMLFormElement');
521
-
522
- const toCamelCase = str => {
523
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
524
- function replacer(m, p1, p2) {
525
- return p1.toUpperCase() + p2;
526
- }
527
- );
528
- };
529
-
530
- /* Creating a function that will check if an object has a property. */
531
- const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
532
-
533
- /**
534
- * Determine if a value is a RegExp object
535
- *
536
- * @param {*} val The value to test
537
- *
538
- * @returns {boolean} True if value is a RegExp object, otherwise false
539
- */
540
- const isRegExp = kindOfTest('RegExp');
541
-
542
- const reduceDescriptors = (obj, reducer) => {
543
- const descriptors = Object.getOwnPropertyDescriptors(obj);
544
- const reducedDescriptors = {};
545
-
546
- forEach(descriptors, (descriptor, name) => {
547
- if (reducer(descriptor, name, obj) !== false) {
548
- reducedDescriptors[name] = descriptor;
549
- }
550
- });
551
-
552
- Object.defineProperties(obj, reducedDescriptors);
553
- };
554
-
555
- /**
556
- * Makes all methods read-only
557
- * @param {Object} obj
558
- */
559
-
560
- const freezeMethods = (obj) => {
561
- reduceDescriptors(obj, (descriptor, name) => {
562
- // skip restricted props in strict mode
563
- if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
564
- return false;
565
- }
566
-
567
- const value = obj[name];
568
-
569
- if (!isFunction(value)) return;
570
-
571
- descriptor.enumerable = false;
572
-
573
- if ('writable' in descriptor) {
574
- descriptor.writable = false;
575
- return;
576
- }
577
-
578
- if (!descriptor.set) {
579
- descriptor.set = () => {
580
- throw Error('Can not rewrite read-only method \'' + name + '\'');
581
- };
582
- }
583
- });
584
- };
585
-
586
- const toObjectSet = (arrayOrString, delimiter) => {
587
- const obj = {};
588
-
589
- const define = (arr) => {
590
- arr.forEach(value => {
591
- obj[value] = true;
592
- });
593
- };
594
-
595
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
596
-
597
- return obj;
598
- };
599
-
600
- const noop = () => {};
601
-
602
- const toFiniteNumber = (value, defaultValue) => {
603
- value = +value;
604
- return Number.isFinite(value) ? value : defaultValue;
605
- };
606
-
607
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
608
-
609
- const DIGIT = '0123456789';
610
-
611
- const ALPHABET = {
612
- DIGIT,
613
- ALPHA,
614
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
615
- };
616
-
617
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
618
- let str = '';
619
- const {length} = alphabet;
620
- while (size--) {
621
- str += alphabet[Math.random() * length|0];
622
- }
623
-
624
- return str;
625
- };
626
-
627
- /**
628
- * If the thing is a FormData object, return true, otherwise return false.
629
- *
630
- * @param {unknown} thing - The thing to check.
631
- *
632
- * @returns {boolean}
633
- */
634
- function isSpecCompliantForm(thing) {
635
- return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
636
- }
637
-
638
- const toJSONObject = (obj) => {
639
- const stack = new Array(10);
640
-
641
- const visit = (source, i) => {
642
-
643
- if (isObject(source)) {
644
- if (stack.indexOf(source) >= 0) {
645
- return;
646
- }
647
-
648
- if(!('toJSON' in source)) {
649
- stack[i] = source;
650
- const target = isArray(source) ? [] : {};
651
-
652
- forEach(source, (value, key) => {
653
- const reducedValue = visit(value, i + 1);
654
- !isUndefined(reducedValue) && (target[key] = reducedValue);
655
- });
656
-
657
- stack[i] = undefined;
658
-
659
- return target;
660
- }
661
- }
662
-
663
- return source;
664
- };
665
-
666
- return visit(obj, 0);
667
- };
668
-
669
- const isAsyncFn = kindOfTest('AsyncFunction');
670
-
671
- const isThenable = (thing) =>
672
- thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
673
-
674
- const utils = {
675
- isArray,
676
- isArrayBuffer,
677
- isBuffer,
678
- isFormData,
679
- isArrayBufferView,
680
- isString,
681
- isNumber,
682
- isBoolean,
683
- isObject,
684
- isPlainObject,
685
- isUndefined,
686
- isDate,
687
- isFile,
688
- isBlob,
689
- isRegExp,
690
- isFunction,
691
- isStream,
692
- isURLSearchParams,
693
- isTypedArray,
694
- isFileList,
695
- forEach,
696
- merge,
697
- extend,
698
- trim,
699
- stripBOM,
700
- inherits,
701
- toFlatObject,
702
- kindOf,
703
- kindOfTest,
704
- endsWith,
705
- toArray,
706
- forEachEntry,
707
- matchAll,
708
- isHTMLForm,
709
- hasOwnProperty,
710
- hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
711
- reduceDescriptors,
712
- freezeMethods,
713
- toObjectSet,
714
- toCamelCase,
715
- noop,
716
- toFiniteNumber,
717
- findKey,
718
- global: _global,
719
- isContextDefined,
720
- ALPHABET,
721
- generateString,
722
- isSpecCompliantForm,
723
- toJSONObject,
724
- isAsyncFn,
725
- isThenable
726
- };
727
-
728
- /**
729
- * Create an Error with the specified message, config, error code, request and response.
730
- *
731
- * @param {string} message The error message.
732
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
733
- * @param {Object} [config] The config.
734
- * @param {Object} [request] The request.
735
- * @param {Object} [response] The response.
736
- *
737
- * @returns {Error} The created error.
738
- */
739
- function AxiosError(message, code, config, request, response) {
740
- Error.call(this);
741
-
742
- if (Error.captureStackTrace) {
743
- Error.captureStackTrace(this, this.constructor);
744
- } else {
745
- this.stack = (new Error()).stack;
746
- }
747
-
748
- this.message = message;
749
- this.name = 'AxiosError';
750
- code && (this.code = code);
751
- config && (this.config = config);
752
- request && (this.request = request);
753
- response && (this.response = response);
754
- }
755
-
756
- utils.inherits(AxiosError, Error, {
757
- toJSON: function toJSON() {
758
- return {
759
- // Standard
760
- message: this.message,
761
- name: this.name,
762
- // Microsoft
763
- description: this.description,
764
- number: this.number,
765
- // Mozilla
766
- fileName: this.fileName,
767
- lineNumber: this.lineNumber,
768
- columnNumber: this.columnNumber,
769
- stack: this.stack,
770
- // Axios
771
- config: utils.toJSONObject(this.config),
772
- code: this.code,
773
- status: this.response && this.response.status ? this.response.status : null
774
- };
775
- }
776
- });
777
-
778
- const prototype$1 = AxiosError.prototype;
779
- const descriptors = {};
780
-
781
- [
782
- 'ERR_BAD_OPTION_VALUE',
783
- 'ERR_BAD_OPTION',
784
- 'ECONNABORTED',
785
- 'ETIMEDOUT',
786
- 'ERR_NETWORK',
787
- 'ERR_FR_TOO_MANY_REDIRECTS',
788
- 'ERR_DEPRECATED',
789
- 'ERR_BAD_RESPONSE',
790
- 'ERR_BAD_REQUEST',
791
- 'ERR_CANCELED',
792
- 'ERR_NOT_SUPPORT',
793
- 'ERR_INVALID_URL'
794
- // eslint-disable-next-line func-names
795
- ].forEach(code => {
796
- descriptors[code] = {value: code};
797
- });
798
-
799
- Object.defineProperties(AxiosError, descriptors);
800
- Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
801
-
802
- // eslint-disable-next-line func-names
803
- AxiosError.from = (error, code, config, request, response, customProps) => {
804
- const axiosError = Object.create(prototype$1);
805
-
806
- utils.toFlatObject(error, axiosError, function filter(obj) {
807
- return obj !== Error.prototype;
808
- }, prop => {
809
- return prop !== 'isAxiosError';
810
- });
811
-
812
- AxiosError.call(axiosError, error.message, code, config, request, response);
813
-
814
- axiosError.cause = error;
815
-
816
- axiosError.name = error.name;
817
-
818
- customProps && Object.assign(axiosError, customProps);
819
-
820
- return axiosError;
821
- };
822
-
823
- // eslint-disable-next-line strict
824
- const httpAdapter = null;
825
-
826
- /**
827
- * Determines if the given thing is a array or js object.
828
- *
829
- * @param {string} thing - The object or array to be visited.
830
- *
831
- * @returns {boolean}
832
- */
833
- function isVisitable(thing) {
834
- return utils.isPlainObject(thing) || utils.isArray(thing);
835
- }
836
-
837
- /**
838
- * It removes the brackets from the end of a string
839
- *
840
- * @param {string} key - The key of the parameter.
841
- *
842
- * @returns {string} the key without the brackets.
843
- */
844
- function removeBrackets(key) {
845
- return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
846
- }
847
-
848
- /**
849
- * It takes a path, a key, and a boolean, and returns a string
850
- *
851
- * @param {string} path - The path to the current key.
852
- * @param {string} key - The key of the current object being iterated over.
853
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
854
- *
855
- * @returns {string} The path to the current key.
856
- */
857
- function renderKey(path, key, dots) {
858
- if (!path) return key;
859
- return path.concat(key).map(function each(token, i) {
860
- // eslint-disable-next-line no-param-reassign
861
- token = removeBrackets(token);
862
- return !dots && i ? '[' + token + ']' : token;
863
- }).join(dots ? '.' : '');
864
- }
865
-
866
- /**
867
- * If the array is an array and none of its elements are visitable, then it's a flat array.
868
- *
869
- * @param {Array<any>} arr - The array to check
870
- *
871
- * @returns {boolean}
872
- */
873
- function isFlatArray(arr) {
874
- return utils.isArray(arr) && !arr.some(isVisitable);
875
- }
876
-
877
- const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
878
- return /^is[A-Z]/.test(prop);
879
- });
880
-
881
- /**
882
- * Convert a data object to FormData
883
- *
884
- * @param {Object} obj
885
- * @param {?Object} [formData]
886
- * @param {?Object} [options]
887
- * @param {Function} [options.visitor]
888
- * @param {Boolean} [options.metaTokens = true]
889
- * @param {Boolean} [options.dots = false]
890
- * @param {?Boolean} [options.indexes = false]
891
- *
892
- * @returns {Object}
893
- **/
894
-
895
- /**
896
- * It converts an object into a FormData object
897
- *
898
- * @param {Object<any, any>} obj - The object to convert to form data.
899
- * @param {string} formData - The FormData object to append to.
900
- * @param {Object<string, any>} options
901
- *
902
- * @returns
903
- */
904
- function toFormData(obj, formData, options) {
905
- if (!utils.isObject(obj)) {
906
- throw new TypeError('target must be an object');
907
- }
908
-
909
- // eslint-disable-next-line no-param-reassign
910
- formData = formData || new (FormData)();
911
-
912
- // eslint-disable-next-line no-param-reassign
913
- options = utils.toFlatObject(options, {
914
- metaTokens: true,
915
- dots: false,
916
- indexes: false
917
- }, false, function defined(option, source) {
918
- // eslint-disable-next-line no-eq-null,eqeqeq
919
- return !utils.isUndefined(source[option]);
920
- });
921
-
922
- const metaTokens = options.metaTokens;
923
- // eslint-disable-next-line no-use-before-define
924
- const visitor = options.visitor || defaultVisitor;
925
- const dots = options.dots;
926
- const indexes = options.indexes;
927
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
928
- const useBlob = _Blob && utils.isSpecCompliantForm(formData);
929
-
930
- if (!utils.isFunction(visitor)) {
931
- throw new TypeError('visitor must be a function');
932
- }
933
-
934
- function convertValue(value) {
935
- if (value === null) return '';
936
-
937
- if (utils.isDate(value)) {
938
- return value.toISOString();
939
- }
940
-
941
- if (!useBlob && utils.isBlob(value)) {
942
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
943
- }
944
-
945
- if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
946
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
947
- }
948
-
949
- return value;
950
- }
951
-
952
- /**
953
- * Default visitor.
954
- *
955
- * @param {*} value
956
- * @param {String|Number} key
957
- * @param {Array<String|Number>} path
958
- * @this {FormData}
959
- *
960
- * @returns {boolean} return true to visit the each prop of the value recursively
961
- */
962
- function defaultVisitor(value, key, path) {
963
- let arr = value;
964
-
965
- if (value && !path && typeof value === 'object') {
966
- if (utils.endsWith(key, '{}')) {
967
- // eslint-disable-next-line no-param-reassign
968
- key = metaTokens ? key : key.slice(0, -2);
969
- // eslint-disable-next-line no-param-reassign
970
- value = JSON.stringify(value);
971
- } else if (
972
- (utils.isArray(value) && isFlatArray(value)) ||
973
- ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
974
- )) {
975
- // eslint-disable-next-line no-param-reassign
976
- key = removeBrackets(key);
977
-
978
- arr.forEach(function each(el, index) {
979
- !(utils.isUndefined(el) || el === null) && formData.append(
980
- // eslint-disable-next-line no-nested-ternary
981
- indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
982
- convertValue(el)
983
- );
984
- });
985
- return false;
986
- }
987
- }
988
-
989
- if (isVisitable(value)) {
990
- return true;
991
- }
992
-
993
- formData.append(renderKey(path, key, dots), convertValue(value));
994
-
995
- return false;
996
- }
997
-
998
- const stack = [];
999
-
1000
- const exposedHelpers = Object.assign(predicates, {
1001
- defaultVisitor,
1002
- convertValue,
1003
- isVisitable
1004
- });
1005
-
1006
- function build(value, path) {
1007
- if (utils.isUndefined(value)) return;
1008
-
1009
- if (stack.indexOf(value) !== -1) {
1010
- throw Error('Circular reference detected in ' + path.join('.'));
1011
- }
1012
-
1013
- stack.push(value);
1014
-
1015
- utils.forEach(value, function each(el, key) {
1016
- const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1017
- formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1018
- );
1019
-
1020
- if (result === true) {
1021
- build(el, path ? path.concat(key) : [key]);
1022
- }
1023
- });
1024
-
1025
- stack.pop();
1026
- }
1027
-
1028
- if (!utils.isObject(obj)) {
1029
- throw new TypeError('data must be an object');
1030
- }
1031
-
1032
- build(obj);
1033
-
1034
- return formData;
1035
- }
1036
-
1037
- /**
1038
- * It encodes a string by replacing all characters that are not in the unreserved set with
1039
- * their percent-encoded equivalents
1040
- *
1041
- * @param {string} str - The string to encode.
1042
- *
1043
- * @returns {string} The encoded string.
1044
- */
1045
- function encode$1(str) {
1046
- const charMap = {
1047
- '!': '%21',
1048
- "'": '%27',
1049
- '(': '%28',
1050
- ')': '%29',
1051
- '~': '%7E',
1052
- '%20': '+',
1053
- '%00': '\x00'
1054
- };
1055
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1056
- return charMap[match];
1057
- });
1058
- }
1059
-
1060
- /**
1061
- * It takes a params object and converts it to a FormData object
1062
- *
1063
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1064
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1065
- *
1066
- * @returns {void}
1067
- */
1068
- function AxiosURLSearchParams(params, options) {
1069
- this._pairs = [];
1070
-
1071
- params && toFormData(params, this, options);
1072
- }
1073
-
1074
- const prototype = AxiosURLSearchParams.prototype;
1075
-
1076
- prototype.append = function append(name, value) {
1077
- this._pairs.push([name, value]);
1078
- };
1079
-
1080
- prototype.toString = function toString(encoder) {
1081
- const _encode = encoder ? function(value) {
1082
- return encoder.call(this, value, encode$1);
1083
- } : encode$1;
1084
-
1085
- return this._pairs.map(function each(pair) {
1086
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1087
- }, '').join('&');
1088
- };
1089
-
1090
- /**
1091
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1092
- * URI encoded counterparts
1093
- *
1094
- * @param {string} val The value to be encoded.
1095
- *
1096
- * @returns {string} The encoded value.
1097
- */
1098
- function encode(val) {
1099
- return encodeURIComponent(val).
1100
- replace(/%3A/gi, ':').
1101
- replace(/%24/g, '$').
1102
- replace(/%2C/gi, ',').
1103
- replace(/%20/g, '+').
1104
- replace(/%5B/gi, '[').
1105
- replace(/%5D/gi, ']');
1106
- }
1107
-
1108
- /**
1109
- * Build a URL by appending params to the end
1110
- *
1111
- * @param {string} url The base of the url (e.g., http://www.google.com)
1112
- * @param {object} [params] The params to be appended
1113
- * @param {?object} options
1114
- *
1115
- * @returns {string} The formatted url
1116
- */
1117
- function buildURL(url, params, options) {
1118
- /*eslint no-param-reassign:0*/
1119
- if (!params) {
1120
- return url;
1121
- }
1122
-
1123
- const _encode = options && options.encode || encode;
1124
-
1125
- const serializeFn = options && options.serialize;
1126
-
1127
- let serializedParams;
1128
-
1129
- if (serializeFn) {
1130
- serializedParams = serializeFn(params, options);
1131
- } else {
1132
- serializedParams = utils.isURLSearchParams(params) ?
1133
- params.toString() :
1134
- new AxiosURLSearchParams(params, options).toString(_encode);
1135
- }
1136
-
1137
- if (serializedParams) {
1138
- const hashmarkIndex = url.indexOf("#");
1139
-
1140
- if (hashmarkIndex !== -1) {
1141
- url = url.slice(0, hashmarkIndex);
1142
- }
1143
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1144
- }
1145
-
1146
- return url;
1147
- }
1148
-
1149
- class InterceptorManager {
1150
- constructor() {
1151
- this.handlers = [];
1152
- }
1153
-
1154
- /**
1155
- * Add a new interceptor to the stack
1156
- *
1157
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1158
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1159
- *
1160
- * @return {Number} An ID used to remove interceptor later
1161
- */
1162
- use(fulfilled, rejected, options) {
1163
- this.handlers.push({
1164
- fulfilled,
1165
- rejected,
1166
- synchronous: options ? options.synchronous : false,
1167
- runWhen: options ? options.runWhen : null
1168
- });
1169
- return this.handlers.length - 1;
1170
- }
1171
-
1172
- /**
1173
- * Remove an interceptor from the stack
1174
- *
1175
- * @param {Number} id The ID that was returned by `use`
1176
- *
1177
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1178
- */
1179
- eject(id) {
1180
- if (this.handlers[id]) {
1181
- this.handlers[id] = null;
1182
- }
1183
- }
1184
-
1185
- /**
1186
- * Clear all interceptors from the stack
1187
- *
1188
- * @returns {void}
1189
- */
1190
- clear() {
1191
- if (this.handlers) {
1192
- this.handlers = [];
1193
- }
1194
- }
1195
-
1196
- /**
1197
- * Iterate over all the registered interceptors
1198
- *
1199
- * This method is particularly useful for skipping over any
1200
- * interceptors that may have become `null` calling `eject`.
1201
- *
1202
- * @param {Function} fn The function to call for each interceptor
1203
- *
1204
- * @returns {void}
1205
- */
1206
- forEach(fn) {
1207
- utils.forEach(this.handlers, function forEachHandler(h) {
1208
- if (h !== null) {
1209
- fn(h);
1210
- }
1211
- });
1212
- }
1213
- }
1214
-
1215
- const InterceptorManager$1 = InterceptorManager;
1216
-
1217
- const transitionalDefaults = {
1218
- silentJSONParsing: true,
1219
- forcedJSONParsing: true,
1220
- clarifyTimeoutError: false
1221
- };
1222
-
1223
- const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1224
-
1225
- const FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
1226
-
1227
- const Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
1228
-
1229
- /**
1230
- * Determine if we're running in a standard browser environment
1231
- *
1232
- * This allows axios to run in a web worker, and react-native.
1233
- * Both environments support XMLHttpRequest, but not fully standard globals.
1234
- *
1235
- * web workers:
1236
- * typeof window -> undefined
1237
- * typeof document -> undefined
1238
- *
1239
- * react-native:
1240
- * navigator.product -> 'ReactNative'
1241
- * nativescript
1242
- * navigator.product -> 'NativeScript' or 'NS'
1243
- *
1244
- * @returns {boolean}
1245
- */
1246
- const isStandardBrowserEnv = (() => {
1247
- let product;
1248
- if (typeof navigator !== 'undefined' && (
1249
- (product = navigator.product) === 'ReactNative' ||
1250
- product === 'NativeScript' ||
1251
- product === 'NS')
1252
- ) {
1253
- return false;
1254
- }
1255
-
1256
- return typeof window !== 'undefined' && typeof document !== 'undefined';
1257
- })();
1258
-
1259
- /**
1260
- * Determine if we're running in a standard browser webWorker environment
1261
- *
1262
- * Although the `isStandardBrowserEnv` method indicates that
1263
- * `allows axios to run in a web worker`, the WebWorker will still be
1264
- * filtered out due to its judgment standard
1265
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1266
- * This leads to a problem when axios post `FormData` in webWorker
1267
- */
1268
- const isStandardBrowserWebWorkerEnv = (() => {
1269
- return (
1270
- typeof WorkerGlobalScope !== 'undefined' &&
1271
- // eslint-disable-next-line no-undef
1272
- self instanceof WorkerGlobalScope &&
1273
- typeof self.importScripts === 'function'
1274
- );
1275
- })();
1276
-
1277
-
1278
- const platform = {
1279
- isBrowser: true,
1280
- classes: {
1281
- URLSearchParams: URLSearchParams$1,
1282
- FormData: FormData$1,
1283
- Blob: Blob$1
1284
- },
1285
- isStandardBrowserEnv,
1286
- isStandardBrowserWebWorkerEnv,
1287
- protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1288
- };
1289
-
1290
- function toURLEncodedForm(data, options) {
1291
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1292
- visitor: function(value, key, path, helpers) {
1293
- if (platform.isNode && utils.isBuffer(value)) {
1294
- this.append(key, value.toString('base64'));
1295
- return false;
1296
- }
1297
-
1298
- return helpers.defaultVisitor.apply(this, arguments);
1299
- }
1300
- }, options));
1301
- }
1302
-
1303
- /**
1304
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1305
- *
1306
- * @param {string} name - The name of the property to get.
1307
- *
1308
- * @returns An array of strings.
1309
- */
1310
- function parsePropPath(name) {
1311
- // foo[x][y][z]
1312
- // foo.x.y.z
1313
- // foo-x-y-z
1314
- // foo x y z
1315
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1316
- return match[0] === '[]' ? '' : match[1] || match[0];
1317
- });
1318
- }
1319
-
1320
- /**
1321
- * Convert an array to an object.
1322
- *
1323
- * @param {Array<any>} arr - The array to convert to an object.
1324
- *
1325
- * @returns An object with the same keys and values as the array.
1326
- */
1327
- function arrayToObject(arr) {
1328
- const obj = {};
1329
- const keys = Object.keys(arr);
1330
- let i;
1331
- const len = keys.length;
1332
- let key;
1333
- for (i = 0; i < len; i++) {
1334
- key = keys[i];
1335
- obj[key] = arr[key];
1336
- }
1337
- return obj;
1338
- }
1339
-
1340
- /**
1341
- * It takes a FormData object and returns a JavaScript object
1342
- *
1343
- * @param {string} formData The FormData object to convert to JSON.
1344
- *
1345
- * @returns {Object<string, any> | null} The converted object.
1346
- */
1347
- function formDataToJSON(formData) {
1348
- function buildPath(path, value, target, index) {
1349
- let name = path[index++];
1350
- const isNumericKey = Number.isFinite(+name);
1351
- const isLast = index >= path.length;
1352
- name = !name && utils.isArray(target) ? target.length : name;
1353
-
1354
- if (isLast) {
1355
- if (utils.hasOwnProp(target, name)) {
1356
- target[name] = [target[name], value];
1357
- } else {
1358
- target[name] = value;
1359
- }
1360
-
1361
- return !isNumericKey;
1362
- }
1363
-
1364
- if (!target[name] || !utils.isObject(target[name])) {
1365
- target[name] = [];
1366
- }
1367
-
1368
- const result = buildPath(path, value, target[name], index);
1369
-
1370
- if (result && utils.isArray(target[name])) {
1371
- target[name] = arrayToObject(target[name]);
1372
- }
1373
-
1374
- return !isNumericKey;
1375
- }
1376
-
1377
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1378
- const obj = {};
1379
-
1380
- utils.forEachEntry(formData, (name, value) => {
1381
- buildPath(parsePropPath(name), value, obj, 0);
1382
- });
1383
-
1384
- return obj;
1385
- }
1386
-
1387
- return null;
1388
- }
1389
-
1390
- const DEFAULT_CONTENT_TYPE = {
1391
- 'Content-Type': undefined
1392
- };
1393
-
1394
- /**
1395
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1396
- * of the input
1397
- *
1398
- * @param {any} rawValue - The value to be stringified.
1399
- * @param {Function} parser - A function that parses a string into a JavaScript object.
1400
- * @param {Function} encoder - A function that takes a value and returns a string.
1401
- *
1402
- * @returns {string} A stringified version of the rawValue.
1403
- */
1404
- function stringifySafely(rawValue, parser, encoder) {
1405
- if (utils.isString(rawValue)) {
1406
- try {
1407
- (parser || JSON.parse)(rawValue);
1408
- return utils.trim(rawValue);
1409
- } catch (e) {
1410
- if (e.name !== 'SyntaxError') {
1411
- throw e;
1412
- }
1413
- }
1414
- }
1415
-
1416
- return (encoder || JSON.stringify)(rawValue);
1417
- }
1418
-
1419
- const defaults = {
1420
-
1421
- transitional: transitionalDefaults,
1422
-
1423
- adapter: ['xhr', 'http'],
1424
-
1425
- transformRequest: [function transformRequest(data, headers) {
1426
- const contentType = headers.getContentType() || '';
1427
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1428
- const isObjectPayload = utils.isObject(data);
1429
-
1430
- if (isObjectPayload && utils.isHTMLForm(data)) {
1431
- data = new FormData(data);
1432
- }
1433
-
1434
- const isFormData = utils.isFormData(data);
1435
-
1436
- if (isFormData) {
1437
- if (!hasJSONContentType) {
1438
- return data;
1439
- }
1440
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1441
- }
1442
-
1443
- if (utils.isArrayBuffer(data) ||
1444
- utils.isBuffer(data) ||
1445
- utils.isStream(data) ||
1446
- utils.isFile(data) ||
1447
- utils.isBlob(data)
1448
- ) {
1449
- return data;
1450
- }
1451
- if (utils.isArrayBufferView(data)) {
1452
- return data.buffer;
1453
- }
1454
- if (utils.isURLSearchParams(data)) {
1455
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1456
- return data.toString();
1457
- }
1458
-
1459
- let isFileList;
1460
-
1461
- if (isObjectPayload) {
1462
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1463
- return toURLEncodedForm(data, this.formSerializer).toString();
1464
- }
1465
-
1466
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1467
- const _FormData = this.env && this.env.FormData;
1468
-
1469
- return toFormData(
1470
- isFileList ? {'files[]': data} : data,
1471
- _FormData && new _FormData(),
1472
- this.formSerializer
1473
- );
1474
- }
1475
- }
1476
-
1477
- if (isObjectPayload || hasJSONContentType ) {
1478
- headers.setContentType('application/json', false);
1479
- return stringifySafely(data);
1480
- }
1481
-
1482
- return data;
1483
- }],
1484
-
1485
- transformResponse: [function transformResponse(data) {
1486
- const transitional = this.transitional || defaults.transitional;
1487
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1488
- const JSONRequested = this.responseType === 'json';
1489
-
1490
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1491
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
1492
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1493
-
1494
- try {
1495
- return JSON.parse(data);
1496
- } catch (e) {
1497
- if (strictJSONParsing) {
1498
- if (e.name === 'SyntaxError') {
1499
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1500
- }
1501
- throw e;
1502
- }
1503
- }
1504
- }
1505
-
1506
- return data;
1507
- }],
1508
-
1509
- /**
1510
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1511
- * timeout is not created.
1512
- */
1513
- timeout: 0,
1514
-
1515
- xsrfCookieName: 'XSRF-TOKEN',
1516
- xsrfHeaderName: 'X-XSRF-TOKEN',
1517
-
1518
- maxContentLength: -1,
1519
- maxBodyLength: -1,
1520
-
1521
- env: {
1522
- FormData: platform.classes.FormData,
1523
- Blob: platform.classes.Blob
1524
- },
1525
-
1526
- validateStatus: function validateStatus(status) {
1527
- return status >= 200 && status < 300;
1528
- },
1529
-
1530
- headers: {
1531
- common: {
1532
- 'Accept': 'application/json, text/plain, */*'
1533
- }
1534
- }
1535
- };
1536
-
1537
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1538
- defaults.headers[method] = {};
1539
- });
1540
-
1541
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1542
- defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1543
- });
1544
-
1545
- const defaults$1 = defaults;
1546
-
1547
- // RawAxiosHeaders whose duplicates are ignored by node
1548
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1549
- const ignoreDuplicateOf = utils.toObjectSet([
1550
- 'age', 'authorization', 'content-length', 'content-type', 'etag',
1551
- 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1552
- 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1553
- 'referer', 'retry-after', 'user-agent'
1554
- ]);
1555
-
1556
- /**
1557
- * Parse headers into an object
1558
- *
1559
- * ```
1560
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1561
- * Content-Type: application/json
1562
- * Connection: keep-alive
1563
- * Transfer-Encoding: chunked
1564
- * ```
1565
- *
1566
- * @param {String} rawHeaders Headers needing to be parsed
1567
- *
1568
- * @returns {Object} Headers parsed into an object
1569
- */
1570
- const parseHeaders = rawHeaders => {
1571
- const parsed = {};
1572
- let key;
1573
- let val;
1574
- let i;
1575
-
1576
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1577
- i = line.indexOf(':');
1578
- key = line.substring(0, i).trim().toLowerCase();
1579
- val = line.substring(i + 1).trim();
1580
-
1581
- if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1582
- return;
1583
- }
1584
-
1585
- if (key === 'set-cookie') {
1586
- if (parsed[key]) {
1587
- parsed[key].push(val);
1588
- } else {
1589
- parsed[key] = [val];
1590
- }
1591
- } else {
1592
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1593
- }
1594
- });
1595
-
1596
- return parsed;
1597
- };
1598
-
1599
- const $internals = Symbol('internals');
1600
-
1601
- function normalizeHeader(header) {
1602
- return header && String(header).trim().toLowerCase();
1603
- }
1604
-
1605
- function normalizeValue(value) {
1606
- if (value === false || value == null) {
1607
- return value;
1608
- }
1609
-
1610
- return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1611
- }
1612
-
1613
- function parseTokens(str) {
1614
- const tokens = Object.create(null);
1615
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1616
- let match;
1617
-
1618
- while ((match = tokensRE.exec(str))) {
1619
- tokens[match[1]] = match[2];
1620
- }
1621
-
1622
- return tokens;
1623
- }
1624
-
1625
- const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1626
-
1627
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1628
- if (utils.isFunction(filter)) {
1629
- return filter.call(this, value, header);
1630
- }
1631
-
1632
- if (isHeaderNameFilter) {
1633
- value = header;
1634
- }
1635
-
1636
- if (!utils.isString(value)) return;
1637
-
1638
- if (utils.isString(filter)) {
1639
- return value.indexOf(filter) !== -1;
1640
- }
1641
-
1642
- if (utils.isRegExp(filter)) {
1643
- return filter.test(value);
1644
- }
1645
- }
1646
-
1647
- function formatHeader(header) {
1648
- return header.trim()
1649
- .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1650
- return char.toUpperCase() + str;
1651
- });
1652
- }
1653
-
1654
- function buildAccessors(obj, header) {
1655
- const accessorName = utils.toCamelCase(' ' + header);
1656
-
1657
- ['get', 'set', 'has'].forEach(methodName => {
1658
- Object.defineProperty(obj, methodName + accessorName, {
1659
- value: function(arg1, arg2, arg3) {
1660
- return this[methodName].call(this, header, arg1, arg2, arg3);
1661
- },
1662
- configurable: true
1663
- });
1664
- });
1665
- }
1666
-
1667
- class AxiosHeaders {
1668
- constructor(headers) {
1669
- headers && this.set(headers);
1670
- }
1671
-
1672
- set(header, valueOrRewrite, rewrite) {
1673
- const self = this;
1674
-
1675
- function setHeader(_value, _header, _rewrite) {
1676
- const lHeader = normalizeHeader(_header);
1677
-
1678
- if (!lHeader) {
1679
- throw new Error('header name must be a non-empty string');
1680
- }
1681
-
1682
- const key = utils.findKey(self, lHeader);
1683
-
1684
- if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1685
- self[key || _header] = normalizeValue(_value);
1686
- }
1687
- }
1688
-
1689
- const setHeaders = (headers, _rewrite) =>
1690
- utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1691
-
1692
- if (utils.isPlainObject(header) || header instanceof this.constructor) {
1693
- setHeaders(header, valueOrRewrite);
1694
- } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1695
- setHeaders(parseHeaders(header), valueOrRewrite);
1696
- } else {
1697
- header != null && setHeader(valueOrRewrite, header, rewrite);
1698
- }
1699
-
1700
- return this;
1701
- }
1702
-
1703
- get(header, parser) {
1704
- header = normalizeHeader(header);
1705
-
1706
- if (header) {
1707
- const key = utils.findKey(this, header);
1708
-
1709
- if (key) {
1710
- const value = this[key];
1711
-
1712
- if (!parser) {
1713
- return value;
1714
- }
1715
-
1716
- if (parser === true) {
1717
- return parseTokens(value);
1718
- }
1719
-
1720
- if (utils.isFunction(parser)) {
1721
- return parser.call(this, value, key);
1722
- }
1723
-
1724
- if (utils.isRegExp(parser)) {
1725
- return parser.exec(value);
1726
- }
1727
-
1728
- throw new TypeError('parser must be boolean|regexp|function');
1729
- }
1730
- }
1731
- }
1732
-
1733
- has(header, matcher) {
1734
- header = normalizeHeader(header);
1735
-
1736
- if (header) {
1737
- const key = utils.findKey(this, header);
1738
-
1739
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1740
- }
1741
-
1742
- return false;
1743
- }
1744
-
1745
- delete(header, matcher) {
1746
- const self = this;
1747
- let deleted = false;
1748
-
1749
- function deleteHeader(_header) {
1750
- _header = normalizeHeader(_header);
1751
-
1752
- if (_header) {
1753
- const key = utils.findKey(self, _header);
1754
-
1755
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1756
- delete self[key];
1757
-
1758
- deleted = true;
1759
- }
1760
- }
1761
- }
1762
-
1763
- if (utils.isArray(header)) {
1764
- header.forEach(deleteHeader);
1765
- } else {
1766
- deleteHeader(header);
1767
- }
1768
-
1769
- return deleted;
1770
- }
1771
-
1772
- clear(matcher) {
1773
- const keys = Object.keys(this);
1774
- let i = keys.length;
1775
- let deleted = false;
1776
-
1777
- while (i--) {
1778
- const key = keys[i];
1779
- if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1780
- delete this[key];
1781
- deleted = true;
1782
- }
1783
- }
1784
-
1785
- return deleted;
1786
- }
1787
-
1788
- normalize(format) {
1789
- const self = this;
1790
- const headers = {};
1791
-
1792
- utils.forEach(this, (value, header) => {
1793
- const key = utils.findKey(headers, header);
1794
-
1795
- if (key) {
1796
- self[key] = normalizeValue(value);
1797
- delete self[header];
1798
- return;
1799
- }
1800
-
1801
- const normalized = format ? formatHeader(header) : String(header).trim();
1802
-
1803
- if (normalized !== header) {
1804
- delete self[header];
1805
- }
1806
-
1807
- self[normalized] = normalizeValue(value);
1808
-
1809
- headers[normalized] = true;
1810
- });
1811
-
1812
- return this;
1813
- }
1814
-
1815
- concat(...targets) {
1816
- return this.constructor.concat(this, ...targets);
1817
- }
1818
-
1819
- toJSON(asStrings) {
1820
- const obj = Object.create(null);
1821
-
1822
- utils.forEach(this, (value, header) => {
1823
- value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1824
- });
1825
-
1826
- return obj;
1827
- }
1828
-
1829
- [Symbol.iterator]() {
1830
- return Object.entries(this.toJSON())[Symbol.iterator]();
1831
- }
1832
-
1833
- toString() {
1834
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1835
- }
1836
-
1837
- get [Symbol.toStringTag]() {
1838
- return 'AxiosHeaders';
1839
- }
1840
-
1841
- static from(thing) {
1842
- return thing instanceof this ? thing : new this(thing);
1843
- }
1844
-
1845
- static concat(first, ...targets) {
1846
- const computed = new this(first);
1847
-
1848
- targets.forEach((target) => computed.set(target));
1849
-
1850
- return computed;
1851
- }
1852
-
1853
- static accessor(header) {
1854
- const internals = this[$internals] = (this[$internals] = {
1855
- accessors: {}
1856
- });
1857
-
1858
- const accessors = internals.accessors;
1859
- const prototype = this.prototype;
1860
-
1861
- function defineAccessor(_header) {
1862
- const lHeader = normalizeHeader(_header);
1863
-
1864
- if (!accessors[lHeader]) {
1865
- buildAccessors(prototype, _header);
1866
- accessors[lHeader] = true;
1867
- }
1868
- }
1869
-
1870
- utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1871
-
1872
- return this;
1873
- }
1874
- }
1875
-
1876
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1877
-
1878
- utils.freezeMethods(AxiosHeaders.prototype);
1879
- utils.freezeMethods(AxiosHeaders);
1880
-
1881
- const AxiosHeaders$1 = AxiosHeaders;
1882
-
1883
- /**
1884
- * Transform the data for a request or a response
1885
- *
1886
- * @param {Array|Function} fns A single function or Array of functions
1887
- * @param {?Object} response The response object
1888
- *
1889
- * @returns {*} The resulting transformed data
1890
- */
1891
- function transformData(fns, response) {
1892
- const config = this || defaults$1;
1893
- const context = response || config;
1894
- const headers = AxiosHeaders$1.from(context.headers);
1895
- let data = context.data;
1896
-
1897
- utils.forEach(fns, function transform(fn) {
1898
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1899
- });
1900
-
1901
- headers.normalize();
1902
-
1903
- return data;
1904
- }
1905
-
1906
- function isCancel(value) {
1907
- return !!(value && value.__CANCEL__);
1908
- }
1909
-
1910
- /**
1911
- * A `CanceledError` is an object that is thrown when an operation is canceled.
1912
- *
1913
- * @param {string=} message The message.
1914
- * @param {Object=} config The config.
1915
- * @param {Object=} request The request.
1916
- *
1917
- * @returns {CanceledError} The created error.
1918
- */
1919
- function CanceledError(message, config, request) {
1920
- // eslint-disable-next-line no-eq-null,eqeqeq
1921
- AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1922
- this.name = 'CanceledError';
1923
- }
1924
-
1925
- utils.inherits(CanceledError, AxiosError, {
1926
- __CANCEL__: true
1927
- });
1928
-
1929
- /**
1930
- * Resolve or reject a Promise based on response status.
1931
- *
1932
- * @param {Function} resolve A function that resolves the promise.
1933
- * @param {Function} reject A function that rejects the promise.
1934
- * @param {object} response The response.
1935
- *
1936
- * @returns {object} The response.
1937
- */
1938
- function settle(resolve, reject, response) {
1939
- const validateStatus = response.config.validateStatus;
1940
- if (!response.status || !validateStatus || validateStatus(response.status)) {
1941
- resolve(response);
1942
- } else {
1943
- reject(new AxiosError(
1944
- 'Request failed with status code ' + response.status,
1945
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1946
- response.config,
1947
- response.request,
1948
- response
1949
- ));
1950
- }
1951
- }
1952
-
1953
- const cookies = platform.isStandardBrowserEnv ?
1954
-
1955
- // Standard browser envs support document.cookie
1956
- (function standardBrowserEnv() {
1957
- return {
1958
- write: function write(name, value, expires, path, domain, secure) {
1959
- const cookie = [];
1960
- cookie.push(name + '=' + encodeURIComponent(value));
1961
-
1962
- if (utils.isNumber(expires)) {
1963
- cookie.push('expires=' + new Date(expires).toGMTString());
1964
- }
1965
-
1966
- if (utils.isString(path)) {
1967
- cookie.push('path=' + path);
1968
- }
1969
-
1970
- if (utils.isString(domain)) {
1971
- cookie.push('domain=' + domain);
1972
- }
1973
-
1974
- if (secure === true) {
1975
- cookie.push('secure');
1976
- }
1977
-
1978
- document.cookie = cookie.join('; ');
1979
- },
1980
-
1981
- read: function read(name) {
1982
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1983
- return (match ? decodeURIComponent(match[3]) : null);
1984
- },
1985
-
1986
- remove: function remove(name) {
1987
- this.write(name, '', Date.now() - 86400000);
1988
- }
1989
- };
1990
- })() :
1991
-
1992
- // Non standard browser env (web workers, react-native) lack needed support.
1993
- (function nonStandardBrowserEnv() {
1994
- return {
1995
- write: function write() {},
1996
- read: function read() { return null; },
1997
- remove: function remove() {}
1998
- };
1999
- })();
2000
-
2001
- /**
2002
- * Determines whether the specified URL is absolute
2003
- *
2004
- * @param {string} url The URL to test
2005
- *
2006
- * @returns {boolean} True if the specified URL is absolute, otherwise false
2007
- */
2008
- function isAbsoluteURL(url) {
2009
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2010
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2011
- // by any combination of letters, digits, plus, period, or hyphen.
2012
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2013
- }
2014
-
2015
- /**
2016
- * Creates a new URL by combining the specified URLs
2017
- *
2018
- * @param {string} baseURL The base URL
2019
- * @param {string} relativeURL The relative URL
2020
- *
2021
- * @returns {string} The combined URL
2022
- */
2023
- function combineURLs(baseURL, relativeURL) {
2024
- return relativeURL
2025
- ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2026
- : baseURL;
2027
- }
2028
-
2029
- /**
2030
- * Creates a new URL by combining the baseURL with the requestedURL,
2031
- * only when the requestedURL is not already an absolute URL.
2032
- * If the requestURL is absolute, this function returns the requestedURL untouched.
2033
- *
2034
- * @param {string} baseURL The base URL
2035
- * @param {string} requestedURL Absolute or relative URL to combine
2036
- *
2037
- * @returns {string} The combined full path
2038
- */
2039
- function buildFullPath(baseURL, requestedURL) {
2040
- if (baseURL && !isAbsoluteURL(requestedURL)) {
2041
- return combineURLs(baseURL, requestedURL);
2042
- }
2043
- return requestedURL;
2044
- }
2045
-
2046
- const isURLSameOrigin = platform.isStandardBrowserEnv ?
2047
-
2048
- // Standard browser envs have full support of the APIs needed to test
2049
- // whether the request URL is of the same origin as current location.
2050
- (function standardBrowserEnv() {
2051
- const msie = /(msie|trident)/i.test(navigator.userAgent);
2052
- const urlParsingNode = document.createElement('a');
2053
- let originURL;
2054
-
2055
- /**
2056
- * Parse a URL to discover it's components
2057
- *
2058
- * @param {String} url The URL to be parsed
2059
- * @returns {Object}
2060
- */
2061
- function resolveURL(url) {
2062
- let href = url;
2063
-
2064
- if (msie) {
2065
- // IE needs attribute set twice to normalize properties
2066
- urlParsingNode.setAttribute('href', href);
2067
- href = urlParsingNode.href;
2068
- }
2069
-
2070
- urlParsingNode.setAttribute('href', href);
2071
-
2072
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2073
- return {
2074
- href: urlParsingNode.href,
2075
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2076
- host: urlParsingNode.host,
2077
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2078
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2079
- hostname: urlParsingNode.hostname,
2080
- port: urlParsingNode.port,
2081
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2082
- urlParsingNode.pathname :
2083
- '/' + urlParsingNode.pathname
2084
- };
2085
- }
2086
-
2087
- originURL = resolveURL(window.location.href);
2088
-
2089
- /**
2090
- * Determine if a URL shares the same origin as the current location
2091
- *
2092
- * @param {String} requestURL The URL to test
2093
- * @returns {boolean} True if URL shares the same origin, otherwise false
2094
- */
2095
- return function isURLSameOrigin(requestURL) {
2096
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2097
- return (parsed.protocol === originURL.protocol &&
2098
- parsed.host === originURL.host);
2099
- };
2100
- })() :
2101
-
2102
- // Non standard browser envs (web workers, react-native) lack needed support.
2103
- (function nonStandardBrowserEnv() {
2104
- return function isURLSameOrigin() {
2105
- return true;
2106
- };
2107
- })();
2108
-
2109
- function parseProtocol(url) {
2110
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2111
- return match && match[1] || '';
2112
- }
2113
-
2114
- /**
2115
- * Calculate data maxRate
2116
- * @param {Number} [samplesCount= 10]
2117
- * @param {Number} [min= 1000]
2118
- * @returns {Function}
2119
- */
2120
- function speedometer(samplesCount, min) {
2121
- samplesCount = samplesCount || 10;
2122
- const bytes = new Array(samplesCount);
2123
- const timestamps = new Array(samplesCount);
2124
- let head = 0;
2125
- let tail = 0;
2126
- let firstSampleTS;
2127
-
2128
- min = min !== undefined ? min : 1000;
2129
-
2130
- return function push(chunkLength) {
2131
- const now = Date.now();
2132
-
2133
- const startedAt = timestamps[tail];
2134
-
2135
- if (!firstSampleTS) {
2136
- firstSampleTS = now;
2137
- }
2138
-
2139
- bytes[head] = chunkLength;
2140
- timestamps[head] = now;
2141
-
2142
- let i = tail;
2143
- let bytesCount = 0;
2144
-
2145
- while (i !== head) {
2146
- bytesCount += bytes[i++];
2147
- i = i % samplesCount;
2148
- }
2149
-
2150
- head = (head + 1) % samplesCount;
2151
-
2152
- if (head === tail) {
2153
- tail = (tail + 1) % samplesCount;
2154
- }
2155
-
2156
- if (now - firstSampleTS < min) {
2157
- return;
2158
- }
2159
-
2160
- const passed = startedAt && now - startedAt;
2161
-
2162
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2163
- };
2164
- }
2165
-
2166
- function progressEventReducer(listener, isDownloadStream) {
2167
- let bytesNotified = 0;
2168
- const _speedometer = speedometer(50, 250);
2169
-
2170
- return e => {
2171
- const loaded = e.loaded;
2172
- const total = e.lengthComputable ? e.total : undefined;
2173
- const progressBytes = loaded - bytesNotified;
2174
- const rate = _speedometer(progressBytes);
2175
- const inRange = loaded <= total;
2176
-
2177
- bytesNotified = loaded;
2178
-
2179
- const data = {
2180
- loaded,
2181
- total,
2182
- progress: total ? (loaded / total) : undefined,
2183
- bytes: progressBytes,
2184
- rate: rate ? rate : undefined,
2185
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2186
- event: e
2187
- };
2188
-
2189
- data[isDownloadStream ? 'download' : 'upload'] = true;
2190
-
2191
- listener(data);
2192
- };
2193
- }
2194
-
2195
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2196
-
2197
- const xhrAdapter = isXHRAdapterSupported && function (config) {
2198
- return new Promise(function dispatchXhrRequest(resolve, reject) {
2199
- let requestData = config.data;
2200
- const requestHeaders = AxiosHeaders$1.from(config.headers).normalize();
2201
- const responseType = config.responseType;
2202
- let onCanceled;
2203
- function done() {
2204
- if (config.cancelToken) {
2205
- config.cancelToken.unsubscribe(onCanceled);
2206
- }
2207
-
2208
- if (config.signal) {
2209
- config.signal.removeEventListener('abort', onCanceled);
2210
- }
2211
- }
2212
-
2213
- if (utils.isFormData(requestData)) {
2214
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
2215
- requestHeaders.setContentType(false); // Let the browser set it
2216
- } else {
2217
- requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
2218
- }
2219
- }
2220
-
2221
- let request = new XMLHttpRequest();
2222
-
2223
- // HTTP basic authentication
2224
- if (config.auth) {
2225
- const username = config.auth.username || '';
2226
- const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2227
- requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2228
- }
2229
-
2230
- const fullPath = buildFullPath(config.baseURL, config.url);
2231
-
2232
- request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2233
-
2234
- // Set the request timeout in MS
2235
- request.timeout = config.timeout;
2236
-
2237
- function onloadend() {
2238
- if (!request) {
2239
- return;
2240
- }
2241
- // Prepare the response
2242
- const responseHeaders = AxiosHeaders$1.from(
2243
- 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2244
- );
2245
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2246
- request.responseText : request.response;
2247
- const response = {
2248
- data: responseData,
2249
- status: request.status,
2250
- statusText: request.statusText,
2251
- headers: responseHeaders,
2252
- config,
2253
- request
2254
- };
2255
-
2256
- settle(function _resolve(value) {
2257
- resolve(value);
2258
- done();
2259
- }, function _reject(err) {
2260
- reject(err);
2261
- done();
2262
- }, response);
2263
-
2264
- // Clean up request
2265
- request = null;
2266
- }
2267
-
2268
- if ('onloadend' in request) {
2269
- // Use onloadend if available
2270
- request.onloadend = onloadend;
2271
- } else {
2272
- // Listen for ready state to emulate onloadend
2273
- request.onreadystatechange = function handleLoad() {
2274
- if (!request || request.readyState !== 4) {
2275
- return;
2276
- }
2277
-
2278
- // The request errored out and we didn't get a response, this will be
2279
- // handled by onerror instead
2280
- // With one exception: request that using file: protocol, most browsers
2281
- // will return status as 0 even though it's a successful request
2282
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2283
- return;
2284
- }
2285
- // readystate handler is calling before onerror or ontimeout handlers,
2286
- // so we should call onloadend on the next 'tick'
2287
- setTimeout(onloadend);
2288
- };
2289
- }
2290
-
2291
- // Handle browser request cancellation (as opposed to a manual cancellation)
2292
- request.onabort = function handleAbort() {
2293
- if (!request) {
2294
- return;
2295
- }
2296
-
2297
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2298
-
2299
- // Clean up request
2300
- request = null;
2301
- };
2302
-
2303
- // Handle low level network errors
2304
- request.onerror = function handleError() {
2305
- // Real errors are hidden from us by the browser
2306
- // onerror should only fire if it's a network error
2307
- reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2308
-
2309
- // Clean up request
2310
- request = null;
2311
- };
2312
-
2313
- // Handle timeout
2314
- request.ontimeout = function handleTimeout() {
2315
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2316
- const transitional = config.transitional || transitionalDefaults;
2317
- if (config.timeoutErrorMessage) {
2318
- timeoutErrorMessage = config.timeoutErrorMessage;
2319
- }
2320
- reject(new AxiosError(
2321
- timeoutErrorMessage,
2322
- transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2323
- config,
2324
- request));
2325
-
2326
- // Clean up request
2327
- request = null;
2328
- };
2329
-
2330
- // Add xsrf header
2331
- // This is only done if running in a standard browser environment.
2332
- // Specifically not if we're in a web worker, or react-native.
2333
- if (platform.isStandardBrowserEnv) {
2334
- // Add xsrf header
2335
- const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
2336
- && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2337
-
2338
- if (xsrfValue) {
2339
- requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2340
- }
2341
- }
2342
-
2343
- // Remove Content-Type if data is undefined
2344
- requestData === undefined && requestHeaders.setContentType(null);
2345
-
2346
- // Add headers to the request
2347
- if ('setRequestHeader' in request) {
2348
- utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2349
- request.setRequestHeader(key, val);
2350
- });
2351
- }
2352
-
2353
- // Add withCredentials to request if needed
2354
- if (!utils.isUndefined(config.withCredentials)) {
2355
- request.withCredentials = !!config.withCredentials;
2356
- }
2357
-
2358
- // Add responseType to request if needed
2359
- if (responseType && responseType !== 'json') {
2360
- request.responseType = config.responseType;
2361
- }
2362
-
2363
- // Handle progress if needed
2364
- if (typeof config.onDownloadProgress === 'function') {
2365
- request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2366
- }
2367
-
2368
- // Not all browsers support upload events
2369
- if (typeof config.onUploadProgress === 'function' && request.upload) {
2370
- request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2371
- }
2372
-
2373
- if (config.cancelToken || config.signal) {
2374
- // Handle cancellation
2375
- // eslint-disable-next-line func-names
2376
- onCanceled = cancel => {
2377
- if (!request) {
2378
- return;
2379
- }
2380
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2381
- request.abort();
2382
- request = null;
2383
- };
2384
-
2385
- config.cancelToken && config.cancelToken.subscribe(onCanceled);
2386
- if (config.signal) {
2387
- config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2388
- }
2389
- }
2390
-
2391
- const protocol = parseProtocol(fullPath);
2392
-
2393
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
2394
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2395
- return;
2396
- }
2397
-
2398
-
2399
- // Send the request
2400
- request.send(requestData || null);
2401
- });
2402
- };
2403
-
2404
- const knownAdapters = {
2405
- http: httpAdapter,
2406
- xhr: xhrAdapter
2407
- };
2408
-
2409
- utils.forEach(knownAdapters, (fn, value) => {
2410
- if(fn) {
2411
- try {
2412
- Object.defineProperty(fn, 'name', {value});
2413
- } catch (e) {
2414
- // eslint-disable-next-line no-empty
2415
- }
2416
- Object.defineProperty(fn, 'adapterName', {value});
2417
- }
2418
- });
2419
-
2420
- const adapters = {
2421
- getAdapter: (adapters) => {
2422
- adapters = utils.isArray(adapters) ? adapters : [adapters];
2423
-
2424
- const {length} = adapters;
2425
- let nameOrAdapter;
2426
- let adapter;
2427
-
2428
- for (let i = 0; i < length; i++) {
2429
- nameOrAdapter = adapters[i];
2430
- if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
2431
- break;
2432
- }
2433
- }
2434
-
2435
- if (!adapter) {
2436
- if (adapter === false) {
2437
- throw new AxiosError(
2438
- `Adapter ${nameOrAdapter} is not supported by the environment`,
2439
- 'ERR_NOT_SUPPORT'
2440
- );
2441
- }
2442
-
2443
- throw new Error(
2444
- utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
2445
- `Adapter '${nameOrAdapter}' is not available in the build` :
2446
- `Unknown adapter '${nameOrAdapter}'`
2447
- );
2448
- }
2449
-
2450
- if (!utils.isFunction(adapter)) {
2451
- throw new TypeError('adapter is not a function');
2452
- }
2453
-
2454
- return adapter;
2455
- },
2456
- adapters: knownAdapters
2457
- };
2458
-
2459
- /**
2460
- * Throws a `CanceledError` if cancellation has been requested.
2461
- *
2462
- * @param {Object} config The config that is to be used for the request
2463
- *
2464
- * @returns {void}
2465
- */
2466
- function throwIfCancellationRequested(config) {
2467
- if (config.cancelToken) {
2468
- config.cancelToken.throwIfRequested();
2469
- }
2470
-
2471
- if (config.signal && config.signal.aborted) {
2472
- throw new CanceledError(null, config);
2473
- }
2474
- }
2475
-
2476
- /**
2477
- * Dispatch a request to the server using the configured adapter.
2478
- *
2479
- * @param {object} config The config that is to be used for the request
2480
- *
2481
- * @returns {Promise} The Promise to be fulfilled
2482
- */
2483
- function dispatchRequest(config) {
2484
- throwIfCancellationRequested(config);
2485
-
2486
- config.headers = AxiosHeaders$1.from(config.headers);
2487
-
2488
- // Transform request data
2489
- config.data = transformData.call(
2490
- config,
2491
- config.transformRequest
2492
- );
2493
-
2494
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2495
- config.headers.setContentType('application/x-www-form-urlencoded', false);
2496
- }
2497
-
2498
- const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
2499
-
2500
- return adapter(config).then(function onAdapterResolution(response) {
2501
- throwIfCancellationRequested(config);
2502
-
2503
- // Transform response data
2504
- response.data = transformData.call(
2505
- config,
2506
- config.transformResponse,
2507
- response
2508
- );
2509
-
2510
- response.headers = AxiosHeaders$1.from(response.headers);
2511
-
2512
- return response;
2513
- }, function onAdapterRejection(reason) {
2514
- if (!isCancel(reason)) {
2515
- throwIfCancellationRequested(config);
2516
-
2517
- // Transform response data
2518
- if (reason && reason.response) {
2519
- reason.response.data = transformData.call(
2520
- config,
2521
- config.transformResponse,
2522
- reason.response
2523
- );
2524
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2525
- }
2526
- }
2527
-
2528
- return Promise.reject(reason);
2529
- });
2530
- }
2531
-
2532
- const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? thing.toJSON() : thing;
2533
-
2534
- /**
2535
- * Config-specific merge-function which creates a new config-object
2536
- * by merging two configuration objects together.
2537
- *
2538
- * @param {Object} config1
2539
- * @param {Object} config2
2540
- *
2541
- * @returns {Object} New object resulting from merging config2 to config1
2542
- */
2543
- function mergeConfig(config1, config2) {
2544
- // eslint-disable-next-line no-param-reassign
2545
- config2 = config2 || {};
2546
- const config = {};
2547
-
2548
- function getMergedValue(target, source, caseless) {
2549
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2550
- return utils.merge.call({caseless}, target, source);
2551
- } else if (utils.isPlainObject(source)) {
2552
- return utils.merge({}, source);
2553
- } else if (utils.isArray(source)) {
2554
- return source.slice();
2555
- }
2556
- return source;
2557
- }
2558
-
2559
- // eslint-disable-next-line consistent-return
2560
- function mergeDeepProperties(a, b, caseless) {
2561
- if (!utils.isUndefined(b)) {
2562
- return getMergedValue(a, b, caseless);
2563
- } else if (!utils.isUndefined(a)) {
2564
- return getMergedValue(undefined, a, caseless);
2565
- }
2566
- }
2567
-
2568
- // eslint-disable-next-line consistent-return
2569
- function valueFromConfig2(a, b) {
2570
- if (!utils.isUndefined(b)) {
2571
- return getMergedValue(undefined, b);
2572
- }
2573
- }
2574
-
2575
- // eslint-disable-next-line consistent-return
2576
- function defaultToConfig2(a, b) {
2577
- if (!utils.isUndefined(b)) {
2578
- return getMergedValue(undefined, b);
2579
- } else if (!utils.isUndefined(a)) {
2580
- return getMergedValue(undefined, a);
2581
- }
2582
- }
2583
-
2584
- // eslint-disable-next-line consistent-return
2585
- function mergeDirectKeys(a, b, prop) {
2586
- if (prop in config2) {
2587
- return getMergedValue(a, b);
2588
- } else if (prop in config1) {
2589
- return getMergedValue(undefined, a);
2590
- }
2591
- }
2592
-
2593
- const mergeMap = {
2594
- url: valueFromConfig2,
2595
- method: valueFromConfig2,
2596
- data: valueFromConfig2,
2597
- baseURL: defaultToConfig2,
2598
- transformRequest: defaultToConfig2,
2599
- transformResponse: defaultToConfig2,
2600
- paramsSerializer: defaultToConfig2,
2601
- timeout: defaultToConfig2,
2602
- timeoutMessage: defaultToConfig2,
2603
- withCredentials: defaultToConfig2,
2604
- adapter: defaultToConfig2,
2605
- responseType: defaultToConfig2,
2606
- xsrfCookieName: defaultToConfig2,
2607
- xsrfHeaderName: defaultToConfig2,
2608
- onUploadProgress: defaultToConfig2,
2609
- onDownloadProgress: defaultToConfig2,
2610
- decompress: defaultToConfig2,
2611
- maxContentLength: defaultToConfig2,
2612
- maxBodyLength: defaultToConfig2,
2613
- beforeRedirect: defaultToConfig2,
2614
- transport: defaultToConfig2,
2615
- httpAgent: defaultToConfig2,
2616
- httpsAgent: defaultToConfig2,
2617
- cancelToken: defaultToConfig2,
2618
- socketPath: defaultToConfig2,
2619
- responseEncoding: defaultToConfig2,
2620
- validateStatus: mergeDirectKeys,
2621
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2622
- };
2623
-
2624
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
2625
- const merge = mergeMap[prop] || mergeDeepProperties;
2626
- const configValue = merge(config1[prop], config2[prop], prop);
2627
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2628
- });
2629
-
2630
- return config;
2631
- }
2632
-
2633
- const VERSION = "1.4.0";
2634
-
2635
- const validators$1 = {};
2636
-
2637
- // eslint-disable-next-line func-names
2638
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
2639
- validators$1[type] = function validator(thing) {
2640
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2641
- };
2642
- });
2643
-
2644
- const deprecatedWarnings = {};
2645
-
2646
- /**
2647
- * Transitional option validator
2648
- *
2649
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
2650
- * @param {string?} version - deprecated version / removed since version
2651
- * @param {string?} message - some message with additional info
2652
- *
2653
- * @returns {function}
2654
- */
2655
- validators$1.transitional = function transitional(validator, version, message) {
2656
- function formatMessage(opt, desc) {
2657
- return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2658
- }
2659
-
2660
- // eslint-disable-next-line func-names
2661
- return (value, opt, opts) => {
2662
- if (validator === false) {
2663
- throw new AxiosError(
2664
- formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2665
- AxiosError.ERR_DEPRECATED
2666
- );
2667
- }
2668
-
2669
- if (version && !deprecatedWarnings[opt]) {
2670
- deprecatedWarnings[opt] = true;
2671
- // eslint-disable-next-line no-console
2672
- console.warn(
2673
- formatMessage(
2674
- opt,
2675
- ' has been deprecated since v' + version + ' and will be removed in the near future'
2676
- )
2677
- );
2678
- }
2679
-
2680
- return validator ? validator(value, opt, opts) : true;
2681
- };
2682
- };
2683
-
2684
- /**
2685
- * Assert object's properties type
2686
- *
2687
- * @param {object} options
2688
- * @param {object} schema
2689
- * @param {boolean?} allowUnknown
2690
- *
2691
- * @returns {object}
2692
- */
2693
-
2694
- function assertOptions(options, schema, allowUnknown) {
2695
- if (typeof options !== 'object') {
2696
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2697
- }
2698
- const keys = Object.keys(options);
2699
- let i = keys.length;
2700
- while (i-- > 0) {
2701
- const opt = keys[i];
2702
- const validator = schema[opt];
2703
- if (validator) {
2704
- const value = options[opt];
2705
- const result = value === undefined || validator(value, opt, options);
2706
- if (result !== true) {
2707
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2708
- }
2709
- continue;
2710
- }
2711
- if (allowUnknown !== true) {
2712
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2713
- }
2714
- }
2715
- }
2716
-
2717
- const validator = {
2718
- assertOptions,
2719
- validators: validators$1
2720
- };
2721
-
2722
- const validators = validator.validators;
2723
-
2724
- /**
2725
- * Create a new instance of Axios
2726
- *
2727
- * @param {Object} instanceConfig The default config for the instance
2728
- *
2729
- * @return {Axios} A new instance of Axios
2730
- */
2731
- class Axios {
2732
- constructor(instanceConfig) {
2733
- this.defaults = instanceConfig;
2734
- this.interceptors = {
2735
- request: new InterceptorManager$1(),
2736
- response: new InterceptorManager$1()
2737
- };
2738
- }
2739
-
2740
- /**
2741
- * Dispatch a request
2742
- *
2743
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2744
- * @param {?Object} config
2745
- *
2746
- * @returns {Promise} The Promise to be fulfilled
2747
- */
2748
- request(configOrUrl, config) {
2749
- /*eslint no-param-reassign:0*/
2750
- // Allow for axios('example/url'[, config]) a la fetch API
2751
- if (typeof configOrUrl === 'string') {
2752
- config = config || {};
2753
- config.url = configOrUrl;
2754
- } else {
2755
- config = configOrUrl || {};
2756
- }
2757
-
2758
- config = mergeConfig(this.defaults, config);
2759
-
2760
- const {transitional, paramsSerializer, headers} = config;
2761
-
2762
- if (transitional !== undefined) {
2763
- validator.assertOptions(transitional, {
2764
- silentJSONParsing: validators.transitional(validators.boolean),
2765
- forcedJSONParsing: validators.transitional(validators.boolean),
2766
- clarifyTimeoutError: validators.transitional(validators.boolean)
2767
- }, false);
2768
- }
2769
-
2770
- if (paramsSerializer != null) {
2771
- if (utils.isFunction(paramsSerializer)) {
2772
- config.paramsSerializer = {
2773
- serialize: paramsSerializer
2774
- };
2775
- } else {
2776
- validator.assertOptions(paramsSerializer, {
2777
- encode: validators.function,
2778
- serialize: validators.function
2779
- }, true);
2780
- }
2781
- }
2782
-
2783
- // Set config.method
2784
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2785
-
2786
- let contextHeaders;
2787
-
2788
- // Flatten headers
2789
- contextHeaders = headers && utils.merge(
2790
- headers.common,
2791
- headers[config.method]
2792
- );
2793
-
2794
- contextHeaders && utils.forEach(
2795
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2796
- (method) => {
2797
- delete headers[method];
2798
- }
2799
- );
2800
-
2801
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2802
-
2803
- // filter out skipped interceptors
2804
- const requestInterceptorChain = [];
2805
- let synchronousRequestInterceptors = true;
2806
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2807
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2808
- return;
2809
- }
2810
-
2811
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2812
-
2813
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2814
- });
2815
-
2816
- const responseInterceptorChain = [];
2817
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2818
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2819
- });
2820
-
2821
- let promise;
2822
- let i = 0;
2823
- let len;
2824
-
2825
- if (!synchronousRequestInterceptors) {
2826
- const chain = [dispatchRequest.bind(this), undefined];
2827
- chain.unshift.apply(chain, requestInterceptorChain);
2828
- chain.push.apply(chain, responseInterceptorChain);
2829
- len = chain.length;
2830
-
2831
- promise = Promise.resolve(config);
2832
-
2833
- while (i < len) {
2834
- promise = promise.then(chain[i++], chain[i++]);
2835
- }
2836
-
2837
- return promise;
2838
- }
2839
-
2840
- len = requestInterceptorChain.length;
2841
-
2842
- let newConfig = config;
2843
-
2844
- i = 0;
2845
-
2846
- while (i < len) {
2847
- const onFulfilled = requestInterceptorChain[i++];
2848
- const onRejected = requestInterceptorChain[i++];
2849
- try {
2850
- newConfig = onFulfilled(newConfig);
2851
- } catch (error) {
2852
- onRejected.call(this, error);
2853
- break;
2854
- }
2855
- }
2856
-
2857
- try {
2858
- promise = dispatchRequest.call(this, newConfig);
2859
- } catch (error) {
2860
- return Promise.reject(error);
2861
- }
2862
-
2863
- i = 0;
2864
- len = responseInterceptorChain.length;
2865
-
2866
- while (i < len) {
2867
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2868
- }
2869
-
2870
- return promise;
2871
- }
2872
-
2873
- getUri(config) {
2874
- config = mergeConfig(this.defaults, config);
2875
- const fullPath = buildFullPath(config.baseURL, config.url);
2876
- return buildURL(fullPath, config.params, config.paramsSerializer);
2877
- }
2878
- }
2879
-
2880
- // Provide aliases for supported request methods
2881
- utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2882
- /*eslint func-names:0*/
2883
- Axios.prototype[method] = function(url, config) {
2884
- return this.request(mergeConfig(config || {}, {
2885
- method,
2886
- url,
2887
- data: (config || {}).data
2888
- }));
2889
- };
2890
- });
2891
-
2892
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2893
- /*eslint func-names:0*/
2894
-
2895
- function generateHTTPMethod(isForm) {
2896
- return function httpMethod(url, data, config) {
2897
- return this.request(mergeConfig(config || {}, {
2898
- method,
2899
- headers: isForm ? {
2900
- 'Content-Type': 'multipart/form-data'
2901
- } : {},
2902
- url,
2903
- data
2904
- }));
2905
- };
2906
- }
2907
-
2908
- Axios.prototype[method] = generateHTTPMethod();
2909
-
2910
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2911
- });
2912
-
2913
- const Axios$1 = Axios;
2914
-
2915
- /**
2916
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
2917
- *
2918
- * @param {Function} executor The executor function.
2919
- *
2920
- * @returns {CancelToken}
2921
- */
2922
- class CancelToken {
2923
- constructor(executor) {
2924
- if (typeof executor !== 'function') {
2925
- throw new TypeError('executor must be a function.');
2926
- }
2927
-
2928
- let resolvePromise;
2929
-
2930
- this.promise = new Promise(function promiseExecutor(resolve) {
2931
- resolvePromise = resolve;
2932
- });
2933
-
2934
- const token = this;
2935
-
2936
- // eslint-disable-next-line func-names
2937
- this.promise.then(cancel => {
2938
- if (!token._listeners) return;
2939
-
2940
- let i = token._listeners.length;
2941
-
2942
- while (i-- > 0) {
2943
- token._listeners[i](cancel);
2944
- }
2945
- token._listeners = null;
2946
- });
2947
-
2948
- // eslint-disable-next-line func-names
2949
- this.promise.then = onfulfilled => {
2950
- let _resolve;
2951
- // eslint-disable-next-line func-names
2952
- const promise = new Promise(resolve => {
2953
- token.subscribe(resolve);
2954
- _resolve = resolve;
2955
- }).then(onfulfilled);
2956
-
2957
- promise.cancel = function reject() {
2958
- token.unsubscribe(_resolve);
2959
- };
2960
-
2961
- return promise;
2962
- };
2963
-
2964
- executor(function cancel(message, config, request) {
2965
- if (token.reason) {
2966
- // Cancellation has already been requested
2967
- return;
2968
- }
2969
-
2970
- token.reason = new CanceledError(message, config, request);
2971
- resolvePromise(token.reason);
2972
- });
2973
- }
2974
-
2975
- /**
2976
- * Throws a `CanceledError` if cancellation has been requested.
2977
- */
2978
- throwIfRequested() {
2979
- if (this.reason) {
2980
- throw this.reason;
2981
- }
2982
- }
2983
-
2984
- /**
2985
- * Subscribe to the cancel signal
2986
- */
2987
-
2988
- subscribe(listener) {
2989
- if (this.reason) {
2990
- listener(this.reason);
2991
- return;
2992
- }
2993
-
2994
- if (this._listeners) {
2995
- this._listeners.push(listener);
2996
- } else {
2997
- this._listeners = [listener];
2998
- }
2999
- }
3000
-
3001
- /**
3002
- * Unsubscribe from the cancel signal
3003
- */
3004
-
3005
- unsubscribe(listener) {
3006
- if (!this._listeners) {
3007
- return;
3008
- }
3009
- const index = this._listeners.indexOf(listener);
3010
- if (index !== -1) {
3011
- this._listeners.splice(index, 1);
3012
- }
3013
- }
3014
-
3015
- /**
3016
- * Returns an object that contains a new `CancelToken` and a function that, when called,
3017
- * cancels the `CancelToken`.
3018
- */
3019
- static source() {
3020
- let cancel;
3021
- const token = new CancelToken(function executor(c) {
3022
- cancel = c;
3023
- });
3024
- return {
3025
- token,
3026
- cancel
3027
- };
3028
- }
3029
- }
3030
-
3031
- const CancelToken$1 = CancelToken;
3032
-
3033
- /**
3034
- * Syntactic sugar for invoking a function and expanding an array for arguments.
3035
- *
3036
- * Common use case would be to use `Function.prototype.apply`.
3037
- *
3038
- * ```js
3039
- * function f(x, y, z) {}
3040
- * var args = [1, 2, 3];
3041
- * f.apply(null, args);
3042
- * ```
3043
- *
3044
- * With `spread` this example can be re-written.
3045
- *
3046
- * ```js
3047
- * spread(function(x, y, z) {})([1, 2, 3]);
3048
- * ```
3049
- *
3050
- * @param {Function} callback
3051
- *
3052
- * @returns {Function}
3053
- */
3054
- function spread(callback) {
3055
- return function wrap(arr) {
3056
- return callback.apply(null, arr);
3057
- };
3058
- }
3059
-
3060
- /**
3061
- * Determines whether the payload is an error thrown by Axios
3062
- *
3063
- * @param {*} payload The value to test
3064
- *
3065
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3066
- */
3067
- function isAxiosError(payload) {
3068
- return utils.isObject(payload) && (payload.isAxiosError === true);
3069
- }
3070
-
3071
- const HttpStatusCode = {
3072
- Continue: 100,
3073
- SwitchingProtocols: 101,
3074
- Processing: 102,
3075
- EarlyHints: 103,
3076
- Ok: 200,
3077
- Created: 201,
3078
- Accepted: 202,
3079
- NonAuthoritativeInformation: 203,
3080
- NoContent: 204,
3081
- ResetContent: 205,
3082
- PartialContent: 206,
3083
- MultiStatus: 207,
3084
- AlreadyReported: 208,
3085
- ImUsed: 226,
3086
- MultipleChoices: 300,
3087
- MovedPermanently: 301,
3088
- Found: 302,
3089
- SeeOther: 303,
3090
- NotModified: 304,
3091
- UseProxy: 305,
3092
- Unused: 306,
3093
- TemporaryRedirect: 307,
3094
- PermanentRedirect: 308,
3095
- BadRequest: 400,
3096
- Unauthorized: 401,
3097
- PaymentRequired: 402,
3098
- Forbidden: 403,
3099
- NotFound: 404,
3100
- MethodNotAllowed: 405,
3101
- NotAcceptable: 406,
3102
- ProxyAuthenticationRequired: 407,
3103
- RequestTimeout: 408,
3104
- Conflict: 409,
3105
- Gone: 410,
3106
- LengthRequired: 411,
3107
- PreconditionFailed: 412,
3108
- PayloadTooLarge: 413,
3109
- UriTooLong: 414,
3110
- UnsupportedMediaType: 415,
3111
- RangeNotSatisfiable: 416,
3112
- ExpectationFailed: 417,
3113
- ImATeapot: 418,
3114
- MisdirectedRequest: 421,
3115
- UnprocessableEntity: 422,
3116
- Locked: 423,
3117
- FailedDependency: 424,
3118
- TooEarly: 425,
3119
- UpgradeRequired: 426,
3120
- PreconditionRequired: 428,
3121
- TooManyRequests: 429,
3122
- RequestHeaderFieldsTooLarge: 431,
3123
- UnavailableForLegalReasons: 451,
3124
- InternalServerError: 500,
3125
- NotImplemented: 501,
3126
- BadGateway: 502,
3127
- ServiceUnavailable: 503,
3128
- GatewayTimeout: 504,
3129
- HttpVersionNotSupported: 505,
3130
- VariantAlsoNegotiates: 506,
3131
- InsufficientStorage: 507,
3132
- LoopDetected: 508,
3133
- NotExtended: 510,
3134
- NetworkAuthenticationRequired: 511,
3135
- };
3136
-
3137
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
3138
- HttpStatusCode[value] = key;
3139
- });
3140
-
3141
- const HttpStatusCode$1 = HttpStatusCode;
3142
-
3143
- /**
3144
- * Create an instance of Axios
3145
- *
3146
- * @param {Object} defaultConfig The default config for the instance
3147
- *
3148
- * @returns {Axios} A new instance of Axios
3149
- */
3150
- function createInstance(defaultConfig) {
3151
- const context = new Axios$1(defaultConfig);
3152
- const instance = bind(Axios$1.prototype.request, context);
3153
-
3154
- // Copy axios.prototype to instance
3155
- utils.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
3156
-
3157
- // Copy context to instance
3158
- utils.extend(instance, context, null, {allOwnKeys: true});
3159
-
3160
- // Factory for creating new instances
3161
- instance.create = function create(instanceConfig) {
3162
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
3163
- };
3164
-
3165
- return instance;
3166
- }
3167
-
3168
- // Create the default instance to be exported
3169
- const axios = createInstance(defaults$1);
3170
-
3171
- // Expose Axios class to allow class inheritance
3172
- axios.Axios = Axios$1;
3173
-
3174
- // Expose Cancel & CancelToken
3175
- axios.CanceledError = CanceledError;
3176
- axios.CancelToken = CancelToken$1;
3177
- axios.isCancel = isCancel;
3178
- axios.VERSION = VERSION;
3179
- axios.toFormData = toFormData;
3180
-
3181
- // Expose AxiosError class
3182
- axios.AxiosError = AxiosError;
3183
-
3184
- // alias for CanceledError for backward compatibility
3185
- axios.Cancel = axios.CanceledError;
3186
-
3187
- // Expose all/spread
3188
- axios.all = function all(promises) {
3189
- return Promise.all(promises);
3190
- };
3191
-
3192
- axios.spread = spread;
3193
-
3194
- // Expose isAxiosError
3195
- axios.isAxiosError = isAxiosError;
3196
-
3197
- // Expose mergeConfig
3198
- axios.mergeConfig = mergeConfig;
3199
-
3200
- axios.AxiosHeaders = AxiosHeaders$1;
3201
-
3202
- axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3203
-
3204
- axios.HttpStatusCode = HttpStatusCode$1;
3205
-
3206
- axios.default = axios;
3207
-
3208
- // this module should only have a default export
3209
- const axios$1 = axios;
3210
-
3211
- exports.axios = axios$1;