@verdocs/web-sdk 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/dist/cjs/Auth-adc80bd4.js +68 -0
  2. package/dist/cjs/{Token-b86e5335.js → Token-1ec62bd3.js} +2 -135
  3. package/dist/{verdocs-web-sdk/buffer-es6-5cef4368.js → cjs/buffer-es6-bc8199b1.js} +47 -14
  4. package/dist/cjs/index-589f3be8.js +1356 -0
  5. package/dist/cjs/loader.cjs.js +3 -19
  6. package/dist/cjs/{index-9c6e5f50.js → popper-71bf3058.js} +0 -186
  7. package/dist/cjs/verdocs-auth.cjs.entry.js +7 -199
  8. package/dist/cjs/verdocs-button_2.cjs.entry.js +105 -0
  9. package/dist/cjs/{verdocs-view.cjs.entry.js → verdocs-dropdown_12.cjs.entry.js} +3313 -50
  10. package/dist/cjs/verdocs-initial-dialog.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-kba-dialog.cjs.entry.js +2 -2
  12. package/dist/cjs/verdocs-loader.cjs.entry.js +1 -1
  13. package/dist/cjs/verdocs-ok-dialog.cjs.entry.js +2 -2
  14. package/dist/cjs/verdocs-organization-card.cjs.entry.js +1 -1
  15. package/dist/cjs/verdocs-quick-functions.cjs.entry.js +2 -2
  16. package/dist/cjs/verdocs-search-activity_2.cjs.entry.js +228 -0
  17. package/dist/cjs/verdocs-search-tabs.cjs.entry.js +2 -2
  18. package/dist/cjs/verdocs-search.cjs.entry.js +1 -1
  19. package/dist/cjs/verdocs-sign.cjs.entry.js +3 -1511
  20. package/dist/cjs/verdocs-signature-dialog.cjs.entry.js +2 -2
  21. package/dist/cjs/verdocs-status-indicator.cjs.entry.js +4 -90
  22. package/dist/cjs/verdocs-template-card.cjs.entry.js +1 -1
  23. package/dist/cjs/verdocs-template-tags.cjs.entry.js +1 -1
  24. package/dist/cjs/verdocs-toggle.cjs.entry.js +1 -1
  25. package/dist/cjs/verdocs-upload-dialog.cjs.entry.js +2 -2
  26. package/dist/cjs/verdocs-web-sdk.cjs.js +5 -117
  27. package/dist/collection/collection-manifest.json +1 -1
  28. package/dist/collection/components/controls/verdocs-button/verdocs-button.css +1 -1
  29. package/dist/collection/components/dialogs/verdocs-kba-dialog/verdocs-kba-dialog.css +1 -1
  30. package/dist/collection/components/dialogs/verdocs-ok-dialog/verdocs-ok-dialog.css +2 -2
  31. package/dist/collection/components/dialogs/verdocs-signature-dialog/verdocs-signature-dialog.css +4 -4
  32. package/dist/collection/components/dialogs/verdocs-upload-dialog/verdocs-upload-dialog.css +2 -2
  33. package/dist/collection/components/elements/verdocs-field-attachment/verdocs-field-attachment.css +2 -4
  34. package/dist/collection/components/elements/verdocs-field-checkbox-group/verdocs-field-checkbox.css +1 -3
  35. package/dist/collection/components/elements/verdocs-field-date/verdocs-field-date.css +1 -3
  36. package/dist/collection/components/elements/verdocs-field-dropdown/verdocs-field-dropdown.css +1 -3
  37. package/dist/collection/components/elements/verdocs-field-initial/verdocs-field-initial.css +1 -3
  38. package/dist/collection/components/elements/verdocs-field-payment/verdocs-field-payment.css +1 -3
  39. package/dist/collection/components/elements/verdocs-field-radio-button-group/verdocs-field-radio-button.css +1 -3
  40. package/dist/collection/components/elements/verdocs-field-signature/verdocs-field-signature.css +1 -3
  41. package/dist/collection/components/elements/verdocs-field-textarea/verdocs-field-textarea.css +1 -3
  42. package/dist/collection/components/elements/verdocs-field-textbox/verdocs-field-textbox.css +1 -3
  43. package/dist/collection/components/elements/verdocs-quick-functions/verdocs-quick-functions.css +1 -3
  44. package/dist/collection/components/elements/verdocs-search-activity/verdocs-search-activity.css +1 -3
  45. package/dist/collection/components/elements/verdocs-search-box/verdocs-search-box.css +1 -3
  46. package/dist/collection/components/elements/verdocs-search-tabs/verdocs-search-tabs.css +1 -0
  47. package/dist/components/Auth.js +0 -93
  48. package/dist/components/Token.js +1 -134
  49. package/dist/components/buffer-es6.js +39 -14
  50. package/dist/components/index.js +0 -4
  51. package/dist/components/{index3.js → popper.js} +0 -186
  52. package/dist/components/verdocs-auth.js +2 -193
  53. package/dist/components/verdocs-button2.js +2 -2
  54. package/dist/components/verdocs-dropdown2.js +2 -2
  55. package/dist/components/verdocs-field-attachment2.js +2 -2
  56. package/dist/components/verdocs-field-checkbox2.js +2 -2
  57. package/dist/components/verdocs-field-date2.js +2 -214
  58. package/dist/components/verdocs-field-dropdown2.js +2 -2
  59. package/dist/components/verdocs-field-initial2.js +2 -2
  60. package/dist/components/verdocs-field-payment2.js +2 -2
  61. package/dist/components/verdocs-field-radio-button2.js +2 -2
  62. package/dist/components/verdocs-field-signature2.js +2 -2
  63. package/dist/components/verdocs-field-textarea2.js +2 -2
  64. package/dist/components/verdocs-field-textbox2.js +2 -2
  65. package/dist/components/verdocs-initial-dialog2.js +1 -1
  66. package/dist/components/verdocs-kba-dialog.js +2 -2
  67. package/dist/components/verdocs-loader2.js +1 -1
  68. package/dist/components/verdocs-ok-dialog2.js +2 -2
  69. package/dist/components/verdocs-organization-card.js +1 -1
  70. package/dist/components/verdocs-quick-functions.js +2 -2
  71. package/dist/components/verdocs-search-activity2.js +16 -104
  72. package/dist/components/verdocs-search-box2.js +2 -2
  73. package/dist/components/verdocs-search-tabs.js +2 -2
  74. package/dist/components/verdocs-search.js +1 -1
  75. package/dist/components/verdocs-sign.js +1 -1508
  76. package/dist/components/verdocs-signature-dialog2.js +2 -2
  77. package/dist/components/verdocs-status-indicator.js +3 -88
  78. package/dist/components/verdocs-template-card.js +1 -1
  79. package/dist/components/verdocs-template-tags.js +1 -1
  80. package/dist/components/verdocs-text-input2.js +1 -1
  81. package/dist/components/verdocs-toggle.js +1 -1
  82. package/dist/components/verdocs-upload-dialog2.js +2 -2
  83. package/dist/components/verdocs-view2.js +6 -33
  84. package/dist/docs.json +2 -2
  85. package/dist/esm/Auth-ff6040be.js +64 -0
  86. package/dist/{verdocs-web-sdk/Token-29eea56d.js → esm/Token-a587e3ad.js} +1 -134
  87. package/dist/{cjs/buffer-es6-b2c1c885.js → esm/buffer-es6-136673c8.js} +38 -15
  88. package/dist/esm/index-859bc689.js +1327 -0
  89. package/dist/esm/loader.js +3 -19
  90. package/dist/esm/{index-432c65a6.js → popper-93ecb064.js} +0 -186
  91. package/dist/esm/verdocs-auth.entry.js +4 -196
  92. package/dist/esm/verdocs-button_2.entry.js +100 -0
  93. package/dist/esm/{verdocs-view.entry.js → verdocs-dropdown_12.entry.js} +3286 -34
  94. package/dist/esm/verdocs-initial-dialog.entry.js +1 -1
  95. package/dist/esm/verdocs-kba-dialog.entry.js +2 -2
  96. package/dist/esm/verdocs-loader.entry.js +1 -1
  97. package/dist/esm/verdocs-ok-dialog.entry.js +2 -2
  98. package/dist/esm/verdocs-organization-card.entry.js +1 -1
  99. package/dist/esm/verdocs-quick-functions.entry.js +2 -2
  100. package/dist/esm/verdocs-search-activity_2.entry.js +223 -0
  101. package/dist/esm/verdocs-search-tabs.entry.js +2 -2
  102. package/dist/esm/verdocs-search.entry.js +1 -1
  103. package/dist/esm/verdocs-sign.entry.js +3 -1511
  104. package/dist/esm/verdocs-signature-dialog.entry.js +2 -2
  105. package/dist/esm/verdocs-status-indicator.entry.js +3 -89
  106. package/dist/esm/verdocs-template-card.entry.js +1 -1
  107. package/dist/esm/verdocs-template-tags.entry.js +1 -1
  108. package/dist/esm/verdocs-toggle.entry.js +1 -1
  109. package/dist/esm/verdocs-upload-dialog.entry.js +2 -2
  110. package/dist/esm/verdocs-web-sdk.js +5 -117
  111. package/dist/esm-es5/Auth-ff6040be.js +1 -0
  112. package/dist/esm-es5/Token-a587e3ad.js +1 -0
  113. package/dist/esm-es5/buffer-es6-136673c8.js +7 -0
  114. package/dist/esm-es5/index-859bc689.js +2 -0
  115. package/dist/esm-es5/loader.js +1 -1
  116. package/dist/esm-es5/popper-93ecb064.js +1 -0
  117. package/dist/esm-es5/verdocs-auth.entry.js +1 -1
  118. package/dist/esm-es5/verdocs-button_2.entry.js +1 -0
  119. package/dist/esm-es5/verdocs-dropdown_12.entry.js +23 -0
  120. package/dist/esm-es5/verdocs-initial-dialog.entry.js +1 -1
  121. package/dist/esm-es5/verdocs-kba-dialog.entry.js +1 -1
  122. package/dist/esm-es5/verdocs-loader.entry.js +1 -1
  123. package/dist/esm-es5/verdocs-ok-dialog.entry.js +1 -1
  124. package/dist/esm-es5/verdocs-organization-card.entry.js +1 -1
  125. package/dist/esm-es5/verdocs-quick-functions.entry.js +1 -1
  126. package/dist/esm-es5/verdocs-search-activity_2.entry.js +1 -0
  127. package/dist/esm-es5/verdocs-search-tabs.entry.js +1 -1
  128. package/dist/esm-es5/verdocs-search.entry.js +1 -1
  129. package/dist/esm-es5/verdocs-sign.entry.js +1 -1
  130. package/dist/esm-es5/verdocs-signature-dialog.entry.js +1 -1
  131. package/dist/esm-es5/verdocs-status-indicator.entry.js +1 -11
  132. package/dist/esm-es5/verdocs-template-card.entry.js +1 -1
  133. package/dist/esm-es5/verdocs-template-tags.entry.js +1 -1
  134. package/dist/esm-es5/verdocs-toggle.entry.js +1 -1
  135. package/dist/esm-es5/verdocs-upload-dialog.entry.js +1 -1
  136. package/dist/esm-es5/verdocs-web-sdk.js +1 -1
  137. package/dist/verdocs-web-sdk/index.esm.js +0 -1
  138. package/dist/verdocs-web-sdk/p-0353c423.entry.js +1 -0
  139. package/dist/verdocs-web-sdk/p-11bc03a5.js +1 -0
  140. package/dist/verdocs-web-sdk/p-144e0842.system.entry.js +1 -0
  141. package/dist/verdocs-web-sdk/p-15b7ed4d.entry.js +1 -0
  142. package/dist/verdocs-web-sdk/p-1f55d8ac.system.entry.js +1 -0
  143. package/dist/verdocs-web-sdk/p-2bc58746.js +2 -0
  144. package/dist/verdocs-web-sdk/p-34bb9854.system.entry.js +1 -0
  145. package/dist/verdocs-web-sdk/p-3d1eb63d.system.entry.js +1 -0
  146. package/dist/verdocs-web-sdk/p-3f437456.system.entry.js +1 -0
  147. package/dist/verdocs-web-sdk/p-432c3151.system.entry.js +1 -0
  148. package/dist/verdocs-web-sdk/p-466cf9bf.system.entry.js +1 -0
  149. package/dist/verdocs-web-sdk/p-4c66f794.js +1 -0
  150. package/dist/verdocs-web-sdk/{index.system.js → p-50ea2036.system.js} +0 -0
  151. package/dist/verdocs-web-sdk/p-5dfd73f9.system.js +7 -0
  152. package/dist/verdocs-web-sdk/p-6348272c.js +1 -0
  153. package/dist/verdocs-web-sdk/p-6393b2b4.entry.js +1 -0
  154. package/dist/verdocs-web-sdk/p-66b19637.entry.js +1 -0
  155. package/dist/verdocs-web-sdk/p-6802ef91.system.entry.js +1 -0
  156. package/dist/verdocs-web-sdk/p-6ac9e6f8.entry.js +1 -0
  157. package/dist/verdocs-web-sdk/p-6d65d54e.system.entry.js +1 -0
  158. package/dist/verdocs-web-sdk/p-6fa6fb3c.entry.js +1 -0
  159. package/dist/verdocs-web-sdk/p-829b235c.entry.js +1 -0
  160. package/dist/verdocs-web-sdk/p-8795dbe8.entry.js +1 -0
  161. package/dist/verdocs-web-sdk/p-88a300c5.system.js +1 -0
  162. package/dist/verdocs-web-sdk/p-8c6db319.entry.js +1 -0
  163. package/dist/verdocs-web-sdk/p-8c6e29a5.entry.js +1 -0
  164. package/dist/verdocs-web-sdk/p-92632d8e.system.entry.js +1 -0
  165. package/dist/verdocs-web-sdk/p-96c0bf40.system.js +1 -0
  166. package/dist/verdocs-web-sdk/p-98d72550.system.entry.js +23 -0
  167. package/dist/verdocs-web-sdk/p-9b34c794.entry.js +1 -0
  168. package/dist/verdocs-web-sdk/p-9fbb3fc2.entry.js +1 -0
  169. package/dist/verdocs-web-sdk/p-a1fcf0c4.entry.js +23 -0
  170. package/dist/verdocs-web-sdk/p-b1cd24f7.entry.js +1 -0
  171. package/dist/verdocs-web-sdk/p-bf2620cb.entry.js +1 -0
  172. package/dist/verdocs-web-sdk/p-c2f97ef9.system.entry.js +1 -0
  173. package/dist/verdocs-web-sdk/p-caed7818.system.js +2 -0
  174. package/dist/verdocs-web-sdk/p-cc127684.system.entry.js +1 -0
  175. package/dist/verdocs-web-sdk/p-cd6d1fe5.system.entry.js +1 -0
  176. package/dist/verdocs-web-sdk/p-d6206c17.system.entry.js +1 -0
  177. package/dist/verdocs-web-sdk/p-da667373.entry.js +1 -0
  178. package/dist/verdocs-web-sdk/p-e2e643c5.system.entry.js +1 -0
  179. package/dist/verdocs-web-sdk/p-e3659c64.system.js +1 -0
  180. package/dist/verdocs-web-sdk/p-e609b2ee.system.js +1 -0
  181. package/dist/verdocs-web-sdk/p-e719f9ca.system.entry.js +1 -0
  182. package/dist/verdocs-web-sdk/p-ed5baeb4.entry.js +1 -0
  183. package/dist/verdocs-web-sdk/p-ef932a87.js +1 -0
  184. package/dist/verdocs-web-sdk/p-f0d0f959.system.entry.js +1 -0
  185. package/dist/verdocs-web-sdk/p-f7e26fbd.entry.js +1 -0
  186. package/dist/verdocs-web-sdk/p-f814d5cc.system.entry.js +1 -0
  187. package/dist/verdocs-web-sdk/p-f9d431ef.entry.js +1 -0
  188. package/dist/verdocs-web-sdk/verdocs-web-sdk.css +1 -57
  189. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -129
  190. package/dist/verdocs-web-sdk/verdocs-web-sdk.js +2 -1
  191. package/package.json +4 -4
  192. package/dist/cjs/Auth-0146ddd8.js +0 -161
  193. package/dist/cjs/app-globals-3a1e7e63.js +0 -5
  194. package/dist/cjs/css-shim-e9231523.js +0 -6
  195. package/dist/cjs/dom-7fb93981.js +0 -75
  196. package/dist/cjs/index-a24f3b6a.js +0 -3096
  197. package/dist/cjs/index-b5a86b04.js +0 -4
  198. package/dist/cjs/index-c4be37e1.js +0 -54
  199. package/dist/cjs/shadow-css-abc19485.js +0 -389
  200. package/dist/cjs/verdocs-button.cjs.entry.js +0 -49
  201. package/dist/cjs/verdocs-dropdown.cjs.entry.js +0 -80
  202. package/dist/cjs/verdocs-field-attachment.cjs.entry.js +0 -59
  203. package/dist/cjs/verdocs-field-checkbox.cjs.entry.js +0 -39
  204. package/dist/cjs/verdocs-field-date.cjs.entry.js +0 -2968
  205. package/dist/cjs/verdocs-field-dropdown.cjs.entry.js +0 -59
  206. package/dist/cjs/verdocs-field-initial.cjs.entry.js +0 -52
  207. package/dist/cjs/verdocs-field-payment.cjs.entry.js +0 -86
  208. package/dist/cjs/verdocs-field-radio-button.cjs.entry.js +0 -48
  209. package/dist/cjs/verdocs-field-signature.cjs.entry.js +0 -52
  210. package/dist/cjs/verdocs-field-textarea.cjs.entry.js +0 -63
  211. package/dist/cjs/verdocs-field-textbox.cjs.entry.js +0 -63
  212. package/dist/cjs/verdocs-search-activity.cjs.entry.js +0 -263
  213. package/dist/cjs/verdocs-search-box.cjs.entry.js +0 -60
  214. package/dist/cjs/verdocs-text-input.cjs.entry.js +0 -62
  215. package/dist/components/index2.js +0 -1
  216. package/dist/components/index4.js +0 -47
  217. package/dist/custom-elements.json +0 -830
  218. package/dist/esm/Auth-4b21fced.js +0 -157
  219. package/dist/esm/Token-29eea56d.js +0 -2458
  220. package/dist/esm/app-globals-0f993ce5.js +0 -3
  221. package/dist/esm/buffer-es6-5cef4368.js +0 -1985
  222. package/dist/esm/css-shim-60f618b9.js +0 -4
  223. package/dist/esm/dom-4eeb3fee.js +0 -73
  224. package/dist/esm/index-97ec070b.js +0 -47
  225. package/dist/esm/index-ddbd60b5.js +0 -3059
  226. package/dist/esm/index-ef172650.js +0 -1
  227. package/dist/esm/shadow-css-02866686.js +0 -387
  228. package/dist/esm/verdocs-button.entry.js +0 -45
  229. package/dist/esm/verdocs-dropdown.entry.js +0 -76
  230. package/dist/esm/verdocs-field-attachment.entry.js +0 -55
  231. package/dist/esm/verdocs-field-checkbox.entry.js +0 -35
  232. package/dist/esm/verdocs-field-date.entry.js +0 -2964
  233. package/dist/esm/verdocs-field-dropdown.entry.js +0 -55
  234. package/dist/esm/verdocs-field-initial.entry.js +0 -48
  235. package/dist/esm/verdocs-field-payment.entry.js +0 -82
  236. package/dist/esm/verdocs-field-radio-button.entry.js +0 -44
  237. package/dist/esm/verdocs-field-signature.entry.js +0 -48
  238. package/dist/esm/verdocs-field-textarea.entry.js +0 -59
  239. package/dist/esm/verdocs-field-textbox.entry.js +0 -59
  240. package/dist/esm/verdocs-search-activity.entry.js +0 -259
  241. package/dist/esm/verdocs-search-box.entry.js +0 -56
  242. package/dist/esm/verdocs-text-input.entry.js +0 -58
  243. package/dist/esm-es5/Auth-4b21fced.js +0 -1
  244. package/dist/esm-es5/Token-29eea56d.js +0 -1
  245. package/dist/esm-es5/app-globals-0f993ce5.js +0 -1
  246. package/dist/esm-es5/buffer-es6-5cef4368.js +0 -7
  247. package/dist/esm-es5/css-shim-60f618b9.js +0 -1
  248. package/dist/esm-es5/dom-4eeb3fee.js +0 -21
  249. package/dist/esm-es5/index-432c65a6.js +0 -1
  250. package/dist/esm-es5/index-97ec070b.js +0 -1
  251. package/dist/esm-es5/index-ddbd60b5.js +0 -2
  252. package/dist/esm-es5/index-ef172650.js +0 -1
  253. package/dist/esm-es5/shadow-css-02866686.js +0 -12
  254. package/dist/esm-es5/verdocs-button.entry.js +0 -1
  255. package/dist/esm-es5/verdocs-dropdown.entry.js +0 -1
  256. package/dist/esm-es5/verdocs-field-attachment.entry.js +0 -1
  257. package/dist/esm-es5/verdocs-field-checkbox.entry.js +0 -1
  258. package/dist/esm-es5/verdocs-field-date.entry.js +0 -1
  259. package/dist/esm-es5/verdocs-field-dropdown.entry.js +0 -1
  260. package/dist/esm-es5/verdocs-field-initial.entry.js +0 -1
  261. package/dist/esm-es5/verdocs-field-payment.entry.js +0 -1
  262. package/dist/esm-es5/verdocs-field-radio-button.entry.js +0 -1
  263. package/dist/esm-es5/verdocs-field-signature.entry.js +0 -1
  264. package/dist/esm-es5/verdocs-field-textarea.entry.js +0 -1
  265. package/dist/esm-es5/verdocs-field-textbox.entry.js +0 -1
  266. package/dist/esm-es5/verdocs-search-activity.entry.js +0 -1
  267. package/dist/esm-es5/verdocs-search-box.entry.js +0 -1
  268. package/dist/esm-es5/verdocs-text-input.entry.js +0 -1
  269. package/dist/esm-es5/verdocs-view.entry.js +0 -23
  270. package/dist/verdocs-web-sdk/Auth-4b21fced.js +0 -157
  271. package/dist/verdocs-web-sdk/Auth-82e38539.system.js +0 -1
  272. package/dist/verdocs-web-sdk/Token-c1cf309e.system.js +0 -1
  273. package/dist/verdocs-web-sdk/app-globals-0f993ce5.js +0 -3
  274. package/dist/verdocs-web-sdk/app-globals-497eb362.system.js +0 -1
  275. package/dist/verdocs-web-sdk/buffer-es6-aa11181b.system.js +0 -7
  276. package/dist/verdocs-web-sdk/css-shim-60f618b9.js +0 -4
  277. package/dist/verdocs-web-sdk/css-shim-e41ceccc.system.js +0 -1
  278. package/dist/verdocs-web-sdk/dom-4eeb3fee.js +0 -73
  279. package/dist/verdocs-web-sdk/dom-89b5deb7.system.js +0 -21
  280. package/dist/verdocs-web-sdk/index-027b383e.system.js +0 -1
  281. package/dist/verdocs-web-sdk/index-06e036a1.system.js +0 -1
  282. package/dist/verdocs-web-sdk/index-432c65a6.js +0 -1974
  283. package/dist/verdocs-web-sdk/index-5d49316f.system.js +0 -1
  284. package/dist/verdocs-web-sdk/index-6465280a.system.js +0 -2
  285. package/dist/verdocs-web-sdk/index-97ec070b.js +0 -47
  286. package/dist/verdocs-web-sdk/index-ddbd60b5.js +0 -3059
  287. package/dist/verdocs-web-sdk/index-ef172650.js +0 -1
  288. package/dist/verdocs-web-sdk/shadow-css-02866686.js +0 -387
  289. package/dist/verdocs-web-sdk/shadow-css-6207e159.system.js +0 -13
  290. package/dist/verdocs-web-sdk/verdocs-auth.entry.js +0 -302
  291. package/dist/verdocs-web-sdk/verdocs-auth.system.entry.js +0 -1
  292. package/dist/verdocs-web-sdk/verdocs-button.entry.js +0 -45
  293. package/dist/verdocs-web-sdk/verdocs-button.system.entry.js +0 -1
  294. package/dist/verdocs-web-sdk/verdocs-dropdown.entry.js +0 -76
  295. package/dist/verdocs-web-sdk/verdocs-dropdown.system.entry.js +0 -1
  296. package/dist/verdocs-web-sdk/verdocs-field-attachment.entry.js +0 -55
  297. package/dist/verdocs-web-sdk/verdocs-field-attachment.system.entry.js +0 -1
  298. package/dist/verdocs-web-sdk/verdocs-field-checkbox.entry.js +0 -35
  299. package/dist/verdocs-web-sdk/verdocs-field-checkbox.system.entry.js +0 -1
  300. package/dist/verdocs-web-sdk/verdocs-field-date.entry.js +0 -2964
  301. package/dist/verdocs-web-sdk/verdocs-field-date.system.entry.js +0 -1
  302. package/dist/verdocs-web-sdk/verdocs-field-dropdown.entry.js +0 -55
  303. package/dist/verdocs-web-sdk/verdocs-field-dropdown.system.entry.js +0 -1
  304. package/dist/verdocs-web-sdk/verdocs-field-initial.entry.js +0 -48
  305. package/dist/verdocs-web-sdk/verdocs-field-initial.system.entry.js +0 -1
  306. package/dist/verdocs-web-sdk/verdocs-field-payment.entry.js +0 -82
  307. package/dist/verdocs-web-sdk/verdocs-field-payment.system.entry.js +0 -1
  308. package/dist/verdocs-web-sdk/verdocs-field-radio-button.entry.js +0 -44
  309. package/dist/verdocs-web-sdk/verdocs-field-radio-button.system.entry.js +0 -1
  310. package/dist/verdocs-web-sdk/verdocs-field-signature.entry.js +0 -48
  311. package/dist/verdocs-web-sdk/verdocs-field-signature.system.entry.js +0 -1
  312. package/dist/verdocs-web-sdk/verdocs-field-textarea.entry.js +0 -59
  313. package/dist/verdocs-web-sdk/verdocs-field-textarea.system.entry.js +0 -1
  314. package/dist/verdocs-web-sdk/verdocs-field-textbox.entry.js +0 -59
  315. package/dist/verdocs-web-sdk/verdocs-field-textbox.system.entry.js +0 -1
  316. package/dist/verdocs-web-sdk/verdocs-initial-dialog.entry.js +0 -239
  317. package/dist/verdocs-web-sdk/verdocs-initial-dialog.system.entry.js +0 -1
  318. package/dist/verdocs-web-sdk/verdocs-kba-dialog.entry.js +0 -77
  319. package/dist/verdocs-web-sdk/verdocs-kba-dialog.system.entry.js +0 -1
  320. package/dist/verdocs-web-sdk/verdocs-loader.entry.js +0 -15
  321. package/dist/verdocs-web-sdk/verdocs-loader.system.entry.js +0 -1
  322. package/dist/verdocs-web-sdk/verdocs-ok-dialog.entry.js +0 -44
  323. package/dist/verdocs-web-sdk/verdocs-ok-dialog.system.entry.js +0 -1
  324. package/dist/verdocs-web-sdk/verdocs-organization-card.entry.js +0 -18
  325. package/dist/verdocs-web-sdk/verdocs-organization-card.system.entry.js +0 -1
  326. package/dist/verdocs-web-sdk/verdocs-quick-functions.entry.js +0 -27
  327. package/dist/verdocs-web-sdk/verdocs-quick-functions.system.entry.js +0 -1
  328. package/dist/verdocs-web-sdk/verdocs-search-activity.entry.js +0 -259
  329. package/dist/verdocs-web-sdk/verdocs-search-activity.system.entry.js +0 -1
  330. package/dist/verdocs-web-sdk/verdocs-search-box.entry.js +0 -56
  331. package/dist/verdocs-web-sdk/verdocs-search-box.system.entry.js +0 -1
  332. package/dist/verdocs-web-sdk/verdocs-search-tabs.entry.js +0 -16
  333. package/dist/verdocs-web-sdk/verdocs-search-tabs.system.entry.js +0 -1
  334. package/dist/verdocs-web-sdk/verdocs-search.entry.js +0 -15
  335. package/dist/verdocs-web-sdk/verdocs-search.system.entry.js +0 -1
  336. package/dist/verdocs-web-sdk/verdocs-sign.entry.js +0 -1995
  337. package/dist/verdocs-web-sdk/verdocs-sign.system.entry.js +0 -1
  338. package/dist/verdocs-web-sdk/verdocs-signature-dialog.entry.js +0 -235
  339. package/dist/verdocs-web-sdk/verdocs-signature-dialog.system.entry.js +0 -1
  340. package/dist/verdocs-web-sdk/verdocs-status-indicator.entry.js +0 -7611
  341. package/dist/verdocs-web-sdk/verdocs-status-indicator.system.entry.js +0 -1
  342. package/dist/verdocs-web-sdk/verdocs-template-card.entry.js +0 -34
  343. package/dist/verdocs-web-sdk/verdocs-template-card.system.entry.js +0 -1
  344. package/dist/verdocs-web-sdk/verdocs-template-tags.entry.js +0 -16
  345. package/dist/verdocs-web-sdk/verdocs-template-tags.system.entry.js +0 -1
  346. package/dist/verdocs-web-sdk/verdocs-text-input.entry.js +0 -58
  347. package/dist/verdocs-web-sdk/verdocs-text-input.system.entry.js +0 -1
  348. package/dist/verdocs-web-sdk/verdocs-toggle.entry.js +0 -32
  349. package/dist/verdocs-web-sdk/verdocs-toggle.system.entry.js +0 -1
  350. package/dist/verdocs-web-sdk/verdocs-upload-dialog.entry.js +0 -119
  351. package/dist/verdocs-web-sdk/verdocs-upload-dialog.system.entry.js +0 -1
  352. package/dist/verdocs-web-sdk/verdocs-view.entry.js +0 -16118
  353. package/dist/verdocs-web-sdk/verdocs-view.system.entry.js +0 -23
  354. package/dist/verdocs-web-sdk/verdocs-web-sdk.system.js +0 -1
@@ -1,1985 +0,0 @@
1
- const global$1 = (typeof global !== "undefined" ? global :
2
- typeof self !== "undefined" ? self :
3
- typeof window !== "undefined" ? window : {});
4
-
5
- var lookup = [];
6
- var revLookup = [];
7
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
8
- var inited = false;
9
- function init () {
10
- inited = true;
11
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
12
- for (var i = 0, len = code.length; i < len; ++i) {
13
- lookup[i] = code[i];
14
- revLookup[code.charCodeAt(i)] = i;
15
- }
16
-
17
- revLookup['-'.charCodeAt(0)] = 62;
18
- revLookup['_'.charCodeAt(0)] = 63;
19
- }
20
-
21
- function toByteArray (b64) {
22
- if (!inited) {
23
- init();
24
- }
25
- var i, j, l, tmp, placeHolders, arr;
26
- var len = b64.length;
27
-
28
- if (len % 4 > 0) {
29
- throw new Error('Invalid string. Length must be a multiple of 4')
30
- }
31
-
32
- // the number of equal signs (place holders)
33
- // if there are two placeholders, than the two characters before it
34
- // represent one byte
35
- // if there is only one, then the three characters before it represent 2 bytes
36
- // this is just a cheap hack to not do indexOf twice
37
- placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
38
-
39
- // base64 is 4/3 + up to two characters of the original data
40
- arr = new Arr(len * 3 / 4 - placeHolders);
41
-
42
- // if there are placeholders, only get up to the last complete 4 chars
43
- l = placeHolders > 0 ? len - 4 : len;
44
-
45
- var L = 0;
46
-
47
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
48
- tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
49
- arr[L++] = (tmp >> 16) & 0xFF;
50
- arr[L++] = (tmp >> 8) & 0xFF;
51
- arr[L++] = tmp & 0xFF;
52
- }
53
-
54
- if (placeHolders === 2) {
55
- tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
56
- arr[L++] = tmp & 0xFF;
57
- } else if (placeHolders === 1) {
58
- tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
59
- arr[L++] = (tmp >> 8) & 0xFF;
60
- arr[L++] = tmp & 0xFF;
61
- }
62
-
63
- return arr
64
- }
65
-
66
- function tripletToBase64 (num) {
67
- return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
68
- }
69
-
70
- function encodeChunk (uint8, start, end) {
71
- var tmp;
72
- var output = [];
73
- for (var i = start; i < end; i += 3) {
74
- tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
75
- output.push(tripletToBase64(tmp));
76
- }
77
- return output.join('')
78
- }
79
-
80
- function fromByteArray (uint8) {
81
- if (!inited) {
82
- init();
83
- }
84
- var tmp;
85
- var len = uint8.length;
86
- var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
87
- var output = '';
88
- var parts = [];
89
- var maxChunkLength = 16383; // must be multiple of 3
90
-
91
- // go through the array every three bytes, we'll deal with trailing stuff later
92
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
93
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
94
- }
95
-
96
- // pad the end with zeros, but make sure to not forget the extra bytes
97
- if (extraBytes === 1) {
98
- tmp = uint8[len - 1];
99
- output += lookup[tmp >> 2];
100
- output += lookup[(tmp << 4) & 0x3F];
101
- output += '==';
102
- } else if (extraBytes === 2) {
103
- tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
104
- output += lookup[tmp >> 10];
105
- output += lookup[(tmp >> 4) & 0x3F];
106
- output += lookup[(tmp << 2) & 0x3F];
107
- output += '=';
108
- }
109
-
110
- parts.push(output);
111
-
112
- return parts.join('')
113
- }
114
-
115
- function read (buffer, offset, isLE, mLen, nBytes) {
116
- var e, m;
117
- var eLen = nBytes * 8 - mLen - 1;
118
- var eMax = (1 << eLen) - 1;
119
- var eBias = eMax >> 1;
120
- var nBits = -7;
121
- var i = isLE ? (nBytes - 1) : 0;
122
- var d = isLE ? -1 : 1;
123
- var s = buffer[offset + i];
124
-
125
- i += d;
126
-
127
- e = s & ((1 << (-nBits)) - 1);
128
- s >>= (-nBits);
129
- nBits += eLen;
130
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
131
-
132
- m = e & ((1 << (-nBits)) - 1);
133
- e >>= (-nBits);
134
- nBits += mLen;
135
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
136
-
137
- if (e === 0) {
138
- e = 1 - eBias;
139
- } else if (e === eMax) {
140
- return m ? NaN : ((s ? -1 : 1) * Infinity)
141
- } else {
142
- m = m + Math.pow(2, mLen);
143
- e = e - eBias;
144
- }
145
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
146
- }
147
-
148
- function write (buffer, value, offset, isLE, mLen, nBytes) {
149
- var e, m, c;
150
- var eLen = nBytes * 8 - mLen - 1;
151
- var eMax = (1 << eLen) - 1;
152
- var eBias = eMax >> 1;
153
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
154
- var i = isLE ? 0 : (nBytes - 1);
155
- var d = isLE ? 1 : -1;
156
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
157
-
158
- value = Math.abs(value);
159
-
160
- if (isNaN(value) || value === Infinity) {
161
- m = isNaN(value) ? 1 : 0;
162
- e = eMax;
163
- } else {
164
- e = Math.floor(Math.log(value) / Math.LN2);
165
- if (value * (c = Math.pow(2, -e)) < 1) {
166
- e--;
167
- c *= 2;
168
- }
169
- if (e + eBias >= 1) {
170
- value += rt / c;
171
- } else {
172
- value += rt * Math.pow(2, 1 - eBias);
173
- }
174
- if (value * c >= 2) {
175
- e++;
176
- c /= 2;
177
- }
178
-
179
- if (e + eBias >= eMax) {
180
- m = 0;
181
- e = eMax;
182
- } else if (e + eBias >= 1) {
183
- m = (value * c - 1) * Math.pow(2, mLen);
184
- e = e + eBias;
185
- } else {
186
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
187
- e = 0;
188
- }
189
- }
190
-
191
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
192
-
193
- e = (e << mLen) | m;
194
- eLen += mLen;
195
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
196
-
197
- buffer[offset + i - d] |= s * 128;
198
- }
199
-
200
- var toString = {}.toString;
201
-
202
- var isArray = Array.isArray || function (arr) {
203
- return toString.call(arr) == '[object Array]';
204
- };
205
-
206
- /*!
207
- * The buffer module from node.js, for the browser.
208
- *
209
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
210
- * @license MIT
211
- */
212
-
213
- var INSPECT_MAX_BYTES = 50;
214
-
215
- /**
216
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
217
- * === true Use Uint8Array implementation (fastest)
218
- * === false Use Object implementation (most compatible, even IE6)
219
- *
220
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
221
- * Opera 11.6+, iOS 4.2+.
222
- *
223
- * Due to various browser bugs, sometimes the Object implementation will be used even
224
- * when the browser supports typed arrays.
225
- *
226
- * Note:
227
- *
228
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
229
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
230
- *
231
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
232
- *
233
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
234
- * incorrect length in some situations.
235
-
236
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
237
- * get the Object implementation, which is slower but behaves correctly.
238
- */
239
- Buffer.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
240
- ? global$1.TYPED_ARRAY_SUPPORT
241
- : true;
242
-
243
- /*
244
- * Export kMaxLength after typed array support is determined.
245
- */
246
- var _kMaxLength = kMaxLength();
247
-
248
- function kMaxLength () {
249
- return Buffer.TYPED_ARRAY_SUPPORT
250
- ? 0x7fffffff
251
- : 0x3fffffff
252
- }
253
-
254
- function createBuffer (that, length) {
255
- if (kMaxLength() < length) {
256
- throw new RangeError('Invalid typed array length')
257
- }
258
- if (Buffer.TYPED_ARRAY_SUPPORT) {
259
- // Return an augmented `Uint8Array` instance, for best performance
260
- that = new Uint8Array(length);
261
- that.__proto__ = Buffer.prototype;
262
- } else {
263
- // Fallback: Return an object instance of the Buffer class
264
- if (that === null) {
265
- that = new Buffer(length);
266
- }
267
- that.length = length;
268
- }
269
-
270
- return that
271
- }
272
-
273
- /**
274
- * The Buffer constructor returns instances of `Uint8Array` that have their
275
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
276
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
277
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
278
- * returns a single octet.
279
- *
280
- * The `Uint8Array` prototype remains unmodified.
281
- */
282
-
283
- function Buffer (arg, encodingOrOffset, length) {
284
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
285
- return new Buffer(arg, encodingOrOffset, length)
286
- }
287
-
288
- // Common case.
289
- if (typeof arg === 'number') {
290
- if (typeof encodingOrOffset === 'string') {
291
- throw new Error(
292
- 'If encoding is specified then the first argument must be a string'
293
- )
294
- }
295
- return allocUnsafe(this, arg)
296
- }
297
- return from(this, arg, encodingOrOffset, length)
298
- }
299
-
300
- Buffer.poolSize = 8192; // not used by this implementation
301
-
302
- // TODO: Legacy, not needed anymore. Remove in next major version.
303
- Buffer._augment = function (arr) {
304
- arr.__proto__ = Buffer.prototype;
305
- return arr
306
- };
307
-
308
- function from (that, value, encodingOrOffset, length) {
309
- if (typeof value === 'number') {
310
- throw new TypeError('"value" argument must not be a number')
311
- }
312
-
313
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
314
- return fromArrayBuffer(that, value, encodingOrOffset, length)
315
- }
316
-
317
- if (typeof value === 'string') {
318
- return fromString(that, value, encodingOrOffset)
319
- }
320
-
321
- return fromObject(that, value)
322
- }
323
-
324
- /**
325
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
326
- * if value is a number.
327
- * Buffer.from(str[, encoding])
328
- * Buffer.from(array)
329
- * Buffer.from(buffer)
330
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
331
- **/
332
- Buffer.from = function (value, encodingOrOffset, length) {
333
- return from(null, value, encodingOrOffset, length)
334
- };
335
-
336
- if (Buffer.TYPED_ARRAY_SUPPORT) {
337
- Buffer.prototype.__proto__ = Uint8Array.prototype;
338
- Buffer.__proto__ = Uint8Array;
339
- }
340
-
341
- function assertSize (size) {
342
- if (typeof size !== 'number') {
343
- throw new TypeError('"size" argument must be a number')
344
- } else if (size < 0) {
345
- throw new RangeError('"size" argument must not be negative')
346
- }
347
- }
348
-
349
- function alloc (that, size, fill, encoding) {
350
- assertSize(size);
351
- if (size <= 0) {
352
- return createBuffer(that, size)
353
- }
354
- if (fill !== undefined) {
355
- // Only pay attention to encoding if it's a string. This
356
- // prevents accidentally sending in a number that would
357
- // be interpretted as a start offset.
358
- return typeof encoding === 'string'
359
- ? createBuffer(that, size).fill(fill, encoding)
360
- : createBuffer(that, size).fill(fill)
361
- }
362
- return createBuffer(that, size)
363
- }
364
-
365
- /**
366
- * Creates a new filled Buffer instance.
367
- * alloc(size[, fill[, encoding]])
368
- **/
369
- Buffer.alloc = function (size, fill, encoding) {
370
- return alloc(null, size, fill, encoding)
371
- };
372
-
373
- function allocUnsafe (that, size) {
374
- assertSize(size);
375
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
376
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
377
- for (var i = 0; i < size; ++i) {
378
- that[i] = 0;
379
- }
380
- }
381
- return that
382
- }
383
-
384
- /**
385
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
386
- * */
387
- Buffer.allocUnsafe = function (size) {
388
- return allocUnsafe(null, size)
389
- };
390
- /**
391
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
392
- */
393
- Buffer.allocUnsafeSlow = function (size) {
394
- return allocUnsafe(null, size)
395
- };
396
-
397
- function fromString (that, string, encoding) {
398
- if (typeof encoding !== 'string' || encoding === '') {
399
- encoding = 'utf8';
400
- }
401
-
402
- if (!Buffer.isEncoding(encoding)) {
403
- throw new TypeError('"encoding" must be a valid string encoding')
404
- }
405
-
406
- var length = byteLength(string, encoding) | 0;
407
- that = createBuffer(that, length);
408
-
409
- var actual = that.write(string, encoding);
410
-
411
- if (actual !== length) {
412
- // Writing a hex string, for example, that contains invalid characters will
413
- // cause everything after the first invalid character to be ignored. (e.g.
414
- // 'abxxcd' will be treated as 'ab')
415
- that = that.slice(0, actual);
416
- }
417
-
418
- return that
419
- }
420
-
421
- function fromArrayLike (that, array) {
422
- var length = array.length < 0 ? 0 : checked(array.length) | 0;
423
- that = createBuffer(that, length);
424
- for (var i = 0; i < length; i += 1) {
425
- that[i] = array[i] & 255;
426
- }
427
- return that
428
- }
429
-
430
- function fromArrayBuffer (that, array, byteOffset, length) {
431
- array.byteLength; // this throws if `array` is not a valid ArrayBuffer
432
-
433
- if (byteOffset < 0 || array.byteLength < byteOffset) {
434
- throw new RangeError('\'offset\' is out of bounds')
435
- }
436
-
437
- if (array.byteLength < byteOffset + (length || 0)) {
438
- throw new RangeError('\'length\' is out of bounds')
439
- }
440
-
441
- if (byteOffset === undefined && length === undefined) {
442
- array = new Uint8Array(array);
443
- } else if (length === undefined) {
444
- array = new Uint8Array(array, byteOffset);
445
- } else {
446
- array = new Uint8Array(array, byteOffset, length);
447
- }
448
-
449
- if (Buffer.TYPED_ARRAY_SUPPORT) {
450
- // Return an augmented `Uint8Array` instance, for best performance
451
- that = array;
452
- that.__proto__ = Buffer.prototype;
453
- } else {
454
- // Fallback: Return an object instance of the Buffer class
455
- that = fromArrayLike(that, array);
456
- }
457
- return that
458
- }
459
-
460
- function fromObject (that, obj) {
461
- if (internalIsBuffer(obj)) {
462
- var len = checked(obj.length) | 0;
463
- that = createBuffer(that, len);
464
-
465
- if (that.length === 0) {
466
- return that
467
- }
468
-
469
- obj.copy(that, 0, 0, len);
470
- return that
471
- }
472
-
473
- if (obj) {
474
- if ((typeof ArrayBuffer !== 'undefined' &&
475
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
476
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
477
- return createBuffer(that, 0)
478
- }
479
- return fromArrayLike(that, obj)
480
- }
481
-
482
- if (obj.type === 'Buffer' && isArray(obj.data)) {
483
- return fromArrayLike(that, obj.data)
484
- }
485
- }
486
-
487
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
488
- }
489
-
490
- function checked (length) {
491
- // Note: cannot use `length < kMaxLength()` here because that fails when
492
- // length is NaN (which is otherwise coerced to zero.)
493
- if (length >= kMaxLength()) {
494
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
495
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
496
- }
497
- return length | 0
498
- }
499
-
500
- function SlowBuffer (length) {
501
- if (+length != length) { // eslint-disable-line eqeqeq
502
- length = 0;
503
- }
504
- return Buffer.alloc(+length)
505
- }
506
- Buffer.isBuffer = isBuffer;
507
- function internalIsBuffer (b) {
508
- return !!(b != null && b._isBuffer)
509
- }
510
-
511
- Buffer.compare = function compare (a, b) {
512
- if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
513
- throw new TypeError('Arguments must be Buffers')
514
- }
515
-
516
- if (a === b) return 0
517
-
518
- var x = a.length;
519
- var y = b.length;
520
-
521
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
522
- if (a[i] !== b[i]) {
523
- x = a[i];
524
- y = b[i];
525
- break
526
- }
527
- }
528
-
529
- if (x < y) return -1
530
- if (y < x) return 1
531
- return 0
532
- };
533
-
534
- Buffer.isEncoding = function isEncoding (encoding) {
535
- switch (String(encoding).toLowerCase()) {
536
- case 'hex':
537
- case 'utf8':
538
- case 'utf-8':
539
- case 'ascii':
540
- case 'latin1':
541
- case 'binary':
542
- case 'base64':
543
- case 'ucs2':
544
- case 'ucs-2':
545
- case 'utf16le':
546
- case 'utf-16le':
547
- return true
548
- default:
549
- return false
550
- }
551
- };
552
-
553
- Buffer.concat = function concat (list, length) {
554
- if (!isArray(list)) {
555
- throw new TypeError('"list" argument must be an Array of Buffers')
556
- }
557
-
558
- if (list.length === 0) {
559
- return Buffer.alloc(0)
560
- }
561
-
562
- var i;
563
- if (length === undefined) {
564
- length = 0;
565
- for (i = 0; i < list.length; ++i) {
566
- length += list[i].length;
567
- }
568
- }
569
-
570
- var buffer = Buffer.allocUnsafe(length);
571
- var pos = 0;
572
- for (i = 0; i < list.length; ++i) {
573
- var buf = list[i];
574
- if (!internalIsBuffer(buf)) {
575
- throw new TypeError('"list" argument must be an Array of Buffers')
576
- }
577
- buf.copy(buffer, pos);
578
- pos += buf.length;
579
- }
580
- return buffer
581
- };
582
-
583
- function byteLength (string, encoding) {
584
- if (internalIsBuffer(string)) {
585
- return string.length
586
- }
587
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
588
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
589
- return string.byteLength
590
- }
591
- if (typeof string !== 'string') {
592
- string = '' + string;
593
- }
594
-
595
- var len = string.length;
596
- if (len === 0) return 0
597
-
598
- // Use a for loop to avoid recursion
599
- var loweredCase = false;
600
- for (;;) {
601
- switch (encoding) {
602
- case 'ascii':
603
- case 'latin1':
604
- case 'binary':
605
- return len
606
- case 'utf8':
607
- case 'utf-8':
608
- case undefined:
609
- return utf8ToBytes(string).length
610
- case 'ucs2':
611
- case 'ucs-2':
612
- case 'utf16le':
613
- case 'utf-16le':
614
- return len * 2
615
- case 'hex':
616
- return len >>> 1
617
- case 'base64':
618
- return base64ToBytes(string).length
619
- default:
620
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
621
- encoding = ('' + encoding).toLowerCase();
622
- loweredCase = true;
623
- }
624
- }
625
- }
626
- Buffer.byteLength = byteLength;
627
-
628
- function slowToString (encoding, start, end) {
629
- var loweredCase = false;
630
-
631
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
632
- // property of a typed array.
633
-
634
- // This behaves neither like String nor Uint8Array in that we set start/end
635
- // to their upper/lower bounds if the value passed is out of range.
636
- // undefined is handled specially as per ECMA-262 6th Edition,
637
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
638
- if (start === undefined || start < 0) {
639
- start = 0;
640
- }
641
- // Return early if start > this.length. Done here to prevent potential uint32
642
- // coercion fail below.
643
- if (start > this.length) {
644
- return ''
645
- }
646
-
647
- if (end === undefined || end > this.length) {
648
- end = this.length;
649
- }
650
-
651
- if (end <= 0) {
652
- return ''
653
- }
654
-
655
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
656
- end >>>= 0;
657
- start >>>= 0;
658
-
659
- if (end <= start) {
660
- return ''
661
- }
662
-
663
- if (!encoding) encoding = 'utf8';
664
-
665
- while (true) {
666
- switch (encoding) {
667
- case 'hex':
668
- return hexSlice(this, start, end)
669
-
670
- case 'utf8':
671
- case 'utf-8':
672
- return utf8Slice(this, start, end)
673
-
674
- case 'ascii':
675
- return asciiSlice(this, start, end)
676
-
677
- case 'latin1':
678
- case 'binary':
679
- return latin1Slice(this, start, end)
680
-
681
- case 'base64':
682
- return base64Slice(this, start, end)
683
-
684
- case 'ucs2':
685
- case 'ucs-2':
686
- case 'utf16le':
687
- case 'utf-16le':
688
- return utf16leSlice(this, start, end)
689
-
690
- default:
691
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
692
- encoding = (encoding + '').toLowerCase();
693
- loweredCase = true;
694
- }
695
- }
696
- }
697
-
698
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
699
- // Buffer instances.
700
- Buffer.prototype._isBuffer = true;
701
-
702
- function swap (b, n, m) {
703
- var i = b[n];
704
- b[n] = b[m];
705
- b[m] = i;
706
- }
707
-
708
- Buffer.prototype.swap16 = function swap16 () {
709
- var len = this.length;
710
- if (len % 2 !== 0) {
711
- throw new RangeError('Buffer size must be a multiple of 16-bits')
712
- }
713
- for (var i = 0; i < len; i += 2) {
714
- swap(this, i, i + 1);
715
- }
716
- return this
717
- };
718
-
719
- Buffer.prototype.swap32 = function swap32 () {
720
- var len = this.length;
721
- if (len % 4 !== 0) {
722
- throw new RangeError('Buffer size must be a multiple of 32-bits')
723
- }
724
- for (var i = 0; i < len; i += 4) {
725
- swap(this, i, i + 3);
726
- swap(this, i + 1, i + 2);
727
- }
728
- return this
729
- };
730
-
731
- Buffer.prototype.swap64 = function swap64 () {
732
- var len = this.length;
733
- if (len % 8 !== 0) {
734
- throw new RangeError('Buffer size must be a multiple of 64-bits')
735
- }
736
- for (var i = 0; i < len; i += 8) {
737
- swap(this, i, i + 7);
738
- swap(this, i + 1, i + 6);
739
- swap(this, i + 2, i + 5);
740
- swap(this, i + 3, i + 4);
741
- }
742
- return this
743
- };
744
-
745
- Buffer.prototype.toString = function toString () {
746
- var length = this.length | 0;
747
- if (length === 0) return ''
748
- if (arguments.length === 0) return utf8Slice(this, 0, length)
749
- return slowToString.apply(this, arguments)
750
- };
751
-
752
- Buffer.prototype.equals = function equals (b) {
753
- if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
754
- if (this === b) return true
755
- return Buffer.compare(this, b) === 0
756
- };
757
-
758
- Buffer.prototype.inspect = function inspect () {
759
- var str = '';
760
- var max = INSPECT_MAX_BYTES;
761
- if (this.length > 0) {
762
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
763
- if (this.length > max) str += ' ... ';
764
- }
765
- return '<Buffer ' + str + '>'
766
- };
767
-
768
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
769
- if (!internalIsBuffer(target)) {
770
- throw new TypeError('Argument must be a Buffer')
771
- }
772
-
773
- if (start === undefined) {
774
- start = 0;
775
- }
776
- if (end === undefined) {
777
- end = target ? target.length : 0;
778
- }
779
- if (thisStart === undefined) {
780
- thisStart = 0;
781
- }
782
- if (thisEnd === undefined) {
783
- thisEnd = this.length;
784
- }
785
-
786
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
787
- throw new RangeError('out of range index')
788
- }
789
-
790
- if (thisStart >= thisEnd && start >= end) {
791
- return 0
792
- }
793
- if (thisStart >= thisEnd) {
794
- return -1
795
- }
796
- if (start >= end) {
797
- return 1
798
- }
799
-
800
- start >>>= 0;
801
- end >>>= 0;
802
- thisStart >>>= 0;
803
- thisEnd >>>= 0;
804
-
805
- if (this === target) return 0
806
-
807
- var x = thisEnd - thisStart;
808
- var y = end - start;
809
- var len = Math.min(x, y);
810
-
811
- var thisCopy = this.slice(thisStart, thisEnd);
812
- var targetCopy = target.slice(start, end);
813
-
814
- for (var i = 0; i < len; ++i) {
815
- if (thisCopy[i] !== targetCopy[i]) {
816
- x = thisCopy[i];
817
- y = targetCopy[i];
818
- break
819
- }
820
- }
821
-
822
- if (x < y) return -1
823
- if (y < x) return 1
824
- return 0
825
- };
826
-
827
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
828
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
829
- //
830
- // Arguments:
831
- // - buffer - a Buffer to search
832
- // - val - a string, Buffer, or number
833
- // - byteOffset - an index into `buffer`; will be clamped to an int32
834
- // - encoding - an optional encoding, relevant is val is a string
835
- // - dir - true for indexOf, false for lastIndexOf
836
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
837
- // Empty buffer means no match
838
- if (buffer.length === 0) return -1
839
-
840
- // Normalize byteOffset
841
- if (typeof byteOffset === 'string') {
842
- encoding = byteOffset;
843
- byteOffset = 0;
844
- } else if (byteOffset > 0x7fffffff) {
845
- byteOffset = 0x7fffffff;
846
- } else if (byteOffset < -0x80000000) {
847
- byteOffset = -0x80000000;
848
- }
849
- byteOffset = +byteOffset; // Coerce to Number.
850
- if (isNaN(byteOffset)) {
851
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
852
- byteOffset = dir ? 0 : (buffer.length - 1);
853
- }
854
-
855
- // Normalize byteOffset: negative offsets start from the end of the buffer
856
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
857
- if (byteOffset >= buffer.length) {
858
- if (dir) return -1
859
- else byteOffset = buffer.length - 1;
860
- } else if (byteOffset < 0) {
861
- if (dir) byteOffset = 0;
862
- else return -1
863
- }
864
-
865
- // Normalize val
866
- if (typeof val === 'string') {
867
- val = Buffer.from(val, encoding);
868
- }
869
-
870
- // Finally, search either indexOf (if dir is true) or lastIndexOf
871
- if (internalIsBuffer(val)) {
872
- // Special case: looking for empty string/buffer always fails
873
- if (val.length === 0) {
874
- return -1
875
- }
876
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
877
- } else if (typeof val === 'number') {
878
- val = val & 0xFF; // Search for a byte value [0-255]
879
- if (Buffer.TYPED_ARRAY_SUPPORT &&
880
- typeof Uint8Array.prototype.indexOf === 'function') {
881
- if (dir) {
882
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
883
- } else {
884
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
885
- }
886
- }
887
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
888
- }
889
-
890
- throw new TypeError('val must be string, number or Buffer')
891
- }
892
-
893
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
894
- var indexSize = 1;
895
- var arrLength = arr.length;
896
- var valLength = val.length;
897
-
898
- if (encoding !== undefined) {
899
- encoding = String(encoding).toLowerCase();
900
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
901
- encoding === 'utf16le' || encoding === 'utf-16le') {
902
- if (arr.length < 2 || val.length < 2) {
903
- return -1
904
- }
905
- indexSize = 2;
906
- arrLength /= 2;
907
- valLength /= 2;
908
- byteOffset /= 2;
909
- }
910
- }
911
-
912
- function read (buf, i) {
913
- if (indexSize === 1) {
914
- return buf[i]
915
- } else {
916
- return buf.readUInt16BE(i * indexSize)
917
- }
918
- }
919
-
920
- var i;
921
- if (dir) {
922
- var foundIndex = -1;
923
- for (i = byteOffset; i < arrLength; i++) {
924
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
925
- if (foundIndex === -1) foundIndex = i;
926
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
927
- } else {
928
- if (foundIndex !== -1) i -= i - foundIndex;
929
- foundIndex = -1;
930
- }
931
- }
932
- } else {
933
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
934
- for (i = byteOffset; i >= 0; i--) {
935
- var found = true;
936
- for (var j = 0; j < valLength; j++) {
937
- if (read(arr, i + j) !== read(val, j)) {
938
- found = false;
939
- break
940
- }
941
- }
942
- if (found) return i
943
- }
944
- }
945
-
946
- return -1
947
- }
948
-
949
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
950
- return this.indexOf(val, byteOffset, encoding) !== -1
951
- };
952
-
953
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
954
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
955
- };
956
-
957
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
958
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
959
- };
960
-
961
- function hexWrite (buf, string, offset, length) {
962
- offset = Number(offset) || 0;
963
- var remaining = buf.length - offset;
964
- if (!length) {
965
- length = remaining;
966
- } else {
967
- length = Number(length);
968
- if (length > remaining) {
969
- length = remaining;
970
- }
971
- }
972
-
973
- // must be an even number of digits
974
- var strLen = string.length;
975
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
976
-
977
- if (length > strLen / 2) {
978
- length = strLen / 2;
979
- }
980
- for (var i = 0; i < length; ++i) {
981
- var parsed = parseInt(string.substr(i * 2, 2), 16);
982
- if (isNaN(parsed)) return i
983
- buf[offset + i] = parsed;
984
- }
985
- return i
986
- }
987
-
988
- function utf8Write (buf, string, offset, length) {
989
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
990
- }
991
-
992
- function asciiWrite (buf, string, offset, length) {
993
- return blitBuffer(asciiToBytes(string), buf, offset, length)
994
- }
995
-
996
- function latin1Write (buf, string, offset, length) {
997
- return asciiWrite(buf, string, offset, length)
998
- }
999
-
1000
- function base64Write (buf, string, offset, length) {
1001
- return blitBuffer(base64ToBytes(string), buf, offset, length)
1002
- }
1003
-
1004
- function ucs2Write (buf, string, offset, length) {
1005
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
1006
- }
1007
-
1008
- Buffer.prototype.write = function write (string, offset, length, encoding) {
1009
- // Buffer#write(string)
1010
- if (offset === undefined) {
1011
- encoding = 'utf8';
1012
- length = this.length;
1013
- offset = 0;
1014
- // Buffer#write(string, encoding)
1015
- } else if (length === undefined && typeof offset === 'string') {
1016
- encoding = offset;
1017
- length = this.length;
1018
- offset = 0;
1019
- // Buffer#write(string, offset[, length][, encoding])
1020
- } else if (isFinite(offset)) {
1021
- offset = offset | 0;
1022
- if (isFinite(length)) {
1023
- length = length | 0;
1024
- if (encoding === undefined) encoding = 'utf8';
1025
- } else {
1026
- encoding = length;
1027
- length = undefined;
1028
- }
1029
- // legacy write(string, encoding, offset, length) - remove in v0.13
1030
- } else {
1031
- throw new Error(
1032
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
1033
- )
1034
- }
1035
-
1036
- var remaining = this.length - offset;
1037
- if (length === undefined || length > remaining) length = remaining;
1038
-
1039
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
1040
- throw new RangeError('Attempt to write outside buffer bounds')
1041
- }
1042
-
1043
- if (!encoding) encoding = 'utf8';
1044
-
1045
- var loweredCase = false;
1046
- for (;;) {
1047
- switch (encoding) {
1048
- case 'hex':
1049
- return hexWrite(this, string, offset, length)
1050
-
1051
- case 'utf8':
1052
- case 'utf-8':
1053
- return utf8Write(this, string, offset, length)
1054
-
1055
- case 'ascii':
1056
- return asciiWrite(this, string, offset, length)
1057
-
1058
- case 'latin1':
1059
- case 'binary':
1060
- return latin1Write(this, string, offset, length)
1061
-
1062
- case 'base64':
1063
- // Warning: maxLength not taken into account in base64Write
1064
- return base64Write(this, string, offset, length)
1065
-
1066
- case 'ucs2':
1067
- case 'ucs-2':
1068
- case 'utf16le':
1069
- case 'utf-16le':
1070
- return ucs2Write(this, string, offset, length)
1071
-
1072
- default:
1073
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1074
- encoding = ('' + encoding).toLowerCase();
1075
- loweredCase = true;
1076
- }
1077
- }
1078
- };
1079
-
1080
- Buffer.prototype.toJSON = function toJSON () {
1081
- return {
1082
- type: 'Buffer',
1083
- data: Array.prototype.slice.call(this._arr || this, 0)
1084
- }
1085
- };
1086
-
1087
- function base64Slice (buf, start, end) {
1088
- if (start === 0 && end === buf.length) {
1089
- return fromByteArray(buf)
1090
- } else {
1091
- return fromByteArray(buf.slice(start, end))
1092
- }
1093
- }
1094
-
1095
- function utf8Slice (buf, start, end) {
1096
- end = Math.min(buf.length, end);
1097
- var res = [];
1098
-
1099
- var i = start;
1100
- while (i < end) {
1101
- var firstByte = buf[i];
1102
- var codePoint = null;
1103
- var bytesPerSequence = (firstByte > 0xEF) ? 4
1104
- : (firstByte > 0xDF) ? 3
1105
- : (firstByte > 0xBF) ? 2
1106
- : 1;
1107
-
1108
- if (i + bytesPerSequence <= end) {
1109
- var secondByte, thirdByte, fourthByte, tempCodePoint;
1110
-
1111
- switch (bytesPerSequence) {
1112
- case 1:
1113
- if (firstByte < 0x80) {
1114
- codePoint = firstByte;
1115
- }
1116
- break
1117
- case 2:
1118
- secondByte = buf[i + 1];
1119
- if ((secondByte & 0xC0) === 0x80) {
1120
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
1121
- if (tempCodePoint > 0x7F) {
1122
- codePoint = tempCodePoint;
1123
- }
1124
- }
1125
- break
1126
- case 3:
1127
- secondByte = buf[i + 1];
1128
- thirdByte = buf[i + 2];
1129
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
1130
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
1131
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
1132
- codePoint = tempCodePoint;
1133
- }
1134
- }
1135
- break
1136
- case 4:
1137
- secondByte = buf[i + 1];
1138
- thirdByte = buf[i + 2];
1139
- fourthByte = buf[i + 3];
1140
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
1141
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
1142
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
1143
- codePoint = tempCodePoint;
1144
- }
1145
- }
1146
- }
1147
- }
1148
-
1149
- if (codePoint === null) {
1150
- // we did not generate a valid codePoint so insert a
1151
- // replacement char (U+FFFD) and advance only 1 byte
1152
- codePoint = 0xFFFD;
1153
- bytesPerSequence = 1;
1154
- } else if (codePoint > 0xFFFF) {
1155
- // encode to utf16 (surrogate pair dance)
1156
- codePoint -= 0x10000;
1157
- res.push(codePoint >>> 10 & 0x3FF | 0xD800);
1158
- codePoint = 0xDC00 | codePoint & 0x3FF;
1159
- }
1160
-
1161
- res.push(codePoint);
1162
- i += bytesPerSequence;
1163
- }
1164
-
1165
- return decodeCodePointsArray(res)
1166
- }
1167
-
1168
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1169
- // the lowest limit is Chrome, with 0x10000 args.
1170
- // We go 1 magnitude less, for safety
1171
- var MAX_ARGUMENTS_LENGTH = 0x1000;
1172
-
1173
- function decodeCodePointsArray (codePoints) {
1174
- var len = codePoints.length;
1175
- if (len <= MAX_ARGUMENTS_LENGTH) {
1176
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
1177
- }
1178
-
1179
- // Decode in chunks to avoid "call stack size exceeded".
1180
- var res = '';
1181
- var i = 0;
1182
- while (i < len) {
1183
- res += String.fromCharCode.apply(
1184
- String,
1185
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1186
- );
1187
- }
1188
- return res
1189
- }
1190
-
1191
- function asciiSlice (buf, start, end) {
1192
- var ret = '';
1193
- end = Math.min(buf.length, end);
1194
-
1195
- for (var i = start; i < end; ++i) {
1196
- ret += String.fromCharCode(buf[i] & 0x7F);
1197
- }
1198
- return ret
1199
- }
1200
-
1201
- function latin1Slice (buf, start, end) {
1202
- var ret = '';
1203
- end = Math.min(buf.length, end);
1204
-
1205
- for (var i = start; i < end; ++i) {
1206
- ret += String.fromCharCode(buf[i]);
1207
- }
1208
- return ret
1209
- }
1210
-
1211
- function hexSlice (buf, start, end) {
1212
- var len = buf.length;
1213
-
1214
- if (!start || start < 0) start = 0;
1215
- if (!end || end < 0 || end > len) end = len;
1216
-
1217
- var out = '';
1218
- for (var i = start; i < end; ++i) {
1219
- out += toHex(buf[i]);
1220
- }
1221
- return out
1222
- }
1223
-
1224
- function utf16leSlice (buf, start, end) {
1225
- var bytes = buf.slice(start, end);
1226
- var res = '';
1227
- for (var i = 0; i < bytes.length; i += 2) {
1228
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1229
- }
1230
- return res
1231
- }
1232
-
1233
- Buffer.prototype.slice = function slice (start, end) {
1234
- var len = this.length;
1235
- start = ~~start;
1236
- end = end === undefined ? len : ~~end;
1237
-
1238
- if (start < 0) {
1239
- start += len;
1240
- if (start < 0) start = 0;
1241
- } else if (start > len) {
1242
- start = len;
1243
- }
1244
-
1245
- if (end < 0) {
1246
- end += len;
1247
- if (end < 0) end = 0;
1248
- } else if (end > len) {
1249
- end = len;
1250
- }
1251
-
1252
- if (end < start) end = start;
1253
-
1254
- var newBuf;
1255
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1256
- newBuf = this.subarray(start, end);
1257
- newBuf.__proto__ = Buffer.prototype;
1258
- } else {
1259
- var sliceLen = end - start;
1260
- newBuf = new Buffer(sliceLen, undefined);
1261
- for (var i = 0; i < sliceLen; ++i) {
1262
- newBuf[i] = this[i + start];
1263
- }
1264
- }
1265
-
1266
- return newBuf
1267
- };
1268
-
1269
- /*
1270
- * Need to make sure that buffer isn't trying to write out of bounds.
1271
- */
1272
- function checkOffset (offset, ext, length) {
1273
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
1274
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
1275
- }
1276
-
1277
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
1278
- offset = offset | 0;
1279
- byteLength = byteLength | 0;
1280
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1281
-
1282
- var val = this[offset];
1283
- var mul = 1;
1284
- var i = 0;
1285
- while (++i < byteLength && (mul *= 0x100)) {
1286
- val += this[offset + i] * mul;
1287
- }
1288
-
1289
- return val
1290
- };
1291
-
1292
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
1293
- offset = offset | 0;
1294
- byteLength = byteLength | 0;
1295
- if (!noAssert) {
1296
- checkOffset(offset, byteLength, this.length);
1297
- }
1298
-
1299
- var val = this[offset + --byteLength];
1300
- var mul = 1;
1301
- while (byteLength > 0 && (mul *= 0x100)) {
1302
- val += this[offset + --byteLength] * mul;
1303
- }
1304
-
1305
- return val
1306
- };
1307
-
1308
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
1309
- if (!noAssert) checkOffset(offset, 1, this.length);
1310
- return this[offset]
1311
- };
1312
-
1313
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
1314
- if (!noAssert) checkOffset(offset, 2, this.length);
1315
- return this[offset] | (this[offset + 1] << 8)
1316
- };
1317
-
1318
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
1319
- if (!noAssert) checkOffset(offset, 2, this.length);
1320
- return (this[offset] << 8) | this[offset + 1]
1321
- };
1322
-
1323
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
1324
- if (!noAssert) checkOffset(offset, 4, this.length);
1325
-
1326
- return ((this[offset]) |
1327
- (this[offset + 1] << 8) |
1328
- (this[offset + 2] << 16)) +
1329
- (this[offset + 3] * 0x1000000)
1330
- };
1331
-
1332
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
1333
- if (!noAssert) checkOffset(offset, 4, this.length);
1334
-
1335
- return (this[offset] * 0x1000000) +
1336
- ((this[offset + 1] << 16) |
1337
- (this[offset + 2] << 8) |
1338
- this[offset + 3])
1339
- };
1340
-
1341
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
1342
- offset = offset | 0;
1343
- byteLength = byteLength | 0;
1344
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1345
-
1346
- var val = this[offset];
1347
- var mul = 1;
1348
- var i = 0;
1349
- while (++i < byteLength && (mul *= 0x100)) {
1350
- val += this[offset + i] * mul;
1351
- }
1352
- mul *= 0x80;
1353
-
1354
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1355
-
1356
- return val
1357
- };
1358
-
1359
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
1360
- offset = offset | 0;
1361
- byteLength = byteLength | 0;
1362
- if (!noAssert) checkOffset(offset, byteLength, this.length);
1363
-
1364
- var i = byteLength;
1365
- var mul = 1;
1366
- var val = this[offset + --i];
1367
- while (i > 0 && (mul *= 0x100)) {
1368
- val += this[offset + --i] * mul;
1369
- }
1370
- mul *= 0x80;
1371
-
1372
- if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1373
-
1374
- return val
1375
- };
1376
-
1377
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
1378
- if (!noAssert) checkOffset(offset, 1, this.length);
1379
- if (!(this[offset] & 0x80)) return (this[offset])
1380
- return ((0xff - this[offset] + 1) * -1)
1381
- };
1382
-
1383
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
1384
- if (!noAssert) checkOffset(offset, 2, this.length);
1385
- var val = this[offset] | (this[offset + 1] << 8);
1386
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1387
- };
1388
-
1389
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
1390
- if (!noAssert) checkOffset(offset, 2, this.length);
1391
- var val = this[offset + 1] | (this[offset] << 8);
1392
- return (val & 0x8000) ? val | 0xFFFF0000 : val
1393
- };
1394
-
1395
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
1396
- if (!noAssert) checkOffset(offset, 4, this.length);
1397
-
1398
- return (this[offset]) |
1399
- (this[offset + 1] << 8) |
1400
- (this[offset + 2] << 16) |
1401
- (this[offset + 3] << 24)
1402
- };
1403
-
1404
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
1405
- if (!noAssert) checkOffset(offset, 4, this.length);
1406
-
1407
- return (this[offset] << 24) |
1408
- (this[offset + 1] << 16) |
1409
- (this[offset + 2] << 8) |
1410
- (this[offset + 3])
1411
- };
1412
-
1413
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
1414
- if (!noAssert) checkOffset(offset, 4, this.length);
1415
- return read(this, offset, true, 23, 4)
1416
- };
1417
-
1418
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
1419
- if (!noAssert) checkOffset(offset, 4, this.length);
1420
- return read(this, offset, false, 23, 4)
1421
- };
1422
-
1423
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
1424
- if (!noAssert) checkOffset(offset, 8, this.length);
1425
- return read(this, offset, true, 52, 8)
1426
- };
1427
-
1428
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
1429
- if (!noAssert) checkOffset(offset, 8, this.length);
1430
- return read(this, offset, false, 52, 8)
1431
- };
1432
-
1433
- function checkInt (buf, value, offset, ext, max, min) {
1434
- if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
1435
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
1436
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1437
- }
1438
-
1439
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
1440
- value = +value;
1441
- offset = offset | 0;
1442
- byteLength = byteLength | 0;
1443
- if (!noAssert) {
1444
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1445
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1446
- }
1447
-
1448
- var mul = 1;
1449
- var i = 0;
1450
- this[offset] = value & 0xFF;
1451
- while (++i < byteLength && (mul *= 0x100)) {
1452
- this[offset + i] = (value / mul) & 0xFF;
1453
- }
1454
-
1455
- return offset + byteLength
1456
- };
1457
-
1458
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
1459
- value = +value;
1460
- offset = offset | 0;
1461
- byteLength = byteLength | 0;
1462
- if (!noAssert) {
1463
- var maxBytes = Math.pow(2, 8 * byteLength) - 1;
1464
- checkInt(this, value, offset, byteLength, maxBytes, 0);
1465
- }
1466
-
1467
- var i = byteLength - 1;
1468
- var mul = 1;
1469
- this[offset + i] = value & 0xFF;
1470
- while (--i >= 0 && (mul *= 0x100)) {
1471
- this[offset + i] = (value / mul) & 0xFF;
1472
- }
1473
-
1474
- return offset + byteLength
1475
- };
1476
-
1477
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
1478
- value = +value;
1479
- offset = offset | 0;
1480
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
1481
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1482
- this[offset] = (value & 0xff);
1483
- return offset + 1
1484
- };
1485
-
1486
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
1487
- if (value < 0) value = 0xffff + value + 1;
1488
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
1489
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
1490
- (littleEndian ? i : 1 - i) * 8;
1491
- }
1492
- }
1493
-
1494
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
1495
- value = +value;
1496
- offset = offset | 0;
1497
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1498
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1499
- this[offset] = (value & 0xff);
1500
- this[offset + 1] = (value >>> 8);
1501
- } else {
1502
- objectWriteUInt16(this, value, offset, true);
1503
- }
1504
- return offset + 2
1505
- };
1506
-
1507
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
1508
- value = +value;
1509
- offset = offset | 0;
1510
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
1511
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1512
- this[offset] = (value >>> 8);
1513
- this[offset + 1] = (value & 0xff);
1514
- } else {
1515
- objectWriteUInt16(this, value, offset, false);
1516
- }
1517
- return offset + 2
1518
- };
1519
-
1520
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
1521
- if (value < 0) value = 0xffffffff + value + 1;
1522
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
1523
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
1524
- }
1525
- }
1526
-
1527
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
1528
- value = +value;
1529
- offset = offset | 0;
1530
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1531
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1532
- this[offset + 3] = (value >>> 24);
1533
- this[offset + 2] = (value >>> 16);
1534
- this[offset + 1] = (value >>> 8);
1535
- this[offset] = (value & 0xff);
1536
- } else {
1537
- objectWriteUInt32(this, value, offset, true);
1538
- }
1539
- return offset + 4
1540
- };
1541
-
1542
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
1543
- value = +value;
1544
- offset = offset | 0;
1545
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
1546
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1547
- this[offset] = (value >>> 24);
1548
- this[offset + 1] = (value >>> 16);
1549
- this[offset + 2] = (value >>> 8);
1550
- this[offset + 3] = (value & 0xff);
1551
- } else {
1552
- objectWriteUInt32(this, value, offset, false);
1553
- }
1554
- return offset + 4
1555
- };
1556
-
1557
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
1558
- value = +value;
1559
- offset = offset | 0;
1560
- if (!noAssert) {
1561
- var limit = Math.pow(2, 8 * byteLength - 1);
1562
-
1563
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1564
- }
1565
-
1566
- var i = 0;
1567
- var mul = 1;
1568
- var sub = 0;
1569
- this[offset] = value & 0xFF;
1570
- while (++i < byteLength && (mul *= 0x100)) {
1571
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1572
- sub = 1;
1573
- }
1574
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1575
- }
1576
-
1577
- return offset + byteLength
1578
- };
1579
-
1580
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
1581
- value = +value;
1582
- offset = offset | 0;
1583
- if (!noAssert) {
1584
- var limit = Math.pow(2, 8 * byteLength - 1);
1585
-
1586
- checkInt(this, value, offset, byteLength, limit - 1, -limit);
1587
- }
1588
-
1589
- var i = byteLength - 1;
1590
- var mul = 1;
1591
- var sub = 0;
1592
- this[offset + i] = value & 0xFF;
1593
- while (--i >= 0 && (mul *= 0x100)) {
1594
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1595
- sub = 1;
1596
- }
1597
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
1598
- }
1599
-
1600
- return offset + byteLength
1601
- };
1602
-
1603
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
1604
- value = +value;
1605
- offset = offset | 0;
1606
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
1607
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
1608
- if (value < 0) value = 0xff + value + 1;
1609
- this[offset] = (value & 0xff);
1610
- return offset + 1
1611
- };
1612
-
1613
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
1614
- value = +value;
1615
- offset = offset | 0;
1616
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1617
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1618
- this[offset] = (value & 0xff);
1619
- this[offset + 1] = (value >>> 8);
1620
- } else {
1621
- objectWriteUInt16(this, value, offset, true);
1622
- }
1623
- return offset + 2
1624
- };
1625
-
1626
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
1627
- value = +value;
1628
- offset = offset | 0;
1629
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
1630
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1631
- this[offset] = (value >>> 8);
1632
- this[offset + 1] = (value & 0xff);
1633
- } else {
1634
- objectWriteUInt16(this, value, offset, false);
1635
- }
1636
- return offset + 2
1637
- };
1638
-
1639
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
1640
- value = +value;
1641
- offset = offset | 0;
1642
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1643
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1644
- this[offset] = (value & 0xff);
1645
- this[offset + 1] = (value >>> 8);
1646
- this[offset + 2] = (value >>> 16);
1647
- this[offset + 3] = (value >>> 24);
1648
- } else {
1649
- objectWriteUInt32(this, value, offset, true);
1650
- }
1651
- return offset + 4
1652
- };
1653
-
1654
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
1655
- value = +value;
1656
- offset = offset | 0;
1657
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
1658
- if (value < 0) value = 0xffffffff + value + 1;
1659
- if (Buffer.TYPED_ARRAY_SUPPORT) {
1660
- this[offset] = (value >>> 24);
1661
- this[offset + 1] = (value >>> 16);
1662
- this[offset + 2] = (value >>> 8);
1663
- this[offset + 3] = (value & 0xff);
1664
- } else {
1665
- objectWriteUInt32(this, value, offset, false);
1666
- }
1667
- return offset + 4
1668
- };
1669
-
1670
- function checkIEEE754 (buf, value, offset, ext, max, min) {
1671
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
1672
- if (offset < 0) throw new RangeError('Index out of range')
1673
- }
1674
-
1675
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
1676
- if (!noAssert) {
1677
- checkIEEE754(buf, value, offset, 4);
1678
- }
1679
- write(buf, value, offset, littleEndian, 23, 4);
1680
- return offset + 4
1681
- }
1682
-
1683
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
1684
- return writeFloat(this, value, offset, true, noAssert)
1685
- };
1686
-
1687
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
1688
- return writeFloat(this, value, offset, false, noAssert)
1689
- };
1690
-
1691
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
1692
- if (!noAssert) {
1693
- checkIEEE754(buf, value, offset, 8);
1694
- }
1695
- write(buf, value, offset, littleEndian, 52, 8);
1696
- return offset + 8
1697
- }
1698
-
1699
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
1700
- return writeDouble(this, value, offset, true, noAssert)
1701
- };
1702
-
1703
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
1704
- return writeDouble(this, value, offset, false, noAssert)
1705
- };
1706
-
1707
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1708
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
1709
- if (!start) start = 0;
1710
- if (!end && end !== 0) end = this.length;
1711
- if (targetStart >= target.length) targetStart = target.length;
1712
- if (!targetStart) targetStart = 0;
1713
- if (end > 0 && end < start) end = start;
1714
-
1715
- // Copy 0 bytes; we're done
1716
- if (end === start) return 0
1717
- if (target.length === 0 || this.length === 0) return 0
1718
-
1719
- // Fatal error conditions
1720
- if (targetStart < 0) {
1721
- throw new RangeError('targetStart out of bounds')
1722
- }
1723
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
1724
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
1725
-
1726
- // Are we oob?
1727
- if (end > this.length) end = this.length;
1728
- if (target.length - targetStart < end - start) {
1729
- end = target.length - targetStart + start;
1730
- }
1731
-
1732
- var len = end - start;
1733
- var i;
1734
-
1735
- if (this === target && start < targetStart && targetStart < end) {
1736
- // descending copy from end
1737
- for (i = len - 1; i >= 0; --i) {
1738
- target[i + targetStart] = this[i + start];
1739
- }
1740
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
1741
- // ascending copy from start
1742
- for (i = 0; i < len; ++i) {
1743
- target[i + targetStart] = this[i + start];
1744
- }
1745
- } else {
1746
- Uint8Array.prototype.set.call(
1747
- target,
1748
- this.subarray(start, start + len),
1749
- targetStart
1750
- );
1751
- }
1752
-
1753
- return len
1754
- };
1755
-
1756
- // Usage:
1757
- // buffer.fill(number[, offset[, end]])
1758
- // buffer.fill(buffer[, offset[, end]])
1759
- // buffer.fill(string[, offset[, end]][, encoding])
1760
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
1761
- // Handle string cases:
1762
- if (typeof val === 'string') {
1763
- if (typeof start === 'string') {
1764
- encoding = start;
1765
- start = 0;
1766
- end = this.length;
1767
- } else if (typeof end === 'string') {
1768
- encoding = end;
1769
- end = this.length;
1770
- }
1771
- if (val.length === 1) {
1772
- var code = val.charCodeAt(0);
1773
- if (code < 256) {
1774
- val = code;
1775
- }
1776
- }
1777
- if (encoding !== undefined && typeof encoding !== 'string') {
1778
- throw new TypeError('encoding must be a string')
1779
- }
1780
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
1781
- throw new TypeError('Unknown encoding: ' + encoding)
1782
- }
1783
- } else if (typeof val === 'number') {
1784
- val = val & 255;
1785
- }
1786
-
1787
- // Invalid ranges are not set to a default, so can range check early.
1788
- if (start < 0 || this.length < start || this.length < end) {
1789
- throw new RangeError('Out of range index')
1790
- }
1791
-
1792
- if (end <= start) {
1793
- return this
1794
- }
1795
-
1796
- start = start >>> 0;
1797
- end = end === undefined ? this.length : end >>> 0;
1798
-
1799
- if (!val) val = 0;
1800
-
1801
- var i;
1802
- if (typeof val === 'number') {
1803
- for (i = start; i < end; ++i) {
1804
- this[i] = val;
1805
- }
1806
- } else {
1807
- var bytes = internalIsBuffer(val)
1808
- ? val
1809
- : utf8ToBytes(new Buffer(val, encoding).toString());
1810
- var len = bytes.length;
1811
- for (i = 0; i < end - start; ++i) {
1812
- this[i + start] = bytes[i % len];
1813
- }
1814
- }
1815
-
1816
- return this
1817
- };
1818
-
1819
- // HELPER FUNCTIONS
1820
- // ================
1821
-
1822
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
1823
-
1824
- function base64clean (str) {
1825
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
1826
- str = stringtrim(str).replace(INVALID_BASE64_RE, '');
1827
- // Node converts strings with length < 2 to ''
1828
- if (str.length < 2) return ''
1829
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1830
- while (str.length % 4 !== 0) {
1831
- str = str + '=';
1832
- }
1833
- return str
1834
- }
1835
-
1836
- function stringtrim (str) {
1837
- if (str.trim) return str.trim()
1838
- return str.replace(/^\s+|\s+$/g, '')
1839
- }
1840
-
1841
- function toHex (n) {
1842
- if (n < 16) return '0' + n.toString(16)
1843
- return n.toString(16)
1844
- }
1845
-
1846
- function utf8ToBytes (string, units) {
1847
- units = units || Infinity;
1848
- var codePoint;
1849
- var length = string.length;
1850
- var leadSurrogate = null;
1851
- var bytes = [];
1852
-
1853
- for (var i = 0; i < length; ++i) {
1854
- codePoint = string.charCodeAt(i);
1855
-
1856
- // is surrogate component
1857
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
1858
- // last char was a lead
1859
- if (!leadSurrogate) {
1860
- // no lead yet
1861
- if (codePoint > 0xDBFF) {
1862
- // unexpected trail
1863
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1864
- continue
1865
- } else if (i + 1 === length) {
1866
- // unpaired lead
1867
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1868
- continue
1869
- }
1870
-
1871
- // valid lead
1872
- leadSurrogate = codePoint;
1873
-
1874
- continue
1875
- }
1876
-
1877
- // 2 leads in a row
1878
- if (codePoint < 0xDC00) {
1879
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1880
- leadSurrogate = codePoint;
1881
- continue
1882
- }
1883
-
1884
- // valid surrogate pair
1885
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
1886
- } else if (leadSurrogate) {
1887
- // valid bmp char, but last char was a lead
1888
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
1889
- }
1890
-
1891
- leadSurrogate = null;
1892
-
1893
- // encode utf8
1894
- if (codePoint < 0x80) {
1895
- if ((units -= 1) < 0) break
1896
- bytes.push(codePoint);
1897
- } else if (codePoint < 0x800) {
1898
- if ((units -= 2) < 0) break
1899
- bytes.push(
1900
- codePoint >> 0x6 | 0xC0,
1901
- codePoint & 0x3F | 0x80
1902
- );
1903
- } else if (codePoint < 0x10000) {
1904
- if ((units -= 3) < 0) break
1905
- bytes.push(
1906
- codePoint >> 0xC | 0xE0,
1907
- codePoint >> 0x6 & 0x3F | 0x80,
1908
- codePoint & 0x3F | 0x80
1909
- );
1910
- } else if (codePoint < 0x110000) {
1911
- if ((units -= 4) < 0) break
1912
- bytes.push(
1913
- codePoint >> 0x12 | 0xF0,
1914
- codePoint >> 0xC & 0x3F | 0x80,
1915
- codePoint >> 0x6 & 0x3F | 0x80,
1916
- codePoint & 0x3F | 0x80
1917
- );
1918
- } else {
1919
- throw new Error('Invalid code point')
1920
- }
1921
- }
1922
-
1923
- return bytes
1924
- }
1925
-
1926
- function asciiToBytes (str) {
1927
- var byteArray = [];
1928
- for (var i = 0; i < str.length; ++i) {
1929
- // Node's code seems to be doing this and not & 0x7F..
1930
- byteArray.push(str.charCodeAt(i) & 0xFF);
1931
- }
1932
- return byteArray
1933
- }
1934
-
1935
- function utf16leToBytes (str, units) {
1936
- var c, hi, lo;
1937
- var byteArray = [];
1938
- for (var i = 0; i < str.length; ++i) {
1939
- if ((units -= 2) < 0) break
1940
-
1941
- c = str.charCodeAt(i);
1942
- hi = c >> 8;
1943
- lo = c % 256;
1944
- byteArray.push(lo);
1945
- byteArray.push(hi);
1946
- }
1947
-
1948
- return byteArray
1949
- }
1950
-
1951
-
1952
- function base64ToBytes (str) {
1953
- return toByteArray(base64clean(str))
1954
- }
1955
-
1956
- function blitBuffer (src, dst, offset, length) {
1957
- for (var i = 0; i < length; ++i) {
1958
- if ((i + offset >= dst.length) || (i >= src.length)) break
1959
- dst[i + offset] = src[i];
1960
- }
1961
- return i
1962
- }
1963
-
1964
- function isnan (val) {
1965
- return val !== val // eslint-disable-line no-self-compare
1966
- }
1967
-
1968
-
1969
- // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
1970
- // The _isBuffer check is for Safari 5-7 support, because it's missing
1971
- // Object.prototype.constructor. Remove this eventually
1972
- function isBuffer(obj) {
1973
- return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
1974
- }
1975
-
1976
- function isFastBuffer (obj) {
1977
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
1978
- }
1979
-
1980
- // For Node v0.10 support. Remove this eventually.
1981
- function isSlowBuffer (obj) {
1982
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
1983
- }
1984
-
1985
- export { Buffer as B };