@verdocs/web-sdk 1.9.9 → 1.9.14

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 (768) hide show
  1. package/dist/cjs/{Envelopes-22a0c02f.js → Envelopes-aec4ee3d.js} +4 -15
  2. package/dist/cjs/Envelopes-aec4ee3d.js.map +1 -0
  3. package/dist/cjs/Templates-0051d647.js +31 -0
  4. package/dist/cjs/Templates-0051d647.js.map +1 -0
  5. package/dist/cjs/VerdocsEndpoint-8c408e5b.js +3569 -0
  6. package/dist/cjs/VerdocsEndpoint-8c408e5b.js.map +1 -0
  7. package/dist/cjs/{templateStore-92828c3c.js → index-eb130f52.js} +2 -41
  8. package/dist/cjs/index-eb130f52.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/templateStore-974781a8.js +46 -0
  11. package/dist/cjs/templateStore-974781a8.js.map +1 -0
  12. package/dist/cjs/{utils-84236321.js → utils-e0f38696.js} +23 -3
  13. package/dist/cjs/utils-e0f38696.js.map +1 -0
  14. package/dist/cjs/verdocs-auth.cjs.entry.js +4 -4
  15. package/dist/cjs/verdocs-auth.cjs.entry.js.map +1 -1
  16. package/dist/cjs/verdocs-build.cjs.entry.js +30 -3
  17. package/dist/cjs/verdocs-build.cjs.entry.js.map +1 -1
  18. package/dist/cjs/verdocs-button-panel_3.cjs.entry.js +1 -20
  19. package/dist/cjs/verdocs-button-panel_3.cjs.entry.js.map +1 -1
  20. package/dist/cjs/verdocs-button.cjs.entry.js +1 -7
  21. package/dist/cjs/verdocs-button.cjs.entry.js.map +1 -1
  22. package/dist/cjs/verdocs-checkbox.cjs.entry.js +1 -6
  23. package/dist/cjs/verdocs-checkbox.cjs.entry.js.map +1 -1
  24. package/dist/cjs/verdocs-contact-picker.cjs.entry.js +4 -4
  25. package/dist/cjs/verdocs-contact-picker.cjs.entry.js.map +1 -1
  26. package/dist/cjs/verdocs-document-page_2.cjs.entry.js +94 -0
  27. package/dist/cjs/verdocs-document-page_2.cjs.entry.js.map +1 -0
  28. package/dist/cjs/verdocs-dropdown_3.cjs.entry.js +6 -11
  29. package/dist/cjs/verdocs-dropdown_3.cjs.entry.js.map +1 -1
  30. package/dist/cjs/verdocs-field-attachment.cjs.entry.js +2 -7
  31. package/dist/cjs/verdocs-field-attachment.cjs.entry.js.map +1 -1
  32. package/dist/cjs/verdocs-field-date.cjs.entry.js +2 -15
  33. package/dist/cjs/verdocs-field-date.cjs.entry.js.map +1 -1
  34. package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +1 -1
  35. package/dist/cjs/verdocs-field-initial.cjs.entry.js +1 -1
  36. package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
  37. package/dist/cjs/verdocs-field-signature_3.cjs.entry.js +9 -11
  38. package/dist/cjs/verdocs-field-signature_3.cjs.entry.js.map +1 -1
  39. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +2 -2
  40. package/dist/cjs/verdocs-field-textarea.cjs.entry.js.map +1 -1
  41. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +4 -3
  42. package/dist/cjs/verdocs-field-textbox.cjs.entry.js.map +1 -1
  43. package/dist/cjs/verdocs-field-timestamp.cjs.entry.js +1 -1
  44. package/dist/cjs/verdocs-help-icon_2.cjs.entry.js +4 -7
  45. package/dist/cjs/verdocs-help-icon_2.cjs.entry.js.map +1 -1
  46. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +3 -6
  47. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js.map +1 -1
  48. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js +4 -7
  49. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js.map +1 -1
  50. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +10 -8
  51. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js.map +1 -1
  52. package/dist/cjs/verdocs-preview.cjs.entry.js +17 -11
  53. package/dist/cjs/verdocs-preview.cjs.entry.js.map +1 -1
  54. package/dist/cjs/verdocs-quick-functions_3.cjs.entry.js +1 -1
  55. package/dist/cjs/verdocs-radio-button.cjs.entry.js +1 -6
  56. package/dist/cjs/verdocs-radio-button.cjs.entry.js.map +1 -1
  57. package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
  58. package/dist/cjs/verdocs-send.cjs.entry.js +4 -4
  59. package/dist/cjs/verdocs-send.cjs.entry.js.map +1 -1
  60. package/dist/cjs/verdocs-sign.cjs.entry.js +93 -24
  61. package/dist/cjs/verdocs-sign.cjs.entry.js.map +1 -1
  62. package/dist/cjs/verdocs-template-create_4.cjs.entry.js +73 -77
  63. package/dist/cjs/verdocs-template-create_4.cjs.entry.js.map +1 -1
  64. package/dist/cjs/verdocs-toggle.cjs.entry.js +0 -22
  65. package/dist/cjs/verdocs-toggle.cjs.entry.js.map +1 -1
  66. package/dist/cjs/verdocs-upload-dialog.cjs.entry.js +9 -22
  67. package/dist/cjs/verdocs-upload-dialog.cjs.entry.js.map +1 -1
  68. package/dist/cjs/verdocs-view.cjs.entry.js +331 -0
  69. package/dist/cjs/verdocs-view.cjs.entry.js.map +1 -0
  70. package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
  71. package/dist/collection/collection-manifest.json +1 -3
  72. package/dist/collection/components/controls/verdocs-button/verdocs-button.js +7 -26
  73. package/dist/collection/components/controls/verdocs-button/verdocs-button.js.map +1 -1
  74. package/dist/collection/components/controls/verdocs-button/verdocs-button.stories.js +8 -9
  75. package/dist/collection/components/controls/verdocs-button/verdocs-button.stories.js.map +1 -1
  76. package/dist/collection/components/controls/verdocs-button-panel/verdocs-button-panel.js +9 -1
  77. package/dist/collection/components/controls/verdocs-button-panel/verdocs-button-panel.js.map +1 -1
  78. package/dist/collection/components/controls/verdocs-checkbox/verdocs-checkbox.js +15 -25
  79. package/dist/collection/components/controls/verdocs-checkbox/verdocs-checkbox.js.map +1 -1
  80. package/dist/collection/components/controls/verdocs-checkbox/verdocs-checkbox.stories.js +7 -2
  81. package/dist/collection/components/controls/verdocs-checkbox/verdocs-checkbox.stories.js.map +1 -1
  82. package/dist/collection/components/controls/verdocs-dropdown/verdocs-dropdown.js +14 -22
  83. package/dist/collection/components/controls/verdocs-dropdown/verdocs-dropdown.js.map +1 -1
  84. package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.js +17 -26
  85. package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.js.map +1 -1
  86. package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.stories.js +7 -2
  87. package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.stories.js.map +1 -1
  88. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.js +1 -34
  89. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.js.map +1 -1
  90. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.stories.js +4 -6
  91. package/dist/collection/components/controls/verdocs-select-input/verdocs-select-input.stories.js.map +1 -1
  92. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js +0 -13
  93. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.js.map +1 -1
  94. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.stories.js +3 -5
  95. package/dist/collection/components/controls/verdocs-text-input/verdocs-text-input.stories.js.map +1 -1
  96. package/dist/collection/components/controls/verdocs-toggle/verdocs-toggle.js +0 -26
  97. package/dist/collection/components/controls/verdocs-toggle/verdocs-toggle.js.map +1 -1
  98. package/dist/collection/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.js +5 -23
  99. package/dist/collection/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.js.map +1 -1
  100. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.js +4 -25
  101. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.js.map +1 -1
  102. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.stories.js +8 -7
  103. package/dist/collection/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.stories.js.map +1 -1
  104. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.js +6 -27
  105. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.js.map +1 -1
  106. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.stories.js +10 -9
  107. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.stories.js.map +1 -1
  108. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.js +30 -32
  109. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.js.map +1 -1
  110. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.stories.js +9 -8
  111. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.stories.js.map +1 -1
  112. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.js +7 -25
  113. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.js.map +1 -1
  114. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.stories.js +8 -7
  115. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.stories.js.map +1 -1
  116. package/dist/collection/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.css +2 -1
  117. package/dist/collection/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.js +7 -28
  118. package/dist/collection/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.js.map +1 -1
  119. package/dist/collection/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.stories.js +35 -7
  120. package/dist/collection/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.stories.js.map +1 -1
  121. package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js +15 -40
  122. package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.js.map +1 -1
  123. package/dist/collection/components/elements/verdocs-contact-picker/verdocs-contact-picker.js +4 -4
  124. package/dist/collection/components/elements/verdocs-contact-picker/verdocs-contact-picker.js.map +1 -1
  125. package/dist/collection/components/elements/verdocs-contact-picker/verdocs-contact-picker.stories.js +3 -9
  126. package/dist/collection/components/elements/verdocs-contact-picker/verdocs-contact-picker.stories.js.map +1 -1
  127. package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js +1 -4
  128. package/dist/collection/components/elements/verdocs-document-page/verdocs-document-page.js.map +1 -1
  129. package/dist/collection/components/elements/verdocs-field-attachment/verdocs-field-attachment.js +2 -20
  130. package/dist/collection/components/elements/verdocs-field-attachment/verdocs-field-attachment.js.map +1 -1
  131. package/dist/collection/components/elements/verdocs-field-checkbox-group/verdocs-field-checkbox.js +2 -24
  132. package/dist/collection/components/elements/verdocs-field-checkbox-group/verdocs-field-checkbox.js.map +1 -1
  133. package/dist/collection/components/elements/verdocs-field-date/verdocs-field-date.js +1 -70
  134. package/dist/collection/components/elements/verdocs-field-date/verdocs-field-date.js.map +1 -1
  135. package/dist/collection/components/elements/verdocs-field-textarea/verdocs-field-textarea.js +1 -1
  136. package/dist/collection/components/elements/verdocs-field-textarea/verdocs-field-textarea.js.map +1 -1
  137. package/dist/collection/components/elements/verdocs-field-textbox/verdocs-field-textbox.js +1 -1
  138. package/dist/collection/components/elements/verdocs-field-textbox/verdocs-field-textbox.js.map +1 -1
  139. package/dist/collection/components/elements/verdocs-template-create/verdocs-template-create.js +18 -19
  140. package/dist/collection/components/elements/verdocs-template-create/verdocs-template-create.js.map +1 -1
  141. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.css +14 -1
  142. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js +27 -35
  143. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.js.map +1 -1
  144. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.stories.js +4 -4
  145. package/dist/collection/components/elements/verdocs-template-fields/verdocs-template-fields.stories.js.map +1 -1
  146. package/dist/collection/components/elements/verdocs-template-properties/verdocs-template-properties.js +4 -25
  147. package/dist/collection/components/elements/verdocs-template-properties/verdocs-template-properties.js.map +1 -1
  148. package/dist/collection/components/elements/verdocs-template-properties/verdocs-template-properties.stories.js +3 -3
  149. package/dist/collection/components/elements/verdocs-template-properties/verdocs-template-properties.stories.js.map +1 -1
  150. package/dist/collection/components/elements/verdocs-template-recipients/verdocs-template-recipients.js +7 -23
  151. package/dist/collection/components/elements/verdocs-template-recipients/verdocs-template-recipients.js.map +1 -1
  152. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js +3 -3
  153. package/dist/collection/components/embeds/verdocs-auth/verdocs-auth.js.map +1 -1
  154. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +26 -4
  155. package/dist/collection/components/embeds/verdocs-build/verdocs-build.js.map +1 -1
  156. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.css +15 -0
  157. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js +14 -7
  158. package/dist/collection/components/embeds/verdocs-preview/verdocs-preview.js.map +1 -1
  159. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +2 -2
  160. package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
  161. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js +126 -49
  162. package/dist/collection/components/embeds/verdocs-sign/verdocs-sign.js.map +1 -1
  163. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js +122 -199
  164. package/dist/collection/components/embeds/verdocs-view/verdocs-view.js.map +1 -1
  165. package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js +2 -3
  166. package/dist/collection/components/embeds/verdocs-view/verdocs-view.stories.js.map +1 -1
  167. package/dist/collection/utils/Envelopes.js +31 -0
  168. package/dist/collection/utils/Envelopes.js.map +1 -0
  169. package/dist/collection/utils/Templates.js +0 -15
  170. package/dist/collection/utils/Templates.js.map +1 -1
  171. package/dist/collection/utils/envelopeStore.js +28 -0
  172. package/dist/collection/utils/envelopeStore.js.map +1 -0
  173. package/dist/collection/utils/utils.js +21 -2
  174. package/dist/collection/utils/utils.js.map +1 -1
  175. package/dist/{esm/Envelopes-df05b3c7.js → components/Envelopes.js} +5 -15
  176. package/dist/components/Envelopes.js.map +1 -0
  177. package/dist/components/Templates.js +0 -15
  178. package/dist/components/Templates.js.map +1 -1
  179. package/dist/components/VerdocsEndpoint.js +2185 -1051
  180. package/dist/components/VerdocsEndpoint.js.map +1 -1
  181. package/dist/components/index.d.ts +0 -2
  182. package/dist/components/index.js +0 -2
  183. package/dist/components/index.js.map +1 -1
  184. package/dist/components/index2.js +196 -0
  185. package/dist/components/index2.js.map +1 -0
  186. package/dist/components/templateStore.js +1 -192
  187. package/dist/components/templateStore.js.map +1 -1
  188. package/dist/components/utils.js +22 -3
  189. package/dist/components/utils.js.map +1 -1
  190. package/dist/components/verdocs-auth.js +3 -3
  191. package/dist/components/verdocs-auth.js.map +1 -1
  192. package/dist/components/verdocs-build.js +59 -54
  193. package/dist/components/verdocs-build.js.map +1 -1
  194. package/dist/components/verdocs-button-panel2.js.map +1 -1
  195. package/dist/components/verdocs-button2.js +2 -8
  196. package/dist/components/verdocs-button2.js.map +1 -1
  197. package/dist/components/verdocs-checkbox2.js +2 -7
  198. package/dist/components/verdocs-checkbox2.js.map +1 -1
  199. package/dist/components/verdocs-contact-picker2.js +3 -3
  200. package/dist/components/verdocs-contact-picker2.js.map +1 -1
  201. package/dist/components/verdocs-document-page2.js +1 -4
  202. package/dist/components/verdocs-document-page2.js.map +1 -1
  203. package/dist/components/verdocs-dropdown2.js +4 -6
  204. package/dist/components/verdocs-dropdown2.js.map +1 -1
  205. package/dist/components/verdocs-field-attachment.js +3 -8
  206. package/dist/components/verdocs-field-attachment.js.map +1 -1
  207. package/dist/components/verdocs-field-checkbox2.js +2 -6
  208. package/dist/components/verdocs-field-checkbox2.js.map +1 -1
  209. package/dist/components/verdocs-field-date.js +1 -14
  210. package/dist/components/verdocs-field-date.js.map +1 -1
  211. package/dist/components/verdocs-field-textarea.js +1 -1
  212. package/dist/components/verdocs-field-textarea.js.map +1 -1
  213. package/dist/components/verdocs-field-textbox.js +1 -1
  214. package/dist/components/verdocs-field-textbox.js.map +1 -1
  215. package/dist/components/verdocs-initial-dialog2.js +3 -7
  216. package/dist/components/verdocs-initial-dialog2.js.map +1 -1
  217. package/dist/components/verdocs-kba-dialog.js +4 -8
  218. package/dist/components/verdocs-kba-dialog.js.map +1 -1
  219. package/dist/components/verdocs-ok-dialog2.js +11 -10
  220. package/dist/components/verdocs-ok-dialog2.js.map +1 -1
  221. package/dist/components/verdocs-preview.js +16 -29
  222. package/dist/components/verdocs-preview.js.map +1 -1
  223. package/dist/components/verdocs-radio-button2.js +2 -7
  224. package/dist/components/verdocs-radio-button2.js.map +1 -1
  225. package/dist/components/verdocs-select-input2.js +3 -15
  226. package/dist/components/verdocs-select-input2.js.map +1 -1
  227. package/dist/components/verdocs-send.js +2 -2
  228. package/dist/components/verdocs-send.js.map +1 -1
  229. package/dist/components/verdocs-sign.js +102 -59
  230. package/dist/components/verdocs-sign.js.map +1 -1
  231. package/dist/components/verdocs-signature-dialog2.js +4 -5
  232. package/dist/components/verdocs-signature-dialog2.js.map +1 -1
  233. package/dist/components/verdocs-template-create2.js +42 -12
  234. package/dist/components/verdocs-template-create2.js.map +1 -1
  235. package/dist/components/verdocs-template-fields2.js +37 -68
  236. package/dist/components/verdocs-template-fields2.js.map +1 -1
  237. package/dist/components/verdocs-template-properties2.js +3 -24
  238. package/dist/components/verdocs-template-properties2.js.map +1 -1
  239. package/dist/components/verdocs-template-recipients2.js +5 -7
  240. package/dist/components/verdocs-template-recipients2.js.map +1 -1
  241. package/dist/components/verdocs-template-sender-dialog2.js +4 -8
  242. package/dist/components/verdocs-template-sender-dialog2.js.map +1 -1
  243. package/dist/components/verdocs-text-input2.js +1 -10
  244. package/dist/components/verdocs-text-input2.js.map +1 -1
  245. package/dist/components/verdocs-toggle.js +0 -22
  246. package/dist/components/verdocs-toggle.js.map +1 -1
  247. package/dist/components/verdocs-toolbar-icon2.js +5 -7
  248. package/dist/components/verdocs-toolbar-icon2.js.map +1 -1
  249. package/dist/components/verdocs-upload-dialog2.js +9 -23
  250. package/dist/components/verdocs-upload-dialog2.js.map +1 -1
  251. package/dist/components/verdocs-view.js +353 -1
  252. package/dist/components/verdocs-view.js.map +1 -1
  253. package/dist/docs.json +121 -876
  254. package/dist/esm/Envelopes-b031f847.js +93 -0
  255. package/dist/esm/Envelopes-b031f847.js.map +1 -0
  256. package/dist/esm/Templates-1034fade.js +29 -0
  257. package/dist/esm/Templates-1034fade.js.map +1 -0
  258. package/dist/esm/VerdocsEndpoint-dac04424.js +3566 -0
  259. package/dist/esm/VerdocsEndpoint-dac04424.js.map +1 -0
  260. package/dist/esm/{templateStore-3b26e38d.js → index-fd7b8a34.js} +2 -41
  261. package/dist/esm/index-fd7b8a34.js.map +1 -0
  262. package/dist/esm/loader.js +1 -1
  263. package/dist/esm/templateStore-96a39844.js +44 -0
  264. package/dist/esm/templateStore-96a39844.js.map +1 -0
  265. package/dist/esm/{utils-3f23facc.js → utils-99a3c1f0.js} +23 -4
  266. package/dist/esm/utils-99a3c1f0.js.map +1 -0
  267. package/dist/esm/verdocs-auth.entry.js +4 -4
  268. package/dist/esm/verdocs-auth.entry.js.map +1 -1
  269. package/dist/esm/verdocs-build.entry.js +30 -3
  270. package/dist/esm/verdocs-build.entry.js.map +1 -1
  271. package/dist/esm/verdocs-button-panel_3.entry.js +2 -21
  272. package/dist/esm/verdocs-button-panel_3.entry.js.map +1 -1
  273. package/dist/esm/verdocs-button.entry.js +2 -8
  274. package/dist/esm/verdocs-button.entry.js.map +1 -1
  275. package/dist/esm/verdocs-checkbox.entry.js +2 -7
  276. package/dist/esm/verdocs-checkbox.entry.js.map +1 -1
  277. package/dist/esm/verdocs-contact-picker.entry.js +4 -4
  278. package/dist/esm/verdocs-contact-picker.entry.js.map +1 -1
  279. package/dist/esm/verdocs-document-page_2.entry.js +89 -0
  280. package/dist/esm/verdocs-document-page_2.entry.js.map +1 -0
  281. package/dist/esm/verdocs-dropdown_3.entry.js +6 -11
  282. package/dist/esm/verdocs-dropdown_3.entry.js.map +1 -1
  283. package/dist/esm/verdocs-field-attachment.entry.js +3 -8
  284. package/dist/esm/verdocs-field-attachment.entry.js.map +1 -1
  285. package/dist/esm/verdocs-field-date.entry.js +2 -15
  286. package/dist/esm/verdocs-field-date.entry.js.map +1 -1
  287. package/dist/esm/verdocs-field-dropdown.entry.js +1 -1
  288. package/dist/esm/verdocs-field-initial.entry.js +1 -1
  289. package/dist/esm/verdocs-field-payment.entry.js +1 -1
  290. package/dist/esm/verdocs-field-signature_3.entry.js +9 -11
  291. package/dist/esm/verdocs-field-signature_3.entry.js.map +1 -1
  292. package/dist/esm/verdocs-field-textarea.entry.js +2 -2
  293. package/dist/esm/verdocs-field-textarea.entry.js.map +1 -1
  294. package/dist/esm/verdocs-field-textbox.entry.js +4 -3
  295. package/dist/esm/verdocs-field-textbox.entry.js.map +1 -1
  296. package/dist/esm/verdocs-field-timestamp.entry.js +1 -1
  297. package/dist/esm/verdocs-help-icon_2.entry.js +4 -7
  298. package/dist/esm/verdocs-help-icon_2.entry.js.map +1 -1
  299. package/dist/esm/verdocs-initial-dialog.entry.js +3 -6
  300. package/dist/esm/verdocs-initial-dialog.entry.js.map +1 -1
  301. package/dist/esm/verdocs-kba-dialog.entry.js +4 -7
  302. package/dist/esm/verdocs-kba-dialog.entry.js.map +1 -1
  303. package/dist/esm/verdocs-ok-dialog.entry.js +10 -8
  304. package/dist/esm/verdocs-ok-dialog.entry.js.map +1 -1
  305. package/dist/esm/verdocs-preview.entry.js +17 -11
  306. package/dist/esm/verdocs-preview.entry.js.map +1 -1
  307. package/dist/esm/verdocs-quick-functions_3.entry.js +1 -1
  308. package/dist/esm/verdocs-radio-button.entry.js +2 -7
  309. package/dist/esm/verdocs-radio-button.entry.js.map +1 -1
  310. package/dist/esm/verdocs-search.entry.js +1 -1
  311. package/dist/esm/verdocs-send.entry.js +4 -4
  312. package/dist/esm/verdocs-send.entry.js.map +1 -1
  313. package/dist/esm/verdocs-sign.entry.js +94 -25
  314. package/dist/esm/verdocs-sign.entry.js.map +1 -1
  315. package/dist/esm/verdocs-template-create_4.entry.js +71 -75
  316. package/dist/esm/verdocs-template-create_4.entry.js.map +1 -1
  317. package/dist/esm/verdocs-toggle.entry.js +0 -22
  318. package/dist/esm/verdocs-toggle.entry.js.map +1 -1
  319. package/dist/esm/verdocs-upload-dialog.entry.js +9 -22
  320. package/dist/esm/verdocs-upload-dialog.entry.js.map +1 -1
  321. package/dist/esm/verdocs-view.entry.js +327 -0
  322. package/dist/esm/verdocs-view.entry.js.map +1 -0
  323. package/dist/esm/verdocs-web-sdk.js +1 -1
  324. package/dist/esm-es5/Envelopes-b031f847.js +2 -0
  325. package/dist/esm-es5/Envelopes-b031f847.js.map +1 -0
  326. package/dist/esm-es5/Templates-1034fade.js +2 -0
  327. package/dist/esm-es5/Templates-1034fade.js.map +1 -0
  328. package/dist/esm-es5/VerdocsEndpoint-dac04424.js +2 -0
  329. package/dist/esm-es5/VerdocsEndpoint-dac04424.js.map +1 -0
  330. package/dist/esm-es5/index-fd7b8a34.js +2 -0
  331. package/dist/esm-es5/index-fd7b8a34.js.map +1 -0
  332. package/dist/esm-es5/loader.js +1 -1
  333. package/dist/esm-es5/loader.js.map +1 -1
  334. package/dist/esm-es5/templateStore-96a39844.js +2 -0
  335. package/dist/esm-es5/templateStore-96a39844.js.map +1 -0
  336. package/dist/esm-es5/utils-99a3c1f0.js +2 -0
  337. package/dist/esm-es5/utils-99a3c1f0.js.map +1 -0
  338. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  339. package/dist/esm-es5/verdocs-auth.entry.js.map +1 -1
  340. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  341. package/dist/esm-es5/verdocs-build.entry.js.map +1 -1
  342. package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
  343. package/dist/esm-es5/verdocs-button-panel_3.entry.js.map +1 -1
  344. package/dist/esm-es5/verdocs-button.entry.js +1 -1
  345. package/dist/esm-es5/verdocs-button.entry.js.map +1 -1
  346. package/dist/esm-es5/verdocs-checkbox.entry.js +1 -1
  347. package/dist/esm-es5/verdocs-checkbox.entry.js.map +1 -1
  348. package/dist/esm-es5/verdocs-contact-picker.entry.js +1 -1
  349. package/dist/esm-es5/verdocs-contact-picker.entry.js.map +1 -1
  350. package/dist/esm-es5/verdocs-document-page_2.entry.js +2 -0
  351. package/dist/esm-es5/verdocs-document-page_2.entry.js.map +1 -0
  352. package/dist/esm-es5/verdocs-dropdown_3.entry.js +1 -1
  353. package/dist/esm-es5/verdocs-dropdown_3.entry.js.map +1 -1
  354. package/dist/esm-es5/verdocs-field-attachment.entry.js +1 -1
  355. package/dist/esm-es5/verdocs-field-attachment.entry.js.map +1 -1
  356. package/dist/esm-es5/verdocs-field-date.entry.js +1 -1
  357. package/dist/esm-es5/verdocs-field-date.entry.js.map +1 -1
  358. package/dist/esm-es5/verdocs-field-dropdown.entry.js +1 -1
  359. package/dist/esm-es5/verdocs-field-initial.entry.js +1 -1
  360. package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
  361. package/dist/esm-es5/verdocs-field-signature_3.entry.js +1 -1
  362. package/dist/esm-es5/verdocs-field-signature_3.entry.js.map +1 -1
  363. package/dist/esm-es5/verdocs-field-textarea.entry.js +1 -1
  364. package/dist/esm-es5/verdocs-field-textarea.entry.js.map +1 -1
  365. package/dist/esm-es5/verdocs-field-textbox.entry.js +1 -1
  366. package/dist/esm-es5/verdocs-field-textbox.entry.js.map +1 -1
  367. package/dist/esm-es5/verdocs-field-timestamp.entry.js +1 -1
  368. package/dist/esm-es5/verdocs-help-icon_2.entry.js +1 -1
  369. package/dist/esm-es5/verdocs-help-icon_2.entry.js.map +1 -1
  370. package/dist/esm-es5/verdocs-initial-dialog.entry.js +1 -1
  371. package/dist/esm-es5/verdocs-initial-dialog.entry.js.map +1 -1
  372. package/dist/esm-es5/verdocs-kba-dialog.entry.js +1 -1
  373. package/dist/esm-es5/verdocs-kba-dialog.entry.js.map +1 -1
  374. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  375. package/dist/esm-es5/verdocs-ok-dialog.entry.js.map +1 -1
  376. package/dist/esm-es5/verdocs-preview.entry.js +1 -1
  377. package/dist/esm-es5/verdocs-preview.entry.js.map +1 -1
  378. package/dist/esm-es5/verdocs-quick-functions_3.entry.js +1 -1
  379. package/dist/esm-es5/verdocs-radio-button.entry.js +1 -1
  380. package/dist/esm-es5/verdocs-radio-button.entry.js.map +1 -1
  381. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  382. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  383. package/dist/esm-es5/verdocs-send.entry.js.map +1 -1
  384. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  385. package/dist/esm-es5/verdocs-sign.entry.js.map +1 -1
  386. package/dist/esm-es5/verdocs-template-create_4.entry.js +1 -1
  387. package/dist/esm-es5/verdocs-template-create_4.entry.js.map +1 -1
  388. package/dist/esm-es5/verdocs-toggle.entry.js.map +1 -1
  389. package/dist/esm-es5/verdocs-upload-dialog.entry.js +1 -1
  390. package/dist/esm-es5/verdocs-upload-dialog.entry.js.map +1 -1
  391. package/dist/esm-es5/verdocs-view.entry.js +2 -0
  392. package/dist/esm-es5/verdocs-view.entry.js.map +1 -0
  393. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  394. package/dist/esm-es5/verdocs-web-sdk.js.map +1 -1
  395. package/dist/types/components/controls/verdocs-button/verdocs-button.d.ts +6 -8
  396. package/dist/types/components/controls/verdocs-button/verdocs-button.stories.d.ts +2 -2
  397. package/dist/types/components/controls/verdocs-button-panel/verdocs-button-panel.d.ts +9 -1
  398. package/dist/types/components/controls/verdocs-checkbox/verdocs-checkbox.d.ts +14 -12
  399. package/dist/types/components/controls/verdocs-checkbox/verdocs-checkbox.stories.d.ts +2 -1
  400. package/dist/types/components/controls/verdocs-dropdown/verdocs-dropdown.d.ts +10 -1
  401. package/dist/types/components/controls/verdocs-radio-button/verdocs-radio-button.d.ts +16 -13
  402. package/dist/types/components/controls/verdocs-radio-button/verdocs-radio-button.stories.d.ts +2 -1
  403. package/dist/types/components/controls/verdocs-select-input/verdocs-select-input.d.ts +0 -9
  404. package/dist/types/components/controls/verdocs-select-input/verdocs-select-input.stories.d.ts +2 -2
  405. package/dist/types/components/controls/verdocs-text-input/verdocs-text-input.d.ts +0 -3
  406. package/dist/types/components/controls/verdocs-text-input/verdocs-text-input.stories.d.ts +2 -2
  407. package/dist/types/components/controls/verdocs-toggle/verdocs-toggle.d.ts +0 -4
  408. package/dist/types/components/controls/verdocs-toolbar-icon/verdocs-toolbar-icon.d.ts +0 -3
  409. package/dist/types/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.d.ts +1 -5
  410. package/dist/types/components/dialogs/verdocs-initial-dialog/verdocs-initial-dialog.stories.d.ts +3 -3
  411. package/dist/types/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.d.ts +2 -6
  412. package/dist/types/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.stories.d.ts +3 -3
  413. package/dist/types/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.d.ts +9 -8
  414. package/dist/types/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.stories.d.ts +4 -4
  415. package/dist/types/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.d.ts +4 -7
  416. package/dist/types/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.stories.d.ts +3 -3
  417. package/dist/types/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.d.ts +2 -8
  418. package/dist/types/components/dialogs/verdocs-template-sender-dialog/verdocs-template-sender-dialog.stories.d.ts +4 -4
  419. package/dist/types/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.d.ts +7 -9
  420. package/dist/types/components/elements/verdocs-contact-picker/verdocs-contact-picker.d.ts +1 -1
  421. package/dist/types/components/elements/verdocs-contact-picker/verdocs-contact-picker.stories.d.ts +3 -3
  422. package/dist/types/components/elements/verdocs-field-attachment/verdocs-field-attachment.d.ts +0 -7
  423. package/dist/types/components/elements/verdocs-field-checkbox-group/verdocs-field-checkbox.d.ts +1 -13
  424. package/dist/types/components/elements/verdocs-field-date/verdocs-field-date.d.ts +0 -20
  425. package/dist/types/components/elements/verdocs-template-create/verdocs-template-create.d.ts +3 -5
  426. package/dist/types/components/elements/verdocs-template-fields/verdocs-template-fields.d.ts +2 -2
  427. package/dist/types/components/elements/verdocs-template-fields/verdocs-template-fields.stories.d.ts +3 -3
  428. package/dist/types/components/elements/verdocs-template-properties/verdocs-template-properties.d.ts +1 -2
  429. package/dist/types/components/elements/verdocs-template-properties/verdocs-template-properties.stories.d.ts +3 -3
  430. package/dist/types/components/elements/verdocs-template-recipients/verdocs-template-recipients.d.ts +2 -6
  431. package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +2 -2
  432. package/dist/types/components/embeds/verdocs-preview/verdocs-preview.d.ts +3 -1
  433. package/dist/types/components/embeds/verdocs-sign/verdocs-sign.d.ts +23 -8
  434. package/dist/types/components/embeds/verdocs-view/verdocs-view.d.ts +5 -40
  435. package/dist/types/components/embeds/verdocs-view/verdocs-view.stories.d.ts +1 -2
  436. package/dist/types/components.d.ts +48 -389
  437. package/dist/types/utils/Envelopes.d.ts +2 -0
  438. package/dist/types/utils/envelopeStore.d.ts +10 -0
  439. package/dist/types/utils/utils.d.ts +10 -2
  440. package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js → p-0a2efec0.system.entry.js} +2 -2
  441. package/dist/verdocs-web-sdk/{p-ff4840d2.system.entry.js.map → p-0a2efec0.system.entry.js.map} +0 -0
  442. package/dist/verdocs-web-sdk/p-0a3d0ca9.js +2 -0
  443. package/dist/verdocs-web-sdk/p-0a3d0ca9.js.map +1 -0
  444. package/dist/verdocs-web-sdk/{p-f5a5e049.system.entry.js → p-0b2290c6.system.entry.js} +2 -2
  445. package/dist/verdocs-web-sdk/p-0b2290c6.system.entry.js.map +1 -0
  446. package/dist/verdocs-web-sdk/p-0f6da8c7.system.js +2 -0
  447. package/dist/verdocs-web-sdk/p-0f6da8c7.system.js.map +1 -0
  448. package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js → p-112c8e05.system.entry.js} +2 -2
  449. package/dist/verdocs-web-sdk/{p-d2d3b56d.system.entry.js.map → p-112c8e05.system.entry.js.map} +0 -0
  450. package/dist/verdocs-web-sdk/p-15584ecb.entry.js +2 -0
  451. package/dist/verdocs-web-sdk/p-15584ecb.entry.js.map +1 -0
  452. package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js +2 -0
  453. package/dist/verdocs-web-sdk/p-1cd2f7dc.system.js.map +1 -0
  454. package/dist/verdocs-web-sdk/p-202a569e.entry.js +2 -0
  455. package/dist/verdocs-web-sdk/p-202a569e.entry.js.map +1 -0
  456. package/dist/verdocs-web-sdk/p-21ec6ff0.system.js +2 -0
  457. package/dist/verdocs-web-sdk/p-21ec6ff0.system.js.map +1 -0
  458. package/dist/verdocs-web-sdk/p-2b822750.system.entry.js +2 -0
  459. package/dist/verdocs-web-sdk/p-2b822750.system.entry.js.map +1 -0
  460. package/dist/verdocs-web-sdk/p-2cf3843a.entry.js +2 -0
  461. package/dist/verdocs-web-sdk/p-2cf3843a.entry.js.map +1 -0
  462. package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js → p-2fe5b678.entry.js} +2 -2
  463. package/dist/verdocs-web-sdk/{p-f11b14a1.entry.js.map → p-2fe5b678.entry.js.map} +0 -0
  464. package/dist/verdocs-web-sdk/p-30424967.entry.js +2 -0
  465. package/dist/verdocs-web-sdk/p-30424967.entry.js.map +1 -0
  466. package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js +2 -0
  467. package/dist/verdocs-web-sdk/p-32c7bce8.system.entry.js.map +1 -0
  468. package/dist/verdocs-web-sdk/p-32da34af.system.js +2 -0
  469. package/dist/verdocs-web-sdk/p-32da34af.system.js.map +1 -0
  470. package/dist/verdocs-web-sdk/{p-2510c268.entry.js → p-32e3a428.entry.js} +2 -2
  471. package/dist/verdocs-web-sdk/{p-2510c268.entry.js.map → p-32e3a428.entry.js.map} +0 -0
  472. package/dist/verdocs-web-sdk/p-3585534a.system.entry.js +2 -0
  473. package/dist/verdocs-web-sdk/p-3585534a.system.entry.js.map +1 -0
  474. package/dist/verdocs-web-sdk/{p-62ffe7a3.system.entry.js → p-35fec075.system.entry.js} +2 -2
  475. package/dist/verdocs-web-sdk/p-35fec075.system.entry.js.map +1 -0
  476. package/dist/verdocs-web-sdk/p-37a75b0e.system.entry.js.map +1 -1
  477. package/dist/verdocs-web-sdk/{p-bdc40f6e.entry.js → p-4b4c610f.entry.js} +2 -2
  478. package/dist/verdocs-web-sdk/p-4b4c610f.entry.js.map +1 -0
  479. package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js → p-5b636344.entry.js} +2 -2
  480. package/dist/verdocs-web-sdk/{p-8c549b7f.entry.js.map → p-5b636344.entry.js.map} +0 -0
  481. package/dist/verdocs-web-sdk/p-5bb42252.system.entry.js +2 -0
  482. package/dist/verdocs-web-sdk/p-5bb42252.system.entry.js.map +1 -0
  483. package/dist/verdocs-web-sdk/p-5bfc608d.entry.js.map +1 -1
  484. package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js +2 -0
  485. package/dist/verdocs-web-sdk/p-5d341c89.system.entry.js.map +1 -0
  486. package/dist/verdocs-web-sdk/p-5e6134d8.entry.js +2 -0
  487. package/dist/verdocs-web-sdk/p-5e6134d8.entry.js.map +1 -0
  488. package/dist/verdocs-web-sdk/p-5ea05a1d.js +2 -0
  489. package/dist/verdocs-web-sdk/p-5ea05a1d.js.map +1 -0
  490. package/dist/verdocs-web-sdk/p-6121f103.system.entry.js +2 -0
  491. package/dist/verdocs-web-sdk/p-6121f103.system.entry.js.map +1 -0
  492. package/dist/verdocs-web-sdk/p-6802bdd2.system.entry.js +2 -0
  493. package/dist/verdocs-web-sdk/p-6802bdd2.system.entry.js.map +1 -0
  494. package/dist/verdocs-web-sdk/{p-f972b493.system.entry.js → p-6a8ac53e.system.entry.js} +2 -2
  495. package/dist/verdocs-web-sdk/p-6a8ac53e.system.entry.js.map +1 -0
  496. package/dist/verdocs-web-sdk/p-71f1e3c9.system.entry.js +2 -0
  497. package/dist/verdocs-web-sdk/p-71f1e3c9.system.entry.js.map +1 -0
  498. package/dist/verdocs-web-sdk/{p-7e7b1a27.system.entry.js → p-78468adf.system.entry.js} +2 -2
  499. package/dist/verdocs-web-sdk/p-78468adf.system.entry.js.map +1 -0
  500. package/dist/verdocs-web-sdk/p-78ec7db1.system.entry.js +2 -0
  501. package/dist/verdocs-web-sdk/p-78ec7db1.system.entry.js.map +1 -0
  502. package/dist/verdocs-web-sdk/{p-60f92123.system.entry.js → p-7a5c37cd.system.entry.js} +2 -2
  503. package/dist/verdocs-web-sdk/p-7a5c37cd.system.entry.js.map +1 -0
  504. package/dist/verdocs-web-sdk/{p-04708900.system.entry.js → p-8095fab3.system.entry.js} +2 -2
  505. package/dist/verdocs-web-sdk/{p-04708900.system.entry.js.map → p-8095fab3.system.entry.js.map} +0 -0
  506. package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js → p-868f497f.entry.js} +2 -2
  507. package/dist/verdocs-web-sdk/{p-036fc9f9.entry.js.map → p-868f497f.entry.js.map} +0 -0
  508. package/dist/verdocs-web-sdk/{p-f5482845.entry.js → p-8ef53023.entry.js} +2 -2
  509. package/dist/verdocs-web-sdk/p-8ef53023.entry.js.map +1 -0
  510. package/dist/verdocs-web-sdk/p-9236d9df.entry.js +2 -0
  511. package/dist/verdocs-web-sdk/p-9236d9df.entry.js.map +1 -0
  512. package/dist/verdocs-web-sdk/p-92b0fc42.js +2 -0
  513. package/dist/verdocs-web-sdk/p-92b0fc42.js.map +1 -0
  514. package/dist/verdocs-web-sdk/{p-5a9ad57d.entry.js → p-a59f1f82.entry.js} +2 -2
  515. package/dist/verdocs-web-sdk/p-a59f1f82.entry.js.map +1 -0
  516. package/dist/verdocs-web-sdk/p-a760546b.entry.js +2 -0
  517. package/dist/verdocs-web-sdk/p-a760546b.entry.js.map +1 -0
  518. package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js +2 -0
  519. package/dist/verdocs-web-sdk/p-a7ac4da8.system.entry.js.map +1 -0
  520. package/dist/verdocs-web-sdk/{p-1935d358.system.entry.js → p-a8c25a4a.system.entry.js} +2 -2
  521. package/dist/verdocs-web-sdk/p-a8c25a4a.system.entry.js.map +1 -0
  522. package/dist/verdocs-web-sdk/p-a9068845.entry.js +2 -0
  523. package/dist/verdocs-web-sdk/p-a9068845.entry.js.map +1 -0
  524. package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js → p-aa2d9932.system.entry.js} +2 -2
  525. package/dist/verdocs-web-sdk/{p-0d12be64.system.entry.js.map → p-aa2d9932.system.entry.js.map} +0 -0
  526. package/dist/verdocs-web-sdk/p-aa3a42a4.system.entry.js +2 -0
  527. package/dist/verdocs-web-sdk/p-aa3a42a4.system.entry.js.map +1 -0
  528. package/dist/verdocs-web-sdk/p-acfdfb92.system.entry.js +2 -0
  529. package/dist/verdocs-web-sdk/p-acfdfb92.system.entry.js.map +1 -0
  530. package/dist/verdocs-web-sdk/{p-3bc4c242.entry.js → p-af1063e3.entry.js} +2 -2
  531. package/dist/verdocs-web-sdk/p-af1063e3.entry.js.map +1 -0
  532. package/dist/verdocs-web-sdk/{p-b77e5b39.entry.js → p-b2dea632.entry.js} +2 -2
  533. package/dist/verdocs-web-sdk/p-b2dea632.entry.js.map +1 -0
  534. package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js → p-b5882803.system.entry.js} +2 -2
  535. package/dist/verdocs-web-sdk/{p-cf8ecaaf.system.entry.js.map → p-b5882803.system.entry.js.map} +0 -0
  536. package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js → p-b6c24f97.system.entry.js} +2 -2
  537. package/dist/verdocs-web-sdk/{p-68319ca5.system.entry.js.map → p-b6c24f97.system.entry.js.map} +0 -0
  538. package/dist/verdocs-web-sdk/p-b9cdae44.system.entry.js +2 -0
  539. package/dist/verdocs-web-sdk/p-b9cdae44.system.entry.js.map +1 -0
  540. package/dist/verdocs-web-sdk/{p-2da21c85.entry.js → p-baa985a4.entry.js} +2 -2
  541. package/dist/verdocs-web-sdk/{p-2da21c85.entry.js.map → p-baa985a4.entry.js.map} +0 -0
  542. package/dist/verdocs-web-sdk/p-be8004c0.entry.js +2 -0
  543. package/dist/verdocs-web-sdk/p-be8004c0.entry.js.map +1 -0
  544. package/dist/verdocs-web-sdk/p-becd8d7e.js +2 -0
  545. package/dist/verdocs-web-sdk/p-becd8d7e.js.map +1 -0
  546. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
  547. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js.map +1 -1
  548. package/dist/verdocs-web-sdk/p-c2ad9de3.entry.js +2 -0
  549. package/dist/verdocs-web-sdk/p-c2ad9de3.entry.js.map +1 -0
  550. package/dist/verdocs-web-sdk/p-c4357387.entry.js +2 -0
  551. package/dist/verdocs-web-sdk/p-c4357387.entry.js.map +1 -0
  552. package/dist/verdocs-web-sdk/{p-6f1440dd.js → p-c5a43bb3.js} +2 -2
  553. package/dist/verdocs-web-sdk/p-c5a43bb3.js.map +1 -0
  554. package/dist/verdocs-web-sdk/p-cb7d9ff5.js +2 -0
  555. package/dist/verdocs-web-sdk/p-cb7d9ff5.js.map +1 -0
  556. package/dist/verdocs-web-sdk/{p-f9901184.system.js → p-cd7b475a.system.js} +2 -2
  557. package/dist/verdocs-web-sdk/p-cd7b475a.system.js.map +1 -0
  558. package/dist/verdocs-web-sdk/{p-b5b9d603.entry.js → p-ce27dc71.entry.js} +2 -2
  559. package/dist/verdocs-web-sdk/p-ce27dc71.entry.js.map +1 -0
  560. package/dist/verdocs-web-sdk/p-d1a97a03.system.js +2 -0
  561. package/dist/verdocs-web-sdk/p-d1a97a03.system.js.map +1 -0
  562. package/dist/verdocs-web-sdk/p-d5f48c21.entry.js +2 -0
  563. package/dist/verdocs-web-sdk/p-d5f48c21.entry.js.map +1 -0
  564. package/dist/verdocs-web-sdk/{p-4425de92.system.entry.js → p-dd864f36.system.entry.js} +2 -2
  565. package/dist/verdocs-web-sdk/p-dd864f36.system.entry.js.map +1 -0
  566. package/dist/verdocs-web-sdk/p-df44cc61.system.entry.js +2 -0
  567. package/dist/verdocs-web-sdk/p-df44cc61.system.entry.js.map +1 -0
  568. package/dist/verdocs-web-sdk/p-e4569806.system.entry.js +2 -0
  569. package/dist/verdocs-web-sdk/p-e4569806.system.entry.js.map +1 -0
  570. package/dist/verdocs-web-sdk/p-e4fa4969.entry.js +2 -0
  571. package/dist/verdocs-web-sdk/p-e4fa4969.entry.js.map +1 -0
  572. package/dist/verdocs-web-sdk/p-e96a04c2.entry.js +2 -0
  573. package/dist/verdocs-web-sdk/p-e96a04c2.entry.js.map +1 -0
  574. package/dist/verdocs-web-sdk/p-ed71080a.entry.js +2 -0
  575. package/dist/verdocs-web-sdk/p-ed71080a.entry.js.map +1 -0
  576. package/dist/verdocs-web-sdk/{p-4226119d.entry.js → p-f19e600e.entry.js} +2 -2
  577. package/dist/verdocs-web-sdk/p-f19e600e.entry.js.map +1 -0
  578. package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js +2 -0
  579. package/dist/verdocs-web-sdk/p-f8c49765.system.entry.js.map +1 -0
  580. package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js → p-f9a9b3a2.entry.js} +2 -2
  581. package/dist/verdocs-web-sdk/{p-6f938ce3.entry.js.map → p-f9a9b3a2.entry.js.map} +0 -0
  582. package/dist/verdocs-web-sdk/p-fac05414.entry.js +2 -0
  583. package/dist/verdocs-web-sdk/p-fac05414.entry.js.map +1 -0
  584. package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js +2 -0
  585. package/dist/verdocs-web-sdk/p-fc93f2f3.entry.js.map +1 -0
  586. package/dist/verdocs-web-sdk/{p-48321abf.system.entry.js → p-ff0b44f9.system.entry.js} +2 -2
  587. package/dist/verdocs-web-sdk/p-ff0b44f9.system.entry.js.map +1 -0
  588. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  589. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js.map +1 -1
  590. package/package.json +2 -2
  591. package/dist/cjs/Envelopes-22a0c02f.js.map +0 -1
  592. package/dist/cjs/TemplateDocuments-01c6e570.js +0 -45
  593. package/dist/cjs/TemplateDocuments-01c6e570.js.map +0 -1
  594. package/dist/cjs/Templates-3e6d5043.js +0 -63
  595. package/dist/cjs/Templates-3e6d5043.js.map +0 -1
  596. package/dist/cjs/VerdocsEndpoint-db38e942.js +0 -2435
  597. package/dist/cjs/VerdocsEndpoint-db38e942.js.map +0 -1
  598. package/dist/cjs/templateStore-92828c3c.js.map +0 -1
  599. package/dist/cjs/utils-84236321.js.map +0 -1
  600. package/dist/cjs/verdocs-document-page.cjs.entry.js +0 -84
  601. package/dist/cjs/verdocs-document-page.cjs.entry.js.map +0 -1
  602. package/dist/cjs/verdocs-loader_4.cjs.entry.js +0 -577
  603. package/dist/cjs/verdocs-loader_4.cjs.entry.js.map +0 -1
  604. package/dist/collection/components/dialogs/verdocs-upload-dialog/paperclip.svg +0 -3
  605. package/dist/collection/components/dialogs/verdocs-upload-dialog/trash.svg +0 -3
  606. package/dist/collection/components/elements/verdocs-field-attachment/paperclip.svg +0 -3
  607. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.css +0 -16
  608. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js +0 -390
  609. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.js.map +0 -1
  610. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js +0 -15
  611. package/dist/collection/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.js.map +0 -1
  612. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.css +0 -16
  613. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js +0 -388
  614. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.js.map +0 -1
  615. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js +0 -15
  616. package/dist/collection/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.js.map +0 -1
  617. package/dist/components/Pages.js +0 -20
  618. package/dist/components/Pages.js.map +0 -1
  619. package/dist/components/TemplateDocuments.js +0 -42
  620. package/dist/components/TemplateDocuments.js.map +0 -1
  621. package/dist/components/verdocs-view-envelope-document.d.ts +0 -11
  622. package/dist/components/verdocs-view-envelope-document.js +0 -8
  623. package/dist/components/verdocs-view-envelope-document.js.map +0 -1
  624. package/dist/components/verdocs-view-envelope-document2.js +0 -306
  625. package/dist/components/verdocs-view-envelope-document2.js.map +0 -1
  626. package/dist/components/verdocs-view-template-document.d.ts +0 -11
  627. package/dist/components/verdocs-view-template-document.js +0 -8
  628. package/dist/components/verdocs-view-template-document.js.map +0 -1
  629. package/dist/components/verdocs-view-template-document2.js +0 -209
  630. package/dist/components/verdocs-view-template-document2.js.map +0 -1
  631. package/dist/components/verdocs-view2.js +0 -253
  632. package/dist/components/verdocs-view2.js.map +0 -1
  633. package/dist/esm/Envelopes-df05b3c7.js.map +0 -1
  634. package/dist/esm/TemplateDocuments-89ba2276.js +0 -42
  635. package/dist/esm/TemplateDocuments-89ba2276.js.map +0 -1
  636. package/dist/esm/Templates-035e0ea2.js +0 -60
  637. package/dist/esm/Templates-035e0ea2.js.map +0 -1
  638. package/dist/esm/VerdocsEndpoint-82f4600d.js +0 -2432
  639. package/dist/esm/VerdocsEndpoint-82f4600d.js.map +0 -1
  640. package/dist/esm/templateStore-3b26e38d.js.map +0 -1
  641. package/dist/esm/utils-3f23facc.js.map +0 -1
  642. package/dist/esm/verdocs-document-page.entry.js +0 -80
  643. package/dist/esm/verdocs-document-page.entry.js.map +0 -1
  644. package/dist/esm/verdocs-loader_4.entry.js +0 -570
  645. package/dist/esm/verdocs-loader_4.entry.js.map +0 -1
  646. package/dist/esm-es5/Envelopes-df05b3c7.js +0 -2
  647. package/dist/esm-es5/Envelopes-df05b3c7.js.map +0 -1
  648. package/dist/esm-es5/TemplateDocuments-89ba2276.js +0 -2
  649. package/dist/esm-es5/TemplateDocuments-89ba2276.js.map +0 -1
  650. package/dist/esm-es5/Templates-035e0ea2.js +0 -2
  651. package/dist/esm-es5/Templates-035e0ea2.js.map +0 -1
  652. package/dist/esm-es5/VerdocsEndpoint-82f4600d.js +0 -2
  653. package/dist/esm-es5/VerdocsEndpoint-82f4600d.js.map +0 -1
  654. package/dist/esm-es5/templateStore-3b26e38d.js +0 -2
  655. package/dist/esm-es5/templateStore-3b26e38d.js.map +0 -1
  656. package/dist/esm-es5/utils-3f23facc.js +0 -2
  657. package/dist/esm-es5/utils-3f23facc.js.map +0 -1
  658. package/dist/esm-es5/verdocs-document-page.entry.js +0 -2
  659. package/dist/esm-es5/verdocs-document-page.entry.js.map +0 -1
  660. package/dist/esm-es5/verdocs-loader_4.entry.js +0 -2
  661. package/dist/esm-es5/verdocs-loader_4.entry.js.map +0 -1
  662. package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.d.ts +0 -79
  663. package/dist/types/components/elements/verdocs-view-envelope-document/verdocs-view-envelope-document.stories.d.ts +0 -7
  664. package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.d.ts +0 -77
  665. package/dist/types/components/elements/verdocs-view-template-document/verdocs-view-template-document.stories.d.ts +0 -7
  666. package/dist/verdocs-web-sdk/p-03677b65.system.js +0 -2
  667. package/dist/verdocs-web-sdk/p-03677b65.system.js.map +0 -1
  668. package/dist/verdocs-web-sdk/p-04373c06.entry.js +0 -2
  669. package/dist/verdocs-web-sdk/p-04373c06.entry.js.map +0 -1
  670. package/dist/verdocs-web-sdk/p-0824553f.system.entry.js +0 -2
  671. package/dist/verdocs-web-sdk/p-0824553f.system.entry.js.map +0 -1
  672. package/dist/verdocs-web-sdk/p-152dd2f0.system.entry.js +0 -2
  673. package/dist/verdocs-web-sdk/p-152dd2f0.system.entry.js.map +0 -1
  674. package/dist/verdocs-web-sdk/p-16c77fbb.system.entry.js +0 -2
  675. package/dist/verdocs-web-sdk/p-16c77fbb.system.entry.js.map +0 -1
  676. package/dist/verdocs-web-sdk/p-1935d358.system.entry.js.map +0 -1
  677. package/dist/verdocs-web-sdk/p-3035b6c5.system.js +0 -2
  678. package/dist/verdocs-web-sdk/p-3035b6c5.system.js.map +0 -1
  679. package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js +0 -2
  680. package/dist/verdocs-web-sdk/p-3a4126d5.system.entry.js.map +0 -1
  681. package/dist/verdocs-web-sdk/p-3bc4c242.entry.js.map +0 -1
  682. package/dist/verdocs-web-sdk/p-4226119d.entry.js.map +0 -1
  683. package/dist/verdocs-web-sdk/p-4425de92.system.entry.js.map +0 -1
  684. package/dist/verdocs-web-sdk/p-48321abf.system.entry.js.map +0 -1
  685. package/dist/verdocs-web-sdk/p-52179311.entry.js +0 -2
  686. package/dist/verdocs-web-sdk/p-52179311.entry.js.map +0 -1
  687. package/dist/verdocs-web-sdk/p-5713fea6.entry.js +0 -2
  688. package/dist/verdocs-web-sdk/p-5713fea6.entry.js.map +0 -1
  689. package/dist/verdocs-web-sdk/p-5a9ad57d.entry.js.map +0 -1
  690. package/dist/verdocs-web-sdk/p-5c40246d.entry.js +0 -2
  691. package/dist/verdocs-web-sdk/p-5c40246d.entry.js.map +0 -1
  692. package/dist/verdocs-web-sdk/p-60f92123.system.entry.js.map +0 -1
  693. package/dist/verdocs-web-sdk/p-6258ec3f.system.entry.js +0 -2
  694. package/dist/verdocs-web-sdk/p-6258ec3f.system.entry.js.map +0 -1
  695. package/dist/verdocs-web-sdk/p-629237fc.js +0 -2
  696. package/dist/verdocs-web-sdk/p-629237fc.js.map +0 -1
  697. package/dist/verdocs-web-sdk/p-62ffe7a3.system.entry.js.map +0 -1
  698. package/dist/verdocs-web-sdk/p-656369a3.entry.js +0 -2
  699. package/dist/verdocs-web-sdk/p-656369a3.entry.js.map +0 -1
  700. package/dist/verdocs-web-sdk/p-6d0c6604.system.entry.js +0 -2
  701. package/dist/verdocs-web-sdk/p-6d0c6604.system.entry.js.map +0 -1
  702. package/dist/verdocs-web-sdk/p-6e1ada33.system.js +0 -2
  703. package/dist/verdocs-web-sdk/p-6e1ada33.system.js.map +0 -1
  704. package/dist/verdocs-web-sdk/p-6f1440dd.js.map +0 -1
  705. package/dist/verdocs-web-sdk/p-70c732b7.js +0 -2
  706. package/dist/verdocs-web-sdk/p-70c732b7.js.map +0 -1
  707. package/dist/verdocs-web-sdk/p-7a476918.entry.js +0 -2
  708. package/dist/verdocs-web-sdk/p-7a476918.entry.js.map +0 -1
  709. package/dist/verdocs-web-sdk/p-7ce27ce2.js +0 -2
  710. package/dist/verdocs-web-sdk/p-7ce27ce2.js.map +0 -1
  711. package/dist/verdocs-web-sdk/p-7e7b1a27.system.entry.js.map +0 -1
  712. package/dist/verdocs-web-sdk/p-824da7e4.entry.js +0 -2
  713. package/dist/verdocs-web-sdk/p-824da7e4.entry.js.map +0 -1
  714. package/dist/verdocs-web-sdk/p-82df4878.entry.js +0 -2
  715. package/dist/verdocs-web-sdk/p-82df4878.entry.js.map +0 -1
  716. package/dist/verdocs-web-sdk/p-8fd9dc5a.js +0 -2
  717. package/dist/verdocs-web-sdk/p-8fd9dc5a.js.map +0 -1
  718. package/dist/verdocs-web-sdk/p-9727d90b.entry.js +0 -2
  719. package/dist/verdocs-web-sdk/p-9727d90b.entry.js.map +0 -1
  720. package/dist/verdocs-web-sdk/p-98a23073.system.entry.js +0 -2
  721. package/dist/verdocs-web-sdk/p-98a23073.system.entry.js.map +0 -1
  722. package/dist/verdocs-web-sdk/p-9e1dda0b.system.entry.js +0 -2
  723. package/dist/verdocs-web-sdk/p-9e1dda0b.system.entry.js.map +0 -1
  724. package/dist/verdocs-web-sdk/p-9f8576e1.entry.js +0 -2
  725. package/dist/verdocs-web-sdk/p-9f8576e1.entry.js.map +0 -1
  726. package/dist/verdocs-web-sdk/p-a4041773.system.js +0 -2
  727. package/dist/verdocs-web-sdk/p-a4041773.system.js.map +0 -1
  728. package/dist/verdocs-web-sdk/p-a43e5fb3.system.entry.js +0 -2
  729. package/dist/verdocs-web-sdk/p-a43e5fb3.system.entry.js.map +0 -1
  730. package/dist/verdocs-web-sdk/p-a717d591.system.entry.js +0 -2
  731. package/dist/verdocs-web-sdk/p-a717d591.system.entry.js.map +0 -1
  732. package/dist/verdocs-web-sdk/p-a8699c5d.system.entry.js +0 -2
  733. package/dist/verdocs-web-sdk/p-a8699c5d.system.entry.js.map +0 -1
  734. package/dist/verdocs-web-sdk/p-b348e0ee.entry.js +0 -2
  735. package/dist/verdocs-web-sdk/p-b348e0ee.entry.js.map +0 -1
  736. package/dist/verdocs-web-sdk/p-b5b9d603.entry.js.map +0 -1
  737. package/dist/verdocs-web-sdk/p-b77e5b39.entry.js.map +0 -1
  738. package/dist/verdocs-web-sdk/p-b8e6a9b6.system.entry.js +0 -2
  739. package/dist/verdocs-web-sdk/p-b8e6a9b6.system.entry.js.map +0 -1
  740. package/dist/verdocs-web-sdk/p-bdc40f6e.entry.js.map +0 -1
  741. package/dist/verdocs-web-sdk/p-bf8a6175.entry.js +0 -2
  742. package/dist/verdocs-web-sdk/p-bf8a6175.entry.js.map +0 -1
  743. package/dist/verdocs-web-sdk/p-c0c61629.entry.js +0 -2
  744. package/dist/verdocs-web-sdk/p-c0c61629.entry.js.map +0 -1
  745. package/dist/verdocs-web-sdk/p-c1a9eb1f.js +0 -2
  746. package/dist/verdocs-web-sdk/p-c1a9eb1f.js.map +0 -1
  747. package/dist/verdocs-web-sdk/p-c51715f2.entry.js +0 -2
  748. package/dist/verdocs-web-sdk/p-c51715f2.entry.js.map +0 -1
  749. package/dist/verdocs-web-sdk/p-c827cc19.system.js +0 -2
  750. package/dist/verdocs-web-sdk/p-c827cc19.system.js.map +0 -1
  751. package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js +0 -2
  752. package/dist/verdocs-web-sdk/p-cf2d7761.system.entry.js.map +0 -1
  753. package/dist/verdocs-web-sdk/p-d2b22759.entry.js +0 -2
  754. package/dist/verdocs-web-sdk/p-d2b22759.entry.js.map +0 -1
  755. package/dist/verdocs-web-sdk/p-f29b8035.entry.js +0 -2
  756. package/dist/verdocs-web-sdk/p-f29b8035.entry.js.map +0 -1
  757. package/dist/verdocs-web-sdk/p-f5482845.entry.js.map +0 -1
  758. package/dist/verdocs-web-sdk/p-f5a5e049.system.entry.js.map +0 -1
  759. package/dist/verdocs-web-sdk/p-f972b493.system.entry.js.map +0 -1
  760. package/dist/verdocs-web-sdk/p-f9901184.system.js.map +0 -1
  761. package/dist/verdocs-web-sdk/p-fb13e1ce.system.entry.js +0 -2
  762. package/dist/verdocs-web-sdk/p-fb13e1ce.system.entry.js.map +0 -1
  763. package/dist/verdocs-web-sdk/p-fc2d6d85.system.entry.js +0 -2
  764. package/dist/verdocs-web-sdk/p-fc2d6d85.system.entry.js.map +0 -1
  765. package/dist/verdocs-web-sdk/p-fe512c19.entry.js +0 -2
  766. package/dist/verdocs-web-sdk/p-fe512c19.entry.js.map +0 -1
  767. package/dist/verdocs-web-sdk/p-ff1e07ee.system.entry.js +0 -2
  768. package/dist/verdocs-web-sdk/p-ff1e07ee.system.entry.js.map +0 -1
@@ -0,0 +1,3569 @@
1
+ 'use strict';
2
+
3
+ /* tslint:disable:no-bitwise */
4
+ var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
5
+ // Regular expression to check formal correctness of base64 encoded strings
6
+ var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
7
+ /**
8
+ * Simplified, Node/Browser-safe alternative to atob() for base64 decoding.
9
+ * Modified from https://github.com/MaxArt2501/base64-js/blob/master/base64.js
10
+ */
11
+ var AtoB = function (str) {
12
+ // atob can work with strings with whitespaces, even inside the encoded part,
13
+ // but only \t, \n, \f, \r and ' ', which can be stripped.
14
+ str = String(str).replace(/[\t\n\f\r ]+/g, '');
15
+ if (!b64re.test(str))
16
+ throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
17
+ // Adding the padding if missing, for semplicity
18
+ str += '=='.slice(2 - (str.length & 3));
19
+ var bitmap;
20
+ var result = '';
21
+ var r1;
22
+ var r2;
23
+ var i = 0;
24
+ for (; i < str.length;) {
25
+ bitmap =
26
+ (b64.indexOf(str.charAt(i++)) << 18) |
27
+ (b64.indexOf(str.charAt(i++)) << 12) |
28
+ ((r1 = b64.indexOf(str.charAt(i++))) << 6) |
29
+ (r2 = b64.indexOf(str.charAt(i++)));
30
+ result +=
31
+ r1 === 64
32
+ ? String.fromCharCode((bitmap >> 16) & 255)
33
+ : r2 === 64
34
+ ? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255)
35
+ : String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255, bitmap & 255);
36
+ }
37
+ return result;
38
+ };
39
+ /**
40
+ * Decode the body of a JWT. This helper may allow front-end applications to avoid a dependency on `jsonwebtoken` in
41
+ * many cases. Note that this should only be used for true JWTs. Opaque tokens will cause this to throw.
42
+ */
43
+ var decodeJWTBody = function (token) { return JSON.parse(AtoB((token || '').split('.')[1] || '')); };
44
+ /**
45
+ * Decode the body of an Verdocs access token. Note that raw tokens contain namespaced fields, e.g.
46
+ * `https://verdocs.com/profile_id`. To make these tokens easier to use in front-end code, this name-spacing
47
+ * will be removed. Note that user and signing sessions have different access token formats. The calling
48
+ * application should distinguish between the two based on the context of the authenticated session, or by
49
+ * the presence of the `document_id` field, which will only be present for signing sessions.
50
+ */
51
+ var decodeAccessTokenBody = function (token) {
52
+ var decoded;
53
+ try {
54
+ decoded = decodeJWTBody(token);
55
+ if (decoded === null) {
56
+ return null;
57
+ }
58
+ }
59
+ catch (e) {
60
+ return null;
61
+ }
62
+ Object.keys(decoded).forEach(function (key) {
63
+ if (typeof key === 'string' && key.startsWith('https://verdocs.com/')) {
64
+ decoded[key.replace('https://verdocs.com/', '')] = decoded[key];
65
+ delete decoded[key];
66
+ }
67
+ });
68
+ return decoded;
69
+ };
70
+
71
+ function bind(fn, thisArg) {
72
+ return function wrap() {
73
+ return fn.apply(thisArg, arguments);
74
+ };
75
+ }
76
+
77
+ // utils is a library of generic helper functions non-specific to axios
78
+
79
+ const {toString} = Object.prototype;
80
+ const {getPrototypeOf} = Object;
81
+
82
+ const kindOf = (cache => thing => {
83
+ const str = toString.call(thing);
84
+ return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
85
+ })(Object.create(null));
86
+
87
+ const kindOfTest = (type) => {
88
+ type = type.toLowerCase();
89
+ return (thing) => kindOf(thing) === type
90
+ };
91
+
92
+ const typeOfTest = type => thing => typeof thing === type;
93
+
94
+ /**
95
+ * Determine if a value is an Array
96
+ *
97
+ * @param {Object} val The value to test
98
+ *
99
+ * @returns {boolean} True if value is an Array, otherwise false
100
+ */
101
+ const {isArray} = Array;
102
+
103
+ /**
104
+ * Determine if a value is undefined
105
+ *
106
+ * @param {*} val The value to test
107
+ *
108
+ * @returns {boolean} True if the value is undefined, otherwise false
109
+ */
110
+ const isUndefined = typeOfTest('undefined');
111
+
112
+ /**
113
+ * Determine if a value is a Buffer
114
+ *
115
+ * @param {*} val The value to test
116
+ *
117
+ * @returns {boolean} True if value is a Buffer, otherwise false
118
+ */
119
+ function isBuffer(val) {
120
+ return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
121
+ && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
122
+ }
123
+
124
+ /**
125
+ * Determine if a value is an ArrayBuffer
126
+ *
127
+ * @param {*} val The value to test
128
+ *
129
+ * @returns {boolean} True if value is an ArrayBuffer, otherwise false
130
+ */
131
+ const isArrayBuffer = kindOfTest('ArrayBuffer');
132
+
133
+
134
+ /**
135
+ * Determine if a value is a view on an ArrayBuffer
136
+ *
137
+ * @param {*} val The value to test
138
+ *
139
+ * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
140
+ */
141
+ function isArrayBufferView(val) {
142
+ let result;
143
+ if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
144
+ result = ArrayBuffer.isView(val);
145
+ } else {
146
+ result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));
147
+ }
148
+ return result;
149
+ }
150
+
151
+ /**
152
+ * Determine if a value is a String
153
+ *
154
+ * @param {*} val The value to test
155
+ *
156
+ * @returns {boolean} True if value is a String, otherwise false
157
+ */
158
+ const isString = typeOfTest('string');
159
+
160
+ /**
161
+ * Determine if a value is a Function
162
+ *
163
+ * @param {*} val The value to test
164
+ * @returns {boolean} True if value is a Function, otherwise false
165
+ */
166
+ const isFunction = typeOfTest('function');
167
+
168
+ /**
169
+ * Determine if a value is a Number
170
+ *
171
+ * @param {*} val The value to test
172
+ *
173
+ * @returns {boolean} True if value is a Number, otherwise false
174
+ */
175
+ const isNumber = typeOfTest('number');
176
+
177
+ /**
178
+ * Determine if a value is an Object
179
+ *
180
+ * @param {*} thing The value to test
181
+ *
182
+ * @returns {boolean} True if value is an Object, otherwise false
183
+ */
184
+ const isObject = (thing) => thing !== null && typeof thing === 'object';
185
+
186
+ /**
187
+ * Determine if a value is a Boolean
188
+ *
189
+ * @param {*} thing The value to test
190
+ * @returns {boolean} True if value is a Boolean, otherwise false
191
+ */
192
+ const isBoolean = thing => thing === true || thing === false;
193
+
194
+ /**
195
+ * Determine if a value is a plain Object
196
+ *
197
+ * @param {*} val The value to test
198
+ *
199
+ * @returns {boolean} True if value is a plain Object, otherwise false
200
+ */
201
+ const isPlainObject = (val) => {
202
+ if (kindOf(val) !== 'object') {
203
+ return false;
204
+ }
205
+
206
+ const prototype = getPrototypeOf(val);
207
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
208
+ };
209
+
210
+ /**
211
+ * Determine if a value is a Date
212
+ *
213
+ * @param {*} val The value to test
214
+ *
215
+ * @returns {boolean} True if value is a Date, otherwise false
216
+ */
217
+ const isDate = kindOfTest('Date');
218
+
219
+ /**
220
+ * Determine if a value is a File
221
+ *
222
+ * @param {*} val The value to test
223
+ *
224
+ * @returns {boolean} True if value is a File, otherwise false
225
+ */
226
+ const isFile = kindOfTest('File');
227
+
228
+ /**
229
+ * Determine if a value is a Blob
230
+ *
231
+ * @param {*} val The value to test
232
+ *
233
+ * @returns {boolean} True if value is a Blob, otherwise false
234
+ */
235
+ const isBlob = kindOfTest('Blob');
236
+
237
+ /**
238
+ * Determine if a value is a FileList
239
+ *
240
+ * @param {*} val The value to test
241
+ *
242
+ * @returns {boolean} True if value is a File, otherwise false
243
+ */
244
+ const isFileList = kindOfTest('FileList');
245
+
246
+ /**
247
+ * Determine if a value is a Stream
248
+ *
249
+ * @param {*} val The value to test
250
+ *
251
+ * @returns {boolean} True if value is a Stream, otherwise false
252
+ */
253
+ const isStream = (val) => isObject(val) && isFunction(val.pipe);
254
+
255
+ /**
256
+ * Determine if a value is a FormData
257
+ *
258
+ * @param {*} thing The value to test
259
+ *
260
+ * @returns {boolean} True if value is an FormData, otherwise false
261
+ */
262
+ const isFormData = (thing) => {
263
+ const pattern = '[object FormData]';
264
+ return thing && (
265
+ (typeof FormData === 'function' && thing instanceof FormData) ||
266
+ toString.call(thing) === pattern ||
267
+ (isFunction(thing.toString) && thing.toString() === pattern)
268
+ );
269
+ };
270
+
271
+ /**
272
+ * Determine if a value is a URLSearchParams object
273
+ *
274
+ * @param {*} val The value to test
275
+ *
276
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
277
+ */
278
+ const isURLSearchParams = kindOfTest('URLSearchParams');
279
+
280
+ /**
281
+ * Trim excess whitespace off the beginning and end of a string
282
+ *
283
+ * @param {String} str The String to trim
284
+ *
285
+ * @returns {String} The String freed of excess whitespace
286
+ */
287
+ const trim = (str) => str.trim ?
288
+ str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
289
+
290
+ /**
291
+ * Iterate over an Array or an Object invoking a function for each item.
292
+ *
293
+ * If `obj` is an Array callback will be called passing
294
+ * the value, index, and complete array for each item.
295
+ *
296
+ * If 'obj' is an Object callback will be called passing
297
+ * the value, key, and complete object for each property.
298
+ *
299
+ * @param {Object|Array} obj The object to iterate
300
+ * @param {Function} fn The callback to invoke for each item
301
+ *
302
+ * @param {Boolean} [allOwnKeys = false]
303
+ * @returns {any}
304
+ */
305
+ function forEach(obj, fn, {allOwnKeys = false} = {}) {
306
+ // Don't bother if no value provided
307
+ if (obj === null || typeof obj === 'undefined') {
308
+ return;
309
+ }
310
+
311
+ let i;
312
+ let l;
313
+
314
+ // Force an array if not already something iterable
315
+ if (typeof obj !== 'object') {
316
+ /*eslint no-param-reassign:0*/
317
+ obj = [obj];
318
+ }
319
+
320
+ if (isArray(obj)) {
321
+ // Iterate over array values
322
+ for (i = 0, l = obj.length; i < l; i++) {
323
+ fn.call(null, obj[i], i, obj);
324
+ }
325
+ } else {
326
+ // Iterate over object keys
327
+ const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
328
+ const len = keys.length;
329
+ let key;
330
+
331
+ for (i = 0; i < len; i++) {
332
+ key = keys[i];
333
+ fn.call(null, obj[key], key, obj);
334
+ }
335
+ }
336
+ }
337
+
338
+ function findKey(obj, key) {
339
+ key = key.toLowerCase();
340
+ const keys = Object.keys(obj);
341
+ let i = keys.length;
342
+ let _key;
343
+ while (i-- > 0) {
344
+ _key = keys[i];
345
+ if (key === _key.toLowerCase()) {
346
+ return _key;
347
+ }
348
+ }
349
+ return null;
350
+ }
351
+
352
+ const _global = (() => {
353
+ /*eslint no-undef:0*/
354
+ if (typeof globalThis !== "undefined") return globalThis;
355
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
356
+ })();
357
+
358
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
359
+
360
+ /**
361
+ * Accepts varargs expecting each argument to be an object, then
362
+ * immutably merges the properties of each object and returns result.
363
+ *
364
+ * When multiple objects contain the same key the later object in
365
+ * the arguments list will take precedence.
366
+ *
367
+ * Example:
368
+ *
369
+ * ```js
370
+ * var result = merge({foo: 123}, {foo: 456});
371
+ * console.log(result.foo); // outputs 456
372
+ * ```
373
+ *
374
+ * @param {Object} obj1 Object to merge
375
+ *
376
+ * @returns {Object} Result of all merge properties
377
+ */
378
+ function merge(/* obj1, obj2, obj3, ... */) {
379
+ const {caseless} = isContextDefined(this) && this || {};
380
+ const result = {};
381
+ const assignValue = (val, key) => {
382
+ const targetKey = caseless && findKey(result, key) || key;
383
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
384
+ result[targetKey] = merge(result[targetKey], val);
385
+ } else if (isPlainObject(val)) {
386
+ result[targetKey] = merge({}, val);
387
+ } else if (isArray(val)) {
388
+ result[targetKey] = val.slice();
389
+ } else {
390
+ result[targetKey] = val;
391
+ }
392
+ };
393
+
394
+ for (let i = 0, l = arguments.length; i < l; i++) {
395
+ arguments[i] && forEach(arguments[i], assignValue);
396
+ }
397
+ return result;
398
+ }
399
+
400
+ /**
401
+ * Extends object a by mutably adding to it the properties of object b.
402
+ *
403
+ * @param {Object} a The object to be extended
404
+ * @param {Object} b The object to copy properties from
405
+ * @param {Object} thisArg The object to bind function to
406
+ *
407
+ * @param {Boolean} [allOwnKeys]
408
+ * @returns {Object} The resulting value of object a
409
+ */
410
+ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
411
+ forEach(b, (val, key) => {
412
+ if (thisArg && isFunction(val)) {
413
+ a[key] = bind(val, thisArg);
414
+ } else {
415
+ a[key] = val;
416
+ }
417
+ }, {allOwnKeys});
418
+ return a;
419
+ };
420
+
421
+ /**
422
+ * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
423
+ *
424
+ * @param {string} content with BOM
425
+ *
426
+ * @returns {string} content value without BOM
427
+ */
428
+ const stripBOM = (content) => {
429
+ if (content.charCodeAt(0) === 0xFEFF) {
430
+ content = content.slice(1);
431
+ }
432
+ return content;
433
+ };
434
+
435
+ /**
436
+ * Inherit the prototype methods from one constructor into another
437
+ * @param {function} constructor
438
+ * @param {function} superConstructor
439
+ * @param {object} [props]
440
+ * @param {object} [descriptors]
441
+ *
442
+ * @returns {void}
443
+ */
444
+ const inherits = (constructor, superConstructor, props, descriptors) => {
445
+ constructor.prototype = Object.create(superConstructor.prototype, descriptors);
446
+ constructor.prototype.constructor = constructor;
447
+ Object.defineProperty(constructor, 'super', {
448
+ value: superConstructor.prototype
449
+ });
450
+ props && Object.assign(constructor.prototype, props);
451
+ };
452
+
453
+ /**
454
+ * Resolve object with deep prototype chain to a flat object
455
+ * @param {Object} sourceObj source object
456
+ * @param {Object} [destObj]
457
+ * @param {Function|Boolean} [filter]
458
+ * @param {Function} [propFilter]
459
+ *
460
+ * @returns {Object}
461
+ */
462
+ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
463
+ let props;
464
+ let i;
465
+ let prop;
466
+ const merged = {};
467
+
468
+ destObj = destObj || {};
469
+ // eslint-disable-next-line no-eq-null,eqeqeq
470
+ if (sourceObj == null) return destObj;
471
+
472
+ do {
473
+ props = Object.getOwnPropertyNames(sourceObj);
474
+ i = props.length;
475
+ while (i-- > 0) {
476
+ prop = props[i];
477
+ if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
478
+ destObj[prop] = sourceObj[prop];
479
+ merged[prop] = true;
480
+ }
481
+ }
482
+ sourceObj = filter !== false && getPrototypeOf(sourceObj);
483
+ } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
484
+
485
+ return destObj;
486
+ };
487
+
488
+ /**
489
+ * Determines whether a string ends with the characters of a specified string
490
+ *
491
+ * @param {String} str
492
+ * @param {String} searchString
493
+ * @param {Number} [position= 0]
494
+ *
495
+ * @returns {boolean}
496
+ */
497
+ const endsWith = (str, searchString, position) => {
498
+ str = String(str);
499
+ if (position === undefined || position > str.length) {
500
+ position = str.length;
501
+ }
502
+ position -= searchString.length;
503
+ const lastIndex = str.indexOf(searchString, position);
504
+ return lastIndex !== -1 && lastIndex === position;
505
+ };
506
+
507
+
508
+ /**
509
+ * Returns new array from array like object or null if failed
510
+ *
511
+ * @param {*} [thing]
512
+ *
513
+ * @returns {?Array}
514
+ */
515
+ const toArray = (thing) => {
516
+ if (!thing) return null;
517
+ if (isArray(thing)) return thing;
518
+ let i = thing.length;
519
+ if (!isNumber(i)) return null;
520
+ const arr = new Array(i);
521
+ while (i-- > 0) {
522
+ arr[i] = thing[i];
523
+ }
524
+ return arr;
525
+ };
526
+
527
+ /**
528
+ * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
529
+ * thing passed in is an instance of Uint8Array
530
+ *
531
+ * @param {TypedArray}
532
+ *
533
+ * @returns {Array}
534
+ */
535
+ // eslint-disable-next-line func-names
536
+ const isTypedArray = (TypedArray => {
537
+ // eslint-disable-next-line func-names
538
+ return thing => {
539
+ return TypedArray && thing instanceof TypedArray;
540
+ };
541
+ })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
542
+
543
+ /**
544
+ * For each entry in the object, call the function with the key and value.
545
+ *
546
+ * @param {Object<any, any>} obj - The object to iterate over.
547
+ * @param {Function} fn - The function to call for each entry.
548
+ *
549
+ * @returns {void}
550
+ */
551
+ const forEachEntry = (obj, fn) => {
552
+ const generator = obj && obj[Symbol.iterator];
553
+
554
+ const iterator = generator.call(obj);
555
+
556
+ let result;
557
+
558
+ while ((result = iterator.next()) && !result.done) {
559
+ const pair = result.value;
560
+ fn.call(obj, pair[0], pair[1]);
561
+ }
562
+ };
563
+
564
+ /**
565
+ * It takes a regular expression and a string, and returns an array of all the matches
566
+ *
567
+ * @param {string} regExp - The regular expression to match against.
568
+ * @param {string} str - The string to search.
569
+ *
570
+ * @returns {Array<boolean>}
571
+ */
572
+ const matchAll = (regExp, str) => {
573
+ let matches;
574
+ const arr = [];
575
+
576
+ while ((matches = regExp.exec(str)) !== null) {
577
+ arr.push(matches);
578
+ }
579
+
580
+ return arr;
581
+ };
582
+
583
+ /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
584
+ const isHTMLForm = kindOfTest('HTMLFormElement');
585
+
586
+ const toCamelCase = str => {
587
+ return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
588
+ function replacer(m, p1, p2) {
589
+ return p1.toUpperCase() + p2;
590
+ }
591
+ );
592
+ };
593
+
594
+ /* Creating a function that will check if an object has a property. */
595
+ const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
596
+
597
+ /**
598
+ * Determine if a value is a RegExp object
599
+ *
600
+ * @param {*} val The value to test
601
+ *
602
+ * @returns {boolean} True if value is a RegExp object, otherwise false
603
+ */
604
+ const isRegExp = kindOfTest('RegExp');
605
+
606
+ const reduceDescriptors = (obj, reducer) => {
607
+ const descriptors = Object.getOwnPropertyDescriptors(obj);
608
+ const reducedDescriptors = {};
609
+
610
+ forEach(descriptors, (descriptor, name) => {
611
+ if (reducer(descriptor, name, obj) !== false) {
612
+ reducedDescriptors[name] = descriptor;
613
+ }
614
+ });
615
+
616
+ Object.defineProperties(obj, reducedDescriptors);
617
+ };
618
+
619
+ /**
620
+ * Makes all methods read-only
621
+ * @param {Object} obj
622
+ */
623
+
624
+ const freezeMethods = (obj) => {
625
+ reduceDescriptors(obj, (descriptor, name) => {
626
+ // skip restricted props in strict mode
627
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
628
+ return false;
629
+ }
630
+
631
+ const value = obj[name];
632
+
633
+ if (!isFunction(value)) return;
634
+
635
+ descriptor.enumerable = false;
636
+
637
+ if ('writable' in descriptor) {
638
+ descriptor.writable = false;
639
+ return;
640
+ }
641
+
642
+ if (!descriptor.set) {
643
+ descriptor.set = () => {
644
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
645
+ };
646
+ }
647
+ });
648
+ };
649
+
650
+ const toObjectSet = (arrayOrString, delimiter) => {
651
+ const obj = {};
652
+
653
+ const define = (arr) => {
654
+ arr.forEach(value => {
655
+ obj[value] = true;
656
+ });
657
+ };
658
+
659
+ isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
660
+
661
+ return obj;
662
+ };
663
+
664
+ const noop = () => {};
665
+
666
+ const toFiniteNumber = (value, defaultValue) => {
667
+ value = +value;
668
+ return Number.isFinite(value) ? value : defaultValue;
669
+ };
670
+
671
+ const toJSONObject = (obj) => {
672
+ const stack = new Array(10);
673
+
674
+ const visit = (source, i) => {
675
+
676
+ if (isObject(source)) {
677
+ if (stack.indexOf(source) >= 0) {
678
+ return;
679
+ }
680
+
681
+ if(!('toJSON' in source)) {
682
+ stack[i] = source;
683
+ const target = isArray(source) ? [] : {};
684
+
685
+ forEach(source, (value, key) => {
686
+ const reducedValue = visit(value, i + 1);
687
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
688
+ });
689
+
690
+ stack[i] = undefined;
691
+
692
+ return target;
693
+ }
694
+ }
695
+
696
+ return source;
697
+ };
698
+
699
+ return visit(obj, 0);
700
+ };
701
+
702
+ const utils = {
703
+ isArray,
704
+ isArrayBuffer,
705
+ isBuffer,
706
+ isFormData,
707
+ isArrayBufferView,
708
+ isString,
709
+ isNumber,
710
+ isBoolean,
711
+ isObject,
712
+ isPlainObject,
713
+ isUndefined,
714
+ isDate,
715
+ isFile,
716
+ isBlob,
717
+ isRegExp,
718
+ isFunction,
719
+ isStream,
720
+ isURLSearchParams,
721
+ isTypedArray,
722
+ isFileList,
723
+ forEach,
724
+ merge,
725
+ extend,
726
+ trim,
727
+ stripBOM,
728
+ inherits,
729
+ toFlatObject,
730
+ kindOf,
731
+ kindOfTest,
732
+ endsWith,
733
+ toArray,
734
+ forEachEntry,
735
+ matchAll,
736
+ isHTMLForm,
737
+ hasOwnProperty,
738
+ hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection
739
+ reduceDescriptors,
740
+ freezeMethods,
741
+ toObjectSet,
742
+ toCamelCase,
743
+ noop,
744
+ toFiniteNumber,
745
+ findKey,
746
+ global: _global,
747
+ isContextDefined,
748
+ toJSONObject
749
+ };
750
+
751
+ /**
752
+ * Create an Error with the specified message, config, error code, request and response.
753
+ *
754
+ * @param {string} message The error message.
755
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
756
+ * @param {Object} [config] The config.
757
+ * @param {Object} [request] The request.
758
+ * @param {Object} [response] The response.
759
+ *
760
+ * @returns {Error} The created error.
761
+ */
762
+ function AxiosError(message, code, config, request, response) {
763
+ Error.call(this);
764
+
765
+ if (Error.captureStackTrace) {
766
+ Error.captureStackTrace(this, this.constructor);
767
+ } else {
768
+ this.stack = (new Error()).stack;
769
+ }
770
+
771
+ this.message = message;
772
+ this.name = 'AxiosError';
773
+ code && (this.code = code);
774
+ config && (this.config = config);
775
+ request && (this.request = request);
776
+ response && (this.response = response);
777
+ }
778
+
779
+ utils.inherits(AxiosError, Error, {
780
+ toJSON: function toJSON() {
781
+ return {
782
+ // Standard
783
+ message: this.message,
784
+ name: this.name,
785
+ // Microsoft
786
+ description: this.description,
787
+ number: this.number,
788
+ // Mozilla
789
+ fileName: this.fileName,
790
+ lineNumber: this.lineNumber,
791
+ columnNumber: this.columnNumber,
792
+ stack: this.stack,
793
+ // Axios
794
+ config: utils.toJSONObject(this.config),
795
+ code: this.code,
796
+ status: this.response && this.response.status ? this.response.status : null
797
+ };
798
+ }
799
+ });
800
+
801
+ const prototype$1 = AxiosError.prototype;
802
+ const descriptors = {};
803
+
804
+ [
805
+ 'ERR_BAD_OPTION_VALUE',
806
+ 'ERR_BAD_OPTION',
807
+ 'ECONNABORTED',
808
+ 'ETIMEDOUT',
809
+ 'ERR_NETWORK',
810
+ 'ERR_FR_TOO_MANY_REDIRECTS',
811
+ 'ERR_DEPRECATED',
812
+ 'ERR_BAD_RESPONSE',
813
+ 'ERR_BAD_REQUEST',
814
+ 'ERR_CANCELED',
815
+ 'ERR_NOT_SUPPORT',
816
+ 'ERR_INVALID_URL'
817
+ // eslint-disable-next-line func-names
818
+ ].forEach(code => {
819
+ descriptors[code] = {value: code};
820
+ });
821
+
822
+ Object.defineProperties(AxiosError, descriptors);
823
+ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
824
+
825
+ // eslint-disable-next-line func-names
826
+ AxiosError.from = (error, code, config, request, response, customProps) => {
827
+ const axiosError = Object.create(prototype$1);
828
+
829
+ utils.toFlatObject(error, axiosError, function filter(obj) {
830
+ return obj !== Error.prototype;
831
+ }, prop => {
832
+ return prop !== 'isAxiosError';
833
+ });
834
+
835
+ AxiosError.call(axiosError, error.message, code, config, request, response);
836
+
837
+ axiosError.cause = error;
838
+
839
+ axiosError.name = error.name;
840
+
841
+ customProps && Object.assign(axiosError, customProps);
842
+
843
+ return axiosError;
844
+ };
845
+
846
+ /* eslint-env browser */
847
+ var browser = typeof self == 'object' ? self.FormData : window.FormData;
848
+
849
+ /**
850
+ * Determines if the given thing is a array or js object.
851
+ *
852
+ * @param {string} thing - The object or array to be visited.
853
+ *
854
+ * @returns {boolean}
855
+ */
856
+ function isVisitable(thing) {
857
+ return utils.isPlainObject(thing) || utils.isArray(thing);
858
+ }
859
+
860
+ /**
861
+ * It removes the brackets from the end of a string
862
+ *
863
+ * @param {string} key - The key of the parameter.
864
+ *
865
+ * @returns {string} the key without the brackets.
866
+ */
867
+ function removeBrackets(key) {
868
+ return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
869
+ }
870
+
871
+ /**
872
+ * It takes a path, a key, and a boolean, and returns a string
873
+ *
874
+ * @param {string} path - The path to the current key.
875
+ * @param {string} key - The key of the current object being iterated over.
876
+ * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
877
+ *
878
+ * @returns {string} The path to the current key.
879
+ */
880
+ function renderKey(path, key, dots) {
881
+ if (!path) return key;
882
+ return path.concat(key).map(function each(token, i) {
883
+ // eslint-disable-next-line no-param-reassign
884
+ token = removeBrackets(token);
885
+ return !dots && i ? '[' + token + ']' : token;
886
+ }).join(dots ? '.' : '');
887
+ }
888
+
889
+ /**
890
+ * If the array is an array and none of its elements are visitable, then it's a flat array.
891
+ *
892
+ * @param {Array<any>} arr - The array to check
893
+ *
894
+ * @returns {boolean}
895
+ */
896
+ function isFlatArray(arr) {
897
+ return utils.isArray(arr) && !arr.some(isVisitable);
898
+ }
899
+
900
+ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
901
+ return /^is[A-Z]/.test(prop);
902
+ });
903
+
904
+ /**
905
+ * If the thing is a FormData object, return true, otherwise return false.
906
+ *
907
+ * @param {unknown} thing - The thing to check.
908
+ *
909
+ * @returns {boolean}
910
+ */
911
+ function isSpecCompliant(thing) {
912
+ return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
913
+ }
914
+
915
+ /**
916
+ * Convert a data object to FormData
917
+ *
918
+ * @param {Object} obj
919
+ * @param {?Object} [formData]
920
+ * @param {?Object} [options]
921
+ * @param {Function} [options.visitor]
922
+ * @param {Boolean} [options.metaTokens = true]
923
+ * @param {Boolean} [options.dots = false]
924
+ * @param {?Boolean} [options.indexes = false]
925
+ *
926
+ * @returns {Object}
927
+ **/
928
+
929
+ /**
930
+ * It converts an object into a FormData object
931
+ *
932
+ * @param {Object<any, any>} obj - The object to convert to form data.
933
+ * @param {string} formData - The FormData object to append to.
934
+ * @param {Object<string, any>} options
935
+ *
936
+ * @returns
937
+ */
938
+ function toFormData(obj, formData, options) {
939
+ if (!utils.isObject(obj)) {
940
+ throw new TypeError('target must be an object');
941
+ }
942
+
943
+ // eslint-disable-next-line no-param-reassign
944
+ formData = formData || new (browser || FormData)();
945
+
946
+ // eslint-disable-next-line no-param-reassign
947
+ options = utils.toFlatObject(options, {
948
+ metaTokens: true,
949
+ dots: false,
950
+ indexes: false
951
+ }, false, function defined(option, source) {
952
+ // eslint-disable-next-line no-eq-null,eqeqeq
953
+ return !utils.isUndefined(source[option]);
954
+ });
955
+
956
+ const metaTokens = options.metaTokens;
957
+ // eslint-disable-next-line no-use-before-define
958
+ const visitor = options.visitor || defaultVisitor;
959
+ const dots = options.dots;
960
+ const indexes = options.indexes;
961
+ const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
962
+ const useBlob = _Blob && isSpecCompliant(formData);
963
+
964
+ if (!utils.isFunction(visitor)) {
965
+ throw new TypeError('visitor must be a function');
966
+ }
967
+
968
+ function convertValue(value) {
969
+ if (value === null) return '';
970
+
971
+ if (utils.isDate(value)) {
972
+ return value.toISOString();
973
+ }
974
+
975
+ if (!useBlob && utils.isBlob(value)) {
976
+ throw new AxiosError('Blob is not supported. Use a Buffer instead.');
977
+ }
978
+
979
+ if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
980
+ return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
981
+ }
982
+
983
+ return value;
984
+ }
985
+
986
+ /**
987
+ * Default visitor.
988
+ *
989
+ * @param {*} value
990
+ * @param {String|Number} key
991
+ * @param {Array<String|Number>} path
992
+ * @this {FormData}
993
+ *
994
+ * @returns {boolean} return true to visit the each prop of the value recursively
995
+ */
996
+ function defaultVisitor(value, key, path) {
997
+ let arr = value;
998
+
999
+ if (value && !path && typeof value === 'object') {
1000
+ if (utils.endsWith(key, '{}')) {
1001
+ // eslint-disable-next-line no-param-reassign
1002
+ key = metaTokens ? key : key.slice(0, -2);
1003
+ // eslint-disable-next-line no-param-reassign
1004
+ value = JSON.stringify(value);
1005
+ } else if (
1006
+ (utils.isArray(value) && isFlatArray(value)) ||
1007
+ (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
1008
+ )) {
1009
+ // eslint-disable-next-line no-param-reassign
1010
+ key = removeBrackets(key);
1011
+
1012
+ arr.forEach(function each(el, index) {
1013
+ !(utils.isUndefined(el) || el === null) && formData.append(
1014
+ // eslint-disable-next-line no-nested-ternary
1015
+ indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
1016
+ convertValue(el)
1017
+ );
1018
+ });
1019
+ return false;
1020
+ }
1021
+ }
1022
+
1023
+ if (isVisitable(value)) {
1024
+ return true;
1025
+ }
1026
+
1027
+ formData.append(renderKey(path, key, dots), convertValue(value));
1028
+
1029
+ return false;
1030
+ }
1031
+
1032
+ const stack = [];
1033
+
1034
+ const exposedHelpers = Object.assign(predicates, {
1035
+ defaultVisitor,
1036
+ convertValue,
1037
+ isVisitable
1038
+ });
1039
+
1040
+ function build(value, path) {
1041
+ if (utils.isUndefined(value)) return;
1042
+
1043
+ if (stack.indexOf(value) !== -1) {
1044
+ throw Error('Circular reference detected in ' + path.join('.'));
1045
+ }
1046
+
1047
+ stack.push(value);
1048
+
1049
+ utils.forEach(value, function each(el, key) {
1050
+ const result = !(utils.isUndefined(el) || el === null) && visitor.call(
1051
+ formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
1052
+ );
1053
+
1054
+ if (result === true) {
1055
+ build(el, path ? path.concat(key) : [key]);
1056
+ }
1057
+ });
1058
+
1059
+ stack.pop();
1060
+ }
1061
+
1062
+ if (!utils.isObject(obj)) {
1063
+ throw new TypeError('data must be an object');
1064
+ }
1065
+
1066
+ build(obj);
1067
+
1068
+ return formData;
1069
+ }
1070
+
1071
+ /**
1072
+ * It encodes a string by replacing all characters that are not in the unreserved set with
1073
+ * their percent-encoded equivalents
1074
+ *
1075
+ * @param {string} str - The string to encode.
1076
+ *
1077
+ * @returns {string} The encoded string.
1078
+ */
1079
+ function encode$1(str) {
1080
+ const charMap = {
1081
+ '!': '%21',
1082
+ "'": '%27',
1083
+ '(': '%28',
1084
+ ')': '%29',
1085
+ '~': '%7E',
1086
+ '%20': '+',
1087
+ '%00': '\x00'
1088
+ };
1089
+ return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1090
+ return charMap[match];
1091
+ });
1092
+ }
1093
+
1094
+ /**
1095
+ * It takes a params object and converts it to a FormData object
1096
+ *
1097
+ * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1098
+ * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1099
+ *
1100
+ * @returns {void}
1101
+ */
1102
+ function AxiosURLSearchParams(params, options) {
1103
+ this._pairs = [];
1104
+
1105
+ params && toFormData(params, this, options);
1106
+ }
1107
+
1108
+ const prototype = AxiosURLSearchParams.prototype;
1109
+
1110
+ prototype.append = function append(name, value) {
1111
+ this._pairs.push([name, value]);
1112
+ };
1113
+
1114
+ prototype.toString = function toString(encoder) {
1115
+ const _encode = encoder ? function(value) {
1116
+ return encoder.call(this, value, encode$1);
1117
+ } : encode$1;
1118
+
1119
+ return this._pairs.map(function each(pair) {
1120
+ return _encode(pair[0]) + '=' + _encode(pair[1]);
1121
+ }, '').join('&');
1122
+ };
1123
+
1124
+ /**
1125
+ * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
1126
+ * URI encoded counterparts
1127
+ *
1128
+ * @param {string} val The value to be encoded.
1129
+ *
1130
+ * @returns {string} The encoded value.
1131
+ */
1132
+ function encode(val) {
1133
+ return encodeURIComponent(val).
1134
+ replace(/%3A/gi, ':').
1135
+ replace(/%24/g, '$').
1136
+ replace(/%2C/gi, ',').
1137
+ replace(/%20/g, '+').
1138
+ replace(/%5B/gi, '[').
1139
+ replace(/%5D/gi, ']');
1140
+ }
1141
+
1142
+ /**
1143
+ * Build a URL by appending params to the end
1144
+ *
1145
+ * @param {string} url The base of the url (e.g., http://www.google.com)
1146
+ * @param {object} [params] The params to be appended
1147
+ * @param {?object} options
1148
+ *
1149
+ * @returns {string} The formatted url
1150
+ */
1151
+ function buildURL(url, params, options) {
1152
+ /*eslint no-param-reassign:0*/
1153
+ if (!params) {
1154
+ return url;
1155
+ }
1156
+
1157
+ const _encode = options && options.encode || encode;
1158
+
1159
+ const serializeFn = options && options.serialize;
1160
+
1161
+ let serializedParams;
1162
+
1163
+ if (serializeFn) {
1164
+ serializedParams = serializeFn(params, options);
1165
+ } else {
1166
+ serializedParams = utils.isURLSearchParams(params) ?
1167
+ params.toString() :
1168
+ new AxiosURLSearchParams(params, options).toString(_encode);
1169
+ }
1170
+
1171
+ if (serializedParams) {
1172
+ const hashmarkIndex = url.indexOf("#");
1173
+
1174
+ if (hashmarkIndex !== -1) {
1175
+ url = url.slice(0, hashmarkIndex);
1176
+ }
1177
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1178
+ }
1179
+
1180
+ return url;
1181
+ }
1182
+
1183
+ class InterceptorManager {
1184
+ constructor() {
1185
+ this.handlers = [];
1186
+ }
1187
+
1188
+ /**
1189
+ * Add a new interceptor to the stack
1190
+ *
1191
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
1192
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
1193
+ *
1194
+ * @return {Number} An ID used to remove interceptor later
1195
+ */
1196
+ use(fulfilled, rejected, options) {
1197
+ this.handlers.push({
1198
+ fulfilled,
1199
+ rejected,
1200
+ synchronous: options ? options.synchronous : false,
1201
+ runWhen: options ? options.runWhen : null
1202
+ });
1203
+ return this.handlers.length - 1;
1204
+ }
1205
+
1206
+ /**
1207
+ * Remove an interceptor from the stack
1208
+ *
1209
+ * @param {Number} id The ID that was returned by `use`
1210
+ *
1211
+ * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
1212
+ */
1213
+ eject(id) {
1214
+ if (this.handlers[id]) {
1215
+ this.handlers[id] = null;
1216
+ }
1217
+ }
1218
+
1219
+ /**
1220
+ * Clear all interceptors from the stack
1221
+ *
1222
+ * @returns {void}
1223
+ */
1224
+ clear() {
1225
+ if (this.handlers) {
1226
+ this.handlers = [];
1227
+ }
1228
+ }
1229
+
1230
+ /**
1231
+ * Iterate over all the registered interceptors
1232
+ *
1233
+ * This method is particularly useful for skipping over any
1234
+ * interceptors that may have become `null` calling `eject`.
1235
+ *
1236
+ * @param {Function} fn The function to call for each interceptor
1237
+ *
1238
+ * @returns {void}
1239
+ */
1240
+ forEach(fn) {
1241
+ utils.forEach(this.handlers, function forEachHandler(h) {
1242
+ if (h !== null) {
1243
+ fn(h);
1244
+ }
1245
+ });
1246
+ }
1247
+ }
1248
+
1249
+ const transitionalDefaults = {
1250
+ silentJSONParsing: true,
1251
+ forcedJSONParsing: true,
1252
+ clarifyTimeoutError: false
1253
+ };
1254
+
1255
+ const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
1256
+
1257
+ const FormData$1 = FormData;
1258
+
1259
+ /**
1260
+ * Determine if we're running in a standard browser environment
1261
+ *
1262
+ * This allows axios to run in a web worker, and react-native.
1263
+ * Both environments support XMLHttpRequest, but not fully standard globals.
1264
+ *
1265
+ * web workers:
1266
+ * typeof window -> undefined
1267
+ * typeof document -> undefined
1268
+ *
1269
+ * react-native:
1270
+ * navigator.product -> 'ReactNative'
1271
+ * nativescript
1272
+ * navigator.product -> 'NativeScript' or 'NS'
1273
+ *
1274
+ * @returns {boolean}
1275
+ */
1276
+ const isStandardBrowserEnv = (() => {
1277
+ let product;
1278
+ if (typeof navigator !== 'undefined' && (
1279
+ (product = navigator.product) === 'ReactNative' ||
1280
+ product === 'NativeScript' ||
1281
+ product === 'NS')
1282
+ ) {
1283
+ return false;
1284
+ }
1285
+
1286
+ return typeof window !== 'undefined' && typeof document !== 'undefined';
1287
+ })();
1288
+
1289
+ /**
1290
+ * Determine if we're running in a standard browser webWorker environment
1291
+ *
1292
+ * Although the `isStandardBrowserEnv` method indicates that
1293
+ * `allows axios to run in a web worker`, the WebWorker will still be
1294
+ * filtered out due to its judgment standard
1295
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1296
+ * This leads to a problem when axios post `FormData` in webWorker
1297
+ */
1298
+ const isStandardBrowserWebWorkerEnv = (() => {
1299
+ return (
1300
+ typeof WorkerGlobalScope !== 'undefined' &&
1301
+ // eslint-disable-next-line no-undef
1302
+ self instanceof WorkerGlobalScope &&
1303
+ typeof self.importScripts === 'function'
1304
+ );
1305
+ })();
1306
+
1307
+
1308
+ const platform = {
1309
+ isBrowser: true,
1310
+ classes: {
1311
+ URLSearchParams: URLSearchParams$1,
1312
+ FormData: FormData$1,
1313
+ Blob
1314
+ },
1315
+ isStandardBrowserEnv,
1316
+ isStandardBrowserWebWorkerEnv,
1317
+ protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
1318
+ };
1319
+
1320
+ function toURLEncodedForm(data, options) {
1321
+ return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
1322
+ visitor: function(value, key, path, helpers) {
1323
+
1324
+ return helpers.defaultVisitor.apply(this, arguments);
1325
+ }
1326
+ }, options));
1327
+ }
1328
+
1329
+ /**
1330
+ * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1331
+ *
1332
+ * @param {string} name - The name of the property to get.
1333
+ *
1334
+ * @returns An array of strings.
1335
+ */
1336
+ function parsePropPath(name) {
1337
+ // foo[x][y][z]
1338
+ // foo.x.y.z
1339
+ // foo-x-y-z
1340
+ // foo x y z
1341
+ return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1342
+ return match[0] === '[]' ? '' : match[1] || match[0];
1343
+ });
1344
+ }
1345
+
1346
+ /**
1347
+ * Convert an array to an object.
1348
+ *
1349
+ * @param {Array<any>} arr - The array to convert to an object.
1350
+ *
1351
+ * @returns An object with the same keys and values as the array.
1352
+ */
1353
+ function arrayToObject(arr) {
1354
+ const obj = {};
1355
+ const keys = Object.keys(arr);
1356
+ let i;
1357
+ const len = keys.length;
1358
+ let key;
1359
+ for (i = 0; i < len; i++) {
1360
+ key = keys[i];
1361
+ obj[key] = arr[key];
1362
+ }
1363
+ return obj;
1364
+ }
1365
+
1366
+ /**
1367
+ * It takes a FormData object and returns a JavaScript object
1368
+ *
1369
+ * @param {string} formData The FormData object to convert to JSON.
1370
+ *
1371
+ * @returns {Object<string, any> | null} The converted object.
1372
+ */
1373
+ function formDataToJSON(formData) {
1374
+ function buildPath(path, value, target, index) {
1375
+ let name = path[index++];
1376
+ const isNumericKey = Number.isFinite(+name);
1377
+ const isLast = index >= path.length;
1378
+ name = !name && utils.isArray(target) ? target.length : name;
1379
+
1380
+ if (isLast) {
1381
+ if (utils.hasOwnProp(target, name)) {
1382
+ target[name] = [target[name], value];
1383
+ } else {
1384
+ target[name] = value;
1385
+ }
1386
+
1387
+ return !isNumericKey;
1388
+ }
1389
+
1390
+ if (!target[name] || !utils.isObject(target[name])) {
1391
+ target[name] = [];
1392
+ }
1393
+
1394
+ const result = buildPath(path, value, target[name], index);
1395
+
1396
+ if (result && utils.isArray(target[name])) {
1397
+ target[name] = arrayToObject(target[name]);
1398
+ }
1399
+
1400
+ return !isNumericKey;
1401
+ }
1402
+
1403
+ if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
1404
+ const obj = {};
1405
+
1406
+ utils.forEachEntry(formData, (name, value) => {
1407
+ buildPath(parsePropPath(name), value, obj, 0);
1408
+ });
1409
+
1410
+ return obj;
1411
+ }
1412
+
1413
+ return null;
1414
+ }
1415
+
1416
+ const DEFAULT_CONTENT_TYPE = {
1417
+ 'Content-Type': undefined
1418
+ };
1419
+
1420
+ /**
1421
+ * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1422
+ * of the input
1423
+ *
1424
+ * @param {any} rawValue - The value to be stringified.
1425
+ * @param {Function} parser - A function that parses a string into a JavaScript object.
1426
+ * @param {Function} encoder - A function that takes a value and returns a string.
1427
+ *
1428
+ * @returns {string} A stringified version of the rawValue.
1429
+ */
1430
+ function stringifySafely(rawValue, parser, encoder) {
1431
+ if (utils.isString(rawValue)) {
1432
+ try {
1433
+ (parser || JSON.parse)(rawValue);
1434
+ return utils.trim(rawValue);
1435
+ } catch (e) {
1436
+ if (e.name !== 'SyntaxError') {
1437
+ throw e;
1438
+ }
1439
+ }
1440
+ }
1441
+
1442
+ return (encoder || JSON.stringify)(rawValue);
1443
+ }
1444
+
1445
+ const defaults = {
1446
+
1447
+ transitional: transitionalDefaults,
1448
+
1449
+ adapter: ['xhr', 'http'],
1450
+
1451
+ transformRequest: [function transformRequest(data, headers) {
1452
+ const contentType = headers.getContentType() || '';
1453
+ const hasJSONContentType = contentType.indexOf('application/json') > -1;
1454
+ const isObjectPayload = utils.isObject(data);
1455
+
1456
+ if (isObjectPayload && utils.isHTMLForm(data)) {
1457
+ data = new FormData(data);
1458
+ }
1459
+
1460
+ const isFormData = utils.isFormData(data);
1461
+
1462
+ if (isFormData) {
1463
+ if (!hasJSONContentType) {
1464
+ return data;
1465
+ }
1466
+ return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1467
+ }
1468
+
1469
+ if (utils.isArrayBuffer(data) ||
1470
+ utils.isBuffer(data) ||
1471
+ utils.isStream(data) ||
1472
+ utils.isFile(data) ||
1473
+ utils.isBlob(data)
1474
+ ) {
1475
+ return data;
1476
+ }
1477
+ if (utils.isArrayBufferView(data)) {
1478
+ return data.buffer;
1479
+ }
1480
+ if (utils.isURLSearchParams(data)) {
1481
+ headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1482
+ return data.toString();
1483
+ }
1484
+
1485
+ let isFileList;
1486
+
1487
+ if (isObjectPayload) {
1488
+ if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1489
+ return toURLEncodedForm(data, this.formSerializer).toString();
1490
+ }
1491
+
1492
+ if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1493
+ const _FormData = this.env && this.env.FormData;
1494
+
1495
+ return toFormData(
1496
+ isFileList ? {'files[]': data} : data,
1497
+ _FormData && new _FormData(),
1498
+ this.formSerializer
1499
+ );
1500
+ }
1501
+ }
1502
+
1503
+ if (isObjectPayload || hasJSONContentType ) {
1504
+ headers.setContentType('application/json', false);
1505
+ return stringifySafely(data);
1506
+ }
1507
+
1508
+ return data;
1509
+ }],
1510
+
1511
+ transformResponse: [function transformResponse(data) {
1512
+ const transitional = this.transitional || defaults.transitional;
1513
+ const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1514
+ const JSONRequested = this.responseType === 'json';
1515
+
1516
+ if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
1517
+ const silentJSONParsing = transitional && transitional.silentJSONParsing;
1518
+ const strictJSONParsing = !silentJSONParsing && JSONRequested;
1519
+
1520
+ try {
1521
+ return JSON.parse(data);
1522
+ } catch (e) {
1523
+ if (strictJSONParsing) {
1524
+ if (e.name === 'SyntaxError') {
1525
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1526
+ }
1527
+ throw e;
1528
+ }
1529
+ }
1530
+ }
1531
+
1532
+ return data;
1533
+ }],
1534
+
1535
+ /**
1536
+ * A timeout in milliseconds to abort a request. If set to 0 (default) a
1537
+ * timeout is not created.
1538
+ */
1539
+ timeout: 0,
1540
+
1541
+ xsrfCookieName: 'XSRF-TOKEN',
1542
+ xsrfHeaderName: 'X-XSRF-TOKEN',
1543
+
1544
+ maxContentLength: -1,
1545
+ maxBodyLength: -1,
1546
+
1547
+ env: {
1548
+ FormData: platform.classes.FormData,
1549
+ Blob: platform.classes.Blob
1550
+ },
1551
+
1552
+ validateStatus: function validateStatus(status) {
1553
+ return status >= 200 && status < 300;
1554
+ },
1555
+
1556
+ headers: {
1557
+ common: {
1558
+ 'Accept': 'application/json, text/plain, */*'
1559
+ }
1560
+ }
1561
+ };
1562
+
1563
+ utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
1564
+ defaults.headers[method] = {};
1565
+ });
1566
+
1567
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
1568
+ defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
1569
+ });
1570
+
1571
+ // RawAxiosHeaders whose duplicates are ignored by node
1572
+ // c.f. https://nodejs.org/api/http.html#http_message_headers
1573
+ const ignoreDuplicateOf = utils.toObjectSet([
1574
+ 'age', 'authorization', 'content-length', 'content-type', 'etag',
1575
+ 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
1576
+ 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
1577
+ 'referer', 'retry-after', 'user-agent'
1578
+ ]);
1579
+
1580
+ /**
1581
+ * Parse headers into an object
1582
+ *
1583
+ * ```
1584
+ * Date: Wed, 27 Aug 2014 08:58:49 GMT
1585
+ * Content-Type: application/json
1586
+ * Connection: keep-alive
1587
+ * Transfer-Encoding: chunked
1588
+ * ```
1589
+ *
1590
+ * @param {String} rawHeaders Headers needing to be parsed
1591
+ *
1592
+ * @returns {Object} Headers parsed into an object
1593
+ */
1594
+ const parseHeaders = rawHeaders => {
1595
+ const parsed = {};
1596
+ let key;
1597
+ let val;
1598
+ let i;
1599
+
1600
+ rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1601
+ i = line.indexOf(':');
1602
+ key = line.substring(0, i).trim().toLowerCase();
1603
+ val = line.substring(i + 1).trim();
1604
+
1605
+ if (!key || (parsed[key] && ignoreDuplicateOf[key])) {
1606
+ return;
1607
+ }
1608
+
1609
+ if (key === 'set-cookie') {
1610
+ if (parsed[key]) {
1611
+ parsed[key].push(val);
1612
+ } else {
1613
+ parsed[key] = [val];
1614
+ }
1615
+ } else {
1616
+ parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1617
+ }
1618
+ });
1619
+
1620
+ return parsed;
1621
+ };
1622
+
1623
+ const $internals = Symbol('internals');
1624
+
1625
+ function normalizeHeader(header) {
1626
+ return header && String(header).trim().toLowerCase();
1627
+ }
1628
+
1629
+ function normalizeValue(value) {
1630
+ if (value === false || value == null) {
1631
+ return value;
1632
+ }
1633
+
1634
+ return utils.isArray(value) ? value.map(normalizeValue) : String(value);
1635
+ }
1636
+
1637
+ function parseTokens(str) {
1638
+ const tokens = Object.create(null);
1639
+ const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1640
+ let match;
1641
+
1642
+ while ((match = tokensRE.exec(str))) {
1643
+ tokens[match[1]] = match[2];
1644
+ }
1645
+
1646
+ return tokens;
1647
+ }
1648
+
1649
+ function isValidHeaderName(str) {
1650
+ return /^[-_a-zA-Z]+$/.test(str.trim());
1651
+ }
1652
+
1653
+ function matchHeaderValue(context, value, header, filter) {
1654
+ if (utils.isFunction(filter)) {
1655
+ return filter.call(this, value, header);
1656
+ }
1657
+
1658
+ if (!utils.isString(value)) return;
1659
+
1660
+ if (utils.isString(filter)) {
1661
+ return value.indexOf(filter) !== -1;
1662
+ }
1663
+
1664
+ if (utils.isRegExp(filter)) {
1665
+ return filter.test(value);
1666
+ }
1667
+ }
1668
+
1669
+ function formatHeader(header) {
1670
+ return header.trim()
1671
+ .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1672
+ return char.toUpperCase() + str;
1673
+ });
1674
+ }
1675
+
1676
+ function buildAccessors(obj, header) {
1677
+ const accessorName = utils.toCamelCase(' ' + header);
1678
+
1679
+ ['get', 'set', 'has'].forEach(methodName => {
1680
+ Object.defineProperty(obj, methodName + accessorName, {
1681
+ value: function(arg1, arg2, arg3) {
1682
+ return this[methodName].call(this, header, arg1, arg2, arg3);
1683
+ },
1684
+ configurable: true
1685
+ });
1686
+ });
1687
+ }
1688
+
1689
+ class AxiosHeaders {
1690
+ constructor(headers) {
1691
+ headers && this.set(headers);
1692
+ }
1693
+
1694
+ set(header, valueOrRewrite, rewrite) {
1695
+ const self = this;
1696
+
1697
+ function setHeader(_value, _header, _rewrite) {
1698
+ const lHeader = normalizeHeader(_header);
1699
+
1700
+ if (!lHeader) {
1701
+ throw new Error('header name must be a non-empty string');
1702
+ }
1703
+
1704
+ const key = utils.findKey(self, lHeader);
1705
+
1706
+ if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
1707
+ self[key || _header] = normalizeValue(_value);
1708
+ }
1709
+ }
1710
+
1711
+ const setHeaders = (headers, _rewrite) =>
1712
+ utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1713
+
1714
+ if (utils.isPlainObject(header) || header instanceof this.constructor) {
1715
+ setHeaders(header, valueOrRewrite);
1716
+ } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1717
+ setHeaders(parseHeaders(header), valueOrRewrite);
1718
+ } else {
1719
+ header != null && setHeader(valueOrRewrite, header, rewrite);
1720
+ }
1721
+
1722
+ return this;
1723
+ }
1724
+
1725
+ get(header, parser) {
1726
+ header = normalizeHeader(header);
1727
+
1728
+ if (header) {
1729
+ const key = utils.findKey(this, header);
1730
+
1731
+ if (key) {
1732
+ const value = this[key];
1733
+
1734
+ if (!parser) {
1735
+ return value;
1736
+ }
1737
+
1738
+ if (parser === true) {
1739
+ return parseTokens(value);
1740
+ }
1741
+
1742
+ if (utils.isFunction(parser)) {
1743
+ return parser.call(this, value, key);
1744
+ }
1745
+
1746
+ if (utils.isRegExp(parser)) {
1747
+ return parser.exec(value);
1748
+ }
1749
+
1750
+ throw new TypeError('parser must be boolean|regexp|function');
1751
+ }
1752
+ }
1753
+ }
1754
+
1755
+ has(header, matcher) {
1756
+ header = normalizeHeader(header);
1757
+
1758
+ if (header) {
1759
+ const key = utils.findKey(this, header);
1760
+
1761
+ return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1762
+ }
1763
+
1764
+ return false;
1765
+ }
1766
+
1767
+ delete(header, matcher) {
1768
+ const self = this;
1769
+ let deleted = false;
1770
+
1771
+ function deleteHeader(_header) {
1772
+ _header = normalizeHeader(_header);
1773
+
1774
+ if (_header) {
1775
+ const key = utils.findKey(self, _header);
1776
+
1777
+ if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1778
+ delete self[key];
1779
+
1780
+ deleted = true;
1781
+ }
1782
+ }
1783
+ }
1784
+
1785
+ if (utils.isArray(header)) {
1786
+ header.forEach(deleteHeader);
1787
+ } else {
1788
+ deleteHeader(header);
1789
+ }
1790
+
1791
+ return deleted;
1792
+ }
1793
+
1794
+ clear() {
1795
+ return Object.keys(this).forEach(this.delete.bind(this));
1796
+ }
1797
+
1798
+ normalize(format) {
1799
+ const self = this;
1800
+ const headers = {};
1801
+
1802
+ utils.forEach(this, (value, header) => {
1803
+ const key = utils.findKey(headers, header);
1804
+
1805
+ if (key) {
1806
+ self[key] = normalizeValue(value);
1807
+ delete self[header];
1808
+ return;
1809
+ }
1810
+
1811
+ const normalized = format ? formatHeader(header) : String(header).trim();
1812
+
1813
+ if (normalized !== header) {
1814
+ delete self[header];
1815
+ }
1816
+
1817
+ self[normalized] = normalizeValue(value);
1818
+
1819
+ headers[normalized] = true;
1820
+ });
1821
+
1822
+ return this;
1823
+ }
1824
+
1825
+ concat(...targets) {
1826
+ return this.constructor.concat(this, ...targets);
1827
+ }
1828
+
1829
+ toJSON(asStrings) {
1830
+ const obj = Object.create(null);
1831
+
1832
+ utils.forEach(this, (value, header) => {
1833
+ value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
1834
+ });
1835
+
1836
+ return obj;
1837
+ }
1838
+
1839
+ [Symbol.iterator]() {
1840
+ return Object.entries(this.toJSON())[Symbol.iterator]();
1841
+ }
1842
+
1843
+ toString() {
1844
+ return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1845
+ }
1846
+
1847
+ get [Symbol.toStringTag]() {
1848
+ return 'AxiosHeaders';
1849
+ }
1850
+
1851
+ static from(thing) {
1852
+ return thing instanceof this ? thing : new this(thing);
1853
+ }
1854
+
1855
+ static concat(first, ...targets) {
1856
+ const computed = new this(first);
1857
+
1858
+ targets.forEach((target) => computed.set(target));
1859
+
1860
+ return computed;
1861
+ }
1862
+
1863
+ static accessor(header) {
1864
+ const internals = this[$internals] = (this[$internals] = {
1865
+ accessors: {}
1866
+ });
1867
+
1868
+ const accessors = internals.accessors;
1869
+ const prototype = this.prototype;
1870
+
1871
+ function defineAccessor(_header) {
1872
+ const lHeader = normalizeHeader(_header);
1873
+
1874
+ if (!accessors[lHeader]) {
1875
+ buildAccessors(prototype, _header);
1876
+ accessors[lHeader] = true;
1877
+ }
1878
+ }
1879
+
1880
+ utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1881
+
1882
+ return this;
1883
+ }
1884
+ }
1885
+
1886
+ AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
1887
+
1888
+ utils.freezeMethods(AxiosHeaders.prototype);
1889
+ utils.freezeMethods(AxiosHeaders);
1890
+
1891
+ /**
1892
+ * Transform the data for a request or a response
1893
+ *
1894
+ * @param {Array|Function} fns A single function or Array of functions
1895
+ * @param {?Object} response The response object
1896
+ *
1897
+ * @returns {*} The resulting transformed data
1898
+ */
1899
+ function transformData(fns, response) {
1900
+ const config = this || defaults;
1901
+ const context = response || config;
1902
+ const headers = AxiosHeaders.from(context.headers);
1903
+ let data = context.data;
1904
+
1905
+ utils.forEach(fns, function transform(fn) {
1906
+ data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1907
+ });
1908
+
1909
+ headers.normalize();
1910
+
1911
+ return data;
1912
+ }
1913
+
1914
+ function isCancel(value) {
1915
+ return !!(value && value.__CANCEL__);
1916
+ }
1917
+
1918
+ /**
1919
+ * A `CanceledError` is an object that is thrown when an operation is canceled.
1920
+ *
1921
+ * @param {string=} message The message.
1922
+ * @param {Object=} config The config.
1923
+ * @param {Object=} request The request.
1924
+ *
1925
+ * @returns {CanceledError} The created error.
1926
+ */
1927
+ function CanceledError(message, config, request) {
1928
+ // eslint-disable-next-line no-eq-null,eqeqeq
1929
+ AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1930
+ this.name = 'CanceledError';
1931
+ }
1932
+
1933
+ utils.inherits(CanceledError, AxiosError, {
1934
+ __CANCEL__: true
1935
+ });
1936
+
1937
+ // eslint-disable-next-line strict
1938
+ const httpAdapter = null;
1939
+
1940
+ /**
1941
+ * Resolve or reject a Promise based on response status.
1942
+ *
1943
+ * @param {Function} resolve A function that resolves the promise.
1944
+ * @param {Function} reject A function that rejects the promise.
1945
+ * @param {object} response The response.
1946
+ *
1947
+ * @returns {object} The response.
1948
+ */
1949
+ function settle(resolve, reject, response) {
1950
+ const validateStatus = response.config.validateStatus;
1951
+ if (!response.status || !validateStatus || validateStatus(response.status)) {
1952
+ resolve(response);
1953
+ } else {
1954
+ reject(new AxiosError(
1955
+ 'Request failed with status code ' + response.status,
1956
+ [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
1957
+ response.config,
1958
+ response.request,
1959
+ response
1960
+ ));
1961
+ }
1962
+ }
1963
+
1964
+ const cookies = platform.isStandardBrowserEnv ?
1965
+
1966
+ // Standard browser envs support document.cookie
1967
+ (function standardBrowserEnv() {
1968
+ return {
1969
+ write: function write(name, value, expires, path, domain, secure) {
1970
+ const cookie = [];
1971
+ cookie.push(name + '=' + encodeURIComponent(value));
1972
+
1973
+ if (utils.isNumber(expires)) {
1974
+ cookie.push('expires=' + new Date(expires).toGMTString());
1975
+ }
1976
+
1977
+ if (utils.isString(path)) {
1978
+ cookie.push('path=' + path);
1979
+ }
1980
+
1981
+ if (utils.isString(domain)) {
1982
+ cookie.push('domain=' + domain);
1983
+ }
1984
+
1985
+ if (secure === true) {
1986
+ cookie.push('secure');
1987
+ }
1988
+
1989
+ document.cookie = cookie.join('; ');
1990
+ },
1991
+
1992
+ read: function read(name) {
1993
+ const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
1994
+ return (match ? decodeURIComponent(match[3]) : null);
1995
+ },
1996
+
1997
+ remove: function remove(name) {
1998
+ this.write(name, '', Date.now() - 86400000);
1999
+ }
2000
+ };
2001
+ })() :
2002
+
2003
+ // Non standard browser env (web workers, react-native) lack needed support.
2004
+ (function nonStandardBrowserEnv() {
2005
+ return {
2006
+ write: function write() {},
2007
+ read: function read() { return null; },
2008
+ remove: function remove() {}
2009
+ };
2010
+ })();
2011
+
2012
+ /**
2013
+ * Determines whether the specified URL is absolute
2014
+ *
2015
+ * @param {string} url The URL to test
2016
+ *
2017
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
2018
+ */
2019
+ function isAbsoluteURL(url) {
2020
+ // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
2021
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
2022
+ // by any combination of letters, digits, plus, period, or hyphen.
2023
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
2024
+ }
2025
+
2026
+ /**
2027
+ * Creates a new URL by combining the specified URLs
2028
+ *
2029
+ * @param {string} baseURL The base URL
2030
+ * @param {string} relativeURL The relative URL
2031
+ *
2032
+ * @returns {string} The combined URL
2033
+ */
2034
+ function combineURLs(baseURL, relativeURL) {
2035
+ return relativeURL
2036
+ ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
2037
+ : baseURL;
2038
+ }
2039
+
2040
+ /**
2041
+ * Creates a new URL by combining the baseURL with the requestedURL,
2042
+ * only when the requestedURL is not already an absolute URL.
2043
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
2044
+ *
2045
+ * @param {string} baseURL The base URL
2046
+ * @param {string} requestedURL Absolute or relative URL to combine
2047
+ *
2048
+ * @returns {string} The combined full path
2049
+ */
2050
+ function buildFullPath(baseURL, requestedURL) {
2051
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
2052
+ return combineURLs(baseURL, requestedURL);
2053
+ }
2054
+ return requestedURL;
2055
+ }
2056
+
2057
+ const isURLSameOrigin = platform.isStandardBrowserEnv ?
2058
+
2059
+ // Standard browser envs have full support of the APIs needed to test
2060
+ // whether the request URL is of the same origin as current location.
2061
+ (function standardBrowserEnv() {
2062
+ const msie = /(msie|trident)/i.test(navigator.userAgent);
2063
+ const urlParsingNode = document.createElement('a');
2064
+ let originURL;
2065
+
2066
+ /**
2067
+ * Parse a URL to discover it's components
2068
+ *
2069
+ * @param {String} url The URL to be parsed
2070
+ * @returns {Object}
2071
+ */
2072
+ function resolveURL(url) {
2073
+ let href = url;
2074
+
2075
+ if (msie) {
2076
+ // IE needs attribute set twice to normalize properties
2077
+ urlParsingNode.setAttribute('href', href);
2078
+ href = urlParsingNode.href;
2079
+ }
2080
+
2081
+ urlParsingNode.setAttribute('href', href);
2082
+
2083
+ // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
2084
+ return {
2085
+ href: urlParsingNode.href,
2086
+ protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
2087
+ host: urlParsingNode.host,
2088
+ search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
2089
+ hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
2090
+ hostname: urlParsingNode.hostname,
2091
+ port: urlParsingNode.port,
2092
+ pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
2093
+ urlParsingNode.pathname :
2094
+ '/' + urlParsingNode.pathname
2095
+ };
2096
+ }
2097
+
2098
+ originURL = resolveURL(window.location.href);
2099
+
2100
+ /**
2101
+ * Determine if a URL shares the same origin as the current location
2102
+ *
2103
+ * @param {String} requestURL The URL to test
2104
+ * @returns {boolean} True if URL shares the same origin, otherwise false
2105
+ */
2106
+ return function isURLSameOrigin(requestURL) {
2107
+ const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
2108
+ return (parsed.protocol === originURL.protocol &&
2109
+ parsed.host === originURL.host);
2110
+ };
2111
+ })() :
2112
+
2113
+ // Non standard browser envs (web workers, react-native) lack needed support.
2114
+ (function nonStandardBrowserEnv() {
2115
+ return function isURLSameOrigin() {
2116
+ return true;
2117
+ };
2118
+ })();
2119
+
2120
+ function parseProtocol(url) {
2121
+ const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2122
+ return match && match[1] || '';
2123
+ }
2124
+
2125
+ /**
2126
+ * Calculate data maxRate
2127
+ * @param {Number} [samplesCount= 10]
2128
+ * @param {Number} [min= 1000]
2129
+ * @returns {Function}
2130
+ */
2131
+ function speedometer(samplesCount, min) {
2132
+ samplesCount = samplesCount || 10;
2133
+ const bytes = new Array(samplesCount);
2134
+ const timestamps = new Array(samplesCount);
2135
+ let head = 0;
2136
+ let tail = 0;
2137
+ let firstSampleTS;
2138
+
2139
+ min = min !== undefined ? min : 1000;
2140
+
2141
+ return function push(chunkLength) {
2142
+ const now = Date.now();
2143
+
2144
+ const startedAt = timestamps[tail];
2145
+
2146
+ if (!firstSampleTS) {
2147
+ firstSampleTS = now;
2148
+ }
2149
+
2150
+ bytes[head] = chunkLength;
2151
+ timestamps[head] = now;
2152
+
2153
+ let i = tail;
2154
+ let bytesCount = 0;
2155
+
2156
+ while (i !== head) {
2157
+ bytesCount += bytes[i++];
2158
+ i = i % samplesCount;
2159
+ }
2160
+
2161
+ head = (head + 1) % samplesCount;
2162
+
2163
+ if (head === tail) {
2164
+ tail = (tail + 1) % samplesCount;
2165
+ }
2166
+
2167
+ if (now - firstSampleTS < min) {
2168
+ return;
2169
+ }
2170
+
2171
+ const passed = startedAt && now - startedAt;
2172
+
2173
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2174
+ };
2175
+ }
2176
+
2177
+ function progressEventReducer(listener, isDownloadStream) {
2178
+ let bytesNotified = 0;
2179
+ const _speedometer = speedometer(50, 250);
2180
+
2181
+ return e => {
2182
+ const loaded = e.loaded;
2183
+ const total = e.lengthComputable ? e.total : undefined;
2184
+ const progressBytes = loaded - bytesNotified;
2185
+ const rate = _speedometer(progressBytes);
2186
+ const inRange = loaded <= total;
2187
+
2188
+ bytesNotified = loaded;
2189
+
2190
+ const data = {
2191
+ loaded,
2192
+ total,
2193
+ progress: total ? (loaded / total) : undefined,
2194
+ bytes: progressBytes,
2195
+ rate: rate ? rate : undefined,
2196
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2197
+ event: e
2198
+ };
2199
+
2200
+ data[isDownloadStream ? 'download' : 'upload'] = true;
2201
+
2202
+ listener(data);
2203
+ };
2204
+ }
2205
+
2206
+ const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
2207
+
2208
+ const xhrAdapter = isXHRAdapterSupported && function (config) {
2209
+ return new Promise(function dispatchXhrRequest(resolve, reject) {
2210
+ let requestData = config.data;
2211
+ const requestHeaders = AxiosHeaders.from(config.headers).normalize();
2212
+ const responseType = config.responseType;
2213
+ let onCanceled;
2214
+ function done() {
2215
+ if (config.cancelToken) {
2216
+ config.cancelToken.unsubscribe(onCanceled);
2217
+ }
2218
+
2219
+ if (config.signal) {
2220
+ config.signal.removeEventListener('abort', onCanceled);
2221
+ }
2222
+ }
2223
+
2224
+ if (utils.isFormData(requestData) && (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv)) {
2225
+ requestHeaders.setContentType(false); // Let the browser set it
2226
+ }
2227
+
2228
+ let request = new XMLHttpRequest();
2229
+
2230
+ // HTTP basic authentication
2231
+ if (config.auth) {
2232
+ const username = config.auth.username || '';
2233
+ const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
2234
+ requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
2235
+ }
2236
+
2237
+ const fullPath = buildFullPath(config.baseURL, config.url);
2238
+
2239
+ request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
2240
+
2241
+ // Set the request timeout in MS
2242
+ request.timeout = config.timeout;
2243
+
2244
+ function onloadend() {
2245
+ if (!request) {
2246
+ return;
2247
+ }
2248
+ // Prepare the response
2249
+ const responseHeaders = AxiosHeaders.from(
2250
+ 'getAllResponseHeaders' in request && request.getAllResponseHeaders()
2251
+ );
2252
+ const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
2253
+ request.responseText : request.response;
2254
+ const response = {
2255
+ data: responseData,
2256
+ status: request.status,
2257
+ statusText: request.statusText,
2258
+ headers: responseHeaders,
2259
+ config,
2260
+ request
2261
+ };
2262
+
2263
+ settle(function _resolve(value) {
2264
+ resolve(value);
2265
+ done();
2266
+ }, function _reject(err) {
2267
+ reject(err);
2268
+ done();
2269
+ }, response);
2270
+
2271
+ // Clean up request
2272
+ request = null;
2273
+ }
2274
+
2275
+ if ('onloadend' in request) {
2276
+ // Use onloadend if available
2277
+ request.onloadend = onloadend;
2278
+ } else {
2279
+ // Listen for ready state to emulate onloadend
2280
+ request.onreadystatechange = function handleLoad() {
2281
+ if (!request || request.readyState !== 4) {
2282
+ return;
2283
+ }
2284
+
2285
+ // The request errored out and we didn't get a response, this will be
2286
+ // handled by onerror instead
2287
+ // With one exception: request that using file: protocol, most browsers
2288
+ // will return status as 0 even though it's a successful request
2289
+ if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
2290
+ return;
2291
+ }
2292
+ // readystate handler is calling before onerror or ontimeout handlers,
2293
+ // so we should call onloadend on the next 'tick'
2294
+ setTimeout(onloadend);
2295
+ };
2296
+ }
2297
+
2298
+ // Handle browser request cancellation (as opposed to a manual cancellation)
2299
+ request.onabort = function handleAbort() {
2300
+ if (!request) {
2301
+ return;
2302
+ }
2303
+
2304
+ reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
2305
+
2306
+ // Clean up request
2307
+ request = null;
2308
+ };
2309
+
2310
+ // Handle low level network errors
2311
+ request.onerror = function handleError() {
2312
+ // Real errors are hidden from us by the browser
2313
+ // onerror should only fire if it's a network error
2314
+ reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request));
2315
+
2316
+ // Clean up request
2317
+ request = null;
2318
+ };
2319
+
2320
+ // Handle timeout
2321
+ request.ontimeout = function handleTimeout() {
2322
+ let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
2323
+ const transitional = config.transitional || transitionalDefaults;
2324
+ if (config.timeoutErrorMessage) {
2325
+ timeoutErrorMessage = config.timeoutErrorMessage;
2326
+ }
2327
+ reject(new AxiosError(
2328
+ timeoutErrorMessage,
2329
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
2330
+ config,
2331
+ request));
2332
+
2333
+ // Clean up request
2334
+ request = null;
2335
+ };
2336
+
2337
+ // Add xsrf header
2338
+ // This is only done if running in a standard browser environment.
2339
+ // Specifically not if we're in a web worker, or react-native.
2340
+ if (platform.isStandardBrowserEnv) {
2341
+ // Add xsrf header
2342
+ const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
2343
+ && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
2344
+
2345
+ if (xsrfValue) {
2346
+ requestHeaders.set(config.xsrfHeaderName, xsrfValue);
2347
+ }
2348
+ }
2349
+
2350
+ // Remove Content-Type if data is undefined
2351
+ requestData === undefined && requestHeaders.setContentType(null);
2352
+
2353
+ // Add headers to the request
2354
+ if ('setRequestHeader' in request) {
2355
+ utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
2356
+ request.setRequestHeader(key, val);
2357
+ });
2358
+ }
2359
+
2360
+ // Add withCredentials to request if needed
2361
+ if (!utils.isUndefined(config.withCredentials)) {
2362
+ request.withCredentials = !!config.withCredentials;
2363
+ }
2364
+
2365
+ // Add responseType to request if needed
2366
+ if (responseType && responseType !== 'json') {
2367
+ request.responseType = config.responseType;
2368
+ }
2369
+
2370
+ // Handle progress if needed
2371
+ if (typeof config.onDownloadProgress === 'function') {
2372
+ request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
2373
+ }
2374
+
2375
+ // Not all browsers support upload events
2376
+ if (typeof config.onUploadProgress === 'function' && request.upload) {
2377
+ request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
2378
+ }
2379
+
2380
+ if (config.cancelToken || config.signal) {
2381
+ // Handle cancellation
2382
+ // eslint-disable-next-line func-names
2383
+ onCanceled = cancel => {
2384
+ if (!request) {
2385
+ return;
2386
+ }
2387
+ reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
2388
+ request.abort();
2389
+ request = null;
2390
+ };
2391
+
2392
+ config.cancelToken && config.cancelToken.subscribe(onCanceled);
2393
+ if (config.signal) {
2394
+ config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
2395
+ }
2396
+ }
2397
+
2398
+ const protocol = parseProtocol(fullPath);
2399
+
2400
+ if (protocol && platform.protocols.indexOf(protocol) === -1) {
2401
+ reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
2402
+ return;
2403
+ }
2404
+
2405
+
2406
+ // Send the request
2407
+ request.send(requestData || null);
2408
+ });
2409
+ };
2410
+
2411
+ const knownAdapters = {
2412
+ http: httpAdapter,
2413
+ xhr: xhrAdapter
2414
+ };
2415
+
2416
+ utils.forEach(knownAdapters, (fn, value) => {
2417
+ if(fn) {
2418
+ try {
2419
+ Object.defineProperty(fn, 'name', {value});
2420
+ } catch (e) {
2421
+ // eslint-disable-next-line no-empty
2422
+ }
2423
+ Object.defineProperty(fn, 'adapterName', {value});
2424
+ }
2425
+ });
2426
+
2427
+ const adapters = {
2428
+ getAdapter: (adapters) => {
2429
+ adapters = utils.isArray(adapters) ? adapters : [adapters];
2430
+
2431
+ const {length} = adapters;
2432
+ let nameOrAdapter;
2433
+ let adapter;
2434
+
2435
+ for (let i = 0; i < length; i++) {
2436
+ nameOrAdapter = adapters[i];
2437
+ if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
2438
+ break;
2439
+ }
2440
+ }
2441
+
2442
+ if (!adapter) {
2443
+ if (adapter === false) {
2444
+ throw new AxiosError(
2445
+ `Adapter ${nameOrAdapter} is not supported by the environment`,
2446
+ 'ERR_NOT_SUPPORT'
2447
+ );
2448
+ }
2449
+
2450
+ throw new Error(
2451
+ utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
2452
+ `Adapter '${nameOrAdapter}' is not available in the build` :
2453
+ `Unknown adapter '${nameOrAdapter}'`
2454
+ );
2455
+ }
2456
+
2457
+ if (!utils.isFunction(adapter)) {
2458
+ throw new TypeError('adapter is not a function');
2459
+ }
2460
+
2461
+ return adapter;
2462
+ },
2463
+ adapters: knownAdapters
2464
+ };
2465
+
2466
+ /**
2467
+ * Throws a `CanceledError` if cancellation has been requested.
2468
+ *
2469
+ * @param {Object} config The config that is to be used for the request
2470
+ *
2471
+ * @returns {void}
2472
+ */
2473
+ function throwIfCancellationRequested(config) {
2474
+ if (config.cancelToken) {
2475
+ config.cancelToken.throwIfRequested();
2476
+ }
2477
+
2478
+ if (config.signal && config.signal.aborted) {
2479
+ throw new CanceledError(null, config);
2480
+ }
2481
+ }
2482
+
2483
+ /**
2484
+ * Dispatch a request to the server using the configured adapter.
2485
+ *
2486
+ * @param {object} config The config that is to be used for the request
2487
+ *
2488
+ * @returns {Promise} The Promise to be fulfilled
2489
+ */
2490
+ function dispatchRequest(config) {
2491
+ throwIfCancellationRequested(config);
2492
+
2493
+ config.headers = AxiosHeaders.from(config.headers);
2494
+
2495
+ // Transform request data
2496
+ config.data = transformData.call(
2497
+ config,
2498
+ config.transformRequest
2499
+ );
2500
+
2501
+ if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
2502
+ config.headers.setContentType('application/x-www-form-urlencoded', false);
2503
+ }
2504
+
2505
+ const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
2506
+
2507
+ return adapter(config).then(function onAdapterResolution(response) {
2508
+ throwIfCancellationRequested(config);
2509
+
2510
+ // Transform response data
2511
+ response.data = transformData.call(
2512
+ config,
2513
+ config.transformResponse,
2514
+ response
2515
+ );
2516
+
2517
+ response.headers = AxiosHeaders.from(response.headers);
2518
+
2519
+ return response;
2520
+ }, function onAdapterRejection(reason) {
2521
+ if (!isCancel(reason)) {
2522
+ throwIfCancellationRequested(config);
2523
+
2524
+ // Transform response data
2525
+ if (reason && reason.response) {
2526
+ reason.response.data = transformData.call(
2527
+ config,
2528
+ config.transformResponse,
2529
+ reason.response
2530
+ );
2531
+ reason.response.headers = AxiosHeaders.from(reason.response.headers);
2532
+ }
2533
+ }
2534
+
2535
+ return Promise.reject(reason);
2536
+ });
2537
+ }
2538
+
2539
+ const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
2540
+
2541
+ /**
2542
+ * Config-specific merge-function which creates a new config-object
2543
+ * by merging two configuration objects together.
2544
+ *
2545
+ * @param {Object} config1
2546
+ * @param {Object} config2
2547
+ *
2548
+ * @returns {Object} New object resulting from merging config2 to config1
2549
+ */
2550
+ function mergeConfig(config1, config2) {
2551
+ // eslint-disable-next-line no-param-reassign
2552
+ config2 = config2 || {};
2553
+ const config = {};
2554
+
2555
+ function getMergedValue(target, source, caseless) {
2556
+ if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
2557
+ return utils.merge.call({caseless}, target, source);
2558
+ } else if (utils.isPlainObject(source)) {
2559
+ return utils.merge({}, source);
2560
+ } else if (utils.isArray(source)) {
2561
+ return source.slice();
2562
+ }
2563
+ return source;
2564
+ }
2565
+
2566
+ // eslint-disable-next-line consistent-return
2567
+ function mergeDeepProperties(a, b, caseless) {
2568
+ if (!utils.isUndefined(b)) {
2569
+ return getMergedValue(a, b, caseless);
2570
+ } else if (!utils.isUndefined(a)) {
2571
+ return getMergedValue(undefined, a, caseless);
2572
+ }
2573
+ }
2574
+
2575
+ // eslint-disable-next-line consistent-return
2576
+ function valueFromConfig2(a, b) {
2577
+ if (!utils.isUndefined(b)) {
2578
+ return getMergedValue(undefined, b);
2579
+ }
2580
+ }
2581
+
2582
+ // eslint-disable-next-line consistent-return
2583
+ function defaultToConfig2(a, b) {
2584
+ if (!utils.isUndefined(b)) {
2585
+ return getMergedValue(undefined, b);
2586
+ } else if (!utils.isUndefined(a)) {
2587
+ return getMergedValue(undefined, a);
2588
+ }
2589
+ }
2590
+
2591
+ // eslint-disable-next-line consistent-return
2592
+ function mergeDirectKeys(a, b, prop) {
2593
+ if (prop in config2) {
2594
+ return getMergedValue(a, b);
2595
+ } else if (prop in config1) {
2596
+ return getMergedValue(undefined, a);
2597
+ }
2598
+ }
2599
+
2600
+ const mergeMap = {
2601
+ url: valueFromConfig2,
2602
+ method: valueFromConfig2,
2603
+ data: valueFromConfig2,
2604
+ baseURL: defaultToConfig2,
2605
+ transformRequest: defaultToConfig2,
2606
+ transformResponse: defaultToConfig2,
2607
+ paramsSerializer: defaultToConfig2,
2608
+ timeout: defaultToConfig2,
2609
+ timeoutMessage: defaultToConfig2,
2610
+ withCredentials: defaultToConfig2,
2611
+ adapter: defaultToConfig2,
2612
+ responseType: defaultToConfig2,
2613
+ xsrfCookieName: defaultToConfig2,
2614
+ xsrfHeaderName: defaultToConfig2,
2615
+ onUploadProgress: defaultToConfig2,
2616
+ onDownloadProgress: defaultToConfig2,
2617
+ decompress: defaultToConfig2,
2618
+ maxContentLength: defaultToConfig2,
2619
+ maxBodyLength: defaultToConfig2,
2620
+ beforeRedirect: defaultToConfig2,
2621
+ transport: defaultToConfig2,
2622
+ httpAgent: defaultToConfig2,
2623
+ httpsAgent: defaultToConfig2,
2624
+ cancelToken: defaultToConfig2,
2625
+ socketPath: defaultToConfig2,
2626
+ responseEncoding: defaultToConfig2,
2627
+ validateStatus: mergeDirectKeys,
2628
+ headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
2629
+ };
2630
+
2631
+ utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
2632
+ const merge = mergeMap[prop] || mergeDeepProperties;
2633
+ const configValue = merge(config1[prop], config2[prop], prop);
2634
+ (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2635
+ });
2636
+
2637
+ return config;
2638
+ }
2639
+
2640
+ const VERSION = "1.2.2";
2641
+
2642
+ const validators$1 = {};
2643
+
2644
+ // eslint-disable-next-line func-names
2645
+ ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
2646
+ validators$1[type] = function validator(thing) {
2647
+ return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
2648
+ };
2649
+ });
2650
+
2651
+ const deprecatedWarnings = {};
2652
+
2653
+ /**
2654
+ * Transitional option validator
2655
+ *
2656
+ * @param {function|boolean?} validator - set to false if the transitional option has been removed
2657
+ * @param {string?} version - deprecated version / removed since version
2658
+ * @param {string?} message - some message with additional info
2659
+ *
2660
+ * @returns {function}
2661
+ */
2662
+ validators$1.transitional = function transitional(validator, version, message) {
2663
+ function formatMessage(opt, desc) {
2664
+ return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
2665
+ }
2666
+
2667
+ // eslint-disable-next-line func-names
2668
+ return (value, opt, opts) => {
2669
+ if (validator === false) {
2670
+ throw new AxiosError(
2671
+ formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
2672
+ AxiosError.ERR_DEPRECATED
2673
+ );
2674
+ }
2675
+
2676
+ if (version && !deprecatedWarnings[opt]) {
2677
+ deprecatedWarnings[opt] = true;
2678
+ // eslint-disable-next-line no-console
2679
+ console.warn(
2680
+ formatMessage(
2681
+ opt,
2682
+ ' has been deprecated since v' + version + ' and will be removed in the near future'
2683
+ )
2684
+ );
2685
+ }
2686
+
2687
+ return validator ? validator(value, opt, opts) : true;
2688
+ };
2689
+ };
2690
+
2691
+ /**
2692
+ * Assert object's properties type
2693
+ *
2694
+ * @param {object} options
2695
+ * @param {object} schema
2696
+ * @param {boolean?} allowUnknown
2697
+ *
2698
+ * @returns {object}
2699
+ */
2700
+
2701
+ function assertOptions(options, schema, allowUnknown) {
2702
+ if (typeof options !== 'object') {
2703
+ throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
2704
+ }
2705
+ const keys = Object.keys(options);
2706
+ let i = keys.length;
2707
+ while (i-- > 0) {
2708
+ const opt = keys[i];
2709
+ const validator = schema[opt];
2710
+ if (validator) {
2711
+ const value = options[opt];
2712
+ const result = value === undefined || validator(value, opt, options);
2713
+ if (result !== true) {
2714
+ throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
2715
+ }
2716
+ continue;
2717
+ }
2718
+ if (allowUnknown !== true) {
2719
+ throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
2720
+ }
2721
+ }
2722
+ }
2723
+
2724
+ const validator = {
2725
+ assertOptions,
2726
+ validators: validators$1
2727
+ };
2728
+
2729
+ const validators = validator.validators;
2730
+
2731
+ /**
2732
+ * Create a new instance of Axios
2733
+ *
2734
+ * @param {Object} instanceConfig The default config for the instance
2735
+ *
2736
+ * @return {Axios} A new instance of Axios
2737
+ */
2738
+ class Axios {
2739
+ constructor(instanceConfig) {
2740
+ this.defaults = instanceConfig;
2741
+ this.interceptors = {
2742
+ request: new InterceptorManager(),
2743
+ response: new InterceptorManager()
2744
+ };
2745
+ }
2746
+
2747
+ /**
2748
+ * Dispatch a request
2749
+ *
2750
+ * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
2751
+ * @param {?Object} config
2752
+ *
2753
+ * @returns {Promise} The Promise to be fulfilled
2754
+ */
2755
+ request(configOrUrl, config) {
2756
+ /*eslint no-param-reassign:0*/
2757
+ // Allow for axios('example/url'[, config]) a la fetch API
2758
+ if (typeof configOrUrl === 'string') {
2759
+ config = config || {};
2760
+ config.url = configOrUrl;
2761
+ } else {
2762
+ config = configOrUrl || {};
2763
+ }
2764
+
2765
+ config = mergeConfig(this.defaults, config);
2766
+
2767
+ const {transitional, paramsSerializer, headers} = config;
2768
+
2769
+ if (transitional !== undefined) {
2770
+ validator.assertOptions(transitional, {
2771
+ silentJSONParsing: validators.transitional(validators.boolean),
2772
+ forcedJSONParsing: validators.transitional(validators.boolean),
2773
+ clarifyTimeoutError: validators.transitional(validators.boolean)
2774
+ }, false);
2775
+ }
2776
+
2777
+ if (paramsSerializer !== undefined) {
2778
+ validator.assertOptions(paramsSerializer, {
2779
+ encode: validators.function,
2780
+ serialize: validators.function
2781
+ }, true);
2782
+ }
2783
+
2784
+ // Set config.method
2785
+ config.method = (config.method || this.defaults.method || 'get').toLowerCase();
2786
+
2787
+ let contextHeaders;
2788
+
2789
+ // Flatten headers
2790
+ contextHeaders = headers && utils.merge(
2791
+ headers.common,
2792
+ headers[config.method]
2793
+ );
2794
+
2795
+ contextHeaders && utils.forEach(
2796
+ ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
2797
+ (method) => {
2798
+ delete headers[method];
2799
+ }
2800
+ );
2801
+
2802
+ config.headers = AxiosHeaders.concat(contextHeaders, headers);
2803
+
2804
+ // filter out skipped interceptors
2805
+ const requestInterceptorChain = [];
2806
+ let synchronousRequestInterceptors = true;
2807
+ this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
2808
+ if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
2809
+ return;
2810
+ }
2811
+
2812
+ synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
2813
+
2814
+ requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
2815
+ });
2816
+
2817
+ const responseInterceptorChain = [];
2818
+ this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
2819
+ responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
2820
+ });
2821
+
2822
+ let promise;
2823
+ let i = 0;
2824
+ let len;
2825
+
2826
+ if (!synchronousRequestInterceptors) {
2827
+ const chain = [dispatchRequest.bind(this), undefined];
2828
+ chain.unshift.apply(chain, requestInterceptorChain);
2829
+ chain.push.apply(chain, responseInterceptorChain);
2830
+ len = chain.length;
2831
+
2832
+ promise = Promise.resolve(config);
2833
+
2834
+ while (i < len) {
2835
+ promise = promise.then(chain[i++], chain[i++]);
2836
+ }
2837
+
2838
+ return promise;
2839
+ }
2840
+
2841
+ len = requestInterceptorChain.length;
2842
+
2843
+ let newConfig = config;
2844
+
2845
+ i = 0;
2846
+
2847
+ while (i < len) {
2848
+ const onFulfilled = requestInterceptorChain[i++];
2849
+ const onRejected = requestInterceptorChain[i++];
2850
+ try {
2851
+ newConfig = onFulfilled(newConfig);
2852
+ } catch (error) {
2853
+ onRejected.call(this, error);
2854
+ break;
2855
+ }
2856
+ }
2857
+
2858
+ try {
2859
+ promise = dispatchRequest.call(this, newConfig);
2860
+ } catch (error) {
2861
+ return Promise.reject(error);
2862
+ }
2863
+
2864
+ i = 0;
2865
+ len = responseInterceptorChain.length;
2866
+
2867
+ while (i < len) {
2868
+ promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
2869
+ }
2870
+
2871
+ return promise;
2872
+ }
2873
+
2874
+ getUri(config) {
2875
+ config = mergeConfig(this.defaults, config);
2876
+ const fullPath = buildFullPath(config.baseURL, config.url);
2877
+ return buildURL(fullPath, config.params, config.paramsSerializer);
2878
+ }
2879
+ }
2880
+
2881
+ // Provide aliases for supported request methods
2882
+ utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
2883
+ /*eslint func-names:0*/
2884
+ Axios.prototype[method] = function(url, config) {
2885
+ return this.request(mergeConfig(config || {}, {
2886
+ method,
2887
+ url,
2888
+ data: (config || {}).data
2889
+ }));
2890
+ };
2891
+ });
2892
+
2893
+ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
2894
+ /*eslint func-names:0*/
2895
+
2896
+ function generateHTTPMethod(isForm) {
2897
+ return function httpMethod(url, data, config) {
2898
+ return this.request(mergeConfig(config || {}, {
2899
+ method,
2900
+ headers: isForm ? {
2901
+ 'Content-Type': 'multipart/form-data'
2902
+ } : {},
2903
+ url,
2904
+ data
2905
+ }));
2906
+ };
2907
+ }
2908
+
2909
+ Axios.prototype[method] = generateHTTPMethod();
2910
+
2911
+ Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
2912
+ });
2913
+
2914
+ /**
2915
+ * A `CancelToken` is an object that can be used to request cancellation of an operation.
2916
+ *
2917
+ * @param {Function} executor The executor function.
2918
+ *
2919
+ * @returns {CancelToken}
2920
+ */
2921
+ class CancelToken {
2922
+ constructor(executor) {
2923
+ if (typeof executor !== 'function') {
2924
+ throw new TypeError('executor must be a function.');
2925
+ }
2926
+
2927
+ let resolvePromise;
2928
+
2929
+ this.promise = new Promise(function promiseExecutor(resolve) {
2930
+ resolvePromise = resolve;
2931
+ });
2932
+
2933
+ const token = this;
2934
+
2935
+ // eslint-disable-next-line func-names
2936
+ this.promise.then(cancel => {
2937
+ if (!token._listeners) return;
2938
+
2939
+ let i = token._listeners.length;
2940
+
2941
+ while (i-- > 0) {
2942
+ token._listeners[i](cancel);
2943
+ }
2944
+ token._listeners = null;
2945
+ });
2946
+
2947
+ // eslint-disable-next-line func-names
2948
+ this.promise.then = onfulfilled => {
2949
+ let _resolve;
2950
+ // eslint-disable-next-line func-names
2951
+ const promise = new Promise(resolve => {
2952
+ token.subscribe(resolve);
2953
+ _resolve = resolve;
2954
+ }).then(onfulfilled);
2955
+
2956
+ promise.cancel = function reject() {
2957
+ token.unsubscribe(_resolve);
2958
+ };
2959
+
2960
+ return promise;
2961
+ };
2962
+
2963
+ executor(function cancel(message, config, request) {
2964
+ if (token.reason) {
2965
+ // Cancellation has already been requested
2966
+ return;
2967
+ }
2968
+
2969
+ token.reason = new CanceledError(message, config, request);
2970
+ resolvePromise(token.reason);
2971
+ });
2972
+ }
2973
+
2974
+ /**
2975
+ * Throws a `CanceledError` if cancellation has been requested.
2976
+ */
2977
+ throwIfRequested() {
2978
+ if (this.reason) {
2979
+ throw this.reason;
2980
+ }
2981
+ }
2982
+
2983
+ /**
2984
+ * Subscribe to the cancel signal
2985
+ */
2986
+
2987
+ subscribe(listener) {
2988
+ if (this.reason) {
2989
+ listener(this.reason);
2990
+ return;
2991
+ }
2992
+
2993
+ if (this._listeners) {
2994
+ this._listeners.push(listener);
2995
+ } else {
2996
+ this._listeners = [listener];
2997
+ }
2998
+ }
2999
+
3000
+ /**
3001
+ * Unsubscribe from the cancel signal
3002
+ */
3003
+
3004
+ unsubscribe(listener) {
3005
+ if (!this._listeners) {
3006
+ return;
3007
+ }
3008
+ const index = this._listeners.indexOf(listener);
3009
+ if (index !== -1) {
3010
+ this._listeners.splice(index, 1);
3011
+ }
3012
+ }
3013
+
3014
+ /**
3015
+ * Returns an object that contains a new `CancelToken` and a function that, when called,
3016
+ * cancels the `CancelToken`.
3017
+ */
3018
+ static source() {
3019
+ let cancel;
3020
+ const token = new CancelToken(function executor(c) {
3021
+ cancel = c;
3022
+ });
3023
+ return {
3024
+ token,
3025
+ cancel
3026
+ };
3027
+ }
3028
+ }
3029
+
3030
+ /**
3031
+ * Syntactic sugar for invoking a function and expanding an array for arguments.
3032
+ *
3033
+ * Common use case would be to use `Function.prototype.apply`.
3034
+ *
3035
+ * ```js
3036
+ * function f(x, y, z) {}
3037
+ * var args = [1, 2, 3];
3038
+ * f.apply(null, args);
3039
+ * ```
3040
+ *
3041
+ * With `spread` this example can be re-written.
3042
+ *
3043
+ * ```js
3044
+ * spread(function(x, y, z) {})([1, 2, 3]);
3045
+ * ```
3046
+ *
3047
+ * @param {Function} callback
3048
+ *
3049
+ * @returns {Function}
3050
+ */
3051
+ function spread(callback) {
3052
+ return function wrap(arr) {
3053
+ return callback.apply(null, arr);
3054
+ };
3055
+ }
3056
+
3057
+ /**
3058
+ * Determines whether the payload is an error thrown by Axios
3059
+ *
3060
+ * @param {*} payload The value to test
3061
+ *
3062
+ * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
3063
+ */
3064
+ function isAxiosError(payload) {
3065
+ return utils.isObject(payload) && (payload.isAxiosError === true);
3066
+ }
3067
+
3068
+ const HttpStatusCode = {
3069
+ Continue: 100,
3070
+ SwitchingProtocols: 101,
3071
+ Processing: 102,
3072
+ EarlyHints: 103,
3073
+ Ok: 200,
3074
+ Created: 201,
3075
+ Accepted: 202,
3076
+ NonAuthoritativeInformation: 203,
3077
+ NoContent: 204,
3078
+ ResetContent: 205,
3079
+ PartialContent: 206,
3080
+ MultiStatus: 207,
3081
+ AlreadyReported: 208,
3082
+ ImUsed: 226,
3083
+ MultipleChoices: 300,
3084
+ MovedPermanently: 301,
3085
+ Found: 302,
3086
+ SeeOther: 303,
3087
+ NotModified: 304,
3088
+ UseProxy: 305,
3089
+ Unused: 306,
3090
+ TemporaryRedirect: 307,
3091
+ PermanentRedirect: 308,
3092
+ BadRequest: 400,
3093
+ Unauthorized: 401,
3094
+ PaymentRequired: 402,
3095
+ Forbidden: 403,
3096
+ NotFound: 404,
3097
+ MethodNotAllowed: 405,
3098
+ NotAcceptable: 406,
3099
+ ProxyAuthenticationRequired: 407,
3100
+ RequestTimeout: 408,
3101
+ Conflict: 409,
3102
+ Gone: 410,
3103
+ LengthRequired: 411,
3104
+ PreconditionFailed: 412,
3105
+ PayloadTooLarge: 413,
3106
+ UriTooLong: 414,
3107
+ UnsupportedMediaType: 415,
3108
+ RangeNotSatisfiable: 416,
3109
+ ExpectationFailed: 417,
3110
+ ImATeapot: 418,
3111
+ MisdirectedRequest: 421,
3112
+ UnprocessableEntity: 422,
3113
+ Locked: 423,
3114
+ FailedDependency: 424,
3115
+ TooEarly: 425,
3116
+ UpgradeRequired: 426,
3117
+ PreconditionRequired: 428,
3118
+ TooManyRequests: 429,
3119
+ RequestHeaderFieldsTooLarge: 431,
3120
+ UnavailableForLegalReasons: 451,
3121
+ InternalServerError: 500,
3122
+ NotImplemented: 501,
3123
+ BadGateway: 502,
3124
+ ServiceUnavailable: 503,
3125
+ GatewayTimeout: 504,
3126
+ HttpVersionNotSupported: 505,
3127
+ VariantAlsoNegotiates: 506,
3128
+ InsufficientStorage: 507,
3129
+ LoopDetected: 508,
3130
+ NotExtended: 510,
3131
+ NetworkAuthenticationRequired: 511,
3132
+ };
3133
+
3134
+ Object.entries(HttpStatusCode).forEach(([key, value]) => {
3135
+ HttpStatusCode[value] = key;
3136
+ });
3137
+
3138
+ /**
3139
+ * Create an instance of Axios
3140
+ *
3141
+ * @param {Object} defaultConfig The default config for the instance
3142
+ *
3143
+ * @returns {Axios} A new instance of Axios
3144
+ */
3145
+ function createInstance(defaultConfig) {
3146
+ const context = new Axios(defaultConfig);
3147
+ const instance = bind(Axios.prototype.request, context);
3148
+
3149
+ // Copy axios.prototype to instance
3150
+ utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
3151
+
3152
+ // Copy context to instance
3153
+ utils.extend(instance, context, null, {allOwnKeys: true});
3154
+
3155
+ // Factory for creating new instances
3156
+ instance.create = function create(instanceConfig) {
3157
+ return createInstance(mergeConfig(defaultConfig, instanceConfig));
3158
+ };
3159
+
3160
+ return instance;
3161
+ }
3162
+
3163
+ // Create the default instance to be exported
3164
+ const axios = createInstance(defaults);
3165
+
3166
+ // Expose Axios class to allow class inheritance
3167
+ axios.Axios = Axios;
3168
+
3169
+ // Expose Cancel & CancelToken
3170
+ axios.CanceledError = CanceledError;
3171
+ axios.CancelToken = CancelToken;
3172
+ axios.isCancel = isCancel;
3173
+ axios.VERSION = VERSION;
3174
+ axios.toFormData = toFormData;
3175
+
3176
+ // Expose AxiosError class
3177
+ axios.AxiosError = AxiosError;
3178
+
3179
+ // alias for CanceledError for backward compatibility
3180
+ axios.Cancel = axios.CanceledError;
3181
+
3182
+ // Expose all/spread
3183
+ axios.all = function all(promises) {
3184
+ return Promise.all(promises);
3185
+ };
3186
+
3187
+ axios.spread = spread;
3188
+
3189
+ // Expose isAxiosError
3190
+ axios.isAxiosError = isAxiosError;
3191
+
3192
+ // Expose mergeConfig
3193
+ axios.mergeConfig = mergeConfig;
3194
+
3195
+ axios.AxiosHeaders = AxiosHeaders;
3196
+
3197
+ axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
3198
+
3199
+ axios.HttpStatusCode = HttpStatusCode;
3200
+
3201
+ axios.default = axios;
3202
+
3203
+ // This file provides a polyfill for managing globals in both NodeJS and browser environments. This is
3204
+ // an anti-pattern we'd hoped to avoid, but we have several projects dependending on one common library
3205
+ // (this js-sdk) and we want that library to provide a common endpoint to all callers (so authentication
3206
+ // tokens only need to be tracked in one place). The trouble is, one of those libraries is based on
3207
+ // StencilJS and is compiling its modules into Web Components. Because of how module resolution works,
3208
+ // when those Components load js-sdk they get a separate instance. Without messy options like having to
3209
+ // pass raw data from the caller to each Component, or pass around references to a common Endpoint, they
3210
+ // have no way to access authenticated sessions unless we make the Endpoint a true global.
3211
+ //
3212
+ // @credit https://github.com/medikoo/es5-ext/blob/master/global.js
3213
+ // @credit https://mathiasbynens.be/notes/globalthis
3214
+ var naiveFallback = function () {
3215
+ if (typeof self === 'object' && self)
3216
+ return self;
3217
+ if (typeof window === 'object' && window)
3218
+ return window;
3219
+ throw new Error('Unable to resolve global `this`');
3220
+ };
3221
+ var globalThis_1 = (function () {
3222
+ if (this)
3223
+ return this;
3224
+ // Unexpected strict mode (may happen if e.g. bundled into ESM module)
3225
+ // Fallback to standard globalThis if available
3226
+ if (typeof globalThis === 'object' && globalThis)
3227
+ return globalThis;
3228
+ // Thanks @mathiasbynens -> https://mathiasbynens.be/notes/globalthis
3229
+ // In all ES5+ engines global object inherits from Object.prototype
3230
+ // (if you approached one that doesn't please report)
3231
+ try {
3232
+ Object.defineProperty(Object.prototype, '__global__', {
3233
+ get: function () {
3234
+ return this;
3235
+ },
3236
+ configurable: true,
3237
+ });
3238
+ }
3239
+ catch (error) {
3240
+ // Unfortunate case of updates to Object.prototype being restricted
3241
+ // via preventExtensions, seal or freeze
3242
+ return naiveFallback();
3243
+ }
3244
+ try {
3245
+ // Safari case (window.__global__ works, but __global__ does not)
3246
+ if (!__global__)
3247
+ return naiveFallback();
3248
+ return __global__;
3249
+ }
3250
+ finally {
3251
+ delete Object.prototype.__global__;
3252
+ }
3253
+ })();
3254
+
3255
+ // @credit https://derickbailey.com/2016/03/09/creating-a-true-singleton-in-node-js-with-es6-symbols/
3256
+ // Also see globalThis for comments about why we're doing this in the first place.
3257
+ var ENDPOINT_KEY = Symbol.for('verdocs-default-endpoint');
3258
+ var requestLogger = function (r) {
3259
+ // tslint:disable-next-line
3260
+ console.debug("[JS-SDK] ".concat(r.method.toUpperCase(), " ").concat(r.baseURL).concat(r.url), r.data ? JSON.stringify(r.data) : '');
3261
+ return r;
3262
+ };
3263
+ /**
3264
+ * VerdocsEndpoint is a class wrapper for a specific connection and authorization context for calling the Verdocs APIs.
3265
+ * Endpoints can be used for isolated session tasks.
3266
+ *
3267
+ * For instance, ephemeral signing sessions may be created independently of a caller's status as an authenticated user.
3268
+ * In that case, an Endpoint can be created and authenticated, used for calls related to signing operations, then
3269
+ * discarded once signing is complete.
3270
+ *
3271
+ * Note that endpoint configuration functions return the instance, so they can be chained, e.g.
3272
+ *
3273
+ * ```typescript
3274
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3275
+ *
3276
+ * const endpoint = new VerdocsEndpoint();
3277
+ * endpoint
3278
+ * .setSessionType('signing')
3279
+ * .logRequests(true)
3280
+ * .setClientID('1234)
3281
+ * .setTimeout(5000);
3282
+ * ```
3283
+ */
3284
+ var VerdocsEndpoint = /** @class */ (function () {
3285
+ /**
3286
+ * Create a new VerdocsEndpoint to call Verdocs platform services.
3287
+ *
3288
+ * ```typescript
3289
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3290
+ * const endpoint = new VerdocsEndpoint();
3291
+ * ```
3292
+ */
3293
+ function VerdocsEndpoint(options) {
3294
+ this.environment = 'verdocs';
3295
+ this.sessionType = 'user';
3296
+ this.baseURL = 'https://api.verdocs.com';
3297
+ this.clientID = 'not-set';
3298
+ this.timeout = 3000;
3299
+ this.token = null;
3300
+ this.nextListenerId = 0;
3301
+ this.sessionListeners = new Map();
3302
+ this.requestLoggerId = null;
3303
+ /**
3304
+ * The current user session, or null if not authenticated. May be either a User or Signing session. If set, the
3305
+ * presence of the `document_id` field can be used to differentiate the types. Only signing sessions are associated
3306
+ * with Envelopes.
3307
+ */
3308
+ this.session = null;
3309
+ this.baseURL = (options === null || options === void 0 ? void 0 : options.baseURL) || 'https://api.verdocs.com';
3310
+ this.timeout = (options === null || options === void 0 ? void 0 : options.timeout) || 3000;
3311
+ this.environment = (options === null || options === void 0 ? void 0 : options.environment) || 'verdocs';
3312
+ this.sessionType = (options === null || options === void 0 ? void 0 : options.sessionType) || 'user';
3313
+ this.clientID = (options === null || options === void 0 ? void 0 : options.clientID) || 'not-set';
3314
+ this.api = axios.create({ baseURL: this.baseURL, timeout: this.timeout });
3315
+ }
3316
+ VerdocsEndpoint.prototype.setDefault = function () {
3317
+ globalThis_1[ENDPOINT_KEY] = this;
3318
+ };
3319
+ VerdocsEndpoint.getDefault = function () {
3320
+ if (!globalThis_1[ENDPOINT_KEY]) {
3321
+ globalThis_1[ENDPOINT_KEY] = new VerdocsEndpoint();
3322
+ window.console.debug('[JS_SDK] Created default endpoint', globalThis_1[ENDPOINT_KEY]);
3323
+ }
3324
+ return globalThis_1[ENDPOINT_KEY];
3325
+ };
3326
+ /**
3327
+ * Get the current environment.
3328
+ */
3329
+ VerdocsEndpoint.prototype.getEnvironment = function () {
3330
+ return this.environment;
3331
+ };
3332
+ /**
3333
+ * Get the current session type.
3334
+ */
3335
+ VerdocsEndpoint.prototype.getSessionType = function () {
3336
+ return this.sessionType;
3337
+ };
3338
+ /**
3339
+ * Get the current base URL. This should rarely be anything other than 'https://api.verdocs.com'.
3340
+ */
3341
+ VerdocsEndpoint.prototype.getBaseURL = function () {
3342
+ return this.baseURL;
3343
+ };
3344
+ /**
3345
+ * Get the current client ID, if set.
3346
+ */
3347
+ VerdocsEndpoint.prototype.getClientID = function () {
3348
+ return this.clientID;
3349
+ };
3350
+ /**
3351
+ * Get the current timeout.
3352
+ */
3353
+ VerdocsEndpoint.prototype.getTimeout = function () {
3354
+ return this.timeout;
3355
+ };
3356
+ /**
3357
+ * Get the current session, if any.
3358
+ */
3359
+ VerdocsEndpoint.prototype.getSession = function () {
3360
+ return this.session;
3361
+ };
3362
+ /**
3363
+ * Set the operating environment. This should rarely be anything other than 'verdocs'.
3364
+ *
3365
+ * ```typescript
3366
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3367
+ *
3368
+ * const endpoint = new VerdocsEndpoint();
3369
+ * endpoint.setEnvironment('verdocs-stage');
3370
+ * ```
3371
+ */
3372
+ VerdocsEndpoint.prototype.setEnvironment = function (environment) {
3373
+ this.environment = environment;
3374
+ return this;
3375
+ };
3376
+ /**
3377
+ * Set the session type. In general this should be done immediately when the endpoint is created. Changing the
3378
+ * session type may be done at any time, but may have unintended consequences if the endpoint is shared between
3379
+ * multiple widgets.
3380
+ *
3381
+ * Changing the session type will clear/reload the action session. This may trigger notifications to session state
3382
+ * observers. Apps that use observers to trigger UI updates such as logging the user out should be prepared to
3383
+ * handle this event.
3384
+ *
3385
+ * ```typescript
3386
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3387
+ *
3388
+ * const endpoint = new VerdocsEndpoint();
3389
+ * endpoint.setEnvironment('verdocs-stage');
3390
+ * ```
3391
+ */
3392
+ VerdocsEndpoint.prototype.setSessionType = function (sessionType) {
3393
+ this.sessionType = sessionType;
3394
+ return this;
3395
+ };
3396
+ /**
3397
+ * Set the base URL for API calls. Should be called only upon direction from Verdocs Customer Solutions Engineering.
3398
+ *
3399
+ * ```typescript
3400
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3401
+ *
3402
+ * const endpoint = new VerdocsEndpoint();
3403
+ * endpoint.setBaseURL('https://api.verdocs.com');
3404
+ * ```
3405
+ */
3406
+ VerdocsEndpoint.prototype.setBaseURL = function (url) {
3407
+ this.api.defaults.baseURL = url;
3408
+ return this;
3409
+ };
3410
+ /**
3411
+ * Set the Client ID for Verdocs API calls.
3412
+ *
3413
+ * ```typescript
3414
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3415
+ *
3416
+ * const endpoint = new VerdocsEndpoint();
3417
+ * endpoint.setClientID('1234);
3418
+ * ```
3419
+ */
3420
+ VerdocsEndpoint.prototype.setClientID = function (clientID) {
3421
+ this.clientID = clientID;
3422
+ this.api.defaults.headers.common['X-Client-ID'] = clientID;
3423
+ return this;
3424
+ };
3425
+ /**
3426
+ * Set the timeout for API calls in milliseconds. 2000-4000ms is recommended for most purposes. 3000ms is the default.
3427
+ *
3428
+ * ```typescript
3429
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3430
+ *
3431
+ * const endpoint = new VerdocsEndpoint();
3432
+ * endpoint.setTimeout(3000);
3433
+ * ```
3434
+ */
3435
+ VerdocsEndpoint.prototype.setTimeout = function (timeout) {
3436
+ this.timeout = timeout;
3437
+ this.api.defaults.timeout = timeout;
3438
+ return this;
3439
+ };
3440
+ /**
3441
+ * Enable or disable request logging. This may expose sensitive data in the console log, so it should only be used for debugging.
3442
+ *
3443
+ * ```typescript
3444
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3445
+ *
3446
+ * const endpoint = new VerdocsEndpoint();
3447
+ * endpoint.logRequests(true);
3448
+ * ```
3449
+ */
3450
+ VerdocsEndpoint.prototype.logRequests = function (enable) {
3451
+ if (enable && this.requestLoggerId === null) {
3452
+ this.requestLoggerId = this.api.interceptors.request.use(requestLogger);
3453
+ }
3454
+ else if (!enable && this.requestLoggerId !== null) {
3455
+ this.api.interceptors.request.eject(this.requestLoggerId);
3456
+ }
3457
+ return this;
3458
+ };
3459
+ /**
3460
+ * Set the authorization token that will be used for Verdocs API calls. This will also set the session metadata
3461
+ * and notify any listeners of the new data.
3462
+ *
3463
+ * If this Endpoint will be used for non-default purposes (e.g. signing, or in an alternate environment) those
3464
+ * settings should be made before calling this. Sessions are persisted to localStorage, and the environment and
3465
+ * type become part of the storage key.
3466
+ *
3467
+ * ```typescript
3468
+ * import {VerdocsEndpoint} from '@verdocs/js-sdk/HTTP';
3469
+ *
3470
+ * const endpoint = new VerdocsEndpoint();
3471
+ * endpoint.setToken(accessToken);
3472
+ * ```
3473
+ */
3474
+ VerdocsEndpoint.prototype.setToken = function (token) {
3475
+ if (!token) {
3476
+ return this.clearSession();
3477
+ }
3478
+ var session = decodeAccessTokenBody(token);
3479
+ if (session === null || (session.exp && session.exp * 1000 < new Date().getTime())) {
3480
+ window.console.warn('[JS_SDK] Ignoring attempt to use expired session token');
3481
+ return this.clearSession();
3482
+ }
3483
+ this.token = token;
3484
+ this.session = session;
3485
+ if (this.sessionType === 'user') {
3486
+ this.api.defaults.headers.common.Authorization = "Bearer ".concat(token);
3487
+ }
3488
+ else {
3489
+ this.api.defaults.headers.common.signer = "Bearer ".concat(token);
3490
+ }
3491
+ localStorage.setItem(this.sessionStorageKey(), token);
3492
+ this.notifySessionListeners();
3493
+ return this;
3494
+ };
3495
+ /**
3496
+ * Retrieves the current session token, if any. Tokens should rarely be used for direct actions, but this is
3497
+ * required by the `<VerdocsView>` and other components to authorize requests to raw PDF files.
3498
+ */
3499
+ VerdocsEndpoint.prototype.getToken = function () {
3500
+ return this.token;
3501
+ };
3502
+ VerdocsEndpoint.prototype.sessionStorageKey = function () {
3503
+ return "verdocs-session-".concat(this.getSessionType(), "-").concat(this.getEnvironment());
3504
+ };
3505
+ /**
3506
+ * Clear the active session.
3507
+ */
3508
+ VerdocsEndpoint.prototype.clearSession = function () {
3509
+ localStorage.removeItem(this.sessionStorageKey());
3510
+ delete this.api.defaults.headers.common.Authorization;
3511
+ delete this.api.defaults.headers.common.signer;
3512
+ this.session = null;
3513
+ this.token = null;
3514
+ this.notifySessionListeners();
3515
+ return this;
3516
+ };
3517
+ /**
3518
+ * Clear the active signing session.
3519
+ */
3520
+ VerdocsEndpoint.prototype.clearSignerSession = function () {
3521
+ localStorage.removeItem(this.sessionStorageKey());
3522
+ delete this.api.defaults.headers.common.Authorization;
3523
+ this.session = null;
3524
+ this.token = null;
3525
+ this.notifySessionListeners();
3526
+ return this;
3527
+ };
3528
+ VerdocsEndpoint.prototype.notifySessionListeners = function () {
3529
+ var _this = this;
3530
+ this.sessionListeners.forEach(function (listener) {
3531
+ try {
3532
+ listener(_this, _this.session);
3533
+ }
3534
+ catch (e) {
3535
+ // NOOP
3536
+ }
3537
+ });
3538
+ };
3539
+ /**
3540
+ * Subscribe to session state change events.
3541
+ */
3542
+ VerdocsEndpoint.prototype.onSessionChanged = function (listener) {
3543
+ var _this = this;
3544
+ // There's no value in randomizing this, a simple counter is fine
3545
+ this.nextListenerId++;
3546
+ var listenerSymbol = Symbol.for('' + this.nextListenerId);
3547
+ this.sessionListeners.set(listenerSymbol, listener);
3548
+ return function () {
3549
+ _this.sessionListeners.delete(listenerSymbol);
3550
+ };
3551
+ };
3552
+ /**
3553
+ * Load a persisted session from localStorage. Typically called once after the endpoint is configured when the app
3554
+ * or component starts.
3555
+ */
3556
+ VerdocsEndpoint.prototype.loadSession = function () {
3557
+ var token = localStorage.getItem(this.sessionStorageKey());
3558
+ if (!token) {
3559
+ return this.clearSession();
3560
+ }
3561
+ return this.setToken(token);
3562
+ };
3563
+ return VerdocsEndpoint;
3564
+ }());
3565
+
3566
+ exports.VerdocsEndpoint = VerdocsEndpoint;
3567
+ exports.decodeAccessTokenBody = decodeAccessTokenBody;
3568
+
3569
+ //# sourceMappingURL=VerdocsEndpoint-8c408e5b.js.map