@localazy/strapi-plugin 0.2.13 → 1.0.0-beta.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 (392) hide show
  1. package/README.md +3 -1
  2. package/dist/_chunks/App-BSFfgZKU.mjs +5278 -0
  3. package/dist/_chunks/App-D1QaIMHX.js +5278 -0
  4. package/dist/_chunks/ContentTransferSetup-DHXJIxAp.js +1552 -0
  5. package/dist/_chunks/ContentTransferSetup-DtjcF_jM.mjs +1550 -0
  6. package/dist/_chunks/GlobalSettings-BON3kjHK.js +228 -0
  7. package/dist/_chunks/GlobalSettings-BcdibqNS.mjs +228 -0
  8. package/dist/_chunks/LanguagesSelector-BeijBEjg.js +47 -0
  9. package/dist/_chunks/LanguagesSelector-fyAIUp7M.mjs +48 -0
  10. package/dist/_chunks/en-BTf8goGM.mjs +8 -0
  11. package/dist/_chunks/en-CRtsEFtl.js +8 -0
  12. package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
  13. package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
  14. package/dist/_chunks/has-model-changed-BMCQX2Dd.js +316 -0
  15. package/dist/_chunks/has-model-changed-Dvtzpc9v.mjs +317 -0
  16. package/dist/_chunks/index-BQw2qi2G.js +2679 -0
  17. package/dist/_chunks/index-CN3Gyh5F.mjs +2678 -0
  18. package/dist/_chunks/isEqual-B-YVnzrp.js +205 -0
  19. package/dist/_chunks/isEqual-CEyT97-3.mjs +206 -0
  20. package/dist/_chunks/set-DUdH3vE5.js +54557 -0
  21. package/dist/_chunks/set-DulHAQhq.mjs +54542 -0
  22. package/dist/admin/index.js +4 -0
  23. package/dist/admin/index.mjs +5 -0
  24. package/dist/admin/src/components/Initializer.d.ts +5 -0
  25. package/dist/admin/src/config/development/index.d.ts +15 -0
  26. package/dist/admin/src/config/example/index.example.d.ts +15 -0
  27. package/dist/admin/src/config/index.d.ts +15 -0
  28. package/dist/admin/src/config/local/index.d.ts +15 -0
  29. package/dist/admin/src/config/production/index.d.ts +15 -0
  30. package/dist/admin/src/i18n.d.ts +2 -0
  31. package/dist/admin/src/index.d.ts +10 -0
  32. package/dist/admin/src/modules/@common/api/strapi-api-base.d.ts +6 -0
  33. package/dist/admin/src/modules/@common/components/Icons/House.d.ts +2 -0
  34. package/dist/admin/src/modules/@common/components/Icons/Localazy.d.ts +2 -0
  35. package/dist/admin/src/modules/@common/components/LanguagesSelector.d.ts +11 -0
  36. package/dist/admin/src/modules/@common/components/PluginPageLoader.d.ts +2 -0
  37. package/dist/admin/src/modules/@common/components/SideNav.d.ts +2 -0
  38. package/dist/admin/src/modules/@common/components/TransferReport.d.ts +5 -0
  39. package/dist/admin/src/modules/@common/functions/flatten-deep.d.ts +2 -0
  40. package/dist/admin/src/modules/@common/locale/en.d.ts +14 -0
  41. package/dist/admin/src/modules/@common/models/supported-content-type-fields.d.ts +2 -0
  42. package/dist/admin/src/modules/@common/models/supported-custom-field-plugins.d.ts +2 -0
  43. package/dist/admin/src/modules/@common/services/i18n-service.d.ts +3 -0
  44. package/dist/admin/src/modules/@common/services/plugin.service.d.ts +3 -0
  45. package/dist/admin/src/modules/@common/services/product-analytics-service.d.ts +14 -0
  46. package/dist/admin/src/modules/@common/services/project-service.d.ts +4 -0
  47. package/dist/admin/src/modules/@common/services/user-service.d.ts +5 -0
  48. package/dist/admin/src/modules/@common/utils/are-locales-compatible.d.ts +2 -0
  49. package/dist/admin/src/modules/@common/utils/format-number.d.ts +2 -0
  50. package/dist/admin/src/modules/@common/utils/get-default-locale.d.ts +2 -0
  51. package/dist/admin/src/modules/@common/utils/history.d.ts +2 -0
  52. package/dist/admin/src/modules/@common/utils/is-plugin-route.d.ts +2 -0
  53. package/dist/admin/src/modules/@common/utils/iso-locales-utils.d.ts +3 -0
  54. package/dist/admin/src/modules/@common/utils/redirect-to-plugin-route.d.ts +13 -0
  55. package/dist/admin/src/modules/@common/utils/sort-by-model-name.d.ts +2 -0
  56. package/dist/admin/src/modules/@common/utils/use-header-subtitle.d.ts +2 -0
  57. package/dist/admin/src/modules/@common/utils/use-header-title.d.ts +2 -0
  58. package/dist/admin/src/modules/@common/utils/use-nav.d.ts +11 -0
  59. package/dist/admin/src/modules/alerts/constants/channels.d.ts +1 -0
  60. package/dist/admin/src/modules/alerts/constants/events.d.ts +4 -0
  61. package/dist/admin/src/modules/alerts/services/alerts-service.d.ts +8 -0
  62. package/dist/admin/src/modules/localazy-download/locale/en.d.ts +24 -0
  63. package/dist/admin/src/modules/localazy-download/services/download-alerts-service.d.ts +5 -0
  64. package/dist/admin/src/modules/localazy-download/services/localazy-download-service.d.ts +3 -0
  65. package/dist/admin/src/modules/localazy-upload/components/ReadDocsButton.d.ts +3 -0
  66. package/dist/admin/src/modules/localazy-upload/locale/en.d.ts +19 -0
  67. package/dist/admin/src/modules/localazy-upload/services/localazy-upload-service.d.ts +3 -0
  68. package/dist/admin/src/modules/localazy-upload/services/upload-alerts-service.d.ts +5 -0
  69. package/dist/admin/src/modules/login/components/FetchIdentity.d.ts +3 -0
  70. package/dist/admin/src/modules/login/components/LoginButton.d.ts +12 -0
  71. package/dist/admin/src/modules/login/components/LogoutButton.d.ts +6 -0
  72. package/dist/admin/src/modules/login/locale/en.d.ts +8 -0
  73. package/dist/admin/src/modules/login/services/localazy-login-service.d.ts +4 -0
  74. package/dist/admin/src/modules/overview/components/OverviewItem.d.ts +7 -0
  75. package/dist/admin/src/modules/overview/components/OverviewItemLink.d.ts +7 -0
  76. package/dist/admin/src/modules/overview/components/PrerequisitiesInfo.d.ts +3 -0
  77. package/dist/admin/src/modules/overview/locale/en.d.ts +14 -0
  78. package/dist/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty.d.ts +2 -0
  79. package/dist/admin/src/modules/plugin-settings/components/Tree.d.ts +8 -0
  80. package/dist/admin/src/modules/plugin-settings/components/TreeItem.d.ts +10 -0
  81. package/dist/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.d.ts +2 -0
  82. package/dist/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.d.ts +8 -0
  83. package/dist/admin/src/modules/plugin-settings/functions/has-model-changed.d.ts +6 -0
  84. package/dist/admin/src/modules/plugin-settings/locale/en.d.ts +49 -0
  85. package/dist/admin/src/modules/plugin-settings/services/plugin-settings-service.d.ts +6 -0
  86. package/dist/admin/src/modules/plugin-settings/services/strapi-model-service.d.ts +4 -0
  87. package/dist/admin/src/modules/plugin-settings/services/strapi-users-service.d.ts +3 -0
  88. package/dist/admin/src/modules/plugin-settings/utils/array-of-models-to-object.d.ts +2 -0
  89. package/dist/admin/src/modules/plugin-settings/utils/find-model-value-by-key.d.ts +2 -0
  90. package/dist/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.d.ts +7 -0
  91. package/dist/admin/src/modules/plugin-settings/utils/get-models-tree.d.ts +5 -0
  92. package/dist/admin/src/modules/strapi/utils/get-default-theme.d.ts +3 -0
  93. package/dist/admin/src/modules/user/model/localazy-identity.d.ts +15 -0
  94. package/dist/admin/src/modules/user/services/localazy-user-service.d.ts +6 -0
  95. package/dist/admin/src/pages/App.d.ts +3 -0
  96. package/dist/admin/src/pages/ContentTransferSetup.d.ts +4 -0
  97. package/dist/admin/src/pages/Download.d.ts +7 -0
  98. package/dist/admin/src/pages/GlobalSettings.d.ts +4 -0
  99. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  100. package/dist/admin/src/pages/Login.d.ts +8 -0
  101. package/dist/admin/src/pages/Overview.d.ts +8 -0
  102. package/dist/admin/src/pages/Upload.d.ts +7 -0
  103. package/dist/admin/src/pluginId.d.ts +2 -0
  104. package/dist/admin/src/plugins/generic-connector-client.d.ts +3 -0
  105. package/dist/admin/src/state/localazy-identity.d.ts +13 -0
  106. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  107. package/dist/server/index.js +26000 -0
  108. package/dist/server/index.mjs +25989 -0
  109. package/dist/server/src/bootstrap.d.ts +5 -0
  110. package/dist/server/src/config/core/config.d.ts +1 -0
  111. package/dist/server/src/config/development/index.d.ts +15 -0
  112. package/dist/server/src/config/example/index.example.d.ts +15 -0
  113. package/dist/server/src/config/index.d.ts +18 -0
  114. package/dist/server/src/config/local/index.d.ts +15 -0
  115. package/dist/server/src/config/production/index.d.ts +15 -0
  116. package/dist/server/src/constants/channels.d.ts +3 -0
  117. package/dist/server/src/constants/events.d.ts +6 -0
  118. package/dist/server/src/content-types/index.d.ts +2 -0
  119. package/dist/server/src/controllers/index.d.ts +43 -0
  120. package/dist/server/src/controllers/localazy-auth-controller.d.ts +8 -0
  121. package/dist/server/src/controllers/localazy-project-controller.d.ts +7 -0
  122. package/dist/server/src/controllers/localazy-transfer-controller.d.ts +8 -0
  123. package/dist/server/src/controllers/localazy-user-controller.d.ts +9 -0
  124. package/dist/server/src/controllers/plugin-settings-controller.d.ts +10 -0
  125. package/dist/server/src/controllers/strapi-controller.d.ts +10 -0
  126. package/dist/server/src/core/index.d.ts +71 -0
  127. package/dist/server/src/db/model/content-transfer-setup.d.ts +4 -0
  128. package/dist/server/src/db/model/localazy-user.d.ts +17 -0
  129. package/dist/server/src/db/model/plugin-settings.d.ts +5 -0
  130. package/dist/server/src/db/model/utils/get-strapi-store.d.ts +26 -0
  131. package/dist/server/src/destroy.d.ts +5 -0
  132. package/dist/server/src/functions/should-set-downloaded-property.d.ts +12 -0
  133. package/dist/server/src/index.d.ts +189 -0
  134. package/dist/server/src/lifecycles/deep-populate-hook.d.ts +20 -0
  135. package/dist/server/src/lifecycles/deprecate-event-entry-in-localazy-hook.d.ts +4 -0
  136. package/dist/server/src/lifecycles/upload-event-entry-to-localazy-hook.d.ts +12 -0
  137. package/dist/server/src/middlewares/index.d.ts +2 -0
  138. package/dist/server/src/models/plugin/content-transfer-setup.d.ts +13 -0
  139. package/dist/server/src/models/strapi/locale.d.ts +8 -0
  140. package/dist/server/src/policies/index.d.ts +2 -0
  141. package/dist/server/src/register.d.ts +5 -0
  142. package/dist/server/src/routes/index.d.ts +25 -0
  143. package/dist/server/src/routes/localazy-auth-routes.d.ts +9 -0
  144. package/dist/server/src/routes/localazy-project-routes.d.ts +9 -0
  145. package/dist/server/src/routes/localazy-transfer-routes.d.ts +9 -0
  146. package/dist/server/src/routes/localazy-user-routes.d.ts +9 -0
  147. package/dist/server/src/routes/plugin-settings-routes.d.ts +9 -0
  148. package/dist/server/src/routes/strapi-routes.d.ts +9 -0
  149. package/dist/server/src/services/helpers/job-notification-service.d.ts +14 -0
  150. package/dist/server/src/services/helpers/plugin-settings-service-helper.d.ts +16 -0
  151. package/dist/server/src/services/index.d.ts +92 -0
  152. package/dist/server/src/services/localazy-pubapi-service.d.ts +12 -0
  153. package/dist/server/src/services/localazy-transfer-download-service.d.ts +11 -0
  154. package/dist/server/src/services/localazy-transfer-upload-service.d.ts +11 -0
  155. package/dist/server/src/services/localazy-upload-service.d.ts +28 -0
  156. package/dist/server/src/services/localazy-user-service.d.ts +11 -0
  157. package/dist/server/src/services/plugin-settings-service.d.ts +16 -0
  158. package/dist/server/src/services/strapi-i18n-service.d.ts +19 -0
  159. package/dist/server/src/services/strapi-localazy-i18n-service.d.ts +9 -0
  160. package/dist/server/src/services/strapi-service.d.ts +10 -0
  161. package/dist/server/src/utils/delay.d.ts +1 -0
  162. package/dist/server/src/utils/drop-property-deep.d.ts +1 -0
  163. package/dist/server/src/utils/flatten-object.d.ts +2 -0
  164. package/dist/server/src/utils/generate-random-id.d.ts +2 -0
  165. package/dist/server/src/utils/get-full-populate-localazy-download-object.d.ts +17 -0
  166. package/dist/server/src/utils/get-full-populate-localazy-upload-object.d.ts +9 -0
  167. package/dist/server/src/utils/get-full-populate-object.d.ts +17 -0
  168. package/dist/server/src/utils/get-main-keys-of-nested-array-objects.d.ts +2 -0
  169. package/dist/server/src/utils/get-picked-flatten-keys-for-hook-entry.d.ts +5 -0
  170. package/dist/server/src/utils/intl-display-name.d.ts +1 -0
  171. package/dist/server/src/utils/is-generally-applicable-content-type.d.ts +2 -0
  172. package/dist/server/src/utils/is-localazy-applicable-content-type.d.ts +2 -0
  173. package/dist/server/src/utils/iso-locales-utils.d.ts +3 -0
  174. package/dist/server/src/utils/localazy-api-client-factory.d.ts +3 -0
  175. package/dist/server/src/utils/localazy-generic-connector-client-factory.d.ts +3 -0
  176. package/dist/server/src/utils/model-utils.d.ts +7 -0
  177. package/dist/server/src/utils/omit-deep.d.ts +2 -0
  178. package/dist/server/src/utils/parsed-localazy-entry-to-create-entry.d.ts +7 -0
  179. package/dist/server/src/utils/parsed-localazy-entry-to-update-entry.d.ts +1 -0
  180. package/dist/server/src/utils/pick-entries.d.ts +2 -0
  181. package/dist/server/src/utils/populate-create-update-entry-with-base-entry.d.ts +1 -0
  182. package/dist/server/src/utils/request-initiator-helper.d.ts +9 -0
  183. package/dist/server/src/utils/reset-array-keys-deep.d.ts +1 -0
  184. package/dist/server/src/utils/transfer-setup-utils.d.ts +7 -0
  185. package/install/index.mjs +88 -34
  186. package/install/vite.config.example.js +40 -0
  187. package/install/vite.config.example.ts +41 -0
  188. package/install/{webpack.example.js → webpack.config.example.js} +2 -2
  189. package/install/webpack.config.example.ts +30 -0
  190. package/package.json +93 -55
  191. package/.babelrc +0 -7
  192. package/.eslintrc +0 -13
  193. package/.github/workflows/qa.yml +0 -25
  194. package/.github/workflows/release.yml +0 -46
  195. package/.nvmrc +0 -1
  196. package/.strapi-updater.json +0 -4
  197. package/CHANGELOG.md +0 -68
  198. package/LICENSE +0 -21
  199. package/admin/src/components/Initializer/index.js +0 -26
  200. package/admin/src/components/PluginIcon/index.js +0 -14
  201. package/admin/src/config/development/index.js +0 -14
  202. package/admin/src/config/example/index.js +0 -14
  203. package/admin/src/config/index.js +0 -19
  204. package/admin/src/config/local/index.js +0 -14
  205. package/admin/src/config/production/index.js +0 -15
  206. package/admin/src/i18n.js +0 -41
  207. package/admin/src/index.js +0 -138
  208. package/admin/src/modules/@common/components/Icons/Localazy/index.js +0 -12
  209. package/admin/src/modules/@common/components/LanguagesSelector/index.js +0 -67
  210. package/admin/src/modules/@common/components/PluginPageLoader/index.js +0 -20
  211. package/admin/src/modules/@common/components/SideNav/index.js +0 -46
  212. package/admin/src/modules/@common/components/TransferReport/index.js +0 -53
  213. package/admin/src/modules/@common/locale/en.js +0 -14
  214. package/admin/src/modules/@common/models/supported-content-type-fields.js +0 -9
  215. package/admin/src/modules/@common/models/supported-custom-field-plugins.js +0 -6
  216. package/admin/src/modules/@common/services/i18n-service.js +0 -15
  217. package/admin/src/modules/@common/services/plugin.service.js +0 -16
  218. package/admin/src/modules/@common/services/product-analytics-service.js +0 -86
  219. package/admin/src/modules/@common/services/project-service.js +0 -15
  220. package/admin/src/modules/@common/services/user-service.js +0 -38
  221. package/admin/src/modules/@common/utils/__tests__/iso-locales-utils.test.js +0 -102
  222. package/admin/src/modules/@common/utils/are-locales-compatible.js +0 -42
  223. package/admin/src/modules/@common/utils/format-number.js +0 -1
  224. package/admin/src/modules/@common/utils/functions/flatten-deep.js +0 -23
  225. package/admin/src/modules/@common/utils/get-default-locale.js +0 -32
  226. package/admin/src/modules/@common/utils/get-header-subtitle.js +0 -21
  227. package/admin/src/modules/@common/utils/get-header-title.js +0 -24
  228. package/admin/src/modules/@common/utils/get-nav.js +0 -35
  229. package/admin/src/modules/@common/utils/history.js +0 -6
  230. package/admin/src/modules/@common/utils/is-plugin-route.js +0 -15
  231. package/admin/src/modules/@common/utils/iso-locales-utils.js +0 -58
  232. package/admin/src/modules/@common/utils/redirect-to-plugin-route.js +0 -22
  233. package/admin/src/modules/@common/utils/sort-by-model-name.js +0 -10
  234. package/admin/src/modules/alerts/constants/channels.js +0 -1
  235. package/admin/src/modules/alerts/constants/events.js +0 -4
  236. package/admin/src/modules/alerts/services/alerts-service.js +0 -41
  237. package/admin/src/modules/localazy-download/locale/en.js +0 -25
  238. package/admin/src/modules/localazy-download/services/download-alerts-service.js +0 -12
  239. package/admin/src/modules/localazy-download/services/localazy-download-service.js +0 -16
  240. package/admin/src/modules/localazy-upload/components/ReadDocsButton.js +0 -20
  241. package/admin/src/modules/localazy-upload/locale/en.js +0 -20
  242. package/admin/src/modules/localazy-upload/services/localazy-upload-service.js +0 -16
  243. package/admin/src/modules/localazy-upload/services/upload-alerts-service.js +0 -12
  244. package/admin/src/modules/login/components/LoginButton/index.js +0 -55
  245. package/admin/src/modules/login/components/LogoutButton/index.js +0 -49
  246. package/admin/src/modules/login/locale/en.js +0 -7
  247. package/admin/src/modules/login/services/localazy-login-service.js +0 -29
  248. package/admin/src/modules/plugin-settings/components/ContentTransferSetup/index.js +0 -308
  249. package/admin/src/modules/plugin-settings/components/ContentTransferSetupEmpty/index.js +0 -86
  250. package/admin/src/modules/plugin-settings/components/GlobalSettings/index.js +0 -269
  251. package/admin/src/modules/plugin-settings/components/Tree/index.js +0 -145
  252. package/admin/src/modules/plugin-settings/components/TreeItem/index.js +0 -48
  253. package/admin/src/modules/plugin-settings/functions/build-content-transfer-setup-schema.js +0 -57
  254. package/admin/src/modules/plugin-settings/functions/get-content-transfer-setup-keys-sets.js +0 -85
  255. package/admin/src/modules/plugin-settings/functions/has-model-changed.js +0 -75
  256. package/admin/src/modules/plugin-settings/locale/en.js +0 -61
  257. package/admin/src/modules/plugin-settings/services/plugin-settings-service.js +0 -55
  258. package/admin/src/modules/plugin-settings/services/strapi-model-service.js +0 -26
  259. package/admin/src/modules/plugin-settings/services/strapi-users-service.js +0 -26
  260. package/admin/src/modules/plugin-settings/utils/__tests__/get-models-tree.test.js +0 -135
  261. package/admin/src/modules/plugin-settings/utils/array-of-models-to-object.js +0 -6
  262. package/admin/src/modules/plugin-settings/utils/find-model-value-by-key.js +0 -8
  263. package/admin/src/modules/plugin-settings/utils/get-filtered-models-schemas.js +0 -31
  264. package/admin/src/modules/plugin-settings/utils/get-models-tree.js +0 -94
  265. package/admin/src/modules/settings/components/OverviewItem/index.js +0 -44
  266. package/admin/src/modules/settings/components/OverviewItemLink/index.js +0 -34
  267. package/admin/src/modules/settings/components/PrerequisitiesInfo/index.js +0 -28
  268. package/admin/src/modules/settings/locale/en.js +0 -13
  269. package/admin/src/modules/user/model/localazy-identity.js +0 -14
  270. package/admin/src/modules/user/services/localazy-user-service.js +0 -38
  271. package/admin/src/pages/App/index.js +0 -154
  272. package/admin/src/pages/Download/index.js +0 -280
  273. package/admin/src/pages/Index/index.js +0 -8
  274. package/admin/src/pages/Login/index.js +0 -109
  275. package/admin/src/pages/PluginSettings/index.js +0 -56
  276. package/admin/src/pages/Settings/index.js +0 -132
  277. package/admin/src/pages/Upload/index.js +0 -241
  278. package/admin/src/pluginId.js +0 -5
  279. package/admin/src/plugins/generic-connector-client.js +0 -9
  280. package/admin/src/state/localazy-identity.js +0 -29
  281. package/admin/src/tests/fixtures/all-models.js +0 -877
  282. package/admin/src/tests/fixtures/restaurant-model.js +0 -230
  283. package/admin/src/translations/en.json +0 -4
  284. package/admin/src/translations/fr.json +0 -1
  285. package/admin/src/utils/createAxiosInstance.js +0 -54
  286. package/admin/src/utils/getTrad.js +0 -5
  287. package/jest.config.js +0 -0
  288. package/server/bootstrap.js +0 -63
  289. package/server/config/development/index.js +0 -16
  290. package/server/config/example/index.js +0 -16
  291. package/server/config/index.js +0 -20
  292. package/server/config/local/index.js +0 -16
  293. package/server/config/production/index.js +0 -17
  294. package/server/config/schema.graphql.js +0 -21
  295. package/server/constants/channels.js +0 -3
  296. package/server/constants/events.js +0 -6
  297. package/server/content-types/index.js +0 -3
  298. package/server/controllers/index.js +0 -17
  299. package/server/controllers/localazy-auth-controller.js +0 -22
  300. package/server/controllers/localazy-project-controller.js +0 -21
  301. package/server/controllers/localazy-transfer-controller.js +0 -62
  302. package/server/controllers/localazy-user-controller.js +0 -24
  303. package/server/controllers/plugin-settings-controller.js +0 -31
  304. package/server/controllers/strapi-controller.js +0 -27
  305. package/server/db/model/content-transfer-setup.js +0 -13
  306. package/server/db/model/localazy-user.js +0 -23
  307. package/server/db/model/plugin-settings.js +0 -13
  308. package/server/db/model/utils/get-strapi-store.js +0 -9
  309. package/server/destroy.js +0 -5
  310. package/server/functions/should-set-downloaded-property.js +0 -94
  311. package/server/index.js +0 -25
  312. package/server/lifecycles/deep-populate-hook.js +0 -12
  313. package/server/lifecycles/deprecate-event-entry-in-localazy-hook.js +0 -73
  314. package/server/lifecycles/upload-event-entry-to-localazy-hook.js +0 -36
  315. package/server/middlewares/index.js +0 -7
  316. package/server/middlewares/verify-webhook.js +0 -76
  317. package/server/models/supported-content-type-fields.js +0 -9
  318. package/server/models/supported-custom-field-plugins.js +0 -6
  319. package/server/policies/index.js +0 -3
  320. package/server/register.js +0 -5
  321. package/server/routes/index.js +0 -28
  322. package/server/routes/localazy-auth.js +0 -22
  323. package/server/routes/localazy-project.js +0 -14
  324. package/server/routes/localazy-public-transfer.js +0 -20
  325. package/server/routes/localazy-transfer.js +0 -22
  326. package/server/routes/localazy-user.js +0 -30
  327. package/server/routes/plugin-settings.js +0 -38
  328. package/server/routes/strapi.js +0 -38
  329. package/server/services/helpers/job-notification-service.js +0 -30
  330. package/server/services/helpers/plugin-settings-service-helper.js +0 -52
  331. package/server/services/index.js +0 -23
  332. package/server/services/localazy-pubapi-service.js +0 -53
  333. package/server/services/localazy-transfer-download-service.js +0 -445
  334. package/server/services/localazy-transfer-upload-service.js +0 -178
  335. package/server/services/localazy-upload-service.js +0 -52
  336. package/server/services/localazy-user-service.js +0 -29
  337. package/server/services/plugin-settings-service.js +0 -53
  338. package/server/services/strapi-i18n-service.js +0 -151
  339. package/server/services/strapi-localazy-i18n-service.js +0 -130
  340. package/server/services/strapi-service.js +0 -26
  341. package/server/tests/fixtures/all-models.js +0 -869
  342. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-cookbook.js +0 -5761
  343. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-lesson-dz.js +0 -402
  344. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-page-dz.js +0 -658
  345. package/server/tests/fixtures/parsed-localazy-entry-to-create-entry-restaurant-simple-menu.js +0 -536
  346. package/server/tests/fixtures/parsed-localazy-entry-to-update-entry.js +0 -35157
  347. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook-empty-recipes.js +0 -202
  348. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-cookbook.js +0 -2700
  349. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-lesson-dz.js +0 -309
  350. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-simple.js +0 -47
  351. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-flat-with-media.js +0 -169
  352. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-empty.js +0 -3003
  353. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-restaurant-simple-menu-with-media.js +0 -2057
  354. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json-dz.js +0 -884
  355. package/server/tests/fixtures/populate-create-update-entry-with-base-entry-sample-json.js +0 -46
  356. package/server/tests/fixtures/strapi-plugin-all-models.js +0 -7000
  357. package/server/utils/__tests__/build-populate.test.js +0 -85
  358. package/server/utils/__tests__/flatten-object.test.js +0 -171
  359. package/server/utils/__tests__/get-models-tree.test.js +0 -170
  360. package/server/utils/__tests__/iso-locales-utils.test.js +0 -104
  361. package/server/utils/__tests__/parsed-localazy-entry-to-create-entry.test.js +0 -258
  362. package/server/utils/__tests__/parsed-localazy-entry-to-update-entry.test.js +0 -456
  363. package/server/utils/__tests__/pick-entries.test.js +0 -963
  364. package/server/utils/__tests__/populate-create-update-entry-with-base-entry.test.js +0 -1176
  365. package/server/utils/build-populate.js +0 -48
  366. package/server/utils/delay.js +0 -6
  367. package/server/utils/flatten-object.js +0 -61
  368. package/server/utils/generate-random-id.js +0 -3
  369. package/server/utils/get-full-populate-object.js +0 -66
  370. package/server/utils/get-main-keys-of-nested-array-objects.js +0 -5
  371. package/server/utils/get-models-tree.js +0 -47
  372. package/server/utils/get-picked-flatten-keys-for-hook-entry.js +0 -270
  373. package/server/utils/intl-display-name.js +0 -4
  374. package/server/utils/is-generally-applicable-content-type.js +0 -33
  375. package/server/utils/is-localazy-applicable-content-type.js +0 -36
  376. package/server/utils/iso-locales-utils.js +0 -60
  377. package/server/utils/localazy-api-client-factory.js +0 -22
  378. package/server/utils/localazy-generic-connector-client-factory.js +0 -15
  379. package/server/utils/model-utils.js +0 -43
  380. package/server/utils/objectivise-entry.js +0 -41
  381. package/server/utils/omit-deep.js +0 -24
  382. package/server/utils/parsed-localazy-entry-to-create-entry.js +0 -194
  383. package/server/utils/parsed-localazy-entry-to-update-entry.js +0 -83
  384. package/server/utils/pick-deep.js +0 -22
  385. package/server/utils/pick-entries.js +0 -37
  386. package/server/utils/populate-create-update-entry-with-base-entry.js +0 -264
  387. package/server/utils/request-initiator-helper.js +0 -36
  388. package/server/utils/reset-array-keys-deep.js +0 -19
  389. package/server/utils/transfer-setup-utils.js +0 -93
  390. package/strapi-admin.js +0 -14
  391. package/strapi-server.js +0 -5
  392. package/test/helpers/mocks.js +0 -9
@@ -0,0 +1,2679 @@
1
+ "use strict";
2
+ const React = require("react");
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const reactRouterDom = require("react-router-dom");
5
+ const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
6
+ const React__default = /* @__PURE__ */ _interopDefault(React);
7
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
8
+ const v = glob[path];
9
+ if (v) {
10
+ return typeof v === "function" ? v() : Promise.resolve(v);
11
+ }
12
+ return new Promise((_, reject) => {
13
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
14
+ reject.bind(
15
+ null,
16
+ new Error(
17
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
18
+ )
19
+ )
20
+ );
21
+ });
22
+ };
23
+ const strapi = {
24
+ name: "strapi-plugin-v5"
25
+ };
26
+ const pluginPkg = {
27
+ strapi
28
+ };
29
+ const PLUGIN_ID = pluginPkg.strapi.name;
30
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
31
+ const Initializer = ({ setPlugin }) => {
32
+ const ref = React.useRef(setPlugin);
33
+ React.useEffect(() => {
34
+ ref.current(PLUGIN_ID);
35
+ }, []);
36
+ return null;
37
+ };
38
+ const Localazy = () => {
39
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", fill: "#8e8ea9", children: [
40
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.4517 2.56643L16.3247 2.87501L15.5632 4.67576H7.49071C7.18595 4.67576 6.98278 4.98434 7.1013 5.26333L9.05259 9.91314C9.12031 10.0695 9.27269 10.171 9.442 10.171H12.6211C12.9216 10.171 13.1247 10.4753 13.0147 10.7501L12.8919 11.046L12.1353 12.8468H10.9192C10.6187 12.8468 10.4113 13.1553 10.5298 13.4343L13.8229 21.2925C13.9626 21.6265 13.7171 21.9942 13.353 21.9942H11.3256C11.1224 21.9942 10.9362 21.8716 10.8557 21.6814L3.1056 3.17091C2.8728 2.61293 3.27915 2 3.88443 2H16.0538C16.3501 2 16.5533 2.29167 16.4517 2.56643Z" }),
41
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17.2937 13.5315L21.0354 4.63345C21.2724 4.07548 20.8619 3.45832 20.2566 3.46255L17.2267 3.46255L16.4794 5.23793C16.4794 5.24638 16.4752 5.25484 16.4709 5.26329L16.4709 5.26329L16.3482 5.55074C16.2297 5.82973 16.4371 6.1383 16.7376 6.1383H16.8069C17.1074 6.1383 17.3148 6.44688 17.1963 6.72587L15.2408 11.3757C15.1773 11.5321 15.0207 11.6335 14.8514 11.6335H13.7902L12.9112 13.7217C12.7927 14.0007 13.0001 14.3093 13.3006 14.3093H16.1212C16.6334 14.3093 17.0947 14.0007 17.2937 13.5315Z" })
42
+ ] });
43
+ };
44
+ const emptyIdentity = {
45
+ accessToken: "",
46
+ project: {
47
+ id: "",
48
+ image: "",
49
+ name: "",
50
+ url: ""
51
+ },
52
+ scope: "",
53
+ user: {
54
+ id: "",
55
+ name: ""
56
+ }
57
+ };
58
+ const LocalazyIdentityContextType = React.createContext(void 0);
59
+ const LocalazyIdentityProvider = ({ children }) => {
60
+ const [identity, setIdentity] = React.useState(emptyIdentity);
61
+ const isLoggedIn = React.useMemo(() => !!identity.accessToken, [identity.accessToken]);
62
+ return /* @__PURE__ */ jsxRuntime.jsx(LocalazyIdentityContextType.Provider, { value: { identity, setIdentity, isLoggedIn }, children });
63
+ };
64
+ const useLocalazyIdentity = () => {
65
+ const context = React.useContext(LocalazyIdentityContextType);
66
+ if (context === void 0) {
67
+ throw new Error("useLocalazyIdentity must be used within a LocalazyIdentityProvider");
68
+ }
69
+ return context;
70
+ };
71
+ const localazyIdentity = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
72
+ __proto__: null,
73
+ LocalazyIdentityProvider,
74
+ useLocalazyIdentity
75
+ }, Symbol.toStringTag, { value: "Module" }));
76
+ function bind(fn, thisArg) {
77
+ return function wrap() {
78
+ return fn.apply(thisArg, arguments);
79
+ };
80
+ }
81
+ const { toString } = Object.prototype;
82
+ const { getPrototypeOf } = Object;
83
+ const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
84
+ const str = toString.call(thing);
85
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
86
+ })(/* @__PURE__ */ Object.create(null));
87
+ const kindOfTest = (type) => {
88
+ type = type.toLowerCase();
89
+ return (thing) => kindOf(thing) === type;
90
+ };
91
+ const typeOfTest = (type) => (thing) => typeof thing === type;
92
+ const { isArray } = Array;
93
+ const isUndefined = typeOfTest("undefined");
94
+ function isBuffer(val) {
95
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
96
+ }
97
+ const isArrayBuffer = kindOfTest("ArrayBuffer");
98
+ function isArrayBufferView(val) {
99
+ let result;
100
+ if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
101
+ result = ArrayBuffer.isView(val);
102
+ } else {
103
+ result = val && val.buffer && isArrayBuffer(val.buffer);
104
+ }
105
+ return result;
106
+ }
107
+ const isString = typeOfTest("string");
108
+ const isFunction = typeOfTest("function");
109
+ const isNumber = typeOfTest("number");
110
+ const isObject = (thing) => thing !== null && typeof thing === "object";
111
+ const isBoolean = (thing) => thing === true || thing === false;
112
+ const isPlainObject = (val) => {
113
+ if (kindOf(val) !== "object") {
114
+ return false;
115
+ }
116
+ const prototype2 = getPrototypeOf(val);
117
+ return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
118
+ };
119
+ const isDate = kindOfTest("Date");
120
+ const isFile = kindOfTest("File");
121
+ const isBlob = kindOfTest("Blob");
122
+ const isFileList = kindOfTest("FileList");
123
+ const isStream = (val) => isObject(val) && isFunction(val.pipe);
124
+ const isFormData = (thing) => {
125
+ let kind;
126
+ return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
127
+ kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
128
+ };
129
+ const isURLSearchParams = kindOfTest("URLSearchParams");
130
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
131
+ const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
132
+ function forEach(obj, fn, { allOwnKeys = false } = {}) {
133
+ if (obj === null || typeof obj === "undefined") {
134
+ return;
135
+ }
136
+ let i;
137
+ let l;
138
+ if (typeof obj !== "object") {
139
+ obj = [obj];
140
+ }
141
+ if (isArray(obj)) {
142
+ for (i = 0, l = obj.length; i < l; i++) {
143
+ fn.call(null, obj[i], i, obj);
144
+ }
145
+ } else {
146
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
147
+ const len = keys.length;
148
+ let key;
149
+ for (i = 0; i < len; i++) {
150
+ key = keys[i];
151
+ fn.call(null, obj[key], key, obj);
152
+ }
153
+ }
154
+ }
155
+ function findKey(obj, key) {
156
+ key = key.toLowerCase();
157
+ const keys = Object.keys(obj);
158
+ let i = keys.length;
159
+ let _key;
160
+ while (i-- > 0) {
161
+ _key = keys[i];
162
+ if (key === _key.toLowerCase()) {
163
+ return _key;
164
+ }
165
+ }
166
+ return null;
167
+ }
168
+ const _global = (() => {
169
+ if (typeof globalThis !== "undefined") return globalThis;
170
+ return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
171
+ })();
172
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
173
+ function merge() {
174
+ const { caseless } = isContextDefined(this) && this || {};
175
+ const result = {};
176
+ const assignValue = (val, key) => {
177
+ const targetKey = caseless && findKey(result, key) || key;
178
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
179
+ result[targetKey] = merge(result[targetKey], val);
180
+ } else if (isPlainObject(val)) {
181
+ result[targetKey] = merge({}, val);
182
+ } else if (isArray(val)) {
183
+ result[targetKey] = val.slice();
184
+ } else {
185
+ result[targetKey] = val;
186
+ }
187
+ };
188
+ for (let i = 0, l = arguments.length; i < l; i++) {
189
+ arguments[i] && forEach(arguments[i], assignValue);
190
+ }
191
+ return result;
192
+ }
193
+ const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
194
+ forEach(b, (val, key) => {
195
+ if (thisArg && isFunction(val)) {
196
+ a[key] = bind(val, thisArg);
197
+ } else {
198
+ a[key] = val;
199
+ }
200
+ }, { allOwnKeys });
201
+ return a;
202
+ };
203
+ const stripBOM = (content) => {
204
+ if (content.charCodeAt(0) === 65279) {
205
+ content = content.slice(1);
206
+ }
207
+ return content;
208
+ };
209
+ const inherits = (constructor, superConstructor, props, descriptors2) => {
210
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
211
+ constructor.prototype.constructor = constructor;
212
+ Object.defineProperty(constructor, "super", {
213
+ value: superConstructor.prototype
214
+ });
215
+ props && Object.assign(constructor.prototype, props);
216
+ };
217
+ const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
218
+ let props;
219
+ let i;
220
+ let prop;
221
+ const merged = {};
222
+ destObj = destObj || {};
223
+ if (sourceObj == null) return destObj;
224
+ do {
225
+ props = Object.getOwnPropertyNames(sourceObj);
226
+ i = props.length;
227
+ while (i-- > 0) {
228
+ prop = props[i];
229
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
230
+ destObj[prop] = sourceObj[prop];
231
+ merged[prop] = true;
232
+ }
233
+ }
234
+ sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
235
+ } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
236
+ return destObj;
237
+ };
238
+ const endsWith = (str, searchString, position) => {
239
+ str = String(str);
240
+ if (position === void 0 || position > str.length) {
241
+ position = str.length;
242
+ }
243
+ position -= searchString.length;
244
+ const lastIndex = str.indexOf(searchString, position);
245
+ return lastIndex !== -1 && lastIndex === position;
246
+ };
247
+ const toArray = (thing) => {
248
+ if (!thing) return null;
249
+ if (isArray(thing)) return thing;
250
+ let i = thing.length;
251
+ if (!isNumber(i)) return null;
252
+ const arr = new Array(i);
253
+ while (i-- > 0) {
254
+ arr[i] = thing[i];
255
+ }
256
+ return arr;
257
+ };
258
+ const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
259
+ return (thing) => {
260
+ return TypedArray && thing instanceof TypedArray;
261
+ };
262
+ })(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
263
+ const forEachEntry = (obj, fn) => {
264
+ const generator = obj && obj[Symbol.iterator];
265
+ const iterator = generator.call(obj);
266
+ let result;
267
+ while ((result = iterator.next()) && !result.done) {
268
+ const pair = result.value;
269
+ fn.call(obj, pair[0], pair[1]);
270
+ }
271
+ };
272
+ const matchAll = (regExp, str) => {
273
+ let matches;
274
+ const arr = [];
275
+ while ((matches = regExp.exec(str)) !== null) {
276
+ arr.push(matches);
277
+ }
278
+ return arr;
279
+ };
280
+ const isHTMLForm = kindOfTest("HTMLFormElement");
281
+ const toCamelCase = (str) => {
282
+ return str.toLowerCase().replace(
283
+ /[-_\s]([a-z\d])(\w*)/g,
284
+ function replacer(m, p1, p2) {
285
+ return p1.toUpperCase() + p2;
286
+ }
287
+ );
288
+ };
289
+ const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
290
+ const isRegExp = kindOfTest("RegExp");
291
+ const reduceDescriptors = (obj, reducer) => {
292
+ const descriptors2 = Object.getOwnPropertyDescriptors(obj);
293
+ const reducedDescriptors = {};
294
+ forEach(descriptors2, (descriptor, name) => {
295
+ let ret;
296
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
297
+ reducedDescriptors[name] = ret || descriptor;
298
+ }
299
+ });
300
+ Object.defineProperties(obj, reducedDescriptors);
301
+ };
302
+ const freezeMethods = (obj) => {
303
+ reduceDescriptors(obj, (descriptor, name) => {
304
+ if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
305
+ return false;
306
+ }
307
+ const value = obj[name];
308
+ if (!isFunction(value)) return;
309
+ descriptor.enumerable = false;
310
+ if ("writable" in descriptor) {
311
+ descriptor.writable = false;
312
+ return;
313
+ }
314
+ if (!descriptor.set) {
315
+ descriptor.set = () => {
316
+ throw Error("Can not rewrite read-only method '" + name + "'");
317
+ };
318
+ }
319
+ });
320
+ };
321
+ const toObjectSet = (arrayOrString, delimiter) => {
322
+ const obj = {};
323
+ const define = (arr) => {
324
+ arr.forEach((value) => {
325
+ obj[value] = true;
326
+ });
327
+ };
328
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
329
+ return obj;
330
+ };
331
+ const noop = () => {
332
+ };
333
+ const toFiniteNumber = (value, defaultValue) => {
334
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
335
+ };
336
+ const ALPHA = "abcdefghijklmnopqrstuvwxyz";
337
+ const DIGIT = "0123456789";
338
+ const ALPHABET = {
339
+ DIGIT,
340
+ ALPHA,
341
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
342
+ };
343
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
344
+ let str = "";
345
+ const { length } = alphabet;
346
+ while (size--) {
347
+ str += alphabet[Math.random() * length | 0];
348
+ }
349
+ return str;
350
+ };
351
+ function isSpecCompliantForm(thing) {
352
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
353
+ }
354
+ const toJSONObject = (obj) => {
355
+ const stack = new Array(10);
356
+ const visit = (source, i) => {
357
+ if (isObject(source)) {
358
+ if (stack.indexOf(source) >= 0) {
359
+ return;
360
+ }
361
+ if (!("toJSON" in source)) {
362
+ stack[i] = source;
363
+ const target = isArray(source) ? [] : {};
364
+ forEach(source, (value, key) => {
365
+ const reducedValue = visit(value, i + 1);
366
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
367
+ });
368
+ stack[i] = void 0;
369
+ return target;
370
+ }
371
+ }
372
+ return source;
373
+ };
374
+ return visit(obj, 0);
375
+ };
376
+ const isAsyncFn = kindOfTest("AsyncFunction");
377
+ const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
378
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
379
+ if (setImmediateSupported) {
380
+ return setImmediate;
381
+ }
382
+ return postMessageSupported ? ((token, callbacks) => {
383
+ _global.addEventListener("message", ({ source, data }) => {
384
+ if (source === _global && data === token) {
385
+ callbacks.length && callbacks.shift()();
386
+ }
387
+ }, false);
388
+ return (cb) => {
389
+ callbacks.push(cb);
390
+ _global.postMessage(token, "*");
391
+ };
392
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
393
+ })(
394
+ typeof setImmediate === "function",
395
+ isFunction(_global.postMessage)
396
+ );
397
+ const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
398
+ const utils$1 = {
399
+ isArray,
400
+ isArrayBuffer,
401
+ isBuffer,
402
+ isFormData,
403
+ isArrayBufferView,
404
+ isString,
405
+ isNumber,
406
+ isBoolean,
407
+ isObject,
408
+ isPlainObject,
409
+ isReadableStream,
410
+ isRequest,
411
+ isResponse,
412
+ isHeaders,
413
+ isUndefined,
414
+ isDate,
415
+ isFile,
416
+ isBlob,
417
+ isRegExp,
418
+ isFunction,
419
+ isStream,
420
+ isURLSearchParams,
421
+ isTypedArray,
422
+ isFileList,
423
+ forEach,
424
+ merge,
425
+ extend,
426
+ trim,
427
+ stripBOM,
428
+ inherits,
429
+ toFlatObject,
430
+ kindOf,
431
+ kindOfTest,
432
+ endsWith,
433
+ toArray,
434
+ forEachEntry,
435
+ matchAll,
436
+ isHTMLForm,
437
+ hasOwnProperty,
438
+ hasOwnProp: hasOwnProperty,
439
+ // an alias to avoid ESLint no-prototype-builtins detection
440
+ reduceDescriptors,
441
+ freezeMethods,
442
+ toObjectSet,
443
+ toCamelCase,
444
+ noop,
445
+ toFiniteNumber,
446
+ findKey,
447
+ global: _global,
448
+ isContextDefined,
449
+ ALPHABET,
450
+ generateString,
451
+ isSpecCompliantForm,
452
+ toJSONObject,
453
+ isAsyncFn,
454
+ isThenable,
455
+ setImmediate: _setImmediate,
456
+ asap
457
+ };
458
+ function AxiosError$1(message, code, config, request, response) {
459
+ Error.call(this);
460
+ if (Error.captureStackTrace) {
461
+ Error.captureStackTrace(this, this.constructor);
462
+ } else {
463
+ this.stack = new Error().stack;
464
+ }
465
+ this.message = message;
466
+ this.name = "AxiosError";
467
+ code && (this.code = code);
468
+ config && (this.config = config);
469
+ request && (this.request = request);
470
+ if (response) {
471
+ this.response = response;
472
+ this.status = response.status ? response.status : null;
473
+ }
474
+ }
475
+ utils$1.inherits(AxiosError$1, Error, {
476
+ toJSON: function toJSON() {
477
+ return {
478
+ // Standard
479
+ message: this.message,
480
+ name: this.name,
481
+ // Microsoft
482
+ description: this.description,
483
+ number: this.number,
484
+ // Mozilla
485
+ fileName: this.fileName,
486
+ lineNumber: this.lineNumber,
487
+ columnNumber: this.columnNumber,
488
+ stack: this.stack,
489
+ // Axios
490
+ config: utils$1.toJSONObject(this.config),
491
+ code: this.code,
492
+ status: this.status
493
+ };
494
+ }
495
+ });
496
+ const prototype$1 = AxiosError$1.prototype;
497
+ const descriptors = {};
498
+ [
499
+ "ERR_BAD_OPTION_VALUE",
500
+ "ERR_BAD_OPTION",
501
+ "ECONNABORTED",
502
+ "ETIMEDOUT",
503
+ "ERR_NETWORK",
504
+ "ERR_FR_TOO_MANY_REDIRECTS",
505
+ "ERR_DEPRECATED",
506
+ "ERR_BAD_RESPONSE",
507
+ "ERR_BAD_REQUEST",
508
+ "ERR_CANCELED",
509
+ "ERR_NOT_SUPPORT",
510
+ "ERR_INVALID_URL"
511
+ // eslint-disable-next-line func-names
512
+ ].forEach((code) => {
513
+ descriptors[code] = { value: code };
514
+ });
515
+ Object.defineProperties(AxiosError$1, descriptors);
516
+ Object.defineProperty(prototype$1, "isAxiosError", { value: true });
517
+ AxiosError$1.from = (error, code, config, request, response, customProps) => {
518
+ const axiosError = Object.create(prototype$1);
519
+ utils$1.toFlatObject(error, axiosError, function filter2(obj) {
520
+ return obj !== Error.prototype;
521
+ }, (prop) => {
522
+ return prop !== "isAxiosError";
523
+ });
524
+ AxiosError$1.call(axiosError, error.message, code, config, request, response);
525
+ axiosError.cause = error;
526
+ axiosError.name = error.name;
527
+ customProps && Object.assign(axiosError, customProps);
528
+ return axiosError;
529
+ };
530
+ const httpAdapter = null;
531
+ function isVisitable(thing) {
532
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
533
+ }
534
+ function removeBrackets(key) {
535
+ return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
536
+ }
537
+ function renderKey(path, key, dots) {
538
+ if (!path) return key;
539
+ return path.concat(key).map(function each(token, i) {
540
+ token = removeBrackets(token);
541
+ return !dots && i ? "[" + token + "]" : token;
542
+ }).join(dots ? "." : "");
543
+ }
544
+ function isFlatArray(arr) {
545
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
546
+ }
547
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
548
+ return /^is[A-Z]/.test(prop);
549
+ });
550
+ function toFormData$1(obj, formData, options) {
551
+ if (!utils$1.isObject(obj)) {
552
+ throw new TypeError("target must be an object");
553
+ }
554
+ formData = formData || new FormData();
555
+ options = utils$1.toFlatObject(options, {
556
+ metaTokens: true,
557
+ dots: false,
558
+ indexes: false
559
+ }, false, function defined(option, source) {
560
+ return !utils$1.isUndefined(source[option]);
561
+ });
562
+ const metaTokens = options.metaTokens;
563
+ const visitor = options.visitor || defaultVisitor;
564
+ const dots = options.dots;
565
+ const indexes = options.indexes;
566
+ const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
567
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
568
+ if (!utils$1.isFunction(visitor)) {
569
+ throw new TypeError("visitor must be a function");
570
+ }
571
+ function convertValue(value) {
572
+ if (value === null) return "";
573
+ if (utils$1.isDate(value)) {
574
+ return value.toISOString();
575
+ }
576
+ if (!useBlob && utils$1.isBlob(value)) {
577
+ throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
578
+ }
579
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
580
+ return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
581
+ }
582
+ return value;
583
+ }
584
+ function defaultVisitor(value, key, path) {
585
+ let arr = value;
586
+ if (value && !path && typeof value === "object") {
587
+ if (utils$1.endsWith(key, "{}")) {
588
+ key = metaTokens ? key : key.slice(0, -2);
589
+ value = JSON.stringify(value);
590
+ } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
591
+ key = removeBrackets(key);
592
+ arr.forEach(function each(el, index2) {
593
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
594
+ // eslint-disable-next-line no-nested-ternary
595
+ indexes === true ? renderKey([key], index2, dots) : indexes === null ? key : key + "[]",
596
+ convertValue(el)
597
+ );
598
+ });
599
+ return false;
600
+ }
601
+ }
602
+ if (isVisitable(value)) {
603
+ return true;
604
+ }
605
+ formData.append(renderKey(path, key, dots), convertValue(value));
606
+ return false;
607
+ }
608
+ const stack = [];
609
+ const exposedHelpers = Object.assign(predicates, {
610
+ defaultVisitor,
611
+ convertValue,
612
+ isVisitable
613
+ });
614
+ function build(value, path) {
615
+ if (utils$1.isUndefined(value)) return;
616
+ if (stack.indexOf(value) !== -1) {
617
+ throw Error("Circular reference detected in " + path.join("."));
618
+ }
619
+ stack.push(value);
620
+ utils$1.forEach(value, function each(el, key) {
621
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
622
+ formData,
623
+ el,
624
+ utils$1.isString(key) ? key.trim() : key,
625
+ path,
626
+ exposedHelpers
627
+ );
628
+ if (result === true) {
629
+ build(el, path ? path.concat(key) : [key]);
630
+ }
631
+ });
632
+ stack.pop();
633
+ }
634
+ if (!utils$1.isObject(obj)) {
635
+ throw new TypeError("data must be an object");
636
+ }
637
+ build(obj);
638
+ return formData;
639
+ }
640
+ function encode$1(str) {
641
+ const charMap = {
642
+ "!": "%21",
643
+ "'": "%27",
644
+ "(": "%28",
645
+ ")": "%29",
646
+ "~": "%7E",
647
+ "%20": "+",
648
+ "%00": "\0"
649
+ };
650
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
651
+ return charMap[match];
652
+ });
653
+ }
654
+ function AxiosURLSearchParams(params, options) {
655
+ this._pairs = [];
656
+ params && toFormData$1(params, this, options);
657
+ }
658
+ const prototype = AxiosURLSearchParams.prototype;
659
+ prototype.append = function append(name, value) {
660
+ this._pairs.push([name, value]);
661
+ };
662
+ prototype.toString = function toString2(encoder) {
663
+ const _encode = encoder ? function(value) {
664
+ return encoder.call(this, value, encode$1);
665
+ } : encode$1;
666
+ return this._pairs.map(function each(pair) {
667
+ return _encode(pair[0]) + "=" + _encode(pair[1]);
668
+ }, "").join("&");
669
+ };
670
+ function encode(val) {
671
+ return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
672
+ }
673
+ function buildURL(url, params, options) {
674
+ if (!params) {
675
+ return url;
676
+ }
677
+ const _encode = options && options.encode || encode;
678
+ if (utils$1.isFunction(options)) {
679
+ options = {
680
+ serialize: options
681
+ };
682
+ }
683
+ const serializeFn = options && options.serialize;
684
+ let serializedParams;
685
+ if (serializeFn) {
686
+ serializedParams = serializeFn(params, options);
687
+ } else {
688
+ serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
689
+ }
690
+ if (serializedParams) {
691
+ const hashmarkIndex = url.indexOf("#");
692
+ if (hashmarkIndex !== -1) {
693
+ url = url.slice(0, hashmarkIndex);
694
+ }
695
+ url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
696
+ }
697
+ return url;
698
+ }
699
+ class InterceptorManager {
700
+ constructor() {
701
+ this.handlers = [];
702
+ }
703
+ /**
704
+ * Add a new interceptor to the stack
705
+ *
706
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
707
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
708
+ *
709
+ * @return {Number} An ID used to remove interceptor later
710
+ */
711
+ use(fulfilled, rejected, options) {
712
+ this.handlers.push({
713
+ fulfilled,
714
+ rejected,
715
+ synchronous: options ? options.synchronous : false,
716
+ runWhen: options ? options.runWhen : null
717
+ });
718
+ return this.handlers.length - 1;
719
+ }
720
+ /**
721
+ * Remove an interceptor from the stack
722
+ *
723
+ * @param {Number} id The ID that was returned by `use`
724
+ *
725
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
726
+ */
727
+ eject(id) {
728
+ if (this.handlers[id]) {
729
+ this.handlers[id] = null;
730
+ }
731
+ }
732
+ /**
733
+ * Clear all interceptors from the stack
734
+ *
735
+ * @returns {void}
736
+ */
737
+ clear() {
738
+ if (this.handlers) {
739
+ this.handlers = [];
740
+ }
741
+ }
742
+ /**
743
+ * Iterate over all the registered interceptors
744
+ *
745
+ * This method is particularly useful for skipping over any
746
+ * interceptors that may have become `null` calling `eject`.
747
+ *
748
+ * @param {Function} fn The function to call for each interceptor
749
+ *
750
+ * @returns {void}
751
+ */
752
+ forEach(fn) {
753
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
754
+ if (h !== null) {
755
+ fn(h);
756
+ }
757
+ });
758
+ }
759
+ }
760
+ const transitionalDefaults = {
761
+ silentJSONParsing: true,
762
+ forcedJSONParsing: true,
763
+ clarifyTimeoutError: false
764
+ };
765
+ const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
766
+ const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
767
+ const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
768
+ const platform$1 = {
769
+ isBrowser: true,
770
+ classes: {
771
+ URLSearchParams: URLSearchParams$1,
772
+ FormData: FormData$1,
773
+ Blob: Blob$1
774
+ },
775
+ protocols: ["http", "https", "file", "blob", "url", "data"]
776
+ };
777
+ const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
778
+ const _navigator = typeof navigator === "object" && navigator || void 0;
779
+ const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
780
+ const hasStandardBrowserWebWorkerEnv = (() => {
781
+ return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
782
+ self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
783
+ })();
784
+ const origin = hasBrowserEnv && window.location.href || "http://localhost";
785
+ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
786
+ __proto__: null,
787
+ hasBrowserEnv,
788
+ hasStandardBrowserEnv,
789
+ hasStandardBrowserWebWorkerEnv,
790
+ navigator: _navigator,
791
+ origin
792
+ }, Symbol.toStringTag, { value: "Module" }));
793
+ const platform = {
794
+ ...utils,
795
+ ...platform$1
796
+ };
797
+ function toURLEncodedForm(data, options) {
798
+ return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({
799
+ visitor: function(value, key, path, helpers) {
800
+ if (platform.isNode && utils$1.isBuffer(value)) {
801
+ this.append(key, value.toString("base64"));
802
+ return false;
803
+ }
804
+ return helpers.defaultVisitor.apply(this, arguments);
805
+ }
806
+ }, options));
807
+ }
808
+ function parsePropPath(name) {
809
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
810
+ return match[0] === "[]" ? "" : match[1] || match[0];
811
+ });
812
+ }
813
+ function arrayToObject(arr) {
814
+ const obj = {};
815
+ const keys = Object.keys(arr);
816
+ let i;
817
+ const len = keys.length;
818
+ let key;
819
+ for (i = 0; i < len; i++) {
820
+ key = keys[i];
821
+ obj[key] = arr[key];
822
+ }
823
+ return obj;
824
+ }
825
+ function formDataToJSON(formData) {
826
+ function buildPath(path, value, target, index2) {
827
+ let name = path[index2++];
828
+ if (name === "__proto__") return true;
829
+ const isNumericKey = Number.isFinite(+name);
830
+ const isLast = index2 >= path.length;
831
+ name = !name && utils$1.isArray(target) ? target.length : name;
832
+ if (isLast) {
833
+ if (utils$1.hasOwnProp(target, name)) {
834
+ target[name] = [target[name], value];
835
+ } else {
836
+ target[name] = value;
837
+ }
838
+ return !isNumericKey;
839
+ }
840
+ if (!target[name] || !utils$1.isObject(target[name])) {
841
+ target[name] = [];
842
+ }
843
+ const result = buildPath(path, value, target[name], index2);
844
+ if (result && utils$1.isArray(target[name])) {
845
+ target[name] = arrayToObject(target[name]);
846
+ }
847
+ return !isNumericKey;
848
+ }
849
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
850
+ const obj = {};
851
+ utils$1.forEachEntry(formData, (name, value) => {
852
+ buildPath(parsePropPath(name), value, obj, 0);
853
+ });
854
+ return obj;
855
+ }
856
+ return null;
857
+ }
858
+ function stringifySafely(rawValue, parser, encoder) {
859
+ if (utils$1.isString(rawValue)) {
860
+ try {
861
+ (parser || JSON.parse)(rawValue);
862
+ return utils$1.trim(rawValue);
863
+ } catch (e) {
864
+ if (e.name !== "SyntaxError") {
865
+ throw e;
866
+ }
867
+ }
868
+ }
869
+ return (encoder || JSON.stringify)(rawValue);
870
+ }
871
+ const defaults = {
872
+ transitional: transitionalDefaults,
873
+ adapter: ["xhr", "http", "fetch"],
874
+ transformRequest: [function transformRequest(data, headers) {
875
+ const contentType = headers.getContentType() || "";
876
+ const hasJSONContentType = contentType.indexOf("application/json") > -1;
877
+ const isObjectPayload = utils$1.isObject(data);
878
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
879
+ data = new FormData(data);
880
+ }
881
+ const isFormData2 = utils$1.isFormData(data);
882
+ if (isFormData2) {
883
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
884
+ }
885
+ if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
886
+ return data;
887
+ }
888
+ if (utils$1.isArrayBufferView(data)) {
889
+ return data.buffer;
890
+ }
891
+ if (utils$1.isURLSearchParams(data)) {
892
+ headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
893
+ return data.toString();
894
+ }
895
+ let isFileList2;
896
+ if (isObjectPayload) {
897
+ if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
898
+ return toURLEncodedForm(data, this.formSerializer).toString();
899
+ }
900
+ if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
901
+ const _FormData = this.env && this.env.FormData;
902
+ return toFormData$1(
903
+ isFileList2 ? { "files[]": data } : data,
904
+ _FormData && new _FormData(),
905
+ this.formSerializer
906
+ );
907
+ }
908
+ }
909
+ if (isObjectPayload || hasJSONContentType) {
910
+ headers.setContentType("application/json", false);
911
+ return stringifySafely(data);
912
+ }
913
+ return data;
914
+ }],
915
+ transformResponse: [function transformResponse(data) {
916
+ const transitional2 = this.transitional || defaults.transitional;
917
+ const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
918
+ const JSONRequested = this.responseType === "json";
919
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
920
+ return data;
921
+ }
922
+ if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
923
+ const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
924
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
925
+ try {
926
+ return JSON.parse(data);
927
+ } catch (e) {
928
+ if (strictJSONParsing) {
929
+ if (e.name === "SyntaxError") {
930
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
931
+ }
932
+ throw e;
933
+ }
934
+ }
935
+ }
936
+ return data;
937
+ }],
938
+ /**
939
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
940
+ * timeout is not created.
941
+ */
942
+ timeout: 0,
943
+ xsrfCookieName: "XSRF-TOKEN",
944
+ xsrfHeaderName: "X-XSRF-TOKEN",
945
+ maxContentLength: -1,
946
+ maxBodyLength: -1,
947
+ env: {
948
+ FormData: platform.classes.FormData,
949
+ Blob: platform.classes.Blob
950
+ },
951
+ validateStatus: function validateStatus(status) {
952
+ return status >= 200 && status < 300;
953
+ },
954
+ headers: {
955
+ common: {
956
+ "Accept": "application/json, text/plain, */*",
957
+ "Content-Type": void 0
958
+ }
959
+ }
960
+ };
961
+ utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
962
+ defaults.headers[method] = {};
963
+ });
964
+ const ignoreDuplicateOf = utils$1.toObjectSet([
965
+ "age",
966
+ "authorization",
967
+ "content-length",
968
+ "content-type",
969
+ "etag",
970
+ "expires",
971
+ "from",
972
+ "host",
973
+ "if-modified-since",
974
+ "if-unmodified-since",
975
+ "last-modified",
976
+ "location",
977
+ "max-forwards",
978
+ "proxy-authorization",
979
+ "referer",
980
+ "retry-after",
981
+ "user-agent"
982
+ ]);
983
+ const parseHeaders = (rawHeaders) => {
984
+ const parsed = {};
985
+ let key;
986
+ let val;
987
+ let i;
988
+ rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
989
+ i = line.indexOf(":");
990
+ key = line.substring(0, i).trim().toLowerCase();
991
+ val = line.substring(i + 1).trim();
992
+ if (!key || parsed[key] && ignoreDuplicateOf[key]) {
993
+ return;
994
+ }
995
+ if (key === "set-cookie") {
996
+ if (parsed[key]) {
997
+ parsed[key].push(val);
998
+ } else {
999
+ parsed[key] = [val];
1000
+ }
1001
+ } else {
1002
+ parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
1003
+ }
1004
+ });
1005
+ return parsed;
1006
+ };
1007
+ const $internals = Symbol("internals");
1008
+ function normalizeHeader(header) {
1009
+ return header && String(header).trim().toLowerCase();
1010
+ }
1011
+ function normalizeValue(value) {
1012
+ if (value === false || value == null) {
1013
+ return value;
1014
+ }
1015
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
1016
+ }
1017
+ function parseTokens(str) {
1018
+ const tokens = /* @__PURE__ */ Object.create(null);
1019
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1020
+ let match;
1021
+ while (match = tokensRE.exec(str)) {
1022
+ tokens[match[1]] = match[2];
1023
+ }
1024
+ return tokens;
1025
+ }
1026
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1027
+ function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
1028
+ if (utils$1.isFunction(filter2)) {
1029
+ return filter2.call(this, value, header);
1030
+ }
1031
+ if (isHeaderNameFilter) {
1032
+ value = header;
1033
+ }
1034
+ if (!utils$1.isString(value)) return;
1035
+ if (utils$1.isString(filter2)) {
1036
+ return value.indexOf(filter2) !== -1;
1037
+ }
1038
+ if (utils$1.isRegExp(filter2)) {
1039
+ return filter2.test(value);
1040
+ }
1041
+ }
1042
+ function formatHeader(header) {
1043
+ return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1044
+ return char.toUpperCase() + str;
1045
+ });
1046
+ }
1047
+ function buildAccessors(obj, header) {
1048
+ const accessorName = utils$1.toCamelCase(" " + header);
1049
+ ["get", "set", "has"].forEach((methodName) => {
1050
+ Object.defineProperty(obj, methodName + accessorName, {
1051
+ value: function(arg1, arg2, arg3) {
1052
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1053
+ },
1054
+ configurable: true
1055
+ });
1056
+ });
1057
+ }
1058
+ let AxiosHeaders$1 = class AxiosHeaders {
1059
+ constructor(headers) {
1060
+ headers && this.set(headers);
1061
+ }
1062
+ set(header, valueOrRewrite, rewrite) {
1063
+ const self2 = this;
1064
+ function setHeader(_value, _header, _rewrite) {
1065
+ const lHeader = normalizeHeader(_header);
1066
+ if (!lHeader) {
1067
+ throw new Error("header name must be a non-empty string");
1068
+ }
1069
+ const key = utils$1.findKey(self2, lHeader);
1070
+ if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
1071
+ self2[key || _header] = normalizeValue(_value);
1072
+ }
1073
+ }
1074
+ const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1075
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1076
+ setHeaders(header, valueOrRewrite);
1077
+ } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1078
+ setHeaders(parseHeaders(header), valueOrRewrite);
1079
+ } else if (utils$1.isHeaders(header)) {
1080
+ for (const [key, value] of header.entries()) {
1081
+ setHeader(value, key, rewrite);
1082
+ }
1083
+ } else {
1084
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1085
+ }
1086
+ return this;
1087
+ }
1088
+ get(header, parser) {
1089
+ header = normalizeHeader(header);
1090
+ if (header) {
1091
+ const key = utils$1.findKey(this, header);
1092
+ if (key) {
1093
+ const value = this[key];
1094
+ if (!parser) {
1095
+ return value;
1096
+ }
1097
+ if (parser === true) {
1098
+ return parseTokens(value);
1099
+ }
1100
+ if (utils$1.isFunction(parser)) {
1101
+ return parser.call(this, value, key);
1102
+ }
1103
+ if (utils$1.isRegExp(parser)) {
1104
+ return parser.exec(value);
1105
+ }
1106
+ throw new TypeError("parser must be boolean|regexp|function");
1107
+ }
1108
+ }
1109
+ }
1110
+ has(header, matcher) {
1111
+ header = normalizeHeader(header);
1112
+ if (header) {
1113
+ const key = utils$1.findKey(this, header);
1114
+ return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1115
+ }
1116
+ return false;
1117
+ }
1118
+ delete(header, matcher) {
1119
+ const self2 = this;
1120
+ let deleted = false;
1121
+ function deleteHeader(_header) {
1122
+ _header = normalizeHeader(_header);
1123
+ if (_header) {
1124
+ const key = utils$1.findKey(self2, _header);
1125
+ if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
1126
+ delete self2[key];
1127
+ deleted = true;
1128
+ }
1129
+ }
1130
+ }
1131
+ if (utils$1.isArray(header)) {
1132
+ header.forEach(deleteHeader);
1133
+ } else {
1134
+ deleteHeader(header);
1135
+ }
1136
+ return deleted;
1137
+ }
1138
+ clear(matcher) {
1139
+ const keys = Object.keys(this);
1140
+ let i = keys.length;
1141
+ let deleted = false;
1142
+ while (i--) {
1143
+ const key = keys[i];
1144
+ if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1145
+ delete this[key];
1146
+ deleted = true;
1147
+ }
1148
+ }
1149
+ return deleted;
1150
+ }
1151
+ normalize(format) {
1152
+ const self2 = this;
1153
+ const headers = {};
1154
+ utils$1.forEach(this, (value, header) => {
1155
+ const key = utils$1.findKey(headers, header);
1156
+ if (key) {
1157
+ self2[key] = normalizeValue(value);
1158
+ delete self2[header];
1159
+ return;
1160
+ }
1161
+ const normalized = format ? formatHeader(header) : String(header).trim();
1162
+ if (normalized !== header) {
1163
+ delete self2[header];
1164
+ }
1165
+ self2[normalized] = normalizeValue(value);
1166
+ headers[normalized] = true;
1167
+ });
1168
+ return this;
1169
+ }
1170
+ concat(...targets) {
1171
+ return this.constructor.concat(this, ...targets);
1172
+ }
1173
+ toJSON(asStrings) {
1174
+ const obj = /* @__PURE__ */ Object.create(null);
1175
+ utils$1.forEach(this, (value, header) => {
1176
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
1177
+ });
1178
+ return obj;
1179
+ }
1180
+ [Symbol.iterator]() {
1181
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1182
+ }
1183
+ toString() {
1184
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
1185
+ }
1186
+ get [Symbol.toStringTag]() {
1187
+ return "AxiosHeaders";
1188
+ }
1189
+ static from(thing) {
1190
+ return thing instanceof this ? thing : new this(thing);
1191
+ }
1192
+ static concat(first, ...targets) {
1193
+ const computed = new this(first);
1194
+ targets.forEach((target) => computed.set(target));
1195
+ return computed;
1196
+ }
1197
+ static accessor(header) {
1198
+ const internals = this[$internals] = this[$internals] = {
1199
+ accessors: {}
1200
+ };
1201
+ const accessors = internals.accessors;
1202
+ const prototype2 = this.prototype;
1203
+ function defineAccessor(_header) {
1204
+ const lHeader = normalizeHeader(_header);
1205
+ if (!accessors[lHeader]) {
1206
+ buildAccessors(prototype2, _header);
1207
+ accessors[lHeader] = true;
1208
+ }
1209
+ }
1210
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1211
+ return this;
1212
+ }
1213
+ };
1214
+ AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
1215
+ utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
1216
+ let mapped = key[0].toUpperCase() + key.slice(1);
1217
+ return {
1218
+ get: () => value,
1219
+ set(headerValue) {
1220
+ this[mapped] = headerValue;
1221
+ }
1222
+ };
1223
+ });
1224
+ utils$1.freezeMethods(AxiosHeaders$1);
1225
+ function transformData(fns, response) {
1226
+ const config = this || defaults;
1227
+ const context = response || config;
1228
+ const headers = AxiosHeaders$1.from(context.headers);
1229
+ let data = context.data;
1230
+ utils$1.forEach(fns, function transform(fn) {
1231
+ data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
1232
+ });
1233
+ headers.normalize();
1234
+ return data;
1235
+ }
1236
+ function isCancel$1(value) {
1237
+ return !!(value && value.__CANCEL__);
1238
+ }
1239
+ function CanceledError$1(message, config, request) {
1240
+ AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
1241
+ this.name = "CanceledError";
1242
+ }
1243
+ utils$1.inherits(CanceledError$1, AxiosError$1, {
1244
+ __CANCEL__: true
1245
+ });
1246
+ function settle(resolve, reject, response) {
1247
+ const validateStatus2 = response.config.validateStatus;
1248
+ if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
1249
+ resolve(response);
1250
+ } else {
1251
+ reject(new AxiosError$1(
1252
+ "Request failed with status code " + response.status,
1253
+ [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1254
+ response.config,
1255
+ response.request,
1256
+ response
1257
+ ));
1258
+ }
1259
+ }
1260
+ function parseProtocol(url) {
1261
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
1262
+ return match && match[1] || "";
1263
+ }
1264
+ function speedometer(samplesCount, min) {
1265
+ samplesCount = samplesCount || 10;
1266
+ const bytes = new Array(samplesCount);
1267
+ const timestamps = new Array(samplesCount);
1268
+ let head = 0;
1269
+ let tail = 0;
1270
+ let firstSampleTS;
1271
+ min = min !== void 0 ? min : 1e3;
1272
+ return function push(chunkLength) {
1273
+ const now = Date.now();
1274
+ const startedAt = timestamps[tail];
1275
+ if (!firstSampleTS) {
1276
+ firstSampleTS = now;
1277
+ }
1278
+ bytes[head] = chunkLength;
1279
+ timestamps[head] = now;
1280
+ let i = tail;
1281
+ let bytesCount = 0;
1282
+ while (i !== head) {
1283
+ bytesCount += bytes[i++];
1284
+ i = i % samplesCount;
1285
+ }
1286
+ head = (head + 1) % samplesCount;
1287
+ if (head === tail) {
1288
+ tail = (tail + 1) % samplesCount;
1289
+ }
1290
+ if (now - firstSampleTS < min) {
1291
+ return;
1292
+ }
1293
+ const passed = startedAt && now - startedAt;
1294
+ return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
1295
+ };
1296
+ }
1297
+ function throttle(fn, freq) {
1298
+ let timestamp = 0;
1299
+ let threshold = 1e3 / freq;
1300
+ let lastArgs;
1301
+ let timer;
1302
+ const invoke = (args, now = Date.now()) => {
1303
+ timestamp = now;
1304
+ lastArgs = null;
1305
+ if (timer) {
1306
+ clearTimeout(timer);
1307
+ timer = null;
1308
+ }
1309
+ fn.apply(null, args);
1310
+ };
1311
+ const throttled = (...args) => {
1312
+ const now = Date.now();
1313
+ const passed = now - timestamp;
1314
+ if (passed >= threshold) {
1315
+ invoke(args, now);
1316
+ } else {
1317
+ lastArgs = args;
1318
+ if (!timer) {
1319
+ timer = setTimeout(() => {
1320
+ timer = null;
1321
+ invoke(lastArgs);
1322
+ }, threshold - passed);
1323
+ }
1324
+ }
1325
+ };
1326
+ const flush = () => lastArgs && invoke(lastArgs);
1327
+ return [throttled, flush];
1328
+ }
1329
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
1330
+ let bytesNotified = 0;
1331
+ const _speedometer = speedometer(50, 250);
1332
+ return throttle((e) => {
1333
+ const loaded = e.loaded;
1334
+ const total = e.lengthComputable ? e.total : void 0;
1335
+ const progressBytes = loaded - bytesNotified;
1336
+ const rate = _speedometer(progressBytes);
1337
+ const inRange = loaded <= total;
1338
+ bytesNotified = loaded;
1339
+ const data = {
1340
+ loaded,
1341
+ total,
1342
+ progress: total ? loaded / total : void 0,
1343
+ bytes: progressBytes,
1344
+ rate: rate ? rate : void 0,
1345
+ estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
1346
+ event: e,
1347
+ lengthComputable: total != null,
1348
+ [isDownloadStream ? "download" : "upload"]: true
1349
+ };
1350
+ listener(data);
1351
+ }, freq);
1352
+ };
1353
+ const progressEventDecorator = (total, throttled) => {
1354
+ const lengthComputable = total != null;
1355
+ return [(loaded) => throttled[0]({
1356
+ lengthComputable,
1357
+ total,
1358
+ loaded
1359
+ }), throttled[1]];
1360
+ };
1361
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
1362
+ const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
1363
+ url = new URL(url, platform.origin);
1364
+ return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
1365
+ })(
1366
+ new URL(platform.origin),
1367
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
1368
+ ) : () => true;
1369
+ const cookies = platform.hasStandardBrowserEnv ? (
1370
+ // Standard browser envs support document.cookie
1371
+ {
1372
+ write(name, value, expires, path, domain, secure) {
1373
+ const cookie = [name + "=" + encodeURIComponent(value)];
1374
+ utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
1375
+ utils$1.isString(path) && cookie.push("path=" + path);
1376
+ utils$1.isString(domain) && cookie.push("domain=" + domain);
1377
+ secure === true && cookie.push("secure");
1378
+ document.cookie = cookie.join("; ");
1379
+ },
1380
+ read(name) {
1381
+ const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
1382
+ return match ? decodeURIComponent(match[3]) : null;
1383
+ },
1384
+ remove(name) {
1385
+ this.write(name, "", Date.now() - 864e5);
1386
+ }
1387
+ }
1388
+ ) : (
1389
+ // Non-standard browser env (web workers, react-native) lack needed support.
1390
+ {
1391
+ write() {
1392
+ },
1393
+ read() {
1394
+ return null;
1395
+ },
1396
+ remove() {
1397
+ }
1398
+ }
1399
+ );
1400
+ function isAbsoluteURL(url) {
1401
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1402
+ }
1403
+ function combineURLs(baseURL, relativeURL) {
1404
+ return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
1405
+ }
1406
+ function buildFullPath(baseURL, requestedURL) {
1407
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
1408
+ return combineURLs(baseURL, requestedURL);
1409
+ }
1410
+ return requestedURL;
1411
+ }
1412
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
1413
+ function mergeConfig$1(config1, config2) {
1414
+ config2 = config2 || {};
1415
+ const config = {};
1416
+ function getMergedValue(target, source, prop, caseless) {
1417
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
1418
+ return utils$1.merge.call({ caseless }, target, source);
1419
+ } else if (utils$1.isPlainObject(source)) {
1420
+ return utils$1.merge({}, source);
1421
+ } else if (utils$1.isArray(source)) {
1422
+ return source.slice();
1423
+ }
1424
+ return source;
1425
+ }
1426
+ function mergeDeepProperties(a, b, prop, caseless) {
1427
+ if (!utils$1.isUndefined(b)) {
1428
+ return getMergedValue(a, b, prop, caseless);
1429
+ } else if (!utils$1.isUndefined(a)) {
1430
+ return getMergedValue(void 0, a, prop, caseless);
1431
+ }
1432
+ }
1433
+ function valueFromConfig2(a, b) {
1434
+ if (!utils$1.isUndefined(b)) {
1435
+ return getMergedValue(void 0, b);
1436
+ }
1437
+ }
1438
+ function defaultToConfig2(a, b) {
1439
+ if (!utils$1.isUndefined(b)) {
1440
+ return getMergedValue(void 0, b);
1441
+ } else if (!utils$1.isUndefined(a)) {
1442
+ return getMergedValue(void 0, a);
1443
+ }
1444
+ }
1445
+ function mergeDirectKeys(a, b, prop) {
1446
+ if (prop in config2) {
1447
+ return getMergedValue(a, b);
1448
+ } else if (prop in config1) {
1449
+ return getMergedValue(void 0, a);
1450
+ }
1451
+ }
1452
+ const mergeMap = {
1453
+ url: valueFromConfig2,
1454
+ method: valueFromConfig2,
1455
+ data: valueFromConfig2,
1456
+ baseURL: defaultToConfig2,
1457
+ transformRequest: defaultToConfig2,
1458
+ transformResponse: defaultToConfig2,
1459
+ paramsSerializer: defaultToConfig2,
1460
+ timeout: defaultToConfig2,
1461
+ timeoutMessage: defaultToConfig2,
1462
+ withCredentials: defaultToConfig2,
1463
+ withXSRFToken: defaultToConfig2,
1464
+ adapter: defaultToConfig2,
1465
+ responseType: defaultToConfig2,
1466
+ xsrfCookieName: defaultToConfig2,
1467
+ xsrfHeaderName: defaultToConfig2,
1468
+ onUploadProgress: defaultToConfig2,
1469
+ onDownloadProgress: defaultToConfig2,
1470
+ decompress: defaultToConfig2,
1471
+ maxContentLength: defaultToConfig2,
1472
+ maxBodyLength: defaultToConfig2,
1473
+ beforeRedirect: defaultToConfig2,
1474
+ transport: defaultToConfig2,
1475
+ httpAgent: defaultToConfig2,
1476
+ httpsAgent: defaultToConfig2,
1477
+ cancelToken: defaultToConfig2,
1478
+ socketPath: defaultToConfig2,
1479
+ responseEncoding: defaultToConfig2,
1480
+ validateStatus: mergeDirectKeys,
1481
+ headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
1482
+ };
1483
+ utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
1484
+ const merge2 = mergeMap[prop] || mergeDeepProperties;
1485
+ const configValue = merge2(config1[prop], config2[prop], prop);
1486
+ utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
1487
+ });
1488
+ return config;
1489
+ }
1490
+ const resolveConfig = (config) => {
1491
+ const newConfig = mergeConfig$1({}, config);
1492
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
1493
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
1494
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
1495
+ if (auth) {
1496
+ headers.set(
1497
+ "Authorization",
1498
+ "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
1499
+ );
1500
+ }
1501
+ let contentType;
1502
+ if (utils$1.isFormData(data)) {
1503
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
1504
+ headers.setContentType(void 0);
1505
+ } else if ((contentType = headers.getContentType()) !== false) {
1506
+ const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
1507
+ headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
1508
+ }
1509
+ }
1510
+ if (platform.hasStandardBrowserEnv) {
1511
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
1512
+ if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
1513
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
1514
+ if (xsrfValue) {
1515
+ headers.set(xsrfHeaderName, xsrfValue);
1516
+ }
1517
+ }
1518
+ }
1519
+ return newConfig;
1520
+ };
1521
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
1522
+ const xhrAdapter = isXHRAdapterSupported && function(config) {
1523
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
1524
+ const _config = resolveConfig(config);
1525
+ let requestData = _config.data;
1526
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
1527
+ let { responseType, onUploadProgress, onDownloadProgress } = _config;
1528
+ let onCanceled;
1529
+ let uploadThrottled, downloadThrottled;
1530
+ let flushUpload, flushDownload;
1531
+ function done() {
1532
+ flushUpload && flushUpload();
1533
+ flushDownload && flushDownload();
1534
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
1535
+ _config.signal && _config.signal.removeEventListener("abort", onCanceled);
1536
+ }
1537
+ let request = new XMLHttpRequest();
1538
+ request.open(_config.method.toUpperCase(), _config.url, true);
1539
+ request.timeout = _config.timeout;
1540
+ function onloadend() {
1541
+ if (!request) {
1542
+ return;
1543
+ }
1544
+ const responseHeaders = AxiosHeaders$1.from(
1545
+ "getAllResponseHeaders" in request && request.getAllResponseHeaders()
1546
+ );
1547
+ const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
1548
+ const response = {
1549
+ data: responseData,
1550
+ status: request.status,
1551
+ statusText: request.statusText,
1552
+ headers: responseHeaders,
1553
+ config,
1554
+ request
1555
+ };
1556
+ settle(function _resolve(value) {
1557
+ resolve(value);
1558
+ done();
1559
+ }, function _reject(err) {
1560
+ reject(err);
1561
+ done();
1562
+ }, response);
1563
+ request = null;
1564
+ }
1565
+ if ("onloadend" in request) {
1566
+ request.onloadend = onloadend;
1567
+ } else {
1568
+ request.onreadystatechange = function handleLoad() {
1569
+ if (!request || request.readyState !== 4) {
1570
+ return;
1571
+ }
1572
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
1573
+ return;
1574
+ }
1575
+ setTimeout(onloadend);
1576
+ };
1577
+ }
1578
+ request.onabort = function handleAbort() {
1579
+ if (!request) {
1580
+ return;
1581
+ }
1582
+ reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
1583
+ request = null;
1584
+ };
1585
+ request.onerror = function handleError() {
1586
+ reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
1587
+ request = null;
1588
+ };
1589
+ request.ontimeout = function handleTimeout() {
1590
+ let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
1591
+ const transitional2 = _config.transitional || transitionalDefaults;
1592
+ if (_config.timeoutErrorMessage) {
1593
+ timeoutErrorMessage = _config.timeoutErrorMessage;
1594
+ }
1595
+ reject(new AxiosError$1(
1596
+ timeoutErrorMessage,
1597
+ transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
1598
+ config,
1599
+ request
1600
+ ));
1601
+ request = null;
1602
+ };
1603
+ requestData === void 0 && requestHeaders.setContentType(null);
1604
+ if ("setRequestHeader" in request) {
1605
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
1606
+ request.setRequestHeader(key, val);
1607
+ });
1608
+ }
1609
+ if (!utils$1.isUndefined(_config.withCredentials)) {
1610
+ request.withCredentials = !!_config.withCredentials;
1611
+ }
1612
+ if (responseType && responseType !== "json") {
1613
+ request.responseType = _config.responseType;
1614
+ }
1615
+ if (onDownloadProgress) {
1616
+ [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
1617
+ request.addEventListener("progress", downloadThrottled);
1618
+ }
1619
+ if (onUploadProgress && request.upload) {
1620
+ [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
1621
+ request.upload.addEventListener("progress", uploadThrottled);
1622
+ request.upload.addEventListener("loadend", flushUpload);
1623
+ }
1624
+ if (_config.cancelToken || _config.signal) {
1625
+ onCanceled = (cancel) => {
1626
+ if (!request) {
1627
+ return;
1628
+ }
1629
+ reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
1630
+ request.abort();
1631
+ request = null;
1632
+ };
1633
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
1634
+ if (_config.signal) {
1635
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
1636
+ }
1637
+ }
1638
+ const protocol = parseProtocol(_config.url);
1639
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
1640
+ reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
1641
+ return;
1642
+ }
1643
+ request.send(requestData || null);
1644
+ });
1645
+ };
1646
+ const composeSignals = (signals, timeout) => {
1647
+ const { length } = signals = signals ? signals.filter(Boolean) : [];
1648
+ if (timeout || length) {
1649
+ let controller = new AbortController();
1650
+ let aborted;
1651
+ const onabort = function(reason) {
1652
+ if (!aborted) {
1653
+ aborted = true;
1654
+ unsubscribe();
1655
+ const err = reason instanceof Error ? reason : this.reason;
1656
+ controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
1657
+ }
1658
+ };
1659
+ let timer = timeout && setTimeout(() => {
1660
+ timer = null;
1661
+ onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
1662
+ }, timeout);
1663
+ const unsubscribe = () => {
1664
+ if (signals) {
1665
+ timer && clearTimeout(timer);
1666
+ timer = null;
1667
+ signals.forEach((signal2) => {
1668
+ signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
1669
+ });
1670
+ signals = null;
1671
+ }
1672
+ };
1673
+ signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
1674
+ const { signal } = controller;
1675
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
1676
+ return signal;
1677
+ }
1678
+ };
1679
+ const streamChunk = function* (chunk, chunkSize) {
1680
+ let len = chunk.byteLength;
1681
+ if (len < chunkSize) {
1682
+ yield chunk;
1683
+ return;
1684
+ }
1685
+ let pos = 0;
1686
+ let end;
1687
+ while (pos < len) {
1688
+ end = pos + chunkSize;
1689
+ yield chunk.slice(pos, end);
1690
+ pos = end;
1691
+ }
1692
+ };
1693
+ const readBytes = async function* (iterable, chunkSize) {
1694
+ for await (const chunk of readStream(iterable)) {
1695
+ yield* streamChunk(chunk, chunkSize);
1696
+ }
1697
+ };
1698
+ const readStream = async function* (stream) {
1699
+ if (stream[Symbol.asyncIterator]) {
1700
+ yield* stream;
1701
+ return;
1702
+ }
1703
+ const reader = stream.getReader();
1704
+ try {
1705
+ for (; ; ) {
1706
+ const { done, value } = await reader.read();
1707
+ if (done) {
1708
+ break;
1709
+ }
1710
+ yield value;
1711
+ }
1712
+ } finally {
1713
+ await reader.cancel();
1714
+ }
1715
+ };
1716
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
1717
+ const iterator = readBytes(stream, chunkSize);
1718
+ let bytes = 0;
1719
+ let done;
1720
+ let _onFinish = (e) => {
1721
+ if (!done) {
1722
+ done = true;
1723
+ onFinish && onFinish(e);
1724
+ }
1725
+ };
1726
+ return new ReadableStream({
1727
+ async pull(controller) {
1728
+ try {
1729
+ const { done: done2, value } = await iterator.next();
1730
+ if (done2) {
1731
+ _onFinish();
1732
+ controller.close();
1733
+ return;
1734
+ }
1735
+ let len = value.byteLength;
1736
+ if (onProgress) {
1737
+ let loadedBytes = bytes += len;
1738
+ onProgress(loadedBytes);
1739
+ }
1740
+ controller.enqueue(new Uint8Array(value));
1741
+ } catch (err) {
1742
+ _onFinish(err);
1743
+ throw err;
1744
+ }
1745
+ },
1746
+ cancel(reason) {
1747
+ _onFinish(reason);
1748
+ return iterator.return();
1749
+ }
1750
+ }, {
1751
+ highWaterMark: 2
1752
+ });
1753
+ };
1754
+ const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
1755
+ const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
1756
+ const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
1757
+ const test = (fn, ...args) => {
1758
+ try {
1759
+ return !!fn(...args);
1760
+ } catch (e) {
1761
+ return false;
1762
+ }
1763
+ };
1764
+ const supportsRequestStream = isReadableStreamSupported && test(() => {
1765
+ let duplexAccessed = false;
1766
+ const hasContentType = new Request(platform.origin, {
1767
+ body: new ReadableStream(),
1768
+ method: "POST",
1769
+ get duplex() {
1770
+ duplexAccessed = true;
1771
+ return "half";
1772
+ }
1773
+ }).headers.has("Content-Type");
1774
+ return duplexAccessed && !hasContentType;
1775
+ });
1776
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
1777
+ const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
1778
+ const resolvers = {
1779
+ stream: supportsResponseStream && ((res) => res.body)
1780
+ };
1781
+ isFetchSupported && ((res) => {
1782
+ ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
1783
+ !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
1784
+ throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
1785
+ });
1786
+ });
1787
+ })(new Response());
1788
+ const getBodyLength = async (body) => {
1789
+ if (body == null) {
1790
+ return 0;
1791
+ }
1792
+ if (utils$1.isBlob(body)) {
1793
+ return body.size;
1794
+ }
1795
+ if (utils$1.isSpecCompliantForm(body)) {
1796
+ const _request = new Request(platform.origin, {
1797
+ method: "POST",
1798
+ body
1799
+ });
1800
+ return (await _request.arrayBuffer()).byteLength;
1801
+ }
1802
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
1803
+ return body.byteLength;
1804
+ }
1805
+ if (utils$1.isURLSearchParams(body)) {
1806
+ body = body + "";
1807
+ }
1808
+ if (utils$1.isString(body)) {
1809
+ return (await encodeText(body)).byteLength;
1810
+ }
1811
+ };
1812
+ const resolveBodyLength = async (headers, body) => {
1813
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
1814
+ return length == null ? getBodyLength(body) : length;
1815
+ };
1816
+ const fetchAdapter = isFetchSupported && (async (config) => {
1817
+ let {
1818
+ url,
1819
+ method,
1820
+ data,
1821
+ signal,
1822
+ cancelToken,
1823
+ timeout,
1824
+ onDownloadProgress,
1825
+ onUploadProgress,
1826
+ responseType,
1827
+ headers,
1828
+ withCredentials = "same-origin",
1829
+ fetchOptions
1830
+ } = resolveConfig(config);
1831
+ responseType = responseType ? (responseType + "").toLowerCase() : "text";
1832
+ let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
1833
+ let request;
1834
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
1835
+ composedSignal.unsubscribe();
1836
+ });
1837
+ let requestContentLength;
1838
+ try {
1839
+ if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
1840
+ let _request = new Request(url, {
1841
+ method: "POST",
1842
+ body: data,
1843
+ duplex: "half"
1844
+ });
1845
+ let contentTypeHeader;
1846
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
1847
+ headers.setContentType(contentTypeHeader);
1848
+ }
1849
+ if (_request.body) {
1850
+ const [onProgress, flush] = progressEventDecorator(
1851
+ requestContentLength,
1852
+ progressEventReducer(asyncDecorator(onUploadProgress))
1853
+ );
1854
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
1855
+ }
1856
+ }
1857
+ if (!utils$1.isString(withCredentials)) {
1858
+ withCredentials = withCredentials ? "include" : "omit";
1859
+ }
1860
+ const isCredentialsSupported = "credentials" in Request.prototype;
1861
+ request = new Request(url, {
1862
+ ...fetchOptions,
1863
+ signal: composedSignal,
1864
+ method: method.toUpperCase(),
1865
+ headers: headers.normalize().toJSON(),
1866
+ body: data,
1867
+ duplex: "half",
1868
+ credentials: isCredentialsSupported ? withCredentials : void 0
1869
+ });
1870
+ let response = await fetch(request);
1871
+ const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
1872
+ if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
1873
+ const options = {};
1874
+ ["status", "statusText", "headers"].forEach((prop) => {
1875
+ options[prop] = response[prop];
1876
+ });
1877
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
1878
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
1879
+ responseContentLength,
1880
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
1881
+ ) || [];
1882
+ response = new Response(
1883
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
1884
+ flush && flush();
1885
+ unsubscribe && unsubscribe();
1886
+ }),
1887
+ options
1888
+ );
1889
+ }
1890
+ responseType = responseType || "text";
1891
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
1892
+ !isStreamResponse && unsubscribe && unsubscribe();
1893
+ return await new Promise((resolve, reject) => {
1894
+ settle(resolve, reject, {
1895
+ data: responseData,
1896
+ headers: AxiosHeaders$1.from(response.headers),
1897
+ status: response.status,
1898
+ statusText: response.statusText,
1899
+ config,
1900
+ request
1901
+ });
1902
+ });
1903
+ } catch (err) {
1904
+ unsubscribe && unsubscribe();
1905
+ if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
1906
+ throw Object.assign(
1907
+ new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
1908
+ {
1909
+ cause: err.cause || err
1910
+ }
1911
+ );
1912
+ }
1913
+ throw AxiosError$1.from(err, err && err.code, config, request);
1914
+ }
1915
+ });
1916
+ const knownAdapters = {
1917
+ http: httpAdapter,
1918
+ xhr: xhrAdapter,
1919
+ fetch: fetchAdapter
1920
+ };
1921
+ utils$1.forEach(knownAdapters, (fn, value) => {
1922
+ if (fn) {
1923
+ try {
1924
+ Object.defineProperty(fn, "name", { value });
1925
+ } catch (e) {
1926
+ }
1927
+ Object.defineProperty(fn, "adapterName", { value });
1928
+ }
1929
+ });
1930
+ const renderReason = (reason) => `- ${reason}`;
1931
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
1932
+ const adapters = {
1933
+ getAdapter: (adapters2) => {
1934
+ adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
1935
+ const { length } = adapters2;
1936
+ let nameOrAdapter;
1937
+ let adapter;
1938
+ const rejectedReasons = {};
1939
+ for (let i = 0; i < length; i++) {
1940
+ nameOrAdapter = adapters2[i];
1941
+ let id;
1942
+ adapter = nameOrAdapter;
1943
+ if (!isResolvedHandle(nameOrAdapter)) {
1944
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
1945
+ if (adapter === void 0) {
1946
+ throw new AxiosError$1(`Unknown adapter '${id}'`);
1947
+ }
1948
+ }
1949
+ if (adapter) {
1950
+ break;
1951
+ }
1952
+ rejectedReasons[id || "#" + i] = adapter;
1953
+ }
1954
+ if (!adapter) {
1955
+ const reasons = Object.entries(rejectedReasons).map(
1956
+ ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
1957
+ );
1958
+ let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
1959
+ throw new AxiosError$1(
1960
+ `There is no suitable adapter to dispatch the request ` + s,
1961
+ "ERR_NOT_SUPPORT"
1962
+ );
1963
+ }
1964
+ return adapter;
1965
+ },
1966
+ adapters: knownAdapters
1967
+ };
1968
+ function throwIfCancellationRequested(config) {
1969
+ if (config.cancelToken) {
1970
+ config.cancelToken.throwIfRequested();
1971
+ }
1972
+ if (config.signal && config.signal.aborted) {
1973
+ throw new CanceledError$1(null, config);
1974
+ }
1975
+ }
1976
+ function dispatchRequest(config) {
1977
+ throwIfCancellationRequested(config);
1978
+ config.headers = AxiosHeaders$1.from(config.headers);
1979
+ config.data = transformData.call(
1980
+ config,
1981
+ config.transformRequest
1982
+ );
1983
+ if (["post", "put", "patch"].indexOf(config.method) !== -1) {
1984
+ config.headers.setContentType("application/x-www-form-urlencoded", false);
1985
+ }
1986
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
1987
+ return adapter(config).then(function onAdapterResolution(response) {
1988
+ throwIfCancellationRequested(config);
1989
+ response.data = transformData.call(
1990
+ config,
1991
+ config.transformResponse,
1992
+ response
1993
+ );
1994
+ response.headers = AxiosHeaders$1.from(response.headers);
1995
+ return response;
1996
+ }, function onAdapterRejection(reason) {
1997
+ if (!isCancel$1(reason)) {
1998
+ throwIfCancellationRequested(config);
1999
+ if (reason && reason.response) {
2000
+ reason.response.data = transformData.call(
2001
+ config,
2002
+ config.transformResponse,
2003
+ reason.response
2004
+ );
2005
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
2006
+ }
2007
+ }
2008
+ return Promise.reject(reason);
2009
+ });
2010
+ }
2011
+ const VERSION$1 = "1.7.9";
2012
+ const validators$1 = {};
2013
+ ["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
2014
+ validators$1[type] = function validator2(thing) {
2015
+ return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
2016
+ };
2017
+ });
2018
+ const deprecatedWarnings = {};
2019
+ validators$1.transitional = function transitional(validator2, version, message) {
2020
+ function formatMessage(opt, desc) {
2021
+ return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
2022
+ }
2023
+ return (value, opt, opts) => {
2024
+ if (validator2 === false) {
2025
+ throw new AxiosError$1(
2026
+ formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
2027
+ AxiosError$1.ERR_DEPRECATED
2028
+ );
2029
+ }
2030
+ if (version && !deprecatedWarnings[opt]) {
2031
+ deprecatedWarnings[opt] = true;
2032
+ console.warn(
2033
+ formatMessage(
2034
+ opt,
2035
+ " has been deprecated since v" + version + " and will be removed in the near future"
2036
+ )
2037
+ );
2038
+ }
2039
+ return validator2 ? validator2(value, opt, opts) : true;
2040
+ };
2041
+ };
2042
+ validators$1.spelling = function spelling(correctSpelling) {
2043
+ return (value, opt) => {
2044
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
2045
+ return true;
2046
+ };
2047
+ };
2048
+ function assertOptions(options, schema, allowUnknown) {
2049
+ if (typeof options !== "object") {
2050
+ throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
2051
+ }
2052
+ const keys = Object.keys(options);
2053
+ let i = keys.length;
2054
+ while (i-- > 0) {
2055
+ const opt = keys[i];
2056
+ const validator2 = schema[opt];
2057
+ if (validator2) {
2058
+ const value = options[opt];
2059
+ const result = value === void 0 || validator2(value, opt, options);
2060
+ if (result !== true) {
2061
+ throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
2062
+ }
2063
+ continue;
2064
+ }
2065
+ if (allowUnknown !== true) {
2066
+ throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
2067
+ }
2068
+ }
2069
+ }
2070
+ const validator = {
2071
+ assertOptions,
2072
+ validators: validators$1
2073
+ };
2074
+ const validators = validator.validators;
2075
+ let Axios$1 = class Axios {
2076
+ constructor(instanceConfig) {
2077
+ this.defaults = instanceConfig;
2078
+ this.interceptors = {
2079
+ request: new InterceptorManager(),
2080
+ response: new InterceptorManager()
2081
+ };
2082
+ }
2083
+ /**
2084
+ * Dispatch a request
2085
+ *
2086
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2087
+ * @param {?Object} config
2088
+ *
2089
+ * @returns {Promise} The Promise to be fulfilled
2090
+ */
2091
+ async request(configOrUrl, config) {
2092
+ try {
2093
+ return await this._request(configOrUrl, config);
2094
+ } catch (err) {
2095
+ if (err instanceof Error) {
2096
+ let dummy = {};
2097
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
2098
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
2099
+ try {
2100
+ if (!err.stack) {
2101
+ err.stack = stack;
2102
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
2103
+ err.stack += "\n" + stack;
2104
+ }
2105
+ } catch (e) {
2106
+ }
2107
+ }
2108
+ throw err;
2109
+ }
2110
+ }
2111
+ _request(configOrUrl, config) {
2112
+ if (typeof configOrUrl === "string") {
2113
+ config = config || {};
2114
+ config.url = configOrUrl;
2115
+ } else {
2116
+ config = configOrUrl || {};
2117
+ }
2118
+ config = mergeConfig$1(this.defaults, config);
2119
+ const { transitional: transitional2, paramsSerializer, headers } = config;
2120
+ if (transitional2 !== void 0) {
2121
+ validator.assertOptions(transitional2, {
2122
+ silentJSONParsing: validators.transitional(validators.boolean),
2123
+ forcedJSONParsing: validators.transitional(validators.boolean),
2124
+ clarifyTimeoutError: validators.transitional(validators.boolean)
2125
+ }, false);
2126
+ }
2127
+ if (paramsSerializer != null) {
2128
+ if (utils$1.isFunction(paramsSerializer)) {
2129
+ config.paramsSerializer = {
2130
+ serialize: paramsSerializer
2131
+ };
2132
+ } else {
2133
+ validator.assertOptions(paramsSerializer, {
2134
+ encode: validators.function,
2135
+ serialize: validators.function
2136
+ }, true);
2137
+ }
2138
+ }
2139
+ validator.assertOptions(config, {
2140
+ baseUrl: validators.spelling("baseURL"),
2141
+ withXsrfToken: validators.spelling("withXSRFToken")
2142
+ }, true);
2143
+ config.method = (config.method || this.defaults.method || "get").toLowerCase();
2144
+ let contextHeaders = headers && utils$1.merge(
2145
+ headers.common,
2146
+ headers[config.method]
2147
+ );
2148
+ headers && utils$1.forEach(
2149
+ ["delete", "get", "head", "post", "put", "patch", "common"],
2150
+ (method) => {
2151
+ delete headers[method];
2152
+ }
2153
+ );
2154
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
2155
+ const requestInterceptorChain = [];
2156
+ let synchronousRequestInterceptors = true;
2157
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2158
+ if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
2159
+ return;
2160
+ }
2161
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2162
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2163
+ });
2164
+ const responseInterceptorChain = [];
2165
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2166
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2167
+ });
2168
+ let promise;
2169
+ let i = 0;
2170
+ let len;
2171
+ if (!synchronousRequestInterceptors) {
2172
+ const chain = [dispatchRequest.bind(this), void 0];
2173
+ chain.unshift.apply(chain, requestInterceptorChain);
2174
+ chain.push.apply(chain, responseInterceptorChain);
2175
+ len = chain.length;
2176
+ promise = Promise.resolve(config);
2177
+ while (i < len) {
2178
+ promise = promise.then(chain[i++], chain[i++]);
2179
+ }
2180
+ return promise;
2181
+ }
2182
+ len = requestInterceptorChain.length;
2183
+ let newConfig = config;
2184
+ i = 0;
2185
+ while (i < len) {
2186
+ const onFulfilled = requestInterceptorChain[i++];
2187
+ const onRejected = requestInterceptorChain[i++];
2188
+ try {
2189
+ newConfig = onFulfilled(newConfig);
2190
+ } catch (error) {
2191
+ onRejected.call(this, error);
2192
+ break;
2193
+ }
2194
+ }
2195
+ try {
2196
+ promise = dispatchRequest.call(this, newConfig);
2197
+ } catch (error) {
2198
+ return Promise.reject(error);
2199
+ }
2200
+ i = 0;
2201
+ len = responseInterceptorChain.length;
2202
+ while (i < len) {
2203
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2204
+ }
2205
+ return promise;
2206
+ }
2207
+ getUri(config) {
2208
+ config = mergeConfig$1(this.defaults, config);
2209
+ const fullPath = buildFullPath(config.baseURL, config.url);
2210
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2211
+ }
2212
+ };
2213
+ utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
2214
+ Axios$1.prototype[method] = function(url, config) {
2215
+ return this.request(mergeConfig$1(config || {}, {
2216
+ method,
2217
+ url,
2218
+ data: (config || {}).data
2219
+ }));
2220
+ };
2221
+ });
2222
+ utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
2223
+ function generateHTTPMethod(isForm) {
2224
+ return function httpMethod(url, data, config) {
2225
+ return this.request(mergeConfig$1(config || {}, {
2226
+ method,
2227
+ headers: isForm ? {
2228
+ "Content-Type": "multipart/form-data"
2229
+ } : {},
2230
+ url,
2231
+ data
2232
+ }));
2233
+ };
2234
+ }
2235
+ Axios$1.prototype[method] = generateHTTPMethod();
2236
+ Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
2237
+ });
2238
+ let CancelToken$1 = class CancelToken {
2239
+ constructor(executor) {
2240
+ if (typeof executor !== "function") {
2241
+ throw new TypeError("executor must be a function.");
2242
+ }
2243
+ let resolvePromise;
2244
+ this.promise = new Promise(function promiseExecutor(resolve) {
2245
+ resolvePromise = resolve;
2246
+ });
2247
+ const token = this;
2248
+ this.promise.then((cancel) => {
2249
+ if (!token._listeners) return;
2250
+ let i = token._listeners.length;
2251
+ while (i-- > 0) {
2252
+ token._listeners[i](cancel);
2253
+ }
2254
+ token._listeners = null;
2255
+ });
2256
+ this.promise.then = (onfulfilled) => {
2257
+ let _resolve;
2258
+ const promise = new Promise((resolve) => {
2259
+ token.subscribe(resolve);
2260
+ _resolve = resolve;
2261
+ }).then(onfulfilled);
2262
+ promise.cancel = function reject() {
2263
+ token.unsubscribe(_resolve);
2264
+ };
2265
+ return promise;
2266
+ };
2267
+ executor(function cancel(message, config, request) {
2268
+ if (token.reason) {
2269
+ return;
2270
+ }
2271
+ token.reason = new CanceledError$1(message, config, request);
2272
+ resolvePromise(token.reason);
2273
+ });
2274
+ }
2275
+ /**
2276
+ * Throws a `CanceledError` if cancellation has been requested.
2277
+ */
2278
+ throwIfRequested() {
2279
+ if (this.reason) {
2280
+ throw this.reason;
2281
+ }
2282
+ }
2283
+ /**
2284
+ * Subscribe to the cancel signal
2285
+ */
2286
+ subscribe(listener) {
2287
+ if (this.reason) {
2288
+ listener(this.reason);
2289
+ return;
2290
+ }
2291
+ if (this._listeners) {
2292
+ this._listeners.push(listener);
2293
+ } else {
2294
+ this._listeners = [listener];
2295
+ }
2296
+ }
2297
+ /**
2298
+ * Unsubscribe from the cancel signal
2299
+ */
2300
+ unsubscribe(listener) {
2301
+ if (!this._listeners) {
2302
+ return;
2303
+ }
2304
+ const index2 = this._listeners.indexOf(listener);
2305
+ if (index2 !== -1) {
2306
+ this._listeners.splice(index2, 1);
2307
+ }
2308
+ }
2309
+ toAbortSignal() {
2310
+ const controller = new AbortController();
2311
+ const abort = (err) => {
2312
+ controller.abort(err);
2313
+ };
2314
+ this.subscribe(abort);
2315
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
2316
+ return controller.signal;
2317
+ }
2318
+ /**
2319
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
2320
+ * cancels the `CancelToken`.
2321
+ */
2322
+ static source() {
2323
+ let cancel;
2324
+ const token = new CancelToken(function executor(c) {
2325
+ cancel = c;
2326
+ });
2327
+ return {
2328
+ token,
2329
+ cancel
2330
+ };
2331
+ }
2332
+ };
2333
+ function spread$1(callback) {
2334
+ return function wrap(arr) {
2335
+ return callback.apply(null, arr);
2336
+ };
2337
+ }
2338
+ function isAxiosError$1(payload) {
2339
+ return utils$1.isObject(payload) && payload.isAxiosError === true;
2340
+ }
2341
+ const HttpStatusCode$1 = {
2342
+ Continue: 100,
2343
+ SwitchingProtocols: 101,
2344
+ Processing: 102,
2345
+ EarlyHints: 103,
2346
+ Ok: 200,
2347
+ Created: 201,
2348
+ Accepted: 202,
2349
+ NonAuthoritativeInformation: 203,
2350
+ NoContent: 204,
2351
+ ResetContent: 205,
2352
+ PartialContent: 206,
2353
+ MultiStatus: 207,
2354
+ AlreadyReported: 208,
2355
+ ImUsed: 226,
2356
+ MultipleChoices: 300,
2357
+ MovedPermanently: 301,
2358
+ Found: 302,
2359
+ SeeOther: 303,
2360
+ NotModified: 304,
2361
+ UseProxy: 305,
2362
+ Unused: 306,
2363
+ TemporaryRedirect: 307,
2364
+ PermanentRedirect: 308,
2365
+ BadRequest: 400,
2366
+ Unauthorized: 401,
2367
+ PaymentRequired: 402,
2368
+ Forbidden: 403,
2369
+ NotFound: 404,
2370
+ MethodNotAllowed: 405,
2371
+ NotAcceptable: 406,
2372
+ ProxyAuthenticationRequired: 407,
2373
+ RequestTimeout: 408,
2374
+ Conflict: 409,
2375
+ Gone: 410,
2376
+ LengthRequired: 411,
2377
+ PreconditionFailed: 412,
2378
+ PayloadTooLarge: 413,
2379
+ UriTooLong: 414,
2380
+ UnsupportedMediaType: 415,
2381
+ RangeNotSatisfiable: 416,
2382
+ ExpectationFailed: 417,
2383
+ ImATeapot: 418,
2384
+ MisdirectedRequest: 421,
2385
+ UnprocessableEntity: 422,
2386
+ Locked: 423,
2387
+ FailedDependency: 424,
2388
+ TooEarly: 425,
2389
+ UpgradeRequired: 426,
2390
+ PreconditionRequired: 428,
2391
+ TooManyRequests: 429,
2392
+ RequestHeaderFieldsTooLarge: 431,
2393
+ UnavailableForLegalReasons: 451,
2394
+ InternalServerError: 500,
2395
+ NotImplemented: 501,
2396
+ BadGateway: 502,
2397
+ ServiceUnavailable: 503,
2398
+ GatewayTimeout: 504,
2399
+ HttpVersionNotSupported: 505,
2400
+ VariantAlsoNegotiates: 506,
2401
+ InsufficientStorage: 507,
2402
+ LoopDetected: 508,
2403
+ NotExtended: 510,
2404
+ NetworkAuthenticationRequired: 511
2405
+ };
2406
+ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
2407
+ HttpStatusCode$1[value] = key;
2408
+ });
2409
+ function createInstance(defaultConfig) {
2410
+ const context = new Axios$1(defaultConfig);
2411
+ const instance = bind(Axios$1.prototype.request, context);
2412
+ utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
2413
+ utils$1.extend(instance, context, null, { allOwnKeys: true });
2414
+ instance.create = function create(instanceConfig) {
2415
+ return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
2416
+ };
2417
+ return instance;
2418
+ }
2419
+ const axios = createInstance(defaults);
2420
+ axios.Axios = Axios$1;
2421
+ axios.CanceledError = CanceledError$1;
2422
+ axios.CancelToken = CancelToken$1;
2423
+ axios.isCancel = isCancel$1;
2424
+ axios.VERSION = VERSION$1;
2425
+ axios.toFormData = toFormData$1;
2426
+ axios.AxiosError = AxiosError$1;
2427
+ axios.Cancel = axios.CanceledError;
2428
+ axios.all = function all(promises) {
2429
+ return Promise.all(promises);
2430
+ };
2431
+ axios.spread = spread$1;
2432
+ axios.isAxiosError = isAxiosError$1;
2433
+ axios.mergeConfig = mergeConfig$1;
2434
+ axios.AxiosHeaders = AxiosHeaders$1;
2435
+ axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
2436
+ axios.getAdapter = adapters.getAdapter;
2437
+ axios.HttpStatusCode = HttpStatusCode$1;
2438
+ axios.default = axios;
2439
+ const {
2440
+ Axios: Axios2,
2441
+ AxiosError,
2442
+ CanceledError,
2443
+ isCancel,
2444
+ CancelToken: CancelToken2,
2445
+ VERSION,
2446
+ all: all2,
2447
+ Cancel,
2448
+ isAxiosError,
2449
+ spread,
2450
+ toFormData,
2451
+ AxiosHeaders: AxiosHeaders2,
2452
+ HttpStatusCode,
2453
+ formToJSON,
2454
+ getAdapter,
2455
+ mergeConfig
2456
+ } = axios;
2457
+ const BASE_PLUGIN_PATH = `/${PLUGIN_ID}`;
2458
+ const getToken = () => {
2459
+ const token = localStorage.getItem("jwtToken") || sessionStorage.getItem("jwtToken") || "";
2460
+ if (!token) {
2461
+ return "";
2462
+ }
2463
+ const parsedToken = JSON.parse(token);
2464
+ return parsedToken;
2465
+ };
2466
+ const createStrapiApiAxiosInstance = (baseUrl = null) => {
2467
+ const token = getToken();
2468
+ if (baseUrl === null) {
2469
+ baseUrl = `${BASE_PLUGIN_PATH}`;
2470
+ }
2471
+ const instance = axios.create({
2472
+ baseURL: `${baseUrl}`
2473
+ });
2474
+ instance.interceptors.request.use(
2475
+ async (config) => {
2476
+ config.headers.set({
2477
+ Accept: "application/json",
2478
+ "Content-Type": "application/json",
2479
+ // Add this header to identify the request as initiated by the plugin
2480
+ "X-Localazy-Initiated-By": "strapi-plugin-localazy"
2481
+ });
2482
+ if (token) {
2483
+ config.headers.set("Authorization", `Bearer ${token}`);
2484
+ }
2485
+ return config;
2486
+ },
2487
+ (error) => {
2488
+ Promise.reject(error);
2489
+ }
2490
+ );
2491
+ instance.interceptors.response.use(
2492
+ (response) => response,
2493
+ (error) => {
2494
+ if (error.response?.status === 401) ;
2495
+ throw error;
2496
+ }
2497
+ );
2498
+ return instance;
2499
+ };
2500
+ const BASE_PATH = "/user";
2501
+ const strapiApiInstance = createStrapiApiAxiosInstance();
2502
+ class LocalazyUserService {
2503
+ static async getIdentity() {
2504
+ try {
2505
+ const result = await strapiApiInstance.get(`${BASE_PATH}`);
2506
+ return result.data;
2507
+ } catch (e) {
2508
+ throw e;
2509
+ }
2510
+ }
2511
+ static async updateIdentity(localazyIdentity2) {
2512
+ try {
2513
+ const result = await strapiApiInstance.put(`${BASE_PATH}`, localazyIdentity2);
2514
+ return result.data;
2515
+ } catch (e) {
2516
+ throw e;
2517
+ }
2518
+ }
2519
+ static async deleteIdentity() {
2520
+ try {
2521
+ const result = await strapiApiInstance.delete(`${BASE_PATH}`);
2522
+ return result.data;
2523
+ } catch (e) {
2524
+ throw e;
2525
+ }
2526
+ }
2527
+ }
2528
+ var PLUGIN_ROUTES = /* @__PURE__ */ ((PLUGIN_ROUTES2) => {
2529
+ PLUGIN_ROUTES2["ROOT"] = "";
2530
+ PLUGIN_ROUTES2["LOGIN"] = "login";
2531
+ PLUGIN_ROUTES2["UPLOAD"] = "upload";
2532
+ PLUGIN_ROUTES2["DOWNLOAD"] = "download";
2533
+ PLUGIN_ROUTES2["OVERVIEW"] = "overview";
2534
+ PLUGIN_ROUTES2["CONTENT_TRANSFER_SETUP"] = "content-transfer-setup";
2535
+ PLUGIN_ROUTES2["GLOBAL_SETTINGS"] = "global-settings";
2536
+ return PLUGIN_ROUTES2;
2537
+ })(PLUGIN_ROUTES || {});
2538
+ const useRedirectToPluginRoute = () => {
2539
+ const navigate = reactRouterDom.useNavigate();
2540
+ const navigateToPluginRoute = (route) => {
2541
+ if ([
2542
+ "content-transfer-setup",
2543
+ "global-settings"
2544
+ /* GLOBAL_SETTINGS */
2545
+ ].includes(route)) {
2546
+ navigate(`/settings/${PLUGIN_ID}/${route}`);
2547
+ return;
2548
+ }
2549
+ navigate(`/plugins/${PLUGIN_ID}/${route}`);
2550
+ };
2551
+ return {
2552
+ navigateToPluginRoute
2553
+ };
2554
+ };
2555
+ const FetchIdentity = () => {
2556
+ const { setIdentity } = useLocalazyIdentity();
2557
+ const { navigateToPluginRoute } = useRedirectToPluginRoute();
2558
+ React.useEffect(() => {
2559
+ const fetchIdentity = async () => {
2560
+ try {
2561
+ const identity = await LocalazyUserService.getIdentity();
2562
+ setIdentity(identity || emptyIdentity);
2563
+ if (!identity?.accessToken) {
2564
+ navigateToPluginRoute(PLUGIN_ROUTES.LOGIN);
2565
+ }
2566
+ } catch (error) {
2567
+ console.error("Error fetching identity:", error);
2568
+ }
2569
+ };
2570
+ fetchIdentity();
2571
+ }, [setIdentity]);
2572
+ return null;
2573
+ };
2574
+ const index = {
2575
+ register(app) {
2576
+ addMenuLink(app);
2577
+ addSettingsSection(app);
2578
+ addPlugin(app);
2579
+ },
2580
+ async registerTrads({ locales }) {
2581
+ return Promise.all(
2582
+ locales.map(async (locale) => {
2583
+ try {
2584
+ const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-CRtsEFtl.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-C8Qw4iPZ.js")) }), `./translations/${locale}.json`, 3);
2585
+ return { data, locale };
2586
+ } catch {
2587
+ return { data: {}, locale };
2588
+ }
2589
+ })
2590
+ );
2591
+ }
2592
+ };
2593
+ const addMenuLink = (app) => {
2594
+ app.addMenuLink({
2595
+ to: `plugins/${PLUGIN_ID}/`,
2596
+ icon: Localazy,
2597
+ intlLabel: {
2598
+ id: `${PLUGIN_ID}.name`,
2599
+ defaultMessage: getTranslation("name")
2600
+ },
2601
+ Component: async () => {
2602
+ const { App } = await Promise.resolve().then(() => require("./App-D1QaIMHX.js"));
2603
+ const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
2604
+ const WrappedApp = () => React__default.default.createElement(LocalazyIdentityProvider2, {
2605
+ children: React__default.default.createElement(React__default.default.Fragment, {}, [
2606
+ React__default.default.createElement(FetchIdentity, {}),
2607
+ React__default.default.createElement(App, {})
2608
+ ])
2609
+ });
2610
+ return WrappedApp;
2611
+ }
2612
+ });
2613
+ };
2614
+ const addSettingsSection = (app) => {
2615
+ app.createSettingSection(
2616
+ {
2617
+ id: `${PLUGIN_ID}-settings`,
2618
+ intlLabel: {
2619
+ id: `${PLUGIN_ID}.localazy_settings`,
2620
+ defaultMessage: getTranslation("localazy_settings")
2621
+ }
2622
+ },
2623
+ [
2624
+ // General
2625
+ {
2626
+ id: `${PLUGIN_ID}-settings-global`,
2627
+ intlLabel: {
2628
+ id: `${PLUGIN_ID}.localazy_settings`,
2629
+ defaultMessage: getTranslation("localazy_settings")
2630
+ },
2631
+ to: `/settings/${PLUGIN_ID}/global-settings`,
2632
+ Component: async () => {
2633
+ const { GlobalSettings } = await Promise.resolve().then(() => require("./GlobalSettings-BON3kjHK.js"));
2634
+ const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
2635
+ const WrappedGlobalSettings = () => React__default.default.createElement(LocalazyIdentityProvider2, { children: React__default.default.createElement(GlobalSettings, {}) });
2636
+ return WrappedGlobalSettings;
2637
+ },
2638
+ permissions: []
2639
+ },
2640
+ // Content Transfer Setup
2641
+ {
2642
+ id: `${PLUGIN_ID}-settings-content-transfer-setup`,
2643
+ intlLabel: {
2644
+ id: `${PLUGIN_ID}.content_transfer_setup`,
2645
+ defaultMessage: getTranslation("content_transfer_setup")
2646
+ },
2647
+ to: `/settings/${PLUGIN_ID}/content-transfer-setup`,
2648
+ Component: async () => {
2649
+ const { ContentTransferSetup } = await Promise.resolve().then(() => require("./ContentTransferSetup-DHXJIxAp.js"));
2650
+ const { LocalazyIdentityProvider: LocalazyIdentityProvider2 } = await Promise.resolve().then(() => localazyIdentity);
2651
+ const WrappedContentTransferSetup = () => React__default.default.createElement(LocalazyIdentityProvider2, {
2652
+ children: React__default.default.createElement(React__default.default.Fragment, {}, [
2653
+ React__default.default.createElement(FetchIdentity, {}),
2654
+ React__default.default.createElement(ContentTransferSetup, {})
2655
+ ])
2656
+ });
2657
+ return WrappedContentTransferSetup;
2658
+ },
2659
+ permissions: []
2660
+ }
2661
+ ]
2662
+ );
2663
+ };
2664
+ const addPlugin = (app) => {
2665
+ app.registerPlugin({
2666
+ id: PLUGIN_ID,
2667
+ initializer: Initializer,
2668
+ isReady: false,
2669
+ name: PLUGIN_ID
2670
+ });
2671
+ };
2672
+ exports.LocalazyUserService = LocalazyUserService;
2673
+ exports.PLUGIN_ID = PLUGIN_ID;
2674
+ exports.PLUGIN_ROUTES = PLUGIN_ROUTES;
2675
+ exports.createStrapiApiAxiosInstance = createStrapiApiAxiosInstance;
2676
+ exports.emptyIdentity = emptyIdentity;
2677
+ exports.index = index;
2678
+ exports.useLocalazyIdentity = useLocalazyIdentity;
2679
+ exports.useRedirectToPluginRoute = useRedirectToPluginRoute;