legalesign-document-viewer 0.1.0 → 0.1.2

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 (449) hide show
  1. package/dist/cjs/index-DqDUg8D7.js +1950 -0
  2. package/dist/cjs/index-DqDUg8D7.js.map +1 -0
  3. package/dist/cjs/index.cjs.js +10 -0
  4. package/dist/cjs/index.cjs.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +15 -0
  6. package/dist/cjs/loader.cjs.js.map +1 -0
  7. package/dist/cjs/ls-document-options_35.cjs.entry.js +33247 -0
  8. package/dist/cjs/ls-document-options_35.cjs.entry.js.map +1 -0
  9. package/dist/cjs/ls-document-viewer.cjs.js +27 -0
  10. package/dist/cjs/ls-document-viewer.cjs.js.map +1 -0
  11. package/dist/collection/collection-manifest.json +46 -0
  12. package/dist/collection/components/interfaces/IToolboxField.js +1 -0
  13. package/dist/collection/components/interfaces/IToolboxField.js.map +1 -0
  14. package/dist/collection/components/ls-document-options/ls-document-options.css +334 -0
  15. package/dist/collection/components/ls-document-options/ls-document-options.js +61 -0
  16. package/dist/collection/components/ls-document-options/ls-document-options.js.map +1 -0
  17. package/dist/collection/components/ls-document-viewer/adapter/LsDocumentAdapter.js +83 -0
  18. package/dist/collection/components/ls-document-viewer/adapter/LsDocumentAdapter.js.map +1 -0
  19. package/dist/collection/components/ls-document-viewer/adapter/elementActions.js +72 -0
  20. package/dist/collection/components/ls-document-viewer/adapter/elementActions.js.map +1 -0
  21. package/dist/collection/components/ls-document-viewer/adapter/parameters.js +16 -0
  22. package/dist/collection/components/ls-document-viewer/adapter/parameters.js.map +1 -0
  23. package/dist/collection/components/ls-document-viewer/adapter/roleActions.js +53 -0
  24. package/dist/collection/components/ls-document-viewer/adapter/roleActions.js.map +1 -0
  25. package/dist/collection/components/ls-document-viewer/adapter/templateActions.js +87 -0
  26. package/dist/collection/components/ls-document-viewer/adapter/templateActions.js.map +1 -0
  27. package/dist/collection/components/ls-document-viewer/defaultPalette.js +22 -0
  28. package/dist/collection/components/ls-document-viewer/defaultPalette.js.map +1 -0
  29. package/dist/collection/components/ls-document-viewer/editorCalculator.js +122 -0
  30. package/dist/collection/components/ls-document-viewer/editorCalculator.js.map +1 -0
  31. package/dist/collection/components/ls-document-viewer/editorUtils.js +168 -0
  32. package/dist/collection/components/ls-document-viewer/editorUtils.js.map +1 -0
  33. package/dist/collection/components/ls-document-viewer/keyHandlers.js +61 -0
  34. package/dist/collection/components/ls-document-viewer/keyHandlers.js.map +1 -0
  35. package/dist/collection/components/ls-document-viewer/ls-document-viewer.css +586 -0
  36. package/dist/collection/components/ls-document-viewer/ls-document-viewer.js +1018 -0
  37. package/dist/collection/components/ls-document-viewer/ls-document-viewer.js.map +1 -0
  38. package/dist/collection/components/ls-document-viewer/mouseHandlers.js +224 -0
  39. package/dist/collection/components/ls-document-viewer/mouseHandlers.js.map +1 -0
  40. package/dist/collection/components/ls-editor-field/ls-editor-field.css +73 -0
  41. package/dist/collection/components/ls-editor-field/ls-editor-field.js +292 -0
  42. package/dist/collection/components/ls-editor-field/ls-editor-field.js.map +1 -0
  43. package/dist/collection/components/ls-editor-table/ls-editor-table.css +16 -0
  44. package/dist/collection/components/ls-editor-table/ls-editor-table.js +70 -0
  45. package/dist/collection/components/ls-editor-table/ls-editor-table.js.map +1 -0
  46. package/dist/collection/components/ls-feature-column/ls-feature-column.css +23 -0
  47. package/dist/collection/components/ls-feature-column/ls-feature-column.js +78 -0
  48. package/dist/collection/components/ls-feature-column/ls-feature-column.js.map +1 -0
  49. package/dist/collection/components/ls-field-alignment/ls-field-alignment.css +300 -0
  50. package/dist/{ls-document-viewer/ls-field-alignment.entry.js → collection/components/ls-field-alignment/ls-field-alignment.js} +90 -18
  51. package/dist/collection/components/ls-field-alignment/ls-field-alignment.js.map +1 -0
  52. package/dist/collection/components/ls-field-dimensions/ls-field-dimensions.css +353 -0
  53. package/dist/collection/components/ls-field-dimensions/ls-field-dimensions.js +120 -0
  54. package/dist/collection/components/ls-field-dimensions/ls-field-dimensions.js.map +1 -0
  55. package/dist/collection/components/ls-field-distribute/ls-field-distribute.css +309 -0
  56. package/dist/collection/components/ls-field-distribute/ls-field-distribute.js +173 -0
  57. package/dist/collection/components/ls-field-distribute/ls-field-distribute.js.map +1 -0
  58. package/dist/collection/components/ls-field-format/ls-field-format.css +291 -0
  59. package/dist/collection/components/ls-field-format/ls-field-format.js +126 -0
  60. package/dist/collection/components/ls-field-format/ls-field-format.js.map +1 -0
  61. package/dist/collection/components/ls-field-placement/ls-field-placement.css +352 -0
  62. package/dist/collection/components/ls-field-placement/ls-field-placement.js +120 -0
  63. package/dist/collection/components/ls-field-placement/ls-field-placement.js.map +1 -0
  64. package/dist/collection/components/ls-field-properties/ls-field-properties.css +285 -0
  65. package/dist/collection/components/ls-field-properties/ls-field-properties.js +76 -0
  66. package/dist/collection/components/ls-field-properties/ls-field-properties.js.map +1 -0
  67. package/dist/collection/components/ls-field-properties-autosign/ls-field-properties-autosign.css +284 -0
  68. package/dist/collection/components/ls-field-properties-autosign/ls-field-properties-autosign.js +48 -0
  69. package/dist/collection/components/ls-field-properties-autosign/ls-field-properties-autosign.js.map +1 -0
  70. package/dist/collection/components/ls-field-properties-date/ls-field-properties-date.css +295 -0
  71. package/dist/collection/components/ls-field-properties-date/ls-field-properties-date.js +48 -0
  72. package/dist/collection/components/ls-field-properties-date/ls-field-properties-date.js.map +1 -0
  73. package/dist/collection/components/ls-field-properties-email/ls-field-properties-email.css +284 -0
  74. package/dist/collection/components/ls-field-properties-email/ls-field-properties-email.js +48 -0
  75. package/dist/collection/components/ls-field-properties-email/ls-field-properties-email.js.map +1 -0
  76. package/dist/collection/components/ls-field-properties-file/ls-field-properties-file.css +283 -0
  77. package/dist/collection/components/ls-field-properties-file/ls-field-properties-file.js +48 -0
  78. package/dist/collection/components/ls-field-properties-file/ls-field-properties-file.js.map +1 -0
  79. package/dist/collection/components/ls-field-properties-general/ls-field-properties-general.css +295 -0
  80. package/dist/collection/components/ls-field-properties-general/ls-field-properties-general.js +48 -0
  81. package/dist/collection/components/ls-field-properties-general/ls-field-properties-general.js.map +1 -0
  82. package/dist/collection/components/ls-field-properties-image/ls-field-properties-image.css +283 -0
  83. package/dist/collection/components/ls-field-properties-image/ls-field-properties-image.js +48 -0
  84. package/dist/collection/components/ls-field-properties-image/ls-field-properties-image.js.map +1 -0
  85. package/dist/collection/components/ls-field-properties-multiple/ls-field-properties-multiple.css +283 -0
  86. package/dist/collection/components/ls-field-properties-multiple/ls-field-properties-multiple.js +48 -0
  87. package/dist/collection/components/ls-field-properties-multiple/ls-field-properties-multiple.js.map +1 -0
  88. package/dist/collection/components/ls-field-properties-number/ls-field-properties-number.css +283 -0
  89. package/dist/collection/components/ls-field-properties-number/ls-field-properties-number.js +48 -0
  90. package/dist/collection/components/ls-field-properties-number/ls-field-properties-number.js.map +1 -0
  91. package/dist/collection/components/ls-field-properties-signature/ls-field-properties-signature.css +418 -0
  92. package/dist/collection/components/ls-field-properties-signature/ls-field-properties-signature.js +69 -0
  93. package/dist/collection/components/ls-field-properties-signature/ls-field-properties-signature.js.map +1 -0
  94. package/dist/collection/components/ls-field-properties-text/ls-field-properties-text.css +284 -0
  95. package/dist/collection/components/ls-field-properties-text/ls-field-properties-text.js +48 -0
  96. package/dist/collection/components/ls-field-properties-text/ls-field-properties-text.js.map +1 -0
  97. package/dist/collection/components/ls-field-size/ls-field-size.css +301 -0
  98. package/dist/collection/components/ls-field-size/ls-field-size.js +105 -0
  99. package/dist/collection/components/ls-field-size/ls-field-size.js.map +1 -0
  100. package/dist/collection/components/ls-formfield/inputs/ls-number-input/ls-number-input.css +273 -0
  101. package/dist/collection/components/ls-formfield/inputs/ls-number-input/ls-number-input.js +336 -0
  102. package/dist/collection/components/ls-formfield/inputs/ls-number-input/ls-number-input.js.map +1 -0
  103. package/dist/collection/components/ls-formfield/inputs/ls-radio-input/ls-radio-input.css +69 -0
  104. package/dist/collection/components/ls-formfield/inputs/ls-radio-input/ls-radio-input.js +173 -0
  105. package/dist/collection/components/ls-formfield/inputs/ls-radio-input/ls-radio-input.js.map +1 -0
  106. package/dist/collection/components/ls-formfield/inputs/ls-select-input/ls-select-input.css +228 -0
  107. package/dist/collection/components/ls-formfield/inputs/ls-select-input/ls-select-input.js +288 -0
  108. package/dist/collection/components/ls-formfield/inputs/ls-select-input/ls-select-input.js.map +1 -0
  109. package/dist/collection/components/ls-formfield/inputs/ls-text-input/ls-text-input.css +218 -0
  110. package/dist/collection/components/ls-formfield/inputs/ls-text-input/ls-text-input.js +336 -0
  111. package/dist/collection/components/ls-formfield/inputs/ls-text-input/ls-text-input.js.map +1 -0
  112. package/dist/collection/components/ls-formfield/inputs/ls-textarea-input/ls-textarea-input.css +208 -0
  113. package/dist/collection/components/ls-formfield/inputs/ls-textarea-input/ls-textarea-input.js +326 -0
  114. package/dist/collection/components/ls-formfield/inputs/ls-textarea-input/ls-textarea-input.js.map +1 -0
  115. package/dist/collection/components/ls-formfield/ls-formfield.css +98 -0
  116. package/dist/collection/components/ls-formfield/ls-formfield.js +528 -0
  117. package/dist/collection/components/ls-formfield/ls-formfield.js.map +1 -0
  118. package/dist/collection/components/ls-icon/icons.js +6619 -0
  119. package/dist/collection/components/ls-icon/icons.js.map +1 -0
  120. package/dist/collection/components/ls-icon/ls-icon.js +125 -0
  121. package/dist/collection/components/ls-icon/ls-icon.js.map +1 -0
  122. package/dist/collection/components/ls-participant-manager/ls-participant-manager.css +413 -0
  123. package/dist/collection/components/ls-participant-manager/ls-participant-manager.js +178 -0
  124. package/dist/collection/components/ls-participant-manager/ls-participant-manager.js.map +1 -0
  125. package/dist/collection/components/ls-participant-select/ls-participant-select.css +405 -0
  126. package/dist/collection/components/ls-participant-select/ls-participant-select.js +189 -0
  127. package/dist/collection/components/ls-participant-select/ls-participant-select.js.map +1 -0
  128. package/dist/collection/components/ls-statusbar/ls-statusbar.css +198 -0
  129. package/dist/collection/components/ls-statusbar/ls-statusbar.js +106 -0
  130. package/dist/collection/components/ls-statusbar/ls-statusbar.js.map +1 -0
  131. package/dist/collection/components/ls-toggle/ls-toggle.css +69 -0
  132. package/dist/collection/components/ls-toggle/ls-toggle.js +19 -0
  133. package/dist/collection/components/ls-toggle/ls-toggle.js.map +1 -0
  134. package/dist/collection/components/ls-toolbar/ls-toolbar.css +303 -0
  135. package/dist/collection/components/ls-toolbar/ls-toolbar.js +169 -0
  136. package/dist/collection/components/ls-toolbar/ls-toolbar.js.map +1 -0
  137. package/dist/collection/components/ls-toolbox-field/ls-toolbox-field.css +311 -0
  138. package/dist/collection/components/ls-toolbox-field/ls-toolbox-field.js +216 -0
  139. package/dist/collection/components/ls-toolbox-field/ls-toolbox-field.js.map +1 -0
  140. package/dist/collection/index.js +11 -0
  141. package/dist/collection/index.js.map +1 -0
  142. package/dist/collection/types/Icon.js +368 -0
  143. package/dist/collection/types/Icon.js.map +1 -0
  144. package/dist/collection/types/LSApiElement.js +2 -0
  145. package/dist/collection/types/LSApiElement.js.map +1 -0
  146. package/dist/collection/types/LSApiElementType.js +16 -0
  147. package/dist/collection/types/LSApiElementType.js.map +1 -0
  148. package/dist/collection/types/LSApiRole.js +2 -0
  149. package/dist/collection/types/LSApiRole.js.map +1 -0
  150. package/dist/collection/types/LSApiTemplate.js +2 -0
  151. package/dist/collection/types/LSApiTemplate.js.map +1 -0
  152. package/dist/collection/types/LSMutateEvent.js +2 -0
  153. package/dist/collection/types/LSMutateEvent.js.map +1 -0
  154. package/dist/collection/types/RoleColor.js +2 -0
  155. package/dist/collection/types/RoleColor.js.map +1 -0
  156. package/dist/collection/types/ValidationType.js +2 -0
  157. package/dist/collection/types/ValidationType.js.map +1 -0
  158. package/dist/collection/utils/utils.js +4 -0
  159. package/dist/collection/utils/utils.js.map +1 -0
  160. package/dist/components/index.js +10 -0
  161. package/dist/components/index.js.map +1 -0
  162. package/dist/components/ls-document-options.js +9 -0
  163. package/dist/components/ls-document-options.js.map +1 -0
  164. package/dist/components/ls-document-viewer.js +24979 -0
  165. package/dist/components/ls-document-viewer.js.map +1 -0
  166. package/dist/components/ls-editor-field.js +9 -0
  167. package/dist/components/ls-editor-field.js.map +1 -0
  168. package/dist/components/ls-editor-table.js +9 -0
  169. package/dist/components/ls-editor-table.js.map +1 -0
  170. package/dist/components/ls-feature-column.js +9 -0
  171. package/dist/components/ls-feature-column.js.map +1 -0
  172. package/dist/components/ls-field-alignment.js +9 -0
  173. package/dist/components/ls-field-alignment.js.map +1 -0
  174. package/dist/components/ls-field-dimensions.js +9 -0
  175. package/dist/components/ls-field-dimensions.js.map +1 -0
  176. package/dist/components/ls-field-distribute.js +9 -0
  177. package/dist/components/ls-field-distribute.js.map +1 -0
  178. package/dist/components/ls-field-format.js +9 -0
  179. package/dist/components/ls-field-format.js.map +1 -0
  180. package/dist/components/ls-field-placement.d.ts +11 -0
  181. package/dist/components/ls-field-placement.js +9 -0
  182. package/dist/components/ls-field-placement.js.map +1 -0
  183. package/dist/components/ls-field-properties-autosign.d.ts +11 -0
  184. package/dist/components/ls-field-properties-autosign.js +9 -0
  185. package/dist/components/ls-field-properties-autosign.js.map +1 -0
  186. package/dist/components/ls-field-properties-date.js +9 -0
  187. package/dist/components/ls-field-properties-date.js.map +1 -0
  188. package/dist/components/ls-field-properties-email.d.ts +11 -0
  189. package/dist/components/ls-field-properties-email.js +9 -0
  190. package/dist/components/ls-field-properties-email.js.map +1 -0
  191. package/dist/components/ls-field-properties-file.d.ts +11 -0
  192. package/dist/components/ls-field-properties-file.js +9 -0
  193. package/dist/components/ls-field-properties-file.js.map +1 -0
  194. package/dist/components/ls-field-properties-general.js +9 -0
  195. package/dist/components/ls-field-properties-general.js.map +1 -0
  196. package/dist/components/ls-field-properties-image.d.ts +11 -0
  197. package/dist/components/ls-field-properties-image.js +9 -0
  198. package/dist/components/ls-field-properties-image.js.map +1 -0
  199. package/dist/components/ls-field-properties-multiple.js +9 -0
  200. package/dist/components/ls-field-properties-multiple.js.map +1 -0
  201. package/dist/components/ls-field-properties-number.js +9 -0
  202. package/dist/components/ls-field-properties-number.js.map +1 -0
  203. package/dist/components/ls-field-properties-signature.js +9 -0
  204. package/dist/components/ls-field-properties-signature.js.map +1 -0
  205. package/dist/components/ls-field-properties-text.js +9 -0
  206. package/dist/components/ls-field-properties-text.js.map +1 -0
  207. package/dist/components/ls-field-properties.js +9 -0
  208. package/dist/components/ls-field-properties.js.map +1 -0
  209. package/dist/components/ls-field-size.js +9 -0
  210. package/dist/components/ls-field-size.js.map +1 -0
  211. package/dist/components/ls-formfield.js +9 -0
  212. package/dist/components/ls-formfield.js.map +1 -0
  213. package/dist/components/ls-icon.js +9 -0
  214. package/dist/components/ls-icon.js.map +1 -0
  215. package/dist/components/ls-number-input.js +9 -0
  216. package/dist/components/ls-number-input.js.map +1 -0
  217. package/dist/components/ls-participant-manager.js +9 -0
  218. package/dist/components/ls-participant-manager.js.map +1 -0
  219. package/dist/components/ls-participant-select.js +9 -0
  220. package/dist/components/ls-participant-select.js.map +1 -0
  221. package/dist/components/ls-radio-input.js +9 -0
  222. package/dist/components/ls-radio-input.js.map +1 -0
  223. package/dist/components/ls-select-input.js +9 -0
  224. package/dist/components/ls-select-input.js.map +1 -0
  225. package/dist/components/ls-statusbar.js +9 -0
  226. package/dist/components/ls-statusbar.js.map +1 -0
  227. package/dist/components/ls-text-input.js +9 -0
  228. package/dist/components/ls-text-input.js.map +1 -0
  229. package/dist/components/ls-textarea-input.js +9 -0
  230. package/dist/components/ls-textarea-input.js.map +1 -0
  231. package/dist/components/ls-toggle.d.ts +11 -0
  232. package/dist/components/ls-toggle.js +9 -0
  233. package/dist/components/ls-toggle.js.map +1 -0
  234. package/dist/components/ls-toolbar.js +9 -0
  235. package/dist/components/ls-toolbar.js.map +1 -0
  236. package/dist/components/ls-toolbox-field.js +9 -0
  237. package/dist/components/ls-toolbox-field.js.map +1 -0
  238. package/dist/components/p-8QmwtD0L.js +160 -0
  239. package/dist/components/p-8QmwtD0L.js.map +1 -0
  240. package/dist/components/p-B1Q1LddX.js +49 -0
  241. package/dist/components/p-B1Q1LddX.js.map +1 -0
  242. package/dist/components/p-B1X25Dz_.js +49 -0
  243. package/dist/components/p-B1X25Dz_.js.map +1 -0
  244. package/dist/components/p-B9qKX3S0.js +107 -0
  245. package/dist/components/p-B9qKX3S0.js.map +1 -0
  246. package/dist/components/p-BI9SKPKN.js +51 -0
  247. package/dist/components/p-BI9SKPKN.js.map +1 -0
  248. package/dist/components/p-BNKSb1yR.js +49 -0
  249. package/dist/components/p-BNKSb1yR.js.map +1 -0
  250. package/dist/components/p-BlTHDG0s.js +77 -0
  251. package/dist/components/p-BlTHDG0s.js.map +1 -0
  252. package/dist/components/p-BxXqIouU.js +49 -0
  253. package/dist/components/p-BxXqIouU.js.map +1 -0
  254. package/dist/components/p-C00GqV9f.js +26 -0
  255. package/dist/components/p-C00GqV9f.js.map +1 -0
  256. package/dist/components/p-C93Q3D_9.js +49 -0
  257. package/dist/components/p-C93Q3D_9.js.map +1 -0
  258. package/dist/components/p-C9AqDCzm.js +58 -0
  259. package/dist/components/p-C9AqDCzm.js.map +1 -0
  260. package/dist/{ls-document-viewer/ls-select-input.entry.js → components/p-CEGQ-SIb.js} +45 -11
  261. package/dist/components/p-CEGQ-SIb.js.map +1 -0
  262. package/dist/components/p-CF583nkL.js +99 -0
  263. package/dist/components/p-CF583nkL.js.map +1 -0
  264. package/dist/components/p-CTraMHE_.js +49 -0
  265. package/dist/components/p-CTraMHE_.js.map +1 -0
  266. package/dist/components/p-CgRZ91kw.js +124 -0
  267. package/dist/components/p-CgRZ91kw.js.map +1 -0
  268. package/dist/{ls-document-viewer/clsx-ChV9xqsO.js → components/p-ChV9xqsO.js} +2 -2
  269. package/dist/components/p-ChV9xqsO.js.map +1 -0
  270. package/dist/{ls-document-viewer/editorUtils-CWtBGPrf.js → components/p-CjicL5jA.js} +13 -8
  271. package/dist/components/p-CjicL5jA.js.map +1 -0
  272. package/dist/components/p-CnIzN0a9.js +49 -0
  273. package/dist/components/p-CnIzN0a9.js.map +1 -0
  274. package/dist/components/p-CpK4mw5O.js +60 -0
  275. package/dist/components/p-CpK4mw5O.js.map +1 -0
  276. package/dist/components/p-Cs6tf1FE.js +34 -0
  277. package/dist/components/p-Cs6tf1FE.js.map +1 -0
  278. package/dist/components/p-Ct78kJaE.js +49 -0
  279. package/dist/components/p-Ct78kJaE.js.map +1 -0
  280. package/dist/components/p-D1o9mMCC.js +105 -0
  281. package/dist/components/p-D1o9mMCC.js.map +1 -0
  282. package/dist/components/p-D2smwTu5.js +82 -0
  283. package/dist/components/p-D2smwTu5.js.map +1 -0
  284. package/dist/components/p-D3GPRslH.js +138 -0
  285. package/dist/components/p-D3GPRslH.js.map +1 -0
  286. package/dist/{ls-document-viewer/ls-number-input.entry.js → components/p-D3p38qOI.js} +48 -11
  287. package/dist/components/p-D3p38qOI.js.map +1 -0
  288. package/dist/components/p-D4wPRNKc.js +86 -0
  289. package/dist/components/p-D4wPRNKc.js.map +1 -0
  290. package/dist/components/p-D7KC-w81.js +97 -0
  291. package/dist/components/p-D7KC-w81.js.map +1 -0
  292. package/dist/components/p-DC7lKZUf.js +49 -0
  293. package/dist/components/p-DC7lKZUf.js.map +1 -0
  294. package/dist/components/p-DTWaVEKo.js +149 -0
  295. package/dist/components/p-DTWaVEKo.js.map +1 -0
  296. package/dist/components/p-DjfDnBZ1.js +1720 -0
  297. package/dist/components/p-DjfDnBZ1.js.map +1 -0
  298. package/dist/{ls-document-viewer/ls-icon.entry.js → components/p-DtHDNV_x.js} +798 -4775
  299. package/dist/components/p-DtHDNV_x.js.map +1 -0
  300. package/dist/components/p-Dxupmj0q.js +63 -0
  301. package/dist/components/p-Dxupmj0q.js.map +1 -0
  302. package/dist/{ls-document-viewer/ls-textarea-input.entry.js → components/p-GHcj9VUq.js} +48 -11
  303. package/dist/components/p-GHcj9VUq.js.map +1 -0
  304. package/dist/{ls-document-viewer/ls-text-input.entry.js → components/p-IGbuOsUA.js} +49 -11
  305. package/dist/components/p-IGbuOsUA.js.map +1 -0
  306. package/dist/components/p-RFw2Bsri.js +72 -0
  307. package/dist/components/p-RFw2Bsri.js.map +1 -0
  308. package/dist/components/p-RoGGAmRf.js +57 -0
  309. package/dist/components/p-RoGGAmRf.js.map +1 -0
  310. package/dist/components/p-pHw5Xziq.js +154 -0
  311. package/dist/components/p-pHw5Xziq.js.map +1 -0
  312. package/dist/components/p-py-rQZsT.js +72 -0
  313. package/dist/components/p-py-rQZsT.js.map +1 -0
  314. package/dist/esm/index-BwkWPcyG.js +1940 -0
  315. package/dist/esm/index-BwkWPcyG.js.map +1 -0
  316. package/dist/esm/index.js +8 -0
  317. package/dist/esm/index.js.map +1 -0
  318. package/dist/esm/loader.js +13 -0
  319. package/dist/esm/loader.js.map +1 -0
  320. package/dist/esm/ls-document-options_35.entry.js +33211 -0
  321. package/dist/esm/ls-document-options_35.entry.js.map +1 -0
  322. package/dist/esm/ls-document-viewer.js +23 -0
  323. package/dist/esm/ls-document-viewer.js.map +1 -0
  324. package/dist/index.cjs.js +1 -0
  325. package/dist/index.js +1 -0
  326. package/dist/ls-document-viewer/defaultPalette-C00GqV9f.js.map +1 -0
  327. package/dist/ls-document-viewer/editorUtils-DbS95k5h.js.map +1 -0
  328. package/dist/ls-document-viewer/index-Db-CNFwu.js.map +1 -0
  329. package/dist/ls-document-viewer/index.esm.js +1 -17
  330. package/dist/ls-document-viewer/ls-document-viewer.css +1 -0
  331. package/dist/ls-document-viewer/ls-document-viewer.entry.esm.js.map +1 -1
  332. package/dist/ls-document-viewer/ls-document-viewer.entry.js +4381 -145
  333. package/dist/ls-document-viewer/ls-document-viewer.entry.js.map +1 -1
  334. package/dist/ls-document-viewer/ls-document-viewer.esm.js +1 -49
  335. package/dist/ls-document-viewer/p-85c0f6fa.entry.js +4907 -0
  336. package/dist/ls-document-viewer/p-85c0f6fa.entry.js.map +1 -0
  337. package/dist/ls-document-viewer/p-BwkWPcyG.js +3 -0
  338. package/dist/ls-document-viewer/p-BwkWPcyG.js.map +1 -0
  339. package/dist/types/components/interfaces/IToolboxField.d.ts +3 -1
  340. package/dist/types/components/ls-document-viewer/adapter/LsDocumentAdapter.d.ts +15 -0
  341. package/dist/types/components/ls-document-viewer/adapter/elementActions.d.ts +4 -0
  342. package/dist/types/components/ls-document-viewer/adapter/parameters.d.ts +11 -0
  343. package/dist/types/components/ls-document-viewer/adapter/roleActions.d.ts +5 -0
  344. package/dist/types/components/ls-document-viewer/adapter/templateActions.d.ts +3 -0
  345. package/dist/types/components/ls-document-viewer/defaultPalette.d.ts +1 -2
  346. package/dist/types/components/ls-document-viewer/editorCalculator.d.ts +1 -1
  347. package/dist/types/components/ls-document-viewer/editorUtils.d.ts +2 -1
  348. package/dist/types/components/ls-document-viewer/ls-document-viewer.d.ts +60 -36
  349. package/dist/types/components/ls-document-viewer/mouseHandlers.d.ts +1 -0
  350. package/dist/types/components/ls-editor-field/ls-editor-field.d.ts +3 -2
  351. package/dist/types/components/ls-feature-column/ls-feature-column.d.ts +3 -3
  352. package/dist/types/components/ls-field-placement/ls-field-placement.d.ts +11 -0
  353. package/dist/types/components/ls-field-properties-autosign/ls-field-properties-autosign.d.ts +5 -0
  354. package/dist/types/components/ls-field-properties-email/ls-field-properties-email.d.ts +5 -0
  355. package/dist/types/components/ls-field-properties-file/ls-field-properties-file.d.ts +5 -0
  356. package/dist/types/components/ls-field-properties-image/ls-field-properties-image.d.ts +5 -0
  357. package/dist/types/components/ls-field-properties-signature/ls-field-properties-signature.d.ts +1 -0
  358. package/dist/types/components/ls-participant-manager/ls-participant-manager.d.ts +4 -3
  359. package/dist/types/components/ls-participant-select/ls-participant-select.d.ts +28 -0
  360. package/dist/types/components/ls-statusbar/ls-statusbar.d.ts +6 -6
  361. package/dist/types/components/ls-toggle/ls-toggle.d.ts +3 -0
  362. package/dist/types/components/ls-toolbar/ls-toolbar.d.ts +11 -7
  363. package/dist/types/components/ls-toolbox-field/ls-toolbox-field.d.ts +6 -1
  364. package/dist/types/components.d.ts +218 -24
  365. package/dist/types/types/Icon.d.ts +1 -0
  366. package/dist/types/types/LSApiElement.d.ts +2 -1
  367. package/dist/types/types/LSApiRole.d.ts +1 -0
  368. package/package.json +2 -2
  369. package/dist/ls-document-viewer/editorUtils-CWtBGPrf.js.map +0 -1
  370. package/dist/ls-document-viewer/index-Cjn1MNt-.js +0 -4334
  371. package/dist/ls-document-viewer/index-Cjn1MNt-.js.map +0 -1
  372. package/dist/ls-document-viewer/ls-document-options.entry.esm.js.map +0 -1
  373. package/dist/ls-document-viewer/ls-document-options.entry.js +0 -29
  374. package/dist/ls-document-viewer/ls-document-options.entry.js.map +0 -1
  375. package/dist/ls-document-viewer/ls-editor-field.entry.esm.js.map +0 -1
  376. package/dist/ls-document-viewer/ls-editor-field.entry.js +0 -120
  377. package/dist/ls-document-viewer/ls-editor-field.entry.js.map +0 -1
  378. package/dist/ls-document-viewer/ls-editor-table.entry.esm.js.map +0 -1
  379. package/dist/ls-document-viewer/ls-editor-table.entry.js +0 -40
  380. package/dist/ls-document-viewer/ls-editor-table.entry.js.map +0 -1
  381. package/dist/ls-document-viewer/ls-feature-column.entry.esm.js.map +0 -1
  382. package/dist/ls-document-viewer/ls-feature-column.entry.js +0 -26
  383. package/dist/ls-document-viewer/ls-feature-column.entry.js.map +0 -1
  384. package/dist/ls-document-viewer/ls-field-alignment.entry.esm.js.map +0 -1
  385. package/dist/ls-document-viewer/ls-field-alignment.entry.js.map +0 -1
  386. package/dist/ls-document-viewer/ls-field-dimensions.entry.esm.js.map +0 -1
  387. package/dist/ls-document-viewer/ls-field-dimensions.entry.js +0 -50
  388. package/dist/ls-document-viewer/ls-field-dimensions.entry.js.map +0 -1
  389. package/dist/ls-document-viewer/ls-field-distribute.entry.esm.js.map +0 -1
  390. package/dist/ls-document-viewer/ls-field-distribute.entry.js +0 -100
  391. package/dist/ls-document-viewer/ls-field-distribute.entry.js.map +0 -1
  392. package/dist/ls-document-viewer/ls-field-format.entry.esm.js.map +0 -1
  393. package/dist/ls-document-viewer/ls-field-format.entry.js +0 -41
  394. package/dist/ls-document-viewer/ls-field-format.entry.js.map +0 -1
  395. package/dist/ls-document-viewer/ls-field-properties-date.entry.esm.js.map +0 -1
  396. package/dist/ls-document-viewer/ls-field-properties-date.entry.js +0 -19
  397. package/dist/ls-document-viewer/ls-field-properties-date.entry.js.map +0 -1
  398. package/dist/ls-document-viewer/ls-field-properties-general.entry.esm.js.map +0 -1
  399. package/dist/ls-document-viewer/ls-field-properties-general.entry.js +0 -19
  400. package/dist/ls-document-viewer/ls-field-properties-general.entry.js.map +0 -1
  401. package/dist/ls-document-viewer/ls-field-properties-multiple.entry.esm.js.map +0 -1
  402. package/dist/ls-document-viewer/ls-field-properties-multiple.entry.js +0 -19
  403. package/dist/ls-document-viewer/ls-field-properties-multiple.entry.js.map +0 -1
  404. package/dist/ls-document-viewer/ls-field-properties-number.entry.esm.js.map +0 -1
  405. package/dist/ls-document-viewer/ls-field-properties-number.entry.js +0 -19
  406. package/dist/ls-document-viewer/ls-field-properties-number.entry.js.map +0 -1
  407. package/dist/ls-document-viewer/ls-field-properties-signature.entry.esm.js.map +0 -1
  408. package/dist/ls-document-viewer/ls-field-properties-signature.entry.js +0 -19
  409. package/dist/ls-document-viewer/ls-field-properties-signature.entry.js.map +0 -1
  410. package/dist/ls-document-viewer/ls-field-properties-text.entry.esm.js.map +0 -1
  411. package/dist/ls-document-viewer/ls-field-properties-text.entry.js +0 -19
  412. package/dist/ls-document-viewer/ls-field-properties-text.entry.js.map +0 -1
  413. package/dist/ls-document-viewer/ls-field-properties.entry.esm.js.map +0 -1
  414. package/dist/ls-document-viewer/ls-field-properties.entry.js +0 -40
  415. package/dist/ls-document-viewer/ls-field-properties.entry.js.map +0 -1
  416. package/dist/ls-document-viewer/ls-field-size.entry.esm.js.map +0 -1
  417. package/dist/ls-document-viewer/ls-field-size.entry.js +0 -33
  418. package/dist/ls-document-viewer/ls-field-size.entry.js.map +0 -1
  419. package/dist/ls-document-viewer/ls-formfield.entry.esm.js.map +0 -1
  420. package/dist/ls-document-viewer/ls-formfield.entry.js +0 -59
  421. package/dist/ls-document-viewer/ls-formfield.entry.js.map +0 -1
  422. package/dist/ls-document-viewer/ls-icon.entry.esm.js.map +0 -1
  423. package/dist/ls-document-viewer/ls-icon.entry.js.map +0 -1
  424. package/dist/ls-document-viewer/ls-number-input.entry.esm.js.map +0 -1
  425. package/dist/ls-document-viewer/ls-number-input.entry.js.map +0 -1
  426. package/dist/ls-document-viewer/ls-participant-manager.entry.esm.js.map +0 -1
  427. package/dist/ls-document-viewer/ls-participant-manager.entry.js +0 -59
  428. package/dist/ls-document-viewer/ls-participant-manager.entry.js.map +0 -1
  429. package/dist/ls-document-viewer/ls-participant-select.entry.esm.js.map +0 -1
  430. package/dist/ls-document-viewer/ls-participant-select.entry.js +0 -18
  431. package/dist/ls-document-viewer/ls-participant-select.entry.js.map +0 -1
  432. package/dist/ls-document-viewer/ls-radio-input.entry.esm.js.map +0 -1
  433. package/dist/ls-document-viewer/ls-radio-input.entry.js +0 -28
  434. package/dist/ls-document-viewer/ls-radio-input.entry.js.map +0 -1
  435. package/dist/ls-document-viewer/ls-select-input.entry.esm.js.map +0 -1
  436. package/dist/ls-document-viewer/ls-select-input.entry.js.map +0 -1
  437. package/dist/ls-document-viewer/ls-statusbar.entry.esm.js.map +0 -1
  438. package/dist/ls-document-viewer/ls-statusbar.entry.js +0 -52
  439. package/dist/ls-document-viewer/ls-statusbar.entry.js.map +0 -1
  440. package/dist/ls-document-viewer/ls-text-input.entry.esm.js.map +0 -1
  441. package/dist/ls-document-viewer/ls-text-input.entry.js.map +0 -1
  442. package/dist/ls-document-viewer/ls-textarea-input.entry.esm.js.map +0 -1
  443. package/dist/ls-document-viewer/ls-textarea-input.entry.js.map +0 -1
  444. package/dist/ls-document-viewer/ls-toolbar.entry.esm.js.map +0 -1
  445. package/dist/ls-document-viewer/ls-toolbar.entry.js +0 -36
  446. package/dist/ls-document-viewer/ls-toolbar.entry.js.map +0 -1
  447. package/dist/ls-document-viewer/ls-toolbox-field.entry.esm.js.map +0 -1
  448. package/dist/ls-document-viewer/ls-toolbox-field.entry.js +0 -52
  449. package/dist/ls-document-viewer/ls-toolbox-field.entry.js.map +0 -1
@@ -1,5 +1,6 @@
1
- import { r as registerInstance, a as createEvent, d as getElement, h, e as Host } from './index-Cjn1MNt-.js';
2
- import { a as alter, o as oob, g as getApiType } from './editorUtils-CWtBGPrf.js';
1
+ import { r as registerInstance, a as createEvent, d as getElement, h, e as Host } from './index-Db-CNFwu.js';
2
+ import { d as defaultRolePalette } from './defaultPalette-C00GqV9f.js';
3
+ import { a as alter, o as oob, m as matchData, g as getApiType } from './editorUtils-DbS95k5h.js';
3
4
 
4
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
6
 
@@ -19966,6 +19967,9 @@ function addField(frame, data) {
19966
19967
  node.style.left = Math.floor(data.left * this.zoom) + 'px';
19967
19968
  node.style.height = Math.floor(data.height * this.zoom) + 'px';
19968
19969
  node.style.width = Math.floor(data.width * this.zoom) + 'px';
19970
+ node.style.fontSize = Math.floor(data.fontSize) + 'pt';
19971
+ node.style.alignContent = data.align;
19972
+ node.style.fontFamily = data.fontName;
19969
19973
  node.dataItem = data;
19970
19974
  frame.appendChild(node);
19971
19975
  return node;
@@ -19976,6 +19980,9 @@ function moveField(item, data) {
19976
19980
  item.style.left = Math.floor(data.left * this.zoom) + 'px';
19977
19981
  item.style.height = Math.floor(data.height * this.zoom) + 'px';
19978
19982
  item.style.width = Math.floor(data.width * this.zoom) + 'px';
19983
+ item.style.fontSize = Math.floor(data.fontSize) + 'pt';
19984
+ item.style.fontFamily = data.fontName;
19985
+ item.style.textAlign = data.align;
19979
19986
  item.dataItem = data;
19980
19987
  }
19981
19988
  ;
@@ -20017,18 +20024,30 @@ const transformCoordinates = (sourceField, inputFieldWidth, inputFieldHeight, vi
20017
20024
  };
20018
20025
  };
20019
20026
  // from a field element get all dimension data including LEGACY dimensions
20020
- const findDimensions = (frameContainer, sourceField, pageHeight, pageWidth) => {
20027
+ const findDimensions = (frameContainer, sourceField, pageHeight, pageWidth, zoom) => {
20021
20028
  // Position of widget frame
20022
20029
  const frmDims = frameContainer.getBoundingClientRect();
20023
20030
  // dimensions relative to viewport
20024
20031
  const { height, width } = sourceField.getBoundingClientRect();
20025
- const top = sourceField.getBoundingClientRect().top - frmDims.top;
20026
- const left = sourceField.getBoundingClientRect().left - frmDims.left;
20032
+ const zwidth = width / zoom;
20033
+ const zheight = height / zoom;
20034
+ const top = Math.floor((sourceField.getBoundingClientRect().top - frmDims.top) / zoom);
20035
+ const left = Math.floor((sourceField.getBoundingClientRect().left - frmDims.left) / zoom);
20027
20036
  // Returns X, Y coordinates
20028
20037
  const ax = left > 0 ? left / pageWidth : 0;
20029
20038
  const ay = top > 0 ? top / pageHeight : 0;
20030
- const bx = (left + width) / pageWidth;
20031
- const by = (top + height) / pageHeight;
20039
+ const bx = (left + zwidth) / pageWidth;
20040
+ const by = (top + zheight) / pageHeight;
20041
+ console.log({
20042
+ top,
20043
+ left,
20044
+ zheight,
20045
+ zwidth,
20046
+ ax,
20047
+ ay,
20048
+ bx,
20049
+ by,
20050
+ });
20032
20051
  // Return with calculated styles that try to place it as it would appear on legacy signing page
20033
20052
  return {
20034
20053
  top,
@@ -20042,32 +20061,11 @@ const findDimensions = (frameContainer, sourceField, pageHeight, pageWidth) => {
20042
20061
  };
20043
20062
  };
20044
20063
 
20045
- const defaultRolePalette = [
20046
- { primary: 'rgb(50, 124, 244)', faded: 'rgb(240, 246, 255)' },
20047
- { primary: 'rgb(70, 219, 170)', faded: 'rgb(239, 255, 249)' },
20048
- { primary: 'rgb(240, 182, 24)', faded: 'rgb(255, 252, 239)' },
20049
- { primary: 'rgb(238, 229, 255)', faded: 'rgb(244, 240, 255)' },
20050
- { primary: 'rgb(240, 86, 178)', faded: 'rgb(255, 240, 249)' },
20051
- { primary: 'rgb(189, 240, 86)', faded: 'rgb(250, 255, 240)' },
20052
- { primary: 'rgb(246, 74, 68)', faded: 'rgb(246, 190, 188)' },
20053
- { primary: 'rgb(58, 0, 166)', faded: 'rgb(188, 169, 240)' },
20054
- { primary: 'rgba(1, 179, 34, 0.69)', faded: 'rgb(135, 173, 158)' },
20055
- { primary: 'rgb(201, 204, 0)', faded: 'rgba(246, 247, 203, 0.77)' },
20056
- { primary: 'rgb(249, 55, 129)', faded: 'rgb(255, 237, 244)' },
20057
- { primary: 'rgb(0, 14, 166)', faded: 'rgb(209, 212, 243)' },
20058
- { primary: 'rgb(135, 173, 158)', faded: 'rgb(205, 244, 228)' },
20059
- { primary: 'rgb(86, 199, 240)', faded: 'rgb(202, 236, 248)' },
20060
- { primary: 'rgb(246, 205, 68)', faded: 'rgb(244, 240, 255)' },
20061
- { primary: 'rgb(0, 94, 166)', faded: 'rgb(188, 169, 240)' },
20062
- { primary: 'rgba(179, 1, 63, 0.69)', faded: 'rgb(135, 173, 158)' }
20063
- ];
20064
-
20065
20064
  function keyDown(ev) {
20066
20065
  if (this.selected && this.selected?.length > 0) {
20067
20066
  // utils need binding to the context
20068
20067
  const altbound = alter.bind(this);
20069
20068
  if (ev.key === 'ArrowDown') {
20070
- console.log('down arrow pressed');
20071
20069
  altbound(original => {
20072
20070
  const alterElement = {
20073
20071
  ...original,
@@ -20079,7 +20077,6 @@ function keyDown(ev) {
20079
20077
  });
20080
20078
  }
20081
20079
  else if (ev.key === 'ArrowUp') {
20082
- console.log('up arrow pressed');
20083
20080
  altbound(original => {
20084
20081
  const alterElement = {
20085
20082
  ...original,
@@ -20091,7 +20088,6 @@ function keyDown(ev) {
20091
20088
  });
20092
20089
  }
20093
20090
  else if (ev.key === 'ArrowRight') {
20094
- console.log('right arrow pressed');
20095
20091
  altbound(original => {
20096
20092
  const alterElement = {
20097
20093
  ...original,
@@ -20103,7 +20099,6 @@ function keyDown(ev) {
20103
20099
  });
20104
20100
  }
20105
20101
  else if (ev.key === 'ArrowLeft') {
20106
- console.log('left arrow pressed');
20107
20102
  altbound(original => {
20108
20103
  const alterElement = {
20109
20104
  ...original,
@@ -20116,6 +20111,9 @@ function keyDown(ev) {
20116
20111
  }
20117
20112
  else if (ev.key === 'Delete') {
20118
20113
  const arr = Array.from(this.selected);
20114
+ this.mutate.emit(arr.map(s => {
20115
+ return { action: 'delete', data: s.dataItem };
20116
+ }));
20119
20117
  this.update.emit(arr.map(s => {
20120
20118
  return { action: 'delete', data: s.dataItem };
20121
20119
  }));
@@ -20263,7 +20261,7 @@ function mouseClick(e) {
20263
20261
  // Calculate new positions and update the dataItem on the control
20264
20262
  const delta = {
20265
20263
  ...fx.dataItem,
20266
- ...findDimensions(divFrame, fx, this.pageDimensions[this.pageNum - 1].height, this.pageDimensions[this.pageNum - 1].width),
20264
+ ...findDimensions(divFrame, fx, this.pageDimensions[this.pageNum - 1].height, this.pageDimensions[this.pageNum - 1].width, this.zoom),
20267
20265
  };
20268
20266
  // TODO:: out of bounds handler (UNDO)
20269
20267
  // update the data in the html element
@@ -20290,8 +20288,4219 @@ function mouseClick(e) {
20290
20288
  this.selectFields.emit(this.selected.map(fx => fx.dataItem));
20291
20289
  }
20292
20290
  }
20291
+ function mouseDrop(event) {
20292
+ event.preventDefault();
20293
+ try {
20294
+ const data = JSON.parse(event.dataTransfer.getData("application/json"));
20295
+ // Unselect all current selected items
20296
+ this.component.shadowRoot.querySelectorAll('ls-editor-field').forEach(f => f.selected = false);
20297
+ var frame = this.component.shadowRoot.getElementById('ls-document-frame');
20298
+ // Make a new API compatible id for a template element (prefix 'ele')
20299
+ const id = btoa('ele' + crypto.randomUUID());
20300
+ const top = event.offsetY * this.zoom + frame.scrollTop;
20301
+ const left = event.offsetX * this.zoom + frame.scrollLeft;
20302
+ // TODO: Put these defaults somewhere sensible
20303
+ const newData = {
20304
+ action: 'create', data: {
20305
+ id,
20306
+ value: "",
20307
+ formElementType: data.formElementType,
20308
+ elementType: data.elementType,
20309
+ validation: data.validation,
20310
+ substantive: false,
20311
+ top,
20312
+ left,
20313
+ hideBorder: false,
20314
+ height: data.defaultHeight,
20315
+ width: data.defaultWidth,
20316
+ pageDimensions: this.pageDimensions[this.pageNum - 1],
20317
+ fontName: "arial",
20318
+ fontSize: 10,
20319
+ align: 'left',
20320
+ signer: this.signer,
20321
+ page: this.pageNum,
20322
+ mapTo: null,
20323
+ label: '',
20324
+ helpText: null,
20325
+ logicGroup: null,
20326
+ optional: false,
20327
+ options: null,
20328
+ logicAction: null,
20329
+ labelExtra: null,
20330
+ fieldOrder: null,
20331
+ ax: left > 0 ? left / this.pageDimensions[this.pageNum - 1].width : 0,
20332
+ ay: top > 0 ? top / this.pageDimensions[this.pageNum - 1].height : 0,
20333
+ bx: (left + data.defaultWidth) / this.pageDimensions[this.pageNum - 1].width,
20334
+ by: (top + data.defaultHeight) / this.pageDimensions[this.pageNum - 1].height,
20335
+ templateId: this._template.id
20336
+ }
20337
+ };
20338
+ console.log(newData);
20339
+ this.mutate.emit([newData]);
20340
+ this.update.emit([newData]);
20341
+ }
20342
+ catch (e) {
20343
+ console.error(e);
20344
+ }
20345
+ }
20346
+
20347
+ /*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */
20348
+
20349
+ var axios_1;
20350
+ var hasRequiredAxios;
20351
+
20352
+ function requireAxios () {
20353
+ if (hasRequiredAxios) return axios_1;
20354
+ hasRequiredAxios = 1;
20355
+ 'use strict';
20356
+
20357
+ function bind(fn, thisArg) {
20358
+ return function wrap() {
20359
+ return fn.apply(thisArg, arguments);
20360
+ };
20361
+ }
20362
+
20363
+ // utils is a library of generic helper functions non-specific to axios
20364
+
20365
+ const {toString} = Object.prototype;
20366
+ const {getPrototypeOf} = Object;
20367
+ const {iterator, toStringTag} = Symbol;
20368
+
20369
+ const kindOf = (cache => thing => {
20370
+ const str = toString.call(thing);
20371
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
20372
+ })(Object.create(null));
20373
+
20374
+ const kindOfTest = (type) => {
20375
+ type = type.toLowerCase();
20376
+ return (thing) => kindOf(thing) === type
20377
+ };
20378
+
20379
+ const typeOfTest = type => thing => typeof thing === type;
20380
+
20381
+ /**
20382
+ * Determine if a value is an Array
20383
+ *
20384
+ * @param {Object} val The value to test
20385
+ *
20386
+ * @returns {boolean} True if value is an Array, otherwise false
20387
+ */
20388
+ const {isArray} = Array;
20389
+
20390
+ /**
20391
+ * Determine if a value is undefined
20392
+ *
20393
+ * @param {*} val The value to test
20394
+ *
20395
+ * @returns {boolean} True if the value is undefined, otherwise false
20396
+ */
20397
+ const isUndefined = typeOfTest('undefined');
20398
+
20399
+ /**
20400
+ * Determine if a value is a Buffer
20401
+ *
20402
+ * @param {*} val The value to test
20403
+ *
20404
+ * @returns {boolean} True if value is a Buffer, otherwise false
20405
+ */
20406
+ function isBuffer(val) {
20407
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
20408
+ && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
20409
+ }
20410
+
20411
+ /**
20412
+ * Determine if a value is an ArrayBuffer
20413
+ *
20414
+ * @param {*} val The value to test
20415
+ *
20416
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
20417
+ */
20418
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
20419
+
20420
+
20421
+ /**
20422
+ * Determine if a value is a view on an ArrayBuffer
20423
+ *
20424
+ * @param {*} val The value to test
20425
+ *
20426
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
20427
+ */
20428
+ function isArrayBufferView(val) {
20429
+ let result;
20430
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
20431
+ result = ArrayBuffer.isView(val);
20432
+ } else {
20433
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
20434
+ }
20435
+ return result;
20436
+ }
20437
+
20438
+ /**
20439
+ * Determine if a value is a String
20440
+ *
20441
+ * @param {*} val The value to test
20442
+ *
20443
+ * @returns {boolean} True if value is a String, otherwise false
20444
+ */
20445
+ const isString = typeOfTest('string');
20446
+
20447
+ /**
20448
+ * Determine if a value is a Function
20449
+ *
20450
+ * @param {*} val The value to test
20451
+ * @returns {boolean} True if value is a Function, otherwise false
20452
+ */
20453
+ const isFunction$1 = typeOfTest('function');
20454
+
20455
+ /**
20456
+ * Determine if a value is a Number
20457
+ *
20458
+ * @param {*} val The value to test
20459
+ *
20460
+ * @returns {boolean} True if value is a Number, otherwise false
20461
+ */
20462
+ const isNumber = typeOfTest('number');
20463
+
20464
+ /**
20465
+ * Determine if a value is an Object
20466
+ *
20467
+ * @param {*} thing The value to test
20468
+ *
20469
+ * @returns {boolean} True if value is an Object, otherwise false
20470
+ */
20471
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
20472
+
20473
+ /**
20474
+ * Determine if a value is a Boolean
20475
+ *
20476
+ * @param {*} thing The value to test
20477
+ * @returns {boolean} True if value is a Boolean, otherwise false
20478
+ */
20479
+ const isBoolean = thing => thing === true || thing === false;
20480
+
20481
+ /**
20482
+ * Determine if a value is a plain Object
20483
+ *
20484
+ * @param {*} val The value to test
20485
+ *
20486
+ * @returns {boolean} True if value is a plain Object, otherwise false
20487
+ */
20488
+ const isPlainObject = (val) => {
20489
+ if (kindOf(val) !== 'object') {
20490
+ return false;
20491
+ }
20492
+
20493
+ const prototype = getPrototypeOf(val);
20494
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
20495
+ };
20496
+
20497
+ /**
20498
+ * Determine if a value is an empty object (safely handles Buffers)
20499
+ *
20500
+ * @param {*} val The value to test
20501
+ *
20502
+ * @returns {boolean} True if value is an empty object, otherwise false
20503
+ */
20504
+ const isEmptyObject = (val) => {
20505
+ // Early return for non-objects or Buffers to prevent RangeError
20506
+ if (!isObject(val) || isBuffer(val)) {
20507
+ return false;
20508
+ }
20509
+
20510
+ try {
20511
+ return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
20512
+ } catch (e) {
20513
+ // Fallback for any other objects that might cause RangeError with Object.keys()
20514
+ return false;
20515
+ }
20516
+ };
20517
+
20518
+ /**
20519
+ * Determine if a value is a Date
20520
+ *
20521
+ * @param {*} val The value to test
20522
+ *
20523
+ * @returns {boolean} True if value is a Date, otherwise false
20524
+ */
20525
+ const isDate = kindOfTest('Date');
20526
+
20527
+ /**
20528
+ * Determine if a value is a File
20529
+ *
20530
+ * @param {*} val The value to test
20531
+ *
20532
+ * @returns {boolean} True if value is a File, otherwise false
20533
+ */
20534
+ const isFile = kindOfTest('File');
20535
+
20536
+ /**
20537
+ * Determine if a value is a Blob
20538
+ *
20539
+ * @param {*} val The value to test
20540
+ *
20541
+ * @returns {boolean} True if value is a Blob, otherwise false
20542
+ */
20543
+ const isBlob = kindOfTest('Blob');
20544
+
20545
+ /**
20546
+ * Determine if a value is a FileList
20547
+ *
20548
+ * @param {*} val The value to test
20549
+ *
20550
+ * @returns {boolean} True if value is a File, otherwise false
20551
+ */
20552
+ const isFileList = kindOfTest('FileList');
20553
+
20554
+ /**
20555
+ * Determine if a value is a Stream
20556
+ *
20557
+ * @param {*} val The value to test
20558
+ *
20559
+ * @returns {boolean} True if value is a Stream, otherwise false
20560
+ */
20561
+ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
20562
+
20563
+ /**
20564
+ * Determine if a value is a FormData
20565
+ *
20566
+ * @param {*} thing The value to test
20567
+ *
20568
+ * @returns {boolean} True if value is an FormData, otherwise false
20569
+ */
20570
+ const isFormData = (thing) => {
20571
+ let kind;
20572
+ return thing && (
20573
+ (typeof FormData === 'function' && thing instanceof FormData) || (
20574
+ isFunction$1(thing.append) && (
20575
+ (kind = kindOf(thing)) === 'formdata' ||
20576
+ // detect form-data instance
20577
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
20578
+ )
20579
+ )
20580
+ )
20581
+ };
20582
+
20583
+ /**
20584
+ * Determine if a value is a URLSearchParams object
20585
+ *
20586
+ * @param {*} val The value to test
20587
+ *
20588
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
20589
+ */
20590
+ const isURLSearchParams = kindOfTest('URLSearchParams');
20591
+
20592
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
20593
+
20594
+ /**
20595
+ * Trim excess whitespace off the beginning and end of a string
20596
+ *
20597
+ * @param {String} str The String to trim
20598
+ *
20599
+ * @returns {String} The String freed of excess whitespace
20600
+ */
20601
+ const trim = (str) => str.trim ?
20602
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
20603
+
20604
+ /**
20605
+ * Iterate over an Array or an Object invoking a function for each item.
20606
+ *
20607
+ * If `obj` is an Array callback will be called passing
20608
+ * the value, index, and complete array for each item.
20609
+ *
20610
+ * If 'obj' is an Object callback will be called passing
20611
+ * the value, key, and complete object for each property.
20612
+ *
20613
+ * @param {Object|Array} obj The object to iterate
20614
+ * @param {Function} fn The callback to invoke for each item
20615
+ *
20616
+ * @param {Boolean} [allOwnKeys = false]
20617
+ * @returns {any}
20618
+ */
20619
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
20620
+ // Don't bother if no value provided
20621
+ if (obj === null || typeof obj === 'undefined') {
20622
+ return;
20623
+ }
20624
+
20625
+ let i;
20626
+ let l;
20627
+
20628
+ // Force an array if not already something iterable
20629
+ if (typeof obj !== 'object') {
20630
+ /*eslint no-param-reassign:0*/
20631
+ obj = [obj];
20632
+ }
20633
+
20634
+ if (isArray(obj)) {
20635
+ // Iterate over array values
20636
+ for (i = 0, l = obj.length; i < l; i++) {
20637
+ fn.call(null, obj[i], i, obj);
20638
+ }
20639
+ } else {
20640
+ // Buffer check
20641
+ if (isBuffer(obj)) {
20642
+ return;
20643
+ }
20644
+
20645
+ // Iterate over object keys
20646
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
20647
+ const len = keys.length;
20648
+ let key;
20649
+
20650
+ for (i = 0; i < len; i++) {
20651
+ key = keys[i];
20652
+ fn.call(null, obj[key], key, obj);
20653
+ }
20654
+ }
20655
+ }
20656
+
20657
+ function findKey(obj, key) {
20658
+ if (isBuffer(obj)){
20659
+ return null;
20660
+ }
20661
+
20662
+ key = key.toLowerCase();
20663
+ const keys = Object.keys(obj);
20664
+ let i = keys.length;
20665
+ let _key;
20666
+ while (i-- > 0) {
20667
+ _key = keys[i];
20668
+ if (key === _key.toLowerCase()) {
20669
+ return _key;
20670
+ }
20671
+ }
20672
+ return null;
20673
+ }
20674
+
20675
+ const _global = (() => {
20676
+ /*eslint no-undef:0*/
20677
+ if (typeof globalThis !== "undefined") return globalThis;
20678
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : commonjsGlobal)
20679
+ })();
20680
+
20681
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
20682
+
20683
+ /**
20684
+ * Accepts varargs expecting each argument to be an object, then
20685
+ * immutably merges the properties of each object and returns result.
20686
+ *
20687
+ * When multiple objects contain the same key the later object in
20688
+ * the arguments list will take precedence.
20689
+ *
20690
+ * Example:
20691
+ *
20692
+ * ```js
20693
+ * var result = merge({foo: 123}, {foo: 456});
20694
+ * console.log(result.foo); // outputs 456
20695
+ * ```
20696
+ *
20697
+ * @param {Object} obj1 Object to merge
20698
+ *
20699
+ * @returns {Object} Result of all merge properties
20700
+ */
20701
+ function merge(/* obj1, obj2, obj3, ... */) {
20702
+ const {caseless, skipUndefined} = isContextDefined(this) && this || {};
20703
+ const result = {};
20704
+ const assignValue = (val, key) => {
20705
+ const targetKey = caseless && findKey(result, key) || key;
20706
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
20707
+ result[targetKey] = merge(result[targetKey], val);
20708
+ } else if (isPlainObject(val)) {
20709
+ result[targetKey] = merge({}, val);
20710
+ } else if (isArray(val)) {
20711
+ result[targetKey] = val.slice();
20712
+ } else if (!skipUndefined || !isUndefined(val)) {
20713
+ result[targetKey] = val;
20714
+ }
20715
+ };
20716
+
20717
+ for (let i = 0, l = arguments.length; i < l; i++) {
20718
+ arguments[i] && forEach(arguments[i], assignValue);
20719
+ }
20720
+ return result;
20721
+ }
20722
+
20723
+ /**
20724
+ * Extends object a by mutably adding to it the properties of object b.
20725
+ *
20726
+ * @param {Object} a The object to be extended
20727
+ * @param {Object} b The object to copy properties from
20728
+ * @param {Object} thisArg The object to bind function to
20729
+ *
20730
+ * @param {Boolean} [allOwnKeys]
20731
+ * @returns {Object} The resulting value of object a
20732
+ */
20733
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
20734
+ forEach(b, (val, key) => {
20735
+ if (thisArg && isFunction$1(val)) {
20736
+ a[key] = bind(val, thisArg);
20737
+ } else {
20738
+ a[key] = val;
20739
+ }
20740
+ }, {allOwnKeys});
20741
+ return a;
20742
+ };
20743
+
20744
+ /**
20745
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
20746
+ *
20747
+ * @param {string} content with BOM
20748
+ *
20749
+ * @returns {string} content value without BOM
20750
+ */
20751
+ const stripBOM = (content) => {
20752
+ if (content.charCodeAt(0) === 0xFEFF) {
20753
+ content = content.slice(1);
20754
+ }
20755
+ return content;
20756
+ };
20757
+
20758
+ /**
20759
+ * Inherit the prototype methods from one constructor into another
20760
+ * @param {function} constructor
20761
+ * @param {function} superConstructor
20762
+ * @param {object} [props]
20763
+ * @param {object} [descriptors]
20764
+ *
20765
+ * @returns {void}
20766
+ */
20767
+ const inherits = (constructor, superConstructor, props, descriptors) => {
20768
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
20769
+ constructor.prototype.constructor = constructor;
20770
+ Object.defineProperty(constructor, 'super', {
20771
+ value: superConstructor.prototype
20772
+ });
20773
+ props && Object.assign(constructor.prototype, props);
20774
+ };
20775
+
20776
+ /**
20777
+ * Resolve object with deep prototype chain to a flat object
20778
+ * @param {Object} sourceObj source object
20779
+ * @param {Object} [destObj]
20780
+ * @param {Function|Boolean} [filter]
20781
+ * @param {Function} [propFilter]
20782
+ *
20783
+ * @returns {Object}
20784
+ */
20785
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
20786
+ let props;
20787
+ let i;
20788
+ let prop;
20789
+ const merged = {};
20790
+
20791
+ destObj = destObj || {};
20792
+ // eslint-disable-next-line no-eq-null,eqeqeq
20793
+ if (sourceObj == null) return destObj;
20794
+
20795
+ do {
20796
+ props = Object.getOwnPropertyNames(sourceObj);
20797
+ i = props.length;
20798
+ while (i-- > 0) {
20799
+ prop = props[i];
20800
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
20801
+ destObj[prop] = sourceObj[prop];
20802
+ merged[prop] = true;
20803
+ }
20804
+ }
20805
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
20806
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
20807
+
20808
+ return destObj;
20809
+ };
20810
+
20811
+ /**
20812
+ * Determines whether a string ends with the characters of a specified string
20813
+ *
20814
+ * @param {String} str
20815
+ * @param {String} searchString
20816
+ * @param {Number} [position= 0]
20817
+ *
20818
+ * @returns {boolean}
20819
+ */
20820
+ const endsWith = (str, searchString, position) => {
20821
+ str = String(str);
20822
+ if (position === undefined || position > str.length) {
20823
+ position = str.length;
20824
+ }
20825
+ position -= searchString.length;
20826
+ const lastIndex = str.indexOf(searchString, position);
20827
+ return lastIndex !== -1 && lastIndex === position;
20828
+ };
20829
+
20830
+
20831
+ /**
20832
+ * Returns new array from array like object or null if failed
20833
+ *
20834
+ * @param {*} [thing]
20835
+ *
20836
+ * @returns {?Array}
20837
+ */
20838
+ const toArray = (thing) => {
20839
+ if (!thing) return null;
20840
+ if (isArray(thing)) return thing;
20841
+ let i = thing.length;
20842
+ if (!isNumber(i)) return null;
20843
+ const arr = new Array(i);
20844
+ while (i-- > 0) {
20845
+ arr[i] = thing[i];
20846
+ }
20847
+ return arr;
20848
+ };
20849
+
20850
+ /**
20851
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
20852
+ * thing passed in is an instance of Uint8Array
20853
+ *
20854
+ * @param {TypedArray}
20855
+ *
20856
+ * @returns {Array}
20857
+ */
20858
+ // eslint-disable-next-line func-names
20859
+ const isTypedArray = (TypedArray => {
20860
+ // eslint-disable-next-line func-names
20861
+ return thing => {
20862
+ return TypedArray && thing instanceof TypedArray;
20863
+ };
20864
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
20865
+
20866
+ /**
20867
+ * For each entry in the object, call the function with the key and value.
20868
+ *
20869
+ * @param {Object<any, any>} obj - The object to iterate over.
20870
+ * @param {Function} fn - The function to call for each entry.
20871
+ *
20872
+ * @returns {void}
20873
+ */
20874
+ const forEachEntry = (obj, fn) => {
20875
+ const generator = obj && obj[iterator];
20876
+
20877
+ const _iterator = generator.call(obj);
20878
+
20879
+ let result;
20880
+
20881
+ while ((result = _iterator.next()) && !result.done) {
20882
+ const pair = result.value;
20883
+ fn.call(obj, pair[0], pair[1]);
20884
+ }
20885
+ };
20886
+
20887
+ /**
20888
+ * It takes a regular expression and a string, and returns an array of all the matches
20889
+ *
20890
+ * @param {string} regExp - The regular expression to match against.
20891
+ * @param {string} str - The string to search.
20892
+ *
20893
+ * @returns {Array<boolean>}
20894
+ */
20895
+ const matchAll = (regExp, str) => {
20896
+ let matches;
20897
+ const arr = [];
20898
+
20899
+ while ((matches = regExp.exec(str)) !== null) {
20900
+ arr.push(matches);
20901
+ }
20902
+
20903
+ return arr;
20904
+ };
20905
+
20906
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
20907
+ const isHTMLForm = kindOfTest('HTMLFormElement');
20908
+
20909
+ const toCamelCase = str => {
20910
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
20911
+ function replacer(m, p1, p2) {
20912
+ return p1.toUpperCase() + p2;
20913
+ }
20914
+ );
20915
+ };
20916
+
20917
+ /* Creating a function that will check if an object has a property. */
20918
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
20919
+
20920
+ /**
20921
+ * Determine if a value is a RegExp object
20922
+ *
20923
+ * @param {*} val The value to test
20924
+ *
20925
+ * @returns {boolean} True if value is a RegExp object, otherwise false
20926
+ */
20927
+ const isRegExp = kindOfTest('RegExp');
20928
+
20929
+ const reduceDescriptors = (obj, reducer) => {
20930
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
20931
+ const reducedDescriptors = {};
20932
+
20933
+ forEach(descriptors, (descriptor, name) => {
20934
+ let ret;
20935
+ if ((ret = reducer(descriptor, name, obj)) !== false) {
20936
+ reducedDescriptors[name] = ret || descriptor;
20937
+ }
20938
+ });
20939
+
20940
+ Object.defineProperties(obj, reducedDescriptors);
20941
+ };
20942
+
20943
+ /**
20944
+ * Makes all methods read-only
20945
+ * @param {Object} obj
20946
+ */
20947
+
20948
+ const freezeMethods = (obj) => {
20949
+ reduceDescriptors(obj, (descriptor, name) => {
20950
+ // skip restricted props in strict mode
20951
+ if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
20952
+ return false;
20953
+ }
20954
+
20955
+ const value = obj[name];
20956
+
20957
+ if (!isFunction$1(value)) return;
20958
+
20959
+ descriptor.enumerable = false;
20960
+
20961
+ if ('writable' in descriptor) {
20962
+ descriptor.writable = false;
20963
+ return;
20964
+ }
20965
+
20966
+ if (!descriptor.set) {
20967
+ descriptor.set = () => {
20968
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
20969
+ };
20970
+ }
20971
+ });
20972
+ };
20973
+
20974
+ const toObjectSet = (arrayOrString, delimiter) => {
20975
+ const obj = {};
20976
+
20977
+ const define = (arr) => {
20978
+ arr.forEach(value => {
20979
+ obj[value] = true;
20980
+ });
20981
+ };
20982
+
20983
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
20984
+
20985
+ return obj;
20986
+ };
20987
+
20988
+ const noop = () => {};
20989
+
20990
+ const toFiniteNumber = (value, defaultValue) => {
20991
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
20992
+ };
20993
+
20994
+
20995
+
20996
+ /**
20997
+ * If the thing is a FormData object, return true, otherwise return false.
20998
+ *
20999
+ * @param {unknown} thing - The thing to check.
21000
+ *
21001
+ * @returns {boolean}
21002
+ */
21003
+ function isSpecCompliantForm(thing) {
21004
+ return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
21005
+ }
21006
+
21007
+ const toJSONObject = (obj) => {
21008
+ const stack = new Array(10);
21009
+
21010
+ const visit = (source, i) => {
21011
+
21012
+ if (isObject(source)) {
21013
+ if (stack.indexOf(source) >= 0) {
21014
+ return;
21015
+ }
21016
+
21017
+ //Buffer check
21018
+ if (isBuffer(source)) {
21019
+ return source;
21020
+ }
21021
+
21022
+ if(!('toJSON' in source)) {
21023
+ stack[i] = source;
21024
+ const target = isArray(source) ? [] : {};
21025
+
21026
+ forEach(source, (value, key) => {
21027
+ const reducedValue = visit(value, i + 1);
21028
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
21029
+ });
21030
+
21031
+ stack[i] = undefined;
21032
+
21033
+ return target;
21034
+ }
21035
+ }
21036
+
21037
+ return source;
21038
+ };
21039
+
21040
+ return visit(obj, 0);
21041
+ };
21042
+
21043
+ const isAsyncFn = kindOfTest('AsyncFunction');
21044
+
21045
+ const isThenable = (thing) =>
21046
+ thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
21047
+
21048
+ // original code
21049
+ // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
21050
+
21051
+ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
21052
+ if (setImmediateSupported) {
21053
+ return setImmediate;
21054
+ }
21055
+
21056
+ return postMessageSupported ? ((token, callbacks) => {
21057
+ _global.addEventListener("message", ({source, data}) => {
21058
+ if (source === _global && data === token) {
21059
+ callbacks.length && callbacks.shift()();
21060
+ }
21061
+ }, false);
21062
+
21063
+ return (cb) => {
21064
+ callbacks.push(cb);
21065
+ _global.postMessage(token, "*");
21066
+ }
21067
+ })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
21068
+ })(
21069
+ typeof setImmediate === 'function',
21070
+ isFunction$1(_global.postMessage)
21071
+ );
21072
+
21073
+ const asap = typeof queueMicrotask !== 'undefined' ?
21074
+ queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
21075
+
21076
+ // *********************
21077
+
21078
+
21079
+ const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
21080
+
21081
+
21082
+ var utils$1 = {
21083
+ isArray,
21084
+ isArrayBuffer,
21085
+ isBuffer,
21086
+ isFormData,
21087
+ isArrayBufferView,
21088
+ isString,
21089
+ isNumber,
21090
+ isBoolean,
21091
+ isObject,
21092
+ isPlainObject,
21093
+ isEmptyObject,
21094
+ isReadableStream,
21095
+ isRequest,
21096
+ isResponse,
21097
+ isHeaders,
21098
+ isUndefined,
21099
+ isDate,
21100
+ isFile,
21101
+ isBlob,
21102
+ isRegExp,
21103
+ isFunction: isFunction$1,
21104
+ isStream,
21105
+ isURLSearchParams,
21106
+ isTypedArray,
21107
+ isFileList,
21108
+ forEach,
21109
+ merge,
21110
+ extend,
21111
+ trim,
21112
+ stripBOM,
21113
+ inherits,
21114
+ toFlatObject,
21115
+ kindOf,
21116
+ kindOfTest,
21117
+ endsWith,
21118
+ toArray,
21119
+ forEachEntry,
21120
+ matchAll,
21121
+ isHTMLForm,
21122
+ hasOwnProperty,
21123
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
21124
+ reduceDescriptors,
21125
+ freezeMethods,
21126
+ toObjectSet,
21127
+ toCamelCase,
21128
+ noop,
21129
+ toFiniteNumber,
21130
+ findKey,
21131
+ global: _global,
21132
+ isContextDefined,
21133
+ isSpecCompliantForm,
21134
+ toJSONObject,
21135
+ isAsyncFn,
21136
+ isThenable,
21137
+ setImmediate: _setImmediate,
21138
+ asap,
21139
+ isIterable
21140
+ };
21141
+
21142
+ /**
21143
+ * Create an Error with the specified message, config, error code, request and response.
21144
+ *
21145
+ * @param {string} message The error message.
21146
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
21147
+ * @param {Object} [config] The config.
21148
+ * @param {Object} [request] The request.
21149
+ * @param {Object} [response] The response.
21150
+ *
21151
+ * @returns {Error} The created error.
21152
+ */
21153
+ function AxiosError(message, code, config, request, response) {
21154
+ Error.call(this);
21155
+
21156
+ if (Error.captureStackTrace) {
21157
+ Error.captureStackTrace(this, this.constructor);
21158
+ } else {
21159
+ this.stack = (new Error()).stack;
21160
+ }
21161
+
21162
+ this.message = message;
21163
+ this.name = 'AxiosError';
21164
+ code && (this.code = code);
21165
+ config && (this.config = config);
21166
+ request && (this.request = request);
21167
+ if (response) {
21168
+ this.response = response;
21169
+ this.status = response.status ? response.status : null;
21170
+ }
21171
+ }
21172
+
21173
+ utils$1.inherits(AxiosError, Error, {
21174
+ toJSON: function toJSON() {
21175
+ return {
21176
+ // Standard
21177
+ message: this.message,
21178
+ name: this.name,
21179
+ // Microsoft
21180
+ description: this.description,
21181
+ number: this.number,
21182
+ // Mozilla
21183
+ fileName: this.fileName,
21184
+ lineNumber: this.lineNumber,
21185
+ columnNumber: this.columnNumber,
21186
+ stack: this.stack,
21187
+ // Axios
21188
+ config: utils$1.toJSONObject(this.config),
21189
+ code: this.code,
21190
+ status: this.status
21191
+ };
21192
+ }
21193
+ });
21194
+
21195
+ const prototype$1 = AxiosError.prototype;
21196
+ const descriptors = {};
21197
+
21198
+ [
21199
+ 'ERR_BAD_OPTION_VALUE',
21200
+ 'ERR_BAD_OPTION',
21201
+ 'ECONNABORTED',
21202
+ 'ETIMEDOUT',
21203
+ 'ERR_NETWORK',
21204
+ 'ERR_FR_TOO_MANY_REDIRECTS',
21205
+ 'ERR_DEPRECATED',
21206
+ 'ERR_BAD_RESPONSE',
21207
+ 'ERR_BAD_REQUEST',
21208
+ 'ERR_CANCELED',
21209
+ 'ERR_NOT_SUPPORT',
21210
+ 'ERR_INVALID_URL'
21211
+ // eslint-disable-next-line func-names
21212
+ ].forEach(code => {
21213
+ descriptors[code] = {value: code};
21214
+ });
21215
+
21216
+ Object.defineProperties(AxiosError, descriptors);
21217
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
21218
+
21219
+ // eslint-disable-next-line func-names
21220
+ AxiosError.from = (error, code, config, request, response, customProps) => {
21221
+ const axiosError = Object.create(prototype$1);
21222
+
21223
+ utils$1.toFlatObject(error, axiosError, function filter(obj) {
21224
+ return obj !== Error.prototype;
21225
+ }, prop => {
21226
+ return prop !== 'isAxiosError';
21227
+ });
21228
+
21229
+ const msg = error && error.message ? error.message : 'Error';
21230
+
21231
+ // Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
21232
+ const errCode = code == null && error ? error.code : code;
21233
+ AxiosError.call(axiosError, msg, errCode, config, request, response);
21234
+
21235
+ // Chain the original error on the standard field; non-enumerable to avoid JSON noise
21236
+ if (error && axiosError.cause == null) {
21237
+ Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
21238
+ }
21239
+
21240
+ axiosError.name = (error && error.name) || 'Error';
21241
+
21242
+ customProps && Object.assign(axiosError, customProps);
21243
+
21244
+ return axiosError;
21245
+ };
21246
+
21247
+ // eslint-disable-next-line strict
21248
+ var httpAdapter = null;
21249
+
21250
+ /**
21251
+ * Determines if the given thing is a array or js object.
21252
+ *
21253
+ * @param {string} thing - The object or array to be visited.
21254
+ *
21255
+ * @returns {boolean}
21256
+ */
21257
+ function isVisitable(thing) {
21258
+ return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
21259
+ }
21260
+
21261
+ /**
21262
+ * It removes the brackets from the end of a string
21263
+ *
21264
+ * @param {string} key - The key of the parameter.
21265
+ *
21266
+ * @returns {string} the key without the brackets.
21267
+ */
21268
+ function removeBrackets(key) {
21269
+ return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
21270
+ }
21271
+
21272
+ /**
21273
+ * It takes a path, a key, and a boolean, and returns a string
21274
+ *
21275
+ * @param {string} path - The path to the current key.
21276
+ * @param {string} key - The key of the current object being iterated over.
21277
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
21278
+ *
21279
+ * @returns {string} The path to the current key.
21280
+ */
21281
+ function renderKey(path, key, dots) {
21282
+ if (!path) return key;
21283
+ return path.concat(key).map(function each(token, i) {
21284
+ // eslint-disable-next-line no-param-reassign
21285
+ token = removeBrackets(token);
21286
+ return !dots && i ? '[' + token + ']' : token;
21287
+ }).join(dots ? '.' : '');
21288
+ }
21289
+
21290
+ /**
21291
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
21292
+ *
21293
+ * @param {Array<any>} arr - The array to check
21294
+ *
21295
+ * @returns {boolean}
21296
+ */
21297
+ function isFlatArray(arr) {
21298
+ return utils$1.isArray(arr) && !arr.some(isVisitable);
21299
+ }
21300
+
21301
+ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
21302
+ return /^is[A-Z]/.test(prop);
21303
+ });
21304
+
21305
+ /**
21306
+ * Convert a data object to FormData
21307
+ *
21308
+ * @param {Object} obj
21309
+ * @param {?Object} [formData]
21310
+ * @param {?Object} [options]
21311
+ * @param {Function} [options.visitor]
21312
+ * @param {Boolean} [options.metaTokens = true]
21313
+ * @param {Boolean} [options.dots = false]
21314
+ * @param {?Boolean} [options.indexes = false]
21315
+ *
21316
+ * @returns {Object}
21317
+ **/
21318
+
21319
+ /**
21320
+ * It converts an object into a FormData object
21321
+ *
21322
+ * @param {Object<any, any>} obj - The object to convert to form data.
21323
+ * @param {string} formData - The FormData object to append to.
21324
+ * @param {Object<string, any>} options
21325
+ *
21326
+ * @returns
21327
+ */
21328
+ function toFormData(obj, formData, options) {
21329
+ if (!utils$1.isObject(obj)) {
21330
+ throw new TypeError('target must be an object');
21331
+ }
21332
+
21333
+ // eslint-disable-next-line no-param-reassign
21334
+ formData = formData || new (FormData)();
21335
+
21336
+ // eslint-disable-next-line no-param-reassign
21337
+ options = utils$1.toFlatObject(options, {
21338
+ metaTokens: true,
21339
+ dots: false,
21340
+ indexes: false
21341
+ }, false, function defined(option, source) {
21342
+ // eslint-disable-next-line no-eq-null,eqeqeq
21343
+ return !utils$1.isUndefined(source[option]);
21344
+ });
21345
+
21346
+ const metaTokens = options.metaTokens;
21347
+ // eslint-disable-next-line no-use-before-define
21348
+ const visitor = options.visitor || defaultVisitor;
21349
+ const dots = options.dots;
21350
+ const indexes = options.indexes;
21351
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
21352
+ const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
21353
+
21354
+ if (!utils$1.isFunction(visitor)) {
21355
+ throw new TypeError('visitor must be a function');
21356
+ }
21357
+
21358
+ function convertValue(value) {
21359
+ if (value === null) return '';
21360
+
21361
+ if (utils$1.isDate(value)) {
21362
+ return value.toISOString();
21363
+ }
21364
+
21365
+ if (utils$1.isBoolean(value)) {
21366
+ return value.toString();
21367
+ }
21368
+
21369
+ if (!useBlob && utils$1.isBlob(value)) {
21370
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
21371
+ }
21372
+
21373
+ if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
21374
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
21375
+ }
21376
+
21377
+ return value;
21378
+ }
21379
+
21380
+ /**
21381
+ * Default visitor.
21382
+ *
21383
+ * @param {*} value
21384
+ * @param {String|Number} key
21385
+ * @param {Array<String|Number>} path
21386
+ * @this {FormData}
21387
+ *
21388
+ * @returns {boolean} return true to visit the each prop of the value recursively
21389
+ */
21390
+ function defaultVisitor(value, key, path) {
21391
+ let arr = value;
21392
+
21393
+ if (value && !path && typeof value === 'object') {
21394
+ if (utils$1.endsWith(key, '{}')) {
21395
+ // eslint-disable-next-line no-param-reassign
21396
+ key = metaTokens ? key : key.slice(0, -2);
21397
+ // eslint-disable-next-line no-param-reassign
21398
+ value = JSON.stringify(value);
21399
+ } else if (
21400
+ (utils$1.isArray(value) && isFlatArray(value)) ||
21401
+ ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
21402
+ )) {
21403
+ // eslint-disable-next-line no-param-reassign
21404
+ key = removeBrackets(key);
21405
+
21406
+ arr.forEach(function each(el, index) {
21407
+ !(utils$1.isUndefined(el) || el === null) && formData.append(
21408
+ // eslint-disable-next-line no-nested-ternary
21409
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
21410
+ convertValue(el)
21411
+ );
21412
+ });
21413
+ return false;
21414
+ }
21415
+ }
21416
+
21417
+ if (isVisitable(value)) {
21418
+ return true;
21419
+ }
21420
+
21421
+ formData.append(renderKey(path, key, dots), convertValue(value));
21422
+
21423
+ return false;
21424
+ }
21425
+
21426
+ const stack = [];
21427
+
21428
+ const exposedHelpers = Object.assign(predicates, {
21429
+ defaultVisitor,
21430
+ convertValue,
21431
+ isVisitable
21432
+ });
21433
+
21434
+ function build(value, path) {
21435
+ if (utils$1.isUndefined(value)) return;
21436
+
21437
+ if (stack.indexOf(value) !== -1) {
21438
+ throw Error('Circular reference detected in ' + path.join('.'));
21439
+ }
21440
+
21441
+ stack.push(value);
21442
+
21443
+ utils$1.forEach(value, function each(el, key) {
21444
+ const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
21445
+ formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
21446
+ );
21447
+
21448
+ if (result === true) {
21449
+ build(el, path ? path.concat(key) : [key]);
21450
+ }
21451
+ });
21452
+
21453
+ stack.pop();
21454
+ }
21455
+
21456
+ if (!utils$1.isObject(obj)) {
21457
+ throw new TypeError('data must be an object');
21458
+ }
21459
+
21460
+ build(obj);
21461
+
21462
+ return formData;
21463
+ }
21464
+
21465
+ /**
21466
+ * It encodes a string by replacing all characters that are not in the unreserved set with
21467
+ * their percent-encoded equivalents
21468
+ *
21469
+ * @param {string} str - The string to encode.
21470
+ *
21471
+ * @returns {string} The encoded string.
21472
+ */
21473
+ function encode$1(str) {
21474
+ const charMap = {
21475
+ '!': '%21',
21476
+ "'": '%27',
21477
+ '(': '%28',
21478
+ ')': '%29',
21479
+ '~': '%7E',
21480
+ '%20': '+',
21481
+ '%00': '\x00'
21482
+ };
21483
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
21484
+ return charMap[match];
21485
+ });
21486
+ }
21487
+
21488
+ /**
21489
+ * It takes a params object and converts it to a FormData object
21490
+ *
21491
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
21492
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
21493
+ *
21494
+ * @returns {void}
21495
+ */
21496
+ function AxiosURLSearchParams(params, options) {
21497
+ this._pairs = [];
21498
+
21499
+ params && toFormData(params, this, options);
21500
+ }
21501
+
21502
+ const prototype = AxiosURLSearchParams.prototype;
21503
+
21504
+ prototype.append = function append(name, value) {
21505
+ this._pairs.push([name, value]);
21506
+ };
21507
+
21508
+ prototype.toString = function toString(encoder) {
21509
+ const _encode = encoder ? function(value) {
21510
+ return encoder.call(this, value, encode$1);
21511
+ } : encode$1;
21512
+
21513
+ return this._pairs.map(function each(pair) {
21514
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
21515
+ }, '').join('&');
21516
+ };
21517
+
21518
+ /**
21519
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
21520
+ * URI encoded counterparts
21521
+ *
21522
+ * @param {string} val The value to be encoded.
21523
+ *
21524
+ * @returns {string} The encoded value.
21525
+ */
21526
+ function encode(val) {
21527
+ return encodeURIComponent(val).
21528
+ replace(/%3A/gi, ':').
21529
+ replace(/%24/g, '$').
21530
+ replace(/%2C/gi, ',').
21531
+ replace(/%20/g, '+');
21532
+ }
21533
+
21534
+ /**
21535
+ * Build a URL by appending params to the end
21536
+ *
21537
+ * @param {string} url The base of the url (e.g., http://www.google.com)
21538
+ * @param {object} [params] The params to be appended
21539
+ * @param {?(object|Function)} options
21540
+ *
21541
+ * @returns {string} The formatted url
21542
+ */
21543
+ function buildURL(url, params, options) {
21544
+ /*eslint no-param-reassign:0*/
21545
+ if (!params) {
21546
+ return url;
21547
+ }
21548
+
21549
+ const _encode = options && options.encode || encode;
21550
+
21551
+ if (utils$1.isFunction(options)) {
21552
+ options = {
21553
+ serialize: options
21554
+ };
21555
+ }
21556
+
21557
+ const serializeFn = options && options.serialize;
21558
+
21559
+ let serializedParams;
21560
+
21561
+ if (serializeFn) {
21562
+ serializedParams = serializeFn(params, options);
21563
+ } else {
21564
+ serializedParams = utils$1.isURLSearchParams(params) ?
21565
+ params.toString() :
21566
+ new AxiosURLSearchParams(params, options).toString(_encode);
21567
+ }
21568
+
21569
+ if (serializedParams) {
21570
+ const hashmarkIndex = url.indexOf("#");
21571
+
21572
+ if (hashmarkIndex !== -1) {
21573
+ url = url.slice(0, hashmarkIndex);
21574
+ }
21575
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
21576
+ }
21577
+
21578
+ return url;
21579
+ }
21580
+
21581
+ class InterceptorManager {
21582
+ constructor() {
21583
+ this.handlers = [];
21584
+ }
21585
+
21586
+ /**
21587
+ * Add a new interceptor to the stack
21588
+ *
21589
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
21590
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
21591
+ *
21592
+ * @return {Number} An ID used to remove interceptor later
21593
+ */
21594
+ use(fulfilled, rejected, options) {
21595
+ this.handlers.push({
21596
+ fulfilled,
21597
+ rejected,
21598
+ synchronous: options ? options.synchronous : false,
21599
+ runWhen: options ? options.runWhen : null
21600
+ });
21601
+ return this.handlers.length - 1;
21602
+ }
21603
+
21604
+ /**
21605
+ * Remove an interceptor from the stack
21606
+ *
21607
+ * @param {Number} id The ID that was returned by `use`
21608
+ *
21609
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
21610
+ */
21611
+ eject(id) {
21612
+ if (this.handlers[id]) {
21613
+ this.handlers[id] = null;
21614
+ }
21615
+ }
21616
+
21617
+ /**
21618
+ * Clear all interceptors from the stack
21619
+ *
21620
+ * @returns {void}
21621
+ */
21622
+ clear() {
21623
+ if (this.handlers) {
21624
+ this.handlers = [];
21625
+ }
21626
+ }
21627
+
21628
+ /**
21629
+ * Iterate over all the registered interceptors
21630
+ *
21631
+ * This method is particularly useful for skipping over any
21632
+ * interceptors that may have become `null` calling `eject`.
21633
+ *
21634
+ * @param {Function} fn The function to call for each interceptor
21635
+ *
21636
+ * @returns {void}
21637
+ */
21638
+ forEach(fn) {
21639
+ utils$1.forEach(this.handlers, function forEachHandler(h) {
21640
+ if (h !== null) {
21641
+ fn(h);
21642
+ }
21643
+ });
21644
+ }
21645
+ }
21646
+
21647
+ var InterceptorManager$1 = InterceptorManager;
21648
+
21649
+ var transitionalDefaults = {
21650
+ silentJSONParsing: true,
21651
+ forcedJSONParsing: true,
21652
+ clarifyTimeoutError: false
21653
+ };
21654
+
21655
+ var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
21656
+
21657
+ var FormData$1 = typeof FormData !== 'undefined' ? FormData : null;
21658
+
21659
+ var Blob$1 = typeof Blob !== 'undefined' ? Blob : null;
21660
+
21661
+ var platform$1 = {
21662
+ isBrowser: true,
21663
+ classes: {
21664
+ URLSearchParams: URLSearchParams$1,
21665
+ FormData: FormData$1,
21666
+ Blob: Blob$1
21667
+ },
21668
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
21669
+ };
21670
+
21671
+ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
21672
+
21673
+ const _navigator = typeof navigator === 'object' && navigator || undefined;
21674
+
21675
+ /**
21676
+ * Determine if we're running in a standard browser environment
21677
+ *
21678
+ * This allows axios to run in a web worker, and react-native.
21679
+ * Both environments support XMLHttpRequest, but not fully standard globals.
21680
+ *
21681
+ * web workers:
21682
+ * typeof window -> undefined
21683
+ * typeof document -> undefined
21684
+ *
21685
+ * react-native:
21686
+ * navigator.product -> 'ReactNative'
21687
+ * nativescript
21688
+ * navigator.product -> 'NativeScript' or 'NS'
21689
+ *
21690
+ * @returns {boolean}
21691
+ */
21692
+ const hasStandardBrowserEnv = hasBrowserEnv &&
21693
+ (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
21694
+
21695
+ /**
21696
+ * Determine if we're running in a standard browser webWorker environment
21697
+ *
21698
+ * Although the `isStandardBrowserEnv` method indicates that
21699
+ * `allows axios to run in a web worker`, the WebWorker will still be
21700
+ * filtered out due to its judgment standard
21701
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
21702
+ * This leads to a problem when axios post `FormData` in webWorker
21703
+ */
21704
+ const hasStandardBrowserWebWorkerEnv = (() => {
21705
+ return (
21706
+ typeof WorkerGlobalScope !== 'undefined' &&
21707
+ // eslint-disable-next-line no-undef
21708
+ self instanceof WorkerGlobalScope &&
21709
+ typeof self.importScripts === 'function'
21710
+ );
21711
+ })();
21712
+
21713
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
21714
+
21715
+ var utils = /*#__PURE__*/Object.freeze({
21716
+ __proto__: null,
21717
+ hasBrowserEnv: hasBrowserEnv,
21718
+ hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
21719
+ hasStandardBrowserEnv: hasStandardBrowserEnv,
21720
+ navigator: _navigator,
21721
+ origin: origin
21722
+ });
21723
+
21724
+ var platform = {
21725
+ ...utils,
21726
+ ...platform$1
21727
+ };
21728
+
21729
+ function toURLEncodedForm(data, options) {
21730
+ return toFormData(data, new platform.classes.URLSearchParams(), {
21731
+ visitor: function(value, key, path, helpers) {
21732
+ if (platform.isNode && utils$1.isBuffer(value)) {
21733
+ this.append(key, value.toString('base64'));
21734
+ return false;
21735
+ }
21736
+
21737
+ return helpers.defaultVisitor.apply(this, arguments);
21738
+ },
21739
+ ...options
21740
+ });
21741
+ }
21742
+
21743
+ /**
21744
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
21745
+ *
21746
+ * @param {string} name - The name of the property to get.
21747
+ *
21748
+ * @returns An array of strings.
21749
+ */
21750
+ function parsePropPath(name) {
21751
+ // foo[x][y][z]
21752
+ // foo.x.y.z
21753
+ // foo-x-y-z
21754
+ // foo x y z
21755
+ return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
21756
+ return match[0] === '[]' ? '' : match[1] || match[0];
21757
+ });
21758
+ }
21759
+
21760
+ /**
21761
+ * Convert an array to an object.
21762
+ *
21763
+ * @param {Array<any>} arr - The array to convert to an object.
21764
+ *
21765
+ * @returns An object with the same keys and values as the array.
21766
+ */
21767
+ function arrayToObject(arr) {
21768
+ const obj = {};
21769
+ const keys = Object.keys(arr);
21770
+ let i;
21771
+ const len = keys.length;
21772
+ let key;
21773
+ for (i = 0; i < len; i++) {
21774
+ key = keys[i];
21775
+ obj[key] = arr[key];
21776
+ }
21777
+ return obj;
21778
+ }
21779
+
21780
+ /**
21781
+ * It takes a FormData object and returns a JavaScript object
21782
+ *
21783
+ * @param {string} formData The FormData object to convert to JSON.
21784
+ *
21785
+ * @returns {Object<string, any> | null} The converted object.
21786
+ */
21787
+ function formDataToJSON(formData) {
21788
+ function buildPath(path, value, target, index) {
21789
+ let name = path[index++];
21790
+
21791
+ if (name === '__proto__') return true;
21792
+
21793
+ const isNumericKey = Number.isFinite(+name);
21794
+ const isLast = index >= path.length;
21795
+ name = !name && utils$1.isArray(target) ? target.length : name;
21796
+
21797
+ if (isLast) {
21798
+ if (utils$1.hasOwnProp(target, name)) {
21799
+ target[name] = [target[name], value];
21800
+ } else {
21801
+ target[name] = value;
21802
+ }
21803
+
21804
+ return !isNumericKey;
21805
+ }
21806
+
21807
+ if (!target[name] || !utils$1.isObject(target[name])) {
21808
+ target[name] = [];
21809
+ }
21810
+
21811
+ const result = buildPath(path, value, target[name], index);
21812
+
21813
+ if (result && utils$1.isArray(target[name])) {
21814
+ target[name] = arrayToObject(target[name]);
21815
+ }
21816
+
21817
+ return !isNumericKey;
21818
+ }
21819
+
21820
+ if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
21821
+ const obj = {};
21822
+
21823
+ utils$1.forEachEntry(formData, (name, value) => {
21824
+ buildPath(parsePropPath(name), value, obj, 0);
21825
+ });
21826
+
21827
+ return obj;
21828
+ }
21829
+
21830
+ return null;
21831
+ }
21832
+
21833
+ /**
21834
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
21835
+ * of the input
21836
+ *
21837
+ * @param {any} rawValue - The value to be stringified.
21838
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
21839
+ * @param {Function} encoder - A function that takes a value and returns a string.
21840
+ *
21841
+ * @returns {string} A stringified version of the rawValue.
21842
+ */
21843
+ function stringifySafely(rawValue, parser, encoder) {
21844
+ if (utils$1.isString(rawValue)) {
21845
+ try {
21846
+ (parser || JSON.parse)(rawValue);
21847
+ return utils$1.trim(rawValue);
21848
+ } catch (e) {
21849
+ if (e.name !== 'SyntaxError') {
21850
+ throw e;
21851
+ }
21852
+ }
21853
+ }
21854
+
21855
+ return (encoder || JSON.stringify)(rawValue);
21856
+ }
21857
+
21858
+ const defaults = {
21859
+
21860
+ transitional: transitionalDefaults,
21861
+
21862
+ adapter: ['xhr', 'http', 'fetch'],
21863
+
21864
+ transformRequest: [function transformRequest(data, headers) {
21865
+ const contentType = headers.getContentType() || '';
21866
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
21867
+ const isObjectPayload = utils$1.isObject(data);
21868
+
21869
+ if (isObjectPayload && utils$1.isHTMLForm(data)) {
21870
+ data = new FormData(data);
21871
+ }
21872
+
21873
+ const isFormData = utils$1.isFormData(data);
21874
+
21875
+ if (isFormData) {
21876
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
21877
+ }
21878
+
21879
+ if (utils$1.isArrayBuffer(data) ||
21880
+ utils$1.isBuffer(data) ||
21881
+ utils$1.isStream(data) ||
21882
+ utils$1.isFile(data) ||
21883
+ utils$1.isBlob(data) ||
21884
+ utils$1.isReadableStream(data)
21885
+ ) {
21886
+ return data;
21887
+ }
21888
+ if (utils$1.isArrayBufferView(data)) {
21889
+ return data.buffer;
21890
+ }
21891
+ if (utils$1.isURLSearchParams(data)) {
21892
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
21893
+ return data.toString();
21894
+ }
21895
+
21896
+ let isFileList;
21897
+
21898
+ if (isObjectPayload) {
21899
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
21900
+ return toURLEncodedForm(data, this.formSerializer).toString();
21901
+ }
21902
+
21903
+ if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
21904
+ const _FormData = this.env && this.env.FormData;
21905
+
21906
+ return toFormData(
21907
+ isFileList ? {'files[]': data} : data,
21908
+ _FormData && new _FormData(),
21909
+ this.formSerializer
21910
+ );
21911
+ }
21912
+ }
21913
+
21914
+ if (isObjectPayload || hasJSONContentType ) {
21915
+ headers.setContentType('application/json', false);
21916
+ return stringifySafely(data);
21917
+ }
21918
+
21919
+ return data;
21920
+ }],
21921
+
21922
+ transformResponse: [function transformResponse(data) {
21923
+ const transitional = this.transitional || defaults.transitional;
21924
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
21925
+ const JSONRequested = this.responseType === 'json';
21926
+
21927
+ if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
21928
+ return data;
21929
+ }
21930
+
21931
+ if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
21932
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
21933
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
21934
+
21935
+ try {
21936
+ return JSON.parse(data, this.parseReviver);
21937
+ } catch (e) {
21938
+ if (strictJSONParsing) {
21939
+ if (e.name === 'SyntaxError') {
21940
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
21941
+ }
21942
+ throw e;
21943
+ }
21944
+ }
21945
+ }
21946
+
21947
+ return data;
21948
+ }],
21949
+
21950
+ /**
21951
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
21952
+ * timeout is not created.
21953
+ */
21954
+ timeout: 0,
21955
+
21956
+ xsrfCookieName: 'XSRF-TOKEN',
21957
+ xsrfHeaderName: 'X-XSRF-TOKEN',
21958
+
21959
+ maxContentLength: -1,
21960
+ maxBodyLength: -1,
21961
+
21962
+ env: {
21963
+ FormData: platform.classes.FormData,
21964
+ Blob: platform.classes.Blob
21965
+ },
21966
+
21967
+ validateStatus: function validateStatus(status) {
21968
+ return status >= 200 && status < 300;
21969
+ },
21970
+
21971
+ headers: {
21972
+ common: {
21973
+ 'Accept': 'application/json, text/plain, */*',
21974
+ 'Content-Type': undefined
21975
+ }
21976
+ }
21977
+ };
21978
+
21979
+ utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
21980
+ defaults.headers[method] = {};
21981
+ });
21982
+
21983
+ var defaults$1 = defaults;
21984
+
21985
+ // RawAxiosHeaders whose duplicates are ignored by node
21986
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
21987
+ const ignoreDuplicateOf = utils$1.toObjectSet([
21988
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
21989
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
21990
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
21991
+ 'referer', 'retry-after', 'user-agent'
21992
+ ]);
21993
+
21994
+ /**
21995
+ * Parse headers into an object
21996
+ *
21997
+ * ```
21998
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
21999
+ * Content-Type: application/json
22000
+ * Connection: keep-alive
22001
+ * Transfer-Encoding: chunked
22002
+ * ```
22003
+ *
22004
+ * @param {String} rawHeaders Headers needing to be parsed
22005
+ *
22006
+ * @returns {Object} Headers parsed into an object
22007
+ */
22008
+ var parseHeaders = rawHeaders => {
22009
+ const parsed = {};
22010
+ let key;
22011
+ let val;
22012
+ let i;
22013
+
22014
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
22015
+ i = line.indexOf(':');
22016
+ key = line.substring(0, i).trim().toLowerCase();
22017
+ val = line.substring(i + 1).trim();
22018
+
22019
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
22020
+ return;
22021
+ }
22022
+
22023
+ if (key === 'set-cookie') {
22024
+ if (parsed[key]) {
22025
+ parsed[key].push(val);
22026
+ } else {
22027
+ parsed[key] = [val];
22028
+ }
22029
+ } else {
22030
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
22031
+ }
22032
+ });
22033
+
22034
+ return parsed;
22035
+ };
22036
+
22037
+ const $internals = Symbol('internals');
22038
+
22039
+ function normalizeHeader(header) {
22040
+ return header && String(header).trim().toLowerCase();
22041
+ }
22042
+
22043
+ function normalizeValue(value) {
22044
+ if (value === false || value == null) {
22045
+ return value;
22046
+ }
22047
+
22048
+ return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
22049
+ }
22050
+
22051
+ function parseTokens(str) {
22052
+ const tokens = Object.create(null);
22053
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
22054
+ let match;
22055
+
22056
+ while ((match = tokensRE.exec(str))) {
22057
+ tokens[match[1]] = match[2];
22058
+ }
22059
+
22060
+ return tokens;
22061
+ }
22062
+
22063
+ const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
22064
+
22065
+ function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
22066
+ if (utils$1.isFunction(filter)) {
22067
+ return filter.call(this, value, header);
22068
+ }
22069
+
22070
+ if (isHeaderNameFilter) {
22071
+ value = header;
22072
+ }
22073
+
22074
+ if (!utils$1.isString(value)) return;
22075
+
22076
+ if (utils$1.isString(filter)) {
22077
+ return value.indexOf(filter) !== -1;
22078
+ }
22079
+
22080
+ if (utils$1.isRegExp(filter)) {
22081
+ return filter.test(value);
22082
+ }
22083
+ }
22084
+
22085
+ function formatHeader(header) {
22086
+ return header.trim()
22087
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
22088
+ return char.toUpperCase() + str;
22089
+ });
22090
+ }
22091
+
22092
+ function buildAccessors(obj, header) {
22093
+ const accessorName = utils$1.toCamelCase(' ' + header);
22094
+
22095
+ ['get', 'set', 'has'].forEach(methodName => {
22096
+ Object.defineProperty(obj, methodName + accessorName, {
22097
+ value: function(arg1, arg2, arg3) {
22098
+ return this[methodName].call(this, header, arg1, arg2, arg3);
22099
+ },
22100
+ configurable: true
22101
+ });
22102
+ });
22103
+ }
22104
+
22105
+ class AxiosHeaders {
22106
+ constructor(headers) {
22107
+ headers && this.set(headers);
22108
+ }
22109
+
22110
+ set(header, valueOrRewrite, rewrite) {
22111
+ const self = this;
22112
+
22113
+ function setHeader(_value, _header, _rewrite) {
22114
+ const lHeader = normalizeHeader(_header);
22115
+
22116
+ if (!lHeader) {
22117
+ throw new Error('header name must be a non-empty string');
22118
+ }
22119
+
22120
+ const key = utils$1.findKey(self, lHeader);
22121
+
22122
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
22123
+ self[key || _header] = normalizeValue(_value);
22124
+ }
22125
+ }
22126
+
22127
+ const setHeaders = (headers, _rewrite) =>
22128
+ utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
22129
+
22130
+ if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
22131
+ setHeaders(header, valueOrRewrite);
22132
+ } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
22133
+ setHeaders(parseHeaders(header), valueOrRewrite);
22134
+ } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
22135
+ let obj = {}, dest, key;
22136
+ for (const entry of header) {
22137
+ if (!utils$1.isArray(entry)) {
22138
+ throw TypeError('Object iterator must return a key-value pair');
22139
+ }
22140
+
22141
+ obj[key = entry[0]] = (dest = obj[key]) ?
22142
+ (utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]]) : entry[1];
22143
+ }
22144
+
22145
+ setHeaders(obj, valueOrRewrite);
22146
+ } else {
22147
+ header != null && setHeader(valueOrRewrite, header, rewrite);
22148
+ }
22149
+
22150
+ return this;
22151
+ }
22152
+
22153
+ get(header, parser) {
22154
+ header = normalizeHeader(header);
22155
+
22156
+ if (header) {
22157
+ const key = utils$1.findKey(this, header);
22158
+
22159
+ if (key) {
22160
+ const value = this[key];
22161
+
22162
+ if (!parser) {
22163
+ return value;
22164
+ }
22165
+
22166
+ if (parser === true) {
22167
+ return parseTokens(value);
22168
+ }
22169
+
22170
+ if (utils$1.isFunction(parser)) {
22171
+ return parser.call(this, value, key);
22172
+ }
22173
+
22174
+ if (utils$1.isRegExp(parser)) {
22175
+ return parser.exec(value);
22176
+ }
22177
+
22178
+ throw new TypeError('parser must be boolean|regexp|function');
22179
+ }
22180
+ }
22181
+ }
22182
+
22183
+ has(header, matcher) {
22184
+ header = normalizeHeader(header);
22185
+
22186
+ if (header) {
22187
+ const key = utils$1.findKey(this, header);
22188
+
22189
+ return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
22190
+ }
22191
+
22192
+ return false;
22193
+ }
22194
+
22195
+ delete(header, matcher) {
22196
+ const self = this;
22197
+ let deleted = false;
22198
+
22199
+ function deleteHeader(_header) {
22200
+ _header = normalizeHeader(_header);
22201
+
22202
+ if (_header) {
22203
+ const key = utils$1.findKey(self, _header);
22204
+
22205
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
22206
+ delete self[key];
22207
+
22208
+ deleted = true;
22209
+ }
22210
+ }
22211
+ }
22212
+
22213
+ if (utils$1.isArray(header)) {
22214
+ header.forEach(deleteHeader);
22215
+ } else {
22216
+ deleteHeader(header);
22217
+ }
22218
+
22219
+ return deleted;
22220
+ }
22221
+
22222
+ clear(matcher) {
22223
+ const keys = Object.keys(this);
22224
+ let i = keys.length;
22225
+ let deleted = false;
22226
+
22227
+ while (i--) {
22228
+ const key = keys[i];
22229
+ if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
22230
+ delete this[key];
22231
+ deleted = true;
22232
+ }
22233
+ }
22234
+
22235
+ return deleted;
22236
+ }
22237
+
22238
+ normalize(format) {
22239
+ const self = this;
22240
+ const headers = {};
22241
+
22242
+ utils$1.forEach(this, (value, header) => {
22243
+ const key = utils$1.findKey(headers, header);
22244
+
22245
+ if (key) {
22246
+ self[key] = normalizeValue(value);
22247
+ delete self[header];
22248
+ return;
22249
+ }
22250
+
22251
+ const normalized = format ? formatHeader(header) : String(header).trim();
22252
+
22253
+ if (normalized !== header) {
22254
+ delete self[header];
22255
+ }
22256
+
22257
+ self[normalized] = normalizeValue(value);
22258
+
22259
+ headers[normalized] = true;
22260
+ });
22261
+
22262
+ return this;
22263
+ }
22264
+
22265
+ concat(...targets) {
22266
+ return this.constructor.concat(this, ...targets);
22267
+ }
22268
+
22269
+ toJSON(asStrings) {
22270
+ const obj = Object.create(null);
22271
+
22272
+ utils$1.forEach(this, (value, header) => {
22273
+ value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
22274
+ });
22275
+
22276
+ return obj;
22277
+ }
22278
+
22279
+ [Symbol.iterator]() {
22280
+ return Object.entries(this.toJSON())[Symbol.iterator]();
22281
+ }
22282
+
22283
+ toString() {
22284
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
22285
+ }
22286
+
22287
+ getSetCookie() {
22288
+ return this.get("set-cookie") || [];
22289
+ }
22290
+
22291
+ get [Symbol.toStringTag]() {
22292
+ return 'AxiosHeaders';
22293
+ }
22294
+
22295
+ static from(thing) {
22296
+ return thing instanceof this ? thing : new this(thing);
22297
+ }
22298
+
22299
+ static concat(first, ...targets) {
22300
+ const computed = new this(first);
22301
+
22302
+ targets.forEach((target) => computed.set(target));
22303
+
22304
+ return computed;
22305
+ }
22306
+
22307
+ static accessor(header) {
22308
+ const internals = this[$internals] = (this[$internals] = {
22309
+ accessors: {}
22310
+ });
22311
+
22312
+ const accessors = internals.accessors;
22313
+ const prototype = this.prototype;
22314
+
22315
+ function defineAccessor(_header) {
22316
+ const lHeader = normalizeHeader(_header);
22317
+
22318
+ if (!accessors[lHeader]) {
22319
+ buildAccessors(prototype, _header);
22320
+ accessors[lHeader] = true;
22321
+ }
22322
+ }
22323
+
22324
+ utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
22325
+
22326
+ return this;
22327
+ }
22328
+ }
22329
+
22330
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
22331
+
22332
+ // reserved names hotfix
22333
+ utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
22334
+ let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
22335
+ return {
22336
+ get: () => value,
22337
+ set(headerValue) {
22338
+ this[mapped] = headerValue;
22339
+ }
22340
+ }
22341
+ });
22342
+
22343
+ utils$1.freezeMethods(AxiosHeaders);
22344
+
22345
+ var AxiosHeaders$1 = AxiosHeaders;
22346
+
22347
+ /**
22348
+ * Transform the data for a request or a response
22349
+ *
22350
+ * @param {Array|Function} fns A single function or Array of functions
22351
+ * @param {?Object} response The response object
22352
+ *
22353
+ * @returns {*} The resulting transformed data
22354
+ */
22355
+ function transformData(fns, response) {
22356
+ const config = this || defaults$1;
22357
+ const context = response || config;
22358
+ const headers = AxiosHeaders$1.from(context.headers);
22359
+ let data = context.data;
22360
+
22361
+ utils$1.forEach(fns, function transform(fn) {
22362
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
22363
+ });
22364
+
22365
+ headers.normalize();
22366
+
22367
+ return data;
22368
+ }
22369
+
22370
+ function isCancel(value) {
22371
+ return !!(value && value.__CANCEL__);
22372
+ }
22373
+
22374
+ /**
22375
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
22376
+ *
22377
+ * @param {string=} message The message.
22378
+ * @param {Object=} config The config.
22379
+ * @param {Object=} request The request.
22380
+ *
22381
+ * @returns {CanceledError} The created error.
22382
+ */
22383
+ function CanceledError(message, config, request) {
22384
+ // eslint-disable-next-line no-eq-null,eqeqeq
22385
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
22386
+ this.name = 'CanceledError';
22387
+ }
22388
+
22389
+ utils$1.inherits(CanceledError, AxiosError, {
22390
+ __CANCEL__: true
22391
+ });
22392
+
22393
+ /**
22394
+ * Resolve or reject a Promise based on response status.
22395
+ *
22396
+ * @param {Function} resolve A function that resolves the promise.
22397
+ * @param {Function} reject A function that rejects the promise.
22398
+ * @param {object} response The response.
22399
+ *
22400
+ * @returns {object} The response.
22401
+ */
22402
+ function settle(resolve, reject, response) {
22403
+ const validateStatus = response.config.validateStatus;
22404
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
22405
+ resolve(response);
22406
+ } else {
22407
+ reject(new AxiosError(
22408
+ 'Request failed with status code ' + response.status,
22409
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
22410
+ response.config,
22411
+ response.request,
22412
+ response
22413
+ ));
22414
+ }
22415
+ }
22416
+
22417
+ function parseProtocol(url) {
22418
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
22419
+ return match && match[1] || '';
22420
+ }
22421
+
22422
+ /**
22423
+ * Calculate data maxRate
22424
+ * @param {Number} [samplesCount= 10]
22425
+ * @param {Number} [min= 1000]
22426
+ * @returns {Function}
22427
+ */
22428
+ function speedometer(samplesCount, min) {
22429
+ samplesCount = samplesCount || 10;
22430
+ const bytes = new Array(samplesCount);
22431
+ const timestamps = new Array(samplesCount);
22432
+ let head = 0;
22433
+ let tail = 0;
22434
+ let firstSampleTS;
22435
+
22436
+ min = min !== undefined ? min : 1000;
22437
+
22438
+ return function push(chunkLength) {
22439
+ const now = Date.now();
22440
+
22441
+ const startedAt = timestamps[tail];
22442
+
22443
+ if (!firstSampleTS) {
22444
+ firstSampleTS = now;
22445
+ }
22446
+
22447
+ bytes[head] = chunkLength;
22448
+ timestamps[head] = now;
22449
+
22450
+ let i = tail;
22451
+ let bytesCount = 0;
22452
+
22453
+ while (i !== head) {
22454
+ bytesCount += bytes[i++];
22455
+ i = i % samplesCount;
22456
+ }
22457
+
22458
+ head = (head + 1) % samplesCount;
22459
+
22460
+ if (head === tail) {
22461
+ tail = (tail + 1) % samplesCount;
22462
+ }
22463
+
22464
+ if (now - firstSampleTS < min) {
22465
+ return;
22466
+ }
22467
+
22468
+ const passed = startedAt && now - startedAt;
22469
+
22470
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
22471
+ };
22472
+ }
22473
+
22474
+ /**
22475
+ * Throttle decorator
22476
+ * @param {Function} fn
22477
+ * @param {Number} freq
22478
+ * @return {Function}
22479
+ */
22480
+ function throttle(fn, freq) {
22481
+ let timestamp = 0;
22482
+ let threshold = 1000 / freq;
22483
+ let lastArgs;
22484
+ let timer;
22485
+
22486
+ const invoke = (args, now = Date.now()) => {
22487
+ timestamp = now;
22488
+ lastArgs = null;
22489
+ if (timer) {
22490
+ clearTimeout(timer);
22491
+ timer = null;
22492
+ }
22493
+ fn(...args);
22494
+ };
22495
+
22496
+ const throttled = (...args) => {
22497
+ const now = Date.now();
22498
+ const passed = now - timestamp;
22499
+ if ( passed >= threshold) {
22500
+ invoke(args, now);
22501
+ } else {
22502
+ lastArgs = args;
22503
+ if (!timer) {
22504
+ timer = setTimeout(() => {
22505
+ timer = null;
22506
+ invoke(lastArgs);
22507
+ }, threshold - passed);
22508
+ }
22509
+ }
22510
+ };
22511
+
22512
+ const flush = () => lastArgs && invoke(lastArgs);
22513
+
22514
+ return [throttled, flush];
22515
+ }
22516
+
22517
+ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
22518
+ let bytesNotified = 0;
22519
+ const _speedometer = speedometer(50, 250);
22520
+
22521
+ return throttle(e => {
22522
+ const loaded = e.loaded;
22523
+ const total = e.lengthComputable ? e.total : undefined;
22524
+ const progressBytes = loaded - bytesNotified;
22525
+ const rate = _speedometer(progressBytes);
22526
+ const inRange = loaded <= total;
22527
+
22528
+ bytesNotified = loaded;
22529
+
22530
+ const data = {
22531
+ loaded,
22532
+ total,
22533
+ progress: total ? (loaded / total) : undefined,
22534
+ bytes: progressBytes,
22535
+ rate: rate ? rate : undefined,
22536
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
22537
+ event: e,
22538
+ lengthComputable: total != null,
22539
+ [isDownloadStream ? 'download' : 'upload']: true
22540
+ };
22541
+
22542
+ listener(data);
22543
+ }, freq);
22544
+ };
22545
+
22546
+ const progressEventDecorator = (total, throttled) => {
22547
+ const lengthComputable = total != null;
22548
+
22549
+ return [(loaded) => throttled[0]({
22550
+ lengthComputable,
22551
+ total,
22552
+ loaded
22553
+ }), throttled[1]];
22554
+ };
22555
+
22556
+ const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
22557
+
22558
+ var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => (url) => {
22559
+ url = new URL(url, platform.origin);
22560
+
22561
+ return (
22562
+ origin.protocol === url.protocol &&
22563
+ origin.host === url.host &&
22564
+ (isMSIE || origin.port === url.port)
22565
+ );
22566
+ })(
22567
+ new URL(platform.origin),
22568
+ platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
22569
+ ) : () => true;
22570
+
22571
+ var cookies = platform.hasStandardBrowserEnv ?
22572
+
22573
+ // Standard browser envs support document.cookie
22574
+ {
22575
+ write(name, value, expires, path, domain, secure) {
22576
+ const cookie = [name + '=' + encodeURIComponent(value)];
22577
+
22578
+ utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
22579
+
22580
+ utils$1.isString(path) && cookie.push('path=' + path);
22581
+
22582
+ utils$1.isString(domain) && cookie.push('domain=' + domain);
22583
+
22584
+ secure === true && cookie.push('secure');
22585
+
22586
+ document.cookie = cookie.join('; ');
22587
+ },
22588
+
22589
+ read(name) {
22590
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
22591
+ return (match ? decodeURIComponent(match[3]) : null);
22592
+ },
22593
+
22594
+ remove(name) {
22595
+ this.write(name, '', Date.now() - 86400000);
22596
+ }
22597
+ }
22598
+
22599
+ :
22600
+
22601
+ // Non-standard browser env (web workers, react-native) lack needed support.
22602
+ {
22603
+ write() {},
22604
+ read() {
22605
+ return null;
22606
+ },
22607
+ remove() {}
22608
+ };
22609
+
22610
+ /**
22611
+ * Determines whether the specified URL is absolute
22612
+ *
22613
+ * @param {string} url The URL to test
22614
+ *
22615
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
22616
+ */
22617
+ function isAbsoluteURL(url) {
22618
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
22619
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
22620
+ // by any combination of letters, digits, plus, period, or hyphen.
22621
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
22622
+ }
22623
+
22624
+ /**
22625
+ * Creates a new URL by combining the specified URLs
22626
+ *
22627
+ * @param {string} baseURL The base URL
22628
+ * @param {string} relativeURL The relative URL
22629
+ *
22630
+ * @returns {string} The combined URL
22631
+ */
22632
+ function combineURLs(baseURL, relativeURL) {
22633
+ return relativeURL
22634
+ ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
22635
+ : baseURL;
22636
+ }
22637
+
22638
+ /**
22639
+ * Creates a new URL by combining the baseURL with the requestedURL,
22640
+ * only when the requestedURL is not already an absolute URL.
22641
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
22642
+ *
22643
+ * @param {string} baseURL The base URL
22644
+ * @param {string} requestedURL Absolute or relative URL to combine
22645
+ *
22646
+ * @returns {string} The combined full path
22647
+ */
22648
+ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
22649
+ let isRelativeUrl = !isAbsoluteURL(requestedURL);
22650
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
22651
+ return combineURLs(baseURL, requestedURL);
22652
+ }
22653
+ return requestedURL;
22654
+ }
22655
+
22656
+ const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
22657
+
22658
+ /**
22659
+ * Config-specific merge-function which creates a new config-object
22660
+ * by merging two configuration objects together.
22661
+ *
22662
+ * @param {Object} config1
22663
+ * @param {Object} config2
22664
+ *
22665
+ * @returns {Object} New object resulting from merging config2 to config1
22666
+ */
22667
+ function mergeConfig(config1, config2) {
22668
+ // eslint-disable-next-line no-param-reassign
22669
+ config2 = config2 || {};
22670
+ const config = {};
22671
+
22672
+ function getMergedValue(target, source, prop, caseless) {
22673
+ if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
22674
+ return utils$1.merge.call({caseless}, target, source);
22675
+ } else if (utils$1.isPlainObject(source)) {
22676
+ return utils$1.merge({}, source);
22677
+ } else if (utils$1.isArray(source)) {
22678
+ return source.slice();
22679
+ }
22680
+ return source;
22681
+ }
22682
+
22683
+ // eslint-disable-next-line consistent-return
22684
+ function mergeDeepProperties(a, b, prop , caseless) {
22685
+ if (!utils$1.isUndefined(b)) {
22686
+ return getMergedValue(a, b, prop , caseless);
22687
+ } else if (!utils$1.isUndefined(a)) {
22688
+ return getMergedValue(undefined, a, prop , caseless);
22689
+ }
22690
+ }
22691
+
22692
+ // eslint-disable-next-line consistent-return
22693
+ function valueFromConfig2(a, b) {
22694
+ if (!utils$1.isUndefined(b)) {
22695
+ return getMergedValue(undefined, b);
22696
+ }
22697
+ }
22698
+
22699
+ // eslint-disable-next-line consistent-return
22700
+ function defaultToConfig2(a, b) {
22701
+ if (!utils$1.isUndefined(b)) {
22702
+ return getMergedValue(undefined, b);
22703
+ } else if (!utils$1.isUndefined(a)) {
22704
+ return getMergedValue(undefined, a);
22705
+ }
22706
+ }
22707
+
22708
+ // eslint-disable-next-line consistent-return
22709
+ function mergeDirectKeys(a, b, prop) {
22710
+ if (prop in config2) {
22711
+ return getMergedValue(a, b);
22712
+ } else if (prop in config1) {
22713
+ return getMergedValue(undefined, a);
22714
+ }
22715
+ }
22716
+
22717
+ const mergeMap = {
22718
+ url: valueFromConfig2,
22719
+ method: valueFromConfig2,
22720
+ data: valueFromConfig2,
22721
+ baseURL: defaultToConfig2,
22722
+ transformRequest: defaultToConfig2,
22723
+ transformResponse: defaultToConfig2,
22724
+ paramsSerializer: defaultToConfig2,
22725
+ timeout: defaultToConfig2,
22726
+ timeoutMessage: defaultToConfig2,
22727
+ withCredentials: defaultToConfig2,
22728
+ withXSRFToken: defaultToConfig2,
22729
+ adapter: defaultToConfig2,
22730
+ responseType: defaultToConfig2,
22731
+ xsrfCookieName: defaultToConfig2,
22732
+ xsrfHeaderName: defaultToConfig2,
22733
+ onUploadProgress: defaultToConfig2,
22734
+ onDownloadProgress: defaultToConfig2,
22735
+ decompress: defaultToConfig2,
22736
+ maxContentLength: defaultToConfig2,
22737
+ maxBodyLength: defaultToConfig2,
22738
+ beforeRedirect: defaultToConfig2,
22739
+ transport: defaultToConfig2,
22740
+ httpAgent: defaultToConfig2,
22741
+ httpsAgent: defaultToConfig2,
22742
+ cancelToken: defaultToConfig2,
22743
+ socketPath: defaultToConfig2,
22744
+ responseEncoding: defaultToConfig2,
22745
+ validateStatus: mergeDirectKeys,
22746
+ headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
22747
+ };
22748
+
22749
+ utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
22750
+ const merge = mergeMap[prop] || mergeDeepProperties;
22751
+ const configValue = merge(config1[prop], config2[prop], prop);
22752
+ (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
22753
+ });
22754
+
22755
+ return config;
22756
+ }
22757
+
22758
+ var resolveConfig = (config) => {
22759
+ const newConfig = mergeConfig({}, config);
22760
+
22761
+ let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
22762
+
22763
+ newConfig.headers = headers = AxiosHeaders$1.from(headers);
22764
+
22765
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
22766
+
22767
+ // HTTP basic authentication
22768
+ if (auth) {
22769
+ headers.set('Authorization', 'Basic ' +
22770
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
22771
+ );
22772
+ }
22773
+
22774
+ if (utils$1.isFormData(data)) {
22775
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
22776
+ headers.setContentType(undefined); // browser handles it
22777
+ } else if (utils$1.isFunction(data.getHeaders)) {
22778
+ // Node.js FormData (like form-data package)
22779
+ const formHeaders = data.getHeaders();
22780
+ // Only set safe headers to avoid overwriting security headers
22781
+ const allowedHeaders = ['content-type', 'content-length'];
22782
+ Object.entries(formHeaders).forEach(([key, val]) => {
22783
+ if (allowedHeaders.includes(key.toLowerCase())) {
22784
+ headers.set(key, val);
22785
+ }
22786
+ });
22787
+ }
22788
+ }
22789
+
22790
+ // Add xsrf header
22791
+ // This is only done if running in a standard browser environment.
22792
+ // Specifically not if we're in a web worker, or react-native.
22793
+
22794
+ if (platform.hasStandardBrowserEnv) {
22795
+ withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
22796
+
22797
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
22798
+ // Add xsrf header
22799
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
22800
+
22801
+ if (xsrfValue) {
22802
+ headers.set(xsrfHeaderName, xsrfValue);
22803
+ }
22804
+ }
22805
+ }
22806
+
22807
+ return newConfig;
22808
+ };
22809
+
22810
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
22811
+
22812
+ var xhrAdapter = isXHRAdapterSupported && function (config) {
22813
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
22814
+ const _config = resolveConfig(config);
22815
+ let requestData = _config.data;
22816
+ const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
22817
+ let {responseType, onUploadProgress, onDownloadProgress} = _config;
22818
+ let onCanceled;
22819
+ let uploadThrottled, downloadThrottled;
22820
+ let flushUpload, flushDownload;
22821
+
22822
+ function done() {
22823
+ flushUpload && flushUpload(); // flush events
22824
+ flushDownload && flushDownload(); // flush events
22825
+
22826
+ _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
22827
+
22828
+ _config.signal && _config.signal.removeEventListener('abort', onCanceled);
22829
+ }
22830
+
22831
+ let request = new XMLHttpRequest();
22832
+
22833
+ request.open(_config.method.toUpperCase(), _config.url, true);
22834
+
22835
+ // Set the request timeout in MS
22836
+ request.timeout = _config.timeout;
22837
+
22838
+ function onloadend() {
22839
+ if (!request) {
22840
+ return;
22841
+ }
22842
+ // Prepare the response
22843
+ const responseHeaders = AxiosHeaders$1.from(
22844
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
22845
+ );
22846
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
22847
+ request.responseText : request.response;
22848
+ const response = {
22849
+ data: responseData,
22850
+ status: request.status,
22851
+ statusText: request.statusText,
22852
+ headers: responseHeaders,
22853
+ config,
22854
+ request
22855
+ };
22856
+
22857
+ settle(function _resolve(value) {
22858
+ resolve(value);
22859
+ done();
22860
+ }, function _reject(err) {
22861
+ reject(err);
22862
+ done();
22863
+ }, response);
22864
+
22865
+ // Clean up request
22866
+ request = null;
22867
+ }
22868
+
22869
+ if ('onloadend' in request) {
22870
+ // Use onloadend if available
22871
+ request.onloadend = onloadend;
22872
+ } else {
22873
+ // Listen for ready state to emulate onloadend
22874
+ request.onreadystatechange = function handleLoad() {
22875
+ if (!request || request.readyState !== 4) {
22876
+ return;
22877
+ }
22878
+
22879
+ // The request errored out and we didn't get a response, this will be
22880
+ // handled by onerror instead
22881
+ // With one exception: request that using file: protocol, most browsers
22882
+ // will return status as 0 even though it's a successful request
22883
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
22884
+ return;
22885
+ }
22886
+ // readystate handler is calling before onerror or ontimeout handlers,
22887
+ // so we should call onloadend on the next 'tick'
22888
+ setTimeout(onloadend);
22889
+ };
22890
+ }
22891
+
22892
+ // Handle browser request cancellation (as opposed to a manual cancellation)
22893
+ request.onabort = function handleAbort() {
22894
+ if (!request) {
22895
+ return;
22896
+ }
22897
+
22898
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
22899
+
22900
+ // Clean up request
22901
+ request = null;
22902
+ };
22903
+
22904
+ // Handle low level network errors
22905
+ request.onerror = function handleError(event) {
22906
+ // Browsers deliver a ProgressEvent in XHR onerror
22907
+ // (message may be empty; when present, surface it)
22908
+ // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
22909
+ const msg = event && event.message ? event.message : 'Network Error';
22910
+ const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
22911
+ // attach the underlying event for consumers who want details
22912
+ err.event = event || null;
22913
+ reject(err);
22914
+ request = null;
22915
+ };
22916
+
22917
+ // Handle timeout
22918
+ request.ontimeout = function handleTimeout() {
22919
+ let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
22920
+ const transitional = _config.transitional || transitionalDefaults;
22921
+ if (_config.timeoutErrorMessage) {
22922
+ timeoutErrorMessage = _config.timeoutErrorMessage;
22923
+ }
22924
+ reject(new AxiosError(
22925
+ timeoutErrorMessage,
22926
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
22927
+ config,
22928
+ request));
22929
+
22930
+ // Clean up request
22931
+ request = null;
22932
+ };
22933
+
22934
+ // Remove Content-Type if data is undefined
22935
+ requestData === undefined && requestHeaders.setContentType(null);
22936
+
22937
+ // Add headers to the request
22938
+ if ('setRequestHeader' in request) {
22939
+ utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
22940
+ request.setRequestHeader(key, val);
22941
+ });
22942
+ }
22943
+
22944
+ // Add withCredentials to request if needed
22945
+ if (!utils$1.isUndefined(_config.withCredentials)) {
22946
+ request.withCredentials = !!_config.withCredentials;
22947
+ }
22948
+
22949
+ // Add responseType to request if needed
22950
+ if (responseType && responseType !== 'json') {
22951
+ request.responseType = _config.responseType;
22952
+ }
22953
+
22954
+ // Handle progress if needed
22955
+ if (onDownloadProgress) {
22956
+ ([downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true));
22957
+ request.addEventListener('progress', downloadThrottled);
22958
+ }
22959
+
22960
+ // Not all browsers support upload events
22961
+ if (onUploadProgress && request.upload) {
22962
+ ([uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress));
22963
+
22964
+ request.upload.addEventListener('progress', uploadThrottled);
22965
+
22966
+ request.upload.addEventListener('loadend', flushUpload);
22967
+ }
22968
+
22969
+ if (_config.cancelToken || _config.signal) {
22970
+ // Handle cancellation
22971
+ // eslint-disable-next-line func-names
22972
+ onCanceled = cancel => {
22973
+ if (!request) {
22974
+ return;
22975
+ }
22976
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
22977
+ request.abort();
22978
+ request = null;
22979
+ };
22980
+
22981
+ _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
22982
+ if (_config.signal) {
22983
+ _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
22984
+ }
22985
+ }
22986
+
22987
+ const protocol = parseProtocol(_config.url);
22988
+
22989
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
22990
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
22991
+ return;
22992
+ }
22993
+
22994
+
22995
+ // Send the request
22996
+ request.send(requestData || null);
22997
+ });
22998
+ };
22999
+
23000
+ const composeSignals = (signals, timeout) => {
23001
+ const {length} = (signals = signals ? signals.filter(Boolean) : []);
23002
+
23003
+ if (timeout || length) {
23004
+ let controller = new AbortController();
23005
+
23006
+ let aborted;
23007
+
23008
+ const onabort = function (reason) {
23009
+ if (!aborted) {
23010
+ aborted = true;
23011
+ unsubscribe();
23012
+ const err = reason instanceof Error ? reason : this.reason;
23013
+ controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
23014
+ }
23015
+ };
23016
+
23017
+ let timer = timeout && setTimeout(() => {
23018
+ timer = null;
23019
+ onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
23020
+ }, timeout);
23021
+
23022
+ const unsubscribe = () => {
23023
+ if (signals) {
23024
+ timer && clearTimeout(timer);
23025
+ timer = null;
23026
+ signals.forEach(signal => {
23027
+ signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
23028
+ });
23029
+ signals = null;
23030
+ }
23031
+ };
23032
+
23033
+ signals.forEach((signal) => signal.addEventListener('abort', onabort));
23034
+
23035
+ const {signal} = controller;
23036
+
23037
+ signal.unsubscribe = () => utils$1.asap(unsubscribe);
23038
+
23039
+ return signal;
23040
+ }
23041
+ };
23042
+
23043
+ var composeSignals$1 = composeSignals;
23044
+
23045
+ const streamChunk = function* (chunk, chunkSize) {
23046
+ let len = chunk.byteLength;
23047
+
23048
+ if (!chunkSize || len < chunkSize) {
23049
+ yield chunk;
23050
+ return;
23051
+ }
23052
+
23053
+ let pos = 0;
23054
+ let end;
23055
+
23056
+ while (pos < len) {
23057
+ end = pos + chunkSize;
23058
+ yield chunk.slice(pos, end);
23059
+ pos = end;
23060
+ }
23061
+ };
23062
+
23063
+ const readBytes = async function* (iterable, chunkSize) {
23064
+ for await (const chunk of readStream(iterable)) {
23065
+ yield* streamChunk(chunk, chunkSize);
23066
+ }
23067
+ };
23068
+
23069
+ const readStream = async function* (stream) {
23070
+ if (stream[Symbol.asyncIterator]) {
23071
+ yield* stream;
23072
+ return;
23073
+ }
23074
+
23075
+ const reader = stream.getReader();
23076
+ try {
23077
+ for (;;) {
23078
+ const {done, value} = await reader.read();
23079
+ if (done) {
23080
+ break;
23081
+ }
23082
+ yield value;
23083
+ }
23084
+ } finally {
23085
+ await reader.cancel();
23086
+ }
23087
+ };
23088
+
23089
+ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
23090
+ const iterator = readBytes(stream, chunkSize);
23091
+
23092
+ let bytes = 0;
23093
+ let done;
23094
+ let _onFinish = (e) => {
23095
+ if (!done) {
23096
+ done = true;
23097
+ onFinish && onFinish(e);
23098
+ }
23099
+ };
23100
+
23101
+ return new ReadableStream({
23102
+ async pull(controller) {
23103
+ try {
23104
+ const {done, value} = await iterator.next();
23105
+
23106
+ if (done) {
23107
+ _onFinish();
23108
+ controller.close();
23109
+ return;
23110
+ }
23111
+
23112
+ let len = value.byteLength;
23113
+ if (onProgress) {
23114
+ let loadedBytes = bytes += len;
23115
+ onProgress(loadedBytes);
23116
+ }
23117
+ controller.enqueue(new Uint8Array(value));
23118
+ } catch (err) {
23119
+ _onFinish(err);
23120
+ throw err;
23121
+ }
23122
+ },
23123
+ cancel(reason) {
23124
+ _onFinish(reason);
23125
+ return iterator.return();
23126
+ }
23127
+ }, {
23128
+ highWaterMark: 2
23129
+ })
23130
+ };
23131
+
23132
+ const DEFAULT_CHUNK_SIZE = 64 * 1024;
23133
+
23134
+ const {isFunction} = utils$1;
23135
+
23136
+ const globalFetchAPI = (({Request, Response}) => ({
23137
+ Request, Response
23138
+ }))(utils$1.global);
23139
+
23140
+ const {
23141
+ ReadableStream: ReadableStream$1, TextEncoder
23142
+ } = utils$1.global;
23143
+
23144
+
23145
+ const test = (fn, ...args) => {
23146
+ try {
23147
+ return !!fn(...args);
23148
+ } catch (e) {
23149
+ return false
23150
+ }
23151
+ };
23152
+
23153
+ const factory = (env) => {
23154
+ env = utils$1.merge.call({
23155
+ skipUndefined: true
23156
+ }, globalFetchAPI, env);
23157
+
23158
+ const {fetch: envFetch, Request, Response} = env;
23159
+ const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
23160
+ const isRequestSupported = isFunction(Request);
23161
+ const isResponseSupported = isFunction(Response);
23162
+
23163
+ if (!isFetchSupported) {
23164
+ return false;
23165
+ }
23166
+
23167
+ const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
23168
+
23169
+ const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
23170
+ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
23171
+ async (str) => new Uint8Array(await new Request(str).arrayBuffer())
23172
+ );
23173
+
23174
+ const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
23175
+ let duplexAccessed = false;
23176
+
23177
+ const hasContentType = new Request(platform.origin, {
23178
+ body: new ReadableStream$1(),
23179
+ method: 'POST',
23180
+ get duplex() {
23181
+ duplexAccessed = true;
23182
+ return 'half';
23183
+ },
23184
+ }).headers.has('Content-Type');
23185
+
23186
+ return duplexAccessed && !hasContentType;
23187
+ });
23188
+
23189
+ const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
23190
+ test(() => utils$1.isReadableStream(new Response('').body));
23191
+
23192
+ const resolvers = {
23193
+ stream: supportsResponseStream && ((res) => res.body)
23194
+ };
23195
+
23196
+ isFetchSupported && ((() => {
23197
+ ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
23198
+ !resolvers[type] && (resolvers[type] = (res, config) => {
23199
+ let method = res && res[type];
23200
+
23201
+ if (method) {
23202
+ return method.call(res);
23203
+ }
23204
+
23205
+ throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
23206
+ });
23207
+ });
23208
+ })());
23209
+
23210
+ const getBodyLength = async (body) => {
23211
+ if (body == null) {
23212
+ return 0;
23213
+ }
23214
+
23215
+ if (utils$1.isBlob(body)) {
23216
+ return body.size;
23217
+ }
23218
+
23219
+ if (utils$1.isSpecCompliantForm(body)) {
23220
+ const _request = new Request(platform.origin, {
23221
+ method: 'POST',
23222
+ body,
23223
+ });
23224
+ return (await _request.arrayBuffer()).byteLength;
23225
+ }
23226
+
23227
+ if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
23228
+ return body.byteLength;
23229
+ }
23230
+
23231
+ if (utils$1.isURLSearchParams(body)) {
23232
+ body = body + '';
23233
+ }
23234
+
23235
+ if (utils$1.isString(body)) {
23236
+ return (await encodeText(body)).byteLength;
23237
+ }
23238
+ };
23239
+
23240
+ const resolveBodyLength = async (headers, body) => {
23241
+ const length = utils$1.toFiniteNumber(headers.getContentLength());
23242
+
23243
+ return length == null ? getBodyLength(body) : length;
23244
+ };
23245
+
23246
+ return async (config) => {
23247
+ let {
23248
+ url,
23249
+ method,
23250
+ data,
23251
+ signal,
23252
+ cancelToken,
23253
+ timeout,
23254
+ onDownloadProgress,
23255
+ onUploadProgress,
23256
+ responseType,
23257
+ headers,
23258
+ withCredentials = 'same-origin',
23259
+ fetchOptions
23260
+ } = resolveConfig(config);
23261
+
23262
+ let _fetch = envFetch || fetch;
23263
+
23264
+ responseType = responseType ? (responseType + '').toLowerCase() : 'text';
23265
+
23266
+ let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
23267
+
23268
+ let request = null;
23269
+
23270
+ const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
23271
+ composedSignal.unsubscribe();
23272
+ });
23273
+
23274
+ let requestContentLength;
23275
+
23276
+ try {
23277
+ if (
23278
+ onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
23279
+ (requestContentLength = await resolveBodyLength(headers, data)) !== 0
23280
+ ) {
23281
+ let _request = new Request(url, {
23282
+ method: 'POST',
23283
+ body: data,
23284
+ duplex: "half"
23285
+ });
23286
+
23287
+ let contentTypeHeader;
23288
+
23289
+ if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
23290
+ headers.setContentType(contentTypeHeader);
23291
+ }
23292
+
23293
+ if (_request.body) {
23294
+ const [onProgress, flush] = progressEventDecorator(
23295
+ requestContentLength,
23296
+ progressEventReducer(asyncDecorator(onUploadProgress))
23297
+ );
23298
+
23299
+ data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
23300
+ }
23301
+ }
23302
+
23303
+ if (!utils$1.isString(withCredentials)) {
23304
+ withCredentials = withCredentials ? 'include' : 'omit';
23305
+ }
23306
+
23307
+ // Cloudflare Workers throws when credentials are defined
23308
+ // see https://github.com/cloudflare/workerd/issues/902
23309
+ const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
23310
+
23311
+ const resolvedOptions = {
23312
+ ...fetchOptions,
23313
+ signal: composedSignal,
23314
+ method: method.toUpperCase(),
23315
+ headers: headers.normalize().toJSON(),
23316
+ body: data,
23317
+ duplex: "half",
23318
+ credentials: isCredentialsSupported ? withCredentials : undefined
23319
+ };
23320
+
23321
+ request = isRequestSupported && new Request(url, resolvedOptions);
23322
+
23323
+ let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
23324
+
23325
+ const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
23326
+
23327
+ if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
23328
+ const options = {};
23329
+
23330
+ ['status', 'statusText', 'headers'].forEach(prop => {
23331
+ options[prop] = response[prop];
23332
+ });
23333
+
23334
+ const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
23335
+
23336
+ const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
23337
+ responseContentLength,
23338
+ progressEventReducer(asyncDecorator(onDownloadProgress), true)
23339
+ ) || [];
23340
+
23341
+ response = new Response(
23342
+ trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
23343
+ flush && flush();
23344
+ unsubscribe && unsubscribe();
23345
+ }),
23346
+ options
23347
+ );
23348
+ }
23349
+
23350
+ responseType = responseType || 'text';
23351
+
23352
+ let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
23353
+
23354
+ !isStreamResponse && unsubscribe && unsubscribe();
23355
+
23356
+ return await new Promise((resolve, reject) => {
23357
+ settle(resolve, reject, {
23358
+ data: responseData,
23359
+ headers: AxiosHeaders$1.from(response.headers),
23360
+ status: response.status,
23361
+ statusText: response.statusText,
23362
+ config,
23363
+ request
23364
+ });
23365
+ })
23366
+ } catch (err) {
23367
+ unsubscribe && unsubscribe();
23368
+
23369
+ if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
23370
+ throw Object.assign(
23371
+ new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
23372
+ {
23373
+ cause: err.cause || err
23374
+ }
23375
+ )
23376
+ }
23377
+
23378
+ throw AxiosError.from(err, err && err.code, config, request);
23379
+ }
23380
+ }
23381
+ };
23382
+
23383
+ const seedCache = new Map();
23384
+
23385
+ const getFetch = (config) => {
23386
+ let env = config ? config.env : {};
23387
+ const {fetch, Request, Response} = env;
23388
+ const seeds = [
23389
+ Request, Response, fetch
23390
+ ];
23391
+
23392
+ let len = seeds.length, i = len,
23393
+ seed, target, map = seedCache;
23394
+
23395
+ while (i--) {
23396
+ seed = seeds[i];
23397
+ target = map.get(seed);
23398
+
23399
+ target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
23400
+
23401
+ map = target;
23402
+ }
23403
+
23404
+ return target;
23405
+ };
23406
+
23407
+ getFetch();
23408
+
23409
+ const knownAdapters = {
23410
+ http: httpAdapter,
23411
+ xhr: xhrAdapter,
23412
+ fetch: {
23413
+ get: getFetch,
23414
+ }
23415
+ };
23416
+
23417
+ utils$1.forEach(knownAdapters, (fn, value) => {
23418
+ if (fn) {
23419
+ try {
23420
+ Object.defineProperty(fn, 'name', {value});
23421
+ } catch (e) {
23422
+ // eslint-disable-next-line no-empty
23423
+ }
23424
+ Object.defineProperty(fn, 'adapterName', {value});
23425
+ }
23426
+ });
23427
+
23428
+ const renderReason = (reason) => `- ${reason}`;
23429
+
23430
+ const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
23431
+
23432
+ var adapters = {
23433
+ getAdapter: (adapters, config) => {
23434
+ adapters = utils$1.isArray(adapters) ? adapters : [adapters];
23435
+
23436
+ const {length} = adapters;
23437
+ let nameOrAdapter;
23438
+ let adapter;
23439
+
23440
+ const rejectedReasons = {};
23441
+
23442
+ for (let i = 0; i < length; i++) {
23443
+ nameOrAdapter = adapters[i];
23444
+ let id;
23445
+
23446
+ adapter = nameOrAdapter;
23447
+
23448
+ if (!isResolvedHandle(nameOrAdapter)) {
23449
+ adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
23450
+
23451
+ if (adapter === undefined) {
23452
+ throw new AxiosError(`Unknown adapter '${id}'`);
23453
+ }
23454
+ }
23455
+
23456
+ if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
23457
+ break;
23458
+ }
23459
+
23460
+ rejectedReasons[id || '#' + i] = adapter;
23461
+ }
23462
+
23463
+ if (!adapter) {
23464
+
23465
+ const reasons = Object.entries(rejectedReasons)
23466
+ .map(([id, state]) => `adapter ${id} ` +
23467
+ (state === false ? 'is not supported by the environment' : 'is not available in the build')
23468
+ );
23469
+
23470
+ let s = length ?
23471
+ (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
23472
+ 'as no adapter specified';
23473
+
23474
+ throw new AxiosError(
23475
+ `There is no suitable adapter to dispatch the request ` + s,
23476
+ 'ERR_NOT_SUPPORT'
23477
+ );
23478
+ }
23479
+
23480
+ return adapter;
23481
+ },
23482
+ adapters: knownAdapters
23483
+ };
23484
+
23485
+ /**
23486
+ * Throws a `CanceledError` if cancellation has been requested.
23487
+ *
23488
+ * @param {Object} config The config that is to be used for the request
23489
+ *
23490
+ * @returns {void}
23491
+ */
23492
+ function throwIfCancellationRequested(config) {
23493
+ if (config.cancelToken) {
23494
+ config.cancelToken.throwIfRequested();
23495
+ }
23496
+
23497
+ if (config.signal && config.signal.aborted) {
23498
+ throw new CanceledError(null, config);
23499
+ }
23500
+ }
23501
+
23502
+ /**
23503
+ * Dispatch a request to the server using the configured adapter.
23504
+ *
23505
+ * @param {object} config The config that is to be used for the request
23506
+ *
23507
+ * @returns {Promise} The Promise to be fulfilled
23508
+ */
23509
+ function dispatchRequest(config) {
23510
+ throwIfCancellationRequested(config);
23511
+
23512
+ config.headers = AxiosHeaders$1.from(config.headers);
23513
+
23514
+ // Transform request data
23515
+ config.data = transformData.call(
23516
+ config,
23517
+ config.transformRequest
23518
+ );
23519
+
23520
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
23521
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
23522
+ }
23523
+
23524
+ const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
23525
+
23526
+ return adapter(config).then(function onAdapterResolution(response) {
23527
+ throwIfCancellationRequested(config);
23528
+
23529
+ // Transform response data
23530
+ response.data = transformData.call(
23531
+ config,
23532
+ config.transformResponse,
23533
+ response
23534
+ );
23535
+
23536
+ response.headers = AxiosHeaders$1.from(response.headers);
23537
+
23538
+ return response;
23539
+ }, function onAdapterRejection(reason) {
23540
+ if (!isCancel(reason)) {
23541
+ throwIfCancellationRequested(config);
23542
+
23543
+ // Transform response data
23544
+ if (reason && reason.response) {
23545
+ reason.response.data = transformData.call(
23546
+ config,
23547
+ config.transformResponse,
23548
+ reason.response
23549
+ );
23550
+ reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
23551
+ }
23552
+ }
23553
+
23554
+ return Promise.reject(reason);
23555
+ });
23556
+ }
23557
+
23558
+ const VERSION = "1.12.2";
23559
+
23560
+ const validators$1 = {};
23561
+
23562
+ // eslint-disable-next-line func-names
23563
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
23564
+ validators$1[type] = function validator(thing) {
23565
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
23566
+ };
23567
+ });
23568
+
23569
+ const deprecatedWarnings = {};
23570
+
23571
+ /**
23572
+ * Transitional option validator
23573
+ *
23574
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
23575
+ * @param {string?} version - deprecated version / removed since version
23576
+ * @param {string?} message - some message with additional info
23577
+ *
23578
+ * @returns {function}
23579
+ */
23580
+ validators$1.transitional = function transitional(validator, version, message) {
23581
+ function formatMessage(opt, desc) {
23582
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
23583
+ }
23584
+
23585
+ // eslint-disable-next-line func-names
23586
+ return (value, opt, opts) => {
23587
+ if (validator === false) {
23588
+ throw new AxiosError(
23589
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
23590
+ AxiosError.ERR_DEPRECATED
23591
+ );
23592
+ }
23593
+
23594
+ if (version && !deprecatedWarnings[opt]) {
23595
+ deprecatedWarnings[opt] = true;
23596
+ // eslint-disable-next-line no-console
23597
+ console.warn(
23598
+ formatMessage(
23599
+ opt,
23600
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
23601
+ )
23602
+ );
23603
+ }
23604
+
23605
+ return validator ? validator(value, opt, opts) : true;
23606
+ };
23607
+ };
23608
+
23609
+ validators$1.spelling = function spelling(correctSpelling) {
23610
+ return (value, opt) => {
23611
+ // eslint-disable-next-line no-console
23612
+ console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
23613
+ return true;
23614
+ }
23615
+ };
23616
+
23617
+ /**
23618
+ * Assert object's properties type
23619
+ *
23620
+ * @param {object} options
23621
+ * @param {object} schema
23622
+ * @param {boolean?} allowUnknown
23623
+ *
23624
+ * @returns {object}
23625
+ */
23626
+
23627
+ function assertOptions(options, schema, allowUnknown) {
23628
+ if (typeof options !== 'object') {
23629
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
23630
+ }
23631
+ const keys = Object.keys(options);
23632
+ let i = keys.length;
23633
+ while (i-- > 0) {
23634
+ const opt = keys[i];
23635
+ const validator = schema[opt];
23636
+ if (validator) {
23637
+ const value = options[opt];
23638
+ const result = value === undefined || validator(value, opt, options);
23639
+ if (result !== true) {
23640
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
23641
+ }
23642
+ continue;
23643
+ }
23644
+ if (allowUnknown !== true) {
23645
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
23646
+ }
23647
+ }
23648
+ }
23649
+
23650
+ var validator = {
23651
+ assertOptions,
23652
+ validators: validators$1
23653
+ };
23654
+
23655
+ const validators = validator.validators;
23656
+
23657
+ /**
23658
+ * Create a new instance of Axios
23659
+ *
23660
+ * @param {Object} instanceConfig The default config for the instance
23661
+ *
23662
+ * @return {Axios} A new instance of Axios
23663
+ */
23664
+ class Axios {
23665
+ constructor(instanceConfig) {
23666
+ this.defaults = instanceConfig || {};
23667
+ this.interceptors = {
23668
+ request: new InterceptorManager$1(),
23669
+ response: new InterceptorManager$1()
23670
+ };
23671
+ }
23672
+
23673
+ /**
23674
+ * Dispatch a request
23675
+ *
23676
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
23677
+ * @param {?Object} config
23678
+ *
23679
+ * @returns {Promise} The Promise to be fulfilled
23680
+ */
23681
+ async request(configOrUrl, config) {
23682
+ try {
23683
+ return await this._request(configOrUrl, config);
23684
+ } catch (err) {
23685
+ if (err instanceof Error) {
23686
+ let dummy = {};
23687
+
23688
+ Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
23689
+
23690
+ // slice off the Error: ... line
23691
+ const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
23692
+ try {
23693
+ if (!err.stack) {
23694
+ err.stack = stack;
23695
+ // match without the 2 top stack lines
23696
+ } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
23697
+ err.stack += '\n' + stack;
23698
+ }
23699
+ } catch (e) {
23700
+ // ignore the case where "stack" is an un-writable property
23701
+ }
23702
+ }
23703
+
23704
+ throw err;
23705
+ }
23706
+ }
23707
+
23708
+ _request(configOrUrl, config) {
23709
+ /*eslint no-param-reassign:0*/
23710
+ // Allow for axios('example/url'[, config]) a la fetch API
23711
+ if (typeof configOrUrl === 'string') {
23712
+ config = config || {};
23713
+ config.url = configOrUrl;
23714
+ } else {
23715
+ config = configOrUrl || {};
23716
+ }
23717
+
23718
+ config = mergeConfig(this.defaults, config);
23719
+
23720
+ const {transitional, paramsSerializer, headers} = config;
23721
+
23722
+ if (transitional !== undefined) {
23723
+ validator.assertOptions(transitional, {
23724
+ silentJSONParsing: validators.transitional(validators.boolean),
23725
+ forcedJSONParsing: validators.transitional(validators.boolean),
23726
+ clarifyTimeoutError: validators.transitional(validators.boolean)
23727
+ }, false);
23728
+ }
23729
+
23730
+ if (paramsSerializer != null) {
23731
+ if (utils$1.isFunction(paramsSerializer)) {
23732
+ config.paramsSerializer = {
23733
+ serialize: paramsSerializer
23734
+ };
23735
+ } else {
23736
+ validator.assertOptions(paramsSerializer, {
23737
+ encode: validators.function,
23738
+ serialize: validators.function
23739
+ }, true);
23740
+ }
23741
+ }
23742
+
23743
+ // Set config.allowAbsoluteUrls
23744
+ if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
23745
+ config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
23746
+ } else {
23747
+ config.allowAbsoluteUrls = true;
23748
+ }
23749
+
23750
+ validator.assertOptions(config, {
23751
+ baseUrl: validators.spelling('baseURL'),
23752
+ withXsrfToken: validators.spelling('withXSRFToken')
23753
+ }, true);
23754
+
23755
+ // Set config.method
23756
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
23757
+
23758
+ // Flatten headers
23759
+ let contextHeaders = headers && utils$1.merge(
23760
+ headers.common,
23761
+ headers[config.method]
23762
+ );
23763
+
23764
+ headers && utils$1.forEach(
23765
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
23766
+ (method) => {
23767
+ delete headers[method];
23768
+ }
23769
+ );
23770
+
23771
+ config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
23772
+
23773
+ // filter out skipped interceptors
23774
+ const requestInterceptorChain = [];
23775
+ let synchronousRequestInterceptors = true;
23776
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
23777
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
23778
+ return;
23779
+ }
23780
+
23781
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
23782
+
23783
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
23784
+ });
23785
+
23786
+ const responseInterceptorChain = [];
23787
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
23788
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
23789
+ });
23790
+
23791
+ let promise;
23792
+ let i = 0;
23793
+ let len;
23794
+
23795
+ if (!synchronousRequestInterceptors) {
23796
+ const chain = [dispatchRequest.bind(this), undefined];
23797
+ chain.unshift(...requestInterceptorChain);
23798
+ chain.push(...responseInterceptorChain);
23799
+ len = chain.length;
23800
+
23801
+ promise = Promise.resolve(config);
23802
+
23803
+ while (i < len) {
23804
+ promise = promise.then(chain[i++], chain[i++]);
23805
+ }
23806
+
23807
+ return promise;
23808
+ }
23809
+
23810
+ len = requestInterceptorChain.length;
23811
+
23812
+ let newConfig = config;
23813
+
23814
+ while (i < len) {
23815
+ const onFulfilled = requestInterceptorChain[i++];
23816
+ const onRejected = requestInterceptorChain[i++];
23817
+ try {
23818
+ newConfig = onFulfilled(newConfig);
23819
+ } catch (error) {
23820
+ onRejected.call(this, error);
23821
+ break;
23822
+ }
23823
+ }
23824
+
23825
+ try {
23826
+ promise = dispatchRequest.call(this, newConfig);
23827
+ } catch (error) {
23828
+ return Promise.reject(error);
23829
+ }
23830
+
23831
+ i = 0;
23832
+ len = responseInterceptorChain.length;
23833
+
23834
+ while (i < len) {
23835
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
23836
+ }
23837
+
23838
+ return promise;
23839
+ }
23840
+
23841
+ getUri(config) {
23842
+ config = mergeConfig(this.defaults, config);
23843
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
23844
+ return buildURL(fullPath, config.params, config.paramsSerializer);
23845
+ }
23846
+ }
23847
+
23848
+ // Provide aliases for supported request methods
23849
+ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
23850
+ /*eslint func-names:0*/
23851
+ Axios.prototype[method] = function(url, config) {
23852
+ return this.request(mergeConfig(config || {}, {
23853
+ method,
23854
+ url,
23855
+ data: (config || {}).data
23856
+ }));
23857
+ };
23858
+ });
23859
+
23860
+ utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
23861
+ /*eslint func-names:0*/
23862
+
23863
+ function generateHTTPMethod(isForm) {
23864
+ return function httpMethod(url, data, config) {
23865
+ return this.request(mergeConfig(config || {}, {
23866
+ method,
23867
+ headers: isForm ? {
23868
+ 'Content-Type': 'multipart/form-data'
23869
+ } : {},
23870
+ url,
23871
+ data
23872
+ }));
23873
+ };
23874
+ }
23875
+
23876
+ Axios.prototype[method] = generateHTTPMethod();
23877
+
23878
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
23879
+ });
23880
+
23881
+ var Axios$1 = Axios;
23882
+
23883
+ /**
23884
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
23885
+ *
23886
+ * @param {Function} executor The executor function.
23887
+ *
23888
+ * @returns {CancelToken}
23889
+ */
23890
+ class CancelToken {
23891
+ constructor(executor) {
23892
+ if (typeof executor !== 'function') {
23893
+ throw new TypeError('executor must be a function.');
23894
+ }
23895
+
23896
+ let resolvePromise;
23897
+
23898
+ this.promise = new Promise(function promiseExecutor(resolve) {
23899
+ resolvePromise = resolve;
23900
+ });
23901
+
23902
+ const token = this;
23903
+
23904
+ // eslint-disable-next-line func-names
23905
+ this.promise.then(cancel => {
23906
+ if (!token._listeners) return;
23907
+
23908
+ let i = token._listeners.length;
23909
+
23910
+ while (i-- > 0) {
23911
+ token._listeners[i](cancel);
23912
+ }
23913
+ token._listeners = null;
23914
+ });
23915
+
23916
+ // eslint-disable-next-line func-names
23917
+ this.promise.then = onfulfilled => {
23918
+ let _resolve;
23919
+ // eslint-disable-next-line func-names
23920
+ const promise = new Promise(resolve => {
23921
+ token.subscribe(resolve);
23922
+ _resolve = resolve;
23923
+ }).then(onfulfilled);
23924
+
23925
+ promise.cancel = function reject() {
23926
+ token.unsubscribe(_resolve);
23927
+ };
23928
+
23929
+ return promise;
23930
+ };
23931
+
23932
+ executor(function cancel(message, config, request) {
23933
+ if (token.reason) {
23934
+ // Cancellation has already been requested
23935
+ return;
23936
+ }
23937
+
23938
+ token.reason = new CanceledError(message, config, request);
23939
+ resolvePromise(token.reason);
23940
+ });
23941
+ }
23942
+
23943
+ /**
23944
+ * Throws a `CanceledError` if cancellation has been requested.
23945
+ */
23946
+ throwIfRequested() {
23947
+ if (this.reason) {
23948
+ throw this.reason;
23949
+ }
23950
+ }
23951
+
23952
+ /**
23953
+ * Subscribe to the cancel signal
23954
+ */
23955
+
23956
+ subscribe(listener) {
23957
+ if (this.reason) {
23958
+ listener(this.reason);
23959
+ return;
23960
+ }
23961
+
23962
+ if (this._listeners) {
23963
+ this._listeners.push(listener);
23964
+ } else {
23965
+ this._listeners = [listener];
23966
+ }
23967
+ }
23968
+
23969
+ /**
23970
+ * Unsubscribe from the cancel signal
23971
+ */
23972
+
23973
+ unsubscribe(listener) {
23974
+ if (!this._listeners) {
23975
+ return;
23976
+ }
23977
+ const index = this._listeners.indexOf(listener);
23978
+ if (index !== -1) {
23979
+ this._listeners.splice(index, 1);
23980
+ }
23981
+ }
23982
+
23983
+ toAbortSignal() {
23984
+ const controller = new AbortController();
23985
+
23986
+ const abort = (err) => {
23987
+ controller.abort(err);
23988
+ };
23989
+
23990
+ this.subscribe(abort);
23991
+
23992
+ controller.signal.unsubscribe = () => this.unsubscribe(abort);
23993
+
23994
+ return controller.signal;
23995
+ }
23996
+
23997
+ /**
23998
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
23999
+ * cancels the `CancelToken`.
24000
+ */
24001
+ static source() {
24002
+ let cancel;
24003
+ const token = new CancelToken(function executor(c) {
24004
+ cancel = c;
24005
+ });
24006
+ return {
24007
+ token,
24008
+ cancel
24009
+ };
24010
+ }
24011
+ }
24012
+
24013
+ var CancelToken$1 = CancelToken;
24014
+
24015
+ /**
24016
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
24017
+ *
24018
+ * Common use case would be to use `Function.prototype.apply`.
24019
+ *
24020
+ * ```js
24021
+ * function f(x, y, z) {}
24022
+ * var args = [1, 2, 3];
24023
+ * f.apply(null, args);
24024
+ * ```
24025
+ *
24026
+ * With `spread` this example can be re-written.
24027
+ *
24028
+ * ```js
24029
+ * spread(function(x, y, z) {})([1, 2, 3]);
24030
+ * ```
24031
+ *
24032
+ * @param {Function} callback
24033
+ *
24034
+ * @returns {Function}
24035
+ */
24036
+ function spread(callback) {
24037
+ return function wrap(arr) {
24038
+ return callback.apply(null, arr);
24039
+ };
24040
+ }
24041
+
24042
+ /**
24043
+ * Determines whether the payload is an error thrown by Axios
24044
+ *
24045
+ * @param {*} payload The value to test
24046
+ *
24047
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
24048
+ */
24049
+ function isAxiosError(payload) {
24050
+ return utils$1.isObject(payload) && (payload.isAxiosError === true);
24051
+ }
24052
+
24053
+ const HttpStatusCode = {
24054
+ Continue: 100,
24055
+ SwitchingProtocols: 101,
24056
+ Processing: 102,
24057
+ EarlyHints: 103,
24058
+ Ok: 200,
24059
+ Created: 201,
24060
+ Accepted: 202,
24061
+ NonAuthoritativeInformation: 203,
24062
+ NoContent: 204,
24063
+ ResetContent: 205,
24064
+ PartialContent: 206,
24065
+ MultiStatus: 207,
24066
+ AlreadyReported: 208,
24067
+ ImUsed: 226,
24068
+ MultipleChoices: 300,
24069
+ MovedPermanently: 301,
24070
+ Found: 302,
24071
+ SeeOther: 303,
24072
+ NotModified: 304,
24073
+ UseProxy: 305,
24074
+ Unused: 306,
24075
+ TemporaryRedirect: 307,
24076
+ PermanentRedirect: 308,
24077
+ BadRequest: 400,
24078
+ Unauthorized: 401,
24079
+ PaymentRequired: 402,
24080
+ Forbidden: 403,
24081
+ NotFound: 404,
24082
+ MethodNotAllowed: 405,
24083
+ NotAcceptable: 406,
24084
+ ProxyAuthenticationRequired: 407,
24085
+ RequestTimeout: 408,
24086
+ Conflict: 409,
24087
+ Gone: 410,
24088
+ LengthRequired: 411,
24089
+ PreconditionFailed: 412,
24090
+ PayloadTooLarge: 413,
24091
+ UriTooLong: 414,
24092
+ UnsupportedMediaType: 415,
24093
+ RangeNotSatisfiable: 416,
24094
+ ExpectationFailed: 417,
24095
+ ImATeapot: 418,
24096
+ MisdirectedRequest: 421,
24097
+ UnprocessableEntity: 422,
24098
+ Locked: 423,
24099
+ FailedDependency: 424,
24100
+ TooEarly: 425,
24101
+ UpgradeRequired: 426,
24102
+ PreconditionRequired: 428,
24103
+ TooManyRequests: 429,
24104
+ RequestHeaderFieldsTooLarge: 431,
24105
+ UnavailableForLegalReasons: 451,
24106
+ InternalServerError: 500,
24107
+ NotImplemented: 501,
24108
+ BadGateway: 502,
24109
+ ServiceUnavailable: 503,
24110
+ GatewayTimeout: 504,
24111
+ HttpVersionNotSupported: 505,
24112
+ VariantAlsoNegotiates: 506,
24113
+ InsufficientStorage: 507,
24114
+ LoopDetected: 508,
24115
+ NotExtended: 510,
24116
+ NetworkAuthenticationRequired: 511,
24117
+ };
24118
+
24119
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
24120
+ HttpStatusCode[value] = key;
24121
+ });
24122
+
24123
+ var HttpStatusCode$1 = HttpStatusCode;
24124
+
24125
+ /**
24126
+ * Create an instance of Axios
24127
+ *
24128
+ * @param {Object} defaultConfig The default config for the instance
24129
+ *
24130
+ * @returns {Axios} A new instance of Axios
24131
+ */
24132
+ function createInstance(defaultConfig) {
24133
+ const context = new Axios$1(defaultConfig);
24134
+ const instance = bind(Axios$1.prototype.request, context);
24135
+
24136
+ // Copy axios.prototype to instance
24137
+ utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
24138
+
24139
+ // Copy context to instance
24140
+ utils$1.extend(instance, context, null, {allOwnKeys: true});
24141
+
24142
+ // Factory for creating new instances
24143
+ instance.create = function create(instanceConfig) {
24144
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
24145
+ };
24146
+
24147
+ return instance;
24148
+ }
24149
+
24150
+ // Create the default instance to be exported
24151
+ const axios = createInstance(defaults$1);
24152
+
24153
+ // Expose Axios class to allow class inheritance
24154
+ axios.Axios = Axios$1;
24155
+
24156
+ // Expose Cancel & CancelToken
24157
+ axios.CanceledError = CanceledError;
24158
+ axios.CancelToken = CancelToken$1;
24159
+ axios.isCancel = isCancel;
24160
+ axios.VERSION = VERSION;
24161
+ axios.toFormData = toFormData;
24162
+
24163
+ // Expose AxiosError class
24164
+ axios.AxiosError = AxiosError;
24165
+
24166
+ // alias for CanceledError for backward compatibility
24167
+ axios.Cancel = axios.CanceledError;
24168
+
24169
+ // Expose all/spread
24170
+ axios.all = function all(promises) {
24171
+ return Promise.all(promises);
24172
+ };
24173
+
24174
+ axios.spread = spread;
24175
+
24176
+ // Expose isAxiosError
24177
+ axios.isAxiosError = isAxiosError;
24178
+
24179
+ // Expose mergeConfig
24180
+ axios.mergeConfig = mergeConfig;
24181
+
24182
+ axios.AxiosHeaders = AxiosHeaders$1;
24183
+
24184
+ axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
24185
+
24186
+ axios.getAdapter = adapters.getAdapter;
24187
+
24188
+ axios.HttpStatusCode = HttpStatusCode$1;
24189
+
24190
+ axios.default = axios;
24191
+
24192
+ axios_1 = axios;
24193
+
24194
+ return axios_1;
24195
+ }
24196
+
24197
+ var axiosExports = /*@__PURE__*/ requireAxios();
24198
+ var axios = /*@__PURE__*/getDefaultExportFromCjs(axiosExports);
24199
+
24200
+ ////////////////////////////////////////////////////////////////////////
24201
+ /// Parameters used by the default platform (valid for UK/EU processing)
24202
+ /// https://docs.aws.amazon.com/appsync/latest/eventapi/event-api-websocket-protocol.html
24203
+ ////////////////////////////////////////////////////////////////////////
24204
+ const Parameters = {
24205
+ endpoints: {
24206
+ graphQL: "https://k2howlr3ynfy3lbx7oxz4qyrlq.appsync-api.eu-west-2.amazonaws.com/graphql",
24207
+ wssHost: "dypxviim4zgwtpev7valhchaem.appsync-api.eu-west-2.amazonaws.com",
24208
+ wssRealTime: 'wss://dypxviim4zgwtpev7valhchaem.appsync-realtime-api.eu-west-2.amazonaws.com/graphql'
24209
+ },
24210
+ buckets: {
24211
+ region: "eu-west-2",
24212
+ clearing: "lon-files-clearing",
24213
+ },
24214
+ };
24215
+
24216
+ // Construct all mutations for a template element.
24217
+ const createElement = element => {
24218
+ return `
24219
+ mutation AddField {
24220
+ createTemplateElement(input: {
24221
+ templateId: "${element.templateId}",
24222
+ ax: ${element.ax},
24223
+ ay: ${element.ay},
24224
+ bx: ${element.bx},
24225
+ by: ${element.by},
24226
+ elementType: ${JSON.stringify(element.elementType)},
24227
+ role: "1",
24228
+ label: ${JSON.stringify(element.label)},
24229
+ page: ${element.page},
24230
+ fieldOrder: ${element.fieldOrder},
24231
+ fontName: ${JSON.stringify(element.fontName)},
24232
+ fontSize: ${element.fontSize},
24233
+ helpText: ${JSON.stringify(element.helpText)},
24234
+ hideBorder: ${element.hideBorder},
24235
+ logicGroup: ${JSON.stringify(element.logicGroup)},
24236
+ mapTo: ${JSON.stringify(element.mapTo)},
24237
+ optional: ${element.optional},
24238
+ options: ${JSON.stringify(element.options)},
24239
+ substantive: ${element.substantive},
24240
+ validation: ${element.validation},
24241
+ value: ${JSON.stringify(element.value)},
24242
+ align: ${JSON.stringify(element.align)},
24243
+ signer: ${element.signer},
24244
+ logicAction: ${element.logicAction},
24245
+ labelExtra: ${JSON.stringify(element.labelExtra)}})
24246
+ }`;
24247
+ };
24248
+ // Save any changes to an element
24249
+ const updateElement = element => {
24250
+ return `mutation ChangeField {
24251
+ updateTemplateElement(input: {
24252
+ templateElementId: "${element.id}",
24253
+ ax: ${element.ax},
24254
+ ay: ${element.ay},
24255
+ bx: ${element.bx},
24256
+ by: ${element.by},
24257
+ elementType: ${JSON.stringify(element.elementType)},
24258
+ label: ${JSON.stringify(element.label)},
24259
+ page: ${element.page},
24260
+ fieldOrder: ${element.fieldOrder ? element.fieldOrder : null},
24261
+ fontName: ${JSON.stringify(element.fontName)},
24262
+ fontSize: ${element.fontSize},
24263
+ helpText: "${element.helpText}",
24264
+ hideBorder: ${element.hideBorder},
24265
+ logicGroup: ${JSON.stringify(element.logicGroup)},
24266
+ mapTo: "${element.mapTo}",
24267
+ optional: ${element.optional},
24268
+ options: ${JSON.stringify(element.options)},
24269
+ role: "1",
24270
+ substantive: ${element.substantive},
24271
+ validation: ${element.validation === '0' ? 'null' : element.validation},
24272
+ value: "${element.value}",
24273
+ align: "${element.align}",
24274
+ signer: ${element.signer},
24275
+ logicAction: ${element.logicAction},
24276
+ labelExtra: "${element.labelExtra}"})
24277
+ }`;
24278
+ };
24279
+ // Save any changes to an element
24280
+ const deleteElement = obj => {
24281
+ return `mutation DeleteField {
24282
+ deleteTemplateElement(input: {
24283
+ templateElementId: "${obj.id}"})
24284
+ }`;
24285
+ };
24286
+
24287
+ // Add a role
24288
+ const createRole = (role) => {
24289
+ const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
24290
+ return `
24291
+ mutation AddRole {
24292
+ createTemplateRole(input: {
24293
+ templateId: "${role.templateId}"
24294
+ signerIndex: ${role.signerIndex}
24295
+ signerParent: ${newParent}
24296
+ name: ${JSON.stringify(role.name)}
24297
+ ordinal: ${role.ordinal}
24298
+ roleType: ${role.roleType}
24299
+ experience: "${role.experience}"
24300
+ })
24301
+ }`;
24302
+ };
24303
+ // Remove a role
24304
+ const deleteRole = (role) => {
24305
+ return `
24306
+ mutation removeRole {
24307
+ deleteTemplateRole(input: {
24308
+ templateRoleId: "${role.id}"
24309
+ })
24310
+ }`;
24311
+ };
24312
+ // Save any changes to an role
24313
+ const updateRole = (role) => {
24314
+ const newParent = role?.signerParent ? `"${role.signerParent}"` : 'null';
24315
+ return `
24316
+ mutation updateRole {
24317
+ updateTemplateRole(input: {
24318
+ templateRoleId: "${role.id}"
24319
+ signerIndex: ${role.signerIndex}
24320
+ ordinal: ${role.ordinal}
24321
+ signerParent: ${newParent}
24322
+ name: ${JSON.stringify(role.name)}
24323
+ roleType: ${role.roleType}
24324
+ experience: "${role.experience}"
24325
+ })
24326
+ }`;
24327
+ };
24328
+ // swap two adjacent roles
24329
+ const swapRoles = (roleId1, roleId2) => {
24330
+ return `
24331
+ mutation swapRole {
24332
+ swapRoles(input: {
24333
+ roleId1: "${roleId1}"
24334
+ roleId2: "${roleId2}"
24335
+ })
24336
+ }`;
24337
+ };
24338
+
24339
+ // Add a role
24340
+ const updateTemplate = (template) => {
24341
+ return `
24342
+ mutation updateTemplate {
24343
+ updateTemplate(input: {
24344
+ templateId: "${template.id}",
24345
+ title: "${template.title}",
24346
+ locked: ${template.locked},
24347
+ autoArchive: ${template.autoArchive},
24348
+ fixSignatureScale: ${template.fixSignatureScale ? template.fixSignatureScale : false}
24349
+ })
24350
+ }
24351
+ `;
24352
+ };
24353
+ const getTemplate = (id) => {
24354
+ return `
24355
+ query GetTemplate {
24356
+ template(id: "${id}") {
24357
+ id
24358
+ title
24359
+ fileName
24360
+ pageDimensions
24361
+ pageCount
24362
+ modified
24363
+ link
24364
+ valid
24365
+ locked
24366
+ autoArchive
24367
+ archived
24368
+ tags
24369
+ created
24370
+ createdBy
24371
+ lastSent
24372
+ fixSignatureScale
24373
+ roles{
24374
+ id
24375
+ signerIndex
24376
+ }
24377
+ elementConnection {
24378
+ templateElements {
24379
+ align
24380
+ ax
24381
+ ay
24382
+ bx
24383
+ by
24384
+ elementType
24385
+ formElementType
24386
+ fieldOrder
24387
+ fontName
24388
+ fontSize
24389
+ helpText
24390
+ hideBorder
24391
+ id
24392
+ label
24393
+ labelExtra
24394
+ logicAction
24395
+ logicGroup
24396
+ mapTo
24397
+ options
24398
+ optional
24399
+ page
24400
+ role
24401
+ signer
24402
+ substantive
24403
+ validation
24404
+ value
24405
+ }
24406
+ totalCount
24407
+ }
24408
+ userSignatureConnection {
24409
+ userSignatureElements {
24410
+ id
24411
+ userId
24412
+ ax
24413
+ ay
24414
+ bx
24415
+ by
24416
+ page
24417
+ link
24418
+ }
24419
+ }
24420
+ }
24421
+ }
24422
+ `;
24423
+ };
24424
+
24425
+ class LsDocumentAdapter {
24426
+ handleEvent = async (event, accessToken) => {
24427
+ axios.defaults.headers.common['Authorization'] = accessToken;
24428
+ // Determine the object type being processed
24429
+ const obj = event.data;
24430
+ if (!obj?.id)
24431
+ return 'invalid';
24432
+ const apiId = atob(obj.id);
24433
+ if (apiId.length < 3)
24434
+ return 'invalid';
24435
+ const prefix = atob(obj.id).substring(0, 3);
24436
+ let query = '';
24437
+ switch (prefix) {
24438
+ case 'ele':
24439
+ switch (event.action) {
24440
+ case 'create':
24441
+ query = createElement(obj);
24442
+ break;
24443
+ case 'update':
24444
+ query = updateElement(obj);
24445
+ break;
24446
+ case 'delete':
24447
+ query = deleteElement(obj);
24448
+ break;
24449
+ }
24450
+ break;
24451
+ case 'rol':
24452
+ switch (event.action) {
24453
+ case 'create':
24454
+ query = createRole(obj);
24455
+ break;
24456
+ case 'update':
24457
+ query = updateRole(obj);
24458
+ break;
24459
+ case 'delete':
24460
+ query = deleteRole(obj);
24461
+ break;
24462
+ case 'swap':
24463
+ query = updateRole(obj);
24464
+ break;
24465
+ }
24466
+ break;
24467
+ case 'tpl':
24468
+ switch (event.action) {
24469
+ case 'update':
24470
+ query = updateTemplate(obj);
24471
+ break;
24472
+ }
24473
+ break;
24474
+ }
24475
+ const result = await this.execute(accessToken, query);
24476
+ return { result, obj };
24477
+ };
24478
+ /**
24479
+ * Run a general query or mutation against the GraphQL API.
24480
+ *
24481
+ * @returns a promise of a graphQL request
24482
+ */
24483
+ async execute(accessToken, graphQLQuery, _graphQLVariables) {
24484
+ if (accessToken) {
24485
+ //console.log(graphQLQuery);
24486
+ const res = await axios.post(Parameters.endpoints.graphQL, {
24487
+ query: graphQLQuery,
24488
+ variables: _graphQLVariables ? _graphQLVariables : {},
24489
+ }, {
24490
+ headers: {
24491
+ Authorization: accessToken,
24492
+ },
24493
+ });
24494
+ return res.data.data;
24495
+ }
24496
+ else {
24497
+ console.warn('UNASSIGNED ACCESS TOKEN');
24498
+ }
24499
+ return Promise.reject();
24500
+ }
24501
+ }
20293
24502
 
20294
- const lsDocumentViewerCss = "*,*::before,*::after{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion: no-preference){html{interpolate-size:allow-keywords}}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate}:host{display:flex;flex-direction:row;width:100vw;height:100vh;margin:0px;padding:0px}.leftBox{display:flex;flex-direction:row;min-width:250px;width:250px;border:1px gray solid}.rightBox{width:200px;border:1px gray solid;width:470px;min-width:390px;padding:4px;font-family:inherit}.toolbox{display:flex;flex-direction:column;width:250px;left:0px}.ls-editor-infobox{padding:2px 8px 2px 8px;color:#727272}#pdf-canvas{top:0px;left:0px;width:100%;height:100%}#ls-mid-area{display:flex;flex-direction:column;width:100%}#ls-document-frame{background-image:repeating-linear-gradient(rgba(175, 176, 178, 0.4) 0px, rgba(175, 176, 178, 0.4) 1px, transparent 1px, transparent 100%), repeating-linear-gradient(90deg, rgba(175, 176, 178, 0.4) 0px, rgba(175, 176, 178, 0.4) 1px, transparent 1px, transparent 100%);border:0px rgb(136, 80, 80) solid;position:relative;min-width:60vw;width:100%;height:98vh;max-width:100%;max-height:100%;margin:0px;padding:2px;overflow-x:scroll;overflow-y:scroll;background-color:rgb(181, 181, 181);scrollbar-width:auto;scrollbar-color:auto}.prevButton{position:relative;bottom:30px}.nextButton{position:relative;bottom:30px}.fieldBox{z-index:1000}#ls-box-selector{position:absolute;visibility:hidden;background-color:transparent;border:1px rgba(71, 71, 71, 0.716) dashed}#ls-editor-form{display:flex;flex-direction:row;width:100vw}.hidden{visibility:hidden;display:none;width:0px}";
24503
+ const lsDocumentViewerCss = "*,*::before,*::after{box-sizing:border-box}*{margin:0}@media (prefers-reduced-motion: no-preference){html{interpolate-size:allow-keywords}}body{line-height:1.5;-webkit-font-smoothing:antialiased}img,picture,video,canvas,svg{display:block;max-width:100%}input,button,textarea,select{font:inherit}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}p{text-wrap:pretty}h1,h2,h3,h4,h5,h6{text-wrap:balance}#root,#__next{isolation:isolate}:host{display:flex;flex-direction:row;width:100vw;height:100vh;margin:0px;padding:0px}.leftBox{border-radius:16px;border:1px solid var(--gray-30, #edeff2);background:var(--white, #fff);box-shadow:0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);width:21.25rem;margin:1rem;min-width:21.25rem;max-height:100%}.left-box-inner{position:relative;display:flex;height:100%;padding:0.75rem;gap:0.75rem}.rightBox{width:200px;border:1px gray solid;width:470px;min-width:390px;padding:4px;font-family:inherit}.toolbox{display:flex;flex-direction:column;width:100%;height:100%;border-radius:8px;border:1px solid var(--gray-30, #e0e2e5);background:var(--gray-10, #f7f8fa);padding:0.75rem;gap:1rem;overflow-y:auto}.ls-editor-infobox{padding:2px 8px 2px 8px}#pdf-canvas{top:0px;left:0px;width:100px;height:100px}#ls-mid-area{display:flex;flex-direction:column;width:100%}.document-frame-wrapper{position:relative;padding:0 1.25rem;height:100%;display:flex;flex-direction:column;justify-content:start;align-items:center;overflow:auto}.spacer{min-height:5.5rem;width:100%}#ls-document-frame{position:relative;height:98vh;max-width:100%;max-height:100%;margin:0px;padding:2px;scrollbar-width:auto;scrollbar-color:auto}.prevButton{position:relative;bottom:30px}.nextButton{position:relative;bottom:30px}.fieldBox{z-index:1000}#ls-box-selector{position:absolute;visibility:hidden;background-color:transparent;border:1px rgba(71, 71, 71, 0.716) dashed}#ls-editor-form{display:flex;width:100vw;max-height:calc(100vh - 2.25rem);position:relative;background:var(--gray-10, #f7f8fa);box-shadow:0 2px 6px 0 rgba(0, 0, 0, 0.04) inset, 0 10px 15px 0 rgba(0, 0, 0, 0.04) inset}.hidden{visibility:hidden;display:none;width:0px}.toolbox-section-title{color:var(--gray-100, #45484d);font-size:1.125rem;font-style:normal;font-weight:500;line-height:1.75rem;}.toolbox-section-description{color:var(--gray-80, #5e6066);font-size:0.75rem;font-style:normal;font-weight:400;line-height:1rem}.fields-box{display:flex;flex-direction:column;gap:0.75rem}.page-header{display:flex;height:2.25rem;gap:0.5rem;padding:0.25rem 0.75rem;justify-content:center;align-items:center}.header-text-1{color:var(--gray-100, #45484d);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem}.header-text-2{color:var(--gray-100, #45484d);font-size:0.875rem;font-style:normal;font-weight:400;line-height:1.25rem}.properties-header{display:flex;padding:1rem;gap:0.75rem;align-items:center;border-bottom:1px solid var(--gray-20, #edeff2)}.properties-header-title{color:var(--gray-100, #45484d);width:100%;font-size:1.5rem;font-style:normal;font-weight:500;line-height:2rem;}.properties-header-icon{display:flex;padding:0.5rem;border-radius:0.625rem;background:var(--primary-10, #eff4ff);color:var(--primary-60, #4456f6)}.expand-fields-row{display:flex;align-items:center;gap:0.5rem;padding:0.5rem;cursor:pointer;color:var(--gray-80, #6c6e73);font-size:0.875rem;font-style:normal;font-weight:500;line-height:1.25rem;}.expand-fields-row p{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:500;line-height:1.5rem;}p{color:var(--gray-80, #6c6e73);font-family:var(--font-family);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height)}a{color:var(--primary-60, #4456f6);font-size:var(--text-sm);font-style:normal;font-weight:400;line-height:var(--text-sm-line-height);cursor:pointer}a:hover{text-decoration:underline;color:var(--primary-70, #2134dc)}.button-link,.button-link:hover{all:unset}select{appearance:none;height:36px}.input-wrapper{position:relative;width:fit-content}#selectorIcon{position:absolute;top:50%;right:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}#selectLeadingIcon{position:absolute;top:50%;left:0.675rem;transform:translateY(-50%);pointer-events:none;color:var(--gray-80, #6c6e73)}.has-leading-icon{padding-left:2.5rem}input,select,textarea{border:1px solid var(--gray-40, #d8d9dc);box-shadow:0 1px 0.125rem rgba(0, 0, 0, 0.05);padding:0.5rem 0.75rem;font-family:var(--font-family);font-size:var(--text-sm);border-radius:0.5rem;color:var(--gray-100, #45484d);font-weight:400}input::placeholder,select::placeholder,textarea::placeholder{color:var(--gray-60, #afb0b2)}input:hover,select:hover,textarea:hover{border-color:var(--gray-50, #c8c9cc);background-color:var(--white, #fff)}input:focus,select:focus,textarea:focus{outline:none;box-shadow:0 0 0 0.25rem var(--primary-40, #79adfc);border-color:var(--primary-60, #4456f6);background-color:var(--white, #fff)}input:active,select:active,textarea:active{border-color:var(--primary-50, #5185ff)}input:disabled,select:disabled,textarea:disabled{cursor:not-allowed;background-color:var(--gray-10, #f7f8fa)}input[type='checkbox']{appearance:none;position:relative;height:1rem;width:1rem;padding:0.25rem;border-radius:var(--radius-sm);border:1px solid #d1d5db;background-color:#ffffff;cursor:pointer}input[type='checkbox']:checked,input[type='checkbox'].indeterminate{background-color:var(--primary-60, #4456f6);border:none}input[type='checkbox']:checked::after{content:'';position:absolute;top:45%;left:50%;transform:translate(-50%, -50%) rotate(-45deg) scale(-1, 1);width:0.5rem;height:0.25rem;border-bottom:0.125rem solid white;border-right:0.125rem solid white}input[type='checkbox'].indeterminate::after{content:'';position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);width:0.5rem;height:0.125rem;background-color:white}input[type='checkbox']:checked:hover,input[type='checkbox'].indeterminate:hover{background-color:var(--primary-70, #2134dc);border:none}input[type='checkbox']:hover{border:1px solid #9ca3af}input[type='checkbox']:focus,input[type='checkbox']:active{outline:none;box-shadow:0 0 0 0.25rem var(--primary-20, #c7ddff);background-color:#f0f4f8}input[type='checkbox']:disabled{background-color:#f3f4f6;outline:none;cursor:not-allowed}input[type='checkbox']:disabled:checked{background-color:#e5e7eb;border:none;outline:none;cursor:not-allowed}.checkbox-container{display:flex;gap:0.5rem;width:100%}.checkbox-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:400;line-height:1rem}.form-label{color:var(--gray-100, #45484d);font-size:1rem;font-style:normal;font-weight:500;line-height:1.5rem}.form-field{display:flex;flex-direction:column;gap:0.25rem;width:100%}.loading-box{display:flex;justify-content:center;align-items:center;width:100%;height:100vh;color:var(--primary-60, #0c7cba)}button{border:0;appearance:button;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;border-radius:var(--radius-lg);background-color:var(--primary-60, #4456f6);color:white;text-transform:capitalize;min-height:2.25rem;min-width:2.25rem}button.tertiaryGrey{border:1px solid var(--gray-40, #d8d9dc);background-color:white;color:var(--gray-80, #787a80)}button.tertiaryGrey:hover{border:1px solid var(--gray-50, #c8c9cc);background:var(--gray-10, #f7f8fa)}.button-group{display:flex;border-radius:0.5rem;border:1px solid var(--gray-30, #e0e2e5);background:var(--white, #ffffff);overflow:clip}.button-group button{display:flex;background:transparent;border-radius:unset;padding:0.25rem 0.75rem;min-width:2.156rem;min-height:unset;color:var(--gray-80, #6c6e73)}.button-group button:hover{background:var(--gray-10, #f7f8fa)}.button-group>:first-child{border-radius:0.5rem 0 0 0.5rem}.button-group>:last-child{border-radius:0 0.5rem 0.5rem 0}.button-group>:not(:first-child){border-left:1px solid var(--gray-30, #e0e2e5)}";
20295
24504
 
20296
24505
  pdfExports.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.5.207/pdf.worker.min.js';
20297
24506
  const LsDocumentViewer = class {
@@ -20308,6 +24517,7 @@ const LsDocumentViewer = class {
20308
24517
  pdfDocument;
20309
24518
  pageNumPending = null;
20310
24519
  canvas;
24520
+ adapter = new LsDocumentAdapter();
20311
24521
  ctx;
20312
24522
  pageDimensions; // hardcoded to start at the page 1
20313
24523
  // @ts-ignore
@@ -20331,14 +24541,26 @@ const LsDocumentViewer = class {
20331
24541
  * {LSApiTemplate}
20332
24542
  */
20333
24543
  template;
24544
+ /**
24545
+ * The access token of the account your want the widget to use, you should normally
24546
+ * acquire this with a server side call using that accounts login credentials.
24547
+ * {string}
24548
+ */
24549
+ token;
24550
+ /**
24551
+ * The id of the template you want to load (if using the internal data adapter).
24552
+ * {string}
24553
+ */
24554
+ templateid;
20334
24555
  zoom = 1.0; // hardcoded to scale the document to full canvas size
20335
24556
  pageNum = 1; // hardcoded to start at the page 1
24557
+ signer = 0; // hardcoded to start at the page 1
20336
24558
  _template;
20337
24559
  selected;
20338
24560
  /**
20339
- * An ease of use property that will arrange document-viewer appropraitely.
20340
- * {'preview' | 'editor' | 'custom'}
20341
- */
24561
+ * An ease of use property that will arrange document-viewer appropraitely.
24562
+ * {'preview' | 'editor' | 'custom'}
24563
+ */
20342
24564
  mode = 'custom';
20343
24565
  modeHandler(_newMode, _oldMode) {
20344
24566
  if (_newMode === 'preview') {
@@ -20366,14 +24588,14 @@ const LsDocumentViewer = class {
20366
24588
  this.queueRenderPage(this.pageNum);
20367
24589
  }
20368
24590
  /**
20369
- * Determines / sets which of the far left 'managers' is active.
20370
- * {'document' | 'toolbox' | 'participant' }
20371
- */
24591
+ * Determines / sets which of the far left 'managers' is active.
24592
+ * {'document' | 'toolbox' | 'participant' }
24593
+ */
20372
24594
  manager = 'toolbox';
20373
24595
  /**
20374
- * Shows the table view of fields rather than the preview.
20375
- * {boolean}
20376
- */
24596
+ * Shows the table view of fields rather than the preview.
24597
+ * {boolean}
24598
+ */
20377
24599
  displayTable = false;
20378
24600
  /**
20379
24601
  * Whether the left hand toolbox is displayed.
@@ -20391,53 +24613,42 @@ const LsDocumentViewer = class {
20391
24613
  */
20392
24614
  showstatusbar = false;
20393
24615
  /**
20394
- * Whether the page previewvertical ribbon will be shown
20395
- * {boolean}
20396
- */
24616
+ * Whether the page previewvertical ribbon will be shown
24617
+ * {boolean}
24618
+ */
20397
24619
  showpagepreview = false;
20398
24620
  /**
20399
- * Whether the right panel (which can be default field properties or custom panel) is
20400
- * displayed.
20401
- * {boolean}
20402
- */
24621
+ * Whether the right panel (which can be default field properties or custom panel) is
24622
+ * displayed.
24623
+ * {boolean}
24624
+ */
20403
24625
  showrightpanel = false;
20404
24626
  /**
20405
- * Whether the right panel (which can be default field properties or custom panel) is
20406
- * displayed.
20407
- * {boolean}
20408
- */
24627
+ * Whether or not the fields list is expanded.
24628
+ * {boolean}
24629
+ */
24630
+ expandfields = false;
24631
+ /**
24632
+ * Whether the right panel (which can be default field properties or custom panel) is
24633
+ * displayed.
24634
+ * {boolean}
24635
+ */
20409
24636
  readonly = false;
20410
24637
  /**
20411
- * Whether the table view of the fields on this template is available to the user.
20412
- * {boolean}
20413
- */
24638
+ * Whether the table view of the fields on this template is available to the user.
24639
+ * {boolean}
24640
+ */
20414
24641
  showtableview = false;
20415
24642
  /**
20416
- * If supplied ONLY items in this | ("or") delimited list will be shown. i.e. "signature|intials"
20417
- * {boolean}
20418
- */
24643
+ * If supplied ONLY items in this | ("or") delimited list will be shown. i.e. "signature|intials"
24644
+ * {boolean}
24645
+ */
20419
24646
  toolboxFilter = null;
20420
24647
  /**
20421
- * Allows you to change the colours used for each role in the template.
20422
- * {SignerColor[]}
20423
- */
24648
+ * Allows you to change the colours used for each role in the template.
24649
+ * {SignerColor[]}
24650
+ */
20424
24651
  roleColors = defaultRolePalette;
20425
- parseTemplate(newValue) {
20426
- const newTemplate = newValue;
20427
- const pages = JSON.parse(JSON.parse(newTemplate.pageDimensions));
20428
- // Convert ax,bx,ay etc. into top, left
20429
- this.pageDimensions = pages.map(p => { return { height: p[1], width: p[0] }; });
20430
- const fields = newTemplate.elementConnection.templateElements.map(f => {
20431
- return {
20432
- ...f,
20433
- top: f.ay * pages[0].height,
20434
- left: f.ax * pages[0].width,
20435
- height: (f.by - f.ay) * pages[0].height,
20436
- width: (f.bx - f.ax) * pages[0].width
20437
- };
20438
- });
20439
- this._template = { ...newTemplate, elementConnection: { ...newTemplate.elementConnection, templateElements: fields } };
20440
- }
20441
24652
  //
20442
24653
  // --- Event Emitters --- //
20443
24654
  //
@@ -20451,6 +24662,15 @@ const LsDocumentViewer = class {
20451
24662
  // Send an internal event to be processed
20452
24663
  update;
20453
24664
  // Updates are internal event between LS controls not to be confused with mutate
24665
+ mutateHandler(event) {
24666
+ console.log(event);
24667
+ if (this.token)
24668
+ event.detail.forEach(me => this.adapter.handleEvent(me, this.token).then(result => {
24669
+ if (me.action === "create")
24670
+ matchData.bind(this)(result);
24671
+ }));
24672
+ }
24673
+ // Updates are internal event between LS controls not to be confused with mutate
20454
24674
  updateHandler(event) {
20455
24675
  if (event.detail)
20456
24676
  event.detail.forEach(fx => this.syncChange(fx));
@@ -20464,6 +24684,10 @@ const LsDocumentViewer = class {
20464
24684
  if (propPanel)
20465
24685
  propPanel.dataItem = event.detail;
20466
24686
  }
24687
+ // Send role selection changes to bars and panels
24688
+ roleHandler(event) {
24689
+ this.signer = event.detail;
24690
+ }
20467
24691
  //
20468
24692
  // --- Methods --- //
20469
24693
  //
@@ -20492,44 +24716,70 @@ const LsDocumentViewer = class {
20492
24716
  this.showPageFields(this.pageNum);
20493
24717
  }
20494
24718
  /**
20495
- * Page and field resize on zoom change
20496
- *
20497
- */
24719
+ * Page and field resize on zoom change
24720
+ *
24721
+ */
20498
24722
  async setZoom(z) {
20499
- console.log(z, 'setZoom');
20500
24723
  this.zoom = z;
20501
24724
  this.canvas = this.component.shadowRoot.getElementById('pdf-canvas');
20502
- this.canvas.style.height = this.pageDimensions[this.pageNum - 1].height * z + "px";
20503
- this.canvas.style.width = this.pageDimensions[this.pageNum - 1].width * z + "px";
24725
+ this.canvas.style.height = this.pageDimensions[this.pageNum - 1].height * z + 'px';
24726
+ this.canvas.style.width = this.pageDimensions[this.pageNum - 1].width * z + 'px';
20504
24727
  // place all fields at new zoom level
20505
24728
  this.component.shadowRoot.querySelectorAll('ls-editor-field').forEach(fx => moveField.bind(this)(fx, fx.dataItem));
20506
- console.log(this.zoom, 'rendering');
20507
24729
  this.queueRenderPage(this.pageNum);
20508
24730
  this.showPageFields(this.pageNum);
20509
24731
  }
24732
+ /**
24733
+ * Decorate the template data object with useful transformations.
24734
+ * {string} json of template
24735
+ */
24736
+ parseTemplate(newValue) {
24737
+ const newTemplate = JSON.parse(newValue);
24738
+ const pages = JSON.parse(JSON.parse(newTemplate.pageDimensions));
24739
+ // Convert ax,bx,ay etc. into top, left
24740
+ // We also add the templateId into every object so that all the information
24741
+ // required to mutate is in each object.
24742
+ this.pageDimensions = pages.map(p => {
24743
+ return { height: p[1], width: p[0] };
24744
+ });
24745
+ const fields = newTemplate.elementConnection.templateElements.map(f => {
24746
+ return {
24747
+ ...f,
24748
+ top: f.ay * pages[0].height,
24749
+ left: f.ax * pages[0].width,
24750
+ height: (f.by - f.ay) * pages[0].height,
24751
+ width: (f.bx - f.ax) * pages[0].width,
24752
+ templateId: newTemplate.id,
24753
+ };
24754
+ });
24755
+ const preparedRoles = newTemplate.roles.map((ro) => {
24756
+ return { ...ro, templateId: newTemplate.id };
24757
+ });
24758
+ this._template = {
24759
+ ...newTemplate,
24760
+ elementConnection: { ...newTemplate.elementConnection, templateElements: fields },
24761
+ roles: preparedRoles,
24762
+ };
24763
+ }
20510
24764
  /**
20511
24765
  * Render the page based on pageNumber
20512
24766
  * {number} pageNumber
20513
24767
  */
20514
24768
  renderPage(pageNumber) {
20515
24769
  this.isPageRendering = true;
20516
- this.pdfDocument
20517
- .getPage(pageNumber)
20518
- .then((page) => {
20519
- console.log('viewport page ', page.getViewport());
24770
+ this.pdfDocument.getPage(pageNumber).then((page) => {
20520
24771
  const viewport = page.getViewport({ scale: this.zoom });
20521
24772
  this.canvas.height = Math.floor(viewport.height);
20522
24773
  this.canvas.width = Math.floor(viewport.width);
20523
24774
  // Render PDF page into canvas context
20524
24775
  const renderContext = {
20525
24776
  viewport,
20526
- canvasContext: this.ctx
24777
+ canvasContext: this.ctx,
20527
24778
  };
20528
24779
  // Render page method
20529
24780
  const renderTask = page.render(renderContext);
20530
24781
  // Wait for rendering to finish
20531
- renderTask.promise
20532
- .then(() => {
24782
+ renderTask.promise.then(() => {
20533
24783
  this.isPageRendering = false;
20534
24784
  this.pageRendered.emit(this.pageNum);
20535
24785
  if (this.pageNumPending !== null) {
@@ -20545,13 +24795,11 @@ const LsDocumentViewer = class {
20545
24795
  this.pageNumPending = pageNumber;
20546
24796
  }
20547
24797
  else {
20548
- console.log('rerender');
20549
24798
  this.renderPage(pageNumber);
20550
24799
  }
20551
24800
  }
20552
24801
  loadAndRender(src) {
20553
- pdfExports.getDocument(src).promise
20554
- .then((pdfDocument) => {
24802
+ pdfExports.getDocument(src).promise.then((pdfDocument) => {
20555
24803
  this.pdfDocument = pdfDocument;
20556
24804
  this.renderPage(this.pageNum);
20557
24805
  });
@@ -20564,11 +24812,13 @@ const LsDocumentViewer = class {
20564
24812
  left: Math.floor(newElement.ax * this.pageDimensions[newElement.page - 1].width),
20565
24813
  height: Math.floor((newElement.by - newElement.ay) * this.pageDimensions[newElement.page - 1].height),
20566
24814
  width: Math.floor((newElement.bx - newElement.ax) * this.pageDimensions[newElement.page - 1].width),
20567
- pageDimensions: this.pageDimensions[newElement.page - 1]
24815
+ pageDimensions: this.pageDimensions[newElement.page - 1],
24816
+ templateId: this._template.id,
20568
24817
  };
20569
24818
  }
20570
24819
  // internal forced change
20571
24820
  syncChange(update) {
24821
+ console.log('sync');
20572
24822
  if (getApiType(update.data) === 'element') {
20573
24823
  if (update.action === 'create') {
20574
24824
  const newData = { ...update.data, page: this.pageNum };
@@ -20584,7 +24834,7 @@ const LsDocumentViewer = class {
20584
24834
  const fu = this.component.shadowRoot.getElementById('ls-field-' + update.data.id);
20585
24835
  fu.dataItem = update.data;
20586
24836
  // Refresh the selected array
20587
- this.selected = this.selected.map(s => s.dataItem.id === update.data.id ? fu : s);
24837
+ this.selected = this.selected.map(s => (s.dataItem.id === update.data.id ? fu : s));
20588
24838
  }
20589
24839
  // Reselect the fields - this updates the dataItem value passed to child controls
20590
24840
  const fields = this.component.shadowRoot.querySelectorAll('ls-editor-field');
@@ -20600,55 +24850,29 @@ const LsDocumentViewer = class {
20600
24850
  }
20601
24851
  }
20602
24852
  }
20603
- componentDidLoad() {
24853
+ initViewer() {
24854
+ console.log('Init Viewer ');
20604
24855
  // Generate a canvas to draw the background PDF on.
20605
24856
  this.canvas = this.component.shadowRoot.getElementById('pdf-canvas');
20606
- this.canvas.style.height = this.pageDimensions[this.pageNum - 1].height * this.zoom + "px";
20607
- this.canvas.style.width = this.pageDimensions[this.pageNum - 1].width * this.zoom + "px";
24857
+ this.canvas.style.height = this.pageDimensions[this.pageNum - 1].height * this.zoom + 'px';
24858
+ this.canvas.style.width = this.pageDimensions[this.pageNum - 1].width * this.zoom + 'px';
20608
24859
  this.ctx = this.canvas.getContext('2d');
20609
- this.loadAndRender(this._template.link);
24860
+ if (this._template?.link)
24861
+ this.loadAndRender(this._template?.link);
20610
24862
  var dropTarget = this.component.shadowRoot.getElementById('ls-document-frame');
20611
24863
  // Used for single field selection
20612
- dropTarget.addEventListener("click", mouseClick.bind(this));
20613
- dropTarget.addEventListener("mousedown", mouseDown.bind(this));
20614
- dropTarget.addEventListener("mousemove", mouseMove.bind(this));
20615
- dropTarget.addEventListener("mouseup", mouseUp.bind(this));
20616
- document.addEventListener("keydown", keyDown.bind(this));
20617
- dropTarget.addEventListener("dragenter", (event) => { event.preventDefault(); });
20618
- dropTarget.addEventListener("dragover", (event) => { event.preventDefault(); });
20619
- dropTarget.addEventListener("drop", (event) => {
24864
+ dropTarget.addEventListener('click', mouseClick.bind(this));
24865
+ dropTarget.addEventListener('mousedown', mouseDown.bind(this));
24866
+ dropTarget.addEventListener('mousemove', mouseMove.bind(this));
24867
+ dropTarget.addEventListener('mouseup', mouseUp.bind(this));
24868
+ document.addEventListener('keydown', keyDown.bind(this));
24869
+ dropTarget.addEventListener('dragenter', event => {
20620
24870
  event.preventDefault();
20621
- try {
20622
- const data = JSON.parse(event.dataTransfer.getData("application/json"));
20623
- this.component.shadowRoot.querySelectorAll('ls-editor-field').forEach(f => f.selected = false);
20624
- var frame = this.component.shadowRoot.getElementById('ls-document-frame');
20625
- // Make a new API compatible id for a template element (prefix 'ele')
20626
- const id = btoa('ele' + crypto.randomUUID());
20627
- // TODO: Put these defaults somewhere sensible
20628
- const newData = {
20629
- action: 'create', data: {
20630
- ...data,
20631
- id,
20632
- value: "",
20633
- top: event.offsetY * this.zoom + frame.scrollTop,
20634
- left: event.offsetX * this.zoom + frame.scrollLeft,
20635
- height: data.defaultHeight,
20636
- width: data.defaultWidth,
20637
- pageDimensions: this.pageDimensions[this.pageNum - 1],
20638
- fontName: "courier",
20639
- fontSize: 10,
20640
- align: 'left',
20641
- signer: 1,
20642
- elementType: data.type
20643
- }
20644
- };
20645
- this.mutate.emit([newData]);
20646
- this.update.emit([newData]);
20647
- }
20648
- catch (e) {
20649
- console.error(e);
20650
- }
20651
24871
  });
24872
+ dropTarget.addEventListener('dragover', event => {
24873
+ event.preventDefault();
24874
+ });
24875
+ dropTarget.addEventListener('drop', mouseDrop.bind(this));
20652
24876
  // Generate all the field HTML elements that are required (for every page)
20653
24877
  this._template.elementConnection.templateElements.forEach(te => {
20654
24878
  addField.bind(this)(this.component.shadowRoot.getElementById('ls-document-frame'), this.prepareElement(te));
@@ -20660,12 +24884,23 @@ const LsDocumentViewer = class {
20660
24884
  fx.className = fx.dataItem.page === page ? '' : 'hidden';
20661
24885
  });
20662
24886
  }
24887
+ async load() {
24888
+ try {
24889
+ const result = (await this.adapter.execute(this.token, getTemplate(this.templateid)));
24890
+ this.parseTemplate(JSON.stringify(result.template));
24891
+ console.log(this._template, '_template');
24892
+ this.initViewer();
24893
+ }
24894
+ catch (e) {
24895
+ console.error('Your access token is invalid.', e);
24896
+ }
24897
+ }
20663
24898
  componentWillLoad() {
20664
- if (this.template)
20665
- this.parseTemplate(this.template);
24899
+ if (this.token && !this._template)
24900
+ this.load();
20666
24901
  }
20667
24902
  render() {
20668
- return (h(Host, { key: '69a201c6e7410215651c839ec902a4d0beea9c18' }, h("form", { key: '77d879474a6e216ba5087fefc4e3056d84c6efc1', id: "ls-editor-form" }, this.showtoolbox === true ? h("div", { class: "leftBox" }, h("ls-feature-column", { onManage: (manager) => {
24903
+ return (h(Host, { key: '744f961f2f3595b953b55362b068a8a056fc6217' }, h(h.Fragment, null, h("div", { key: '5f83502772c2642227a67376e42074f41dfe3723', class: "page-header" }, h("p", { key: 'fe7a7772790ea96ffc3d0d590137d2be29df3f24', class: "header-text-1" }, "Template Creation"), h("p", { key: 'a3c6aab38dc49e6753499d84deead0c21103cd1d' }, "/"), h("p", { key: '6a84dd8d33ec656953e48c29ad0b8d924a6ad94e', class: "header-text-2" }, "Template Name")), h("form", { key: 'a01571adc26b9f0bbb013592a2d161e6fbda2e15', id: "ls-editor-form" }, this.showtoolbox === true ? (h("div", { class: "leftBox" }, h("div", { class: !this.selected || this.selected.length === 0 ? 'left-box-inner' : 'hidden' }, h("ls-feature-column", { onManage: manager => {
20669
24904
  if (manager.detail === 'document') {
20670
24905
  var documentManager = this.component.shadowRoot.getElementById('ls-document-options');
20671
24906
  documentManager.template = this._template;
@@ -20675,9 +24910,10 @@ const LsDocumentViewer = class {
20675
24910
  participantManager.template = this._template;
20676
24911
  }
20677
24912
  this.manager = manager.detail;
20678
- } }), h("div", { id: "ls-toolbox", class: this.manager === 'toolbox' ? 'toolbox' : 'hidden' }, h("div", { class: "ls-editor-infobox" }, "Drag to Add..."), h("ls-toolbox-field", { elementType: "signature", formElementType: "signature", label: "Signature", defaultHeight: 27, defaultWidth: 120, validation: 0 }), h("ls-toolbox-field", { elementType: "text", formElementType: "text", label: "Text", defaultHeight: 27, defaultWidth: 100, validation: 0 }), h("ls-toolbox-field", { elementType: "email", formElementType: "email", label: "Email", defaultHeight: 27, defaultWidth: 120, validation: 1 }), h("ls-toolbox-field", { elementType: "number", formElementType: "number", label: "Number", defaultHeight: 27, defaultWidth: 80, validation: 50 }), h("ls-toolbox-field", { elementType: "date", formElementType: "date", label: "Date", defaultHeight: 27, defaultWidth: 80, validation: 2 }), h("ls-toolbox-field", { elementType: "checkbox", formElementType: "checkbox", label: "Checkbox", defaultHeight: 27, defaultWidth: 27, validation: 25 }), h("ls-toolbox-field", { elementType: "auto sign", formElementType: "auto sign", label: "Auto Sign", defaultHeight: 27, defaultWidth: 120, validation: 3000 }), h("ls-toolbox-field", { elementType: "initials", formElementType: "initials", label: "Initials", defaultHeight: 27, defaultWidth: 120, validation: 2000 }), h("ls-toolbox-field", { elementType: "regex", formElementType: "regex", label: "Regex", defaultHeight: 27, defaultWidth: 120, validation: 93 }), h("ls-toolbox-field", { elementType: "image", formElementType: "image", label: "Image", defaultHeight: 27, defaultWidth: 120, validation: 90 }), h("ls-toolbox-field", { elementType: "signing date", formElementType: "signing date", label: "Signing Date", defaultHeight: 27, defaultWidth: 120, validation: 30 }), h("ls-toolbox-field", { elementType: "file", formElementType: "file", label: "File", defaultHeight: 27, defaultWidth: 120, validation: 74 })), h("ls-participant-manager", { id: "ls-participant-manager", class: this.manager === 'participant' ? 'toolbox' : 'hidden', editor: this }), h("ls-document-options", { id: "ls-document-options", class: this.manager === 'document' ? 'toolbox' : 'hidden' }))
20679
- :
20680
- h(h.Fragment, null), h("div", { key: '5a5c544cb33c6c17e4c9ec0d97b287dca7368ea9', id: "ls-mid-area" }, h("ls-toolbar", { key: '0b5febf3ee579071e5d66a043ea83b1326ad2aba', id: "ls-toolbar", dataItem: this.selected ? this.selected.map(s => s.dataItem) : null, template: this._template }), h("div", { key: 'caa4b96df1d27e6907910fa8e1ebe52e0a243053', id: "ls-document-frame" }, h("canvas", { key: '8c85781a7a8b5efa0698df482626d0ac1c73746d', id: "pdf-canvas", class: this.displayTable ? 'hidden' : '' }), h("ls-editor-table", { key: '5d3de7f59a02ab1322b6df3ace85b7ca17820656', editor: this, class: this.displayTable ? '' : 'hidden' }), h("div", { key: 'a34a8fc95279c33c1f24dd248d5949745ae74654', id: "ls-box-selector" })), h("ls-statusbar", { key: '4ead547e79826bcc321361b90e845a0144506d02', editor: this })), this.showrightpanel && !this.displayTable && h("div", { key: '49f5ba457e1cedda002027bf979d1ffc9eb62c1a', class: this.selected && this.selected.length > 0 ? 'rightBox' : 'hidden' }, h("ls-field-properties", { key: 'a28df4ee74c30451b2e4811079ecdd7de14ab466', id: "my-field-panel" }), h("slot", { key: 'f8ba23c8cbc86f85b7f2584711dbdc69000cba9b' })))));
24913
+ } }), h("div", { id: "ls-toolbox", class: this.manager === 'toolbox' ? 'toolbox' : 'hidden' }, h("div", { class: "ls-editor-infobox" }, h("h2", { class: "toolbox-section-title" }, "Participant Fields"), h("p", { class: "toolbox-section-description" }, "Select and Click to place Signature fields where you\u2019d like on the Document.")), h("div", { class: "fields-box" }, h("ls-toolbox-field", { elementType: "signature", formElementType: "signature", label: "Signature", defaultHeight: 27, defaultWidth: 120, validation: 0, icon: "signature" }), h("ls-toolbox-field", { elementType: "initials", formElementType: "initials", label: "Initials", defaultHeight: 27, defaultWidth: 120, validation: 2000, icon: "initials" }), h("ls-toolbox-field", { elementType: "date", formElementType: "date", label: "Date", defaultHeight: 27, defaultWidth: 80, validation: 2, icon: "calender" }), h("ls-toolbox-field", { elementType: "signing date", formElementType: "signing date", label: "Signing Date", defaultHeight: 27, defaultWidth: 120, validation: 30, icon: "auto-date" }), h("ls-toolbox-field", { elementType: "email", formElementType: "email", label: "Email", defaultHeight: 27, defaultWidth: 120, validation: 1, icon: "at-symbol" }), h("ls-toolbox-field", { elementType: "text", formElementType: "text", label: "Text", defaultHeight: 27, defaultWidth: 100, validation: 0, icon: "text" }), h("div", { class: 'expand-fields-row' }, h("ls-icon", { name: this.expandfields ? 'expand' : 'collapse', size: "20", solid: true, onClick: () => (this.expandfields = !this.expandfields) }), h("p", null, "More Field Types")), this.expandfields && (h("div", { class: "fields-box" }, h("ls-toolbox-field", { elementType: "number", formElementType: "number", label: "Number", defaultHeight: 27, defaultWidth: 80, validation: 50, icon: "hashtag" }), h("ls-toolbox-field", { elementType: "checkbox", formElementType: "checkbox", label: "Checkbox", defaultHeight: 27, defaultWidth: 27, validation: 25, icon: "check" }), h("ls-toolbox-field", { elementType: "auto sign", formElementType: "auto sign", label: "Auto Sign", defaultHeight: 27, defaultWidth: 120, validation: 3000, icon: "signature" }), h("ls-toolbox-field", { elementType: "regex", formElementType: "regex", label: "Regex", defaultHeight: 27, defaultWidth: 120, validation: 93, icon: "code" }), h("ls-toolbox-field", { elementType: "image", formElementType: "image", label: "Image", defaultHeight: 27, defaultWidth: 120, validation: 90, icon: "photograph" }), h("ls-toolbox-field", { elementType: "file", formElementType: "file", label: "File", defaultHeight: 27, defaultWidth: 120, validation: 74, icon: "upload" }))))), h("ls-participant-manager", { id: "ls-participant-manager", class: this.manager === 'participant' ? 'toolbox' : 'hidden', editor: this }), h("ls-document-options", { id: "ls-document-options", class: this.manager === 'document' ? 'toolbox' : 'hidden' })), this.showrightpanel && !this.displayTable && (h("div", { class: this.selected && this.selected.length > 0 ? 'field-properties-outer' : 'hidden' }, h("div", { class: 'properties-header' }, h("div", { class: 'properties-header-icon' }, h("ls-icon", { name: "pre-filled-content" })), h("h1", { class: 'properties-header-title' }, "Field Properties"), h("button", { class: 'tertiaryGrey', onClick: e => {
24914
+ this.selected = [];
24915
+ e.preventDefault();
24916
+ } }, h("ls-icon", { name: "x", size: "20" }))), h("ls-field-properties", { id: "my-field-panel" }), h("slot", null))))) : (h(h.Fragment, null)), h("div", { key: '03f3054a9882770b6e45e1a4e240c9071837cfbf', id: "ls-mid-area" }, h("ls-toolbar", { key: 'abe30fa6c668bfd76c3ae9e8b4b9f435409ff980', id: "ls-toolbar", dataItem: this.selected ? this.selected.map(s => s.dataItem) : null, template: this._template }), h("div", { key: '414e6989827b49a95e72c1ba4f2ba6523bbf9410', class: 'document-frame-wrapper' }, h("div", { key: '2c9f7373dec198d3482aa8391301f18e1158acc6', class: 'spacer' }), h("div", { key: '0efdb724dad8718a6c66a5c70d1b13d1117d79a0', id: "ls-document-frame" }, h("canvas", { key: '2c2484f7aea016835bebb0a10af52d3fd16b971a', id: "pdf-canvas", class: this.displayTable ? 'hidden' : '' }), h("ls-editor-table", { key: '3179534f785139308ae68b80700136bd89091b2e', editor: this, class: this.displayTable ? '' : 'hidden' }), h("div", { key: 'b36cb41ba0505fd92126ea912e152ebac1dfbd94', id: "ls-box-selector" }))), h("ls-statusbar", { key: '3f900b44099d13c60028499ca287fdcda05b09ce', editor: this }))))));
20681
24917
  }
20682
24918
  static get watchers() { return {
20683
24919
  "mode": ["modeHandler"],