@jointhedots/gear 1.0.21 → 1.1.5

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 (334) hide show
  1. package/browser-modules/asap-raw.js +79 -0
  2. package/browser-modules/asap.js +57 -0
  3. package/browser-modules/buffer.js +3 -1
  4. package/browser-modules/child_process.js +145 -0
  5. package/browser-modules/events.js +200 -0
  6. package/browser-modules/side-effects.js +8 -0
  7. package/browser-modules/stream.js +323 -0
  8. package/browser-modules/util.js +170 -0
  9. package/browser-modules/worker_threads.js +85 -0
  10. package/esm/builder/build-app-bundle.js +190 -0
  11. package/esm/builder/build-app-bundle.js.map +1 -0
  12. package/esm/builder/build-app-host.js +173 -0
  13. package/esm/builder/build-app-host.js.map +1 -0
  14. package/esm/builder/build-application.js +233 -71
  15. package/esm/builder/build-application.js.map +1 -1
  16. package/esm/builder/build-library.js +29 -39
  17. package/esm/builder/build-library.js.map +1 -1
  18. package/esm/builder/build-target.js +63 -105
  19. package/esm/builder/build-target.js.map +1 -1
  20. package/esm/builder/emit-dts.js +110 -87
  21. package/esm/builder/emit-dts.js.map +1 -1
  22. package/esm/builder/esbuild-plugins.js +182 -59
  23. package/esm/builder/esbuild-plugins.js.map +1 -1
  24. package/esm/builder/helpers/path-helpers.js +95 -0
  25. package/esm/builder/helpers/path-helpers.js.map +1 -0
  26. package/esm/cli.js +0 -1
  27. package/esm/cli.js.map +1 -1
  28. package/esm/commands/init.js +1 -0
  29. package/esm/commands/init.js.map +1 -1
  30. package/esm/commands/make.js +52 -9
  31. package/esm/commands/make.js.map +1 -1
  32. package/esm/commands/publish.js +1 -0
  33. package/esm/commands/publish.js.map +1 -1
  34. package/esm/commands/run.js +1 -0
  35. package/esm/commands/run.js.map +1 -1
  36. package/esm/commands/serve.js +42 -9
  37. package/esm/commands/serve.js.map +1 -1
  38. package/esm/model/component.js +6 -11
  39. package/esm/model/component.js.map +1 -1
  40. package/esm/model/helpers/create-manifests.js +69 -0
  41. package/esm/model/helpers/create-manifests.js.map +1 -0
  42. package/esm/model/helpers/discover-workspace.js +258 -0
  43. package/esm/model/helpers/discover-workspace.js.map +1 -0
  44. package/esm/model/helpers/logger.js +116 -0
  45. package/esm/model/helpers/logger.js.map +1 -0
  46. package/esm/model/storage.js +82 -24
  47. package/esm/model/storage.js.map +1 -1
  48. package/esm/model/workspace.js +107 -148
  49. package/esm/model/workspace.js.map +1 -1
  50. package/esm/publish/publish_aws_s3.js +1 -0
  51. package/esm/publish/publish_aws_s3.js.map +1 -1
  52. package/esm/utils/file.js +37 -6
  53. package/esm/utils/file.js.map +1 -1
  54. package/esm/utils/graph-ordering.js +86 -0
  55. package/esm/utils/graph-ordering.js.map +1 -0
  56. package/esm/utils/normalized-name.js +94 -0
  57. package/esm/utils/normalized-name.js.map +1 -0
  58. package/node_modules/@jspm/core/.github/workflows/ci.yml +64 -0
  59. package/node_modules/@jspm/core/LICENSE +796 -0
  60. package/node_modules/@jspm/core/README.md +11 -0
  61. package/node_modules/@jspm/core/chompfile.toml +28 -0
  62. package/node_modules/@jspm/core/generate-node-libs.mjs +10 -0
  63. package/node_modules/@jspm/core/nodelibs/@empty.dew.js +7 -0
  64. package/node_modules/@jspm/core/nodelibs/@empty.js +3 -0
  65. package/node_modules/@jspm/core/nodelibs/browser/_stream_duplex.js +13 -0
  66. package/node_modules/@jspm/core/nodelibs/browser/_stream_passthrough.js +12 -0
  67. package/node_modules/@jspm/core/nodelibs/browser/_stream_readable.js +14 -0
  68. package/node_modules/@jspm/core/nodelibs/browser/_stream_transform.js +12 -0
  69. package/node_modules/@jspm/core/nodelibs/browser/_stream_writable.js +13 -0
  70. package/node_modules/@jspm/core/nodelibs/browser/assert/strict.js +29 -0
  71. package/node_modules/@jspm/core/nodelibs/browser/assert.js +2574 -0
  72. package/node_modules/@jspm/core/nodelibs/browser/async_hooks.js +14 -0
  73. package/node_modules/@jspm/core/nodelibs/browser/buffer.js +10 -0
  74. package/node_modules/@jspm/core/nodelibs/browser/child_process.js +17 -0
  75. package/node_modules/@jspm/core/nodelibs/browser/chunk-B6-G-Ftj.js +158 -0
  76. package/node_modules/@jspm/core/nodelibs/browser/chunk-B738Er4n.js +5524 -0
  77. package/node_modules/@jspm/core/nodelibs/browser/chunk-BlJi4mNy.js +448 -0
  78. package/node_modules/@jspm/core/nodelibs/browser/chunk-BsRZ0PEC.js +74 -0
  79. package/node_modules/@jspm/core/nodelibs/browser/chunk-C4rKjYLo.js +20 -0
  80. package/node_modules/@jspm/core/nodelibs/browser/chunk-CbQqNoLO.js +32 -0
  81. package/node_modules/@jspm/core/nodelibs/browser/chunk-CcCWfKp1.js +360 -0
  82. package/node_modules/@jspm/core/nodelibs/browser/chunk-CjPlbOtt.js +47 -0
  83. package/node_modules/@jspm/core/nodelibs/browser/chunk-CkFCi-G1.js +36 -0
  84. package/node_modules/@jspm/core/nodelibs/browser/chunk-D3uu3VYh.js +33 -0
  85. package/node_modules/@jspm/core/nodelibs/browser/chunk-DEMDiNwt.js +275 -0
  86. package/node_modules/@jspm/core/nodelibs/browser/chunk-DHWh-hmB.js +1344 -0
  87. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtDiafJB.js +96 -0
  88. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtcTpLWz.js +826 -0
  89. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtuTasat.js +1923 -0
  90. package/node_modules/@jspm/core/nodelibs/browser/chunk-b0rmRow7.js +246 -0
  91. package/node_modules/@jspm/core/nodelibs/browser/chunk-tHuMsdT0.js +8 -0
  92. package/node_modules/@jspm/core/nodelibs/browser/cluster.js +33 -0
  93. package/node_modules/@jspm/core/nodelibs/browser/console.js +103 -0
  94. package/node_modules/@jspm/core/nodelibs/browser/constants.js +419 -0
  95. package/node_modules/@jspm/core/nodelibs/browser/crypto.js +109730 -0
  96. package/node_modules/@jspm/core/nodelibs/browser/dgram.js +11 -0
  97. package/node_modules/@jspm/core/nodelibs/browser/diagnostics_channel.js +153 -0
  98. package/node_modules/@jspm/core/nodelibs/browser/dns/promises.js +26 -0
  99. package/node_modules/@jspm/core/nodelibs/browser/dns.js +101 -0
  100. package/node_modules/@jspm/core/nodelibs/browser/domain.js +77 -0
  101. package/node_modules/@jspm/core/nodelibs/browser/events.js +491 -0
  102. package/node_modules/@jspm/core/nodelibs/browser/fs/promises.js +50 -0
  103. package/node_modules/@jspm/core/nodelibs/browser/fs.js +4139 -0
  104. package/node_modules/@jspm/core/nodelibs/browser/http.js +3513 -0
  105. package/node_modules/@jspm/core/nodelibs/browser/http2.js +88 -0
  106. package/node_modules/@jspm/core/nodelibs/browser/https.js +873 -0
  107. package/node_modules/@jspm/core/nodelibs/browser/module.js +58 -0
  108. package/node_modules/@jspm/core/nodelibs/browser/net.js +20 -0
  109. package/node_modules/@jspm/core/nodelibs/browser/os.js +94 -0
  110. package/node_modules/@jspm/core/nodelibs/browser/path/posix.js +40 -0
  111. package/node_modules/@jspm/core/nodelibs/browser/path/win32.js +27 -0
  112. package/node_modules/@jspm/core/nodelibs/browser/path.js +20 -0
  113. package/node_modules/@jspm/core/nodelibs/browser/perf_hooks.js +30 -0
  114. package/node_modules/@jspm/core/nodelibs/browser/process-production.js +274 -0
  115. package/node_modules/@jspm/core/nodelibs/browser/process.js +277 -0
  116. package/node_modules/@jspm/core/nodelibs/browser/punycode.js +436 -0
  117. package/node_modules/@jspm/core/nodelibs/browser/querystring.js +118 -0
  118. package/node_modules/@jspm/core/nodelibs/browser/readline.js +15 -0
  119. package/node_modules/@jspm/core/nodelibs/browser/repl.js +21 -0
  120. package/node_modules/@jspm/core/nodelibs/browser/stream/consumers.js +61 -0
  121. package/node_modules/@jspm/core/nodelibs/browser/stream/promises.js +12 -0
  122. package/node_modules/@jspm/core/nodelibs/browser/stream/web.js +35 -0
  123. package/node_modules/@jspm/core/nodelibs/browser/stream.js +6574 -0
  124. package/node_modules/@jspm/core/nodelibs/browser/string_decoder.js +2 -0
  125. package/node_modules/@jspm/core/nodelibs/browser/sys.js +9 -0
  126. package/node_modules/@jspm/core/nodelibs/browser/timers/promises.js +17 -0
  127. package/node_modules/@jspm/core/nodelibs/browser/timers.js +256 -0
  128. package/node_modules/@jspm/core/nodelibs/browser/tls.js +34 -0
  129. package/node_modules/@jspm/core/nodelibs/browser/tty.js +20 -0
  130. package/node_modules/@jspm/core/nodelibs/browser/url.js +2361 -0
  131. package/node_modules/@jspm/core/nodelibs/browser/util/types.js +51 -0
  132. package/node_modules/@jspm/core/nodelibs/browser/util.js +1345 -0
  133. package/node_modules/@jspm/core/nodelibs/browser/v8.js +21 -0
  134. package/node_modules/@jspm/core/nodelibs/browser/vm.js +139 -0
  135. package/node_modules/@jspm/core/nodelibs/browser/wasi.js +160 -0
  136. package/node_modules/@jspm/core/nodelibs/browser/worker_threads.js +140 -0
  137. package/node_modules/@jspm/core/nodelibs/browser/zlib.js +6545 -0
  138. package/node_modules/@jspm/core/nodelibs/deno/_stream_duplex.ts +5 -0
  139. package/node_modules/@jspm/core/nodelibs/deno/_stream_passthrough.ts +1 -0
  140. package/node_modules/@jspm/core/nodelibs/deno/_stream_readable.ts +5 -0
  141. package/node_modules/@jspm/core/nodelibs/deno/_stream_transform.ts +1 -0
  142. package/node_modules/@jspm/core/nodelibs/deno/_stream_writable.ts +5 -0
  143. package/node_modules/@jspm/core/nodelibs/deno/assert/strict.ts +2 -0
  144. package/node_modules/@jspm/core/nodelibs/deno/assert.ts +2 -0
  145. package/node_modules/@jspm/core/nodelibs/deno/async_hooks.ts +2 -0
  146. package/node_modules/@jspm/core/nodelibs/deno/buffer.ts +5 -0
  147. package/node_modules/@jspm/core/nodelibs/deno/child_process.ts +2 -0
  148. package/node_modules/@jspm/core/nodelibs/deno/cluster.ts +2 -0
  149. package/node_modules/@jspm/core/nodelibs/deno/console.ts +2 -0
  150. package/node_modules/@jspm/core/nodelibs/deno/constants.ts +2 -0
  151. package/node_modules/@jspm/core/nodelibs/deno/crypto.ts +2 -0
  152. package/node_modules/@jspm/core/nodelibs/deno/dgram.ts +2 -0
  153. package/node_modules/@jspm/core/nodelibs/deno/diagnostics_channel.ts +2 -0
  154. package/node_modules/@jspm/core/nodelibs/deno/dns/promises.ts +2 -0
  155. package/node_modules/@jspm/core/nodelibs/deno/dns.ts +2 -0
  156. package/node_modules/@jspm/core/nodelibs/deno/domain.ts +2 -0
  157. package/node_modules/@jspm/core/nodelibs/deno/events.ts +2 -0
  158. package/node_modules/@jspm/core/nodelibs/deno/fs/promises.ts +2 -0
  159. package/node_modules/@jspm/core/nodelibs/deno/fs.ts +2 -0
  160. package/node_modules/@jspm/core/nodelibs/deno/http.ts +2 -0
  161. package/node_modules/@jspm/core/nodelibs/deno/http2.ts +2 -0
  162. package/node_modules/@jspm/core/nodelibs/deno/https.ts +2 -0
  163. package/node_modules/@jspm/core/nodelibs/deno/inspector.ts +2 -0
  164. package/node_modules/@jspm/core/nodelibs/deno/module.ts +2 -0
  165. package/node_modules/@jspm/core/nodelibs/deno/net.ts +2 -0
  166. package/node_modules/@jspm/core/nodelibs/deno/os.ts +2 -0
  167. package/node_modules/@jspm/core/nodelibs/deno/path/posix.ts +2 -0
  168. package/node_modules/@jspm/core/nodelibs/deno/path/win32.ts +2 -0
  169. package/node_modules/@jspm/core/nodelibs/deno/path.ts +2 -0
  170. package/node_modules/@jspm/core/nodelibs/deno/perf_hooks.ts +2 -0
  171. package/node_modules/@jspm/core/nodelibs/deno/process-production.ts +4 -0
  172. package/node_modules/@jspm/core/nodelibs/deno/process.ts +2 -0
  173. package/node_modules/@jspm/core/nodelibs/deno/punycode.ts +2 -0
  174. package/node_modules/@jspm/core/nodelibs/deno/querystring.ts +2 -0
  175. package/node_modules/@jspm/core/nodelibs/deno/readline/promises.ts +2 -0
  176. package/node_modules/@jspm/core/nodelibs/deno/readline.ts +2 -0
  177. package/node_modules/@jspm/core/nodelibs/deno/repl.ts +2 -0
  178. package/node_modules/@jspm/core/nodelibs/deno/stream/consumers.ts +2 -0
  179. package/node_modules/@jspm/core/nodelibs/deno/stream/promises.ts +2 -0
  180. package/node_modules/@jspm/core/nodelibs/deno/stream/web.ts +2 -0
  181. package/node_modules/@jspm/core/nodelibs/deno/stream.ts +2 -0
  182. package/node_modules/@jspm/core/nodelibs/deno/string_decoder.ts +2 -0
  183. package/node_modules/@jspm/core/nodelibs/deno/timers/promises.ts +2 -0
  184. package/node_modules/@jspm/core/nodelibs/deno/timers.ts +2 -0
  185. package/node_modules/@jspm/core/nodelibs/deno/tls.ts +2 -0
  186. package/node_modules/@jspm/core/nodelibs/deno/tty.ts +2 -0
  187. package/node_modules/@jspm/core/nodelibs/deno/url.ts +2 -0
  188. package/node_modules/@jspm/core/nodelibs/deno/util/types.ts +2 -0
  189. package/node_modules/@jspm/core/nodelibs/deno/util.ts +2 -0
  190. package/node_modules/@jspm/core/nodelibs/deno/v8.ts +2 -0
  191. package/node_modules/@jspm/core/nodelibs/deno/vm.ts +2 -0
  192. package/node_modules/@jspm/core/nodelibs/deno/wasi.ts +2 -0
  193. package/node_modules/@jspm/core/nodelibs/deno/worker_threads.ts +2 -0
  194. package/node_modules/@jspm/core/nodelibs/deno/zlib.ts +2 -0
  195. package/node_modules/@jspm/core/nodelibs/node/_http_agent.js +2 -0
  196. package/node_modules/@jspm/core/nodelibs/node/_http_client.js +2 -0
  197. package/node_modules/@jspm/core/nodelibs/node/_http_common.js +2 -0
  198. package/node_modules/@jspm/core/nodelibs/node/_http_incoming.js +2 -0
  199. package/node_modules/@jspm/core/nodelibs/node/_http_outgoing.js +2 -0
  200. package/node_modules/@jspm/core/nodelibs/node/_http_server.js +2 -0
  201. package/node_modules/@jspm/core/nodelibs/node/_stream_duplex.js +2 -0
  202. package/node_modules/@jspm/core/nodelibs/node/_stream_passthrough.js +2 -0
  203. package/node_modules/@jspm/core/nodelibs/node/_stream_readable.js +2 -0
  204. package/node_modules/@jspm/core/nodelibs/node/_stream_transform.js +2 -0
  205. package/node_modules/@jspm/core/nodelibs/node/_stream_wrap.js +2 -0
  206. package/node_modules/@jspm/core/nodelibs/node/_stream_writable.js +2 -0
  207. package/node_modules/@jspm/core/nodelibs/node/_tls_common.js +2 -0
  208. package/node_modules/@jspm/core/nodelibs/node/_tls_wrap.js +2 -0
  209. package/node_modules/@jspm/core/nodelibs/node/assert/strict.js +2 -0
  210. package/node_modules/@jspm/core/nodelibs/node/assert.js +2 -0
  211. package/node_modules/@jspm/core/nodelibs/node/async_hooks.js +2 -0
  212. package/node_modules/@jspm/core/nodelibs/node/buffer.js +2 -0
  213. package/node_modules/@jspm/core/nodelibs/node/child_process.js +2 -0
  214. package/node_modules/@jspm/core/nodelibs/node/cluster.js +2 -0
  215. package/node_modules/@jspm/core/nodelibs/node/console.js +2 -0
  216. package/node_modules/@jspm/core/nodelibs/node/constants.js +2 -0
  217. package/node_modules/@jspm/core/nodelibs/node/crypto.js +2 -0
  218. package/node_modules/@jspm/core/nodelibs/node/dgram.js +2 -0
  219. package/node_modules/@jspm/core/nodelibs/node/diagnostics_channel.js +2 -0
  220. package/node_modules/@jspm/core/nodelibs/node/dns/promises.js +2 -0
  221. package/node_modules/@jspm/core/nodelibs/node/dns.js +2 -0
  222. package/node_modules/@jspm/core/nodelibs/node/domain.js +2 -0
  223. package/node_modules/@jspm/core/nodelibs/node/events.js +2 -0
  224. package/node_modules/@jspm/core/nodelibs/node/fs/promises.js +2 -0
  225. package/node_modules/@jspm/core/nodelibs/node/fs.js +2 -0
  226. package/node_modules/@jspm/core/nodelibs/node/http.js +2 -0
  227. package/node_modules/@jspm/core/nodelibs/node/http2.js +2 -0
  228. package/node_modules/@jspm/core/nodelibs/node/https.js +2 -0
  229. package/node_modules/@jspm/core/nodelibs/node/inspector/promises.js +2 -0
  230. package/node_modules/@jspm/core/nodelibs/node/inspector.js +2 -0
  231. package/node_modules/@jspm/core/nodelibs/node/module.js +2 -0
  232. package/node_modules/@jspm/core/nodelibs/node/net.js +2 -0
  233. package/node_modules/@jspm/core/nodelibs/node/os.js +2 -0
  234. package/node_modules/@jspm/core/nodelibs/node/path/posix.js +2 -0
  235. package/node_modules/@jspm/core/nodelibs/node/path/win32.js +2 -0
  236. package/node_modules/@jspm/core/nodelibs/node/path.js +2 -0
  237. package/node_modules/@jspm/core/nodelibs/node/perf_hooks.js +2 -0
  238. package/node_modules/@jspm/core/nodelibs/node/process-production.js +4 -0
  239. package/node_modules/@jspm/core/nodelibs/node/process.js +2 -0
  240. package/node_modules/@jspm/core/nodelibs/node/punycode.js +2 -0
  241. package/node_modules/@jspm/core/nodelibs/node/querystring.js +2 -0
  242. package/node_modules/@jspm/core/nodelibs/node/readline/promises.js +2 -0
  243. package/node_modules/@jspm/core/nodelibs/node/readline.js +2 -0
  244. package/node_modules/@jspm/core/nodelibs/node/repl.js +2 -0
  245. package/node_modules/@jspm/core/nodelibs/node/stream/consumers.js +2 -0
  246. package/node_modules/@jspm/core/nodelibs/node/stream/promises.js +2 -0
  247. package/node_modules/@jspm/core/nodelibs/node/stream/web.js +2 -0
  248. package/node_modules/@jspm/core/nodelibs/node/stream.js +2 -0
  249. package/node_modules/@jspm/core/nodelibs/node/string_decoder.js +2 -0
  250. package/node_modules/@jspm/core/nodelibs/node/sys.js +2 -0
  251. package/node_modules/@jspm/core/nodelibs/node/timers/promises.js +2 -0
  252. package/node_modules/@jspm/core/nodelibs/node/timers.js +2 -0
  253. package/node_modules/@jspm/core/nodelibs/node/tls.js +2 -0
  254. package/node_modules/@jspm/core/nodelibs/node/trace_events.js +2 -0
  255. package/node_modules/@jspm/core/nodelibs/node/tty.js +2 -0
  256. package/node_modules/@jspm/core/nodelibs/node/url.js +2 -0
  257. package/node_modules/@jspm/core/nodelibs/node/util/types.js +2 -0
  258. package/node_modules/@jspm/core/nodelibs/node/util.js +2 -0
  259. package/node_modules/@jspm/core/nodelibs/node/v8.js +2 -0
  260. package/node_modules/@jspm/core/nodelibs/node/vm.js +2 -0
  261. package/node_modules/@jspm/core/nodelibs/node/wasi.js +2 -0
  262. package/node_modules/@jspm/core/nodelibs/node/worker_threads.js +2 -0
  263. package/node_modules/@jspm/core/nodelibs/node/zlib.js +2 -0
  264. package/node_modules/@jspm/core/package.json +75 -0
  265. package/node_modules/@jspm/core/rollup.config.mjs +55 -0
  266. package/node_modules/@jspm/core/src-browser/__tty.js +11 -0
  267. package/node_modules/@jspm/core/src-browser/_stream_duplex.js +3 -0
  268. package/node_modules/@jspm/core/src-browser/_stream_passthrough.js +2 -0
  269. package/node_modules/@jspm/core/src-browser/_stream_readable.js +5 -0
  270. package/node_modules/@jspm/core/src-browser/_stream_transform.js +2 -0
  271. package/node_modules/@jspm/core/src-browser/_stream_writable.js +3 -0
  272. package/node_modules/@jspm/core/src-browser/assert/strict.js +26 -0
  273. package/node_modules/@jspm/core/src-browser/assert.js +19 -0
  274. package/node_modules/@jspm/core/src-browser/async_hooks.js +21 -0
  275. package/node_modules/@jspm/core/src-browser/buffer.js +5 -0
  276. package/node_modules/@jspm/core/src-browser/child_process.js +27 -0
  277. package/node_modules/@jspm/core/src-browser/cluster.js +38 -0
  278. package/node_modules/@jspm/core/src-browser/console.js +25 -0
  279. package/node_modules/@jspm/core/src-browser/constants.js +209 -0
  280. package/node_modules/@jspm/core/src-browser/crypto.js +63 -0
  281. package/node_modules/@jspm/core/src-browser/dgram.js +15 -0
  282. package/node_modules/@jspm/core/src-browser/diagnostics_channel.js +6 -0
  283. package/node_modules/@jspm/core/src-browser/dns/promises.js +45 -0
  284. package/node_modules/@jspm/core/src-browser/dns.js +121 -0
  285. package/node_modules/@jspm/core/src-browser/domain.js +4 -0
  286. package/node_modules/@jspm/core/src-browser/events.js +105 -0
  287. package/node_modules/@jspm/core/src-browser/fs/promises.js +34 -0
  288. package/node_modules/@jspm/core/src-browser/fs.js +209 -0
  289. package/node_modules/@jspm/core/src-browser/http.js +10 -0
  290. package/node_modules/@jspm/core/src-browser/http2.js +86 -0
  291. package/node_modules/@jspm/core/src-browser/https.js +10 -0
  292. package/node_modules/@jspm/core/src-browser/module.js +75 -0
  293. package/node_modules/@jspm/core/src-browser/net.js +33 -0
  294. package/node_modules/@jspm/core/src-browser/os.js +35 -0
  295. package/node_modules/@jspm/core/src-browser/path/posix.js +38 -0
  296. package/node_modules/@jspm/core/src-browser/path/win32.js +42 -0
  297. package/node_modules/@jspm/core/src-browser/path.js +17 -0
  298. package/node_modules/@jspm/core/src-browser/perf_hooks.js +30 -0
  299. package/node_modules/@jspm/core/src-browser/process-production.js +279 -0
  300. package/node_modules/@jspm/core/src-browser/process.js +282 -0
  301. package/node_modules/@jspm/core/src-browser/punycode.js +8 -0
  302. package/node_modules/@jspm/core/src-browser/querystring.js +6 -0
  303. package/node_modules/@jspm/core/src-browser/readline.js +23 -0
  304. package/node_modules/@jspm/core/src-browser/repl.js +26 -0
  305. package/node_modules/@jspm/core/src-browser/stream/consumers.js +57 -0
  306. package/node_modules/@jspm/core/src-browser/stream/promises.js +4 -0
  307. package/node_modules/@jspm/core/src-browser/stream/web.js +33 -0
  308. package/node_modules/@jspm/core/src-browser/stream.js +26 -0
  309. package/node_modules/@jspm/core/src-browser/string_decoder.js +3 -0
  310. package/node_modules/@jspm/core/src-browser/sys.js +3 -0
  311. package/node_modules/@jspm/core/src-browser/timers/promises.js +12 -0
  312. package/node_modules/@jspm/core/src-browser/timers.js +13 -0
  313. package/node_modules/@jspm/core/src-browser/tls.js +46 -0
  314. package/node_modules/@jspm/core/src-browser/tty.js +3 -0
  315. package/node_modules/@jspm/core/src-browser/url.js +154 -0
  316. package/node_modules/@jspm/core/src-browser/util/types.js +48 -0
  317. package/node_modules/@jspm/core/src-browser/util.js +30 -0
  318. package/node_modules/@jspm/core/src-browser/v8.js +35 -0
  319. package/node_modules/@jspm/core/src-browser/vm.js +9 -0
  320. package/node_modules/@jspm/core/src-browser/wasi.js +15 -0
  321. package/node_modules/@jspm/core/src-browser/worker_threads.js +139 -0
  322. package/node_modules/@jspm/core/src-browser/zlib.js +71 -0
  323. package/node_modules/@jspm/core/test/chrome-worker_threads.test.js +14 -0
  324. package/node_modules/@jspm/core/test/cowsay.wasm +0 -0
  325. package/node_modules/@jspm/core/test/exports.test.js +99 -0
  326. package/node_modules/@jspm/core/test/fs.test.js +13 -0
  327. package/node_modules/@jspm/core/test/os.test.js +7 -0
  328. package/node_modules/@jspm/core/test/process.test.js +15 -0
  329. package/node_modules/@jspm/core/test/server.js +177 -0
  330. package/node_modules/@jspm/core/test/test.html +29 -0
  331. package/node_modules/@jspm/core/test/wasi.test.js +13 -0
  332. package/package.json +39 -24
  333. package/esm/utils/helpers.js +0 -32
  334. package/esm/utils/helpers.js.map +0 -1
@@ -0,0 +1,1923 @@
1
+ var exports$2 = {},
2
+ _dewExec$2 = false;
3
+ function dew$2() {
4
+ if (_dewExec$2) return exports$2;
5
+ _dewExec$2 = true;
6
+ exports$2.byteLength = byteLength;
7
+ exports$2.toByteArray = toByteArray;
8
+ exports$2.fromByteArray = fromByteArray;
9
+ var lookup = [];
10
+ var revLookup = [];
11
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
12
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
13
+ for (var i = 0, len = code.length; i < len; ++i) {
14
+ lookup[i] = code[i];
15
+ revLookup[code.charCodeAt(i)] = i;
16
+ }
17
+
18
+ // Support decoding URL-safe base64 strings, as Node.js does.
19
+ // See: https://en.wikipedia.org/wiki/Base64#URL_applications
20
+ revLookup["-".charCodeAt(0)] = 62;
21
+ revLookup["_".charCodeAt(0)] = 63;
22
+ function getLens(b64) {
23
+ var len = b64.length;
24
+ if (len % 4 > 0) {
25
+ throw new Error("Invalid string. Length must be a multiple of 4");
26
+ }
27
+
28
+ // Trim off extra bytes after placeholder bytes are found
29
+ // See: https://github.com/beatgammit/base64-js/issues/42
30
+ var validLen = b64.indexOf("=");
31
+ if (validLen === -1) validLen = len;
32
+ var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;
33
+ return [validLen, placeHoldersLen];
34
+ }
35
+
36
+ // base64 is 4/3 + up to two characters of the original data
37
+ function byteLength(b64) {
38
+ var lens = getLens(b64);
39
+ var validLen = lens[0];
40
+ var placeHoldersLen = lens[1];
41
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
42
+ }
43
+ function _byteLength(b64, validLen, placeHoldersLen) {
44
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
45
+ }
46
+ function toByteArray(b64) {
47
+ var tmp;
48
+ var lens = getLens(b64);
49
+ var validLen = lens[0];
50
+ var placeHoldersLen = lens[1];
51
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
52
+ var curByte = 0;
53
+
54
+ // if there are placeholders, only get up to the last complete 4 chars
55
+ var len = placeHoldersLen > 0 ? validLen - 4 : validLen;
56
+ var i;
57
+ for (i = 0; i < len; i += 4) {
58
+ tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
59
+ arr[curByte++] = tmp >> 16 & 255;
60
+ arr[curByte++] = tmp >> 8 & 255;
61
+ arr[curByte++] = tmp & 255;
62
+ }
63
+ if (placeHoldersLen === 2) {
64
+ tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
65
+ arr[curByte++] = tmp & 255;
66
+ }
67
+ if (placeHoldersLen === 1) {
68
+ tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
69
+ arr[curByte++] = tmp >> 8 & 255;
70
+ arr[curByte++] = tmp & 255;
71
+ }
72
+ return arr;
73
+ }
74
+ function tripletToBase64(num) {
75
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
76
+ }
77
+ function encodeChunk(uint8, start, end) {
78
+ var tmp;
79
+ var output = [];
80
+ for (var i = start; i < end; i += 3) {
81
+ tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255);
82
+ output.push(tripletToBase64(tmp));
83
+ }
84
+ return output.join("");
85
+ }
86
+ function fromByteArray(uint8) {
87
+ var tmp;
88
+ var len = uint8.length;
89
+ var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
90
+ var parts = [];
91
+ var maxChunkLength = 16383; // must be multiple of 3
92
+
93
+ // go through the array every three bytes, we'll deal with trailing stuff later
94
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
95
+ parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
96
+ }
97
+
98
+ // pad the end with zeros, but make sure to not forget the extra bytes
99
+ if (extraBytes === 1) {
100
+ tmp = uint8[len - 1];
101
+ parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "==");
102
+ } else if (extraBytes === 2) {
103
+ tmp = (uint8[len - 2] << 8) + uint8[len - 1];
104
+ parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "=");
105
+ }
106
+ return parts.join("");
107
+ }
108
+ return exports$2;
109
+ }
110
+
111
+ var exports$1 = {},
112
+ _dewExec$1 = false;
113
+ function dew$1() {
114
+ if (_dewExec$1) return exports$1;
115
+ _dewExec$1 = true;
116
+ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
117
+ exports$1.read = function (buffer, offset, isLE, mLen, nBytes) {
118
+ var e, m;
119
+ var eLen = nBytes * 8 - mLen - 1;
120
+ var eMax = (1 << eLen) - 1;
121
+ var eBias = eMax >> 1;
122
+ var nBits = -7;
123
+ var i = isLE ? nBytes - 1 : 0;
124
+ var d = isLE ? -1 : 1;
125
+ var s = buffer[offset + i];
126
+ i += d;
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
+ m = e & (1 << -nBits) - 1;
132
+ e >>= -nBits;
133
+ nBits += mLen;
134
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
135
+ if (e === 0) {
136
+ e = 1 - eBias;
137
+ } else if (e === eMax) {
138
+ return m ? NaN : (s ? -1 : 1) * Infinity;
139
+ } else {
140
+ m = m + Math.pow(2, mLen);
141
+ e = e - eBias;
142
+ }
143
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
144
+ };
145
+ exports$1.write = function (buffer, value, offset, isLE, mLen, nBytes) {
146
+ var e, m, c;
147
+ var eLen = nBytes * 8 - mLen - 1;
148
+ var eMax = (1 << eLen) - 1;
149
+ var eBias = eMax >> 1;
150
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
151
+ var i = isLE ? 0 : nBytes - 1;
152
+ var d = isLE ? 1 : -1;
153
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
154
+ value = Math.abs(value);
155
+ if (isNaN(value) || value === Infinity) {
156
+ m = isNaN(value) ? 1 : 0;
157
+ e = eMax;
158
+ } else {
159
+ e = Math.floor(Math.log(value) / Math.LN2);
160
+ if (value * (c = Math.pow(2, -e)) < 1) {
161
+ e--;
162
+ c *= 2;
163
+ }
164
+ if (e + eBias >= 1) {
165
+ value += rt / c;
166
+ } else {
167
+ value += rt * Math.pow(2, 1 - eBias);
168
+ }
169
+ if (value * c >= 2) {
170
+ e++;
171
+ c /= 2;
172
+ }
173
+ if (e + eBias >= eMax) {
174
+ m = 0;
175
+ e = eMax;
176
+ } else if (e + eBias >= 1) {
177
+ m = (value * c - 1) * Math.pow(2, mLen);
178
+ e = e + eBias;
179
+ } else {
180
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
181
+ e = 0;
182
+ }
183
+ }
184
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {}
185
+ e = e << mLen | m;
186
+ eLen += mLen;
187
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {}
188
+ buffer[offset + i - d] |= s * 128;
189
+ };
190
+ return exports$1;
191
+ }
192
+
193
+ var exports = {},
194
+ _dewExec = false;
195
+ function dew() {
196
+ if (_dewExec) return exports;
197
+ _dewExec = true;
198
+ const base64 = dew$2();
199
+ const ieee754 = dew$1();
200
+ const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" // eslint-disable-line dot-notation
201
+ ? Symbol["for"]("nodejs.util.inspect.custom") // eslint-disable-line dot-notation
202
+ : null;
203
+ exports.Buffer = Buffer;
204
+ exports.SlowBuffer = SlowBuffer;
205
+ exports.INSPECT_MAX_BYTES = 50;
206
+ const K_MAX_LENGTH = 2147483647;
207
+ exports.kMaxLength = K_MAX_LENGTH;
208
+
209
+ /**
210
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
211
+ * === true Use Uint8Array implementation (fastest)
212
+ * === false Print warning and recommend using `buffer` v4.x which has an Object
213
+ * implementation (most compatible, even IE6)
214
+ *
215
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
216
+ * Opera 11.6+, iOS 4.2+.
217
+ *
218
+ * We report that the browser does not support typed arrays if the are not subclassable
219
+ * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
220
+ * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
221
+ * for __proto__ and has a buggy typed array implementation.
222
+ */
223
+ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport();
224
+ if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
225
+ console.error("This browser lacks typed array (Uint8Array) support which is required by " + "`buffer` v5.x. Use `buffer` v4.x if you require old browser support.");
226
+ }
227
+ function typedArraySupport() {
228
+ // Can typed array instances can be augmented?
229
+ try {
230
+ const arr = new Uint8Array(1);
231
+ const proto = {
232
+ foo: function () {
233
+ return 42;
234
+ }
235
+ };
236
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
237
+ Object.setPrototypeOf(arr, proto);
238
+ return arr.foo() === 42;
239
+ } catch (e) {
240
+ return false;
241
+ }
242
+ }
243
+ Object.defineProperty(Buffer.prototype, "parent", {
244
+ enumerable: true,
245
+ get: function () {
246
+ if (!Buffer.isBuffer(this)) return undefined;
247
+ return this.buffer;
248
+ }
249
+ });
250
+ Object.defineProperty(Buffer.prototype, "offset", {
251
+ enumerable: true,
252
+ get: function () {
253
+ if (!Buffer.isBuffer(this)) return undefined;
254
+ return this.byteOffset;
255
+ }
256
+ });
257
+ function createBuffer(length) {
258
+ if (length > K_MAX_LENGTH) {
259
+ throw new RangeError("The value \"" + length + "\" is invalid for option \"size\"");
260
+ }
261
+ // Return an augmented `Uint8Array` instance
262
+ const buf = new Uint8Array(length);
263
+ Object.setPrototypeOf(buf, Buffer.prototype);
264
+ return buf;
265
+ }
266
+
267
+ /**
268
+ * The Buffer constructor returns instances of `Uint8Array` that have their
269
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
270
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
271
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
272
+ * returns a single octet.
273
+ *
274
+ * The `Uint8Array` prototype remains unmodified.
275
+ */
276
+
277
+ function Buffer(arg, encodingOrOffset, length) {
278
+ // Common case.
279
+ if (typeof arg === "number") {
280
+ if (typeof encodingOrOffset === "string") {
281
+ throw new TypeError("The \"string\" argument must be of type string. Received type number");
282
+ }
283
+ return allocUnsafe(arg);
284
+ }
285
+ return from(arg, encodingOrOffset, length);
286
+ }
287
+ Buffer.poolSize = 8192; // not used by this implementation
288
+
289
+ function from(value, encodingOrOffset, length) {
290
+ if (typeof value === "string") {
291
+ return fromString(value, encodingOrOffset);
292
+ }
293
+ if (ArrayBuffer.isView(value)) {
294
+ return fromArrayView(value);
295
+ }
296
+ if (value == null) {
297
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + typeof value);
298
+ }
299
+ if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
300
+ return fromArrayBuffer(value, encodingOrOffset, length);
301
+ }
302
+ if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
303
+ return fromArrayBuffer(value, encodingOrOffset, length);
304
+ }
305
+ if (typeof value === "number") {
306
+ throw new TypeError("The \"value\" argument must not be of type number. Received type number");
307
+ }
308
+ const valueOf = value.valueOf && value.valueOf();
309
+ if (valueOf != null && valueOf !== value) {
310
+ return Buffer.from(valueOf, encodingOrOffset, length);
311
+ }
312
+ const b = fromObject(value);
313
+ if (b) return b;
314
+ if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
315
+ return Buffer.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
316
+ }
317
+ throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, " + "or Array-like Object. Received type " + typeof value);
318
+ }
319
+
320
+ /**
321
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
322
+ * if value is a number.
323
+ * Buffer.from(str[, encoding])
324
+ * Buffer.from(array)
325
+ * Buffer.from(buffer)
326
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
327
+ **/
328
+ Buffer.from = function (value, encodingOrOffset, length) {
329
+ return from(value, encodingOrOffset, length);
330
+ };
331
+
332
+ // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
333
+ // https://github.com/feross/buffer/pull/148
334
+ Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype);
335
+ Object.setPrototypeOf(Buffer, Uint8Array);
336
+ function assertSize(size) {
337
+ if (typeof size !== "number") {
338
+ throw new TypeError("\"size\" argument must be of type number");
339
+ } else if (size < 0) {
340
+ throw new RangeError("The value \"" + size + "\" is invalid for option \"size\"");
341
+ }
342
+ }
343
+ function alloc(size, fill, encoding) {
344
+ assertSize(size);
345
+ if (size <= 0) {
346
+ return createBuffer(size);
347
+ }
348
+ if (fill !== undefined) {
349
+ // Only pay attention to encoding if it's a string. This
350
+ // prevents accidentally sending in a number that would
351
+ // be interpreted as a start offset.
352
+ return typeof encoding === "string" ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill);
353
+ }
354
+ return createBuffer(size);
355
+ }
356
+
357
+ /**
358
+ * Creates a new filled Buffer instance.
359
+ * alloc(size[, fill[, encoding]])
360
+ **/
361
+ Buffer.alloc = function (size, fill, encoding) {
362
+ return alloc(size, fill, encoding);
363
+ };
364
+ function allocUnsafe(size) {
365
+ assertSize(size);
366
+ return createBuffer(size < 0 ? 0 : checked(size) | 0);
367
+ }
368
+
369
+ /**
370
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
371
+ * */
372
+ Buffer.allocUnsafe = function (size) {
373
+ return allocUnsafe(size);
374
+ };
375
+ /**
376
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
377
+ */
378
+ Buffer.allocUnsafeSlow = function (size) {
379
+ return allocUnsafe(size);
380
+ };
381
+ function fromString(string, encoding) {
382
+ if (typeof encoding !== "string" || encoding === "") {
383
+ encoding = "utf8";
384
+ }
385
+ if (!Buffer.isEncoding(encoding)) {
386
+ throw new TypeError("Unknown encoding: " + encoding);
387
+ }
388
+ const length = byteLength(string, encoding) | 0;
389
+ let buf = createBuffer(length);
390
+ const actual = buf.write(string, encoding);
391
+ if (actual !== length) {
392
+ // Writing a hex string, for example, that contains invalid characters will
393
+ // cause everything after the first invalid character to be ignored. (e.g.
394
+ // 'abxxcd' will be treated as 'ab')
395
+ buf = buf.slice(0, actual);
396
+ }
397
+ return buf;
398
+ }
399
+ function fromArrayLike(array) {
400
+ const length = array.length < 0 ? 0 : checked(array.length) | 0;
401
+ const buf = createBuffer(length);
402
+ for (let i = 0; i < length; i += 1) {
403
+ buf[i] = array[i] & 255;
404
+ }
405
+ return buf;
406
+ }
407
+ function fromArrayView(arrayView) {
408
+ if (isInstance(arrayView, Uint8Array)) {
409
+ const copy = new Uint8Array(arrayView);
410
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
411
+ }
412
+ return fromArrayLike(arrayView);
413
+ }
414
+ function fromArrayBuffer(array, byteOffset, length) {
415
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
416
+ throw new RangeError("\"offset\" is outside of buffer bounds");
417
+ }
418
+ if (array.byteLength < byteOffset + (length || 0)) {
419
+ throw new RangeError("\"length\" is outside of buffer bounds");
420
+ }
421
+ let buf;
422
+ if (byteOffset === undefined && length === undefined) {
423
+ buf = new Uint8Array(array);
424
+ } else if (length === undefined) {
425
+ buf = new Uint8Array(array, byteOffset);
426
+ } else {
427
+ buf = new Uint8Array(array, byteOffset, length);
428
+ }
429
+
430
+ // Return an augmented `Uint8Array` instance
431
+ Object.setPrototypeOf(buf, Buffer.prototype);
432
+ return buf;
433
+ }
434
+ function fromObject(obj) {
435
+ if (Buffer.isBuffer(obj)) {
436
+ const len = checked(obj.length) | 0;
437
+ const buf = createBuffer(len);
438
+ if (buf.length === 0) {
439
+ return buf;
440
+ }
441
+ obj.copy(buf, 0, 0, len);
442
+ return buf;
443
+ }
444
+ if (obj.length !== undefined) {
445
+ if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
446
+ return createBuffer(0);
447
+ }
448
+ return fromArrayLike(obj);
449
+ }
450
+ if (obj.type === "Buffer" && Array.isArray(obj.data)) {
451
+ return fromArrayLike(obj.data);
452
+ }
453
+ }
454
+ function checked(length) {
455
+ // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
456
+ // length is NaN (which is otherwise coerced to zero.)
457
+ if (length >= K_MAX_LENGTH) {
458
+ throw new RangeError("Attempt to allocate Buffer larger than maximum " + "size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
459
+ }
460
+ return length | 0;
461
+ }
462
+ function SlowBuffer(length) {
463
+ if (+length != length) {
464
+ // eslint-disable-line eqeqeq
465
+ length = 0;
466
+ }
467
+ return Buffer.alloc(+length);
468
+ }
469
+ Buffer.isBuffer = function isBuffer(b) {
470
+ return b != null && b._isBuffer === true && b !== Buffer.prototype; // so Buffer.isBuffer(Buffer.prototype) will be false
471
+ };
472
+ Buffer.compare = function compare(a, b) {
473
+ if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength);
474
+ if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength);
475
+ if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
476
+ throw new TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
477
+ }
478
+ if (a === b) return 0;
479
+ let x = a.length;
480
+ let y = b.length;
481
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
482
+ if (a[i] !== b[i]) {
483
+ x = a[i];
484
+ y = b[i];
485
+ break;
486
+ }
487
+ }
488
+ if (x < y) return -1;
489
+ if (y < x) return 1;
490
+ return 0;
491
+ };
492
+ Buffer.isEncoding = function isEncoding(encoding) {
493
+ switch (String(encoding).toLowerCase()) {
494
+ case "hex":
495
+ case "utf8":
496
+ case "utf-8":
497
+ case "ascii":
498
+ case "latin1":
499
+ case "binary":
500
+ case "base64":
501
+ case "ucs2":
502
+ case "ucs-2":
503
+ case "utf16le":
504
+ case "utf-16le":
505
+ return true;
506
+ default:
507
+ return false;
508
+ }
509
+ };
510
+ Buffer.concat = function concat(list, length) {
511
+ if (!Array.isArray(list)) {
512
+ throw new TypeError("\"list\" argument must be an Array of Buffers");
513
+ }
514
+ if (list.length === 0) {
515
+ return Buffer.alloc(0);
516
+ }
517
+ let i;
518
+ if (length === undefined) {
519
+ length = 0;
520
+ for (i = 0; i < list.length; ++i) {
521
+ length += list[i].length;
522
+ }
523
+ }
524
+ const buffer = Buffer.allocUnsafe(length);
525
+ let pos = 0;
526
+ for (i = 0; i < list.length; ++i) {
527
+ let buf = list[i];
528
+ if (isInstance(buf, Uint8Array)) {
529
+ if (pos + buf.length > buffer.length) {
530
+ if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
531
+ buf.copy(buffer, pos);
532
+ } else {
533
+ Uint8Array.prototype.set.call(buffer, buf, pos);
534
+ }
535
+ } else if (!Buffer.isBuffer(buf)) {
536
+ throw new TypeError("\"list\" argument must be an Array of Buffers");
537
+ } else {
538
+ buf.copy(buffer, pos);
539
+ }
540
+ pos += buf.length;
541
+ }
542
+ return buffer;
543
+ };
544
+ function byteLength(string, encoding) {
545
+ if (Buffer.isBuffer(string)) {
546
+ return string.length;
547
+ }
548
+ if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
549
+ return string.byteLength;
550
+ }
551
+ if (typeof string !== "string") {
552
+ throw new TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. " + "Received type " + typeof string);
553
+ }
554
+ const len = string.length;
555
+ const mustMatch = arguments.length > 2 && arguments[2] === true;
556
+ if (!mustMatch && len === 0) return 0;
557
+
558
+ // Use a for loop to avoid recursion
559
+ let loweredCase = false;
560
+ for (;;) {
561
+ switch (encoding) {
562
+ case "ascii":
563
+ case "latin1":
564
+ case "binary":
565
+ return len;
566
+ case "utf8":
567
+ case "utf-8":
568
+ return utf8ToBytes(string).length;
569
+ case "ucs2":
570
+ case "ucs-2":
571
+ case "utf16le":
572
+ case "utf-16le":
573
+ return len * 2;
574
+ case "hex":
575
+ return len >>> 1;
576
+ case "base64":
577
+ return base64ToBytes(string).length;
578
+ default:
579
+ if (loweredCase) {
580
+ return mustMatch ? -1 : utf8ToBytes(string).length; // assume utf8
581
+ }
582
+ encoding = ("" + encoding).toLowerCase();
583
+ loweredCase = true;
584
+ }
585
+ }
586
+ }
587
+ Buffer.byteLength = byteLength;
588
+ function slowToString(encoding, start, end) {
589
+ let loweredCase = false;
590
+
591
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
592
+ // property of a typed array.
593
+
594
+ // This behaves neither like String nor Uint8Array in that we set start/end
595
+ // to their upper/lower bounds if the value passed is out of range.
596
+ // undefined is handled specially as per ECMA-262 6th Edition,
597
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
598
+ if (start === undefined || start < 0) {
599
+ start = 0;
600
+ }
601
+ // Return early if start > this.length. Done here to prevent potential uint32
602
+ // coercion fail below.
603
+ if (start > this.length) {
604
+ return "";
605
+ }
606
+ if (end === undefined || end > this.length) {
607
+ end = this.length;
608
+ }
609
+ if (end <= 0) {
610
+ return "";
611
+ }
612
+
613
+ // Force coercion to uint32. This will also coerce falsey/NaN values to 0.
614
+ end >>>= 0;
615
+ start >>>= 0;
616
+ if (end <= start) {
617
+ return "";
618
+ }
619
+ if (!encoding) encoding = "utf8";
620
+ while (true) {
621
+ switch (encoding) {
622
+ case "hex":
623
+ return hexSlice(this, start, end);
624
+ case "utf8":
625
+ case "utf-8":
626
+ return utf8Slice(this, start, end);
627
+ case "ascii":
628
+ return asciiSlice(this, start, end);
629
+ case "latin1":
630
+ case "binary":
631
+ return latin1Slice(this, start, end);
632
+ case "base64":
633
+ return base64Slice(this, start, end);
634
+ case "ucs2":
635
+ case "ucs-2":
636
+ case "utf16le":
637
+ case "utf-16le":
638
+ return utf16leSlice(this, start, end);
639
+ default:
640
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
641
+ encoding = (encoding + "").toLowerCase();
642
+ loweredCase = true;
643
+ }
644
+ }
645
+ }
646
+
647
+ // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
648
+ // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
649
+ // reliably in a browserify context because there could be multiple different
650
+ // copies of the 'buffer' package in use. This method works even for Buffer
651
+ // instances that were created from another copy of the `buffer` package.
652
+ // See: https://github.com/feross/buffer/issues/154
653
+ Buffer.prototype._isBuffer = true;
654
+ function swap(b, n, m) {
655
+ const i = b[n];
656
+ b[n] = b[m];
657
+ b[m] = i;
658
+ }
659
+ Buffer.prototype.swap16 = function swap16() {
660
+ const len = this.length;
661
+ if (len % 2 !== 0) {
662
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
663
+ }
664
+ for (let i = 0; i < len; i += 2) {
665
+ swap(this, i, i + 1);
666
+ }
667
+ return this;
668
+ };
669
+ Buffer.prototype.swap32 = function swap32() {
670
+ const len = this.length;
671
+ if (len % 4 !== 0) {
672
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
673
+ }
674
+ for (let i = 0; i < len; i += 4) {
675
+ swap(this, i, i + 3);
676
+ swap(this, i + 1, i + 2);
677
+ }
678
+ return this;
679
+ };
680
+ Buffer.prototype.swap64 = function swap64() {
681
+ const len = this.length;
682
+ if (len % 8 !== 0) {
683
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
684
+ }
685
+ for (let i = 0; i < len; i += 8) {
686
+ swap(this, i, i + 7);
687
+ swap(this, i + 1, i + 6);
688
+ swap(this, i + 2, i + 5);
689
+ swap(this, i + 3, i + 4);
690
+ }
691
+ return this;
692
+ };
693
+ Buffer.prototype.toString = function toString() {
694
+ const length = this.length;
695
+ if (length === 0) return "";
696
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
697
+ return slowToString.apply(this, arguments);
698
+ };
699
+ Buffer.prototype.toLocaleString = Buffer.prototype.toString;
700
+ Buffer.prototype.equals = function equals(b) {
701
+ if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
702
+ if (this === b) return true;
703
+ return Buffer.compare(this, b) === 0;
704
+ };
705
+ Buffer.prototype.inspect = function inspect() {
706
+ let str = "";
707
+ const max = exports.INSPECT_MAX_BYTES;
708
+ str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
709
+ if (this.length > max) str += " ... ";
710
+ return "<Buffer " + str + ">";
711
+ };
712
+ if (customInspectSymbol) {
713
+ Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect;
714
+ }
715
+ Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
716
+ if (isInstance(target, Uint8Array)) {
717
+ target = Buffer.from(target, target.offset, target.byteLength);
718
+ }
719
+ if (!Buffer.isBuffer(target)) {
720
+ throw new TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. " + "Received type " + typeof target);
721
+ }
722
+ if (start === undefined) {
723
+ start = 0;
724
+ }
725
+ if (end === undefined) {
726
+ end = target ? target.length : 0;
727
+ }
728
+ if (thisStart === undefined) {
729
+ thisStart = 0;
730
+ }
731
+ if (thisEnd === undefined) {
732
+ thisEnd = this.length;
733
+ }
734
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
735
+ throw new RangeError("out of range index");
736
+ }
737
+ if (thisStart >= thisEnd && start >= end) {
738
+ return 0;
739
+ }
740
+ if (thisStart >= thisEnd) {
741
+ return -1;
742
+ }
743
+ if (start >= end) {
744
+ return 1;
745
+ }
746
+ start >>>= 0;
747
+ end >>>= 0;
748
+ thisStart >>>= 0;
749
+ thisEnd >>>= 0;
750
+ if (this === target) return 0;
751
+ let x = thisEnd - thisStart;
752
+ let y = end - start;
753
+ const len = Math.min(x, y);
754
+ const thisCopy = this.slice(thisStart, thisEnd);
755
+ const targetCopy = target.slice(start, end);
756
+ for (let i = 0; i < len; ++i) {
757
+ if (thisCopy[i] !== targetCopy[i]) {
758
+ x = thisCopy[i];
759
+ y = targetCopy[i];
760
+ break;
761
+ }
762
+ }
763
+ if (x < y) return -1;
764
+ if (y < x) return 1;
765
+ return 0;
766
+ };
767
+
768
+ // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
769
+ // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
770
+ //
771
+ // Arguments:
772
+ // - buffer - a Buffer to search
773
+ // - val - a string, Buffer, or number
774
+ // - byteOffset - an index into `buffer`; will be clamped to an int32
775
+ // - encoding - an optional encoding, relevant is val is a string
776
+ // - dir - true for indexOf, false for lastIndexOf
777
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
778
+ // Empty buffer means no match
779
+ if (buffer.length === 0) return -1;
780
+
781
+ // Normalize byteOffset
782
+ if (typeof byteOffset === "string") {
783
+ encoding = byteOffset;
784
+ byteOffset = 0;
785
+ } else if (byteOffset > 2147483647) {
786
+ byteOffset = 2147483647;
787
+ } else if (byteOffset < -2147483648) {
788
+ byteOffset = -2147483648;
789
+ }
790
+ byteOffset = +byteOffset; // Coerce to Number.
791
+ if (numberIsNaN(byteOffset)) {
792
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
793
+ byteOffset = dir ? 0 : buffer.length - 1;
794
+ }
795
+
796
+ // Normalize byteOffset: negative offsets start from the end of the buffer
797
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
798
+ if (byteOffset >= buffer.length) {
799
+ if (dir) return -1;else byteOffset = buffer.length - 1;
800
+ } else if (byteOffset < 0) {
801
+ if (dir) byteOffset = 0;else return -1;
802
+ }
803
+
804
+ // Normalize val
805
+ if (typeof val === "string") {
806
+ val = Buffer.from(val, encoding);
807
+ }
808
+
809
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
810
+ if (Buffer.isBuffer(val)) {
811
+ // Special case: looking for empty string/buffer always fails
812
+ if (val.length === 0) {
813
+ return -1;
814
+ }
815
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
816
+ } else if (typeof val === "number") {
817
+ val = val & 255; // Search for a byte value [0-255]
818
+ if (typeof Uint8Array.prototype.indexOf === "function") {
819
+ if (dir) {
820
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
821
+ } else {
822
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
823
+ }
824
+ }
825
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
826
+ }
827
+ throw new TypeError("val must be string, number or Buffer");
828
+ }
829
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
830
+ let indexSize = 1;
831
+ let arrLength = arr.length;
832
+ let valLength = val.length;
833
+ if (encoding !== undefined) {
834
+ encoding = String(encoding).toLowerCase();
835
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
836
+ if (arr.length < 2 || val.length < 2) {
837
+ return -1;
838
+ }
839
+ indexSize = 2;
840
+ arrLength /= 2;
841
+ valLength /= 2;
842
+ byteOffset /= 2;
843
+ }
844
+ }
845
+ function read(buf, i) {
846
+ if (indexSize === 1) {
847
+ return buf[i];
848
+ } else {
849
+ return buf.readUInt16BE(i * indexSize);
850
+ }
851
+ }
852
+ let i;
853
+ if (dir) {
854
+ let foundIndex = -1;
855
+ for (i = byteOffset; i < arrLength; i++) {
856
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
857
+ if (foundIndex === -1) foundIndex = i;
858
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
859
+ } else {
860
+ if (foundIndex !== -1) i -= i - foundIndex;
861
+ foundIndex = -1;
862
+ }
863
+ }
864
+ } else {
865
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
866
+ for (i = byteOffset; i >= 0; i--) {
867
+ let found = true;
868
+ for (let j = 0; j < valLength; j++) {
869
+ if (read(arr, i + j) !== read(val, j)) {
870
+ found = false;
871
+ break;
872
+ }
873
+ }
874
+ if (found) return i;
875
+ }
876
+ }
877
+ return -1;
878
+ }
879
+ Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
880
+ return this.indexOf(val, byteOffset, encoding) !== -1;
881
+ };
882
+ Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
883
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
884
+ };
885
+ Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
886
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
887
+ };
888
+ function hexWrite(buf, string, offset, length) {
889
+ offset = Number(offset) || 0;
890
+ const remaining = buf.length - offset;
891
+ if (!length) {
892
+ length = remaining;
893
+ } else {
894
+ length = Number(length);
895
+ if (length > remaining) {
896
+ length = remaining;
897
+ }
898
+ }
899
+ const strLen = string.length;
900
+ if (length > strLen / 2) {
901
+ length = strLen / 2;
902
+ }
903
+ let i;
904
+ for (i = 0; i < length; ++i) {
905
+ const parsed = parseInt(string.substr(i * 2, 2), 16);
906
+ if (numberIsNaN(parsed)) return i;
907
+ buf[offset + i] = parsed;
908
+ }
909
+ return i;
910
+ }
911
+ function utf8Write(buf, string, offset, length) {
912
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
913
+ }
914
+ function asciiWrite(buf, string, offset, length) {
915
+ return blitBuffer(asciiToBytes(string), buf, offset, length);
916
+ }
917
+ function base64Write(buf, string, offset, length) {
918
+ return blitBuffer(base64ToBytes(string), buf, offset, length);
919
+ }
920
+ function ucs2Write(buf, string, offset, length) {
921
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length);
922
+ }
923
+ Buffer.prototype.write = function write(string, offset, length, encoding) {
924
+ // Buffer#write(string)
925
+ if (offset === undefined) {
926
+ encoding = "utf8";
927
+ length = this.length;
928
+ offset = 0;
929
+ // Buffer#write(string, encoding)
930
+ } else if (length === undefined && typeof offset === "string") {
931
+ encoding = offset;
932
+ length = this.length;
933
+ offset = 0;
934
+ // Buffer#write(string, offset[, length][, encoding])
935
+ } else if (isFinite(offset)) {
936
+ offset = offset >>> 0;
937
+ if (isFinite(length)) {
938
+ length = length >>> 0;
939
+ if (encoding === undefined) encoding = "utf8";
940
+ } else {
941
+ encoding = length;
942
+ length = undefined;
943
+ }
944
+ } else {
945
+ throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
946
+ }
947
+ const remaining = this.length - offset;
948
+ if (length === undefined || length > remaining) length = remaining;
949
+ if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
950
+ throw new RangeError("Attempt to write outside buffer bounds");
951
+ }
952
+ if (!encoding) encoding = "utf8";
953
+ let loweredCase = false;
954
+ for (;;) {
955
+ switch (encoding) {
956
+ case "hex":
957
+ return hexWrite(this, string, offset, length);
958
+ case "utf8":
959
+ case "utf-8":
960
+ return utf8Write(this, string, offset, length);
961
+ case "ascii":
962
+ case "latin1":
963
+ case "binary":
964
+ return asciiWrite(this, string, offset, length);
965
+ case "base64":
966
+ // Warning: maxLength not taken into account in base64Write
967
+ return base64Write(this, string, offset, length);
968
+ case "ucs2":
969
+ case "ucs-2":
970
+ case "utf16le":
971
+ case "utf-16le":
972
+ return ucs2Write(this, string, offset, length);
973
+ default:
974
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
975
+ encoding = ("" + encoding).toLowerCase();
976
+ loweredCase = true;
977
+ }
978
+ }
979
+ };
980
+ Buffer.prototype.toJSON = function toJSON() {
981
+ return {
982
+ type: "Buffer",
983
+ data: Array.prototype.slice.call(this._arr || this, 0)
984
+ };
985
+ };
986
+ function base64Slice(buf, start, end) {
987
+ if (start === 0 && end === buf.length) {
988
+ return base64.fromByteArray(buf);
989
+ } else {
990
+ return base64.fromByteArray(buf.slice(start, end));
991
+ }
992
+ }
993
+ function utf8Slice(buf, start, end) {
994
+ end = Math.min(buf.length, end);
995
+ const res = [];
996
+ let i = start;
997
+ while (i < end) {
998
+ const firstByte = buf[i];
999
+ let codePoint = null;
1000
+ let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
1001
+ if (i + bytesPerSequence <= end) {
1002
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1003
+ switch (bytesPerSequence) {
1004
+ case 1:
1005
+ if (firstByte < 128) {
1006
+ codePoint = firstByte;
1007
+ }
1008
+ break;
1009
+ case 2:
1010
+ secondByte = buf[i + 1];
1011
+ if ((secondByte & 192) === 128) {
1012
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
1013
+ if (tempCodePoint > 127) {
1014
+ codePoint = tempCodePoint;
1015
+ }
1016
+ }
1017
+ break;
1018
+ case 3:
1019
+ secondByte = buf[i + 1];
1020
+ thirdByte = buf[i + 2];
1021
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
1022
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
1023
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
1024
+ codePoint = tempCodePoint;
1025
+ }
1026
+ }
1027
+ break;
1028
+ case 4:
1029
+ secondByte = buf[i + 1];
1030
+ thirdByte = buf[i + 2];
1031
+ fourthByte = buf[i + 3];
1032
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
1033
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
1034
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
1035
+ codePoint = tempCodePoint;
1036
+ }
1037
+ }
1038
+ }
1039
+ }
1040
+ if (codePoint === null) {
1041
+ // we did not generate a valid codePoint so insert a
1042
+ // replacement char (U+FFFD) and advance only 1 byte
1043
+ codePoint = 65533;
1044
+ bytesPerSequence = 1;
1045
+ } else if (codePoint > 65535) {
1046
+ // encode to utf16 (surrogate pair dance)
1047
+ codePoint -= 65536;
1048
+ res.push(codePoint >>> 10 & 1023 | 55296);
1049
+ codePoint = 56320 | codePoint & 1023;
1050
+ }
1051
+ res.push(codePoint);
1052
+ i += bytesPerSequence;
1053
+ }
1054
+ return decodeCodePointsArray(res);
1055
+ }
1056
+
1057
+ // Based on http://stackoverflow.com/a/22747272/680742, the browser with
1058
+ // the lowest limit is Chrome, with 0x10000 args.
1059
+ // We go 1 magnitude less, for safety
1060
+ const MAX_ARGUMENTS_LENGTH = 4096;
1061
+ function decodeCodePointsArray(codePoints) {
1062
+ const len = codePoints.length;
1063
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1064
+ return String.fromCharCode.apply(String, codePoints); // avoid extra slice()
1065
+ }
1066
+
1067
+ // Decode in chunks to avoid "call stack size exceeded".
1068
+ let res = "";
1069
+ let i = 0;
1070
+ while (i < len) {
1071
+ res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
1072
+ }
1073
+ return res;
1074
+ }
1075
+ function asciiSlice(buf, start, end) {
1076
+ let ret = "";
1077
+ end = Math.min(buf.length, end);
1078
+ for (let i = start; i < end; ++i) {
1079
+ ret += String.fromCharCode(buf[i] & 127);
1080
+ }
1081
+ return ret;
1082
+ }
1083
+ function latin1Slice(buf, start, end) {
1084
+ let ret = "";
1085
+ end = Math.min(buf.length, end);
1086
+ for (let i = start; i < end; ++i) {
1087
+ ret += String.fromCharCode(buf[i]);
1088
+ }
1089
+ return ret;
1090
+ }
1091
+ function hexSlice(buf, start, end) {
1092
+ const len = buf.length;
1093
+ if (!start || start < 0) start = 0;
1094
+ if (!end || end < 0 || end > len) end = len;
1095
+ let out = "";
1096
+ for (let i = start; i < end; ++i) {
1097
+ out += hexSliceLookupTable[buf[i]];
1098
+ }
1099
+ return out;
1100
+ }
1101
+ function utf16leSlice(buf, start, end) {
1102
+ const bytes = buf.slice(start, end);
1103
+ let res = "";
1104
+ // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)
1105
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1106
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1107
+ }
1108
+ return res;
1109
+ }
1110
+ Buffer.prototype.slice = function slice(start, end) {
1111
+ const len = this.length;
1112
+ start = ~~start;
1113
+ end = end === undefined ? len : ~~end;
1114
+ if (start < 0) {
1115
+ start += len;
1116
+ if (start < 0) start = 0;
1117
+ } else if (start > len) {
1118
+ start = len;
1119
+ }
1120
+ if (end < 0) {
1121
+ end += len;
1122
+ if (end < 0) end = 0;
1123
+ } else if (end > len) {
1124
+ end = len;
1125
+ }
1126
+ if (end < start) end = start;
1127
+ const newBuf = this.subarray(start, end);
1128
+ // Return an augmented `Uint8Array` instance
1129
+ Object.setPrototypeOf(newBuf, Buffer.prototype);
1130
+ return newBuf;
1131
+ };
1132
+
1133
+ /*
1134
+ * Need to make sure that buffer isn't trying to write out of bounds.
1135
+ */
1136
+ function checkOffset(offset, ext, length) {
1137
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
1138
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
1139
+ }
1140
+ Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) {
1141
+ offset = offset >>> 0;
1142
+ byteLength = byteLength >>> 0;
1143
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1144
+ let val = this[offset];
1145
+ let mul = 1;
1146
+ let i = 0;
1147
+ while (++i < byteLength && (mul *= 256)) {
1148
+ val += this[offset + i] * mul;
1149
+ }
1150
+ return val;
1151
+ };
1152
+ Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) {
1153
+ offset = offset >>> 0;
1154
+ byteLength = byteLength >>> 0;
1155
+ if (!noAssert) {
1156
+ checkOffset(offset, byteLength, this.length);
1157
+ }
1158
+ let val = this[offset + --byteLength];
1159
+ let mul = 1;
1160
+ while (byteLength > 0 && (mul *= 256)) {
1161
+ val += this[offset + --byteLength] * mul;
1162
+ }
1163
+ return val;
1164
+ };
1165
+ Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) {
1166
+ offset = offset >>> 0;
1167
+ if (!noAssert) checkOffset(offset, 1, this.length);
1168
+ return this[offset];
1169
+ };
1170
+ Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
1171
+ offset = offset >>> 0;
1172
+ if (!noAssert) checkOffset(offset, 2, this.length);
1173
+ return this[offset] | this[offset + 1] << 8;
1174
+ };
1175
+ Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
1176
+ offset = offset >>> 0;
1177
+ if (!noAssert) checkOffset(offset, 2, this.length);
1178
+ return this[offset] << 8 | this[offset + 1];
1179
+ };
1180
+ Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
1181
+ offset = offset >>> 0;
1182
+ if (!noAssert) checkOffset(offset, 4, this.length);
1183
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
1184
+ };
1185
+ Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
1186
+ offset = offset >>> 0;
1187
+ if (!noAssert) checkOffset(offset, 4, this.length);
1188
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
1189
+ };
1190
+ Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
1191
+ offset = offset >>> 0;
1192
+ validateNumber(offset, "offset");
1193
+ const first = this[offset];
1194
+ const last = this[offset + 7];
1195
+ if (first === undefined || last === undefined) {
1196
+ boundsError(offset, this.length - 8);
1197
+ }
1198
+ const lo = first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24;
1199
+ const hi = this[++offset] + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + last * 2 ** 24;
1200
+ return BigInt(lo) + (BigInt(hi) << BigInt(32));
1201
+ });
1202
+ Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
1203
+ offset = offset >>> 0;
1204
+ validateNumber(offset, "offset");
1205
+ const first = this[offset];
1206
+ const last = this[offset + 7];
1207
+ if (first === undefined || last === undefined) {
1208
+ boundsError(offset, this.length - 8);
1209
+ }
1210
+ const hi = first * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1211
+ const lo = this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last;
1212
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo);
1213
+ });
1214
+ Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) {
1215
+ offset = offset >>> 0;
1216
+ byteLength = byteLength >>> 0;
1217
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1218
+ let val = this[offset];
1219
+ let mul = 1;
1220
+ let i = 0;
1221
+ while (++i < byteLength && (mul *= 256)) {
1222
+ val += this[offset + i] * mul;
1223
+ }
1224
+ mul *= 128;
1225
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1226
+ return val;
1227
+ };
1228
+ Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) {
1229
+ offset = offset >>> 0;
1230
+ byteLength = byteLength >>> 0;
1231
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
1232
+ let i = byteLength;
1233
+ let mul = 1;
1234
+ let val = this[offset + --i];
1235
+ while (i > 0 && (mul *= 256)) {
1236
+ val += this[offset + --i] * mul;
1237
+ }
1238
+ mul *= 128;
1239
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
1240
+ return val;
1241
+ };
1242
+ Buffer.prototype.readInt8 = function readInt8(offset, noAssert) {
1243
+ offset = offset >>> 0;
1244
+ if (!noAssert) checkOffset(offset, 1, this.length);
1245
+ if (!(this[offset] & 128)) return this[offset];
1246
+ return (255 - this[offset] + 1) * -1;
1247
+ };
1248
+ Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
1249
+ offset = offset >>> 0;
1250
+ if (!noAssert) checkOffset(offset, 2, this.length);
1251
+ const val = this[offset] | this[offset + 1] << 8;
1252
+ return val & 32768 ? val | 4294901760 : val;
1253
+ };
1254
+ Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
1255
+ offset = offset >>> 0;
1256
+ if (!noAssert) checkOffset(offset, 2, this.length);
1257
+ const val = this[offset + 1] | this[offset] << 8;
1258
+ return val & 32768 ? val | 4294901760 : val;
1259
+ };
1260
+ Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
1261
+ offset = offset >>> 0;
1262
+ if (!noAssert) checkOffset(offset, 4, this.length);
1263
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
1264
+ };
1265
+ Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
1266
+ offset = offset >>> 0;
1267
+ if (!noAssert) checkOffset(offset, 4, this.length);
1268
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
1269
+ };
1270
+ Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
1271
+ offset = offset >>> 0;
1272
+ validateNumber(offset, "offset");
1273
+ const first = this[offset];
1274
+ const last = this[offset + 7];
1275
+ if (first === undefined || last === undefined) {
1276
+ boundsError(offset, this.length - 8);
1277
+ }
1278
+ const val = this[offset + 4] + this[offset + 5] * 2 ** 8 + this[offset + 6] * 2 ** 16 + (last << 24); // Overflow
1279
+
1280
+ return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * 2 ** 8 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 24);
1281
+ });
1282
+ Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
1283
+ offset = offset >>> 0;
1284
+ validateNumber(offset, "offset");
1285
+ const first = this[offset];
1286
+ const last = this[offset + 7];
1287
+ if (first === undefined || last === undefined) {
1288
+ boundsError(offset, this.length - 8);
1289
+ }
1290
+ const val = (first << 24) +
1291
+ // Overflow
1292
+ this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + this[++offset];
1293
+ return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * 2 ** 24 + this[++offset] * 2 ** 16 + this[++offset] * 2 ** 8 + last);
1294
+ });
1295
+ Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
1296
+ offset = offset >>> 0;
1297
+ if (!noAssert) checkOffset(offset, 4, this.length);
1298
+ return ieee754.read(this, offset, true, 23, 4);
1299
+ };
1300
+ Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
1301
+ offset = offset >>> 0;
1302
+ if (!noAssert) checkOffset(offset, 4, this.length);
1303
+ return ieee754.read(this, offset, false, 23, 4);
1304
+ };
1305
+ Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
1306
+ offset = offset >>> 0;
1307
+ if (!noAssert) checkOffset(offset, 8, this.length);
1308
+ return ieee754.read(this, offset, true, 52, 8);
1309
+ };
1310
+ Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
1311
+ offset = offset >>> 0;
1312
+ if (!noAssert) checkOffset(offset, 8, this.length);
1313
+ return ieee754.read(this, offset, false, 52, 8);
1314
+ };
1315
+ function checkInt(buf, value, offset, ext, max, min) {
1316
+ if (!Buffer.isBuffer(buf)) throw new TypeError("\"buffer\" argument must be a Buffer instance");
1317
+ if (value > max || value < min) throw new RangeError("\"value\" argument is out of bounds");
1318
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1319
+ }
1320
+ Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) {
1321
+ value = +value;
1322
+ offset = offset >>> 0;
1323
+ byteLength = byteLength >>> 0;
1324
+ if (!noAssert) {
1325
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1326
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1327
+ }
1328
+ let mul = 1;
1329
+ let i = 0;
1330
+ this[offset] = value & 255;
1331
+ while (++i < byteLength && (mul *= 256)) {
1332
+ this[offset + i] = value / mul & 255;
1333
+ }
1334
+ return offset + byteLength;
1335
+ };
1336
+ Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) {
1337
+ value = +value;
1338
+ offset = offset >>> 0;
1339
+ byteLength = byteLength >>> 0;
1340
+ if (!noAssert) {
1341
+ const maxBytes = Math.pow(2, 8 * byteLength) - 1;
1342
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
1343
+ }
1344
+ let i = byteLength - 1;
1345
+ let mul = 1;
1346
+ this[offset + i] = value & 255;
1347
+ while (--i >= 0 && (mul *= 256)) {
1348
+ this[offset + i] = value / mul & 255;
1349
+ }
1350
+ return offset + byteLength;
1351
+ };
1352
+ Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
1353
+ value = +value;
1354
+ offset = offset >>> 0;
1355
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
1356
+ this[offset] = value & 255;
1357
+ return offset + 1;
1358
+ };
1359
+ Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
1360
+ value = +value;
1361
+ offset = offset >>> 0;
1362
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1363
+ this[offset] = value & 255;
1364
+ this[offset + 1] = value >>> 8;
1365
+ return offset + 2;
1366
+ };
1367
+ Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
1368
+ value = +value;
1369
+ offset = offset >>> 0;
1370
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1371
+ this[offset] = value >>> 8;
1372
+ this[offset + 1] = value & 255;
1373
+ return offset + 2;
1374
+ };
1375
+ Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
1376
+ value = +value;
1377
+ offset = offset >>> 0;
1378
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1379
+ this[offset + 3] = value >>> 24;
1380
+ this[offset + 2] = value >>> 16;
1381
+ this[offset + 1] = value >>> 8;
1382
+ this[offset] = value & 255;
1383
+ return offset + 4;
1384
+ };
1385
+ Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
1386
+ value = +value;
1387
+ offset = offset >>> 0;
1388
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1389
+ this[offset] = value >>> 24;
1390
+ this[offset + 1] = value >>> 16;
1391
+ this[offset + 2] = value >>> 8;
1392
+ this[offset + 3] = value & 255;
1393
+ return offset + 4;
1394
+ };
1395
+ function wrtBigUInt64LE(buf, value, offset, min, max) {
1396
+ checkIntBI(value, min, max, buf, offset, 7);
1397
+ let lo = Number(value & BigInt(4294967295));
1398
+ buf[offset++] = lo;
1399
+ lo = lo >> 8;
1400
+ buf[offset++] = lo;
1401
+ lo = lo >> 8;
1402
+ buf[offset++] = lo;
1403
+ lo = lo >> 8;
1404
+ buf[offset++] = lo;
1405
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1406
+ buf[offset++] = hi;
1407
+ hi = hi >> 8;
1408
+ buf[offset++] = hi;
1409
+ hi = hi >> 8;
1410
+ buf[offset++] = hi;
1411
+ hi = hi >> 8;
1412
+ buf[offset++] = hi;
1413
+ return offset;
1414
+ }
1415
+ function wrtBigUInt64BE(buf, value, offset, min, max) {
1416
+ checkIntBI(value, min, max, buf, offset, 7);
1417
+ let lo = Number(value & BigInt(4294967295));
1418
+ buf[offset + 7] = lo;
1419
+ lo = lo >> 8;
1420
+ buf[offset + 6] = lo;
1421
+ lo = lo >> 8;
1422
+ buf[offset + 5] = lo;
1423
+ lo = lo >> 8;
1424
+ buf[offset + 4] = lo;
1425
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1426
+ buf[offset + 3] = hi;
1427
+ hi = hi >> 8;
1428
+ buf[offset + 2] = hi;
1429
+ hi = hi >> 8;
1430
+ buf[offset + 1] = hi;
1431
+ hi = hi >> 8;
1432
+ buf[offset] = hi;
1433
+ return offset + 8;
1434
+ }
1435
+ Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
1436
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1437
+ });
1438
+ Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
1439
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1440
+ });
1441
+ Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) {
1442
+ value = +value;
1443
+ offset = offset >>> 0;
1444
+ if (!noAssert) {
1445
+ const limit = Math.pow(2, 8 * byteLength - 1);
1446
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1447
+ }
1448
+ let i = 0;
1449
+ let mul = 1;
1450
+ let sub = 0;
1451
+ this[offset] = value & 255;
1452
+ while (++i < byteLength && (mul *= 256)) {
1453
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1454
+ sub = 1;
1455
+ }
1456
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1457
+ }
1458
+ return offset + byteLength;
1459
+ };
1460
+ Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) {
1461
+ value = +value;
1462
+ offset = offset >>> 0;
1463
+ if (!noAssert) {
1464
+ const limit = Math.pow(2, 8 * byteLength - 1);
1465
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
1466
+ }
1467
+ let i = byteLength - 1;
1468
+ let mul = 1;
1469
+ let sub = 0;
1470
+ this[offset + i] = value & 255;
1471
+ while (--i >= 0 && (mul *= 256)) {
1472
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1473
+ sub = 1;
1474
+ }
1475
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1476
+ }
1477
+ return offset + byteLength;
1478
+ };
1479
+ Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
1480
+ value = +value;
1481
+ offset = offset >>> 0;
1482
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
1483
+ if (value < 0) value = 255 + value + 1;
1484
+ this[offset] = value & 255;
1485
+ return offset + 1;
1486
+ };
1487
+ Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
1488
+ value = +value;
1489
+ offset = offset >>> 0;
1490
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1491
+ this[offset] = value & 255;
1492
+ this[offset + 1] = value >>> 8;
1493
+ return offset + 2;
1494
+ };
1495
+ Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
1496
+ value = +value;
1497
+ offset = offset >>> 0;
1498
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1499
+ this[offset] = value >>> 8;
1500
+ this[offset + 1] = value & 255;
1501
+ return offset + 2;
1502
+ };
1503
+ Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
1504
+ value = +value;
1505
+ offset = offset >>> 0;
1506
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1507
+ this[offset] = value & 255;
1508
+ this[offset + 1] = value >>> 8;
1509
+ this[offset + 2] = value >>> 16;
1510
+ this[offset + 3] = value >>> 24;
1511
+ return offset + 4;
1512
+ };
1513
+ Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
1514
+ value = +value;
1515
+ offset = offset >>> 0;
1516
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1517
+ if (value < 0) value = 4294967295 + value + 1;
1518
+ this[offset] = value >>> 24;
1519
+ this[offset + 1] = value >>> 16;
1520
+ this[offset + 2] = value >>> 8;
1521
+ this[offset + 3] = value & 255;
1522
+ return offset + 4;
1523
+ };
1524
+ Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
1525
+ return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1526
+ });
1527
+ Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
1528
+ return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1529
+ });
1530
+ function checkIEEE754(buf, value, offset, ext, max, min) {
1531
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1532
+ if (offset < 0) throw new RangeError("Index out of range");
1533
+ }
1534
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
1535
+ value = +value;
1536
+ offset = offset >>> 0;
1537
+ if (!noAssert) {
1538
+ checkIEEE754(buf, value, offset, 4);
1539
+ }
1540
+ ieee754.write(buf, value, offset, littleEndian, 23, 4);
1541
+ return offset + 4;
1542
+ }
1543
+ Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
1544
+ return writeFloat(this, value, offset, true, noAssert);
1545
+ };
1546
+ Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
1547
+ return writeFloat(this, value, offset, false, noAssert);
1548
+ };
1549
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
1550
+ value = +value;
1551
+ offset = offset >>> 0;
1552
+ if (!noAssert) {
1553
+ checkIEEE754(buf, value, offset, 8);
1554
+ }
1555
+ ieee754.write(buf, value, offset, littleEndian, 52, 8);
1556
+ return offset + 8;
1557
+ }
1558
+ Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
1559
+ return writeDouble(this, value, offset, true, noAssert);
1560
+ };
1561
+ Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
1562
+ return writeDouble(this, value, offset, false, noAssert);
1563
+ };
1564
+
1565
+ // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
1566
+ Buffer.prototype.copy = function copy(target, targetStart, start, end) {
1567
+ if (!Buffer.isBuffer(target)) throw new TypeError("argument should be a Buffer");
1568
+ if (!start) start = 0;
1569
+ if (!end && end !== 0) end = this.length;
1570
+ if (targetStart >= target.length) targetStart = target.length;
1571
+ if (!targetStart) targetStart = 0;
1572
+ if (end > 0 && end < start) end = start;
1573
+
1574
+ // Copy 0 bytes; we're done
1575
+ if (end === start) return 0;
1576
+ if (target.length === 0 || this.length === 0) return 0;
1577
+
1578
+ // Fatal error conditions
1579
+ if (targetStart < 0) {
1580
+ throw new RangeError("targetStart out of bounds");
1581
+ }
1582
+ if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
1583
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
1584
+
1585
+ // Are we oob?
1586
+ if (end > this.length) end = this.length;
1587
+ if (target.length - targetStart < end - start) {
1588
+ end = target.length - targetStart + start;
1589
+ }
1590
+ const len = end - start;
1591
+ if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
1592
+ // Use built-in when available, missing from IE11
1593
+ this.copyWithin(targetStart, start, end);
1594
+ } else {
1595
+ Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart);
1596
+ }
1597
+ return len;
1598
+ };
1599
+
1600
+ // Usage:
1601
+ // buffer.fill(number[, offset[, end]])
1602
+ // buffer.fill(buffer[, offset[, end]])
1603
+ // buffer.fill(string[, offset[, end]][, encoding])
1604
+ Buffer.prototype.fill = function fill(val, start, end, encoding) {
1605
+ // Handle string cases:
1606
+ if (typeof val === "string") {
1607
+ if (typeof start === "string") {
1608
+ encoding = start;
1609
+ start = 0;
1610
+ end = this.length;
1611
+ } else if (typeof end === "string") {
1612
+ encoding = end;
1613
+ end = this.length;
1614
+ }
1615
+ if (encoding !== undefined && typeof encoding !== "string") {
1616
+ throw new TypeError("encoding must be a string");
1617
+ }
1618
+ if (typeof encoding === "string" && !Buffer.isEncoding(encoding)) {
1619
+ throw new TypeError("Unknown encoding: " + encoding);
1620
+ }
1621
+ if (val.length === 1) {
1622
+ const code = val.charCodeAt(0);
1623
+ if (encoding === "utf8" && code < 128 || encoding === "latin1") {
1624
+ // Fast path: If `val` fits into a single byte, use that numeric value.
1625
+ val = code;
1626
+ }
1627
+ }
1628
+ } else if (typeof val === "number") {
1629
+ val = val & 255;
1630
+ } else if (typeof val === "boolean") {
1631
+ val = Number(val);
1632
+ }
1633
+
1634
+ // Invalid ranges are not set to a default, so can range check early.
1635
+ if (start < 0 || this.length < start || this.length < end) {
1636
+ throw new RangeError("Out of range index");
1637
+ }
1638
+ if (end <= start) {
1639
+ return this;
1640
+ }
1641
+ start = start >>> 0;
1642
+ end = end === undefined ? this.length : end >>> 0;
1643
+ if (!val) val = 0;
1644
+ let i;
1645
+ if (typeof val === "number") {
1646
+ for (i = start; i < end; ++i) {
1647
+ this[i] = val;
1648
+ }
1649
+ } else {
1650
+ const bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding);
1651
+ const len = bytes.length;
1652
+ if (len === 0) {
1653
+ throw new TypeError("The value \"" + val + "\" is invalid for argument \"value\"");
1654
+ }
1655
+ for (i = 0; i < end - start; ++i) {
1656
+ this[i + start] = bytes[i % len];
1657
+ }
1658
+ }
1659
+ return this;
1660
+ };
1661
+
1662
+ // CUSTOM ERRORS
1663
+ // =============
1664
+
1665
+ // Simplified versions from Node, changed for Buffer-only usage
1666
+ const errors = {};
1667
+ function E(sym, getMessage, Base) {
1668
+ errors[sym] = class NodeError extends Base {
1669
+ constructor() {
1670
+ super();
1671
+ Object.defineProperty(this, "message", {
1672
+ value: getMessage.apply(this, arguments),
1673
+ writable: true,
1674
+ configurable: true
1675
+ });
1676
+
1677
+ // Add the error code to the name to include it in the stack trace.
1678
+ this.name = `${this.name} [${sym}]`;
1679
+ // Access the stack to generate the error message including the error code
1680
+ // from the name.
1681
+ this.stack; // eslint-disable-line no-unused-expressions
1682
+ // Reset the name to the actual name.
1683
+ delete this.name;
1684
+ }
1685
+ get code() {
1686
+ return sym;
1687
+ }
1688
+ set code(value) {
1689
+ Object.defineProperty(this, "code", {
1690
+ configurable: true,
1691
+ enumerable: true,
1692
+ value,
1693
+ writable: true
1694
+ });
1695
+ }
1696
+ toString() {
1697
+ return `${this.name} [${sym}]: ${this.message}`;
1698
+ }
1699
+ };
1700
+ }
1701
+ E("ERR_BUFFER_OUT_OF_BOUNDS", function (name) {
1702
+ if (name) {
1703
+ return `${name} is outside of buffer bounds`;
1704
+ }
1705
+ return "Attempt to access memory outside buffer bounds";
1706
+ }, RangeError);
1707
+ E("ERR_INVALID_ARG_TYPE", function (name, actual) {
1708
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
1709
+ }, TypeError);
1710
+ E("ERR_OUT_OF_RANGE", function (str, range, input) {
1711
+ let msg = `The value of "${str}" is out of range.`;
1712
+ let received = input;
1713
+ if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
1714
+ received = addNumericalSeparator(String(input));
1715
+ } else if (typeof input === "bigint") {
1716
+ received = String(input);
1717
+ if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {
1718
+ received = addNumericalSeparator(received);
1719
+ }
1720
+ received += "n";
1721
+ }
1722
+ msg += ` It must be ${range}. Received ${received}`;
1723
+ return msg;
1724
+ }, RangeError);
1725
+ function addNumericalSeparator(val) {
1726
+ let res = "";
1727
+ let i = val.length;
1728
+ const start = val[0] === "-" ? 1 : 0;
1729
+ for (; i >= start + 4; i -= 3) {
1730
+ res = `_${val.slice(i - 3, i)}${res}`;
1731
+ }
1732
+ return `${val.slice(0, i)}${res}`;
1733
+ }
1734
+
1735
+ // CHECK FUNCTIONS
1736
+ // ===============
1737
+
1738
+ function checkBounds(buf, offset, byteLength) {
1739
+ validateNumber(offset, "offset");
1740
+ if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {
1741
+ boundsError(offset, buf.length - (byteLength + 1));
1742
+ }
1743
+ }
1744
+ function checkIntBI(value, min, max, buf, offset, byteLength) {
1745
+ if (value > max || value < min) {
1746
+ const n = typeof min === "bigint" ? "n" : "";
1747
+ let range;
1748
+ {
1749
+ if (min === 0 || min === BigInt(0)) {
1750
+ range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`;
1751
+ } else {
1752
+ range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + `${(byteLength + 1) * 8 - 1}${n}`;
1753
+ }
1754
+ }
1755
+ throw new errors.ERR_OUT_OF_RANGE("value", range, value);
1756
+ }
1757
+ checkBounds(buf, offset, byteLength);
1758
+ }
1759
+ function validateNumber(value, name) {
1760
+ if (typeof value !== "number") {
1761
+ throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
1762
+ }
1763
+ }
1764
+ function boundsError(value, length, type) {
1765
+ if (Math.floor(value) !== value) {
1766
+ validateNumber(value, type);
1767
+ throw new errors.ERR_OUT_OF_RANGE("offset", "an integer", value);
1768
+ }
1769
+ if (length < 0) {
1770
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
1771
+ }
1772
+ throw new errors.ERR_OUT_OF_RANGE("offset", `>= ${0} and <= ${length}`, value);
1773
+ }
1774
+
1775
+ // HELPER FUNCTIONS
1776
+ // ================
1777
+
1778
+ const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
1779
+ function base64clean(str) {
1780
+ // Node takes equal signs as end of the Base64 encoding
1781
+ str = str.split("=")[0];
1782
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
1783
+ str = str.trim().replace(INVALID_BASE64_RE, "");
1784
+ // Node converts strings with length < 2 to ''
1785
+ if (str.length < 2) return "";
1786
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
1787
+ while (str.length % 4 !== 0) {
1788
+ str = str + "=";
1789
+ }
1790
+ return str;
1791
+ }
1792
+ function utf8ToBytes(string, units) {
1793
+ units = units || Infinity;
1794
+ let codePoint;
1795
+ const length = string.length;
1796
+ let leadSurrogate = null;
1797
+ const bytes = [];
1798
+ for (let i = 0; i < length; ++i) {
1799
+ codePoint = string.charCodeAt(i);
1800
+
1801
+ // is surrogate component
1802
+ if (codePoint > 55295 && codePoint < 57344) {
1803
+ // last char was a lead
1804
+ if (!leadSurrogate) {
1805
+ // no lead yet
1806
+ if (codePoint > 56319) {
1807
+ // unexpected trail
1808
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1809
+ continue;
1810
+ } else if (i + 1 === length) {
1811
+ // unpaired lead
1812
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1813
+ continue;
1814
+ }
1815
+
1816
+ // valid lead
1817
+ leadSurrogate = codePoint;
1818
+ continue;
1819
+ }
1820
+
1821
+ // 2 leads in a row
1822
+ if (codePoint < 56320) {
1823
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1824
+ leadSurrogate = codePoint;
1825
+ continue;
1826
+ }
1827
+
1828
+ // valid surrogate pair
1829
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
1830
+ } else if (leadSurrogate) {
1831
+ // valid bmp char, but last char was a lead
1832
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1833
+ }
1834
+ leadSurrogate = null;
1835
+
1836
+ // encode utf8
1837
+ if (codePoint < 128) {
1838
+ if ((units -= 1) < 0) break;
1839
+ bytes.push(codePoint);
1840
+ } else if (codePoint < 2048) {
1841
+ if ((units -= 2) < 0) break;
1842
+ bytes.push(codePoint >> 6 | 192, codePoint & 63 | 128);
1843
+ } else if (codePoint < 65536) {
1844
+ if ((units -= 3) < 0) break;
1845
+ bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
1846
+ } else if (codePoint < 1114112) {
1847
+ if ((units -= 4) < 0) break;
1848
+ bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
1849
+ } else {
1850
+ throw new Error("Invalid code point");
1851
+ }
1852
+ }
1853
+ return bytes;
1854
+ }
1855
+ function asciiToBytes(str) {
1856
+ const byteArray = [];
1857
+ for (let i = 0; i < str.length; ++i) {
1858
+ // Node's code seems to be doing this and not & 0x7F..
1859
+ byteArray.push(str.charCodeAt(i) & 255);
1860
+ }
1861
+ return byteArray;
1862
+ }
1863
+ function utf16leToBytes(str, units) {
1864
+ let c, hi, lo;
1865
+ const byteArray = [];
1866
+ for (let i = 0; i < str.length; ++i) {
1867
+ if ((units -= 2) < 0) break;
1868
+ c = str.charCodeAt(i);
1869
+ hi = c >> 8;
1870
+ lo = c % 256;
1871
+ byteArray.push(lo);
1872
+ byteArray.push(hi);
1873
+ }
1874
+ return byteArray;
1875
+ }
1876
+ function base64ToBytes(str) {
1877
+ return base64.toByteArray(base64clean(str));
1878
+ }
1879
+ function blitBuffer(src, dst, offset, length) {
1880
+ let i;
1881
+ for (i = 0; i < length; ++i) {
1882
+ if (i + offset >= dst.length || i >= src.length) break;
1883
+ dst[i + offset] = src[i];
1884
+ }
1885
+ return i;
1886
+ }
1887
+
1888
+ // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
1889
+ // the `instanceof` check but they should be treated as of that type.
1890
+ // See: https://github.com/feross/buffer/issues/166
1891
+ function isInstance(obj, type) {
1892
+ return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
1893
+ }
1894
+ function numberIsNaN(obj) {
1895
+ // For IE11 support
1896
+ return obj !== obj; // eslint-disable-line no-self-compare
1897
+ }
1898
+
1899
+ // Create lookup table for `toString('hex')`
1900
+ // See: https://github.com/feross/buffer/issues/219
1901
+ const hexSliceLookupTable = function () {
1902
+ const alphabet = "0123456789abcdef";
1903
+ const table = new Array(256);
1904
+ for (let i = 0; i < 16; ++i) {
1905
+ const i16 = i * 16;
1906
+ for (let j = 0; j < 16; ++j) {
1907
+ table[i16 + j] = alphabet[i] + alphabet[j];
1908
+ }
1909
+ }
1910
+ return table;
1911
+ }();
1912
+
1913
+ // Return not function with Error if BigInt not supported
1914
+ function defineBigIntMethod(fn) {
1915
+ return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
1916
+ }
1917
+ function BufferBigIntNotDefined() {
1918
+ throw new Error("BigInt not supported");
1919
+ }
1920
+ return exports;
1921
+ }
1922
+
1923
+ export { dew as d };