From 830d68834fe42b42be5627cca5686837acffbb3f Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Mon, 19 Dec 2022 16:30:54 -0500 Subject: [PATCH 1/4] renamed old example to console, add simple, update host started Signed-off-by: Brooks Townsend --- .gitignore | 5 +- examples/console/README.md | 50 + examples/console/esbuild.js | 18 + .../example-webpack.config.js | 0 examples/console/index.html | 22 + examples/console/main.js | 12 + examples/simple/Makefile | 11 + examples/simple/README.md | 43 +- examples/simple/esbuild.js | 2 +- examples/simple/favicon.ico | Bin 0 -> 15406 bytes examples/simple/index.html | 14 +- examples/simple/main.js | 38 +- examples/simple/out.js | 14087 ++++++++++++++++ package-lock.json | 7352 +++++++- package.json | 9 +- src/events.ts | 5 +- src/host.ts | 40 +- src/types.ts | 6 + test/infra/docker-compose.yml | 16 +- test/infra/nats.conf | 1 - 20 files changed, 21478 insertions(+), 253 deletions(-) create mode 100644 examples/console/README.md create mode 100644 examples/console/esbuild.js rename examples/{simple => console}/example-webpack.config.js (100%) create mode 100644 examples/console/index.html create mode 100644 examples/console/main.js create mode 100644 examples/simple/Makefile create mode 100644 examples/simple/favicon.ico create mode 100644 examples/simple/out.js diff --git a/.gitignore b/.gitignore index dec92b5..c6ae9b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ dist/* index.html !examples/**/*index.html* *.sh* -wasmcloud-rs-js/pkg/ \ No newline at end of file +wasmcloud-rs-js/pkg/ + +host_config.json +*.wasm \ No newline at end of file diff --git a/examples/console/README.md b/examples/console/README.md new file mode 100644 index 0000000..22b481a --- /dev/null +++ b/examples/console/README.md @@ -0,0 +1,50 @@ +# wasmcloud-js Console Example + +This directory contains examples of using the `wasmcloud-js` library with sample `webpack` and `esbuild` configurations. All interaction with the wasmCloud host is done through the console. + +## Prerequisities + +- NATS with WebSockets enabled + + - There is sample infra via docker in the `test/infra` directory of this repo, `cd test/infra && docker-compose up` + +- wasmCloud lattice (OTP Version) + +- (OPTIONAL) Docker Registry with CORS configured + + - If launching actors from remote registries in the browser host, CORS must be configured on the registry server + +- NodeJS, NPM, npx + +## Build + +```sh +$ npm install # this will run and build the rust deps +$ npm install webpack esbuild copy-webpack-plugin fs +$ #### if you want to use esbuild, follow these next 2 steps #### +$ node esbuild.js # this produces the esbuild version +$ mv out-esbuild.js out.js # rename the esbuild version +$ #### if you want to use webpack, follow the steps below #### +$ npx webpack --config=example-webpack.config.js # this produces the webpack output +$ mv out-webpack.js out.js #rename the webpack version to out.js +``` + +## Usage + +1. Build the code with esbuild or webpack + +2. Rename the output file to `out.js` + +3. Start a web server inside this directory (e.g `python3 -m http.server` or `npx serve`) + +4. Navigate to a browser `localhost:` + +5. Open the developer console to view the host output + +6. In the dev tools run `host` and you will get the full host object and methods + +7. Start an actor with `host.launchActor('registry:5000/image', (data) => console.log(data))`. Echo actor is recommended (the 2nd parameter here is an invocation callback to handle the data from an invocation) + +8. Link the actor with a provider running in Wasmcloud (eg `httpserver`) + +9. Run a `curl localhost:port/echo` to see the response in the console (based off the invocation callback). diff --git a/examples/console/esbuild.js b/examples/console/esbuild.js new file mode 100644 index 0000000..c01968f --- /dev/null +++ b/examples/console/esbuild.js @@ -0,0 +1,18 @@ +// Use this path in projects using the node import +let defaultWasmFileLocation = './node_modules/@wasmcloud/wasmcloud-js/dist/wasmcloud-rs-js/pkgwasmcloud.wasm' +let wasmFileLocationForLocal = '../../dist/wasmcloud-rs-js/pkg/wasmcloud.wasm' + +let copyPlugin = { + name: 'copy', + setup(build) { + require('fs').copyFile(wasmFileLocationForLocal, `${process.cwd()}/wasmcloud.wasm`, (err) => { + if (err) throw err; + }); + } +} +require('esbuild').build({ + entryPoints: ['main.js'], + bundle: true, + outfile: 'out-esbuild.js', + plugins: [copyPlugin] +}).catch(() => process.exit(1)) \ No newline at end of file diff --git a/examples/simple/example-webpack.config.js b/examples/console/example-webpack.config.js similarity index 100% rename from examples/simple/example-webpack.config.js rename to examples/console/example-webpack.config.js diff --git a/examples/console/index.html b/examples/console/index.html new file mode 100644 index 0000000..13aa59d --- /dev/null +++ b/examples/console/index.html @@ -0,0 +1,22 @@ + + + + + Hello World - wasmcloudjs + + + + + + + + + + + \ No newline at end of file diff --git a/examples/console/main.js b/examples/console/main.js new file mode 100644 index 0000000..06d7bb9 --- /dev/null +++ b/examples/console/main.js @@ -0,0 +1,12 @@ +import { startHost } from '../../dist/src' + +// Importing inside of a project +// import { startHost } from '@wasmcloud/wasmcloud-js'; +// const { startHost } = require('@wasmcloud/wasmcloud-js'); + +(async () => { + console.log('USING A JS BUNDLER') + const host = await startHost('default', false, ['ws://localhost:6222']) + window.host = host; + console.log(host); +})() \ No newline at end of file diff --git a/examples/simple/Makefile b/examples/simple/Makefile new file mode 100644 index 0000000..a47a134 --- /dev/null +++ b/examples/simple/Makefile @@ -0,0 +1,11 @@ +help: ## Display this help + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_\-.*]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) + +install: + npm install + +esbuild: install + node esbuild.js + +esbuild-run: esbuild ## Build and run wasmCloud with esbuild, then run httpserver + python3 -m http.server diff --git a/examples/simple/README.md b/examples/simple/README.md index bc6a503..9b6fcd5 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -1,50 +1,41 @@ -# wasmcloud-js Examples +# Simple HTML/JS example -This directory contains examples of using the `wasmcloud-js` library with sample `webpack` and `esbuild` configurations. +This directory contains examples of using the `wasmcloud-js` library with an `esbuild` configuration. ## Prerequisities -* NATS with WebSockets enabled +- NATS with WebSockets enabled - * There is sample infra via docker in the `test/infra` directory of this repo, `cd test/infra && docker-compose up` + - There is sample infra via docker in the `test/infra` directory of this repo, `cd test/infra && docker-compose up` -* wasmCloud lattice (OTP Version) +- wasmCloud lattice (OTP Version) -* (OPTIONAL) Docker Registry with CORS configured +- (OPTIONAL) Docker Registry with CORS configured - * If launching actors from remote registries in the browser host, CORS must be configured on the registry server + - If launching actors from remote registries in the browser host, CORS must be configured on the registry server -* NodeJS, NPM, npx +- NodeJS, NPM, npx ## Build ```sh -$ npm install # this will run and build the rust deps -$ npm install webpack esbuild copy-webpack-plugin fs -$ #### if you want to use esbuild, follow these next 2 steps #### -$ node esbuild.js # this produces the esbuild version -$ mv out-esbuild.js out.js # rename the esbuild version -$ #### if you want to use webpack, follow the steps below #### -$ npx webpack --config=example-webpack.config.js # this produces the webpack output -$ mv out-webpack.js out.js #rename the webpack version to out.js +npm install # this will run and build the rust deps +npm install esbuild copy-webpack-plugin fs +node esbuild.js # this produces the esbuild version ``` ## Usage -1. Build the code with esbuild or webpack +1. Build the code with esbuild -2. Rename the output file to `out.js` - -3. Start a web server inside this directory (e.g `python3 -m http.server` or `npx serve`) +2. Start a web server inside this directory (e.g `python3 -m http.server` or `npx serve`) 3. Navigate to a browser `localhost:` -4. Open the developer console to view the host output - -5. In the dev tools run `host` and you will get the full host object and methods +4. Launch a host using the button on the page, feel free to add a lattice prefix or just use `default` -6. Start an actor with `host.launchActor('registry:5000/image', (data) => console.log(data))`. Echo actor is recommended (the 2nd parameter here is an invocation callback to handle the data from an invocation) +5. Start an actor with `host.launchActor('registry:5000/image', (data) => console.log(data))`. Echo actor is recommended (the 2nd parameter here is an invocation callback to handle the data from an invocation) -7. Link the actor with a provider running in Wasmcloud (eg `httpserver`) +6. Link the actor with a provider running in Wasmcloud (eg `httpserver`) -8. Run a `curl localhost:port/echo` to see the response in the console (based off the invocation callback). \ No newline at end of file +7. Run a `curl localhost:port/echo` to see the response in the console (based off the invocation callback). diff --git a/examples/simple/esbuild.js b/examples/simple/esbuild.js index c01968f..6a32910 100644 --- a/examples/simple/esbuild.js +++ b/examples/simple/esbuild.js @@ -13,6 +13,6 @@ let copyPlugin = { require('esbuild').build({ entryPoints: ['main.js'], bundle: true, - outfile: 'out-esbuild.js', + outfile: 'out.js', plugins: [copyPlugin] }).catch(() => process.exit(1)) \ No newline at end of file diff --git a/examples/simple/favicon.ico b/examples/simple/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..9b13eca49bb84029c9176460c78993d33d8b7329 GIT binary patch literal 15406 zcmeI3eQaJ;9mju#@!~r~(L_|5iOYzHLtzLapw9V5G)gcKiB1#Q2w4~=1{KjKo3NL* zPrI=ZYY+ttYK`F!*h~97ZDk|#jj({tbQ^TIb*wsP>llLxZT)=jb8mZ|(|hl8pZ4i$ zOq-nCd(Zj3e9!Nk^E|{IR4C7gEOJ`>o(aNMUVd1CGkaVq7_dZe^ZBjlePkQ-W$mY^*u`ct*T4qFT!8y z+p>tCe%=(+(Kbc=qxNHrD(VNzZ2A(|&l!UknO_am=Tq=E(Y`X@S(*ppMc>tY_lUpusCG0k6P z#d6O!JCnI}JN-RG@%5yCgB2hA1Nqpj`Xai}4}A-r&!^}eVjtK>U$;Rs<}*E<;Qu@0 z^6gaxds8Go>A9iXUf)=>TcF>cqIZ~a*iQSWawB$9en$~)lAOOumvo9BpYs`LcPG(f<6-Ra z1mz2HzRAU)cVUzN1Lq%;WQO&-8-=%!IL7M3Q^>luH6}Lj_4?n!%D8+H89RbL#MvW8 zH#U^s9-h}L-tpyD`z;*EyAFAO=9x4mQT-5@mu88ns>VTI(0>c|PFpL-o7(N2)ymFF zFWJn!D6We7Jo;4I|DgW5eAigal(ny`6laaF^*MhN>3=R~Ck1|?U>o7TY{Zl4h!0*F z-}f=jZP>C`yl(qM^&_w34>fl>?N`Vw>sO=$y0w&OeD~K}e`)>fO|U^7x}Ty%^JzwZ zt;hfW-2U>7#4JmfIx(^4FmuX{2PQQC6rU46E>82mqjR@lJK3|oES|~g*M1!CgHOip zgE4zxh+`P~9lYO2apTTR{l{kwvga+rU;G~a_;>`}YdUNpGWJdc$ z*5_TD$g31=1^hbWMe;H|10HxKBdfk7I-UE_ul!EjxzEQl23w`qi849bjmo zyg>2ws;-5#boNB$XXPVqKZiMdk8B){%?8zF<)5J&vw-p>q-bpsrPg^8M8^KfXXMBg z%5N}!Kc@`fs|T1rzosmZkMLu+SV7ZJDZd%!cJBvkKgIWX+N*w{Jx_UrX@D53Qu%Gg z@7Vfb{KG#eiRUozE4T4aXf{Is(OiZcd#uvQRx(do$rCU)J^-dx$`Ok1chbKL_98q# z!!OMb^3)a1FO!8F@&B~jPG^6=3j3``|GoE3>^zXW_pd_fTQOkP zF?*GM?}2{}YvYn?@=fyL&6}-0utDiw;6LacXD7c-@gq8)Cl*}3w!_}z+D`Amolw!f z4_{wEn?WWRUQrBB4Bgz^ZS`q;ht4$lM{PE=x8YZGuJZkNd>=YZ{ZkILH5ha6Z0nA{ z^fz|fT$63Ny$1_<>&WepFDlOteP>_ zp3%@{mtdy`#^M>|r0p4Q|75Ej=)0Z0^1R?|vc*0^o$j+z=T`OL7=ScGV4E{u0rZgn_hFaS{ zIJa=_NVqRZfjGV?$g{QE2j$~vjqO8C@e|+S6QbO!&a;=Ve%#*R-zkkpT3(~Qm%Zmg z%8!}X{gRm^V~X$}3w_!_*46`*&*vTveu7pG)cex@2cKdV-6=gwQS5VUn(#+HAczmy zJHO&Pte!hV0O;}(~V#KI0~+>0XTLJM;%fAgqT%1p{VbA&fs_Lk>>x$*01Kj zYr`4)C***p(ErTXzcdGD)~~Y`6{~V~xHR&4WzXqYzhJ2IRbm7+- zyXCj!z>2n+lKK4N_{AfP!%uWx5AQ|m6r+Uk&y@L3SB6>b@z&(l2bRlR3ibh%I}Se$hay+|j-&$D@z`HTmwEPJ6ejL%Ch< zPTxg7X(_UwL3UQ#XfEs%7GX-WO<5=SkpAWl`!M|SVZDr*&PnAqkNYms^^iZxDW@6S z-S9hUc>jb9_so(kt0bcrf7c=mt}T3=mA-XOxq5WY0b6 zY*VnigEd*h`@CQ;)O`?l&=k$ZY_^OWBd;!$r8W1E?wo3w+xEvtxmDKRLi%toPyHS# z+r08H!>4f)uVhHp!r&g*S2z{l_z}eujPa%D)}G_<#mRGftRKg)_XFB*gV+R_QvtP- zOsy^OFQ6#KQmm3T9z)D+(QIaIe|$3QvJ$Rp+k@Y@73><;>Mz57_+xNbZP@#oEWcH& oR(~z%<)2&mjSTn~fVGV|J)jc2Q>V6Se0VJ|&B&OsK$->q3*E%Iga7~l literal 0 HcmV?d00001 diff --git a/examples/simple/index.html b/examples/simple/index.html index 13aa59d..13c0b67 100644 --- a/examples/simple/index.html +++ b/examples/simple/index.html @@ -2,9 +2,9 @@ - Hello World - wasmcloudjs + + wasmCloud JS - @@ -18,5 +18,15 @@ +

wasmCloud in the browser

+ + +

+ + +
    +
    + +
    \ No newline at end of file diff --git a/examples/simple/main.js b/examples/simple/main.js index 06d7bb9..a80ffff 100644 --- a/examples/simple/main.js +++ b/examples/simple/main.js @@ -4,9 +4,35 @@ import { startHost } from '../../dist/src' // import { startHost } from '@wasmcloud/wasmcloud-js'; // const { startHost } = require('@wasmcloud/wasmcloud-js'); -(async () => { - console.log('USING A JS BUNDLER') - const host = await startHost('default', false, ['ws://localhost:6222']) - window.host = host; - console.log(host); -})() \ No newline at end of file +var runningHosts = []; + +document.getElementById('hostButton').onclick = () => { + const latticePrefixInput = document.getElementById('latticePrefix'); + if (!latticePrefixInput || !latticePrefixInput.value || latticePrefixInput.value === '') { + //TODO: help duplication here + (async () => { + const host = await startHost('374b6434-f18d-4b93-8743-bcd3089e4d5b', false, ['ws://localhost:6222']) + runningHosts.push(host); + document.getElementById('runningHosts').innerHTML = hostList(runningHosts).innerHTML + console.dir(runningHosts); + })(); + } else { + (async () => { + const host = await startHost(latticePrefixInput.value, false, ['ws://localhost:6222']) + runningHosts.push(host); + document.getElementById('runningHosts').innerHTML = hostList(runningHosts).innerHTML + console.dir(runningHosts); + })(); + } +} + +function hostList(runningHosts) { + let list = document.createElement('ol'); + runningHosts.forEach((host) => { + console.dir(host) + let listItem = document.createElement('li'); + listItem.innerText = host.friendlyName; + list.appendChild(listItem); + }); + return list; +} \ No newline at end of file diff --git a/examples/simple/out.js b/examples/simple/out.js new file mode 100644 index 0000000..cc9d568 --- /dev/null +++ b/examples/simple/out.js @@ -0,0 +1,14087 @@ +"use strict"; +(() => { + var __create = Object.create; + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __getProtoOf = Object.getPrototypeOf; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { + get: (a, b) => (typeof require !== "undefined" ? require : a)[b] + }) : x)(function(x) { + if (typeof require !== "undefined") + return require.apply(this, arguments); + throw new Error('Dynamic require of "' + x + '" is not supported'); + }); + var __commonJS = (cb, mod) => function __require2() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod + )); + + // ../../node_modules/@msgpack/msgpack/dist/utils/int.js + var require_int = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/utils/int.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getUint64 = exports.getInt64 = exports.setInt64 = exports.setUint64 = exports.UINT32_MAX = void 0; + exports.UINT32_MAX = 4294967295; + function setUint64(view, offset, value) { + const high = value / 4294967296; + const low = value; + view.setUint32(offset, high); + view.setUint32(offset + 4, low); + } + exports.setUint64 = setUint64; + function setInt64(view, offset, value) { + const high = Math.floor(value / 4294967296); + const low = value; + view.setUint32(offset, high); + view.setUint32(offset + 4, low); + } + exports.setInt64 = setInt64; + function getInt64(view, offset) { + const high = view.getInt32(offset); + const low = view.getUint32(offset + 4); + return high * 4294967296 + low; + } + exports.getInt64 = getInt64; + function getUint64(view, offset) { + const high = view.getUint32(offset); + const low = view.getUint32(offset + 4); + return high * 4294967296 + low; + } + exports.getUint64 = getUint64; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/utils/utf8.js + var require_utf8 = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/utils/utf8.js"(exports) { + "use strict"; + var _a; + var _b; + var _c; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.utf8DecodeTD = exports.TEXT_DECODER_THRESHOLD = exports.utf8DecodeJs = exports.utf8EncodeTE = exports.TEXT_ENCODER_THRESHOLD = exports.utf8EncodeJs = exports.utf8Count = void 0; + var int_1 = require_int(); + var TEXT_ENCODING_AVAILABLE = (typeof process === "undefined" || ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a["TEXT_ENCODING"]) !== "never") && typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined"; + function utf8Count(str) { + const strLength = str.length; + let byteLength = 0; + let pos = 0; + while (pos < strLength) { + let value = str.charCodeAt(pos++); + if ((value & 4294967168) === 0) { + byteLength++; + continue; + } else if ((value & 4294965248) === 0) { + byteLength += 2; + } else { + if (value >= 55296 && value <= 56319) { + if (pos < strLength) { + const extra = str.charCodeAt(pos); + if ((extra & 64512) === 56320) { + ++pos; + value = ((value & 1023) << 10) + (extra & 1023) + 65536; + } + } + } + if ((value & 4294901760) === 0) { + byteLength += 3; + } else { + byteLength += 4; + } + } + } + return byteLength; + } + exports.utf8Count = utf8Count; + function utf8EncodeJs(str, output, outputOffset) { + const strLength = str.length; + let offset = outputOffset; + let pos = 0; + while (pos < strLength) { + let value = str.charCodeAt(pos++); + if ((value & 4294967168) === 0) { + output[offset++] = value; + continue; + } else if ((value & 4294965248) === 0) { + output[offset++] = value >> 6 & 31 | 192; + } else { + if (value >= 55296 && value <= 56319) { + if (pos < strLength) { + const extra = str.charCodeAt(pos); + if ((extra & 64512) === 56320) { + ++pos; + value = ((value & 1023) << 10) + (extra & 1023) + 65536; + } + } + } + if ((value & 4294901760) === 0) { + output[offset++] = value >> 12 & 15 | 224; + output[offset++] = value >> 6 & 63 | 128; + } else { + output[offset++] = value >> 18 & 7 | 240; + output[offset++] = value >> 12 & 63 | 128; + output[offset++] = value >> 6 & 63 | 128; + } + } + output[offset++] = value & 63 | 128; + } + } + exports.utf8EncodeJs = utf8EncodeJs; + var sharedTextEncoder = TEXT_ENCODING_AVAILABLE ? new TextEncoder() : void 0; + exports.TEXT_ENCODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE ? int_1.UINT32_MAX : typeof process !== "undefined" && ((_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b["TEXT_ENCODING"]) !== "force" ? 200 : 0; + function utf8EncodeTEencode(str, output, outputOffset) { + output.set(sharedTextEncoder.encode(str), outputOffset); + } + function utf8EncodeTEencodeInto(str, output, outputOffset) { + sharedTextEncoder.encodeInto(str, output.subarray(outputOffset)); + } + exports.utf8EncodeTE = (sharedTextEncoder === null || sharedTextEncoder === void 0 ? void 0 : sharedTextEncoder.encodeInto) ? utf8EncodeTEencodeInto : utf8EncodeTEencode; + var CHUNK_SIZE = 4096; + function utf8DecodeJs(bytes, inputOffset, byteLength) { + let offset = inputOffset; + const end = offset + byteLength; + const units = []; + let result = ""; + while (offset < end) { + const byte1 = bytes[offset++]; + if ((byte1 & 128) === 0) { + units.push(byte1); + } else if ((byte1 & 224) === 192) { + const byte2 = bytes[offset++] & 63; + units.push((byte1 & 31) << 6 | byte2); + } else if ((byte1 & 240) === 224) { + const byte2 = bytes[offset++] & 63; + const byte3 = bytes[offset++] & 63; + units.push((byte1 & 31) << 12 | byte2 << 6 | byte3); + } else if ((byte1 & 248) === 240) { + const byte2 = bytes[offset++] & 63; + const byte3 = bytes[offset++] & 63; + const byte4 = bytes[offset++] & 63; + let unit = (byte1 & 7) << 18 | byte2 << 12 | byte3 << 6 | byte4; + if (unit > 65535) { + unit -= 65536; + units.push(unit >>> 10 & 1023 | 55296); + unit = 56320 | unit & 1023; + } + units.push(unit); + } else { + units.push(byte1); + } + if (units.length >= CHUNK_SIZE) { + result += String.fromCharCode(...units); + units.length = 0; + } + } + if (units.length > 0) { + result += String.fromCharCode(...units); + } + return result; + } + exports.utf8DecodeJs = utf8DecodeJs; + var sharedTextDecoder = TEXT_ENCODING_AVAILABLE ? new TextDecoder() : null; + exports.TEXT_DECODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE ? int_1.UINT32_MAX : typeof process !== "undefined" && ((_c = process === null || process === void 0 ? void 0 : process.env) === null || _c === void 0 ? void 0 : _c["TEXT_DECODER"]) !== "force" ? 200 : 0; + function utf8DecodeTD(bytes, inputOffset, byteLength) { + const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength); + return sharedTextDecoder.decode(stringBytes); + } + exports.utf8DecodeTD = utf8DecodeTD; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/ExtData.js + var require_ExtData = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/ExtData.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExtData = void 0; + var ExtData = class { + constructor(type, data) { + this.type = type; + this.data = data; + } + }; + exports.ExtData = ExtData; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/DecodeError.js + var require_DecodeError = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/DecodeError.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DecodeError = void 0; + var DecodeError = class extends Error { + constructor(message) { + super(message); + const proto = Object.create(DecodeError.prototype); + Object.setPrototypeOf(this, proto); + Object.defineProperty(this, "name", { + configurable: true, + enumerable: false, + value: DecodeError.name + }); + } + }; + exports.DecodeError = DecodeError; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/timestamp.js + var require_timestamp = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/timestamp.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.timestampExtension = exports.decodeTimestampExtension = exports.decodeTimestampToTimeSpec = exports.encodeTimestampExtension = exports.encodeDateToTimeSpec = exports.encodeTimeSpecToTimestamp = exports.EXT_TIMESTAMP = void 0; + var DecodeError_1 = require_DecodeError(); + var int_1 = require_int(); + exports.EXT_TIMESTAMP = -1; + var TIMESTAMP32_MAX_SEC = 4294967296 - 1; + var TIMESTAMP64_MAX_SEC = 17179869184 - 1; + function encodeTimeSpecToTimestamp({ sec, nsec }) { + if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) { + if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) { + const rv = new Uint8Array(4); + const view = new DataView(rv.buffer); + view.setUint32(0, sec); + return rv; + } else { + const secHigh = sec / 4294967296; + const secLow = sec & 4294967295; + const rv = new Uint8Array(8); + const view = new DataView(rv.buffer); + view.setUint32(0, nsec << 2 | secHigh & 3); + view.setUint32(4, secLow); + return rv; + } + } else { + const rv = new Uint8Array(12); + const view = new DataView(rv.buffer); + view.setUint32(0, nsec); + (0, int_1.setInt64)(view, 4, sec); + return rv; + } + } + exports.encodeTimeSpecToTimestamp = encodeTimeSpecToTimestamp; + function encodeDateToTimeSpec(date) { + const msec = date.getTime(); + const sec = Math.floor(msec / 1e3); + const nsec = (msec - sec * 1e3) * 1e6; + const nsecInSec = Math.floor(nsec / 1e9); + return { + sec: sec + nsecInSec, + nsec: nsec - nsecInSec * 1e9 + }; + } + exports.encodeDateToTimeSpec = encodeDateToTimeSpec; + function encodeTimestampExtension(object) { + if (object instanceof Date) { + const timeSpec = encodeDateToTimeSpec(object); + return encodeTimeSpecToTimestamp(timeSpec); + } else { + return null; + } + } + exports.encodeTimestampExtension = encodeTimestampExtension; + function decodeTimestampToTimeSpec(data) { + const view = new DataView(data.buffer, data.byteOffset, data.byteLength); + switch (data.byteLength) { + case 4: { + const sec = view.getUint32(0); + const nsec = 0; + return { sec, nsec }; + } + case 8: { + const nsec30AndSecHigh2 = view.getUint32(0); + const secLow32 = view.getUint32(4); + const sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32; + const nsec = nsec30AndSecHigh2 >>> 2; + return { sec, nsec }; + } + case 12: { + const sec = (0, int_1.getInt64)(view, 4); + const nsec = view.getUint32(0); + return { sec, nsec }; + } + default: + throw new DecodeError_1.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${data.length}`); + } + } + exports.decodeTimestampToTimeSpec = decodeTimestampToTimeSpec; + function decodeTimestampExtension(data) { + const timeSpec = decodeTimestampToTimeSpec(data); + return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6); + } + exports.decodeTimestampExtension = decodeTimestampExtension; + exports.timestampExtension = { + type: exports.EXT_TIMESTAMP, + encode: encodeTimestampExtension, + decode: decodeTimestampExtension + }; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/ExtensionCodec.js + var require_ExtensionCodec = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/ExtensionCodec.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ExtensionCodec = void 0; + var ExtData_1 = require_ExtData(); + var timestamp_1 = require_timestamp(); + var ExtensionCodec = class { + constructor() { + this.builtInEncoders = []; + this.builtInDecoders = []; + this.encoders = []; + this.decoders = []; + this.register(timestamp_1.timestampExtension); + } + register({ type, encode, decode }) { + if (type >= 0) { + this.encoders[type] = encode; + this.decoders[type] = decode; + } else { + const index = 1 + type; + this.builtInEncoders[index] = encode; + this.builtInDecoders[index] = decode; + } + } + tryToEncode(object, context) { + for (let i = 0; i < this.builtInEncoders.length; i++) { + const encodeExt = this.builtInEncoders[i]; + if (encodeExt != null) { + const data = encodeExt(object, context); + if (data != null) { + const type = -1 - i; + return new ExtData_1.ExtData(type, data); + } + } + } + for (let i = 0; i < this.encoders.length; i++) { + const encodeExt = this.encoders[i]; + if (encodeExt != null) { + const data = encodeExt(object, context); + if (data != null) { + const type = i; + return new ExtData_1.ExtData(type, data); + } + } + } + if (object instanceof ExtData_1.ExtData) { + return object; + } + return null; + } + decode(data, type, context) { + const decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type]; + if (decodeExt) { + return decodeExt(data, type, context); + } else { + return new ExtData_1.ExtData(type, data); + } + } + }; + exports.ExtensionCodec = ExtensionCodec; + ExtensionCodec.defaultCodec = new ExtensionCodec(); + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/utils/typedArrays.js + var require_typedArrays = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/utils/typedArrays.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createDataView = exports.ensureUint8Array = void 0; + function ensureUint8Array(buffer) { + if (buffer instanceof Uint8Array) { + return buffer; + } else if (ArrayBuffer.isView(buffer)) { + return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); + } else if (buffer instanceof ArrayBuffer) { + return new Uint8Array(buffer); + } else { + return Uint8Array.from(buffer); + } + } + exports.ensureUint8Array = ensureUint8Array; + function createDataView(buffer) { + if (buffer instanceof ArrayBuffer) { + return new DataView(buffer); + } + const bufferView = ensureUint8Array(buffer); + return new DataView(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength); + } + exports.createDataView = createDataView; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/Encoder.js + var require_Encoder = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/Encoder.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Encoder = exports.DEFAULT_INITIAL_BUFFER_SIZE = exports.DEFAULT_MAX_DEPTH = void 0; + var utf8_1 = require_utf8(); + var ExtensionCodec_1 = require_ExtensionCodec(); + var int_1 = require_int(); + var typedArrays_1 = require_typedArrays(); + exports.DEFAULT_MAX_DEPTH = 100; + exports.DEFAULT_INITIAL_BUFFER_SIZE = 2048; + var Encoder = class { + constructor(extensionCodec = ExtensionCodec_1.ExtensionCodec.defaultCodec, context = void 0, maxDepth = exports.DEFAULT_MAX_DEPTH, initialBufferSize = exports.DEFAULT_INITIAL_BUFFER_SIZE, sortKeys = false, forceFloat32 = false, ignoreUndefined = false, forceIntegerToFloat = false) { + this.extensionCodec = extensionCodec; + this.context = context; + this.maxDepth = maxDepth; + this.initialBufferSize = initialBufferSize; + this.sortKeys = sortKeys; + this.forceFloat32 = forceFloat32; + this.ignoreUndefined = ignoreUndefined; + this.forceIntegerToFloat = forceIntegerToFloat; + this.pos = 0; + this.view = new DataView(new ArrayBuffer(this.initialBufferSize)); + this.bytes = new Uint8Array(this.view.buffer); + } + reinitializeState() { + this.pos = 0; + } + encodeSharedRef(object) { + this.reinitializeState(); + this.doEncode(object, 1); + return this.bytes.subarray(0, this.pos); + } + encode(object) { + this.reinitializeState(); + this.doEncode(object, 1); + return this.bytes.slice(0, this.pos); + } + doEncode(object, depth) { + if (depth > this.maxDepth) { + throw new Error(`Too deep objects in depth ${depth}`); + } + if (object == null) { + this.encodeNil(); + } else if (typeof object === "boolean") { + this.encodeBoolean(object); + } else if (typeof object === "number") { + this.encodeNumber(object); + } else if (typeof object === "string") { + this.encodeString(object); + } else { + this.encodeObject(object, depth); + } + } + ensureBufferSizeToWrite(sizeToWrite) { + const requiredSize = this.pos + sizeToWrite; + if (this.view.byteLength < requiredSize) { + this.resizeBuffer(requiredSize * 2); + } + } + resizeBuffer(newSize) { + const newBuffer = new ArrayBuffer(newSize); + const newBytes = new Uint8Array(newBuffer); + const newView = new DataView(newBuffer); + newBytes.set(this.bytes); + this.view = newView; + this.bytes = newBytes; + } + encodeNil() { + this.writeU8(192); + } + encodeBoolean(object) { + if (object === false) { + this.writeU8(194); + } else { + this.writeU8(195); + } + } + encodeNumber(object) { + if (Number.isSafeInteger(object) && !this.forceIntegerToFloat) { + if (object >= 0) { + if (object < 128) { + this.writeU8(object); + } else if (object < 256) { + this.writeU8(204); + this.writeU8(object); + } else if (object < 65536) { + this.writeU8(205); + this.writeU16(object); + } else if (object < 4294967296) { + this.writeU8(206); + this.writeU32(object); + } else { + this.writeU8(207); + this.writeU64(object); + } + } else { + if (object >= -32) { + this.writeU8(224 | object + 32); + } else if (object >= -128) { + this.writeU8(208); + this.writeI8(object); + } else if (object >= -32768) { + this.writeU8(209); + this.writeI16(object); + } else if (object >= -2147483648) { + this.writeU8(210); + this.writeI32(object); + } else { + this.writeU8(211); + this.writeI64(object); + } + } + } else { + if (this.forceFloat32) { + this.writeU8(202); + this.writeF32(object); + } else { + this.writeU8(203); + this.writeF64(object); + } + } + } + writeStringHeader(byteLength) { + if (byteLength < 32) { + this.writeU8(160 + byteLength); + } else if (byteLength < 256) { + this.writeU8(217); + this.writeU8(byteLength); + } else if (byteLength < 65536) { + this.writeU8(218); + this.writeU16(byteLength); + } else if (byteLength < 4294967296) { + this.writeU8(219); + this.writeU32(byteLength); + } else { + throw new Error(`Too long string: ${byteLength} bytes in UTF-8`); + } + } + encodeString(object) { + const maxHeaderSize = 1 + 4; + const strLength = object.length; + if (strLength > utf8_1.TEXT_ENCODER_THRESHOLD) { + const byteLength = (0, utf8_1.utf8Count)(object); + this.ensureBufferSizeToWrite(maxHeaderSize + byteLength); + this.writeStringHeader(byteLength); + (0, utf8_1.utf8EncodeTE)(object, this.bytes, this.pos); + this.pos += byteLength; + } else { + const byteLength = (0, utf8_1.utf8Count)(object); + this.ensureBufferSizeToWrite(maxHeaderSize + byteLength); + this.writeStringHeader(byteLength); + (0, utf8_1.utf8EncodeJs)(object, this.bytes, this.pos); + this.pos += byteLength; + } + } + encodeObject(object, depth) { + const ext = this.extensionCodec.tryToEncode(object, this.context); + if (ext != null) { + this.encodeExtension(ext); + } else if (Array.isArray(object)) { + this.encodeArray(object, depth); + } else if (ArrayBuffer.isView(object)) { + this.encodeBinary(object); + } else if (typeof object === "object") { + this.encodeMap(object, depth); + } else { + throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(object)}`); + } + } + encodeBinary(object) { + const size = object.byteLength; + if (size < 256) { + this.writeU8(196); + this.writeU8(size); + } else if (size < 65536) { + this.writeU8(197); + this.writeU16(size); + } else if (size < 4294967296) { + this.writeU8(198); + this.writeU32(size); + } else { + throw new Error(`Too large binary: ${size}`); + } + const bytes = (0, typedArrays_1.ensureUint8Array)(object); + this.writeU8a(bytes); + } + encodeArray(object, depth) { + const size = object.length; + if (size < 16) { + this.writeU8(144 + size); + } else if (size < 65536) { + this.writeU8(220); + this.writeU16(size); + } else if (size < 4294967296) { + this.writeU8(221); + this.writeU32(size); + } else { + throw new Error(`Too large array: ${size}`); + } + for (const item of object) { + this.doEncode(item, depth + 1); + } + } + countWithoutUndefined(object, keys) { + let count = 0; + for (const key of keys) { + if (object[key] !== void 0) { + count++; + } + } + return count; + } + encodeMap(object, depth) { + const keys = Object.keys(object); + if (this.sortKeys) { + keys.sort(); + } + const size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length; + if (size < 16) { + this.writeU8(128 + size); + } else if (size < 65536) { + this.writeU8(222); + this.writeU16(size); + } else if (size < 4294967296) { + this.writeU8(223); + this.writeU32(size); + } else { + throw new Error(`Too large map object: ${size}`); + } + for (const key of keys) { + const value = object[key]; + if (!(this.ignoreUndefined && value === void 0)) { + this.encodeString(key); + this.doEncode(value, depth + 1); + } + } + } + encodeExtension(ext) { + const size = ext.data.length; + if (size === 1) { + this.writeU8(212); + } else if (size === 2) { + this.writeU8(213); + } else if (size === 4) { + this.writeU8(214); + } else if (size === 8) { + this.writeU8(215); + } else if (size === 16) { + this.writeU8(216); + } else if (size < 256) { + this.writeU8(199); + this.writeU8(size); + } else if (size < 65536) { + this.writeU8(200); + this.writeU16(size); + } else if (size < 4294967296) { + this.writeU8(201); + this.writeU32(size); + } else { + throw new Error(`Too large extension object: ${size}`); + } + this.writeI8(ext.type); + this.writeU8a(ext.data); + } + writeU8(value) { + this.ensureBufferSizeToWrite(1); + this.view.setUint8(this.pos, value); + this.pos++; + } + writeU8a(values) { + const size = values.length; + this.ensureBufferSizeToWrite(size); + this.bytes.set(values, this.pos); + this.pos += size; + } + writeI8(value) { + this.ensureBufferSizeToWrite(1); + this.view.setInt8(this.pos, value); + this.pos++; + } + writeU16(value) { + this.ensureBufferSizeToWrite(2); + this.view.setUint16(this.pos, value); + this.pos += 2; + } + writeI16(value) { + this.ensureBufferSizeToWrite(2); + this.view.setInt16(this.pos, value); + this.pos += 2; + } + writeU32(value) { + this.ensureBufferSizeToWrite(4); + this.view.setUint32(this.pos, value); + this.pos += 4; + } + writeI32(value) { + this.ensureBufferSizeToWrite(4); + this.view.setInt32(this.pos, value); + this.pos += 4; + } + writeF32(value) { + this.ensureBufferSizeToWrite(4); + this.view.setFloat32(this.pos, value); + this.pos += 4; + } + writeF64(value) { + this.ensureBufferSizeToWrite(8); + this.view.setFloat64(this.pos, value); + this.pos += 8; + } + writeU64(value) { + this.ensureBufferSizeToWrite(8); + (0, int_1.setUint64)(this.view, this.pos, value); + this.pos += 8; + } + writeI64(value) { + this.ensureBufferSizeToWrite(8); + (0, int_1.setInt64)(this.view, this.pos, value); + this.pos += 8; + } + }; + exports.Encoder = Encoder; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/encode.js + var require_encode = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/encode.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.encode = void 0; + var Encoder_1 = require_Encoder(); + var defaultEncodeOptions = {}; + function encode(value, options = defaultEncodeOptions) { + const encoder = new Encoder_1.Encoder(options.extensionCodec, options.context, options.maxDepth, options.initialBufferSize, options.sortKeys, options.forceFloat32, options.ignoreUndefined, options.forceIntegerToFloat); + return encoder.encodeSharedRef(value); + } + exports.encode = encode; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/utils/prettyByte.js + var require_prettyByte = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/utils/prettyByte.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.prettyByte = void 0; + function prettyByte(byte) { + return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`; + } + exports.prettyByte = prettyByte; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/CachedKeyDecoder.js + var require_CachedKeyDecoder = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/CachedKeyDecoder.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.CachedKeyDecoder = void 0; + var utf8_1 = require_utf8(); + var DEFAULT_MAX_KEY_LENGTH = 16; + var DEFAULT_MAX_LENGTH_PER_KEY = 16; + var CachedKeyDecoder = class { + constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) { + this.maxKeyLength = maxKeyLength; + this.maxLengthPerKey = maxLengthPerKey; + this.hit = 0; + this.miss = 0; + this.caches = []; + for (let i = 0; i < this.maxKeyLength; i++) { + this.caches.push([]); + } + } + canBeCached(byteLength) { + return byteLength > 0 && byteLength <= this.maxKeyLength; + } + find(bytes, inputOffset, byteLength) { + const records = this.caches[byteLength - 1]; + FIND_CHUNK: + for (const record of records) { + const recordBytes = record.bytes; + for (let j = 0; j < byteLength; j++) { + if (recordBytes[j] !== bytes[inputOffset + j]) { + continue FIND_CHUNK; + } + } + return record.str; + } + return null; + } + store(bytes, value) { + const records = this.caches[bytes.length - 1]; + const record = { bytes, str: value }; + if (records.length >= this.maxLengthPerKey) { + records[Math.random() * records.length | 0] = record; + } else { + records.push(record); + } + } + decode(bytes, inputOffset, byteLength) { + const cachedValue = this.find(bytes, inputOffset, byteLength); + if (cachedValue != null) { + this.hit++; + return cachedValue; + } + this.miss++; + const str = (0, utf8_1.utf8DecodeJs)(bytes, inputOffset, byteLength); + const slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength); + this.store(slicedCopyOfBytes, str); + return str; + } + }; + exports.CachedKeyDecoder = CachedKeyDecoder; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/Decoder.js + var require_Decoder = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/Decoder.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Decoder = exports.DataViewIndexOutOfBoundsError = void 0; + var prettyByte_1 = require_prettyByte(); + var ExtensionCodec_1 = require_ExtensionCodec(); + var int_1 = require_int(); + var utf8_1 = require_utf8(); + var typedArrays_1 = require_typedArrays(); + var CachedKeyDecoder_1 = require_CachedKeyDecoder(); + var DecodeError_1 = require_DecodeError(); + var isValidMapKeyType = (key) => { + const keyType = typeof key; + return keyType === "string" || keyType === "number"; + }; + var HEAD_BYTE_REQUIRED = -1; + var EMPTY_VIEW = new DataView(new ArrayBuffer(0)); + var EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer); + exports.DataViewIndexOutOfBoundsError = (() => { + try { + EMPTY_VIEW.getInt8(0); + } catch (e) { + return e.constructor; + } + throw new Error("never reached"); + })(); + var MORE_DATA = new exports.DataViewIndexOutOfBoundsError("Insufficient data"); + var sharedCachedKeyDecoder = new CachedKeyDecoder_1.CachedKeyDecoder(); + var Decoder = class { + constructor(extensionCodec = ExtensionCodec_1.ExtensionCodec.defaultCodec, context = void 0, maxStrLength = int_1.UINT32_MAX, maxBinLength = int_1.UINT32_MAX, maxArrayLength = int_1.UINT32_MAX, maxMapLength = int_1.UINT32_MAX, maxExtLength = int_1.UINT32_MAX, keyDecoder = sharedCachedKeyDecoder) { + this.extensionCodec = extensionCodec; + this.context = context; + this.maxStrLength = maxStrLength; + this.maxBinLength = maxBinLength; + this.maxArrayLength = maxArrayLength; + this.maxMapLength = maxMapLength; + this.maxExtLength = maxExtLength; + this.keyDecoder = keyDecoder; + this.totalPos = 0; + this.pos = 0; + this.view = EMPTY_VIEW; + this.bytes = EMPTY_BYTES; + this.headByte = HEAD_BYTE_REQUIRED; + this.stack = []; + } + reinitializeState() { + this.totalPos = 0; + this.headByte = HEAD_BYTE_REQUIRED; + this.stack.length = 0; + } + setBuffer(buffer) { + this.bytes = (0, typedArrays_1.ensureUint8Array)(buffer); + this.view = (0, typedArrays_1.createDataView)(this.bytes); + this.pos = 0; + } + appendBuffer(buffer) { + if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining(1)) { + this.setBuffer(buffer); + } else { + const remainingData = this.bytes.subarray(this.pos); + const newData = (0, typedArrays_1.ensureUint8Array)(buffer); + const newBuffer = new Uint8Array(remainingData.length + newData.length); + newBuffer.set(remainingData); + newBuffer.set(newData, remainingData.length); + this.setBuffer(newBuffer); + } + } + hasRemaining(size) { + return this.view.byteLength - this.pos >= size; + } + createExtraByteError(posToShow) { + const { view, pos } = this; + return new RangeError(`Extra ${view.byteLength - pos} of ${view.byteLength} byte(s) found at buffer[${posToShow}]`); + } + decode(buffer) { + this.reinitializeState(); + this.setBuffer(buffer); + const object = this.doDecodeSync(); + if (this.hasRemaining(1)) { + throw this.createExtraByteError(this.pos); + } + return object; + } + *decodeMulti(buffer) { + this.reinitializeState(); + this.setBuffer(buffer); + while (this.hasRemaining(1)) { + yield this.doDecodeSync(); + } + } + async decodeAsync(stream) { + let decoded = false; + let object; + for await (const buffer of stream) { + if (decoded) { + throw this.createExtraByteError(this.totalPos); + } + this.appendBuffer(buffer); + try { + object = this.doDecodeSync(); + decoded = true; + } catch (e) { + if (!(e instanceof exports.DataViewIndexOutOfBoundsError)) { + throw e; + } + } + this.totalPos += this.pos; + } + if (decoded) { + if (this.hasRemaining(1)) { + throw this.createExtraByteError(this.totalPos); + } + return object; + } + const { headByte, pos, totalPos } = this; + throw new RangeError(`Insufficient data in parsing ${(0, prettyByte_1.prettyByte)(headByte)} at ${totalPos} (${pos} in the current buffer)`); + } + decodeArrayStream(stream) { + return this.decodeMultiAsync(stream, true); + } + decodeStream(stream) { + return this.decodeMultiAsync(stream, false); + } + async *decodeMultiAsync(stream, isArray) { + let isArrayHeaderRequired = isArray; + let arrayItemsLeft = -1; + for await (const buffer of stream) { + if (isArray && arrayItemsLeft === 0) { + throw this.createExtraByteError(this.totalPos); + } + this.appendBuffer(buffer); + if (isArrayHeaderRequired) { + arrayItemsLeft = this.readArraySize(); + isArrayHeaderRequired = false; + this.complete(); + } + try { + while (true) { + yield this.doDecodeSync(); + if (--arrayItemsLeft === 0) { + break; + } + } + } catch (e) { + if (!(e instanceof exports.DataViewIndexOutOfBoundsError)) { + throw e; + } + } + this.totalPos += this.pos; + } + } + doDecodeSync() { + DECODE: + while (true) { + const headByte = this.readHeadByte(); + let object; + if (headByte >= 224) { + object = headByte - 256; + } else if (headByte < 192) { + if (headByte < 128) { + object = headByte; + } else if (headByte < 144) { + const size = headByte - 128; + if (size !== 0) { + this.pushMapState(size); + this.complete(); + continue DECODE; + } else { + object = {}; + } + } else if (headByte < 160) { + const size = headByte - 144; + if (size !== 0) { + this.pushArrayState(size); + this.complete(); + continue DECODE; + } else { + object = []; + } + } else { + const byteLength = headByte - 160; + object = this.decodeUtf8String(byteLength, 0); + } + } else if (headByte === 192) { + object = null; + } else if (headByte === 194) { + object = false; + } else if (headByte === 195) { + object = true; + } else if (headByte === 202) { + object = this.readF32(); + } else if (headByte === 203) { + object = this.readF64(); + } else if (headByte === 204) { + object = this.readU8(); + } else if (headByte === 205) { + object = this.readU16(); + } else if (headByte === 206) { + object = this.readU32(); + } else if (headByte === 207) { + object = this.readU64(); + } else if (headByte === 208) { + object = this.readI8(); + } else if (headByte === 209) { + object = this.readI16(); + } else if (headByte === 210) { + object = this.readI32(); + } else if (headByte === 211) { + object = this.readI64(); + } else if (headByte === 217) { + const byteLength = this.lookU8(); + object = this.decodeUtf8String(byteLength, 1); + } else if (headByte === 218) { + const byteLength = this.lookU16(); + object = this.decodeUtf8String(byteLength, 2); + } else if (headByte === 219) { + const byteLength = this.lookU32(); + object = this.decodeUtf8String(byteLength, 4); + } else if (headByte === 220) { + const size = this.readU16(); + if (size !== 0) { + this.pushArrayState(size); + this.complete(); + continue DECODE; + } else { + object = []; + } + } else if (headByte === 221) { + const size = this.readU32(); + if (size !== 0) { + this.pushArrayState(size); + this.complete(); + continue DECODE; + } else { + object = []; + } + } else if (headByte === 222) { + const size = this.readU16(); + if (size !== 0) { + this.pushMapState(size); + this.complete(); + continue DECODE; + } else { + object = {}; + } + } else if (headByte === 223) { + const size = this.readU32(); + if (size !== 0) { + this.pushMapState(size); + this.complete(); + continue DECODE; + } else { + object = {}; + } + } else if (headByte === 196) { + const size = this.lookU8(); + object = this.decodeBinary(size, 1); + } else if (headByte === 197) { + const size = this.lookU16(); + object = this.decodeBinary(size, 2); + } else if (headByte === 198) { + const size = this.lookU32(); + object = this.decodeBinary(size, 4); + } else if (headByte === 212) { + object = this.decodeExtension(1, 0); + } else if (headByte === 213) { + object = this.decodeExtension(2, 0); + } else if (headByte === 214) { + object = this.decodeExtension(4, 0); + } else if (headByte === 215) { + object = this.decodeExtension(8, 0); + } else if (headByte === 216) { + object = this.decodeExtension(16, 0); + } else if (headByte === 199) { + const size = this.lookU8(); + object = this.decodeExtension(size, 1); + } else if (headByte === 200) { + const size = this.lookU16(); + object = this.decodeExtension(size, 2); + } else if (headByte === 201) { + const size = this.lookU32(); + object = this.decodeExtension(size, 4); + } else { + throw new DecodeError_1.DecodeError(`Unrecognized type byte: ${(0, prettyByte_1.prettyByte)(headByte)}`); + } + this.complete(); + const stack = this.stack; + while (stack.length > 0) { + const state = stack[stack.length - 1]; + if (state.type === 0) { + state.array[state.position] = object; + state.position++; + if (state.position === state.size) { + stack.pop(); + object = state.array; + } else { + continue DECODE; + } + } else if (state.type === 1) { + if (!isValidMapKeyType(object)) { + throw new DecodeError_1.DecodeError("The type of key must be string or number but " + typeof object); + } + if (object === "__proto__") { + throw new DecodeError_1.DecodeError("The key __proto__ is not allowed"); + } + state.key = object; + state.type = 2; + continue DECODE; + } else { + state.map[state.key] = object; + state.readCount++; + if (state.readCount === state.size) { + stack.pop(); + object = state.map; + } else { + state.key = null; + state.type = 1; + continue DECODE; + } + } + } + return object; + } + } + readHeadByte() { + if (this.headByte === HEAD_BYTE_REQUIRED) { + this.headByte = this.readU8(); + } + return this.headByte; + } + complete() { + this.headByte = HEAD_BYTE_REQUIRED; + } + readArraySize() { + const headByte = this.readHeadByte(); + switch (headByte) { + case 220: + return this.readU16(); + case 221: + return this.readU32(); + default: { + if (headByte < 160) { + return headByte - 144; + } else { + throw new DecodeError_1.DecodeError(`Unrecognized array type byte: ${(0, prettyByte_1.prettyByte)(headByte)}`); + } + } + } + } + pushMapState(size) { + if (size > this.maxMapLength) { + throw new DecodeError_1.DecodeError(`Max length exceeded: map length (${size}) > maxMapLengthLength (${this.maxMapLength})`); + } + this.stack.push({ + type: 1, + size, + key: null, + readCount: 0, + map: {} + }); + } + pushArrayState(size) { + if (size > this.maxArrayLength) { + throw new DecodeError_1.DecodeError(`Max length exceeded: array length (${size}) > maxArrayLength (${this.maxArrayLength})`); + } + this.stack.push({ + type: 0, + size, + array: new Array(size), + position: 0 + }); + } + decodeUtf8String(byteLength, headerOffset) { + var _a; + if (byteLength > this.maxStrLength) { + throw new DecodeError_1.DecodeError(`Max length exceeded: UTF-8 byte length (${byteLength}) > maxStrLength (${this.maxStrLength})`); + } + if (this.bytes.byteLength < this.pos + headerOffset + byteLength) { + throw MORE_DATA; + } + const offset = this.pos + headerOffset; + let object; + if (this.stateIsMapKey() && ((_a = this.keyDecoder) === null || _a === void 0 ? void 0 : _a.canBeCached(byteLength))) { + object = this.keyDecoder.decode(this.bytes, offset, byteLength); + } else if (byteLength > utf8_1.TEXT_DECODER_THRESHOLD) { + object = (0, utf8_1.utf8DecodeTD)(this.bytes, offset, byteLength); + } else { + object = (0, utf8_1.utf8DecodeJs)(this.bytes, offset, byteLength); + } + this.pos += headerOffset + byteLength; + return object; + } + stateIsMapKey() { + if (this.stack.length > 0) { + const state = this.stack[this.stack.length - 1]; + return state.type === 1; + } + return false; + } + decodeBinary(byteLength, headOffset) { + if (byteLength > this.maxBinLength) { + throw new DecodeError_1.DecodeError(`Max length exceeded: bin length (${byteLength}) > maxBinLength (${this.maxBinLength})`); + } + if (!this.hasRemaining(byteLength + headOffset)) { + throw MORE_DATA; + } + const offset = this.pos + headOffset; + const object = this.bytes.subarray(offset, offset + byteLength); + this.pos += headOffset + byteLength; + return object; + } + decodeExtension(size, headOffset) { + if (size > this.maxExtLength) { + throw new DecodeError_1.DecodeError(`Max length exceeded: ext length (${size}) > maxExtLength (${this.maxExtLength})`); + } + const extType = this.view.getInt8(this.pos + headOffset); + const data = this.decodeBinary(size, headOffset + 1); + return this.extensionCodec.decode(data, extType, this.context); + } + lookU8() { + return this.view.getUint8(this.pos); + } + lookU16() { + return this.view.getUint16(this.pos); + } + lookU32() { + return this.view.getUint32(this.pos); + } + readU8() { + const value = this.view.getUint8(this.pos); + this.pos++; + return value; + } + readI8() { + const value = this.view.getInt8(this.pos); + this.pos++; + return value; + } + readU16() { + const value = this.view.getUint16(this.pos); + this.pos += 2; + return value; + } + readI16() { + const value = this.view.getInt16(this.pos); + this.pos += 2; + return value; + } + readU32() { + const value = this.view.getUint32(this.pos); + this.pos += 4; + return value; + } + readI32() { + const value = this.view.getInt32(this.pos); + this.pos += 4; + return value; + } + readU64() { + const value = (0, int_1.getUint64)(this.view, this.pos); + this.pos += 8; + return value; + } + readI64() { + const value = (0, int_1.getInt64)(this.view, this.pos); + this.pos += 8; + return value; + } + readF32() { + const value = this.view.getFloat32(this.pos); + this.pos += 4; + return value; + } + readF64() { + const value = this.view.getFloat64(this.pos); + this.pos += 8; + return value; + } + }; + exports.Decoder = Decoder; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/decode.js + var require_decode = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/decode.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.decodeMulti = exports.decode = exports.defaultDecodeOptions = void 0; + var Decoder_1 = require_Decoder(); + exports.defaultDecodeOptions = {}; + function decode(buffer, options = exports.defaultDecodeOptions) { + const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); + return decoder.decode(buffer); + } + exports.decode = decode; + function decodeMulti(buffer, options = exports.defaultDecodeOptions) { + const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); + return decoder.decodeMulti(buffer); + } + exports.decodeMulti = decodeMulti; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/utils/stream.js + var require_stream = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/utils/stream.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ensureAsyncIterable = exports.asyncIterableFromStream = exports.isAsyncIterable = void 0; + function isAsyncIterable(object) { + return object[Symbol.asyncIterator] != null; + } + exports.isAsyncIterable = isAsyncIterable; + function assertNonNull(value) { + if (value == null) { + throw new Error("Assertion Failure: value must not be null nor undefined"); + } + } + async function* asyncIterableFromStream(stream) { + const reader = stream.getReader(); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) { + return; + } + assertNonNull(value); + yield value; + } + } finally { + reader.releaseLock(); + } + } + exports.asyncIterableFromStream = asyncIterableFromStream; + function ensureAsyncIterable(streamLike) { + if (isAsyncIterable(streamLike)) { + return streamLike; + } else { + return asyncIterableFromStream(streamLike); + } + } + exports.ensureAsyncIterable = ensureAsyncIterable; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/decodeAsync.js + var require_decodeAsync = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/decodeAsync.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.decodeStream = exports.decodeMultiStream = exports.decodeArrayStream = exports.decodeAsync = void 0; + var Decoder_1 = require_Decoder(); + var stream_1 = require_stream(); + var decode_1 = require_decode(); + async function decodeAsync(streamLike, options = decode_1.defaultDecodeOptions) { + const stream = (0, stream_1.ensureAsyncIterable)(streamLike); + const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); + return decoder.decodeAsync(stream); + } + exports.decodeAsync = decodeAsync; + function decodeArrayStream(streamLike, options = decode_1.defaultDecodeOptions) { + const stream = (0, stream_1.ensureAsyncIterable)(streamLike); + const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); + return decoder.decodeArrayStream(stream); + } + exports.decodeArrayStream = decodeArrayStream; + function decodeMultiStream(streamLike, options = decode_1.defaultDecodeOptions) { + const stream = (0, stream_1.ensureAsyncIterable)(streamLike); + const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); + return decoder.decodeStream(stream); + } + exports.decodeMultiStream = decodeMultiStream; + function decodeStream(streamLike, options = decode_1.defaultDecodeOptions) { + return decodeMultiStream(streamLike, options); + } + exports.decodeStream = decodeStream; + } + }); + + // ../../node_modules/@msgpack/msgpack/dist/index.js + var require_dist = __commonJS({ + "../../node_modules/@msgpack/msgpack/dist/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.decodeTimestampExtension = exports.encodeTimestampExtension = exports.decodeTimestampToTimeSpec = exports.encodeTimeSpecToTimestamp = exports.encodeDateToTimeSpec = exports.EXT_TIMESTAMP = exports.ExtData = exports.ExtensionCodec = exports.Encoder = exports.DataViewIndexOutOfBoundsError = exports.DecodeError = exports.Decoder = exports.decodeStream = exports.decodeMultiStream = exports.decodeArrayStream = exports.decodeAsync = exports.decodeMulti = exports.decode = exports.encode = void 0; + var encode_1 = require_encode(); + Object.defineProperty(exports, "encode", { enumerable: true, get: function() { + return encode_1.encode; + } }); + var decode_1 = require_decode(); + Object.defineProperty(exports, "decode", { enumerable: true, get: function() { + return decode_1.decode; + } }); + Object.defineProperty(exports, "decodeMulti", { enumerable: true, get: function() { + return decode_1.decodeMulti; + } }); + var decodeAsync_1 = require_decodeAsync(); + Object.defineProperty(exports, "decodeAsync", { enumerable: true, get: function() { + return decodeAsync_1.decodeAsync; + } }); + Object.defineProperty(exports, "decodeArrayStream", { enumerable: true, get: function() { + return decodeAsync_1.decodeArrayStream; + } }); + Object.defineProperty(exports, "decodeMultiStream", { enumerable: true, get: function() { + return decodeAsync_1.decodeMultiStream; + } }); + Object.defineProperty(exports, "decodeStream", { enumerable: true, get: function() { + return decodeAsync_1.decodeStream; + } }); + var Decoder_1 = require_Decoder(); + Object.defineProperty(exports, "Decoder", { enumerable: true, get: function() { + return Decoder_1.Decoder; + } }); + Object.defineProperty(exports, "DataViewIndexOutOfBoundsError", { enumerable: true, get: function() { + return Decoder_1.DataViewIndexOutOfBoundsError; + } }); + var DecodeError_1 = require_DecodeError(); + Object.defineProperty(exports, "DecodeError", { enumerable: true, get: function() { + return DecodeError_1.DecodeError; + } }); + var Encoder_1 = require_Encoder(); + Object.defineProperty(exports, "Encoder", { enumerable: true, get: function() { + return Encoder_1.Encoder; + } }); + var ExtensionCodec_1 = require_ExtensionCodec(); + Object.defineProperty(exports, "ExtensionCodec", { enumerable: true, get: function() { + return ExtensionCodec_1.ExtensionCodec; + } }); + var ExtData_1 = require_ExtData(); + Object.defineProperty(exports, "ExtData", { enumerable: true, get: function() { + return ExtData_1.ExtData; + } }); + var timestamp_1 = require_timestamp(); + Object.defineProperty(exports, "EXT_TIMESTAMP", { enumerable: true, get: function() { + return timestamp_1.EXT_TIMESTAMP; + } }); + Object.defineProperty(exports, "encodeDateToTimeSpec", { enumerable: true, get: function() { + return timestamp_1.encodeDateToTimeSpec; + } }); + Object.defineProperty(exports, "encodeTimeSpecToTimestamp", { enumerable: true, get: function() { + return timestamp_1.encodeTimeSpecToTimestamp; + } }); + Object.defineProperty(exports, "decodeTimestampToTimeSpec", { enumerable: true, get: function() { + return timestamp_1.decodeTimestampToTimeSpec; + } }); + Object.defineProperty(exports, "encodeTimestampExtension", { enumerable: true, get: function() { + return timestamp_1.encodeTimestampExtension; + } }); + Object.defineProperty(exports, "decodeTimestampExtension", { enumerable: true, get: function() { + return timestamp_1.decodeTimestampExtension; + } }); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/types.js + var require_types = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/types.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JsHeaders = exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.DEFAULT_MAX_PING_OUT = exports.DEFAULT_PING_INTERVAL = exports.DEFAULT_JITTER_TLS = exports.DEFAULT_JITTER = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.DEFAULT_RECONNECT_TIME_WAIT = exports.DEFAULT_HOST = exports.DEFAULT_PORT = exports.DebugEvents = exports.Events = exports.Empty = void 0; + exports.Empty = new Uint8Array(0); + var Events; + (function(Events2) { + Events2["Disconnect"] = "disconnect"; + Events2["Reconnect"] = "reconnect"; + Events2["Update"] = "update"; + Events2["LDM"] = "ldm"; + Events2["Error"] = "error"; + })(Events = exports.Events || (exports.Events = {})); + var DebugEvents; + (function(DebugEvents2) { + DebugEvents2["Reconnecting"] = "reconnecting"; + DebugEvents2["PingTimer"] = "pingTimer"; + DebugEvents2["StaleConnection"] = "staleConnection"; + })(DebugEvents = exports.DebugEvents || (exports.DebugEvents = {})); + exports.DEFAULT_PORT = 4222; + exports.DEFAULT_HOST = "127.0.0.1"; + exports.DEFAULT_RECONNECT_TIME_WAIT = 2 * 1e3; + exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = 10; + exports.DEFAULT_JITTER = 100; + exports.DEFAULT_JITTER_TLS = 1e3; + exports.DEFAULT_PING_INTERVAL = 2 * 60 * 1e3; + exports.DEFAULT_MAX_PING_OUT = 2; + var AdvisoryKind; + (function(AdvisoryKind2) { + AdvisoryKind2["API"] = "api_audit"; + AdvisoryKind2["StreamAction"] = "stream_action"; + AdvisoryKind2["ConsumerAction"] = "consumer_action"; + AdvisoryKind2["SnapshotCreate"] = "snapshot_create"; + AdvisoryKind2["SnapshotComplete"] = "snapshot_complete"; + AdvisoryKind2["RestoreCreate"] = "restore_create"; + AdvisoryKind2["RestoreComplete"] = "restore_complete"; + AdvisoryKind2["MaxDeliver"] = "max_deliver"; + AdvisoryKind2["Terminated"] = "terminated"; + AdvisoryKind2["Ack"] = "consumer_ack"; + AdvisoryKind2["StreamLeaderElected"] = "stream_leader_elected"; + AdvisoryKind2["StreamQuorumLost"] = "stream_quorum_lost"; + AdvisoryKind2["ConsumerLeaderElected"] = "consumer_leader_elected"; + AdvisoryKind2["ConsumerQuorumLost"] = "consumer_quorum_lost"; + })(AdvisoryKind = exports.AdvisoryKind || (exports.AdvisoryKind = {})); + var RetentionPolicy; + (function(RetentionPolicy2) { + RetentionPolicy2["Limits"] = "limits"; + RetentionPolicy2["Interest"] = "interest"; + RetentionPolicy2["Workqueue"] = "workqueue"; + })(RetentionPolicy = exports.RetentionPolicy || (exports.RetentionPolicy = {})); + var DiscardPolicy; + (function(DiscardPolicy2) { + DiscardPolicy2["Old"] = "old"; + DiscardPolicy2["New"] = "new"; + })(DiscardPolicy = exports.DiscardPolicy || (exports.DiscardPolicy = {})); + var StorageType; + (function(StorageType2) { + StorageType2["File"] = "file"; + StorageType2["Memory"] = "memory"; + })(StorageType = exports.StorageType || (exports.StorageType = {})); + var DeliverPolicy; + (function(DeliverPolicy2) { + DeliverPolicy2["All"] = "all"; + DeliverPolicy2["Last"] = "last"; + DeliverPolicy2["New"] = "new"; + DeliverPolicy2["StartSequence"] = "by_start_sequence"; + DeliverPolicy2["StartTime"] = "by_start_time"; + })(DeliverPolicy = exports.DeliverPolicy || (exports.DeliverPolicy = {})); + var AckPolicy; + (function(AckPolicy2) { + AckPolicy2["None"] = "none"; + AckPolicy2["All"] = "all"; + AckPolicy2["Explicit"] = "explicit"; + AckPolicy2["NotSet"] = ""; + })(AckPolicy = exports.AckPolicy || (exports.AckPolicy = {})); + var ReplayPolicy; + (function(ReplayPolicy2) { + ReplayPolicy2["Instant"] = "instant"; + ReplayPolicy2["Original"] = "original"; + })(ReplayPolicy = exports.ReplayPolicy || (exports.ReplayPolicy = {})); + var JsHeaders; + (function(JsHeaders2) { + JsHeaders2["StreamSourceHdr"] = "Nats-Stream-Source"; + JsHeaders2["LastConsumerSeqHdr"] = "Nats-Last-Consumer"; + JsHeaders2["LastStreamSeqHdr"] = "Nats-Last-Stream"; + })(JsHeaders = exports.JsHeaders || (exports.JsHeaders = {})); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/encoders.js + var require_encoders = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/encoders.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.fastDecoder = exports.fastEncoder = exports.TD = exports.TE = void 0; + var types_1 = require_types(); + exports.TE = new TextEncoder(); + exports.TD = new TextDecoder(); + function fastEncoder(...a) { + let len = 0; + for (let i = 0; i < a.length; i++) { + len += a[i] ? a[i].length : 0; + } + if (len === 0) { + return types_1.Empty; + } + const buf = new Uint8Array(len); + let c = 0; + for (let i = 0; i < a.length; i++) { + const s = a[i]; + if (s) { + for (let j = 0; j < s.length; j++) { + buf[c] = s.charCodeAt(j); + c++; + } + } + } + return buf; + } + exports.fastEncoder = fastEncoder; + function fastDecoder(a) { + if (!a || a.length === 0) { + return ""; + } + return String.fromCharCode(...a); + } + exports.fastDecoder = fastDecoder; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/databuffer.js + var require_databuffer = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/databuffer.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.DataBuffer = void 0; + var encoders_1 = require_encoders(); + var DataBuffer = class { + constructor() { + this.buffers = []; + this.byteLength = 0; + } + static concat(...bufs) { + let max = 0; + for (let i = 0; i < bufs.length; i++) { + max += bufs[i].length; + } + const out = new Uint8Array(max); + let index = 0; + for (let i = 0; i < bufs.length; i++) { + out.set(bufs[i], index); + index += bufs[i].length; + } + return out; + } + static fromAscii(m) { + if (!m) { + m = ""; + } + return encoders_1.TE.encode(m); + } + static toAscii(a) { + return encoders_1.TD.decode(a); + } + reset() { + this.buffers.length = 0; + this.byteLength = 0; + } + pack() { + if (this.buffers.length > 1) { + const v = new Uint8Array(this.byteLength); + let index = 0; + for (let i = 0; i < this.buffers.length; i++) { + v.set(this.buffers[i], index); + index += this.buffers[i].length; + } + this.buffers.length = 0; + this.buffers.push(v); + } + } + drain(n) { + if (this.buffers.length) { + this.pack(); + const v = this.buffers.pop(); + if (v) { + const max = this.byteLength; + if (n === void 0 || n > max) { + n = max; + } + const d = v.subarray(0, n); + if (max > n) { + this.buffers.push(v.subarray(n)); + } + this.byteLength = max - n; + return d; + } + } + return new Uint8Array(0); + } + fill(a, ...bufs) { + if (a) { + this.buffers.push(a); + this.byteLength += a.length; + } + for (let i = 0; i < bufs.length; i++) { + if (bufs[i] && bufs[i].length) { + this.buffers.push(bufs[i]); + this.byteLength += bufs[i].length; + } + } + } + peek() { + if (this.buffers.length) { + this.pack(); + return this.buffers[0]; + } + return new Uint8Array(0); + } + size() { + return this.byteLength; + } + length() { + return this.buffers.length; + } + }; + exports.DataBuffer = DataBuffer; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/error.js + var require_error = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/error.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.NatsError = exports.isNatsError = exports.Messages = exports.ErrorCode = void 0; + var ErrorCode; + (function(ErrorCode2) { + ErrorCode2["ApiError"] = "BAD API"; + ErrorCode2["BadAuthentication"] = "BAD_AUTHENTICATION"; + ErrorCode2["BadCreds"] = "BAD_CREDS"; + ErrorCode2["BadHeader"] = "BAD_HEADER"; + ErrorCode2["BadJson"] = "BAD_JSON"; + ErrorCode2["BadPayload"] = "BAD_PAYLOAD"; + ErrorCode2["BadSubject"] = "BAD_SUBJECT"; + ErrorCode2["Cancelled"] = "CANCELLED"; + ErrorCode2["ConnectionClosed"] = "CONNECTION_CLOSED"; + ErrorCode2["ConnectionDraining"] = "CONNECTION_DRAINING"; + ErrorCode2["ConnectionRefused"] = "CONNECTION_REFUSED"; + ErrorCode2["ConnectionTimeout"] = "CONNECTION_TIMEOUT"; + ErrorCode2["Disconnect"] = "DISCONNECT"; + ErrorCode2["InvalidOption"] = "INVALID_OPTION"; + ErrorCode2["InvalidPayload"] = "INVALID_PAYLOAD"; + ErrorCode2["MaxPayloadExceeded"] = "MAX_PAYLOAD_EXCEEDED"; + ErrorCode2["NoResponders"] = "503"; + ErrorCode2["NotFunction"] = "NOT_FUNC"; + ErrorCode2["RequestError"] = "REQUEST_ERROR"; + ErrorCode2["ServerOptionNotAvailable"] = "SERVER_OPT_NA"; + ErrorCode2["SubClosed"] = "SUB_CLOSED"; + ErrorCode2["SubDraining"] = "SUB_DRAINING"; + ErrorCode2["Timeout"] = "TIMEOUT"; + ErrorCode2["Tls"] = "TLS"; + ErrorCode2["Unknown"] = "UNKNOWN_ERROR"; + ErrorCode2["WssRequired"] = "WSS_REQUIRED"; + ErrorCode2["JetStreamInvalidAck"] = "JESTREAM_INVALID_ACK"; + ErrorCode2["JetStream404NoMessages"] = "404"; + ErrorCode2["JetStream408RequestTimeout"] = "408"; + ErrorCode2["JetStream409MaxAckPendingExceeded"] = "409"; + ErrorCode2["JetStreamNotEnabled"] = "503"; + ErrorCode2["AuthorizationViolation"] = "AUTHORIZATION_VIOLATION"; + ErrorCode2["AuthenticationExpired"] = "AUTHENTICATION_EXPIRED"; + ErrorCode2["ProtocolError"] = "NATS_PROTOCOL_ERR"; + ErrorCode2["PermissionsViolation"] = "PERMISSIONS_VIOLATION"; + })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); + var Messages = class { + constructor() { + this.messages = /* @__PURE__ */ new Map(); + this.messages.set(ErrorCode.InvalidPayload, "Invalid payload type - payloads can be 'binary', 'string', or 'json'"); + this.messages.set(ErrorCode.BadJson, "Bad JSON"); + this.messages.set(ErrorCode.WssRequired, "TLS is required, therefore a secure websocket connection is also required"); + } + static getMessage(s) { + return messages.getMessage(s); + } + getMessage(s) { + return this.messages.get(s) || s; + } + }; + exports.Messages = Messages; + var messages = new Messages(); + function isNatsError(err) { + return typeof err.code === "string"; + } + exports.isNatsError = isNatsError; + var NatsError = class extends Error { + constructor(message, code, chainedError) { + super(message); + this.name = "NatsError"; + this.message = message; + this.code = code; + this.chainedError = chainedError; + } + static errorForCode(code, chainedError) { + const m = Messages.getMessage(code); + return new NatsError(m, code, chainedError); + } + isAuthError() { + return this.code === ErrorCode.AuthenticationExpired || this.code === ErrorCode.AuthorizationViolation; + } + isPermissionError() { + return this.code === ErrorCode.PermissionsViolation; + } + isProtocolError() { + return this.code === ErrorCode.ProtocolError; + } + }; + exports.NatsError = NatsError; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/util.js + var require_util = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/util.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Perf = exports.shuffle = exports.deferred = exports.delay = exports.timeout = exports.render = exports.extend = exports.extractProtocolMessage = exports.protoLen = exports.isUint8Array = exports.LF = exports.CR = exports.CRLF = exports.CR_LF_LEN = exports.CR_LF = void 0; + var databuffer_1 = require_databuffer(); + var error_1 = require_error(); + var encoders_1 = require_encoders(); + exports.CR_LF = "\r\n"; + exports.CR_LF_LEN = exports.CR_LF.length; + exports.CRLF = databuffer_1.DataBuffer.fromAscii(exports.CR_LF); + exports.CR = new Uint8Array(exports.CRLF)[0]; + exports.LF = new Uint8Array(exports.CRLF)[1]; + function isUint8Array(a) { + return a instanceof Uint8Array; + } + exports.isUint8Array = isUint8Array; + function protoLen(ba) { + for (let i = 0; i < ba.length; i++) { + const n = i + 1; + if (ba.byteLength > n && ba[i] === exports.CR && ba[n] === exports.LF) { + return n + 1; + } + } + return -1; + } + exports.protoLen = protoLen; + function extractProtocolMessage(a) { + const len = protoLen(a); + if (len) { + const ba = new Uint8Array(a); + const out = ba.slice(0, len); + return encoders_1.TD.decode(out); + } + return ""; + } + exports.extractProtocolMessage = extractProtocolMessage; + function extend(a, ...b) { + for (let i = 0; i < b.length; i++) { + const o = b[i]; + Object.keys(o).forEach(function(k) { + a[k] = o[k]; + }); + } + return a; + } + exports.extend = extend; + function render(frame) { + const cr = "\u240D"; + const lf = "\u240A"; + return encoders_1.TD.decode(frame).replace(/\n/g, lf).replace(/\r/g, cr); + } + exports.render = render; + function timeout(ms) { + let methods; + let timer; + const p = new Promise((_resolve, reject) => { + const cancel = () => { + if (timer) { + clearTimeout(timer); + } + }; + methods = { cancel }; + timer = setTimeout(() => { + reject(error_1.NatsError.errorForCode(error_1.ErrorCode.Timeout)); + }, ms); + }); + return Object.assign(p, methods); + } + exports.timeout = timeout; + function delay(ms = 0) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, ms); + }); + } + exports.delay = delay; + function deferred() { + let methods = {}; + const p = new Promise((resolve, reject) => { + methods = { resolve, reject }; + }); + return Object.assign(p, methods); + } + exports.deferred = deferred; + function shuffle(a) { + for (let i = a.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [a[i], a[j]] = [a[j], a[i]]; + } + return a; + } + exports.shuffle = shuffle; + var Perf = class { + constructor() { + this.timers = /* @__PURE__ */ new Map(); + this.measures = /* @__PURE__ */ new Map(); + } + mark(key) { + this.timers.set(key, Date.now()); + } + measure(key, startKey, endKey) { + const s = this.timers.get(startKey); + if (s === void 0) { + throw new Error(`${startKey} is not defined`); + } + const e = this.timers.get(endKey); + if (e === void 0) { + throw new Error(`${endKey} is not defined`); + } + this.measures.set(key, e - s); + } + getEntries() { + const values = []; + this.measures.forEach((v, k) => { + values.push({ name: k, duration: v }); + }); + return values; + } + }; + exports.Perf = Perf; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/transport.js + var require_transport = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/transport.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.newTransport = exports.getUrlParseFn = exports.defaultPort = exports.setTransportFactory = void 0; + var types_1 = require_types(); + var transportConfig; + function setTransportFactory(config) { + transportConfig = config; + } + exports.setTransportFactory = setTransportFactory; + function defaultPort() { + return transportConfig !== void 0 && transportConfig.defaultPort !== void 0 ? transportConfig.defaultPort : types_1.DEFAULT_PORT; + } + exports.defaultPort = defaultPort; + function getUrlParseFn() { + return transportConfig !== void 0 && transportConfig.urlParseFn ? transportConfig.urlParseFn : void 0; + } + exports.getUrlParseFn = getUrlParseFn; + function newTransport() { + if (!transportConfig || typeof transportConfig.factory !== "function") { + throw new Error("transport fn is not set"); + } + return transportConfig.factory(); + } + exports.newTransport = newTransport; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/nuid.js + var require_nuid = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/nuid.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.nuid = exports.Nuid = void 0; + var digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + var base = 36; + var preLen = 12; + var seqLen = 10; + var maxSeq = 3656158440062976; + var minInc = 33; + var maxInc = 333; + var totalLen = preLen + seqLen; + var cryptoObj = initCrypto(); + function initCrypto() { + let cryptoObj2 = null; + if (typeof globalThis !== "undefined") { + if ("crypto" in globalThis && globalThis.crypto.getRandomValues) { + cryptoObj2 = globalThis.crypto; + } + } + if (!cryptoObj2) { + cryptoObj2 = { + getRandomValues: function(array) { + for (let i = 0; i < array.length; i++) { + array[i] = Math.floor(Math.random() * 255); + } + } + }; + } + return cryptoObj2; + } + var Nuid = class { + constructor() { + this.buf = new Uint8Array(totalLen); + this.init(); + } + init() { + this.setPre(); + this.initSeqAndInc(); + this.fillSeq(); + } + initSeqAndInc() { + this.seq = Math.floor(Math.random() * maxSeq); + this.inc = Math.floor(Math.random() * (maxInc - minInc) + minInc); + } + setPre() { + const cbuf = new Uint8Array(preLen); + cryptoObj.getRandomValues(cbuf); + for (let i = 0; i < preLen; i++) { + const di = cbuf[i] % base; + this.buf[i] = digits.charCodeAt(di); + } + } + fillSeq() { + let n = this.seq; + for (let i = totalLen - 1; i >= preLen; i--) { + this.buf[i] = digits.charCodeAt(n % base); + n = Math.floor(n / base); + } + } + next() { + this.seq += this.inc; + if (this.seq > maxSeq) { + this.setPre(); + this.initSeqAndInc(); + } + this.fillSeq(); + return String.fromCharCode.apply(String, this.buf); + } + reset() { + this.init(); + } + }; + exports.Nuid = Nuid; + exports.nuid = new Nuid(); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/ipparser.js + var require_ipparser = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/ipparser.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseIP = exports.isIP = exports.ipV4 = void 0; + var IPv4LEN = 4; + var IPv6LEN = 16; + var ASCII0 = 48; + var ASCII9 = 57; + var ASCIIA = 65; + var ASCIIF = 70; + var ASCIIa = 97; + var ASCIIf = 102; + var big = 16777215; + function ipV4(a, b, c, d) { + const ip = new Uint8Array(IPv6LEN); + const prefix = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255]; + prefix.forEach((v, idx) => { + ip[idx] = v; + }); + ip[12] = a; + ip[13] = b; + ip[14] = c; + ip[15] = d; + return ip; + } + exports.ipV4 = ipV4; + function isIP(h) { + return parseIP(h) !== void 0; + } + exports.isIP = isIP; + function parseIP(h) { + for (let i = 0; i < h.length; i++) { + switch (h[i]) { + case ".": + return parseIPv4(h); + case ":": + return parseIPv6(h); + } + } + return; + } + exports.parseIP = parseIP; + function parseIPv4(s) { + const ip = new Uint8Array(IPv4LEN); + for (let i = 0; i < IPv4LEN; i++) { + if (s.length === 0) { + return void 0; + } + if (i > 0) { + if (s[0] !== ".") { + return void 0; + } + s = s.substring(1); + } + const { n, c, ok } = dtoi(s); + if (!ok || n > 255) { + return void 0; + } + s = s.substring(c); + ip[i] = n; + } + return ipV4(ip[0], ip[1], ip[2], ip[3]); + } + function parseIPv6(s) { + const ip = new Uint8Array(IPv6LEN); + let ellipsis = -1; + if (s.length >= 2 && s[0] === ":" && s[1] === ":") { + ellipsis = 0; + s = s.substring(2); + if (s.length === 0) { + return ip; + } + } + let i = 0; + while (i < IPv6LEN) { + const { n, c, ok } = xtoi(s); + if (!ok || n > 65535) { + return void 0; + } + if (c < s.length && s[c] === ".") { + if (ellipsis < 0 && i != IPv6LEN - IPv4LEN) { + return void 0; + } + if (i + IPv4LEN > IPv6LEN) { + return void 0; + } + const ip4 = parseIPv4(s); + if (ip4 === void 0) { + return void 0; + } + ip[i] = ip4[12]; + ip[i + 1] = ip4[13]; + ip[i + 2] = ip4[14]; + ip[i + 3] = ip4[15]; + s = ""; + i += IPv4LEN; + break; + } + ip[i] = n >> 8; + ip[i + 1] = n; + i += 2; + s = s.substring(c); + if (s.length === 0) { + break; + } + if (s[0] !== ":" || s.length == 1) { + return void 0; + } + s = s.substring(1); + if (s[0] === ":") { + if (ellipsis >= 0) { + return void 0; + } + ellipsis = i; + s = s.substring(1); + if (s.length === 0) { + break; + } + } + } + if (s.length !== 0) { + return void 0; + } + if (i < IPv6LEN) { + if (ellipsis < 0) { + return void 0; + } + const n = IPv6LEN - i; + for (let j = i - 1; j >= ellipsis; j--) { + ip[j + n] = ip[j]; + } + for (let j = ellipsis + n - 1; j >= ellipsis; j--) { + ip[j] = 0; + } + } else if (ellipsis >= 0) { + return void 0; + } + return ip; + } + function dtoi(s) { + let i = 0; + let n = 0; + for (i = 0; i < s.length && ASCII0 <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCII9; i++) { + n = n * 10 + (s.charCodeAt(i) - ASCII0); + if (n >= big) { + return { n: big, c: i, ok: false }; + } + } + if (i === 0) { + return { n: 0, c: 0, ok: false }; + } + return { n, c: i, ok: true }; + } + function xtoi(s) { + let n = 0; + let i = 0; + for (i = 0; i < s.length; i++) { + if (ASCII0 <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCII9) { + n *= 16; + n += s.charCodeAt(i) - ASCII0; + } else if (ASCIIa <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCIIf) { + n *= 16; + n += s.charCodeAt(i) - ASCIIa + 10; + } else if (ASCIIA <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCIIF) { + n *= 16; + n += s.charCodeAt(i) - ASCIIA + 10; + } else { + break; + } + if (n >= big) { + return { n: 0, c: i, ok: false }; + } + } + if (i === 0) { + return { n: 0, c: i, ok: false }; + } + return { n, c: i, ok: true }; + } + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/servers.js + var require_servers = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/servers.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Servers = exports.ServerImpl = void 0; + var types_1 = require_types(); + var transport_1 = require_transport(); + var util_1 = require_util(); + var ipparser_1 = require_ipparser(); + var ServerImpl = class { + constructor(u, gossiped = false) { + this.src = u; + this.tlsName = ""; + if (u.match(/^(.*:\/\/)(.*)/m)) { + u = u.replace(/^(.*:\/\/)(.*)/gm, "$2"); + } + const url = new URL(`http://${u}`); + if (!url.port) { + url.port = `${types_1.DEFAULT_PORT}`; + } + this.listen = url.host; + this.hostname = url.hostname; + this.port = parseInt(url.port, 10); + this.didConnect = false; + this.reconnects = 0; + this.lastConnect = 0; + this.gossiped = gossiped; + } + toString() { + return this.listen; + } + }; + exports.ServerImpl = ServerImpl; + var Servers = class { + constructor(randomize, listens = []) { + this.firstSelect = true; + this.servers = []; + this.tlsName = ""; + const urlParseFn = transport_1.getUrlParseFn(); + if (listens) { + listens.forEach((hp) => { + hp = urlParseFn ? urlParseFn(hp) : hp; + this.servers.push(new ServerImpl(hp)); + }); + if (randomize) { + this.servers = util_1.shuffle(this.servers); + } + } + if (this.servers.length === 0) { + this.addServer(`${types_1.DEFAULT_HOST}:${transport_1.defaultPort()}`, false); + } + this.currentServer = this.servers[0]; + } + updateTLSName() { + const cs = this.getCurrentServer(); + if (!ipparser_1.isIP(cs.hostname)) { + this.tlsName = cs.hostname; + this.servers.forEach((s) => { + if (s.gossiped) { + s.tlsName = this.tlsName; + } + }); + } + } + getCurrentServer() { + return this.currentServer; + } + addServer(u, implicit = false) { + const urlParseFn = transport_1.getUrlParseFn(); + u = urlParseFn ? urlParseFn(u) : u; + const s = new ServerImpl(u, implicit); + if (ipparser_1.isIP(s.hostname)) { + s.tlsName = this.tlsName; + } + this.servers.push(s); + } + selectServer() { + if (this.firstSelect) { + this.firstSelect = false; + return this.currentServer; + } + const t = this.servers.shift(); + if (t) { + this.servers.push(t); + this.currentServer = t; + } + return t; + } + removeCurrentServer() { + this.removeServer(this.currentServer); + } + removeServer(server) { + if (server) { + const index = this.servers.indexOf(server); + this.servers.splice(index, 1); + } + } + length() { + return this.servers.length; + } + next() { + return this.servers.length ? this.servers[0] : void 0; + } + getServers() { + return this.servers; + } + update(info) { + const added = []; + let deleted = []; + const urlParseFn = transport_1.getUrlParseFn(); + const discovered = /* @__PURE__ */ new Map(); + if (info.connect_urls && info.connect_urls.length > 0) { + info.connect_urls.forEach((hp) => { + hp = urlParseFn ? urlParseFn(hp) : hp; + const s = new ServerImpl(hp, true); + discovered.set(hp, s); + }); + } + const toDelete = []; + this.servers.forEach((s, index) => { + const u = s.listen; + if (s.gossiped && this.currentServer.listen !== u && discovered.get(u) === void 0) { + toDelete.push(index); + } + discovered.delete(u); + }); + toDelete.reverse(); + toDelete.forEach((index) => { + const removed = this.servers.splice(index, 1); + deleted = deleted.concat(removed[0].listen); + }); + discovered.forEach((v, k) => { + this.servers.push(v); + added.push(k); + }); + return { added, deleted }; + } + }; + exports.Servers = Servers; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/queued_iterator.js + var require_queued_iterator = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/queued_iterator.js"(exports) { + "use strict"; + var __await = exports && exports.__await || function(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function verb(n) { + if (g[n]) + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + } + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f, v) { + if (f(v), q.shift(), q.length) + resume(q[0][0], q[0][1]); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.QueuedIteratorImpl = void 0; + var util_1 = require_util(); + var error_1 = require_error(); + var QueuedIteratorImpl = class { + constructor() { + this.inflight = 0; + this.processed = 0; + this.received = 0; + this.noIterator = false; + this.done = false; + this.signal = util_1.deferred(); + this.yields = []; + this.iterClosed = util_1.deferred(); + } + [Symbol.asyncIterator]() { + return this.iterate(); + } + push(v) { + if (this.done) { + return; + } + this.yields.push(v); + this.signal.resolve(); + } + iterate() { + return __asyncGenerator(this, arguments, function* iterate_1() { + if (this.noIterator) { + throw new error_1.NatsError("unsupported iterator", error_1.ErrorCode.ApiError); + } + while (true) { + if (this.yields.length === 0) { + yield __await(this.signal); + } + if (this.err) { + throw this.err; + } + const yields = this.yields; + this.inflight = yields.length; + this.yields = []; + for (let i = 0; i < yields.length; i++) { + this.processed++; + yield yield __await(yields[i]); + if (this.dispatchedFn && yields[i]) { + this.dispatchedFn(yields[i]); + } + this.inflight--; + } + if (this.done) { + break; + } else if (this.yields.length === 0) { + yields.length = 0; + this.yields = yields; + this.signal = util_1.deferred(); + } + } + }); + } + stop(err) { + this.err = err; + this.done = true; + this.signal.resolve(); + this.iterClosed.resolve(); + } + getProcessed() { + return this.noIterator ? this.received : this.processed; + } + getPending() { + return this.yields.length + this.inflight; + } + getReceived() { + return this.received; + } + }; + exports.QueuedIteratorImpl = QueuedIteratorImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/subscription.js + var require_subscription = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/subscription.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.SubscriptionImpl = void 0; + var queued_iterator_1 = require_queued_iterator(); + var util_1 = require_util(); + var error_1 = require_error(); + var SubscriptionImpl = class extends queued_iterator_1.QueuedIteratorImpl { + constructor(protocol, subject, opts = {}) { + super(); + util_1.extend(this, opts); + this.protocol = protocol; + this.subject = subject; + this.draining = false; + this.noIterator = typeof opts.callback === "function"; + this.closed = util_1.deferred(); + if (opts.timeout) { + this.timer = util_1.timeout(opts.timeout); + this.timer.then(() => { + this.timer = void 0; + }).catch((err) => { + this.stop(err); + if (this.noIterator) { + this.callback(err, {}); + } + }); + } + } + setDispatchedFn(cb) { + if (this.noIterator) { + const uc = this.callback; + this.callback = (err, msg) => { + uc(err, msg); + cb(msg); + }; + } else { + this.dispatchedFn = cb; + } + } + callback(err, msg) { + this.cancelTimeout(); + err ? this.stop(err) : this.push(msg); + } + close() { + if (!this.isClosed()) { + this.cancelTimeout(); + this.stop(); + if (this.cleanupFn) { + try { + this.cleanupFn(this, this.info); + } catch (_err) { + } + } + this.closed.resolve(); + } + } + unsubscribe(max) { + this.protocol.unsubscribe(this, max); + } + cancelTimeout() { + if (this.timer) { + this.timer.cancel(); + this.timer = void 0; + } + } + drain() { + if (this.protocol.isClosed()) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); + } + if (this.isClosed()) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.SubClosed); + } + if (!this.drained) { + this.protocol.unsub(this); + this.drained = this.protocol.flush(util_1.deferred()); + this.drained.then(() => { + this.protocol.subscriptions.cancel(this); + }); + } + return this.drained; + } + isDraining() { + return this.draining; + } + isClosed() { + return this.done; + } + getSubject() { + return this.subject; + } + getMax() { + return this.max; + } + getID() { + return this.sid; + } + }; + exports.SubscriptionImpl = SubscriptionImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/subscriptions.js + var require_subscriptions = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/subscriptions.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Subscriptions = void 0; + var Subscriptions = class { + constructor() { + this.sidCounter = 0; + this.subs = /* @__PURE__ */ new Map(); + } + size() { + return this.subs.size; + } + add(s) { + this.sidCounter++; + s.sid = this.sidCounter; + this.subs.set(s.sid, s); + return s; + } + setMux(s) { + this.mux = s; + return s; + } + getMux() { + return this.mux; + } + get(sid) { + return this.subs.get(sid); + } + all() { + const buf = []; + for (const s of this.subs.values()) { + buf.push(s); + } + return buf; + } + cancel(s) { + if (s) { + s.close(); + this.subs.delete(s.sid); + } + } + handleError(err) { + let handled = false; + if (err) { + const re = /^'Permissions Violation for Subscription to "(\S+)"'/i; + const ma = re.exec(err.message); + if (ma) { + const subj = ma[1]; + this.subs.forEach((sub) => { + if (subj == sub.subject) { + sub.callback(err, {}); + sub.close(); + handled = sub !== this.mux; + } + }); + } + } + return handled; + } + close() { + this.subs.forEach((sub) => { + sub.close(); + }); + } + }; + exports.Subscriptions = Subscriptions; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/headers.js + var require_headers = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/headers.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = void 0; + var error_1 = require_error(); + var encoders_1 = require_encoders(); + function canonicalMIMEHeaderKey(k) { + const a = 97; + const A = 65; + const Z = 90; + const z = 122; + const dash = 45; + const colon = 58; + const start = 33; + const end = 126; + const toLower = a - A; + let upper = true; + const buf = new Array(k.length); + for (let i = 0; i < k.length; i++) { + let c = k.charCodeAt(i); + if (c === colon || c < start || c > end) { + throw new error_1.NatsError(`'${k[i]}' is not a valid character for a header key`, error_1.ErrorCode.BadHeader); + } + if (upper && a <= c && c <= z) { + c -= toLower; + } else if (!upper && A <= c && c <= Z) { + c += toLower; + } + buf[i] = c; + upper = c == dash; + } + return String.fromCharCode(...buf); + } + exports.canonicalMIMEHeaderKey = canonicalMIMEHeaderKey; + function headers() { + return new MsgHdrsImpl(); + } + exports.headers = headers; + var HEADER = "NATS/1.0"; + var Match; + (function(Match2) { + Match2[Match2["Exact"] = 0] = "Exact"; + Match2[Match2["CanonicalMIME"] = 1] = "CanonicalMIME"; + Match2[Match2["IgnoreCase"] = 2] = "IgnoreCase"; + })(Match = exports.Match || (exports.Match = {})); + var MsgHdrsImpl = class { + constructor() { + this.code = 0; + this.headers = /* @__PURE__ */ new Map(); + this.description = ""; + } + [Symbol.iterator]() { + return this.headers.entries(); + } + size() { + return this.headers.size; + } + equals(mh) { + if (mh && this.headers.size === mh.headers.size && this.code === mh.code) { + for (const [k, v] of this.headers) { + const a = mh.values(k); + if (v.length !== a.length) { + return false; + } + const vv = [...v].sort(); + const aa = [...a].sort(); + for (let i = 0; i < vv.length; i++) { + if (vv[i] !== aa[i]) { + return false; + } + } + } + return true; + } + return false; + } + static decode(a) { + const mh = new MsgHdrsImpl(); + const s = encoders_1.TD.decode(a); + const lines = s.split("\r\n"); + const h = lines[0]; + if (h !== HEADER) { + let str = h.replace(HEADER, ""); + mh.code = parseInt(str, 10); + const scode = mh.code.toString(); + str = str.replace(scode, ""); + mh.description = str.trim(); + } + if (lines.length >= 1) { + lines.slice(1).map((s2) => { + if (s2) { + const idx = s2.indexOf(":"); + if (idx > -1) { + const k = s2.slice(0, idx); + const v = s2.slice(idx + 1).trim(); + mh.append(k, v); + } + } + }); + } + return mh; + } + toString() { + if (this.headers.size === 0) { + return ""; + } + let s = HEADER; + for (const [k, v] of this.headers) { + for (let i = 0; i < v.length; i++) { + s = `${s}\r +${k}: ${v[i]}`; + } + } + return `${s}\r +\r +`; + } + encode() { + return encoders_1.TE.encode(this.toString()); + } + static validHeaderValue(k) { + const inv = /[\r\n]/; + if (inv.test(k)) { + throw new error_1.NatsError("invalid header value - \\r and \\n are not allowed.", error_1.ErrorCode.BadHeader); + } + return k.trim(); + } + keys() { + const keys = []; + for (const sk of this.headers.keys()) { + keys.push(sk); + } + return keys; + } + findKeys(k, match = Match.Exact) { + const keys = this.keys(); + switch (match) { + case Match.Exact: + return keys.filter((v) => { + return v === k; + }); + case Match.CanonicalMIME: + k = canonicalMIMEHeaderKey(k); + return keys.filter((v) => { + return v === k; + }); + default: { + const lci = k.toLowerCase(); + return keys.filter((v) => { + return lci === v.toLowerCase(); + }); + } + } + } + get(k, match = Match.Exact) { + const keys = this.findKeys(k, match); + if (keys.length) { + const v = this.headers.get(keys[0]); + if (v) { + return Array.isArray(v) ? v[0] : v; + } + } + return ""; + } + has(k, match = Match.Exact) { + return this.findKeys(k, match).length > 0; + } + set(k, v, match = Match.Exact) { + this.delete(k, match); + this.append(k, v, match); + } + append(k, v, match = Match.Exact) { + const ck = canonicalMIMEHeaderKey(k); + if (match === Match.CanonicalMIME) { + k = ck; + } + const keys = this.findKeys(k, match); + k = keys.length > 0 ? keys[0] : k; + const value = MsgHdrsImpl.validHeaderValue(v); + let a = this.headers.get(k); + if (!a) { + a = []; + this.headers.set(k, a); + } + a.push(value); + } + values(k, match = Match.Exact) { + const buf = []; + const keys = this.findKeys(k, match); + keys.forEach((v) => { + const values = this.headers.get(v); + if (values) { + buf.push(...values); + } + }); + return buf; + } + delete(k, match = Match.Exact) { + const keys = this.findKeys(k, match); + keys.forEach((v) => { + this.headers.delete(v); + }); + } + get hasError() { + return this.code >= 300; + } + get status() { + return `${this.code} ${this.description}`.trim(); + } + }; + exports.MsgHdrsImpl = MsgHdrsImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/msg.js + var require_msg = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/msg.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MsgImpl = exports.isRequestError = void 0; + var types_1 = require_types(); + var headers_1 = require_headers(); + var encoders_1 = require_encoders(); + var error_1 = require_error(); + function isRequestError(msg) { + if (msg && msg.headers) { + const headers = msg.headers; + if (headers.hasError) { + if (headers.code === 503) { + return error_1.NatsError.errorForCode(error_1.ErrorCode.NoResponders); + } else { + let desc = headers.description; + if (desc === "") { + desc = error_1.ErrorCode.RequestError; + } + desc = desc.toLowerCase(); + return new error_1.NatsError(desc, headers.status); + } + } + } + return null; + } + exports.isRequestError = isRequestError; + var MsgImpl = class { + constructor(msg, data, publisher) { + this._msg = msg; + this._rdata = data; + this.publisher = publisher; + } + get subject() { + if (this._subject) { + return this._subject; + } + this._subject = encoders_1.TD.decode(this._msg.subject); + return this._subject; + } + get reply() { + if (this._reply) { + return this._reply; + } + this._reply = encoders_1.TD.decode(this._msg.reply); + return this._reply; + } + get sid() { + return this._msg.sid; + } + get headers() { + if (this._msg.hdr > -1 && !this._headers) { + const buf = this._rdata.subarray(0, this._msg.hdr); + this._headers = headers_1.MsgHdrsImpl.decode(buf); + } + return this._headers; + } + get data() { + if (!this._rdata) { + return new Uint8Array(0); + } + return this._msg.hdr > -1 ? this._rdata.subarray(this._msg.hdr) : this._rdata; + } + respond(data = types_1.Empty, opts) { + if (this.reply) { + this.publisher.publish(this.reply, data, opts); + return true; + } + return false; + } + }; + exports.MsgImpl = MsgImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/muxsubscription.js + var require_muxsubscription = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/muxsubscription.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.MuxSubscription = void 0; + var error_1 = require_error(); + var protocol_1 = require_protocol(); + var msg_1 = require_msg(); + var MuxSubscription = class { + constructor() { + this.reqs = /* @__PURE__ */ new Map(); + } + size() { + return this.reqs.size; + } + init(prefix) { + this.baseInbox = `${protocol_1.createInbox(prefix)}.`; + return this.baseInbox; + } + add(r) { + if (!isNaN(r.received)) { + r.received = 0; + } + this.reqs.set(r.token, r); + } + get(token) { + return this.reqs.get(token); + } + cancel(r) { + this.reqs.delete(r.token); + } + getToken(m) { + const s = m.subject || ""; + if (s.indexOf(this.baseInbox) === 0) { + return s.substring(this.baseInbox.length); + } + return null; + } + dispatcher() { + return (err, m) => { + const token = this.getToken(m); + if (token) { + const r = this.get(token); + if (r) { + if (err === null && m.headers) { + err = msg_1.isRequestError(m); + } + r.resolver(err, m); + } + } + }; + } + close() { + const err = error_1.NatsError.errorForCode(error_1.ErrorCode.Timeout); + this.reqs.forEach((req) => { + req.resolver(err, {}); + }); + } + }; + exports.MuxSubscription = MuxSubscription; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/heartbeats.js + var require_heartbeats = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/heartbeats.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Heartbeat = void 0; + var util_1 = require_util(); + var types_1 = require_types(); + var Heartbeat = class { + constructor(ph, interval, maxOut) { + this.ph = ph; + this.interval = interval; + this.maxOut = maxOut; + this.pendings = []; + } + start() { + this.cancel(); + this._schedule(); + } + cancel(stale) { + if (this.timer) { + clearTimeout(this.timer); + this.timer = void 0; + } + this._reset(); + if (stale) { + this.ph.disconnect(); + } + } + _schedule() { + this.timer = setTimeout(() => { + this.ph.dispatchStatus({ type: types_1.DebugEvents.PingTimer, data: `${this.pendings.length + 1}` }); + if (this.pendings.length === this.maxOut) { + this.cancel(true); + return; + } + const ping = util_1.deferred(); + this.ph.flush(ping).then(() => { + this._reset(); + }).catch(() => { + this.cancel(); + }); + this.pendings.push(ping); + this._schedule(); + }, this.interval); + } + _reset() { + this.pendings = this.pendings.filter((p) => { + const d = p; + d.resolve(); + return false; + }); + } + }; + exports.Heartbeat = Heartbeat; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/denobuffer.js + var require_denobuffer = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/denobuffer.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.writeAll = exports.readAll = exports.DenoBuffer = exports.append = exports.concat = exports.MAX_SIZE = exports.assert = exports.AssertionError = void 0; + var encoders_1 = require_encoders(); + var AssertionError = class extends Error { + constructor(msg) { + super(msg); + this.name = "AssertionError"; + } + }; + exports.AssertionError = AssertionError; + function assert(cond, msg = "Assertion failed.") { + if (!cond) { + throw new AssertionError(msg); + } + } + exports.assert = assert; + var MIN_READ = 32 * 1024; + exports.MAX_SIZE = Math.pow(2, 32) - 2; + function copy(src, dst, off = 0) { + const r = dst.byteLength - off; + if (src.byteLength > r) { + src = src.subarray(0, r); + } + dst.set(src, off); + return src.byteLength; + } + function concat(origin, b) { + if (origin === void 0 && b === void 0) { + return new Uint8Array(0); + } + if (origin === void 0) { + return b; + } + if (b === void 0) { + return origin; + } + const output = new Uint8Array(origin.length + b.length); + output.set(origin, 0); + output.set(b, origin.length); + return output; + } + exports.concat = concat; + function append(origin, b) { + return concat(origin, Uint8Array.of(b)); + } + exports.append = append; + var DenoBuffer = class { + constructor(ab) { + this._off = 0; + if (ab == null) { + this._buf = new Uint8Array(0); + return; + } + this._buf = new Uint8Array(ab); + } + bytes(options = { copy: true }) { + if (options.copy === false) + return this._buf.subarray(this._off); + return this._buf.slice(this._off); + } + empty() { + return this._buf.byteLength <= this._off; + } + get length() { + return this._buf.byteLength - this._off; + } + get capacity() { + return this._buf.buffer.byteLength; + } + truncate(n) { + if (n === 0) { + this.reset(); + return; + } + if (n < 0 || n > this.length) { + throw Error("bytes.Buffer: truncation out of range"); + } + this._reslice(this._off + n); + } + reset() { + this._reslice(0); + this._off = 0; + } + _tryGrowByReslice(n) { + const l = this._buf.byteLength; + if (n <= this.capacity - l) { + this._reslice(l + n); + return l; + } + return -1; + } + _reslice(len) { + assert(len <= this._buf.buffer.byteLength); + this._buf = new Uint8Array(this._buf.buffer, 0, len); + } + readByte() { + const a = new Uint8Array(1); + if (this.read(a)) { + return a[0]; + } + return null; + } + read(p) { + if (this.empty()) { + this.reset(); + if (p.byteLength === 0) { + return 0; + } + return null; + } + const nread = copy(this._buf.subarray(this._off), p); + this._off += nread; + return nread; + } + writeByte(n) { + return this.write(Uint8Array.of(n)); + } + writeString(s) { + return this.write(encoders_1.TE.encode(s)); + } + write(p) { + const m = this._grow(p.byteLength); + return copy(p, this._buf, m); + } + _grow(n) { + const m = this.length; + if (m === 0 && this._off !== 0) { + this.reset(); + } + const i = this._tryGrowByReslice(n); + if (i >= 0) { + return i; + } + const c = this.capacity; + if (n <= Math.floor(c / 2) - m) { + copy(this._buf.subarray(this._off), this._buf); + } else if (c + n > exports.MAX_SIZE) { + throw new Error("The buffer cannot be grown beyond the maximum size."); + } else { + const buf = new Uint8Array(Math.min(2 * c + n, exports.MAX_SIZE)); + copy(this._buf.subarray(this._off), buf); + this._buf = buf; + } + this._off = 0; + this._reslice(Math.min(m + n, exports.MAX_SIZE)); + return m; + } + grow(n) { + if (n < 0) { + throw Error("Buffer._grow: negative count"); + } + const m = this._grow(n); + this._reslice(m); + } + readFrom(r) { + let n = 0; + const tmp = new Uint8Array(MIN_READ); + while (true) { + const shouldGrow = this.capacity - this.length < MIN_READ; + const buf = shouldGrow ? tmp : new Uint8Array(this._buf.buffer, this.length); + const nread = r.read(buf); + if (nread === null) { + return n; + } + if (shouldGrow) + this.write(buf.subarray(0, nread)); + else + this._reslice(this.length + nread); + n += nread; + } + } + }; + exports.DenoBuffer = DenoBuffer; + function readAll(r) { + const buf = new DenoBuffer(); + buf.readFrom(r); + return buf.bytes(); + } + exports.readAll = readAll; + function writeAll(w, arr) { + let nwritten = 0; + while (nwritten < arr.length) { + nwritten += w.write(arr.subarray(nwritten)); + } + } + exports.writeAll = writeAll; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/parser.js + var require_parser = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/parser.js"(exports, module) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.State = exports.Parser = exports.describe = exports.Kind = void 0; + var denobuffer_1 = require_denobuffer(); + var encoders_1 = require_encoders(); + var Kind; + (function(Kind2) { + Kind2[Kind2["OK"] = 0] = "OK"; + Kind2[Kind2["ERR"] = 1] = "ERR"; + Kind2[Kind2["MSG"] = 2] = "MSG"; + Kind2[Kind2["INFO"] = 3] = "INFO"; + Kind2[Kind2["PING"] = 4] = "PING"; + Kind2[Kind2["PONG"] = 5] = "PONG"; + })(Kind = exports.Kind || (exports.Kind = {})); + function describe(e) { + let ks; + let data = ""; + switch (e.kind) { + case Kind.MSG: + ks = "MSG"; + break; + case Kind.OK: + ks = "OK"; + break; + case Kind.ERR: + ks = "ERR"; + data = encoders_1.TD.decode(e.data); + break; + case Kind.PING: + ks = "PING"; + break; + case Kind.PONG: + ks = "PONG"; + break; + case Kind.INFO: + ks = "INFO"; + data = encoders_1.TD.decode(e.data); + } + return `${ks}: ${data}`; + } + exports.describe = describe; + function newMsgArg() { + const ma = {}; + ma.sid = -1; + ma.hdr = -1; + ma.size = -1; + return ma; + } + var ASCII_0 = 48; + var ASCII_9 = 57; + var Parser = class { + constructor(dispatcher) { + this.dispatcher = dispatcher; + this.state = State.OP_START; + this.as = 0; + this.drop = 0; + this.hdr = 0; + } + parse(buf) { + if (typeof module !== "undefined" && module.exports) { + buf.subarray = buf.slice; + } + let i; + for (i = 0; i < buf.length; i++) { + const b = buf[i]; + switch (this.state) { + case State.OP_START: + switch (b) { + case cc.M: + case cc.m: + this.state = State.OP_M; + this.hdr = -1; + this.ma = newMsgArg(); + break; + case cc.H: + case cc.h: + this.state = State.OP_H; + this.hdr = 0; + this.ma = newMsgArg(); + break; + case cc.P: + case cc.p: + this.state = State.OP_P; + break; + case cc.PLUS: + this.state = State.OP_PLUS; + break; + case cc.MINUS: + this.state = State.OP_MINUS; + break; + case cc.I: + case cc.i: + this.state = State.OP_I; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_H: + switch (b) { + case cc.M: + case cc.m: + this.state = State.OP_M; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_M: + switch (b) { + case cc.S: + case cc.s: + this.state = State.OP_MS; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MS: + switch (b) { + case cc.G: + case cc.g: + this.state = State.OP_MSG; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MSG: + switch (b) { + case cc.SPACE: + case cc.TAB: + this.state = State.OP_MSG_SPC; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MSG_SPC: + switch (b) { + case cc.SPACE: + case cc.TAB: + continue; + default: + this.state = State.MSG_ARG; + this.as = i; + } + break; + case State.MSG_ARG: + switch (b) { + case cc.CR: + this.drop = 1; + break; + case cc.NL: { + const arg = this.argBuf ? this.argBuf.bytes() : buf.subarray(this.as, i - this.drop); + this.processMsgArgs(arg); + this.drop = 0; + this.as = i + 1; + this.state = State.MSG_PAYLOAD; + i = this.as + this.ma.size - 1; + break; + } + default: + if (this.argBuf) { + this.argBuf.writeByte(b); + } + } + break; + case State.MSG_PAYLOAD: + if (this.msgBuf) { + if (this.msgBuf.length >= this.ma.size) { + const data = this.msgBuf.bytes({ copy: false }); + this.dispatcher.push({ kind: Kind.MSG, msg: this.ma, data }); + this.argBuf = void 0; + this.msgBuf = void 0; + this.state = State.MSG_END; + } else { + let toCopy = this.ma.size - this.msgBuf.length; + const avail = buf.length - i; + if (avail < toCopy) { + toCopy = avail; + } + if (toCopy > 0) { + this.msgBuf.write(buf.subarray(i, i + toCopy)); + i = i + toCopy - 1; + } else { + this.msgBuf.writeByte(b); + } + } + } else if (i - this.as >= this.ma.size) { + this.dispatcher.push({ kind: Kind.MSG, msg: this.ma, data: buf.subarray(this.as, i) }); + this.argBuf = void 0; + this.msgBuf = void 0; + this.state = State.MSG_END; + } + break; + case State.MSG_END: + switch (b) { + case cc.NL: + this.drop = 0; + this.as = i + 1; + this.state = State.OP_START; + break; + default: + continue; + } + break; + case State.OP_PLUS: + switch (b) { + case cc.O: + case cc.o: + this.state = State.OP_PLUS_O; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PLUS_O: + switch (b) { + case cc.K: + case cc.k: + this.state = State.OP_PLUS_OK; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PLUS_OK: + switch (b) { + case cc.NL: + this.dispatcher.push({ kind: Kind.OK }); + this.drop = 0; + this.state = State.OP_START; + break; + } + break; + case State.OP_MINUS: + switch (b) { + case cc.E: + case cc.e: + this.state = State.OP_MINUS_E; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MINUS_E: + switch (b) { + case cc.R: + case cc.r: + this.state = State.OP_MINUS_ER; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MINUS_ER: + switch (b) { + case cc.R: + case cc.r: + this.state = State.OP_MINUS_ERR; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MINUS_ERR: + switch (b) { + case cc.SPACE: + case cc.TAB: + this.state = State.OP_MINUS_ERR_SPC; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_MINUS_ERR_SPC: + switch (b) { + case cc.SPACE: + case cc.TAB: + continue; + default: + this.state = State.MINUS_ERR_ARG; + this.as = i; + } + break; + case State.MINUS_ERR_ARG: + switch (b) { + case cc.CR: + this.drop = 1; + break; + case cc.NL: { + let arg; + if (this.argBuf) { + arg = this.argBuf.bytes(); + this.argBuf = void 0; + } else { + arg = buf.subarray(this.as, i - this.drop); + } + this.dispatcher.push({ kind: Kind.ERR, data: arg }); + this.drop = 0; + this.as = i + 1; + this.state = State.OP_START; + break; + } + default: + if (this.argBuf) { + this.argBuf.write(Uint8Array.of(b)); + } + } + break; + case State.OP_P: + switch (b) { + case cc.I: + case cc.i: + this.state = State.OP_PI; + break; + case cc.O: + case cc.o: + this.state = State.OP_PO; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PO: + switch (b) { + case cc.N: + case cc.n: + this.state = State.OP_PON; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PON: + switch (b) { + case cc.G: + case cc.g: + this.state = State.OP_PONG; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PONG: + switch (b) { + case cc.NL: + this.dispatcher.push({ kind: Kind.PONG }); + this.drop = 0; + this.state = State.OP_START; + break; + } + break; + case State.OP_PI: + switch (b) { + case cc.N: + case cc.n: + this.state = State.OP_PIN; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PIN: + switch (b) { + case cc.G: + case cc.g: + this.state = State.OP_PING; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_PING: + switch (b) { + case cc.NL: + this.dispatcher.push({ kind: Kind.PING }); + this.drop = 0; + this.state = State.OP_START; + break; + } + break; + case State.OP_I: + switch (b) { + case cc.N: + case cc.n: + this.state = State.OP_IN; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_IN: + switch (b) { + case cc.F: + case cc.f: + this.state = State.OP_INF; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_INF: + switch (b) { + case cc.O: + case cc.o: + this.state = State.OP_INFO; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_INFO: + switch (b) { + case cc.SPACE: + case cc.TAB: + this.state = State.OP_INFO_SPC; + break; + default: + throw this.fail(buf.subarray(i)); + } + break; + case State.OP_INFO_SPC: + switch (b) { + case cc.SPACE: + case cc.TAB: + continue; + default: + this.state = State.INFO_ARG; + this.as = i; + } + break; + case State.INFO_ARG: + switch (b) { + case cc.CR: + this.drop = 1; + break; + case cc.NL: { + let arg; + if (this.argBuf) { + arg = this.argBuf.bytes(); + this.argBuf = void 0; + } else { + arg = buf.subarray(this.as, i - this.drop); + } + this.dispatcher.push({ kind: Kind.INFO, data: arg }); + this.drop = 0; + this.as = i + 1; + this.state = State.OP_START; + break; + } + default: + if (this.argBuf) { + this.argBuf.writeByte(b); + } + } + break; + default: + throw this.fail(buf.subarray(i)); + } + } + if ((this.state === State.MSG_ARG || this.state === State.MINUS_ERR_ARG || this.state === State.INFO_ARG) && !this.argBuf) { + this.argBuf = new denobuffer_1.DenoBuffer(buf.subarray(this.as, i - this.drop)); + } + if (this.state === State.MSG_PAYLOAD && !this.msgBuf) { + if (!this.argBuf) { + this.cloneMsgArg(); + } + this.msgBuf = new denobuffer_1.DenoBuffer(buf.subarray(this.as)); + } + } + cloneMsgArg() { + const s = this.ma.subject.length; + const r = this.ma.reply ? this.ma.reply.length : 0; + const buf = new Uint8Array(s + r); + buf.set(this.ma.subject); + if (this.ma.reply) { + buf.set(this.ma.reply, s); + } + this.argBuf = new denobuffer_1.DenoBuffer(buf); + this.ma.subject = buf.subarray(0, s); + if (this.ma.reply) { + this.ma.reply = buf.subarray(s); + } + } + processMsgArgs(arg) { + if (this.hdr >= 0) { + return this.processHeaderMsgArgs(arg); + } + const args = []; + let start = -1; + for (let i = 0; i < arg.length; i++) { + const b = arg[i]; + switch (b) { + case cc.SPACE: + case cc.TAB: + case cc.CR: + case cc.NL: + if (start >= 0) { + args.push(arg.subarray(start, i)); + start = -1; + } + break; + default: + if (start < 0) { + start = i; + } + } + } + if (start >= 0) { + args.push(arg.subarray(start)); + } + switch (args.length) { + case 3: + this.ma.subject = args[0]; + this.ma.sid = this.protoParseInt(args[1]); + this.ma.reply = void 0; + this.ma.size = this.protoParseInt(args[2]); + break; + case 4: + this.ma.subject = args[0]; + this.ma.sid = this.protoParseInt(args[1]); + this.ma.reply = args[2]; + this.ma.size = this.protoParseInt(args[3]); + break; + default: + throw this.fail(arg, "processMsgArgs Parse Error"); + } + if (this.ma.sid < 0) { + throw this.fail(arg, "processMsgArgs Bad or Missing Sid Error"); + } + if (this.ma.size < 0) { + throw this.fail(arg, "processMsgArgs Bad or Missing Size Error"); + } + } + fail(data, label = "") { + if (!label) { + label = `parse error [${this.state}]`; + } else { + label = `${label} [${this.state}]`; + } + return new Error(`${label}: ${encoders_1.TD.decode(data)}`); + } + processHeaderMsgArgs(arg) { + const args = []; + let start = -1; + for (let i = 0; i < arg.length; i++) { + const b = arg[i]; + switch (b) { + case cc.SPACE: + case cc.TAB: + case cc.CR: + case cc.NL: + if (start >= 0) { + args.push(arg.subarray(start, i)); + start = -1; + } + break; + default: + if (start < 0) { + start = i; + } + } + } + if (start >= 0) { + args.push(arg.subarray(start)); + } + switch (args.length) { + case 4: + this.ma.subject = args[0]; + this.ma.sid = this.protoParseInt(args[1]); + this.ma.reply = void 0; + this.ma.hdr = this.protoParseInt(args[2]); + this.ma.size = this.protoParseInt(args[3]); + break; + case 5: + this.ma.subject = args[0]; + this.ma.sid = this.protoParseInt(args[1]); + this.ma.reply = args[2]; + this.ma.hdr = this.protoParseInt(args[3]); + this.ma.size = this.protoParseInt(args[4]); + break; + default: + throw this.fail(arg, "processHeaderMsgArgs Parse Error"); + } + if (this.ma.sid < 0) { + throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Sid Error"); + } + if (this.ma.hdr < 0 || this.ma.hdr > this.ma.size) { + throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Header Size Error"); + } + if (this.ma.size < 0) { + throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Size Error"); + } + } + protoParseInt(a) { + if (a.length === 0) { + return -1; + } + let n = 0; + for (let i = 0; i < a.length; i++) { + if (a[i] < ASCII_0 || a[i] > ASCII_9) { + return -1; + } + n = n * 10 + (a[i] - ASCII_0); + } + return n; + } + }; + exports.Parser = Parser; + var State; + (function(State2) { + State2[State2["OP_START"] = 0] = "OP_START"; + State2[State2["OP_PLUS"] = 1] = "OP_PLUS"; + State2[State2["OP_PLUS_O"] = 2] = "OP_PLUS_O"; + State2[State2["OP_PLUS_OK"] = 3] = "OP_PLUS_OK"; + State2[State2["OP_MINUS"] = 4] = "OP_MINUS"; + State2[State2["OP_MINUS_E"] = 5] = "OP_MINUS_E"; + State2[State2["OP_MINUS_ER"] = 6] = "OP_MINUS_ER"; + State2[State2["OP_MINUS_ERR"] = 7] = "OP_MINUS_ERR"; + State2[State2["OP_MINUS_ERR_SPC"] = 8] = "OP_MINUS_ERR_SPC"; + State2[State2["MINUS_ERR_ARG"] = 9] = "MINUS_ERR_ARG"; + State2[State2["OP_M"] = 10] = "OP_M"; + State2[State2["OP_MS"] = 11] = "OP_MS"; + State2[State2["OP_MSG"] = 12] = "OP_MSG"; + State2[State2["OP_MSG_SPC"] = 13] = "OP_MSG_SPC"; + State2[State2["MSG_ARG"] = 14] = "MSG_ARG"; + State2[State2["MSG_PAYLOAD"] = 15] = "MSG_PAYLOAD"; + State2[State2["MSG_END"] = 16] = "MSG_END"; + State2[State2["OP_H"] = 17] = "OP_H"; + State2[State2["OP_P"] = 18] = "OP_P"; + State2[State2["OP_PI"] = 19] = "OP_PI"; + State2[State2["OP_PIN"] = 20] = "OP_PIN"; + State2[State2["OP_PING"] = 21] = "OP_PING"; + State2[State2["OP_PO"] = 22] = "OP_PO"; + State2[State2["OP_PON"] = 23] = "OP_PON"; + State2[State2["OP_PONG"] = 24] = "OP_PONG"; + State2[State2["OP_I"] = 25] = "OP_I"; + State2[State2["OP_IN"] = 26] = "OP_IN"; + State2[State2["OP_INF"] = 27] = "OP_INF"; + State2[State2["OP_INFO"] = 28] = "OP_INFO"; + State2[State2["OP_INFO_SPC"] = 29] = "OP_INFO_SPC"; + State2[State2["INFO_ARG"] = 30] = "INFO_ARG"; + })(State = exports.State || (exports.State = {})); + var cc; + (function(cc2) { + cc2[cc2["CR"] = "\r".charCodeAt(0)] = "CR"; + cc2[cc2["E"] = "E".charCodeAt(0)] = "E"; + cc2[cc2["e"] = "e".charCodeAt(0)] = "e"; + cc2[cc2["F"] = "F".charCodeAt(0)] = "F"; + cc2[cc2["f"] = "f".charCodeAt(0)] = "f"; + cc2[cc2["G"] = "G".charCodeAt(0)] = "G"; + cc2[cc2["g"] = "g".charCodeAt(0)] = "g"; + cc2[cc2["H"] = "H".charCodeAt(0)] = "H"; + cc2[cc2["h"] = "h".charCodeAt(0)] = "h"; + cc2[cc2["I"] = "I".charCodeAt(0)] = "I"; + cc2[cc2["i"] = "i".charCodeAt(0)] = "i"; + cc2[cc2["K"] = "K".charCodeAt(0)] = "K"; + cc2[cc2["k"] = "k".charCodeAt(0)] = "k"; + cc2[cc2["M"] = "M".charCodeAt(0)] = "M"; + cc2[cc2["m"] = "m".charCodeAt(0)] = "m"; + cc2[cc2["MINUS"] = "-".charCodeAt(0)] = "MINUS"; + cc2[cc2["N"] = "N".charCodeAt(0)] = "N"; + cc2[cc2["n"] = "n".charCodeAt(0)] = "n"; + cc2[cc2["NL"] = "\n".charCodeAt(0)] = "NL"; + cc2[cc2["O"] = "O".charCodeAt(0)] = "O"; + cc2[cc2["o"] = "o".charCodeAt(0)] = "o"; + cc2[cc2["P"] = "P".charCodeAt(0)] = "P"; + cc2[cc2["p"] = "p".charCodeAt(0)] = "p"; + cc2[cc2["PLUS"] = "+".charCodeAt(0)] = "PLUS"; + cc2[cc2["R"] = "R".charCodeAt(0)] = "R"; + cc2[cc2["r"] = "r".charCodeAt(0)] = "r"; + cc2[cc2["S"] = "S".charCodeAt(0)] = "S"; + cc2[cc2["s"] = "s".charCodeAt(0)] = "s"; + cc2[cc2["SPACE"] = " ".charCodeAt(0)] = "SPACE"; + cc2[cc2["TAB"] = " ".charCodeAt(0)] = "TAB"; + })(cc || (cc = {})); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/protocol.js + var require_protocol = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/protocol.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __asyncValues = exports && exports.__asyncValues || function(o) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ProtocolHandler = exports.Connect = exports.createInbox = exports.INFO = void 0; + var types_1 = require_types(); + var transport_1 = require_transport(); + var error_1 = require_error(); + var util_1 = require_util(); + var nuid_1 = require_nuid(); + var databuffer_1 = require_databuffer(); + var servers_1 = require_servers(); + var queued_iterator_1 = require_queued_iterator(); + var subscription_1 = require_subscription(); + var subscriptions_1 = require_subscriptions(); + var muxsubscription_1 = require_muxsubscription(); + var heartbeats_1 = require_heartbeats(); + var parser_1 = require_parser(); + var msg_1 = require_msg(); + var encoders_1 = require_encoders(); + var FLUSH_THRESHOLD = 1024 * 32; + exports.INFO = /^INFO\s+([^\r\n]+)\r\n/i; + function createInbox(prefix = "") { + prefix = prefix || "_INBOX"; + if (typeof prefix !== "string") { + throw new Error("prefix must be a string"); + } + return `${prefix}.${nuid_1.nuid.next()}`; + } + exports.createInbox = createInbox; + var PONG_CMD = encoders_1.fastEncoder("PONG\r\n"); + var PING_CMD = encoders_1.fastEncoder("PING\r\n"); + var Connect = class { + constructor(transport, opts, nonce) { + this.protocol = 1; + this.version = transport.version; + this.lang = transport.lang; + this.echo = opts.noEcho ? false : void 0; + this.verbose = opts.verbose; + this.pedantic = opts.pedantic; + this.tls_required = opts.tls ? true : void 0; + this.name = opts.name; + const creds = (opts && opts.authenticator ? opts.authenticator(nonce) : {}) || {}; + util_1.extend(this, creds); + } + }; + exports.Connect = Connect; + var ProtocolHandler = class { + constructor(options, publisher) { + this._closed = false; + this.connected = false; + this.connectedOnce = false; + this.infoReceived = false; + this.noMorePublishing = false; + this.abortReconnect = false; + this.listeners = []; + this.pendingLimit = FLUSH_THRESHOLD; + this.outMsgs = 0; + this.inMsgs = 0; + this.outBytes = 0; + this.inBytes = 0; + this.options = options; + this.publisher = publisher; + this.subscriptions = new subscriptions_1.Subscriptions(); + this.muxSubscriptions = new muxsubscription_1.MuxSubscription(); + this.outbound = new databuffer_1.DataBuffer(); + this.pongs = []; + this.pendingLimit = options.pendingLimit || this.pendingLimit; + this.servers = new servers_1.Servers( + !options.noRandomize, + options.servers + ); + this.closed = util_1.deferred(); + this.parser = new parser_1.Parser(this); + this.heartbeats = new heartbeats_1.Heartbeat(this, this.options.pingInterval || types_1.DEFAULT_PING_INTERVAL, this.options.maxPingOut || types_1.DEFAULT_MAX_PING_OUT); + } + resetOutbound() { + this.outbound.reset(); + const pongs = this.pongs; + this.pongs = []; + pongs.forEach((p) => { + p.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.Disconnect)); + }); + this.parser = new parser_1.Parser(this); + this.infoReceived = false; + } + dispatchStatus(status) { + this.listeners.forEach((q) => { + q.push(status); + }); + } + status() { + const iter = new queued_iterator_1.QueuedIteratorImpl(); + this.listeners.push(iter); + return iter; + } + prepare() { + this.info = void 0; + this.resetOutbound(); + const pong = util_1.deferred(); + this.pongs.unshift(pong); + this.connectError = (err) => { + pong.reject(err); + }; + this.transport = transport_1.newTransport(); + this.transport.closed().then((_err) => __awaiter(this, void 0, void 0, function* () { + this.connected = false; + if (!this.isClosed()) { + yield this.disconnected(this.transport.closeError); + return; + } + })); + return pong; + } + disconnect() { + this.dispatchStatus({ type: types_1.DebugEvents.StaleConnection, data: "" }); + this.transport.disconnect(); + } + disconnected(_err) { + return __awaiter(this, void 0, void 0, function* () { + this.dispatchStatus({ + type: types_1.Events.Disconnect, + data: this.servers.getCurrentServer().toString() + }); + if (this.options.reconnect) { + yield this.dialLoop().then(() => { + this.dispatchStatus({ + type: types_1.Events.Reconnect, + data: this.servers.getCurrentServer().toString() + }); + }).catch((err) => { + this._close(err); + }); + } else { + yield this._close(); + } + }); + } + dial(srv) { + return __awaiter(this, void 0, void 0, function* () { + const pong = this.prepare(); + let timer; + try { + timer = util_1.timeout(this.options.timeout || 2e4); + const cp = this.transport.connect(srv, this.options); + yield Promise.race([cp, timer]); + (() => __awaiter(this, void 0, void 0, function* () { + var e_1, _a; + try { + try { + for (var _b = __asyncValues(this.transport), _c; _c = yield _b.next(), !_c.done; ) { + const b = _c.value; + this.parser.parse(b); + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (_c && !_c.done && (_a = _b.return)) + yield _a.call(_b); + } finally { + if (e_1) + throw e_1.error; + } + } + } catch (err) { + console.log("reader closed", err); + } + }))().then(); + } catch (err) { + pong.reject(err); + } + try { + yield Promise.race([timer, pong]); + if (timer) { + timer.cancel(); + } + this.connected = true; + this.connectError = void 0; + this.sendSubscriptions(); + this.connectedOnce = true; + this.server.didConnect = true; + this.server.reconnects = 0; + this.flushPending(); + this.heartbeats.start(); + } catch (err) { + if (timer) { + timer.cancel(); + } + yield this.transport.close(err); + throw err; + } + }); + } + dialLoop() { + return __awaiter(this, void 0, void 0, function* () { + let lastError; + while (true) { + const wait = this.options.reconnectDelayHandler ? this.options.reconnectDelayHandler() : types_1.DEFAULT_RECONNECT_TIME_WAIT; + let maxWait = wait; + const srv = this.selectServer(); + if (!srv || this.abortReconnect) { + throw lastError || error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionRefused); + } + const now = Date.now(); + if (srv.lastConnect === 0 || srv.lastConnect + wait <= now) { + srv.lastConnect = Date.now(); + try { + this.dispatchStatus({ type: types_1.DebugEvents.Reconnecting, data: srv.toString() }); + yield this.dial(srv); + break; + } catch (err) { + lastError = err; + if (!this.connectedOnce) { + if (this.options.waitOnFirstConnect) { + continue; + } + this.servers.removeCurrentServer(); + } + srv.reconnects++; + const mra = this.options.maxReconnectAttempts || 0; + if (mra !== -1 && srv.reconnects >= mra) { + this.servers.removeCurrentServer(); + } + } + } else { + maxWait = Math.min(maxWait, srv.lastConnect + wait - now); + yield util_1.delay(maxWait); + } + } + }); + } + static connect(options, publisher) { + return __awaiter(this, void 0, void 0, function* () { + const h = new ProtocolHandler(options, publisher); + yield h.dialLoop(); + return h; + }); + } + static toError(s) { + const t = s ? s.toLowerCase() : ""; + if (t.indexOf("permissions violation") !== -1) { + return new error_1.NatsError(s, error_1.ErrorCode.PermissionsViolation); + } else if (t.indexOf("authorization violation") !== -1) { + return new error_1.NatsError(s, error_1.ErrorCode.AuthorizationViolation); + } else if (t.indexOf("user authentication expired") !== -1) { + return new error_1.NatsError(s, error_1.ErrorCode.AuthenticationExpired); + } else { + return new error_1.NatsError(s, error_1.ErrorCode.ProtocolError); + } + } + processMsg(msg, data) { + this.inMsgs++; + this.inBytes += data.length; + if (!this.subscriptions.sidCounter) { + return; + } + const sub = this.subscriptions.get(msg.sid); + if (!sub) { + return; + } + sub.received += 1; + if (sub.callback) { + sub.callback(null, new msg_1.MsgImpl(msg, data, this)); + } + if (sub.max !== void 0 && sub.received >= sub.max) { + sub.unsubscribe(); + } + } + processError(m) { + return __awaiter(this, void 0, void 0, function* () { + const s = encoders_1.fastDecoder(m); + const err = ProtocolHandler.toError(s); + const handled = this.subscriptions.handleError(err); + if (!handled) { + this.dispatchStatus({ type: types_1.Events.Error, data: err.code }); + } + yield this.handleError(err); + }); + } + handleError(err) { + return __awaiter(this, void 0, void 0, function* () { + if (err.isAuthError()) { + this.handleAuthError(err); + } + if (err.isPermissionError() || err.isProtocolError()) { + yield this._close(err); + } + this.lastError = err; + }); + } + handleAuthError(err) { + if (this.lastError && err.code === this.lastError.code) { + this.abortReconnect = true; + } + if (this.connectError) { + this.connectError(err); + } else { + this.disconnect(); + } + } + processPing() { + this.transport.send(PONG_CMD); + } + processPong() { + const cb = this.pongs.shift(); + if (cb) { + cb.resolve(); + } + } + processInfo(m) { + const info = JSON.parse(encoders_1.fastDecoder(m)); + this.info = info; + const updates = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(info); + if (!this.infoReceived) { + this.infoReceived = true; + if (this.transport.isEncrypted()) { + this.servers.updateTLSName(); + } + const { version, lang } = this.transport; + try { + const c = new Connect({ version, lang }, this.options, info.nonce); + if (info.headers) { + c.headers = true; + c.no_responders = true; + } + const cs = JSON.stringify(c); + this.transport.send(encoders_1.fastEncoder(`CONNECT ${cs}${util_1.CR_LF}`)); + this.transport.send(PING_CMD); + } catch (err) { + this._close(error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication, err)); + } + } + if (updates) { + this.dispatchStatus({ type: types_1.Events.Update, data: updates }); + } + const ldm = info.ldm !== void 0 ? info.ldm : false; + if (ldm) { + this.dispatchStatus({ + type: types_1.Events.LDM, + data: this.servers.getCurrentServer().toString() + }); + } + } + push(e) { + switch (e.kind) { + case parser_1.Kind.MSG: { + const { msg, data } = e; + this.processMsg(msg, data); + break; + } + case parser_1.Kind.OK: + break; + case parser_1.Kind.ERR: + this.processError(e.data); + break; + case parser_1.Kind.PING: + this.processPing(); + break; + case parser_1.Kind.PONG: + this.processPong(); + break; + case parser_1.Kind.INFO: + this.processInfo(e.data); + break; + } + } + sendCommand(cmd, ...payloads) { + const len = this.outbound.length(); + let buf; + if (typeof cmd === "string") { + buf = encoders_1.fastEncoder(cmd); + } else { + buf = cmd; + } + this.outbound.fill(buf, ...payloads); + if (len === 0) { + setTimeout(() => { + this.flushPending(); + }); + } else if (this.outbound.size() >= this.pendingLimit) { + this.flushPending(); + } + } + publish(subject, data, options) { + if (this.isClosed()) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); + } + if (this.noMorePublishing) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining); + } + let len = data.length; + options = options || {}; + options.reply = options.reply || ""; + let headers = types_1.Empty; + let hlen = 0; + if (options.headers) { + if (this.info && !this.info.headers) { + throw new error_1.NatsError("headers", error_1.ErrorCode.ServerOptionNotAvailable); + } + const hdrs = options.headers; + headers = hdrs.encode(); + hlen = headers.length; + len = data.length + hlen; + } + if (this.info && len > this.info.max_payload) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.MaxPayloadExceeded); + } + this.outBytes += len; + this.outMsgs++; + let proto; + if (options.headers) { + if (options.reply) { + proto = `HPUB ${subject} ${options.reply} ${hlen} ${len}${util_1.CR_LF}`; + } else { + proto = `HPUB ${subject} ${hlen} ${len}\r +`; + } + this.sendCommand(proto, headers, data, util_1.CRLF); + } else { + if (options.reply) { + proto = `PUB ${subject} ${options.reply} ${len}\r +`; + } else { + proto = `PUB ${subject} ${len}\r +`; + } + this.sendCommand(proto, data, util_1.CRLF); + } + } + request(r) { + this.initMux(); + this.muxSubscriptions.add(r); + return r; + } + subscribe(s) { + this.subscriptions.add(s); + if (s.queue) { + this.sendCommand(`SUB ${s.subject} ${s.queue} ${s.sid}\r +`); + } else { + this.sendCommand(`SUB ${s.subject} ${s.sid}\r +`); + } + if (s.max) { + this.unsubscribe(s, s.max); + } + return s; + } + unsubscribe(s, max) { + this.unsub(s, max); + if (s.max === void 0 || s.received >= s.max) { + this.subscriptions.cancel(s); + } + } + unsub(s, max) { + if (!s || this.isClosed()) { + return; + } + if (max) { + this.sendCommand(`UNSUB ${s.sid} ${max}${util_1.CR_LF}`); + } else { + this.sendCommand(`UNSUB ${s.sid}${util_1.CR_LF}`); + } + s.max = max; + } + flush(p) { + if (!p) { + p = util_1.deferred(); + } + this.pongs.push(p); + this.sendCommand(PING_CMD); + return p; + } + sendSubscriptions() { + const cmds = []; + this.subscriptions.all().forEach((s) => { + const sub = s; + if (sub.queue) { + cmds.push(`SUB ${sub.subject} ${sub.queue} ${sub.sid}${util_1.CR_LF}`); + } else { + cmds.push(`SUB ${sub.subject} ${sub.sid}${util_1.CR_LF}`); + } + }); + if (cmds.length) { + this.transport.send(encoders_1.fastEncoder(cmds.join(""))); + } + } + _close(err) { + return __awaiter(this, void 0, void 0, function* () { + if (this._closed) { + return; + } + this.heartbeats.cancel(); + if (this.connectError) { + this.connectError(err); + this.connectError = void 0; + } + this.muxSubscriptions.close(); + this.subscriptions.close(); + this.listeners.forEach((l) => { + l.stop(); + }); + this._closed = true; + yield this.transport.close(err); + yield this.closed.resolve(err); + }); + } + close() { + return this._close(); + } + isClosed() { + return this._closed; + } + drain() { + const subs = this.subscriptions.all(); + const promises = []; + subs.forEach((sub) => { + promises.push(sub.drain()); + }); + return Promise.all(promises).then(() => __awaiter(this, void 0, void 0, function* () { + this.noMorePublishing = true; + yield this.flush(); + return this.close(); + })).catch(() => { + }); + } + flushPending() { + if (!this.infoReceived || !this.connected) { + return; + } + if (this.outbound.size()) { + const d = this.outbound.drain(); + this.transport.send(d); + } + } + initMux() { + const mux = this.subscriptions.getMux(); + if (!mux) { + const inbox = this.muxSubscriptions.init(this.options.inboxPrefix); + const sub = new subscription_1.SubscriptionImpl(this, `${inbox}*`); + sub.callback = this.muxSubscriptions.dispatcher(); + this.subscriptions.setMux(sub); + this.subscribe(sub); + } + } + selectServer() { + const server = this.servers.selectServer(); + if (server === void 0) { + return void 0; + } + this.server = server; + return this.server; + } + getServer() { + return this.server; + } + }; + exports.ProtocolHandler = ProtocolHandler; + } + }); + + // (disabled):crypto + var require_crypto = __commonJS({ + "(disabled):crypto"() { + } + }); + + // ../../node_modules/tweetnacl/nacl-fast.js + var require_nacl_fast = __commonJS({ + "../../node_modules/tweetnacl/nacl-fast.js"(exports, module) { + (function(nacl) { + "use strict"; + var gf = function(init) { + var i, r = new Float64Array(16); + if (init) + for (i = 0; i < init.length; i++) + r[i] = init[i]; + return r; + }; + var randombytes = function() { + throw new Error("no PRNG"); + }; + var _0 = new Uint8Array(16); + var _9 = new Uint8Array(32); + _9[0] = 9; + var gf0 = gf(), gf1 = gf([1]), _121665 = gf([56129, 1]), D = gf([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), D2 = gf([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), X = gf([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), Y = gf([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), I = gf([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); + function ts64(x, i, h, l) { + x[i] = h >> 24 & 255; + x[i + 1] = h >> 16 & 255; + x[i + 2] = h >> 8 & 255; + x[i + 3] = h & 255; + x[i + 4] = l >> 24 & 255; + x[i + 5] = l >> 16 & 255; + x[i + 6] = l >> 8 & 255; + x[i + 7] = l & 255; + } + function vn(x, xi, y, yi, n) { + var i, d = 0; + for (i = 0; i < n; i++) + d |= x[xi + i] ^ y[yi + i]; + return (1 & d - 1 >>> 8) - 1; + } + function crypto_verify_16(x, xi, y, yi) { + return vn(x, xi, y, yi, 16); + } + function crypto_verify_32(x, xi, y, yi) { + return vn(x, xi, y, yi, 32); + } + function core_salsa20(o, p, k, c) { + var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24; + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u; + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u << 7 | u >>> 32 - 7; + u = x4 + x0 | 0; + x8 ^= u << 9 | u >>> 32 - 9; + u = x8 + x4 | 0; + x12 ^= u << 13 | u >>> 32 - 13; + u = x12 + x8 | 0; + x0 ^= u << 18 | u >>> 32 - 18; + u = x5 + x1 | 0; + x9 ^= u << 7 | u >>> 32 - 7; + u = x9 + x5 | 0; + x13 ^= u << 9 | u >>> 32 - 9; + u = x13 + x9 | 0; + x1 ^= u << 13 | u >>> 32 - 13; + u = x1 + x13 | 0; + x5 ^= u << 18 | u >>> 32 - 18; + u = x10 + x6 | 0; + x14 ^= u << 7 | u >>> 32 - 7; + u = x14 + x10 | 0; + x2 ^= u << 9 | u >>> 32 - 9; + u = x2 + x14 | 0; + x6 ^= u << 13 | u >>> 32 - 13; + u = x6 + x2 | 0; + x10 ^= u << 18 | u >>> 32 - 18; + u = x15 + x11 | 0; + x3 ^= u << 7 | u >>> 32 - 7; + u = x3 + x15 | 0; + x7 ^= u << 9 | u >>> 32 - 9; + u = x7 + x3 | 0; + x11 ^= u << 13 | u >>> 32 - 13; + u = x11 + x7 | 0; + x15 ^= u << 18 | u >>> 32 - 18; + u = x0 + x3 | 0; + x1 ^= u << 7 | u >>> 32 - 7; + u = x1 + x0 | 0; + x2 ^= u << 9 | u >>> 32 - 9; + u = x2 + x1 | 0; + x3 ^= u << 13 | u >>> 32 - 13; + u = x3 + x2 | 0; + x0 ^= u << 18 | u >>> 32 - 18; + u = x5 + x4 | 0; + x6 ^= u << 7 | u >>> 32 - 7; + u = x6 + x5 | 0; + x7 ^= u << 9 | u >>> 32 - 9; + u = x7 + x6 | 0; + x4 ^= u << 13 | u >>> 32 - 13; + u = x4 + x7 | 0; + x5 ^= u << 18 | u >>> 32 - 18; + u = x10 + x9 | 0; + x11 ^= u << 7 | u >>> 32 - 7; + u = x11 + x10 | 0; + x8 ^= u << 9 | u >>> 32 - 9; + u = x8 + x11 | 0; + x9 ^= u << 13 | u >>> 32 - 13; + u = x9 + x8 | 0; + x10 ^= u << 18 | u >>> 32 - 18; + u = x15 + x14 | 0; + x12 ^= u << 7 | u >>> 32 - 7; + u = x12 + x15 | 0; + x13 ^= u << 9 | u >>> 32 - 9; + u = x13 + x12 | 0; + x14 ^= u << 13 | u >>> 32 - 13; + u = x14 + x13 | 0; + x15 ^= u << 18 | u >>> 32 - 18; + } + x0 = x0 + j0 | 0; + x1 = x1 + j1 | 0; + x2 = x2 + j2 | 0; + x3 = x3 + j3 | 0; + x4 = x4 + j4 | 0; + x5 = x5 + j5 | 0; + x6 = x6 + j6 | 0; + x7 = x7 + j7 | 0; + x8 = x8 + j8 | 0; + x9 = x9 + j9 | 0; + x10 = x10 + j10 | 0; + x11 = x11 + j11 | 0; + x12 = x12 + j12 | 0; + x13 = x13 + j13 | 0; + x14 = x14 + j14 | 0; + x15 = x15 + j15 | 0; + o[0] = x0 >>> 0 & 255; + o[1] = x0 >>> 8 & 255; + o[2] = x0 >>> 16 & 255; + o[3] = x0 >>> 24 & 255; + o[4] = x1 >>> 0 & 255; + o[5] = x1 >>> 8 & 255; + o[6] = x1 >>> 16 & 255; + o[7] = x1 >>> 24 & 255; + o[8] = x2 >>> 0 & 255; + o[9] = x2 >>> 8 & 255; + o[10] = x2 >>> 16 & 255; + o[11] = x2 >>> 24 & 255; + o[12] = x3 >>> 0 & 255; + o[13] = x3 >>> 8 & 255; + o[14] = x3 >>> 16 & 255; + o[15] = x3 >>> 24 & 255; + o[16] = x4 >>> 0 & 255; + o[17] = x4 >>> 8 & 255; + o[18] = x4 >>> 16 & 255; + o[19] = x4 >>> 24 & 255; + o[20] = x5 >>> 0 & 255; + o[21] = x5 >>> 8 & 255; + o[22] = x5 >>> 16 & 255; + o[23] = x5 >>> 24 & 255; + o[24] = x6 >>> 0 & 255; + o[25] = x6 >>> 8 & 255; + o[26] = x6 >>> 16 & 255; + o[27] = x6 >>> 24 & 255; + o[28] = x7 >>> 0 & 255; + o[29] = x7 >>> 8 & 255; + o[30] = x7 >>> 16 & 255; + o[31] = x7 >>> 24 & 255; + o[32] = x8 >>> 0 & 255; + o[33] = x8 >>> 8 & 255; + o[34] = x8 >>> 16 & 255; + o[35] = x8 >>> 24 & 255; + o[36] = x9 >>> 0 & 255; + o[37] = x9 >>> 8 & 255; + o[38] = x9 >>> 16 & 255; + o[39] = x9 >>> 24 & 255; + o[40] = x10 >>> 0 & 255; + o[41] = x10 >>> 8 & 255; + o[42] = x10 >>> 16 & 255; + o[43] = x10 >>> 24 & 255; + o[44] = x11 >>> 0 & 255; + o[45] = x11 >>> 8 & 255; + o[46] = x11 >>> 16 & 255; + o[47] = x11 >>> 24 & 255; + o[48] = x12 >>> 0 & 255; + o[49] = x12 >>> 8 & 255; + o[50] = x12 >>> 16 & 255; + o[51] = x12 >>> 24 & 255; + o[52] = x13 >>> 0 & 255; + o[53] = x13 >>> 8 & 255; + o[54] = x13 >>> 16 & 255; + o[55] = x13 >>> 24 & 255; + o[56] = x14 >>> 0 & 255; + o[57] = x14 >>> 8 & 255; + o[58] = x14 >>> 16 & 255; + o[59] = x14 >>> 24 & 255; + o[60] = x15 >>> 0 & 255; + o[61] = x15 >>> 8 & 255; + o[62] = x15 >>> 16 & 255; + o[63] = x15 >>> 24 & 255; + } + function core_hsalsa20(o, p, k, c) { + var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24; + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u; + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u << 7 | u >>> 32 - 7; + u = x4 + x0 | 0; + x8 ^= u << 9 | u >>> 32 - 9; + u = x8 + x4 | 0; + x12 ^= u << 13 | u >>> 32 - 13; + u = x12 + x8 | 0; + x0 ^= u << 18 | u >>> 32 - 18; + u = x5 + x1 | 0; + x9 ^= u << 7 | u >>> 32 - 7; + u = x9 + x5 | 0; + x13 ^= u << 9 | u >>> 32 - 9; + u = x13 + x9 | 0; + x1 ^= u << 13 | u >>> 32 - 13; + u = x1 + x13 | 0; + x5 ^= u << 18 | u >>> 32 - 18; + u = x10 + x6 | 0; + x14 ^= u << 7 | u >>> 32 - 7; + u = x14 + x10 | 0; + x2 ^= u << 9 | u >>> 32 - 9; + u = x2 + x14 | 0; + x6 ^= u << 13 | u >>> 32 - 13; + u = x6 + x2 | 0; + x10 ^= u << 18 | u >>> 32 - 18; + u = x15 + x11 | 0; + x3 ^= u << 7 | u >>> 32 - 7; + u = x3 + x15 | 0; + x7 ^= u << 9 | u >>> 32 - 9; + u = x7 + x3 | 0; + x11 ^= u << 13 | u >>> 32 - 13; + u = x11 + x7 | 0; + x15 ^= u << 18 | u >>> 32 - 18; + u = x0 + x3 | 0; + x1 ^= u << 7 | u >>> 32 - 7; + u = x1 + x0 | 0; + x2 ^= u << 9 | u >>> 32 - 9; + u = x2 + x1 | 0; + x3 ^= u << 13 | u >>> 32 - 13; + u = x3 + x2 | 0; + x0 ^= u << 18 | u >>> 32 - 18; + u = x5 + x4 | 0; + x6 ^= u << 7 | u >>> 32 - 7; + u = x6 + x5 | 0; + x7 ^= u << 9 | u >>> 32 - 9; + u = x7 + x6 | 0; + x4 ^= u << 13 | u >>> 32 - 13; + u = x4 + x7 | 0; + x5 ^= u << 18 | u >>> 32 - 18; + u = x10 + x9 | 0; + x11 ^= u << 7 | u >>> 32 - 7; + u = x11 + x10 | 0; + x8 ^= u << 9 | u >>> 32 - 9; + u = x8 + x11 | 0; + x9 ^= u << 13 | u >>> 32 - 13; + u = x9 + x8 | 0; + x10 ^= u << 18 | u >>> 32 - 18; + u = x15 + x14 | 0; + x12 ^= u << 7 | u >>> 32 - 7; + u = x12 + x15 | 0; + x13 ^= u << 9 | u >>> 32 - 9; + u = x13 + x12 | 0; + x14 ^= u << 13 | u >>> 32 - 13; + u = x14 + x13 | 0; + x15 ^= u << 18 | u >>> 32 - 18; + } + o[0] = x0 >>> 0 & 255; + o[1] = x0 >>> 8 & 255; + o[2] = x0 >>> 16 & 255; + o[3] = x0 >>> 24 & 255; + o[4] = x5 >>> 0 & 255; + o[5] = x5 >>> 8 & 255; + o[6] = x5 >>> 16 & 255; + o[7] = x5 >>> 24 & 255; + o[8] = x10 >>> 0 & 255; + o[9] = x10 >>> 8 & 255; + o[10] = x10 >>> 16 & 255; + o[11] = x10 >>> 24 & 255; + o[12] = x15 >>> 0 & 255; + o[13] = x15 >>> 8 & 255; + o[14] = x15 >>> 16 & 255; + o[15] = x15 >>> 24 & 255; + o[16] = x6 >>> 0 & 255; + o[17] = x6 >>> 8 & 255; + o[18] = x6 >>> 16 & 255; + o[19] = x6 >>> 24 & 255; + o[20] = x7 >>> 0 & 255; + o[21] = x7 >>> 8 & 255; + o[22] = x7 >>> 16 & 255; + o[23] = x7 >>> 24 & 255; + o[24] = x8 >>> 0 & 255; + o[25] = x8 >>> 8 & 255; + o[26] = x8 >>> 16 & 255; + o[27] = x8 >>> 24 & 255; + o[28] = x9 >>> 0 & 255; + o[29] = x9 >>> 8 & 255; + o[30] = x9 >>> 16 & 255; + o[31] = x9 >>> 24 & 255; + } + function crypto_core_salsa20(out, inp, k, c) { + core_salsa20(out, inp, k, c); + } + function crypto_core_hsalsa20(out, inp, k, c) { + core_hsalsa20(out, inp, k, c); + } + var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + function crypto_stream_salsa20_xor(c, cpos, m, mpos, b, n, k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) + z[i] = 0; + for (i = 0; i < 8; i++) + z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x, z, k, sigma); + for (i = 0; i < 64; i++) + c[cpos + i] = m[mpos + i] ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 255) | 0; + z[i] = u & 255; + u >>>= 8; + } + b -= 64; + cpos += 64; + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x, z, k, sigma); + for (i = 0; i < b; i++) + c[cpos + i] = m[mpos + i] ^ x[i]; + } + return 0; + } + function crypto_stream_salsa20(c, cpos, b, n, k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) + z[i] = 0; + for (i = 0; i < 8; i++) + z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x, z, k, sigma); + for (i = 0; i < 64; i++) + c[cpos + i] = x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 255) | 0; + z[i] = u & 255; + u >>>= 8; + } + b -= 64; + cpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x, z, k, sigma); + for (i = 0; i < b; i++) + c[cpos + i] = x[i]; + } + return 0; + } + function crypto_stream(c, cpos, d, n, k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s, n, k, sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) + sn[i] = n[i + 16]; + return crypto_stream_salsa20(c, cpos, d, sn, s); + } + function crypto_stream_xor(c, cpos, m, mpos, d, n, k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s, n, k, sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) + sn[i] = n[i + 16]; + return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, sn, s); + } + var poly1305 = function(key) { + this.buffer = new Uint8Array(16); + this.r = new Uint16Array(10); + this.h = new Uint16Array(10); + this.pad = new Uint16Array(8); + this.leftover = 0; + this.fin = 0; + var t0, t1, t2, t3, t4, t5, t6, t7; + t0 = key[0] & 255 | (key[1] & 255) << 8; + this.r[0] = t0 & 8191; + t1 = key[2] & 255 | (key[3] & 255) << 8; + this.r[1] = (t0 >>> 13 | t1 << 3) & 8191; + t2 = key[4] & 255 | (key[5] & 255) << 8; + this.r[2] = (t1 >>> 10 | t2 << 6) & 7939; + t3 = key[6] & 255 | (key[7] & 255) << 8; + this.r[3] = (t2 >>> 7 | t3 << 9) & 8191; + t4 = key[8] & 255 | (key[9] & 255) << 8; + this.r[4] = (t3 >>> 4 | t4 << 12) & 255; + this.r[5] = t4 >>> 1 & 8190; + t5 = key[10] & 255 | (key[11] & 255) << 8; + this.r[6] = (t4 >>> 14 | t5 << 2) & 8191; + t6 = key[12] & 255 | (key[13] & 255) << 8; + this.r[7] = (t5 >>> 11 | t6 << 5) & 8065; + t7 = key[14] & 255 | (key[15] & 255) << 8; + this.r[8] = (t6 >>> 8 | t7 << 8) & 8191; + this.r[9] = t7 >>> 5 & 127; + this.pad[0] = key[16] & 255 | (key[17] & 255) << 8; + this.pad[1] = key[18] & 255 | (key[19] & 255) << 8; + this.pad[2] = key[20] & 255 | (key[21] & 255) << 8; + this.pad[3] = key[22] & 255 | (key[23] & 255) << 8; + this.pad[4] = key[24] & 255 | (key[25] & 255) << 8; + this.pad[5] = key[26] & 255 | (key[27] & 255) << 8; + this.pad[6] = key[28] & 255 | (key[29] & 255) << 8; + this.pad[7] = key[30] & 255 | (key[31] & 255) << 8; + }; + poly1305.prototype.blocks = function(m, mpos, bytes) { + var hibit = this.fin ? 0 : 1 << 11; + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + var h0 = this.h[0], h1 = this.h[1], h2 = this.h[2], h3 = this.h[3], h4 = this.h[4], h5 = this.h[5], h6 = this.h[6], h7 = this.h[7], h8 = this.h[8], h9 = this.h[9]; + var r0 = this.r[0], r1 = this.r[1], r2 = this.r[2], r3 = this.r[3], r4 = this.r[4], r5 = this.r[5], r6 = this.r[6], r7 = this.r[7], r8 = this.r[8], r9 = this.r[9]; + while (bytes >= 16) { + t0 = m[mpos + 0] & 255 | (m[mpos + 1] & 255) << 8; + h0 += t0 & 8191; + t1 = m[mpos + 2] & 255 | (m[mpos + 3] & 255) << 8; + h1 += (t0 >>> 13 | t1 << 3) & 8191; + t2 = m[mpos + 4] & 255 | (m[mpos + 5] & 255) << 8; + h2 += (t1 >>> 10 | t2 << 6) & 8191; + t3 = m[mpos + 6] & 255 | (m[mpos + 7] & 255) << 8; + h3 += (t2 >>> 7 | t3 << 9) & 8191; + t4 = m[mpos + 8] & 255 | (m[mpos + 9] & 255) << 8; + h4 += (t3 >>> 4 | t4 << 12) & 8191; + h5 += t4 >>> 1 & 8191; + t5 = m[mpos + 10] & 255 | (m[mpos + 11] & 255) << 8; + h6 += (t4 >>> 14 | t5 << 2) & 8191; + t6 = m[mpos + 12] & 255 | (m[mpos + 13] & 255) << 8; + h7 += (t5 >>> 11 | t6 << 5) & 8191; + t7 = m[mpos + 14] & 255 | (m[mpos + 15] & 255) << 8; + h8 += (t6 >>> 8 | t7 << 8) & 8191; + h9 += t7 >>> 5 | hibit; + c = 0; + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = d0 >>> 13; + d0 &= 8191; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += d0 >>> 13; + d0 &= 8191; + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = d1 >>> 13; + d1 &= 8191; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += d1 >>> 13; + d1 &= 8191; + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = d2 >>> 13; + d2 &= 8191; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += d2 >>> 13; + d2 &= 8191; + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = d3 >>> 13; + d3 &= 8191; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += d3 >>> 13; + d3 &= 8191; + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = d4 >>> 13; + d4 &= 8191; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += d4 >>> 13; + d4 &= 8191; + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = d5 >>> 13; + d5 &= 8191; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += d5 >>> 13; + d5 &= 8191; + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = d6 >>> 13; + d6 &= 8191; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += d6 >>> 13; + d6 &= 8191; + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = d7 >>> 13; + d7 &= 8191; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += d7 >>> 13; + d7 &= 8191; + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = d8 >>> 13; + d8 &= 8191; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += d8 >>> 13; + d8 &= 8191; + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = d9 >>> 13; + d9 &= 8191; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += d9 >>> 13; + d9 &= 8191; + c = (c << 2) + c | 0; + c = c + d0 | 0; + d0 = c & 8191; + c = c >>> 13; + d1 += c; + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; + mpos += 16; + bytes -= 16; + } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; + }; + poly1305.prototype.finish = function(mac, macpos) { + var g = new Uint16Array(10); + var c, mask, f, i; + if (this.leftover) { + i = this.leftover; + this.buffer[i++] = 1; + for (; i < 16; i++) + this.buffer[i] = 0; + this.fin = 1; + this.blocks(this.buffer, 0, 16); + } + c = this.h[1] >>> 13; + this.h[1] &= 8191; + for (i = 2; i < 10; i++) { + this.h[i] += c; + c = this.h[i] >>> 13; + this.h[i] &= 8191; + } + this.h[0] += c * 5; + c = this.h[0] >>> 13; + this.h[0] &= 8191; + this.h[1] += c; + c = this.h[1] >>> 13; + this.h[1] &= 8191; + this.h[2] += c; + g[0] = this.h[0] + 5; + c = g[0] >>> 13; + g[0] &= 8191; + for (i = 1; i < 10; i++) { + g[i] = this.h[i] + c; + c = g[i] >>> 13; + g[i] &= 8191; + } + g[9] -= 1 << 13; + mask = (c ^ 1) - 1; + for (i = 0; i < 10; i++) + g[i] &= mask; + mask = ~mask; + for (i = 0; i < 10; i++) + this.h[i] = this.h[i] & mask | g[i]; + this.h[0] = (this.h[0] | this.h[1] << 13) & 65535; + this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535; + this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535; + this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535; + this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535; + this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535; + this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535; + this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535; + f = this.h[0] + this.pad[0]; + this.h[0] = f & 65535; + for (i = 1; i < 8; i++) { + f = (this.h[i] + this.pad[i] | 0) + (f >>> 16) | 0; + this.h[i] = f & 65535; + } + mac[macpos + 0] = this.h[0] >>> 0 & 255; + mac[macpos + 1] = this.h[0] >>> 8 & 255; + mac[macpos + 2] = this.h[1] >>> 0 & 255; + mac[macpos + 3] = this.h[1] >>> 8 & 255; + mac[macpos + 4] = this.h[2] >>> 0 & 255; + mac[macpos + 5] = this.h[2] >>> 8 & 255; + mac[macpos + 6] = this.h[3] >>> 0 & 255; + mac[macpos + 7] = this.h[3] >>> 8 & 255; + mac[macpos + 8] = this.h[4] >>> 0 & 255; + mac[macpos + 9] = this.h[4] >>> 8 & 255; + mac[macpos + 10] = this.h[5] >>> 0 & 255; + mac[macpos + 11] = this.h[5] >>> 8 & 255; + mac[macpos + 12] = this.h[6] >>> 0 & 255; + mac[macpos + 13] = this.h[6] >>> 8 & 255; + mac[macpos + 14] = this.h[7] >>> 0 & 255; + mac[macpos + 15] = this.h[7] >>> 8 & 255; + }; + poly1305.prototype.update = function(m, mpos, bytes) { + var i, want; + if (this.leftover) { + want = 16 - this.leftover; + if (want > bytes) + want = bytes; + for (i = 0; i < want; i++) + this.buffer[this.leftover + i] = m[mpos + i]; + bytes -= want; + mpos += want; + this.leftover += want; + if (this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16); + this.leftover = 0; + } + if (bytes >= 16) { + want = bytes - bytes % 16; + this.blocks(m, mpos, want); + mpos += want; + bytes -= want; + } + if (bytes) { + for (i = 0; i < bytes; i++) + this.buffer[this.leftover + i] = m[mpos + i]; + this.leftover += bytes; + } + }; + function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s = new poly1305(k); + s.update(m, mpos, n); + s.finish(out, outpos); + return 0; + } + function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x, 0, m, mpos, n, k); + return crypto_verify_16(h, hpos, x, 0); + } + function crypto_secretbox(c, m, d, n, k) { + var i; + if (d < 32) + return -1; + crypto_stream_xor(c, 0, m, 0, d, n, k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) + c[i] = 0; + return 0; + } + function crypto_secretbox_open(m, c, d, n, k) { + var i; + var x = new Uint8Array(32); + if (d < 32) + return -1; + crypto_stream(x, 0, 32, n, k); + if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) + return -1; + crypto_stream_xor(m, 0, c, 0, d, n, k); + for (i = 0; i < 32; i++) + m[i] = 0; + return 0; + } + function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) + r[i] = a[i] | 0; + } + function car25519(o) { + var i, v, c = 1; + for (i = 0; i < 16; i++) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; + } + o[0] += c - 1 + 37 * (c - 1); + } + function sel25519(p, q, b) { + var t, c = ~(b - 1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } + } + function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) + t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 65517; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 65535 - (m[i - 1] >> 16 & 1); + m[i - 1] &= 65535; + } + m[15] = t[15] - 32767 - (m[14] >> 16 & 1); + b = m[15] >> 16 & 1; + m[14] &= 65535; + sel25519(t, m, 1 - b); + } + for (i = 0; i < 16; i++) { + o[2 * i] = t[i] & 255; + o[2 * i + 1] = t[i] >> 8; + } + } + function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); + } + function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; + } + function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) + o[i] = n[2 * i] + (n[2 * i + 1] << 8); + o[15] &= 32767; + } + function A(o, a, b) { + for (var i = 0; i < 16; i++) + o[i] = a[i] + b[i]; + } + function Z(o, a, b) { + for (var i = 0; i < 16; i++) + o[i] = a[i] - b[i]; + } + function M(o, a, b) { + var v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + c = 1; + v = t0 + c + 65535; + c = Math.floor(v / 65536); + t0 = v - c * 65536; + v = t1 + c + 65535; + c = Math.floor(v / 65536); + t1 = v - c * 65536; + v = t2 + c + 65535; + c = Math.floor(v / 65536); + t2 = v - c * 65536; + v = t3 + c + 65535; + c = Math.floor(v / 65536); + t3 = v - c * 65536; + v = t4 + c + 65535; + c = Math.floor(v / 65536); + t4 = v - c * 65536; + v = t5 + c + 65535; + c = Math.floor(v / 65536); + t5 = v - c * 65536; + v = t6 + c + 65535; + c = Math.floor(v / 65536); + t6 = v - c * 65536; + v = t7 + c + 65535; + c = Math.floor(v / 65536); + t7 = v - c * 65536; + v = t8 + c + 65535; + c = Math.floor(v / 65536); + t8 = v - c * 65536; + v = t9 + c + 65535; + c = Math.floor(v / 65536); + t9 = v - c * 65536; + v = t10 + c + 65535; + c = Math.floor(v / 65536); + t10 = v - c * 65536; + v = t11 + c + 65535; + c = Math.floor(v / 65536); + t11 = v - c * 65536; + v = t12 + c + 65535; + c = Math.floor(v / 65536); + t12 = v - c * 65536; + v = t13 + c + 65535; + c = Math.floor(v / 65536); + t13 = v - c * 65536; + v = t14 + c + 65535; + c = Math.floor(v / 65536); + t14 = v - c * 65536; + v = t15 + c + 65535; + c = Math.floor(v / 65536); + t15 = v - c * 65536; + t0 += c - 1 + 37 * (c - 1); + c = 1; + v = t0 + c + 65535; + c = Math.floor(v / 65536); + t0 = v - c * 65536; + v = t1 + c + 65535; + c = Math.floor(v / 65536); + t1 = v - c * 65536; + v = t2 + c + 65535; + c = Math.floor(v / 65536); + t2 = v - c * 65536; + v = t3 + c + 65535; + c = Math.floor(v / 65536); + t3 = v - c * 65536; + v = t4 + c + 65535; + c = Math.floor(v / 65536); + t4 = v - c * 65536; + v = t5 + c + 65535; + c = Math.floor(v / 65536); + t5 = v - c * 65536; + v = t6 + c + 65535; + c = Math.floor(v / 65536); + t6 = v - c * 65536; + v = t7 + c + 65535; + c = Math.floor(v / 65536); + t7 = v - c * 65536; + v = t8 + c + 65535; + c = Math.floor(v / 65536); + t8 = v - c * 65536; + v = t9 + c + 65535; + c = Math.floor(v / 65536); + t9 = v - c * 65536; + v = t10 + c + 65535; + c = Math.floor(v / 65536); + t10 = v - c * 65536; + v = t11 + c + 65535; + c = Math.floor(v / 65536); + t11 = v - c * 65536; + v = t12 + c + 65535; + c = Math.floor(v / 65536); + t12 = v - c * 65536; + v = t13 + c + 65535; + c = Math.floor(v / 65536); + t13 = v - c * 65536; + v = t14 + c + 65535; + c = Math.floor(v / 65536); + t14 = v - c * 65536; + v = t15 + c + 65535; + c = Math.floor(v / 65536); + t15 = v - c * 65536; + t0 += c - 1 + 37 * (c - 1); + o[0] = t0; + o[1] = t1; + o[2] = t2; + o[3] = t3; + o[4] = t4; + o[5] = t5; + o[6] = t6; + o[7] = t7; + o[8] = t8; + o[9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; + } + function S(o, a) { + M(o, a, a); + } + function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) + c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if (a !== 2 && a !== 4) + M(c, c, i); + } + for (a = 0; a < 16; a++) + o[a] = c[a]; + } + function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) + c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if (a !== 1) + M(c, c, i); + } + for (a = 0; a < 16; a++) + o[a] = c[a]; + } + function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) + z[i] = n[i]; + z[31] = n[31] & 127 | 64; + z[0] &= 248; + unpack25519(x, p); + for (i = 0; i < 16; i++) { + b[i] = x[i]; + d[i] = a[i] = c[i] = 0; + } + a[0] = d[0] = 1; + for (i = 254; i >= 0; --i) { + r = z[i >>> 3] >>> (i & 7) & 1; + sel25519(a, b, r); + sel25519(c, d, r); + A(e, a, c); + Z(a, a, c); + A(c, b, d); + Z(b, b, d); + S(d, e); + S(f, a); + M(a, c, a); + M(c, b, e); + A(e, a, c); + Z(a, a, c); + S(b, a); + Z(c, d, f); + M(a, c, _121665); + A(a, a, d); + M(c, c, a); + M(a, d, f); + M(d, b, x); + S(b, e); + sel25519(a, b, r); + sel25519(c, d, r); + } + for (i = 0; i < 16; i++) { + x[i + 16] = a[i]; + x[i + 32] = c[i]; + x[i + 48] = b[i]; + x[i + 64] = d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32, x32); + M(x16, x16, x32); + pack25519(q, x16); + return 0; + } + function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); + } + function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); + } + function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); + } + var crypto_box_afternm = crypto_secretbox; + var crypto_box_open_afternm = crypto_secretbox_open; + function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); + } + function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); + } + var K = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function crypto_hashblocks_hl(hh, hl, m, n) { + var wh = new Int32Array(16), wl = new Int32Array(16), bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, th, tl, i, j, h, l, a, b, c, d; + var ah0 = hh[0], ah1 = hh[1], ah2 = hh[2], ah3 = hh[3], ah4 = hh[4], ah5 = hh[5], ah6 = hh[6], ah7 = hh[7], al0 = hl[0], al1 = hl[1], al2 = hl[2], al3 = hl[3], al4 = hl[4], al5 = hl[5], al6 = hl[6], al7 = hl[7]; + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) { + j = 8 * i + pos; + wh[i] = m[j + 0] << 24 | m[j + 1] << 16 | m[j + 2] << 8 | m[j + 3]; + wl[i] = m[j + 4] << 24 | m[j + 5] << 16 | m[j + 6] << 8 | m[j + 7]; + } + for (i = 0; i < 80; i++) { + bh0 = ah0; + bh1 = ah1; + bh2 = ah2; + bh3 = ah3; + bh4 = ah4; + bh5 = ah5; + bh6 = ah6; + bh7 = ah7; + bl0 = al0; + bl1 = al1; + bl2 = al2; + bl3 = al3; + bl4 = al4; + bl5 = al5; + bl6 = al6; + bl7 = al7; + h = ah7; + l = al7; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = (ah4 >>> 14 | al4 << 32 - 14) ^ (ah4 >>> 18 | al4 << 32 - 18) ^ (al4 >>> 41 - 32 | ah4 << 32 - (41 - 32)); + l = (al4 >>> 14 | ah4 << 32 - 14) ^ (al4 >>> 18 | ah4 << 32 - 18) ^ (ah4 >>> 41 - 32 | al4 << 32 - (41 - 32)); + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + h = ah4 & ah5 ^ ~ah4 & ah6; + l = al4 & al5 ^ ~al4 & al6; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + h = K[i * 2]; + l = K[i * 2 + 1]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + h = wh[i % 16]; + l = wl[i % 16]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + th = c & 65535 | d << 16; + tl = a & 65535 | b << 16; + h = th; + l = tl; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = (ah0 >>> 28 | al0 << 32 - 28) ^ (al0 >>> 34 - 32 | ah0 << 32 - (34 - 32)) ^ (al0 >>> 39 - 32 | ah0 << 32 - (39 - 32)); + l = (al0 >>> 28 | ah0 << 32 - 28) ^ (ah0 >>> 34 - 32 | al0 << 32 - (34 - 32)) ^ (ah0 >>> 39 - 32 | al0 << 32 - (39 - 32)); + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + h = ah0 & ah1 ^ ah0 & ah2 ^ ah1 & ah2; + l = al0 & al1 ^ al0 & al2 ^ al1 & al2; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + bh7 = c & 65535 | d << 16; + bl7 = a & 65535 | b << 16; + h = bh3; + l = bl3; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = th; + l = tl; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + bh3 = c & 65535 | d << 16; + bl3 = a & 65535 | b << 16; + ah1 = bh0; + ah2 = bh1; + ah3 = bh2; + ah4 = bh3; + ah5 = bh4; + ah6 = bh5; + ah7 = bh6; + ah0 = bh7; + al1 = bl0; + al2 = bl1; + al3 = bl2; + al4 = bl3; + al5 = bl4; + al6 = bl5; + al7 = bl6; + al0 = bl7; + if (i % 16 === 15) { + for (j = 0; j < 16; j++) { + h = wh[j]; + l = wl[j]; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = wh[(j + 9) % 16]; + l = wl[(j + 9) % 16]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + th = wh[(j + 1) % 16]; + tl = wl[(j + 1) % 16]; + h = (th >>> 1 | tl << 32 - 1) ^ (th >>> 8 | tl << 32 - 8) ^ th >>> 7; + l = (tl >>> 1 | th << 32 - 1) ^ (tl >>> 8 | th << 32 - 8) ^ (tl >>> 7 | th << 32 - 7); + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + th = wh[(j + 14) % 16]; + tl = wl[(j + 14) % 16]; + h = (th >>> 19 | tl << 32 - 19) ^ (tl >>> 61 - 32 | th << 32 - (61 - 32)) ^ th >>> 6; + l = (tl >>> 19 | th << 32 - 19) ^ (th >>> 61 - 32 | tl << 32 - (61 - 32)) ^ (tl >>> 6 | th << 32 - 6); + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + wh[j] = c & 65535 | d << 16; + wl[j] = a & 65535 | b << 16; + } + } + } + h = ah0; + l = al0; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[0]; + l = hl[0]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[0] = ah0 = c & 65535 | d << 16; + hl[0] = al0 = a & 65535 | b << 16; + h = ah1; + l = al1; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[1]; + l = hl[1]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[1] = ah1 = c & 65535 | d << 16; + hl[1] = al1 = a & 65535 | b << 16; + h = ah2; + l = al2; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[2]; + l = hl[2]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[2] = ah2 = c & 65535 | d << 16; + hl[2] = al2 = a & 65535 | b << 16; + h = ah3; + l = al3; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[3]; + l = hl[3]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[3] = ah3 = c & 65535 | d << 16; + hl[3] = al3 = a & 65535 | b << 16; + h = ah4; + l = al4; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[4]; + l = hl[4]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[4] = ah4 = c & 65535 | d << 16; + hl[4] = al4 = a & 65535 | b << 16; + h = ah5; + l = al5; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[5]; + l = hl[5]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[5] = ah5 = c & 65535 | d << 16; + hl[5] = al5 = a & 65535 | b << 16; + h = ah6; + l = al6; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[6]; + l = hl[6]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[6] = ah6 = c & 65535 | d << 16; + hl[6] = al6 = a & 65535 | b << 16; + h = ah7; + l = al7; + a = l & 65535; + b = l >>> 16; + c = h & 65535; + d = h >>> 16; + h = hh[7]; + l = hl[7]; + a += l & 65535; + b += l >>> 16; + c += h & 65535; + d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + hh[7] = ah7 = c & 65535 | d << 16; + hl[7] = al7 = a & 65535 | b << 16; + pos += 128; + n -= 128; + } + return n; + } + function crypto_hash(out, m, n) { + var hh = new Int32Array(8), hl = new Int32Array(8), x = new Uint8Array(256), i, b = n; + hh[0] = 1779033703; + hh[1] = 3144134277; + hh[2] = 1013904242; + hh[3] = 2773480762; + hh[4] = 1359893119; + hh[5] = 2600822924; + hh[6] = 528734635; + hh[7] = 1541459225; + hl[0] = 4089235720; + hl[1] = 2227873595; + hl[2] = 4271175723; + hl[3] = 1595750129; + hl[4] = 2917565137; + hl[5] = 725511199; + hl[6] = 4215389547; + hl[7] = 327033209; + crypto_hashblocks_hl(hh, hl, m, n); + n %= 128; + for (i = 0; i < n; i++) + x[i] = m[b - n + i]; + x[n] = 128; + n = 256 - 128 * (n < 112 ? 1 : 0); + x[n - 9] = 0; + ts64(x, n - 8, b / 536870912 | 0, b << 3); + crypto_hashblocks_hl(hh, hl, x, n); + for (i = 0; i < 8; i++) + ts64(out, 8 * i, hh[i], hl[i]); + return 0; + } + function add(p, q) { + var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(), g = gf(), h = gf(), t = gf(); + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); + } + function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); + } + } + function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; + } + function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = s[i / 8 | 0] >> (i & 7) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } + } + function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); + } + function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; + if (!seeded) + randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + scalarbase(p, d); + pack(pk, p); + for (i = 0; i < 32; i++) + sk[i + 32] = pk[i]; + return 0; + } + var L = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); + function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = Math.floor((x[j] + 128) / 256); + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) + x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i + 1] += x[i] >> 8; + r[i] = x[i] & 255; + } + } + function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) + x[i] = r[i]; + for (i = 0; i < 64; i++) + r[i] = 0; + modL(r, x); + } + function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + var smlen = n + 64; + for (i = 0; i < n; i++) + sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) + sm[32 + i] = d[32 + i]; + crypto_hash(r, sm.subarray(32), n + 32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + for (i = 32; i < 64; i++) + sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); + for (i = 0; i < 64; i++) + x[i] = 0; + for (i = 0; i < 32; i++) + x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i + j] += h[i] * d[j]; + } + } + modL(sm.subarray(32), x); + return smlen; + } + function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf(); + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) + M(r[0], r[0], I); + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) + return -1; + if (par25519(r[0]) === p[31] >> 7) + Z(r[0], gf0, r[0]); + M(r[3], r[0], r[1]); + return 0; + } + function crypto_sign_open(m, sm, n, pk) { + var i; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], q = [gf(), gf(), gf(), gf()]; + if (n < 64) + return -1; + if (unpackneg(q, pk)) + return -1; + for (i = 0; i < n; i++) + m[i] = sm[i]; + for (i = 0; i < 32; i++) + m[i + 32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + n -= 64; + if (crypto_verify_32(sm, 0, t, 0)) { + for (i = 0; i < n; i++) + m[i] = 0; + return -1; + } + for (i = 0; i < n; i++) + m[i] = sm[i + 64]; + return n; + } + var crypto_secretbox_KEYBYTES = 32, crypto_secretbox_NONCEBYTES = 24, crypto_secretbox_ZEROBYTES = 32, crypto_secretbox_BOXZEROBYTES = 16, crypto_scalarmult_BYTES = 32, crypto_scalarmult_SCALARBYTES = 32, crypto_box_PUBLICKEYBYTES = 32, crypto_box_SECRETKEYBYTES = 32, crypto_box_BEFORENMBYTES = 32, crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, crypto_sign_BYTES = 64, crypto_sign_PUBLICKEYBYTES = 32, crypto_sign_SECRETKEYBYTES = 64, crypto_sign_SEEDBYTES = 32, crypto_hash_BYTES = 64; + nacl.lowlevel = { + crypto_core_hsalsa20, + crypto_stream_xor, + crypto_stream, + crypto_stream_salsa20_xor, + crypto_stream_salsa20, + crypto_onetimeauth, + crypto_onetimeauth_verify, + crypto_verify_16, + crypto_verify_32, + crypto_secretbox, + crypto_secretbox_open, + crypto_scalarmult, + crypto_scalarmult_base, + crypto_box_beforenm, + crypto_box_afternm, + crypto_box, + crypto_box_open, + crypto_box_keypair, + crypto_hash, + crypto_sign, + crypto_sign_keypair, + crypto_sign_open, + crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES, + crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES, + crypto_hash_BYTES, + gf, + D, + L, + pack25519, + unpack25519, + M, + A, + S, + Z, + pow2523, + add, + set25519, + modL, + scalarmult, + scalarbase + }; + function checkLengths(k, n) { + if (k.length !== crypto_secretbox_KEYBYTES) + throw new Error("bad key size"); + if (n.length !== crypto_secretbox_NONCEBYTES) + throw new Error("bad nonce size"); + } + function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) + throw new Error("bad public key size"); + if (sk.length !== crypto_box_SECRETKEYBYTES) + throw new Error("bad secret key size"); + } + function checkArrayTypes() { + for (var i = 0; i < arguments.length; i++) { + if (!(arguments[i] instanceof Uint8Array)) + throw new TypeError("unexpected type, use Uint8Array"); + } + } + function cleanup(arr) { + for (var i = 0; i < arr.length; i++) + arr[i] = 0; + } + nacl.randomBytes = function(n) { + var b = new Uint8Array(n); + randombytes(b, n); + return b; + }; + nacl.secretbox = function(msg, nonce, key) { + checkArrayTypes(msg, nonce, key); + checkLengths(key, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i = 0; i < msg.length; i++) + m[i + crypto_secretbox_ZEROBYTES] = msg[i]; + crypto_secretbox(c, m, m.length, nonce, key); + return c.subarray(crypto_secretbox_BOXZEROBYTES); + }; + nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) + c[i + crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) + return null; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) + return null; + return m.subarray(crypto_secretbox_ZEROBYTES); + }; + nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; + nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; + nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) + throw new Error("bad n size"); + if (p.length !== crypto_scalarmult_BYTES) + throw new Error("bad p size"); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; + }; + nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) + throw new Error("bad n size"); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; + }; + nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; + nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; + nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); + }; + nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; + }; + nacl.box.after = nacl.secretbox; + nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); + }; + nacl.box.open.after = nacl.secretbox.open; + nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return { publicKey: pk, secretKey: sk }; + }; + nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; + }; + nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; + nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; + nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; + nacl.box.nonceLength = crypto_box_NONCEBYTES; + nacl.box.overheadLength = nacl.secretbox.overheadLength; + nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; + }; + nacl.sign.open = function(signedMsg, publicKey) { + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error("bad public key size"); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) + return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) + m[i] = tmp[i]; + return m; + }; + nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) + sig[i] = signedMsg[i]; + return sig; + }; + nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error("bad signature size"); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error("bad public key size"); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) + sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) + sm[i + crypto_sign_BYTES] = msg[i]; + return crypto_sign_open(m, sm, sm.length, publicKey) >= 0; + }; + nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return { publicKey: pk, secretKey: sk }; + }; + nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error("bad secret key size"); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) + pk[i] = secretKey[32 + i]; + return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; + }; + nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error("bad seed size"); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) + sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return { publicKey: pk, secretKey: sk }; + }; + nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; + nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; + nacl.sign.seedLength = crypto_sign_SEEDBYTES; + nacl.sign.signatureLength = crypto_sign_BYTES; + nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; + }; + nacl.hash.hashLength = crypto_hash_BYTES; + nacl.verify = function(x, y) { + checkArrayTypes(x, y); + if (x.length === 0 || y.length === 0) + return false; + if (x.length !== y.length) + return false; + return vn(x, 0, y, 0, x.length) === 0 ? true : false; + }; + nacl.setPRNG = function(fn) { + randombytes = fn; + }; + (function() { + var crypto = typeof self !== "undefined" ? self.crypto || self.msCrypto : null; + if (crypto && crypto.getRandomValues) { + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) + x[i] = v[i]; + cleanup(v); + }); + } else if (typeof __require !== "undefined") { + crypto = require_crypto(); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) + x[i] = v[i]; + cleanup(v); + }); + } + } + })(); + })(typeof module !== "undefined" && module.exports ? module.exports : self.nacl = self.nacl || {}); + } + }); + + // ../../node_modules/util/support/isBufferBrowser.js + var require_isBufferBrowser = __commonJS({ + "../../node_modules/util/support/isBufferBrowser.js"(exports, module) { + module.exports = function isBuffer(arg) { + return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; + }; + } + }); + + // ../../node_modules/inherits/inherits_browser.js + var require_inherits_browser = __commonJS({ + "../../node_modules/inherits/inherits_browser.js"(exports, module) { + if (typeof Object.create === "function") { + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; + } else { + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + }; + } + } + }); + + // ../../node_modules/util/util.js + var require_util2 = __commonJS({ + "../../node_modules/util/util.js"(exports) { + var formatRegExp = /%[sdj%]/g; + exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(" "); + } + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x2) { + if (x2 === "%%") + return "%"; + if (i >= len) + return x2; + switch (x2) { + case "%s": + return String(args[i++]); + case "%d": + return Number(args[i++]); + case "%j": + try { + return JSON.stringify(args[i++]); + } catch (_) { + return "[Circular]"; + } + default: + return x2; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += " " + x; + } else { + str += " " + inspect(x); + } + } + return str; + }; + exports.deprecate = function(fn, msg) { + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + if (process.noDeprecation === true) { + return fn; + } + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + return deprecated; + }; + var debugs = {}; + var debugEnviron; + exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ""; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error("%s %d: %s", set, pid, msg); + }; + } else { + debugs[set] = function() { + }; + } + } + return debugs[set]; + }; + function inspect(obj, opts) { + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + if (arguments.length >= 3) + ctx.depth = arguments[2]; + if (arguments.length >= 4) + ctx.colors = arguments[3]; + if (isBoolean(opts)) { + ctx.showHidden = opts; + } else if (opts) { + exports._extend(ctx, opts); + } + if (isUndefined(ctx.showHidden)) + ctx.showHidden = false; + if (isUndefined(ctx.depth)) + ctx.depth = 2; + if (isUndefined(ctx.colors)) + ctx.colors = false; + if (isUndefined(ctx.customInspect)) + ctx.customInspect = true; + if (ctx.colors) + ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); + } + exports.inspect = inspect; + inspect.colors = { + "bold": [1, 22], + "italic": [3, 23], + "underline": [4, 24], + "inverse": [7, 27], + "white": [37, 39], + "grey": [90, 39], + "black": [30, 39], + "blue": [34, 39], + "cyan": [36, 39], + "green": [32, 39], + "magenta": [35, 39], + "red": [31, 39], + "yellow": [33, 39] + }; + inspect.styles = { + "special": "cyan", + "number": "yellow", + "boolean": "yellow", + "undefined": "grey", + "null": "bold", + "string": "green", + "date": "magenta", + "regexp": "red" + }; + function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + if (style) { + return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; + } else { + return str; + } + } + function stylizeNoColor(str, styleType) { + return str; + } + function arrayToHash(array) { + var hash = {}; + array.forEach(function(val, idx) { + hash[val] = true; + }); + return hash; + } + function formatValue(ctx, value, recurseTimes) { + if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { + return formatError(value); + } + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ": " + value.name : ""; + return ctx.stylize("[Function" + name + "]", "special"); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), "date"); + } + if (isError(value)) { + return formatError(value); + } + } + var base = "", array = false, braces = ["{", "}"]; + if (isArray(value)) { + array = true; + braces = ["[", "]"]; + } + if (isFunction(value)) { + var n = value.name ? ": " + value.name : ""; + base = " [Function" + n + "]"; + } + if (isRegExp(value)) { + base = " " + RegExp.prototype.toString.call(value); + } + if (isDate(value)) { + base = " " + Date.prototype.toUTCString.call(value); + } + if (isError(value)) { + base = " " + formatError(value); + } + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); + } else { + return ctx.stylize("[Object]", "special"); + } + } + ctx.seen.push(value); + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + ctx.seen.pop(); + return reduceToSingleString(output, base, braces); + } + function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize("undefined", "undefined"); + if (isString(value)) { + var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; + return ctx.stylize(simple, "string"); + } + if (isNumber(value)) + return ctx.stylize("" + value, "number"); + if (isBoolean(value)) + return ctx.stylize("" + value, "boolean"); + if (isNull(value)) + return ctx.stylize("null", "null"); + } + function formatError(value) { + return "[" + Error.prototype.toString.call(value) + "]"; + } + function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty( + ctx, + value, + recurseTimes, + visibleKeys, + String(i), + true + )); + } else { + output.push(""); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty( + ctx, + value, + recurseTimes, + visibleKeys, + key, + true + )); + } + }); + return output; + } + function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize("[Getter/Setter]", "special"); + } else { + str = ctx.stylize("[Getter]", "special"); + } + } else { + if (desc.set) { + str = ctx.stylize("[Setter]", "special"); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = "[" + key + "]"; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf("\n") > -1) { + if (array) { + str = str.split("\n").map(function(line) { + return " " + line; + }).join("\n").substr(2); + } else { + str = "\n" + str.split("\n").map(function(line) { + return " " + line; + }).join("\n"); + } + } + } else { + str = ctx.stylize("[Circular]", "special"); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify("" + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, "name"); + } else { + name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, "string"); + } + } + return name + ": " + str; + } + function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf("\n") >= 0) + numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; + }, 0); + if (length > 60) { + return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; + } + return braces[0] + base + " " + output.join(", ") + " " + braces[1]; + } + function isArray(ar) { + return Array.isArray(ar); + } + exports.isArray = isArray; + function isBoolean(arg) { + return typeof arg === "boolean"; + } + exports.isBoolean = isBoolean; + function isNull(arg) { + return arg === null; + } + exports.isNull = isNull; + function isNullOrUndefined(arg) { + return arg == null; + } + exports.isNullOrUndefined = isNullOrUndefined; + function isNumber(arg) { + return typeof arg === "number"; + } + exports.isNumber = isNumber; + function isString(arg) { + return typeof arg === "string"; + } + exports.isString = isString; + function isSymbol(arg) { + return typeof arg === "symbol"; + } + exports.isSymbol = isSymbol; + function isUndefined(arg) { + return arg === void 0; + } + exports.isUndefined = isUndefined; + function isRegExp(re) { + return isObject(re) && objectToString(re) === "[object RegExp]"; + } + exports.isRegExp = isRegExp; + function isObject(arg) { + return typeof arg === "object" && arg !== null; + } + exports.isObject = isObject; + function isDate(d) { + return isObject(d) && objectToString(d) === "[object Date]"; + } + exports.isDate = isDate; + function isError(e) { + return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); + } + exports.isError = isError; + function isFunction(arg) { + return typeof arg === "function"; + } + exports.isFunction = isFunction; + function isPrimitive(arg) { + return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; + } + exports.isPrimitive = isPrimitive; + exports.isBuffer = require_isBufferBrowser(); + function objectToString(o) { + return Object.prototype.toString.call(o); + } + function pad(n) { + return n < 10 ? "0" + n.toString(10) : n.toString(10); + } + var months = [ + "Jan", + "Feb", + "Mar", + "Apr", + "May", + "Jun", + "Jul", + "Aug", + "Sep", + "Oct", + "Nov", + "Dec" + ]; + function timestamp() { + var d = new Date(); + var time = [ + pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds()) + ].join(":"); + return [d.getDate(), months[d.getMonth()], time].join(" "); + } + exports.log = function() { + console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); + }; + exports.inherits = require_inherits_browser(); + exports._extend = function(origin, add) { + if (!add || !isObject(add)) + return origin; + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; + }; + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } + } + }); + + // ../../node_modules/nkeys.js/lib/helper.js + var require_helper = __commonJS({ + "../../node_modules/nkeys.js/lib/helper.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.getEd25519Helper = exports.setEd25519Helper = void 0; + var helper; + function setEd25519Helper(lib) { + helper = lib; + } + exports.setEd25519Helper = setEd25519Helper; + function getEd25519Helper() { + return helper; + } + exports.getEd25519Helper = getEd25519Helper; + } + }); + + // ../../node_modules/nkeys.js/lib/crc16.js + var require_crc16 = __commonJS({ + "../../node_modules/nkeys.js/lib/crc16.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.crc16 = void 0; + var crc16tab = new Uint16Array([ + 0, + 4129, + 8258, + 12387, + 16516, + 20645, + 24774, + 28903, + 33032, + 37161, + 41290, + 45419, + 49548, + 53677, + 57806, + 61935, + 4657, + 528, + 12915, + 8786, + 21173, + 17044, + 29431, + 25302, + 37689, + 33560, + 45947, + 41818, + 54205, + 50076, + 62463, + 58334, + 9314, + 13379, + 1056, + 5121, + 25830, + 29895, + 17572, + 21637, + 42346, + 46411, + 34088, + 38153, + 58862, + 62927, + 50604, + 54669, + 13907, + 9842, + 5649, + 1584, + 30423, + 26358, + 22165, + 18100, + 46939, + 42874, + 38681, + 34616, + 63455, + 59390, + 55197, + 51132, + 18628, + 22757, + 26758, + 30887, + 2112, + 6241, + 10242, + 14371, + 51660, + 55789, + 59790, + 63919, + 35144, + 39273, + 43274, + 47403, + 23285, + 19156, + 31415, + 27286, + 6769, + 2640, + 14899, + 10770, + 56317, + 52188, + 64447, + 60318, + 39801, + 35672, + 47931, + 43802, + 27814, + 31879, + 19684, + 23749, + 11298, + 15363, + 3168, + 7233, + 60846, + 64911, + 52716, + 56781, + 44330, + 48395, + 36200, + 40265, + 32407, + 28342, + 24277, + 20212, + 15891, + 11826, + 7761, + 3696, + 65439, + 61374, + 57309, + 53244, + 48923, + 44858, + 40793, + 36728, + 37256, + 33193, + 45514, + 41451, + 53516, + 49453, + 61774, + 57711, + 4224, + 161, + 12482, + 8419, + 20484, + 16421, + 28742, + 24679, + 33721, + 37784, + 41979, + 46042, + 49981, + 54044, + 58239, + 62302, + 689, + 4752, + 8947, + 13010, + 16949, + 21012, + 25207, + 29270, + 46570, + 42443, + 38312, + 34185, + 62830, + 58703, + 54572, + 50445, + 13538, + 9411, + 5280, + 1153, + 29798, + 25671, + 21540, + 17413, + 42971, + 47098, + 34713, + 38840, + 59231, + 63358, + 50973, + 55100, + 9939, + 14066, + 1681, + 5808, + 26199, + 30326, + 17941, + 22068, + 55628, + 51565, + 63758, + 59695, + 39368, + 35305, + 47498, + 43435, + 22596, + 18533, + 30726, + 26663, + 6336, + 2273, + 14466, + 10403, + 52093, + 56156, + 60223, + 64286, + 35833, + 39896, + 43963, + 48026, + 19061, + 23124, + 27191, + 31254, + 2801, + 6864, + 10931, + 14994, + 64814, + 60687, + 56684, + 52557, + 48554, + 44427, + 40424, + 36297, + 31782, + 27655, + 23652, + 19525, + 15522, + 11395, + 7392, + 3265, + 61215, + 65342, + 53085, + 57212, + 44955, + 49082, + 36825, + 40952, + 28183, + 32310, + 20053, + 24180, + 11923, + 16050, + 3793, + 7920 + ]); + var crc16 = class { + static checksum(data) { + let crc = 0; + for (let i = 0; i < data.byteLength; i++) { + let b = data[i]; + crc = crc << 8 & 65535 ^ crc16tab[(crc >> 8 ^ b) & 255]; + } + return crc; + } + static validate(data, expected) { + let ba = crc16.checksum(data); + return ba == expected; + } + }; + exports.crc16 = crc16; + } + }); + + // ../../node_modules/nkeys.js/lib/base32.js + var require_base32 = __commonJS({ + "../../node_modules/nkeys.js/lib/base32.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.base32 = void 0; + var b32Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + var base32 = class { + static encode(src) { + let bits = 0; + let value = 0; + let a = new Uint8Array(src); + let buf = new Uint8Array(src.byteLength * 2); + let j = 0; + for (let i = 0; i < a.byteLength; i++) { + value = value << 8 | a[i]; + bits += 8; + while (bits >= 5) { + let index = value >>> bits - 5 & 31; + buf[j++] = b32Alphabet.charAt(index).charCodeAt(0); + bits -= 5; + } + } + if (bits > 0) { + let index = value << 5 - bits & 31; + buf[j++] = b32Alphabet.charAt(index).charCodeAt(0); + } + return buf.slice(0, j); + } + static decode(src) { + let bits = 0; + let byte = 0; + let j = 0; + let a = new Uint8Array(src); + let out = new Uint8Array(a.byteLength * 5 / 8 | 0); + for (let i = 0; i < a.byteLength; i++) { + let v = String.fromCharCode(a[i]); + let vv = b32Alphabet.indexOf(v); + if (vv === -1) { + throw new Error("Illegal Base32 character: " + a[i]); + } + byte = byte << 5 | vv; + bits += 5; + if (bits >= 8) { + out[j++] = byte >>> bits - 8 & 255; + bits -= 8; + } + } + return out.slice(0, j); + } + }; + exports.base32 = base32; + } + }); + + // ../../node_modules/nkeys.js/lib/codec.js + var require_codec = __commonJS({ + "../../node_modules/nkeys.js/lib/codec.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Codec = void 0; + var crc16_1 = require_crc16(); + var nkeys_1 = require_nkeys(); + var base32_1 = require_base32(); + var Codec = class { + static encode(prefix, src) { + if (!src || !(src instanceof Uint8Array)) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.SerializationError); + } + if (!nkeys_1.Prefixes.isValidPrefix(prefix)) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); + } + return Codec._encode(false, prefix, src); + } + static encodeSeed(role, src) { + if (!src) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ApiError); + } + if (!nkeys_1.Prefixes.isValidPublicPrefix(role)) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); + } + if (src.byteLength !== 32) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidSeedLen); + } + return Codec._encode(true, role, src); + } + static decode(expected, src) { + if (!nkeys_1.Prefixes.isValidPrefix(expected)) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); + } + const raw = Codec._decode(src); + if (raw[0] !== expected) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); + } + return raw.slice(1); + } + static decodeSeed(src) { + const raw = Codec._decode(src); + const prefix = Codec._decodePrefix(raw); + if (prefix[0] != nkeys_1.Prefix.Seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidSeed); + } + if (!nkeys_1.Prefixes.isValidPublicPrefix(prefix[1])) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); + } + return { buf: raw.slice(2), prefix: prefix[1] }; + } + static _encode(seed, role, payload) { + const payloadOffset = seed ? 2 : 1; + const payloadLen = payload.byteLength; + const checkLen = 2; + const cap = payloadOffset + payloadLen + checkLen; + const checkOffset = payloadOffset + payloadLen; + const raw = new Uint8Array(cap); + if (seed) { + const encodedPrefix = Codec._encodePrefix(nkeys_1.Prefix.Seed, role); + raw.set(encodedPrefix); + } else { + raw[0] = role; + } + raw.set(payload, payloadOffset); + const checksum = crc16_1.crc16.checksum(raw.slice(0, checkOffset)); + const dv = new DataView(raw.buffer); + dv.setUint16(checkOffset, checksum, true); + return base32_1.base32.encode(raw); + } + static _decode(src) { + if (src.byteLength < 4) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidEncoding); + } + let raw; + try { + raw = base32_1.base32.decode(src); + } catch (ex) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidEncoding, ex); + } + const checkOffset = raw.byteLength - 2; + const dv = new DataView(raw.buffer); + const checksum = dv.getUint16(checkOffset, true); + const payload = raw.slice(0, checkOffset); + if (!crc16_1.crc16.validate(payload, checksum)) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidChecksum); + } + return payload; + } + static _encodePrefix(kind, role) { + const b1 = kind | role >> 5; + const b2 = (role & 31) << 3; + return new Uint8Array([b1, b2]); + } + static _decodePrefix(raw) { + const b1 = raw[0] & 248; + const b2 = (raw[0] & 7) << 5 | (raw[1] & 248) >> 3; + return new Uint8Array([b1, b2]); + } + }; + exports.Codec = Codec; + } + }); + + // ../../node_modules/nkeys.js/lib/kp.js + var require_kp = __commonJS({ + "../../node_modules/nkeys.js/lib/kp.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.KP = void 0; + var codec_1 = require_codec(); + var nkeys_1 = require_nkeys(); + var helper_1 = require_helper(); + var KP = class { + constructor(seed) { + this.seed = seed; + } + getRawSeed() { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + let sd = codec_1.Codec.decodeSeed(this.seed); + return sd.buf; + } + getSeed() { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + return this.seed; + } + getPublicKey() { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + const sd = codec_1.Codec.decodeSeed(this.seed); + const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); + const buf = codec_1.Codec.encode(sd.prefix, kp.publicKey); + return new TextDecoder().decode(buf); + } + getPrivateKey() { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); + return codec_1.Codec.encode(nkeys_1.Prefix.Private, kp.secretKey); + } + sign(input) { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); + return helper_1.getEd25519Helper().sign(input, kp.secretKey); + } + verify(input, sig) { + if (!this.seed) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); + return helper_1.getEd25519Helper().verify(input, sig, kp.publicKey); + } + clear() { + if (!this.seed) { + return; + } + this.seed.fill(0); + this.seed = void 0; + } + }; + exports.KP = KP; + } + }); + + // ../../node_modules/nkeys.js/lib/public.js + var require_public = __commonJS({ + "../../node_modules/nkeys.js/lib/public.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.PublicKey = void 0; + var codec_1 = require_codec(); + var nkeys_1 = require_nkeys(); + var helper_1 = require_helper(); + var PublicKey = class { + constructor(publicKey) { + this.publicKey = publicKey; + } + getPublicKey() { + if (!this.publicKey) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + return new TextDecoder().decode(this.publicKey); + } + getPrivateKey() { + if (!this.publicKey) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.PublicKeyOnly); + } + getSeed() { + if (!this.publicKey) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.PublicKeyOnly); + } + sign(_) { + if (!this.publicKey) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.CannotSign); + } + verify(input, sig) { + if (!this.publicKey) { + throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); + } + let buf = codec_1.Codec._decode(this.publicKey); + return helper_1.getEd25519Helper().verify(input, sig, buf.slice(1)); + } + clear() { + if (!this.publicKey) { + return; + } + this.publicKey.fill(0); + this.publicKey = void 0; + } + }; + exports.PublicKey = PublicKey; + } + }); + + // ../../node_modules/nkeys.js/lib/nkeys.js + var require_nkeys = __commonJS({ + "../../node_modules/nkeys.js/lib/nkeys.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.NKeysError = exports.NKeysErrorCode = exports.Prefixes = exports.Prefix = exports.fromSeed = exports.fromPublic = exports.createServer = exports.createCluster = exports.createUser = exports.createAccount = exports.createOperator = exports.createPair = void 0; + var kp_1 = require_kp(); + var public_1 = require_public(); + var codec_1 = require_codec(); + var helper_1 = require_helper(); + function createPair(prefix) { + const rawSeed = helper_1.getEd25519Helper().randomBytes(32); + let str = codec_1.Codec.encodeSeed(prefix, new Uint8Array(rawSeed)); + return new kp_1.KP(str); + } + exports.createPair = createPair; + function createOperator() { + return createPair(Prefix.Operator); + } + exports.createOperator = createOperator; + function createAccount() { + return createPair(Prefix.Account); + } + exports.createAccount = createAccount; + function createUser() { + return createPair(Prefix.User); + } + exports.createUser = createUser; + function createCluster() { + return createPair(Prefix.Cluster); + } + exports.createCluster = createCluster; + function createServer() { + return createPair(Prefix.Server); + } + exports.createServer = createServer; + function fromPublic(src) { + const ba = new TextEncoder().encode(src); + const raw = codec_1.Codec._decode(ba); + const prefix = Prefixes.parsePrefix(raw[0]); + if (Prefixes.isValidPublicPrefix(prefix)) { + return new public_1.PublicKey(ba); + } + throw new NKeysError(NKeysErrorCode.InvalidPublicKey); + } + exports.fromPublic = fromPublic; + function fromSeed(src) { + codec_1.Codec.decodeSeed(src); + return new kp_1.KP(src); + } + exports.fromSeed = fromSeed; + var Prefix; + (function(Prefix2) { + Prefix2[Prefix2["Seed"] = 144] = "Seed"; + Prefix2[Prefix2["Private"] = 120] = "Private"; + Prefix2[Prefix2["Operator"] = 112] = "Operator"; + Prefix2[Prefix2["Server"] = 104] = "Server"; + Prefix2[Prefix2["Cluster"] = 16] = "Cluster"; + Prefix2[Prefix2["Account"] = 0] = "Account"; + Prefix2[Prefix2["User"] = 160] = "User"; + })(Prefix = exports.Prefix || (exports.Prefix = {})); + var Prefixes = class { + static isValidPublicPrefix(prefix) { + return prefix == Prefix.Server || prefix == Prefix.Operator || prefix == Prefix.Cluster || prefix == Prefix.Account || prefix == Prefix.User; + } + static startsWithValidPrefix(s) { + let c = s[0]; + return c == "S" || c == "P" || c == "O" || c == "N" || c == "C" || c == "A" || c == "U"; + } + static isValidPrefix(prefix) { + let v = this.parsePrefix(prefix); + return v != -1; + } + static parsePrefix(v) { + switch (v) { + case Prefix.Seed: + return Prefix.Seed; + case Prefix.Private: + return Prefix.Private; + case Prefix.Operator: + return Prefix.Operator; + case Prefix.Server: + return Prefix.Server; + case Prefix.Cluster: + return Prefix.Cluster; + case Prefix.Account: + return Prefix.Account; + case Prefix.User: + return Prefix.User; + default: + return -1; + } + } + }; + exports.Prefixes = Prefixes; + var NKeysErrorCode; + (function(NKeysErrorCode2) { + NKeysErrorCode2["InvalidPrefixByte"] = "nkeys: invalid prefix byte"; + NKeysErrorCode2["InvalidKey"] = "nkeys: invalid key"; + NKeysErrorCode2["InvalidPublicKey"] = "nkeys: invalid public key"; + NKeysErrorCode2["InvalidSeedLen"] = "nkeys: invalid seed length"; + NKeysErrorCode2["InvalidSeed"] = "nkeys: invalid seed"; + NKeysErrorCode2["InvalidEncoding"] = "nkeys: invalid encoded key"; + NKeysErrorCode2["InvalidSignature"] = "nkeys: signature verification failed"; + NKeysErrorCode2["CannotSign"] = "nkeys: cannot sign, no private key available"; + NKeysErrorCode2["PublicKeyOnly"] = "nkeys: no seed or private key available"; + NKeysErrorCode2["InvalidChecksum"] = "nkeys: invalid checksum"; + NKeysErrorCode2["SerializationError"] = "nkeys: serialization error"; + NKeysErrorCode2["ApiError"] = "nkeys: api error"; + NKeysErrorCode2["ClearedPair"] = "nkeys: pair is cleared"; + })(NKeysErrorCode = exports.NKeysErrorCode || (exports.NKeysErrorCode = {})); + var NKeysError = class extends Error { + constructor(code, chainedError) { + super(code); + this.name = "NKeysError"; + this.code = code; + this.chainedError = chainedError; + } + }; + exports.NKeysError = NKeysError; + } + }); + + // ../../node_modules/nkeys.js/lib/util.js + var require_util3 = __commonJS({ + "../../node_modules/nkeys.js/lib/util.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.dump = exports.decode = exports.encode = void 0; + function encode(bytes) { + return btoa(String.fromCharCode(...bytes)); + } + exports.encode = encode; + function decode(b64str) { + const bin = atob(b64str); + const bytes = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; i++) { + bytes[i] = bin.charCodeAt(i); + } + return bytes; + } + exports.decode = decode; + function dump(buf, msg) { + if (msg) { + console.log(msg); + } + let a = []; + for (let i = 0; i < buf.byteLength; i++) { + if (i % 8 === 0) { + a.push("\n"); + } + let v = buf[i].toString(16); + if (v.length === 1) { + v = "0" + v; + } + a.push(v); + } + console.log(a.join(" ")); + } + exports.dump = dump; + } + }); + + // ../../node_modules/nkeys.js/lib/mod.js + var require_mod = __commonJS({ + "../../node_modules/nkeys.js/lib/mod.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.encode = exports.decode = exports.Prefix = exports.NKeysErrorCode = exports.NKeysError = exports.fromSeed = exports.fromPublic = exports.createUser = exports.createPair = exports.createOperator = exports.createAccount = void 0; + var nkeys_1 = require_nkeys(); + Object.defineProperty(exports, "createAccount", { enumerable: true, get: function() { + return nkeys_1.createAccount; + } }); + Object.defineProperty(exports, "createOperator", { enumerable: true, get: function() { + return nkeys_1.createOperator; + } }); + Object.defineProperty(exports, "createPair", { enumerable: true, get: function() { + return nkeys_1.createPair; + } }); + Object.defineProperty(exports, "createUser", { enumerable: true, get: function() { + return nkeys_1.createUser; + } }); + Object.defineProperty(exports, "fromPublic", { enumerable: true, get: function() { + return nkeys_1.fromPublic; + } }); + Object.defineProperty(exports, "fromSeed", { enumerable: true, get: function() { + return nkeys_1.fromSeed; + } }); + Object.defineProperty(exports, "NKeysError", { enumerable: true, get: function() { + return nkeys_1.NKeysError; + } }); + Object.defineProperty(exports, "NKeysErrorCode", { enumerable: true, get: function() { + return nkeys_1.NKeysErrorCode; + } }); + Object.defineProperty(exports, "Prefix", { enumerable: true, get: function() { + return nkeys_1.Prefix; + } }); + var util_1 = require_util3(); + Object.defineProperty(exports, "decode", { enumerable: true, get: function() { + return util_1.decode; + } }); + Object.defineProperty(exports, "encode", { enumerable: true, get: function() { + return util_1.encode; + } }); + } + }); + + // ../../node_modules/nkeys.js/lib/index.js + var require_lib = __commonJS({ + "../../node_modules/nkeys.js/lib/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var nacl = require_nacl_fast(); + var helper = { + randomBytes: nacl.randomBytes, + verify: nacl.sign.detached.verify, + fromSeed: nacl.sign.keyPair.fromSeed, + sign: nacl.sign.detached + }; + if (typeof TextEncoder === "undefined") { + const util = require_util2(); + global.TextEncoder = util.TextEncoder; + global.TextDecoder = util.TextDecoder; + } + if (typeof atob === "undefined") { + global.atob = (a) => { + return Buffer.from(a, "base64").toString("binary"); + }; + global.btoa = (b) => { + return Buffer.from(b, "binary").toString("base64"); + }; + } + var { setEd25519Helper } = require_helper(); + setEd25519Helper(helper); + __exportStar(require_mod(), exports); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/nkeys.js + var require_nkeys2 = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/nkeys.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.nkeys = void 0; + exports.nkeys = require_lib(); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/mod.js + var require_mod2 = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/mod.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.toJsMsg = exports.StringCodec = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.nuid = exports.Nuid = exports.nkeyAuthenticator = exports.NatsError = exports.nanos = exports.millis = exports.Match = exports.jwtAuthenticator = exports.JSONCodec = exports.JsHeaders = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.DiscardPolicy = exports.DeliverPolicy = exports.DebugEvents = exports.credsAuthenticator = exports.createInbox = exports.consumerOpts = exports.canonicalMIMEHeaderKey = exports.Bench = exports.AdvisoryKind = exports.AckPolicy = void 0; + var internal_mod_1 = require_internal_mod(); + Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function() { + return internal_mod_1.AckPolicy; + } }); + Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function() { + return internal_mod_1.AdvisoryKind; + } }); + Object.defineProperty(exports, "Bench", { enumerable: true, get: function() { + return internal_mod_1.Bench; + } }); + Object.defineProperty(exports, "canonicalMIMEHeaderKey", { enumerable: true, get: function() { + return internal_mod_1.canonicalMIMEHeaderKey; + } }); + Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function() { + return internal_mod_1.consumerOpts; + } }); + Object.defineProperty(exports, "createInbox", { enumerable: true, get: function() { + return internal_mod_1.createInbox; + } }); + Object.defineProperty(exports, "credsAuthenticator", { enumerable: true, get: function() { + return internal_mod_1.credsAuthenticator; + } }); + Object.defineProperty(exports, "DebugEvents", { enumerable: true, get: function() { + return internal_mod_1.DebugEvents; + } }); + Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function() { + return internal_mod_1.DeliverPolicy; + } }); + Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function() { + return internal_mod_1.DiscardPolicy; + } }); + Object.defineProperty(exports, "Empty", { enumerable: true, get: function() { + return internal_mod_1.Empty; + } }); + Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function() { + return internal_mod_1.ErrorCode; + } }); + Object.defineProperty(exports, "Events", { enumerable: true, get: function() { + return internal_mod_1.Events; + } }); + Object.defineProperty(exports, "headers", { enumerable: true, get: function() { + return internal_mod_1.headers; + } }); + Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function() { + return internal_mod_1.isFlowControlMsg; + } }); + Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function() { + return internal_mod_1.isHeartbeatMsg; + } }); + Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function() { + return internal_mod_1.JsHeaders; + } }); + Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function() { + return internal_mod_1.JSONCodec; + } }); + Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function() { + return internal_mod_1.jwtAuthenticator; + } }); + Object.defineProperty(exports, "Match", { enumerable: true, get: function() { + return internal_mod_1.Match; + } }); + Object.defineProperty(exports, "millis", { enumerable: true, get: function() { + return internal_mod_1.millis; + } }); + Object.defineProperty(exports, "nanos", { enumerable: true, get: function() { + return internal_mod_1.nanos; + } }); + Object.defineProperty(exports, "NatsError", { enumerable: true, get: function() { + return internal_mod_1.NatsError; + } }); + Object.defineProperty(exports, "nkeyAuthenticator", { enumerable: true, get: function() { + return internal_mod_1.nkeyAuthenticator; + } }); + Object.defineProperty(exports, "Nuid", { enumerable: true, get: function() { + return internal_mod_1.Nuid; + } }); + Object.defineProperty(exports, "nuid", { enumerable: true, get: function() { + return internal_mod_1.nuid; + } }); + Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function() { + return internal_mod_1.ReplayPolicy; + } }); + Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function() { + return internal_mod_1.RetentionPolicy; + } }); + Object.defineProperty(exports, "StorageType", { enumerable: true, get: function() { + return internal_mod_1.StorageType; + } }); + Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function() { + return internal_mod_1.StringCodec; + } }); + Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function() { + return internal_mod_1.toJsMsg; + } }); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/authenticator.js + var require_authenticator = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/authenticator.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.credsAuthenticator = exports.jwtAuthenticator = exports.nkeyAuthenticator = exports.noAuthFn = exports.buildAuthenticator = void 0; + var nkeys_1 = require_nkeys2(); + var mod_1 = require_mod2(); + var encoders_1 = require_encoders(); + function buildAuthenticator(opts) { + if (opts.authenticator) { + return opts.authenticator; + } + if (opts.token) { + return tokenFn(opts.token); + } + if (opts.user) { + return passFn(opts.user, opts.pass); + } + return noAuthFn(); + } + exports.buildAuthenticator = buildAuthenticator; + function noAuthFn() { + return () => { + return; + }; + } + exports.noAuthFn = noAuthFn; + function passFn(user, pass) { + return () => { + return { user, pass }; + }; + } + function tokenFn(token) { + return () => { + return { auth_token: token }; + }; + } + function nkeyAuthenticator(seed) { + return (nonce) => { + seed = typeof seed === "function" ? seed() : seed; + const kp = seed ? nkeys_1.nkeys.fromSeed(seed) : void 0; + const nkey = kp ? kp.getPublicKey() : ""; + const challenge = encoders_1.TE.encode(nonce || ""); + const sigBytes = kp !== void 0 && nonce ? kp.sign(challenge) : void 0; + const sig = sigBytes ? nkeys_1.nkeys.encode(sigBytes) : ""; + return { nkey, sig }; + }; + } + exports.nkeyAuthenticator = nkeyAuthenticator; + function jwtAuthenticator(ajwt, seed) { + return (nonce) => { + const jwt = typeof ajwt === "function" ? ajwt() : ajwt; + const fn = nkeyAuthenticator(seed); + const { nkey, sig } = fn(nonce); + return { jwt, nkey, sig }; + }; + } + exports.jwtAuthenticator = jwtAuthenticator; + function credsAuthenticator(creds) { + const CREDS = /\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig; + const s = encoders_1.TD.decode(creds); + let m = CREDS.exec(s); + if (!m) { + throw mod_1.NatsError.errorForCode(mod_1.ErrorCode.BadCreds); + } + const jwt = m[1].trim(); + m = CREDS.exec(s); + if (!m) { + throw mod_1.NatsError.errorForCode(mod_1.ErrorCode.BadCreds); + } + const seed = encoders_1.TE.encode(m[1].trim()); + return jwtAuthenticator(jwt, seed); + } + exports.credsAuthenticator = credsAuthenticator; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/options.js + var require_options = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/options.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.checkUnsupportedOption = exports.checkOptions = exports.parseOptions = exports.defaultOptions = void 0; + var util_1 = require_util(); + var error_1 = require_error(); + var types_1 = require_types(); + var authenticator_1 = require_authenticator(); + var transport_1 = require_transport(); + var mod_1 = require_mod2(); + function defaultOptions() { + return { + maxPingOut: types_1.DEFAULT_MAX_PING_OUT, + maxReconnectAttempts: types_1.DEFAULT_MAX_RECONNECT_ATTEMPTS, + noRandomize: false, + pedantic: false, + pingInterval: types_1.DEFAULT_PING_INTERVAL, + reconnect: true, + reconnectJitter: types_1.DEFAULT_JITTER, + reconnectJitterTLS: types_1.DEFAULT_JITTER_TLS, + reconnectTimeWait: types_1.DEFAULT_RECONNECT_TIME_WAIT, + tls: void 0, + verbose: false, + waitOnFirstConnect: false + }; + } + exports.defaultOptions = defaultOptions; + function parseOptions(opts) { + const dhp = `${types_1.DEFAULT_HOST}:${transport_1.defaultPort()}`; + opts = opts || { servers: [dhp] }; + if (opts.port) { + opts.servers = [`${types_1.DEFAULT_HOST}:${opts.port}`]; + } + if (typeof opts.servers === "string") { + opts.servers = [opts.servers]; + } + if (opts.servers && opts.servers.length === 0) { + opts.servers = [dhp]; + } + const options = util_1.extend(defaultOptions(), opts); + if (opts.user && opts.token) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication); + } + if (opts.authenticator && (opts.token || opts.user || opts.pass)) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication); + } + options.authenticator = authenticator_1.buildAuthenticator(options); + ["reconnectDelayHandler", "authenticator"].forEach((n) => { + if (options[n] && typeof options[n] !== "function") { + throw new error_1.NatsError(`${n} option should be a function`, error_1.ErrorCode.NotFunction); + } + }); + if (!options.reconnectDelayHandler) { + options.reconnectDelayHandler = () => { + let extra = options.tls ? options.reconnectJitterTLS : options.reconnectJitter; + if (extra) { + extra++; + extra = Math.floor(Math.random() * extra); + } + return options.reconnectTimeWait + extra; + }; + } + if (options.inboxPrefix) { + try { + mod_1.createInbox(options.inboxPrefix); + } catch (err) { + throw new error_1.NatsError(err.message, error_1.ErrorCode.ApiError); + } + } + return options; + } + exports.parseOptions = parseOptions; + function checkOptions(info, options) { + const { proto, tls_required: tlsRequired } = info; + if ((proto === void 0 || proto < 1) && options.noEcho) { + throw new error_1.NatsError("noEcho", error_1.ErrorCode.ServerOptionNotAvailable); + } + if (options.tls && !tlsRequired) { + throw new error_1.NatsError("tls", error_1.ErrorCode.ServerOptionNotAvailable); + } + } + exports.checkOptions = checkOptions; + function checkUnsupportedOption(prop, v) { + if (v) { + throw new error_1.NatsError(prop, error_1.ErrorCode.InvalidOption); + } + } + exports.checkUnsupportedOption = checkUnsupportedOption; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/request.js + var require_request = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/request.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Request = void 0; + var util_1 = require_util(); + var error_1 = require_error(); + var nuid_1 = require_nuid(); + var Request = class { + constructor(mux, opts = { timeout: 1e3 }) { + this.mux = mux; + this.received = 0; + this.deferred = util_1.deferred(); + this.token = nuid_1.nuid.next(); + util_1.extend(this, opts); + this.timer = util_1.timeout(opts.timeout); + } + resolver(err, msg) { + if (this.timer) { + this.timer.cancel(); + } + if (err) { + this.deferred.reject(err); + } else { + this.deferred.resolve(msg); + } + this.cancel(); + } + cancel(err) { + if (this.timer) { + this.timer.cancel(); + } + this.mux.cancel(this); + this.deferred.reject(err ? err : error_1.NatsError.errorForCode(error_1.ErrorCode.Cancelled)); + } + }; + exports.Request = Request; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/codec.js + var require_codec2 = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/codec.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JSONCodec = exports.StringCodec = void 0; + var error_1 = require_error(); + var encoders_1 = require_encoders(); + function StringCodec() { + return { + encode(d) { + return encoders_1.TE.encode(d); + }, + decode(a) { + return encoders_1.TD.decode(a); + } + }; + } + exports.StringCodec = StringCodec; + function JSONCodec() { + return { + encode(d) { + try { + if (d === void 0) { + d = null; + } + return encoders_1.TE.encode(JSON.stringify(d)); + } catch (err) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadJson, err); + } + }, + decode(a) { + try { + return JSON.parse(encoders_1.TD.decode(a)); + } catch (err) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadJson, err); + } + } + }; + } + exports.JSONCodec = JSONCodec; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsutil.js + var require_jsutil = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsutil.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.checkJsErrorCode = exports.checkJsError = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; + var types_1 = require_types(); + var error_1 = require_error(); + function validateDurableName(name) { + return validateName("durable", name); + } + exports.validateDurableName = validateDurableName; + function validateStreamName(name) { + return validateName("stream", name); + } + exports.validateStreamName = validateStreamName; + function validateName(context, name = "") { + if (name === "") { + throw Error(`${context} name required`); + } + const bad = [".", "*", ">"]; + bad.forEach((v) => { + if (name.indexOf(v) !== -1) { + throw Error(`invalid ${context} name - ${context} name cannot contain '${v}'`); + } + }); + } + exports.validateName = validateName; + function defaultConsumer(name, opts = {}) { + return Object.assign({ + name, + deliver_policy: types_1.DeliverPolicy.All, + ack_policy: types_1.AckPolicy.Explicit, + ack_wait: nanos(30 * 1e3), + replay_policy: types_1.ReplayPolicy.Instant + }, opts); + } + exports.defaultConsumer = defaultConsumer; + function nanos(millis2) { + return millis2 * 1e6; + } + exports.nanos = nanos; + function millis(ns) { + return ns / 1e6; + } + exports.millis = millis; + function isFlowControlMsg(msg) { + const h = msg.headers; + if (!h) { + return false; + } + return h.code >= 100 && h.code < 200; + } + exports.isFlowControlMsg = isFlowControlMsg; + function isHeartbeatMsg(msg) { + var _a; + return isFlowControlMsg(msg) && ((_a = msg.headers) === null || _a === void 0 ? void 0 : _a.description) === "Idle Heartbeat"; + } + exports.isHeartbeatMsg = isHeartbeatMsg; + function checkJsError(msg) { + const h = msg.headers; + if (!h) { + return null; + } + return checkJsErrorCode(h.code, h.status); + } + exports.checkJsError = checkJsError; + function checkJsErrorCode(code, description = "") { + if (code < 300) { + return null; + } + description = description.toLowerCase(); + switch (code) { + case 503: + return error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamNotEnabled, new Error(description)); + default: + if (description === "") { + description = error_1.ErrorCode.Unknown; + } + return new error_1.NatsError(description, `${code}`); + } + } + exports.checkJsErrorCode = checkJsErrorCode; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsbaseclient_api.js + var require_jsbaseclient_api = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsbaseclient_api.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.BaseApiClient = exports.defaultJsOptions = void 0; + var types_1 = require_types(); + var codec_1 = require_codec2(); + var util_1 = require_util(); + var jsutil_1 = require_jsutil(); + var defaultPrefix = "$JS.API"; + var defaultTimeout = 5e3; + function defaultJsOptions(opts) { + opts = opts || {}; + if (opts.domain) { + opts.apiPrefix = `$JS.${opts.domain}.API`; + delete opts.domain; + } + return util_1.extend({ apiPrefix: defaultPrefix, timeout: defaultTimeout }, opts); + } + exports.defaultJsOptions = defaultJsOptions; + var BaseApiClient = class { + constructor(nc, opts) { + this.nc = nc; + this.opts = defaultJsOptions(opts); + this._parseOpts(); + this.prefix = this.opts.apiPrefix; + this.timeout = this.opts.timeout; + this.jc = codec_1.JSONCodec(); + } + _parseOpts() { + let prefix = this.opts.apiPrefix; + if (!prefix || prefix.length === 0) { + throw new Error("invalid empty prefix"); + } + const c = prefix[prefix.length - 1]; + if (c === ".") { + prefix = prefix.substr(0, prefix.length - 1); + } + this.opts.apiPrefix = prefix; + } + _request(subj, data = null, opts) { + return __awaiter(this, void 0, void 0, function* () { + opts = opts || {}; + opts.timeout = this.timeout; + let a = types_1.Empty; + if (data) { + a = this.jc.encode(data); + } + const m = yield this.nc.request(subj, a, opts); + return this.parseJsResponse(m); + }); + } + findStream(subject) { + return __awaiter(this, void 0, void 0, function* () { + const q = { subject }; + const r = yield this._request(`${this.prefix}.STREAM.NAMES`, q); + const names = r; + if (!names.streams || names.streams.length !== 1) { + throw new Error("no stream matches subject"); + } + return names.streams[0]; + }); + } + parseJsResponse(m) { + const v = this.jc.decode(m.data); + const r = v; + if (r.error) { + const err = jsutil_1.checkJsErrorCode(r.error.code, r.error.description); + if (err !== null) { + throw err; + } + } + return v; + } + }; + exports.BaseApiClient = BaseApiClient; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jslister.js + var require_jslister = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jslister.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __await = exports && exports.__await || function(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function verb(n) { + if (g[n]) + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + } + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f, v) { + if (f(v), q.shift(), q.length) + resume(q[0][0], q[0][1]); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ListerImpl = void 0; + var ListerImpl = class { + constructor(subject, filter, jsm) { + if (!subject) { + throw new Error("subject is required"); + } + this.subject = subject; + this.jsm = jsm; + this.offset = 0; + this.pageInfo = {}; + this.filter = filter; + } + next() { + return __awaiter(this, void 0, void 0, function* () { + if (this.err) { + return []; + } + if (this.pageInfo && this.offset >= this.pageInfo.total) { + return []; + } + const offset = { offset: this.offset }; + try { + const r = yield this.jsm._request(this.subject, offset, { timeout: this.jsm.timeout }); + this.pageInfo = r; + const a = this.filter(r); + this.offset += a.length; + return a; + } catch (err) { + this.err = err; + throw err; + } + }); + } + [Symbol.asyncIterator]() { + return __asyncGenerator(this, arguments, function* _a() { + let page = yield __await(this.next()); + while (page.length > 0) { + for (const item of page) { + yield yield __await(item); + } + page = yield __await(this.next()); + } + }); + } + }; + exports.ListerImpl = ListerImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsstream_api.js + var require_jsstream_api = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsstream_api.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.StoredMsgImpl = exports.StreamAPIImpl = void 0; + var types_1 = require_types(); + var jsbaseclient_api_1 = require_jsbaseclient_api(); + var jslister_1 = require_jslister(); + var jsutil_1 = require_jsutil(); + var headers_1 = require_headers(); + var StreamAPIImpl = class extends jsbaseclient_api_1.BaseApiClient { + constructor(nc, opts) { + super(nc, opts); + } + add(cfg = {}) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(cfg.name); + const r = yield this._request(`${this.prefix}.STREAM.CREATE.${cfg.name}`, cfg); + return r; + }); + } + delete(stream) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + const r = yield this._request(`${this.prefix}.STREAM.DELETE.${stream}`); + const cr = r; + return cr.success; + }); + } + update(cfg = {}) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(cfg.name); + const r = yield this._request(`${this.prefix}.STREAM.UPDATE.${cfg.name}`, cfg); + return r; + }); + } + info(name, data) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(name); + const r = yield this._request(`${this.prefix}.STREAM.INFO.${name}`, data); + return r; + }); + } + list() { + const filter = (v) => { + const slr = v; + return slr.streams; + }; + const subj = `${this.prefix}.STREAM.LIST`; + return new jslister_1.ListerImpl(subj, filter, this); + } + purge(name, opts) { + return __awaiter(this, void 0, void 0, function* () { + if (opts) { + const { keep, seq } = opts; + if (typeof keep === "number" && typeof seq === "number") { + throw new Error("can specify one of keep or seq"); + } + } + jsutil_1.validateStreamName(name); + const v = yield this._request(`${this.prefix}.STREAM.PURGE.${name}`, opts); + return v; + }); + } + deleteMessage(stream, seq, erase = true) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + const dr = { seq }; + if (!erase) { + dr.no_erase = true; + } + const r = yield this._request(`${this.prefix}.STREAM.MSG.DELETE.${stream}`, dr); + const cr = r; + return cr.success; + }); + } + getMessage(stream, query) { + return __awaiter(this, void 0, void 0, function* () { + if (typeof query === "number") { + console.log(`\x1B[33m [WARN] jsm.getMessage(number) is deprecated and will be removed on release - use \`{seq: number}\` as an argument \x1B[0m`); + query = { seq: query }; + } + jsutil_1.validateStreamName(stream); + const r = yield this._request(`${this.prefix}.STREAM.MSG.GET.${stream}`, query); + const sm = r; + return new StoredMsgImpl(sm); + }); + } + find(subject) { + return this.findStream(subject); + } + }; + exports.StreamAPIImpl = StreamAPIImpl; + var StoredMsgImpl = class { + constructor(smr) { + this.subject = smr.message.subject; + this.seq = smr.message.seq; + this.time = new Date(smr.message.time); + this.data = smr.message.data ? this._parse(smr.message.data) : types_1.Empty; + if (smr.message.hdrs) { + const hd = this._parse(smr.message.hdrs); + this.header = headers_1.MsgHdrsImpl.decode(hd); + } else { + this.header = headers_1.headers(); + } + } + _parse(s) { + const bs = atob(s); + const len = bs.length; + const bytes = new Uint8Array(len); + for (let i = 0; i < len; i++) { + bytes[i] = bs.charCodeAt(i); + } + return bytes; + } + }; + exports.StoredMsgImpl = StoredMsgImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsconsumer_api.js + var require_jsconsumer_api = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsconsumer_api.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.ConsumerAPIImpl = void 0; + var jsbaseclient_api_1 = require_jsbaseclient_api(); + var jslister_1 = require_jslister(); + var jsutil_1 = require_jsutil(); + var ConsumerAPIImpl = class extends jsbaseclient_api_1.BaseApiClient { + constructor(nc, opts) { + super(nc, opts); + } + add(stream, cfg) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + const cr = {}; + cr.config = cfg; + cr.stream_name = stream; + if (cr.config.durable_name) { + jsutil_1.validateDurableName(cr.config.durable_name); + } + const subj = cfg.durable_name ? `${this.prefix}.CONSUMER.DURABLE.CREATE.${stream}.${cfg.durable_name}` : `${this.prefix}.CONSUMER.CREATE.${stream}`; + const r = yield this._request(subj, cr); + return r; + }); + } + info(stream, name) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + jsutil_1.validateDurableName(name); + const r = yield this._request(`${this.prefix}.CONSUMER.INFO.${stream}.${name}`); + return r; + }); + } + delete(stream, name) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + jsutil_1.validateDurableName(name); + const r = yield this._request(`${this.prefix}.CONSUMER.DELETE.${stream}.${name}`); + const cr = r; + return cr.success; + }); + } + list(stream) { + jsutil_1.validateStreamName(stream); + const filter = (v) => { + const clr = v; + return clr.consumers; + }; + const subj = `${this.prefix}.CONSUMER.LIST.${stream}`; + return new jslister_1.ListerImpl(subj, filter, this); + } + }; + exports.ConsumerAPIImpl = ConsumerAPIImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsm.js + var require_jsm = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsm.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JetStreamManagerImpl = void 0; + var jsbaseclient_api_1 = require_jsbaseclient_api(); + var jsstream_api_1 = require_jsstream_api(); + var jsconsumer_api_1 = require_jsconsumer_api(); + var queued_iterator_1 = require_queued_iterator(); + var JetStreamManagerImpl = class extends jsbaseclient_api_1.BaseApiClient { + constructor(nc, opts) { + super(nc, opts); + this.streams = new jsstream_api_1.StreamAPIImpl(nc, opts); + this.consumers = new jsconsumer_api_1.ConsumerAPIImpl(nc, opts); + } + getAccountInfo() { + return __awaiter(this, void 0, void 0, function* () { + const r = yield this._request(`${this.prefix}.INFO`); + return r; + }); + } + advisories() { + const iter = new queued_iterator_1.QueuedIteratorImpl(); + this.nc.subscribe(`$JS.EVENT.ADVISORY.>`, { + callback: (err, msg) => { + if (err) { + throw err; + } + try { + const d = this.parseJsResponse(msg); + const chunks = d.type.split("."); + const kind = chunks[chunks.length - 1]; + iter.push({ kind, data: d }); + } catch (err2) { + iter.stop(err2); + } + } + }); + return iter; + } + }; + exports.JetStreamManagerImpl = JetStreamManagerImpl; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsmsg.js + var require_jsmsg = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsmsg.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.parseInfo = exports.toJsMsg = exports.ACK = void 0; + var databuffer_1 = require_databuffer(); + var codec_1 = require_codec2(); + var request_1 = require_request(); + exports.ACK = Uint8Array.of(43, 65, 67, 75); + var NAK = Uint8Array.of(45, 78, 65, 75); + var WPI = Uint8Array.of(43, 87, 80, 73); + var NXT = Uint8Array.of(43, 78, 88, 84); + var TERM = Uint8Array.of(43, 84, 69, 82, 77); + var SPACE = Uint8Array.of(32); + function toJsMsg(m) { + return new JsMsgImpl(m); + } + exports.toJsMsg = toJsMsg; + function parseInfo(s) { + const tokens = s.split("."); + if (tokens.length !== 9 && tokens[0] !== "$JS" && tokens[1] !== "ACK") { + throw new Error(`not js message`); + } + const di = {}; + di.stream = tokens[2]; + di.consumer = tokens[3]; + di.redeliveryCount = parseInt(tokens[4], 10); + di.streamSequence = parseInt(tokens[5], 10); + di.deliverySequence = parseInt(tokens[6], 10); + di.timestampNanos = parseInt(tokens[7], 10); + di.pending = parseInt(tokens[8], 10); + return di; + } + exports.parseInfo = parseInfo; + var JsMsgImpl = class { + constructor(msg) { + this.msg = msg; + this.didAck = false; + } + get subject() { + return this.msg.subject; + } + get sid() { + return this.msg.sid; + } + get data() { + return this.msg.data; + } + get headers() { + return this.msg.headers; + } + get info() { + if (!this.di) { + this.di = parseInfo(this.reply); + } + return this.di; + } + get redelivered() { + return this.info.redeliveryCount > 1; + } + get reply() { + return this.msg.reply || ""; + } + get seq() { + return this.info.streamSequence; + } + doAck(payload) { + if (!this.didAck) { + this.didAck = !this.isWIP(payload); + this.msg.respond(payload); + } + } + isWIP(p) { + return p.length === 4 && p[0] === WPI[0] && p[1] === WPI[1] && p[2] === WPI[2] && p[3] === WPI[3]; + } + ackAck() { + return __awaiter(this, void 0, void 0, function* () { + if (!this.didAck) { + this.didAck = true; + if (this.msg.reply) { + const mi = this.msg; + const proto = mi.publisher; + const r = new request_1.Request(proto.muxSubscriptions); + proto.request(r); + try { + proto.publish(this.msg.reply, exports.ACK, { + reply: `${proto.muxSubscriptions.baseInbox}${r.token}` + }); + } catch (err) { + r.cancel(err); + } + try { + yield Promise.race([r.timer, r.deferred]); + return true; + } catch (err) { + r.cancel(err); + } + } + } + return false; + }); + } + ack() { + this.doAck(exports.ACK); + } + nak() { + this.doAck(NAK); + } + working() { + this.doAck(WPI); + } + next(subj, ro) { + let payload = NXT; + if (ro) { + const data = codec_1.JSONCodec().encode(ro); + payload = databuffer_1.DataBuffer.concat(NXT, SPACE, data); + } + const opts = subj ? { reply: subj } : void 0; + this.msg.respond(payload, opts); + } + term() { + this.doAck(TERM); + } + }; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/typedsub.js + var require_typedsub = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/typedsub.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.TypedSubscription = exports.checkFn = void 0; + var util_1 = require_util(); + var queued_iterator_1 = require_queued_iterator(); + var error_1 = require_error(); + function checkFn(fn, name, required = false) { + if (required === true && !fn) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ApiError, new Error(`${name} is not a function`)); + } + if (fn && typeof fn !== "function") { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ApiError, new Error(`${name} is not a function`)); + } + } + exports.checkFn = checkFn; + var TypedSubscription = class extends queued_iterator_1.QueuedIteratorImpl { + constructor(nc, subject, opts) { + super(); + checkFn(opts.adapter, "adapter", true); + this.adapter = opts.adapter; + if (opts.callback) { + checkFn(opts.callback, "callback"); + } + this.noIterator = typeof opts.callback === "function"; + if (opts.dispatchedFn) { + checkFn(opts.dispatchedFn, "dispatchedFn"); + this.dispatchedFn = opts.dispatchedFn; + } + if (opts.cleanupFn) { + checkFn(opts.cleanupFn, "cleanupFn"); + } + let callback = (err, msg) => { + this.callback(err, msg); + }; + if (opts.callback) { + const uh = opts.callback; + callback = (err, msg) => { + const [jer, tm] = this.adapter(err, msg); + uh(jer, tm); + if (this.dispatchedFn && tm) { + this.dispatchedFn(tm); + } + }; + } + const { max, queue, timeout } = opts; + const sopts = { queue, timeout, callback }; + if (max && max > 0) { + sopts.max = max; + } + this.sub = nc.subscribe(subject, sopts); + if (opts.cleanupFn) { + this.sub.cleanupFn = opts.cleanupFn; + } + this.subIterDone = util_1.deferred(); + Promise.all([this.sub.closed, this.iterClosed]).then(() => { + this.subIterDone.resolve(); + }).catch(() => { + this.subIterDone.resolve(); + }); + ((s) => __awaiter(this, void 0, void 0, function* () { + yield s.closed; + this.stop(); + }))(this.sub).then().catch(); + } + unsubscribe(max) { + this.sub.unsubscribe(max); + } + drain() { + return this.sub.drain(); + } + isDraining() { + return this.sub.isDraining(); + } + isClosed() { + return this.sub.isClosed(); + } + callback(e, msg) { + this.sub.cancelTimeout(); + const [err, tm] = this.adapter(e, msg); + if (err) { + this.stop(err); + } + if (tm) { + this.push(tm); + } + } + getSubject() { + return this.sub.getSubject(); + } + getReceived() { + return this.sub.getReceived(); + } + getProcessed() { + return this.sub.getProcessed(); + } + getPending() { + return this.sub.getPending(); + } + getID() { + return this.sub.getID(); + } + getMax() { + return this.sub.getMax(); + } + get closed() { + return this.sub.closed; + } + }; + exports.TypedSubscription = TypedSubscription; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsconsumeropts.js + var require_jsconsumeropts = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsconsumeropts.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.isConsumerOptsBuilder = exports.ConsumerOptsBuilderImpl = exports.consumerOpts = void 0; + var types_1 = require_types(); + var jsutil_1 = require_jsutil(); + function consumerOpts(opts) { + return new ConsumerOptsBuilderImpl(opts); + } + exports.consumerOpts = consumerOpts; + var ConsumerOptsBuilderImpl = class { + constructor(opts) { + this.stream = ""; + this.mack = false; + this.config = jsutil_1.defaultConsumer("", opts || {}); + this.config.ack_policy = types_1.AckPolicy.All; + } + getOpts() { + const o = {}; + o.config = this.config; + o.mack = this.mack; + o.stream = this.stream; + o.callbackFn = this.callbackFn; + o.max = this.max; + o.queue = this.qname; + return o; + } + deliverTo(subject) { + this.config.deliver_subject = subject; + } + manualAck() { + this.mack = true; + } + durable(name) { + jsutil_1.validateDurableName(name); + this.config.durable_name = name; + } + deliverAll() { + this.config.deliver_policy = types_1.DeliverPolicy.All; + } + deliverLast() { + this.config.deliver_policy = types_1.DeliverPolicy.Last; + } + deliverNew() { + this.config.deliver_policy = types_1.DeliverPolicy.New; + } + startSequence(seq) { + if (seq <= 0) { + throw new Error("sequence must be greater than 0"); + } + this.config.deliver_policy = types_1.DeliverPolicy.StartSequence; + this.config.opt_start_seq = seq; + } + startTime(time) { + this.config.deliver_policy = types_1.DeliverPolicy.StartTime; + this.config.opt_start_time = time.toISOString(); + } + ackNone() { + this.config.ack_policy = types_1.AckPolicy.None; + } + ackAll() { + this.config.ack_policy = types_1.AckPolicy.All; + } + ackExplicit() { + this.config.ack_policy = types_1.AckPolicy.Explicit; + } + maxDeliver(max) { + this.config.max_deliver = max; + } + maxAckPending(max) { + this.config.max_ack_pending = max; + } + maxWaiting(max) { + this.config.max_waiting = max; + } + maxMessages(max) { + this.max = max; + } + callback(fn) { + this.callbackFn = fn; + } + queue(n) { + this.qname = n; + } + idleHeartbeat(millis) { + this.config.idle_heartbeat = jsutil_1.nanos(millis); + } + flowControl() { + this.config.flow_control = true; + } + }; + exports.ConsumerOptsBuilderImpl = ConsumerOptsBuilderImpl; + function isConsumerOptsBuilder(o) { + return typeof o.getOpts === "function"; + } + exports.isConsumerOptsBuilder = isConsumerOptsBuilder; + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/jsclient.js + var require_jsclient = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/jsclient.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.JetStreamClientImpl = void 0; + var types_1 = require_types(); + var jsbaseclient_api_1 = require_jsbaseclient_api(); + var jsutil_1 = require_jsutil(); + var jsconsumer_api_1 = require_jsconsumer_api(); + var jsmsg_1 = require_jsmsg(); + var typedsub_1 = require_typedsub(); + var error_1 = require_error(); + var queued_iterator_1 = require_queued_iterator(); + var util_1 = require_util(); + var protocol_1 = require_protocol(); + var headers_1 = require_headers(); + var jsconsumeropts_1 = require_jsconsumeropts(); + var PubHeaders; + (function(PubHeaders2) { + PubHeaders2["MsgIdHdr"] = "Nats-Msg-Id"; + PubHeaders2["ExpectedStreamHdr"] = "Nats-Expected-Stream"; + PubHeaders2["ExpectedLastSeqHdr"] = "Nats-Expected-Last-Sequence"; + PubHeaders2["ExpectedLastMsgIdHdr"] = "Nats-Expected-Last-Msg-Id"; + PubHeaders2["ExpectedLastSubjectSequenceHdr"] = "Nats-Expected-Last-Subject-Sequence"; + })(PubHeaders || (PubHeaders = {})); + var JetStreamClientImpl = class extends jsbaseclient_api_1.BaseApiClient { + constructor(nc, opts) { + super(nc, opts); + this.api = new jsconsumer_api_1.ConsumerAPIImpl(nc, opts); + } + publish(subj, data = types_1.Empty, opts) { + return __awaiter(this, void 0, void 0, function* () { + opts = opts || {}; + opts.expect = opts.expect || {}; + const mh = (opts === null || opts === void 0 ? void 0 : opts.headers) || headers_1.headers(); + if (opts) { + if (opts.msgID) { + mh.set(PubHeaders.MsgIdHdr, opts.msgID); + } + if (opts.expect.lastMsgID) { + mh.set(PubHeaders.ExpectedLastMsgIdHdr, opts.expect.lastMsgID); + } + if (opts.expect.streamName) { + mh.set(PubHeaders.ExpectedStreamHdr, opts.expect.streamName); + } + if (opts.expect.lastSequence) { + mh.set(PubHeaders.ExpectedLastSeqHdr, `${opts.expect.lastSequence}`); + } + if (opts.expect.lastSubjectSequence) { + mh.set(PubHeaders.ExpectedLastSubjectSequenceHdr, `${opts.expect.lastSubjectSequence}`); + } + } + const to = opts.timeout || this.timeout; + const ro = {}; + if (to) { + ro.timeout = to; + } + if (opts) { + ro.headers = mh; + } + const r = yield this.nc.request(subj, data, ro); + const pa = this.parseJsResponse(r); + if (pa.stream === "") { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamInvalidAck); + } + pa.duplicate = pa.duplicate ? pa.duplicate : false; + return pa; + }); + } + pull(stream, durable) { + return __awaiter(this, void 0, void 0, function* () { + jsutil_1.validateStreamName(stream); + jsutil_1.validateDurableName(durable); + const msg = yield this.nc.request( + `${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, + this.jc.encode({ no_wait: true, batch: 1, expires: jsutil_1.nanos(this.timeout) }), + { noMux: true, timeout: this.timeout } + ); + const err = jsutil_1.checkJsError(msg); + if (err) { + throw err; + } + return jsmsg_1.toJsMsg(msg); + }); + } + fetch(stream, durable, opts = {}) { + jsutil_1.validateStreamName(stream); + jsutil_1.validateDurableName(durable); + let timer = null; + const args = {}; + args.batch = opts.batch || 1; + args.no_wait = opts.no_wait || false; + const expires = opts.expires || 0; + if (expires) { + args.expires = jsutil_1.nanos(expires); + } + if (expires === 0 && args.no_wait === false) { + throw new Error("expires or no_wait is required"); + } + const qi = new queued_iterator_1.QueuedIteratorImpl(); + const wants = args.batch; + let received = 0; + qi.dispatchedFn = (m) => { + if (m) { + received++; + if (timer && m.info.pending === 0) { + return; + } + if (qi.getPending() === 1 && m.info.pending === 0 || wants === received) { + qi.stop(); + } + } + }; + const inbox = protocol_1.createInbox(this.nc.options.inboxPrefix); + const sub = this.nc.subscribe(inbox, { + max: opts.batch, + callback: (err, msg) => { + if (err === null) { + err = jsutil_1.checkJsError(msg); + } + if (err !== null) { + if (timer) { + timer.cancel(); + timer = null; + } + if (error_1.isNatsError(err) && err.code === error_1.ErrorCode.JetStream404NoMessages) { + qi.stop(); + } else { + qi.stop(err); + } + } else { + qi.received++; + qi.push(jsmsg_1.toJsMsg(msg)); + } + } + }); + if (expires) { + timer = util_1.timeout(expires); + timer.catch(() => { + if (!sub.isClosed()) { + sub.drain(); + timer = null; + } + }); + } + (() => __awaiter(this, void 0, void 0, function* () { + yield sub.closed; + if (timer !== null) { + timer.cancel(); + timer = null; + } + qi.stop(); + }))().catch(); + this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, this.jc.encode(args), { reply: inbox }); + return qi; + } + pullSubscribe(subject, opts = jsconsumeropts_1.consumerOpts()) { + return __awaiter(this, void 0, void 0, function* () { + const cso = yield this._processOptions(subject, opts); + if (!cso.attached) { + cso.config.filter_subject = subject; + } + if (cso.config.deliver_subject) { + throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set"); + } + const ackPolicy = cso.config.ack_policy; + if (ackPolicy === types_1.AckPolicy.None || ackPolicy === types_1.AckPolicy.All) { + throw new Error("ack policy for pull consumers must be explicit"); + } + const so = this._buildTypedSubscriptionOpts(cso); + const sub = new JetStreamPullSubscriptionImpl(this, cso.deliver, so); + try { + yield this._maybeCreateConsumer(cso); + } catch (err) { + sub.unsubscribe(); + throw err; + } + sub.info = cso; + return sub; + }); + } + subscribe(subject, opts = jsconsumeropts_1.consumerOpts()) { + return __awaiter(this, void 0, void 0, function* () { + const cso = yield this._processOptions(subject, opts); + if (!cso.config.deliver_subject) { + throw new Error("consumer info specifies a pull consumer - deliver_subject is required"); + } + const so = this._buildTypedSubscriptionOpts(cso); + const sub = new JetStreamSubscriptionImpl(this, cso.deliver, so); + try { + yield this._maybeCreateConsumer(cso); + } catch (err) { + sub.unsubscribe(); + throw err; + } + sub.info = cso; + return sub; + }); + } + _processOptions(subject, opts = jsconsumeropts_1.consumerOpts()) { + return __awaiter(this, void 0, void 0, function* () { + const jsi = jsconsumeropts_1.isConsumerOptsBuilder(opts) ? opts.getOpts() : opts; + jsi.api = this; + jsi.config = jsi.config || {}; + jsi.stream = jsi.stream ? jsi.stream : yield this.findStream(subject); + jsi.attached = false; + if (jsi.config.durable_name) { + try { + const info = yield this.api.info(jsi.stream, jsi.config.durable_name); + if (info) { + if (info.config.filter_subject && info.config.filter_subject !== subject) { + throw new Error("subject does not match consumer"); + } + jsi.config = info.config; + jsi.attached = true; + } + } catch (err) { + if (err.code !== "404") { + throw err; + } + } + } + if (!jsi.attached) { + jsi.config.filter_subject = subject; + } + jsi.deliver = jsi.config.deliver_subject || protocol_1.createInbox(this.nc.options.inboxPrefix); + return jsi; + }); + } + _buildTypedSubscriptionOpts(jsi) { + const so = {}; + so.adapter = msgAdapter(jsi.callbackFn === void 0); + if (jsi.callbackFn) { + so.callback = jsi.callbackFn; + } + if (!jsi.mack) { + so.dispatchedFn = autoAckJsMsg; + } + so.max = jsi.max || 0; + so.queue = jsi.queue; + return so; + } + _maybeCreateConsumer(jsi) { + return __awaiter(this, void 0, void 0, function* () { + if (jsi.attached) { + return; + } + jsi.config = Object.assign({ + deliver_policy: types_1.DeliverPolicy.All, + ack_policy: types_1.AckPolicy.Explicit, + ack_wait: jsutil_1.nanos(30 * 1e3), + replay_policy: types_1.ReplayPolicy.Instant + }, jsi.config); + const ci = yield this.api.add(jsi.stream, jsi.config); + jsi.name = ci.name; + jsi.config = ci.config; + }); + } + }; + exports.JetStreamClientImpl = JetStreamClientImpl; + var JetStreamSubscriptionImpl = class extends typedsub_1.TypedSubscription { + constructor(js, subject, opts) { + super(js.nc, subject, opts); + } + set info(info) { + this.sub.info = info; + } + get info() { + return this.sub.info; + } + destroy() { + return __awaiter(this, void 0, void 0, function* () { + if (!this.isClosed()) { + yield this.drain(); + } + const jinfo = this.sub.info; + const name = jinfo.config.durable_name || jinfo.name; + const subj = `${jinfo.api.prefix}.CONSUMER.DELETE.${jinfo.stream}.${name}`; + yield jinfo.api._request(subj); + }); + } + consumerInfo() { + return __awaiter(this, void 0, void 0, function* () { + const jinfo = this.sub.info; + const name = jinfo.config.durable_name || jinfo.name; + const subj = `${jinfo.api.prefix}.CONSUMER.INFO.${jinfo.stream}.${name}`; + return yield jinfo.api._request(subj); + }); + } + }; + var JetStreamPullSubscriptionImpl = class extends JetStreamSubscriptionImpl { + constructor(js, subject, opts) { + super(js, subject, opts); + } + pull(opts = { batch: 1 }) { + const { stream, config } = this.sub.info; + const consumer = config.durable_name; + const args = {}; + args.batch = opts.batch || 1; + args.no_wait = opts.no_wait || false; + if (opts.expires && opts.expires > 0) { + args.expires = opts.expires; + } + if (this.info) { + const api = this.info.api; + const subj = `${api.prefix}.CONSUMER.MSG.NEXT.${stream}.${consumer}`; + const reply = this.sub.subject; + api.nc.publish(subj, api.jc.encode(args), { reply }); + } + } + }; + function msgAdapter(iterator) { + if (iterator) { + return iterMsgAdapter; + } else { + return cbMsgAdapter; + } + } + function cbMsgAdapter(err, msg) { + if (err) { + return [err, null]; + } + err = jsutil_1.checkJsError(msg); + if (err) { + return [err, null]; + } + if (jsutil_1.isFlowControlMsg(msg)) { + msg.respond(); + return [null, null]; + } + const jm = jsmsg_1.toJsMsg(msg); + try { + jm.info; + return [null, jm]; + } catch (err2) { + return [err2, null]; + } + } + function iterMsgAdapter(err, msg) { + if (err) { + return [err, null]; + } + const ne = jsutil_1.checkJsError(msg); + if (ne !== null) { + switch (ne.code) { + case error_1.ErrorCode.JetStream404NoMessages: + case error_1.ErrorCode.JetStream408RequestTimeout: + case error_1.ErrorCode.JetStream409MaxAckPendingExceeded: + return [null, null]; + default: + return [ne, null]; + } + } + if (jsutil_1.isFlowControlMsg(msg)) { + msg.respond(); + return [null, null]; + } + const jm = jsmsg_1.toJsMsg(msg); + try { + jm.info; + return [null, jm]; + } catch (err2) { + return [err2, null]; + } + } + function autoAckJsMsg(data) { + if (data) { + data.ack(); + } + } + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/nats.js + var require_nats = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/nats.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __asyncValues = exports && exports.__asyncValues || function(o) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.NatsConnectionImpl = void 0; + var util_1 = require_util(); + var protocol_1 = require_protocol(); + var subscription_1 = require_subscription(); + var error_1 = require_error(); + var types_1 = require_types(); + var options_1 = require_options(); + var queued_iterator_1 = require_queued_iterator(); + var request_1 = require_request(); + var msg_1 = require_msg(); + var jsm_1 = require_jsm(); + var jsclient_1 = require_jsclient(); + var NatsConnectionImpl = class { + constructor(opts) { + this.draining = false; + this.options = options_1.parseOptions(opts); + this.listeners = []; + } + static connect(opts = {}) { + return new Promise((resolve, reject) => { + const nc = new NatsConnectionImpl(opts); + protocol_1.ProtocolHandler.connect(nc.options, nc).then((ph) => { + nc.protocol = ph; + (function() { + var e_1, _a; + return __awaiter(this, void 0, void 0, function* () { + try { + for (var _b = __asyncValues(ph.status()), _c; _c = yield _b.next(), !_c.done; ) { + const s = _c.value; + nc.listeners.forEach((l) => { + l.push(s); + }); + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (_c && !_c.done && (_a = _b.return)) + yield _a.call(_b); + } finally { + if (e_1) + throw e_1.error; + } + } + }); + })(); + resolve(nc); + }).catch((err) => { + reject(err); + }); + }); + } + closed() { + return this.protocol.closed; + } + close() { + return __awaiter(this, void 0, void 0, function* () { + yield this.protocol.close(); + }); + } + publish(subject, data = types_1.Empty, options) { + subject = subject || ""; + if (subject.length === 0) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject); + } + if (data && !util_1.isUint8Array(data)) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadPayload); + } + this.protocol.publish(subject, data, options); + } + subscribe(subject, opts = {}) { + if (this.isClosed()) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); + } + if (this.isDraining()) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining); + } + subject = subject || ""; + if (subject.length === 0) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject); + } + const sub = new subscription_1.SubscriptionImpl(this.protocol, subject, opts); + this.protocol.subscribe(sub); + return sub; + } + request(subject, data = types_1.Empty, opts = { timeout: 1e3, noMux: false }) { + if (this.isClosed()) { + return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed)); + } + if (this.isDraining()) { + return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining)); + } + subject = subject || ""; + if (subject.length === 0) { + return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject)); + } + opts.timeout = opts.timeout || 1e3; + if (opts.timeout < 1) { + return Promise.reject(new error_1.NatsError("timeout", error_1.ErrorCode.InvalidOption)); + } + if (!opts.noMux && opts.reply) { + return Promise.reject(new error_1.NatsError("reply can only be used with noMux", error_1.ErrorCode.InvalidOption)); + } + if (opts.noMux) { + const inbox = opts.reply ? opts.reply : protocol_1.createInbox(this.options.inboxPrefix); + const d = util_1.deferred(); + this.subscribe(inbox, { + max: 1, + timeout: opts.timeout, + callback: (err, msg) => { + if (err) { + d.reject(err); + } else { + err = msg_1.isRequestError(msg); + if (err) { + d.reject(err); + } else { + d.resolve(msg); + } + } + } + }); + this.publish(subject, data, { reply: inbox }); + return d; + } else { + const r = new request_1.Request(this.protocol.muxSubscriptions, opts); + this.protocol.request(r); + try { + this.publish(subject, data, { + reply: `${this.protocol.muxSubscriptions.baseInbox}${r.token}`, + headers: opts.headers + }); + } catch (err) { + r.cancel(err); + } + const p = Promise.race([r.timer, r.deferred]); + p.catch(() => { + r.cancel(); + }); + return p; + } + } + flush() { + return this.protocol.flush(); + } + drain() { + if (this.isClosed()) { + return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed)); + } + if (this.isDraining()) { + return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining)); + } + this.draining = true; + return this.protocol.drain(); + } + isClosed() { + return this.protocol.isClosed(); + } + isDraining() { + return this.draining; + } + getServer() { + const srv = this.protocol.getServer(); + return srv ? srv.listen : ""; + } + status() { + const iter = new queued_iterator_1.QueuedIteratorImpl(); + this.listeners.push(iter); + return iter; + } + get info() { + return this.protocol.isClosed() ? void 0 : this.protocol.info; + } + stats() { + return { + inBytes: this.protocol.inBytes, + outBytes: this.protocol.outBytes, + inMsgs: this.protocol.inMsgs, + outMsgs: this.protocol.outMsgs + }; + } + jetstreamManager(opts = {}) { + return __awaiter(this, void 0, void 0, function* () { + jetstreamPreview(this); + const adm = new jsm_1.JetStreamManagerImpl(this, opts); + try { + yield adm.getAccountInfo(); + } catch (err) { + const ne = err; + if (ne.code === error_1.ErrorCode.NoResponders) { + throw error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamNotEnabled); + } + throw ne; + } + return adm; + }); + } + jetstream(opts = {}) { + jetstreamPreview(this); + return new jsclient_1.JetStreamClientImpl(this, opts); + } + }; + exports.NatsConnectionImpl = NatsConnectionImpl; + var jetstreamPreview = (() => { + let once = false; + return (nci) => { + var _a; + if (!once) { + once = true; + const { lang } = (_a = nci === null || nci === void 0 ? void 0 : nci.protocol) === null || _a === void 0 ? void 0 : _a.transport; + if (lang) { + console.log(`\x1B[33m >> jetstream functionality in ${lang} is preview functionality \x1B[0m`); + } else { + console.log(`\x1B[33m >> jetstream functionality is preview functionality \x1B[0m`); + } + } + }; + })(); + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/bench.js + var require_bench = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/bench.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __asyncValues = exports && exports.__asyncValues || function(o) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n) { + i[n] = o[n] && function(v) { + return new Promise(function(resolve, reject) { + v = o[n](v), settle(resolve, reject, v.done, v.value); + }); + }; + } + function settle(resolve, reject, d, v) { + Promise.resolve(v).then(function(v2) { + resolve({ value: v2, done: d }); + }, reject); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Bench = exports.Metric = void 0; + var types_1 = require_types(); + var nuid_1 = require_nuid(); + var util_1 = require_util(); + var error_1 = require_error(); + var Metric = class { + constructor(name, duration) { + this.name = name; + this.duration = duration; + this.date = Date.now(); + this.payload = 0; + this.msgs = 0; + this.bytes = 0; + } + toString() { + const sec = this.duration / 1e3; + const mps = Math.round(this.msgs / sec); + const label = this.asyncRequests ? "asyncRequests" : ""; + let minmax = ""; + if (this.max) { + minmax = `${this.min}/${this.max}`; + } + return `${this.name}${label ? " [asyncRequests]" : ""} ${humanizeNumber(mps)} msgs/sec - [${sec.toFixed(2)} secs] ~ ${throughput(this.bytes, sec)} ${minmax}`; + } + toCsv() { + return `"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests ? this.asyncRequests : false} +`; + } + static header() { + return `Test,Date,Lang,Version,Count,MsgPayload,Bytes,Millis,Async +`; + } + }; + exports.Metric = Metric; + var Bench = class { + constructor(nc, opts = { + msgs: 1e5, + size: 128, + subject: "", + asyncRequests: false, + pub: false, + sub: false, + req: false, + rep: false + }) { + this.nc = nc; + this.callbacks = opts.callbacks || false; + this.msgs = opts.msgs || 0; + this.size = opts.size || 0; + this.subject = opts.subject || nuid_1.nuid.next(); + this.asyncRequests = opts.asyncRequests || false; + this.pub = opts.pub || false; + this.sub = opts.sub || false; + this.req = opts.req || false; + this.rep = opts.rep || false; + this.perf = new util_1.Perf(); + this.payload = this.size ? new Uint8Array(this.size) : types_1.Empty; + if (!this.pub && !this.sub && !this.req && !this.rep) { + throw new Error("no bench option selected"); + } + } + run() { + return __awaiter(this, void 0, void 0, function* () { + this.nc.closed().then((err) => { + if (err) { + throw new error_1.NatsError(`bench closed with an error: ${err.message}`, error_1.ErrorCode.Unknown, err); + } + }); + if (this.callbacks) { + yield this.runCallbacks(); + } else { + yield this.runAsync(); + } + return this.processMetrics(); + }); + } + processMetrics() { + const nc = this.nc; + const { lang, version } = nc.protocol.transport; + if (this.pub && this.sub) { + this.perf.measure("pubsub", "pubStart", "subStop"); + } + const measures = this.perf.getEntries(); + const pubsub = measures.find((m) => m.name === "pubsub"); + const req = measures.find((m) => m.name === "req"); + const pub = measures.find((m) => m.name === "pub"); + const sub = measures.find((m) => m.name === "sub"); + const stats = this.nc.stats(); + const metrics = []; + if (pubsub) { + const { name, duration } = pubsub; + const m = new Metric(name, duration); + m.msgs = this.msgs * 2; + m.bytes = stats.inBytes + stats.outBytes; + m.lang = lang; + m.version = version; + m.payload = this.payload.length; + metrics.push(m); + } + if (pub) { + const { name, duration } = pub; + const m = new Metric(name, duration); + m.msgs = this.msgs; + m.bytes = stats.outBytes; + m.lang = lang; + m.version = version; + m.payload = this.payload.length; + metrics.push(m); + } + if (sub) { + const { name, duration } = sub; + const m = new Metric(name, duration); + m.msgs = this.msgs; + m.bytes = stats.inBytes; + m.lang = lang; + m.version = version; + m.payload = this.payload.length; + metrics.push(m); + } + if (req) { + const { name, duration } = req; + const m = new Metric(name, duration); + m.msgs = this.msgs * 2; + m.bytes = stats.inBytes + stats.outBytes; + m.lang = lang; + m.version = version; + m.payload = this.payload.length; + metrics.push(m); + } + return metrics; + } + runCallbacks() { + return __awaiter(this, void 0, void 0, function* () { + const jobs = []; + if (this.req) { + const d = util_1.deferred(); + jobs.push(d); + const sub = this.nc.subscribe(this.subject, { + max: this.msgs, + callback: (_, m) => { + m.respond(this.payload); + if (sub.getProcessed() === this.msgs) { + d.resolve(); + } + } + }); + } + if (this.sub) { + const d = util_1.deferred(); + jobs.push(d); + let i = 0; + this.nc.subscribe(this.subject, { + max: this.msgs, + callback: () => { + i++; + if (i === 1) { + this.perf.mark("subStart"); + } + if (i === this.msgs) { + this.perf.mark("subStop"); + this.perf.measure("sub", "subStart", "subStop"); + d.resolve(); + } + } + }); + } + if (this.pub) { + const job = (() => __awaiter(this, void 0, void 0, function* () { + this.perf.mark("pubStart"); + for (let i = 0; i < this.msgs; i++) { + this.nc.publish(this.subject, this.payload); + } + yield this.nc.flush(); + this.perf.mark("pubStop"); + this.perf.measure("pub", "pubStart", "pubStop"); + }))(); + jobs.push(job); + } + if (this.req) { + const job = (() => __awaiter(this, void 0, void 0, function* () { + if (this.asyncRequests) { + this.perf.mark("reqStart"); + const a = []; + for (let i = 0; i < this.msgs; i++) { + a.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 })); + } + yield Promise.all(a); + this.perf.mark("reqStop"); + this.perf.measure("req", "reqStart", "reqStop"); + } else { + this.perf.mark("reqStart"); + for (let i = 0; i < this.msgs; i++) { + yield this.nc.request(this.subject); + } + this.perf.mark("reqStop"); + this.perf.measure("req", "reqStart", "reqStop"); + } + }))(); + jobs.push(job); + } + yield Promise.all(jobs); + }); + } + runAsync() { + return __awaiter(this, void 0, void 0, function* () { + const jobs = []; + if (this.req) { + const sub = this.nc.subscribe(this.subject, { max: this.msgs }); + const job = (() => __awaiter(this, void 0, void 0, function* () { + var e_1, _a; + try { + for (var sub_1 = __asyncValues(sub), sub_1_1; sub_1_1 = yield sub_1.next(), !sub_1_1.done; ) { + const m = sub_1_1.value; + m.respond(this.payload); + } + } catch (e_1_1) { + e_1 = { error: e_1_1 }; + } finally { + try { + if (sub_1_1 && !sub_1_1.done && (_a = sub_1.return)) + yield _a.call(sub_1); + } finally { + if (e_1) + throw e_1.error; + } + } + }))(); + jobs.push(job); + } + if (this.sub) { + let first = false; + const sub = this.nc.subscribe(this.subject, { max: this.msgs }); + const job = (() => __awaiter(this, void 0, void 0, function* () { + var e_2, _b; + try { + for (var sub_2 = __asyncValues(sub), sub_2_1; sub_2_1 = yield sub_2.next(), !sub_2_1.done; ) { + const m = sub_2_1.value; + if (!first) { + this.perf.mark("subStart"); + first = true; + } + } + } catch (e_2_1) { + e_2 = { error: e_2_1 }; + } finally { + try { + if (sub_2_1 && !sub_2_1.done && (_b = sub_2.return)) + yield _b.call(sub_2); + } finally { + if (e_2) + throw e_2.error; + } + } + this.perf.mark("subStop"); + this.perf.measure("sub", "subStart", "subStop"); + }))(); + jobs.push(job); + } + if (this.pub) { + const job = (() => __awaiter(this, void 0, void 0, function* () { + this.perf.mark("pubStart"); + for (let i = 0; i < this.msgs; i++) { + this.nc.publish(this.subject, this.payload); + } + yield this.nc.flush(); + this.perf.mark("pubStop"); + this.perf.measure("pub", "pubStart", "pubStop"); + }))(); + jobs.push(job); + } + if (this.req) { + const job = (() => __awaiter(this, void 0, void 0, function* () { + if (this.asyncRequests) { + this.perf.mark("reqStart"); + const a = []; + for (let i = 0; i < this.msgs; i++) { + a.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 })); + } + yield Promise.all(a); + this.perf.mark("reqStop"); + this.perf.measure("req", "reqStart", "reqStop"); + } else { + this.perf.mark("reqStart"); + for (let i = 0; i < this.msgs; i++) { + yield this.nc.request(this.subject); + } + this.perf.mark("reqStop"); + this.perf.measure("req", "reqStart", "reqStop"); + } + }))(); + jobs.push(job); + } + yield Promise.all(jobs); + }); + } + }; + exports.Bench = Bench; + function throughput(bytes, seconds) { + return humanizeBytes(bytes / seconds); + } + function humanizeBytes(bytes, si = false) { + const base = si ? 1e3 : 1024; + const pre = si ? ["k", "M", "G", "T", "P", "E"] : ["K", "M", "G", "T", "P", "E"]; + const post = si ? "iB" : "B"; + if (bytes < base) { + return `${bytes.toFixed(2)} ${post}/sec`; + } + const exp = parseInt(Math.log(bytes) / Math.log(base) + ""); + const index = parseInt(exp - 1 + ""); + return `${(bytes / Math.pow(base, exp)).toFixed(2)} ${pre[index]}${post}/sec`; + } + function humanizeNumber(n) { + return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); + } + } + }); + + // ../../node_modules/nats.ws/lib/nats-base-client/internal_mod.js + var require_internal_mod = __commonJS({ + "../../node_modules/nats.ws/lib/nats-base-client/internal_mod.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.State = exports.Parser = exports.Kind = exports.StringCodec = exports.JSONCodec = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.Request = exports.checkUnsupportedOption = exports.checkOptions = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.render = exports.extractProtocolMessage = exports.extend = exports.delay = exports.deferred = exports.ProtocolHandler = exports.INFO = exports.createInbox = exports.Connect = exports.setTransportFactory = exports.Subscriptions = exports.SubscriptionImpl = exports.MsgImpl = exports.JsHeaders = exports.Events = exports.Empty = exports.DebugEvents = exports.toJsMsg = exports.consumerOpts = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.DiscardPolicy = exports.DeliverPolicy = exports.AdvisoryKind = exports.AckPolicy = exports.NatsError = exports.ErrorCode = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0; + exports.nanos = exports.millis = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.TypedSubscription = exports.parseIP = exports.isIP = exports.TE = exports.TD = exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = exports.DenoBuffer = void 0; + var nats_1 = require_nats(); + Object.defineProperty(exports, "NatsConnectionImpl", { enumerable: true, get: function() { + return nats_1.NatsConnectionImpl; + } }); + var nuid_1 = require_nuid(); + Object.defineProperty(exports, "Nuid", { enumerable: true, get: function() { + return nuid_1.Nuid; + } }); + Object.defineProperty(exports, "nuid", { enumerable: true, get: function() { + return nuid_1.nuid; + } }); + var error_1 = require_error(); + Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function() { + return error_1.ErrorCode; + } }); + Object.defineProperty(exports, "NatsError", { enumerable: true, get: function() { + return error_1.NatsError; + } }); + var types_1 = require_types(); + Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function() { + return types_1.AckPolicy; + } }); + Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function() { + return types_1.AdvisoryKind; + } }); + Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function() { + return types_1.DeliverPolicy; + } }); + Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function() { + return types_1.DiscardPolicy; + } }); + Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function() { + return types_1.ReplayPolicy; + } }); + Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function() { + return types_1.RetentionPolicy; + } }); + Object.defineProperty(exports, "StorageType", { enumerable: true, get: function() { + return types_1.StorageType; + } }); + var jsconsumeropts_1 = require_jsconsumeropts(); + Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function() { + return jsconsumeropts_1.consumerOpts; + } }); + var jsmsg_1 = require_jsmsg(); + Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function() { + return jsmsg_1.toJsMsg; + } }); + var types_2 = require_types(); + Object.defineProperty(exports, "DebugEvents", { enumerable: true, get: function() { + return types_2.DebugEvents; + } }); + Object.defineProperty(exports, "Empty", { enumerable: true, get: function() { + return types_2.Empty; + } }); + Object.defineProperty(exports, "Events", { enumerable: true, get: function() { + return types_2.Events; + } }); + Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function() { + return types_2.JsHeaders; + } }); + var msg_1 = require_msg(); + Object.defineProperty(exports, "MsgImpl", { enumerable: true, get: function() { + return msg_1.MsgImpl; + } }); + var subscription_1 = require_subscription(); + Object.defineProperty(exports, "SubscriptionImpl", { enumerable: true, get: function() { + return subscription_1.SubscriptionImpl; + } }); + var subscriptions_1 = require_subscriptions(); + Object.defineProperty(exports, "Subscriptions", { enumerable: true, get: function() { + return subscriptions_1.Subscriptions; + } }); + var transport_1 = require_transport(); + Object.defineProperty(exports, "setTransportFactory", { enumerable: true, get: function() { + return transport_1.setTransportFactory; + } }); + var protocol_1 = require_protocol(); + Object.defineProperty(exports, "Connect", { enumerable: true, get: function() { + return protocol_1.Connect; + } }); + Object.defineProperty(exports, "createInbox", { enumerable: true, get: function() { + return protocol_1.createInbox; + } }); + Object.defineProperty(exports, "INFO", { enumerable: true, get: function() { + return protocol_1.INFO; + } }); + Object.defineProperty(exports, "ProtocolHandler", { enumerable: true, get: function() { + return protocol_1.ProtocolHandler; + } }); + var util_1 = require_util(); + Object.defineProperty(exports, "deferred", { enumerable: true, get: function() { + return util_1.deferred; + } }); + Object.defineProperty(exports, "delay", { enumerable: true, get: function() { + return util_1.delay; + } }); + Object.defineProperty(exports, "extend", { enumerable: true, get: function() { + return util_1.extend; + } }); + Object.defineProperty(exports, "extractProtocolMessage", { enumerable: true, get: function() { + return util_1.extractProtocolMessage; + } }); + Object.defineProperty(exports, "render", { enumerable: true, get: function() { + return util_1.render; + } }); + Object.defineProperty(exports, "timeout", { enumerable: true, get: function() { + return util_1.timeout; + } }); + var headers_1 = require_headers(); + Object.defineProperty(exports, "canonicalMIMEHeaderKey", { enumerable: true, get: function() { + return headers_1.canonicalMIMEHeaderKey; + } }); + Object.defineProperty(exports, "headers", { enumerable: true, get: function() { + return headers_1.headers; + } }); + Object.defineProperty(exports, "Match", { enumerable: true, get: function() { + return headers_1.Match; + } }); + Object.defineProperty(exports, "MsgHdrsImpl", { enumerable: true, get: function() { + return headers_1.MsgHdrsImpl; + } }); + var heartbeats_1 = require_heartbeats(); + Object.defineProperty(exports, "Heartbeat", { enumerable: true, get: function() { + return heartbeats_1.Heartbeat; + } }); + var muxsubscription_1 = require_muxsubscription(); + Object.defineProperty(exports, "MuxSubscription", { enumerable: true, get: function() { + return muxsubscription_1.MuxSubscription; + } }); + var databuffer_1 = require_databuffer(); + Object.defineProperty(exports, "DataBuffer", { enumerable: true, get: function() { + return databuffer_1.DataBuffer; + } }); + var options_1 = require_options(); + Object.defineProperty(exports, "checkOptions", { enumerable: true, get: function() { + return options_1.checkOptions; + } }); + Object.defineProperty(exports, "checkUnsupportedOption", { enumerable: true, get: function() { + return options_1.checkUnsupportedOption; + } }); + var request_1 = require_request(); + Object.defineProperty(exports, "Request", { enumerable: true, get: function() { + return request_1.Request; + } }); + var authenticator_1 = require_authenticator(); + Object.defineProperty(exports, "credsAuthenticator", { enumerable: true, get: function() { + return authenticator_1.credsAuthenticator; + } }); + Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function() { + return authenticator_1.jwtAuthenticator; + } }); + Object.defineProperty(exports, "nkeyAuthenticator", { enumerable: true, get: function() { + return authenticator_1.nkeyAuthenticator; + } }); + var codec_1 = require_codec2(); + Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function() { + return codec_1.JSONCodec; + } }); + Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function() { + return codec_1.StringCodec; + } }); + __exportStar(require_nkeys2(), exports); + var parser_1 = require_parser(); + Object.defineProperty(exports, "Kind", { enumerable: true, get: function() { + return parser_1.Kind; + } }); + Object.defineProperty(exports, "Parser", { enumerable: true, get: function() { + return parser_1.Parser; + } }); + Object.defineProperty(exports, "State", { enumerable: true, get: function() { + return parser_1.State; + } }); + var denobuffer_1 = require_denobuffer(); + Object.defineProperty(exports, "DenoBuffer", { enumerable: true, get: function() { + return denobuffer_1.DenoBuffer; + } }); + Object.defineProperty(exports, "MAX_SIZE", { enumerable: true, get: function() { + return denobuffer_1.MAX_SIZE; + } }); + Object.defineProperty(exports, "readAll", { enumerable: true, get: function() { + return denobuffer_1.readAll; + } }); + Object.defineProperty(exports, "writeAll", { enumerable: true, get: function() { + return denobuffer_1.writeAll; + } }); + var bench_1 = require_bench(); + Object.defineProperty(exports, "Bench", { enumerable: true, get: function() { + return bench_1.Bench; + } }); + Object.defineProperty(exports, "Metric", { enumerable: true, get: function() { + return bench_1.Metric; + } }); + var encoders_1 = require_encoders(); + Object.defineProperty(exports, "TD", { enumerable: true, get: function() { + return encoders_1.TD; + } }); + Object.defineProperty(exports, "TE", { enumerable: true, get: function() { + return encoders_1.TE; + } }); + var ipparser_1 = require_ipparser(); + Object.defineProperty(exports, "isIP", { enumerable: true, get: function() { + return ipparser_1.isIP; + } }); + Object.defineProperty(exports, "parseIP", { enumerable: true, get: function() { + return ipparser_1.parseIP; + } }); + var typedsub_1 = require_typedsub(); + Object.defineProperty(exports, "TypedSubscription", { enumerable: true, get: function() { + return typedsub_1.TypedSubscription; + } }); + var jsutil_1 = require_jsutil(); + Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function() { + return jsutil_1.isFlowControlMsg; + } }); + Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function() { + return jsutil_1.isHeartbeatMsg; + } }); + Object.defineProperty(exports, "millis", { enumerable: true, get: function() { + return jsutil_1.millis; + } }); + Object.defineProperty(exports, "nanos", { enumerable: true, get: function() { + return jsutil_1.nanos; + } }); + } + }); + + // ../../node_modules/nats.ws/lib/src/ws_transport.js + var require_ws_transport = __commonJS({ + "../../node_modules/nats.ws/lib/src/ws_transport.js"(exports) { + "use strict"; + var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __await = exports && exports.__await || function(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function verb(n) { + if (g[n]) + i[n] = function(v) { + return new Promise(function(a, b) { + q.push([n, v, a, b]) > 1 || resume(n, v); + }); + }; + } + function resume(n, v) { + try { + step(g[n](v)); + } catch (e) { + settle(q[0][3], e); + } + } + function step(r) { + r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f, v) { + if (f(v), q.shift(), q.length) + resume(q[0][0], q[0][1]); + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WsTransport = void 0; + var internal_mod_1 = require_internal_mod(); + var VERSION = "1.2.0"; + var LANG = "nats.ws"; + var WsTransport = class { + constructor() { + this.version = VERSION; + this.lang = LANG; + this.connected = false; + this.done = false; + this.socketClosed = false; + this.encrypted = false; + this.peeked = false; + this.yields = []; + this.signal = internal_mod_1.deferred(); + this.closedNotification = internal_mod_1.deferred(); + } + connect(server, options) { + const connected = false; + const connLock = internal_mod_1.deferred(); + if (options.tls) { + connLock.reject(new internal_mod_1.NatsError("tls", internal_mod_1.ErrorCode.InvalidOption)); + return connLock; + } + this.options = options; + const u = server.src; + this.encrypted = u.indexOf("wss://") === 0; + this.socket = new WebSocket(u); + this.socket.binaryType = "arraybuffer"; + this.socket.onopen = () => { + }; + this.socket.onmessage = (me) => { + this.yields.push(new Uint8Array(me.data)); + if (this.peeked) { + this.signal.resolve(); + return; + } + const t = internal_mod_1.DataBuffer.concat(...this.yields); + const pm = internal_mod_1.extractProtocolMessage(t); + if (pm) { + const m = internal_mod_1.INFO.exec(pm); + if (!m) { + if (options.debug) { + console.error("!!!", internal_mod_1.render(t)); + } + connLock.reject(new Error("unexpected response from server")); + return; + } + try { + const info = JSON.parse(m[1]); + internal_mod_1.checkOptions(info, this.options); + this.peeked = true; + this.connected = true; + this.signal.resolve(); + connLock.resolve(); + } catch (err) { + connLock.reject(err); + return; + } + } + }; + this.socket.onclose = (evt) => { + this.socketClosed = true; + let reason; + if (this.done) + return; + if (!evt.wasClean) { + reason = new Error(evt.reason); + } + this._closed(reason); + }; + this.socket.onerror = (e) => { + const evt = e; + const err = new internal_mod_1.NatsError(evt.message, internal_mod_1.ErrorCode.Unknown, new Error(evt.error)); + if (!connected) { + connLock.reject(err); + } else { + this._closed(err); + } + }; + return connLock; + } + disconnect() { + this._closed(void 0, true); + } + _closed(err, internal = true) { + return __awaiter(this, void 0, void 0, function* () { + if (!this.connected) + return; + if (this.done) + return; + this.closeError = err; + if (!err) { + while (!this.socketClosed && this.socket.bufferedAmount > 0) { + console.log(this.socket.bufferedAmount); + yield internal_mod_1.delay(100); + } + } + this.done = true; + try { + this.socket.close(err ? 1002 : 1e3, err ? err.message : void 0); + } catch (err2) { + } + if (internal) { + this.closedNotification.resolve(err); + } + }); + } + get isClosed() { + return this.done; + } + [Symbol.asyncIterator]() { + return this.iterate(); + } + iterate() { + return __asyncGenerator(this, arguments, function* iterate_1() { + while (true) { + if (this.yields.length === 0) { + yield __await(this.signal); + } + const yields = this.yields; + this.yields = []; + for (let i = 0; i < yields.length; i++) { + if (this.options.debug) { + console.info(`> ${internal_mod_1.render(yields[i])}`); + } + yield yield __await(yields[i]); + } + if (this.done) { + break; + } else if (this.yields.length === 0) { + yields.length = 0; + this.yields = yields; + this.signal = internal_mod_1.deferred(); + } + } + }); + } + isEncrypted() { + return this.connected && this.encrypted; + } + send(frame) { + if (this.done) { + return Promise.resolve(); + } + try { + this.socket.send(frame.buffer); + if (this.options.debug) { + console.info(`< ${internal_mod_1.render(frame)}`); + } + return Promise.resolve(); + } catch (err) { + if (this.options.debug) { + console.error(`!!! ${internal_mod_1.render(frame)}: ${err}`); + } + return Promise.reject(err); + } + } + close(err) { + return this._closed(err, false); + } + closed() { + return this.closedNotification; + } + }; + exports.WsTransport = WsTransport; + } + }); + + // ../../node_modules/nats.ws/lib/src/connect.js + var require_connect = __commonJS({ + "../../node_modules/nats.ws/lib/src/connect.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.connect = exports.wsUrlParseFn = void 0; + var internal_mod_1 = require_internal_mod(); + var ws_transport_1 = require_ws_transport(); + function wsUrlParseFn(u) { + const ut = /^(.*:\/\/)(.*)/; + if (!ut.test(u)) { + u = `https://${u}`; + } + let url = new URL(u); + const srcProto = url.protocol.toLowerCase(); + if (srcProto !== "https:" && srcProto !== "http") { + u = u.replace(/^(.*:\/\/)(.*)/gm, "$2"); + url = new URL(`http://${u}`); + } + let protocol; + let port; + const host = url.hostname; + const path = url.pathname; + const search = url.search || ""; + switch (srcProto) { + case "http:": + case "ws:": + case "nats:": + port = url.port || "80"; + protocol = "ws:"; + break; + default: + port = url.port || "443"; + protocol = "wss:"; + break; + } + return `${protocol}//${host}:${port}${path}${search}`; + } + exports.wsUrlParseFn = wsUrlParseFn; + function connect(opts = {}) { + internal_mod_1.setTransportFactory({ + defaultPort: 443, + urlParseFn: wsUrlParseFn, + factory: () => { + return new ws_transport_1.WsTransport(); + } + }); + return internal_mod_1.NatsConnectionImpl.connect(opts); + } + exports.connect = connect; + } + }); + + // ../../node_modules/nats.ws/lib/src/mod.js + var require_mod3 = __commonJS({ + "../../node_modules/nats.ws/lib/src/mod.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __exportStar = exports && exports.__exportStar || function(m, exports2) { + for (var p in m) + if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) + __createBinding(exports2, m, p); + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.connect = void 0; + __exportStar(require_internal_mod(), exports); + var connect_1 = require_connect(); + Object.defineProperty(exports, "connect", { enumerable: true, get: function() { + return connect_1.connect; + } }); + } + }); + + // ../../node_modules/nats.ws/nats.cjs + var require_nats2 = __commonJS({ + "../../node_modules/nats.ws/nats.cjs"(exports, module) { + "use strict"; + module.exports = require_mod3(); + } + }); + + // ../../node_modules/ms/index.js + var require_ms = __commonJS({ + "../../node_modules/ms/index.js"(exports, module) { + var s = 1e3; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var w = d * 7; + var y = d * 365.25; + module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === "string" && val.length > 0) { + return parse(val); + } else if (type === "number" && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) + ); + }; + function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || "ms").toLowerCase(); + switch (type) { + case "years": + case "year": + case "yrs": + case "yr": + case "y": + return n * y; + case "weeks": + case "week": + case "w": + return n * w; + case "days": + case "day": + case "d": + return n * d; + case "hours": + case "hour": + case "hrs": + case "hr": + case "h": + return n * h; + case "minutes": + case "minute": + case "mins": + case "min": + case "m": + return n * m; + case "seconds": + case "second": + case "secs": + case "sec": + case "s": + return n * s; + case "milliseconds": + case "millisecond": + case "msecs": + case "msec": + case "ms": + return n; + default: + return void 0; + } + } + function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + "d"; + } + if (msAbs >= h) { + return Math.round(ms / h) + "h"; + } + if (msAbs >= m) { + return Math.round(ms / m) + "m"; + } + if (msAbs >= s) { + return Math.round(ms / s) + "s"; + } + return ms + "ms"; + } + function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, "day"); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, "hour"); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, "minute"); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, "second"); + } + return ms + " ms"; + } + function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); + } + } + }); + + // ../../node_modules/debug/src/common.js + var require_common = __commonJS({ + "../../node_modules/debug/src/common.js"(exports, module) { + function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require_ms(); + createDebug.destroy = destroy; + Object.keys(env).forEach((key) => { + createDebug[key] = env[key]; + }); + createDebug.names = []; + createDebug.skips = []; + createDebug.formatters = {}; + function selectColor(namespace) { + let hash = 0; + for (let i = 0; i < namespace.length; i++) { + hash = (hash << 5) - hash + namespace.charCodeAt(i); + hash |= 0; + } + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + function debug(...args) { + if (!debug.enabled) { + return; + } + const self2 = debug; + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self2.diff = ms; + self2.prev = prevTime; + self2.curr = curr; + prevTime = curr; + args[0] = createDebug.coerce(args[0]); + if (typeof args[0] !== "string") { + args.unshift("%O"); + } + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + if (match === "%%") { + return "%"; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === "function") { + const val = args[index]; + match = formatter.call(self2, val); + args.splice(index, 1); + index--; + } + return match; + }); + createDebug.formatArgs.call(self2, args); + const logFn = self2.log || createDebug.log; + logFn.apply(self2, args); + } + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; + Object.defineProperty(debug, "enabled", { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + return enabledCache; + }, + set: (v) => { + enableOverride = v; + } + }); + if (typeof createDebug.init === "function") { + createDebug.init(debug); + } + return debug; + } + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + createDebug.names = []; + createDebug.skips = []; + let i; + const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); + const len = split.length; + for (i = 0; i < len; i++) { + if (!split[i]) { + continue; + } + namespaces = split[i].replace(/\*/g, ".*?"); + if (namespaces[0] === "-") { + createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); + } else { + createDebug.names.push(new RegExp("^" + namespaces + "$")); + } + } + } + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace) + ].join(","); + createDebug.enable(""); + return namespaces; + } + function enabled(name) { + if (name[name.length - 1] === "*") { + return true; + } + let i; + let len; + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + return false; + } + function toNamespace(regexp) { + return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); + } + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + function destroy() { + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); + } + createDebug.enable(createDebug.load()); + return createDebug; + } + module.exports = setup; + } + }); + + // ../../node_modules/debug/src/browser.js + var require_browser = __commonJS({ + "../../node_modules/debug/src/browser.js"(exports, module) { + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = localstorage(); + exports.destroy = (() => { + let warned = false; + return () => { + if (!warned) { + warned = true; + console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); + } + }; + })(); + exports.colors = [ + "#0000CC", + "#0000FF", + "#0033CC", + "#0033FF", + "#0066CC", + "#0066FF", + "#0099CC", + "#0099FF", + "#00CC00", + "#00CC33", + "#00CC66", + "#00CC99", + "#00CCCC", + "#00CCFF", + "#3300CC", + "#3300FF", + "#3333CC", + "#3333FF", + "#3366CC", + "#3366FF", + "#3399CC", + "#3399FF", + "#33CC00", + "#33CC33", + "#33CC66", + "#33CC99", + "#33CCCC", + "#33CCFF", + "#6600CC", + "#6600FF", + "#6633CC", + "#6633FF", + "#66CC00", + "#66CC33", + "#9900CC", + "#9900FF", + "#9933CC", + "#9933FF", + "#99CC00", + "#99CC33", + "#CC0000", + "#CC0033", + "#CC0066", + "#CC0099", + "#CC00CC", + "#CC00FF", + "#CC3300", + "#CC3333", + "#CC3366", + "#CC3399", + "#CC33CC", + "#CC33FF", + "#CC6600", + "#CC6633", + "#CC9900", + "#CC9933", + "#CCCC00", + "#CCCC33", + "#FF0000", + "#FF0033", + "#FF0066", + "#FF0099", + "#FF00CC", + "#FF00FF", + "#FF3300", + "#FF3333", + "#FF3366", + "#FF3399", + "#FF33CC", + "#FF33FF", + "#FF6600", + "#FF6633", + "#FF9900", + "#FF9933", + "#FFCC00", + "#FFCC33" + ]; + function useColors() { + if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { + return true; + } + if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + } + function formatArgs(args) { + args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff); + if (!this.useColors) { + return; + } + const c = "color: " + this.color; + args.splice(1, 0, c, "color: inherit"); + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, (match) => { + if (match === "%%") { + return; + } + index++; + if (match === "%c") { + lastC = index; + } + }); + args.splice(lastC, 0, c); + } + exports.log = console.debug || console.log || (() => { + }); + function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem("debug", namespaces); + } else { + exports.storage.removeItem("debug"); + } + } catch (error) { + } + } + function load() { + let r; + try { + r = exports.storage.getItem("debug"); + } catch (error) { + } + if (!r && typeof process !== "undefined" && "env" in process) { + r = process.env.DEBUG; + } + return r; + } + function localstorage() { + try { + return localStorage; + } catch (error) { + } + } + module.exports = require_common()(exports); + var { formatters } = module.exports; + formatters.j = function(v) { + try { + return JSON.stringify(v); + } catch (error) { + return "[UnexpectedJSONParseError]: " + error.message; + } + }; + } + }); + + // ../../node_modules/@wapc/host/dist/src/debug.js + var require_debug = __commonJS({ + "../../node_modules/@wapc/host/dist/src/debug.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.debug = void 0; + var debug_1 = __importDefault(require_browser()); + var _debug = debug_1.default("wapc"); + function debug(cb) { + if (_debug.enabled) { + const params = cb(); + _debug(...params); + } + } + exports.debug = debug; + } + }); + + // ../../node_modules/@wapc/host/dist/src/callbacks.js + var require_callbacks = __commonJS({ + "../../node_modules/@wapc/host/dist/src/callbacks.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.generateWASIImports = exports.generateWapcImports = void 0; + var debug_1 = require_debug(); + function generateWapcImports(instance) { + return { + __console_log(ptr, len) { + debug_1.debug(() => ["__console_log %o bytes @ %o", len, ptr]); + const buffer = new Uint8Array(instance.getCallerMemory().buffer); + const bytes = buffer.slice(ptr, ptr + len); + console.log(instance.textDecoder.decode(bytes)); + }, + __host_call(bd_ptr, bd_len, ns_ptr, ns_len, op_ptr, op_len, ptr, len) { + debug_1.debug(() => ["__host_call"]); + const mem = instance.getCallerMemory(); + const buffer = new Uint8Array(mem.buffer); + const binding = instance.textDecoder.decode(buffer.slice(bd_ptr, bd_ptr + bd_len)); + const namespace = instance.textDecoder.decode(buffer.slice(ns_ptr, ns_ptr + ns_len)); + const operation = instance.textDecoder.decode(buffer.slice(op_ptr, op_ptr + op_len)); + const bytes = buffer.slice(ptr, ptr + len); + debug_1.debug(() => ["host_call(%o,%o,%o,[%o bytes])", binding, namespace, operation, bytes.length]); + instance.state.hostError = void 0; + instance.state.hostResponse = void 0; + try { + const result = instance.state.hostCallback(binding, namespace, operation, bytes); + instance.state.hostResponse = result; + return 1; + } catch (e) { + instance.state.hostError = e.toString(); + return 0; + } + }, + __host_response(ptr) { + debug_1.debug(() => ["__host_response ptr: %o", ptr]); + if (instance.state.hostResponse) { + const buffer = new Uint8Array(instance.getCallerMemory().buffer); + buffer.set(instance.state.hostResponse, ptr); + } + }, + __host_response_len() { + var _a; + const len = ((_a = instance.state.hostResponse) === null || _a === void 0 ? void 0 : _a.length) || 0; + debug_1.debug(() => ["__host_response_len %o", len]); + return len; + }, + __host_error_len() { + var _a; + const len = ((_a = instance.state.hostError) === null || _a === void 0 ? void 0 : _a.length) || 0; + debug_1.debug(() => ["__host_error_len ptr: %o", len]); + return len; + }, + __host_error(ptr) { + debug_1.debug(() => ["__host_error %o", ptr]); + if (instance.state.hostError) { + debug_1.debug(() => ["__host_error writing to mem: %o", instance.state.hostError]); + const buffer = new Uint8Array(instance.getCallerMemory().buffer); + buffer.set(instance.textEncoder.encode(instance.state.hostError), ptr); + } + }, + __guest_response(ptr, len) { + debug_1.debug(() => ["__guest_response %o bytes @ %o", len, ptr]); + instance.state.guestError = void 0; + const buffer = new Uint8Array(instance.getCallerMemory().buffer); + const bytes = buffer.slice(ptr, ptr + len); + instance.state.guestResponse = bytes; + }, + __guest_error(ptr, len) { + debug_1.debug(() => ["__guest_error %o bytes @ %o", len, ptr]); + const buffer = new Uint8Array(instance.getCallerMemory().buffer); + const bytes = buffer.slice(ptr, ptr + len); + const message = instance.textDecoder.decode(bytes); + instance.state.guestError = message; + }, + __guest_request(op_ptr, ptr) { + debug_1.debug(() => ["__guest_request op: %o, ptr: %o", op_ptr, ptr]); + const invocation = instance.state.guestRequest; + if (invocation) { + const memory = instance.getCallerMemory(); + debug_1.debug(() => ["writing invocation (%o,[%o bytes])", invocation.operation, invocation.msg.length]); + const buffer = new Uint8Array(memory.buffer); + buffer.set(invocation.operationEncoded, op_ptr); + buffer.set(invocation.msg, ptr); + } else { + throw new Error("__guest_request called without an invocation present. This is probably a bug in the library using @wapc/host."); + } + } + }; + } + exports.generateWapcImports = generateWapcImports; + function generateWASIImports(instance) { + return { + __fd_write(fileDescriptor, iovsPtr, iovsLen, writtenPtr) { + if (fileDescriptor != 1) { + return 0; + } + const memory = instance.getCallerMemory(); + const dv = new DataView(memory.buffer); + const heap = new Uint8Array(memory.buffer); + let bytesWritten = 0; + while (iovsLen > 0) { + iovsLen--; + const base = dv.getUint32(iovsPtr, true); + iovsPtr += 4; + const length = dv.getUint32(iovsPtr, true); + iovsPtr += 4; + const stringBytes = heap.slice(base, base + length); + instance.state.writer(instance.textDecoder.decode(stringBytes)); + bytesWritten += length; + } + dv.setUint32(writtenPtr, bytesWritten, true); + return bytesWritten; + } + }; + } + exports.generateWASIImports = generateWASIImports; + } + }); + + // ../../node_modules/@wapc/host/dist/src/errors.js + var require_errors = __commonJS({ + "../../node_modules/@wapc/host/dist/src/errors.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.StreamingFailure = exports.InvalidWasm = exports.HostCallNotImplementedError = void 0; + var TestableError = class extends Error { + matcher() { + return new RegExp(this.toString().replace(/^Error: /, "")); + } + }; + var HostCallNotImplementedError = class extends TestableError { + constructor(binding, namespace, operation) { + super(`Host call not implemented. Guest called host with binding = '${binding}', namespace = '${namespace}', & operation = '${operation}'`); + } + }; + exports.HostCallNotImplementedError = HostCallNotImplementedError; + var InvalidWasm = class extends TestableError { + constructor(error) { + super(`Invalid wasm binary: ${error.message}`); + } + }; + exports.InvalidWasm = InvalidWasm; + var StreamingFailure = class extends TestableError { + constructor(error) { + super(`Could not instantiate from Response object: ${error.message}`); + } + }; + exports.StreamingFailure = StreamingFailure; + } + }); + + // ../../node_modules/@wapc/host/dist/src/wapc-host.js + var require_wapc_host = __commonJS({ + "../../node_modules/@wapc/host/dist/src/wapc-host.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.instantiateStreaming = exports.instantiate = exports.WapcHost = void 0; + var debug_1 = require_debug(); + var _1 = require_src(); + var callbacks_1 = require_callbacks(); + var errors_1 = require_errors(); + var START = "_start"; + var WAPC_INIT = "wapc_init"; + var GUEST_CALL = "__guest_call"; + var ModuleState = class { + constructor(hostCall, writer) { + this.hostCallback = hostCall || ((binding, namespace, operation) => { + throw new errors_1.HostCallNotImplementedError(binding, namespace, operation); + }); + this.writer = writer || (() => void 0); + } + }; + var WapcHost = class { + constructor(hostCall, writer) { + this.state = new ModuleState(hostCall, writer); + this.textEncoder = new TextEncoder(); + this.textDecoder = new TextDecoder("utf-8"); + this.guestCall = () => void 0; + } + async instantiate(source) { + const imports = this.getImports(); + const result = await WebAssembly.instantiate(source, imports).catch((e) => { + throw new _1.errors.InvalidWasm(e); + }); + this.initialize(result.instance); + return this; + } + async instantiateStreaming(source) { + const imports = this.getImports(); + if (!WebAssembly.instantiateStreaming) { + debug_1.debug(() => [ + "WebAssembly.instantiateStreaming is not supported on this browser, wasm execution will be impacted." + ]); + const bytes = new Uint8Array(await (await source).arrayBuffer()); + return this.instantiate(bytes); + } else { + const result = await WebAssembly.instantiateStreaming(source, imports).catch((e) => { + throw new _1.errors.StreamingFailure(e); + }); + this.initialize(result.instance); + return this; + } + } + getImports() { + const wasiImports = callbacks_1.generateWASIImports(this); + return { + wapc: callbacks_1.generateWapcImports(this), + wasi: wasiImports, + wasi_unstable: wasiImports + }; + } + initialize(instance) { + this.instance = instance; + const start = this.instance.exports[START]; + if (start != null) { + start([]); + } + const init = this.instance.exports[WAPC_INIT]; + if (init != null) { + init([]); + } + this.guestCall = this.instance.exports[GUEST_CALL]; + if (this.guestCall == null) { + throw new Error("WebAssembly module does not export __guest_call"); + } + } + async invoke(operation, payload) { + debug_1.debug(() => [`invoke(%o, [%o bytes]`, operation, payload.length]); + const operationEncoded = this.textEncoder.encode(operation); + this.state.guestRequest = { operation, operationEncoded, msg: payload }; + const result = this.guestCall(operationEncoded.length, payload.length); + if (result === 0) { + throw new Error(this.state.guestError); + } else { + if (!this.state.guestResponse) { + throw new Error("Guest call succeeded, but guest response not set. This is a bug in @wapc/host"); + } else { + return this.state.guestResponse; + } + } + } + getCallerMemory() { + return this.instance.exports.memory; + } + }; + exports.WapcHost = WapcHost; + async function instantiate(source, hostCall, writer) { + const host = new WapcHost(hostCall, writer); + return host.instantiate(source); + } + exports.instantiate = instantiate; + async function instantiateStreaming(source, hostCall, writer) { + const host = new WapcHost(hostCall, writer); + return host.instantiateStreaming(await source); + } + exports.instantiateStreaming = instantiateStreaming; + } + }); + + // ../../node_modules/@wapc/host/dist/src/index.js + var require_src = __commonJS({ + "../../node_modules/@wapc/host/dist/src/index.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.errors = exports.WapcHost = exports.instantiateStreaming = exports.instantiate = void 0; + var wapc_host_1 = require_wapc_host(); + Object.defineProperty(exports, "instantiate", { enumerable: true, get: function() { + return wapc_host_1.instantiate; + } }); + Object.defineProperty(exports, "instantiateStreaming", { enumerable: true, get: function() { + return wapc_host_1.instantiateStreaming; + } }); + Object.defineProperty(exports, "WapcHost", { enumerable: true, get: function() { + return wapc_host_1.WapcHost; + } }); + exports.errors = __importStar(require_errors()); + } + }); + + // ../../dist/src/wasmbus.js + var require_wasmbus = __commonJS({ + "../../dist/src/wasmbus.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.Wasmbus = exports.instantiate = void 0; + var host_1 = require_src(); + async function instantiate(source, hostCall, writer) { + const host = new Wasmbus(hostCall, writer); + return host.instantiate(source); + } + exports.instantiate = instantiate; + var Wasmbus = class extends host_1.WapcHost { + constructor(hostCall, writer) { + super(hostCall, writer); + } + async instantiate(source) { + const imports = super.getImports(); + const result = await WebAssembly.instantiate(source, { + wasmbus: imports.wapc, + wasi: imports.wasi, + wasi_unstable: imports.wasi_unstable + }).catch((e) => { + throw new Error(`Invalid wasm binary: ${e.message}`); + }); + super.initialize(result.instance); + return this; + } + }; + exports.Wasmbus = Wasmbus; + } + }); + + // ../../dist/src/util.js + var require_util4 = __commonJS({ + "../../dist/src/util.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.jsonDecode = exports.jsonEncode = exports.parseJwt = exports.uuidv4 = void 0; + var nats_ws_1 = require_nats2(); + var jc = nats_ws_1.JSONCodec(); + function uuidv4() { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { + const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8; + return v.toString(16); + }); + } + exports.uuidv4 = uuidv4; + function parseJwt(token) { + var base64Url = token.split(".")[1]; + var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); + var jsonPayload = decodeURIComponent(atob(base64).split("").map(function(c) { + return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); + }).join("")); + return JSON.parse(jsonPayload); + } + exports.parseJwt = parseJwt; + function jsonEncode(data) { + return jc.encode(data); + } + exports.jsonEncode = jsonEncode; + function jsonDecode(data) { + return jc.decode(data); + } + exports.jsonDecode = jsonDecode; + } + }); + + // ../../dist/src/events.js + var require_events = __commonJS({ + "../../dist/src/events.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.createEventMessage = exports.EventType = void 0; + var util_1 = require_util4(); + var EventType; + (function(EventType2) { + EventType2["ActorStarted"] = "com.wasmcloud.lattice.actor_started"; + EventType2["ActorStopped"] = "com.wasmcloud.lattice.actor_stopped"; + EventType2["HeartBeat"] = "com.wasmcloud.lattice.host_heartbeat"; + EventType2["HealthCheckPass"] = "com.wasmcloud.lattice.health_check_passed"; + EventType2["HostStarted"] = "com.wasmcloud.lattice.host_started"; + })(EventType = exports.EventType || (exports.EventType = {})); + function createEventMessage(hostKey, eventType, data) { + return { + data, + datacontenttype: "application/json", + id: util_1.uuidv4(), + source: hostKey, + specversion: "1.0", + time: new Date().toISOString(), + type: eventType + }; + } + exports.createEventMessage = createEventMessage; + } + }); + + // ../../dist/src/actor.js + var require_actor = __commonJS({ + "../../dist/src/actor.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.startActor = exports.Actor = void 0; + var msgpack_1 = require_dist(); + var wasmbus_1 = require_wasmbus(); + var events_1 = require_events(); + var util_1 = require_util4(); + var Actor = class { + constructor(hostName = "default", hostKey, wasm, invocationCallback, hostCall, writer) { + this.key = ""; + this.hostName = hostName; + this.hostKey = hostKey; + this.claims = { + jti: "", + iat: 0, + iss: "", + sub: "", + wascap: { + name: "", + hash: "", + tags: [], + caps: [], + ver: "", + prov: false + } + }; + this.wasm = wasm; + this.invocationCallback = invocationCallback; + this.hostCall = hostCall; + this.writer = writer; + } + async startActor(actorBuffer) { + const token = await this.wasm.extract_jwt(actorBuffer); + const valid = await this.wasm.validate_jwt(token); + if (!valid) { + throw new Error("invalid token"); + } + this.claims = util_1.parseJwt(token); + this.key = this.claims.sub; + this.module = await wasmbus_1.instantiate(actorBuffer, this.hostCall, this.writer); + } + async stopActor(natsConn) { + const actorToStop = { + host_id: this.hostKey, + actor_ref: this.key + }; + natsConn.publish(`wasmbus.ctl.${this.hostName}.cmd.${this.hostKey}.sa`, util_1.jsonEncode(actorToStop)); + } + async publishActorStarted(natsConn) { + const claims = { + call_alias: "", + caps: this.claims.wascap.caps[0], + iss: this.claims.iss, + name: this.claims.wascap.name, + rev: "1", + sub: this.claims.sub, + tags: "", + version: this.claims.wascap.ver + }; + natsConn.publish(`lc.${this.hostName}.claims.${this.key}`, util_1.jsonEncode(claims)); + const actorStarted = { + api_version: 0, + instance_id: util_1.uuidv4(), + public_key: this.key + }; + natsConn.publish(`wasmbus.evt.${this.hostName}`, util_1.jsonEncode(events_1.createEventMessage(this.hostKey, events_1.EventType.ActorStarted, actorStarted))); + const actorHealthCheck = { + instance_id: util_1.uuidv4(), + public_key: this.key + }; + natsConn.publish(`wasmbus.evt.${this.hostName}`, util_1.jsonEncode(events_1.createEventMessage(this.hostKey, events_1.EventType.HealthCheckPass, actorHealthCheck))); + } + async subscribeInvocations(natsConn) { + const invocationsTopic = natsConn.subscribe(`wasmbus.rpc.${this.hostName}.${this.key}`); + for await (const invocationMessage of invocationsTopic) { + const invocationData = msgpack_1.decode(invocationMessage.data); + const invocation = invocationData; + const invocationResult = await this.module.invoke(invocation.operation, invocation.msg); + invocationMessage.respond(msgpack_1.encode({ + invocation_id: invocationData.id, + instance_id: util_1.uuidv4(), + msg: invocationResult + })); + if (this.invocationCallback) { + this.invocationCallback(invocationResult); + } + } + throw new Error("actor.inovcation subscription closed"); + } + }; + exports.Actor = Actor; + async function startActor(hostName, hostKey, actorModule, natsConn, wasm, invocationCallback, hostCall, writer) { + const actor = new Actor(hostName, hostKey, wasm, invocationCallback, hostCall, writer); + await actor.startActor(actorModule); + await actor.publishActorStarted(natsConn); + Promise.all([actor.subscribeInvocations(natsConn)]).catch((err) => { + throw err; + }); + return actor; + } + exports.startActor = startActor; + } + }); + + // ../../node_modules/axios/lib/helpers/bind.js + var require_bind = __commonJS({ + "../../node_modules/axios/lib/helpers/bind.js"(exports, module) { + "use strict"; + module.exports = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; + }; + } + }); + + // ../../node_modules/axios/lib/utils.js + var require_utils = __commonJS({ + "../../node_modules/axios/lib/utils.js"(exports, module) { + "use strict"; + var bind = require_bind(); + var toString = Object.prototype.toString; + function isArray(val) { + return toString.call(val) === "[object Array]"; + } + function isUndefined(val) { + return typeof val === "undefined"; + } + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val); + } + function isArrayBuffer(val) { + return toString.call(val) === "[object ArrayBuffer]"; + } + function isFormData(val) { + return typeof FormData !== "undefined" && val instanceof FormData; + } + function isArrayBufferView(val) { + var result; + if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { + result = ArrayBuffer.isView(val); + } else { + result = val && val.buffer && val.buffer instanceof ArrayBuffer; + } + return result; + } + function isString(val) { + return typeof val === "string"; + } + function isNumber(val) { + return typeof val === "number"; + } + function isObject(val) { + return val !== null && typeof val === "object"; + } + function isPlainObject(val) { + if (toString.call(val) !== "[object Object]") { + return false; + } + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; + } + function isDate(val) { + return toString.call(val) === "[object Date]"; + } + function isFile(val) { + return toString.call(val) === "[object File]"; + } + function isBlob(val) { + return toString.call(val) === "[object Blob]"; + } + function isFunction(val) { + return toString.call(val) === "[object Function]"; + } + function isStream(val) { + return isObject(val) && isFunction(val.pipe); + } + function isURLSearchParams(val) { + return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams; + } + function trim(str) { + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ""); + } + function isStandardBrowserEnv() { + if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) { + return false; + } + return typeof window !== "undefined" && typeof document !== "undefined"; + } + function forEach(obj, fn) { + if (obj === null || typeof obj === "undefined") { + return; + } + if (typeof obj !== "object") { + obj = [obj]; + } + if (isArray(obj)) { + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } + } + function merge() { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; + } + function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === "function") { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; + } + function stripBOM(content) { + if (content.charCodeAt(0) === 65279) { + content = content.slice(1); + } + return content; + } + module.exports = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isObject, + isPlainObject, + isUndefined, + isDate, + isFile, + isBlob, + isFunction, + isStream, + isURLSearchParams, + isStandardBrowserEnv, + forEach, + merge, + extend, + trim, + stripBOM + }; + } + }); + + // ../../node_modules/axios/lib/helpers/buildURL.js + var require_buildURL = __commonJS({ + "../../node_modules/axios/lib/helpers/buildURL.js"(exports, module) { + "use strict"; + var utils = require_utils(); + function encode(val) { + return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); + } + module.exports = function buildURL(url, params, paramsSerializer) { + if (!params) { + return url; + } + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === "undefined") { + return; + } + if (utils.isArray(val)) { + key = key + "[]"; + } else { + val = [val]; + } + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + "=" + encode(v)); + }); + }); + serializedParams = parts.join("&"); + } + if (serializedParams) { + var hashmarkIndex = url.indexOf("#"); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams; + } + return url; + }; + } + }); + + // ../../node_modules/axios/lib/core/InterceptorManager.js + var require_InterceptorManager = __commonJS({ + "../../node_modules/axios/lib/core/InterceptorManager.js"(exports, module) { + "use strict"; + var utils = require_utils(); + function InterceptorManager() { + this.handlers = []; + } + InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + }; + InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + }; + InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + }; + module.exports = InterceptorManager; + } + }); + + // ../../node_modules/axios/lib/helpers/normalizeHeaderName.js + var require_normalizeHeaderName = __commonJS({ + "../../node_modules/axios/lib/helpers/normalizeHeaderName.js"(exports, module) { + "use strict"; + var utils = require_utils(); + module.exports = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); + }; + } + }); + + // ../../node_modules/axios/lib/core/enhanceError.js + var require_enhanceError = __commonJS({ + "../../node_modules/axios/lib/core/enhanceError.js"(exports, module) { + "use strict"; + module.exports = function enhanceError(error, config, code, request, response) { + error.config = config; + if (code) { + error.code = code; + } + error.request = request; + error.response = response; + error.isAxiosError = true; + error.toJSON = function toJSON() { + return { + message: this.message, + name: this.name, + description: this.description, + number: this.number, + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + config: this.config, + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + }; + return error; + }; + } + }); + + // ../../node_modules/axios/lib/core/createError.js + var require_createError = __commonJS({ + "../../node_modules/axios/lib/core/createError.js"(exports, module) { + "use strict"; + var enhanceError = require_enhanceError(); + module.exports = function createError(message, config, code, request, response) { + var error = new Error(message); + return enhanceError(error, config, code, request, response); + }; + } + }); + + // ../../node_modules/axios/lib/core/settle.js + var require_settle = __commonJS({ + "../../node_modules/axios/lib/core/settle.js"(exports, module) { + "use strict"; + var createError = require_createError(); + module.exports = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(createError( + "Request failed with status code " + response.status, + response.config, + null, + response.request, + response + )); + } + }; + } + }); + + // ../../node_modules/axios/lib/helpers/cookies.js + var require_cookies = __commonJS({ + "../../node_modules/axios/lib/helpers/cookies.js"(exports, module) { + "use strict"; + var utils = require_utils(); + module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + "=" + encodeURIComponent(value)); + if (utils.isNumber(expires)) { + cookie.push("expires=" + new Date(expires).toGMTString()); + } + if (utils.isString(path)) { + cookie.push("path=" + path); + } + if (utils.isString(domain)) { + cookie.push("domain=" + domain); + } + if (secure === true) { + cookie.push("secure"); + } + document.cookie = cookie.join("; "); + }, + read: function read(name) { + var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); + return match ? decodeURIComponent(match[3]) : null; + }, + remove: function remove(name) { + this.write(name, "", Date.now() - 864e5); + } + }; + }() : function nonStandardBrowserEnv() { + return { + write: function write() { + }, + read: function read() { + return null; + }, + remove: function remove() { + } + }; + }(); + } + }); + + // ../../node_modules/axios/lib/helpers/isAbsoluteURL.js + var require_isAbsoluteURL = __commonJS({ + "../../node_modules/axios/lib/helpers/isAbsoluteURL.js"(exports, module) { + "use strict"; + module.exports = function isAbsoluteURL(url) { + return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); + }; + } + }); + + // ../../node_modules/axios/lib/helpers/combineURLs.js + var require_combineURLs = __commonJS({ + "../../node_modules/axios/lib/helpers/combineURLs.js"(exports, module) { + "use strict"; + module.exports = function combineURLs(baseURL, relativeURL) { + return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; + }; + } + }); + + // ../../node_modules/axios/lib/core/buildFullPath.js + var require_buildFullPath = __commonJS({ + "../../node_modules/axios/lib/core/buildFullPath.js"(exports, module) { + "use strict"; + var isAbsoluteURL = require_isAbsoluteURL(); + var combineURLs = require_combineURLs(); + module.exports = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + }; + } + }); + + // ../../node_modules/axios/lib/helpers/parseHeaders.js + var require_parseHeaders = __commonJS({ + "../../node_modules/axios/lib/helpers/parseHeaders.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var ignoreDuplicateOf = [ + "age", + "authorization", + "content-length", + "content-type", + "etag", + "expires", + "from", + "host", + "if-modified-since", + "if-unmodified-since", + "last-modified", + "location", + "max-forwards", + "proxy-authorization", + "referer", + "retry-after", + "user-agent" + ]; + module.exports = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + if (!headers) { + return parsed; + } + utils.forEach(headers.split("\n"), function parser(line) { + i = line.indexOf(":"); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === "set-cookie") { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; + } + } + }); + return parsed; + }; + } + }); + + // ../../node_modules/axios/lib/helpers/isURLSameOrigin.js + var require_isURLSameOrigin = __commonJS({ + "../../node_modules/axios/lib/helpers/isURLSameOrigin.js"(exports, module) { + "use strict"; + var utils = require_utils(); + module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement("a"); + var originURL; + function resolveURL(url) { + var href = url; + if (msie) { + urlParsingNode.setAttribute("href", href); + href = urlParsingNode.href; + } + urlParsingNode.setAttribute("href", href); + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname + }; + } + originURL = resolveURL(window.location.href); + return function isURLSameOrigin(requestURL) { + var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL; + return parsed.protocol === originURL.protocol && parsed.host === originURL.host; + }; + }() : function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + }(); + } + }); + + // ../../node_modules/axios/lib/cancel/Cancel.js + var require_Cancel = __commonJS({ + "../../node_modules/axios/lib/cancel/Cancel.js"(exports, module) { + "use strict"; + function Cancel(message) { + this.message = message; + } + Cancel.prototype.toString = function toString() { + return "Cancel" + (this.message ? ": " + this.message : ""); + }; + Cancel.prototype.__CANCEL__ = true; + module.exports = Cancel; + } + }); + + // ../../node_modules/axios/lib/adapters/xhr.js + var require_xhr = __commonJS({ + "../../node_modules/axios/lib/adapters/xhr.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var settle = require_settle(); + var cookies = require_cookies(); + var buildURL = require_buildURL(); + var buildFullPath = require_buildFullPath(); + var parseHeaders = require_parseHeaders(); + var isURLSameOrigin = require_isURLSameOrigin(); + var createError = require_createError(); + var defaults = require_defaults(); + var Cancel = require_Cancel(); + module.exports = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + var responseType = config.responseType; + var onCanceled; + function done() { + if (config.cancelToken) { + config.cancelToken.unsubscribe(onCanceled); + } + if (config.signal) { + config.signal.removeEventListener("abort", onCanceled); + } + } + if (utils.isFormData(requestData)) { + delete requestHeaders["Content-Type"]; + } + var request = new XMLHttpRequest(); + if (config.auth) { + var username = config.auth.username || ""; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ""; + requestHeaders.Authorization = "Basic " + btoa(username + ":" + password); + } + var fullPath = buildFullPath(config.baseURL, config.url); + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + request.timeout = config.timeout; + function onloadend() { + if (!request) { + return; + } + var responseHeaders = "getAllResponseHeaders" in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + request = null; + } + if ("onloadend" in request) { + request.onloadend = onloadend; + } else { + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) { + return; + } + setTimeout(onloadend); + }; + } + request.onabort = function handleAbort() { + if (!request) { + return; + } + reject(createError("Request aborted", config, "ECONNABORTED", request)); + request = null; + }; + request.onerror = function handleError() { + reject(createError("Network Error", config, null, request)); + request = null; + }; + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded"; + var transitional = config.transitional || defaults.transitional; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(createError( + timeoutErrorMessage, + config, + transitional.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", + request + )); + request = null; + }; + if (utils.isStandardBrowserEnv()) { + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0; + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } + if ("setRequestHeader" in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") { + delete requestHeaders[key]; + } else { + request.setRequestHeader(key, val); + } + }); + } + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + if (responseType && responseType !== "json") { + request.responseType = config.responseType; + } + if (typeof config.onDownloadProgress === "function") { + request.addEventListener("progress", config.onDownloadProgress); + } + if (typeof config.onUploadProgress === "function" && request.upload) { + request.upload.addEventListener("progress", config.onUploadProgress); + } + if (config.cancelToken || config.signal) { + onCanceled = function(cancel) { + if (!request) { + return; + } + reject(!cancel || cancel && cancel.type ? new Cancel("canceled") : cancel); + request.abort(); + request = null; + }; + config.cancelToken && config.cancelToken.subscribe(onCanceled); + if (config.signal) { + config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled); + } + } + if (!requestData) { + requestData = null; + } + request.send(requestData); + }); + }; + } + }); + + // ../../node_modules/axios/lib/defaults.js + var require_defaults = __commonJS({ + "../../node_modules/axios/lib/defaults.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var normalizeHeaderName = require_normalizeHeaderName(); + var enhanceError = require_enhanceError(); + var DEFAULT_CONTENT_TYPE = { + "Content-Type": "application/x-www-form-urlencoded" + }; + function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers["Content-Type"])) { + headers["Content-Type"] = value; + } + } + function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== "undefined") { + adapter = require_xhr(); + } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") { + adapter = require_xhr(); + } + return adapter; + } + function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== "SyntaxError") { + throw e; + } + } + } + return (encoder || JSON.stringify)(rawValue); + } + var defaults = { + transitional: { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }, + adapter: getDefaultAdapter(), + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, "Accept"); + normalizeHeaderName(headers, "Content-Type"); + if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8"); + return data.toString(); + } + if (utils.isObject(data) || headers && headers["Content-Type"] === "application/json") { + setContentTypeIfUnset(headers, "application/json"); + return stringifySafely(data); + } + return data; + }], + transformResponse: [function transformResponse(data) { + var transitional = this.transitional || defaults.transitional; + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var strictJSONParsing = !silentJSONParsing && this.responseType === "json"; + if (strictJSONParsing || forcedJSONParsing && utils.isString(data) && data.length) { + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === "SyntaxError") { + throw enhanceError(e, this, "E_JSON_PARSE"); + } + throw e; + } + } + } + return data; + }], + timeout: 0, + xsrfCookieName: "XSRF-TOKEN", + xsrfHeaderName: "X-XSRF-TOKEN", + maxContentLength: -1, + maxBodyLength: -1, + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + headers: { + common: { + "Accept": "application/json, text/plain, */*" + } + } + }; + utils.forEach(["delete", "get", "head"], function forEachMethodNoData(method) { + defaults.headers[method] = {}; + }); + utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); + }); + module.exports = defaults; + } + }); + + // ../../node_modules/axios/lib/core/transformData.js + var require_transformData = __commonJS({ + "../../node_modules/axios/lib/core/transformData.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var defaults = require_defaults(); + module.exports = function transformData(data, headers, fns) { + var context = this || defaults; + utils.forEach(fns, function transform(fn) { + data = fn.call(context, data, headers); + }); + return data; + }; + } + }); + + // ../../node_modules/axios/lib/cancel/isCancel.js + var require_isCancel = __commonJS({ + "../../node_modules/axios/lib/cancel/isCancel.js"(exports, module) { + "use strict"; + module.exports = function isCancel(value) { + return !!(value && value.__CANCEL__); + }; + } + }); + + // ../../node_modules/axios/lib/core/dispatchRequest.js + var require_dispatchRequest = __commonJS({ + "../../node_modules/axios/lib/core/dispatchRequest.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var transformData = require_transformData(); + var isCancel = require_isCancel(); + var defaults = require_defaults(); + var Cancel = require_Cancel(); + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + if (config.signal && config.signal.aborted) { + throw new Cancel("canceled"); + } + } + module.exports = function dispatchRequest(config) { + throwIfCancellationRequested(config); + config.headers = config.headers || {}; + config.data = transformData.call( + config, + config.data, + config.headers, + config.transformRequest + ); + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + utils.forEach( + ["delete", "get", "head", "post", "put", "patch", "common"], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + var adapter = config.adapter || defaults.adapter; + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + response.data = transformData.call( + config, + response.data, + response.headers, + config.transformResponse + ); + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + return Promise.reject(reason); + }); + }; + } + }); + + // ../../node_modules/axios/lib/core/mergeConfig.js + var require_mergeConfig = __commonJS({ + "../../node_modules/axios/lib/core/mergeConfig.js"(exports, module) { + "use strict"; + var utils = require_utils(); + module.exports = function mergeConfig(config1, config2) { + config2 = config2 || {}; + var config = {}; + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(void 0, config1[prop]); + } + } + function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(void 0, config2[prop]); + } + } + function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(void 0, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(void 0, config1[prop]); + } + } + function mergeDirectKeys(prop) { + if (prop in config2) { + return getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + return getMergedValue(void 0, config1[prop]); + } + } + var mergeMap = { + "url": valueFromConfig2, + "method": valueFromConfig2, + "data": valueFromConfig2, + "baseURL": defaultToConfig2, + "transformRequest": defaultToConfig2, + "transformResponse": defaultToConfig2, + "paramsSerializer": defaultToConfig2, + "timeout": defaultToConfig2, + "timeoutMessage": defaultToConfig2, + "withCredentials": defaultToConfig2, + "adapter": defaultToConfig2, + "responseType": defaultToConfig2, + "xsrfCookieName": defaultToConfig2, + "xsrfHeaderName": defaultToConfig2, + "onUploadProgress": defaultToConfig2, + "onDownloadProgress": defaultToConfig2, + "decompress": defaultToConfig2, + "maxContentLength": defaultToConfig2, + "maxBodyLength": defaultToConfig2, + "transport": defaultToConfig2, + "httpAgent": defaultToConfig2, + "httpsAgent": defaultToConfig2, + "cancelToken": defaultToConfig2, + "socketPath": defaultToConfig2, + "responseEncoding": defaultToConfig2, + "validateStatus": mergeDirectKeys + }; + utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { + var merge = mergeMap[prop] || mergeDeepProperties; + var configValue = merge(prop); + utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue); + }); + return config; + }; + } + }); + + // ../../node_modules/axios/lib/env/data.js + var require_data = __commonJS({ + "../../node_modules/axios/lib/env/data.js"(exports, module) { + module.exports = { + "version": "0.24.0" + }; + } + }); + + // ../../node_modules/axios/lib/helpers/validator.js + var require_validator = __commonJS({ + "../../node_modules/axios/lib/helpers/validator.js"(exports, module) { + "use strict"; + var VERSION = require_data().version; + var validators = {}; + ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) { + validators[type] = function validator(thing) { + return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type; + }; + }); + var deprecatedWarnings = {}; + validators.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); + } + return function(value, opt, opts) { + if (validator === false) { + throw new Error(formatMessage(opt, " has been removed" + (version ? " in " + version : ""))); + } + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + console.warn( + formatMessage( + opt, + " has been deprecated since v" + version + " and will be removed in the near future" + ) + ); + } + return validator ? validator(value, opt, opts) : true; + }; + }; + function assertOptions(options, schema, allowUnknown) { + if (typeof options !== "object") { + throw new TypeError("options must be an object"); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === void 0 || validator(value, opt, options); + if (result !== true) { + throw new TypeError("option " + opt + " must be " + result); + } + continue; + } + if (allowUnknown !== true) { + throw Error("Unknown option " + opt); + } + } + } + module.exports = { + assertOptions, + validators + }; + } + }); + + // ../../node_modules/axios/lib/core/Axios.js + var require_Axios = __commonJS({ + "../../node_modules/axios/lib/core/Axios.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var buildURL = require_buildURL(); + var InterceptorManager = require_InterceptorManager(); + var dispatchRequest = require_dispatchRequest(); + var mergeConfig = require_mergeConfig(); + var validator = require_validator(); + var validators = validator.validators; + function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; + } + Axios.prototype.request = function request(config) { + if (typeof config === "string") { + config = arguments[1] || {}; + config.url = arguments[0]; + } else { + config = config || {}; + } + config = mergeConfig(this.defaults, config); + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = "get"; + } + var transitional = config.transitional; + if (transitional !== void 0) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) { + return; + } + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + var promise; + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest, void 0]; + Array.prototype.unshift.apply(chain, requestInterceptorChain); + chain = chain.concat(responseInterceptorChain); + promise = Promise.resolve(config); + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + return promise; + } + var newConfig = config; + while (requestInterceptorChain.length) { + var onFulfilled = requestInterceptorChain.shift(); + var onRejected = requestInterceptorChain.shift(); + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected(error); + break; + } + } + try { + promise = dispatchRequest(newConfig); + } catch (error) { + return Promise.reject(error); + } + while (responseInterceptorChain.length) { + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); + } + return promise; + }; + Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ""); + }; + utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) { + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; + }); + utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { + Axios.prototype[method] = function(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data + })); + }; + }); + module.exports = Axios; + } + }); + + // ../../node_modules/axios/lib/cancel/CancelToken.js + var require_CancelToken = __commonJS({ + "../../node_modules/axios/lib/cancel/CancelToken.js"(exports, module) { + "use strict"; + var Cancel = require_Cancel(); + function CancelToken(executor) { + if (typeof executor !== "function") { + throw new TypeError("executor must be a function."); + } + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + var token = this; + this.promise.then(function(cancel) { + if (!token._listeners) + return; + var i; + var l = token._listeners.length; + for (i = 0; i < l; i++) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + this.promise.then = function(onfulfilled) { + var _resolve; + var promise = new Promise(function(resolve) { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + return promise; + }; + executor(function cancel(message) { + if (token.reason) { + return; + } + token.reason = new Cancel(message); + resolvePromise(token.reason); + }); + } + CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } + }; + CancelToken.prototype.subscribe = function subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + }; + CancelToken.prototype.unsubscribe = function unsubscribe(listener) { + if (!this._listeners) { + return; + } + var index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + }; + CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + }; + module.exports = CancelToken; + } + }); + + // ../../node_modules/axios/lib/helpers/spread.js + var require_spread = __commonJS({ + "../../node_modules/axios/lib/helpers/spread.js"(exports, module) { + "use strict"; + module.exports = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; + }; + } + }); + + // ../../node_modules/axios/lib/helpers/isAxiosError.js + var require_isAxiosError = __commonJS({ + "../../node_modules/axios/lib/helpers/isAxiosError.js"(exports, module) { + "use strict"; + module.exports = function isAxiosError(payload) { + return typeof payload === "object" && payload.isAxiosError === true; + }; + } + }); + + // ../../node_modules/axios/lib/axios.js + var require_axios = __commonJS({ + "../../node_modules/axios/lib/axios.js"(exports, module) { + "use strict"; + var utils = require_utils(); + var bind = require_bind(); + var Axios = require_Axios(); + var mergeConfig = require_mergeConfig(); + var defaults = require_defaults(); + function createInstance(defaultConfig) { + var context = new Axios(defaultConfig); + var instance = bind(Axios.prototype.request, context); + utils.extend(instance, Axios.prototype, context); + utils.extend(instance, context); + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + return instance; + } + var axios = createInstance(defaults); + axios.Axios = Axios; + axios.Cancel = require_Cancel(); + axios.CancelToken = require_CancelToken(); + axios.isCancel = require_isCancel(); + axios.VERSION = require_data().version; + axios.all = function all(promises) { + return Promise.all(promises); + }; + axios.spread = require_spread(); + axios.isAxiosError = require_isAxiosError(); + module.exports = axios; + module.exports.default = axios; + } + }); + + // ../../node_modules/axios/index.js + var require_axios2 = __commonJS({ + "../../node_modules/axios/index.js"(exports, module) { + module.exports = require_axios(); + } + }); + + // ../../dist/src/fetch.js + var require_fetch = __commonJS({ + "../../dist/src/fetch.js"(exports) { + "use strict"; + var __importDefault = exports && exports.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.fetchActor = exports.fetchActorDigest = void 0; + var axios_1 = __importDefault(require_axios2()); + async function fetchActorDigest(actorRef, withTLS) { + const image = actorRef.split("/"); + const registry = image[0]; + const [name, version] = image[1].split(":"); + const response = await axios_1.default.get(`${withTLS ? "https://" : "http://"}${registry}/v2/${name}/manifests/${version}`, { + headers: { + Accept: "application/vnd.oci.image.manifest.v1+json" + } + }).catch((err) => { + throw err; + }); + const layers = response.data; + if (layers.layers.length === 0) { + throw new Error("no layers"); + } + return { + name, + digest: layers.layers[0].digest, + registry + }; + } + exports.fetchActorDigest = fetchActorDigest; + async function fetchActor(url) { + const response = await axios_1.default.get(url, { + responseType: "arraybuffer" + }).catch((err) => { + throw err; + }); + return new Uint8Array(response.data); + } + exports.fetchActor = fetchActor; + } + }); + + // ../../dist/wasmcloud-rs-js/pkg/index.js + var require_pkg = __commonJS({ + "../../dist/wasmcloud-rs-js/pkg/index.js"(exports, module) { + "use strict"; + (() => { + "use strict"; + var e, r, t, n, a = { 462: (e2, r2, t2) => { + t2.a(e2, async (e3, n2) => { + try { + t2.r(r2), t2.d(r2, { HostKey: () => a2.tL, __wbg_buffer_de1150f91b23aa89: () => a2.$r, __wbg_crypto_b8c92eaac23d0d80: () => a2.iY, __wbg_getRandomValues_dd27e6b0652b3236: () => a2.yX, __wbg_getRandomValues_e57c9b75ddead065: () => a2.ae, __wbg_length_e09c0b925ab8de5d: () => a2.uV, __wbg_msCrypto_9ad6677321a08dd8: () => a2.mS, __wbg_new_97cf52648830a70d: () => a2.xe, __wbg_newwithlength_e833b89f9db02732: () => a2.Nu, __wbg_randomFillSync_d2ba53160aec6aba: () => a2.Os, __wbg_require_f5521a5b85ad2542: () => a2.r2, __wbg_self_86b4b13392c7af56: () => a2.U5, __wbg_set_a0172b213e2469e9: () => a2.Rh, __wbg_static_accessor_MODULE_452b4680e8614c81: () => a2.DA, __wbg_subarray_9482ae5cd5cd99d3: () => a2.dx, __wbindgen_is_undefined: () => a2.XP, __wbindgen_memory: () => a2.oH, __wbindgen_object_drop_ref: () => a2.ug, __wbindgen_string_new: () => a2.h4, __wbindgen_throw: () => a2.Or, extract_jwt: () => a2.$n, validate_jwt: () => a2.Xo }); + var a2 = t2(194), _2 = e3([a2]); + a2 = (_2.then ? (await _2)() : _2)[0], n2(); + } catch (e4) { + n2(e4); + } + }); + }, 194: (e2, r2, t2) => { + t2.a(e2, async (n2, a2) => { + try { + let y = function(e3, r3) { + if (!(e3 instanceof r3)) + throw new TypeError("Cannot call a class as a function"); + }, p = function(e3, r3) { + for (var t3 = 0; t3 < r3.length; t3++) { + var n3 = r3[t3]; + n3.enumerable = n3.enumerable || false, n3.configurable = true, "value" in n3 && (n3.writable = true), Object.defineProperty(e3, n3.key, n3); + } + }, h = function() { + return 0 === i2.byteLength && (i2 = new Uint8Array(_2.memory.buffer)), i2; + }, m = function(e3, r3) { + return c.decode(h().subarray(e3, e3 + r3)); + }, v = function(e3) { + b === u.length && u.push(u.length + 1); + var r3 = b; + return b = u[r3], u[r3] = e3, r3; + }, x = function(e3) { + return u[e3]; + }, k = function(e3) { + e3 < 36 || (u[e3] = b, b = e3); + }, S = function(e3) { + var r3 = x(e3); + return k(e3), r3; + }, j = function() { + return 0 === d.byteLength && (d = new Int32Array(_2.memory.buffer)), d; + }, O = function(e3) { + if (1 == f) + throw new Error("out of js stack"); + return u[--f] = e3, f; + }, E = function(e3) { + try { + var r3 = _2.__wbindgen_add_to_stack_pointer(-16); + _2.extract_jwt(r3, O(e3)); + var t3 = j()[r3 / 4 + 0], n3 = j()[r3 / 4 + 1], a3 = j()[r3 / 4 + 2], o3 = j()[r3 / 4 + 3], i3 = t3, c2 = n3; + if (o3) + throw i3 = 0, c2 = 0, S(a3); + return m(i3, c2); + } finally { + _2.__wbindgen_add_to_stack_pointer(16), u[f++] = void 0, _2.__wbindgen_free(i3, c2); + } + }, A = function(e3, r3, t3) { + if (void 0 === t3) { + var n3 = w.encode(e3), a3 = r3(n3.length); + return h().subarray(a3, a3 + n3.length).set(n3), s = n3.length, a3; + } + for (var _3 = e3.length, o3 = r3(_3), i3 = h(), c2 = 0; c2 < _3; c2++) { + var u2 = e3.charCodeAt(c2); + if (u2 > 127) + break; + i3[o3 + c2] = u2; + } + if (c2 !== _3) { + 0 !== c2 && (e3 = e3.slice(c2)), o3 = t3(o3, _3, _3 = c2 + 3 * e3.length); + var d2 = h().subarray(o3 + c2, o3 + _3); + c2 += l(e3, d2).written; + } + return s = c2, o3; + }, P = function(e3) { + var r3 = A(e3, _2.__wbindgen_malloc, _2.__wbindgen_realloc), t3 = s; + return 0 !== _2.validate_jwt(r3, t3); + }, T = function(e3, r3) { + try { + return e3.apply(this, r3); + } catch (e4) { + _2.__wbindgen_exn_store(v(e4)); + } + }, U = function(e3, r3) { + return v(m(e3, r3)); + }, R = function(e3) { + S(e3); + }, V = function(e3, r3, t3) { + var n3, a3; + x(e3).randomFillSync((n3 = r3, a3 = t3, h().subarray(n3 / 1, n3 / 1 + a3))); + }, D = function(e3, r3) { + x(e3).getRandomValues(x(r3)); + }, X = function() { + return T(function() { + return v(self.self); + }, arguments); + }, $ = function(e3) { + return v(x(e3).crypto); + }, q = function(e3) { + return v(x(e3).msCrypto); + }, M = function(e3) { + return void 0 === x(e3); + }, L = function(e3, r3, t3) { + return v(x(e3).require(m(r3, t3))); + }, C = function(e3) { + return v(x(e3).getRandomValues); + }, F = function() { + return v(e2); + }, H = function(e3) { + return v(x(e3).buffer); + }, I = function(e3) { + return v(new Uint8Array(x(e3))); + }, N = function(e3, r3, t3) { + x(e3).set(x(r3), t3 >>> 0); + }, B = function(e3) { + return x(e3).length; + }, W = function(e3) { + return v(new Uint8Array(e3 >>> 0)); + }, Y = function(e3, r3, t3) { + return v(x(e3).subarray(r3 >>> 0, t3 >>> 0)); + }, K = function(e3, r3) { + throw new Error(m(e3, r3)); + }, z = function() { + return v(_2.memory); + }; + t2.d(r2, { $n: () => E, $r: () => H, DA: () => F, Nu: () => W, Or: () => K, Os: () => V, Rh: () => N, U5: () => X, XP: () => M, Xo: () => P, ae: () => D, dx: () => Y, h4: () => U, iY: () => $, mS: () => q, oH: () => z, r2: () => L, tL: () => g, uV: () => B, ug: () => R, xe: () => I, yX: () => C }); + var _2 = t2(293); + e2 = t2.hmd(e2); + var o2 = n2([_2]); + _2 = (o2.then ? (await o2)() : o2)[0]; + var i2, c = new ("undefined" == typeof TextDecoder ? (0, e2.require)("util").TextDecoder : TextDecoder)("utf-8", { ignoreBOM: true, fatal: true }); + c.decode(); + var u = new Array(32).fill(void 0); + u.push(void 0, null, true, false); + var d, b = u.length; + var f = 32; + var s = 0, w = new ("undefined" == typeof TextEncoder ? (0, e2.require)("util").TextEncoder : TextEncoder)("utf-8"), l = "function" == typeof w.encodeInto ? function(e3, r3) { + return w.encodeInto(e3, r3); + } : function(e3, r3) { + var t3 = w.encode(e3); + return r3.set(t3), { read: e3.length, written: t3.length }; + }; + var g = function() { + function e3() { + y(this, e3); + var r4 = _2.hostkey_new(); + return e3.__wrap(r4); + } + var r3, t3, n3; + return r3 = e3, n3 = [{ key: "__wrap", value: function(r4) { + var t4 = Object.create(e3.prototype); + return t4.ptr = r4, t4; + } }], (t3 = [{ key: "__destroy_into_raw", value: function() { + var e4 = this.ptr; + return this.ptr = 0, e4; + } }, { key: "free", value: function() { + var e4 = this.__destroy_into_raw(); + _2.__wbg_hostkey_free(e4); + } }, { key: "pk", get: function() { + try { + var e4 = _2.__wbindgen_add_to_stack_pointer(-16); + _2.hostkey_pk(e4, this.ptr); + var r4 = j()[e4 / 4 + 0], t4 = j()[e4 / 4 + 1]; + return m(r4, t4); + } finally { + _2.__wbindgen_add_to_stack_pointer(16), _2.__wbindgen_free(r4, t4); + } + } }, { key: "seed", get: function() { + try { + var e4 = _2.__wbindgen_add_to_stack_pointer(-16); + _2.hostkey_seed(e4, this.ptr); + var r4 = j()[e4 / 4 + 0], t4 = j()[e4 / 4 + 1]; + return m(r4, t4); + } finally { + _2.__wbindgen_add_to_stack_pointer(16), _2.__wbindgen_free(r4, t4); + } + } }]) && p(r3.prototype, t3), n3 && p(r3, n3), e3; + }(); + d = new Int32Array(_2.memory.buffer), i2 = new Uint8Array(_2.memory.buffer), a2(); + } catch (e3) { + a2(e3); + } + }); + }, 293: (e2, r2, t2) => { + t2.a(e2, async (n2, a2) => { + try { + var _2, o2 = n2([_2 = t2(194)]), [_2] = o2.then ? (await o2)() : o2; + await t2.v(r2, e2.id, "cb0a530d888b2657c6eb", { "./index_bg.js": { __wbindgen_string_new: _2.h4, __wbindgen_object_drop_ref: _2.ug, __wbg_randomFillSync_d2ba53160aec6aba: _2.Os, __wbg_getRandomValues_e57c9b75ddead065: _2.ae, __wbg_self_86b4b13392c7af56: _2.U5, __wbg_crypto_b8c92eaac23d0d80: _2.iY, __wbg_msCrypto_9ad6677321a08dd8: _2.mS, __wbindgen_is_undefined: _2.XP, __wbg_require_f5521a5b85ad2542: _2.r2, __wbg_getRandomValues_dd27e6b0652b3236: _2.yX, __wbg_static_accessor_MODULE_452b4680e8614c81: _2.DA, __wbg_buffer_de1150f91b23aa89: _2.$r, __wbg_new_97cf52648830a70d: _2.xe, __wbg_set_a0172b213e2469e9: _2.Rh, __wbg_length_e09c0b925ab8de5d: _2.uV, __wbg_newwithlength_e833b89f9db02732: _2.Nu, __wbg_subarray_9482ae5cd5cd99d3: _2.dx, __wbindgen_throw: _2.Or, __wbindgen_memory: _2.oH } }), a2(); + } catch (e3) { + a2(e3); + } + }, 1); + } }, _ = {}; + function o(e2) { + var r2 = _[e2]; + if (void 0 !== r2) + return r2.exports; + var t2 = _[e2] = { id: e2, loaded: false, exports: {} }; + return a[e2](t2, t2.exports, o), t2.loaded = true, t2.exports; + } + e = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__", r = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__", t = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__", n = (e2) => { + e2 && !e2.d && (e2.d = 1, e2.forEach((e3) => e3.r--), e2.forEach((e3) => e3.r-- ? e3.r++ : e3())); + }, o.a = (a2, _2, o2) => { + var i2; + o2 && ((i2 = []).d = 1); + var c, u, d, b = /* @__PURE__ */ new Set(), f = a2.exports, s = new Promise((e2, r2) => { + d = r2, u = e2; + }); + s[r] = f, s[e] = (e2) => (i2 && e2(i2), b.forEach(e2), s.catch((e3) => { + })), a2.exports = s, _2((a3) => { + var _3; + c = ((a4) => a4.map((a5) => { + if (null !== a5 && "object" == typeof a5) { + if (a5[e]) + return a5; + if (a5.then) { + var _4 = []; + _4.d = 0, a5.then((e2) => { + o4[r] = e2, n(_4); + }, (e2) => { + o4[t] = e2, n(_4); + }); + var o4 = {}; + return o4[e] = (e2) => e2(_4), o4; + } + } + var i3 = {}; + return i3[e] = (e2) => { + }, i3[r] = a5, i3; + }))(a3); + var o3 = () => c.map((e2) => { + if (e2[t]) + throw e2[t]; + return e2[r]; + }), u2 = new Promise((r2) => { + (_3 = () => r2(o3)).r = 0; + var t2 = (e2) => e2 !== i2 && !b.has(e2) && (b.add(e2), e2 && !e2.d && (_3.r++, e2.push(_3))); + c.map((r3) => r3[e](t2)); + }); + return _3.r ? u2 : o3(); + }, (e2) => (e2 ? d(s[t] = e2) : u(f), n(i2))), i2 && (i2.d = 0); + }, o.d = (e2, r2) => { + for (var t2 in r2) + o.o(r2, t2) && !o.o(e2, t2) && Object.defineProperty(e2, t2, { enumerable: true, get: r2[t2] }); + }, o.g = function() { + if ("object" == typeof globalThis) + return globalThis; + try { + return this || new Function("return this")(); + } catch (e2) { + if ("object" == typeof window) + return window; + } + }(), o.hmd = (e2) => ((e2 = Object.create(e2)).children || (e2.children = []), Object.defineProperty(e2, "exports", { enumerable: true, set: () => { + throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: " + e2.id); + } }), e2), o.o = (e2, r2) => Object.prototype.hasOwnProperty.call(e2, r2), o.r = (e2) => { + "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true }); + }, o.v = (e2, r2, t2, n2) => { + var a2 = fetch(o.p + "wasmcloud.wasm"); + return "function" == typeof WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(a2, n2).then((r3) => Object.assign(e2, r3.instance.exports)) : a2.then((e3) => e3.arrayBuffer()).then((e3) => WebAssembly.instantiate(e3, n2)).then((r3) => Object.assign(e2, r3.instance.exports)); + }, (() => { + var e2; + o.g.importScripts && (e2 = o.g.location + ""); + var r2 = o.g.document; + if (!e2 && r2 && (r2.currentScript && (e2 = r2.currentScript.src), !e2)) { + var t2 = r2.getElementsByTagName("script"); + t2.length && (e2 = t2[t2.length - 1].src); + } + if (!e2) + throw new Error("Automatic publicPath is not supported in this browser"); + e2 = e2.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/"), o.p = e2; + })(); + var i = o(462); + module.exports = i; + })(); + } + }); + + // ../../dist/src/host.js + var require_host = __commonJS({ + "../../dist/src/host.js"(exports) { + "use strict"; + var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) + k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports && exports.__importStar || function(mod) { + if (mod && mod.__esModule) + return mod; + var result = {}; + if (mod != null) { + for (var k in mod) + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) + __createBinding(result, mod, k); + } + __setModuleDefault(result, mod); + return result; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.startHost = exports.Host = void 0; + var msgpack_1 = require_dist(); + var nats_ws_1 = require_nats2(); + var actor_1 = require_actor(); + var events_1 = require_events(); + var fetch_1 = require_fetch(); + var util_1 = require_util4(); + var HOST_HEARTBEAT_INTERVAL = 3e4; + var Host = class { + constructor(name = "default", withRegistryTLS, heartbeatInterval, natsConnOpts, wasm) { + const hostKey = new wasm.HostKey(); + this.name = name; + this.key = hostKey.pk; + this.seed = hostKey.seed; + this.withRegistryTLS = withRegistryTLS; + this.actors = {}; + this.labels = { + "hostcore.arch": "web", + "hostcore.os": "browser", + "hostcore.osfamily": "js" + }; + this.friendlyName = `java-script-${Math.round(Math.random() * 9999)}`; + this.wasm = wasm; + this.heartbeatInterval = heartbeatInterval; + this.natsConnOpts = natsConnOpts; + this.invocationCallbacks = {}; + this.hostCalls = {}; + this.writers = {}; + } + async connectNATS() { + const opts = Array.isArray(this.natsConnOpts) ? { + servers: this.natsConnOpts + } : this.natsConnOpts; + this.natsConn = await nats_ws_1.connect(opts); + } + async disconnectNATS() { + this.natsConn.close(); + } + async startHeartbeat() { + this.heartbeatIntervalId; + const heartbeat = { + actors: [], + providers: [], + labels: this.labels + }; + for (const actor in this.actors) { + heartbeat.actors.push({ + actor, + instances: 1 + }); + } + const heartbeatFn = () => { + this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.HeartBeat, heartbeat))); + }; + this.heartbeatIntervalId = setInterval(heartbeatFn, this.heartbeatInterval); + } + async stopHeartbeat() { + clearInterval(this.heartbeatIntervalId); + this.heartbeatIntervalId = null; + } + async publishHostStarted() { + const hostStarted = { + labels: this.labels, + friendly_name: this.friendlyName + }; + this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.HostStarted, hostStarted))); + } + async subscribeToEvents(eventCallback) { + this.eventsSubscription = this.natsConn.subscribe(`wasmbus.evt.${this.name}`); + for await (const event of this.eventsSubscription) { + const eventData = util_1.jsonDecode(event.data); + if (eventCallback) { + eventCallback(eventData); + } + } + throw new Error("evt subscription was closed"); + } + async unsubscribeEvents() { + var _a; + (_a = this.eventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe(); + this.eventsSubscription = null; + } + async launchActor(actorRef, invocationCallback, hostCall, writer) { + const actor = { + actor_ref: actorRef, + host_id: this.key + }; + this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`, util_1.jsonEncode(actor)); + if (invocationCallback) { + this.invocationCallbacks[actorRef] = invocationCallback; + } + if (hostCall) { + this.hostCalls[actorRef] = hostCall; + } + if (writer) { + this.writers[actorRef] = writer; + } + } + async stopActor(actorRef) { + const actorToStop = { + host_id: this.key, + actor_ref: actorRef + }; + this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`, util_1.jsonEncode(actorToStop)); + } + async listenLaunchActor() { + var _a, _b, _c; + const actorsTopic = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`); + for await (const actorMessage of actorsTopic) { + const actorData = util_1.jsonDecode(actorMessage.data); + const actorRef = actorData.actor_ref; + const usingRegistry = !actorRef.endsWith(".wasm"); + try { + let url; + if (usingRegistry) { + const actorDigest = await fetch_1.fetchActorDigest(actorRef); + url = `${this.withRegistryTLS ? "https://" : "http://"}${actorDigest.registry}/v2/${actorDigest.name}/blobs/${actorDigest.digest}`; + } else { + url = actorRef; + } + const actorModule = await fetch_1.fetchActor(url); + const actor = await actor_1.startActor(this.name, this.key, actorModule, this.natsConn, this.wasm, (_a = this.invocationCallbacks) === null || _a === void 0 ? void 0 : _a[actorRef], (_b = this.hostCalls) === null || _b === void 0 ? void 0 : _b[actorRef], (_c = this.writers) === null || _c === void 0 ? void 0 : _c[actorRef]); + if (this.actors[actorRef]) { + this.actors[actorRef].count++; + } else { + this.actors[actorRef] = { + count: 1, + actor + }; + } + } catch (err) { + console.log("error", err); + } + } + throw new Error("la.subscription was closed"); + } + async listenStopActor() { + const actorsTopic = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`); + for await (const actorMessage of actorsTopic) { + const actorData = util_1.jsonDecode(actorMessage.data); + const actorStop = { + instance_id: util_1.uuidv4(), + public_key: this.actors[actorData.actor_ref].actor.key + }; + this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.ActorStopped, actorStop))); + delete this.actors[actorData.actor_ref]; + delete this.invocationCallbacks[actorData.actor_ref]; + } + throw new Error("sa.subscription was closed"); + } + async createLinkDefinition(actorKey, providerKey, linkName, contractId, values) { + const linkDefinition = { + actor_id: actorKey, + provider_id: providerKey, + link_name: linkName, + contract_id: contractId, + values + }; + this.natsConn.publish(`wasmbus.rpc.${this.name}.${providerKey}.${linkName}.linkdefs.put`, msgpack_1.encode(linkDefinition)); + } + async startHost() { + await this.connectNATS(); + Promise.all([ + this.publishHostStarted(), + this.startHeartbeat(), + this.listenLaunchActor(), + this.listenStopActor() + ]).catch((err) => { + throw err; + }); + } + async stopHost() { + await this.stopHeartbeat(); + for (const actor in this.actors) { + await this.stopActor(actor); + } + await this.natsConn.drain(); + await this.disconnectNATS(); + } + }; + exports.Host = Host; + async function startHost2(name, withRegistryTLS = true, natsConnection, heartbeatInterval) { + const wasmModule = await Promise.resolve().then(() => __importStar(require_pkg())); + const wasm = await wasmModule.default; + const host = new Host(name, withRegistryTLS, heartbeatInterval ? heartbeatInterval : HOST_HEARTBEAT_INTERVAL, natsConnection, wasm); + await host.startHost(); + return host; + } + exports.startHost = startHost2; + } + }); + + // ../../dist/src/index.js + var require_src2 = __commonJS({ + "../../dist/src/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.startHost = void 0; + var host_1 = require_host(); + Object.defineProperty(exports, "startHost", { enumerable: true, get: function() { + return host_1.startHost; + } }); + } + }); + + // main.js + var import_src = __toESM(require_src2()); + var runningHosts = []; + document.getElementById("hostButton").onclick = () => { + const latticePrefixInput = document.getElementById("latticePrefix"); + if (!latticePrefixInput || !latticePrefixInput.value || latticePrefixInput.value === "") { + (async () => { + const host = await (0, import_src.startHost)("374b6434-f18d-4b93-8743-bcd3089e4d5b", false, ["ws://localhost:6222"]); + runningHosts.push(host); + document.getElementById("runningHosts").innerHTML = hostList(runningHosts).innerHTML; + console.dir(runningHosts); + })(); + } else { + (async () => { + const host = await (0, import_src.startHost)(latticePrefixInput.value, false, ["ws://localhost:6222"]); + runningHosts.push(host); + document.getElementById("runningHosts").innerHTML = hostList(runningHosts).innerHTML; + console.dir(runningHosts); + })(); + } + }; + function hostList(runningHosts2) { + let list = document.createElement("ol"); + runningHosts2.forEach((host) => { + console.dir(host); + let listItem = document.createElement("li"); + listItem.innerText = host.friendlyName; + list.appendChild(listItem); + }); + return list; + } +})(); diff --git a/package-lock.json b/package-lock.json index 89de649..d2e39c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,8 +1,6787 @@ { "name": "@wasmcloud/wasmcloud-js", "version": "1.0.6", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "@wasmcloud/wasmcloud-js", + "version": "1.0.6", + "license": "ISC", + "dependencies": { + "@msgpack/msgpack": "^2.8.0", + "@wapc/host": "0.0.2", + "axios": "^0.24.0", + "copy-webpack-plugin": "^11.0.0", + "esbuild": "^0.16.9", + "fs": "^0.0.1-security", + "nats.ws": "^1.2.0" + }, + "devDependencies": { + "@babel/core": "^7.15.0", + "@babel/preset-env": "^7.15.0", + "@types/chai": "^4.2.21", + "@types/chai-as-promised": "^7.1.4", + "@types/mocha": "^9.0.0", + "@typescript-eslint/eslint-plugin": "^4.22.0", + "@typescript-eslint/parser": "^4.29.2", + "@wasm-tool/wasm-pack-plugin": "^1.5.0", + "babel-loader": "^8.2.2", + "chai": "^4.3.4", + "chai-as-promised": "^7.1.1", + "eslint": "^7.32.0", + "mocha": "^9.0.3", + "path": "^0.12.7", + "prettier": "^2.3.2", + "ts-loader": "^9.2.5", + "ts-node": "^10.2.1", + "typescript": "^4.3.5", + "webpack": "^5.75.0", + "webpack-cli": "^4.8.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.12.11", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz", + "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.10.4" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.15.0.tgz", + "integrity": "sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.15.0.tgz", + "integrity": "sha512-tXtmTminrze5HEUPn/a0JtOzzfp0nk+UEXQ/tqIJo3WDGypl/2OFQEMll/zSFU8f/lfmfLXvTaORHF3cfXIQMw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.0", + "@babel/helper-compilation-targets": "^7.15.0", + "@babel/helper-module-transforms": "^7.15.0", + "@babel/helpers": "^7.14.8", + "@babel/parser": "^7.15.0", + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.15.0", + "@babel/types": "^7.15.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/core/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.15.0.tgz", + "integrity": "sha512-eKl4XdMrbpYvuB505KTta4AV9g+wWzmVBW69tX0H2NwKVKd2YJbKgyK6M8j/rgLbmHOYJn6rUklV677nOyJrEQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.15.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.14.5.tgz", + "integrity": "sha512-EivH9EgBIb+G8ij1B2jAwSH36WnGvkQSEC6CkX/6v6ZFlw5fVOHvsgGF4uiEHO2GzMvunZb6tDLQEQSdrdocrA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.14.5.tgz", + "integrity": "sha512-YTA/Twn0vBXDVGJuAX6PwW7x5zQei1luDDo2Pl6q1qZ7hVNl0RZrhHCQG/ArGpR29Vl7ETiB8eJyrvpuRp300w==", + "dev": true, + "dependencies": { + "@babel/helper-explode-assignable-expression": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.0.tgz", + "integrity": "sha512-h+/9t0ncd4jfZ8wsdAsoIxSa61qhBYlycXiHWqJaQBCXAhDCMbPRSMTGnZIkkmt1u4ag+UQmuqcILwqKzZ4N2A==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.15.0", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.16.6", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.15.0.tgz", + "integrity": "sha512-MdmDXgvTIi4heDVX/e9EFfeGpugqm9fobBVg/iioE8kueXrOHdRDe36FAY7SnE9xXLVeYCoJR/gdrBEIHRC83Q==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-member-expression-to-functions": "^7.15.0", + "@babel/helper-optimise-call-expression": "^7.14.5", + "@babel/helper-replace-supers": "^7.15.0", + "@babel/helper-split-export-declaration": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.14.5.tgz", + "integrity": "sha512-TLawwqpOErY2HhWbGJ2nZT5wSkR192QpN+nBg1THfBfftrlvOh+WbhrxXCH4q4xJ9Gl16BGPR/48JA+Ryiho/A==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "regexpu-core": "^4.7.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.2.3.tgz", + "integrity": "sha512-RH3QDAfRMzj7+0Nqu5oqgO5q9mFtQEVvCRsi8qCEfzLR9p2BHfn5FzhSB2oj1fF7I2+DcTORkYaQ6aTR9Cofew==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0-0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-explode-assignable-expression": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.14.5.tgz", + "integrity": "sha512-Htb24gnGJdIGT4vnRKMdoXiOIlqOLmdiUYpAQ0mYfgVT/GDm8GOYhgi4GL+hMKrkiPRohO4ts34ELFsGAPQLDQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.14.5.tgz", + "integrity": "sha512-Gjna0AsXWfFvrAuX+VKcN/aNNWonizBj39yGwUzVDVTlMYJMK2Wp6xdpy72mfArFq5uK+NOuexfzZlzI1z9+AQ==", + "dev": true, + "dependencies": { + "@babel/helper-get-function-arity": "^7.14.5", + "@babel/template": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.14.5.tgz", + "integrity": "sha512-I1Db4Shst5lewOM4V+ZKJzQ0JGGaZ6VY1jYvMghRjqs6DWgxLCIyFt30GlnKkfUeFLpJt2vzbMVEXVSXlIFYUg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.14.5.tgz", + "integrity": "sha512-R1PXiz31Uc0Vxy4OEOm07x0oSjKAdPPCh3tPivn/Eo8cvz6gveAeuyUUPB21Hoiif0uoPQSSdhIPS3352nvdyQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.15.0.tgz", + "integrity": "sha512-Jq8H8U2kYiafuj2xMTPQwkTBnEEdGKpT35lJEQsRRjnG0LW3neucsaMWLgKcwu3OHKNeYugfw+Z20BXBSEs2Lg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.15.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.14.5.tgz", + "integrity": "sha512-SwrNHu5QWS84XlHwGYPDtCxcA0hrSlL2yhWYLgeOc0w7ccOl2qv4s/nARI0aYZW+bSwAL5CukeXA47B/1NKcnQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.15.0.tgz", + "integrity": "sha512-RkGiW5Rer7fpXv9m1B3iHIFDZdItnO2/BLfWVW/9q7+KqQSDY5kUfQEbzdXM1MVhJGcugKV7kRrNVzNxmk7NBg==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.14.5", + "@babel/helper-replace-supers": "^7.15.0", + "@babel/helper-simple-access": "^7.14.8", + "@babel/helper-split-export-declaration": "^7.14.5", + "@babel/helper-validator-identifier": "^7.14.9", + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.15.0", + "@babel/types": "^7.15.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.14.5.tgz", + "integrity": "sha512-IqiLIrODUOdnPU9/F8ib1Fx2ohlgDhxnIDU7OEVi+kAbEZcyiF7BLU8W6PfvPi9LzztjS7kcbzbmL7oG8kD6VA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.14.5.tgz", + "integrity": "sha512-/37qQCE3K0vvZKwoK4XU/irIJQdIfCJuhU5eKnNxpFDsOkgFaUAwbv+RYw6eYgsC0E4hS7r5KqGULUogqui0fQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.14.5.tgz", + "integrity": "sha512-rLQKdQU+HYlxBwQIj8dk4/0ENOUEhA/Z0l4hN8BexpvmSMN9oA9EagjnhnDpNsRdWCfjwa4mn/HyBXO9yhQP6A==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "@babel/helper-wrap-function": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.15.0.tgz", + "integrity": "sha512-6O+eWrhx+HEra/uJnifCwhwMd6Bp5+ZfZeJwbqUTuqkhIT6YcRhiZCOOFChRypOIe0cV46kFrRBlm+t5vHCEaA==", + "dev": true, + "dependencies": { + "@babel/helper-member-expression-to-functions": "^7.15.0", + "@babel/helper-optimise-call-expression": "^7.14.5", + "@babel/traverse": "^7.15.0", + "@babel/types": "^7.15.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.14.8", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.14.8.tgz", + "integrity": "sha512-TrFN4RHh9gnWEU+s7JloIho2T76GPwRHhdzOWLqTrMnlas8T9O7ec+oEDNsRXndOmru9ymH9DFrEOxpzPoSbdg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.14.5.tgz", + "integrity": "sha512-dmqZB7mrb94PZSAOYtr+ZN5qt5owZIAgqtoTuqiFbHFtxgEcmQlRJVI+bO++fciBunXtB6MK7HrzrfcAzIz2NQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.14.5.tgz", + "integrity": "sha512-hprxVPu6e5Kdp2puZUmvOGjaLv9TCe58E/Fl6hRq4YiVQxIcNvuq6uTM2r1mT/oPskuS9CgR+I94sqAYv0NGKA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.14.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.9.tgz", + "integrity": "sha512-pQYxPY0UP6IHISRitNe8bsijHex4TWZXi2HwKVsjPiltzlhse2znVcm9Ace510VT1kxIHjGJCZZQBX2gJDbo0g==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", + "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.14.5.tgz", + "integrity": "sha512-YEdjTCq+LNuNS1WfxsDCNpgXkJaIyqco6DAelTUjT4f2KIWC1nBcaCaSdHTBqQVLnTBexBcVcFhLSU1KnYuePQ==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.14.5", + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.15.3", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.15.3.tgz", + "integrity": "sha512-HwJiz52XaS96lX+28Tnbu31VeFSQJGOeKHJeaEPQlTl7PnlhFElWPj8tUXtqFIzeN86XxXoBr+WFAyK2PPVz6g==", + "dev": true, + "dependencies": { + "@babel/template": "^7.14.5", + "@babel/traverse": "^7.15.0", + "@babel/types": "^7.15.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.14.5.tgz", + "integrity": "sha512-qf9u2WFWVV0MppaL877j2dBtQIDgmidgjGk5VIMw3OadXvYaXn66U1BFlH2t4+t3i+8PhedppRv+i40ABzd+gg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.14.5", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.15.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.15.3.tgz", + "integrity": "sha512-O0L6v/HvqbdJawj0iBEfVQMc3/6WP+AeOsovsIgBFyJaG+W2w7eqvZB7puddATmWuARlm1SX7DwxJ/JJUnDpEA==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.14.5.tgz", + "integrity": "sha512-ZoJS2XCKPBfTmL122iP6NM9dOg+d4lc9fFk3zxc8iDjvt8Pk4+TlsHSKhIPf6X+L5ORCdBzqMZDjL/WHj7WknQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5", + "@babel/plugin-proposal-optional-chaining": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-proposal-async-generator-functions": { + "version": "7.14.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.14.9.tgz", + "integrity": "sha512-d1lnh+ZnKrFKwtTYdw320+sQWCTwgkB9fmUhNXRADA4akR6wLjaruSGnIEUjpt9HCOwTr4ynFTKu19b7rFRpmw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-remap-async-to-generator": "^7.14.5", + "@babel/plugin-syntax-async-generators": "^7.8.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-properties": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.14.5.tgz", + "integrity": "sha512-q/PLpv5Ko4dVc1LYMpCY7RVAAO4uk55qPwrIuJ5QJ8c6cVuAmhu7I/49JOppXL6gXf7ZHzpRVEUZdYoPLM04Gg==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.14.5.tgz", + "integrity": "sha512-KBAH5ksEnYHCegqseI5N9skTdxgJdmDoAOc0uXa+4QMYKeZD0w5IARh4FMlTNtaHhbB8v+KzMdTgxMMzsIy6Yg==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-proposal-dynamic-import": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.14.5.tgz", + "integrity": "sha512-ExjiNYc3HDN5PXJx+bwC50GIx/KKanX2HiggnIUAYedbARdImiCU4RhhHfdf0Kd7JNXGpsBBBCOm+bBVy3Gb0g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-export-namespace-from": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.14.5.tgz", + "integrity": "sha512-g5POA32bXPMmSBu5Dx/iZGLGnKmKPc5AiY7qfZgurzrCYgIztDlHFbznSNCoQuv57YQLnQfaDi7dxCtLDIdXdA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-json-strings": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.14.5.tgz", + "integrity": "sha512-NSq2fczJYKVRIsUJyNxrVUMhB27zb7N7pOFGQOhBKJrChbGcgEAqyZrmZswkPk18VMurEeJAaICbfm57vUeTbQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.14.5.tgz", + "integrity": "sha512-YGn2AvZAo9TwyhlLvCCWxD90Xq8xJ4aSgaX3G5D/8DW94L8aaT+dS5cSP+Z06+rCJERGSr9GxMBZ601xoc2taw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.14.5.tgz", + "integrity": "sha512-gun/SOnMqjSb98Nkaq2rTKMwervfdAoz6NphdY0vTfuzMfryj+tDGb2n6UkDKwez+Y8PZDhE3D143v6Gepp4Hg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-numeric-separator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.14.5.tgz", + "integrity": "sha512-yiclALKe0vyZRZE0pS6RXgjUOt87GWv6FYa5zqj15PvhOGFO69R5DusPlgK/1K5dVnCtegTiWu9UaBSrLLJJBg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-object-rest-spread": { + "version": "7.14.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.7.tgz", + "integrity": "sha512-082hsZz+sVabfmDWo1Oct1u1AgbKbUAyVgmX4otIc7bdsRgHBXwTwb3DpDmD4Eyyx6DNiuz5UAATT655k+kL5g==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.14.7", + "@babel/helper-compilation-targets": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-catch-binding": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.14.5.tgz", + "integrity": "sha512-3Oyiixm0ur7bzO5ybNcZFlmVsygSIQgdOa7cTfOYCMY+wEPAYhZAJxi3mixKFCTCKUhQXuCTtQ1MzrpL3WT8ZQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-chaining": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.14.5.tgz", + "integrity": "sha512-ycz+VOzo2UbWNI1rQXxIuMOzrDdHGrI23fRiz/Si2R4kv2XZQ1BK8ccdHwehMKBlcH/joGW/tzrUmo67gbJHlQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-methods": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.14.5.tgz", + "integrity": "sha512-838DkdUA1u+QTCplatfq4B7+1lnDa/+QMI89x5WZHBcnNv+47N8QEj2k9I2MUU9xIv8XJ4XvPCviM/Dj7Uwt9g==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-62EyfyA3WA0mZiF2e2IV9mc9Ghwxcg8YTu8BS4Wss4Y3PY725OmS9M0qLORbJwLqFtGh+jiE4wAmocK2CTUK2Q==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "@babel/helper-create-class-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-unicode-property-regex": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.14.5.tgz", + "integrity": "sha512-6axIeOU5LnY471KenAB9vI8I5j7NQ2d652hIYwVyRfgaZT5UpiqFKCuVXCDMSrU+3VFafnu2c5m3lrWIlr6A5Q==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.14.5.tgz", + "integrity": "sha512-KOnO0l4+tD5IfOdi4x8C1XmEIRWUjNRV8wc6K2vz/3e8yAOoZZvsRXRRIF/yo/MAOFb4QjtAw9xSxMXbSMRy8A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.14.5.tgz", + "integrity": "sha512-szkbzQ0mNk0rpu76fzDdqSyPu0MuvpXgC+6rz5rpMb5OIRxdmHfQxrktL8CYolL2d8luMCZTR0DpIMIdL27IjA==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-remap-async-to-generator": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.14.5.tgz", + "integrity": "sha512-dtqWqdWZ5NqBX3KzsVCWfQI3A53Ft5pWFCT2eCVUftWZgjc5DpDponbIF1+c+7cSGk2wN0YK7HGL/ezfRbpKBQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.15.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.15.3.tgz", + "integrity": "sha512-nBAzfZwZb4DkaGtOes1Up1nOAp9TDRRFw4XBzBBSG9QK7KVFmYzgj9o9sbPv7TX5ofL4Auq4wZnxCoPnI/lz2Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.14.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.14.9.tgz", + "integrity": "sha512-NfZpTcxU3foGWbl4wxmZ35mTsYJy8oQocbeIMoDAGGFarAmSQlL+LWMkDx/tj6pNotpbX3rltIA4dprgAPOq5A==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.14.5", + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-optimise-call-expression": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-replace-supers": "^7.14.5", + "@babel/helper-split-export-declaration": "^7.14.5", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-classes/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.14.5.tgz", + "integrity": "sha512-pWM+E4283UxaVzLb8UBXv4EIxMovU4zxT1OPnpHJcmnvyY9QbPPTKZfEj31EUvG3/EQRbYAGaYEUZ4yWOBC2xg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.14.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.14.7.tgz", + "integrity": "sha512-0mDE99nK+kVh3xlc5vKwB6wnP9ecuSj+zQCa/n0voENtP/zymdT4HH6QEb65wjjcbqr1Jb/7z9Qp7TF5FtwYGw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.14.5.tgz", + "integrity": "sha512-loGlnBdj02MDsFaHhAIJzh7euK89lBrGIdM9EAtHFo6xKygCUGuuWe07o1oZVk287amtW1n0808sQM99aZt3gw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.14.5.tgz", + "integrity": "sha512-iJjbI53huKbPDAsJ8EmVmvCKeeq21bAze4fu9GBQtSLqfvzj2oRuHVx4ZkDwEhg1htQ+5OBZh/Ab0XDf5iBZ7A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.14.5.tgz", + "integrity": "sha512-jFazJhMBc9D27o9jDnIE5ZErI0R0m7PbKXVq77FFvqFbzvTMuv8jaAwLZ5PviOLSFttqKIW0/wxNSDbjLk0tYA==", + "dev": true, + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.14.5.tgz", + "integrity": "sha512-CfmqxSUZzBl0rSjpoQSFoR9UEj3HzbGuGNL21/iFTmjb5gFggJp3ph0xR1YBhexmLoKRHzgxuFvty2xdSt6gTA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.14.5.tgz", + "integrity": "sha512-vbO6kv0fIzZ1GpmGQuvbwwm+O4Cbm2NrPzwlup9+/3fdkuzo1YqOZcXw26+YUJB84Ja7j9yURWposEHLYwxUfQ==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.14.5.tgz", + "integrity": "sha512-ql33+epql2F49bi8aHXxvLURHkxJbSmMKl9J5yHqg4PLtdE6Uc48CH1GS6TQvZ86eoB/ApZXwm7jlA+B3kra7A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.14.5.tgz", + "integrity": "sha512-WkNXxH1VXVTKarWFqmso83xl+2V3Eo28YY5utIkbsmXoItO8Q3aZxN4BTS2k0hz9dGUloHK26mJMyQEYfkn/+Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.14.5.tgz", + "integrity": "sha512-3lpOU8Vxmp3roC4vzFpSdEpGUWSMsHFreTWOMMLzel2gNGfHE5UWIh/LN6ghHs2xurUp4jRFYMUIZhuFbody1g==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.15.0.tgz", + "integrity": "sha512-3H/R9s8cXcOGE8kgMlmjYYC9nqr5ELiPkJn4q0mypBrjhYQoc+5/Maq69vV4xRPWnkzZuwJPf5rArxpB/35Cig==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.15.0", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-simple-access": "^7.14.8", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.14.5.tgz", + "integrity": "sha512-mNMQdvBEE5DcMQaL5LbzXFMANrQjd2W7FPzg34Y4yEz7dBgdaC+9B84dSO+/1Wba98zoDbInctCDo4JGxz1VYA==", + "dev": true, + "dependencies": { + "@babel/helper-hoist-variables": "^7.14.5", + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-identifier": "^7.14.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.14.5.tgz", + "integrity": "sha512-RfPGoagSngC06LsGUYyM9QWSXZ8MysEjDJTAea1lqRjNECE3y0qIJF/qbvJxc4oA4s99HumIMdXOrd+TdKaAAA==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.14.9", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.14.9.tgz", + "integrity": "sha512-l666wCVYO75mlAtGFfyFwnWmIXQm3kSH0C3IRnJqWcZbWkoihyAdDhFm2ZWaxWTqvBvhVFfJjMRQ0ez4oN1yYA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.14.5.tgz", + "integrity": "sha512-Nx054zovz6IIRWEB49RDRuXGI4Gy0GMgqG0cII9L3MxqgXz/+rgII+RU58qpo4g7tNEx1jG7rRVH4ihZoP4esQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.14.5.tgz", + "integrity": "sha512-MKfOBWzK0pZIrav9z/hkRqIk/2bTv9qvxHzPQc12RcVkMOzpIKnFCNYJip00ssKWYkd8Sf5g0Wr7pqJ+cmtuFg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-replace-supers": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.14.5.tgz", + "integrity": "sha512-Tl7LWdr6HUxTmzQtzuU14SqbgrSKmaR77M0OKyq4njZLQTPfOvzblNKyNkGwOfEFCEx7KeYHQHDI0P3F02IVkA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.14.5.tgz", + "integrity": "sha512-r1uilDthkgXW8Z1vJz2dKYLV1tuw2xsbrp3MrZmD99Wh9vsfKoob+JTgri5VUb/JqyKRXotlOtwgu4stIYCmnw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.14.5.tgz", + "integrity": "sha512-NVIY1W3ITDP5xQl50NgTKlZ0GrotKtLna08/uGY6ErQt6VEQZXla86x/CTddm5gZdcr+5GSsvMeTmWA5Ii6pkg==", + "dev": true, + "dependencies": { + "regenerator-transform": "^0.14.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.14.5.tgz", + "integrity": "sha512-cv4F2rv1nD4qdexOGsRQXJrOcyb5CrgjUH9PKrrtyhSDBNWGxd0UIitjyJiWagS+EbUGjG++22mGH1Pub8D6Vg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.14.5.tgz", + "integrity": "sha512-xLucks6T1VmGsTB+GWK5Pl9Jl5+nRXD1uoFdA5TSO6xtiNjtXTjKkmPdFXVLGlK5A2/or/wQMKfmQ2Y0XJfn5g==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.14.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.14.6.tgz", + "integrity": "sha512-Zr0x0YroFJku7n7+/HH3A2eIrGMjbmAIbJSVv0IZ+t3U2WUQUA64S/oeied2e+MaGSjmt4alzBCsK9E8gh+fag==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.14.5.tgz", + "integrity": "sha512-Z7F7GyvEMzIIbwnziAZmnSNpdijdr4dWt+FJNBnBLz5mwDFkqIXU9wmBcWWad3QeJF5hMTkRe4dAq2sUZiG+8A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.14.5.tgz", + "integrity": "sha512-22btZeURqiepOfuy/VkFr+zStqlujWaarpMErvay7goJS6BWwdd6BY9zQyDLDa4x2S3VugxFb162IZ4m/S/+Gg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.14.5.tgz", + "integrity": "sha512-lXzLD30ffCWseTbMQzrvDWqljvZlHkXU+CnseMhkMNqU1sASnCsz3tSzAaH3vCUXb9PHeUb90ZT1BdFTm1xxJw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.14.5.tgz", + "integrity": "sha512-crTo4jATEOjxj7bt9lbYXcBAM3LZaUrbP2uUdxb6WIorLmjNKSpHfIybgY4B8SRpbf8tEVIWH3Vtm7ayCrKocA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.14.5.tgz", + "integrity": "sha512-UygduJpC5kHeCiRw/xDVzC+wj8VaYSoKl5JNVmbP7MadpNinAm3SvZCxZ42H37KZBKztz46YC73i9yV34d0Tzw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.14.5", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.15.0.tgz", + "integrity": "sha512-FhEpCNFCcWW3iZLg0L2NPE9UerdtsCR6ZcsGHUX6Om6kbCQeL5QZDqFDmeNHC6/fy6UH3jEge7K4qG5uC9In0Q==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.15.0", + "@babel/helper-compilation-targets": "^7.15.0", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.14.5", + "@babel/plugin-proposal-async-generator-functions": "^7.14.9", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-class-static-block": "^7.14.5", + "@babel/plugin-proposal-dynamic-import": "^7.14.5", + "@babel/plugin-proposal-export-namespace-from": "^7.14.5", + "@babel/plugin-proposal-json-strings": "^7.14.5", + "@babel/plugin-proposal-logical-assignment-operators": "^7.14.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5", + "@babel/plugin-proposal-numeric-separator": "^7.14.5", + "@babel/plugin-proposal-object-rest-spread": "^7.14.7", + "@babel/plugin-proposal-optional-catch-binding": "^7.14.5", + "@babel/plugin-proposal-optional-chaining": "^7.14.5", + "@babel/plugin-proposal-private-methods": "^7.14.5", + "@babel/plugin-proposal-private-property-in-object": "^7.14.5", + "@babel/plugin-proposal-unicode-property-regex": "^7.14.5", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.14.5", + "@babel/plugin-transform-async-to-generator": "^7.14.5", + "@babel/plugin-transform-block-scoped-functions": "^7.14.5", + "@babel/plugin-transform-block-scoping": "^7.14.5", + "@babel/plugin-transform-classes": "^7.14.9", + "@babel/plugin-transform-computed-properties": "^7.14.5", + "@babel/plugin-transform-destructuring": "^7.14.7", + "@babel/plugin-transform-dotall-regex": "^7.14.5", + "@babel/plugin-transform-duplicate-keys": "^7.14.5", + "@babel/plugin-transform-exponentiation-operator": "^7.14.5", + "@babel/plugin-transform-for-of": "^7.14.5", + "@babel/plugin-transform-function-name": "^7.14.5", + "@babel/plugin-transform-literals": "^7.14.5", + "@babel/plugin-transform-member-expression-literals": "^7.14.5", + "@babel/plugin-transform-modules-amd": "^7.14.5", + "@babel/plugin-transform-modules-commonjs": "^7.15.0", + "@babel/plugin-transform-modules-systemjs": "^7.14.5", + "@babel/plugin-transform-modules-umd": "^7.14.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.14.9", + "@babel/plugin-transform-new-target": "^7.14.5", + "@babel/plugin-transform-object-super": "^7.14.5", + "@babel/plugin-transform-parameters": "^7.14.5", + "@babel/plugin-transform-property-literals": "^7.14.5", + "@babel/plugin-transform-regenerator": "^7.14.5", + "@babel/plugin-transform-reserved-words": "^7.14.5", + "@babel/plugin-transform-shorthand-properties": "^7.14.5", + "@babel/plugin-transform-spread": "^7.14.6", + "@babel/plugin-transform-sticky-regex": "^7.14.5", + "@babel/plugin-transform-template-literals": "^7.14.5", + "@babel/plugin-transform-typeof-symbol": "^7.14.5", + "@babel/plugin-transform-unicode-escapes": "^7.14.5", + "@babel/plugin-transform-unicode-regex": "^7.14.5", + "@babel/preset-modules": "^0.1.4", + "@babel/types": "^7.15.0", + "babel-plugin-polyfill-corejs2": "^0.2.2", + "babel-plugin-polyfill-corejs3": "^0.2.2", + "babel-plugin-polyfill-regenerator": "^0.2.2", + "core-js-compat": "^3.16.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-env/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.4.tgz", + "integrity": "sha512-J36NhwnfdzpmH41M1DrnkkgAqhZaqr/NBdPfQ677mLzlaXo+oDiv1deyCDtgAhz8p328otdob0Du7+xgHGZbKg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.15.3", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.15.3.tgz", + "integrity": "sha512-OvwMLqNXkCXSz1kSm58sEsNuhqOx/fKpnUnKnFB5v8uDda5bLNEHNgKPvhDN6IU0LDcnHQ90LlJ0Q6jnyBSIBA==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.14.5.tgz", + "integrity": "sha512-6Z3Po85sfxRGachLULUhOmvAaOo7xCvqGQtxINai2mEGPFm6pQ4z5QInFnUrRpfoSV60BnjyF5F3c+15fxFV1g==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.14.5", + "@babel/parser": "^7.14.5", + "@babel/types": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template/node_modules/@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.15.0.tgz", + "integrity": "sha512-392d8BN0C9eVxVWd8H6x9WfipgVH5IaIoLp23334Sc1vbKKWINnvwRpb4us0xtPaCumlwbTtIYNA0Dv/32sVFw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.14.5", + "@babel/generator": "^7.15.0", + "@babel/helper-function-name": "^7.14.5", + "@babel/helper-hoist-variables": "^7.14.5", + "@babel/helper-split-export-declaration": "^7.14.5", + "@babel/parser": "^7.15.0", + "@babel/types": "^7.15.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/code-frame": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.14.5.tgz", + "integrity": "sha512-9pzDqyc6OLDaqe+zbACgFkb6fKMNG6CObKpnYXChRsvYGyEdc7CA2BaqeOM+vOtCS5ndmJicPJhKAwYRI6UfFw==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/types": { + "version": "7.15.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.15.0.tgz", + "integrity": "sha512-OBvfqnllOIdX4ojTHpwZbpvz4j3EWyjkZEdmjH0/cgsd6QOdSgU8rLSk6ard/pcW7rlmjdVSX/AWOaORR1uNOQ==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.14.9", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.6.1.tgz", + "integrity": "sha512-DX3Z+T5dt1ockmPdobJS/FAsQPW4V4SrWEhD2iYQT2Cb2tQsiMnYxrcUH9By/Z3B+v0S5LMBkQtV/XOBbpLEOg==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@discoveryjs/json-ext": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.3.tgz", + "integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.16.9.tgz", + "integrity": "sha512-kW5ccqWHVOOTGUkkJbtfoImtqu3kA1PFkivM+9QPFSHphPfPBlBalX9eDRqPK+wHCqKhU48/78T791qPgC9e9A==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.16.9.tgz", + "integrity": "sha512-ndIAZJUeLx4O+4AJbFQCurQW4VRUXjDsUvt1L+nP8bVELOWdmdCEOtlIweCUE6P+hU0uxYbEK2AEP0n5IVQvhg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.16.9.tgz", + "integrity": "sha512-UbMcJB4EHrAVOnknQklREPgclNU2CPet2h+sCBCXmF2mfoYWopBn/CfTfeyOkb/JglOcdEADqAljFndMKnFtOw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.16.9.tgz", + "integrity": "sha512-d7D7/nrt4CxPul98lx4PXhyNZwTYtbdaHhOSdXlZuu5zZIznjqtMqLac8Bv+IuT6SVHiHUwrkL6ywD7mOgLW+A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.9.tgz", + "integrity": "sha512-LZc+Wlz06AkJYtwWsBM3x2rSqTG8lntDuftsUNQ3fCx9ZttYtvlDcVtgb+NQ6t9s6K5No5zutN3pcjZEC2a4iQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.9.tgz", + "integrity": "sha512-gIj0UQZlQo93CHYouHKkpzP7AuruSaMIm1etcWIxccFEVqCN1xDr6BWlN9bM+ol/f0W9w3hx3HDuEwcJVtGneQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.16.9.tgz", + "integrity": "sha512-GNors4vaMJ7lzGOuhzNc7jvgsQZqErGA8rsW+nck8N1nYu86CvsJW2seigVrQQWOV4QzEP8Zf3gm+QCjA2hnBQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.16.9.tgz", + "integrity": "sha512-cNx1EF99c2t1Ztn0lk9N+MuwBijGF8mH6nx9GFsB3e0lpUpPkCE/yt5d+7NP9EwJf5uzqdjutgVYoH1SNqzudA==", + "cpu": [ + "arm" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.16.9.tgz", + "integrity": "sha512-YPxQunReYp8RQ1FvexFrOEqqf+nLbS3bKVZF5FRT2uKM7Wio7BeATqAwO02AyrdSEntt3I5fhFsujUChIa8CZg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.16.9.tgz", + "integrity": "sha512-zb12ixDIKNwFpIqR00J88FFitVwOEwO78EiUi8wi8FXlmSc3GtUuKV/BSO+730Kglt0B47+ZrJN1BhhOxZaVrw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.16.9.tgz", + "integrity": "sha512-X8te4NLxtHiNT6H+4Pfm5RklzItA1Qy4nfyttihGGX+Koc53Ar20ViC+myY70QJ8PDEOehinXZj/F7QK3A+MKQ==", + "cpu": [ + "loong64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.16.9.tgz", + "integrity": "sha512-ZqyMDLt02c5smoS3enlF54ndK5zK4IpClLTxF0hHfzHJlfm4y8IAkIF8LUW0W7zxcKy7oAwI7BRDqeVvC120SA==", + "cpu": [ + "mips64el" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.16.9.tgz", + "integrity": "sha512-k+ca5W5LDBEF3lfDwMV6YNXwm4wEpw9krMnNvvlNz3MrKSD2Eb2c861O0MaKrZkG/buTQAP4vkavbLwgIe6xjg==", + "cpu": [ + "ppc64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.16.9.tgz", + "integrity": "sha512-GuInVdogjmg9DhgkEmNipHkC+3tzkanPJzgzTC2ihsvrruLyFoR1YrTGixblNSMPudQLpiqkcwGwwe0oqfrvfA==", + "cpu": [ + "riscv64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.16.9.tgz", + "integrity": "sha512-49wQ0aYkvwXonGsxc7LuuLNICMX8XtO92Iqmug5Qau0kpnV6SP34jk+jIeu4suHwAbSbRhVFtDv75yRmyfQcHw==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.16.9.tgz", + "integrity": "sha512-Nx4oKEAJ6EcQlt4dK7qJyuZUoXZG7CAeY22R7rqZijFzwFfMOD+gLP56uV7RrV86jGf8PeRY8TBsRmOcZoG42w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.16.9.tgz", + "integrity": "sha512-d0WnpgJ+FTiMZXEQ1NOv9+0gvEhttbgKEvVqWWAtl1u9AvlspKXbodKHzQ5MLP6YV1y52Xp+p8FMYqj8ykTahg==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.16.9.tgz", + "integrity": "sha512-jccK11278dvEscHFfMk5EIPjF4wv1qGD0vps7mBV1a6TspdR36O28fgPem/SA/0pcsCPHjww5ouCLwP+JNAFlw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.16.9.tgz", + "integrity": "sha512-OetwTSsv6mIDLqN7I7I2oX9MmHGwG+AP+wKIHvq+6sIHwcPPJqRx+DJB55jy9JG13CWcdcQno/7V5MTJ5a0xfQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.16.9.tgz", + "integrity": "sha512-tKSSSK6unhxbGbHg+Cc+JhRzemkcsX0tPBvG0m5qsWbkShDK9c+/LSb13L18LWVdOQZwuA55Vbakxmt6OjBDOQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.16.9.tgz", + "integrity": "sha512-ZTQ5vhNS5gli0KK8I6/s6+LwXmNEfq1ftjnSVyyNm33dBw8zDpstqhGXYUbZSWWLvkqiRRjgxgmoncmi6Yy7Ng==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.16.9.tgz", + "integrity": "sha512-C4ZX+YFIp6+lPrru3tpH6Gaapy8IBRHw/e7l63fzGDhn/EaiGpQgbIlT5paByyy+oMvRFQoxxyvC4LE0AjJMqQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", + "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.1.1", + "espree": "^7.3.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz", + "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.0", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz", + "integrity": "sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==", + "dev": true + }, + "node_modules/@msgpack/msgpack": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.8.0.tgz", + "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "node_modules/@types/chai": { + "version": "4.2.21", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.21.tgz", + "integrity": "sha512-yd+9qKmJxm496BOV9CMNaey8TWsikaZOwMRwPHQIjcOJM9oV+fi9ZMNw3JsVnbEEbo2gRTDnGEBv8pjyn67hNg==", + "dev": true + }, + "node_modules/@types/chai-as-promised": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz", + "integrity": "sha512-1y3L1cHePcIm5vXkh1DSGf/zQq5n5xDKG1fpCvf18+uOkpce0Z1ozNFPkyWsVswK7ntN1sZBw3oU6gmN+pDUcA==", + "dev": true, + "dependencies": { + "@types/chai": "*" + } + }, + "node_modules/@types/eslint": { + "version": "8.4.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", + "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", + "dependencies": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "node_modules/@types/eslint-scope": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", + "dependencies": { + "@types/eslint": "*", + "@types/estree": "*" + } + }, + "node_modules/@types/estree": { + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" + }, + "node_modules/@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" + }, + "node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "14.17.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.9.tgz", + "integrity": "sha512-CMjgRNsks27IDwI785YMY0KLt3co/c0cQ5foxHYv/shC2w8oOnVwz5Ubq1QG5KzrcW+AXk6gzdnxIkDnTvzu3g==" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.29.1.tgz", + "integrity": "sha512-AHqIU+SqZZgBEiWOrtN94ldR3ZUABV5dUG94j8Nms9rQnHFc8fvDOue/58K4CFz6r8OtDDc35Pw9NQPWo0Ayrw==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "4.29.1", + "@typescript-eslint/scope-manager": "4.29.1", + "debug": "^4.3.1", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.1.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^4.0.0", + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.29.1.tgz", + "integrity": "sha512-kl6QG6qpzZthfd2bzPNSJB2YcZpNOrP6r9jueXupcZHnL74WiuSjaft7WSu17J9+ae9zTlk0KJMXPUj0daBxMw==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.7", + "@typescript-eslint/scope-manager": "4.29.1", + "@typescript-eslint/types": "4.29.1", + "@typescript-eslint/typescript-estree": "4.29.1", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "*" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "4.29.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.2.tgz", + "integrity": "sha512-WQ6BPf+lNuwteUuyk1jD/aHKqMQ9jrdCn7Gxt9vvBnzbpj7aWEf+aZsJ1zvTjx5zFxGCt000lsbD9tQPEL8u6g==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "4.29.2", + "@typescript-eslint/types": "4.29.2", + "@typescript-eslint/typescript-estree": "4.29.2", + "debug": "^4.3.1" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^5.0.0 || ^6.0.0 || ^7.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "4.29.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.2.tgz", + "integrity": "sha512-mfHmvlQxmfkU8D55CkZO2sQOueTxLqGvzV+mG6S/6fIunDiD2ouwsAoiYCZYDDK73QCibYjIZmGhpvKwAB5BOA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.2", + "@typescript-eslint/visitor-keys": "4.29.2" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "4.29.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.2.tgz", + "integrity": "sha512-K6ApnEXId+WTGxqnda8z4LhNMa/pZmbTFkDxEBLQAbhLZL50DjeY0VIDCml/0Y3FlcbqXZrABqrcKxq+n0LwzQ==", + "dev": true, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "4.29.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.2.tgz", + "integrity": "sha512-TJ0/hEnYxapYn9SGn3dCnETO0r+MjaxtlWZ2xU+EvytF0g4CqTpZL48SqSNn2hXsPolnewF30pdzR9a5Lj3DNg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.2", + "@typescript-eslint/visitor-keys": "4.29.2", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "4.29.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.2.tgz", + "integrity": "sha512-bDgJLQ86oWHJoZ1ai4TZdgXzJxsea3Ee9u9wsTAvjChdj2WLcVsgWYAPeY7RQMn16tKrlQaBnpKv7KBfs4EQag==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.2", + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.1.tgz", + "integrity": "sha512-Hzv/uZOa9zrD/W5mftZa54Jd5Fed3tL6b4HeaOpwVSabJK8CJ+2MkDasnX/XK4rqP5ZTWngK1ZDeCi6EnxPQ7A==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.1", + "@typescript-eslint/visitor-keys": "4.29.1" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.1.tgz", + "integrity": "sha512-Jj2yu78IRfw4nlaLtKjVaGaxh/6FhofmQ/j8v3NXmAiKafbIqtAPnKYrf0sbGjKdj0hS316J8WhnGnErbJ4RCA==", + "dev": true, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.1.tgz", + "integrity": "sha512-lIkkrR9E4lwZkzPiRDNq0xdC3f2iVCUjw/7WPJ4S2Sl6C3nRWkeE1YXCQ0+KsiaQRbpY16jNaokdWnm9aUIsfw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.1", + "@typescript-eslint/visitor-keys": "4.29.1", + "debug": "^4.3.1", + "globby": "^11.0.3", + "is-glob": "^4.0.1", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "4.29.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.1.tgz", + "integrity": "sha512-zLqtjMoXvgdZY/PG6gqA73V8BjqPs4af1v2kiiETBObp+uC6gRYnJLmJHxC0QyUrrHDLJPIWNYxoBV3wbcRlag==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "4.29.1", + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/@wapc/host": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@wapc/host/-/host-0.0.2.tgz", + "integrity": "sha512-UQSRZLMZWWcuibMb3OmwScfEt3NoytRoAqaZTqMCPNcXZBZ0L3eU5TRDfaa2Id+/vVDLefS5zMIfIwK6+DGUHg==", + "dependencies": { + "debug": "^4.3.1" + } + }, + "node_modules/@wasm-tool/wasm-pack-plugin": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@wasm-tool/wasm-pack-plugin/-/wasm-pack-plugin-1.5.0.tgz", + "integrity": "sha512-qsGJ953zrXZdXW58cfYOh2nBXp0SYBsFhkxqh9p4JK8cXllEzHeRXoVO+qtgEB31+s1tsL8eda3Uy97W/7yOAg==", + "dev": true, + "dependencies": { + "chalk": "^2.4.1", + "command-exists": "^1.2.7", + "watchpack": "^2.1.1", + "which": "^2.0.2" + } + }, + "node_modules/@webassemblyjs/ast": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", + "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", + "dependencies": { + "@webassemblyjs/helper-numbers": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1" + } + }, + "node_modules/@webassemblyjs/floating-point-hex-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==" + }, + "node_modules/@webassemblyjs/helper-api-error": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" + }, + "node_modules/@webassemblyjs/helper-buffer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==" + }, + "node_modules/@webassemblyjs/helper-numbers": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", + "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", + "dependencies": { + "@webassemblyjs/floating-point-hex-parser": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/helper-wasm-bytecode": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==" + }, + "node_modules/@webassemblyjs/helper-wasm-section": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", + "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1" + } + }, + "node_modules/@webassemblyjs/ieee754": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", + "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", + "dependencies": { + "@xtuc/ieee754": "^1.2.0" + } + }, + "node_modules/@webassemblyjs/leb128": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", + "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", + "dependencies": { + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webassemblyjs/utf8": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==" + }, + "node_modules/@webassemblyjs/wasm-edit": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", + "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/helper-wasm-section": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-opt": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "@webassemblyjs/wast-printer": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-gen": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", + "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-opt": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", + "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-buffer": "1.11.1", + "@webassemblyjs/wasm-gen": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wasm-parser": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", + "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/helper-api-error": "1.11.1", + "@webassemblyjs/helper-wasm-bytecode": "1.11.1", + "@webassemblyjs/ieee754": "1.11.1", + "@webassemblyjs/leb128": "1.11.1", + "@webassemblyjs/utf8": "1.11.1" + } + }, + "node_modules/@webassemblyjs/wast-printer": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", + "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", + "dependencies": { + "@webassemblyjs/ast": "1.11.1", + "@xtuc/long": "4.2.2" + } + }, + "node_modules/@webpack-cli/configtest": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.4.tgz", + "integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==", + "dev": true, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x", + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/info": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.3.0.tgz", + "integrity": "sha512-ASiVB3t9LOKHs5DyVUcxpraBXDOKubYu/ihHhU+t1UPpxsivg6Od2E2qU4gJCekfEddzRBzHhzA/Acyw/mlK/w==", + "dev": true, + "dependencies": { + "envinfo": "^7.7.3" + }, + "peerDependencies": { + "webpack-cli": "4.x.x" + } + }, + "node_modules/@webpack-cli/serve": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.2.tgz", + "integrity": "sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==", + "dev": true, + "peerDependencies": { + "webpack-cli": "4.x.x" + }, + "peerDependenciesMeta": { + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" + }, + "node_modules/@xtuc/long": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" + }, + "node_modules/acorn": { + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-import-assertions": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.7.6.tgz", + "integrity": "sha512-FlVvVFA1TX6l3lp8VjDnYYq7R1nyW6x3svAt4nDgrWQ9SBaSh9CnbwgSUTasgfNfOG5HlM1ehugCvM+hjo56LA==", + "peerDependencies": { + "acorn": "^8" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.1.1.tgz", + "integrity": "sha512-FbJdceMlPHEAWJOILDk1fXD8lnTlEIWFkqtfk+MvmL5q/qlHfN7GEHcsFZWt/Tea9jRNPWUZG4G976nqAAmU9w==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "peerDependencies": { + "ajv": "^6.9.1" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/astral-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", + "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/axios": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", + "integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", + "dependencies": { + "follow-redirects": "^1.14.4" + } + }, + "node_modules/babel-loader": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.2.tgz", + "integrity": "sha512-JvTd0/D889PQBtUXJ2PXaKU/pjZDMtHA9V2ecm+eNRmmBCMR09a+fmpGTNwnJtFmFl5Ei7Vy47LjBb+L0wQ99g==", + "dev": true, + "dependencies": { + "find-cache-dir": "^3.3.1", + "loader-utils": "^1.4.0", + "make-dir": "^3.1.0", + "schema-utils": "^2.6.5" + }, + "engines": { + "node": ">= 8.9" + }, + "peerDependencies": { + "@babel/core": "^7.0.0", + "webpack": ">=2" + } + }, + "node_modules/babel-loader/node_modules/schema-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 8.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "dev": true, + "dependencies": { + "object.assign": "^4.1.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.2.2.tgz", + "integrity": "sha512-kISrENsJ0z5dNPq5eRvcctITNHYXWOA4DUZRFYCz3jYCcvTb/A546LIddmoGNMVYg2U38OyFeNosQwI9ENTqIQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.2.2", + "semver": "^6.1.1" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.2.4.tgz", + "integrity": "sha512-z3HnJE5TY/j4EFEa/qpQMSbcUJZ5JQi+3UFjXzn6pQCmIKc5Ug5j98SuYyH+m4xQnvKlMDIW4plLfgyVnd0IcQ==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.2.2", + "core-js-compat": "^3.14.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.2.2.tgz", + "integrity": "sha512-Goy5ghsc21HgPDFtzRkSirpZVW35meGoTmTOb2bxqdl60ghub4xOidgNTHaZfQ2FaxQsKmwvXtOAkcIS4SMBWg==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.2.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/browserslist": { + "version": "4.16.7", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", + "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", + "dependencies": { + "caniuse-lite": "^1.0.30001248", + "colorette": "^1.2.2", + "electron-to-chromium": "^1.3.793", + "escalade": "^3.1.1", + "node-releases": "^1.1.73" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", + "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001251", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz", + "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai-as-promised": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", + "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", + "dev": true, + "dependencies": { + "check-error": "^1.0.2" + }, + "peerDependencies": { + "chai": ">= 2.1.2 < 5" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chrome-trace-event": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", + "engines": { + "node": ">=6.0" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/colorette": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", + "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==" + }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, + "node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/convert-source-map/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "dependencies": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/copy-webpack-plugin/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/copy-webpack-plugin/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/copy-webpack-plugin/node_modules/globby": { + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz", + "integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.11", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/copy-webpack-plugin/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "node_modules/copy-webpack-plugin/node_modules/schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/copy-webpack-plugin/node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/core-js-compat": { + "version": "3.16.4", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.4.tgz", + "integrity": "sha512-IzCSomxRdahCYb6G3HiN6pl3JCiM0NMunRcNa1pIeC7g17Vd6Ue3AT9anQiENPIm/svThUVer1pIbLMDERIsFw==", + "dev": true, + "dependencies": { + "browserslist": "^4.16.8", + "semver": "7.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat/node_modules/browserslist": { + "version": "4.16.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.8.tgz", + "integrity": "sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ==", + "dev": true, + "dependencies": { + "caniuse-lite": "^1.0.30001251", + "colorette": "^1.3.0", + "electron-to-chromium": "^1.3.811", + "escalade": "^3.1.1", + "node-releases": "^1.1.75" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/core-js-compat/node_modules/electron-to-chromium": { + "version": "1.3.824", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.824.tgz", + "integrity": "sha512-Fk+5aD0HDi9i9ZKt9n2VPOZO1dQy7PV++hz2wJ/KIn+CvVfu4fny39squHtyVDPuHNuoJGAZIbuReEklqYIqfA==", + "dev": true + }, + "node_modules/core-js-compat/node_modules/node-releases": { + "version": "1.1.75", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.75.tgz", + "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==", + "dev": true + }, + "node_modules/core-js-compat/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.3.806", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", + "integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/enhanced-resolve": { + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.2.0" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/envinfo": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", + "integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw==", + "dev": true, + "bin": { + "envinfo": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/es-module-lexer": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "node_modules/esbuild": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.9.tgz", + "integrity": "sha512-gkH83yHyijMSZcZFs1IWew342eMdFuWXmQo3zkDPTre25LIPBJsXryg02M3u8OpTwCJdBkdaQwqKkDLnAsAeLQ==", + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.16.9", + "@esbuild/android-arm64": "0.16.9", + "@esbuild/android-x64": "0.16.9", + "@esbuild/darwin-arm64": "0.16.9", + "@esbuild/darwin-x64": "0.16.9", + "@esbuild/freebsd-arm64": "0.16.9", + "@esbuild/freebsd-x64": "0.16.9", + "@esbuild/linux-arm": "0.16.9", + "@esbuild/linux-arm64": "0.16.9", + "@esbuild/linux-ia32": "0.16.9", + "@esbuild/linux-loong64": "0.16.9", + "@esbuild/linux-mips64el": "0.16.9", + "@esbuild/linux-ppc64": "0.16.9", + "@esbuild/linux-riscv64": "0.16.9", + "@esbuild/linux-s390x": "0.16.9", + "@esbuild/linux-x64": "0.16.9", + "@esbuild/netbsd-x64": "0.16.9", + "@esbuild/openbsd-x64": "0.16.9", + "@esbuild/sunos-x64": "0.16.9", + "@esbuild/win32-arm64": "0.16.9", + "@esbuild/win32-ia32": "0.16.9", + "@esbuild/win32-x64": "0.16.9" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "7.32.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz", + "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==", + "dev": true, + "dependencies": { + "@babel/code-frame": "7.12.11", + "@eslint/eslintrc": "^0.4.3", + "@humanwhocodes/config-array": "^0.5.0", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^2.1.0", + "eslint-visitor-keys": "^2.0.0", + "espree": "^7.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^5.1.2", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.1.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.0", + "strip-json-comments": "^3.1.0", + "table": "^6.0.9", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/eslint/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz", + "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==", + "dev": true, + "dependencies": { + "acorn": "^7.4.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^1.3.0" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/espree/node_modules/acorn": { + "version": "7.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", + "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/espree/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/fast-glob": { + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastest-levenshtein": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz", + "integrity": "sha512-On2N+BpYJ15xIC974QNVuYGMOlEVt4s0EOI3wwMqOmK1fdDY+FN/zltPV8vosq4ad4c/gJ1KHScUn/6AWIgiow==", + "dev": true + }, + "node_modules/fastq": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", + "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.2.tgz", + "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.14.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", + "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/glob-to-regexp": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" + }, + "node_modules/globals": { + "version": "13.11.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", + "integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ignore": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.2.tgz", + "integrity": "sha512-m1MJSy4Z2NAcyhoYpxQeBsc1ZdNQwYjN0wGbLBlnVArdJ90Gtr8IhNSfZZcCoR0fM/0E0BJ0mf1KnLNDOCJP4w==", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/import-local": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.0.2.tgz", + "integrity": "sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA==", + "dev": true, + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "node_modules/interpret": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", + "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.5.0.tgz", + "integrity": "sha512-TXCMSDsEHMEEZ6eCA8rwRDbLu55MRGmrctljsBX/2v1d9/GzqHOxW5c5oPSgrUt2vBFXebu9rGqckXGPWOlYpg==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jest-worker": { + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.6.tgz", + "integrity": "sha512-qupxcj/dRuA3xHPMUd40gr2EaAurFbkwzOh7wfPaeE9id7hyjURRQoqNfHifHK3XjJU6YJJUQKILGUnwGPEOCA==", + "dependencies": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": ">= 10.13.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/loader-runner": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", + "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==", + "engines": { + "node": ">=6.11.5" + } + }, + "node_modules/loader-utils": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.0.tgz", + "integrity": "sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==", + "dev": true, + "dependencies": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^1.0.1" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/loader-utils/node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/lodash.truncate": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz", + "integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime-db": { + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.32", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", + "dependencies": { + "mime-db": "1.49.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mocha": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.0.3.tgz", + "integrity": "sha512-hnYFrSefHxYS2XFGtN01x8un0EwNu2bzKvhpRFhgoybIvMaOkkL60IVPmkb5h6XDmUl4IMSB+rT5cIO4/4bJgg==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.1", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.23", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "wide-align": "1.1.3", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + }, + "node_modules/nanoid": { + "version": "3.1.23", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.23.tgz", + "integrity": "sha512-FiB0kzdP0FFVGDKlRLEQ1BgDzU87dy5NnzjeW9YZNt+/c3+q82EQDUwniSAUxp/F0gFNI1ZhKU1FqYsMuqZVnw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/nats.ws": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/nats.ws/-/nats.ws-1.2.0.tgz", + "integrity": "sha512-3T2IpZkm7ThVj3t9bWrycvWYN5XgYbc3TYK3jIyjDs7AlL6qdialq3Gjpld0DMJ61mpOuwBcVhvYZlirJ0HSUA==", + "optionalDependencies": { + "nkeys.js": "^1.0.0-9" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" + }, + "node_modules/nkeys.js": { + "version": "1.0.0-9", + "resolved": "https://registry.npmjs.org/nkeys.js/-/nkeys.js-1.0.0-9.tgz", + "integrity": "sha512-m9O0NQT+3rUe1om6MWpxV77EuHql/LdorDH+FYQkoeARcM2V0sQ89kM36fArWaHWq/25EmNmQUW0MhLTcbqW1A==", + "optional": true, + "dependencies": { + "@types/node": "^14.0.26", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/node-releases": { + "version": "1.1.74", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", + "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "dev": true, + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "engines": { + "node": ">=8" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.2.tgz", + "integrity": "sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", + "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "dev": true, + "dependencies": { + "resolve": "^1.9.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "node_modules/regenerator-transform": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", + "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/regexpu-core": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.1.tgz", + "integrity": "sha512-ywH2VUraA44DZQuRKzARmw6S66mr48pQVva4LBeRhcOltJ6hExvWly5ZjFLYo67xbIxb6W1q4bAGtgfEl20zfQ==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.0", + "regenerate-unicode-properties": "^8.2.0", + "regjsgen": "^0.5.1", + "regjsparser": "^0.6.4", + "unicode-match-property-ecmascript": "^1.0.4", + "unicode-match-property-value-ecmascript": "^1.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "node_modules/regjsparser": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.9.tgz", + "integrity": "sha512-ZqbNRz1SNjLAiYuwY0zoXW8Ne675IX5q+YHioAGbCw4X96Mjl2+dcX9B2ciaeyYjViDAfvIjFpQjJgLttTEERQ==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/schema-utils": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", + "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", + "dependencies": { + "@types/json-schema": "^7.0.8", + "ajv": "^6.12.5", + "ajv-keywords": "^3.5.2" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/slice-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", + "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "astral-regex": "^2.0.0", + "is-fullwidth-code-point": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/slice-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/slice-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/table": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/table/-/table-6.7.1.tgz", + "integrity": "sha512-ZGum47Yi6KOOFDE8m223td53ath2enHcYLgOCjGr5ngu8bdIARQk6mN/wRMv4yMRcHnCSnHbCEha4sobQx5yWg==", + "dev": true, + "dependencies": { + "ajv": "^8.0.1", + "lodash.clonedeep": "^4.5.0", + "lodash.truncate": "^4.4.2", + "slice-ansi": "^4.0.0", + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/table/node_modules/ajv": { + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.2.tgz", + "integrity": "sha512-9807RlWAgT564wT+DjeyU5OFMPjmzxVobvDFmNAhY+5zD6A2ly3jDp6sgnfyDtlIQ+7H97oc/DGCzzfu9rjw9w==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/table/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/table/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/table/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/table/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tapable": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", + "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==", + "engines": { + "node": ">=6" + } + }, + "node_modules/terser": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz", + "integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==", + "dependencies": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + }, + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/terser-webpack-plugin": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz", + "integrity": "sha512-C2WkFwstHDhVEmsmlCxrXUtVklS+Ir1A7twrYzrDrQQOIMOaVAYykaoo/Aq1K0QRkMoY2hhvDQY1cm4jnIMFwA==", + "dependencies": { + "jest-worker": "^27.0.2", + "p-limit": "^3.1.0", + "schema-utils": "^3.0.0", + "serialize-javascript": "^6.0.0", + "source-map": "^0.6.1", + "terser": "^5.7.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "node_modules/terser-webpack-plugin/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/terser/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-loader": { + "version": "9.2.5", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.2.5.tgz", + "integrity": "sha512-al/ATFEffybdRMUIr5zMEWQdVnCGMUA9d3fXJ8dBVvBlzytPvIszoG9kZoR+94k6/i293RnVOXwMaWbXhNy9pQ==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "enhanced-resolve": "^5.0.0", + "micromatch": "^4.0.0", + "semver": "^7.3.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "*", + "webpack": "^5.0.0" + } + }, + "node_modules/ts-loader/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ts-loader/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/ts-loader/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/ts-loader/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-node": { + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.2.1.tgz", + "integrity": "sha512-hCnyOyuGmD5wHleOQX6NIjJtYVIO8bPP8F2acWkB4W06wdlkgyvJtubO/I9NkI88hCFECbsEgoLc0VNkYmcSfw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.6.1", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "optional": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", + "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", + "integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz", + "integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^1.0.4", + "unicode-property-aliases-ecmascript": "^1.0.4" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "node_modules/watchpack": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", + "dependencies": { + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.1.2" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/webpack": { + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", + "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", + "dependencies": { + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^0.0.51", + "@webassemblyjs/ast": "1.11.1", + "@webassemblyjs/wasm-edit": "1.11.1", + "@webassemblyjs/wasm-parser": "1.11.1", + "acorn": "^8.7.1", + "acorn-import-assertions": "^1.7.6", + "browserslist": "^4.14.5", + "chrome-trace-event": "^1.0.2", + "enhanced-resolve": "^5.10.0", + "es-module-lexer": "^0.9.0", + "eslint-scope": "5.1.1", + "events": "^3.2.0", + "glob-to-regexp": "^0.4.1", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", + "loader-runner": "^4.2.0", + "mime-types": "^2.1.27", + "neo-async": "^2.6.2", + "schema-utils": "^3.1.0", + "tapable": "^2.1.1", + "terser-webpack-plugin": "^5.1.3", + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" + }, + "bin": { + "webpack": "bin/webpack.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependenciesMeta": { + "webpack-cli": { + "optional": true + } + } + }, + "node_modules/webpack-cli": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.8.0.tgz", + "integrity": "sha512-+iBSWsX16uVna5aAYN6/wjhJy1q/GKk4KjKvfg90/6hykCTSgozbfz5iRgDTSJt/LgSbYxdBX3KBHeobIs+ZEw==", + "dev": true, + "dependencies": { + "@discoveryjs/json-ext": "^0.5.0", + "@webpack-cli/configtest": "^1.0.4", + "@webpack-cli/info": "^1.3.0", + "@webpack-cli/serve": "^1.5.2", + "colorette": "^1.2.1", + "commander": "^7.0.0", + "execa": "^5.0.0", + "fastest-levenshtein": "^1.0.12", + "import-local": "^3.0.2", + "interpret": "^2.2.0", + "rechoir": "^0.7.0", + "v8-compile-cache": "^2.2.0", + "webpack-merge": "^5.7.3" + }, + "bin": { + "webpack-cli": "bin/cli.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "peerDependencies": { + "webpack": "4.x.x || 5.x.x" + }, + "peerDependenciesMeta": { + "@webpack-cli/generators": { + "optional": true + }, + "@webpack-cli/migrate": { + "optional": true + }, + "webpack-bundle-analyzer": { + "optional": true + }, + "webpack-dev-server": { + "optional": true + } + } + }, + "node_modules/webpack-merge": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.8.0.tgz", + "integrity": "sha512-/SaI7xY0831XwP6kzuwhKWVKDP9t1QY1h65lAFLbZqMPIuYcD9QAW4u9STIbU9kaJbPBB/geU/gLr1wDjOhQ+Q==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webpack-sources": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "dependencies": { + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/wildcard": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", + "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", + "dev": true + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs/node_modules/ansi-regex": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", + "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/strip-ansi": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + }, "dependencies": { "@babel/code-frame": { "version": "7.12.11", @@ -1173,6 +7952,138 @@ "integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==", "dev": true }, + "@esbuild/android-arm": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.16.9.tgz", + "integrity": "sha512-kW5ccqWHVOOTGUkkJbtfoImtqu3kA1PFkivM+9QPFSHphPfPBlBalX9eDRqPK+wHCqKhU48/78T791qPgC9e9A==", + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.16.9.tgz", + "integrity": "sha512-ndIAZJUeLx4O+4AJbFQCurQW4VRUXjDsUvt1L+nP8bVELOWdmdCEOtlIweCUE6P+hU0uxYbEK2AEP0n5IVQvhg==", + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.16.9.tgz", + "integrity": "sha512-UbMcJB4EHrAVOnknQklREPgclNU2CPet2h+sCBCXmF2mfoYWopBn/CfTfeyOkb/JglOcdEADqAljFndMKnFtOw==", + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.16.9.tgz", + "integrity": "sha512-d7D7/nrt4CxPul98lx4PXhyNZwTYtbdaHhOSdXlZuu5zZIznjqtMqLac8Bv+IuT6SVHiHUwrkL6ywD7mOgLW+A==", + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.16.9.tgz", + "integrity": "sha512-LZc+Wlz06AkJYtwWsBM3x2rSqTG8lntDuftsUNQ3fCx9ZttYtvlDcVtgb+NQ6t9s6K5No5zutN3pcjZEC2a4iQ==", + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.9.tgz", + "integrity": "sha512-gIj0UQZlQo93CHYouHKkpzP7AuruSaMIm1etcWIxccFEVqCN1xDr6BWlN9bM+ol/f0W9w3hx3HDuEwcJVtGneQ==", + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.16.9.tgz", + "integrity": "sha512-GNors4vaMJ7lzGOuhzNc7jvgsQZqErGA8rsW+nck8N1nYu86CvsJW2seigVrQQWOV4QzEP8Zf3gm+QCjA2hnBQ==", + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.16.9.tgz", + "integrity": "sha512-cNx1EF99c2t1Ztn0lk9N+MuwBijGF8mH6nx9GFsB3e0lpUpPkCE/yt5d+7NP9EwJf5uzqdjutgVYoH1SNqzudA==", + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.16.9.tgz", + "integrity": "sha512-YPxQunReYp8RQ1FvexFrOEqqf+nLbS3bKVZF5FRT2uKM7Wio7BeATqAwO02AyrdSEntt3I5fhFsujUChIa8CZg==", + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.16.9.tgz", + "integrity": "sha512-zb12ixDIKNwFpIqR00J88FFitVwOEwO78EiUi8wi8FXlmSc3GtUuKV/BSO+730Kglt0B47+ZrJN1BhhOxZaVrw==", + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.16.9.tgz", + "integrity": "sha512-X8te4NLxtHiNT6H+4Pfm5RklzItA1Qy4nfyttihGGX+Koc53Ar20ViC+myY70QJ8PDEOehinXZj/F7QK3A+MKQ==", + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.16.9.tgz", + "integrity": "sha512-ZqyMDLt02c5smoS3enlF54ndK5zK4IpClLTxF0hHfzHJlfm4y8IAkIF8LUW0W7zxcKy7oAwI7BRDqeVvC120SA==", + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.16.9.tgz", + "integrity": "sha512-k+ca5W5LDBEF3lfDwMV6YNXwm4wEpw9krMnNvvlNz3MrKSD2Eb2c861O0MaKrZkG/buTQAP4vkavbLwgIe6xjg==", + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.16.9.tgz", + "integrity": "sha512-GuInVdogjmg9DhgkEmNipHkC+3tzkanPJzgzTC2ihsvrruLyFoR1YrTGixblNSMPudQLpiqkcwGwwe0oqfrvfA==", + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.16.9.tgz", + "integrity": "sha512-49wQ0aYkvwXonGsxc7LuuLNICMX8XtO92Iqmug5Qau0kpnV6SP34jk+jIeu4suHwAbSbRhVFtDv75yRmyfQcHw==", + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.16.9.tgz", + "integrity": "sha512-Nx4oKEAJ6EcQlt4dK7qJyuZUoXZG7CAeY22R7rqZijFzwFfMOD+gLP56uV7RrV86jGf8PeRY8TBsRmOcZoG42w==", + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.16.9.tgz", + "integrity": "sha512-d0WnpgJ+FTiMZXEQ1NOv9+0gvEhttbgKEvVqWWAtl1u9AvlspKXbodKHzQ5MLP6YV1y52Xp+p8FMYqj8ykTahg==", + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.16.9.tgz", + "integrity": "sha512-jccK11278dvEscHFfMk5EIPjF4wv1qGD0vps7mBV1a6TspdR36O28fgPem/SA/0pcsCPHjww5ouCLwP+JNAFlw==", + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.16.9.tgz", + "integrity": "sha512-OetwTSsv6mIDLqN7I7I2oX9MmHGwG+AP+wKIHvq+6sIHwcPPJqRx+DJB55jy9JG13CWcdcQno/7V5MTJ5a0xfQ==", + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.16.9.tgz", + "integrity": "sha512-tKSSSK6unhxbGbHg+Cc+JhRzemkcsX0tPBvG0m5qsWbkShDK9c+/LSb13L18LWVdOQZwuA55Vbakxmt6OjBDOQ==", + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.16.9.tgz", + "integrity": "sha512-ZTQ5vhNS5gli0KK8I6/s6+LwXmNEfq1ftjnSVyyNm33dBw8zDpstqhGXYUbZSWWLvkqiRRjgxgmoncmi6Yy7Ng==", + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.16.9.tgz", + "integrity": "sha512-C4ZX+YFIp6+lPrru3tpH6Gaapy8IBRHw/e7l63fzGDhn/EaiGpQgbIlT5paByyy+oMvRFQoxxyvC4LE0AjJMqQ==", + "optional": true + }, "@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -1235,15 +8146,14 @@ "dev": true }, "@msgpack/msgpack": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.7.1.tgz", - "integrity": "sha512-ApwiSL2c9ObewdOE/sqt788P1C5lomBOHyO8nUBCr4ofErBCnYQ003NtJ8lS9OQZc11ximkbmgAZJjB8y6cCdA==" + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-2.8.0.tgz", + "integrity": "sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==" }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "dev": true, "requires": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -1252,14 +8162,12 @@ "@nodelib/fs.stat": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "dev": true + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" }, "@nodelib/fs.walk": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "dev": true, "requires": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -1305,36 +8213,32 @@ } }, "@types/eslint": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.0.tgz", - "integrity": "sha512-07XlgzX0YJUn4iG1ocY4IX9DzKSmMGUs6ESKlxWhZRaa0fatIWaHWUVapcuGa8r5HFnTqzj+4OCjd5f7EZ/i/A==", - "dev": true, + "version": "8.4.10", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.10.tgz", + "integrity": "sha512-Sl/HOqN8NKPmhWo2VBEPm0nvHnu2LL3v9vKo8MEq0EtbJ4eVzGPl41VNPvn5E1i5poMk4/XD8UriLHpJvEP/Nw==", "requires": { "@types/estree": "*", "@types/json-schema": "*" } }, "@types/eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha512-SCFeogqiptms4Fg29WpOTk5nHIzfpKCemSN63ksBQYKTcXoJEmJagV+DhVmbapZzY4/5YaOV1nZwrsU79fFm1g==", - "dev": true, + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", + "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", "requires": { "@types/eslint": "*", "@types/estree": "*" } }, "@types/estree": { - "version": "0.0.50", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.50.tgz", - "integrity": "sha512-C6N5s2ZFtuZRj54k2/zyRhNDjJwwcViAM3Nbm8zjBpbqAdZ00mr0CFxvSKeO8Y/e03WVFLpQMdHYVfUd6SB+Hw==", - "dev": true + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "@types/json-schema": { "version": "7.0.9", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", - "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", - "dev": true + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==" }, "@types/mocha": { "version": "9.0.0", @@ -1502,7 +8406,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz", "integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==", - "dev": true, "requires": { "@webassemblyjs/helper-numbers": "1.11.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.1" @@ -1511,26 +8414,22 @@ "@webassemblyjs/floating-point-hex-parser": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz", - "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==", - "dev": true + "integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==" }, "@webassemblyjs/helper-api-error": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz", - "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==", - "dev": true + "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" }, "@webassemblyjs/helper-buffer": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz", - "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==", - "dev": true + "integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==" }, "@webassemblyjs/helper-numbers": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", "integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==", - "dev": true, "requires": { "@webassemblyjs/floating-point-hex-parser": "1.11.1", "@webassemblyjs/helper-api-error": "1.11.1", @@ -1540,14 +8439,12 @@ "@webassemblyjs/helper-wasm-bytecode": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz", - "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==", - "dev": true + "integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==" }, "@webassemblyjs/helper-wasm-section": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz", "integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -1559,7 +8456,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz", "integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==", - "dev": true, "requires": { "@xtuc/ieee754": "^1.2.0" } @@ -1568,7 +8464,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz", "integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==", - "dev": true, "requires": { "@xtuc/long": "4.2.2" } @@ -1576,14 +8471,12 @@ "@webassemblyjs/utf8": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz", - "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==", - "dev": true + "integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==" }, "@webassemblyjs/wasm-edit": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz", "integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -1599,7 +8492,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz", "integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-wasm-bytecode": "1.11.1", @@ -1612,7 +8504,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz", "integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-buffer": "1.11.1", @@ -1624,7 +8515,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz", "integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/helper-api-error": "1.11.1", @@ -1638,7 +8528,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz", "integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==", - "dev": true, "requires": { "@webassemblyjs/ast": "1.11.1", "@xtuc/long": "4.2.2" @@ -1648,7 +8537,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.0.4.tgz", "integrity": "sha512-cs3XLy+UcxiP6bj0A6u7MLLuwdXJ1c3Dtc0RkKg+wiI1g/Ti1om8+/2hc2A2B60NbBNAbMgyBMHvyymWm/j4wQ==", - "dev": true + "dev": true, + "requires": {} }, "@webpack-cli/info": { "version": "1.3.0", @@ -1663,37 +8553,36 @@ "version": "1.5.2", "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.5.2.tgz", "integrity": "sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw==", - "dev": true + "dev": true, + "requires": {} }, "@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "dev": true + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==" }, "@xtuc/long": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "dev": true + "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, "acorn": { - "version": "8.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.4.1.tgz", - "integrity": "sha512-asabaBSkEKosYKMITunzX177CXxQ4Q8BSSzMTKD+FefUhipQC70gfW5SiUDhYQ3vk8G+81HqQk7Fv9OXwwn9KA==", - "dev": true + "version": "8.8.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz", + "integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==" }, "acorn-import-assertions": { "version": "1.7.6", "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.7.6.tgz", "integrity": "sha512-FlVvVFA1TX6l3lp8VjDnYYq7R1nyW6x3svAt4nDgrWQ9SBaSh9CnbwgSUTasgfNfOG5HlM1ehugCvM+hjo56LA==", - "dev": true + "requires": {} }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "requires": {} }, "acorn-walk": { "version": "8.1.1", @@ -1705,7 +8594,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1713,11 +8601,37 @@ "uri-js": "^4.2.2" } }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + } + } + }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", - "dev": true + "requires": {} }, "ansi-colors": { "version": "4.1.1", @@ -1892,7 +8806,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -1907,7 +8820,6 @@ "version": "4.16.7", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.16.7.tgz", "integrity": "sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA==", - "dev": true, "requires": { "caniuse-lite": "^1.0.30001248", "colorette": "^1.2.2", @@ -1919,8 +8831,7 @@ "buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" }, "call-bind": { "version": "1.0.2", @@ -1947,8 +8858,7 @@ "caniuse-lite": { "version": "1.0.30001251", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz", - "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==", - "dev": true + "integrity": "sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A==" }, "chai": { "version": "4.3.4", @@ -2026,8 +8936,7 @@ "chrome-trace-event": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", - "dev": true + "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==" }, "cliui": { "version": "7.0.4", @@ -2103,8 +9012,7 @@ "colorette": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.3.0.tgz", - "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==", - "dev": true + "integrity": "sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w==" }, "command-exists": { "version": "1.2.9", @@ -2147,6 +9055,81 @@ } } }, + "copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "requires": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-E4bfmKAhGiSTvMfL1Myyycaub+cUEU2/IvpylXkUu7CHBkBj1f/ikdzbD7YQ6FKUbixDxeYvB/xY4fvyroDlQg==", + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "requires": { + "is-glob": "^4.0.3" + } + }, + "globby": { + "version": "13.1.3", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.3.tgz", + "integrity": "sha512-8krCNHXvlCgHDpegPzleMq07yMYTO2sXKASmZmquEYWEmCx6J5UTRbp5RwMJkTJGtcQ44YpiUYUiN0b9mzy8Bw==", + "requires": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.11", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + }, + "schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + } + }, + "slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==" + } + } + }, "core-js-compat": { "version": "3.16.4", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.16.4.tgz", @@ -2255,7 +9238,6 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, "requires": { "path-type": "^4.0.0" } @@ -2272,8 +9254,7 @@ "electron-to-chromium": { "version": "1.3.806", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.806.tgz", - "integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==", - "dev": true + "integrity": "sha512-AH/otJLAAecgyrYp0XK1DPiGVWcOgwPeJBOLeuFQ5l//vhQhwC9u6d+GijClqJAmsHG4XDue81ndSQPohUu0xA==" }, "emoji-regex": { "version": "8.0.0", @@ -2288,10 +9269,9 @@ "dev": true }, "enhanced-resolve": { - "version": "5.8.2", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.8.2.tgz", - "integrity": "sha512-F27oB3WuHDzvR2DOGNTaYy0D5o0cnrv8TeI482VM4kYgQd/FT9lUQwuNsJ0oOHtBUq7eiW5ytqzp7nBFknL+GA==", - "dev": true, + "version": "5.12.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz", + "integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==", "requires": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -2313,16 +9293,43 @@ "dev": true }, "es-module-lexer": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.7.1.tgz", - "integrity": "sha512-MgtWFl5No+4S3TmhDmCz2ObFGm6lEpTnzbQi+Dd+pw4mlTIZTmM2iAs5gRlmx5zS9luzobCSBSI90JM/1/JgOw==", - "dev": true + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", + "integrity": "sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==" + }, + "esbuild": { + "version": "0.16.9", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.16.9.tgz", + "integrity": "sha512-gkH83yHyijMSZcZFs1IWew342eMdFuWXmQo3zkDPTre25LIPBJsXryg02M3u8OpTwCJdBkdaQwqKkDLnAsAeLQ==", + "requires": { + "@esbuild/android-arm": "0.16.9", + "@esbuild/android-arm64": "0.16.9", + "@esbuild/android-x64": "0.16.9", + "@esbuild/darwin-arm64": "0.16.9", + "@esbuild/darwin-x64": "0.16.9", + "@esbuild/freebsd-arm64": "0.16.9", + "@esbuild/freebsd-x64": "0.16.9", + "@esbuild/linux-arm": "0.16.9", + "@esbuild/linux-arm64": "0.16.9", + "@esbuild/linux-ia32": "0.16.9", + "@esbuild/linux-loong64": "0.16.9", + "@esbuild/linux-mips64el": "0.16.9", + "@esbuild/linux-ppc64": "0.16.9", + "@esbuild/linux-riscv64": "0.16.9", + "@esbuild/linux-s390x": "0.16.9", + "@esbuild/linux-x64": "0.16.9", + "@esbuild/netbsd-x64": "0.16.9", + "@esbuild/openbsd-x64": "0.16.9", + "@esbuild/sunos-x64": "0.16.9", + "@esbuild/win32-arm64": "0.16.9", + "@esbuild/win32-ia32": "0.16.9", + "@esbuild/win32-x64": "0.16.9" + } }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, "escape-string-regexp": { "version": "1.0.5", @@ -2490,7 +9497,6 @@ "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, "requires": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -2563,7 +9569,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "dev": true, "requires": { "estraverse": "^5.2.0" }, @@ -2571,16 +9576,14 @@ "estraverse": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", - "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", - "dev": true + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==" } } }, "estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" }, "esutils": { "version": "2.0.3", @@ -2591,8 +9594,7 @@ "events": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==" }, "execa": { "version": "5.1.1", @@ -2614,14 +9616,12 @@ "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-glob": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", - "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", - "dev": true, + "version": "3.2.12", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", + "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -2633,8 +9633,7 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "fast-levenshtein": { "version": "2.0.6", @@ -2652,7 +9651,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", - "dev": true, "requires": { "reusify": "^1.0.4" } @@ -2670,7 +9668,6 @@ "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -2723,6 +9720,11 @@ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", "integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" }, + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2801,7 +9803,6 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, "requires": { "is-glob": "^4.0.1" } @@ -2809,8 +9810,7 @@ "glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "dev": true + "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==" }, "globals": { "version": "13.11.0", @@ -2836,10 +9836,9 @@ } }, "graceful-fs": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", - "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", - "dev": true + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "growl": { "version": "1.10.5", @@ -2859,8 +9858,7 @@ "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" }, "has-symbols": { "version": "1.0.2", @@ -2881,10 +9879,9 @@ "dev": true }, "ignore": { - "version": "5.1.8", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", - "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", - "dev": true + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.2.tgz", + "integrity": "sha512-m1MJSy4Z2NAcyhoYpxQeBsc1ZdNQwYjN0wGbLBlnVArdJ90Gtr8IhNSfZZcCoR0fM/0E0BJ0mf1KnLNDOCJP4w==" }, "import-fresh": { "version": "3.3.0", @@ -2963,8 +9960,7 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" }, "is-fullwidth-code-point": { "version": "2.0.0", @@ -2973,10 +9969,9 @@ "dev": true }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "requires": { "is-extglob": "^2.1.1" } @@ -2984,8 +9979,7 @@ "is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" }, "is-plain-obj": { "version": "2.1.0", @@ -3030,7 +10024,6 @@ "version": "27.0.6", "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.6.tgz", "integrity": "sha512-qupxcj/dRuA3xHPMUd40gr2EaAurFbkwzOh7wfPaeE9id7hyjURRQoqNfHifHK3XjJU6YJJUQKILGUnwGPEOCA==", - "dev": true, "requires": { "@types/node": "*", "merge-stream": "^2.0.0", @@ -3058,17 +10051,15 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -3104,8 +10095,7 @@ "loader-runner": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.2.0.tgz", - "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==", - "dev": true + "integrity": "sha512-92+huvxMvYlMzMt0iIOukcwYBFpkYJdpl2xsZ7LrlayO7E8SOv+JJUEK17B/dJIHAOLMfh2dZZ/Y18WgmGtYNw==" }, "loader-utils": { "version": "1.4.0", @@ -3252,20 +10242,17 @@ "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" }, "micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", - "dev": true, "requires": { "braces": "^3.0.1", "picomatch": "^2.2.3" @@ -3274,14 +10261,12 @@ "mime-db": { "version": "1.49.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", - "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", - "dev": true + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==" }, "mime-types": { "version": "2.1.32", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", - "dev": true, "requires": { "mime-db": "1.49.0" } @@ -3436,8 +10421,7 @@ "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, "nkeys.js": { "version": "1.0.0-9", @@ -3452,14 +10436,12 @@ "node-releases": { "version": "1.1.74", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.74.tgz", - "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==", - "dev": true + "integrity": "sha512-caJBVempXZPepZoZAPCWRTNxYQ+xtG/KAi4ozTA5A+nJ7IU+kLQCbqaUjb5Rwy14M9upBWiQ4NutcmW04LJSRw==" }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" }, "npm-run-path": { "version": "4.0.1", @@ -3590,8 +10572,7 @@ "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", - "dev": true + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" }, "pathval": { "version": "1.1.1", @@ -3602,8 +10583,7 @@ "picomatch": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", - "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", - "dev": true + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==" }, "pkg-dir": { "version": "4.2.0", @@ -3641,20 +10621,17 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, "queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, "requires": { "safe-buffer": "^5.1.0" } @@ -3759,8 +10736,7 @@ "require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", - "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", - "dev": true + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, "resolve": { "version": "1.20.0", @@ -3790,8 +10766,7 @@ "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "dev": true + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" }, "rimraf": { "version": "3.0.2", @@ -3806,7 +10781,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "dev": true, "requires": { "queue-microtask": "^1.2.2" } @@ -3814,14 +10788,12 @@ "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, "schema-utils": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz", "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==", - "dev": true, "requires": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", @@ -3841,7 +10813,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, "requires": { "randombytes": "^2.1.0" } @@ -3928,14 +10899,12 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { "version": "0.5.19", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", - "dev": true, "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -3982,7 +10951,6 @@ "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, "requires": { "has-flag": "^4.0.0" } @@ -4056,14 +11024,12 @@ "tapable": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.0.tgz", - "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==", - "dev": true + "integrity": "sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==" }, "terser": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz", "integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==", - "dev": true, "requires": { "commander": "^2.20.0", "source-map": "~0.7.2", @@ -4073,14 +11039,12 @@ "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "source-map": { "version": "0.7.3", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", - "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", - "dev": true + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==" } } }, @@ -4088,7 +11052,6 @@ "version": "5.1.4", "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz", "integrity": "sha512-C2WkFwstHDhVEmsmlCxrXUtVklS+Ir1A7twrYzrDrQQOIMOaVAYykaoo/Aq1K0QRkMoY2hhvDQY1cm4jnIMFwA==", - "dev": true, "requires": { "jest-worker": "^27.0.2", "p-limit": "^3.1.0", @@ -4102,7 +11065,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, "requires": { "yocto-queue": "^0.1.0" } @@ -4125,7 +11087,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, "requires": { "is-number": "^7.0.0" } @@ -4295,7 +11256,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "requires": { "punycode": "^2.1.0" } @@ -4316,45 +11276,43 @@ "dev": true }, "watchpack": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.2.0.tgz", - "integrity": "sha512-up4YAn/XHgZHIxFBVCdlMiWDj6WaLKpwVeGQk2I5thdYxF/KmF0aaz6TfJZ/hfl1h/XlcDr7k1KH7ThDagpFaA==", - "dev": true, + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", + "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", "requires": { "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.1.2" } }, "webpack": { - "version": "5.50.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.50.0.tgz", - "integrity": "sha512-hqxI7t/KVygs0WRv/kTgUW8Kl3YC81uyWQSo/7WUs5LsuRw0htH/fCwbVBGCuiX/t4s7qzjXFcf41O8Reiypag==", - "dev": true, + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", + "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", "requires": { - "@types/eslint-scope": "^3.7.0", - "@types/estree": "^0.0.50", + "@types/eslint-scope": "^3.7.3", + "@types/estree": "^0.0.51", "@webassemblyjs/ast": "1.11.1", "@webassemblyjs/wasm-edit": "1.11.1", "@webassemblyjs/wasm-parser": "1.11.1", - "acorn": "^8.4.1", + "acorn": "^8.7.1", "acorn-import-assertions": "^1.7.6", "browserslist": "^4.14.5", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.8.0", - "es-module-lexer": "^0.7.1", + "enhanced-resolve": "^5.10.0", + "es-module-lexer": "^0.9.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.4", - "json-parse-better-errors": "^1.0.2", + "graceful-fs": "^4.2.9", + "json-parse-even-better-errors": "^2.3.1", "loader-runner": "^4.2.0", "mime-types": "^2.1.27", "neo-async": "^2.6.2", "schema-utils": "^3.1.0", "tapable": "^2.1.1", "terser-webpack-plugin": "^5.1.3", - "watchpack": "^2.2.0", - "webpack-sources": "^3.2.0" + "watchpack": "^2.4.0", + "webpack-sources": "^3.2.3" } }, "webpack-cli": { @@ -4389,10 +11347,9 @@ } }, "webpack-sources": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.0.tgz", - "integrity": "sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==", - "dev": true + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", + "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==" }, "which": { "version": "2.0.2", @@ -4593,8 +11550,7 @@ "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" } } } diff --git a/package.json b/package.json index 947e99d..172fdc5 100644 --- a/package.json +++ b/package.json @@ -69,13 +69,16 @@ "ts-loader": "^9.2.5", "ts-node": "^10.2.1", "typescript": "^4.3.5", - "webpack": "^5.50.0", + "webpack": "^5.75.0", "webpack-cli": "^4.8.0" }, "dependencies": { - "@msgpack/msgpack": "^2.7.1", + "@msgpack/msgpack": "^2.8.0", "@wapc/host": "0.0.2", "axios": "^0.24.0", + "copy-webpack-plugin": "^11.0.0", + "esbuild": "^0.16.9", + "fs": "^0.0.1-security", "nats.ws": "^1.2.0" } -} \ No newline at end of file +} diff --git a/src/events.ts b/src/events.ts index 2daf532..2eca14f 100644 --- a/src/events.ts +++ b/src/events.ts @@ -1,10 +1,11 @@ import { uuidv4 } from './util'; export enum EventType { - HeartBeat = 'com.wasmcloud.lattice.host_heartbeat', ActorStarted = 'com.wasmcloud.lattice.actor_started', ActorStopped = 'com.wasmcloud.lattice.actor_stopped', - HealthCheckPass = 'com.wasmcloud.lattice.health_check_passed' + HeartBeat = 'com.wasmcloud.lattice.host_heartbeat', + HealthCheckPass = 'com.wasmcloud.lattice.health_check_passed', + HostStarted = 'com.wasmcloud.lattice.host_started' } export type EventData = { diff --git a/src/host.ts b/src/host.ts index c463b97..56d0127 100644 --- a/src/host.ts +++ b/src/host.ts @@ -12,7 +12,8 @@ import { LaunchActorMessage, StopActorMessage, HostCall, - Writer + Writer, + HostStartedMessage } from './types'; import { jsonDecode, jsonEncode, uuidv4 } from './util'; @@ -34,6 +35,8 @@ export class Host { count: number; }; }; + labels: object; + friendlyName: string; natsConnOpts: Array | ConnectionOptions; natsConn!: NatsConnection; eventsSubscription!: Subscription | null; @@ -59,6 +62,13 @@ export class Host { this.seed = hostKey.seed; this.withRegistryTLS = withRegistryTLS; this.actors = {}; + this.labels = { + // TODO: Could maybe pull the type of browser? + 'hostcore.arch': 'web', + 'hostcore.os': 'browser', + 'hostcore.osfamily': 'js' + }; + this.friendlyName = `java-script-${Math.round(Math.random() * 9999)}`; this.wasm = wasm; this.heartbeatInterval = heartbeatInterval; this.natsConnOpts = natsConnOpts; @@ -93,7 +103,8 @@ export class Host { this.heartbeatIntervalId; const heartbeat: HeartbeatMessage = { actors: [], - providers: [] + providers: [], + labels: this.labels }; for (const actor in this.actors) { heartbeat.actors.push({ @@ -101,12 +112,13 @@ export class Host { instances: 1 }); } - this.heartbeatIntervalId = await setInterval(() => { + const heartbeatFn = () => { this.natsConn.publish( `wasmbus.evt.${this.name}`, jsonEncode(createEventMessage(this.key, EventType.HeartBeat, heartbeat)) ); - }, this.heartbeatInterval); + }; + this.heartbeatIntervalId = setInterval(heartbeatFn, this.heartbeatInterval); } /** @@ -117,6 +129,18 @@ export class Host { this.heartbeatIntervalId = null; } + async publishHostStarted() { + const hostStarted: HostStartedMessage = { + labels: this.labels, + friendly_name: this.friendlyName + }; + + this.natsConn.publish( + `wasmbus.evt.${this.name}`, + jsonEncode(createEventMessage(this.key, EventType.HostStarted, hostStarted)) + ); + } + /** * subscribeToEvents subscribes to the events on the host * @@ -280,7 +304,12 @@ export class Host { */ async startHost() { await this.connectNATS(); - Promise.all([this.startHeartbeat(), this.listenLaunchActor(), this.listenStopActor()]).catch((err: Error) => { + Promise.all([ + this.publishHostStarted(), + this.startHeartbeat(), + this.listenLaunchActor(), + this.listenStopActor() + ]).catch((err: Error) => { throw err; }); } @@ -328,6 +357,7 @@ export async function startHost( natsConnection, wasm ); + await host.startHost(); return host; } diff --git a/src/types.ts b/src/types.ts index d849c54..4fe9c82 100644 --- a/src/types.ts +++ b/src/types.ts @@ -4,6 +4,12 @@ export type HeartbeatMessage = { instances: number; }>; providers: []; + labels: object; +}; + +export type HostStartedMessage = { + labels: object; + friendly_name: string; }; export type CreateLinkDefMessage = { diff --git a/test/infra/docker-compose.yml b/test/infra/docker-compose.yml index 8e7419b..92d51aa 100644 --- a/test/infra/docker-compose.yml +++ b/test/infra/docker-compose.yml @@ -1,16 +1,16 @@ -version: "3" +version: '3' services: registry: image: registry:2 ports: - - "5001:5001" - volumes: - - ./docker-registry.yml:/etc/docker/registry/config.yml + - '5001:5000' + volumes: + - ./docker-registry.yml:/etc/docker/registry/config.yml nats: - image: nats:latest + image: nats:2.9.3 ports: - - "4222:4222" - - "6222:6222" + - '4222:4222' + - '6222:6222' volumes: - ./nats.conf:/etc/nats.conf - command: "-c=/etc/nats.conf -js" + command: '-c=/etc/nats.conf -js' diff --git a/test/infra/nats.conf b/test/infra/nats.conf index be116c2..3b228a0 100644 --- a/test/infra/nats.conf +++ b/test/infra/nats.conf @@ -1,4 +1,3 @@ -listen: localhost:4222 websocket { # host: "hostname" port: 6222 From c4e1d3347cdbee696a2e9fe9cc3ad0b8adfe078e Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Thu, 22 Dec 2022 12:27:03 -0500 Subject: [PATCH 2/4] Added simple example, updated READMEs Signed-off-by: Brooks Townsend --- .gitignore | 1 + README.md | 100 +- examples/simple/Makefile | 4 +- examples/simple/README.md | 45 +- examples/simple/index.html | 109 +- examples/simple/main.css | 15 + examples/simple/main.js | 127 +- examples/simple/out.js | 14087 ----------------------------------- src/actor.ts | 33 +- src/host.ts | 56 +- src/types.ts | 22 +- 11 files changed, 368 insertions(+), 14231 deletions(-) create mode 100644 examples/simple/main.css delete mode 100644 examples/simple/out.js diff --git a/.gitignore b/.gitignore index c6ae9b8..f3a3630 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ index.html wasmcloud-rs-js/pkg/ host_config.json +out.js *.wasm \ No newline at end of file diff --git a/README.md b/README.md index fee85d4..b66d259 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,44 @@ # wasmCloud Host in JavaScript/Browser -This is the JavaScript implementation of the wasmCloud host for the browser (NodeJS support in progress). The library runs a host inside a web browser/application that connects to a remote lattice via NATS and can run wasmCloud actors in the browser. The host will automatically listen for actor start/stop from NATS and will initialize the actor using `wapcJS`. Any invocations will be handled by the browser actor and returned to the requesting host via NATS. Users can pass callbacks to handle invocation and event data. +This is the JavaScript implementation of the wasmCloud host for the browser (NodeJS support in progress). The library runs a host inside a web browser/application that connects to a remote [lattice](https://wasmcloud.com/docs/reference/lattice/) via NATS and can run [wasmCloud actors](https://wasmcloud.com/docs/app-dev/create-actor/) in the browser. The host will automatically listen for actor start/stop from NATS and will initialize the actor using `wapcJS`. Any invocations will be handled by the browser actor and returned to the requesting host via NATS. Users can pass callbacks to handle invocation and event data. + +## Running the JavaScript host + +This repository contains two examples: + +1. [console](./examples/console) which includes examples for how to utilize the wasmCloud host as a library or through a bundler like webpack or esbuild. All interaction with this host occurs through the browser console +1. [simple](./examples/simple/) which includes a very simple web UI, error handling, and scripts for starting the host through the web browser. **It's recommended to use this example to get started** ## Demonstration Video In this demonstration video we will demonstration the following: -* Load an HTTP Server capability into a wasmCloud Host running on a machine -* Load an the wasmcloud-js host into a web browser -* Load an 'echo' actor into the web browser -* **seamlessly** bind the actor to the capability provider through Lattice -* Access the webserver, which in turn delivers the request to the actor, processes it, and returns it to the requestion client via the capability -* Unload the actor +- Load an HTTP Server capability into a wasmCloud Host running on a machine +- Load an the wasmcloud-js host into a web browser +- Load an 'echo' actor into the web browser +- **seamlessly** bind the actor to the capability provider through Lattice +- Access the webserver, which in turn delivers the request to the actor, processes it, and returns it to the requestion client via the capability +- Unload the actor https://user-images.githubusercontent.com/1530656/130013412-b9a9daa6-fc71-424b-814c-2ca400926794.mp4 - - ## Prerequisities -* NATS with WebSockets enabled +- NATS with WebSockets enabled -* wasmCloud lattice (OTP Version) +- wasmCloud lattice (OTP Version) -* (OPTIONAL) Docker Registry with CORS configured +- (OPTIONAL) Docker Registry with CORS configured - * If launching actors from remote registries in the browser host, CORS must be configured on the registry server + - If launching actors from remote registries in the browser host, CORS must be configured on the registry server ## Development Prerequisities -* NodeJS, npm - -* rust, cargo, wasm-pack +- NodeJS, npm - * Used to port the rust versions of wascap, nkeys to JS +- rust, cargo, wasm-pack + - Used to port the rust versions of wascap, nkeys to JS ## Installation @@ -44,16 +48,16 @@ $ npm install @wasmcloud/wasmcloud-js ## Usage -More examples can be found in the [examples](examples/) directory, including sample `webpack` and `esbuild` configurations +More examples can be found in the [examples](examples/) directory, including sample `webpack` and `esbuild` configurations **Browser** -```html +````html -``` +```` **With a bundler** -There are some caveats to using with a bundler: +There are some caveats to using with a bundler: -* The module contains `.wasm` files that need to be present alongside the final build output. Using `webpack-copy-plugin` (or `fs.copyFile` with other bundlers) can solve this issue. +- The module contains `.wasm` files that need to be present alongside the final build output. Using `webpack-copy-plugin` (or `fs.copyFile` with other bundlers) can solve this issue. -* If using with `create-react-app`, the webpack config will need to be ejected via `npm run eject` OR an npm library like `react-app-rewired` can handle the config injection. +- If using with `create-react-app`, the webpack config will need to be ejected via `npm run eject` OR an npm library like `react-app-rewired` can handle the config injection. ```javascript // as esm -- this will grant you access to the types/params @@ -115,13 +127,13 @@ import { startHost } from '@wasmcloud/wasmcloud-js'; // const wasmcloudjs = require('@wasmcloud/wasmcloud-js); async function cjsHost() { - const host = await wasmcloudjs.startHost('default', false, ['ws://localhost:4222']) - console.log(host); + const host = await wasmcloudjs.startHost('default', false, ['ws://localhost:4222']); + console.log(host); } async function esmHost() { - const host = await startHost('default', false, ['ws://localhost:4222']) - console.log(host); + const host = await startHost('default', false, ['ws://localhost:4222']); + console.log(host); } cjsHost(); @@ -131,20 +143,20 @@ esmHost(); ```javascript // webpack config, add this to the plugin section plugins: [ - new CopyPlugin({ - patterns: [ - { - from: 'node_modules/@wasmcloud/wasmcloud-js/dist/wasmcloud-rs-js/pkg/*.wasm', - to: '[name].wasm' - } - ] - }), -] + new CopyPlugin({ + patterns: [ + { + from: 'node_modules/@wasmcloud/wasmcloud-js/dist/wasmcloud-rs-js/pkg/*.wasm', + to: '[name].wasm' + } + ] + }) +]; ``` -**Node** +**Node** -*IN PROGRESS* - NodeJS does not support WebSockets natively (required by nats.ws) +_IN PROGRESS_ - NodeJS does not support WebSockets natively (required by nats.ws) ## Contributing diff --git a/examples/simple/Makefile b/examples/simple/Makefile index a47a134..bdd9218 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -4,8 +4,8 @@ help: ## Display this help install: npm install -esbuild: install +build: install ## Install NPM dependencies and compile the JS library and wasmcloud.wasm file node esbuild.js -esbuild-run: esbuild ## Build and run wasmCloud with esbuild, then run httpserver +run: build ## Build and run wasmCloud with esbuild, then run python3's httpserver python3 -m http.server diff --git a/examples/simple/README.md b/examples/simple/README.md index 9b6fcd5..fdb65b4 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -4,38 +4,39 @@ This directory contains examples of using the `wasmcloud-js` library with an `es ## Prerequisities -- NATS with WebSockets enabled +- `make` +- `npm` +- `cargo` and a Rust `wasm32-unknown-unknown` toolchain installed +- `python3` or an equivalent way to serve static assets from local files +- `nats-server` with JetStream and WebSockets enabled - - There is sample infra via docker in the `test/infra` directory of this repo, `cd test/infra && docker-compose up` +## Build and Run -- wasmCloud lattice (OTP Version) - -- (OPTIONAL) Docker Registry with CORS configured - - - If launching actors from remote registries in the browser host, CORS must be configured on the registry server - -- NodeJS, NPM, npx - -## Build +This example is bundled with `esbuild` and runs locally with use of the `python3` http server. ```sh -npm install # this will run and build the rust deps -npm install esbuild copy-webpack-plugin fs -node esbuild.js # this produces the esbuild version +make run ``` -## Usage +In another terminal you'll need to run a NATS server with websockets enabled, which you can do with: -1. Build the code with esbuild +``` +cd ../../test/infra && docker compose up +``` -2. Start a web server inside this directory (e.g `python3 -m http.server` or `npx serve`) +## Starting Actors -3. Navigate to a browser `localhost:` +For this section you should install [`wash`, the wasmCloud shell](https://wasmcloud.com/docs/installation). +You can start actors on this host by dragging the `.wasm` file into the browser window after you launch the host. To run the `echo` example, in your terminal, download the sample actor with `wash`: -4. Launch a host using the button on the page, feel free to add a lattice prefix or just use `default` +``` +wash reg pull wasmcloud.azurecr.io/echo:0.3.4 +``` -5. Start an actor with `host.launchActor('registry:5000/image', (data) => console.log(data))`. Echo actor is recommended (the 2nd parameter here is an invocation callback to handle the data from an invocation) +Then, drag that `echo.wasm` file into the browser. You should see a single `Echo` actor running. You can directly call this actor's HTTP handler using `wash`: -6. Link the actor with a provider running in Wasmcloud (eg `httpserver`) +``` +wash call MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5 HttpServer.HandleRequest '{"method": "GET", "path": "/echo", "body": "", "queryString":"","header":{}}' +``` -7. Run a `curl localhost:port/echo` to see the response in the console (based off the invocation callback). +And you'll get back a raw response like: `Call response (raw): ��statusCode�Ȧheader��body�;{"body":[],"method":"GET","path":"/echo","query_string":""}` diff --git a/examples/simple/index.html b/examples/simple/index.html index 13c0b67..a04bb03 100644 --- a/examples/simple/index.html +++ b/examples/simple/index.html @@ -2,31 +2,98 @@ - + + wasmCloud JS - - - - - - - -

    wasmCloud in the browser

    + +

    wasmCloud Browser Host

    - -

    - - -
      + + + + + + + + + + + + +
      + + + +
      + + + +
      + +
      +
      + + +
      - \ No newline at end of file + diff --git a/examples/simple/main.css b/examples/simple/main.css new file mode 100644 index 0000000..a91d1ea --- /dev/null +++ b/examples/simple/main.css @@ -0,0 +1,15 @@ +body { + font-family: sans-serif; + padding: 16px; + background-color: #D9E1E2; + color: #253746; +} + +input.userInput { + /* Enough to display a 56 character public key */ + width: 510px; +} + +label.tabelLabel { + width: 150px; +} \ No newline at end of file diff --git a/examples/simple/main.js b/examples/simple/main.js index a80ffff..ff38832 100644 --- a/examples/simple/main.js +++ b/examples/simple/main.js @@ -1,38 +1,107 @@ import { startHost } from '../../dist/src' -// Importing inside of a project -// import { startHost } from '@wasmcloud/wasmcloud-js'; -// const { startHost } = require('@wasmcloud/wasmcloud-js'); +document.getElementById('hostButton').onclick = () => { + const latticePrefixInput = getInputValue(document.getElementById('latticePrefix')); + const natsUrlInput = getInputValue(document.getElementById('natsUrl')); -var runningHosts = []; + const latticePrefix = latticePrefixInput === null ? 'default' : latticePrefixInput; + const natsUrl = natsUrlInput === null ? 'ws://localhost:6222' : natsUrlInput; -document.getElementById('hostButton').onclick = () => { - const latticePrefixInput = document.getElementById('latticePrefix'); - if (!latticePrefixInput || !latticePrefixInput.value || latticePrefixInput.value === '') { - //TODO: help duplication here - (async () => { - const host = await startHost('374b6434-f18d-4b93-8743-bcd3089e4d5b', false, ['ws://localhost:6222']) - runningHosts.push(host); - document.getElementById('runningHosts').innerHTML = hostList(runningHosts).innerHTML - console.dir(runningHosts); - })(); + (async () => { + try { + const host = await startHost(latticePrefix, false, [natsUrl]) + displayHost(host); + window.host = host; + alert(`Host ${host.friendlyName} launched successfully!`) + } catch (e) { + alert(e) + } + })(); +} + +function displayHost(host) { + document.getElementById('hostFriendlyName').value = host.friendlyName; + document.getElementById('hostId').value = host.key; + document.getElementById('recommendation').innerHTML = 'Drag and drop a wasmCloud WebAssembly actor anywhere on this page to start it on this host.'; + document.getElementById('hostButton').hidden = true; + document.getElementById('runningHost').hidden = false; + document.getElementById('dropZone').hidden = false; +} + +function getInputValue(input) { + if (input && input.value && input.value !== '') { + return input.value; } else { - (async () => { - const host = await startHost(latticePrefixInput.value, false, ['ws://localhost:6222']) - runningHosts.push(host); - document.getElementById('runningHosts').innerHTML = hostList(runningHosts).innerHTML - console.dir(runningHosts); - })(); + return null; } } -function hostList(runningHosts) { - let list = document.createElement('ol'); - runningHosts.forEach((host) => { - console.dir(host) - let listItem = document.createElement('li'); - listItem.innerText = host.friendlyName; - list.appendChild(listItem); - }); - return list; +document.getElementById("dropZone").ondragover = (ev) => { + // Prevent default behavior (Prevent file from being opened) + ev.preventDefault(); + document.getElementById("pageBody").style.backgroundColor = "#00C389"; +} + +document.getElementById("dropZone").ondrop = (ev) => { + // Prevent default behavior (Prevent file from being opened) + ev.preventDefault(); + document.getElementById("pageBody").style.backgroundColor = "#D9E1E2"; + + if (ev.dataTransfer.items) { + // Use DataTransferItemList interface to access the file(s) + [...ev.dataTransfer.items].forEach((item, i) => { + // If dropped items aren't files, reject them + if (item.kind === 'file') { + const file = item.getAsFile(); + file.arrayBuffer().then( + (buf) => { + const bytes = new Uint8Array(buf); + window.host.launchActorFromBytes(bytes).then((actor) => { + document.getElementById('actors').appendChild(actorRow(actor)); + console.log("Launched actor successfully") + }).catch((e) => { + alert(e); + }); + + } + ); + } + }); + } else { + // Use DataTransfer interface to access the file(s) + [...ev.dataTransfer.files].forEach((file, i) => { + console.log(`… file[${i}].name = ${file.name}`); + }); + } +} + +// Helper function to create the HTML for an actor's row +function actorRow(actor) { + const claims = actor.claims.wascap; + let actorRow = document.createElement('tr'); + + let nameValueTd = document.createElement('td'); + let nameValue = document.createElement('input'); + nameValue.disabled = true; + nameValue.value = claims.name; + nameValueTd.appendChild(nameValue); + + let verValueTd = document.createElement('td'); + let verValue = document.createElement('input'); + verValue.disabled = true; + verValue.value = claims.ver; + verValueTd.appendChild(verValue); + + let capsValueTd = document.createElement('td'); + let capsValue = document.createElement('input'); + capsValue.style.width = "310px"; + capsValue.disabled = true; + capsValue.value = claims.caps.join(','); + capsValueTd.appendChild(capsValue); + + actorRow.appendChild(nameValueTd); + actorRow.appendChild(verValueTd); + actorRow.appendChild(capsValueTd); + + return actorRow; } \ No newline at end of file diff --git a/examples/simple/out.js b/examples/simple/out.js deleted file mode 100644 index cc9d568..0000000 --- a/examples/simple/out.js +++ /dev/null @@ -1,14087 +0,0 @@ -"use strict"; -(() => { - var __create = Object.create; - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __getProtoOf = Object.getPrototypeOf; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] - }) : x)(function(x) { - if (typeof require !== "undefined") - return require.apply(this, arguments); - throw new Error('Dynamic require of "' + x + '" is not supported'); - }); - var __commonJS = (cb, mod) => function __require2() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod - )); - - // ../../node_modules/@msgpack/msgpack/dist/utils/int.js - var require_int = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/utils/int.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getUint64 = exports.getInt64 = exports.setInt64 = exports.setUint64 = exports.UINT32_MAX = void 0; - exports.UINT32_MAX = 4294967295; - function setUint64(view, offset, value) { - const high = value / 4294967296; - const low = value; - view.setUint32(offset, high); - view.setUint32(offset + 4, low); - } - exports.setUint64 = setUint64; - function setInt64(view, offset, value) { - const high = Math.floor(value / 4294967296); - const low = value; - view.setUint32(offset, high); - view.setUint32(offset + 4, low); - } - exports.setInt64 = setInt64; - function getInt64(view, offset) { - const high = view.getInt32(offset); - const low = view.getUint32(offset + 4); - return high * 4294967296 + low; - } - exports.getInt64 = getInt64; - function getUint64(view, offset) { - const high = view.getUint32(offset); - const low = view.getUint32(offset + 4); - return high * 4294967296 + low; - } - exports.getUint64 = getUint64; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/utils/utf8.js - var require_utf8 = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/utils/utf8.js"(exports) { - "use strict"; - var _a; - var _b; - var _c; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.utf8DecodeTD = exports.TEXT_DECODER_THRESHOLD = exports.utf8DecodeJs = exports.utf8EncodeTE = exports.TEXT_ENCODER_THRESHOLD = exports.utf8EncodeJs = exports.utf8Count = void 0; - var int_1 = require_int(); - var TEXT_ENCODING_AVAILABLE = (typeof process === "undefined" || ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a["TEXT_ENCODING"]) !== "never") && typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined"; - function utf8Count(str) { - const strLength = str.length; - let byteLength = 0; - let pos = 0; - while (pos < strLength) { - let value = str.charCodeAt(pos++); - if ((value & 4294967168) === 0) { - byteLength++; - continue; - } else if ((value & 4294965248) === 0) { - byteLength += 2; - } else { - if (value >= 55296 && value <= 56319) { - if (pos < strLength) { - const extra = str.charCodeAt(pos); - if ((extra & 64512) === 56320) { - ++pos; - value = ((value & 1023) << 10) + (extra & 1023) + 65536; - } - } - } - if ((value & 4294901760) === 0) { - byteLength += 3; - } else { - byteLength += 4; - } - } - } - return byteLength; - } - exports.utf8Count = utf8Count; - function utf8EncodeJs(str, output, outputOffset) { - const strLength = str.length; - let offset = outputOffset; - let pos = 0; - while (pos < strLength) { - let value = str.charCodeAt(pos++); - if ((value & 4294967168) === 0) { - output[offset++] = value; - continue; - } else if ((value & 4294965248) === 0) { - output[offset++] = value >> 6 & 31 | 192; - } else { - if (value >= 55296 && value <= 56319) { - if (pos < strLength) { - const extra = str.charCodeAt(pos); - if ((extra & 64512) === 56320) { - ++pos; - value = ((value & 1023) << 10) + (extra & 1023) + 65536; - } - } - } - if ((value & 4294901760) === 0) { - output[offset++] = value >> 12 & 15 | 224; - output[offset++] = value >> 6 & 63 | 128; - } else { - output[offset++] = value >> 18 & 7 | 240; - output[offset++] = value >> 12 & 63 | 128; - output[offset++] = value >> 6 & 63 | 128; - } - } - output[offset++] = value & 63 | 128; - } - } - exports.utf8EncodeJs = utf8EncodeJs; - var sharedTextEncoder = TEXT_ENCODING_AVAILABLE ? new TextEncoder() : void 0; - exports.TEXT_ENCODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE ? int_1.UINT32_MAX : typeof process !== "undefined" && ((_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b["TEXT_ENCODING"]) !== "force" ? 200 : 0; - function utf8EncodeTEencode(str, output, outputOffset) { - output.set(sharedTextEncoder.encode(str), outputOffset); - } - function utf8EncodeTEencodeInto(str, output, outputOffset) { - sharedTextEncoder.encodeInto(str, output.subarray(outputOffset)); - } - exports.utf8EncodeTE = (sharedTextEncoder === null || sharedTextEncoder === void 0 ? void 0 : sharedTextEncoder.encodeInto) ? utf8EncodeTEencodeInto : utf8EncodeTEencode; - var CHUNK_SIZE = 4096; - function utf8DecodeJs(bytes, inputOffset, byteLength) { - let offset = inputOffset; - const end = offset + byteLength; - const units = []; - let result = ""; - while (offset < end) { - const byte1 = bytes[offset++]; - if ((byte1 & 128) === 0) { - units.push(byte1); - } else if ((byte1 & 224) === 192) { - const byte2 = bytes[offset++] & 63; - units.push((byte1 & 31) << 6 | byte2); - } else if ((byte1 & 240) === 224) { - const byte2 = bytes[offset++] & 63; - const byte3 = bytes[offset++] & 63; - units.push((byte1 & 31) << 12 | byte2 << 6 | byte3); - } else if ((byte1 & 248) === 240) { - const byte2 = bytes[offset++] & 63; - const byte3 = bytes[offset++] & 63; - const byte4 = bytes[offset++] & 63; - let unit = (byte1 & 7) << 18 | byte2 << 12 | byte3 << 6 | byte4; - if (unit > 65535) { - unit -= 65536; - units.push(unit >>> 10 & 1023 | 55296); - unit = 56320 | unit & 1023; - } - units.push(unit); - } else { - units.push(byte1); - } - if (units.length >= CHUNK_SIZE) { - result += String.fromCharCode(...units); - units.length = 0; - } - } - if (units.length > 0) { - result += String.fromCharCode(...units); - } - return result; - } - exports.utf8DecodeJs = utf8DecodeJs; - var sharedTextDecoder = TEXT_ENCODING_AVAILABLE ? new TextDecoder() : null; - exports.TEXT_DECODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE ? int_1.UINT32_MAX : typeof process !== "undefined" && ((_c = process === null || process === void 0 ? void 0 : process.env) === null || _c === void 0 ? void 0 : _c["TEXT_DECODER"]) !== "force" ? 200 : 0; - function utf8DecodeTD(bytes, inputOffset, byteLength) { - const stringBytes = bytes.subarray(inputOffset, inputOffset + byteLength); - return sharedTextDecoder.decode(stringBytes); - } - exports.utf8DecodeTD = utf8DecodeTD; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/ExtData.js - var require_ExtData = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/ExtData.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExtData = void 0; - var ExtData = class { - constructor(type, data) { - this.type = type; - this.data = data; - } - }; - exports.ExtData = ExtData; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/DecodeError.js - var require_DecodeError = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/DecodeError.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DecodeError = void 0; - var DecodeError = class extends Error { - constructor(message) { - super(message); - const proto = Object.create(DecodeError.prototype); - Object.setPrototypeOf(this, proto); - Object.defineProperty(this, "name", { - configurable: true, - enumerable: false, - value: DecodeError.name - }); - } - }; - exports.DecodeError = DecodeError; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/timestamp.js - var require_timestamp = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/timestamp.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.timestampExtension = exports.decodeTimestampExtension = exports.decodeTimestampToTimeSpec = exports.encodeTimestampExtension = exports.encodeDateToTimeSpec = exports.encodeTimeSpecToTimestamp = exports.EXT_TIMESTAMP = void 0; - var DecodeError_1 = require_DecodeError(); - var int_1 = require_int(); - exports.EXT_TIMESTAMP = -1; - var TIMESTAMP32_MAX_SEC = 4294967296 - 1; - var TIMESTAMP64_MAX_SEC = 17179869184 - 1; - function encodeTimeSpecToTimestamp({ sec, nsec }) { - if (sec >= 0 && nsec >= 0 && sec <= TIMESTAMP64_MAX_SEC) { - if (nsec === 0 && sec <= TIMESTAMP32_MAX_SEC) { - const rv = new Uint8Array(4); - const view = new DataView(rv.buffer); - view.setUint32(0, sec); - return rv; - } else { - const secHigh = sec / 4294967296; - const secLow = sec & 4294967295; - const rv = new Uint8Array(8); - const view = new DataView(rv.buffer); - view.setUint32(0, nsec << 2 | secHigh & 3); - view.setUint32(4, secLow); - return rv; - } - } else { - const rv = new Uint8Array(12); - const view = new DataView(rv.buffer); - view.setUint32(0, nsec); - (0, int_1.setInt64)(view, 4, sec); - return rv; - } - } - exports.encodeTimeSpecToTimestamp = encodeTimeSpecToTimestamp; - function encodeDateToTimeSpec(date) { - const msec = date.getTime(); - const sec = Math.floor(msec / 1e3); - const nsec = (msec - sec * 1e3) * 1e6; - const nsecInSec = Math.floor(nsec / 1e9); - return { - sec: sec + nsecInSec, - nsec: nsec - nsecInSec * 1e9 - }; - } - exports.encodeDateToTimeSpec = encodeDateToTimeSpec; - function encodeTimestampExtension(object) { - if (object instanceof Date) { - const timeSpec = encodeDateToTimeSpec(object); - return encodeTimeSpecToTimestamp(timeSpec); - } else { - return null; - } - } - exports.encodeTimestampExtension = encodeTimestampExtension; - function decodeTimestampToTimeSpec(data) { - const view = new DataView(data.buffer, data.byteOffset, data.byteLength); - switch (data.byteLength) { - case 4: { - const sec = view.getUint32(0); - const nsec = 0; - return { sec, nsec }; - } - case 8: { - const nsec30AndSecHigh2 = view.getUint32(0); - const secLow32 = view.getUint32(4); - const sec = (nsec30AndSecHigh2 & 3) * 4294967296 + secLow32; - const nsec = nsec30AndSecHigh2 >>> 2; - return { sec, nsec }; - } - case 12: { - const sec = (0, int_1.getInt64)(view, 4); - const nsec = view.getUint32(0); - return { sec, nsec }; - } - default: - throw new DecodeError_1.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${data.length}`); - } - } - exports.decodeTimestampToTimeSpec = decodeTimestampToTimeSpec; - function decodeTimestampExtension(data) { - const timeSpec = decodeTimestampToTimeSpec(data); - return new Date(timeSpec.sec * 1e3 + timeSpec.nsec / 1e6); - } - exports.decodeTimestampExtension = decodeTimestampExtension; - exports.timestampExtension = { - type: exports.EXT_TIMESTAMP, - encode: encodeTimestampExtension, - decode: decodeTimestampExtension - }; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/ExtensionCodec.js - var require_ExtensionCodec = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/ExtensionCodec.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ExtensionCodec = void 0; - var ExtData_1 = require_ExtData(); - var timestamp_1 = require_timestamp(); - var ExtensionCodec = class { - constructor() { - this.builtInEncoders = []; - this.builtInDecoders = []; - this.encoders = []; - this.decoders = []; - this.register(timestamp_1.timestampExtension); - } - register({ type, encode, decode }) { - if (type >= 0) { - this.encoders[type] = encode; - this.decoders[type] = decode; - } else { - const index = 1 + type; - this.builtInEncoders[index] = encode; - this.builtInDecoders[index] = decode; - } - } - tryToEncode(object, context) { - for (let i = 0; i < this.builtInEncoders.length; i++) { - const encodeExt = this.builtInEncoders[i]; - if (encodeExt != null) { - const data = encodeExt(object, context); - if (data != null) { - const type = -1 - i; - return new ExtData_1.ExtData(type, data); - } - } - } - for (let i = 0; i < this.encoders.length; i++) { - const encodeExt = this.encoders[i]; - if (encodeExt != null) { - const data = encodeExt(object, context); - if (data != null) { - const type = i; - return new ExtData_1.ExtData(type, data); - } - } - } - if (object instanceof ExtData_1.ExtData) { - return object; - } - return null; - } - decode(data, type, context) { - const decodeExt = type < 0 ? this.builtInDecoders[-1 - type] : this.decoders[type]; - if (decodeExt) { - return decodeExt(data, type, context); - } else { - return new ExtData_1.ExtData(type, data); - } - } - }; - exports.ExtensionCodec = ExtensionCodec; - ExtensionCodec.defaultCodec = new ExtensionCodec(); - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/utils/typedArrays.js - var require_typedArrays = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/utils/typedArrays.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createDataView = exports.ensureUint8Array = void 0; - function ensureUint8Array(buffer) { - if (buffer instanceof Uint8Array) { - return buffer; - } else if (ArrayBuffer.isView(buffer)) { - return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength); - } else if (buffer instanceof ArrayBuffer) { - return new Uint8Array(buffer); - } else { - return Uint8Array.from(buffer); - } - } - exports.ensureUint8Array = ensureUint8Array; - function createDataView(buffer) { - if (buffer instanceof ArrayBuffer) { - return new DataView(buffer); - } - const bufferView = ensureUint8Array(buffer); - return new DataView(bufferView.buffer, bufferView.byteOffset, bufferView.byteLength); - } - exports.createDataView = createDataView; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/Encoder.js - var require_Encoder = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/Encoder.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Encoder = exports.DEFAULT_INITIAL_BUFFER_SIZE = exports.DEFAULT_MAX_DEPTH = void 0; - var utf8_1 = require_utf8(); - var ExtensionCodec_1 = require_ExtensionCodec(); - var int_1 = require_int(); - var typedArrays_1 = require_typedArrays(); - exports.DEFAULT_MAX_DEPTH = 100; - exports.DEFAULT_INITIAL_BUFFER_SIZE = 2048; - var Encoder = class { - constructor(extensionCodec = ExtensionCodec_1.ExtensionCodec.defaultCodec, context = void 0, maxDepth = exports.DEFAULT_MAX_DEPTH, initialBufferSize = exports.DEFAULT_INITIAL_BUFFER_SIZE, sortKeys = false, forceFloat32 = false, ignoreUndefined = false, forceIntegerToFloat = false) { - this.extensionCodec = extensionCodec; - this.context = context; - this.maxDepth = maxDepth; - this.initialBufferSize = initialBufferSize; - this.sortKeys = sortKeys; - this.forceFloat32 = forceFloat32; - this.ignoreUndefined = ignoreUndefined; - this.forceIntegerToFloat = forceIntegerToFloat; - this.pos = 0; - this.view = new DataView(new ArrayBuffer(this.initialBufferSize)); - this.bytes = new Uint8Array(this.view.buffer); - } - reinitializeState() { - this.pos = 0; - } - encodeSharedRef(object) { - this.reinitializeState(); - this.doEncode(object, 1); - return this.bytes.subarray(0, this.pos); - } - encode(object) { - this.reinitializeState(); - this.doEncode(object, 1); - return this.bytes.slice(0, this.pos); - } - doEncode(object, depth) { - if (depth > this.maxDepth) { - throw new Error(`Too deep objects in depth ${depth}`); - } - if (object == null) { - this.encodeNil(); - } else if (typeof object === "boolean") { - this.encodeBoolean(object); - } else if (typeof object === "number") { - this.encodeNumber(object); - } else if (typeof object === "string") { - this.encodeString(object); - } else { - this.encodeObject(object, depth); - } - } - ensureBufferSizeToWrite(sizeToWrite) { - const requiredSize = this.pos + sizeToWrite; - if (this.view.byteLength < requiredSize) { - this.resizeBuffer(requiredSize * 2); - } - } - resizeBuffer(newSize) { - const newBuffer = new ArrayBuffer(newSize); - const newBytes = new Uint8Array(newBuffer); - const newView = new DataView(newBuffer); - newBytes.set(this.bytes); - this.view = newView; - this.bytes = newBytes; - } - encodeNil() { - this.writeU8(192); - } - encodeBoolean(object) { - if (object === false) { - this.writeU8(194); - } else { - this.writeU8(195); - } - } - encodeNumber(object) { - if (Number.isSafeInteger(object) && !this.forceIntegerToFloat) { - if (object >= 0) { - if (object < 128) { - this.writeU8(object); - } else if (object < 256) { - this.writeU8(204); - this.writeU8(object); - } else if (object < 65536) { - this.writeU8(205); - this.writeU16(object); - } else if (object < 4294967296) { - this.writeU8(206); - this.writeU32(object); - } else { - this.writeU8(207); - this.writeU64(object); - } - } else { - if (object >= -32) { - this.writeU8(224 | object + 32); - } else if (object >= -128) { - this.writeU8(208); - this.writeI8(object); - } else if (object >= -32768) { - this.writeU8(209); - this.writeI16(object); - } else if (object >= -2147483648) { - this.writeU8(210); - this.writeI32(object); - } else { - this.writeU8(211); - this.writeI64(object); - } - } - } else { - if (this.forceFloat32) { - this.writeU8(202); - this.writeF32(object); - } else { - this.writeU8(203); - this.writeF64(object); - } - } - } - writeStringHeader(byteLength) { - if (byteLength < 32) { - this.writeU8(160 + byteLength); - } else if (byteLength < 256) { - this.writeU8(217); - this.writeU8(byteLength); - } else if (byteLength < 65536) { - this.writeU8(218); - this.writeU16(byteLength); - } else if (byteLength < 4294967296) { - this.writeU8(219); - this.writeU32(byteLength); - } else { - throw new Error(`Too long string: ${byteLength} bytes in UTF-8`); - } - } - encodeString(object) { - const maxHeaderSize = 1 + 4; - const strLength = object.length; - if (strLength > utf8_1.TEXT_ENCODER_THRESHOLD) { - const byteLength = (0, utf8_1.utf8Count)(object); - this.ensureBufferSizeToWrite(maxHeaderSize + byteLength); - this.writeStringHeader(byteLength); - (0, utf8_1.utf8EncodeTE)(object, this.bytes, this.pos); - this.pos += byteLength; - } else { - const byteLength = (0, utf8_1.utf8Count)(object); - this.ensureBufferSizeToWrite(maxHeaderSize + byteLength); - this.writeStringHeader(byteLength); - (0, utf8_1.utf8EncodeJs)(object, this.bytes, this.pos); - this.pos += byteLength; - } - } - encodeObject(object, depth) { - const ext = this.extensionCodec.tryToEncode(object, this.context); - if (ext != null) { - this.encodeExtension(ext); - } else if (Array.isArray(object)) { - this.encodeArray(object, depth); - } else if (ArrayBuffer.isView(object)) { - this.encodeBinary(object); - } else if (typeof object === "object") { - this.encodeMap(object, depth); - } else { - throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(object)}`); - } - } - encodeBinary(object) { - const size = object.byteLength; - if (size < 256) { - this.writeU8(196); - this.writeU8(size); - } else if (size < 65536) { - this.writeU8(197); - this.writeU16(size); - } else if (size < 4294967296) { - this.writeU8(198); - this.writeU32(size); - } else { - throw new Error(`Too large binary: ${size}`); - } - const bytes = (0, typedArrays_1.ensureUint8Array)(object); - this.writeU8a(bytes); - } - encodeArray(object, depth) { - const size = object.length; - if (size < 16) { - this.writeU8(144 + size); - } else if (size < 65536) { - this.writeU8(220); - this.writeU16(size); - } else if (size < 4294967296) { - this.writeU8(221); - this.writeU32(size); - } else { - throw new Error(`Too large array: ${size}`); - } - for (const item of object) { - this.doEncode(item, depth + 1); - } - } - countWithoutUndefined(object, keys) { - let count = 0; - for (const key of keys) { - if (object[key] !== void 0) { - count++; - } - } - return count; - } - encodeMap(object, depth) { - const keys = Object.keys(object); - if (this.sortKeys) { - keys.sort(); - } - const size = this.ignoreUndefined ? this.countWithoutUndefined(object, keys) : keys.length; - if (size < 16) { - this.writeU8(128 + size); - } else if (size < 65536) { - this.writeU8(222); - this.writeU16(size); - } else if (size < 4294967296) { - this.writeU8(223); - this.writeU32(size); - } else { - throw new Error(`Too large map object: ${size}`); - } - for (const key of keys) { - const value = object[key]; - if (!(this.ignoreUndefined && value === void 0)) { - this.encodeString(key); - this.doEncode(value, depth + 1); - } - } - } - encodeExtension(ext) { - const size = ext.data.length; - if (size === 1) { - this.writeU8(212); - } else if (size === 2) { - this.writeU8(213); - } else if (size === 4) { - this.writeU8(214); - } else if (size === 8) { - this.writeU8(215); - } else if (size === 16) { - this.writeU8(216); - } else if (size < 256) { - this.writeU8(199); - this.writeU8(size); - } else if (size < 65536) { - this.writeU8(200); - this.writeU16(size); - } else if (size < 4294967296) { - this.writeU8(201); - this.writeU32(size); - } else { - throw new Error(`Too large extension object: ${size}`); - } - this.writeI8(ext.type); - this.writeU8a(ext.data); - } - writeU8(value) { - this.ensureBufferSizeToWrite(1); - this.view.setUint8(this.pos, value); - this.pos++; - } - writeU8a(values) { - const size = values.length; - this.ensureBufferSizeToWrite(size); - this.bytes.set(values, this.pos); - this.pos += size; - } - writeI8(value) { - this.ensureBufferSizeToWrite(1); - this.view.setInt8(this.pos, value); - this.pos++; - } - writeU16(value) { - this.ensureBufferSizeToWrite(2); - this.view.setUint16(this.pos, value); - this.pos += 2; - } - writeI16(value) { - this.ensureBufferSizeToWrite(2); - this.view.setInt16(this.pos, value); - this.pos += 2; - } - writeU32(value) { - this.ensureBufferSizeToWrite(4); - this.view.setUint32(this.pos, value); - this.pos += 4; - } - writeI32(value) { - this.ensureBufferSizeToWrite(4); - this.view.setInt32(this.pos, value); - this.pos += 4; - } - writeF32(value) { - this.ensureBufferSizeToWrite(4); - this.view.setFloat32(this.pos, value); - this.pos += 4; - } - writeF64(value) { - this.ensureBufferSizeToWrite(8); - this.view.setFloat64(this.pos, value); - this.pos += 8; - } - writeU64(value) { - this.ensureBufferSizeToWrite(8); - (0, int_1.setUint64)(this.view, this.pos, value); - this.pos += 8; - } - writeI64(value) { - this.ensureBufferSizeToWrite(8); - (0, int_1.setInt64)(this.view, this.pos, value); - this.pos += 8; - } - }; - exports.Encoder = Encoder; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/encode.js - var require_encode = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/encode.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.encode = void 0; - var Encoder_1 = require_Encoder(); - var defaultEncodeOptions = {}; - function encode(value, options = defaultEncodeOptions) { - const encoder = new Encoder_1.Encoder(options.extensionCodec, options.context, options.maxDepth, options.initialBufferSize, options.sortKeys, options.forceFloat32, options.ignoreUndefined, options.forceIntegerToFloat); - return encoder.encodeSharedRef(value); - } - exports.encode = encode; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/utils/prettyByte.js - var require_prettyByte = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/utils/prettyByte.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.prettyByte = void 0; - function prettyByte(byte) { - return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`; - } - exports.prettyByte = prettyByte; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/CachedKeyDecoder.js - var require_CachedKeyDecoder = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/CachedKeyDecoder.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.CachedKeyDecoder = void 0; - var utf8_1 = require_utf8(); - var DEFAULT_MAX_KEY_LENGTH = 16; - var DEFAULT_MAX_LENGTH_PER_KEY = 16; - var CachedKeyDecoder = class { - constructor(maxKeyLength = DEFAULT_MAX_KEY_LENGTH, maxLengthPerKey = DEFAULT_MAX_LENGTH_PER_KEY) { - this.maxKeyLength = maxKeyLength; - this.maxLengthPerKey = maxLengthPerKey; - this.hit = 0; - this.miss = 0; - this.caches = []; - for (let i = 0; i < this.maxKeyLength; i++) { - this.caches.push([]); - } - } - canBeCached(byteLength) { - return byteLength > 0 && byteLength <= this.maxKeyLength; - } - find(bytes, inputOffset, byteLength) { - const records = this.caches[byteLength - 1]; - FIND_CHUNK: - for (const record of records) { - const recordBytes = record.bytes; - for (let j = 0; j < byteLength; j++) { - if (recordBytes[j] !== bytes[inputOffset + j]) { - continue FIND_CHUNK; - } - } - return record.str; - } - return null; - } - store(bytes, value) { - const records = this.caches[bytes.length - 1]; - const record = { bytes, str: value }; - if (records.length >= this.maxLengthPerKey) { - records[Math.random() * records.length | 0] = record; - } else { - records.push(record); - } - } - decode(bytes, inputOffset, byteLength) { - const cachedValue = this.find(bytes, inputOffset, byteLength); - if (cachedValue != null) { - this.hit++; - return cachedValue; - } - this.miss++; - const str = (0, utf8_1.utf8DecodeJs)(bytes, inputOffset, byteLength); - const slicedCopyOfBytes = Uint8Array.prototype.slice.call(bytes, inputOffset, inputOffset + byteLength); - this.store(slicedCopyOfBytes, str); - return str; - } - }; - exports.CachedKeyDecoder = CachedKeyDecoder; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/Decoder.js - var require_Decoder = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/Decoder.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Decoder = exports.DataViewIndexOutOfBoundsError = void 0; - var prettyByte_1 = require_prettyByte(); - var ExtensionCodec_1 = require_ExtensionCodec(); - var int_1 = require_int(); - var utf8_1 = require_utf8(); - var typedArrays_1 = require_typedArrays(); - var CachedKeyDecoder_1 = require_CachedKeyDecoder(); - var DecodeError_1 = require_DecodeError(); - var isValidMapKeyType = (key) => { - const keyType = typeof key; - return keyType === "string" || keyType === "number"; - }; - var HEAD_BYTE_REQUIRED = -1; - var EMPTY_VIEW = new DataView(new ArrayBuffer(0)); - var EMPTY_BYTES = new Uint8Array(EMPTY_VIEW.buffer); - exports.DataViewIndexOutOfBoundsError = (() => { - try { - EMPTY_VIEW.getInt8(0); - } catch (e) { - return e.constructor; - } - throw new Error("never reached"); - })(); - var MORE_DATA = new exports.DataViewIndexOutOfBoundsError("Insufficient data"); - var sharedCachedKeyDecoder = new CachedKeyDecoder_1.CachedKeyDecoder(); - var Decoder = class { - constructor(extensionCodec = ExtensionCodec_1.ExtensionCodec.defaultCodec, context = void 0, maxStrLength = int_1.UINT32_MAX, maxBinLength = int_1.UINT32_MAX, maxArrayLength = int_1.UINT32_MAX, maxMapLength = int_1.UINT32_MAX, maxExtLength = int_1.UINT32_MAX, keyDecoder = sharedCachedKeyDecoder) { - this.extensionCodec = extensionCodec; - this.context = context; - this.maxStrLength = maxStrLength; - this.maxBinLength = maxBinLength; - this.maxArrayLength = maxArrayLength; - this.maxMapLength = maxMapLength; - this.maxExtLength = maxExtLength; - this.keyDecoder = keyDecoder; - this.totalPos = 0; - this.pos = 0; - this.view = EMPTY_VIEW; - this.bytes = EMPTY_BYTES; - this.headByte = HEAD_BYTE_REQUIRED; - this.stack = []; - } - reinitializeState() { - this.totalPos = 0; - this.headByte = HEAD_BYTE_REQUIRED; - this.stack.length = 0; - } - setBuffer(buffer) { - this.bytes = (0, typedArrays_1.ensureUint8Array)(buffer); - this.view = (0, typedArrays_1.createDataView)(this.bytes); - this.pos = 0; - } - appendBuffer(buffer) { - if (this.headByte === HEAD_BYTE_REQUIRED && !this.hasRemaining(1)) { - this.setBuffer(buffer); - } else { - const remainingData = this.bytes.subarray(this.pos); - const newData = (0, typedArrays_1.ensureUint8Array)(buffer); - const newBuffer = new Uint8Array(remainingData.length + newData.length); - newBuffer.set(remainingData); - newBuffer.set(newData, remainingData.length); - this.setBuffer(newBuffer); - } - } - hasRemaining(size) { - return this.view.byteLength - this.pos >= size; - } - createExtraByteError(posToShow) { - const { view, pos } = this; - return new RangeError(`Extra ${view.byteLength - pos} of ${view.byteLength} byte(s) found at buffer[${posToShow}]`); - } - decode(buffer) { - this.reinitializeState(); - this.setBuffer(buffer); - const object = this.doDecodeSync(); - if (this.hasRemaining(1)) { - throw this.createExtraByteError(this.pos); - } - return object; - } - *decodeMulti(buffer) { - this.reinitializeState(); - this.setBuffer(buffer); - while (this.hasRemaining(1)) { - yield this.doDecodeSync(); - } - } - async decodeAsync(stream) { - let decoded = false; - let object; - for await (const buffer of stream) { - if (decoded) { - throw this.createExtraByteError(this.totalPos); - } - this.appendBuffer(buffer); - try { - object = this.doDecodeSync(); - decoded = true; - } catch (e) { - if (!(e instanceof exports.DataViewIndexOutOfBoundsError)) { - throw e; - } - } - this.totalPos += this.pos; - } - if (decoded) { - if (this.hasRemaining(1)) { - throw this.createExtraByteError(this.totalPos); - } - return object; - } - const { headByte, pos, totalPos } = this; - throw new RangeError(`Insufficient data in parsing ${(0, prettyByte_1.prettyByte)(headByte)} at ${totalPos} (${pos} in the current buffer)`); - } - decodeArrayStream(stream) { - return this.decodeMultiAsync(stream, true); - } - decodeStream(stream) { - return this.decodeMultiAsync(stream, false); - } - async *decodeMultiAsync(stream, isArray) { - let isArrayHeaderRequired = isArray; - let arrayItemsLeft = -1; - for await (const buffer of stream) { - if (isArray && arrayItemsLeft === 0) { - throw this.createExtraByteError(this.totalPos); - } - this.appendBuffer(buffer); - if (isArrayHeaderRequired) { - arrayItemsLeft = this.readArraySize(); - isArrayHeaderRequired = false; - this.complete(); - } - try { - while (true) { - yield this.doDecodeSync(); - if (--arrayItemsLeft === 0) { - break; - } - } - } catch (e) { - if (!(e instanceof exports.DataViewIndexOutOfBoundsError)) { - throw e; - } - } - this.totalPos += this.pos; - } - } - doDecodeSync() { - DECODE: - while (true) { - const headByte = this.readHeadByte(); - let object; - if (headByte >= 224) { - object = headByte - 256; - } else if (headByte < 192) { - if (headByte < 128) { - object = headByte; - } else if (headByte < 144) { - const size = headByte - 128; - if (size !== 0) { - this.pushMapState(size); - this.complete(); - continue DECODE; - } else { - object = {}; - } - } else if (headByte < 160) { - const size = headByte - 144; - if (size !== 0) { - this.pushArrayState(size); - this.complete(); - continue DECODE; - } else { - object = []; - } - } else { - const byteLength = headByte - 160; - object = this.decodeUtf8String(byteLength, 0); - } - } else if (headByte === 192) { - object = null; - } else if (headByte === 194) { - object = false; - } else if (headByte === 195) { - object = true; - } else if (headByte === 202) { - object = this.readF32(); - } else if (headByte === 203) { - object = this.readF64(); - } else if (headByte === 204) { - object = this.readU8(); - } else if (headByte === 205) { - object = this.readU16(); - } else if (headByte === 206) { - object = this.readU32(); - } else if (headByte === 207) { - object = this.readU64(); - } else if (headByte === 208) { - object = this.readI8(); - } else if (headByte === 209) { - object = this.readI16(); - } else if (headByte === 210) { - object = this.readI32(); - } else if (headByte === 211) { - object = this.readI64(); - } else if (headByte === 217) { - const byteLength = this.lookU8(); - object = this.decodeUtf8String(byteLength, 1); - } else if (headByte === 218) { - const byteLength = this.lookU16(); - object = this.decodeUtf8String(byteLength, 2); - } else if (headByte === 219) { - const byteLength = this.lookU32(); - object = this.decodeUtf8String(byteLength, 4); - } else if (headByte === 220) { - const size = this.readU16(); - if (size !== 0) { - this.pushArrayState(size); - this.complete(); - continue DECODE; - } else { - object = []; - } - } else if (headByte === 221) { - const size = this.readU32(); - if (size !== 0) { - this.pushArrayState(size); - this.complete(); - continue DECODE; - } else { - object = []; - } - } else if (headByte === 222) { - const size = this.readU16(); - if (size !== 0) { - this.pushMapState(size); - this.complete(); - continue DECODE; - } else { - object = {}; - } - } else if (headByte === 223) { - const size = this.readU32(); - if (size !== 0) { - this.pushMapState(size); - this.complete(); - continue DECODE; - } else { - object = {}; - } - } else if (headByte === 196) { - const size = this.lookU8(); - object = this.decodeBinary(size, 1); - } else if (headByte === 197) { - const size = this.lookU16(); - object = this.decodeBinary(size, 2); - } else if (headByte === 198) { - const size = this.lookU32(); - object = this.decodeBinary(size, 4); - } else if (headByte === 212) { - object = this.decodeExtension(1, 0); - } else if (headByte === 213) { - object = this.decodeExtension(2, 0); - } else if (headByte === 214) { - object = this.decodeExtension(4, 0); - } else if (headByte === 215) { - object = this.decodeExtension(8, 0); - } else if (headByte === 216) { - object = this.decodeExtension(16, 0); - } else if (headByte === 199) { - const size = this.lookU8(); - object = this.decodeExtension(size, 1); - } else if (headByte === 200) { - const size = this.lookU16(); - object = this.decodeExtension(size, 2); - } else if (headByte === 201) { - const size = this.lookU32(); - object = this.decodeExtension(size, 4); - } else { - throw new DecodeError_1.DecodeError(`Unrecognized type byte: ${(0, prettyByte_1.prettyByte)(headByte)}`); - } - this.complete(); - const stack = this.stack; - while (stack.length > 0) { - const state = stack[stack.length - 1]; - if (state.type === 0) { - state.array[state.position] = object; - state.position++; - if (state.position === state.size) { - stack.pop(); - object = state.array; - } else { - continue DECODE; - } - } else if (state.type === 1) { - if (!isValidMapKeyType(object)) { - throw new DecodeError_1.DecodeError("The type of key must be string or number but " + typeof object); - } - if (object === "__proto__") { - throw new DecodeError_1.DecodeError("The key __proto__ is not allowed"); - } - state.key = object; - state.type = 2; - continue DECODE; - } else { - state.map[state.key] = object; - state.readCount++; - if (state.readCount === state.size) { - stack.pop(); - object = state.map; - } else { - state.key = null; - state.type = 1; - continue DECODE; - } - } - } - return object; - } - } - readHeadByte() { - if (this.headByte === HEAD_BYTE_REQUIRED) { - this.headByte = this.readU8(); - } - return this.headByte; - } - complete() { - this.headByte = HEAD_BYTE_REQUIRED; - } - readArraySize() { - const headByte = this.readHeadByte(); - switch (headByte) { - case 220: - return this.readU16(); - case 221: - return this.readU32(); - default: { - if (headByte < 160) { - return headByte - 144; - } else { - throw new DecodeError_1.DecodeError(`Unrecognized array type byte: ${(0, prettyByte_1.prettyByte)(headByte)}`); - } - } - } - } - pushMapState(size) { - if (size > this.maxMapLength) { - throw new DecodeError_1.DecodeError(`Max length exceeded: map length (${size}) > maxMapLengthLength (${this.maxMapLength})`); - } - this.stack.push({ - type: 1, - size, - key: null, - readCount: 0, - map: {} - }); - } - pushArrayState(size) { - if (size > this.maxArrayLength) { - throw new DecodeError_1.DecodeError(`Max length exceeded: array length (${size}) > maxArrayLength (${this.maxArrayLength})`); - } - this.stack.push({ - type: 0, - size, - array: new Array(size), - position: 0 - }); - } - decodeUtf8String(byteLength, headerOffset) { - var _a; - if (byteLength > this.maxStrLength) { - throw new DecodeError_1.DecodeError(`Max length exceeded: UTF-8 byte length (${byteLength}) > maxStrLength (${this.maxStrLength})`); - } - if (this.bytes.byteLength < this.pos + headerOffset + byteLength) { - throw MORE_DATA; - } - const offset = this.pos + headerOffset; - let object; - if (this.stateIsMapKey() && ((_a = this.keyDecoder) === null || _a === void 0 ? void 0 : _a.canBeCached(byteLength))) { - object = this.keyDecoder.decode(this.bytes, offset, byteLength); - } else if (byteLength > utf8_1.TEXT_DECODER_THRESHOLD) { - object = (0, utf8_1.utf8DecodeTD)(this.bytes, offset, byteLength); - } else { - object = (0, utf8_1.utf8DecodeJs)(this.bytes, offset, byteLength); - } - this.pos += headerOffset + byteLength; - return object; - } - stateIsMapKey() { - if (this.stack.length > 0) { - const state = this.stack[this.stack.length - 1]; - return state.type === 1; - } - return false; - } - decodeBinary(byteLength, headOffset) { - if (byteLength > this.maxBinLength) { - throw new DecodeError_1.DecodeError(`Max length exceeded: bin length (${byteLength}) > maxBinLength (${this.maxBinLength})`); - } - if (!this.hasRemaining(byteLength + headOffset)) { - throw MORE_DATA; - } - const offset = this.pos + headOffset; - const object = this.bytes.subarray(offset, offset + byteLength); - this.pos += headOffset + byteLength; - return object; - } - decodeExtension(size, headOffset) { - if (size > this.maxExtLength) { - throw new DecodeError_1.DecodeError(`Max length exceeded: ext length (${size}) > maxExtLength (${this.maxExtLength})`); - } - const extType = this.view.getInt8(this.pos + headOffset); - const data = this.decodeBinary(size, headOffset + 1); - return this.extensionCodec.decode(data, extType, this.context); - } - lookU8() { - return this.view.getUint8(this.pos); - } - lookU16() { - return this.view.getUint16(this.pos); - } - lookU32() { - return this.view.getUint32(this.pos); - } - readU8() { - const value = this.view.getUint8(this.pos); - this.pos++; - return value; - } - readI8() { - const value = this.view.getInt8(this.pos); - this.pos++; - return value; - } - readU16() { - const value = this.view.getUint16(this.pos); - this.pos += 2; - return value; - } - readI16() { - const value = this.view.getInt16(this.pos); - this.pos += 2; - return value; - } - readU32() { - const value = this.view.getUint32(this.pos); - this.pos += 4; - return value; - } - readI32() { - const value = this.view.getInt32(this.pos); - this.pos += 4; - return value; - } - readU64() { - const value = (0, int_1.getUint64)(this.view, this.pos); - this.pos += 8; - return value; - } - readI64() { - const value = (0, int_1.getInt64)(this.view, this.pos); - this.pos += 8; - return value; - } - readF32() { - const value = this.view.getFloat32(this.pos); - this.pos += 4; - return value; - } - readF64() { - const value = this.view.getFloat64(this.pos); - this.pos += 8; - return value; - } - }; - exports.Decoder = Decoder; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/decode.js - var require_decode = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/decode.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.decodeMulti = exports.decode = exports.defaultDecodeOptions = void 0; - var Decoder_1 = require_Decoder(); - exports.defaultDecodeOptions = {}; - function decode(buffer, options = exports.defaultDecodeOptions) { - const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); - return decoder.decode(buffer); - } - exports.decode = decode; - function decodeMulti(buffer, options = exports.defaultDecodeOptions) { - const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); - return decoder.decodeMulti(buffer); - } - exports.decodeMulti = decodeMulti; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/utils/stream.js - var require_stream = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/utils/stream.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ensureAsyncIterable = exports.asyncIterableFromStream = exports.isAsyncIterable = void 0; - function isAsyncIterable(object) { - return object[Symbol.asyncIterator] != null; - } - exports.isAsyncIterable = isAsyncIterable; - function assertNonNull(value) { - if (value == null) { - throw new Error("Assertion Failure: value must not be null nor undefined"); - } - } - async function* asyncIterableFromStream(stream) { - const reader = stream.getReader(); - try { - while (true) { - const { done, value } = await reader.read(); - if (done) { - return; - } - assertNonNull(value); - yield value; - } - } finally { - reader.releaseLock(); - } - } - exports.asyncIterableFromStream = asyncIterableFromStream; - function ensureAsyncIterable(streamLike) { - if (isAsyncIterable(streamLike)) { - return streamLike; - } else { - return asyncIterableFromStream(streamLike); - } - } - exports.ensureAsyncIterable = ensureAsyncIterable; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/decodeAsync.js - var require_decodeAsync = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/decodeAsync.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.decodeStream = exports.decodeMultiStream = exports.decodeArrayStream = exports.decodeAsync = void 0; - var Decoder_1 = require_Decoder(); - var stream_1 = require_stream(); - var decode_1 = require_decode(); - async function decodeAsync(streamLike, options = decode_1.defaultDecodeOptions) { - const stream = (0, stream_1.ensureAsyncIterable)(streamLike); - const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); - return decoder.decodeAsync(stream); - } - exports.decodeAsync = decodeAsync; - function decodeArrayStream(streamLike, options = decode_1.defaultDecodeOptions) { - const stream = (0, stream_1.ensureAsyncIterable)(streamLike); - const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); - return decoder.decodeArrayStream(stream); - } - exports.decodeArrayStream = decodeArrayStream; - function decodeMultiStream(streamLike, options = decode_1.defaultDecodeOptions) { - const stream = (0, stream_1.ensureAsyncIterable)(streamLike); - const decoder = new Decoder_1.Decoder(options.extensionCodec, options.context, options.maxStrLength, options.maxBinLength, options.maxArrayLength, options.maxMapLength, options.maxExtLength); - return decoder.decodeStream(stream); - } - exports.decodeMultiStream = decodeMultiStream; - function decodeStream(streamLike, options = decode_1.defaultDecodeOptions) { - return decodeMultiStream(streamLike, options); - } - exports.decodeStream = decodeStream; - } - }); - - // ../../node_modules/@msgpack/msgpack/dist/index.js - var require_dist = __commonJS({ - "../../node_modules/@msgpack/msgpack/dist/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.decodeTimestampExtension = exports.encodeTimestampExtension = exports.decodeTimestampToTimeSpec = exports.encodeTimeSpecToTimestamp = exports.encodeDateToTimeSpec = exports.EXT_TIMESTAMP = exports.ExtData = exports.ExtensionCodec = exports.Encoder = exports.DataViewIndexOutOfBoundsError = exports.DecodeError = exports.Decoder = exports.decodeStream = exports.decodeMultiStream = exports.decodeArrayStream = exports.decodeAsync = exports.decodeMulti = exports.decode = exports.encode = void 0; - var encode_1 = require_encode(); - Object.defineProperty(exports, "encode", { enumerable: true, get: function() { - return encode_1.encode; - } }); - var decode_1 = require_decode(); - Object.defineProperty(exports, "decode", { enumerable: true, get: function() { - return decode_1.decode; - } }); - Object.defineProperty(exports, "decodeMulti", { enumerable: true, get: function() { - return decode_1.decodeMulti; - } }); - var decodeAsync_1 = require_decodeAsync(); - Object.defineProperty(exports, "decodeAsync", { enumerable: true, get: function() { - return decodeAsync_1.decodeAsync; - } }); - Object.defineProperty(exports, "decodeArrayStream", { enumerable: true, get: function() { - return decodeAsync_1.decodeArrayStream; - } }); - Object.defineProperty(exports, "decodeMultiStream", { enumerable: true, get: function() { - return decodeAsync_1.decodeMultiStream; - } }); - Object.defineProperty(exports, "decodeStream", { enumerable: true, get: function() { - return decodeAsync_1.decodeStream; - } }); - var Decoder_1 = require_Decoder(); - Object.defineProperty(exports, "Decoder", { enumerable: true, get: function() { - return Decoder_1.Decoder; - } }); - Object.defineProperty(exports, "DataViewIndexOutOfBoundsError", { enumerable: true, get: function() { - return Decoder_1.DataViewIndexOutOfBoundsError; - } }); - var DecodeError_1 = require_DecodeError(); - Object.defineProperty(exports, "DecodeError", { enumerable: true, get: function() { - return DecodeError_1.DecodeError; - } }); - var Encoder_1 = require_Encoder(); - Object.defineProperty(exports, "Encoder", { enumerable: true, get: function() { - return Encoder_1.Encoder; - } }); - var ExtensionCodec_1 = require_ExtensionCodec(); - Object.defineProperty(exports, "ExtensionCodec", { enumerable: true, get: function() { - return ExtensionCodec_1.ExtensionCodec; - } }); - var ExtData_1 = require_ExtData(); - Object.defineProperty(exports, "ExtData", { enumerable: true, get: function() { - return ExtData_1.ExtData; - } }); - var timestamp_1 = require_timestamp(); - Object.defineProperty(exports, "EXT_TIMESTAMP", { enumerable: true, get: function() { - return timestamp_1.EXT_TIMESTAMP; - } }); - Object.defineProperty(exports, "encodeDateToTimeSpec", { enumerable: true, get: function() { - return timestamp_1.encodeDateToTimeSpec; - } }); - Object.defineProperty(exports, "encodeTimeSpecToTimestamp", { enumerable: true, get: function() { - return timestamp_1.encodeTimeSpecToTimestamp; - } }); - Object.defineProperty(exports, "decodeTimestampToTimeSpec", { enumerable: true, get: function() { - return timestamp_1.decodeTimestampToTimeSpec; - } }); - Object.defineProperty(exports, "encodeTimestampExtension", { enumerable: true, get: function() { - return timestamp_1.encodeTimestampExtension; - } }); - Object.defineProperty(exports, "decodeTimestampExtension", { enumerable: true, get: function() { - return timestamp_1.decodeTimestampExtension; - } }); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/types.js - var require_types = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/types.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.JsHeaders = exports.ReplayPolicy = exports.AckPolicy = exports.DeliverPolicy = exports.StorageType = exports.DiscardPolicy = exports.RetentionPolicy = exports.AdvisoryKind = exports.DEFAULT_MAX_PING_OUT = exports.DEFAULT_PING_INTERVAL = exports.DEFAULT_JITTER_TLS = exports.DEFAULT_JITTER = exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = exports.DEFAULT_RECONNECT_TIME_WAIT = exports.DEFAULT_HOST = exports.DEFAULT_PORT = exports.DebugEvents = exports.Events = exports.Empty = void 0; - exports.Empty = new Uint8Array(0); - var Events; - (function(Events2) { - Events2["Disconnect"] = "disconnect"; - Events2["Reconnect"] = "reconnect"; - Events2["Update"] = "update"; - Events2["LDM"] = "ldm"; - Events2["Error"] = "error"; - })(Events = exports.Events || (exports.Events = {})); - var DebugEvents; - (function(DebugEvents2) { - DebugEvents2["Reconnecting"] = "reconnecting"; - DebugEvents2["PingTimer"] = "pingTimer"; - DebugEvents2["StaleConnection"] = "staleConnection"; - })(DebugEvents = exports.DebugEvents || (exports.DebugEvents = {})); - exports.DEFAULT_PORT = 4222; - exports.DEFAULT_HOST = "127.0.0.1"; - exports.DEFAULT_RECONNECT_TIME_WAIT = 2 * 1e3; - exports.DEFAULT_MAX_RECONNECT_ATTEMPTS = 10; - exports.DEFAULT_JITTER = 100; - exports.DEFAULT_JITTER_TLS = 1e3; - exports.DEFAULT_PING_INTERVAL = 2 * 60 * 1e3; - exports.DEFAULT_MAX_PING_OUT = 2; - var AdvisoryKind; - (function(AdvisoryKind2) { - AdvisoryKind2["API"] = "api_audit"; - AdvisoryKind2["StreamAction"] = "stream_action"; - AdvisoryKind2["ConsumerAction"] = "consumer_action"; - AdvisoryKind2["SnapshotCreate"] = "snapshot_create"; - AdvisoryKind2["SnapshotComplete"] = "snapshot_complete"; - AdvisoryKind2["RestoreCreate"] = "restore_create"; - AdvisoryKind2["RestoreComplete"] = "restore_complete"; - AdvisoryKind2["MaxDeliver"] = "max_deliver"; - AdvisoryKind2["Terminated"] = "terminated"; - AdvisoryKind2["Ack"] = "consumer_ack"; - AdvisoryKind2["StreamLeaderElected"] = "stream_leader_elected"; - AdvisoryKind2["StreamQuorumLost"] = "stream_quorum_lost"; - AdvisoryKind2["ConsumerLeaderElected"] = "consumer_leader_elected"; - AdvisoryKind2["ConsumerQuorumLost"] = "consumer_quorum_lost"; - })(AdvisoryKind = exports.AdvisoryKind || (exports.AdvisoryKind = {})); - var RetentionPolicy; - (function(RetentionPolicy2) { - RetentionPolicy2["Limits"] = "limits"; - RetentionPolicy2["Interest"] = "interest"; - RetentionPolicy2["Workqueue"] = "workqueue"; - })(RetentionPolicy = exports.RetentionPolicy || (exports.RetentionPolicy = {})); - var DiscardPolicy; - (function(DiscardPolicy2) { - DiscardPolicy2["Old"] = "old"; - DiscardPolicy2["New"] = "new"; - })(DiscardPolicy = exports.DiscardPolicy || (exports.DiscardPolicy = {})); - var StorageType; - (function(StorageType2) { - StorageType2["File"] = "file"; - StorageType2["Memory"] = "memory"; - })(StorageType = exports.StorageType || (exports.StorageType = {})); - var DeliverPolicy; - (function(DeliverPolicy2) { - DeliverPolicy2["All"] = "all"; - DeliverPolicy2["Last"] = "last"; - DeliverPolicy2["New"] = "new"; - DeliverPolicy2["StartSequence"] = "by_start_sequence"; - DeliverPolicy2["StartTime"] = "by_start_time"; - })(DeliverPolicy = exports.DeliverPolicy || (exports.DeliverPolicy = {})); - var AckPolicy; - (function(AckPolicy2) { - AckPolicy2["None"] = "none"; - AckPolicy2["All"] = "all"; - AckPolicy2["Explicit"] = "explicit"; - AckPolicy2["NotSet"] = ""; - })(AckPolicy = exports.AckPolicy || (exports.AckPolicy = {})); - var ReplayPolicy; - (function(ReplayPolicy2) { - ReplayPolicy2["Instant"] = "instant"; - ReplayPolicy2["Original"] = "original"; - })(ReplayPolicy = exports.ReplayPolicy || (exports.ReplayPolicy = {})); - var JsHeaders; - (function(JsHeaders2) { - JsHeaders2["StreamSourceHdr"] = "Nats-Stream-Source"; - JsHeaders2["LastConsumerSeqHdr"] = "Nats-Last-Consumer"; - JsHeaders2["LastStreamSeqHdr"] = "Nats-Last-Stream"; - })(JsHeaders = exports.JsHeaders || (exports.JsHeaders = {})); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/encoders.js - var require_encoders = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/encoders.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.fastDecoder = exports.fastEncoder = exports.TD = exports.TE = void 0; - var types_1 = require_types(); - exports.TE = new TextEncoder(); - exports.TD = new TextDecoder(); - function fastEncoder(...a) { - let len = 0; - for (let i = 0; i < a.length; i++) { - len += a[i] ? a[i].length : 0; - } - if (len === 0) { - return types_1.Empty; - } - const buf = new Uint8Array(len); - let c = 0; - for (let i = 0; i < a.length; i++) { - const s = a[i]; - if (s) { - for (let j = 0; j < s.length; j++) { - buf[c] = s.charCodeAt(j); - c++; - } - } - } - return buf; - } - exports.fastEncoder = fastEncoder; - function fastDecoder(a) { - if (!a || a.length === 0) { - return ""; - } - return String.fromCharCode(...a); - } - exports.fastDecoder = fastDecoder; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/databuffer.js - var require_databuffer = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/databuffer.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.DataBuffer = void 0; - var encoders_1 = require_encoders(); - var DataBuffer = class { - constructor() { - this.buffers = []; - this.byteLength = 0; - } - static concat(...bufs) { - let max = 0; - for (let i = 0; i < bufs.length; i++) { - max += bufs[i].length; - } - const out = new Uint8Array(max); - let index = 0; - for (let i = 0; i < bufs.length; i++) { - out.set(bufs[i], index); - index += bufs[i].length; - } - return out; - } - static fromAscii(m) { - if (!m) { - m = ""; - } - return encoders_1.TE.encode(m); - } - static toAscii(a) { - return encoders_1.TD.decode(a); - } - reset() { - this.buffers.length = 0; - this.byteLength = 0; - } - pack() { - if (this.buffers.length > 1) { - const v = new Uint8Array(this.byteLength); - let index = 0; - for (let i = 0; i < this.buffers.length; i++) { - v.set(this.buffers[i], index); - index += this.buffers[i].length; - } - this.buffers.length = 0; - this.buffers.push(v); - } - } - drain(n) { - if (this.buffers.length) { - this.pack(); - const v = this.buffers.pop(); - if (v) { - const max = this.byteLength; - if (n === void 0 || n > max) { - n = max; - } - const d = v.subarray(0, n); - if (max > n) { - this.buffers.push(v.subarray(n)); - } - this.byteLength = max - n; - return d; - } - } - return new Uint8Array(0); - } - fill(a, ...bufs) { - if (a) { - this.buffers.push(a); - this.byteLength += a.length; - } - for (let i = 0; i < bufs.length; i++) { - if (bufs[i] && bufs[i].length) { - this.buffers.push(bufs[i]); - this.byteLength += bufs[i].length; - } - } - } - peek() { - if (this.buffers.length) { - this.pack(); - return this.buffers[0]; - } - return new Uint8Array(0); - } - size() { - return this.byteLength; - } - length() { - return this.buffers.length; - } - }; - exports.DataBuffer = DataBuffer; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/error.js - var require_error = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/error.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NatsError = exports.isNatsError = exports.Messages = exports.ErrorCode = void 0; - var ErrorCode; - (function(ErrorCode2) { - ErrorCode2["ApiError"] = "BAD API"; - ErrorCode2["BadAuthentication"] = "BAD_AUTHENTICATION"; - ErrorCode2["BadCreds"] = "BAD_CREDS"; - ErrorCode2["BadHeader"] = "BAD_HEADER"; - ErrorCode2["BadJson"] = "BAD_JSON"; - ErrorCode2["BadPayload"] = "BAD_PAYLOAD"; - ErrorCode2["BadSubject"] = "BAD_SUBJECT"; - ErrorCode2["Cancelled"] = "CANCELLED"; - ErrorCode2["ConnectionClosed"] = "CONNECTION_CLOSED"; - ErrorCode2["ConnectionDraining"] = "CONNECTION_DRAINING"; - ErrorCode2["ConnectionRefused"] = "CONNECTION_REFUSED"; - ErrorCode2["ConnectionTimeout"] = "CONNECTION_TIMEOUT"; - ErrorCode2["Disconnect"] = "DISCONNECT"; - ErrorCode2["InvalidOption"] = "INVALID_OPTION"; - ErrorCode2["InvalidPayload"] = "INVALID_PAYLOAD"; - ErrorCode2["MaxPayloadExceeded"] = "MAX_PAYLOAD_EXCEEDED"; - ErrorCode2["NoResponders"] = "503"; - ErrorCode2["NotFunction"] = "NOT_FUNC"; - ErrorCode2["RequestError"] = "REQUEST_ERROR"; - ErrorCode2["ServerOptionNotAvailable"] = "SERVER_OPT_NA"; - ErrorCode2["SubClosed"] = "SUB_CLOSED"; - ErrorCode2["SubDraining"] = "SUB_DRAINING"; - ErrorCode2["Timeout"] = "TIMEOUT"; - ErrorCode2["Tls"] = "TLS"; - ErrorCode2["Unknown"] = "UNKNOWN_ERROR"; - ErrorCode2["WssRequired"] = "WSS_REQUIRED"; - ErrorCode2["JetStreamInvalidAck"] = "JESTREAM_INVALID_ACK"; - ErrorCode2["JetStream404NoMessages"] = "404"; - ErrorCode2["JetStream408RequestTimeout"] = "408"; - ErrorCode2["JetStream409MaxAckPendingExceeded"] = "409"; - ErrorCode2["JetStreamNotEnabled"] = "503"; - ErrorCode2["AuthorizationViolation"] = "AUTHORIZATION_VIOLATION"; - ErrorCode2["AuthenticationExpired"] = "AUTHENTICATION_EXPIRED"; - ErrorCode2["ProtocolError"] = "NATS_PROTOCOL_ERR"; - ErrorCode2["PermissionsViolation"] = "PERMISSIONS_VIOLATION"; - })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {})); - var Messages = class { - constructor() { - this.messages = /* @__PURE__ */ new Map(); - this.messages.set(ErrorCode.InvalidPayload, "Invalid payload type - payloads can be 'binary', 'string', or 'json'"); - this.messages.set(ErrorCode.BadJson, "Bad JSON"); - this.messages.set(ErrorCode.WssRequired, "TLS is required, therefore a secure websocket connection is also required"); - } - static getMessage(s) { - return messages.getMessage(s); - } - getMessage(s) { - return this.messages.get(s) || s; - } - }; - exports.Messages = Messages; - var messages = new Messages(); - function isNatsError(err) { - return typeof err.code === "string"; - } - exports.isNatsError = isNatsError; - var NatsError = class extends Error { - constructor(message, code, chainedError) { - super(message); - this.name = "NatsError"; - this.message = message; - this.code = code; - this.chainedError = chainedError; - } - static errorForCode(code, chainedError) { - const m = Messages.getMessage(code); - return new NatsError(m, code, chainedError); - } - isAuthError() { - return this.code === ErrorCode.AuthenticationExpired || this.code === ErrorCode.AuthorizationViolation; - } - isPermissionError() { - return this.code === ErrorCode.PermissionsViolation; - } - isProtocolError() { - return this.code === ErrorCode.ProtocolError; - } - }; - exports.NatsError = NatsError; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/util.js - var require_util = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/util.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Perf = exports.shuffle = exports.deferred = exports.delay = exports.timeout = exports.render = exports.extend = exports.extractProtocolMessage = exports.protoLen = exports.isUint8Array = exports.LF = exports.CR = exports.CRLF = exports.CR_LF_LEN = exports.CR_LF = void 0; - var databuffer_1 = require_databuffer(); - var error_1 = require_error(); - var encoders_1 = require_encoders(); - exports.CR_LF = "\r\n"; - exports.CR_LF_LEN = exports.CR_LF.length; - exports.CRLF = databuffer_1.DataBuffer.fromAscii(exports.CR_LF); - exports.CR = new Uint8Array(exports.CRLF)[0]; - exports.LF = new Uint8Array(exports.CRLF)[1]; - function isUint8Array(a) { - return a instanceof Uint8Array; - } - exports.isUint8Array = isUint8Array; - function protoLen(ba) { - for (let i = 0; i < ba.length; i++) { - const n = i + 1; - if (ba.byteLength > n && ba[i] === exports.CR && ba[n] === exports.LF) { - return n + 1; - } - } - return -1; - } - exports.protoLen = protoLen; - function extractProtocolMessage(a) { - const len = protoLen(a); - if (len) { - const ba = new Uint8Array(a); - const out = ba.slice(0, len); - return encoders_1.TD.decode(out); - } - return ""; - } - exports.extractProtocolMessage = extractProtocolMessage; - function extend(a, ...b) { - for (let i = 0; i < b.length; i++) { - const o = b[i]; - Object.keys(o).forEach(function(k) { - a[k] = o[k]; - }); - } - return a; - } - exports.extend = extend; - function render(frame) { - const cr = "\u240D"; - const lf = "\u240A"; - return encoders_1.TD.decode(frame).replace(/\n/g, lf).replace(/\r/g, cr); - } - exports.render = render; - function timeout(ms) { - let methods; - let timer; - const p = new Promise((_resolve, reject) => { - const cancel = () => { - if (timer) { - clearTimeout(timer); - } - }; - methods = { cancel }; - timer = setTimeout(() => { - reject(error_1.NatsError.errorForCode(error_1.ErrorCode.Timeout)); - }, ms); - }); - return Object.assign(p, methods); - } - exports.timeout = timeout; - function delay(ms = 0) { - return new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, ms); - }); - } - exports.delay = delay; - function deferred() { - let methods = {}; - const p = new Promise((resolve, reject) => { - methods = { resolve, reject }; - }); - return Object.assign(p, methods); - } - exports.deferred = deferred; - function shuffle(a) { - for (let i = a.length - 1; i > 0; i--) { - const j = Math.floor(Math.random() * (i + 1)); - [a[i], a[j]] = [a[j], a[i]]; - } - return a; - } - exports.shuffle = shuffle; - var Perf = class { - constructor() { - this.timers = /* @__PURE__ */ new Map(); - this.measures = /* @__PURE__ */ new Map(); - } - mark(key) { - this.timers.set(key, Date.now()); - } - measure(key, startKey, endKey) { - const s = this.timers.get(startKey); - if (s === void 0) { - throw new Error(`${startKey} is not defined`); - } - const e = this.timers.get(endKey); - if (e === void 0) { - throw new Error(`${endKey} is not defined`); - } - this.measures.set(key, e - s); - } - getEntries() { - const values = []; - this.measures.forEach((v, k) => { - values.push({ name: k, duration: v }); - }); - return values; - } - }; - exports.Perf = Perf; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/transport.js - var require_transport = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/transport.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.newTransport = exports.getUrlParseFn = exports.defaultPort = exports.setTransportFactory = void 0; - var types_1 = require_types(); - var transportConfig; - function setTransportFactory(config) { - transportConfig = config; - } - exports.setTransportFactory = setTransportFactory; - function defaultPort() { - return transportConfig !== void 0 && transportConfig.defaultPort !== void 0 ? transportConfig.defaultPort : types_1.DEFAULT_PORT; - } - exports.defaultPort = defaultPort; - function getUrlParseFn() { - return transportConfig !== void 0 && transportConfig.urlParseFn ? transportConfig.urlParseFn : void 0; - } - exports.getUrlParseFn = getUrlParseFn; - function newTransport() { - if (!transportConfig || typeof transportConfig.factory !== "function") { - throw new Error("transport fn is not set"); - } - return transportConfig.factory(); - } - exports.newTransport = newTransport; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/nuid.js - var require_nuid = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/nuid.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.nuid = exports.Nuid = void 0; - var digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - var base = 36; - var preLen = 12; - var seqLen = 10; - var maxSeq = 3656158440062976; - var minInc = 33; - var maxInc = 333; - var totalLen = preLen + seqLen; - var cryptoObj = initCrypto(); - function initCrypto() { - let cryptoObj2 = null; - if (typeof globalThis !== "undefined") { - if ("crypto" in globalThis && globalThis.crypto.getRandomValues) { - cryptoObj2 = globalThis.crypto; - } - } - if (!cryptoObj2) { - cryptoObj2 = { - getRandomValues: function(array) { - for (let i = 0; i < array.length; i++) { - array[i] = Math.floor(Math.random() * 255); - } - } - }; - } - return cryptoObj2; - } - var Nuid = class { - constructor() { - this.buf = new Uint8Array(totalLen); - this.init(); - } - init() { - this.setPre(); - this.initSeqAndInc(); - this.fillSeq(); - } - initSeqAndInc() { - this.seq = Math.floor(Math.random() * maxSeq); - this.inc = Math.floor(Math.random() * (maxInc - minInc) + minInc); - } - setPre() { - const cbuf = new Uint8Array(preLen); - cryptoObj.getRandomValues(cbuf); - for (let i = 0; i < preLen; i++) { - const di = cbuf[i] % base; - this.buf[i] = digits.charCodeAt(di); - } - } - fillSeq() { - let n = this.seq; - for (let i = totalLen - 1; i >= preLen; i--) { - this.buf[i] = digits.charCodeAt(n % base); - n = Math.floor(n / base); - } - } - next() { - this.seq += this.inc; - if (this.seq > maxSeq) { - this.setPre(); - this.initSeqAndInc(); - } - this.fillSeq(); - return String.fromCharCode.apply(String, this.buf); - } - reset() { - this.init(); - } - }; - exports.Nuid = Nuid; - exports.nuid = new Nuid(); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/ipparser.js - var require_ipparser = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/ipparser.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseIP = exports.isIP = exports.ipV4 = void 0; - var IPv4LEN = 4; - var IPv6LEN = 16; - var ASCII0 = 48; - var ASCII9 = 57; - var ASCIIA = 65; - var ASCIIF = 70; - var ASCIIa = 97; - var ASCIIf = 102; - var big = 16777215; - function ipV4(a, b, c, d) { - const ip = new Uint8Array(IPv6LEN); - const prefix = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255]; - prefix.forEach((v, idx) => { - ip[idx] = v; - }); - ip[12] = a; - ip[13] = b; - ip[14] = c; - ip[15] = d; - return ip; - } - exports.ipV4 = ipV4; - function isIP(h) { - return parseIP(h) !== void 0; - } - exports.isIP = isIP; - function parseIP(h) { - for (let i = 0; i < h.length; i++) { - switch (h[i]) { - case ".": - return parseIPv4(h); - case ":": - return parseIPv6(h); - } - } - return; - } - exports.parseIP = parseIP; - function parseIPv4(s) { - const ip = new Uint8Array(IPv4LEN); - for (let i = 0; i < IPv4LEN; i++) { - if (s.length === 0) { - return void 0; - } - if (i > 0) { - if (s[0] !== ".") { - return void 0; - } - s = s.substring(1); - } - const { n, c, ok } = dtoi(s); - if (!ok || n > 255) { - return void 0; - } - s = s.substring(c); - ip[i] = n; - } - return ipV4(ip[0], ip[1], ip[2], ip[3]); - } - function parseIPv6(s) { - const ip = new Uint8Array(IPv6LEN); - let ellipsis = -1; - if (s.length >= 2 && s[0] === ":" && s[1] === ":") { - ellipsis = 0; - s = s.substring(2); - if (s.length === 0) { - return ip; - } - } - let i = 0; - while (i < IPv6LEN) { - const { n, c, ok } = xtoi(s); - if (!ok || n > 65535) { - return void 0; - } - if (c < s.length && s[c] === ".") { - if (ellipsis < 0 && i != IPv6LEN - IPv4LEN) { - return void 0; - } - if (i + IPv4LEN > IPv6LEN) { - return void 0; - } - const ip4 = parseIPv4(s); - if (ip4 === void 0) { - return void 0; - } - ip[i] = ip4[12]; - ip[i + 1] = ip4[13]; - ip[i + 2] = ip4[14]; - ip[i + 3] = ip4[15]; - s = ""; - i += IPv4LEN; - break; - } - ip[i] = n >> 8; - ip[i + 1] = n; - i += 2; - s = s.substring(c); - if (s.length === 0) { - break; - } - if (s[0] !== ":" || s.length == 1) { - return void 0; - } - s = s.substring(1); - if (s[0] === ":") { - if (ellipsis >= 0) { - return void 0; - } - ellipsis = i; - s = s.substring(1); - if (s.length === 0) { - break; - } - } - } - if (s.length !== 0) { - return void 0; - } - if (i < IPv6LEN) { - if (ellipsis < 0) { - return void 0; - } - const n = IPv6LEN - i; - for (let j = i - 1; j >= ellipsis; j--) { - ip[j + n] = ip[j]; - } - for (let j = ellipsis + n - 1; j >= ellipsis; j--) { - ip[j] = 0; - } - } else if (ellipsis >= 0) { - return void 0; - } - return ip; - } - function dtoi(s) { - let i = 0; - let n = 0; - for (i = 0; i < s.length && ASCII0 <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCII9; i++) { - n = n * 10 + (s.charCodeAt(i) - ASCII0); - if (n >= big) { - return { n: big, c: i, ok: false }; - } - } - if (i === 0) { - return { n: 0, c: 0, ok: false }; - } - return { n, c: i, ok: true }; - } - function xtoi(s) { - let n = 0; - let i = 0; - for (i = 0; i < s.length; i++) { - if (ASCII0 <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCII9) { - n *= 16; - n += s.charCodeAt(i) - ASCII0; - } else if (ASCIIa <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCIIf) { - n *= 16; - n += s.charCodeAt(i) - ASCIIa + 10; - } else if (ASCIIA <= s.charCodeAt(i) && s.charCodeAt(i) <= ASCIIF) { - n *= 16; - n += s.charCodeAt(i) - ASCIIA + 10; - } else { - break; - } - if (n >= big) { - return { n: 0, c: i, ok: false }; - } - } - if (i === 0) { - return { n: 0, c: i, ok: false }; - } - return { n, c: i, ok: true }; - } - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/servers.js - var require_servers = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/servers.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Servers = exports.ServerImpl = void 0; - var types_1 = require_types(); - var transport_1 = require_transport(); - var util_1 = require_util(); - var ipparser_1 = require_ipparser(); - var ServerImpl = class { - constructor(u, gossiped = false) { - this.src = u; - this.tlsName = ""; - if (u.match(/^(.*:\/\/)(.*)/m)) { - u = u.replace(/^(.*:\/\/)(.*)/gm, "$2"); - } - const url = new URL(`http://${u}`); - if (!url.port) { - url.port = `${types_1.DEFAULT_PORT}`; - } - this.listen = url.host; - this.hostname = url.hostname; - this.port = parseInt(url.port, 10); - this.didConnect = false; - this.reconnects = 0; - this.lastConnect = 0; - this.gossiped = gossiped; - } - toString() { - return this.listen; - } - }; - exports.ServerImpl = ServerImpl; - var Servers = class { - constructor(randomize, listens = []) { - this.firstSelect = true; - this.servers = []; - this.tlsName = ""; - const urlParseFn = transport_1.getUrlParseFn(); - if (listens) { - listens.forEach((hp) => { - hp = urlParseFn ? urlParseFn(hp) : hp; - this.servers.push(new ServerImpl(hp)); - }); - if (randomize) { - this.servers = util_1.shuffle(this.servers); - } - } - if (this.servers.length === 0) { - this.addServer(`${types_1.DEFAULT_HOST}:${transport_1.defaultPort()}`, false); - } - this.currentServer = this.servers[0]; - } - updateTLSName() { - const cs = this.getCurrentServer(); - if (!ipparser_1.isIP(cs.hostname)) { - this.tlsName = cs.hostname; - this.servers.forEach((s) => { - if (s.gossiped) { - s.tlsName = this.tlsName; - } - }); - } - } - getCurrentServer() { - return this.currentServer; - } - addServer(u, implicit = false) { - const urlParseFn = transport_1.getUrlParseFn(); - u = urlParseFn ? urlParseFn(u) : u; - const s = new ServerImpl(u, implicit); - if (ipparser_1.isIP(s.hostname)) { - s.tlsName = this.tlsName; - } - this.servers.push(s); - } - selectServer() { - if (this.firstSelect) { - this.firstSelect = false; - return this.currentServer; - } - const t = this.servers.shift(); - if (t) { - this.servers.push(t); - this.currentServer = t; - } - return t; - } - removeCurrentServer() { - this.removeServer(this.currentServer); - } - removeServer(server) { - if (server) { - const index = this.servers.indexOf(server); - this.servers.splice(index, 1); - } - } - length() { - return this.servers.length; - } - next() { - return this.servers.length ? this.servers[0] : void 0; - } - getServers() { - return this.servers; - } - update(info) { - const added = []; - let deleted = []; - const urlParseFn = transport_1.getUrlParseFn(); - const discovered = /* @__PURE__ */ new Map(); - if (info.connect_urls && info.connect_urls.length > 0) { - info.connect_urls.forEach((hp) => { - hp = urlParseFn ? urlParseFn(hp) : hp; - const s = new ServerImpl(hp, true); - discovered.set(hp, s); - }); - } - const toDelete = []; - this.servers.forEach((s, index) => { - const u = s.listen; - if (s.gossiped && this.currentServer.listen !== u && discovered.get(u) === void 0) { - toDelete.push(index); - } - discovered.delete(u); - }); - toDelete.reverse(); - toDelete.forEach((index) => { - const removed = this.servers.splice(index, 1); - deleted = deleted.concat(removed[0].listen); - }); - discovered.forEach((v, k) => { - this.servers.push(v); - added.push(k); - }); - return { added, deleted }; - } - }; - exports.Servers = Servers; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/queued_iterator.js - var require_queued_iterator = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/queued_iterator.js"(exports) { - "use strict"; - var __await = exports && exports.__await || function(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function verb(n) { - if (g[n]) - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); - }); - }; - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); - } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) - resume(q[0][0], q[0][1]); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.QueuedIteratorImpl = void 0; - var util_1 = require_util(); - var error_1 = require_error(); - var QueuedIteratorImpl = class { - constructor() { - this.inflight = 0; - this.processed = 0; - this.received = 0; - this.noIterator = false; - this.done = false; - this.signal = util_1.deferred(); - this.yields = []; - this.iterClosed = util_1.deferred(); - } - [Symbol.asyncIterator]() { - return this.iterate(); - } - push(v) { - if (this.done) { - return; - } - this.yields.push(v); - this.signal.resolve(); - } - iterate() { - return __asyncGenerator(this, arguments, function* iterate_1() { - if (this.noIterator) { - throw new error_1.NatsError("unsupported iterator", error_1.ErrorCode.ApiError); - } - while (true) { - if (this.yields.length === 0) { - yield __await(this.signal); - } - if (this.err) { - throw this.err; - } - const yields = this.yields; - this.inflight = yields.length; - this.yields = []; - for (let i = 0; i < yields.length; i++) { - this.processed++; - yield yield __await(yields[i]); - if (this.dispatchedFn && yields[i]) { - this.dispatchedFn(yields[i]); - } - this.inflight--; - } - if (this.done) { - break; - } else if (this.yields.length === 0) { - yields.length = 0; - this.yields = yields; - this.signal = util_1.deferred(); - } - } - }); - } - stop(err) { - this.err = err; - this.done = true; - this.signal.resolve(); - this.iterClosed.resolve(); - } - getProcessed() { - return this.noIterator ? this.received : this.processed; - } - getPending() { - return this.yields.length + this.inflight; - } - getReceived() { - return this.received; - } - }; - exports.QueuedIteratorImpl = QueuedIteratorImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/subscription.js - var require_subscription = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/subscription.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.SubscriptionImpl = void 0; - var queued_iterator_1 = require_queued_iterator(); - var util_1 = require_util(); - var error_1 = require_error(); - var SubscriptionImpl = class extends queued_iterator_1.QueuedIteratorImpl { - constructor(protocol, subject, opts = {}) { - super(); - util_1.extend(this, opts); - this.protocol = protocol; - this.subject = subject; - this.draining = false; - this.noIterator = typeof opts.callback === "function"; - this.closed = util_1.deferred(); - if (opts.timeout) { - this.timer = util_1.timeout(opts.timeout); - this.timer.then(() => { - this.timer = void 0; - }).catch((err) => { - this.stop(err); - if (this.noIterator) { - this.callback(err, {}); - } - }); - } - } - setDispatchedFn(cb) { - if (this.noIterator) { - const uc = this.callback; - this.callback = (err, msg) => { - uc(err, msg); - cb(msg); - }; - } else { - this.dispatchedFn = cb; - } - } - callback(err, msg) { - this.cancelTimeout(); - err ? this.stop(err) : this.push(msg); - } - close() { - if (!this.isClosed()) { - this.cancelTimeout(); - this.stop(); - if (this.cleanupFn) { - try { - this.cleanupFn(this, this.info); - } catch (_err) { - } - } - this.closed.resolve(); - } - } - unsubscribe(max) { - this.protocol.unsubscribe(this, max); - } - cancelTimeout() { - if (this.timer) { - this.timer.cancel(); - this.timer = void 0; - } - } - drain() { - if (this.protocol.isClosed()) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); - } - if (this.isClosed()) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.SubClosed); - } - if (!this.drained) { - this.protocol.unsub(this); - this.drained = this.protocol.flush(util_1.deferred()); - this.drained.then(() => { - this.protocol.subscriptions.cancel(this); - }); - } - return this.drained; - } - isDraining() { - return this.draining; - } - isClosed() { - return this.done; - } - getSubject() { - return this.subject; - } - getMax() { - return this.max; - } - getID() { - return this.sid; - } - }; - exports.SubscriptionImpl = SubscriptionImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/subscriptions.js - var require_subscriptions = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/subscriptions.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Subscriptions = void 0; - var Subscriptions = class { - constructor() { - this.sidCounter = 0; - this.subs = /* @__PURE__ */ new Map(); - } - size() { - return this.subs.size; - } - add(s) { - this.sidCounter++; - s.sid = this.sidCounter; - this.subs.set(s.sid, s); - return s; - } - setMux(s) { - this.mux = s; - return s; - } - getMux() { - return this.mux; - } - get(sid) { - return this.subs.get(sid); - } - all() { - const buf = []; - for (const s of this.subs.values()) { - buf.push(s); - } - return buf; - } - cancel(s) { - if (s) { - s.close(); - this.subs.delete(s.sid); - } - } - handleError(err) { - let handled = false; - if (err) { - const re = /^'Permissions Violation for Subscription to "(\S+)"'/i; - const ma = re.exec(err.message); - if (ma) { - const subj = ma[1]; - this.subs.forEach((sub) => { - if (subj == sub.subject) { - sub.callback(err, {}); - sub.close(); - handled = sub !== this.mux; - } - }); - } - } - return handled; - } - close() { - this.subs.forEach((sub) => { - sub.close(); - }); - } - }; - exports.Subscriptions = Subscriptions; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/headers.js - var require_headers = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/headers.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = void 0; - var error_1 = require_error(); - var encoders_1 = require_encoders(); - function canonicalMIMEHeaderKey(k) { - const a = 97; - const A = 65; - const Z = 90; - const z = 122; - const dash = 45; - const colon = 58; - const start = 33; - const end = 126; - const toLower = a - A; - let upper = true; - const buf = new Array(k.length); - for (let i = 0; i < k.length; i++) { - let c = k.charCodeAt(i); - if (c === colon || c < start || c > end) { - throw new error_1.NatsError(`'${k[i]}' is not a valid character for a header key`, error_1.ErrorCode.BadHeader); - } - if (upper && a <= c && c <= z) { - c -= toLower; - } else if (!upper && A <= c && c <= Z) { - c += toLower; - } - buf[i] = c; - upper = c == dash; - } - return String.fromCharCode(...buf); - } - exports.canonicalMIMEHeaderKey = canonicalMIMEHeaderKey; - function headers() { - return new MsgHdrsImpl(); - } - exports.headers = headers; - var HEADER = "NATS/1.0"; - var Match; - (function(Match2) { - Match2[Match2["Exact"] = 0] = "Exact"; - Match2[Match2["CanonicalMIME"] = 1] = "CanonicalMIME"; - Match2[Match2["IgnoreCase"] = 2] = "IgnoreCase"; - })(Match = exports.Match || (exports.Match = {})); - var MsgHdrsImpl = class { - constructor() { - this.code = 0; - this.headers = /* @__PURE__ */ new Map(); - this.description = ""; - } - [Symbol.iterator]() { - return this.headers.entries(); - } - size() { - return this.headers.size; - } - equals(mh) { - if (mh && this.headers.size === mh.headers.size && this.code === mh.code) { - for (const [k, v] of this.headers) { - const a = mh.values(k); - if (v.length !== a.length) { - return false; - } - const vv = [...v].sort(); - const aa = [...a].sort(); - for (let i = 0; i < vv.length; i++) { - if (vv[i] !== aa[i]) { - return false; - } - } - } - return true; - } - return false; - } - static decode(a) { - const mh = new MsgHdrsImpl(); - const s = encoders_1.TD.decode(a); - const lines = s.split("\r\n"); - const h = lines[0]; - if (h !== HEADER) { - let str = h.replace(HEADER, ""); - mh.code = parseInt(str, 10); - const scode = mh.code.toString(); - str = str.replace(scode, ""); - mh.description = str.trim(); - } - if (lines.length >= 1) { - lines.slice(1).map((s2) => { - if (s2) { - const idx = s2.indexOf(":"); - if (idx > -1) { - const k = s2.slice(0, idx); - const v = s2.slice(idx + 1).trim(); - mh.append(k, v); - } - } - }); - } - return mh; - } - toString() { - if (this.headers.size === 0) { - return ""; - } - let s = HEADER; - for (const [k, v] of this.headers) { - for (let i = 0; i < v.length; i++) { - s = `${s}\r -${k}: ${v[i]}`; - } - } - return `${s}\r -\r -`; - } - encode() { - return encoders_1.TE.encode(this.toString()); - } - static validHeaderValue(k) { - const inv = /[\r\n]/; - if (inv.test(k)) { - throw new error_1.NatsError("invalid header value - \\r and \\n are not allowed.", error_1.ErrorCode.BadHeader); - } - return k.trim(); - } - keys() { - const keys = []; - for (const sk of this.headers.keys()) { - keys.push(sk); - } - return keys; - } - findKeys(k, match = Match.Exact) { - const keys = this.keys(); - switch (match) { - case Match.Exact: - return keys.filter((v) => { - return v === k; - }); - case Match.CanonicalMIME: - k = canonicalMIMEHeaderKey(k); - return keys.filter((v) => { - return v === k; - }); - default: { - const lci = k.toLowerCase(); - return keys.filter((v) => { - return lci === v.toLowerCase(); - }); - } - } - } - get(k, match = Match.Exact) { - const keys = this.findKeys(k, match); - if (keys.length) { - const v = this.headers.get(keys[0]); - if (v) { - return Array.isArray(v) ? v[0] : v; - } - } - return ""; - } - has(k, match = Match.Exact) { - return this.findKeys(k, match).length > 0; - } - set(k, v, match = Match.Exact) { - this.delete(k, match); - this.append(k, v, match); - } - append(k, v, match = Match.Exact) { - const ck = canonicalMIMEHeaderKey(k); - if (match === Match.CanonicalMIME) { - k = ck; - } - const keys = this.findKeys(k, match); - k = keys.length > 0 ? keys[0] : k; - const value = MsgHdrsImpl.validHeaderValue(v); - let a = this.headers.get(k); - if (!a) { - a = []; - this.headers.set(k, a); - } - a.push(value); - } - values(k, match = Match.Exact) { - const buf = []; - const keys = this.findKeys(k, match); - keys.forEach((v) => { - const values = this.headers.get(v); - if (values) { - buf.push(...values); - } - }); - return buf; - } - delete(k, match = Match.Exact) { - const keys = this.findKeys(k, match); - keys.forEach((v) => { - this.headers.delete(v); - }); - } - get hasError() { - return this.code >= 300; - } - get status() { - return `${this.code} ${this.description}`.trim(); - } - }; - exports.MsgHdrsImpl = MsgHdrsImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/msg.js - var require_msg = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/msg.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MsgImpl = exports.isRequestError = void 0; - var types_1 = require_types(); - var headers_1 = require_headers(); - var encoders_1 = require_encoders(); - var error_1 = require_error(); - function isRequestError(msg) { - if (msg && msg.headers) { - const headers = msg.headers; - if (headers.hasError) { - if (headers.code === 503) { - return error_1.NatsError.errorForCode(error_1.ErrorCode.NoResponders); - } else { - let desc = headers.description; - if (desc === "") { - desc = error_1.ErrorCode.RequestError; - } - desc = desc.toLowerCase(); - return new error_1.NatsError(desc, headers.status); - } - } - } - return null; - } - exports.isRequestError = isRequestError; - var MsgImpl = class { - constructor(msg, data, publisher) { - this._msg = msg; - this._rdata = data; - this.publisher = publisher; - } - get subject() { - if (this._subject) { - return this._subject; - } - this._subject = encoders_1.TD.decode(this._msg.subject); - return this._subject; - } - get reply() { - if (this._reply) { - return this._reply; - } - this._reply = encoders_1.TD.decode(this._msg.reply); - return this._reply; - } - get sid() { - return this._msg.sid; - } - get headers() { - if (this._msg.hdr > -1 && !this._headers) { - const buf = this._rdata.subarray(0, this._msg.hdr); - this._headers = headers_1.MsgHdrsImpl.decode(buf); - } - return this._headers; - } - get data() { - if (!this._rdata) { - return new Uint8Array(0); - } - return this._msg.hdr > -1 ? this._rdata.subarray(this._msg.hdr) : this._rdata; - } - respond(data = types_1.Empty, opts) { - if (this.reply) { - this.publisher.publish(this.reply, data, opts); - return true; - } - return false; - } - }; - exports.MsgImpl = MsgImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/muxsubscription.js - var require_muxsubscription = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/muxsubscription.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.MuxSubscription = void 0; - var error_1 = require_error(); - var protocol_1 = require_protocol(); - var msg_1 = require_msg(); - var MuxSubscription = class { - constructor() { - this.reqs = /* @__PURE__ */ new Map(); - } - size() { - return this.reqs.size; - } - init(prefix) { - this.baseInbox = `${protocol_1.createInbox(prefix)}.`; - return this.baseInbox; - } - add(r) { - if (!isNaN(r.received)) { - r.received = 0; - } - this.reqs.set(r.token, r); - } - get(token) { - return this.reqs.get(token); - } - cancel(r) { - this.reqs.delete(r.token); - } - getToken(m) { - const s = m.subject || ""; - if (s.indexOf(this.baseInbox) === 0) { - return s.substring(this.baseInbox.length); - } - return null; - } - dispatcher() { - return (err, m) => { - const token = this.getToken(m); - if (token) { - const r = this.get(token); - if (r) { - if (err === null && m.headers) { - err = msg_1.isRequestError(m); - } - r.resolver(err, m); - } - } - }; - } - close() { - const err = error_1.NatsError.errorForCode(error_1.ErrorCode.Timeout); - this.reqs.forEach((req) => { - req.resolver(err, {}); - }); - } - }; - exports.MuxSubscription = MuxSubscription; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/heartbeats.js - var require_heartbeats = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/heartbeats.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Heartbeat = void 0; - var util_1 = require_util(); - var types_1 = require_types(); - var Heartbeat = class { - constructor(ph, interval, maxOut) { - this.ph = ph; - this.interval = interval; - this.maxOut = maxOut; - this.pendings = []; - } - start() { - this.cancel(); - this._schedule(); - } - cancel(stale) { - if (this.timer) { - clearTimeout(this.timer); - this.timer = void 0; - } - this._reset(); - if (stale) { - this.ph.disconnect(); - } - } - _schedule() { - this.timer = setTimeout(() => { - this.ph.dispatchStatus({ type: types_1.DebugEvents.PingTimer, data: `${this.pendings.length + 1}` }); - if (this.pendings.length === this.maxOut) { - this.cancel(true); - return; - } - const ping = util_1.deferred(); - this.ph.flush(ping).then(() => { - this._reset(); - }).catch(() => { - this.cancel(); - }); - this.pendings.push(ping); - this._schedule(); - }, this.interval); - } - _reset() { - this.pendings = this.pendings.filter((p) => { - const d = p; - d.resolve(); - return false; - }); - } - }; - exports.Heartbeat = Heartbeat; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/denobuffer.js - var require_denobuffer = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/denobuffer.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.writeAll = exports.readAll = exports.DenoBuffer = exports.append = exports.concat = exports.MAX_SIZE = exports.assert = exports.AssertionError = void 0; - var encoders_1 = require_encoders(); - var AssertionError = class extends Error { - constructor(msg) { - super(msg); - this.name = "AssertionError"; - } - }; - exports.AssertionError = AssertionError; - function assert(cond, msg = "Assertion failed.") { - if (!cond) { - throw new AssertionError(msg); - } - } - exports.assert = assert; - var MIN_READ = 32 * 1024; - exports.MAX_SIZE = Math.pow(2, 32) - 2; - function copy(src, dst, off = 0) { - const r = dst.byteLength - off; - if (src.byteLength > r) { - src = src.subarray(0, r); - } - dst.set(src, off); - return src.byteLength; - } - function concat(origin, b) { - if (origin === void 0 && b === void 0) { - return new Uint8Array(0); - } - if (origin === void 0) { - return b; - } - if (b === void 0) { - return origin; - } - const output = new Uint8Array(origin.length + b.length); - output.set(origin, 0); - output.set(b, origin.length); - return output; - } - exports.concat = concat; - function append(origin, b) { - return concat(origin, Uint8Array.of(b)); - } - exports.append = append; - var DenoBuffer = class { - constructor(ab) { - this._off = 0; - if (ab == null) { - this._buf = new Uint8Array(0); - return; - } - this._buf = new Uint8Array(ab); - } - bytes(options = { copy: true }) { - if (options.copy === false) - return this._buf.subarray(this._off); - return this._buf.slice(this._off); - } - empty() { - return this._buf.byteLength <= this._off; - } - get length() { - return this._buf.byteLength - this._off; - } - get capacity() { - return this._buf.buffer.byteLength; - } - truncate(n) { - if (n === 0) { - this.reset(); - return; - } - if (n < 0 || n > this.length) { - throw Error("bytes.Buffer: truncation out of range"); - } - this._reslice(this._off + n); - } - reset() { - this._reslice(0); - this._off = 0; - } - _tryGrowByReslice(n) { - const l = this._buf.byteLength; - if (n <= this.capacity - l) { - this._reslice(l + n); - return l; - } - return -1; - } - _reslice(len) { - assert(len <= this._buf.buffer.byteLength); - this._buf = new Uint8Array(this._buf.buffer, 0, len); - } - readByte() { - const a = new Uint8Array(1); - if (this.read(a)) { - return a[0]; - } - return null; - } - read(p) { - if (this.empty()) { - this.reset(); - if (p.byteLength === 0) { - return 0; - } - return null; - } - const nread = copy(this._buf.subarray(this._off), p); - this._off += nread; - return nread; - } - writeByte(n) { - return this.write(Uint8Array.of(n)); - } - writeString(s) { - return this.write(encoders_1.TE.encode(s)); - } - write(p) { - const m = this._grow(p.byteLength); - return copy(p, this._buf, m); - } - _grow(n) { - const m = this.length; - if (m === 0 && this._off !== 0) { - this.reset(); - } - const i = this._tryGrowByReslice(n); - if (i >= 0) { - return i; - } - const c = this.capacity; - if (n <= Math.floor(c / 2) - m) { - copy(this._buf.subarray(this._off), this._buf); - } else if (c + n > exports.MAX_SIZE) { - throw new Error("The buffer cannot be grown beyond the maximum size."); - } else { - const buf = new Uint8Array(Math.min(2 * c + n, exports.MAX_SIZE)); - copy(this._buf.subarray(this._off), buf); - this._buf = buf; - } - this._off = 0; - this._reslice(Math.min(m + n, exports.MAX_SIZE)); - return m; - } - grow(n) { - if (n < 0) { - throw Error("Buffer._grow: negative count"); - } - const m = this._grow(n); - this._reslice(m); - } - readFrom(r) { - let n = 0; - const tmp = new Uint8Array(MIN_READ); - while (true) { - const shouldGrow = this.capacity - this.length < MIN_READ; - const buf = shouldGrow ? tmp : new Uint8Array(this._buf.buffer, this.length); - const nread = r.read(buf); - if (nread === null) { - return n; - } - if (shouldGrow) - this.write(buf.subarray(0, nread)); - else - this._reslice(this.length + nread); - n += nread; - } - } - }; - exports.DenoBuffer = DenoBuffer; - function readAll(r) { - const buf = new DenoBuffer(); - buf.readFrom(r); - return buf.bytes(); - } - exports.readAll = readAll; - function writeAll(w, arr) { - let nwritten = 0; - while (nwritten < arr.length) { - nwritten += w.write(arr.subarray(nwritten)); - } - } - exports.writeAll = writeAll; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/parser.js - var require_parser = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/parser.js"(exports, module) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.State = exports.Parser = exports.describe = exports.Kind = void 0; - var denobuffer_1 = require_denobuffer(); - var encoders_1 = require_encoders(); - var Kind; - (function(Kind2) { - Kind2[Kind2["OK"] = 0] = "OK"; - Kind2[Kind2["ERR"] = 1] = "ERR"; - Kind2[Kind2["MSG"] = 2] = "MSG"; - Kind2[Kind2["INFO"] = 3] = "INFO"; - Kind2[Kind2["PING"] = 4] = "PING"; - Kind2[Kind2["PONG"] = 5] = "PONG"; - })(Kind = exports.Kind || (exports.Kind = {})); - function describe(e) { - let ks; - let data = ""; - switch (e.kind) { - case Kind.MSG: - ks = "MSG"; - break; - case Kind.OK: - ks = "OK"; - break; - case Kind.ERR: - ks = "ERR"; - data = encoders_1.TD.decode(e.data); - break; - case Kind.PING: - ks = "PING"; - break; - case Kind.PONG: - ks = "PONG"; - break; - case Kind.INFO: - ks = "INFO"; - data = encoders_1.TD.decode(e.data); - } - return `${ks}: ${data}`; - } - exports.describe = describe; - function newMsgArg() { - const ma = {}; - ma.sid = -1; - ma.hdr = -1; - ma.size = -1; - return ma; - } - var ASCII_0 = 48; - var ASCII_9 = 57; - var Parser = class { - constructor(dispatcher) { - this.dispatcher = dispatcher; - this.state = State.OP_START; - this.as = 0; - this.drop = 0; - this.hdr = 0; - } - parse(buf) { - if (typeof module !== "undefined" && module.exports) { - buf.subarray = buf.slice; - } - let i; - for (i = 0; i < buf.length; i++) { - const b = buf[i]; - switch (this.state) { - case State.OP_START: - switch (b) { - case cc.M: - case cc.m: - this.state = State.OP_M; - this.hdr = -1; - this.ma = newMsgArg(); - break; - case cc.H: - case cc.h: - this.state = State.OP_H; - this.hdr = 0; - this.ma = newMsgArg(); - break; - case cc.P: - case cc.p: - this.state = State.OP_P; - break; - case cc.PLUS: - this.state = State.OP_PLUS; - break; - case cc.MINUS: - this.state = State.OP_MINUS; - break; - case cc.I: - case cc.i: - this.state = State.OP_I; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_H: - switch (b) { - case cc.M: - case cc.m: - this.state = State.OP_M; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_M: - switch (b) { - case cc.S: - case cc.s: - this.state = State.OP_MS; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MS: - switch (b) { - case cc.G: - case cc.g: - this.state = State.OP_MSG; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MSG: - switch (b) { - case cc.SPACE: - case cc.TAB: - this.state = State.OP_MSG_SPC; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MSG_SPC: - switch (b) { - case cc.SPACE: - case cc.TAB: - continue; - default: - this.state = State.MSG_ARG; - this.as = i; - } - break; - case State.MSG_ARG: - switch (b) { - case cc.CR: - this.drop = 1; - break; - case cc.NL: { - const arg = this.argBuf ? this.argBuf.bytes() : buf.subarray(this.as, i - this.drop); - this.processMsgArgs(arg); - this.drop = 0; - this.as = i + 1; - this.state = State.MSG_PAYLOAD; - i = this.as + this.ma.size - 1; - break; - } - default: - if (this.argBuf) { - this.argBuf.writeByte(b); - } - } - break; - case State.MSG_PAYLOAD: - if (this.msgBuf) { - if (this.msgBuf.length >= this.ma.size) { - const data = this.msgBuf.bytes({ copy: false }); - this.dispatcher.push({ kind: Kind.MSG, msg: this.ma, data }); - this.argBuf = void 0; - this.msgBuf = void 0; - this.state = State.MSG_END; - } else { - let toCopy = this.ma.size - this.msgBuf.length; - const avail = buf.length - i; - if (avail < toCopy) { - toCopy = avail; - } - if (toCopy > 0) { - this.msgBuf.write(buf.subarray(i, i + toCopy)); - i = i + toCopy - 1; - } else { - this.msgBuf.writeByte(b); - } - } - } else if (i - this.as >= this.ma.size) { - this.dispatcher.push({ kind: Kind.MSG, msg: this.ma, data: buf.subarray(this.as, i) }); - this.argBuf = void 0; - this.msgBuf = void 0; - this.state = State.MSG_END; - } - break; - case State.MSG_END: - switch (b) { - case cc.NL: - this.drop = 0; - this.as = i + 1; - this.state = State.OP_START; - break; - default: - continue; - } - break; - case State.OP_PLUS: - switch (b) { - case cc.O: - case cc.o: - this.state = State.OP_PLUS_O; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PLUS_O: - switch (b) { - case cc.K: - case cc.k: - this.state = State.OP_PLUS_OK; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PLUS_OK: - switch (b) { - case cc.NL: - this.dispatcher.push({ kind: Kind.OK }); - this.drop = 0; - this.state = State.OP_START; - break; - } - break; - case State.OP_MINUS: - switch (b) { - case cc.E: - case cc.e: - this.state = State.OP_MINUS_E; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MINUS_E: - switch (b) { - case cc.R: - case cc.r: - this.state = State.OP_MINUS_ER; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MINUS_ER: - switch (b) { - case cc.R: - case cc.r: - this.state = State.OP_MINUS_ERR; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MINUS_ERR: - switch (b) { - case cc.SPACE: - case cc.TAB: - this.state = State.OP_MINUS_ERR_SPC; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_MINUS_ERR_SPC: - switch (b) { - case cc.SPACE: - case cc.TAB: - continue; - default: - this.state = State.MINUS_ERR_ARG; - this.as = i; - } - break; - case State.MINUS_ERR_ARG: - switch (b) { - case cc.CR: - this.drop = 1; - break; - case cc.NL: { - let arg; - if (this.argBuf) { - arg = this.argBuf.bytes(); - this.argBuf = void 0; - } else { - arg = buf.subarray(this.as, i - this.drop); - } - this.dispatcher.push({ kind: Kind.ERR, data: arg }); - this.drop = 0; - this.as = i + 1; - this.state = State.OP_START; - break; - } - default: - if (this.argBuf) { - this.argBuf.write(Uint8Array.of(b)); - } - } - break; - case State.OP_P: - switch (b) { - case cc.I: - case cc.i: - this.state = State.OP_PI; - break; - case cc.O: - case cc.o: - this.state = State.OP_PO; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PO: - switch (b) { - case cc.N: - case cc.n: - this.state = State.OP_PON; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PON: - switch (b) { - case cc.G: - case cc.g: - this.state = State.OP_PONG; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PONG: - switch (b) { - case cc.NL: - this.dispatcher.push({ kind: Kind.PONG }); - this.drop = 0; - this.state = State.OP_START; - break; - } - break; - case State.OP_PI: - switch (b) { - case cc.N: - case cc.n: - this.state = State.OP_PIN; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PIN: - switch (b) { - case cc.G: - case cc.g: - this.state = State.OP_PING; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_PING: - switch (b) { - case cc.NL: - this.dispatcher.push({ kind: Kind.PING }); - this.drop = 0; - this.state = State.OP_START; - break; - } - break; - case State.OP_I: - switch (b) { - case cc.N: - case cc.n: - this.state = State.OP_IN; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_IN: - switch (b) { - case cc.F: - case cc.f: - this.state = State.OP_INF; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_INF: - switch (b) { - case cc.O: - case cc.o: - this.state = State.OP_INFO; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_INFO: - switch (b) { - case cc.SPACE: - case cc.TAB: - this.state = State.OP_INFO_SPC; - break; - default: - throw this.fail(buf.subarray(i)); - } - break; - case State.OP_INFO_SPC: - switch (b) { - case cc.SPACE: - case cc.TAB: - continue; - default: - this.state = State.INFO_ARG; - this.as = i; - } - break; - case State.INFO_ARG: - switch (b) { - case cc.CR: - this.drop = 1; - break; - case cc.NL: { - let arg; - if (this.argBuf) { - arg = this.argBuf.bytes(); - this.argBuf = void 0; - } else { - arg = buf.subarray(this.as, i - this.drop); - } - this.dispatcher.push({ kind: Kind.INFO, data: arg }); - this.drop = 0; - this.as = i + 1; - this.state = State.OP_START; - break; - } - default: - if (this.argBuf) { - this.argBuf.writeByte(b); - } - } - break; - default: - throw this.fail(buf.subarray(i)); - } - } - if ((this.state === State.MSG_ARG || this.state === State.MINUS_ERR_ARG || this.state === State.INFO_ARG) && !this.argBuf) { - this.argBuf = new denobuffer_1.DenoBuffer(buf.subarray(this.as, i - this.drop)); - } - if (this.state === State.MSG_PAYLOAD && !this.msgBuf) { - if (!this.argBuf) { - this.cloneMsgArg(); - } - this.msgBuf = new denobuffer_1.DenoBuffer(buf.subarray(this.as)); - } - } - cloneMsgArg() { - const s = this.ma.subject.length; - const r = this.ma.reply ? this.ma.reply.length : 0; - const buf = new Uint8Array(s + r); - buf.set(this.ma.subject); - if (this.ma.reply) { - buf.set(this.ma.reply, s); - } - this.argBuf = new denobuffer_1.DenoBuffer(buf); - this.ma.subject = buf.subarray(0, s); - if (this.ma.reply) { - this.ma.reply = buf.subarray(s); - } - } - processMsgArgs(arg) { - if (this.hdr >= 0) { - return this.processHeaderMsgArgs(arg); - } - const args = []; - let start = -1; - for (let i = 0; i < arg.length; i++) { - const b = arg[i]; - switch (b) { - case cc.SPACE: - case cc.TAB: - case cc.CR: - case cc.NL: - if (start >= 0) { - args.push(arg.subarray(start, i)); - start = -1; - } - break; - default: - if (start < 0) { - start = i; - } - } - } - if (start >= 0) { - args.push(arg.subarray(start)); - } - switch (args.length) { - case 3: - this.ma.subject = args[0]; - this.ma.sid = this.protoParseInt(args[1]); - this.ma.reply = void 0; - this.ma.size = this.protoParseInt(args[2]); - break; - case 4: - this.ma.subject = args[0]; - this.ma.sid = this.protoParseInt(args[1]); - this.ma.reply = args[2]; - this.ma.size = this.protoParseInt(args[3]); - break; - default: - throw this.fail(arg, "processMsgArgs Parse Error"); - } - if (this.ma.sid < 0) { - throw this.fail(arg, "processMsgArgs Bad or Missing Sid Error"); - } - if (this.ma.size < 0) { - throw this.fail(arg, "processMsgArgs Bad or Missing Size Error"); - } - } - fail(data, label = "") { - if (!label) { - label = `parse error [${this.state}]`; - } else { - label = `${label} [${this.state}]`; - } - return new Error(`${label}: ${encoders_1.TD.decode(data)}`); - } - processHeaderMsgArgs(arg) { - const args = []; - let start = -1; - for (let i = 0; i < arg.length; i++) { - const b = arg[i]; - switch (b) { - case cc.SPACE: - case cc.TAB: - case cc.CR: - case cc.NL: - if (start >= 0) { - args.push(arg.subarray(start, i)); - start = -1; - } - break; - default: - if (start < 0) { - start = i; - } - } - } - if (start >= 0) { - args.push(arg.subarray(start)); - } - switch (args.length) { - case 4: - this.ma.subject = args[0]; - this.ma.sid = this.protoParseInt(args[1]); - this.ma.reply = void 0; - this.ma.hdr = this.protoParseInt(args[2]); - this.ma.size = this.protoParseInt(args[3]); - break; - case 5: - this.ma.subject = args[0]; - this.ma.sid = this.protoParseInt(args[1]); - this.ma.reply = args[2]; - this.ma.hdr = this.protoParseInt(args[3]); - this.ma.size = this.protoParseInt(args[4]); - break; - default: - throw this.fail(arg, "processHeaderMsgArgs Parse Error"); - } - if (this.ma.sid < 0) { - throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Sid Error"); - } - if (this.ma.hdr < 0 || this.ma.hdr > this.ma.size) { - throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Header Size Error"); - } - if (this.ma.size < 0) { - throw this.fail(arg, "processHeaderMsgArgs Bad or Missing Size Error"); - } - } - protoParseInt(a) { - if (a.length === 0) { - return -1; - } - let n = 0; - for (let i = 0; i < a.length; i++) { - if (a[i] < ASCII_0 || a[i] > ASCII_9) { - return -1; - } - n = n * 10 + (a[i] - ASCII_0); - } - return n; - } - }; - exports.Parser = Parser; - var State; - (function(State2) { - State2[State2["OP_START"] = 0] = "OP_START"; - State2[State2["OP_PLUS"] = 1] = "OP_PLUS"; - State2[State2["OP_PLUS_O"] = 2] = "OP_PLUS_O"; - State2[State2["OP_PLUS_OK"] = 3] = "OP_PLUS_OK"; - State2[State2["OP_MINUS"] = 4] = "OP_MINUS"; - State2[State2["OP_MINUS_E"] = 5] = "OP_MINUS_E"; - State2[State2["OP_MINUS_ER"] = 6] = "OP_MINUS_ER"; - State2[State2["OP_MINUS_ERR"] = 7] = "OP_MINUS_ERR"; - State2[State2["OP_MINUS_ERR_SPC"] = 8] = "OP_MINUS_ERR_SPC"; - State2[State2["MINUS_ERR_ARG"] = 9] = "MINUS_ERR_ARG"; - State2[State2["OP_M"] = 10] = "OP_M"; - State2[State2["OP_MS"] = 11] = "OP_MS"; - State2[State2["OP_MSG"] = 12] = "OP_MSG"; - State2[State2["OP_MSG_SPC"] = 13] = "OP_MSG_SPC"; - State2[State2["MSG_ARG"] = 14] = "MSG_ARG"; - State2[State2["MSG_PAYLOAD"] = 15] = "MSG_PAYLOAD"; - State2[State2["MSG_END"] = 16] = "MSG_END"; - State2[State2["OP_H"] = 17] = "OP_H"; - State2[State2["OP_P"] = 18] = "OP_P"; - State2[State2["OP_PI"] = 19] = "OP_PI"; - State2[State2["OP_PIN"] = 20] = "OP_PIN"; - State2[State2["OP_PING"] = 21] = "OP_PING"; - State2[State2["OP_PO"] = 22] = "OP_PO"; - State2[State2["OP_PON"] = 23] = "OP_PON"; - State2[State2["OP_PONG"] = 24] = "OP_PONG"; - State2[State2["OP_I"] = 25] = "OP_I"; - State2[State2["OP_IN"] = 26] = "OP_IN"; - State2[State2["OP_INF"] = 27] = "OP_INF"; - State2[State2["OP_INFO"] = 28] = "OP_INFO"; - State2[State2["OP_INFO_SPC"] = 29] = "OP_INFO_SPC"; - State2[State2["INFO_ARG"] = 30] = "INFO_ARG"; - })(State = exports.State || (exports.State = {})); - var cc; - (function(cc2) { - cc2[cc2["CR"] = "\r".charCodeAt(0)] = "CR"; - cc2[cc2["E"] = "E".charCodeAt(0)] = "E"; - cc2[cc2["e"] = "e".charCodeAt(0)] = "e"; - cc2[cc2["F"] = "F".charCodeAt(0)] = "F"; - cc2[cc2["f"] = "f".charCodeAt(0)] = "f"; - cc2[cc2["G"] = "G".charCodeAt(0)] = "G"; - cc2[cc2["g"] = "g".charCodeAt(0)] = "g"; - cc2[cc2["H"] = "H".charCodeAt(0)] = "H"; - cc2[cc2["h"] = "h".charCodeAt(0)] = "h"; - cc2[cc2["I"] = "I".charCodeAt(0)] = "I"; - cc2[cc2["i"] = "i".charCodeAt(0)] = "i"; - cc2[cc2["K"] = "K".charCodeAt(0)] = "K"; - cc2[cc2["k"] = "k".charCodeAt(0)] = "k"; - cc2[cc2["M"] = "M".charCodeAt(0)] = "M"; - cc2[cc2["m"] = "m".charCodeAt(0)] = "m"; - cc2[cc2["MINUS"] = "-".charCodeAt(0)] = "MINUS"; - cc2[cc2["N"] = "N".charCodeAt(0)] = "N"; - cc2[cc2["n"] = "n".charCodeAt(0)] = "n"; - cc2[cc2["NL"] = "\n".charCodeAt(0)] = "NL"; - cc2[cc2["O"] = "O".charCodeAt(0)] = "O"; - cc2[cc2["o"] = "o".charCodeAt(0)] = "o"; - cc2[cc2["P"] = "P".charCodeAt(0)] = "P"; - cc2[cc2["p"] = "p".charCodeAt(0)] = "p"; - cc2[cc2["PLUS"] = "+".charCodeAt(0)] = "PLUS"; - cc2[cc2["R"] = "R".charCodeAt(0)] = "R"; - cc2[cc2["r"] = "r".charCodeAt(0)] = "r"; - cc2[cc2["S"] = "S".charCodeAt(0)] = "S"; - cc2[cc2["s"] = "s".charCodeAt(0)] = "s"; - cc2[cc2["SPACE"] = " ".charCodeAt(0)] = "SPACE"; - cc2[cc2["TAB"] = " ".charCodeAt(0)] = "TAB"; - })(cc || (cc = {})); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/protocol.js - var require_protocol = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/protocol.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __asyncValues = exports && exports.__asyncValues || function(o) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ProtocolHandler = exports.Connect = exports.createInbox = exports.INFO = void 0; - var types_1 = require_types(); - var transport_1 = require_transport(); - var error_1 = require_error(); - var util_1 = require_util(); - var nuid_1 = require_nuid(); - var databuffer_1 = require_databuffer(); - var servers_1 = require_servers(); - var queued_iterator_1 = require_queued_iterator(); - var subscription_1 = require_subscription(); - var subscriptions_1 = require_subscriptions(); - var muxsubscription_1 = require_muxsubscription(); - var heartbeats_1 = require_heartbeats(); - var parser_1 = require_parser(); - var msg_1 = require_msg(); - var encoders_1 = require_encoders(); - var FLUSH_THRESHOLD = 1024 * 32; - exports.INFO = /^INFO\s+([^\r\n]+)\r\n/i; - function createInbox(prefix = "") { - prefix = prefix || "_INBOX"; - if (typeof prefix !== "string") { - throw new Error("prefix must be a string"); - } - return `${prefix}.${nuid_1.nuid.next()}`; - } - exports.createInbox = createInbox; - var PONG_CMD = encoders_1.fastEncoder("PONG\r\n"); - var PING_CMD = encoders_1.fastEncoder("PING\r\n"); - var Connect = class { - constructor(transport, opts, nonce) { - this.protocol = 1; - this.version = transport.version; - this.lang = transport.lang; - this.echo = opts.noEcho ? false : void 0; - this.verbose = opts.verbose; - this.pedantic = opts.pedantic; - this.tls_required = opts.tls ? true : void 0; - this.name = opts.name; - const creds = (opts && opts.authenticator ? opts.authenticator(nonce) : {}) || {}; - util_1.extend(this, creds); - } - }; - exports.Connect = Connect; - var ProtocolHandler = class { - constructor(options, publisher) { - this._closed = false; - this.connected = false; - this.connectedOnce = false; - this.infoReceived = false; - this.noMorePublishing = false; - this.abortReconnect = false; - this.listeners = []; - this.pendingLimit = FLUSH_THRESHOLD; - this.outMsgs = 0; - this.inMsgs = 0; - this.outBytes = 0; - this.inBytes = 0; - this.options = options; - this.publisher = publisher; - this.subscriptions = new subscriptions_1.Subscriptions(); - this.muxSubscriptions = new muxsubscription_1.MuxSubscription(); - this.outbound = new databuffer_1.DataBuffer(); - this.pongs = []; - this.pendingLimit = options.pendingLimit || this.pendingLimit; - this.servers = new servers_1.Servers( - !options.noRandomize, - options.servers - ); - this.closed = util_1.deferred(); - this.parser = new parser_1.Parser(this); - this.heartbeats = new heartbeats_1.Heartbeat(this, this.options.pingInterval || types_1.DEFAULT_PING_INTERVAL, this.options.maxPingOut || types_1.DEFAULT_MAX_PING_OUT); - } - resetOutbound() { - this.outbound.reset(); - const pongs = this.pongs; - this.pongs = []; - pongs.forEach((p) => { - p.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.Disconnect)); - }); - this.parser = new parser_1.Parser(this); - this.infoReceived = false; - } - dispatchStatus(status) { - this.listeners.forEach((q) => { - q.push(status); - }); - } - status() { - const iter = new queued_iterator_1.QueuedIteratorImpl(); - this.listeners.push(iter); - return iter; - } - prepare() { - this.info = void 0; - this.resetOutbound(); - const pong = util_1.deferred(); - this.pongs.unshift(pong); - this.connectError = (err) => { - pong.reject(err); - }; - this.transport = transport_1.newTransport(); - this.transport.closed().then((_err) => __awaiter(this, void 0, void 0, function* () { - this.connected = false; - if (!this.isClosed()) { - yield this.disconnected(this.transport.closeError); - return; - } - })); - return pong; - } - disconnect() { - this.dispatchStatus({ type: types_1.DebugEvents.StaleConnection, data: "" }); - this.transport.disconnect(); - } - disconnected(_err) { - return __awaiter(this, void 0, void 0, function* () { - this.dispatchStatus({ - type: types_1.Events.Disconnect, - data: this.servers.getCurrentServer().toString() - }); - if (this.options.reconnect) { - yield this.dialLoop().then(() => { - this.dispatchStatus({ - type: types_1.Events.Reconnect, - data: this.servers.getCurrentServer().toString() - }); - }).catch((err) => { - this._close(err); - }); - } else { - yield this._close(); - } - }); - } - dial(srv) { - return __awaiter(this, void 0, void 0, function* () { - const pong = this.prepare(); - let timer; - try { - timer = util_1.timeout(this.options.timeout || 2e4); - const cp = this.transport.connect(srv, this.options); - yield Promise.race([cp, timer]); - (() => __awaiter(this, void 0, void 0, function* () { - var e_1, _a; - try { - try { - for (var _b = __asyncValues(this.transport), _c; _c = yield _b.next(), !_c.done; ) { - const b = _c.value; - this.parser.parse(b); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_c && !_c.done && (_a = _b.return)) - yield _a.call(_b); - } finally { - if (e_1) - throw e_1.error; - } - } - } catch (err) { - console.log("reader closed", err); - } - }))().then(); - } catch (err) { - pong.reject(err); - } - try { - yield Promise.race([timer, pong]); - if (timer) { - timer.cancel(); - } - this.connected = true; - this.connectError = void 0; - this.sendSubscriptions(); - this.connectedOnce = true; - this.server.didConnect = true; - this.server.reconnects = 0; - this.flushPending(); - this.heartbeats.start(); - } catch (err) { - if (timer) { - timer.cancel(); - } - yield this.transport.close(err); - throw err; - } - }); - } - dialLoop() { - return __awaiter(this, void 0, void 0, function* () { - let lastError; - while (true) { - const wait = this.options.reconnectDelayHandler ? this.options.reconnectDelayHandler() : types_1.DEFAULT_RECONNECT_TIME_WAIT; - let maxWait = wait; - const srv = this.selectServer(); - if (!srv || this.abortReconnect) { - throw lastError || error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionRefused); - } - const now = Date.now(); - if (srv.lastConnect === 0 || srv.lastConnect + wait <= now) { - srv.lastConnect = Date.now(); - try { - this.dispatchStatus({ type: types_1.DebugEvents.Reconnecting, data: srv.toString() }); - yield this.dial(srv); - break; - } catch (err) { - lastError = err; - if (!this.connectedOnce) { - if (this.options.waitOnFirstConnect) { - continue; - } - this.servers.removeCurrentServer(); - } - srv.reconnects++; - const mra = this.options.maxReconnectAttempts || 0; - if (mra !== -1 && srv.reconnects >= mra) { - this.servers.removeCurrentServer(); - } - } - } else { - maxWait = Math.min(maxWait, srv.lastConnect + wait - now); - yield util_1.delay(maxWait); - } - } - }); - } - static connect(options, publisher) { - return __awaiter(this, void 0, void 0, function* () { - const h = new ProtocolHandler(options, publisher); - yield h.dialLoop(); - return h; - }); - } - static toError(s) { - const t = s ? s.toLowerCase() : ""; - if (t.indexOf("permissions violation") !== -1) { - return new error_1.NatsError(s, error_1.ErrorCode.PermissionsViolation); - } else if (t.indexOf("authorization violation") !== -1) { - return new error_1.NatsError(s, error_1.ErrorCode.AuthorizationViolation); - } else if (t.indexOf("user authentication expired") !== -1) { - return new error_1.NatsError(s, error_1.ErrorCode.AuthenticationExpired); - } else { - return new error_1.NatsError(s, error_1.ErrorCode.ProtocolError); - } - } - processMsg(msg, data) { - this.inMsgs++; - this.inBytes += data.length; - if (!this.subscriptions.sidCounter) { - return; - } - const sub = this.subscriptions.get(msg.sid); - if (!sub) { - return; - } - sub.received += 1; - if (sub.callback) { - sub.callback(null, new msg_1.MsgImpl(msg, data, this)); - } - if (sub.max !== void 0 && sub.received >= sub.max) { - sub.unsubscribe(); - } - } - processError(m) { - return __awaiter(this, void 0, void 0, function* () { - const s = encoders_1.fastDecoder(m); - const err = ProtocolHandler.toError(s); - const handled = this.subscriptions.handleError(err); - if (!handled) { - this.dispatchStatus({ type: types_1.Events.Error, data: err.code }); - } - yield this.handleError(err); - }); - } - handleError(err) { - return __awaiter(this, void 0, void 0, function* () { - if (err.isAuthError()) { - this.handleAuthError(err); - } - if (err.isPermissionError() || err.isProtocolError()) { - yield this._close(err); - } - this.lastError = err; - }); - } - handleAuthError(err) { - if (this.lastError && err.code === this.lastError.code) { - this.abortReconnect = true; - } - if (this.connectError) { - this.connectError(err); - } else { - this.disconnect(); - } - } - processPing() { - this.transport.send(PONG_CMD); - } - processPong() { - const cb = this.pongs.shift(); - if (cb) { - cb.resolve(); - } - } - processInfo(m) { - const info = JSON.parse(encoders_1.fastDecoder(m)); - this.info = info; - const updates = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(info); - if (!this.infoReceived) { - this.infoReceived = true; - if (this.transport.isEncrypted()) { - this.servers.updateTLSName(); - } - const { version, lang } = this.transport; - try { - const c = new Connect({ version, lang }, this.options, info.nonce); - if (info.headers) { - c.headers = true; - c.no_responders = true; - } - const cs = JSON.stringify(c); - this.transport.send(encoders_1.fastEncoder(`CONNECT ${cs}${util_1.CR_LF}`)); - this.transport.send(PING_CMD); - } catch (err) { - this._close(error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication, err)); - } - } - if (updates) { - this.dispatchStatus({ type: types_1.Events.Update, data: updates }); - } - const ldm = info.ldm !== void 0 ? info.ldm : false; - if (ldm) { - this.dispatchStatus({ - type: types_1.Events.LDM, - data: this.servers.getCurrentServer().toString() - }); - } - } - push(e) { - switch (e.kind) { - case parser_1.Kind.MSG: { - const { msg, data } = e; - this.processMsg(msg, data); - break; - } - case parser_1.Kind.OK: - break; - case parser_1.Kind.ERR: - this.processError(e.data); - break; - case parser_1.Kind.PING: - this.processPing(); - break; - case parser_1.Kind.PONG: - this.processPong(); - break; - case parser_1.Kind.INFO: - this.processInfo(e.data); - break; - } - } - sendCommand(cmd, ...payloads) { - const len = this.outbound.length(); - let buf; - if (typeof cmd === "string") { - buf = encoders_1.fastEncoder(cmd); - } else { - buf = cmd; - } - this.outbound.fill(buf, ...payloads); - if (len === 0) { - setTimeout(() => { - this.flushPending(); - }); - } else if (this.outbound.size() >= this.pendingLimit) { - this.flushPending(); - } - } - publish(subject, data, options) { - if (this.isClosed()) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); - } - if (this.noMorePublishing) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining); - } - let len = data.length; - options = options || {}; - options.reply = options.reply || ""; - let headers = types_1.Empty; - let hlen = 0; - if (options.headers) { - if (this.info && !this.info.headers) { - throw new error_1.NatsError("headers", error_1.ErrorCode.ServerOptionNotAvailable); - } - const hdrs = options.headers; - headers = hdrs.encode(); - hlen = headers.length; - len = data.length + hlen; - } - if (this.info && len > this.info.max_payload) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.MaxPayloadExceeded); - } - this.outBytes += len; - this.outMsgs++; - let proto; - if (options.headers) { - if (options.reply) { - proto = `HPUB ${subject} ${options.reply} ${hlen} ${len}${util_1.CR_LF}`; - } else { - proto = `HPUB ${subject} ${hlen} ${len}\r -`; - } - this.sendCommand(proto, headers, data, util_1.CRLF); - } else { - if (options.reply) { - proto = `PUB ${subject} ${options.reply} ${len}\r -`; - } else { - proto = `PUB ${subject} ${len}\r -`; - } - this.sendCommand(proto, data, util_1.CRLF); - } - } - request(r) { - this.initMux(); - this.muxSubscriptions.add(r); - return r; - } - subscribe(s) { - this.subscriptions.add(s); - if (s.queue) { - this.sendCommand(`SUB ${s.subject} ${s.queue} ${s.sid}\r -`); - } else { - this.sendCommand(`SUB ${s.subject} ${s.sid}\r -`); - } - if (s.max) { - this.unsubscribe(s, s.max); - } - return s; - } - unsubscribe(s, max) { - this.unsub(s, max); - if (s.max === void 0 || s.received >= s.max) { - this.subscriptions.cancel(s); - } - } - unsub(s, max) { - if (!s || this.isClosed()) { - return; - } - if (max) { - this.sendCommand(`UNSUB ${s.sid} ${max}${util_1.CR_LF}`); - } else { - this.sendCommand(`UNSUB ${s.sid}${util_1.CR_LF}`); - } - s.max = max; - } - flush(p) { - if (!p) { - p = util_1.deferred(); - } - this.pongs.push(p); - this.sendCommand(PING_CMD); - return p; - } - sendSubscriptions() { - const cmds = []; - this.subscriptions.all().forEach((s) => { - const sub = s; - if (sub.queue) { - cmds.push(`SUB ${sub.subject} ${sub.queue} ${sub.sid}${util_1.CR_LF}`); - } else { - cmds.push(`SUB ${sub.subject} ${sub.sid}${util_1.CR_LF}`); - } - }); - if (cmds.length) { - this.transport.send(encoders_1.fastEncoder(cmds.join(""))); - } - } - _close(err) { - return __awaiter(this, void 0, void 0, function* () { - if (this._closed) { - return; - } - this.heartbeats.cancel(); - if (this.connectError) { - this.connectError(err); - this.connectError = void 0; - } - this.muxSubscriptions.close(); - this.subscriptions.close(); - this.listeners.forEach((l) => { - l.stop(); - }); - this._closed = true; - yield this.transport.close(err); - yield this.closed.resolve(err); - }); - } - close() { - return this._close(); - } - isClosed() { - return this._closed; - } - drain() { - const subs = this.subscriptions.all(); - const promises = []; - subs.forEach((sub) => { - promises.push(sub.drain()); - }); - return Promise.all(promises).then(() => __awaiter(this, void 0, void 0, function* () { - this.noMorePublishing = true; - yield this.flush(); - return this.close(); - })).catch(() => { - }); - } - flushPending() { - if (!this.infoReceived || !this.connected) { - return; - } - if (this.outbound.size()) { - const d = this.outbound.drain(); - this.transport.send(d); - } - } - initMux() { - const mux = this.subscriptions.getMux(); - if (!mux) { - const inbox = this.muxSubscriptions.init(this.options.inboxPrefix); - const sub = new subscription_1.SubscriptionImpl(this, `${inbox}*`); - sub.callback = this.muxSubscriptions.dispatcher(); - this.subscriptions.setMux(sub); - this.subscribe(sub); - } - } - selectServer() { - const server = this.servers.selectServer(); - if (server === void 0) { - return void 0; - } - this.server = server; - return this.server; - } - getServer() { - return this.server; - } - }; - exports.ProtocolHandler = ProtocolHandler; - } - }); - - // (disabled):crypto - var require_crypto = __commonJS({ - "(disabled):crypto"() { - } - }); - - // ../../node_modules/tweetnacl/nacl-fast.js - var require_nacl_fast = __commonJS({ - "../../node_modules/tweetnacl/nacl-fast.js"(exports, module) { - (function(nacl) { - "use strict"; - var gf = function(init) { - var i, r = new Float64Array(16); - if (init) - for (i = 0; i < init.length; i++) - r[i] = init[i]; - return r; - }; - var randombytes = function() { - throw new Error("no PRNG"); - }; - var _0 = new Uint8Array(16); - var _9 = new Uint8Array(32); - _9[0] = 9; - var gf0 = gf(), gf1 = gf([1]), _121665 = gf([56129, 1]), D = gf([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), D2 = gf([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), X = gf([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), Y = gf([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), I = gf([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]); - function ts64(x, i, h, l) { - x[i] = h >> 24 & 255; - x[i + 1] = h >> 16 & 255; - x[i + 2] = h >> 8 & 255; - x[i + 3] = h & 255; - x[i + 4] = l >> 24 & 255; - x[i + 5] = l >> 16 & 255; - x[i + 6] = l >> 8 & 255; - x[i + 7] = l & 255; - } - function vn(x, xi, y, yi, n) { - var i, d = 0; - for (i = 0; i < n; i++) - d |= x[xi + i] ^ y[yi + i]; - return (1 & d - 1 >>> 8) - 1; - } - function crypto_verify_16(x, xi, y, yi) { - return vn(x, xi, y, yi, 16); - } - function crypto_verify_32(x, xi, y, yi) { - return vn(x, xi, y, yi, 32); - } - function core_salsa20(o, p, k, c) { - var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24; - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u; - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u << 7 | u >>> 32 - 7; - u = x4 + x0 | 0; - x8 ^= u << 9 | u >>> 32 - 9; - u = x8 + x4 | 0; - x12 ^= u << 13 | u >>> 32 - 13; - u = x12 + x8 | 0; - x0 ^= u << 18 | u >>> 32 - 18; - u = x5 + x1 | 0; - x9 ^= u << 7 | u >>> 32 - 7; - u = x9 + x5 | 0; - x13 ^= u << 9 | u >>> 32 - 9; - u = x13 + x9 | 0; - x1 ^= u << 13 | u >>> 32 - 13; - u = x1 + x13 | 0; - x5 ^= u << 18 | u >>> 32 - 18; - u = x10 + x6 | 0; - x14 ^= u << 7 | u >>> 32 - 7; - u = x14 + x10 | 0; - x2 ^= u << 9 | u >>> 32 - 9; - u = x2 + x14 | 0; - x6 ^= u << 13 | u >>> 32 - 13; - u = x6 + x2 | 0; - x10 ^= u << 18 | u >>> 32 - 18; - u = x15 + x11 | 0; - x3 ^= u << 7 | u >>> 32 - 7; - u = x3 + x15 | 0; - x7 ^= u << 9 | u >>> 32 - 9; - u = x7 + x3 | 0; - x11 ^= u << 13 | u >>> 32 - 13; - u = x11 + x7 | 0; - x15 ^= u << 18 | u >>> 32 - 18; - u = x0 + x3 | 0; - x1 ^= u << 7 | u >>> 32 - 7; - u = x1 + x0 | 0; - x2 ^= u << 9 | u >>> 32 - 9; - u = x2 + x1 | 0; - x3 ^= u << 13 | u >>> 32 - 13; - u = x3 + x2 | 0; - x0 ^= u << 18 | u >>> 32 - 18; - u = x5 + x4 | 0; - x6 ^= u << 7 | u >>> 32 - 7; - u = x6 + x5 | 0; - x7 ^= u << 9 | u >>> 32 - 9; - u = x7 + x6 | 0; - x4 ^= u << 13 | u >>> 32 - 13; - u = x4 + x7 | 0; - x5 ^= u << 18 | u >>> 32 - 18; - u = x10 + x9 | 0; - x11 ^= u << 7 | u >>> 32 - 7; - u = x11 + x10 | 0; - x8 ^= u << 9 | u >>> 32 - 9; - u = x8 + x11 | 0; - x9 ^= u << 13 | u >>> 32 - 13; - u = x9 + x8 | 0; - x10 ^= u << 18 | u >>> 32 - 18; - u = x15 + x14 | 0; - x12 ^= u << 7 | u >>> 32 - 7; - u = x12 + x15 | 0; - x13 ^= u << 9 | u >>> 32 - 9; - u = x13 + x12 | 0; - x14 ^= u << 13 | u >>> 32 - 13; - u = x14 + x13 | 0; - x15 ^= u << 18 | u >>> 32 - 18; - } - x0 = x0 + j0 | 0; - x1 = x1 + j1 | 0; - x2 = x2 + j2 | 0; - x3 = x3 + j3 | 0; - x4 = x4 + j4 | 0; - x5 = x5 + j5 | 0; - x6 = x6 + j6 | 0; - x7 = x7 + j7 | 0; - x8 = x8 + j8 | 0; - x9 = x9 + j9 | 0; - x10 = x10 + j10 | 0; - x11 = x11 + j11 | 0; - x12 = x12 + j12 | 0; - x13 = x13 + j13 | 0; - x14 = x14 + j14 | 0; - x15 = x15 + j15 | 0; - o[0] = x0 >>> 0 & 255; - o[1] = x0 >>> 8 & 255; - o[2] = x0 >>> 16 & 255; - o[3] = x0 >>> 24 & 255; - o[4] = x1 >>> 0 & 255; - o[5] = x1 >>> 8 & 255; - o[6] = x1 >>> 16 & 255; - o[7] = x1 >>> 24 & 255; - o[8] = x2 >>> 0 & 255; - o[9] = x2 >>> 8 & 255; - o[10] = x2 >>> 16 & 255; - o[11] = x2 >>> 24 & 255; - o[12] = x3 >>> 0 & 255; - o[13] = x3 >>> 8 & 255; - o[14] = x3 >>> 16 & 255; - o[15] = x3 >>> 24 & 255; - o[16] = x4 >>> 0 & 255; - o[17] = x4 >>> 8 & 255; - o[18] = x4 >>> 16 & 255; - o[19] = x4 >>> 24 & 255; - o[20] = x5 >>> 0 & 255; - o[21] = x5 >>> 8 & 255; - o[22] = x5 >>> 16 & 255; - o[23] = x5 >>> 24 & 255; - o[24] = x6 >>> 0 & 255; - o[25] = x6 >>> 8 & 255; - o[26] = x6 >>> 16 & 255; - o[27] = x6 >>> 24 & 255; - o[28] = x7 >>> 0 & 255; - o[29] = x7 >>> 8 & 255; - o[30] = x7 >>> 16 & 255; - o[31] = x7 >>> 24 & 255; - o[32] = x8 >>> 0 & 255; - o[33] = x8 >>> 8 & 255; - o[34] = x8 >>> 16 & 255; - o[35] = x8 >>> 24 & 255; - o[36] = x9 >>> 0 & 255; - o[37] = x9 >>> 8 & 255; - o[38] = x9 >>> 16 & 255; - o[39] = x9 >>> 24 & 255; - o[40] = x10 >>> 0 & 255; - o[41] = x10 >>> 8 & 255; - o[42] = x10 >>> 16 & 255; - o[43] = x10 >>> 24 & 255; - o[44] = x11 >>> 0 & 255; - o[45] = x11 >>> 8 & 255; - o[46] = x11 >>> 16 & 255; - o[47] = x11 >>> 24 & 255; - o[48] = x12 >>> 0 & 255; - o[49] = x12 >>> 8 & 255; - o[50] = x12 >>> 16 & 255; - o[51] = x12 >>> 24 & 255; - o[52] = x13 >>> 0 & 255; - o[53] = x13 >>> 8 & 255; - o[54] = x13 >>> 16 & 255; - o[55] = x13 >>> 24 & 255; - o[56] = x14 >>> 0 & 255; - o[57] = x14 >>> 8 & 255; - o[58] = x14 >>> 16 & 255; - o[59] = x14 >>> 24 & 255; - o[60] = x15 >>> 0 & 255; - o[61] = x15 >>> 8 & 255; - o[62] = x15 >>> 16 & 255; - o[63] = x15 >>> 24 & 255; - } - function core_hsalsa20(o, p, k, c) { - var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24; - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u; - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u << 7 | u >>> 32 - 7; - u = x4 + x0 | 0; - x8 ^= u << 9 | u >>> 32 - 9; - u = x8 + x4 | 0; - x12 ^= u << 13 | u >>> 32 - 13; - u = x12 + x8 | 0; - x0 ^= u << 18 | u >>> 32 - 18; - u = x5 + x1 | 0; - x9 ^= u << 7 | u >>> 32 - 7; - u = x9 + x5 | 0; - x13 ^= u << 9 | u >>> 32 - 9; - u = x13 + x9 | 0; - x1 ^= u << 13 | u >>> 32 - 13; - u = x1 + x13 | 0; - x5 ^= u << 18 | u >>> 32 - 18; - u = x10 + x6 | 0; - x14 ^= u << 7 | u >>> 32 - 7; - u = x14 + x10 | 0; - x2 ^= u << 9 | u >>> 32 - 9; - u = x2 + x14 | 0; - x6 ^= u << 13 | u >>> 32 - 13; - u = x6 + x2 | 0; - x10 ^= u << 18 | u >>> 32 - 18; - u = x15 + x11 | 0; - x3 ^= u << 7 | u >>> 32 - 7; - u = x3 + x15 | 0; - x7 ^= u << 9 | u >>> 32 - 9; - u = x7 + x3 | 0; - x11 ^= u << 13 | u >>> 32 - 13; - u = x11 + x7 | 0; - x15 ^= u << 18 | u >>> 32 - 18; - u = x0 + x3 | 0; - x1 ^= u << 7 | u >>> 32 - 7; - u = x1 + x0 | 0; - x2 ^= u << 9 | u >>> 32 - 9; - u = x2 + x1 | 0; - x3 ^= u << 13 | u >>> 32 - 13; - u = x3 + x2 | 0; - x0 ^= u << 18 | u >>> 32 - 18; - u = x5 + x4 | 0; - x6 ^= u << 7 | u >>> 32 - 7; - u = x6 + x5 | 0; - x7 ^= u << 9 | u >>> 32 - 9; - u = x7 + x6 | 0; - x4 ^= u << 13 | u >>> 32 - 13; - u = x4 + x7 | 0; - x5 ^= u << 18 | u >>> 32 - 18; - u = x10 + x9 | 0; - x11 ^= u << 7 | u >>> 32 - 7; - u = x11 + x10 | 0; - x8 ^= u << 9 | u >>> 32 - 9; - u = x8 + x11 | 0; - x9 ^= u << 13 | u >>> 32 - 13; - u = x9 + x8 | 0; - x10 ^= u << 18 | u >>> 32 - 18; - u = x15 + x14 | 0; - x12 ^= u << 7 | u >>> 32 - 7; - u = x12 + x15 | 0; - x13 ^= u << 9 | u >>> 32 - 9; - u = x13 + x12 | 0; - x14 ^= u << 13 | u >>> 32 - 13; - u = x14 + x13 | 0; - x15 ^= u << 18 | u >>> 32 - 18; - } - o[0] = x0 >>> 0 & 255; - o[1] = x0 >>> 8 & 255; - o[2] = x0 >>> 16 & 255; - o[3] = x0 >>> 24 & 255; - o[4] = x5 >>> 0 & 255; - o[5] = x5 >>> 8 & 255; - o[6] = x5 >>> 16 & 255; - o[7] = x5 >>> 24 & 255; - o[8] = x10 >>> 0 & 255; - o[9] = x10 >>> 8 & 255; - o[10] = x10 >>> 16 & 255; - o[11] = x10 >>> 24 & 255; - o[12] = x15 >>> 0 & 255; - o[13] = x15 >>> 8 & 255; - o[14] = x15 >>> 16 & 255; - o[15] = x15 >>> 24 & 255; - o[16] = x6 >>> 0 & 255; - o[17] = x6 >>> 8 & 255; - o[18] = x6 >>> 16 & 255; - o[19] = x6 >>> 24 & 255; - o[20] = x7 >>> 0 & 255; - o[21] = x7 >>> 8 & 255; - o[22] = x7 >>> 16 & 255; - o[23] = x7 >>> 24 & 255; - o[24] = x8 >>> 0 & 255; - o[25] = x8 >>> 8 & 255; - o[26] = x8 >>> 16 & 255; - o[27] = x8 >>> 24 & 255; - o[28] = x9 >>> 0 & 255; - o[29] = x9 >>> 8 & 255; - o[30] = x9 >>> 16 & 255; - o[31] = x9 >>> 24 & 255; - } - function crypto_core_salsa20(out, inp, k, c) { - core_salsa20(out, inp, k, c); - } - function crypto_core_hsalsa20(out, inp, k, c) { - core_hsalsa20(out, inp, k, c); - } - var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - function crypto_stream_salsa20_xor(c, cpos, m, mpos, b, n, k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) - z[i] = 0; - for (i = 0; i < 8; i++) - z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x, z, k, sigma); - for (i = 0; i < 64; i++) - c[cpos + i] = m[mpos + i] ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 255) | 0; - z[i] = u & 255; - u >>>= 8; - } - b -= 64; - cpos += 64; - mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x, z, k, sigma); - for (i = 0; i < b; i++) - c[cpos + i] = m[mpos + i] ^ x[i]; - } - return 0; - } - function crypto_stream_salsa20(c, cpos, b, n, k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) - z[i] = 0; - for (i = 0; i < 8; i++) - z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x, z, k, sigma); - for (i = 0; i < 64; i++) - c[cpos + i] = x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 255) | 0; - z[i] = u & 255; - u >>>= 8; - } - b -= 64; - cpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x, z, k, sigma); - for (i = 0; i < b; i++) - c[cpos + i] = x[i]; - } - return 0; - } - function crypto_stream(c, cpos, d, n, k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s, n, k, sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) - sn[i] = n[i + 16]; - return crypto_stream_salsa20(c, cpos, d, sn, s); - } - function crypto_stream_xor(c, cpos, m, mpos, d, n, k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s, n, k, sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) - sn[i] = n[i + 16]; - return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, sn, s); - } - var poly1305 = function(key) { - this.buffer = new Uint8Array(16); - this.r = new Uint16Array(10); - this.h = new Uint16Array(10); - this.pad = new Uint16Array(8); - this.leftover = 0; - this.fin = 0; - var t0, t1, t2, t3, t4, t5, t6, t7; - t0 = key[0] & 255 | (key[1] & 255) << 8; - this.r[0] = t0 & 8191; - t1 = key[2] & 255 | (key[3] & 255) << 8; - this.r[1] = (t0 >>> 13 | t1 << 3) & 8191; - t2 = key[4] & 255 | (key[5] & 255) << 8; - this.r[2] = (t1 >>> 10 | t2 << 6) & 7939; - t3 = key[6] & 255 | (key[7] & 255) << 8; - this.r[3] = (t2 >>> 7 | t3 << 9) & 8191; - t4 = key[8] & 255 | (key[9] & 255) << 8; - this.r[4] = (t3 >>> 4 | t4 << 12) & 255; - this.r[5] = t4 >>> 1 & 8190; - t5 = key[10] & 255 | (key[11] & 255) << 8; - this.r[6] = (t4 >>> 14 | t5 << 2) & 8191; - t6 = key[12] & 255 | (key[13] & 255) << 8; - this.r[7] = (t5 >>> 11 | t6 << 5) & 8065; - t7 = key[14] & 255 | (key[15] & 255) << 8; - this.r[8] = (t6 >>> 8 | t7 << 8) & 8191; - this.r[9] = t7 >>> 5 & 127; - this.pad[0] = key[16] & 255 | (key[17] & 255) << 8; - this.pad[1] = key[18] & 255 | (key[19] & 255) << 8; - this.pad[2] = key[20] & 255 | (key[21] & 255) << 8; - this.pad[3] = key[22] & 255 | (key[23] & 255) << 8; - this.pad[4] = key[24] & 255 | (key[25] & 255) << 8; - this.pad[5] = key[26] & 255 | (key[27] & 255) << 8; - this.pad[6] = key[28] & 255 | (key[29] & 255) << 8; - this.pad[7] = key[30] & 255 | (key[31] & 255) << 8; - }; - poly1305.prototype.blocks = function(m, mpos, bytes) { - var hibit = this.fin ? 0 : 1 << 11; - var t0, t1, t2, t3, t4, t5, t6, t7, c; - var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; - var h0 = this.h[0], h1 = this.h[1], h2 = this.h[2], h3 = this.h[3], h4 = this.h[4], h5 = this.h[5], h6 = this.h[6], h7 = this.h[7], h8 = this.h[8], h9 = this.h[9]; - var r0 = this.r[0], r1 = this.r[1], r2 = this.r[2], r3 = this.r[3], r4 = this.r[4], r5 = this.r[5], r6 = this.r[6], r7 = this.r[7], r8 = this.r[8], r9 = this.r[9]; - while (bytes >= 16) { - t0 = m[mpos + 0] & 255 | (m[mpos + 1] & 255) << 8; - h0 += t0 & 8191; - t1 = m[mpos + 2] & 255 | (m[mpos + 3] & 255) << 8; - h1 += (t0 >>> 13 | t1 << 3) & 8191; - t2 = m[mpos + 4] & 255 | (m[mpos + 5] & 255) << 8; - h2 += (t1 >>> 10 | t2 << 6) & 8191; - t3 = m[mpos + 6] & 255 | (m[mpos + 7] & 255) << 8; - h3 += (t2 >>> 7 | t3 << 9) & 8191; - t4 = m[mpos + 8] & 255 | (m[mpos + 9] & 255) << 8; - h4 += (t3 >>> 4 | t4 << 12) & 8191; - h5 += t4 >>> 1 & 8191; - t5 = m[mpos + 10] & 255 | (m[mpos + 11] & 255) << 8; - h6 += (t4 >>> 14 | t5 << 2) & 8191; - t6 = m[mpos + 12] & 255 | (m[mpos + 13] & 255) << 8; - h7 += (t5 >>> 11 | t6 << 5) & 8191; - t7 = m[mpos + 14] & 255 | (m[mpos + 15] & 255) << 8; - h8 += (t6 >>> 8 | t7 << 8) & 8191; - h9 += t7 >>> 5 | hibit; - c = 0; - d0 = c; - d0 += h0 * r0; - d0 += h1 * (5 * r9); - d0 += h2 * (5 * r8); - d0 += h3 * (5 * r7); - d0 += h4 * (5 * r6); - c = d0 >>> 13; - d0 &= 8191; - d0 += h5 * (5 * r5); - d0 += h6 * (5 * r4); - d0 += h7 * (5 * r3); - d0 += h8 * (5 * r2); - d0 += h9 * (5 * r1); - c += d0 >>> 13; - d0 &= 8191; - d1 = c; - d1 += h0 * r1; - d1 += h1 * r0; - d1 += h2 * (5 * r9); - d1 += h3 * (5 * r8); - d1 += h4 * (5 * r7); - c = d1 >>> 13; - d1 &= 8191; - d1 += h5 * (5 * r6); - d1 += h6 * (5 * r5); - d1 += h7 * (5 * r4); - d1 += h8 * (5 * r3); - d1 += h9 * (5 * r2); - c += d1 >>> 13; - d1 &= 8191; - d2 = c; - d2 += h0 * r2; - d2 += h1 * r1; - d2 += h2 * r0; - d2 += h3 * (5 * r9); - d2 += h4 * (5 * r8); - c = d2 >>> 13; - d2 &= 8191; - d2 += h5 * (5 * r7); - d2 += h6 * (5 * r6); - d2 += h7 * (5 * r5); - d2 += h8 * (5 * r4); - d2 += h9 * (5 * r3); - c += d2 >>> 13; - d2 &= 8191; - d3 = c; - d3 += h0 * r3; - d3 += h1 * r2; - d3 += h2 * r1; - d3 += h3 * r0; - d3 += h4 * (5 * r9); - c = d3 >>> 13; - d3 &= 8191; - d3 += h5 * (5 * r8); - d3 += h6 * (5 * r7); - d3 += h7 * (5 * r6); - d3 += h8 * (5 * r5); - d3 += h9 * (5 * r4); - c += d3 >>> 13; - d3 &= 8191; - d4 = c; - d4 += h0 * r4; - d4 += h1 * r3; - d4 += h2 * r2; - d4 += h3 * r1; - d4 += h4 * r0; - c = d4 >>> 13; - d4 &= 8191; - d4 += h5 * (5 * r9); - d4 += h6 * (5 * r8); - d4 += h7 * (5 * r7); - d4 += h8 * (5 * r6); - d4 += h9 * (5 * r5); - c += d4 >>> 13; - d4 &= 8191; - d5 = c; - d5 += h0 * r5; - d5 += h1 * r4; - d5 += h2 * r3; - d5 += h3 * r2; - d5 += h4 * r1; - c = d5 >>> 13; - d5 &= 8191; - d5 += h5 * r0; - d5 += h6 * (5 * r9); - d5 += h7 * (5 * r8); - d5 += h8 * (5 * r7); - d5 += h9 * (5 * r6); - c += d5 >>> 13; - d5 &= 8191; - d6 = c; - d6 += h0 * r6; - d6 += h1 * r5; - d6 += h2 * r4; - d6 += h3 * r3; - d6 += h4 * r2; - c = d6 >>> 13; - d6 &= 8191; - d6 += h5 * r1; - d6 += h6 * r0; - d6 += h7 * (5 * r9); - d6 += h8 * (5 * r8); - d6 += h9 * (5 * r7); - c += d6 >>> 13; - d6 &= 8191; - d7 = c; - d7 += h0 * r7; - d7 += h1 * r6; - d7 += h2 * r5; - d7 += h3 * r4; - d7 += h4 * r3; - c = d7 >>> 13; - d7 &= 8191; - d7 += h5 * r2; - d7 += h6 * r1; - d7 += h7 * r0; - d7 += h8 * (5 * r9); - d7 += h9 * (5 * r8); - c += d7 >>> 13; - d7 &= 8191; - d8 = c; - d8 += h0 * r8; - d8 += h1 * r7; - d8 += h2 * r6; - d8 += h3 * r5; - d8 += h4 * r4; - c = d8 >>> 13; - d8 &= 8191; - d8 += h5 * r3; - d8 += h6 * r2; - d8 += h7 * r1; - d8 += h8 * r0; - d8 += h9 * (5 * r9); - c += d8 >>> 13; - d8 &= 8191; - d9 = c; - d9 += h0 * r9; - d9 += h1 * r8; - d9 += h2 * r7; - d9 += h3 * r6; - d9 += h4 * r5; - c = d9 >>> 13; - d9 &= 8191; - d9 += h5 * r4; - d9 += h6 * r3; - d9 += h7 * r2; - d9 += h8 * r1; - d9 += h9 * r0; - c += d9 >>> 13; - d9 &= 8191; - c = (c << 2) + c | 0; - c = c + d0 | 0; - d0 = c & 8191; - c = c >>> 13; - d1 += c; - h0 = d0; - h1 = d1; - h2 = d2; - h3 = d3; - h4 = d4; - h5 = d5; - h6 = d6; - h7 = d7; - h8 = d8; - h9 = d9; - mpos += 16; - bytes -= 16; - } - this.h[0] = h0; - this.h[1] = h1; - this.h[2] = h2; - this.h[3] = h3; - this.h[4] = h4; - this.h[5] = h5; - this.h[6] = h6; - this.h[7] = h7; - this.h[8] = h8; - this.h[9] = h9; - }; - poly1305.prototype.finish = function(mac, macpos) { - var g = new Uint16Array(10); - var c, mask, f, i; - if (this.leftover) { - i = this.leftover; - this.buffer[i++] = 1; - for (; i < 16; i++) - this.buffer[i] = 0; - this.fin = 1; - this.blocks(this.buffer, 0, 16); - } - c = this.h[1] >>> 13; - this.h[1] &= 8191; - for (i = 2; i < 10; i++) { - this.h[i] += c; - c = this.h[i] >>> 13; - this.h[i] &= 8191; - } - this.h[0] += c * 5; - c = this.h[0] >>> 13; - this.h[0] &= 8191; - this.h[1] += c; - c = this.h[1] >>> 13; - this.h[1] &= 8191; - this.h[2] += c; - g[0] = this.h[0] + 5; - c = g[0] >>> 13; - g[0] &= 8191; - for (i = 1; i < 10; i++) { - g[i] = this.h[i] + c; - c = g[i] >>> 13; - g[i] &= 8191; - } - g[9] -= 1 << 13; - mask = (c ^ 1) - 1; - for (i = 0; i < 10; i++) - g[i] &= mask; - mask = ~mask; - for (i = 0; i < 10; i++) - this.h[i] = this.h[i] & mask | g[i]; - this.h[0] = (this.h[0] | this.h[1] << 13) & 65535; - this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535; - this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535; - this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535; - this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535; - this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535; - this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535; - this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535; - f = this.h[0] + this.pad[0]; - this.h[0] = f & 65535; - for (i = 1; i < 8; i++) { - f = (this.h[i] + this.pad[i] | 0) + (f >>> 16) | 0; - this.h[i] = f & 65535; - } - mac[macpos + 0] = this.h[0] >>> 0 & 255; - mac[macpos + 1] = this.h[0] >>> 8 & 255; - mac[macpos + 2] = this.h[1] >>> 0 & 255; - mac[macpos + 3] = this.h[1] >>> 8 & 255; - mac[macpos + 4] = this.h[2] >>> 0 & 255; - mac[macpos + 5] = this.h[2] >>> 8 & 255; - mac[macpos + 6] = this.h[3] >>> 0 & 255; - mac[macpos + 7] = this.h[3] >>> 8 & 255; - mac[macpos + 8] = this.h[4] >>> 0 & 255; - mac[macpos + 9] = this.h[4] >>> 8 & 255; - mac[macpos + 10] = this.h[5] >>> 0 & 255; - mac[macpos + 11] = this.h[5] >>> 8 & 255; - mac[macpos + 12] = this.h[6] >>> 0 & 255; - mac[macpos + 13] = this.h[6] >>> 8 & 255; - mac[macpos + 14] = this.h[7] >>> 0 & 255; - mac[macpos + 15] = this.h[7] >>> 8 & 255; - }; - poly1305.prototype.update = function(m, mpos, bytes) { - var i, want; - if (this.leftover) { - want = 16 - this.leftover; - if (want > bytes) - want = bytes; - for (i = 0; i < want; i++) - this.buffer[this.leftover + i] = m[mpos + i]; - bytes -= want; - mpos += want; - this.leftover += want; - if (this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16); - this.leftover = 0; - } - if (bytes >= 16) { - want = bytes - bytes % 16; - this.blocks(m, mpos, want); - mpos += want; - bytes -= want; - } - if (bytes) { - for (i = 0; i < bytes; i++) - this.buffer[this.leftover + i] = m[mpos + i]; - this.leftover += bytes; - } - }; - function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s = new poly1305(k); - s.update(m, mpos, n); - s.finish(out, outpos); - return 0; - } - function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x, 0, m, mpos, n, k); - return crypto_verify_16(h, hpos, x, 0); - } - function crypto_secretbox(c, m, d, n, k) { - var i; - if (d < 32) - return -1; - crypto_stream_xor(c, 0, m, 0, d, n, k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) - c[i] = 0; - return 0; - } - function crypto_secretbox_open(m, c, d, n, k) { - var i; - var x = new Uint8Array(32); - if (d < 32) - return -1; - crypto_stream(x, 0, 32, n, k); - if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) - return -1; - crypto_stream_xor(m, 0, c, 0, d, n, k); - for (i = 0; i < 32; i++) - m[i] = 0; - return 0; - } - function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) - r[i] = a[i] | 0; - } - function car25519(o) { - var i, v, c = 1; - for (i = 0; i < 16; i++) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c - 1 + 37 * (c - 1); - } - function sel25519(p, q, b) { - var t, c = ~(b - 1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } - } - function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) - t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 65517; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 65535 - (m[i - 1] >> 16 & 1); - m[i - 1] &= 65535; - } - m[15] = t[15] - 32767 - (m[14] >> 16 & 1); - b = m[15] >> 16 & 1; - m[14] &= 65535; - sel25519(t, m, 1 - b); - } - for (i = 0; i < 16; i++) { - o[2 * i] = t[i] & 255; - o[2 * i + 1] = t[i] >> 8; - } - } - function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); - } - function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; - } - function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) - o[i] = n[2 * i] + (n[2 * i + 1] << 8); - o[15] &= 32767; - } - function A(o, a, b) { - for (var i = 0; i < 16; i++) - o[i] = a[i] + b[i]; - } - function Z(o, a, b) { - for (var i = 0; i < 16; i++) - o[i] = a[i] - b[i]; - } - function M(o, a, b) { - var v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15]; - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - c = 1; - v = t0 + c + 65535; - c = Math.floor(v / 65536); - t0 = v - c * 65536; - v = t1 + c + 65535; - c = Math.floor(v / 65536); - t1 = v - c * 65536; - v = t2 + c + 65535; - c = Math.floor(v / 65536); - t2 = v - c * 65536; - v = t3 + c + 65535; - c = Math.floor(v / 65536); - t3 = v - c * 65536; - v = t4 + c + 65535; - c = Math.floor(v / 65536); - t4 = v - c * 65536; - v = t5 + c + 65535; - c = Math.floor(v / 65536); - t5 = v - c * 65536; - v = t6 + c + 65535; - c = Math.floor(v / 65536); - t6 = v - c * 65536; - v = t7 + c + 65535; - c = Math.floor(v / 65536); - t7 = v - c * 65536; - v = t8 + c + 65535; - c = Math.floor(v / 65536); - t8 = v - c * 65536; - v = t9 + c + 65535; - c = Math.floor(v / 65536); - t9 = v - c * 65536; - v = t10 + c + 65535; - c = Math.floor(v / 65536); - t10 = v - c * 65536; - v = t11 + c + 65535; - c = Math.floor(v / 65536); - t11 = v - c * 65536; - v = t12 + c + 65535; - c = Math.floor(v / 65536); - t12 = v - c * 65536; - v = t13 + c + 65535; - c = Math.floor(v / 65536); - t13 = v - c * 65536; - v = t14 + c + 65535; - c = Math.floor(v / 65536); - t14 = v - c * 65536; - v = t15 + c + 65535; - c = Math.floor(v / 65536); - t15 = v - c * 65536; - t0 += c - 1 + 37 * (c - 1); - c = 1; - v = t0 + c + 65535; - c = Math.floor(v / 65536); - t0 = v - c * 65536; - v = t1 + c + 65535; - c = Math.floor(v / 65536); - t1 = v - c * 65536; - v = t2 + c + 65535; - c = Math.floor(v / 65536); - t2 = v - c * 65536; - v = t3 + c + 65535; - c = Math.floor(v / 65536); - t3 = v - c * 65536; - v = t4 + c + 65535; - c = Math.floor(v / 65536); - t4 = v - c * 65536; - v = t5 + c + 65535; - c = Math.floor(v / 65536); - t5 = v - c * 65536; - v = t6 + c + 65535; - c = Math.floor(v / 65536); - t6 = v - c * 65536; - v = t7 + c + 65535; - c = Math.floor(v / 65536); - t7 = v - c * 65536; - v = t8 + c + 65535; - c = Math.floor(v / 65536); - t8 = v - c * 65536; - v = t9 + c + 65535; - c = Math.floor(v / 65536); - t9 = v - c * 65536; - v = t10 + c + 65535; - c = Math.floor(v / 65536); - t10 = v - c * 65536; - v = t11 + c + 65535; - c = Math.floor(v / 65536); - t11 = v - c * 65536; - v = t12 + c + 65535; - c = Math.floor(v / 65536); - t12 = v - c * 65536; - v = t13 + c + 65535; - c = Math.floor(v / 65536); - t13 = v - c * 65536; - v = t14 + c + 65535; - c = Math.floor(v / 65536); - t14 = v - c * 65536; - v = t15 + c + 65535; - c = Math.floor(v / 65536); - t15 = v - c * 65536; - t0 += c - 1 + 37 * (c - 1); - o[0] = t0; - o[1] = t1; - o[2] = t2; - o[3] = t3; - o[4] = t4; - o[5] = t5; - o[6] = t6; - o[7] = t7; - o[8] = t8; - o[9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; - } - function S(o, a) { - M(o, a, a); - } - function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) - c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if (a !== 2 && a !== 4) - M(c, c, i); - } - for (a = 0; a < 16; a++) - o[a] = c[a]; - } - function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) - c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if (a !== 1) - M(c, c, i); - } - for (a = 0; a < 16; a++) - o[a] = c[a]; - } - function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) - z[i] = n[i]; - z[31] = n[31] & 127 | 64; - z[0] &= 248; - unpack25519(x, p); - for (i = 0; i < 16; i++) { - b[i] = x[i]; - d[i] = a[i] = c[i] = 0; - } - a[0] = d[0] = 1; - for (i = 254; i >= 0; --i) { - r = z[i >>> 3] >>> (i & 7) & 1; - sel25519(a, b, r); - sel25519(c, d, r); - A(e, a, c); - Z(a, a, c); - A(c, b, d); - Z(b, b, d); - S(d, e); - S(f, a); - M(a, c, a); - M(c, b, e); - A(e, a, c); - Z(a, a, c); - S(b, a); - Z(c, d, f); - M(a, c, _121665); - A(a, a, d); - M(c, c, a); - M(a, d, f); - M(d, b, x); - S(b, e); - sel25519(a, b, r); - sel25519(c, d, r); - } - for (i = 0; i < 16; i++) { - x[i + 16] = a[i]; - x[i + 32] = c[i]; - x[i + 48] = b[i]; - x[i + 64] = d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32, x32); - M(x16, x16, x32); - pack25519(q, x16); - return 0; - } - function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); - } - function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); - } - function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); - } - var crypto_box_afternm = crypto_secretbox; - var crypto_box_open_afternm = crypto_secretbox_open; - function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); - } - function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); - } - var K = [ - 1116352408, - 3609767458, - 1899447441, - 602891725, - 3049323471, - 3964484399, - 3921009573, - 2173295548, - 961987163, - 4081628472, - 1508970993, - 3053834265, - 2453635748, - 2937671579, - 2870763221, - 3664609560, - 3624381080, - 2734883394, - 310598401, - 1164996542, - 607225278, - 1323610764, - 1426881987, - 3590304994, - 1925078388, - 4068182383, - 2162078206, - 991336113, - 2614888103, - 633803317, - 3248222580, - 3479774868, - 3835390401, - 2666613458, - 4022224774, - 944711139, - 264347078, - 2341262773, - 604807628, - 2007800933, - 770255983, - 1495990901, - 1249150122, - 1856431235, - 1555081692, - 3175218132, - 1996064986, - 2198950837, - 2554220882, - 3999719339, - 2821834349, - 766784016, - 2952996808, - 2566594879, - 3210313671, - 3203337956, - 3336571891, - 1034457026, - 3584528711, - 2466948901, - 113926993, - 3758326383, - 338241895, - 168717936, - 666307205, - 1188179964, - 773529912, - 1546045734, - 1294757372, - 1522805485, - 1396182291, - 2643833823, - 1695183700, - 2343527390, - 1986661051, - 1014477480, - 2177026350, - 1206759142, - 2456956037, - 344077627, - 2730485921, - 1290863460, - 2820302411, - 3158454273, - 3259730800, - 3505952657, - 3345764771, - 106217008, - 3516065817, - 3606008344, - 3600352804, - 1432725776, - 4094571909, - 1467031594, - 275423344, - 851169720, - 430227734, - 3100823752, - 506948616, - 1363258195, - 659060556, - 3750685593, - 883997877, - 3785050280, - 958139571, - 3318307427, - 1322822218, - 3812723403, - 1537002063, - 2003034995, - 1747873779, - 3602036899, - 1955562222, - 1575990012, - 2024104815, - 1125592928, - 2227730452, - 2716904306, - 2361852424, - 442776044, - 2428436474, - 593698344, - 2756734187, - 3733110249, - 3204031479, - 2999351573, - 3329325298, - 3815920427, - 3391569614, - 3928383900, - 3515267271, - 566280711, - 3940187606, - 3454069534, - 4118630271, - 4000239992, - 116418474, - 1914138554, - 174292421, - 2731055270, - 289380356, - 3203993006, - 460393269, - 320620315, - 685471733, - 587496836, - 852142971, - 1086792851, - 1017036298, - 365543100, - 1126000580, - 2618297676, - 1288033470, - 3409855158, - 1501505948, - 4234509866, - 1607167915, - 987167468, - 1816402316, - 1246189591 - ]; - function crypto_hashblocks_hl(hh, hl, m, n) { - var wh = new Int32Array(16), wl = new Int32Array(16), bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, th, tl, i, j, h, l, a, b, c, d; - var ah0 = hh[0], ah1 = hh[1], ah2 = hh[2], ah3 = hh[3], ah4 = hh[4], ah5 = hh[5], ah6 = hh[6], ah7 = hh[7], al0 = hl[0], al1 = hl[1], al2 = hl[2], al3 = hl[3], al4 = hl[4], al5 = hl[5], al6 = hl[6], al7 = hl[7]; - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) { - j = 8 * i + pos; - wh[i] = m[j + 0] << 24 | m[j + 1] << 16 | m[j + 2] << 8 | m[j + 3]; - wl[i] = m[j + 4] << 24 | m[j + 5] << 16 | m[j + 6] << 8 | m[j + 7]; - } - for (i = 0; i < 80; i++) { - bh0 = ah0; - bh1 = ah1; - bh2 = ah2; - bh3 = ah3; - bh4 = ah4; - bh5 = ah5; - bh6 = ah6; - bh7 = ah7; - bl0 = al0; - bl1 = al1; - bl2 = al2; - bl3 = al3; - bl4 = al4; - bl5 = al5; - bl6 = al6; - bl7 = al7; - h = ah7; - l = al7; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = (ah4 >>> 14 | al4 << 32 - 14) ^ (ah4 >>> 18 | al4 << 32 - 18) ^ (al4 >>> 41 - 32 | ah4 << 32 - (41 - 32)); - l = (al4 >>> 14 | ah4 << 32 - 14) ^ (al4 >>> 18 | ah4 << 32 - 18) ^ (ah4 >>> 41 - 32 | al4 << 32 - (41 - 32)); - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - h = ah4 & ah5 ^ ~ah4 & ah6; - l = al4 & al5 ^ ~al4 & al6; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - h = K[i * 2]; - l = K[i * 2 + 1]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - h = wh[i % 16]; - l = wl[i % 16]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - th = c & 65535 | d << 16; - tl = a & 65535 | b << 16; - h = th; - l = tl; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = (ah0 >>> 28 | al0 << 32 - 28) ^ (al0 >>> 34 - 32 | ah0 << 32 - (34 - 32)) ^ (al0 >>> 39 - 32 | ah0 << 32 - (39 - 32)); - l = (al0 >>> 28 | ah0 << 32 - 28) ^ (ah0 >>> 34 - 32 | al0 << 32 - (34 - 32)) ^ (ah0 >>> 39 - 32 | al0 << 32 - (39 - 32)); - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - h = ah0 & ah1 ^ ah0 & ah2 ^ ah1 & ah2; - l = al0 & al1 ^ al0 & al2 ^ al1 & al2; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - bh7 = c & 65535 | d << 16; - bl7 = a & 65535 | b << 16; - h = bh3; - l = bl3; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = th; - l = tl; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - bh3 = c & 65535 | d << 16; - bl3 = a & 65535 | b << 16; - ah1 = bh0; - ah2 = bh1; - ah3 = bh2; - ah4 = bh3; - ah5 = bh4; - ah6 = bh5; - ah7 = bh6; - ah0 = bh7; - al1 = bl0; - al2 = bl1; - al3 = bl2; - al4 = bl3; - al5 = bl4; - al6 = bl5; - al7 = bl6; - al0 = bl7; - if (i % 16 === 15) { - for (j = 0; j < 16; j++) { - h = wh[j]; - l = wl[j]; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = wh[(j + 9) % 16]; - l = wl[(j + 9) % 16]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - th = wh[(j + 1) % 16]; - tl = wl[(j + 1) % 16]; - h = (th >>> 1 | tl << 32 - 1) ^ (th >>> 8 | tl << 32 - 8) ^ th >>> 7; - l = (tl >>> 1 | th << 32 - 1) ^ (tl >>> 8 | th << 32 - 8) ^ (tl >>> 7 | th << 32 - 7); - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - th = wh[(j + 14) % 16]; - tl = wl[(j + 14) % 16]; - h = (th >>> 19 | tl << 32 - 19) ^ (tl >>> 61 - 32 | th << 32 - (61 - 32)) ^ th >>> 6; - l = (tl >>> 19 | th << 32 - 19) ^ (th >>> 61 - 32 | tl << 32 - (61 - 32)) ^ (tl >>> 6 | th << 32 - 6); - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - wh[j] = c & 65535 | d << 16; - wl[j] = a & 65535 | b << 16; - } - } - } - h = ah0; - l = al0; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[0]; - l = hl[0]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[0] = ah0 = c & 65535 | d << 16; - hl[0] = al0 = a & 65535 | b << 16; - h = ah1; - l = al1; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[1]; - l = hl[1]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[1] = ah1 = c & 65535 | d << 16; - hl[1] = al1 = a & 65535 | b << 16; - h = ah2; - l = al2; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[2]; - l = hl[2]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[2] = ah2 = c & 65535 | d << 16; - hl[2] = al2 = a & 65535 | b << 16; - h = ah3; - l = al3; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[3]; - l = hl[3]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[3] = ah3 = c & 65535 | d << 16; - hl[3] = al3 = a & 65535 | b << 16; - h = ah4; - l = al4; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[4]; - l = hl[4]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[4] = ah4 = c & 65535 | d << 16; - hl[4] = al4 = a & 65535 | b << 16; - h = ah5; - l = al5; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[5]; - l = hl[5]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[5] = ah5 = c & 65535 | d << 16; - hl[5] = al5 = a & 65535 | b << 16; - h = ah6; - l = al6; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[6]; - l = hl[6]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[6] = ah6 = c & 65535 | d << 16; - hl[6] = al6 = a & 65535 | b << 16; - h = ah7; - l = al7; - a = l & 65535; - b = l >>> 16; - c = h & 65535; - d = h >>> 16; - h = hh[7]; - l = hl[7]; - a += l & 65535; - b += l >>> 16; - c += h & 65535; - d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - hh[7] = ah7 = c & 65535 | d << 16; - hl[7] = al7 = a & 65535 | b << 16; - pos += 128; - n -= 128; - } - return n; - } - function crypto_hash(out, m, n) { - var hh = new Int32Array(8), hl = new Int32Array(8), x = new Uint8Array(256), i, b = n; - hh[0] = 1779033703; - hh[1] = 3144134277; - hh[2] = 1013904242; - hh[3] = 2773480762; - hh[4] = 1359893119; - hh[5] = 2600822924; - hh[6] = 528734635; - hh[7] = 1541459225; - hl[0] = 4089235720; - hl[1] = 2227873595; - hl[2] = 4271175723; - hl[3] = 1595750129; - hl[4] = 2917565137; - hl[5] = 725511199; - hl[6] = 4215389547; - hl[7] = 327033209; - crypto_hashblocks_hl(hh, hl, m, n); - n %= 128; - for (i = 0; i < n; i++) - x[i] = m[b - n + i]; - x[n] = 128; - n = 256 - 128 * (n < 112 ? 1 : 0); - x[n - 9] = 0; - ts64(x, n - 8, b / 536870912 | 0, b << 3); - crypto_hashblocks_hl(hh, hl, x, n); - for (i = 0; i < 8; i++) - ts64(out, 8 * i, hh[i], hl[i]); - return 0; - } - function add(p, q) { - var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(), g = gf(), h = gf(), t = gf(); - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); - } - function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } - } - function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; - } - function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = s[i / 8 | 0] >> (i & 7) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } - } - function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); - } - function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - if (!seeded) - randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - scalarbase(p, d); - pack(pk, p); - for (i = 0; i < 32; i++) - sk[i + 32] = pk[i]; - return 0; - } - var L = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]); - function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = Math.floor((x[j] + 128) / 256); - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) - x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i + 1] += x[i] >> 8; - r[i] = x[i] & 255; - } - } - function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) - x[i] = r[i]; - for (i = 0; i < 64; i++) - r[i] = 0; - modL(r, x); - } - function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - var smlen = n + 64; - for (i = 0; i < n; i++) - sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) - sm[32 + i] = d[32 + i]; - crypto_hash(r, sm.subarray(32), n + 32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - for (i = 32; i < 64; i++) - sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - for (i = 0; i < 64; i++) - x[i] = 0; - for (i = 0; i < 32; i++) - x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i + j] += h[i] * d[j]; - } - } - modL(sm.subarray(32), x); - return smlen; - } - function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf(); - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) - M(r[0], r[0], I); - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) - return -1; - if (par25519(r[0]) === p[31] >> 7) - Z(r[0], gf0, r[0]); - M(r[3], r[0], r[1]); - return 0; - } - function crypto_sign_open(m, sm, n, pk) { - var i; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], q = [gf(), gf(), gf(), gf()]; - if (n < 64) - return -1; - if (unpackneg(q, pk)) - return -1; - for (i = 0; i < n; i++) - m[i] = sm[i]; - for (i = 0; i < 32; i++) - m[i + 32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) - m[i] = 0; - return -1; - } - for (i = 0; i < n; i++) - m[i] = sm[i + 64]; - return n; - } - var crypto_secretbox_KEYBYTES = 32, crypto_secretbox_NONCEBYTES = 24, crypto_secretbox_ZEROBYTES = 32, crypto_secretbox_BOXZEROBYTES = 16, crypto_scalarmult_BYTES = 32, crypto_scalarmult_SCALARBYTES = 32, crypto_box_PUBLICKEYBYTES = 32, crypto_box_SECRETKEYBYTES = 32, crypto_box_BEFORENMBYTES = 32, crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, crypto_sign_BYTES = 64, crypto_sign_PUBLICKEYBYTES = 32, crypto_sign_SECRETKEYBYTES = 64, crypto_sign_SEEDBYTES = 32, crypto_hash_BYTES = 64; - nacl.lowlevel = { - crypto_core_hsalsa20, - crypto_stream_xor, - crypto_stream, - crypto_stream_salsa20_xor, - crypto_stream_salsa20, - crypto_onetimeauth, - crypto_onetimeauth_verify, - crypto_verify_16, - crypto_verify_32, - crypto_secretbox, - crypto_secretbox_open, - crypto_scalarmult, - crypto_scalarmult_base, - crypto_box_beforenm, - crypto_box_afternm, - crypto_box, - crypto_box_open, - crypto_box_keypair, - crypto_hash, - crypto_sign, - crypto_sign_keypair, - crypto_sign_open, - crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES, - crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES, - crypto_hash_BYTES, - gf, - D, - L, - pack25519, - unpack25519, - M, - A, - S, - Z, - pow2523, - add, - set25519, - modL, - scalarmult, - scalarbase - }; - function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) - throw new Error("bad key size"); - if (n.length !== crypto_secretbox_NONCEBYTES) - throw new Error("bad nonce size"); - } - function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) - throw new Error("bad public key size"); - if (sk.length !== crypto_box_SECRETKEYBYTES) - throw new Error("bad secret key size"); - } - function checkArrayTypes() { - for (var i = 0; i < arguments.length; i++) { - if (!(arguments[i] instanceof Uint8Array)) - throw new TypeError("unexpected type, use Uint8Array"); - } - } - function cleanup(arr) { - for (var i = 0; i < arr.length; i++) - arr[i] = 0; - } - nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; - }; - nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) - m[i + crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); - }; - nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) - c[i + crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) - return null; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) - return null; - return m.subarray(crypto_secretbox_ZEROBYTES); - }; - nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; - nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; - nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) - throw new Error("bad n size"); - if (p.length !== crypto_scalarmult_BYTES) - throw new Error("bad p size"); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; - }; - nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) - throw new Error("bad n size"); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; - }; - nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; - nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); - }; - nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; - }; - nacl.box.after = nacl.secretbox; - nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); - }; - nacl.box.open.after = nacl.secretbox.open; - nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return { publicKey: pk, secretKey: sk }; - }; - nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error("bad secret key size"); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; - }; - nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; - nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; - nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; - nacl.box.nonceLength = crypto_box_NONCEBYTES; - nacl.box.overheadLength = nacl.secretbox.overheadLength; - nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error("bad secret key size"); - var signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; - }; - nacl.sign.open = function(signedMsg, publicKey) { - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error("bad public key size"); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) - return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) - m[i] = tmp[i]; - return m; - }; - nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) - sig[i] = signedMsg[i]; - return sig; - }; - nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error("bad signature size"); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error("bad public key size"); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) - sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) - sm[i + crypto_sign_BYTES] = msg[i]; - return crypto_sign_open(m, sm, sm.length, publicKey) >= 0; - }; - nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return { publicKey: pk, secretKey: sk }; - }; - nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error("bad secret key size"); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) - pk[i] = secretKey[32 + i]; - return { publicKey: pk, secretKey: new Uint8Array(secretKey) }; - }; - nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error("bad seed size"); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) - sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return { publicKey: pk, secretKey: sk }; - }; - nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; - nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; - nacl.sign.seedLength = crypto_sign_SEEDBYTES; - nacl.sign.signatureLength = crypto_sign_BYTES; - nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; - }; - nacl.hash.hashLength = crypto_hash_BYTES; - nacl.verify = function(x, y) { - checkArrayTypes(x, y); - if (x.length === 0 || y.length === 0) - return false; - if (x.length !== y.length) - return false; - return vn(x, 0, y, 0, x.length) === 0 ? true : false; - }; - nacl.setPRNG = function(fn) { - randombytes = fn; - }; - (function() { - var crypto = typeof self !== "undefined" ? self.crypto || self.msCrypto : null; - if (crypto && crypto.getRandomValues) { - var QUOTA = 65536; - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - for (i = 0; i < n; i += QUOTA) { - crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); - } - for (i = 0; i < n; i++) - x[i] = v[i]; - cleanup(v); - }); - } else if (typeof __require !== "undefined") { - crypto = require_crypto(); - if (crypto && crypto.randomBytes) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) - x[i] = v[i]; - cleanup(v); - }); - } - } - })(); - })(typeof module !== "undefined" && module.exports ? module.exports : self.nacl = self.nacl || {}); - } - }); - - // ../../node_modules/util/support/isBufferBrowser.js - var require_isBufferBrowser = __commonJS({ - "../../node_modules/util/support/isBufferBrowser.js"(exports, module) { - module.exports = function isBuffer(arg) { - return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function"; - }; - } - }); - - // ../../node_modules/inherits/inherits_browser.js - var require_inherits_browser = __commonJS({ - "../../node_modules/inherits/inherits_browser.js"(exports, module) { - if (typeof Object.create === "function") { - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; - } else { - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function() { - }; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - }; - } - } - }); - - // ../../node_modules/util/util.js - var require_util2 = __commonJS({ - "../../node_modules/util/util.js"(exports) { - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(" "); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x2) { - if (x2 === "%%") - return "%"; - if (i >= len) - return x2; - switch (x2) { - case "%s": - return String(args[i++]); - case "%d": - return Number(args[i++]); - case "%j": - try { - return JSON.stringify(args[i++]); - } catch (_) { - return "[Circular]"; - } - default: - return x2; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += " " + x; - } else { - str += " " + inspect(x); - } - } - return str; - }; - exports.deprecate = function(fn, msg) { - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - if (process.noDeprecation === true) { - return fn; - } - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - }; - var debugs = {}; - var debugEnviron; - exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ""; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error("%s %d: %s", set, pid, msg); - }; - } else { - debugs[set] = function() { - }; - } - } - return debugs[set]; - }; - function inspect(obj, opts) { - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - if (arguments.length >= 3) - ctx.depth = arguments[2]; - if (arguments.length >= 4) - ctx.colors = arguments[3]; - if (isBoolean(opts)) { - ctx.showHidden = opts; - } else if (opts) { - exports._extend(ctx, opts); - } - if (isUndefined(ctx.showHidden)) - ctx.showHidden = false; - if (isUndefined(ctx.depth)) - ctx.depth = 2; - if (isUndefined(ctx.colors)) - ctx.colors = false; - if (isUndefined(ctx.customInspect)) - ctx.customInspect = true; - if (ctx.colors) - ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - inspect.colors = { - "bold": [1, 22], - "italic": [3, 23], - "underline": [4, 24], - "inverse": [7, 27], - "white": [37, 39], - "grey": [90, 39], - "black": [30, 39], - "blue": [34, 39], - "cyan": [36, 39], - "green": [32, 39], - "magenta": [35, 39], - "red": [31, 39], - "yellow": [33, 39] - }; - inspect.styles = { - "special": "cyan", - "number": "yellow", - "boolean": "yellow", - "undefined": "grey", - "null": "bold", - "string": "green", - "date": "magenta", - "regexp": "red" - }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) { - return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m"; - } else { - return str; - } - } - function stylizeNoColor(str, styleType) { - return str; - } - function arrayToHash(array) { - var hash = {}; - array.forEach(function(val, idx) { - hash[val] = true; - }); - return hash; - } - function formatValue(ctx, value, recurseTimes) { - if (ctx.customInspect && value && isFunction(value.inspect) && value.inspect !== exports.inspect && !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) { - return formatError(value); - } - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ": " + value.name : ""; - return ctx.stylize("[Function" + name + "]", "special"); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), "date"); - } - if (isError(value)) { - return formatError(value); - } - } - var base = "", array = false, braces = ["{", "}"]; - if (isArray(value)) { - array = true; - braces = ["[", "]"]; - } - if (isFunction(value)) { - var n = value.name ? ": " + value.name : ""; - base = " [Function" + n + "]"; - } - if (isRegExp(value)) { - base = " " + RegExp.prototype.toString.call(value); - } - if (isDate(value)) { - base = " " + Date.prototype.toUTCString.call(value); - } - if (isError(value)) { - base = " " + formatError(value); - } - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), "regexp"); - } else { - return ctx.stylize("[Object]", "special"); - } - } - ctx.seen.push(value); - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); - } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize("undefined", "undefined"); - if (isString(value)) { - var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'"; - return ctx.stylize(simple, "string"); - } - if (isNumber(value)) - return ctx.stylize("" + value, "number"); - if (isBoolean(value)) - return ctx.stylize("" + value, "boolean"); - if (isNull(value)) - return ctx.stylize("null", "null"); - } - function formatError(value) { - return "[" + Error.prototype.toString.call(value) + "]"; - } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty( - ctx, - value, - recurseTimes, - visibleKeys, - String(i), - true - )); - } else { - output.push(""); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty( - ctx, - value, - recurseTimes, - visibleKeys, - key, - true - )); - } - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize("[Getter/Setter]", "special"); - } else { - str = ctx.stylize("[Getter]", "special"); - } - } else { - if (desc.set) { - str = ctx.stylize("[Setter]", "special"); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = "[" + key + "]"; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf("\n") > -1) { - if (array) { - str = str.split("\n").map(function(line) { - return " " + line; - }).join("\n").substr(2); - } else { - str = "\n" + str.split("\n").map(function(line) { - return " " + line; - }).join("\n"); - } - } - } else { - str = ctx.stylize("[Circular]", "special"); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify("" + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, "name"); - } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, "string"); - } - } - return name + ": " + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf("\n") >= 0) - numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1; - }, 0); - if (length > 60) { - return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1]; - } - return braces[0] + base + " " + output.join(", ") + " " + braces[1]; - } - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - function isBoolean(arg) { - return typeof arg === "boolean"; - } - exports.isBoolean = isBoolean; - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return typeof arg === "number"; - } - exports.isNumber = isNumber; - function isString(arg) { - return typeof arg === "string"; - } - exports.isString = isString; - function isSymbol(arg) { - return typeof arg === "symbol"; - } - exports.isSymbol = isSymbol; - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && objectToString(re) === "[object RegExp]"; - } - exports.isRegExp = isRegExp; - function isObject(arg) { - return typeof arg === "object" && arg !== null; - } - exports.isObject = isObject; - function isDate(d) { - return isObject(d) && objectToString(d) === "[object Date]"; - } - exports.isDate = isDate; - function isError(e) { - return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error); - } - exports.isError = isError; - function isFunction(arg) { - return typeof arg === "function"; - } - exports.isFunction = isFunction; - function isPrimitive(arg) { - return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || typeof arg === "undefined"; - } - exports.isPrimitive = isPrimitive; - exports.isBuffer = require_isBufferBrowser(); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? "0" + n.toString(10) : n.toString(10); - } - var months = [ - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" - ]; - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(":"); - return [d.getDate(), months[d.getMonth()], time].join(" "); - } - exports.log = function() { - console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments)); - }; - exports.inherits = require_inherits_browser(); - exports._extend = function(origin, add) { - if (!add || !isObject(add)) - return origin; - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; - }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - } - }); - - // ../../node_modules/nkeys.js/lib/helper.js - var require_helper = __commonJS({ - "../../node_modules/nkeys.js/lib/helper.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.getEd25519Helper = exports.setEd25519Helper = void 0; - var helper; - function setEd25519Helper(lib) { - helper = lib; - } - exports.setEd25519Helper = setEd25519Helper; - function getEd25519Helper() { - return helper; - } - exports.getEd25519Helper = getEd25519Helper; - } - }); - - // ../../node_modules/nkeys.js/lib/crc16.js - var require_crc16 = __commonJS({ - "../../node_modules/nkeys.js/lib/crc16.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.crc16 = void 0; - var crc16tab = new Uint16Array([ - 0, - 4129, - 8258, - 12387, - 16516, - 20645, - 24774, - 28903, - 33032, - 37161, - 41290, - 45419, - 49548, - 53677, - 57806, - 61935, - 4657, - 528, - 12915, - 8786, - 21173, - 17044, - 29431, - 25302, - 37689, - 33560, - 45947, - 41818, - 54205, - 50076, - 62463, - 58334, - 9314, - 13379, - 1056, - 5121, - 25830, - 29895, - 17572, - 21637, - 42346, - 46411, - 34088, - 38153, - 58862, - 62927, - 50604, - 54669, - 13907, - 9842, - 5649, - 1584, - 30423, - 26358, - 22165, - 18100, - 46939, - 42874, - 38681, - 34616, - 63455, - 59390, - 55197, - 51132, - 18628, - 22757, - 26758, - 30887, - 2112, - 6241, - 10242, - 14371, - 51660, - 55789, - 59790, - 63919, - 35144, - 39273, - 43274, - 47403, - 23285, - 19156, - 31415, - 27286, - 6769, - 2640, - 14899, - 10770, - 56317, - 52188, - 64447, - 60318, - 39801, - 35672, - 47931, - 43802, - 27814, - 31879, - 19684, - 23749, - 11298, - 15363, - 3168, - 7233, - 60846, - 64911, - 52716, - 56781, - 44330, - 48395, - 36200, - 40265, - 32407, - 28342, - 24277, - 20212, - 15891, - 11826, - 7761, - 3696, - 65439, - 61374, - 57309, - 53244, - 48923, - 44858, - 40793, - 36728, - 37256, - 33193, - 45514, - 41451, - 53516, - 49453, - 61774, - 57711, - 4224, - 161, - 12482, - 8419, - 20484, - 16421, - 28742, - 24679, - 33721, - 37784, - 41979, - 46042, - 49981, - 54044, - 58239, - 62302, - 689, - 4752, - 8947, - 13010, - 16949, - 21012, - 25207, - 29270, - 46570, - 42443, - 38312, - 34185, - 62830, - 58703, - 54572, - 50445, - 13538, - 9411, - 5280, - 1153, - 29798, - 25671, - 21540, - 17413, - 42971, - 47098, - 34713, - 38840, - 59231, - 63358, - 50973, - 55100, - 9939, - 14066, - 1681, - 5808, - 26199, - 30326, - 17941, - 22068, - 55628, - 51565, - 63758, - 59695, - 39368, - 35305, - 47498, - 43435, - 22596, - 18533, - 30726, - 26663, - 6336, - 2273, - 14466, - 10403, - 52093, - 56156, - 60223, - 64286, - 35833, - 39896, - 43963, - 48026, - 19061, - 23124, - 27191, - 31254, - 2801, - 6864, - 10931, - 14994, - 64814, - 60687, - 56684, - 52557, - 48554, - 44427, - 40424, - 36297, - 31782, - 27655, - 23652, - 19525, - 15522, - 11395, - 7392, - 3265, - 61215, - 65342, - 53085, - 57212, - 44955, - 49082, - 36825, - 40952, - 28183, - 32310, - 20053, - 24180, - 11923, - 16050, - 3793, - 7920 - ]); - var crc16 = class { - static checksum(data) { - let crc = 0; - for (let i = 0; i < data.byteLength; i++) { - let b = data[i]; - crc = crc << 8 & 65535 ^ crc16tab[(crc >> 8 ^ b) & 255]; - } - return crc; - } - static validate(data, expected) { - let ba = crc16.checksum(data); - return ba == expected; - } - }; - exports.crc16 = crc16; - } - }); - - // ../../node_modules/nkeys.js/lib/base32.js - var require_base32 = __commonJS({ - "../../node_modules/nkeys.js/lib/base32.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.base32 = void 0; - var b32Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; - var base32 = class { - static encode(src) { - let bits = 0; - let value = 0; - let a = new Uint8Array(src); - let buf = new Uint8Array(src.byteLength * 2); - let j = 0; - for (let i = 0; i < a.byteLength; i++) { - value = value << 8 | a[i]; - bits += 8; - while (bits >= 5) { - let index = value >>> bits - 5 & 31; - buf[j++] = b32Alphabet.charAt(index).charCodeAt(0); - bits -= 5; - } - } - if (bits > 0) { - let index = value << 5 - bits & 31; - buf[j++] = b32Alphabet.charAt(index).charCodeAt(0); - } - return buf.slice(0, j); - } - static decode(src) { - let bits = 0; - let byte = 0; - let j = 0; - let a = new Uint8Array(src); - let out = new Uint8Array(a.byteLength * 5 / 8 | 0); - for (let i = 0; i < a.byteLength; i++) { - let v = String.fromCharCode(a[i]); - let vv = b32Alphabet.indexOf(v); - if (vv === -1) { - throw new Error("Illegal Base32 character: " + a[i]); - } - byte = byte << 5 | vv; - bits += 5; - if (bits >= 8) { - out[j++] = byte >>> bits - 8 & 255; - bits -= 8; - } - } - return out.slice(0, j); - } - }; - exports.base32 = base32; - } - }); - - // ../../node_modules/nkeys.js/lib/codec.js - var require_codec = __commonJS({ - "../../node_modules/nkeys.js/lib/codec.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Codec = void 0; - var crc16_1 = require_crc16(); - var nkeys_1 = require_nkeys(); - var base32_1 = require_base32(); - var Codec = class { - static encode(prefix, src) { - if (!src || !(src instanceof Uint8Array)) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.SerializationError); - } - if (!nkeys_1.Prefixes.isValidPrefix(prefix)) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); - } - return Codec._encode(false, prefix, src); - } - static encodeSeed(role, src) { - if (!src) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ApiError); - } - if (!nkeys_1.Prefixes.isValidPublicPrefix(role)) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); - } - if (src.byteLength !== 32) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidSeedLen); - } - return Codec._encode(true, role, src); - } - static decode(expected, src) { - if (!nkeys_1.Prefixes.isValidPrefix(expected)) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); - } - const raw = Codec._decode(src); - if (raw[0] !== expected) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); - } - return raw.slice(1); - } - static decodeSeed(src) { - const raw = Codec._decode(src); - const prefix = Codec._decodePrefix(raw); - if (prefix[0] != nkeys_1.Prefix.Seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidSeed); - } - if (!nkeys_1.Prefixes.isValidPublicPrefix(prefix[1])) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidPrefixByte); - } - return { buf: raw.slice(2), prefix: prefix[1] }; - } - static _encode(seed, role, payload) { - const payloadOffset = seed ? 2 : 1; - const payloadLen = payload.byteLength; - const checkLen = 2; - const cap = payloadOffset + payloadLen + checkLen; - const checkOffset = payloadOffset + payloadLen; - const raw = new Uint8Array(cap); - if (seed) { - const encodedPrefix = Codec._encodePrefix(nkeys_1.Prefix.Seed, role); - raw.set(encodedPrefix); - } else { - raw[0] = role; - } - raw.set(payload, payloadOffset); - const checksum = crc16_1.crc16.checksum(raw.slice(0, checkOffset)); - const dv = new DataView(raw.buffer); - dv.setUint16(checkOffset, checksum, true); - return base32_1.base32.encode(raw); - } - static _decode(src) { - if (src.byteLength < 4) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidEncoding); - } - let raw; - try { - raw = base32_1.base32.decode(src); - } catch (ex) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidEncoding, ex); - } - const checkOffset = raw.byteLength - 2; - const dv = new DataView(raw.buffer); - const checksum = dv.getUint16(checkOffset, true); - const payload = raw.slice(0, checkOffset); - if (!crc16_1.crc16.validate(payload, checksum)) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.InvalidChecksum); - } - return payload; - } - static _encodePrefix(kind, role) { - const b1 = kind | role >> 5; - const b2 = (role & 31) << 3; - return new Uint8Array([b1, b2]); - } - static _decodePrefix(raw) { - const b1 = raw[0] & 248; - const b2 = (raw[0] & 7) << 5 | (raw[1] & 248) >> 3; - return new Uint8Array([b1, b2]); - } - }; - exports.Codec = Codec; - } - }); - - // ../../node_modules/nkeys.js/lib/kp.js - var require_kp = __commonJS({ - "../../node_modules/nkeys.js/lib/kp.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.KP = void 0; - var codec_1 = require_codec(); - var nkeys_1 = require_nkeys(); - var helper_1 = require_helper(); - var KP = class { - constructor(seed) { - this.seed = seed; - } - getRawSeed() { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - let sd = codec_1.Codec.decodeSeed(this.seed); - return sd.buf; - } - getSeed() { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - return this.seed; - } - getPublicKey() { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - const sd = codec_1.Codec.decodeSeed(this.seed); - const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); - const buf = codec_1.Codec.encode(sd.prefix, kp.publicKey); - return new TextDecoder().decode(buf); - } - getPrivateKey() { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); - return codec_1.Codec.encode(nkeys_1.Prefix.Private, kp.secretKey); - } - sign(input) { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); - return helper_1.getEd25519Helper().sign(input, kp.secretKey); - } - verify(input, sig) { - if (!this.seed) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - const kp = helper_1.getEd25519Helper().fromSeed(this.getRawSeed()); - return helper_1.getEd25519Helper().verify(input, sig, kp.publicKey); - } - clear() { - if (!this.seed) { - return; - } - this.seed.fill(0); - this.seed = void 0; - } - }; - exports.KP = KP; - } - }); - - // ../../node_modules/nkeys.js/lib/public.js - var require_public = __commonJS({ - "../../node_modules/nkeys.js/lib/public.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.PublicKey = void 0; - var codec_1 = require_codec(); - var nkeys_1 = require_nkeys(); - var helper_1 = require_helper(); - var PublicKey = class { - constructor(publicKey) { - this.publicKey = publicKey; - } - getPublicKey() { - if (!this.publicKey) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - return new TextDecoder().decode(this.publicKey); - } - getPrivateKey() { - if (!this.publicKey) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.PublicKeyOnly); - } - getSeed() { - if (!this.publicKey) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.PublicKeyOnly); - } - sign(_) { - if (!this.publicKey) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.CannotSign); - } - verify(input, sig) { - if (!this.publicKey) { - throw new nkeys_1.NKeysError(nkeys_1.NKeysErrorCode.ClearedPair); - } - let buf = codec_1.Codec._decode(this.publicKey); - return helper_1.getEd25519Helper().verify(input, sig, buf.slice(1)); - } - clear() { - if (!this.publicKey) { - return; - } - this.publicKey.fill(0); - this.publicKey = void 0; - } - }; - exports.PublicKey = PublicKey; - } - }); - - // ../../node_modules/nkeys.js/lib/nkeys.js - var require_nkeys = __commonJS({ - "../../node_modules/nkeys.js/lib/nkeys.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NKeysError = exports.NKeysErrorCode = exports.Prefixes = exports.Prefix = exports.fromSeed = exports.fromPublic = exports.createServer = exports.createCluster = exports.createUser = exports.createAccount = exports.createOperator = exports.createPair = void 0; - var kp_1 = require_kp(); - var public_1 = require_public(); - var codec_1 = require_codec(); - var helper_1 = require_helper(); - function createPair(prefix) { - const rawSeed = helper_1.getEd25519Helper().randomBytes(32); - let str = codec_1.Codec.encodeSeed(prefix, new Uint8Array(rawSeed)); - return new kp_1.KP(str); - } - exports.createPair = createPair; - function createOperator() { - return createPair(Prefix.Operator); - } - exports.createOperator = createOperator; - function createAccount() { - return createPair(Prefix.Account); - } - exports.createAccount = createAccount; - function createUser() { - return createPair(Prefix.User); - } - exports.createUser = createUser; - function createCluster() { - return createPair(Prefix.Cluster); - } - exports.createCluster = createCluster; - function createServer() { - return createPair(Prefix.Server); - } - exports.createServer = createServer; - function fromPublic(src) { - const ba = new TextEncoder().encode(src); - const raw = codec_1.Codec._decode(ba); - const prefix = Prefixes.parsePrefix(raw[0]); - if (Prefixes.isValidPublicPrefix(prefix)) { - return new public_1.PublicKey(ba); - } - throw new NKeysError(NKeysErrorCode.InvalidPublicKey); - } - exports.fromPublic = fromPublic; - function fromSeed(src) { - codec_1.Codec.decodeSeed(src); - return new kp_1.KP(src); - } - exports.fromSeed = fromSeed; - var Prefix; - (function(Prefix2) { - Prefix2[Prefix2["Seed"] = 144] = "Seed"; - Prefix2[Prefix2["Private"] = 120] = "Private"; - Prefix2[Prefix2["Operator"] = 112] = "Operator"; - Prefix2[Prefix2["Server"] = 104] = "Server"; - Prefix2[Prefix2["Cluster"] = 16] = "Cluster"; - Prefix2[Prefix2["Account"] = 0] = "Account"; - Prefix2[Prefix2["User"] = 160] = "User"; - })(Prefix = exports.Prefix || (exports.Prefix = {})); - var Prefixes = class { - static isValidPublicPrefix(prefix) { - return prefix == Prefix.Server || prefix == Prefix.Operator || prefix == Prefix.Cluster || prefix == Prefix.Account || prefix == Prefix.User; - } - static startsWithValidPrefix(s) { - let c = s[0]; - return c == "S" || c == "P" || c == "O" || c == "N" || c == "C" || c == "A" || c == "U"; - } - static isValidPrefix(prefix) { - let v = this.parsePrefix(prefix); - return v != -1; - } - static parsePrefix(v) { - switch (v) { - case Prefix.Seed: - return Prefix.Seed; - case Prefix.Private: - return Prefix.Private; - case Prefix.Operator: - return Prefix.Operator; - case Prefix.Server: - return Prefix.Server; - case Prefix.Cluster: - return Prefix.Cluster; - case Prefix.Account: - return Prefix.Account; - case Prefix.User: - return Prefix.User; - default: - return -1; - } - } - }; - exports.Prefixes = Prefixes; - var NKeysErrorCode; - (function(NKeysErrorCode2) { - NKeysErrorCode2["InvalidPrefixByte"] = "nkeys: invalid prefix byte"; - NKeysErrorCode2["InvalidKey"] = "nkeys: invalid key"; - NKeysErrorCode2["InvalidPublicKey"] = "nkeys: invalid public key"; - NKeysErrorCode2["InvalidSeedLen"] = "nkeys: invalid seed length"; - NKeysErrorCode2["InvalidSeed"] = "nkeys: invalid seed"; - NKeysErrorCode2["InvalidEncoding"] = "nkeys: invalid encoded key"; - NKeysErrorCode2["InvalidSignature"] = "nkeys: signature verification failed"; - NKeysErrorCode2["CannotSign"] = "nkeys: cannot sign, no private key available"; - NKeysErrorCode2["PublicKeyOnly"] = "nkeys: no seed or private key available"; - NKeysErrorCode2["InvalidChecksum"] = "nkeys: invalid checksum"; - NKeysErrorCode2["SerializationError"] = "nkeys: serialization error"; - NKeysErrorCode2["ApiError"] = "nkeys: api error"; - NKeysErrorCode2["ClearedPair"] = "nkeys: pair is cleared"; - })(NKeysErrorCode = exports.NKeysErrorCode || (exports.NKeysErrorCode = {})); - var NKeysError = class extends Error { - constructor(code, chainedError) { - super(code); - this.name = "NKeysError"; - this.code = code; - this.chainedError = chainedError; - } - }; - exports.NKeysError = NKeysError; - } - }); - - // ../../node_modules/nkeys.js/lib/util.js - var require_util3 = __commonJS({ - "../../node_modules/nkeys.js/lib/util.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.dump = exports.decode = exports.encode = void 0; - function encode(bytes) { - return btoa(String.fromCharCode(...bytes)); - } - exports.encode = encode; - function decode(b64str) { - const bin = atob(b64str); - const bytes = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; i++) { - bytes[i] = bin.charCodeAt(i); - } - return bytes; - } - exports.decode = decode; - function dump(buf, msg) { - if (msg) { - console.log(msg); - } - let a = []; - for (let i = 0; i < buf.byteLength; i++) { - if (i % 8 === 0) { - a.push("\n"); - } - let v = buf[i].toString(16); - if (v.length === 1) { - v = "0" + v; - } - a.push(v); - } - console.log(a.join(" ")); - } - exports.dump = dump; - } - }); - - // ../../node_modules/nkeys.js/lib/mod.js - var require_mod = __commonJS({ - "../../node_modules/nkeys.js/lib/mod.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.encode = exports.decode = exports.Prefix = exports.NKeysErrorCode = exports.NKeysError = exports.fromSeed = exports.fromPublic = exports.createUser = exports.createPair = exports.createOperator = exports.createAccount = void 0; - var nkeys_1 = require_nkeys(); - Object.defineProperty(exports, "createAccount", { enumerable: true, get: function() { - return nkeys_1.createAccount; - } }); - Object.defineProperty(exports, "createOperator", { enumerable: true, get: function() { - return nkeys_1.createOperator; - } }); - Object.defineProperty(exports, "createPair", { enumerable: true, get: function() { - return nkeys_1.createPair; - } }); - Object.defineProperty(exports, "createUser", { enumerable: true, get: function() { - return nkeys_1.createUser; - } }); - Object.defineProperty(exports, "fromPublic", { enumerable: true, get: function() { - return nkeys_1.fromPublic; - } }); - Object.defineProperty(exports, "fromSeed", { enumerable: true, get: function() { - return nkeys_1.fromSeed; - } }); - Object.defineProperty(exports, "NKeysError", { enumerable: true, get: function() { - return nkeys_1.NKeysError; - } }); - Object.defineProperty(exports, "NKeysErrorCode", { enumerable: true, get: function() { - return nkeys_1.NKeysErrorCode; - } }); - Object.defineProperty(exports, "Prefix", { enumerable: true, get: function() { - return nkeys_1.Prefix; - } }); - var util_1 = require_util3(); - Object.defineProperty(exports, "decode", { enumerable: true, get: function() { - return util_1.decode; - } }); - Object.defineProperty(exports, "encode", { enumerable: true, get: function() { - return util_1.encode; - } }); - } - }); - - // ../../node_modules/nkeys.js/lib/index.js - var require_lib = __commonJS({ - "../../node_modules/nkeys.js/lib/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - var nacl = require_nacl_fast(); - var helper = { - randomBytes: nacl.randomBytes, - verify: nacl.sign.detached.verify, - fromSeed: nacl.sign.keyPair.fromSeed, - sign: nacl.sign.detached - }; - if (typeof TextEncoder === "undefined") { - const util = require_util2(); - global.TextEncoder = util.TextEncoder; - global.TextDecoder = util.TextDecoder; - } - if (typeof atob === "undefined") { - global.atob = (a) => { - return Buffer.from(a, "base64").toString("binary"); - }; - global.btoa = (b) => { - return Buffer.from(b, "binary").toString("base64"); - }; - } - var { setEd25519Helper } = require_helper(); - setEd25519Helper(helper); - __exportStar(require_mod(), exports); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/nkeys.js - var require_nkeys2 = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/nkeys.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.nkeys = void 0; - exports.nkeys = require_lib(); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/mod.js - var require_mod2 = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/mod.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.toJsMsg = exports.StringCodec = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.nuid = exports.Nuid = exports.nkeyAuthenticator = exports.NatsError = exports.nanos = exports.millis = exports.Match = exports.jwtAuthenticator = exports.JSONCodec = exports.JsHeaders = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.headers = exports.Events = exports.ErrorCode = exports.Empty = exports.DiscardPolicy = exports.DeliverPolicy = exports.DebugEvents = exports.credsAuthenticator = exports.createInbox = exports.consumerOpts = exports.canonicalMIMEHeaderKey = exports.Bench = exports.AdvisoryKind = exports.AckPolicy = void 0; - var internal_mod_1 = require_internal_mod(); - Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function() { - return internal_mod_1.AckPolicy; - } }); - Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function() { - return internal_mod_1.AdvisoryKind; - } }); - Object.defineProperty(exports, "Bench", { enumerable: true, get: function() { - return internal_mod_1.Bench; - } }); - Object.defineProperty(exports, "canonicalMIMEHeaderKey", { enumerable: true, get: function() { - return internal_mod_1.canonicalMIMEHeaderKey; - } }); - Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function() { - return internal_mod_1.consumerOpts; - } }); - Object.defineProperty(exports, "createInbox", { enumerable: true, get: function() { - return internal_mod_1.createInbox; - } }); - Object.defineProperty(exports, "credsAuthenticator", { enumerable: true, get: function() { - return internal_mod_1.credsAuthenticator; - } }); - Object.defineProperty(exports, "DebugEvents", { enumerable: true, get: function() { - return internal_mod_1.DebugEvents; - } }); - Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function() { - return internal_mod_1.DeliverPolicy; - } }); - Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function() { - return internal_mod_1.DiscardPolicy; - } }); - Object.defineProperty(exports, "Empty", { enumerable: true, get: function() { - return internal_mod_1.Empty; - } }); - Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function() { - return internal_mod_1.ErrorCode; - } }); - Object.defineProperty(exports, "Events", { enumerable: true, get: function() { - return internal_mod_1.Events; - } }); - Object.defineProperty(exports, "headers", { enumerable: true, get: function() { - return internal_mod_1.headers; - } }); - Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function() { - return internal_mod_1.isFlowControlMsg; - } }); - Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function() { - return internal_mod_1.isHeartbeatMsg; - } }); - Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function() { - return internal_mod_1.JsHeaders; - } }); - Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function() { - return internal_mod_1.JSONCodec; - } }); - Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function() { - return internal_mod_1.jwtAuthenticator; - } }); - Object.defineProperty(exports, "Match", { enumerable: true, get: function() { - return internal_mod_1.Match; - } }); - Object.defineProperty(exports, "millis", { enumerable: true, get: function() { - return internal_mod_1.millis; - } }); - Object.defineProperty(exports, "nanos", { enumerable: true, get: function() { - return internal_mod_1.nanos; - } }); - Object.defineProperty(exports, "NatsError", { enumerable: true, get: function() { - return internal_mod_1.NatsError; - } }); - Object.defineProperty(exports, "nkeyAuthenticator", { enumerable: true, get: function() { - return internal_mod_1.nkeyAuthenticator; - } }); - Object.defineProperty(exports, "Nuid", { enumerable: true, get: function() { - return internal_mod_1.Nuid; - } }); - Object.defineProperty(exports, "nuid", { enumerable: true, get: function() { - return internal_mod_1.nuid; - } }); - Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function() { - return internal_mod_1.ReplayPolicy; - } }); - Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function() { - return internal_mod_1.RetentionPolicy; - } }); - Object.defineProperty(exports, "StorageType", { enumerable: true, get: function() { - return internal_mod_1.StorageType; - } }); - Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function() { - return internal_mod_1.StringCodec; - } }); - Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function() { - return internal_mod_1.toJsMsg; - } }); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/authenticator.js - var require_authenticator = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/authenticator.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.credsAuthenticator = exports.jwtAuthenticator = exports.nkeyAuthenticator = exports.noAuthFn = exports.buildAuthenticator = void 0; - var nkeys_1 = require_nkeys2(); - var mod_1 = require_mod2(); - var encoders_1 = require_encoders(); - function buildAuthenticator(opts) { - if (opts.authenticator) { - return opts.authenticator; - } - if (opts.token) { - return tokenFn(opts.token); - } - if (opts.user) { - return passFn(opts.user, opts.pass); - } - return noAuthFn(); - } - exports.buildAuthenticator = buildAuthenticator; - function noAuthFn() { - return () => { - return; - }; - } - exports.noAuthFn = noAuthFn; - function passFn(user, pass) { - return () => { - return { user, pass }; - }; - } - function tokenFn(token) { - return () => { - return { auth_token: token }; - }; - } - function nkeyAuthenticator(seed) { - return (nonce) => { - seed = typeof seed === "function" ? seed() : seed; - const kp = seed ? nkeys_1.nkeys.fromSeed(seed) : void 0; - const nkey = kp ? kp.getPublicKey() : ""; - const challenge = encoders_1.TE.encode(nonce || ""); - const sigBytes = kp !== void 0 && nonce ? kp.sign(challenge) : void 0; - const sig = sigBytes ? nkeys_1.nkeys.encode(sigBytes) : ""; - return { nkey, sig }; - }; - } - exports.nkeyAuthenticator = nkeyAuthenticator; - function jwtAuthenticator(ajwt, seed) { - return (nonce) => { - const jwt = typeof ajwt === "function" ? ajwt() : ajwt; - const fn = nkeyAuthenticator(seed); - const { nkey, sig } = fn(nonce); - return { jwt, nkey, sig }; - }; - } - exports.jwtAuthenticator = jwtAuthenticator; - function credsAuthenticator(creds) { - const CREDS = /\s*(?:(?:[-]{3,}[^\n]*[-]{3,}\n)(.+)(?:\n\s*[-]{3,}[^\n]*[-]{3,}\n))/ig; - const s = encoders_1.TD.decode(creds); - let m = CREDS.exec(s); - if (!m) { - throw mod_1.NatsError.errorForCode(mod_1.ErrorCode.BadCreds); - } - const jwt = m[1].trim(); - m = CREDS.exec(s); - if (!m) { - throw mod_1.NatsError.errorForCode(mod_1.ErrorCode.BadCreds); - } - const seed = encoders_1.TE.encode(m[1].trim()); - return jwtAuthenticator(jwt, seed); - } - exports.credsAuthenticator = credsAuthenticator; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/options.js - var require_options = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/options.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.checkUnsupportedOption = exports.checkOptions = exports.parseOptions = exports.defaultOptions = void 0; - var util_1 = require_util(); - var error_1 = require_error(); - var types_1 = require_types(); - var authenticator_1 = require_authenticator(); - var transport_1 = require_transport(); - var mod_1 = require_mod2(); - function defaultOptions() { - return { - maxPingOut: types_1.DEFAULT_MAX_PING_OUT, - maxReconnectAttempts: types_1.DEFAULT_MAX_RECONNECT_ATTEMPTS, - noRandomize: false, - pedantic: false, - pingInterval: types_1.DEFAULT_PING_INTERVAL, - reconnect: true, - reconnectJitter: types_1.DEFAULT_JITTER, - reconnectJitterTLS: types_1.DEFAULT_JITTER_TLS, - reconnectTimeWait: types_1.DEFAULT_RECONNECT_TIME_WAIT, - tls: void 0, - verbose: false, - waitOnFirstConnect: false - }; - } - exports.defaultOptions = defaultOptions; - function parseOptions(opts) { - const dhp = `${types_1.DEFAULT_HOST}:${transport_1.defaultPort()}`; - opts = opts || { servers: [dhp] }; - if (opts.port) { - opts.servers = [`${types_1.DEFAULT_HOST}:${opts.port}`]; - } - if (typeof opts.servers === "string") { - opts.servers = [opts.servers]; - } - if (opts.servers && opts.servers.length === 0) { - opts.servers = [dhp]; - } - const options = util_1.extend(defaultOptions(), opts); - if (opts.user && opts.token) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication); - } - if (opts.authenticator && (opts.token || opts.user || opts.pass)) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadAuthentication); - } - options.authenticator = authenticator_1.buildAuthenticator(options); - ["reconnectDelayHandler", "authenticator"].forEach((n) => { - if (options[n] && typeof options[n] !== "function") { - throw new error_1.NatsError(`${n} option should be a function`, error_1.ErrorCode.NotFunction); - } - }); - if (!options.reconnectDelayHandler) { - options.reconnectDelayHandler = () => { - let extra = options.tls ? options.reconnectJitterTLS : options.reconnectJitter; - if (extra) { - extra++; - extra = Math.floor(Math.random() * extra); - } - return options.reconnectTimeWait + extra; - }; - } - if (options.inboxPrefix) { - try { - mod_1.createInbox(options.inboxPrefix); - } catch (err) { - throw new error_1.NatsError(err.message, error_1.ErrorCode.ApiError); - } - } - return options; - } - exports.parseOptions = parseOptions; - function checkOptions(info, options) { - const { proto, tls_required: tlsRequired } = info; - if ((proto === void 0 || proto < 1) && options.noEcho) { - throw new error_1.NatsError("noEcho", error_1.ErrorCode.ServerOptionNotAvailable); - } - if (options.tls && !tlsRequired) { - throw new error_1.NatsError("tls", error_1.ErrorCode.ServerOptionNotAvailable); - } - } - exports.checkOptions = checkOptions; - function checkUnsupportedOption(prop, v) { - if (v) { - throw new error_1.NatsError(prop, error_1.ErrorCode.InvalidOption); - } - } - exports.checkUnsupportedOption = checkUnsupportedOption; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/request.js - var require_request = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/request.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Request = void 0; - var util_1 = require_util(); - var error_1 = require_error(); - var nuid_1 = require_nuid(); - var Request = class { - constructor(mux, opts = { timeout: 1e3 }) { - this.mux = mux; - this.received = 0; - this.deferred = util_1.deferred(); - this.token = nuid_1.nuid.next(); - util_1.extend(this, opts); - this.timer = util_1.timeout(opts.timeout); - } - resolver(err, msg) { - if (this.timer) { - this.timer.cancel(); - } - if (err) { - this.deferred.reject(err); - } else { - this.deferred.resolve(msg); - } - this.cancel(); - } - cancel(err) { - if (this.timer) { - this.timer.cancel(); - } - this.mux.cancel(this); - this.deferred.reject(err ? err : error_1.NatsError.errorForCode(error_1.ErrorCode.Cancelled)); - } - }; - exports.Request = Request; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/codec.js - var require_codec2 = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/codec.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.JSONCodec = exports.StringCodec = void 0; - var error_1 = require_error(); - var encoders_1 = require_encoders(); - function StringCodec() { - return { - encode(d) { - return encoders_1.TE.encode(d); - }, - decode(a) { - return encoders_1.TD.decode(a); - } - }; - } - exports.StringCodec = StringCodec; - function JSONCodec() { - return { - encode(d) { - try { - if (d === void 0) { - d = null; - } - return encoders_1.TE.encode(JSON.stringify(d)); - } catch (err) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadJson, err); - } - }, - decode(a) { - try { - return JSON.parse(encoders_1.TD.decode(a)); - } catch (err) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadJson, err); - } - } - }; - } - exports.JSONCodec = JSONCodec; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsutil.js - var require_jsutil = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsutil.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.checkJsErrorCode = exports.checkJsError = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.millis = exports.nanos = exports.defaultConsumer = exports.validateName = exports.validateStreamName = exports.validateDurableName = void 0; - var types_1 = require_types(); - var error_1 = require_error(); - function validateDurableName(name) { - return validateName("durable", name); - } - exports.validateDurableName = validateDurableName; - function validateStreamName(name) { - return validateName("stream", name); - } - exports.validateStreamName = validateStreamName; - function validateName(context, name = "") { - if (name === "") { - throw Error(`${context} name required`); - } - const bad = [".", "*", ">"]; - bad.forEach((v) => { - if (name.indexOf(v) !== -1) { - throw Error(`invalid ${context} name - ${context} name cannot contain '${v}'`); - } - }); - } - exports.validateName = validateName; - function defaultConsumer(name, opts = {}) { - return Object.assign({ - name, - deliver_policy: types_1.DeliverPolicy.All, - ack_policy: types_1.AckPolicy.Explicit, - ack_wait: nanos(30 * 1e3), - replay_policy: types_1.ReplayPolicy.Instant - }, opts); - } - exports.defaultConsumer = defaultConsumer; - function nanos(millis2) { - return millis2 * 1e6; - } - exports.nanos = nanos; - function millis(ns) { - return ns / 1e6; - } - exports.millis = millis; - function isFlowControlMsg(msg) { - const h = msg.headers; - if (!h) { - return false; - } - return h.code >= 100 && h.code < 200; - } - exports.isFlowControlMsg = isFlowControlMsg; - function isHeartbeatMsg(msg) { - var _a; - return isFlowControlMsg(msg) && ((_a = msg.headers) === null || _a === void 0 ? void 0 : _a.description) === "Idle Heartbeat"; - } - exports.isHeartbeatMsg = isHeartbeatMsg; - function checkJsError(msg) { - const h = msg.headers; - if (!h) { - return null; - } - return checkJsErrorCode(h.code, h.status); - } - exports.checkJsError = checkJsError; - function checkJsErrorCode(code, description = "") { - if (code < 300) { - return null; - } - description = description.toLowerCase(); - switch (code) { - case 503: - return error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamNotEnabled, new Error(description)); - default: - if (description === "") { - description = error_1.ErrorCode.Unknown; - } - return new error_1.NatsError(description, `${code}`); - } - } - exports.checkJsErrorCode = checkJsErrorCode; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsbaseclient_api.js - var require_jsbaseclient_api = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsbaseclient_api.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.BaseApiClient = exports.defaultJsOptions = void 0; - var types_1 = require_types(); - var codec_1 = require_codec2(); - var util_1 = require_util(); - var jsutil_1 = require_jsutil(); - var defaultPrefix = "$JS.API"; - var defaultTimeout = 5e3; - function defaultJsOptions(opts) { - opts = opts || {}; - if (opts.domain) { - opts.apiPrefix = `$JS.${opts.domain}.API`; - delete opts.domain; - } - return util_1.extend({ apiPrefix: defaultPrefix, timeout: defaultTimeout }, opts); - } - exports.defaultJsOptions = defaultJsOptions; - var BaseApiClient = class { - constructor(nc, opts) { - this.nc = nc; - this.opts = defaultJsOptions(opts); - this._parseOpts(); - this.prefix = this.opts.apiPrefix; - this.timeout = this.opts.timeout; - this.jc = codec_1.JSONCodec(); - } - _parseOpts() { - let prefix = this.opts.apiPrefix; - if (!prefix || prefix.length === 0) { - throw new Error("invalid empty prefix"); - } - const c = prefix[prefix.length - 1]; - if (c === ".") { - prefix = prefix.substr(0, prefix.length - 1); - } - this.opts.apiPrefix = prefix; - } - _request(subj, data = null, opts) { - return __awaiter(this, void 0, void 0, function* () { - opts = opts || {}; - opts.timeout = this.timeout; - let a = types_1.Empty; - if (data) { - a = this.jc.encode(data); - } - const m = yield this.nc.request(subj, a, opts); - return this.parseJsResponse(m); - }); - } - findStream(subject) { - return __awaiter(this, void 0, void 0, function* () { - const q = { subject }; - const r = yield this._request(`${this.prefix}.STREAM.NAMES`, q); - const names = r; - if (!names.streams || names.streams.length !== 1) { - throw new Error("no stream matches subject"); - } - return names.streams[0]; - }); - } - parseJsResponse(m) { - const v = this.jc.decode(m.data); - const r = v; - if (r.error) { - const err = jsutil_1.checkJsErrorCode(r.error.code, r.error.description); - if (err !== null) { - throw err; - } - } - return v; - } - }; - exports.BaseApiClient = BaseApiClient; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jslister.js - var require_jslister = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jslister.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __await = exports && exports.__await || function(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function verb(n) { - if (g[n]) - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); - }); - }; - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); - } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) - resume(q[0][0], q[0][1]); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ListerImpl = void 0; - var ListerImpl = class { - constructor(subject, filter, jsm) { - if (!subject) { - throw new Error("subject is required"); - } - this.subject = subject; - this.jsm = jsm; - this.offset = 0; - this.pageInfo = {}; - this.filter = filter; - } - next() { - return __awaiter(this, void 0, void 0, function* () { - if (this.err) { - return []; - } - if (this.pageInfo && this.offset >= this.pageInfo.total) { - return []; - } - const offset = { offset: this.offset }; - try { - const r = yield this.jsm._request(this.subject, offset, { timeout: this.jsm.timeout }); - this.pageInfo = r; - const a = this.filter(r); - this.offset += a.length; - return a; - } catch (err) { - this.err = err; - throw err; - } - }); - } - [Symbol.asyncIterator]() { - return __asyncGenerator(this, arguments, function* _a() { - let page = yield __await(this.next()); - while (page.length > 0) { - for (const item of page) { - yield yield __await(item); - } - page = yield __await(this.next()); - } - }); - } - }; - exports.ListerImpl = ListerImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsstream_api.js - var require_jsstream_api = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsstream_api.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.StoredMsgImpl = exports.StreamAPIImpl = void 0; - var types_1 = require_types(); - var jsbaseclient_api_1 = require_jsbaseclient_api(); - var jslister_1 = require_jslister(); - var jsutil_1 = require_jsutil(); - var headers_1 = require_headers(); - var StreamAPIImpl = class extends jsbaseclient_api_1.BaseApiClient { - constructor(nc, opts) { - super(nc, opts); - } - add(cfg = {}) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(cfg.name); - const r = yield this._request(`${this.prefix}.STREAM.CREATE.${cfg.name}`, cfg); - return r; - }); - } - delete(stream) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - const r = yield this._request(`${this.prefix}.STREAM.DELETE.${stream}`); - const cr = r; - return cr.success; - }); - } - update(cfg = {}) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(cfg.name); - const r = yield this._request(`${this.prefix}.STREAM.UPDATE.${cfg.name}`, cfg); - return r; - }); - } - info(name, data) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(name); - const r = yield this._request(`${this.prefix}.STREAM.INFO.${name}`, data); - return r; - }); - } - list() { - const filter = (v) => { - const slr = v; - return slr.streams; - }; - const subj = `${this.prefix}.STREAM.LIST`; - return new jslister_1.ListerImpl(subj, filter, this); - } - purge(name, opts) { - return __awaiter(this, void 0, void 0, function* () { - if (opts) { - const { keep, seq } = opts; - if (typeof keep === "number" && typeof seq === "number") { - throw new Error("can specify one of keep or seq"); - } - } - jsutil_1.validateStreamName(name); - const v = yield this._request(`${this.prefix}.STREAM.PURGE.${name}`, opts); - return v; - }); - } - deleteMessage(stream, seq, erase = true) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - const dr = { seq }; - if (!erase) { - dr.no_erase = true; - } - const r = yield this._request(`${this.prefix}.STREAM.MSG.DELETE.${stream}`, dr); - const cr = r; - return cr.success; - }); - } - getMessage(stream, query) { - return __awaiter(this, void 0, void 0, function* () { - if (typeof query === "number") { - console.log(`\x1B[33m [WARN] jsm.getMessage(number) is deprecated and will be removed on release - use \`{seq: number}\` as an argument \x1B[0m`); - query = { seq: query }; - } - jsutil_1.validateStreamName(stream); - const r = yield this._request(`${this.prefix}.STREAM.MSG.GET.${stream}`, query); - const sm = r; - return new StoredMsgImpl(sm); - }); - } - find(subject) { - return this.findStream(subject); - } - }; - exports.StreamAPIImpl = StreamAPIImpl; - var StoredMsgImpl = class { - constructor(smr) { - this.subject = smr.message.subject; - this.seq = smr.message.seq; - this.time = new Date(smr.message.time); - this.data = smr.message.data ? this._parse(smr.message.data) : types_1.Empty; - if (smr.message.hdrs) { - const hd = this._parse(smr.message.hdrs); - this.header = headers_1.MsgHdrsImpl.decode(hd); - } else { - this.header = headers_1.headers(); - } - } - _parse(s) { - const bs = atob(s); - const len = bs.length; - const bytes = new Uint8Array(len); - for (let i = 0; i < len; i++) { - bytes[i] = bs.charCodeAt(i); - } - return bytes; - } - }; - exports.StoredMsgImpl = StoredMsgImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsconsumer_api.js - var require_jsconsumer_api = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsconsumer_api.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.ConsumerAPIImpl = void 0; - var jsbaseclient_api_1 = require_jsbaseclient_api(); - var jslister_1 = require_jslister(); - var jsutil_1 = require_jsutil(); - var ConsumerAPIImpl = class extends jsbaseclient_api_1.BaseApiClient { - constructor(nc, opts) { - super(nc, opts); - } - add(stream, cfg) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - const cr = {}; - cr.config = cfg; - cr.stream_name = stream; - if (cr.config.durable_name) { - jsutil_1.validateDurableName(cr.config.durable_name); - } - const subj = cfg.durable_name ? `${this.prefix}.CONSUMER.DURABLE.CREATE.${stream}.${cfg.durable_name}` : `${this.prefix}.CONSUMER.CREATE.${stream}`; - const r = yield this._request(subj, cr); - return r; - }); - } - info(stream, name) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - jsutil_1.validateDurableName(name); - const r = yield this._request(`${this.prefix}.CONSUMER.INFO.${stream}.${name}`); - return r; - }); - } - delete(stream, name) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - jsutil_1.validateDurableName(name); - const r = yield this._request(`${this.prefix}.CONSUMER.DELETE.${stream}.${name}`); - const cr = r; - return cr.success; - }); - } - list(stream) { - jsutil_1.validateStreamName(stream); - const filter = (v) => { - const clr = v; - return clr.consumers; - }; - const subj = `${this.prefix}.CONSUMER.LIST.${stream}`; - return new jslister_1.ListerImpl(subj, filter, this); - } - }; - exports.ConsumerAPIImpl = ConsumerAPIImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsm.js - var require_jsm = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsm.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.JetStreamManagerImpl = void 0; - var jsbaseclient_api_1 = require_jsbaseclient_api(); - var jsstream_api_1 = require_jsstream_api(); - var jsconsumer_api_1 = require_jsconsumer_api(); - var queued_iterator_1 = require_queued_iterator(); - var JetStreamManagerImpl = class extends jsbaseclient_api_1.BaseApiClient { - constructor(nc, opts) { - super(nc, opts); - this.streams = new jsstream_api_1.StreamAPIImpl(nc, opts); - this.consumers = new jsconsumer_api_1.ConsumerAPIImpl(nc, opts); - } - getAccountInfo() { - return __awaiter(this, void 0, void 0, function* () { - const r = yield this._request(`${this.prefix}.INFO`); - return r; - }); - } - advisories() { - const iter = new queued_iterator_1.QueuedIteratorImpl(); - this.nc.subscribe(`$JS.EVENT.ADVISORY.>`, { - callback: (err, msg) => { - if (err) { - throw err; - } - try { - const d = this.parseJsResponse(msg); - const chunks = d.type.split("."); - const kind = chunks[chunks.length - 1]; - iter.push({ kind, data: d }); - } catch (err2) { - iter.stop(err2); - } - } - }); - return iter; - } - }; - exports.JetStreamManagerImpl = JetStreamManagerImpl; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsmsg.js - var require_jsmsg = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsmsg.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.parseInfo = exports.toJsMsg = exports.ACK = void 0; - var databuffer_1 = require_databuffer(); - var codec_1 = require_codec2(); - var request_1 = require_request(); - exports.ACK = Uint8Array.of(43, 65, 67, 75); - var NAK = Uint8Array.of(45, 78, 65, 75); - var WPI = Uint8Array.of(43, 87, 80, 73); - var NXT = Uint8Array.of(43, 78, 88, 84); - var TERM = Uint8Array.of(43, 84, 69, 82, 77); - var SPACE = Uint8Array.of(32); - function toJsMsg(m) { - return new JsMsgImpl(m); - } - exports.toJsMsg = toJsMsg; - function parseInfo(s) { - const tokens = s.split("."); - if (tokens.length !== 9 && tokens[0] !== "$JS" && tokens[1] !== "ACK") { - throw new Error(`not js message`); - } - const di = {}; - di.stream = tokens[2]; - di.consumer = tokens[3]; - di.redeliveryCount = parseInt(tokens[4], 10); - di.streamSequence = parseInt(tokens[5], 10); - di.deliverySequence = parseInt(tokens[6], 10); - di.timestampNanos = parseInt(tokens[7], 10); - di.pending = parseInt(tokens[8], 10); - return di; - } - exports.parseInfo = parseInfo; - var JsMsgImpl = class { - constructor(msg) { - this.msg = msg; - this.didAck = false; - } - get subject() { - return this.msg.subject; - } - get sid() { - return this.msg.sid; - } - get data() { - return this.msg.data; - } - get headers() { - return this.msg.headers; - } - get info() { - if (!this.di) { - this.di = parseInfo(this.reply); - } - return this.di; - } - get redelivered() { - return this.info.redeliveryCount > 1; - } - get reply() { - return this.msg.reply || ""; - } - get seq() { - return this.info.streamSequence; - } - doAck(payload) { - if (!this.didAck) { - this.didAck = !this.isWIP(payload); - this.msg.respond(payload); - } - } - isWIP(p) { - return p.length === 4 && p[0] === WPI[0] && p[1] === WPI[1] && p[2] === WPI[2] && p[3] === WPI[3]; - } - ackAck() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.didAck) { - this.didAck = true; - if (this.msg.reply) { - const mi = this.msg; - const proto = mi.publisher; - const r = new request_1.Request(proto.muxSubscriptions); - proto.request(r); - try { - proto.publish(this.msg.reply, exports.ACK, { - reply: `${proto.muxSubscriptions.baseInbox}${r.token}` - }); - } catch (err) { - r.cancel(err); - } - try { - yield Promise.race([r.timer, r.deferred]); - return true; - } catch (err) { - r.cancel(err); - } - } - } - return false; - }); - } - ack() { - this.doAck(exports.ACK); - } - nak() { - this.doAck(NAK); - } - working() { - this.doAck(WPI); - } - next(subj, ro) { - let payload = NXT; - if (ro) { - const data = codec_1.JSONCodec().encode(ro); - payload = databuffer_1.DataBuffer.concat(NXT, SPACE, data); - } - const opts = subj ? { reply: subj } : void 0; - this.msg.respond(payload, opts); - } - term() { - this.doAck(TERM); - } - }; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/typedsub.js - var require_typedsub = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/typedsub.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.TypedSubscription = exports.checkFn = void 0; - var util_1 = require_util(); - var queued_iterator_1 = require_queued_iterator(); - var error_1 = require_error(); - function checkFn(fn, name, required = false) { - if (required === true && !fn) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ApiError, new Error(`${name} is not a function`)); - } - if (fn && typeof fn !== "function") { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ApiError, new Error(`${name} is not a function`)); - } - } - exports.checkFn = checkFn; - var TypedSubscription = class extends queued_iterator_1.QueuedIteratorImpl { - constructor(nc, subject, opts) { - super(); - checkFn(opts.adapter, "adapter", true); - this.adapter = opts.adapter; - if (opts.callback) { - checkFn(opts.callback, "callback"); - } - this.noIterator = typeof opts.callback === "function"; - if (opts.dispatchedFn) { - checkFn(opts.dispatchedFn, "dispatchedFn"); - this.dispatchedFn = opts.dispatchedFn; - } - if (opts.cleanupFn) { - checkFn(opts.cleanupFn, "cleanupFn"); - } - let callback = (err, msg) => { - this.callback(err, msg); - }; - if (opts.callback) { - const uh = opts.callback; - callback = (err, msg) => { - const [jer, tm] = this.adapter(err, msg); - uh(jer, tm); - if (this.dispatchedFn && tm) { - this.dispatchedFn(tm); - } - }; - } - const { max, queue, timeout } = opts; - const sopts = { queue, timeout, callback }; - if (max && max > 0) { - sopts.max = max; - } - this.sub = nc.subscribe(subject, sopts); - if (opts.cleanupFn) { - this.sub.cleanupFn = opts.cleanupFn; - } - this.subIterDone = util_1.deferred(); - Promise.all([this.sub.closed, this.iterClosed]).then(() => { - this.subIterDone.resolve(); - }).catch(() => { - this.subIterDone.resolve(); - }); - ((s) => __awaiter(this, void 0, void 0, function* () { - yield s.closed; - this.stop(); - }))(this.sub).then().catch(); - } - unsubscribe(max) { - this.sub.unsubscribe(max); - } - drain() { - return this.sub.drain(); - } - isDraining() { - return this.sub.isDraining(); - } - isClosed() { - return this.sub.isClosed(); - } - callback(e, msg) { - this.sub.cancelTimeout(); - const [err, tm] = this.adapter(e, msg); - if (err) { - this.stop(err); - } - if (tm) { - this.push(tm); - } - } - getSubject() { - return this.sub.getSubject(); - } - getReceived() { - return this.sub.getReceived(); - } - getProcessed() { - return this.sub.getProcessed(); - } - getPending() { - return this.sub.getPending(); - } - getID() { - return this.sub.getID(); - } - getMax() { - return this.sub.getMax(); - } - get closed() { - return this.sub.closed; - } - }; - exports.TypedSubscription = TypedSubscription; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsconsumeropts.js - var require_jsconsumeropts = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsconsumeropts.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.isConsumerOptsBuilder = exports.ConsumerOptsBuilderImpl = exports.consumerOpts = void 0; - var types_1 = require_types(); - var jsutil_1 = require_jsutil(); - function consumerOpts(opts) { - return new ConsumerOptsBuilderImpl(opts); - } - exports.consumerOpts = consumerOpts; - var ConsumerOptsBuilderImpl = class { - constructor(opts) { - this.stream = ""; - this.mack = false; - this.config = jsutil_1.defaultConsumer("", opts || {}); - this.config.ack_policy = types_1.AckPolicy.All; - } - getOpts() { - const o = {}; - o.config = this.config; - o.mack = this.mack; - o.stream = this.stream; - o.callbackFn = this.callbackFn; - o.max = this.max; - o.queue = this.qname; - return o; - } - deliverTo(subject) { - this.config.deliver_subject = subject; - } - manualAck() { - this.mack = true; - } - durable(name) { - jsutil_1.validateDurableName(name); - this.config.durable_name = name; - } - deliverAll() { - this.config.deliver_policy = types_1.DeliverPolicy.All; - } - deliverLast() { - this.config.deliver_policy = types_1.DeliverPolicy.Last; - } - deliverNew() { - this.config.deliver_policy = types_1.DeliverPolicy.New; - } - startSequence(seq) { - if (seq <= 0) { - throw new Error("sequence must be greater than 0"); - } - this.config.deliver_policy = types_1.DeliverPolicy.StartSequence; - this.config.opt_start_seq = seq; - } - startTime(time) { - this.config.deliver_policy = types_1.DeliverPolicy.StartTime; - this.config.opt_start_time = time.toISOString(); - } - ackNone() { - this.config.ack_policy = types_1.AckPolicy.None; - } - ackAll() { - this.config.ack_policy = types_1.AckPolicy.All; - } - ackExplicit() { - this.config.ack_policy = types_1.AckPolicy.Explicit; - } - maxDeliver(max) { - this.config.max_deliver = max; - } - maxAckPending(max) { - this.config.max_ack_pending = max; - } - maxWaiting(max) { - this.config.max_waiting = max; - } - maxMessages(max) { - this.max = max; - } - callback(fn) { - this.callbackFn = fn; - } - queue(n) { - this.qname = n; - } - idleHeartbeat(millis) { - this.config.idle_heartbeat = jsutil_1.nanos(millis); - } - flowControl() { - this.config.flow_control = true; - } - }; - exports.ConsumerOptsBuilderImpl = ConsumerOptsBuilderImpl; - function isConsumerOptsBuilder(o) { - return typeof o.getOpts === "function"; - } - exports.isConsumerOptsBuilder = isConsumerOptsBuilder; - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/jsclient.js - var require_jsclient = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/jsclient.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.JetStreamClientImpl = void 0; - var types_1 = require_types(); - var jsbaseclient_api_1 = require_jsbaseclient_api(); - var jsutil_1 = require_jsutil(); - var jsconsumer_api_1 = require_jsconsumer_api(); - var jsmsg_1 = require_jsmsg(); - var typedsub_1 = require_typedsub(); - var error_1 = require_error(); - var queued_iterator_1 = require_queued_iterator(); - var util_1 = require_util(); - var protocol_1 = require_protocol(); - var headers_1 = require_headers(); - var jsconsumeropts_1 = require_jsconsumeropts(); - var PubHeaders; - (function(PubHeaders2) { - PubHeaders2["MsgIdHdr"] = "Nats-Msg-Id"; - PubHeaders2["ExpectedStreamHdr"] = "Nats-Expected-Stream"; - PubHeaders2["ExpectedLastSeqHdr"] = "Nats-Expected-Last-Sequence"; - PubHeaders2["ExpectedLastMsgIdHdr"] = "Nats-Expected-Last-Msg-Id"; - PubHeaders2["ExpectedLastSubjectSequenceHdr"] = "Nats-Expected-Last-Subject-Sequence"; - })(PubHeaders || (PubHeaders = {})); - var JetStreamClientImpl = class extends jsbaseclient_api_1.BaseApiClient { - constructor(nc, opts) { - super(nc, opts); - this.api = new jsconsumer_api_1.ConsumerAPIImpl(nc, opts); - } - publish(subj, data = types_1.Empty, opts) { - return __awaiter(this, void 0, void 0, function* () { - opts = opts || {}; - opts.expect = opts.expect || {}; - const mh = (opts === null || opts === void 0 ? void 0 : opts.headers) || headers_1.headers(); - if (opts) { - if (opts.msgID) { - mh.set(PubHeaders.MsgIdHdr, opts.msgID); - } - if (opts.expect.lastMsgID) { - mh.set(PubHeaders.ExpectedLastMsgIdHdr, opts.expect.lastMsgID); - } - if (opts.expect.streamName) { - mh.set(PubHeaders.ExpectedStreamHdr, opts.expect.streamName); - } - if (opts.expect.lastSequence) { - mh.set(PubHeaders.ExpectedLastSeqHdr, `${opts.expect.lastSequence}`); - } - if (opts.expect.lastSubjectSequence) { - mh.set(PubHeaders.ExpectedLastSubjectSequenceHdr, `${opts.expect.lastSubjectSequence}`); - } - } - const to = opts.timeout || this.timeout; - const ro = {}; - if (to) { - ro.timeout = to; - } - if (opts) { - ro.headers = mh; - } - const r = yield this.nc.request(subj, data, ro); - const pa = this.parseJsResponse(r); - if (pa.stream === "") { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamInvalidAck); - } - pa.duplicate = pa.duplicate ? pa.duplicate : false; - return pa; - }); - } - pull(stream, durable) { - return __awaiter(this, void 0, void 0, function* () { - jsutil_1.validateStreamName(stream); - jsutil_1.validateDurableName(durable); - const msg = yield this.nc.request( - `${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, - this.jc.encode({ no_wait: true, batch: 1, expires: jsutil_1.nanos(this.timeout) }), - { noMux: true, timeout: this.timeout } - ); - const err = jsutil_1.checkJsError(msg); - if (err) { - throw err; - } - return jsmsg_1.toJsMsg(msg); - }); - } - fetch(stream, durable, opts = {}) { - jsutil_1.validateStreamName(stream); - jsutil_1.validateDurableName(durable); - let timer = null; - const args = {}; - args.batch = opts.batch || 1; - args.no_wait = opts.no_wait || false; - const expires = opts.expires || 0; - if (expires) { - args.expires = jsutil_1.nanos(expires); - } - if (expires === 0 && args.no_wait === false) { - throw new Error("expires or no_wait is required"); - } - const qi = new queued_iterator_1.QueuedIteratorImpl(); - const wants = args.batch; - let received = 0; - qi.dispatchedFn = (m) => { - if (m) { - received++; - if (timer && m.info.pending === 0) { - return; - } - if (qi.getPending() === 1 && m.info.pending === 0 || wants === received) { - qi.stop(); - } - } - }; - const inbox = protocol_1.createInbox(this.nc.options.inboxPrefix); - const sub = this.nc.subscribe(inbox, { - max: opts.batch, - callback: (err, msg) => { - if (err === null) { - err = jsutil_1.checkJsError(msg); - } - if (err !== null) { - if (timer) { - timer.cancel(); - timer = null; - } - if (error_1.isNatsError(err) && err.code === error_1.ErrorCode.JetStream404NoMessages) { - qi.stop(); - } else { - qi.stop(err); - } - } else { - qi.received++; - qi.push(jsmsg_1.toJsMsg(msg)); - } - } - }); - if (expires) { - timer = util_1.timeout(expires); - timer.catch(() => { - if (!sub.isClosed()) { - sub.drain(); - timer = null; - } - }); - } - (() => __awaiter(this, void 0, void 0, function* () { - yield sub.closed; - if (timer !== null) { - timer.cancel(); - timer = null; - } - qi.stop(); - }))().catch(); - this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${stream}.${durable}`, this.jc.encode(args), { reply: inbox }); - return qi; - } - pullSubscribe(subject, opts = jsconsumeropts_1.consumerOpts()) { - return __awaiter(this, void 0, void 0, function* () { - const cso = yield this._processOptions(subject, opts); - if (!cso.attached) { - cso.config.filter_subject = subject; - } - if (cso.config.deliver_subject) { - throw new Error("consumer info specifies deliver_subject - pull consumers cannot have deliver_subject set"); - } - const ackPolicy = cso.config.ack_policy; - if (ackPolicy === types_1.AckPolicy.None || ackPolicy === types_1.AckPolicy.All) { - throw new Error("ack policy for pull consumers must be explicit"); - } - const so = this._buildTypedSubscriptionOpts(cso); - const sub = new JetStreamPullSubscriptionImpl(this, cso.deliver, so); - try { - yield this._maybeCreateConsumer(cso); - } catch (err) { - sub.unsubscribe(); - throw err; - } - sub.info = cso; - return sub; - }); - } - subscribe(subject, opts = jsconsumeropts_1.consumerOpts()) { - return __awaiter(this, void 0, void 0, function* () { - const cso = yield this._processOptions(subject, opts); - if (!cso.config.deliver_subject) { - throw new Error("consumer info specifies a pull consumer - deliver_subject is required"); - } - const so = this._buildTypedSubscriptionOpts(cso); - const sub = new JetStreamSubscriptionImpl(this, cso.deliver, so); - try { - yield this._maybeCreateConsumer(cso); - } catch (err) { - sub.unsubscribe(); - throw err; - } - sub.info = cso; - return sub; - }); - } - _processOptions(subject, opts = jsconsumeropts_1.consumerOpts()) { - return __awaiter(this, void 0, void 0, function* () { - const jsi = jsconsumeropts_1.isConsumerOptsBuilder(opts) ? opts.getOpts() : opts; - jsi.api = this; - jsi.config = jsi.config || {}; - jsi.stream = jsi.stream ? jsi.stream : yield this.findStream(subject); - jsi.attached = false; - if (jsi.config.durable_name) { - try { - const info = yield this.api.info(jsi.stream, jsi.config.durable_name); - if (info) { - if (info.config.filter_subject && info.config.filter_subject !== subject) { - throw new Error("subject does not match consumer"); - } - jsi.config = info.config; - jsi.attached = true; - } - } catch (err) { - if (err.code !== "404") { - throw err; - } - } - } - if (!jsi.attached) { - jsi.config.filter_subject = subject; - } - jsi.deliver = jsi.config.deliver_subject || protocol_1.createInbox(this.nc.options.inboxPrefix); - return jsi; - }); - } - _buildTypedSubscriptionOpts(jsi) { - const so = {}; - so.adapter = msgAdapter(jsi.callbackFn === void 0); - if (jsi.callbackFn) { - so.callback = jsi.callbackFn; - } - if (!jsi.mack) { - so.dispatchedFn = autoAckJsMsg; - } - so.max = jsi.max || 0; - so.queue = jsi.queue; - return so; - } - _maybeCreateConsumer(jsi) { - return __awaiter(this, void 0, void 0, function* () { - if (jsi.attached) { - return; - } - jsi.config = Object.assign({ - deliver_policy: types_1.DeliverPolicy.All, - ack_policy: types_1.AckPolicy.Explicit, - ack_wait: jsutil_1.nanos(30 * 1e3), - replay_policy: types_1.ReplayPolicy.Instant - }, jsi.config); - const ci = yield this.api.add(jsi.stream, jsi.config); - jsi.name = ci.name; - jsi.config = ci.config; - }); - } - }; - exports.JetStreamClientImpl = JetStreamClientImpl; - var JetStreamSubscriptionImpl = class extends typedsub_1.TypedSubscription { - constructor(js, subject, opts) { - super(js.nc, subject, opts); - } - set info(info) { - this.sub.info = info; - } - get info() { - return this.sub.info; - } - destroy() { - return __awaiter(this, void 0, void 0, function* () { - if (!this.isClosed()) { - yield this.drain(); - } - const jinfo = this.sub.info; - const name = jinfo.config.durable_name || jinfo.name; - const subj = `${jinfo.api.prefix}.CONSUMER.DELETE.${jinfo.stream}.${name}`; - yield jinfo.api._request(subj); - }); - } - consumerInfo() { - return __awaiter(this, void 0, void 0, function* () { - const jinfo = this.sub.info; - const name = jinfo.config.durable_name || jinfo.name; - const subj = `${jinfo.api.prefix}.CONSUMER.INFO.${jinfo.stream}.${name}`; - return yield jinfo.api._request(subj); - }); - } - }; - var JetStreamPullSubscriptionImpl = class extends JetStreamSubscriptionImpl { - constructor(js, subject, opts) { - super(js, subject, opts); - } - pull(opts = { batch: 1 }) { - const { stream, config } = this.sub.info; - const consumer = config.durable_name; - const args = {}; - args.batch = opts.batch || 1; - args.no_wait = opts.no_wait || false; - if (opts.expires && opts.expires > 0) { - args.expires = opts.expires; - } - if (this.info) { - const api = this.info.api; - const subj = `${api.prefix}.CONSUMER.MSG.NEXT.${stream}.${consumer}`; - const reply = this.sub.subject; - api.nc.publish(subj, api.jc.encode(args), { reply }); - } - } - }; - function msgAdapter(iterator) { - if (iterator) { - return iterMsgAdapter; - } else { - return cbMsgAdapter; - } - } - function cbMsgAdapter(err, msg) { - if (err) { - return [err, null]; - } - err = jsutil_1.checkJsError(msg); - if (err) { - return [err, null]; - } - if (jsutil_1.isFlowControlMsg(msg)) { - msg.respond(); - return [null, null]; - } - const jm = jsmsg_1.toJsMsg(msg); - try { - jm.info; - return [null, jm]; - } catch (err2) { - return [err2, null]; - } - } - function iterMsgAdapter(err, msg) { - if (err) { - return [err, null]; - } - const ne = jsutil_1.checkJsError(msg); - if (ne !== null) { - switch (ne.code) { - case error_1.ErrorCode.JetStream404NoMessages: - case error_1.ErrorCode.JetStream408RequestTimeout: - case error_1.ErrorCode.JetStream409MaxAckPendingExceeded: - return [null, null]; - default: - return [ne, null]; - } - } - if (jsutil_1.isFlowControlMsg(msg)) { - msg.respond(); - return [null, null]; - } - const jm = jsmsg_1.toJsMsg(msg); - try { - jm.info; - return [null, jm]; - } catch (err2) { - return [err2, null]; - } - } - function autoAckJsMsg(data) { - if (data) { - data.ack(); - } - } - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/nats.js - var require_nats = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/nats.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __asyncValues = exports && exports.__asyncValues || function(o) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.NatsConnectionImpl = void 0; - var util_1 = require_util(); - var protocol_1 = require_protocol(); - var subscription_1 = require_subscription(); - var error_1 = require_error(); - var types_1 = require_types(); - var options_1 = require_options(); - var queued_iterator_1 = require_queued_iterator(); - var request_1 = require_request(); - var msg_1 = require_msg(); - var jsm_1 = require_jsm(); - var jsclient_1 = require_jsclient(); - var NatsConnectionImpl = class { - constructor(opts) { - this.draining = false; - this.options = options_1.parseOptions(opts); - this.listeners = []; - } - static connect(opts = {}) { - return new Promise((resolve, reject) => { - const nc = new NatsConnectionImpl(opts); - protocol_1.ProtocolHandler.connect(nc.options, nc).then((ph) => { - nc.protocol = ph; - (function() { - var e_1, _a; - return __awaiter(this, void 0, void 0, function* () { - try { - for (var _b = __asyncValues(ph.status()), _c; _c = yield _b.next(), !_c.done; ) { - const s = _c.value; - nc.listeners.forEach((l) => { - l.push(s); - }); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (_c && !_c.done && (_a = _b.return)) - yield _a.call(_b); - } finally { - if (e_1) - throw e_1.error; - } - } - }); - })(); - resolve(nc); - }).catch((err) => { - reject(err); - }); - }); - } - closed() { - return this.protocol.closed; - } - close() { - return __awaiter(this, void 0, void 0, function* () { - yield this.protocol.close(); - }); - } - publish(subject, data = types_1.Empty, options) { - subject = subject || ""; - if (subject.length === 0) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject); - } - if (data && !util_1.isUint8Array(data)) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadPayload); - } - this.protocol.publish(subject, data, options); - } - subscribe(subject, opts = {}) { - if (this.isClosed()) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed); - } - if (this.isDraining()) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining); - } - subject = subject || ""; - if (subject.length === 0) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject); - } - const sub = new subscription_1.SubscriptionImpl(this.protocol, subject, opts); - this.protocol.subscribe(sub); - return sub; - } - request(subject, data = types_1.Empty, opts = { timeout: 1e3, noMux: false }) { - if (this.isClosed()) { - return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed)); - } - if (this.isDraining()) { - return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining)); - } - subject = subject || ""; - if (subject.length === 0) { - return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.BadSubject)); - } - opts.timeout = opts.timeout || 1e3; - if (opts.timeout < 1) { - return Promise.reject(new error_1.NatsError("timeout", error_1.ErrorCode.InvalidOption)); - } - if (!opts.noMux && opts.reply) { - return Promise.reject(new error_1.NatsError("reply can only be used with noMux", error_1.ErrorCode.InvalidOption)); - } - if (opts.noMux) { - const inbox = opts.reply ? opts.reply : protocol_1.createInbox(this.options.inboxPrefix); - const d = util_1.deferred(); - this.subscribe(inbox, { - max: 1, - timeout: opts.timeout, - callback: (err, msg) => { - if (err) { - d.reject(err); - } else { - err = msg_1.isRequestError(msg); - if (err) { - d.reject(err); - } else { - d.resolve(msg); - } - } - } - }); - this.publish(subject, data, { reply: inbox }); - return d; - } else { - const r = new request_1.Request(this.protocol.muxSubscriptions, opts); - this.protocol.request(r); - try { - this.publish(subject, data, { - reply: `${this.protocol.muxSubscriptions.baseInbox}${r.token}`, - headers: opts.headers - }); - } catch (err) { - r.cancel(err); - } - const p = Promise.race([r.timer, r.deferred]); - p.catch(() => { - r.cancel(); - }); - return p; - } - } - flush() { - return this.protocol.flush(); - } - drain() { - if (this.isClosed()) { - return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionClosed)); - } - if (this.isDraining()) { - return Promise.reject(error_1.NatsError.errorForCode(error_1.ErrorCode.ConnectionDraining)); - } - this.draining = true; - return this.protocol.drain(); - } - isClosed() { - return this.protocol.isClosed(); - } - isDraining() { - return this.draining; - } - getServer() { - const srv = this.protocol.getServer(); - return srv ? srv.listen : ""; - } - status() { - const iter = new queued_iterator_1.QueuedIteratorImpl(); - this.listeners.push(iter); - return iter; - } - get info() { - return this.protocol.isClosed() ? void 0 : this.protocol.info; - } - stats() { - return { - inBytes: this.protocol.inBytes, - outBytes: this.protocol.outBytes, - inMsgs: this.protocol.inMsgs, - outMsgs: this.protocol.outMsgs - }; - } - jetstreamManager(opts = {}) { - return __awaiter(this, void 0, void 0, function* () { - jetstreamPreview(this); - const adm = new jsm_1.JetStreamManagerImpl(this, opts); - try { - yield adm.getAccountInfo(); - } catch (err) { - const ne = err; - if (ne.code === error_1.ErrorCode.NoResponders) { - throw error_1.NatsError.errorForCode(error_1.ErrorCode.JetStreamNotEnabled); - } - throw ne; - } - return adm; - }); - } - jetstream(opts = {}) { - jetstreamPreview(this); - return new jsclient_1.JetStreamClientImpl(this, opts); - } - }; - exports.NatsConnectionImpl = NatsConnectionImpl; - var jetstreamPreview = (() => { - let once = false; - return (nci) => { - var _a; - if (!once) { - once = true; - const { lang } = (_a = nci === null || nci === void 0 ? void 0 : nci.protocol) === null || _a === void 0 ? void 0 : _a.transport; - if (lang) { - console.log(`\x1B[33m >> jetstream functionality in ${lang} is preview functionality \x1B[0m`); - } else { - console.log(`\x1B[33m >> jetstream functionality is preview functionality \x1B[0m`); - } - } - }; - })(); - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/bench.js - var require_bench = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/bench.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __asyncValues = exports && exports.__asyncValues || function(o) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i); - function verb(n) { - i[n] = o[n] && function(v) { - return new Promise(function(resolve, reject) { - v = o[n](v), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function(v2) { - resolve({ value: v2, done: d }); - }, reject); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Bench = exports.Metric = void 0; - var types_1 = require_types(); - var nuid_1 = require_nuid(); - var util_1 = require_util(); - var error_1 = require_error(); - var Metric = class { - constructor(name, duration) { - this.name = name; - this.duration = duration; - this.date = Date.now(); - this.payload = 0; - this.msgs = 0; - this.bytes = 0; - } - toString() { - const sec = this.duration / 1e3; - const mps = Math.round(this.msgs / sec); - const label = this.asyncRequests ? "asyncRequests" : ""; - let minmax = ""; - if (this.max) { - minmax = `${this.min}/${this.max}`; - } - return `${this.name}${label ? " [asyncRequests]" : ""} ${humanizeNumber(mps)} msgs/sec - [${sec.toFixed(2)} secs] ~ ${throughput(this.bytes, sec)} ${minmax}`; - } - toCsv() { - return `"${this.name}",${new Date(this.date).toISOString()},${this.lang},${this.version},${this.msgs},${this.payload},${this.bytes},${this.duration},${this.asyncRequests ? this.asyncRequests : false} -`; - } - static header() { - return `Test,Date,Lang,Version,Count,MsgPayload,Bytes,Millis,Async -`; - } - }; - exports.Metric = Metric; - var Bench = class { - constructor(nc, opts = { - msgs: 1e5, - size: 128, - subject: "", - asyncRequests: false, - pub: false, - sub: false, - req: false, - rep: false - }) { - this.nc = nc; - this.callbacks = opts.callbacks || false; - this.msgs = opts.msgs || 0; - this.size = opts.size || 0; - this.subject = opts.subject || nuid_1.nuid.next(); - this.asyncRequests = opts.asyncRequests || false; - this.pub = opts.pub || false; - this.sub = opts.sub || false; - this.req = opts.req || false; - this.rep = opts.rep || false; - this.perf = new util_1.Perf(); - this.payload = this.size ? new Uint8Array(this.size) : types_1.Empty; - if (!this.pub && !this.sub && !this.req && !this.rep) { - throw new Error("no bench option selected"); - } - } - run() { - return __awaiter(this, void 0, void 0, function* () { - this.nc.closed().then((err) => { - if (err) { - throw new error_1.NatsError(`bench closed with an error: ${err.message}`, error_1.ErrorCode.Unknown, err); - } - }); - if (this.callbacks) { - yield this.runCallbacks(); - } else { - yield this.runAsync(); - } - return this.processMetrics(); - }); - } - processMetrics() { - const nc = this.nc; - const { lang, version } = nc.protocol.transport; - if (this.pub && this.sub) { - this.perf.measure("pubsub", "pubStart", "subStop"); - } - const measures = this.perf.getEntries(); - const pubsub = measures.find((m) => m.name === "pubsub"); - const req = measures.find((m) => m.name === "req"); - const pub = measures.find((m) => m.name === "pub"); - const sub = measures.find((m) => m.name === "sub"); - const stats = this.nc.stats(); - const metrics = []; - if (pubsub) { - const { name, duration } = pubsub; - const m = new Metric(name, duration); - m.msgs = this.msgs * 2; - m.bytes = stats.inBytes + stats.outBytes; - m.lang = lang; - m.version = version; - m.payload = this.payload.length; - metrics.push(m); - } - if (pub) { - const { name, duration } = pub; - const m = new Metric(name, duration); - m.msgs = this.msgs; - m.bytes = stats.outBytes; - m.lang = lang; - m.version = version; - m.payload = this.payload.length; - metrics.push(m); - } - if (sub) { - const { name, duration } = sub; - const m = new Metric(name, duration); - m.msgs = this.msgs; - m.bytes = stats.inBytes; - m.lang = lang; - m.version = version; - m.payload = this.payload.length; - metrics.push(m); - } - if (req) { - const { name, duration } = req; - const m = new Metric(name, duration); - m.msgs = this.msgs * 2; - m.bytes = stats.inBytes + stats.outBytes; - m.lang = lang; - m.version = version; - m.payload = this.payload.length; - metrics.push(m); - } - return metrics; - } - runCallbacks() { - return __awaiter(this, void 0, void 0, function* () { - const jobs = []; - if (this.req) { - const d = util_1.deferred(); - jobs.push(d); - const sub = this.nc.subscribe(this.subject, { - max: this.msgs, - callback: (_, m) => { - m.respond(this.payload); - if (sub.getProcessed() === this.msgs) { - d.resolve(); - } - } - }); - } - if (this.sub) { - const d = util_1.deferred(); - jobs.push(d); - let i = 0; - this.nc.subscribe(this.subject, { - max: this.msgs, - callback: () => { - i++; - if (i === 1) { - this.perf.mark("subStart"); - } - if (i === this.msgs) { - this.perf.mark("subStop"); - this.perf.measure("sub", "subStart", "subStop"); - d.resolve(); - } - } - }); - } - if (this.pub) { - const job = (() => __awaiter(this, void 0, void 0, function* () { - this.perf.mark("pubStart"); - for (let i = 0; i < this.msgs; i++) { - this.nc.publish(this.subject, this.payload); - } - yield this.nc.flush(); - this.perf.mark("pubStop"); - this.perf.measure("pub", "pubStart", "pubStop"); - }))(); - jobs.push(job); - } - if (this.req) { - const job = (() => __awaiter(this, void 0, void 0, function* () { - if (this.asyncRequests) { - this.perf.mark("reqStart"); - const a = []; - for (let i = 0; i < this.msgs; i++) { - a.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 })); - } - yield Promise.all(a); - this.perf.mark("reqStop"); - this.perf.measure("req", "reqStart", "reqStop"); - } else { - this.perf.mark("reqStart"); - for (let i = 0; i < this.msgs; i++) { - yield this.nc.request(this.subject); - } - this.perf.mark("reqStop"); - this.perf.measure("req", "reqStart", "reqStop"); - } - }))(); - jobs.push(job); - } - yield Promise.all(jobs); - }); - } - runAsync() { - return __awaiter(this, void 0, void 0, function* () { - const jobs = []; - if (this.req) { - const sub = this.nc.subscribe(this.subject, { max: this.msgs }); - const job = (() => __awaiter(this, void 0, void 0, function* () { - var e_1, _a; - try { - for (var sub_1 = __asyncValues(sub), sub_1_1; sub_1_1 = yield sub_1.next(), !sub_1_1.done; ) { - const m = sub_1_1.value; - m.respond(this.payload); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (sub_1_1 && !sub_1_1.done && (_a = sub_1.return)) - yield _a.call(sub_1); - } finally { - if (e_1) - throw e_1.error; - } - } - }))(); - jobs.push(job); - } - if (this.sub) { - let first = false; - const sub = this.nc.subscribe(this.subject, { max: this.msgs }); - const job = (() => __awaiter(this, void 0, void 0, function* () { - var e_2, _b; - try { - for (var sub_2 = __asyncValues(sub), sub_2_1; sub_2_1 = yield sub_2.next(), !sub_2_1.done; ) { - const m = sub_2_1.value; - if (!first) { - this.perf.mark("subStart"); - first = true; - } - } - } catch (e_2_1) { - e_2 = { error: e_2_1 }; - } finally { - try { - if (sub_2_1 && !sub_2_1.done && (_b = sub_2.return)) - yield _b.call(sub_2); - } finally { - if (e_2) - throw e_2.error; - } - } - this.perf.mark("subStop"); - this.perf.measure("sub", "subStart", "subStop"); - }))(); - jobs.push(job); - } - if (this.pub) { - const job = (() => __awaiter(this, void 0, void 0, function* () { - this.perf.mark("pubStart"); - for (let i = 0; i < this.msgs; i++) { - this.nc.publish(this.subject, this.payload); - } - yield this.nc.flush(); - this.perf.mark("pubStop"); - this.perf.measure("pub", "pubStart", "pubStop"); - }))(); - jobs.push(job); - } - if (this.req) { - const job = (() => __awaiter(this, void 0, void 0, function* () { - if (this.asyncRequests) { - this.perf.mark("reqStart"); - const a = []; - for (let i = 0; i < this.msgs; i++) { - a.push(this.nc.request(this.subject, this.payload, { timeout: 2e4 })); - } - yield Promise.all(a); - this.perf.mark("reqStop"); - this.perf.measure("req", "reqStart", "reqStop"); - } else { - this.perf.mark("reqStart"); - for (let i = 0; i < this.msgs; i++) { - yield this.nc.request(this.subject); - } - this.perf.mark("reqStop"); - this.perf.measure("req", "reqStart", "reqStop"); - } - }))(); - jobs.push(job); - } - yield Promise.all(jobs); - }); - } - }; - exports.Bench = Bench; - function throughput(bytes, seconds) { - return humanizeBytes(bytes / seconds); - } - function humanizeBytes(bytes, si = false) { - const base = si ? 1e3 : 1024; - const pre = si ? ["k", "M", "G", "T", "P", "E"] : ["K", "M", "G", "T", "P", "E"]; - const post = si ? "iB" : "B"; - if (bytes < base) { - return `${bytes.toFixed(2)} ${post}/sec`; - } - const exp = parseInt(Math.log(bytes) / Math.log(base) + ""); - const index = parseInt(exp - 1 + ""); - return `${(bytes / Math.pow(base, exp)).toFixed(2)} ${pre[index]}${post}/sec`; - } - function humanizeNumber(n) { - return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); - } - } - }); - - // ../../node_modules/nats.ws/lib/nats-base-client/internal_mod.js - var require_internal_mod = __commonJS({ - "../../node_modules/nats.ws/lib/nats-base-client/internal_mod.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.State = exports.Parser = exports.Kind = exports.StringCodec = exports.JSONCodec = exports.nkeyAuthenticator = exports.jwtAuthenticator = exports.credsAuthenticator = exports.Request = exports.checkUnsupportedOption = exports.checkOptions = exports.DataBuffer = exports.MuxSubscription = exports.Heartbeat = exports.MsgHdrsImpl = exports.Match = exports.headers = exports.canonicalMIMEHeaderKey = exports.timeout = exports.render = exports.extractProtocolMessage = exports.extend = exports.delay = exports.deferred = exports.ProtocolHandler = exports.INFO = exports.createInbox = exports.Connect = exports.setTransportFactory = exports.Subscriptions = exports.SubscriptionImpl = exports.MsgImpl = exports.JsHeaders = exports.Events = exports.Empty = exports.DebugEvents = exports.toJsMsg = exports.consumerOpts = exports.StorageType = exports.RetentionPolicy = exports.ReplayPolicy = exports.DiscardPolicy = exports.DeliverPolicy = exports.AdvisoryKind = exports.AckPolicy = exports.NatsError = exports.ErrorCode = exports.nuid = exports.Nuid = exports.NatsConnectionImpl = void 0; - exports.nanos = exports.millis = exports.isHeartbeatMsg = exports.isFlowControlMsg = exports.TypedSubscription = exports.parseIP = exports.isIP = exports.TE = exports.TD = exports.Metric = exports.Bench = exports.writeAll = exports.readAll = exports.MAX_SIZE = exports.DenoBuffer = void 0; - var nats_1 = require_nats(); - Object.defineProperty(exports, "NatsConnectionImpl", { enumerable: true, get: function() { - return nats_1.NatsConnectionImpl; - } }); - var nuid_1 = require_nuid(); - Object.defineProperty(exports, "Nuid", { enumerable: true, get: function() { - return nuid_1.Nuid; - } }); - Object.defineProperty(exports, "nuid", { enumerable: true, get: function() { - return nuid_1.nuid; - } }); - var error_1 = require_error(); - Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function() { - return error_1.ErrorCode; - } }); - Object.defineProperty(exports, "NatsError", { enumerable: true, get: function() { - return error_1.NatsError; - } }); - var types_1 = require_types(); - Object.defineProperty(exports, "AckPolicy", { enumerable: true, get: function() { - return types_1.AckPolicy; - } }); - Object.defineProperty(exports, "AdvisoryKind", { enumerable: true, get: function() { - return types_1.AdvisoryKind; - } }); - Object.defineProperty(exports, "DeliverPolicy", { enumerable: true, get: function() { - return types_1.DeliverPolicy; - } }); - Object.defineProperty(exports, "DiscardPolicy", { enumerable: true, get: function() { - return types_1.DiscardPolicy; - } }); - Object.defineProperty(exports, "ReplayPolicy", { enumerable: true, get: function() { - return types_1.ReplayPolicy; - } }); - Object.defineProperty(exports, "RetentionPolicy", { enumerable: true, get: function() { - return types_1.RetentionPolicy; - } }); - Object.defineProperty(exports, "StorageType", { enumerable: true, get: function() { - return types_1.StorageType; - } }); - var jsconsumeropts_1 = require_jsconsumeropts(); - Object.defineProperty(exports, "consumerOpts", { enumerable: true, get: function() { - return jsconsumeropts_1.consumerOpts; - } }); - var jsmsg_1 = require_jsmsg(); - Object.defineProperty(exports, "toJsMsg", { enumerable: true, get: function() { - return jsmsg_1.toJsMsg; - } }); - var types_2 = require_types(); - Object.defineProperty(exports, "DebugEvents", { enumerable: true, get: function() { - return types_2.DebugEvents; - } }); - Object.defineProperty(exports, "Empty", { enumerable: true, get: function() { - return types_2.Empty; - } }); - Object.defineProperty(exports, "Events", { enumerable: true, get: function() { - return types_2.Events; - } }); - Object.defineProperty(exports, "JsHeaders", { enumerable: true, get: function() { - return types_2.JsHeaders; - } }); - var msg_1 = require_msg(); - Object.defineProperty(exports, "MsgImpl", { enumerable: true, get: function() { - return msg_1.MsgImpl; - } }); - var subscription_1 = require_subscription(); - Object.defineProperty(exports, "SubscriptionImpl", { enumerable: true, get: function() { - return subscription_1.SubscriptionImpl; - } }); - var subscriptions_1 = require_subscriptions(); - Object.defineProperty(exports, "Subscriptions", { enumerable: true, get: function() { - return subscriptions_1.Subscriptions; - } }); - var transport_1 = require_transport(); - Object.defineProperty(exports, "setTransportFactory", { enumerable: true, get: function() { - return transport_1.setTransportFactory; - } }); - var protocol_1 = require_protocol(); - Object.defineProperty(exports, "Connect", { enumerable: true, get: function() { - return protocol_1.Connect; - } }); - Object.defineProperty(exports, "createInbox", { enumerable: true, get: function() { - return protocol_1.createInbox; - } }); - Object.defineProperty(exports, "INFO", { enumerable: true, get: function() { - return protocol_1.INFO; - } }); - Object.defineProperty(exports, "ProtocolHandler", { enumerable: true, get: function() { - return protocol_1.ProtocolHandler; - } }); - var util_1 = require_util(); - Object.defineProperty(exports, "deferred", { enumerable: true, get: function() { - return util_1.deferred; - } }); - Object.defineProperty(exports, "delay", { enumerable: true, get: function() { - return util_1.delay; - } }); - Object.defineProperty(exports, "extend", { enumerable: true, get: function() { - return util_1.extend; - } }); - Object.defineProperty(exports, "extractProtocolMessage", { enumerable: true, get: function() { - return util_1.extractProtocolMessage; - } }); - Object.defineProperty(exports, "render", { enumerable: true, get: function() { - return util_1.render; - } }); - Object.defineProperty(exports, "timeout", { enumerable: true, get: function() { - return util_1.timeout; - } }); - var headers_1 = require_headers(); - Object.defineProperty(exports, "canonicalMIMEHeaderKey", { enumerable: true, get: function() { - return headers_1.canonicalMIMEHeaderKey; - } }); - Object.defineProperty(exports, "headers", { enumerable: true, get: function() { - return headers_1.headers; - } }); - Object.defineProperty(exports, "Match", { enumerable: true, get: function() { - return headers_1.Match; - } }); - Object.defineProperty(exports, "MsgHdrsImpl", { enumerable: true, get: function() { - return headers_1.MsgHdrsImpl; - } }); - var heartbeats_1 = require_heartbeats(); - Object.defineProperty(exports, "Heartbeat", { enumerable: true, get: function() { - return heartbeats_1.Heartbeat; - } }); - var muxsubscription_1 = require_muxsubscription(); - Object.defineProperty(exports, "MuxSubscription", { enumerable: true, get: function() { - return muxsubscription_1.MuxSubscription; - } }); - var databuffer_1 = require_databuffer(); - Object.defineProperty(exports, "DataBuffer", { enumerable: true, get: function() { - return databuffer_1.DataBuffer; - } }); - var options_1 = require_options(); - Object.defineProperty(exports, "checkOptions", { enumerable: true, get: function() { - return options_1.checkOptions; - } }); - Object.defineProperty(exports, "checkUnsupportedOption", { enumerable: true, get: function() { - return options_1.checkUnsupportedOption; - } }); - var request_1 = require_request(); - Object.defineProperty(exports, "Request", { enumerable: true, get: function() { - return request_1.Request; - } }); - var authenticator_1 = require_authenticator(); - Object.defineProperty(exports, "credsAuthenticator", { enumerable: true, get: function() { - return authenticator_1.credsAuthenticator; - } }); - Object.defineProperty(exports, "jwtAuthenticator", { enumerable: true, get: function() { - return authenticator_1.jwtAuthenticator; - } }); - Object.defineProperty(exports, "nkeyAuthenticator", { enumerable: true, get: function() { - return authenticator_1.nkeyAuthenticator; - } }); - var codec_1 = require_codec2(); - Object.defineProperty(exports, "JSONCodec", { enumerable: true, get: function() { - return codec_1.JSONCodec; - } }); - Object.defineProperty(exports, "StringCodec", { enumerable: true, get: function() { - return codec_1.StringCodec; - } }); - __exportStar(require_nkeys2(), exports); - var parser_1 = require_parser(); - Object.defineProperty(exports, "Kind", { enumerable: true, get: function() { - return parser_1.Kind; - } }); - Object.defineProperty(exports, "Parser", { enumerable: true, get: function() { - return parser_1.Parser; - } }); - Object.defineProperty(exports, "State", { enumerable: true, get: function() { - return parser_1.State; - } }); - var denobuffer_1 = require_denobuffer(); - Object.defineProperty(exports, "DenoBuffer", { enumerable: true, get: function() { - return denobuffer_1.DenoBuffer; - } }); - Object.defineProperty(exports, "MAX_SIZE", { enumerable: true, get: function() { - return denobuffer_1.MAX_SIZE; - } }); - Object.defineProperty(exports, "readAll", { enumerable: true, get: function() { - return denobuffer_1.readAll; - } }); - Object.defineProperty(exports, "writeAll", { enumerable: true, get: function() { - return denobuffer_1.writeAll; - } }); - var bench_1 = require_bench(); - Object.defineProperty(exports, "Bench", { enumerable: true, get: function() { - return bench_1.Bench; - } }); - Object.defineProperty(exports, "Metric", { enumerable: true, get: function() { - return bench_1.Metric; - } }); - var encoders_1 = require_encoders(); - Object.defineProperty(exports, "TD", { enumerable: true, get: function() { - return encoders_1.TD; - } }); - Object.defineProperty(exports, "TE", { enumerable: true, get: function() { - return encoders_1.TE; - } }); - var ipparser_1 = require_ipparser(); - Object.defineProperty(exports, "isIP", { enumerable: true, get: function() { - return ipparser_1.isIP; - } }); - Object.defineProperty(exports, "parseIP", { enumerable: true, get: function() { - return ipparser_1.parseIP; - } }); - var typedsub_1 = require_typedsub(); - Object.defineProperty(exports, "TypedSubscription", { enumerable: true, get: function() { - return typedsub_1.TypedSubscription; - } }); - var jsutil_1 = require_jsutil(); - Object.defineProperty(exports, "isFlowControlMsg", { enumerable: true, get: function() { - return jsutil_1.isFlowControlMsg; - } }); - Object.defineProperty(exports, "isHeartbeatMsg", { enumerable: true, get: function() { - return jsutil_1.isHeartbeatMsg; - } }); - Object.defineProperty(exports, "millis", { enumerable: true, get: function() { - return jsutil_1.millis; - } }); - Object.defineProperty(exports, "nanos", { enumerable: true, get: function() { - return jsutil_1.nanos; - } }); - } - }); - - // ../../node_modules/nats.ws/lib/src/ws_transport.js - var require_ws_transport = __commonJS({ - "../../node_modules/nats.ws/lib/src/ws_transport.js"(exports) { - "use strict"; - var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - var __await = exports && exports.__await || function(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); - }; - var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) - throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { - return this; - }, i; - function verb(n) { - if (g[n]) - i[n] = function(v) { - return new Promise(function(a, b) { - q.push([n, v, a, b]) > 1 || resume(n, v); - }); - }; - } - function resume(n, v) { - try { - step(g[n](v)); - } catch (e) { - settle(q[0][3], e); - } - } - function step(r) { - r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); - } - function fulfill(value) { - resume("next", value); - } - function reject(value) { - resume("throw", value); - } - function settle(f, v) { - if (f(v), q.shift(), q.length) - resume(q[0][0], q[0][1]); - } - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.WsTransport = void 0; - var internal_mod_1 = require_internal_mod(); - var VERSION = "1.2.0"; - var LANG = "nats.ws"; - var WsTransport = class { - constructor() { - this.version = VERSION; - this.lang = LANG; - this.connected = false; - this.done = false; - this.socketClosed = false; - this.encrypted = false; - this.peeked = false; - this.yields = []; - this.signal = internal_mod_1.deferred(); - this.closedNotification = internal_mod_1.deferred(); - } - connect(server, options) { - const connected = false; - const connLock = internal_mod_1.deferred(); - if (options.tls) { - connLock.reject(new internal_mod_1.NatsError("tls", internal_mod_1.ErrorCode.InvalidOption)); - return connLock; - } - this.options = options; - const u = server.src; - this.encrypted = u.indexOf("wss://") === 0; - this.socket = new WebSocket(u); - this.socket.binaryType = "arraybuffer"; - this.socket.onopen = () => { - }; - this.socket.onmessage = (me) => { - this.yields.push(new Uint8Array(me.data)); - if (this.peeked) { - this.signal.resolve(); - return; - } - const t = internal_mod_1.DataBuffer.concat(...this.yields); - const pm = internal_mod_1.extractProtocolMessage(t); - if (pm) { - const m = internal_mod_1.INFO.exec(pm); - if (!m) { - if (options.debug) { - console.error("!!!", internal_mod_1.render(t)); - } - connLock.reject(new Error("unexpected response from server")); - return; - } - try { - const info = JSON.parse(m[1]); - internal_mod_1.checkOptions(info, this.options); - this.peeked = true; - this.connected = true; - this.signal.resolve(); - connLock.resolve(); - } catch (err) { - connLock.reject(err); - return; - } - } - }; - this.socket.onclose = (evt) => { - this.socketClosed = true; - let reason; - if (this.done) - return; - if (!evt.wasClean) { - reason = new Error(evt.reason); - } - this._closed(reason); - }; - this.socket.onerror = (e) => { - const evt = e; - const err = new internal_mod_1.NatsError(evt.message, internal_mod_1.ErrorCode.Unknown, new Error(evt.error)); - if (!connected) { - connLock.reject(err); - } else { - this._closed(err); - } - }; - return connLock; - } - disconnect() { - this._closed(void 0, true); - } - _closed(err, internal = true) { - return __awaiter(this, void 0, void 0, function* () { - if (!this.connected) - return; - if (this.done) - return; - this.closeError = err; - if (!err) { - while (!this.socketClosed && this.socket.bufferedAmount > 0) { - console.log(this.socket.bufferedAmount); - yield internal_mod_1.delay(100); - } - } - this.done = true; - try { - this.socket.close(err ? 1002 : 1e3, err ? err.message : void 0); - } catch (err2) { - } - if (internal) { - this.closedNotification.resolve(err); - } - }); - } - get isClosed() { - return this.done; - } - [Symbol.asyncIterator]() { - return this.iterate(); - } - iterate() { - return __asyncGenerator(this, arguments, function* iterate_1() { - while (true) { - if (this.yields.length === 0) { - yield __await(this.signal); - } - const yields = this.yields; - this.yields = []; - for (let i = 0; i < yields.length; i++) { - if (this.options.debug) { - console.info(`> ${internal_mod_1.render(yields[i])}`); - } - yield yield __await(yields[i]); - } - if (this.done) { - break; - } else if (this.yields.length === 0) { - yields.length = 0; - this.yields = yields; - this.signal = internal_mod_1.deferred(); - } - } - }); - } - isEncrypted() { - return this.connected && this.encrypted; - } - send(frame) { - if (this.done) { - return Promise.resolve(); - } - try { - this.socket.send(frame.buffer); - if (this.options.debug) { - console.info(`< ${internal_mod_1.render(frame)}`); - } - return Promise.resolve(); - } catch (err) { - if (this.options.debug) { - console.error(`!!! ${internal_mod_1.render(frame)}: ${err}`); - } - return Promise.reject(err); - } - } - close(err) { - return this._closed(err, false); - } - closed() { - return this.closedNotification; - } - }; - exports.WsTransport = WsTransport; - } - }); - - // ../../node_modules/nats.ws/lib/src/connect.js - var require_connect = __commonJS({ - "../../node_modules/nats.ws/lib/src/connect.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.connect = exports.wsUrlParseFn = void 0; - var internal_mod_1 = require_internal_mod(); - var ws_transport_1 = require_ws_transport(); - function wsUrlParseFn(u) { - const ut = /^(.*:\/\/)(.*)/; - if (!ut.test(u)) { - u = `https://${u}`; - } - let url = new URL(u); - const srcProto = url.protocol.toLowerCase(); - if (srcProto !== "https:" && srcProto !== "http") { - u = u.replace(/^(.*:\/\/)(.*)/gm, "$2"); - url = new URL(`http://${u}`); - } - let protocol; - let port; - const host = url.hostname; - const path = url.pathname; - const search = url.search || ""; - switch (srcProto) { - case "http:": - case "ws:": - case "nats:": - port = url.port || "80"; - protocol = "ws:"; - break; - default: - port = url.port || "443"; - protocol = "wss:"; - break; - } - return `${protocol}//${host}:${port}${path}${search}`; - } - exports.wsUrlParseFn = wsUrlParseFn; - function connect(opts = {}) { - internal_mod_1.setTransportFactory({ - defaultPort: 443, - urlParseFn: wsUrlParseFn, - factory: () => { - return new ws_transport_1.WsTransport(); - } - }); - return internal_mod_1.NatsConnectionImpl.connect(opts); - } - exports.connect = connect; - } - }); - - // ../../node_modules/nats.ws/lib/src/mod.js - var require_mod3 = __commonJS({ - "../../node_modules/nats.ws/lib/src/mod.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __exportStar = exports && exports.__exportStar || function(m, exports2) { - for (var p in m) - if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) - __createBinding(exports2, m, p); - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.connect = void 0; - __exportStar(require_internal_mod(), exports); - var connect_1 = require_connect(); - Object.defineProperty(exports, "connect", { enumerable: true, get: function() { - return connect_1.connect; - } }); - } - }); - - // ../../node_modules/nats.ws/nats.cjs - var require_nats2 = __commonJS({ - "../../node_modules/nats.ws/nats.cjs"(exports, module) { - "use strict"; - module.exports = require_mod3(); - } - }); - - // ../../node_modules/ms/index.js - var require_ms = __commonJS({ - "../../node_modules/ms/index.js"(exports, module) { - var s = 1e3; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var w = d * 7; - var y = d * 365.25; - module.exports = function(val, options) { - options = options || {}; - var type = typeof val; - if (type === "string" && val.length > 0) { - return parse(val); - } else if (type === "number" && isFinite(val)) { - return options.long ? fmtLong(val) : fmtShort(val); - } - throw new Error( - "val is not a non-empty string or a valid number. val=" + JSON.stringify(val) - ); - }; - function parse(str) { - str = String(str); - if (str.length > 100) { - return; - } - var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( - str - ); - if (!match) { - return; - } - var n = parseFloat(match[1]); - var type = (match[2] || "ms").toLowerCase(); - switch (type) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * y; - case "weeks": - case "week": - case "w": - return n * w; - case "days": - case "day": - case "d": - return n * d; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * h; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * m; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * s; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - default: - return void 0; - } - } - function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return Math.round(ms / d) + "d"; - } - if (msAbs >= h) { - return Math.round(ms / h) + "h"; - } - if (msAbs >= m) { - return Math.round(ms / m) + "m"; - } - if (msAbs >= s) { - return Math.round(ms / s) + "s"; - } - return ms + "ms"; - } - function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, "day"); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, "hour"); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, "minute"); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, "second"); - } - return ms + " ms"; - } - function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + " " + name + (isPlural ? "s" : ""); - } - } - }); - - // ../../node_modules/debug/src/common.js - var require_common = __commonJS({ - "../../node_modules/debug/src/common.js"(exports, module) { - function setup(env) { - createDebug.debug = createDebug; - createDebug.default = createDebug; - createDebug.coerce = coerce; - createDebug.disable = disable; - createDebug.enable = enable; - createDebug.enabled = enabled; - createDebug.humanize = require_ms(); - createDebug.destroy = destroy; - Object.keys(env).forEach((key) => { - createDebug[key] = env[key]; - }); - createDebug.names = []; - createDebug.skips = []; - createDebug.formatters = {}; - function selectColor(namespace) { - let hash = 0; - for (let i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; - } - return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; - } - createDebug.selectColor = selectColor; - function createDebug(namespace) { - let prevTime; - let enableOverride = null; - let namespacesCache; - let enabledCache; - function debug(...args) { - if (!debug.enabled) { - return; - } - const self2 = debug; - const curr = Number(new Date()); - const ms = curr - (prevTime || curr); - self2.diff = ms; - self2.prev = prevTime; - self2.curr = curr; - prevTime = curr; - args[0] = createDebug.coerce(args[0]); - if (typeof args[0] !== "string") { - args.unshift("%O"); - } - let index = 0; - args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { - if (match === "%%") { - return "%"; - } - index++; - const formatter = createDebug.formatters[format]; - if (typeof formatter === "function") { - const val = args[index]; - match = formatter.call(self2, val); - args.splice(index, 1); - index--; - } - return match; - }); - createDebug.formatArgs.call(self2, args); - const logFn = self2.log || createDebug.log; - logFn.apply(self2, args); - } - debug.namespace = namespace; - debug.useColors = createDebug.useColors(); - debug.color = createDebug.selectColor(namespace); - debug.extend = extend; - debug.destroy = createDebug.destroy; - Object.defineProperty(debug, "enabled", { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride !== null) { - return enableOverride; - } - if (namespacesCache !== createDebug.namespaces) { - namespacesCache = createDebug.namespaces; - enabledCache = createDebug.enabled(namespace); - } - return enabledCache; - }, - set: (v) => { - enableOverride = v; - } - }); - if (typeof createDebug.init === "function") { - createDebug.init(debug); - } - return debug; - } - function extend(namespace, delimiter) { - const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace); - newDebug.log = this.log; - return newDebug; - } - function enable(namespaces) { - createDebug.save(namespaces); - createDebug.namespaces = namespaces; - createDebug.names = []; - createDebug.skips = []; - let i; - const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/); - const len = split.length; - for (i = 0; i < len; i++) { - if (!split[i]) { - continue; - } - namespaces = split[i].replace(/\*/g, ".*?"); - if (namespaces[0] === "-") { - createDebug.skips.push(new RegExp("^" + namespaces.substr(1) + "$")); - } else { - createDebug.names.push(new RegExp("^" + namespaces + "$")); - } - } - } - function disable() { - const namespaces = [ - ...createDebug.names.map(toNamespace), - ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace) - ].join(","); - createDebug.enable(""); - return namespaces; - } - function enabled(name) { - if (name[name.length - 1] === "*") { - return true; - } - let i; - let len; - for (i = 0, len = createDebug.skips.length; i < len; i++) { - if (createDebug.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = createDebug.names.length; i < len; i++) { - if (createDebug.names[i].test(name)) { - return true; - } - } - return false; - } - function toNamespace(regexp) { - return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*"); - } - function coerce(val) { - if (val instanceof Error) { - return val.stack || val.message; - } - return val; - } - function destroy() { - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - createDebug.enable(createDebug.load()); - return createDebug; - } - module.exports = setup; - } - }); - - // ../../node_modules/debug/src/browser.js - var require_browser = __commonJS({ - "../../node_modules/debug/src/browser.js"(exports, module) { - exports.formatArgs = formatArgs; - exports.save = save; - exports.load = load; - exports.useColors = useColors; - exports.storage = localstorage(); - exports.destroy = (() => { - let warned = false; - return () => { - if (!warned) { - warned = true; - console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."); - } - }; - })(); - exports.colors = [ - "#0000CC", - "#0000FF", - "#0033CC", - "#0033FF", - "#0066CC", - "#0066FF", - "#0099CC", - "#0099FF", - "#00CC00", - "#00CC33", - "#00CC66", - "#00CC99", - "#00CCCC", - "#00CCFF", - "#3300CC", - "#3300FF", - "#3333CC", - "#3333FF", - "#3366CC", - "#3366FF", - "#3399CC", - "#3399FF", - "#33CC00", - "#33CC33", - "#33CC66", - "#33CC99", - "#33CCCC", - "#33CCFF", - "#6600CC", - "#6600FF", - "#6633CC", - "#6633FF", - "#66CC00", - "#66CC33", - "#9900CC", - "#9900FF", - "#9933CC", - "#9933FF", - "#99CC00", - "#99CC33", - "#CC0000", - "#CC0033", - "#CC0066", - "#CC0099", - "#CC00CC", - "#CC00FF", - "#CC3300", - "#CC3333", - "#CC3366", - "#CC3399", - "#CC33CC", - "#CC33FF", - "#CC6600", - "#CC6633", - "#CC9900", - "#CC9933", - "#CCCC00", - "#CCCC33", - "#FF0000", - "#FF0033", - "#FF0066", - "#FF0099", - "#FF00CC", - "#FF00FF", - "#FF3300", - "#FF3333", - "#FF3366", - "#FF3399", - "#FF33CC", - "#FF33FF", - "#FF6600", - "#FF6633", - "#FF9900", - "#FF9933", - "#FFCC00", - "#FFCC33" - ]; - function useColors() { - if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) { - return true; - } - if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { - return false; - } - return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); - } - function formatArgs(args) { - args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff); - if (!this.useColors) { - return; - } - const c = "color: " + this.color; - args.splice(1, 0, c, "color: inherit"); - let index = 0; - let lastC = 0; - args[0].replace(/%[a-zA-Z%]/g, (match) => { - if (match === "%%") { - return; - } - index++; - if (match === "%c") { - lastC = index; - } - }); - args.splice(lastC, 0, c); - } - exports.log = console.debug || console.log || (() => { - }); - function save(namespaces) { - try { - if (namespaces) { - exports.storage.setItem("debug", namespaces); - } else { - exports.storage.removeItem("debug"); - } - } catch (error) { - } - } - function load() { - let r; - try { - r = exports.storage.getItem("debug"); - } catch (error) { - } - if (!r && typeof process !== "undefined" && "env" in process) { - r = process.env.DEBUG; - } - return r; - } - function localstorage() { - try { - return localStorage; - } catch (error) { - } - } - module.exports = require_common()(exports); - var { formatters } = module.exports; - formatters.j = function(v) { - try { - return JSON.stringify(v); - } catch (error) { - return "[UnexpectedJSONParseError]: " + error.message; - } - }; - } - }); - - // ../../node_modules/@wapc/host/dist/src/debug.js - var require_debug = __commonJS({ - "../../node_modules/@wapc/host/dist/src/debug.js"(exports) { - "use strict"; - var __importDefault = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.debug = void 0; - var debug_1 = __importDefault(require_browser()); - var _debug = debug_1.default("wapc"); - function debug(cb) { - if (_debug.enabled) { - const params = cb(); - _debug(...params); - } - } - exports.debug = debug; - } - }); - - // ../../node_modules/@wapc/host/dist/src/callbacks.js - var require_callbacks = __commonJS({ - "../../node_modules/@wapc/host/dist/src/callbacks.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.generateWASIImports = exports.generateWapcImports = void 0; - var debug_1 = require_debug(); - function generateWapcImports(instance) { - return { - __console_log(ptr, len) { - debug_1.debug(() => ["__console_log %o bytes @ %o", len, ptr]); - const buffer = new Uint8Array(instance.getCallerMemory().buffer); - const bytes = buffer.slice(ptr, ptr + len); - console.log(instance.textDecoder.decode(bytes)); - }, - __host_call(bd_ptr, bd_len, ns_ptr, ns_len, op_ptr, op_len, ptr, len) { - debug_1.debug(() => ["__host_call"]); - const mem = instance.getCallerMemory(); - const buffer = new Uint8Array(mem.buffer); - const binding = instance.textDecoder.decode(buffer.slice(bd_ptr, bd_ptr + bd_len)); - const namespace = instance.textDecoder.decode(buffer.slice(ns_ptr, ns_ptr + ns_len)); - const operation = instance.textDecoder.decode(buffer.slice(op_ptr, op_ptr + op_len)); - const bytes = buffer.slice(ptr, ptr + len); - debug_1.debug(() => ["host_call(%o,%o,%o,[%o bytes])", binding, namespace, operation, bytes.length]); - instance.state.hostError = void 0; - instance.state.hostResponse = void 0; - try { - const result = instance.state.hostCallback(binding, namespace, operation, bytes); - instance.state.hostResponse = result; - return 1; - } catch (e) { - instance.state.hostError = e.toString(); - return 0; - } - }, - __host_response(ptr) { - debug_1.debug(() => ["__host_response ptr: %o", ptr]); - if (instance.state.hostResponse) { - const buffer = new Uint8Array(instance.getCallerMemory().buffer); - buffer.set(instance.state.hostResponse, ptr); - } - }, - __host_response_len() { - var _a; - const len = ((_a = instance.state.hostResponse) === null || _a === void 0 ? void 0 : _a.length) || 0; - debug_1.debug(() => ["__host_response_len %o", len]); - return len; - }, - __host_error_len() { - var _a; - const len = ((_a = instance.state.hostError) === null || _a === void 0 ? void 0 : _a.length) || 0; - debug_1.debug(() => ["__host_error_len ptr: %o", len]); - return len; - }, - __host_error(ptr) { - debug_1.debug(() => ["__host_error %o", ptr]); - if (instance.state.hostError) { - debug_1.debug(() => ["__host_error writing to mem: %o", instance.state.hostError]); - const buffer = new Uint8Array(instance.getCallerMemory().buffer); - buffer.set(instance.textEncoder.encode(instance.state.hostError), ptr); - } - }, - __guest_response(ptr, len) { - debug_1.debug(() => ["__guest_response %o bytes @ %o", len, ptr]); - instance.state.guestError = void 0; - const buffer = new Uint8Array(instance.getCallerMemory().buffer); - const bytes = buffer.slice(ptr, ptr + len); - instance.state.guestResponse = bytes; - }, - __guest_error(ptr, len) { - debug_1.debug(() => ["__guest_error %o bytes @ %o", len, ptr]); - const buffer = new Uint8Array(instance.getCallerMemory().buffer); - const bytes = buffer.slice(ptr, ptr + len); - const message = instance.textDecoder.decode(bytes); - instance.state.guestError = message; - }, - __guest_request(op_ptr, ptr) { - debug_1.debug(() => ["__guest_request op: %o, ptr: %o", op_ptr, ptr]); - const invocation = instance.state.guestRequest; - if (invocation) { - const memory = instance.getCallerMemory(); - debug_1.debug(() => ["writing invocation (%o,[%o bytes])", invocation.operation, invocation.msg.length]); - const buffer = new Uint8Array(memory.buffer); - buffer.set(invocation.operationEncoded, op_ptr); - buffer.set(invocation.msg, ptr); - } else { - throw new Error("__guest_request called without an invocation present. This is probably a bug in the library using @wapc/host."); - } - } - }; - } - exports.generateWapcImports = generateWapcImports; - function generateWASIImports(instance) { - return { - __fd_write(fileDescriptor, iovsPtr, iovsLen, writtenPtr) { - if (fileDescriptor != 1) { - return 0; - } - const memory = instance.getCallerMemory(); - const dv = new DataView(memory.buffer); - const heap = new Uint8Array(memory.buffer); - let bytesWritten = 0; - while (iovsLen > 0) { - iovsLen--; - const base = dv.getUint32(iovsPtr, true); - iovsPtr += 4; - const length = dv.getUint32(iovsPtr, true); - iovsPtr += 4; - const stringBytes = heap.slice(base, base + length); - instance.state.writer(instance.textDecoder.decode(stringBytes)); - bytesWritten += length; - } - dv.setUint32(writtenPtr, bytesWritten, true); - return bytesWritten; - } - }; - } - exports.generateWASIImports = generateWASIImports; - } - }); - - // ../../node_modules/@wapc/host/dist/src/errors.js - var require_errors = __commonJS({ - "../../node_modules/@wapc/host/dist/src/errors.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.StreamingFailure = exports.InvalidWasm = exports.HostCallNotImplementedError = void 0; - var TestableError = class extends Error { - matcher() { - return new RegExp(this.toString().replace(/^Error: /, "")); - } - }; - var HostCallNotImplementedError = class extends TestableError { - constructor(binding, namespace, operation) { - super(`Host call not implemented. Guest called host with binding = '${binding}', namespace = '${namespace}', & operation = '${operation}'`); - } - }; - exports.HostCallNotImplementedError = HostCallNotImplementedError; - var InvalidWasm = class extends TestableError { - constructor(error) { - super(`Invalid wasm binary: ${error.message}`); - } - }; - exports.InvalidWasm = InvalidWasm; - var StreamingFailure = class extends TestableError { - constructor(error) { - super(`Could not instantiate from Response object: ${error.message}`); - } - }; - exports.StreamingFailure = StreamingFailure; - } - }); - - // ../../node_modules/@wapc/host/dist/src/wapc-host.js - var require_wapc_host = __commonJS({ - "../../node_modules/@wapc/host/dist/src/wapc-host.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.instantiateStreaming = exports.instantiate = exports.WapcHost = void 0; - var debug_1 = require_debug(); - var _1 = require_src(); - var callbacks_1 = require_callbacks(); - var errors_1 = require_errors(); - var START = "_start"; - var WAPC_INIT = "wapc_init"; - var GUEST_CALL = "__guest_call"; - var ModuleState = class { - constructor(hostCall, writer) { - this.hostCallback = hostCall || ((binding, namespace, operation) => { - throw new errors_1.HostCallNotImplementedError(binding, namespace, operation); - }); - this.writer = writer || (() => void 0); - } - }; - var WapcHost = class { - constructor(hostCall, writer) { - this.state = new ModuleState(hostCall, writer); - this.textEncoder = new TextEncoder(); - this.textDecoder = new TextDecoder("utf-8"); - this.guestCall = () => void 0; - } - async instantiate(source) { - const imports = this.getImports(); - const result = await WebAssembly.instantiate(source, imports).catch((e) => { - throw new _1.errors.InvalidWasm(e); - }); - this.initialize(result.instance); - return this; - } - async instantiateStreaming(source) { - const imports = this.getImports(); - if (!WebAssembly.instantiateStreaming) { - debug_1.debug(() => [ - "WebAssembly.instantiateStreaming is not supported on this browser, wasm execution will be impacted." - ]); - const bytes = new Uint8Array(await (await source).arrayBuffer()); - return this.instantiate(bytes); - } else { - const result = await WebAssembly.instantiateStreaming(source, imports).catch((e) => { - throw new _1.errors.StreamingFailure(e); - }); - this.initialize(result.instance); - return this; - } - } - getImports() { - const wasiImports = callbacks_1.generateWASIImports(this); - return { - wapc: callbacks_1.generateWapcImports(this), - wasi: wasiImports, - wasi_unstable: wasiImports - }; - } - initialize(instance) { - this.instance = instance; - const start = this.instance.exports[START]; - if (start != null) { - start([]); - } - const init = this.instance.exports[WAPC_INIT]; - if (init != null) { - init([]); - } - this.guestCall = this.instance.exports[GUEST_CALL]; - if (this.guestCall == null) { - throw new Error("WebAssembly module does not export __guest_call"); - } - } - async invoke(operation, payload) { - debug_1.debug(() => [`invoke(%o, [%o bytes]`, operation, payload.length]); - const operationEncoded = this.textEncoder.encode(operation); - this.state.guestRequest = { operation, operationEncoded, msg: payload }; - const result = this.guestCall(operationEncoded.length, payload.length); - if (result === 0) { - throw new Error(this.state.guestError); - } else { - if (!this.state.guestResponse) { - throw new Error("Guest call succeeded, but guest response not set. This is a bug in @wapc/host"); - } else { - return this.state.guestResponse; - } - } - } - getCallerMemory() { - return this.instance.exports.memory; - } - }; - exports.WapcHost = WapcHost; - async function instantiate(source, hostCall, writer) { - const host = new WapcHost(hostCall, writer); - return host.instantiate(source); - } - exports.instantiate = instantiate; - async function instantiateStreaming(source, hostCall, writer) { - const host = new WapcHost(hostCall, writer); - return host.instantiateStreaming(await source); - } - exports.instantiateStreaming = instantiateStreaming; - } - }); - - // ../../node_modules/@wapc/host/dist/src/index.js - var require_src = __commonJS({ - "../../node_modules/@wapc/host/dist/src/index.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); - } - __setModuleDefault(result, mod); - return result; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.errors = exports.WapcHost = exports.instantiateStreaming = exports.instantiate = void 0; - var wapc_host_1 = require_wapc_host(); - Object.defineProperty(exports, "instantiate", { enumerable: true, get: function() { - return wapc_host_1.instantiate; - } }); - Object.defineProperty(exports, "instantiateStreaming", { enumerable: true, get: function() { - return wapc_host_1.instantiateStreaming; - } }); - Object.defineProperty(exports, "WapcHost", { enumerable: true, get: function() { - return wapc_host_1.WapcHost; - } }); - exports.errors = __importStar(require_errors()); - } - }); - - // ../../dist/src/wasmbus.js - var require_wasmbus = __commonJS({ - "../../dist/src/wasmbus.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.Wasmbus = exports.instantiate = void 0; - var host_1 = require_src(); - async function instantiate(source, hostCall, writer) { - const host = new Wasmbus(hostCall, writer); - return host.instantiate(source); - } - exports.instantiate = instantiate; - var Wasmbus = class extends host_1.WapcHost { - constructor(hostCall, writer) { - super(hostCall, writer); - } - async instantiate(source) { - const imports = super.getImports(); - const result = await WebAssembly.instantiate(source, { - wasmbus: imports.wapc, - wasi: imports.wasi, - wasi_unstable: imports.wasi_unstable - }).catch((e) => { - throw new Error(`Invalid wasm binary: ${e.message}`); - }); - super.initialize(result.instance); - return this; - } - }; - exports.Wasmbus = Wasmbus; - } - }); - - // ../../dist/src/util.js - var require_util4 = __commonJS({ - "../../dist/src/util.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.jsonDecode = exports.jsonEncode = exports.parseJwt = exports.uuidv4 = void 0; - var nats_ws_1 = require_nats2(); - var jc = nats_ws_1.JSONCodec(); - function uuidv4() { - return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) { - const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8; - return v.toString(16); - }); - } - exports.uuidv4 = uuidv4; - function parseJwt(token) { - var base64Url = token.split(".")[1]; - var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - var jsonPayload = decodeURIComponent(atob(base64).split("").map(function(c) { - return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); - }).join("")); - return JSON.parse(jsonPayload); - } - exports.parseJwt = parseJwt; - function jsonEncode(data) { - return jc.encode(data); - } - exports.jsonEncode = jsonEncode; - function jsonDecode(data) { - return jc.decode(data); - } - exports.jsonDecode = jsonDecode; - } - }); - - // ../../dist/src/events.js - var require_events = __commonJS({ - "../../dist/src/events.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.createEventMessage = exports.EventType = void 0; - var util_1 = require_util4(); - var EventType; - (function(EventType2) { - EventType2["ActorStarted"] = "com.wasmcloud.lattice.actor_started"; - EventType2["ActorStopped"] = "com.wasmcloud.lattice.actor_stopped"; - EventType2["HeartBeat"] = "com.wasmcloud.lattice.host_heartbeat"; - EventType2["HealthCheckPass"] = "com.wasmcloud.lattice.health_check_passed"; - EventType2["HostStarted"] = "com.wasmcloud.lattice.host_started"; - })(EventType = exports.EventType || (exports.EventType = {})); - function createEventMessage(hostKey, eventType, data) { - return { - data, - datacontenttype: "application/json", - id: util_1.uuidv4(), - source: hostKey, - specversion: "1.0", - time: new Date().toISOString(), - type: eventType - }; - } - exports.createEventMessage = createEventMessage; - } - }); - - // ../../dist/src/actor.js - var require_actor = __commonJS({ - "../../dist/src/actor.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.startActor = exports.Actor = void 0; - var msgpack_1 = require_dist(); - var wasmbus_1 = require_wasmbus(); - var events_1 = require_events(); - var util_1 = require_util4(); - var Actor = class { - constructor(hostName = "default", hostKey, wasm, invocationCallback, hostCall, writer) { - this.key = ""; - this.hostName = hostName; - this.hostKey = hostKey; - this.claims = { - jti: "", - iat: 0, - iss: "", - sub: "", - wascap: { - name: "", - hash: "", - tags: [], - caps: [], - ver: "", - prov: false - } - }; - this.wasm = wasm; - this.invocationCallback = invocationCallback; - this.hostCall = hostCall; - this.writer = writer; - } - async startActor(actorBuffer) { - const token = await this.wasm.extract_jwt(actorBuffer); - const valid = await this.wasm.validate_jwt(token); - if (!valid) { - throw new Error("invalid token"); - } - this.claims = util_1.parseJwt(token); - this.key = this.claims.sub; - this.module = await wasmbus_1.instantiate(actorBuffer, this.hostCall, this.writer); - } - async stopActor(natsConn) { - const actorToStop = { - host_id: this.hostKey, - actor_ref: this.key - }; - natsConn.publish(`wasmbus.ctl.${this.hostName}.cmd.${this.hostKey}.sa`, util_1.jsonEncode(actorToStop)); - } - async publishActorStarted(natsConn) { - const claims = { - call_alias: "", - caps: this.claims.wascap.caps[0], - iss: this.claims.iss, - name: this.claims.wascap.name, - rev: "1", - sub: this.claims.sub, - tags: "", - version: this.claims.wascap.ver - }; - natsConn.publish(`lc.${this.hostName}.claims.${this.key}`, util_1.jsonEncode(claims)); - const actorStarted = { - api_version: 0, - instance_id: util_1.uuidv4(), - public_key: this.key - }; - natsConn.publish(`wasmbus.evt.${this.hostName}`, util_1.jsonEncode(events_1.createEventMessage(this.hostKey, events_1.EventType.ActorStarted, actorStarted))); - const actorHealthCheck = { - instance_id: util_1.uuidv4(), - public_key: this.key - }; - natsConn.publish(`wasmbus.evt.${this.hostName}`, util_1.jsonEncode(events_1.createEventMessage(this.hostKey, events_1.EventType.HealthCheckPass, actorHealthCheck))); - } - async subscribeInvocations(natsConn) { - const invocationsTopic = natsConn.subscribe(`wasmbus.rpc.${this.hostName}.${this.key}`); - for await (const invocationMessage of invocationsTopic) { - const invocationData = msgpack_1.decode(invocationMessage.data); - const invocation = invocationData; - const invocationResult = await this.module.invoke(invocation.operation, invocation.msg); - invocationMessage.respond(msgpack_1.encode({ - invocation_id: invocationData.id, - instance_id: util_1.uuidv4(), - msg: invocationResult - })); - if (this.invocationCallback) { - this.invocationCallback(invocationResult); - } - } - throw new Error("actor.inovcation subscription closed"); - } - }; - exports.Actor = Actor; - async function startActor(hostName, hostKey, actorModule, natsConn, wasm, invocationCallback, hostCall, writer) { - const actor = new Actor(hostName, hostKey, wasm, invocationCallback, hostCall, writer); - await actor.startActor(actorModule); - await actor.publishActorStarted(natsConn); - Promise.all([actor.subscribeInvocations(natsConn)]).catch((err) => { - throw err; - }); - return actor; - } - exports.startActor = startActor; - } - }); - - // ../../node_modules/axios/lib/helpers/bind.js - var require_bind = __commonJS({ - "../../node_modules/axios/lib/helpers/bind.js"(exports, module) { - "use strict"; - module.exports = function bind(fn, thisArg) { - return function wrap() { - var args = new Array(arguments.length); - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i]; - } - return fn.apply(thisArg, args); - }; - }; - } - }); - - // ../../node_modules/axios/lib/utils.js - var require_utils = __commonJS({ - "../../node_modules/axios/lib/utils.js"(exports, module) { - "use strict"; - var bind = require_bind(); - var toString = Object.prototype.toString; - function isArray(val) { - return toString.call(val) === "[object Array]"; - } - function isUndefined(val) { - return typeof val === "undefined"; - } - function isBuffer(val) { - return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val); - } - function isArrayBuffer(val) { - return toString.call(val) === "[object ArrayBuffer]"; - } - function isFormData(val) { - return typeof FormData !== "undefined" && val instanceof FormData; - } - function isArrayBufferView(val) { - var result; - if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) { - result = ArrayBuffer.isView(val); - } else { - result = val && val.buffer && val.buffer instanceof ArrayBuffer; - } - return result; - } - function isString(val) { - return typeof val === "string"; - } - function isNumber(val) { - return typeof val === "number"; - } - function isObject(val) { - return val !== null && typeof val === "object"; - } - function isPlainObject(val) { - if (toString.call(val) !== "[object Object]") { - return false; - } - var prototype = Object.getPrototypeOf(val); - return prototype === null || prototype === Object.prototype; - } - function isDate(val) { - return toString.call(val) === "[object Date]"; - } - function isFile(val) { - return toString.call(val) === "[object File]"; - } - function isBlob(val) { - return toString.call(val) === "[object Blob]"; - } - function isFunction(val) { - return toString.call(val) === "[object Function]"; - } - function isStream(val) { - return isObject(val) && isFunction(val.pipe); - } - function isURLSearchParams(val) { - return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams; - } - function trim(str) { - return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ""); - } - function isStandardBrowserEnv() { - if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) { - return false; - } - return typeof window !== "undefined" && typeof document !== "undefined"; - } - function forEach(obj, fn) { - if (obj === null || typeof obj === "undefined") { - return; - } - if (typeof obj !== "object") { - obj = [obj]; - } - if (isArray(obj)) { - for (var i = 0, l = obj.length; i < l; i++) { - fn.call(null, obj[i], i, obj); - } - } else { - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - fn.call(null, obj[key], key, obj); - } - } - } - } - function merge() { - var result = {}; - function assignValue(val, key) { - if (isPlainObject(result[key]) && isPlainObject(val)) { - result[key] = merge(result[key], val); - } else if (isPlainObject(val)) { - result[key] = merge({}, val); - } else if (isArray(val)) { - result[key] = val.slice(); - } else { - result[key] = val; - } - } - for (var i = 0, l = arguments.length; i < l; i++) { - forEach(arguments[i], assignValue); - } - return result; - } - function extend(a, b, thisArg) { - forEach(b, function assignValue(val, key) { - if (thisArg && typeof val === "function") { - a[key] = bind(val, thisArg); - } else { - a[key] = val; - } - }); - return a; - } - function stripBOM(content) { - if (content.charCodeAt(0) === 65279) { - content = content.slice(1); - } - return content; - } - module.exports = { - isArray, - isArrayBuffer, - isBuffer, - isFormData, - isArrayBufferView, - isString, - isNumber, - isObject, - isPlainObject, - isUndefined, - isDate, - isFile, - isBlob, - isFunction, - isStream, - isURLSearchParams, - isStandardBrowserEnv, - forEach, - merge, - extend, - trim, - stripBOM - }; - } - }); - - // ../../node_modules/axios/lib/helpers/buildURL.js - var require_buildURL = __commonJS({ - "../../node_modules/axios/lib/helpers/buildURL.js"(exports, module) { - "use strict"; - var utils = require_utils(); - function encode(val) { - return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]"); - } - module.exports = function buildURL(url, params, paramsSerializer) { - if (!params) { - return url; - } - var serializedParams; - if (paramsSerializer) { - serializedParams = paramsSerializer(params); - } else if (utils.isURLSearchParams(params)) { - serializedParams = params.toString(); - } else { - var parts = []; - utils.forEach(params, function serialize(val, key) { - if (val === null || typeof val === "undefined") { - return; - } - if (utils.isArray(val)) { - key = key + "[]"; - } else { - val = [val]; - } - utils.forEach(val, function parseValue(v) { - if (utils.isDate(v)) { - v = v.toISOString(); - } else if (utils.isObject(v)) { - v = JSON.stringify(v); - } - parts.push(encode(key) + "=" + encode(v)); - }); - }); - serializedParams = parts.join("&"); - } - if (serializedParams) { - var hashmarkIndex = url.indexOf("#"); - if (hashmarkIndex !== -1) { - url = url.slice(0, hashmarkIndex); - } - url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams; - } - return url; - }; - } - }); - - // ../../node_modules/axios/lib/core/InterceptorManager.js - var require_InterceptorManager = __commonJS({ - "../../node_modules/axios/lib/core/InterceptorManager.js"(exports, module) { - "use strict"; - var utils = require_utils(); - function InterceptorManager() { - this.handlers = []; - } - InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { - this.handlers.push({ - fulfilled, - rejected, - synchronous: options ? options.synchronous : false, - runWhen: options ? options.runWhen : null - }); - return this.handlers.length - 1; - }; - InterceptorManager.prototype.eject = function eject(id) { - if (this.handlers[id]) { - this.handlers[id] = null; - } - }; - InterceptorManager.prototype.forEach = function forEach(fn) { - utils.forEach(this.handlers, function forEachHandler(h) { - if (h !== null) { - fn(h); - } - }); - }; - module.exports = InterceptorManager; - } - }); - - // ../../node_modules/axios/lib/helpers/normalizeHeaderName.js - var require_normalizeHeaderName = __commonJS({ - "../../node_modules/axios/lib/helpers/normalizeHeaderName.js"(exports, module) { - "use strict"; - var utils = require_utils(); - module.exports = function normalizeHeaderName(headers, normalizedName) { - utils.forEach(headers, function processHeader(value, name) { - if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { - headers[normalizedName] = value; - delete headers[name]; - } - }); - }; - } - }); - - // ../../node_modules/axios/lib/core/enhanceError.js - var require_enhanceError = __commonJS({ - "../../node_modules/axios/lib/core/enhanceError.js"(exports, module) { - "use strict"; - module.exports = function enhanceError(error, config, code, request, response) { - error.config = config; - if (code) { - error.code = code; - } - error.request = request; - error.response = response; - error.isAxiosError = true; - error.toJSON = function toJSON() { - return { - message: this.message, - name: this.name, - description: this.description, - number: this.number, - fileName: this.fileName, - lineNumber: this.lineNumber, - columnNumber: this.columnNumber, - stack: this.stack, - config: this.config, - code: this.code, - status: this.response && this.response.status ? this.response.status : null - }; - }; - return error; - }; - } - }); - - // ../../node_modules/axios/lib/core/createError.js - var require_createError = __commonJS({ - "../../node_modules/axios/lib/core/createError.js"(exports, module) { - "use strict"; - var enhanceError = require_enhanceError(); - module.exports = function createError(message, config, code, request, response) { - var error = new Error(message); - return enhanceError(error, config, code, request, response); - }; - } - }); - - // ../../node_modules/axios/lib/core/settle.js - var require_settle = __commonJS({ - "../../node_modules/axios/lib/core/settle.js"(exports, module) { - "use strict"; - var createError = require_createError(); - module.exports = function settle(resolve, reject, response) { - var validateStatus = response.config.validateStatus; - if (!response.status || !validateStatus || validateStatus(response.status)) { - resolve(response); - } else { - reject(createError( - "Request failed with status code " + response.status, - response.config, - null, - response.request, - response - )); - } - }; - } - }); - - // ../../node_modules/axios/lib/helpers/cookies.js - var require_cookies = __commonJS({ - "../../node_modules/axios/lib/helpers/cookies.js"(exports, module) { - "use strict"; - var utils = require_utils(); - module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv() { - return { - write: function write(name, value, expires, path, domain, secure) { - var cookie = []; - cookie.push(name + "=" + encodeURIComponent(value)); - if (utils.isNumber(expires)) { - cookie.push("expires=" + new Date(expires).toGMTString()); - } - if (utils.isString(path)) { - cookie.push("path=" + path); - } - if (utils.isString(domain)) { - cookie.push("domain=" + domain); - } - if (secure === true) { - cookie.push("secure"); - } - document.cookie = cookie.join("; "); - }, - read: function read(name) { - var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)")); - return match ? decodeURIComponent(match[3]) : null; - }, - remove: function remove(name) { - this.write(name, "", Date.now() - 864e5); - } - }; - }() : function nonStandardBrowserEnv() { - return { - write: function write() { - }, - read: function read() { - return null; - }, - remove: function remove() { - } - }; - }(); - } - }); - - // ../../node_modules/axios/lib/helpers/isAbsoluteURL.js - var require_isAbsoluteURL = __commonJS({ - "../../node_modules/axios/lib/helpers/isAbsoluteURL.js"(exports, module) { - "use strict"; - module.exports = function isAbsoluteURL(url) { - return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url); - }; - } - }); - - // ../../node_modules/axios/lib/helpers/combineURLs.js - var require_combineURLs = __commonJS({ - "../../node_modules/axios/lib/helpers/combineURLs.js"(exports, module) { - "use strict"; - module.exports = function combineURLs(baseURL, relativeURL) { - return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; - }; - } - }); - - // ../../node_modules/axios/lib/core/buildFullPath.js - var require_buildFullPath = __commonJS({ - "../../node_modules/axios/lib/core/buildFullPath.js"(exports, module) { - "use strict"; - var isAbsoluteURL = require_isAbsoluteURL(); - var combineURLs = require_combineURLs(); - module.exports = function buildFullPath(baseURL, requestedURL) { - if (baseURL && !isAbsoluteURL(requestedURL)) { - return combineURLs(baseURL, requestedURL); - } - return requestedURL; - }; - } - }); - - // ../../node_modules/axios/lib/helpers/parseHeaders.js - var require_parseHeaders = __commonJS({ - "../../node_modules/axios/lib/helpers/parseHeaders.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var ignoreDuplicateOf = [ - "age", - "authorization", - "content-length", - "content-type", - "etag", - "expires", - "from", - "host", - "if-modified-since", - "if-unmodified-since", - "last-modified", - "location", - "max-forwards", - "proxy-authorization", - "referer", - "retry-after", - "user-agent" - ]; - module.exports = function parseHeaders(headers) { - var parsed = {}; - var key; - var val; - var i; - if (!headers) { - return parsed; - } - utils.forEach(headers.split("\n"), function parser(line) { - i = line.indexOf(":"); - key = utils.trim(line.substr(0, i)).toLowerCase(); - val = utils.trim(line.substr(i + 1)); - if (key) { - if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { - return; - } - if (key === "set-cookie") { - parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); - } else { - parsed[key] = parsed[key] ? parsed[key] + ", " + val : val; - } - } - }); - return parsed; - }; - } - }); - - // ../../node_modules/axios/lib/helpers/isURLSameOrigin.js - var require_isURLSameOrigin = __commonJS({ - "../../node_modules/axios/lib/helpers/isURLSameOrigin.js"(exports, module) { - "use strict"; - var utils = require_utils(); - module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv() { - var msie = /(msie|trident)/i.test(navigator.userAgent); - var urlParsingNode = document.createElement("a"); - var originURL; - function resolveURL(url) { - var href = url; - if (msie) { - urlParsingNode.setAttribute("href", href); - href = urlParsingNode.href; - } - urlParsingNode.setAttribute("href", href); - return { - href: urlParsingNode.href, - protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "", - host: urlParsingNode.host, - search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "", - hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "", - hostname: urlParsingNode.hostname, - port: urlParsingNode.port, - pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname - }; - } - originURL = resolveURL(window.location.href); - return function isURLSameOrigin(requestURL) { - var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL; - return parsed.protocol === originURL.protocol && parsed.host === originURL.host; - }; - }() : function nonStandardBrowserEnv() { - return function isURLSameOrigin() { - return true; - }; - }(); - } - }); - - // ../../node_modules/axios/lib/cancel/Cancel.js - var require_Cancel = __commonJS({ - "../../node_modules/axios/lib/cancel/Cancel.js"(exports, module) { - "use strict"; - function Cancel(message) { - this.message = message; - } - Cancel.prototype.toString = function toString() { - return "Cancel" + (this.message ? ": " + this.message : ""); - }; - Cancel.prototype.__CANCEL__ = true; - module.exports = Cancel; - } - }); - - // ../../node_modules/axios/lib/adapters/xhr.js - var require_xhr = __commonJS({ - "../../node_modules/axios/lib/adapters/xhr.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var settle = require_settle(); - var cookies = require_cookies(); - var buildURL = require_buildURL(); - var buildFullPath = require_buildFullPath(); - var parseHeaders = require_parseHeaders(); - var isURLSameOrigin = require_isURLSameOrigin(); - var createError = require_createError(); - var defaults = require_defaults(); - var Cancel = require_Cancel(); - module.exports = function xhrAdapter(config) { - return new Promise(function dispatchXhrRequest(resolve, reject) { - var requestData = config.data; - var requestHeaders = config.headers; - var responseType = config.responseType; - var onCanceled; - function done() { - if (config.cancelToken) { - config.cancelToken.unsubscribe(onCanceled); - } - if (config.signal) { - config.signal.removeEventListener("abort", onCanceled); - } - } - if (utils.isFormData(requestData)) { - delete requestHeaders["Content-Type"]; - } - var request = new XMLHttpRequest(); - if (config.auth) { - var username = config.auth.username || ""; - var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ""; - requestHeaders.Authorization = "Basic " + btoa(username + ":" + password); - } - var fullPath = buildFullPath(config.baseURL, config.url); - request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); - request.timeout = config.timeout; - function onloadend() { - if (!request) { - return; - } - var responseHeaders = "getAllResponseHeaders" in request ? parseHeaders(request.getAllResponseHeaders()) : null; - var responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response; - var response = { - data: responseData, - status: request.status, - statusText: request.statusText, - headers: responseHeaders, - config, - request - }; - settle(function _resolve(value) { - resolve(value); - done(); - }, function _reject(err) { - reject(err); - done(); - }, response); - request = null; - } - if ("onloadend" in request) { - request.onloadend = onloadend; - } else { - request.onreadystatechange = function handleLoad() { - if (!request || request.readyState !== 4) { - return; - } - if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) { - return; - } - setTimeout(onloadend); - }; - } - request.onabort = function handleAbort() { - if (!request) { - return; - } - reject(createError("Request aborted", config, "ECONNABORTED", request)); - request = null; - }; - request.onerror = function handleError() { - reject(createError("Network Error", config, null, request)); - request = null; - }; - request.ontimeout = function handleTimeout() { - var timeoutErrorMessage = config.timeout ? "timeout of " + config.timeout + "ms exceeded" : "timeout exceeded"; - var transitional = config.transitional || defaults.transitional; - if (config.timeoutErrorMessage) { - timeoutErrorMessage = config.timeoutErrorMessage; - } - reject(createError( - timeoutErrorMessage, - config, - transitional.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED", - request - )); - request = null; - }; - if (utils.isStandardBrowserEnv()) { - var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? cookies.read(config.xsrfCookieName) : void 0; - if (xsrfValue) { - requestHeaders[config.xsrfHeaderName] = xsrfValue; - } - } - if ("setRequestHeader" in request) { - utils.forEach(requestHeaders, function setRequestHeader(val, key) { - if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") { - delete requestHeaders[key]; - } else { - request.setRequestHeader(key, val); - } - }); - } - if (!utils.isUndefined(config.withCredentials)) { - request.withCredentials = !!config.withCredentials; - } - if (responseType && responseType !== "json") { - request.responseType = config.responseType; - } - if (typeof config.onDownloadProgress === "function") { - request.addEventListener("progress", config.onDownloadProgress); - } - if (typeof config.onUploadProgress === "function" && request.upload) { - request.upload.addEventListener("progress", config.onUploadProgress); - } - if (config.cancelToken || config.signal) { - onCanceled = function(cancel) { - if (!request) { - return; - } - reject(!cancel || cancel && cancel.type ? new Cancel("canceled") : cancel); - request.abort(); - request = null; - }; - config.cancelToken && config.cancelToken.subscribe(onCanceled); - if (config.signal) { - config.signal.aborted ? onCanceled() : config.signal.addEventListener("abort", onCanceled); - } - } - if (!requestData) { - requestData = null; - } - request.send(requestData); - }); - }; - } - }); - - // ../../node_modules/axios/lib/defaults.js - var require_defaults = __commonJS({ - "../../node_modules/axios/lib/defaults.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var normalizeHeaderName = require_normalizeHeaderName(); - var enhanceError = require_enhanceError(); - var DEFAULT_CONTENT_TYPE = { - "Content-Type": "application/x-www-form-urlencoded" - }; - function setContentTypeIfUnset(headers, value) { - if (!utils.isUndefined(headers) && utils.isUndefined(headers["Content-Type"])) { - headers["Content-Type"] = value; - } - } - function getDefaultAdapter() { - var adapter; - if (typeof XMLHttpRequest !== "undefined") { - adapter = require_xhr(); - } else if (typeof process !== "undefined" && Object.prototype.toString.call(process) === "[object process]") { - adapter = require_xhr(); - } - return adapter; - } - function stringifySafely(rawValue, parser, encoder) { - if (utils.isString(rawValue)) { - try { - (parser || JSON.parse)(rawValue); - return utils.trim(rawValue); - } catch (e) { - if (e.name !== "SyntaxError") { - throw e; - } - } - } - return (encoder || JSON.stringify)(rawValue); - } - var defaults = { - transitional: { - silentJSONParsing: true, - forcedJSONParsing: true, - clarifyTimeoutError: false - }, - adapter: getDefaultAdapter(), - transformRequest: [function transformRequest(data, headers) { - normalizeHeaderName(headers, "Accept"); - normalizeHeaderName(headers, "Content-Type"); - if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) { - return data; - } - if (utils.isArrayBufferView(data)) { - return data.buffer; - } - if (utils.isURLSearchParams(data)) { - setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8"); - return data.toString(); - } - if (utils.isObject(data) || headers && headers["Content-Type"] === "application/json") { - setContentTypeIfUnset(headers, "application/json"); - return stringifySafely(data); - } - return data; - }], - transformResponse: [function transformResponse(data) { - var transitional = this.transitional || defaults.transitional; - var silentJSONParsing = transitional && transitional.silentJSONParsing; - var forcedJSONParsing = transitional && transitional.forcedJSONParsing; - var strictJSONParsing = !silentJSONParsing && this.responseType === "json"; - if (strictJSONParsing || forcedJSONParsing && utils.isString(data) && data.length) { - try { - return JSON.parse(data); - } catch (e) { - if (strictJSONParsing) { - if (e.name === "SyntaxError") { - throw enhanceError(e, this, "E_JSON_PARSE"); - } - throw e; - } - } - } - return data; - }], - timeout: 0, - xsrfCookieName: "XSRF-TOKEN", - xsrfHeaderName: "X-XSRF-TOKEN", - maxContentLength: -1, - maxBodyLength: -1, - validateStatus: function validateStatus(status) { - return status >= 200 && status < 300; - }, - headers: { - common: { - "Accept": "application/json, text/plain, */*" - } - } - }; - utils.forEach(["delete", "get", "head"], function forEachMethodNoData(method) { - defaults.headers[method] = {}; - }); - utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { - defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); - }); - module.exports = defaults; - } - }); - - // ../../node_modules/axios/lib/core/transformData.js - var require_transformData = __commonJS({ - "../../node_modules/axios/lib/core/transformData.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var defaults = require_defaults(); - module.exports = function transformData(data, headers, fns) { - var context = this || defaults; - utils.forEach(fns, function transform(fn) { - data = fn.call(context, data, headers); - }); - return data; - }; - } - }); - - // ../../node_modules/axios/lib/cancel/isCancel.js - var require_isCancel = __commonJS({ - "../../node_modules/axios/lib/cancel/isCancel.js"(exports, module) { - "use strict"; - module.exports = function isCancel(value) { - return !!(value && value.__CANCEL__); - }; - } - }); - - // ../../node_modules/axios/lib/core/dispatchRequest.js - var require_dispatchRequest = __commonJS({ - "../../node_modules/axios/lib/core/dispatchRequest.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var transformData = require_transformData(); - var isCancel = require_isCancel(); - var defaults = require_defaults(); - var Cancel = require_Cancel(); - function throwIfCancellationRequested(config) { - if (config.cancelToken) { - config.cancelToken.throwIfRequested(); - } - if (config.signal && config.signal.aborted) { - throw new Cancel("canceled"); - } - } - module.exports = function dispatchRequest(config) { - throwIfCancellationRequested(config); - config.headers = config.headers || {}; - config.data = transformData.call( - config, - config.data, - config.headers, - config.transformRequest - ); - config.headers = utils.merge( - config.headers.common || {}, - config.headers[config.method] || {}, - config.headers - ); - utils.forEach( - ["delete", "get", "head", "post", "put", "patch", "common"], - function cleanHeaderConfig(method) { - delete config.headers[method]; - } - ); - var adapter = config.adapter || defaults.adapter; - return adapter(config).then(function onAdapterResolution(response) { - throwIfCancellationRequested(config); - response.data = transformData.call( - config, - response.data, - response.headers, - config.transformResponse - ); - return response; - }, function onAdapterRejection(reason) { - if (!isCancel(reason)) { - throwIfCancellationRequested(config); - if (reason && reason.response) { - reason.response.data = transformData.call( - config, - reason.response.data, - reason.response.headers, - config.transformResponse - ); - } - } - return Promise.reject(reason); - }); - }; - } - }); - - // ../../node_modules/axios/lib/core/mergeConfig.js - var require_mergeConfig = __commonJS({ - "../../node_modules/axios/lib/core/mergeConfig.js"(exports, module) { - "use strict"; - var utils = require_utils(); - module.exports = function mergeConfig(config1, config2) { - config2 = config2 || {}; - var config = {}; - function getMergedValue(target, source) { - if (utils.isPlainObject(target) && utils.isPlainObject(source)) { - return utils.merge(target, source); - } else if (utils.isPlainObject(source)) { - return utils.merge({}, source); - } else if (utils.isArray(source)) { - return source.slice(); - } - return source; - } - function mergeDeepProperties(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(config1[prop], config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - return getMergedValue(void 0, config1[prop]); - } - } - function valueFromConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(void 0, config2[prop]); - } - } - function defaultToConfig2(prop) { - if (!utils.isUndefined(config2[prop])) { - return getMergedValue(void 0, config2[prop]); - } else if (!utils.isUndefined(config1[prop])) { - return getMergedValue(void 0, config1[prop]); - } - } - function mergeDirectKeys(prop) { - if (prop in config2) { - return getMergedValue(config1[prop], config2[prop]); - } else if (prop in config1) { - return getMergedValue(void 0, config1[prop]); - } - } - var mergeMap = { - "url": valueFromConfig2, - "method": valueFromConfig2, - "data": valueFromConfig2, - "baseURL": defaultToConfig2, - "transformRequest": defaultToConfig2, - "transformResponse": defaultToConfig2, - "paramsSerializer": defaultToConfig2, - "timeout": defaultToConfig2, - "timeoutMessage": defaultToConfig2, - "withCredentials": defaultToConfig2, - "adapter": defaultToConfig2, - "responseType": defaultToConfig2, - "xsrfCookieName": defaultToConfig2, - "xsrfHeaderName": defaultToConfig2, - "onUploadProgress": defaultToConfig2, - "onDownloadProgress": defaultToConfig2, - "decompress": defaultToConfig2, - "maxContentLength": defaultToConfig2, - "maxBodyLength": defaultToConfig2, - "transport": defaultToConfig2, - "httpAgent": defaultToConfig2, - "httpsAgent": defaultToConfig2, - "cancelToken": defaultToConfig2, - "socketPath": defaultToConfig2, - "responseEncoding": defaultToConfig2, - "validateStatus": mergeDirectKeys - }; - utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { - var merge = mergeMap[prop] || mergeDeepProperties; - var configValue = merge(prop); - utils.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue); - }); - return config; - }; - } - }); - - // ../../node_modules/axios/lib/env/data.js - var require_data = __commonJS({ - "../../node_modules/axios/lib/env/data.js"(exports, module) { - module.exports = { - "version": "0.24.0" - }; - } - }); - - // ../../node_modules/axios/lib/helpers/validator.js - var require_validator = __commonJS({ - "../../node_modules/axios/lib/helpers/validator.js"(exports, module) { - "use strict"; - var VERSION = require_data().version; - var validators = {}; - ["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) { - validators[type] = function validator(thing) { - return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type; - }; - }); - var deprecatedWarnings = {}; - validators.transitional = function transitional(validator, version, message) { - function formatMessage(opt, desc) { - return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : ""); - } - return function(value, opt, opts) { - if (validator === false) { - throw new Error(formatMessage(opt, " has been removed" + (version ? " in " + version : ""))); - } - if (version && !deprecatedWarnings[opt]) { - deprecatedWarnings[opt] = true; - console.warn( - formatMessage( - opt, - " has been deprecated since v" + version + " and will be removed in the near future" - ) - ); - } - return validator ? validator(value, opt, opts) : true; - }; - }; - function assertOptions(options, schema, allowUnknown) { - if (typeof options !== "object") { - throw new TypeError("options must be an object"); - } - var keys = Object.keys(options); - var i = keys.length; - while (i-- > 0) { - var opt = keys[i]; - var validator = schema[opt]; - if (validator) { - var value = options[opt]; - var result = value === void 0 || validator(value, opt, options); - if (result !== true) { - throw new TypeError("option " + opt + " must be " + result); - } - continue; - } - if (allowUnknown !== true) { - throw Error("Unknown option " + opt); - } - } - } - module.exports = { - assertOptions, - validators - }; - } - }); - - // ../../node_modules/axios/lib/core/Axios.js - var require_Axios = __commonJS({ - "../../node_modules/axios/lib/core/Axios.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var buildURL = require_buildURL(); - var InterceptorManager = require_InterceptorManager(); - var dispatchRequest = require_dispatchRequest(); - var mergeConfig = require_mergeConfig(); - var validator = require_validator(); - var validators = validator.validators; - function Axios(instanceConfig) { - this.defaults = instanceConfig; - this.interceptors = { - request: new InterceptorManager(), - response: new InterceptorManager() - }; - } - Axios.prototype.request = function request(config) { - if (typeof config === "string") { - config = arguments[1] || {}; - config.url = arguments[0]; - } else { - config = config || {}; - } - config = mergeConfig(this.defaults, config); - if (config.method) { - config.method = config.method.toLowerCase(); - } else if (this.defaults.method) { - config.method = this.defaults.method.toLowerCase(); - } else { - config.method = "get"; - } - var transitional = config.transitional; - if (transitional !== void 0) { - validator.assertOptions(transitional, { - silentJSONParsing: validators.transitional(validators.boolean), - forcedJSONParsing: validators.transitional(validators.boolean), - clarifyTimeoutError: validators.transitional(validators.boolean) - }, false); - } - var requestInterceptorChain = []; - var synchronousRequestInterceptors = true; - this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { - if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) { - return; - } - synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; - requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); - }); - var responseInterceptorChain = []; - this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { - responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); - }); - var promise; - if (!synchronousRequestInterceptors) { - var chain = [dispatchRequest, void 0]; - Array.prototype.unshift.apply(chain, requestInterceptorChain); - chain = chain.concat(responseInterceptorChain); - promise = Promise.resolve(config); - while (chain.length) { - promise = promise.then(chain.shift(), chain.shift()); - } - return promise; - } - var newConfig = config; - while (requestInterceptorChain.length) { - var onFulfilled = requestInterceptorChain.shift(); - var onRejected = requestInterceptorChain.shift(); - try { - newConfig = onFulfilled(newConfig); - } catch (error) { - onRejected(error); - break; - } - } - try { - promise = dispatchRequest(newConfig); - } catch (error) { - return Promise.reject(error); - } - while (responseInterceptorChain.length) { - promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); - } - return promise; - }; - Axios.prototype.getUri = function getUri(config) { - config = mergeConfig(this.defaults, config); - return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, ""); - }; - utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) { - Axios.prototype[method] = function(url, config) { - return this.request(mergeConfig(config || {}, { - method, - url, - data: (config || {}).data - })); - }; - }); - utils.forEach(["post", "put", "patch"], function forEachMethodWithData(method) { - Axios.prototype[method] = function(url, data, config) { - return this.request(mergeConfig(config || {}, { - method, - url, - data - })); - }; - }); - module.exports = Axios; - } - }); - - // ../../node_modules/axios/lib/cancel/CancelToken.js - var require_CancelToken = __commonJS({ - "../../node_modules/axios/lib/cancel/CancelToken.js"(exports, module) { - "use strict"; - var Cancel = require_Cancel(); - function CancelToken(executor) { - if (typeof executor !== "function") { - throw new TypeError("executor must be a function."); - } - var resolvePromise; - this.promise = new Promise(function promiseExecutor(resolve) { - resolvePromise = resolve; - }); - var token = this; - this.promise.then(function(cancel) { - if (!token._listeners) - return; - var i; - var l = token._listeners.length; - for (i = 0; i < l; i++) { - token._listeners[i](cancel); - } - token._listeners = null; - }); - this.promise.then = function(onfulfilled) { - var _resolve; - var promise = new Promise(function(resolve) { - token.subscribe(resolve); - _resolve = resolve; - }).then(onfulfilled); - promise.cancel = function reject() { - token.unsubscribe(_resolve); - }; - return promise; - }; - executor(function cancel(message) { - if (token.reason) { - return; - } - token.reason = new Cancel(message); - resolvePromise(token.reason); - }); - } - CancelToken.prototype.throwIfRequested = function throwIfRequested() { - if (this.reason) { - throw this.reason; - } - }; - CancelToken.prototype.subscribe = function subscribe(listener) { - if (this.reason) { - listener(this.reason); - return; - } - if (this._listeners) { - this._listeners.push(listener); - } else { - this._listeners = [listener]; - } - }; - CancelToken.prototype.unsubscribe = function unsubscribe(listener) { - if (!this._listeners) { - return; - } - var index = this._listeners.indexOf(listener); - if (index !== -1) { - this._listeners.splice(index, 1); - } - }; - CancelToken.source = function source() { - var cancel; - var token = new CancelToken(function executor(c) { - cancel = c; - }); - return { - token, - cancel - }; - }; - module.exports = CancelToken; - } - }); - - // ../../node_modules/axios/lib/helpers/spread.js - var require_spread = __commonJS({ - "../../node_modules/axios/lib/helpers/spread.js"(exports, module) { - "use strict"; - module.exports = function spread(callback) { - return function wrap(arr) { - return callback.apply(null, arr); - }; - }; - } - }); - - // ../../node_modules/axios/lib/helpers/isAxiosError.js - var require_isAxiosError = __commonJS({ - "../../node_modules/axios/lib/helpers/isAxiosError.js"(exports, module) { - "use strict"; - module.exports = function isAxiosError(payload) { - return typeof payload === "object" && payload.isAxiosError === true; - }; - } - }); - - // ../../node_modules/axios/lib/axios.js - var require_axios = __commonJS({ - "../../node_modules/axios/lib/axios.js"(exports, module) { - "use strict"; - var utils = require_utils(); - var bind = require_bind(); - var Axios = require_Axios(); - var mergeConfig = require_mergeConfig(); - var defaults = require_defaults(); - function createInstance(defaultConfig) { - var context = new Axios(defaultConfig); - var instance = bind(Axios.prototype.request, context); - utils.extend(instance, Axios.prototype, context); - utils.extend(instance, context); - instance.create = function create(instanceConfig) { - return createInstance(mergeConfig(defaultConfig, instanceConfig)); - }; - return instance; - } - var axios = createInstance(defaults); - axios.Axios = Axios; - axios.Cancel = require_Cancel(); - axios.CancelToken = require_CancelToken(); - axios.isCancel = require_isCancel(); - axios.VERSION = require_data().version; - axios.all = function all(promises) { - return Promise.all(promises); - }; - axios.spread = require_spread(); - axios.isAxiosError = require_isAxiosError(); - module.exports = axios; - module.exports.default = axios; - } - }); - - // ../../node_modules/axios/index.js - var require_axios2 = __commonJS({ - "../../node_modules/axios/index.js"(exports, module) { - module.exports = require_axios(); - } - }); - - // ../../dist/src/fetch.js - var require_fetch = __commonJS({ - "../../dist/src/fetch.js"(exports) { - "use strict"; - var __importDefault = exports && exports.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.fetchActor = exports.fetchActorDigest = void 0; - var axios_1 = __importDefault(require_axios2()); - async function fetchActorDigest(actorRef, withTLS) { - const image = actorRef.split("/"); - const registry = image[0]; - const [name, version] = image[1].split(":"); - const response = await axios_1.default.get(`${withTLS ? "https://" : "http://"}${registry}/v2/${name}/manifests/${version}`, { - headers: { - Accept: "application/vnd.oci.image.manifest.v1+json" - } - }).catch((err) => { - throw err; - }); - const layers = response.data; - if (layers.layers.length === 0) { - throw new Error("no layers"); - } - return { - name, - digest: layers.layers[0].digest, - registry - }; - } - exports.fetchActorDigest = fetchActorDigest; - async function fetchActor(url) { - const response = await axios_1.default.get(url, { - responseType: "arraybuffer" - }).catch((err) => { - throw err; - }); - return new Uint8Array(response.data); - } - exports.fetchActor = fetchActor; - } - }); - - // ../../dist/wasmcloud-rs-js/pkg/index.js - var require_pkg = __commonJS({ - "../../dist/wasmcloud-rs-js/pkg/index.js"(exports, module) { - "use strict"; - (() => { - "use strict"; - var e, r, t, n, a = { 462: (e2, r2, t2) => { - t2.a(e2, async (e3, n2) => { - try { - t2.r(r2), t2.d(r2, { HostKey: () => a2.tL, __wbg_buffer_de1150f91b23aa89: () => a2.$r, __wbg_crypto_b8c92eaac23d0d80: () => a2.iY, __wbg_getRandomValues_dd27e6b0652b3236: () => a2.yX, __wbg_getRandomValues_e57c9b75ddead065: () => a2.ae, __wbg_length_e09c0b925ab8de5d: () => a2.uV, __wbg_msCrypto_9ad6677321a08dd8: () => a2.mS, __wbg_new_97cf52648830a70d: () => a2.xe, __wbg_newwithlength_e833b89f9db02732: () => a2.Nu, __wbg_randomFillSync_d2ba53160aec6aba: () => a2.Os, __wbg_require_f5521a5b85ad2542: () => a2.r2, __wbg_self_86b4b13392c7af56: () => a2.U5, __wbg_set_a0172b213e2469e9: () => a2.Rh, __wbg_static_accessor_MODULE_452b4680e8614c81: () => a2.DA, __wbg_subarray_9482ae5cd5cd99d3: () => a2.dx, __wbindgen_is_undefined: () => a2.XP, __wbindgen_memory: () => a2.oH, __wbindgen_object_drop_ref: () => a2.ug, __wbindgen_string_new: () => a2.h4, __wbindgen_throw: () => a2.Or, extract_jwt: () => a2.$n, validate_jwt: () => a2.Xo }); - var a2 = t2(194), _2 = e3([a2]); - a2 = (_2.then ? (await _2)() : _2)[0], n2(); - } catch (e4) { - n2(e4); - } - }); - }, 194: (e2, r2, t2) => { - t2.a(e2, async (n2, a2) => { - try { - let y = function(e3, r3) { - if (!(e3 instanceof r3)) - throw new TypeError("Cannot call a class as a function"); - }, p = function(e3, r3) { - for (var t3 = 0; t3 < r3.length; t3++) { - var n3 = r3[t3]; - n3.enumerable = n3.enumerable || false, n3.configurable = true, "value" in n3 && (n3.writable = true), Object.defineProperty(e3, n3.key, n3); - } - }, h = function() { - return 0 === i2.byteLength && (i2 = new Uint8Array(_2.memory.buffer)), i2; - }, m = function(e3, r3) { - return c.decode(h().subarray(e3, e3 + r3)); - }, v = function(e3) { - b === u.length && u.push(u.length + 1); - var r3 = b; - return b = u[r3], u[r3] = e3, r3; - }, x = function(e3) { - return u[e3]; - }, k = function(e3) { - e3 < 36 || (u[e3] = b, b = e3); - }, S = function(e3) { - var r3 = x(e3); - return k(e3), r3; - }, j = function() { - return 0 === d.byteLength && (d = new Int32Array(_2.memory.buffer)), d; - }, O = function(e3) { - if (1 == f) - throw new Error("out of js stack"); - return u[--f] = e3, f; - }, E = function(e3) { - try { - var r3 = _2.__wbindgen_add_to_stack_pointer(-16); - _2.extract_jwt(r3, O(e3)); - var t3 = j()[r3 / 4 + 0], n3 = j()[r3 / 4 + 1], a3 = j()[r3 / 4 + 2], o3 = j()[r3 / 4 + 3], i3 = t3, c2 = n3; - if (o3) - throw i3 = 0, c2 = 0, S(a3); - return m(i3, c2); - } finally { - _2.__wbindgen_add_to_stack_pointer(16), u[f++] = void 0, _2.__wbindgen_free(i3, c2); - } - }, A = function(e3, r3, t3) { - if (void 0 === t3) { - var n3 = w.encode(e3), a3 = r3(n3.length); - return h().subarray(a3, a3 + n3.length).set(n3), s = n3.length, a3; - } - for (var _3 = e3.length, o3 = r3(_3), i3 = h(), c2 = 0; c2 < _3; c2++) { - var u2 = e3.charCodeAt(c2); - if (u2 > 127) - break; - i3[o3 + c2] = u2; - } - if (c2 !== _3) { - 0 !== c2 && (e3 = e3.slice(c2)), o3 = t3(o3, _3, _3 = c2 + 3 * e3.length); - var d2 = h().subarray(o3 + c2, o3 + _3); - c2 += l(e3, d2).written; - } - return s = c2, o3; - }, P = function(e3) { - var r3 = A(e3, _2.__wbindgen_malloc, _2.__wbindgen_realloc), t3 = s; - return 0 !== _2.validate_jwt(r3, t3); - }, T = function(e3, r3) { - try { - return e3.apply(this, r3); - } catch (e4) { - _2.__wbindgen_exn_store(v(e4)); - } - }, U = function(e3, r3) { - return v(m(e3, r3)); - }, R = function(e3) { - S(e3); - }, V = function(e3, r3, t3) { - var n3, a3; - x(e3).randomFillSync((n3 = r3, a3 = t3, h().subarray(n3 / 1, n3 / 1 + a3))); - }, D = function(e3, r3) { - x(e3).getRandomValues(x(r3)); - }, X = function() { - return T(function() { - return v(self.self); - }, arguments); - }, $ = function(e3) { - return v(x(e3).crypto); - }, q = function(e3) { - return v(x(e3).msCrypto); - }, M = function(e3) { - return void 0 === x(e3); - }, L = function(e3, r3, t3) { - return v(x(e3).require(m(r3, t3))); - }, C = function(e3) { - return v(x(e3).getRandomValues); - }, F = function() { - return v(e2); - }, H = function(e3) { - return v(x(e3).buffer); - }, I = function(e3) { - return v(new Uint8Array(x(e3))); - }, N = function(e3, r3, t3) { - x(e3).set(x(r3), t3 >>> 0); - }, B = function(e3) { - return x(e3).length; - }, W = function(e3) { - return v(new Uint8Array(e3 >>> 0)); - }, Y = function(e3, r3, t3) { - return v(x(e3).subarray(r3 >>> 0, t3 >>> 0)); - }, K = function(e3, r3) { - throw new Error(m(e3, r3)); - }, z = function() { - return v(_2.memory); - }; - t2.d(r2, { $n: () => E, $r: () => H, DA: () => F, Nu: () => W, Or: () => K, Os: () => V, Rh: () => N, U5: () => X, XP: () => M, Xo: () => P, ae: () => D, dx: () => Y, h4: () => U, iY: () => $, mS: () => q, oH: () => z, r2: () => L, tL: () => g, uV: () => B, ug: () => R, xe: () => I, yX: () => C }); - var _2 = t2(293); - e2 = t2.hmd(e2); - var o2 = n2([_2]); - _2 = (o2.then ? (await o2)() : o2)[0]; - var i2, c = new ("undefined" == typeof TextDecoder ? (0, e2.require)("util").TextDecoder : TextDecoder)("utf-8", { ignoreBOM: true, fatal: true }); - c.decode(); - var u = new Array(32).fill(void 0); - u.push(void 0, null, true, false); - var d, b = u.length; - var f = 32; - var s = 0, w = new ("undefined" == typeof TextEncoder ? (0, e2.require)("util").TextEncoder : TextEncoder)("utf-8"), l = "function" == typeof w.encodeInto ? function(e3, r3) { - return w.encodeInto(e3, r3); - } : function(e3, r3) { - var t3 = w.encode(e3); - return r3.set(t3), { read: e3.length, written: t3.length }; - }; - var g = function() { - function e3() { - y(this, e3); - var r4 = _2.hostkey_new(); - return e3.__wrap(r4); - } - var r3, t3, n3; - return r3 = e3, n3 = [{ key: "__wrap", value: function(r4) { - var t4 = Object.create(e3.prototype); - return t4.ptr = r4, t4; - } }], (t3 = [{ key: "__destroy_into_raw", value: function() { - var e4 = this.ptr; - return this.ptr = 0, e4; - } }, { key: "free", value: function() { - var e4 = this.__destroy_into_raw(); - _2.__wbg_hostkey_free(e4); - } }, { key: "pk", get: function() { - try { - var e4 = _2.__wbindgen_add_to_stack_pointer(-16); - _2.hostkey_pk(e4, this.ptr); - var r4 = j()[e4 / 4 + 0], t4 = j()[e4 / 4 + 1]; - return m(r4, t4); - } finally { - _2.__wbindgen_add_to_stack_pointer(16), _2.__wbindgen_free(r4, t4); - } - } }, { key: "seed", get: function() { - try { - var e4 = _2.__wbindgen_add_to_stack_pointer(-16); - _2.hostkey_seed(e4, this.ptr); - var r4 = j()[e4 / 4 + 0], t4 = j()[e4 / 4 + 1]; - return m(r4, t4); - } finally { - _2.__wbindgen_add_to_stack_pointer(16), _2.__wbindgen_free(r4, t4); - } - } }]) && p(r3.prototype, t3), n3 && p(r3, n3), e3; - }(); - d = new Int32Array(_2.memory.buffer), i2 = new Uint8Array(_2.memory.buffer), a2(); - } catch (e3) { - a2(e3); - } - }); - }, 293: (e2, r2, t2) => { - t2.a(e2, async (n2, a2) => { - try { - var _2, o2 = n2([_2 = t2(194)]), [_2] = o2.then ? (await o2)() : o2; - await t2.v(r2, e2.id, "cb0a530d888b2657c6eb", { "./index_bg.js": { __wbindgen_string_new: _2.h4, __wbindgen_object_drop_ref: _2.ug, __wbg_randomFillSync_d2ba53160aec6aba: _2.Os, __wbg_getRandomValues_e57c9b75ddead065: _2.ae, __wbg_self_86b4b13392c7af56: _2.U5, __wbg_crypto_b8c92eaac23d0d80: _2.iY, __wbg_msCrypto_9ad6677321a08dd8: _2.mS, __wbindgen_is_undefined: _2.XP, __wbg_require_f5521a5b85ad2542: _2.r2, __wbg_getRandomValues_dd27e6b0652b3236: _2.yX, __wbg_static_accessor_MODULE_452b4680e8614c81: _2.DA, __wbg_buffer_de1150f91b23aa89: _2.$r, __wbg_new_97cf52648830a70d: _2.xe, __wbg_set_a0172b213e2469e9: _2.Rh, __wbg_length_e09c0b925ab8de5d: _2.uV, __wbg_newwithlength_e833b89f9db02732: _2.Nu, __wbg_subarray_9482ae5cd5cd99d3: _2.dx, __wbindgen_throw: _2.Or, __wbindgen_memory: _2.oH } }), a2(); - } catch (e3) { - a2(e3); - } - }, 1); - } }, _ = {}; - function o(e2) { - var r2 = _[e2]; - if (void 0 !== r2) - return r2.exports; - var t2 = _[e2] = { id: e2, loaded: false, exports: {} }; - return a[e2](t2, t2.exports, o), t2.loaded = true, t2.exports; - } - e = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__", r = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__", t = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__", n = (e2) => { - e2 && !e2.d && (e2.d = 1, e2.forEach((e3) => e3.r--), e2.forEach((e3) => e3.r-- ? e3.r++ : e3())); - }, o.a = (a2, _2, o2) => { - var i2; - o2 && ((i2 = []).d = 1); - var c, u, d, b = /* @__PURE__ */ new Set(), f = a2.exports, s = new Promise((e2, r2) => { - d = r2, u = e2; - }); - s[r] = f, s[e] = (e2) => (i2 && e2(i2), b.forEach(e2), s.catch((e3) => { - })), a2.exports = s, _2((a3) => { - var _3; - c = ((a4) => a4.map((a5) => { - if (null !== a5 && "object" == typeof a5) { - if (a5[e]) - return a5; - if (a5.then) { - var _4 = []; - _4.d = 0, a5.then((e2) => { - o4[r] = e2, n(_4); - }, (e2) => { - o4[t] = e2, n(_4); - }); - var o4 = {}; - return o4[e] = (e2) => e2(_4), o4; - } - } - var i3 = {}; - return i3[e] = (e2) => { - }, i3[r] = a5, i3; - }))(a3); - var o3 = () => c.map((e2) => { - if (e2[t]) - throw e2[t]; - return e2[r]; - }), u2 = new Promise((r2) => { - (_3 = () => r2(o3)).r = 0; - var t2 = (e2) => e2 !== i2 && !b.has(e2) && (b.add(e2), e2 && !e2.d && (_3.r++, e2.push(_3))); - c.map((r3) => r3[e](t2)); - }); - return _3.r ? u2 : o3(); - }, (e2) => (e2 ? d(s[t] = e2) : u(f), n(i2))), i2 && (i2.d = 0); - }, o.d = (e2, r2) => { - for (var t2 in r2) - o.o(r2, t2) && !o.o(e2, t2) && Object.defineProperty(e2, t2, { enumerable: true, get: r2[t2] }); - }, o.g = function() { - if ("object" == typeof globalThis) - return globalThis; - try { - return this || new Function("return this")(); - } catch (e2) { - if ("object" == typeof window) - return window; - } - }(), o.hmd = (e2) => ((e2 = Object.create(e2)).children || (e2.children = []), Object.defineProperty(e2, "exports", { enumerable: true, set: () => { - throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: " + e2.id); - } }), e2), o.o = (e2, r2) => Object.prototype.hasOwnProperty.call(e2, r2), o.r = (e2) => { - "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true }); - }, o.v = (e2, r2, t2, n2) => { - var a2 = fetch(o.p + "wasmcloud.wasm"); - return "function" == typeof WebAssembly.instantiateStreaming ? WebAssembly.instantiateStreaming(a2, n2).then((r3) => Object.assign(e2, r3.instance.exports)) : a2.then((e3) => e3.arrayBuffer()).then((e3) => WebAssembly.instantiate(e3, n2)).then((r3) => Object.assign(e2, r3.instance.exports)); - }, (() => { - var e2; - o.g.importScripts && (e2 = o.g.location + ""); - var r2 = o.g.document; - if (!e2 && r2 && (r2.currentScript && (e2 = r2.currentScript.src), !e2)) { - var t2 = r2.getElementsByTagName("script"); - t2.length && (e2 = t2[t2.length - 1].src); - } - if (!e2) - throw new Error("Automatic publicPath is not supported in this browser"); - e2 = e2.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/"), o.p = e2; - })(); - var i = o(462); - module.exports = i; - })(); - } - }); - - // ../../dist/src/host.js - var require_host = __commonJS({ - "../../dist/src/host.js"(exports) { - "use strict"; - var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { - return m[k]; - } }); - } : function(o, m, k, k2) { - if (k2 === void 0) - k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar = exports && exports.__importStar || function(mod) { - if (mod && mod.__esModule) - return mod; - var result = {}; - if (mod != null) { - for (var k in mod) - if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) - __createBinding(result, mod, k); - } - __setModuleDefault(result, mod); - return result; - }; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.startHost = exports.Host = void 0; - var msgpack_1 = require_dist(); - var nats_ws_1 = require_nats2(); - var actor_1 = require_actor(); - var events_1 = require_events(); - var fetch_1 = require_fetch(); - var util_1 = require_util4(); - var HOST_HEARTBEAT_INTERVAL = 3e4; - var Host = class { - constructor(name = "default", withRegistryTLS, heartbeatInterval, natsConnOpts, wasm) { - const hostKey = new wasm.HostKey(); - this.name = name; - this.key = hostKey.pk; - this.seed = hostKey.seed; - this.withRegistryTLS = withRegistryTLS; - this.actors = {}; - this.labels = { - "hostcore.arch": "web", - "hostcore.os": "browser", - "hostcore.osfamily": "js" - }; - this.friendlyName = `java-script-${Math.round(Math.random() * 9999)}`; - this.wasm = wasm; - this.heartbeatInterval = heartbeatInterval; - this.natsConnOpts = natsConnOpts; - this.invocationCallbacks = {}; - this.hostCalls = {}; - this.writers = {}; - } - async connectNATS() { - const opts = Array.isArray(this.natsConnOpts) ? { - servers: this.natsConnOpts - } : this.natsConnOpts; - this.natsConn = await nats_ws_1.connect(opts); - } - async disconnectNATS() { - this.natsConn.close(); - } - async startHeartbeat() { - this.heartbeatIntervalId; - const heartbeat = { - actors: [], - providers: [], - labels: this.labels - }; - for (const actor in this.actors) { - heartbeat.actors.push({ - actor, - instances: 1 - }); - } - const heartbeatFn = () => { - this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.HeartBeat, heartbeat))); - }; - this.heartbeatIntervalId = setInterval(heartbeatFn, this.heartbeatInterval); - } - async stopHeartbeat() { - clearInterval(this.heartbeatIntervalId); - this.heartbeatIntervalId = null; - } - async publishHostStarted() { - const hostStarted = { - labels: this.labels, - friendly_name: this.friendlyName - }; - this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.HostStarted, hostStarted))); - } - async subscribeToEvents(eventCallback) { - this.eventsSubscription = this.natsConn.subscribe(`wasmbus.evt.${this.name}`); - for await (const event of this.eventsSubscription) { - const eventData = util_1.jsonDecode(event.data); - if (eventCallback) { - eventCallback(eventData); - } - } - throw new Error("evt subscription was closed"); - } - async unsubscribeEvents() { - var _a; - (_a = this.eventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe(); - this.eventsSubscription = null; - } - async launchActor(actorRef, invocationCallback, hostCall, writer) { - const actor = { - actor_ref: actorRef, - host_id: this.key - }; - this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`, util_1.jsonEncode(actor)); - if (invocationCallback) { - this.invocationCallbacks[actorRef] = invocationCallback; - } - if (hostCall) { - this.hostCalls[actorRef] = hostCall; - } - if (writer) { - this.writers[actorRef] = writer; - } - } - async stopActor(actorRef) { - const actorToStop = { - host_id: this.key, - actor_ref: actorRef - }; - this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`, util_1.jsonEncode(actorToStop)); - } - async listenLaunchActor() { - var _a, _b, _c; - const actorsTopic = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`); - for await (const actorMessage of actorsTopic) { - const actorData = util_1.jsonDecode(actorMessage.data); - const actorRef = actorData.actor_ref; - const usingRegistry = !actorRef.endsWith(".wasm"); - try { - let url; - if (usingRegistry) { - const actorDigest = await fetch_1.fetchActorDigest(actorRef); - url = `${this.withRegistryTLS ? "https://" : "http://"}${actorDigest.registry}/v2/${actorDigest.name}/blobs/${actorDigest.digest}`; - } else { - url = actorRef; - } - const actorModule = await fetch_1.fetchActor(url); - const actor = await actor_1.startActor(this.name, this.key, actorModule, this.natsConn, this.wasm, (_a = this.invocationCallbacks) === null || _a === void 0 ? void 0 : _a[actorRef], (_b = this.hostCalls) === null || _b === void 0 ? void 0 : _b[actorRef], (_c = this.writers) === null || _c === void 0 ? void 0 : _c[actorRef]); - if (this.actors[actorRef]) { - this.actors[actorRef].count++; - } else { - this.actors[actorRef] = { - count: 1, - actor - }; - } - } catch (err) { - console.log("error", err); - } - } - throw new Error("la.subscription was closed"); - } - async listenStopActor() { - const actorsTopic = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`); - for await (const actorMessage of actorsTopic) { - const actorData = util_1.jsonDecode(actorMessage.data); - const actorStop = { - instance_id: util_1.uuidv4(), - public_key: this.actors[actorData.actor_ref].actor.key - }; - this.natsConn.publish(`wasmbus.evt.${this.name}`, util_1.jsonEncode(events_1.createEventMessage(this.key, events_1.EventType.ActorStopped, actorStop))); - delete this.actors[actorData.actor_ref]; - delete this.invocationCallbacks[actorData.actor_ref]; - } - throw new Error("sa.subscription was closed"); - } - async createLinkDefinition(actorKey, providerKey, linkName, contractId, values) { - const linkDefinition = { - actor_id: actorKey, - provider_id: providerKey, - link_name: linkName, - contract_id: contractId, - values - }; - this.natsConn.publish(`wasmbus.rpc.${this.name}.${providerKey}.${linkName}.linkdefs.put`, msgpack_1.encode(linkDefinition)); - } - async startHost() { - await this.connectNATS(); - Promise.all([ - this.publishHostStarted(), - this.startHeartbeat(), - this.listenLaunchActor(), - this.listenStopActor() - ]).catch((err) => { - throw err; - }); - } - async stopHost() { - await this.stopHeartbeat(); - for (const actor in this.actors) { - await this.stopActor(actor); - } - await this.natsConn.drain(); - await this.disconnectNATS(); - } - }; - exports.Host = Host; - async function startHost2(name, withRegistryTLS = true, natsConnection, heartbeatInterval) { - const wasmModule = await Promise.resolve().then(() => __importStar(require_pkg())); - const wasm = await wasmModule.default; - const host = new Host(name, withRegistryTLS, heartbeatInterval ? heartbeatInterval : HOST_HEARTBEAT_INTERVAL, natsConnection, wasm); - await host.startHost(); - return host; - } - exports.startHost = startHost2; - } - }); - - // ../../dist/src/index.js - var require_src2 = __commonJS({ - "../../dist/src/index.js"(exports) { - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); - exports.startHost = void 0; - var host_1 = require_host(); - Object.defineProperty(exports, "startHost", { enumerable: true, get: function() { - return host_1.startHost; - } }); - } - }); - - // main.js - var import_src = __toESM(require_src2()); - var runningHosts = []; - document.getElementById("hostButton").onclick = () => { - const latticePrefixInput = document.getElementById("latticePrefix"); - if (!latticePrefixInput || !latticePrefixInput.value || latticePrefixInput.value === "") { - (async () => { - const host = await (0, import_src.startHost)("374b6434-f18d-4b93-8743-bcd3089e4d5b", false, ["ws://localhost:6222"]); - runningHosts.push(host); - document.getElementById("runningHosts").innerHTML = hostList(runningHosts).innerHTML; - console.dir(runningHosts); - })(); - } else { - (async () => { - const host = await (0, import_src.startHost)(latticePrefixInput.value, false, ["ws://localhost:6222"]); - runningHosts.push(host); - document.getElementById("runningHosts").innerHTML = hostList(runningHosts).innerHTML; - console.dir(runningHosts); - })(); - } - }; - function hostList(runningHosts2) { - let list = document.createElement("ol"); - runningHosts2.forEach((host) => { - console.dir(host); - let listItem = document.createElement("li"); - listItem.innerText = host.friendlyName; - list.appendChild(listItem); - }); - return list; - } -})(); diff --git a/src/actor.ts b/src/actor.ts index 3aa5cfb..a4477b9 100644 --- a/src/actor.ts +++ b/src/actor.ts @@ -11,10 +11,13 @@ import { InvocationMessage, StopActorMessage, HostCall, - Writer + Writer, + ActorStartedClaims } from './types'; import { jsonEncode, parseJwt, uuidv4 } from './util'; +const CTL_TOPIC_PREFIX: string = 'wasmbus.ctl'; + /** * Actor holds the actor wasm module */ @@ -47,6 +50,7 @@ export class Actor { sub: '', wascap: { name: '', + call_alias: '', hash: '', tags: [], caps: [], @@ -84,9 +88,10 @@ export class Actor { async stopActor(natsConn: NatsConnection) { const actorToStop: StopActorMessage = { host_id: this.hostKey, - actor_ref: this.key + actor_ref: this.key, + count: 0 }; - natsConn.publish(`wasmbus.ctl.${this.hostName}.cmd.${this.hostKey}.sa`, jsonEncode(actorToStop)); + natsConn.publish(`${CTL_TOPIC_PREFIX}.${this.hostName}.cmd.${this.hostKey}.sa`, jsonEncode(actorToStop)); } /** @@ -97,22 +102,36 @@ export class Actor { async publishActorStarted(natsConn: NatsConnection) { // publish claims const claims: ActorClaimsMessage = { - call_alias: '', - caps: this.claims.wascap.caps[0], + call_alias: this.claims.wascap.call_alias || 'N/A', + caps: this.claims.wascap.caps, iss: this.claims.iss, name: this.claims.wascap.name, rev: '1', sub: this.claims.sub, - tags: '', + tags: this.claims.wascap.tags, version: this.claims.wascap.ver }; natsConn.publish(`lc.${this.hostName}.claims.${this.key}`, jsonEncode(claims)); + const actorStartedClaims: ActorStartedClaims = { + call_alias: claims.call_alias, + caps: claims.caps, + issuer: claims.iss, + name: claims.name, + revision: claims.rev, + tags: claims.tags, + version: claims.version, + not_before_human: null, + expires_human: null + }; + // publish actor_started const actorStarted: ActorStartedMessage = { + annotations: {}, api_version: 0, instance_id: uuidv4(), - public_key: this.key + public_key: this.key, + claims: actorStartedClaims }; natsConn.publish( `wasmbus.evt.${this.hostName}`, diff --git a/src/host.ts b/src/host.ts index 56d0127..fd7a9d8 100644 --- a/src/host.ts +++ b/src/host.ts @@ -18,6 +18,7 @@ import { import { jsonDecode, jsonEncode, uuidv4 } from './util'; const HOST_HEARTBEAT_INTERVAL: number = 30000; +const CTL_TOPIC_PREFIX: string = 'wasmbus.ctl'; /** * Host holds the js/browser host @@ -178,7 +179,7 @@ export class Host { actor_ref: actorRef, host_id: this.key }; - this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`, jsonEncode(actor)); + this.natsConn.publish(`${CTL_TOPIC_PREFIX}.${this.name}.cmd.${this.key}.la`, jsonEncode(actor)); if (invocationCallback) { this.invocationCallbacks![actorRef] = invocationCallback; } @@ -190,6 +191,20 @@ export class Host { } } + async launchActorFromBytes(actorBytes: Uint8Array) { + const actor: Actor = await startActor(this.name, this.key, actorBytes, this.natsConn, this.wasm); + + if (this.actors[actor.claims.sub]) { + this.actors[actor.claims.sub].count++; + } else { + this.actors[actor.claims.sub] = { + count: 1, + actor: actor + }; + } + return actor; + } + /** * stopActor stops an actor by publishing the sa message * @@ -198,21 +213,23 @@ export class Host { async stopActor(actorRef: string) { const actorToStop: StopActorMessage = { host_id: this.key, - actor_ref: actorRef + actor_ref: actorRef, + // Stop all instances + count: 0 }; - this.natsConn.publish(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`, jsonEncode(actorToStop)); + this.natsConn.publish(`${CTL_TOPIC_PREFIX}.${this.name}.cmd.${this.key}.sa`, jsonEncode(actorToStop)); } /** * listenLaunchActor listens for start actor message and will fetch the actor (either from disk or registry) and initialize the actor */ async listenLaunchActor() { - // subscribe to the .la topic `wasmbus.ctl.${this.name}.cmd.${this.key}.la` + // subscribe to the .la topic `${CTL_TOPIC_PREFIX}.${this.name}.cmd.${this.key}.la` // decode the data // fetch the actor from registry or local // start the actor class // listen for invocation events - const actorsTopic: Subscription = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.la`); + const actorsTopic: Subscription = this.natsConn.subscribe(`${CTL_TOPIC_PREFIX}.${this.name}.cmd.${this.key}.la`); for await (const actorMessage of actorsTopic) { const actorData = jsonDecode(actorMessage.data); const actorRef: string = (actorData as LaunchActorMessage).actor_ref; @@ -262,19 +279,26 @@ export class Host { // listen for stop actor message, decode the data // publish actor_stopped to the lattice // delete the actor from the host and remove the invocation callback - const actorsTopic: Subscription = this.natsConn.subscribe(`wasmbus.ctl.${this.name}.cmd.${this.key}.sa`); + const actorsTopic: Subscription = this.natsConn.subscribe(`${CTL_TOPIC_PREFIX}.${this.name}.cmd.${this.key}.sa`); for await (const actorMessage of actorsTopic) { + console.log('GOT ACTOR STOP MESSAGE'); const actorData = jsonDecode(actorMessage.data); - const actorStop: ActorStoppedMessage = { - instance_id: uuidv4(), - public_key: this.actors[(actorData as StopActorMessage).actor_ref].actor.key - }; - this.natsConn.publish( - `wasmbus.evt.${this.name}`, - jsonEncode(createEventMessage(this.key, EventType.ActorStopped, actorStop)) - ); - delete this.actors[(actorData as StopActorMessage).actor_ref]; - delete this.invocationCallbacks![(actorData as StopActorMessage).actor_ref]; + console.dir(actorData); + const actor = this.actors[(actorData as StopActorMessage).actor_ref]; + if (actor) { + const actorStop: ActorStoppedMessage = { + instance_id: uuidv4(), + public_key: this.actors[(actorData as StopActorMessage).actor_ref].actor.key + }; + this.natsConn.publish( + `wasmbus.evt.${this.name}`, + jsonEncode(createEventMessage(this.key, EventType.ActorStopped, actorStop)) + ); + delete this.actors[(actorData as StopActorMessage).actor_ref]; + delete this.invocationCallbacks![(actorData as StopActorMessage).actor_ref]; + } else { + console.log('actor not running on this host'); + } } throw new Error('sa.subscription was closed'); } diff --git a/src/types.ts b/src/types.ts index 4fe9c82..6efcec0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -28,21 +28,22 @@ export type ActorClaims = { wascap: { name: string; hash: string; - tags: Array; + tags: Array; caps: Array; ver: string; + call_alias: string | null; prov: boolean; }; }; export type ActorClaimsMessage = { call_alias: string; - caps: any; + caps: Array; iss: string; name: string; rev: string; sub: string; - tags: string; + tags: Array; version: string; }; @@ -51,10 +52,24 @@ export type LaunchActorMessage = { host_id: string; }; +export type ActorStartedClaims = { + call_alias: string; + caps: string[]; + issuer: string; + tags: Array; + name: string; + revision: string; + version: string; + not_before_human: number | null; + expires_human: number | null; +}; + export type ActorStartedMessage = { api_version: number; instance_id: string; + annotations: object; public_key: string; + claims: ActorStartedClaims; }; export type ActorHealthCheckPassMessage = { @@ -65,6 +80,7 @@ export type ActorHealthCheckPassMessage = { export type StopActorMessage = { host_id: string; actor_ref: string; + count: number; }; export type ActorStoppedMessage = { From fa6fc9474124f366b92067c997ee06cfce337f50 Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Thu, 22 Dec 2022 12:29:48 -0500 Subject: [PATCH 3/4] made infra easier Signed-off-by: Brooks Townsend --- examples/simple/Makefile | 3 +++ examples/simple/README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/simple/Makefile b/examples/simple/Makefile index bdd9218..d7a547d 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -4,6 +4,9 @@ help: ## Display this help install: npm install +infra: ## Launch required infrastructure using Docker + cd ../../test/infra && docker compose up + build: install ## Install NPM dependencies and compile the JS library and wasmcloud.wasm file node esbuild.js diff --git a/examples/simple/README.md b/examples/simple/README.md index fdb65b4..012d894 100644 --- a/examples/simple/README.md +++ b/examples/simple/README.md @@ -12,7 +12,7 @@ This directory contains examples of using the `wasmcloud-js` library with an `es ## Build and Run -This example is bundled with `esbuild` and runs locally with use of the `python3` http server. +This example is bundled with `esbuild` and runs locally with use of the `python3` http server. As mentioned above you will need a NATS server running with JetStream and WebSockets. You can either launch a NATS server yourself with `nats-server -js -c ../../test/infra/nats.conf`, or use the included Docker compose file with `make infra` ```sh make run From 856ecd7e2223aff6ba5829a073f2b0753e77364e Mon Sep 17 00:00:00 2001 From: Brooks Townsend Date: Thu, 22 Dec 2022 12:32:05 -0500 Subject: [PATCH 4/4] detach infra Signed-off-by: Brooks Townsend --- examples/simple/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/simple/Makefile b/examples/simple/Makefile index d7a547d..a99d71a 100644 --- a/examples/simple/Makefile +++ b/examples/simple/Makefile @@ -5,7 +5,7 @@ install: npm install infra: ## Launch required infrastructure using Docker - cd ../../test/infra && docker compose up + cd ../../test/infra && docker compose up -d build: install ## Install NPM dependencies and compile the JS library and wasmcloud.wasm file node esbuild.js