pshenmic-dpp 2.0.0-dev.22 → 2.0.0-dev.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/binaries/bindingsTypes.d.ts +27 -8
- package/dist/binaries/memory.cjs +7 -0
- package/dist/binaries/memory.d.cts +2 -0
- package/dist/binaries/native/aarch64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-apple-darwin/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-unknown-linux-gnu/pshenmic_dpp.node +0 -0
- package/dist/binaries/native/x86_64-unknown-linux-musl/pshenmic_dpp.node +0 -0
- package/dist/binaries/pshenmic_dpp.android.node/arm64-v8a/libpshenmic_dpp.so +0 -0
- package/dist/binaries/pshenmic_dpp.apple.node/ios-arm64-simulator/libpshenmic_dpp.framework/libpshenmic_dpp +0 -0
- package/dist/binaries/pshenmic_dpp.d.ts +3 -0
- package/dist/binaries/pshenmic_dpp.js +1 -1
- package/dist/binaries/wasm/wasmBytes.cjs +2 -1
- package/dist/binaries/wasm/wasmBytes.d.cts +2 -1
- package/dist/binaries/wasm/workerBundle.cjs +6 -0
- package/dist/binaries/wasm/workerBundle.d.cts +2 -0
- package/dist/binaries/wasm.d.ts +3 -0
- package/dist/binaries/wasm.js +1 -1
- package/dist/binaries/wasmCreation.cjs +119 -38
- package/dist/binaries/wasmCreation.d.cts +2 -0
- package/dist/src/dpp/dpp.d.ts +1 -0
- package/dist/src/dpp/dpp.js +1 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.d.ts +7 -0
- package/dist/src/dpp/structs/Orchard/OrchardProver.js +17 -1
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.d.ts +13 -6
- package/dist/src/dpp/structs/Orchard/ShieldedBuilder.js +29 -13
- package/dist/src/dpp/types.d.ts +22 -0
- package/dist/src/dpp/verify/System/verifyFinalizedEpochInfosProof.d.ts +2 -0
- package/dist/src/dpp/verify/System/verifyFinalizedEpochInfosProof.js +27 -0
- package/package.json +1 -1
- package/tests/unit/Shielded.spec.ts +8 -6
- package/tests/unit/WebAssembly.spec.ts +40 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Generated by utils/buildWorkerBundle.mjs — self-contained browser worker
|
|
3
|
+
// for wasm threads (spawned from a Blob URL by wasmCreation.cjs).
|
|
4
|
+
/** @type {string} */
|
|
5
|
+
const source = "!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],e):e((t=\"undefined\"!=typeof globalThis?globalThis:t||self).wasmUtil={})}(this,(function(t){\"use strict\";const e=\"undefined\"!=typeof WebAssembly?WebAssembly:\"undefined\"!=typeof WXWebAssembly?WXWebAssembly:void 0;if(!e)throw new Error(\"WebAssembly is not supported in this environment\");function n(t,e){if(null===t||\"object\"!=typeof t)throw new TypeError(`${e} must be an object. Received ${null===t?\"null\":typeof t}`)}function r(t,e){if(\"string\"!=typeof t)throw new TypeError(`${e} must be a string. Received ${null===t?\"null\":typeof t}`)}function i(t,e){if(\"function\"!=typeof t)throw new TypeError(`${e} must be a function. Received ${null===t?\"null\":typeof t}`)}function s(t,e){if(void 0!==t)throw new TypeError(`${e} must be undefined. Received ${null===t?\"null\":typeof t}`)}function o(t){return!(!t||\"object\"!=typeof t&&\"function\"!=typeof t||\"function\"!=typeof t.then)}function a(t,e){const n=Object.create(null);return Object.keys(t).forEach((r=>{const i=t[r];Object.defineProperty(n,r,{enumerable:!0,value:e(i,r)})})),n}function c(t,e,n){return\"function\"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(t.buffer.constructor)?t.slice(e,n):t.subarray(e,n)}const u=[\"asyncify_get_state\",\"asyncify_start_rewind\",\"asyncify_start_unwind\",\"asyncify_stop_rewind\",\"asyncify_stop_unwind\"];function f(t,e,n,r){if(\"function\"!=typeof t.exports[r]||n<=0)return{wasm64:e,dataPtr:16,start:e?32:24,end:1024};const i=t.exports[r],s=e?Number(i(BigInt(16)+BigInt(n))):i(8+n);if(0===s)throw new Error(\"Allocate asyncify data failed\");return e?{wasm64:e,dataPtr:s,start:s+16,end:s+16+n}:{wasm64:e,dataPtr:s,start:s+8,end:s+8+n}}class h{constructor(){this.value=void 0,this.exports=void 0,this.dataPtr=0}init(t,n,r){var i,s;if(this.exports)throw new Error(\"Asyncify has been initialized\");if(!(t instanceof e.Memory))throw new TypeError(\"Require WebAssembly.Memory object\");const o=n.exports;for(let t=0;t<u.length;++t)if(\"function\"!=typeof o[u[t]])throw new TypeError(\"Invalid asyncify wasm\");let a;const c=Boolean(r.wasm64);a=r.tryAllocate?!0===r.tryAllocate?f(n,c,4096,\"malloc\"):f(n,c,null!==(i=r.tryAllocate.size)&&void 0!==i?i:4096,null!==(s=r.tryAllocate.name)&&void 0!==s?s:\"malloc\"):{wasm64:c,dataPtr:16,start:c?32:24,end:1024},this.dataPtr=a.dataPtr,c?new BigInt64Array(t.buffer,this.dataPtr).set([BigInt(a.start),BigInt(a.end)]):new Int32Array(t.buffer,this.dataPtr).set([a.start,a.end]),this.exports=this.wrapExports(o,r.wrapExports);const h=Object.create(e.Instance.prototype);return Object.defineProperty(h,\"exports\",{value:this.exports}),h}assertState(){if(0!==this.exports.asyncify_get_state())throw new Error(\"Asyncify state error\")}wrapImportFunction(t){const e=this;return function(){for(;2===e.exports.asyncify_get_state();)return e.exports.asyncify_stop_rewind(),e.value;e.assertState();const n=t.apply(this,arguments);if(!o(n))return n;e.exports.asyncify_start_unwind(e.dataPtr),e.value=n}}wrapImports(t){const e={};return Object.keys(t).forEach((n=>{const r=t[n],i={};Object.keys(r).forEach((t=>{const e=r[t];i[t]=\"function\"==typeof e?this.wrapImportFunction(e):e})),e[n]=i})),e}wrapExportFunction(t){const e=this;return async function(){e.assertState();let n=t.apply(this,arguments);for(;1===e.exports.asyncify_get_state();)e.exports.asyncify_stop_unwind(),e.value=await e.value,e.assertState(),e.exports.asyncify_start_rewind(e.dataPtr),n=t.call(this);return e.assertState(),n}}wrapExports(t,e){return a(t,((t,n)=>{let r=-1!==u.indexOf(n)||\"function\"!=typeof t;return Array.isArray(e)&&(r=r||-1===e.indexOf(n)),r?t:this.wrapExportFunction(t)}))}}function d(t){if(t&&\"object\"!=typeof t)throw new TypeError(\"imports must be an object or undefined\")}function g(t,n){return\"undefined\"!=typeof wx&&\"undefined\"!=typeof __wxConfig?e.instantiate(t,n):fetch(t).then((t=>t.arrayBuffer())).then((t=>e.instantiate(t,n)))}function l(t,n){let r;if(d(n),n=null!=n?n:{},t instanceof ArrayBuffer||ArrayBuffer.isView(t))return e.instantiate(t,n);if(t instanceof e.Module)return e.instantiate(t,n).then((e=>({instance:e,module:t})));if(\"string\"!=typeof t&&!(t instanceof URL))throw new TypeError(\"Invalid source\");if(\"function\"==typeof e.instantiateStreaming){let i;try{i=fetch(t),r=e.instantiateStreaming(i,n).catch((()=>g(t,n)))}catch(e){r=g(t,n)}}else r=g(t,n);return r}function _(t,n){let r;if(d(n),n=null!=n?n:{},t instanceof ArrayBuffer||ArrayBuffer.isView(t))r=new e.Module(t);else{if(!(t instanceof WebAssembly.Module))throw new TypeError(\"Invalid source\");r=t}return{instance:new e.Instance(r,n),module:r}}const p=46,y=47,m=92,E=58,I=65,b=90,A=97,T=122;function w(t){return t===y||t===m}function B(t){return t>=I&&t<=b||t>=A&&t<=T}const N=\"undefined\"!=typeof process&&\"win32\"===process.platform;function S(t){return t===y}function P(t,e,n,r){let i=\"\",s=0,o=-1,a=0,c=0;for(let u=0;u<=t.length;++u){if(u<t.length)c=t.charCodeAt(u);else{if(r(c))break;c=y}if(r(c)){if(o===u-1||1===a);else if(2===a){if(i.length<2||2!==s||i.charCodeAt(i.length-1)!==p||i.charCodeAt(i.length-2)!==p){if(i.length>2){const t=i.indexOf(n);-1===t?(i=\"\",s=0):(i=i.slice(0,t),s=i.length-1-i.indexOf(n)),o=u,a=0;continue}if(0!==i.length){i=\"\",s=0,o=u,a=0;continue}}e&&(i+=i.length>0?`${n}..`:\"..\",s=2)}else i.length>0?i+=`${n}${t.slice(o+1,u)}`:i=t.slice(o+1,u),s=u-o-1;o=u,a=0}else c===p&&-1!==a?++a:a=-1}return i}function D(...t){if(N)return function(t){let e=\"\",n=\"\",i=!1;for(let s=t.length-1;s>=-1;s--){let o;if(s>=0){if(o=t[s],r(o,\"path\"),0===o.length)continue}else if(0===e.length)o=\"undefined\"!=typeof process&&\"function\"==typeof process.cwd?process.cwd():\"\";else{const t=`=${e}`,n=\"undefined\"!=typeof process?process.env:void 0;o=n&&\"string\"==typeof n[t]?n[t]:\"undefined\"!=typeof process&&\"function\"==typeof process.cwd?process.cwd():\"\",(void 0===o||o.slice(0,2).toLowerCase()!==e.toLowerCase()&&o.charCodeAt(2)===m)&&(o=`${e}\\\\`)}const a=o.length;let c=0,u=\"\",f=!1;const h=o.charCodeAt(0);if(1===a)w(h)&&(c=1,f=!0);else if(w(h))if(f=!0,w(o.charCodeAt(1))){let t=2,e=t;for(;t<a&&!w(o.charCodeAt(t));)t++;if(t<a&&t!==e){const n=o.slice(e,t);for(e=t;t<a&&w(o.charCodeAt(t));)t++;if(t<a&&t!==e){for(e=t;t<a&&!w(o.charCodeAt(t));)t++;t!==a&&t===e||(u=`\\\\\\\\${n}\\\\${o.slice(e,t)}`,c=t)}}}else c=1;else B(h)&&o.charCodeAt(1)===E&&(u=o.slice(0,2),c=2,a>2&&w(o.charCodeAt(2))&&(f=!0,c=3));if(u.length>0)if(e.length>0){if(u.toLowerCase()!==e.toLowerCase())continue}else e=u;if(i){if(e.length>0)break}else if(n=`${o.slice(c)}\\\\${n}`,i=f,f&&e.length>0)break}return n=P(n,!i,\"\\\\\",w),e+(i?\"\\\\\":\"\")+n||\".\"}(t);let e=\"\",n=!1;for(let i=t.length-1;i>=-1&&!n;i--){const s=i>=0?t[i]:\"/\";r(s,\"path\"),0!==s.length&&(e=`${s}/${e}`,n=s.charCodeAt(0)===y)}return e=P(e,!n,\"/\",S),n?`/${e}`:e.length>0?e:\".\"}const F={FD_DATASYNC:BigInt(1)<<BigInt(0),FD_READ:BigInt(1)<<BigInt(1),FD_SEEK:BigInt(1)<<BigInt(2),FD_FDSTAT_SET_FLAGS:BigInt(1)<<BigInt(3),FD_SYNC:BigInt(1)<<BigInt(4),FD_TELL:BigInt(1)<<BigInt(5),FD_WRITE:BigInt(1)<<BigInt(6),FD_ADVISE:BigInt(1)<<BigInt(7),FD_ALLOCATE:BigInt(1)<<BigInt(8),PATH_CREATE_DIRECTORY:BigInt(1)<<BigInt(9),PATH_CREATE_FILE:BigInt(1)<<BigInt(10),PATH_LINK_SOURCE:BigInt(1)<<BigInt(11),PATH_LINK_TARGET:BigInt(1)<<BigInt(12),PATH_OPEN:BigInt(1)<<BigInt(13),FD_READDIR:BigInt(1)<<BigInt(14),PATH_READLINK:BigInt(1)<<BigInt(15),PATH_RENAME_SOURCE:BigInt(1)<<BigInt(16),PATH_RENAME_TARGET:BigInt(1)<<BigInt(17),PATH_FILESTAT_GET:BigInt(1)<<BigInt(18),PATH_FILESTAT_SET_SIZE:BigInt(1)<<BigInt(19),PATH_FILESTAT_SET_TIMES:BigInt(1)<<BigInt(20),FD_FILESTAT_GET:BigInt(1)<<BigInt(21),FD_FILESTAT_SET_SIZE:BigInt(1)<<BigInt(22),FD_FILESTAT_SET_TIMES:BigInt(1)<<BigInt(23),PATH_SYMLINK:BigInt(1)<<BigInt(24),PATH_REMOVE_DIRECTORY:BigInt(1)<<BigInt(25),PATH_UNLINK_FILE:BigInt(1)<<BigInt(26),POLL_FD_READWRITE:BigInt(1)<<BigInt(27),SOCK_SHUTDOWN:BigInt(1)<<BigInt(28),SOCK_ACCEPT:BigInt(1)<<BigInt(29)};class v extends Error{constructor(t,e){super(t),this.errno=e}getErrorMessage(){return function(t){switch(t){case 0:return\"Success\";case 1:return\"Argument list too long\";case 2:return\"Permission denied\";case 3:return\"Address in use\";case 4:return\"Address not available\";case 5:return\"Address family not supported by protocol\";case 6:return\"Resource temporarily unavailable\";case 7:return\"Operation already in progress\";case 8:return\"Bad file descriptor\";case 9:return\"Bad message\";case 10:return\"Resource busy\";case 11:return\"Operation canceled\";case 12:return\"No child process\";case 13:return\"Connection aborted\";case 14:return\"Connection refused\";case 15:return\"Connection reset by peer\";case 16:return\"Resource deadlock would occur\";case 17:return\"Destination address required\";case 18:return\"Domain error\";case 19:return\"Quota exceeded\";case 20:return\"File exists\";case 21:return\"Bad address\";case 22:return\"File too large\";case 23:return\"Host is unreachable\";case 24:return\"Identifier removed\";case 25:return\"Illegal byte sequence\";case 26:return\"Operation in progress\";case 27:return\"Interrupted system call\";case 28:return\"Invalid argument\";case 29:return\"I/O error\";case 30:return\"Socket is connected\";case 31:return\"Is a directory\";case 32:return\"Symbolic link loop\";case 33:return\"No file descriptors available\";case 34:return\"Too many links\";case 35:return\"Message too large\";case 36:return\"Multihop attempted\";case 37:return\"Filename too long\";case 38:return\"Network is down\";case 39:return\"Connection reset by network\";case 40:return\"Network unreachable\";case 41:return\"Too many files open in system\";case 42:return\"No buffer space available\";case 43:return\"No such device\";case 44:return\"No such file or directory\";case 45:return\"Exec format error\";case 46:return\"No locks available\";case 47:return\"Link has been severed\";case 48:return\"Out of memory\";case 49:return\"No message of the desired type\";case 50:return\"Protocol not available\";case 51:return\"No space left on device\";case 52:return\"Function not implemented\";case 53:return\"Socket not connected\";case 54:return\"Not a directory\";case 55:return\"Directory not empty\";case 56:return\"State not recoverable\";case 57:return\"Not a socket\";case 58:return\"Not supported\";case 59:return\"Not a tty\";case 60:return\"No such device or address\";case 61:return\"Value too large for data type\";case 62:return\"Previous owner died\";case 63:return\"Operation not permitted\";case 64:return\"Broken pipe\";case 65:return\"Protocol error\";case 66:return\"Protocol not supported\";case 67:return\"Protocol wrong type for socket\";case 68:return\"Result not representable\";case 69:return\"Read-only file system\";case 70:return\"Invalid seek\";case 71:return\"No such process\";case 72:return\"Stale file handle\";case 73:return\"Operation timed out\";case 74:return\"Text file busy\";case 75:return\"Cross-device link\";case 76:return\"Capabilities insufficient\";default:return\"Unknown error\"}}(this.errno)}}Object.defineProperty(v.prototype,\"name\",{configurable:!0,writable:!0,value:\"WasiError\"});const U=F.FD_DATASYNC|F.FD_READ|F.FD_SEEK|F.FD_FDSTAT_SET_FLAGS|F.FD_SYNC|F.FD_TELL|F.FD_WRITE|F.FD_ADVISE|F.FD_ALLOCATE|F.PATH_CREATE_DIRECTORY|F.PATH_CREATE_FILE|F.PATH_LINK_SOURCE|F.PATH_LINK_TARGET|F.PATH_OPEN|F.FD_READDIR|F.PATH_READLINK|F.PATH_RENAME_SOURCE|F.PATH_RENAME_TARGET|F.PATH_FILESTAT_GET|F.PATH_FILESTAT_SET_SIZE|F.PATH_FILESTAT_SET_TIMES|F.FD_FILESTAT_GET|F.FD_FILESTAT_SET_TIMES|F.FD_FILESTAT_SET_SIZE|F.PATH_SYMLINK|F.PATH_UNLINK_FILE|F.PATH_REMOVE_DIRECTORY|F.POLL_FD_READWRITE|F.SOCK_SHUTDOWN|F.SOCK_ACCEPT,R=U,L=U,H=U,x=U,O=F.FD_DATASYNC|F.FD_READ|F.FD_SEEK|F.FD_FDSTAT_SET_FLAGS|F.FD_SYNC|F.FD_TELL|F.FD_WRITE|F.FD_ADVISE|F.FD_ALLOCATE|F.FD_FILESTAT_GET|F.FD_FILESTAT_SET_SIZE|F.FD_FILESTAT_SET_TIMES|F.POLL_FD_READWRITE,M=BigInt(0),C=F.FD_FDSTAT_SET_FLAGS|F.FD_SYNC|F.FD_ADVISE|F.PATH_CREATE_DIRECTORY|F.PATH_CREATE_FILE|F.PATH_LINK_SOURCE|F.PATH_LINK_TARGET|F.PATH_OPEN|F.FD_READDIR|F.PATH_READLINK|F.PATH_RENAME_SOURCE|F.PATH_RENAME_TARGET|F.PATH_FILESTAT_GET|F.PATH_FILESTAT_SET_SIZE|F.PATH_FILESTAT_SET_TIMES|F.FD_FILESTAT_GET|F.FD_FILESTAT_SET_TIMES|F.PATH_SYMLINK|F.PATH_UNLINK_FILE|F.PATH_REMOVE_DIRECTORY|F.POLL_FD_READWRITE,k=C|O,W=F.FD_READ|F.FD_FDSTAT_SET_FLAGS|F.FD_WRITE|F.FD_FILESTAT_GET|F.POLL_FD_READWRITE|F.SOCK_SHUTDOWN,z=U,K=F.FD_READ|F.FD_FDSTAT_SET_FLAGS|F.FD_WRITE|F.FD_FILESTAT_GET|F.POLL_FD_READWRITE,j=BigInt(0);function $(t,e,n,r){const i={base:BigInt(0),inheriting:BigInt(0)};if(0===r)throw new v(\"Unknown file type\",28);switch(r){case 4:i.base=O,i.inheriting=M;break;case 3:i.base=C,i.inheriting=k;break;case 6:case 5:i.base=W,i.inheriting=z;break;case 2:-1!==t.indexOf(e)?(i.base=K,i.inheriting=j):(i.base=H,i.inheriting=x);break;case 1:i.base=R,i.inheriting=L;break;default:i.base=BigInt(0),i.inheriting=BigInt(0)}const s=3&n;return 0===s?i.base&=~F.FD_WRITE:1===s&&(i.base&=~F.FD_READ),i}function G(t,e){let n=0;if(\"number\"==typeof e&&e>=0)n=e;else for(let e=0;e<t.length;e++){n+=t[e].length}let r=0;const i=new Uint8Array(n);for(let e=0;e<t.length;e++){const n=t[e];i.set(n,r),r+=n.length}return i}class Y{constructor(t,e,n,r,i,s,o,a){this.id=t,this.fd=e,this.path=n,this.realPath=r,this.type=i,this.rightsBase=s,this.rightsInheriting=o,this.preopen=a,this.pos=BigInt(0),this.size=BigInt(0)}seek(t,e){if(0===e)this.pos=BigInt(t);else if(1===e)this.pos+=BigInt(t);else{if(2!==e)throw new v(\"Unknown whence\",29);this.pos=BigInt(this.size)-BigInt(t)}return this.pos}}class V extends Y{constructor(t,e,n,r,i,s,o,a,c){super(e,n,r,i,s,o,a,c),this._log=t,this._buf=null}write(t){const e=t;if(this._buf&&(t=G([this._buf,t]),this._buf=null),-1===t.indexOf(10))return this._buf=t,e.byteLength;let n,r=0,i=0;for(;-1!==(n=t.indexOf(10,r));){const e=(new TextDecoder).decode(t.subarray(i,n));this._log(e),r+=n-i+1,i=n+1}return r<t.length&&(this._buf=t.slice(r)),e.byteLength}}function Z(t){return t.isBlockDevice()?1:t.isCharacterDevice()?2:t.isDirectory()?3:t.isSocket()?6:t.isFile()?4:t.isSymbolicLink()?7:0}function q(t,e,n){t.setBigUint64(e,n.dev,!0),t.setBigUint64(e+8,n.ino,!0),t.setBigUint64(e+16,BigInt(Z(n)),!0),t.setBigUint64(e+24,n.nlink,!0),t.setBigUint64(e+32,n.size,!0),t.setBigUint64(e+40,n.atimeMs*BigInt(1e6),!0),t.setBigUint64(e+48,n.mtimeMs*BigInt(1e6),!0),t.setBigUint64(e+56,n.ctimeMs*BigInt(1e6),!0)}class X{constructor(t){this.used=0,this.size=t.size,this.fds=Array(t.size),this.stdio=[t.in,t.out,t.err],this.print=t.print,this.printErr=t.printErr,this.insertStdio(t.in,0,\"<stdin>\"),this.insertStdio(t.out,1,\"<stdout>\"),this.insertStdio(t.err,2,\"<stderr>\")}insertStdio(t,e,n){const{base:r,inheriting:i}=$(this.stdio,t,2,2),s=this.insert(t,n,n,2,r,i,0);if(s.id!==e)throw new v(`id: ${s.id} !== expected: ${e}`,8);return s}insert(t,e,n,r,i,s,o){var a,c;let u,f=-1;if(this.used>=this.size){const t=2*this.size;this.fds.length=t,f=this.size,this.size=t}else for(let t=0;t<this.size;++t)if(null==this.fds[t]){f=t;break}return u=\"<stdout>\"===e?new V(null!==(a=this.print)&&void 0!==a?a:console.log,f,t,e,n,r,i,s,o):\"<stderr>\"===e?new V(null!==(c=this.printErr)&&void 0!==c?c:console.error,f,t,e,n,r,i,s,o):new Y(f,t,e,n,r,i,s,o),this.fds[f]=u,this.used++,u}get(t,e,n){if(t>=this.size)throw new v(\"Invalid fd\",8);const r=this.fds[t];if(!r||r.id!==t)throw new v(\"Bad file descriptor\",8);if((~r.rightsBase&e)!==BigInt(0)||(~r.rightsInheriting&n)!==BigInt(0))throw new v(\"Capabilities insufficient\",76);return r}remove(t){if(t>=this.size)throw new v(\"Invalid fd\",8);const e=this.fds[t];if(!e||e.id!==t)throw new v(\"Bad file descriptor\",8);this.fds[t]=void 0,this.used--}}class Q extends X{constructor(t){super(t),this.fs=t.fs}getFileTypeByFd(t){return Z(this.fs.fstatSync(t,{bigint:!0}))}insertPreopen(t,e,n){const r=this.getFileTypeByFd(t);if(3!==r)throw new v(`Preopen not dir: [\"${e}\", \"${n}\"]`,54);const i=$(this.stdio,t,0,r);return this.insert(t,e,n,r,i.base,i.inheriting,1)}renumber(t,e){if(t===e)return;if(t>=this.size||e>=this.size)throw new v(\"Invalid fd\",8);const n=this.fds[t],r=this.fds[e];if(!n||!r||n.id!==t||r.id!==e)throw new v(\"Invalid fd\",8);this.fs.closeSync(n.fd),this.fds[t]=this.fds[e],this.fds[t].id=t,this.fds[e]=void 0,this.used--}}class J extends X{constructor(t){super(t)}async getFileTypeByFd(t){return Z(await t.stat({bigint:!0}))}async insertPreopen(t,e,n){const r=await this.getFileTypeByFd(t);if(3!==r)throw new v(`Preopen not dir: [\"${e}\", \"${n}\"]`,54);const i=$(this.stdio,t.fd,0,r);return this.insert(t,e,n,r,i.base,i.inheriting,1)}async renumber(t,e){if(t===e)return;if(t>=this.size||e>=this.size)throw new v(\"Invalid fd\",8);const n=this.fds[t],r=this.fds[e];if(!n||!r||n.id!==t||r.id!==e)throw new v(\"Invalid fd\",8);await n.fd.close(),this.fds[t]=this.fds[e],this.fds[t].id=t,this.fds[e]=void 0,this.used--}}const tt=function(){return e.Memory}();class et extends tt{constructor(t){super(t)}get HEAP8(){return new Int8Array(super.buffer)}get HEAPU8(){return new Uint8Array(super.buffer)}get HEAP16(){return new Int16Array(super.buffer)}get HEAPU16(){return new Uint16Array(super.buffer)}get HEAP32(){return new Int32Array(super.buffer)}get HEAPU32(){return new Uint32Array(super.buffer)}get HEAP64(){return new BigInt64Array(super.buffer)}get HEAPU64(){return new BigUint64Array(super.buffer)}get HEAPF32(){return new Float32Array(super.buffer)}get HEAPF64(){return new Float64Array(super.buffer)}get view(){return new DataView(super.buffer)}}function nt(t){return Object.getPrototypeOf(t)===e.Memory.prototype&&Object.setPrototypeOf(t,et.prototype),t}function rt(){const t=e.Function;if(\"function\"!=typeof t)throw new Error('WebAssembly.Function is not supported in this environment. If you are using V8 based browser like Chrome, try to specify --js-flags=\"--wasm-staging --experimental-wasm-stack-switching\"');return t}function it(t,e,n){const r=rt();if(\"function\"!=typeof t)throw new TypeError(\"Function required\");const i=e.slice(0);return i.unshift(\"externref\"),new r({parameters:i,results:n},t,{suspending:\"first\"})}function st(t){const e=rt();if(\"function\"!=typeof t)throw new TypeError(\"Function required\");return new e({parameters:[...e.type(t).parameters.slice(1)],results:[\"externref\"]},t,{promising:\"first\"})}const ot=\"undefined\"!=typeof process&&\"win32\"===process.platform;function at(t){let e=3&t;return 0!=(64&t)&&(e|=256),0!=(128&t)&&(e|=1024),0!=(512&t)&&(e|=512),0!=(1024&t)&&(e|=8),e}function ct(t,e){if(0===t.length||0===e.length)return 0;let n=0,r=e.length-n;for(let i=0;i<t.length;++i){const s=t[i];if(r<s.length)return s.set(e.subarray(n,n+r),0),n+=r,r=0,n;s.set(e.subarray(n,n+s.length),0),n+=s.length,r-=s.length}return n}const ut=new WeakMap,ft=new WeakMap,ht=new WeakMap;function dt(t,e=0){const n=ut.get(t);return function(t,e){let n=t.buffer;e>n.byteLength&&(t.grow(0),n=t.buffer)}(n,e),n}function gt(t){const e=ht.get(t);if(!e)throw new Error(\"filesystem is unavailable\");return e}function lt(t){if(t instanceof v)return t.errno;switch(t.code){case\"ENOENT\":return 44;case\"EBADF\":return 8;case\"EINVAL\":return 28;case\"EPERM\":return 63;case\"EPROTO\":return 65;case\"EEXIST\":return 20;case\"ENOTDIR\":return 54;case\"EMFILE\":return 33;case\"EACCES\":return 2;case\"EISDIR\":return 31;case\"ENOTEMPTY\":return 55;case\"ENOSYS\":return 52}throw t}function _t(t,e){return Object.defineProperty(e,\"name\",{value:t}),e}function pt(t,e,n){let r;try{r=t.apply(e,n)}catch(t){return lt(t)}return o(r)?r.then((t=>t),lt):r}function yt(t,e,n){let r=!1;const i=(()=>{try{return}catch(t){return}})();return\"string\"==typeof i&&i.split(\",\").includes(\"wasi\")&&(r=!0),_t(e,r?function(){const r=Array.prototype.slice.call(arguments);let i=[`${e}(${Array.from({length:arguments.length}).map((()=>\"%d\")).join(\", \")})`];return i=i.concat(r),console.debug.apply(console,i),pt(n,t,r)}:function(){return pt(n,t,arguments)})}function mt(t,e,n,r){let i=D(e.realPath,n);if(1==(1&r))try{i=t.readlinkSync(i)}catch(t){if(\"EINVAL\"!==t.code&&\"ENOENT\"!==t.code)throw t}return i}async function Et(t,e,n,r){let i=D(e.realPath,n);if(1==(1&r))try{i=await t.promises.readlink(i)}catch(t){if(\"EINVAL\"!==t.code&&\"ENOENT\"!==t.code)throw t}return i}const It=new TextEncoder,bt=new TextDecoder,At=(BigInt(1)<<BigInt(63))-BigInt(1);function Tt(){const t=window.prompt();if(null===t)return new Uint8Array;return(new TextEncoder).encode(t+\"\\n\")}function wt(t){return Boolean(-16&t)||3==(3&t)||12==(12&t)}class Bt{constructor(t,n,r,i,s,o){this.args_get=yt(this,\"args_get\",(function(t,e){if(t=Number(t),e=Number(e),0===t||0===e)return 28;const n=ft.get(this).args,r=It.encode(n.join(\"\\0\")+\"\\0\").length,{HEAPU8:i,view:s}=dt(this,Math.max(t+4*n.length,e+r));for(let r=0;r<n.length;++r){const o=n[r];s.setInt32(t,e,!0),t+=4;const a=It.encode(o+\"\\0\");i.set(a,e),e+=a.length}return 0})),this.args_sizes_get=yt(this,\"args_sizes_get\",(function(t,e){if(t=Number(t),e=Number(e),0===t||0===e)return 28;const{view:n}=dt(this,Math.max(t+4,e+4)),r=ft.get(this).args;return n.setUint32(t,r.length,!0),n.setUint32(e,It.encode(r.join(\"\\0\")+\"\\0\").length,!0),0})),this.environ_get=yt(this,\"environ_get\",(function(t,e){if(t=Number(t),e=Number(e),0===t||0===e)return 28;const n=ft.get(this).env,r=It.encode(n.join(\"\\0\")+\"\\0\").length,{HEAPU8:i,view:s}=dt(this,Math.max(t+4*n.length,e+r));for(let r=0;r<n.length;++r){const o=n[r];s.setInt32(t,e,!0),t+=4;const a=It.encode(o+\"\\0\");i.set(a,e),e+=a.length}return 0})),this.environ_sizes_get=yt(this,\"environ_sizes_get\",(function(t,e){if(t=Number(t),e=Number(e),0===t||0===e)return 28;const{view:n}=dt(this,Math.max(t+4,e+4)),r=ft.get(this);return n.setUint32(t,r.env.length,!0),n.setUint32(e,It.encode(r.env.join(\"\\0\")+\"\\0\").length,!0),0})),this.clock_res_get=yt(this,\"clock_res_get\",(function(t,e){if(0===(e=Number(e)))return 28;const{view:n}=dt(this,e+8);switch(t){case 0:return n.setBigUint64(e,BigInt(1e6),!0),0;case 1:case 2:case 3:return n.setBigUint64(e,BigInt(1e3),!0),0;default:return 28}})),this.clock_time_get=yt(this,\"clock_time_get\",(function(t,e,n){if(0===(n=Number(n)))return 28;const{view:r}=dt(this,n+8);switch(t){case 0:return r.setBigUint64(n,BigInt(Date.now())*BigInt(1e6),!0),0;case 1:case 2:case 3:{const t=performance.now()/1e3,e=Math.trunc(t),i=Math.floor(1e3*(t-e)),s=BigInt(e)*BigInt(1e9)+BigInt(i)*BigInt(1e6);return r.setBigUint64(n,s,!0),0}default:return 28}})),this.fd_advise=yt(this,\"fd_advise\",(function(t,e,n,r){return 52})),this.fd_fdstat_get=yt(this,\"fd_fdstat_get\",(function(t,e){if(0===(e=Number(e)))return 28;const n=ft.get(this).fds.get(t,BigInt(0),BigInt(0)),{view:r}=dt(this,e+24);return r.setUint16(e,n.type,!0),r.setUint16(e+2,0,!0),r.setBigUint64(e+8,n.rightsBase,!0),r.setBigUint64(e+16,n.rightsInheriting,!0),0})),this.fd_fdstat_set_flags=yt(this,\"fd_fdstat_set_flags\",(function(t,e){return 52})),this.fd_fdstat_set_rights=yt(this,\"fd_fdstat_set_rights\",(function(t,e,n){const r=ft.get(this).fds.get(t,BigInt(0),BigInt(0));return(e|r.rightsBase)>r.rightsBase||(n|r.rightsInheriting)>r.rightsInheriting?76:(r.rightsBase=e,r.rightsInheriting=n,0)})),this.fd_prestat_get=yt(this,\"fd_prestat_get\",(function(t,e){if(0===(e=Number(e)))return 28;const n=ft.get(this);let r;try{r=n.fds.get(t,BigInt(0),BigInt(0))}catch(t){if(t instanceof v)return t.errno;throw t}if(1!==r.preopen)return 28;const{view:i}=dt(this,e+8);return i.setUint32(e,0,!0),i.setUint32(e+4,It.encode(r.path).length,!0),0})),this.fd_prestat_dir_name=yt(this,\"fd_prestat_dir_name\",(function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const r=ft.get(this).fds.get(t,BigInt(0),BigInt(0));if(1!==r.preopen)return 8;const i=It.encode(r.path),s=i.length;if(s>n)return 42;const{HEAPU8:o}=dt(this,e+s);return o.set(i,e),0})),this.fd_seek=yt(this,\"fd_seek\",(function(t,e,n,r){if(0===(r=Number(r)))return 28;if(0===t||1===t||2===t)return 0;const i=ft.get(this).fds.get(t,F.FD_SEEK,BigInt(0)).seek(e,n),{view:s}=dt(this,r+8);return s.setBigUint64(r,i,!0),0})),this.fd_tell=yt(this,\"fd_tell\",(function(t,e){const n=ft.get(this).fds.get(t,F.FD_TELL,BigInt(0)),r=BigInt(n.pos),{view:i}=dt(this,Number(e)+8);return i.setBigUint64(Number(e),r,!0),0})),this.poll_oneoff=yt(this,\"poll_oneoff\",(function(t,e,n,r){if(t=Number(t),e=Number(e),r=Number(r),n=Number(n),n>>>=0,0===t||0===e||0===n||0===r)return 28;const{view:i}=dt(this,Math.max(t+48*n,e+32*n,r+4));i.setUint32(r,0,!0);let s,o=0,a=BigInt(0),c=BigInt(0),u=0,f=BigInt(0);const h=Array(n);for(o=0;o<n;o++){s=t+48*o;const e=i.getBigUint64(s,!0),n=i.getUint8(s+8),r=i.getUint32(s+16,!0),a=i.getBigUint64(s+24,!0),c=i.getBigUint64(s+32,!0),u=i.getUint16(s+40,!0);h[o]={userdata:e,type:n,u:{clock:{clock_id:r,timeout:a,precision:c,flags:u},fd_readwrite:{fd:r}}}}const d=[];for(o=0;o<n;o++)switch(s=h[o],s.type){case 0:if(1===s.u.clock.flags){const t=BigInt(Date.now())*BigInt(1e6);c=s.u.clock.timeout-t}else c=s.u.clock.timeout;(0===u||c<f)&&(f=c,a=s.userdata,u=1);break;case 1:case 2:d.push(s);break;default:return 28}if(d.length>0){for(o=0;o<d.length;o++){const t=d[o],n=e+32*o;i.setBigUint64(n,t.userdata,!0),i.setUint32(n+8,52,!0),i.setUint32(n+12,t.type,!0),i.setBigUint64(n+16,BigInt(0),!0),i.setUint16(n+24,0,!0),i.setUint32(r,1,!0)}return i.setUint32(r,d.length,!0),0}if(u){!function(t,e){const n=Date.now()+t;let r=!1;for(;Date.now()<n;)if(e()){r=!0;break}}(Number(f/BigInt(1e6)),(()=>!1));const t=e;i.setBigUint64(t,a,!0),i.setUint32(t+8,0,!0),i.setUint32(t+12,0,!0),i.setUint32(r,1,!0)}return 0})),this.proc_exit=yt(this,\"proc_exit\",(function(t){return\"object\"==typeof process&&null!==process&&\"function\"==typeof process.exit&&process.exit(t),0})),this.proc_raise=yt(this,\"proc_raise\",(function(t){return 52})),this.sched_yield=yt(this,\"sched_yield\",(function(){return 0})),this.random_get=\"undefined\"!=typeof crypto&&\"function\"==typeof crypto.getRandomValues?yt(this,\"random_get\",(function(t,e){if(0===(t=Number(t)))return 28;e=Number(e);const{HEAPU8:n,view:r}=dt(this,t+e);if(\"function\"==typeof SharedArrayBuffer&&n.buffer instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(n.buffer)){for(let n=t;n<t+e;++n)r.setUint8(n,Math.floor(256*Math.random()));return 0}let i;const s=65536;for(i=0;i+s<e;i+=s)crypto.getRandomValues(n.subarray(t+i,t+i+s));return crypto.getRandomValues(n.subarray(t+i,t+e)),0})):yt(this,\"random_get\",(function(t,e){if(0===(t=Number(t)))return 28;e=Number(e);const{view:n}=dt(this,t+e);for(let r=t;r<t+e;++r)n.setUint8(r,Math.floor(256*Math.random()));return 0})),this.sock_recv=yt(this,\"sock_recv\",(function(){return 58})),this.sock_send=yt(this,\"sock_send\",(function(){return 58})),this.sock_shutdown=yt(this,\"sock_shutdown\",(function(){return 58})),this.sock_accept=yt(this,\"sock_accept\",(function(){return 58})),ft.set(this,{fds:r,args:t,env:n}),s&&ht.set(this,s);const a=this;function u(t,e,n,r,s){a[t]=i?o?o.wrapImportFunction(yt(a,t,n)):it(yt(a,t,n),r,s):yt(a,t,e)}function f(t,e,n,r){const i=ft.get(this).fds.get(t,F.FD_FILESTAT_SET_TIMES,BigInt(0));return 2==(2&r)&&(e=BigInt(1e6*Date.now())),8==(8&r)&&(n=BigInt(1e6*Date.now())),{fileDescriptor:i,atim:e,mtim:n}}function h(t,e,n,r){const i=(e&(F.FD_READ|F.FD_READDIR))!==BigInt(0),s=(e&(F.FD_DATASYNC|F.FD_WRITE|F.FD_ALLOCATE|F.FD_FILESTAT_SET_SIZE))!==BigInt(0);let o=s?i?2:1:0,a=F.PATH_OPEN,c=e|n;return 0!=(1&t)&&(o|=64,a|=F.PATH_CREATE_FILE),0!=(2&t)&&(o|=65536),0!=(4&t)&&(o|=128),0!=(8&t)&&(o|=512,a|=F.PATH_FILESTAT_SET_SIZE),0!=(1&r)&&(o|=1024),0!=(2&r)&&(c|=F.FD_DATASYNC),0!=(4&r)&&(o|=2048),0!=(8&r)&&(o|=1052672,c|=F.FD_SYNC),0!=(16&r)&&(o|=1052672,c|=F.FD_SYNC),s&&0==(1536&o)&&(c|=F.FD_SEEK),{flags:o,needed_base:a,needed_inheriting:c}}u(\"fd_allocate\",(function(t,e,n){const r=ft.get(this),i=gt(this),s=r.fds.get(t,F.FD_ALLOCATE,BigInt(0));return i.fstatSync(s.fd,{bigint:!0}).size<e+n&&i.ftruncateSync(s.fd,Number(e+n)),0}),(async function(t,e,n){const r=ft.get(this).fds.get(t,F.FD_ALLOCATE,BigInt(0)).fd;return(await r.stat({bigint:!0})).size<e+n&&await r.truncate(Number(e+n)),0}),[\"i32\",\"i64\",\"f64\"],[\"i32\"]),u(\"fd_close\",(function(t){const e=ft.get(this),n=e.fds.get(t,BigInt(0),BigInt(0));return gt(this).closeSync(n.fd),e.fds.remove(t),0}),(async function(t){const e=ft.get(this),n=e.fds.get(t,BigInt(0),BigInt(0));return await n.fd.close(),e.fds.remove(t),0}),[\"i32\"],[\"i32\"]),u(\"fd_datasync\",(function(t){const e=ft.get(this).fds.get(t,F.FD_DATASYNC,BigInt(0));return gt(this).fdatasyncSync(e.fd),0}),(async function(t){const e=ft.get(this).fds.get(t,F.FD_DATASYNC,BigInt(0));return await e.fd.datasync(),0}),[\"i32\"],[\"i32\"]),u(\"fd_filestat_get\",(function(t,e){if(0===(e=Number(e)))return 28;const n=ft.get(this).fds.get(t,F.FD_FILESTAT_GET,BigInt(0)),r=gt(this).fstatSync(n.fd,{bigint:!0}),{view:i}=dt(this,e+64);return q(i,e,r),0}),(async function(t,e){if(0===(e=Number(e)))return 28;const n=ft.get(this).fds.get(t,F.FD_FILESTAT_GET,BigInt(0)).fd,r=await n.stat({bigint:!0}),{view:i}=dt(this,e+64);return q(i,e,r),0}),[\"i32\",\"i32\"],[\"i32\"]),u(\"fd_filestat_set_size\",(function(t,e){const n=ft.get(this).fds.get(t,F.FD_FILESTAT_SET_SIZE,BigInt(0));return gt(this).ftruncateSync(n.fd,Number(e)),0}),(async function(t,e){const n=ft.get(this).fds.get(t,F.FD_FILESTAT_SET_SIZE,BigInt(0)).fd;return await n.truncate(Number(e)),0}),[\"i32\",\"i64\"],[\"i32\"]),u(\"fd_filestat_set_times\",(function(t,e,n,r){if(wt(r))return 28;const{fileDescriptor:i,atim:s,mtim:o}=f.call(this,t,e,n,r);return gt(this).futimesSync(i.fd,Number(s),Number(o)),0}),(async function(t,e,n,r){if(wt(r))return 28;const{fileDescriptor:i,atim:s,mtim:o}=f.call(this,t,e,n,r),a=i.fd;return await a.utimes(Number(s),Number(o)),0}),[\"i32\",\"i64\",\"i64\",\"i32\"],[\"i32\"]),u(\"fd_pread\",(function(t,e,n,r,i){if(e=Number(e),i=Number(i),0===e&&n||0===i||r>At)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(e+8*Number(n),i+4)),a=ft.get(this).fds.get(t,F.FD_READ|F.FD_SEEK,BigInt(0));if(!n)return o.setUint32(i,0,!0),0;let c=0;const u=Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,i=o.getInt32(r,!0),a=o.getUint32(r+4,!0);return c+=a,s.subarray(i,i+a)}));let f=0;const h=(()=>{try{return new Uint8Array(new SharedArrayBuffer(c))}catch(t){return new Uint8Array(c)}})();h._isBuffer=!0;const d=gt(this).readSync(a.fd,h,0,h.length,Number(r));return f=h?ct(u,h.subarray(0,d)):0,o.setUint32(i,f,!0),0}),(async function(t,e,n,r,i){if(e=Number(e),i=Number(i),0===e&&n||0===i||r>At)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(e+8*Number(n),i+4)),a=ft.get(this).fds.get(t,F.FD_READ|F.FD_SEEK,BigInt(0));if(!n)return o.setUint32(i,0,!0),0;let c=0;const u=Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,i=o.getInt32(r,!0),a=o.getUint32(r+4,!0);return c+=a,s.subarray(i,i+a)}));let f=0;const h=new Uint8Array(c);h._isBuffer=!0;const{bytesRead:d}=await a.fd.read(h,0,h.length,Number(r));return f=h?ct(u,h.subarray(0,d)):0,o.setUint32(i,f,!0),0}),[\"i32\",\"i32\",\"i32\",\"i64\",\"i32\"],[\"i32\"]),u(\"fd_pwrite\",(function(t,e,n,r,i){if(e=Number(e),i=Number(i),0===e&&n||0===i||r>At)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(e+8*Number(n),i+4)),a=ft.get(this).fds.get(t,F.FD_WRITE|F.FD_SEEK,BigInt(0));if(!n)return o.setUint32(i,0,!0),0;const c=G(Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,i=o.getInt32(r,!0),a=o.getUint32(r+4,!0);return s.subarray(i,i+a)}))),u=gt(this).writeSync(a.fd,c,0,c.length,Number(r));return o.setUint32(i,u,!0),0}),(async function(t,e,n,r,i){if(e=Number(e),i=Number(i),0===e&&n||0===i||r>At)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(e+8*Number(n),i+4)),a=ft.get(this).fds.get(t,F.FD_WRITE|F.FD_SEEK,BigInt(0));if(!n)return o.setUint32(i,0,!0),0;const c=G(Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,i=o.getInt32(r,!0),a=o.getUint32(r+4,!0);return s.subarray(i,i+a)}))),{bytesWritten:u}=await a.fd.write(c,0,c.length,Number(r));return o.setUint32(i,u,!0),0}),[\"i32\",\"i32\",\"i32\",\"i64\",\"i32\"],[\"i32\"]),u(\"fd_read\",(function(t,e,n,r){if(e=Number(e),r=Number(r),0===e&&n||0===r)return 28;const{HEAPU8:i,view:s}=dt(this,Math.max(e+8*Number(n),r+4)),o=ft.get(this).fds.get(t,F.FD_READ,BigInt(0));if(!n)return s.setUint32(r,0,!0),0;let a=0;const c=Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,o=s.getInt32(r,!0),c=s.getUint32(r+4,!0);return a+=c,i.subarray(o,o+c)}));let u,f=0;if(0===t){if(\"undefined\"==typeof window||\"function\"!=typeof window.prompt)return 58;u=Tt(),f=u?ct(c,u):0}else{u=(()=>{try{return new Uint8Array(new SharedArrayBuffer(a))}catch(t){return new Uint8Array(a)}})(),u._isBuffer=!0;const t=gt(this).readSync(o.fd,u,0,u.length,Number(o.pos));f=u?ct(c,u.subarray(0,t)):0,o.pos+=BigInt(f)}return s.setUint32(r,f,!0),0}),(async function(t,e,n,r){if(e=Number(e),r=Number(r),0===e&&n||0===r)return 28;const{HEAPU8:i,view:s}=dt(this,Math.max(e+8*Number(n),r+4)),o=ft.get(this).fds.get(t,F.FD_READ,BigInt(0));if(!n)return s.setUint32(r,0,!0),0;let a=0;const c=Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,o=s.getInt32(r,!0),c=s.getUint32(r+4,!0);return a+=c,i.subarray(o,o+c)}));let u,f=0;if(0===t){if(\"undefined\"==typeof window||\"function\"!=typeof window.prompt)return 58;u=Tt(),f=u?ct(c,u):0}else{u=new Uint8Array(a),u._isBuffer=!0;const{bytesRead:t}=await o.fd.read(u,0,u.length,Number(o.pos));f=u?ct(c,u.subarray(0,t)):0,o.pos+=BigInt(f)}return s.setUint32(r,f,!0),0}),[\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"fd_readdir\",(function(t,e,n,r,i){if(e=Number(e),n=Number(n),i=Number(i),0===e||0===i)return 0;const s=ft.get(this).fds.get(t,F.FD_READDIR,BigInt(0)),o=gt(this),a=o.readdirSync(s.realPath,{withFileTypes:!0}),{HEAPU8:c,view:u}=dt(this,Math.max(e+n,i+4));let f=0;for(let t=Number(r);t<a.length;t++){const r=It.encode(a[t].name),i=o.statSync(D(s.realPath,a[t].name),{bigint:!0}),u=new Uint8Array(24+r.byteLength),h=new DataView(u.buffer);let d;h.setBigUint64(0,BigInt(t+1),!0),h.setBigUint64(8,BigInt(i.ino?i.ino:0),!0),h.setUint32(16,r.byteLength,!0),d=a[t].isFile()?4:a[t].isDirectory()?3:a[t].isSymbolicLink()?7:a[t].isCharacterDevice()?2:a[t].isBlockDevice()?1:a[t].isSocket()?6:0,h.setUint8(20,d),u.set(r,24);const g=u.slice(0,Math.min(u.length,n-f));c.set(g,e+f),f+=g.byteLength}return u.setUint32(i,f,!0),0}),(async function(t,e,n,r,i){if(e=Number(e),n=Number(n),i=Number(i),0===e||0===i)return 0;const s=ft.get(this).fds.get(t,F.FD_READDIR,BigInt(0)),o=gt(this),a=await o.promises.readdir(s.realPath,{withFileTypes:!0}),{HEAPU8:c,view:u}=dt(this,Math.max(e+n,i+4));let f=0;for(let t=Number(r);t<a.length;t++){const r=It.encode(a[t].name),i=await o.promises.stat(D(s.realPath,a[t].name),{bigint:!0}),u=new Uint8Array(24+r.byteLength),h=new DataView(u.buffer);let d;h.setBigUint64(0,BigInt(t+1),!0),h.setBigUint64(8,BigInt(i.ino?i.ino:0),!0),h.setUint32(16,r.byteLength,!0),d=a[t].isFile()?4:a[t].isDirectory()?3:a[t].isSymbolicLink()?7:a[t].isCharacterDevice()?2:a[t].isBlockDevice()?1:a[t].isSocket()?6:0,h.setUint8(20,d),u.set(r,24);const g=u.slice(0,Math.min(u.length,n-f));c.set(g,e+f),f+=g.byteLength}return u.setUint32(i,f,!0),0}),[\"i32\",\"i32\",\"i32\",\"i64\",\"i32\"],[\"i32\"]),u(\"fd_renumber\",(function(t,e){return ft.get(this).fds.renumber(e,t),0}),(async function(t,e){const n=ft.get(this);return await n.fds.renumber(e,t),0}),[\"i32\",\"i32\"],[\"i32\"]),u(\"fd_sync\",(function(t){const e=ft.get(this).fds.get(t,F.FD_SYNC,BigInt(0));return gt(this).fsyncSync(e.fd),0}),(async function(t){const e=ft.get(this).fds.get(t,F.FD_SYNC,BigInt(0));return await e.fd.sync(),0}),[\"i32\"],[\"i32\"]),u(\"fd_write\",(function(t,e,n,r){if(e=Number(e),r=Number(r),0===e&&n||0===r)return 28;const{HEAPU8:i,view:s}=dt(this,Math.max(e+8*Number(n),r+4)),o=ft.get(this).fds.get(t,F.FD_WRITE,BigInt(0));if(!n)return s.setUint32(r,0,!0),0;const a=G(Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,o=s.getInt32(r,!0),a=s.getUint32(r+4,!0);return i.subarray(o,o+a)})));let c;if(1===t||2===t)c=o.write(a);else{c=gt(this).writeSync(o.fd,a,0,a.length,Number(o.pos)),o.pos+=BigInt(c)}return s.setUint32(r,c,!0),0}),(async function(t,e,n,r){if(e=Number(e),r=Number(r),0===e&&n||0===r)return 28;const{HEAPU8:i,view:s}=dt(this,Math.max(e+8*Number(n),r+4)),o=ft.get(this).fds.get(t,F.FD_WRITE,BigInt(0));if(!n)return s.setUint32(r,0,!0),0;const a=G(Array.from({length:Number(n)},((t,n)=>{const r=e+8*n,o=s.getInt32(r,!0),a=s.getUint32(r+4,!0);return i.subarray(o,o+a)})));let c;return 1===t||2===t?c=o.write(a):(c=await(await o.fd.write(a,0,a.length,Number(o.pos))).bytesWritten,o.pos+=BigInt(c)),s.setUint32(r,c,!0),0}),[\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_create_directory\",(function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_CREATE_DIRECTORY,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);return gt(this).mkdirSync(s),0}),(async function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_CREATE_DIRECTORY,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);const o=gt(this);return await o.promises.mkdir(s),0}),[\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_filestat_get\",(function(t,e,n,r,i){if(n=Number(n),r=Number(r),i=Number(i),0===n||0===i)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(n+r,i+64)),a=ft.get(this).fds.get(t,F.PATH_FILESTAT_GET,BigInt(0));let u=bt.decode(c(s,n,n+r));const f=gt(this);let h;return u=D(a.realPath,u),h=1==(1&e)?f.statSync(u,{bigint:!0}):f.lstatSync(u,{bigint:!0}),q(o,i,h),0}),(async function(t,e,n,r,i){if(n=Number(n),r=Number(r),i=Number(i),0===n||0===i)return 28;const{HEAPU8:s,view:o}=dt(this,Math.max(n+r,i+64)),a=ft.get(this).fds.get(t,F.PATH_FILESTAT_GET,BigInt(0));let u=bt.decode(c(s,n,n+r));const f=gt(this);let h;return u=D(a.realPath,u),h=1==(1&e)?await f.promises.stat(u,{bigint:!0}):await f.promises.lstat(u,{bigint:!0}),q(o,i,h),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_filestat_set_times\",(function(t,e,n,r,i,s,o){if(n=Number(n),r=Number(r),0===n)return 28;const{HEAPU8:a}=dt(this,n+r),u=ft.get(this).fds.get(t,F.PATH_FILESTAT_SET_TIMES,BigInt(0));if(wt(o))return 28;const f=gt(this),h=mt(f,u,bt.decode(c(a,n,n+r)),e);return 2==(2&o)&&(i=BigInt(1e6*Date.now())),8==(8&o)&&(s=BigInt(1e6*Date.now())),f.utimesSync(h,Number(i),Number(s)),0}),(async function(t,e,n,r,i,s,o){if(n=Number(n),r=Number(r),0===n)return 28;const{HEAPU8:a}=dt(this,n+r),u=ft.get(this).fds.get(t,F.PATH_FILESTAT_SET_TIMES,BigInt(0));if(wt(o))return 28;const f=gt(this),h=await Et(f,u,bt.decode(c(a,n,n+r)),e);return 2==(2&o)&&(i=BigInt(1e6*Date.now())),8==(8&o)&&(s=BigInt(1e6*Date.now())),await f.promises.utimes(h,Number(i),Number(s)),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i64\",\"i64\",\"i32\"],[\"i32\"]),u(\"path_link\",(function(t,e,n,r,i,s,o){if(n=Number(n),r=Number(r),s=Number(s),o=Number(o),0===n||0===s)return 28;const a=ft.get(this);let u,f;t===i?u=f=a.fds.get(t,F.PATH_LINK_SOURCE|F.PATH_LINK_TARGET,BigInt(0)):(u=a.fds.get(t,F.PATH_LINK_SOURCE,BigInt(0)),f=a.fds.get(i,F.PATH_LINK_TARGET,BigInt(0)));const{HEAPU8:h}=dt(this,Math.max(n+r,s+o)),d=gt(this),g=mt(d,u,bt.decode(c(h,n,n+r)),e),l=D(f.realPath,bt.decode(c(h,s,s+o)));return d.linkSync(g,l),0}),(async function(t,e,n,r,i,s,o){if(n=Number(n),r=Number(r),s=Number(s),o=Number(o),0===n||0===s)return 28;const a=ft.get(this);let u,f;t===i?u=f=a.fds.get(t,F.PATH_LINK_SOURCE|F.PATH_LINK_TARGET,BigInt(0)):(u=a.fds.get(t,F.PATH_LINK_SOURCE,BigInt(0)),f=a.fds.get(i,F.PATH_LINK_TARGET,BigInt(0)));const{HEAPU8:h}=dt(this,Math.max(n+r,s+o)),d=gt(this),g=await Et(d,u,bt.decode(c(h,n,n+r)),e),l=D(f.realPath,bt.decode(c(h,s,s+o)));return await d.promises.link(g,l),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_open\",(function(t,e,n,r,i,s,o,a,u){if(n=Number(n),u=Number(u),0===n||0===u)return 28;r=Number(r),s=BigInt(s),o=BigInt(o);const{flags:f,needed_base:d,needed_inheriting:g}=h(i,s,o,a),l=ft.get(this),_=l.fds.get(t,d,g),p=dt(this,Math.max(n+r,u+4)),y=p.HEAPU8,m=bt.decode(c(y,n,n+r)),E=gt(this),I=mt(E,_,m,e),b=E.openSync(I,ot?at(f):f,438),A=l.fds.getFileTypeByFd(b);if(3!==A&&(0!=(2&i)||I.endsWith(\"/\")))return 54;const{base:T,inheriting:w}=$(l.fds.stdio,b,f,A),B=l.fds.insert(b,I,I,A,s&T,o&w,0),N=E.fstatSync(b,{bigint:!0});N.isFile()&&(B.size=N.size,0!=(1024&f)&&(B.pos=N.size));return p.view.setInt32(u,B.id,!0),0}),(async function(t,e,n,r,i,s,o,a,u){if(n=Number(n),u=Number(u),0===n||0===u)return 28;r=Number(r),s=BigInt(s),o=BigInt(o);const{flags:f,needed_base:d,needed_inheriting:g}=h(i,s,o,a),l=ft.get(this),_=l.fds.get(t,d,g),p=dt(this,Math.max(n+r,u+4)),y=p.HEAPU8,m=bt.decode(c(y,n,n+r)),E=gt(this),I=await Et(E,_,m,e),b=await E.promises.open(I,ot?at(f):f,438),A=await l.fds.getFileTypeByFd(b);if(0!=(2&i)&&3!==A)return 54;const{base:T,inheriting:w}=$(l.fds.stdio,b.fd,f,A),B=l.fds.insert(b,I,I,A,s&T,o&w,0),N=await b.stat({bigint:!0});N.isFile()&&(B.size=N.size,0!=(1024&f)&&(B.pos=N.size));return p.view.setInt32(u,B.id,!0),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\",\"i64\",\"i64\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_readlink\",(function(t,e,n,r,i,s){if(e=Number(e),n=Number(n),r=Number(r),i=Number(i),s=Number(s),0===e||0===r||0===s)return 28;const{HEAPU8:o,view:a}=dt(this,Math.max(e+n,r+i,s+4)),u=ft.get(this).fds.get(t,F.PATH_READLINK,BigInt(0));let f=bt.decode(c(o,e,e+n));f=D(u.realPath,f);const h=gt(this).readlinkSync(f),d=It.encode(h),g=Math.min(d.length,i);return g>=i?42:(o.set(d.subarray(0,g),r),o[r+g]=0,a.setUint32(s,g,!0),0)}),(async function(t,e,n,r,i,s){if(e=Number(e),n=Number(n),r=Number(r),i=Number(i),s=Number(s),0===e||0===r||0===s)return 28;const{HEAPU8:o,view:a}=dt(this,Math.max(e+n,r+i,s+4)),u=ft.get(this).fds.get(t,F.PATH_READLINK,BigInt(0));let f=bt.decode(c(o,e,e+n));f=D(u.realPath,f);const h=gt(this),d=await h.promises.readlink(f),g=It.encode(d),l=Math.min(g.length,i);return l>=i?42:(o.set(g.subarray(0,l),r),o[r+l]=0,a.setUint32(s,l,!0),0)}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_remove_directory\",(function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_REMOVE_DIRECTORY,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);return gt(this).rmdirSync(s),0}),(async function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_REMOVE_DIRECTORY,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);const o=gt(this);return await o.promises.rmdir(s),0}),[\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_rename\",(function(t,e,n,r,i,s){if(e=Number(e),n=Number(n),i=Number(i),s=Number(s),0===e||0===i)return 28;const o=ft.get(this);let a,u;t===r?a=u=o.fds.get(t,F.PATH_RENAME_SOURCE|F.PATH_RENAME_TARGET,BigInt(0)):(a=o.fds.get(t,F.PATH_RENAME_SOURCE,BigInt(0)),u=o.fds.get(r,F.PATH_RENAME_TARGET,BigInt(0)));const{HEAPU8:f}=dt(this,Math.max(e+n,i+s)),h=D(a.realPath,bt.decode(c(f,e,e+n))),d=D(u.realPath,bt.decode(c(f,i,i+s)));return gt(this).renameSync(h,d),0}),(async function(t,e,n,r,i,s){if(e=Number(e),n=Number(n),i=Number(i),s=Number(s),0===e||0===i)return 28;const o=ft.get(this);let a,u;t===r?a=u=o.fds.get(t,F.PATH_RENAME_SOURCE|F.PATH_RENAME_TARGET,BigInt(0)):(a=o.fds.get(t,F.PATH_RENAME_SOURCE,BigInt(0)),u=o.fds.get(r,F.PATH_RENAME_TARGET,BigInt(0)));const{HEAPU8:f}=dt(this,Math.max(e+n,i+s)),h=D(a.realPath,bt.decode(c(f,e,e+n))),d=D(u.realPath,bt.decode(c(f,i,i+s))),g=gt(this);return await g.promises.rename(h,d),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_symlink\",(function(t,e,n,r,i){if(t=Number(t),e=Number(e),r=Number(r),i=Number(i),0===t||0===r)return 28;const{HEAPU8:s}=dt(this,Math.max(t+e,r+i)),o=ft.get(this).fds.get(n,F.PATH_SYMLINK,BigInt(0)),a=bt.decode(c(s,t,t+e));if(a.length>0&&\"/\"===a[0])return 63;let u=bt.decode(c(s,r,r+i));u=D(o.realPath,u);return gt(this).symlinkSync(a,u),0}),(async function(t,e,n,r,i){if(t=Number(t),e=Number(e),r=Number(r),i=Number(i),0===t||0===r)return 28;const{HEAPU8:s}=dt(this,Math.max(t+e,r+i)),o=ft.get(this).fds.get(n,F.PATH_SYMLINK,BigInt(0)),a=bt.decode(c(s,t,t+e));let u=bt.decode(c(s,r,r+i));u=D(o.realPath,u);const f=gt(this);return await f.promises.symlink(a,u),0}),[\"i32\",\"i32\",\"i32\",\"i32\",\"i32\"],[\"i32\"]),u(\"path_unlink_file\",(function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_UNLINK_FILE,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);return gt(this).unlinkSync(s),0}),(async function(t,e,n){if(e=Number(e),n=Number(n),0===e)return 28;const{HEAPU8:r}=dt(this,e+n),i=ft.get(this).fds.get(t,F.PATH_UNLINK_FILE,BigInt(0));let s=bt.decode(c(r,e,e+n));s=D(i.realPath,s);const o=gt(this);return await o.promises.unlink(s),0}),[\"i32\",\"i32\",\"i32\"],[\"i32\"]),this._setMemory=function(t){if(!(t instanceof e.Memory))throw new TypeError('\"instance.exports.memory\" property must be a WebAssembly.Memory');ut.set(a,nt(t))}}static createSync(t,e,n,r,i,s,o){const a=new Q({size:3,in:r[0],out:r[1],err:r[2],fs:i,print:s,printErr:o}),c=new Bt(t,e,a,!1,i);if(n.length>0)for(let t=0;t<n.length;++t){const e=i.realpathSync(n[t].realPath,\"utf8\"),r=i.openSync(e,\"r\",438);a.insertPreopen(r,n[t].mappedPath,e)}return c}static async createAsync(t,e,n,r,i,s,o,a){const c=new J({size:3,in:r[0],out:r[1],err:r[2],print:s,printErr:o}),u=new Bt(t,e,c,!0,i,a);if(n.length>0)for(let t=0;t<n.length;++t){const e=n[t],r=await i.promises.realpath(e.realPath),s=await i.promises.open(r,\"r\",438);await c.insertPreopen(s,e.mappedPath,r)}return u}}const Nt=Object.freeze(Object.create(null)),St=Symbol(\"kExitCode\"),Pt=Symbol(\"kSetMemory\"),Dt=Symbol(\"kStarted\"),Ft=Symbol(\"kInstance\"),vt=Symbol(\"kBindingName\");function Ut(t){var e;let s;if(n(t,\"options\"),void 0!==t.version)switch(r(t.version,\"options.version\"),t.version){case\"unstable\":s=Bt,this[vt]=\"wasi_unstable\";break;case\"preview1\":s=Bt,this[vt]=\"wasi_snapshot_preview1\";break;default:throw new TypeError(`unsupported WASI version \"${t.version}\"`)}else s=Bt,this[vt]=\"wasi_snapshot_preview1\";void 0!==t.args&&function(t,e){if(!Array.isArray(t))throw new TypeError(`${e} must be an array. Received ${null===t?\"null\":typeof t}`)}(t.args,\"options.args\");const o=(null!==(e=t.args)&&void 0!==e?e:[]).map(String),a=[];void 0!==t.env&&(n(t.env,\"options.env\"),Object.entries(t.env).forEach((({0:t,1:e})=>{void 0!==e&&a.push(`${t}=${e}`)})));const c=[];if(void 0!==t.preopens&&(n(t.preopens,\"options.preopens\"),Object.entries(t.preopens).forEach((({0:t,1:e})=>c.push({mappedPath:String(t),realPath:String(e)})))),c.length>0){if(void 0===t.fs)throw new Error(\"filesystem is disabled, can not preopen directory\");try{n(t.fs,\"options.fs\")}catch(t){throw new TypeError(\"Node.js fs like implementation is not provided\")}}void 0!==t.print&&i(t.print,\"options.print\"),void 0!==t.printErr&&i(t.printErr,\"options.printErr\"),void 0!==t.returnOnExit&&function(t,e){if(\"boolean\"!=typeof t)throw new TypeError(`${e} must be a boolean. Received ${null===t?\"null\":typeof t}`)}(t.returnOnExit,\"options.returnOnExit\");return{args:o,env:a,preopens:c,stdio:[0,1,2],_WASI:s}}function Rt(t,e){this[Pt]=t,this.wasiImport=e,this[Dt]=!1,this[St]=0,this[Ft]=void 0}class Lt{constructor(t=Nt){const{args:e,env:n,preopens:r,stdio:i,_WASI:s}=Ut.call(this,t),o=s.createSync(e,n,r,i,t.fs,t.print,t.printErr),a=o._setMemory;delete o._setMemory,Rt.call(this,a,o),t.returnOnExit&&(o.proc_exit=Ht.bind(this))}finalizeBindings(t,e){var r,{memory:i=(null===(r=null==t?void 0:t.exports)||void 0===r?void 0:r.memory)}=void 0===e?{}:e;if(this[Dt])throw new Error(\"WASI instance has already started\");n(t,\"instance\"),n(t.exports,\"instance.exports\"),this[Pt](i),this[Ft]=t,this[Dt]=!0}start(t){this.finalizeBindings(t);const{_start:e,_initialize:n}=this[Ft].exports;let r;i(e,\"instance.exports._start\"),s(n,\"instance.exports._initialize\");try{r=e()}catch(t){if(t!==St)throw t}return r instanceof Promise?r.then((()=>this[St]),(t=>{if(t!==St)throw t;return this[St]})):this[St]}initialize(t){this.finalizeBindings(t);const{_start:e,_initialize:n}=this[Ft].exports;if(s(e,\"instance.exports._start\"),void 0!==n)return i(n,\"instance.exports._initialize\"),n()}getImportObject(){return{[this[vt]]:this.wasiImport}}}function Ht(t){throw this[St]=t,St}t.Asyncify=h,t.Memory=et,t.WASI=Lt,t.WebAssemblyMemory=tt,t.asyncifyLoad=function(t,e,n){d(n),n=null!=n?n:{};const r=new h;return l(e,n=r.wrapImports(n)).then((e=>{var i;const s=e.instance.exports.memory||(null===(i=n.env)||void 0===i?void 0:i.memory);return{module:e.module,instance:r.init(s,e.instance,t)}}))},t.asyncifyLoadSync=function(t,e,n){var r;d(n),n=null!=n?n:{};const i=new h,s=_(e,n=i.wrapImports(n)),o=s.instance.exports.memory||(null===(r=n.env)||void 0===r?void 0:r.memory);return{module:s.module,instance:i.init(o,s.instance,t)}},t.createAsyncWASI=async function(t=Nt){const e=Object.create(Lt.prototype),{args:r,env:s,preopens:o,stdio:a,_WASI:c}=Ut.call(e,t);void 0!==t.asyncify&&(n(t.asyncify,\"options.asyncify\"),i(t.asyncify.wrapImportFunction,\"options.asyncify.wrapImportFunction\"));const u=await c.createAsync(r,s,o,a,t.fs,t.print,t.printErr,t.asyncify),f=u._setMemory;return delete u._setMemory,Rt.call(e,f,u),t.returnOnExit&&(u.proc_exit=Ht.bind(e)),e},t.extendMemory=nt,t.load=l,t.loadSync=_,t.wrapAsyncExport=st,t.wrapAsyncImport=it,t.wrapExports=function(t,e){return a(t,((t,n)=>{let r=\"function\"!=typeof t;return Array.isArray(e)&&(r=r||-1===e.indexOf(n)),r?t:st(t)}))},Object.defineProperty(t,\"__esModule\",{value:!0})}));\n;\n!function(t,e){\"object\"==typeof exports&&\"undefined\"!=typeof module?e(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],e):e((t=\"undefined\"!=typeof globalThis?globalThis:t||self).emnapi={})}(this,function(t){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},e(t,n)};function n(t,n){if(\"function\"!=typeof n&&null!==n)throw new TypeError(\"Class extends value \"+String(n)+\" is not a constructor or null\");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}\"function\"==typeof SuppressedError&&SuppressedError;var i=new WeakMap;function r(t){return i.has(t)}var o=function(){function t(t){Object.setPrototypeOf(this,null),i.set(this,t)}return t.prototype=null,t}();function s(t){if(!r(t))throw new TypeError(\"not external\");return i.get(t)}var a=function(){var t;try{t=new Function}catch(t){return!1}return\"function\"==typeof t}(),u=function(){if(\"undefined\"!=typeof globalThis)return globalThis;var t=function(){return this}();if(!t&&a)try{t=new Function(\"return this\")()}catch(t){}if(!t){if(\"undefined\"==typeof __webpack_public_path__&&\"undefined\"!=typeof global)return global;if(\"undefined\"!=typeof window)return window;if(\"undefined\"!=typeof self)return self}return t}(),c=function(){function t(){this._exception=void 0,this._caught=!1}return t.prototype.isEmpty=function(){return!this._caught},t.prototype.hasCaught=function(){return this._caught},t.prototype.exception=function(){return this._exception},t.prototype.setError=function(t){this._caught=!0,this._exception=t},t.prototype.reset=function(){this._caught=!1,this._exception=void 0},t.prototype.extractException=function(){var t=this._exception;return this.reset(),t},t}(),p=function(){var t;try{return Boolean(null===(t=Object.getOwnPropertyDescriptor(Function.prototype,\"name\"))||void 0===t?void 0:t.configurable)}catch(t){return!1}}(),f=\"object\"==typeof Reflect,l=\"undefined\"!=typeof FinalizationRegistry&&\"undefined\"!=typeof WeakRef,h=function(){try{var t=Symbol();new WeakRef(t),(new WeakMap).set(t,void 0)}catch(t){return!1}return!0}(),d=\"undefined\"!=typeof BigInt;var y=function(){return\"undefined\"!=typeof __webpack_public_path__||\"undefined\"!=typeof __webpack_public_path__?\"undefined\"!=typeof __non_webpack_require__?__non_webpack_require__:void 0:\"undefined\"!=typeof require?require:void 0}(),_=\"function\"==typeof MessageChannel?MessageChannel:function(){try{return y(\"worker_threads\").MessageChannel}catch(t){}}(),v=\"function\"==typeof setImmediate?setImmediate:function(t){if(\"function\"!=typeof t)throw new TypeError('The \"callback\" argument must be of type function');if(_){var e=new _;e.port1.onmessage=function(){e.port1.onmessage=null,e=void 0,t()},e.port2.postMessage(null)}else setTimeout(t,0)},g=\"function\"==typeof Buffer?Buffer:function(){try{return y(\"buffer\").Buffer}catch(t){}}(),z=\"1.9.0\",b=2147483647,k=function(){function t(t,e){this.id=t,this.value=e}return t.prototype.data=function(){return s(this.value)},t.prototype.isNumber=function(){return\"number\"==typeof this.value},t.prototype.isBigInt=function(){return\"bigint\"==typeof this.value},t.prototype.isString=function(){return\"string\"==typeof this.value},t.prototype.isFunction=function(){return\"function\"==typeof this.value},t.prototype.isExternal=function(){return r(this.value)},t.prototype.isObject=function(){return\"object\"==typeof this.value&&null!==this.value},t.prototype.isArray=function(){return Array.isArray(this.value)},t.prototype.isArrayBuffer=function(){return this.value instanceof ArrayBuffer},t.prototype.isTypedArray=function(){return ArrayBuffer.isView(this.value)&&!(this.value instanceof DataView)},t.prototype.isBuffer=function(t){return!!ArrayBuffer.isView(this.value)||(null!=t||(t=g),\"function\"==typeof t&&t.isBuffer(this.value))},t.prototype.isDataView=function(){return this.value instanceof DataView},t.prototype.isDate=function(){return this.value instanceof Date},t.prototype.isPromise=function(){return this.value instanceof Promise},t.prototype.isBoolean=function(){return\"boolean\"==typeof this.value},t.prototype.isUndefined=function(){return void 0===this.value},t.prototype.isSymbol=function(){return\"symbol\"==typeof this.value},t.prototype.isNull=function(){return null===this.value},t.prototype.dispose=function(){this.value=void 0},t}(),w=function(t){function e(e,n){return t.call(this,e,n)||this}return n(e,t),e.prototype.dispose=function(){},e}(k),S=function(){function t(){this._values=[void 0,t.UNDEFINED,t.NULL,t.FALSE,t.TRUE,t.GLOBAL],this._next=t.MIN_ID}return t.prototype.push=function(t){var e,n=this._next,i=this._values;return n<i.length?(e=i[n]).value=t:(e=new k(n,t),i[n]=e),this._next++,e},t.prototype.erase=function(t,e){this._next=t;for(var n=this._values,i=t;i<e;++i)n[i].dispose()},t.prototype.get=function(t){return this._values[t]},t.prototype.swap=function(t,e){var n=this._values,i=n[t];n[t]=n[e],n[t].id=Number(t),n[e]=i,i.id=Number(e)},t.prototype.dispose=function(){this._values.length=t.MIN_ID,this._next=t.MIN_ID},t.UNDEFINED=new w(1,void 0),t.NULL=new w(2,null),t.FALSE=new w(3,!1),t.TRUE=new w(4,!0),t.GLOBAL=new w(5,u),t.MIN_ID=6,t}(),E=function(){function t(t,e,n,i,r){void 0===r&&(r=i),this.handleStore=t,this.id=e,this.parent=n,this.child=null,null!==n&&(n.child=this),this.start=i,this.end=r,this._escapeCalled=!1,this.callbackInfo={thiz:void 0,data:0,args:void 0,fn:void 0}}return t.prototype.add=function(t){var e=this.handleStore.push(t);return this.end++,e},t.prototype.addExternal=function(t){return this.add(new o(t))},t.prototype.dispose=function(){this._escapeCalled&&(this._escapeCalled=!1),this.start!==this.end&&this.handleStore.erase(this.start,this.end)},t.prototype.escape=function(t){if(this._escapeCalled)return null;if(this._escapeCalled=!0,t<this.start||t>=this.end)return null;this.handleStore.swap(t,this.start);var e=this.handleStore.get(this.start);return this.start++,this.parent.end++,e},t.prototype.escapeCalled=function(){return this._escapeCalled},t}(),m=function(){function t(){this._rootScope=new E(null,0,null,1,S.MIN_ID),this.currentScope=this._rootScope,this._values=[void 0]}return t.prototype.get=function(t){return this._values[t]},t.prototype.openScope=function(t){var e=this.currentScope,n=e.child;if(null!==n)n.start=n.end=e.end;else{var i=e.id+1;n=new E(t,i,e,e.end),this._values[i]=n}return this.currentScope=n,n},t.prototype.closeScope=function(){var t=this.currentScope;this.currentScope=t.parent,t.dispose()},t.prototype.dispose=function(){this.currentScope=this._rootScope,this._values.length=1},t}(),C=function(){function t(){this._next=null,this._prev=null}return t.prototype.dispose=function(){},t.prototype.finalize=function(){},t.prototype.link=function(t){this._prev=t,this._next=t._next,null!==this._next&&(this._next._prev=this),t._next=this},t.prototype.unlink=function(){null!==this._prev&&(this._prev._next=this._next),null!==this._next&&(this._next._prev=this._prev),this._prev=null,this._next=null},t.finalizeAll=function(t){for(;null!==t._next;)t._next.finalize()},t}(),x=function(){function t(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=0),void 0===i&&(i=0),this.envObject=t,this._finalizeCallback=e,this._finalizeData=n,this._finalizeHint=i,this._makeDynCall_vppp=t.makeDynCall_vppp}return t.prototype.callback=function(){return this._finalizeCallback},t.prototype.data=function(){return this._finalizeData},t.prototype.hint=function(){return this._finalizeHint},t.prototype.resetEnv=function(){this.envObject=void 0},t.prototype.resetFinalizer=function(){this._finalizeCallback=0,this._finalizeData=0,this._finalizeHint=0},t.prototype.callFinalizer=function(){var t=this._finalizeCallback,e=this._finalizeData,n=this._finalizeHint;if(this.resetFinalizer(),t){var i=Number(t);this.envObject?this.envObject.callFinalizer(i,e,n):this._makeDynCall_vppp(i)(0,e,n)}},t.prototype.dispose=function(){this.envObject=void 0,this._makeDynCall_vppp=void 0},t}(),F=function(t){function e(e,n,i,r){var o=t.call(this)||this;return o._finalizer=new x(e,n,i,r),o}return n(e,t),e.create=function(t,n,i,r){var o=new e(t,n,i,r);return o.link(t.finalizing_reflist),o},e.prototype.data=function(){return this._finalizer.data()},e.prototype.dispose=function(){this._finalizer&&(this.unlink(),this._finalizer.envObject.dequeueFinalizer(this),this._finalizer.dispose(),this._finalizer=void 0,t.prototype.dispose.call(this))},e.prototype.finalize=function(){var t;this.unlink();var e=!1;try{this._finalizer.callFinalizer()}catch(n){e=!0,t=n}if(this.dispose(),e)throw t},e}(C);function O(t,e){if(!t.terminatedOrTerminating())throw e}var I=function(){function t(t,e,n,i,r){this.ctx=t,this.moduleApiVersion=e,this.makeDynCall_vppp=n,this.makeDynCall_vp=i,this.abort=r,this.openHandleScopes=0,this.instanceData=null,this.tryCatch=new c,this.refs=1,this.reflist=new C,this.finalizing_reflist=new C,this.pendingFinalizers=[],this.lastError={errorCode:0,engineErrorCode:0,engineReserved:0},this.inGcFinalizer=!1,this._bindingMap=new WeakMap,this.id=0}return t.prototype.canCallIntoJs=function(){return!0},t.prototype.terminatedOrTerminating=function(){return!this.canCallIntoJs()},t.prototype.ref=function(){this.refs++},t.prototype.unref=function(){this.refs--,0===this.refs&&this.dispose()},t.prototype.ensureHandle=function(t){return this.ctx.ensureHandle(t)},t.prototype.ensureHandleId=function(t){return this.ensureHandle(t).id},t.prototype.clearLastError=function(){var t=this.lastError;return 0!==t.errorCode&&(t.errorCode=0),0!==t.engineErrorCode&&(t.engineErrorCode=0),0!==t.engineReserved&&(t.engineReserved=0),0},t.prototype.setLastError=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0);var i=this.lastError;return i.errorCode!==t&&(i.errorCode=t),i.engineErrorCode!==e&&(i.engineErrorCode=e),i.engineReserved!==n&&(i.engineReserved=n),t},t.prototype.getReturnStatus=function(){return this.tryCatch.hasCaught()?this.setLastError(10):0},t.prototype.callIntoModule=function(t,e){void 0===e&&(e=O);var n=this.openHandleScopes;this.clearLastError();var i=t(this);(n!==this.openHandleScopes&&this.abort(\"open_handle_scopes != open_handle_scopes_before\"),this.tryCatch.hasCaught())&&e(this,this.tryCatch.extractException());return i},t.prototype.invokeFinalizerFromGC=function(t){if(this.moduleApiVersion!==b)this.enqueueFinalizer(t);else{var e=this.inGcFinalizer;this.inGcFinalizer=!0;try{t.finalize()}finally{this.inGcFinalizer=e}}},t.prototype.checkGCAccess=function(){this.moduleApiVersion===b&&this.inGcFinalizer&&this.abort(\"Finalizer is calling a function that may affect GC state.\\nThe finalizers are run directly from GC and must not affect GC state.\\nUse `node_api_post_finalizer` from inside of the finalizer to work around this issue.\\nIt schedules the call as a new task in the event loop.\")},t.prototype.enqueueFinalizer=function(t){-1===this.pendingFinalizers.indexOf(t)&&this.pendingFinalizers.push(t)},t.prototype.dequeueFinalizer=function(t){var e=this.pendingFinalizers.indexOf(t);-1!==e&&this.pendingFinalizers.splice(e,1)},t.prototype.deleteMe=function(){C.finalizeAll(this.finalizing_reflist),C.finalizeAll(this.reflist),this.tryCatch.extractException(),this.ctx.envStore.remove(this.id)},t.prototype.dispose=function(){0!==this.id&&(this.deleteMe(),this.finalizing_reflist.dispose(),this.reflist.dispose(),this.id=0)},t.prototype.initObjectBinding=function(t){var e={wrapped:0,tag:null};return this._bindingMap.set(t,e),e},t.prototype.getObjectBinding=function(t){return this._bindingMap.has(t)?this._bindingMap.get(t):this.initObjectBinding(t)},t.prototype.setInstanceData=function(t,e,n){this.instanceData&&this.instanceData.dispose(),this.instanceData=F.create(this,e,t,n)},t.prototype.getInstanceData=function(){return this.instanceData?this.instanceData.data():0},t}(),D=function(t){function e(e,n,i,r,o,s,a){var u=t.call(this,e,i,r,o,s)||this;return u.filename=n,u.nodeBinding=a,u.destructing=!1,u.finalizationScheduled=!1,u}return n(e,t),e.prototype.deleteMe=function(){this.destructing=!0,this.drainFinalizerQueue(),t.prototype.deleteMe.call(this)},e.prototype.canCallIntoJs=function(){return t.prototype.canCallIntoJs.call(this)&&this.ctx.canCallIntoJs()},e.prototype.triggerFatalException=function(t){if(this.nodeBinding)this.nodeBinding.napi.fatalException(t);else{if(\"object\"!=typeof process||null===process||\"function\"!=typeof process._fatalException)throw t;process._fatalException(t)||(console.error(t),process.exit(1))}},e.prototype.callbackIntoModule=function(t,e){return this.callIntoModule(e,function(e,n){if(!e.terminatedOrTerminating()){var i=\"object\"==typeof process&&null!==process,r=!!i&&Boolean(process.execArgv&&-1!==process.execArgv.indexOf(\"--force-node-api-uncaught-exceptions-policy\"));if(e.moduleApiVersion<10&&!r&&!t)(i&&\"function\"==typeof process.emitWarning?process.emitWarning:function(t,e,n){if(t instanceof Error)console.warn(t.toString());else{var i=n?\"[\".concat(n,\"] \"):\"\";console.warn(\"\".concat(i).concat(e||\"Warning\",\": \").concat(t))}})(\"Uncaught Node-API callback exception detected, please run node with option --force-node-api-uncaught-exceptions-policy=true to handle those exceptions properly.\",\"DeprecationWarning\",\"DEP0168\");else e.triggerFatalException(n)}})},e.prototype.callFinalizer=function(t,e,n){this.callFinalizerInternal(1,t,e,n)},e.prototype.callFinalizerInternal=function(t,e,n,i){var r=this.makeDynCall_vppp(e),o=this.id,s=this.ctx.openScope(this);try{this.callbackIntoModule(Boolean(t),function(){r(o,n,i)})}finally{this.ctx.closeScope(this,s)}},e.prototype.enqueueFinalizer=function(e){var n=this;t.prototype.enqueueFinalizer.call(this,e),this.finalizationScheduled||this.destructing||(this.finalizationScheduled=!0,this.ref(),v(function(){n.finalizationScheduled=!1,n.unref(),n.drainFinalizerQueue()}))},e.prototype.drainFinalizerQueue=function(){for(;this.pendingFinalizers.length>0;){this.pendingFinalizers.shift().finalize()}},e}(I);function R(t,e,n,i,r,o,s){(n=\"number\"!=typeof n?8:n)<8?n=8:n>10&&n!==b&&function(t,e){var n=\"\".concat(t,\" requires Node-API version \").concat(e,\", but this version of Node.js only supports version \").concat(10,\" add-ons.\");throw new Error(n)}(e,n);var a=new D(t,e,n,i,r,o,s);return t.envStore.add(a),t.addCleanupHook(a,function(){a.unref()},0),a}var N=function(t){function e(n){var i=this.constructor,r=t.call(this,n)||this,o=i,s=o.prototype;if(!(r instanceof e)){var a=Object.setPrototypeOf;\"function\"==typeof a?a.call(Object,r,s):r.__proto__=s,\"function\"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,o)}return r}return n(e,t),e}(Error);Object.defineProperty(N.prototype,\"name\",{configurable:!0,writable:!0,value:\"EmnapiError\"});var A=function(t){function e(e,n){return t.call(this,\"\".concat(e,': The current runtime does not support \"FinalizationRegistry\" and \"WeakRef\".').concat(n?\" \".concat(n):\"\"))||this}return n(e,t),e}(N);Object.defineProperty(A.prototype,\"name\",{configurable:!0,writable:!0,value:\"NotSupportWeakRefError\"});var H=function(t){function e(e,n){return t.call(this,\"\".concat(e,': The current runtime does not support \"Buffer\". Consider using buffer polyfill to make sure `globalThis.Buffer` is defined.').concat(n?\" \".concat(n):\"\"))||this}return n(e,t),e}(N);Object.defineProperty(H.prototype,\"name\",{configurable:!0,writable:!0,value:\"NotSupportBufferError\"});var j,T=function(){function t(t){this._value=t}return t.prototype.deref=function(){return this._value},t.prototype.dispose=function(){this._value=void 0},t}(),B=function(){function t(t){this._ref=new T(t)}return t.prototype.setWeak=function(e,n){if(l&&void 0!==this._ref&&!(this._ref instanceof WeakRef)){var i=this._ref.deref();try{t._registry.register(i,this,this);var r=new WeakRef(i);this._ref.dispose(),this._ref=r,this._param=e,this._callback=n}catch(t){if(\"symbol\"!=typeof i)throw t}}},t.prototype.clearWeak=function(){if(l&&void 0!==this._ref&&this._ref instanceof WeakRef){try{t._registry.unregister(this)}catch(t){}this._param=void 0,this._callback=void 0;var e=this._ref.deref();this._ref=void 0===e?e:new T(e)}},t.prototype.reset=function(){if(l)try{t._registry.unregister(this)}catch(t){}this._param=void 0,this._callback=void 0,this._ref instanceof T&&this._ref.dispose(),this._ref=void 0},t.prototype.isEmpty=function(){return void 0===this._ref},t.prototype.deref=function(){if(void 0!==this._ref)return this._ref.deref()},t._registry=l?new FinalizationRegistry(function(t){t._ref=void 0;var e=t._callback,n=t._param;t._callback=void 0,t._param=void 0,\"function\"==typeof e&&e(n)}):void 0,t}();t.ReferenceOwnership=void 0,(j=t.ReferenceOwnership||(t.ReferenceOwnership={}))[j.kRuntime=0]=\"kRuntime\",j[j.kUserland=1]=\"kUserland\";var W,M=function(e){function i(t,n,i,r){var o=e.call(this)||this;o.envObject=t,o._refcount=i,o._ownership=r;var s,a=t.ctx.handleStore.get(n);return o.canBeWeak=(s=a).isObject()||s.isFunction()||s.isSymbol(),o.persistent=new B(a.value),o.id=0,0===i&&o._setWeak(),o}return n(i,e),i.weakCallback=function(t){t.persistent.reset(),t.invokeFinalizerFromGC()},i.create=function(t,e,n,r,o,s,a){var u=new i(t,e,n,r);return t.ctx.refStore.add(u),u.link(t.reflist),u},i.prototype.ref=function(){return this.persistent.isEmpty()?0:(1===++this._refcount&&this.canBeWeak&&this.persistent.clearWeak(),this._refcount)},i.prototype.unref=function(){return this.persistent.isEmpty()||0===this._refcount?0:(0===--this._refcount&&this._setWeak(),this._refcount)},i.prototype.get=function(t){if(void 0===t&&(t=this.envObject),this.persistent.isEmpty())return 0;var e=this.persistent.deref();return t.ensureHandle(e).id},i.prototype.resetFinalizer=function(){},i.prototype.data=function(){return 0},i.prototype.refcount=function(){return this._refcount},i.prototype.ownership=function(){return this._ownership},i.prototype.callUserFinalizer=function(){},i.prototype.invokeFinalizerFromGC=function(){this.finalize()},i.prototype._setWeak=function(){this.canBeWeak?this.persistent.setWeak(this,i.weakCallback):this.persistent.reset()},i.prototype.finalize=function(){this.persistent.reset();var e=this._ownership===t.ReferenceOwnership.kRuntime;this.unlink(),this.callUserFinalizer(),e&&this.dispose()},i.prototype.dispose=function(){0!==this.id&&(this.unlink(),this.persistent.reset(),this.envObject.ctx.refStore.remove(this.id),e.prototype.dispose.call(this),this.envObject=void 0,this.id=0)},i}(C),P=function(t){function e(e,n,i,r,o){var s=t.call(this,e,n,i,r)||this;return s._data=o,s}return n(e,t),e.create=function(t,n,i,r,o){var s=new e(t,n,i,r,o);return t.ctx.refStore.add(s),s.link(t.reflist),s},e.prototype.data=function(){return this._data},e}(M),L=function(t){function e(e,n,i,r,o,s,a){var u=t.call(this,e,n,i,r)||this;return u._finalizer=new x(e,o,s,a),u}return n(e,t),e.create=function(t,n,i,r,o,s,a){var u=new e(t,n,i,r,o,s,a);return t.ctx.refStore.add(u),u.link(t.finalizing_reflist),u},e.prototype.resetFinalizer=function(){this._finalizer.resetFinalizer()},e.prototype.data=function(){return this._finalizer.data()},e.prototype.callUserFinalizer=function(){this._finalizer.callFinalizer()},e.prototype.invokeFinalizerFromGC=function(){this._finalizer.envObject.invokeFinalizerFromGC(this)},e.prototype.dispose=function(){this._finalizer&&(this._finalizer.envObject.dequeueFinalizer(this),this._finalizer.dispose(),t.prototype.dispose.call(this),this._finalizer=void 0)},e}(M),U=function(){function t(t,e){this.id=0,this.ctx=t,this.value=e}return t.create=function(e,n){var i=new t(e,n);return e.deferredStore.add(i),i},t.prototype.resolve=function(t){this.value.resolve(t),this.dispose()},t.prototype.reject=function(t){this.value.reject(t),this.dispose()},t.prototype.dispose=function(){this.ctx.deferredStore.remove(this.id),this.id=0,this.value=null,this.ctx=null},t}(),V=function(){function t(){this._values=[void 0],this._values.length=4,this._size=1,this._freeList=[]}return t.prototype.add=function(t){var e;if(this._freeList.length)e=this._freeList.shift();else{e=this._size,this._size++;var n=this._values.length;e>=n&&(this._values.length=n+(n>>1)+16)}t.id=e,this._values[e]=t},t.prototype.get=function(t){return this._values[t]},t.prototype.has=function(t){return void 0!==this._values[t]},t.prototype.remove=function(t){var e=this._values[t];e&&(e.id=0,this._values[t]=void 0,this._freeList.push(Number(t)))},t.prototype.dispose=function(){for(var t=1;t<this._size;++t){var e=this._values[t];null==e||e.dispose()}this._values=[void 0],this._size=1,this._freeList=[]},t}(),G=function(){return function(t,e,n,i){this.envObject=t,this.fn=e,this.arg=n,this.order=i}}(),q=function(){function t(){this._cleanupHooks=[],this._cleanupHookCounter=0}return t.prototype.empty=function(){return 0===this._cleanupHooks.length},t.prototype.add=function(t,e,n){if(this._cleanupHooks.filter(function(i){return i.envObject===t&&i.fn===e&&i.arg===n}).length>0)throw new Error(\"Can not add same fn and arg twice\");this._cleanupHooks.push(new G(t,e,n,this._cleanupHookCounter++))},t.prototype.remove=function(t,e,n){for(var i=0;i<this._cleanupHooks.length;++i){var r=this._cleanupHooks[i];if(r.envObject===t&&r.fn===e&&r.arg===n)return void this._cleanupHooks.splice(i,1)}},t.prototype.drain=function(){var t=this._cleanupHooks.slice();t.sort(function(t,e){return e.order-t.order});for(var e=0;e<t.length;++e){var n=t[e];\"number\"==typeof n.fn?n.envObject.makeDynCall_vp(n.fn)(n.arg):n.fn(n.arg),this._cleanupHooks.splice(this._cleanupHooks.indexOf(n),1)}},t.prototype.dispose=function(){this._cleanupHooks.length=0,this._cleanupHookCounter=0},t}(),J=function(){function t(){this.refHandle=(new _).port1,this.count=0}return t.prototype.increase=function(){0===this.count&&this.refHandle.ref&&this.refHandle.ref(),this.count++},t.prototype.decrease=function(){0!==this.count&&(1===this.count&&this.refHandle.unref&&this.refHandle.unref(),this.count--)},t}(),Q=function(){function t(){var t=this;this._isStopping=!1,this._canCallIntoJs=!0,this._suppressDestroy=!1,this.envStore=new V,this.scopeStore=new m,this.refStore=new V,this.deferredStore=new V,this.handleStore=new S,this.feature={supportReflect:f,supportFinalizer:l,supportWeakSymbol:h,supportBigInt:d,supportNewFunction:a,canSetFunctionName:p,setImmediate:v,Buffer:g,MessageChannel:_},this.cleanupQueue=new q,\"object\"==typeof process&&null!==process&&\"function\"==typeof process.once&&(this.refCounter=new J,process.once(\"beforeExit\",function(){t._suppressDestroy||t.destroy()}))}return t.prototype.suppressDestroy=function(){this._suppressDestroy=!0},t.prototype.getRuntimeVersions=function(){return{version:z,NODE_API_SUPPORTED_VERSION_MAX:10,NAPI_VERSION_EXPERIMENTAL:b,NODE_API_DEFAULT_MODULE_API_VERSION:8}},t.prototype.createNotSupportWeakRefError=function(t,e){return new A(t,e)},t.prototype.createNotSupportBufferError=function(t,e){return new H(t,e)},t.prototype.createReference=function(t,e,n,i){return M.create(t,e,n,i)},t.prototype.createReferenceWithData=function(t,e,n,i,r){return P.create(t,e,n,i,r)},t.prototype.createReferenceWithFinalizer=function(t,e,n,i,r,o,s){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),L.create(t,e,n,i,r,o,s)},t.prototype.createDeferred=function(t){return U.create(this,t)},t.prototype.createEnv=function(t,e,n,i,r,o){return R(this,t,e,n,i,r,o)},t.prototype.createTrackedFinalizer=function(t,e,n,i){return F.create(t,e,n,i)},t.prototype.getCurrentScope=function(){return this.scopeStore.currentScope},t.prototype.addToCurrentScope=function(t){return this.scopeStore.currentScope.add(t)},t.prototype.openScope=function(t){var e=this.scopeStore.openScope(this.handleStore);return t&&t.openHandleScopes++,e},t.prototype.closeScope=function(t,e){t&&0===t.openHandleScopes||(this.scopeStore.closeScope(),t&&t.openHandleScopes--)},t.prototype.ensureHandle=function(t){switch(t){case void 0:return S.UNDEFINED;case null:return S.NULL;case!0:return S.TRUE;case!1:return S.FALSE;case u:return S.GLOBAL}return this.addToCurrentScope(t)},t.prototype.addCleanupHook=function(t,e,n){this.cleanupQueue.add(t,e,n)},t.prototype.removeCleanupHook=function(t,e,n){this.cleanupQueue.remove(t,e,n)},t.prototype.runCleanup=function(){for(;!this.cleanupQueue.empty();)this.cleanupQueue.drain()},t.prototype.increaseWaitingRequestCounter=function(){var t;null===(t=this.refCounter)||void 0===t||t.increase()},t.prototype.decreaseWaitingRequestCounter=function(){var t;null===(t=this.refCounter)||void 0===t||t.decrease()},t.prototype.setCanCallIntoJs=function(t){this._canCallIntoJs=t},t.prototype.setStopping=function(t){this._isStopping=t},t.prototype.canCallIntoJs=function(){return this._canCallIntoJs&&!this._isStopping},t.prototype.destroy=function(){this.setStopping(!0),this.setCanCallIntoJs(!1),this.runCleanup()},t}();function X(){return new Q}t.ConstHandle=w,t.Context=Q,t.Deferred=U,t.EmnapiError=N,t.Env=I,t.External=o,t.Finalizer=x,t.Handle=k,t.HandleScope=E,t.HandleStore=S,t.NAPI_VERSION_EXPERIMENTAL=b,t.NODE_API_DEFAULT_MODULE_API_VERSION=8,t.NODE_API_SUPPORTED_VERSION_MAX=10,t.NODE_API_SUPPORTED_VERSION_MIN=1,t.NodeEnv=D,t.NotSupportBufferError=H,t.NotSupportWeakRefError=A,t.Persistent=B,t.RefTracker=C,t.Reference=M,t.ReferenceWithData=P,t.ReferenceWithFinalizer=L,t.ScopeStore=m,t.Store=V,t.TrackedFinalizer=F,t.TryCatch=c,t.createContext=X,t.getDefaultContext=function(){return W||(W=X()),W},t.getExternalValue=s,t.isExternal=r,t.isReferenceType=function(t){return\"object\"==typeof t&&null!==t||\"function\"==typeof t},t.version=z});\n;\n!function(e,r){\"object\"==typeof exports&&\"undefined\"!=typeof module?r(exports):\"function\"==typeof define&&define.amd?define([\"exports\"],r):r((e=\"undefined\"!=typeof globalThis?globalThis:e||self).emnapiCore={})}(this,function(e){var r=\"undefined\"!=typeof WebAssembly?WebAssembly:\"undefined\"!=typeof WXWebAssembly?WXWebAssembly:void 0;function t(e){if(e&&\"object\"!=typeof e)throw new TypeError(\"imports must be an object or undefined\");return!0}function n(e,a){if(!e)throw new TypeError(\"Invalid wasm source\");t(a),a=null!=a?a:{};try{var o=\"object\"==typeof e&&null!==e&&\"then\"in e?e.then:void 0;if(\"function\"==typeof o)return o.call(e,function(e){return n(e,a)})}catch(e){}if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return r.instantiate(e,a);if(e instanceof r.Module)return r.instantiate(e,a).then(function(r){return{instance:r,module:e}});if(\"undefined\"!=typeof Response&&e instanceof Response)return e.arrayBuffer().then(function(e){return r.instantiate(e,a)});var i=\"string\"==typeof e;if(i||\"undefined\"!=typeof URL&&e instanceof URL){if(i&&\"undefined\"!=typeof wx&&\"undefined\"!=typeof __wxConfig)return r.instantiate(e,a);if(\"function\"!=typeof fetch)throw new TypeError(\"wasm source can not be a string or URL in this environment\");if(\"function\"!=typeof r.instantiateStreaming)return n(fetch(e),a);try{return r.instantiateStreaming(fetch(e),a).catch(function(){return n(fetch(e),a)})}catch(r){return n(fetch(e),a)}}throw new TypeError(\"Invalid wasm source\")}var a=\"undefined\"!=typeof WebAssembly?WebAssembly:\"undefined\"!=typeof WXWebAssembly?WXWebAssembly:void 0,o=\"object\"==typeof process&&null!==process&&\"object\"==typeof process.versions&&null!==process.versions&&\"string\"==typeof process.versions.node;function i(e){return\"function\"==typeof(null==e?void 0:e.postMessage)?e.postMessage:\"function\"==typeof postMessage?postMessage:void 0}function s(e){return\"function\"==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(e)}function u(e){try{return e instanceof a.RuntimeError}catch(e){return!1}}function f(e,r){return{__emnapi__:{type:e,payload:r}}}function c(e){if(e){if(!s(e.buffer))throw new Error(\"Multithread features require shared wasm memory. Try to compile with `-matomics -mbulk-memory` and use `--import-memory --shared-memory` during linking, then create WebAssembly.Memory with `shared: true` option\")}else if(\"undefined\"==typeof SharedArrayBuffer)throw new Error(\"Current environment does not support SharedArrayBuffer, threads are not available!\")}var l=0,d=function(){function e(e){var r;if(this.unusedWorkers=[],this.runningWorkers=[],this.pthreads=Object.create(null),this.wasmModule=null,this.wasmMemory=null,this.messageEvents=new WeakMap,!e)throw new TypeError(\"ThreadManager(): options is not provided\");this._childThread=\"childThread\"in e&&Boolean(e.childThread),this._childThread?(this._onCreateWorker=void 0,this._reuseWorker=!1,this._beforeLoad=void 0):(this._onCreateWorker=e.onCreateWorker,this._reuseWorker=function(e){var r;if(\"boolean\"==typeof e)return!!e&&{size:0,strict:!1};if(\"number\"==typeof e){if(!(e>=0))throw new RangeError(\"reuseWorker: size must be a non-negative integer\");return{size:e,strict:!1}}if(!e)return!1;var t=null!==(r=Number(e.size))&&void 0!==r?r:0,n=Boolean(e.strict);if(!(t>0)&&n)throw new RangeError(\"reuseWorker: size must be set to positive integer if strict is set to true\");return{size:t,strict:n}}(e.reuseWorker),this._beforeLoad=e.beforeLoad),this.printErr=null!==(r=e.printErr)&&void 0!==r?r:console.error.bind(console),this.threadSpawn=e.threadSpawn}return Object.defineProperty(e.prototype,\"nextWorkerID\",{get:function(){return l},enumerable:!1,configurable:!0}),e.prototype.init=function(){this._childThread||this.initMainThread()},e.prototype.initMainThread=function(){this.preparePool()},e.prototype.preparePool=function(){if(this._reuseWorker&&this._reuseWorker.size)for(var e=this._reuseWorker.size;e--;){var r=this.allocateUnusedWorker();o&&(r.once(\"message\",function(){}),r.unref())}},e.prototype.shouldPreloadWorkers=function(){return!this._childThread&&this._reuseWorker&&this._reuseWorker.size>0},e.prototype.loadWasmModuleToAllWorkers=function(){for(var e=this,r=Array(this.unusedWorkers.length),t=function(e){var t=n.unusedWorkers[e];o&&t.ref(),r[e]=n.loadWasmModuleToWorker(t).then(function(e){return o&&t.unref(),e},function(e){throw o&&t.unref(),e})},n=this,a=0;a<this.unusedWorkers.length;++a)t(a);return Promise.all(r).catch(function(r){throw e.terminateAllThreads(),r})},e.prototype.preloadWorkers=function(){return this.shouldPreloadWorkers()?this.loadWasmModuleToAllWorkers():Promise.resolve([])},e.prototype.setup=function(e,r){this.wasmModule=e,this.wasmMemory=r},e.prototype.markId=function(e){if(e.__emnapi_tid)return e.__emnapi_tid;var r=l+43;return l=(l+1)%536870869,this.pthreads[r]=e,e.__emnapi_tid=r,r},e.prototype.returnWorkerToPool=function(e){var r=e.__emnapi_tid;void 0!==r&&delete this.pthreads[r],this.unusedWorkers.push(e),this.runningWorkers.splice(this.runningWorkers.indexOf(e),1),delete e.__emnapi_tid,o&&e.unref()},e.prototype.loadWasmModuleToWorker=function(e,r){var t=this;if(e.whenLoaded)return e.whenLoaded;var n=this.printErr,a=this._beforeLoad,i=this;return e.whenLoaded=new Promise(function(s,u){e.onmessage=function(r){!function(r){if(r.__emnapi__){var n=r.__emnapi__.type,a=r.__emnapi__.payload;\"loaded\"===n?(e.loaded=!0,o&&!e.__emnapi_tid&&e.unref(),s(e)):\"cleanup-thread\"===n?a.tid in t.pthreads&&t.cleanThread(e,a.tid):\"spawn-thread\"===n?t.threadSpawn(a.startArg,a.errorOrTid):\"terminate-all-threads\"===n&&t.terminateAllThreads()}}(r.data),t.fireMessageEvent(e,r)},e.onerror=function(r){var t=\"worker sent an error!\";if(void 0!==e.__emnapi_tid&&(t=\"worker (tid = \"+e.__emnapi_tid+\") sent an error!\"),\"message\"in r){if(n(t+\" \"+r.message),-1!==r.message.indexOf(\"RuntimeError\")||-1!==r.message.indexOf(\"unreachable\"))try{i.terminateAllThreads()}catch(e){}}else n(t);throw u(r),r},o&&(e.on(\"message\",function(r){var t,n;null===(n=(t=e).onmessage)||void 0===n||n.call(t,{data:r})}),e.on(\"error\",function(r){var t,n;null===(n=(t=e).onerror)||void 0===n||n.call(t,r)}),e.on(\"detachedExit\",function(){})),\"function\"==typeof a&&a(e);try{e.postMessage(f(\"load\",{wasmModule:t.wasmModule,wasmMemory:t.wasmMemory,sab:r}))}catch(e){throw c(t.wasmMemory),e}}),e.whenLoaded},e.prototype.allocateUnusedWorker=function(){var e=this._onCreateWorker;if(\"function\"!=typeof e)throw new TypeError(\"`options.onCreateWorker` is not provided\");var r=e({type:\"thread\",name:\"emnapi-pthread\"});return this.unusedWorkers.push(r),r},e.prototype.getNewWorker=function(e){if(this._reuseWorker){if(0===this.unusedWorkers.length){if(this._reuseWorker.strict)if(!o)return void(0,this.printErr)(\"Tried to spawn a new thread, but the thread pool is exhausted.\\nThis might result in a deadlock unless some threads eventually exit or the code explicitly breaks out to the event loop.\");var r=this.allocateUnusedWorker();this.loadWasmModuleToWorker(r,e)}return this.unusedWorkers.pop()}var t=this.allocateUnusedWorker();return this.loadWasmModuleToWorker(t,e),this.unusedWorkers.pop()},e.prototype.cleanThread=function(e,r,t){if(!t&&this._reuseWorker)this.returnWorkerToPool(e);else{delete this.pthreads[r];var n=this.runningWorkers.indexOf(e);-1!==n&&this.runningWorkers.splice(n,1),this.terminateWorker(e),delete e.__emnapi_tid}},e.prototype.terminateWorker=function(e){var r,t=this,n=e.__emnapi_tid;e.terminate(),null===(r=this.messageEvents.get(e))||void 0===r||r.clear(),this.messageEvents.delete(e),e.onmessage=function(e){e.data.__emnapi__&&(0,t.printErr)('received \"'+e.data.__emnapi__.type+'\" command from terminated worker: '+n)}},e.prototype.terminateAllThreads=function(){for(var e=0;e<this.runningWorkers.length;++e)this.terminateWorker(this.runningWorkers[e]);for(e=0;e<this.unusedWorkers.length;++e)this.terminateWorker(this.unusedWorkers[e]);this.unusedWorkers=[],this.runningWorkers=[],this.pthreads=Object.create(null),this.preparePool()},e.prototype.addMessageEventListener=function(e,r){var t=this.messageEvents.get(e);return t||(t=new Set,this.messageEvents.set(e,t)),t.add(r),function(){null==t||t.delete(r)}},e.prototype.fireMessageEvent=function(e,r){var t=this.messageEvents.get(e);if(t){var n=this.printErr;t.forEach(function(e){try{e(r)}catch(e){n(e.stack)}})}},e}(),p=Symbol(\"kIsProxy\");function v(e,r){if(e[p])return e;var t=e.exports,n=function(e){for(var r=[\"apply\",\"construct\",\"defineProperty\",\"deleteProperty\",\"get\",\"getOwnPropertyDescriptor\",\"getPrototypeOf\",\"has\",\"isExtensible\",\"ownKeys\",\"preventExtensions\",\"set\",\"setPrototypeOf\"],t={},n=function(n){var a=r[n];t[a]=function(){var r=Array.prototype.slice.call(arguments,1);return r.unshift(e),Reflect[a].apply(Reflect,r)}},a=0;a<r.length;a++)n(a);return t}(t),a=function(){},o=function(){return 0};n.get=function(e,n,i){var s;return\"memory\"===n?null!==(s=\"function\"==typeof r?r():r)&&void 0!==s?s:Reflect.get(t,n,i):\"_initialize\"===n?n in t?a:void 0:\"_start\"===n?n in t?o:void 0:Reflect.get(t,n,i)},n.has=function(e,r){return\"memory\"===r||Reflect.has(t,r)};var i=new Proxy(Object.create(null),n);return new Proxy(e,{get:function(e,r,t){return\"exports\"===r?i:r===p||Reflect.get(e,r,t)}})}var h=new WeakMap,y=function(){function e(e){var r=this;if(!e)throw new TypeError(\"WASIThreads(): options is not provided\");if(!e.wasi)throw new TypeError(\"WASIThreads(): options.wasi is not provided\");h.set(this,new WeakSet);var t=e.wasi;!function(e,r){var t=h.get(e);if(t.has(r))return;var n=e,a=r.wasiImport;if(a){var o=a.proc_exit;a.proc_exit=function(e){return n.terminateAllThreads(),o.call(this,e)}}if(!n.childThread){var i=r.start;\"function\"==typeof i&&(r.start=function(e){try{return i.call(this,e)}catch(e){throw u(e)&&n.terminateAllThreads(),e}})}t.add(r)}(this,t),this.wasi=t,this.childThread=\"childThread\"in e&&Boolean(e.childThread),this.PThread=void 0,\"threadManager\"in e?\"function\"==typeof e.threadManager?this.PThread=e.threadManager():this.PThread=e.threadManager:this.childThread||(this.PThread=new d(e),this.PThread.init());var n=!1;\"waitThreadStart\"in e&&(n=\"number\"==typeof e.waitThreadStart?e.waitThreadStart:Boolean(e.waitThreadStart));var s=i(e);if(this.childThread&&\"function\"!=typeof s)throw new TypeError(\"options.postMessage is not a function\");this.postMessage=s;var l=Boolean(e.wasm64),p=function(e,t){var i,u=void 0!==t;try{c(r.wasmMemory)}catch(e){if(null===(i=r.PThread)||void 0===i||i.printErr(e.stack),u){var d=new Int32Array(r.wasmMemory.buffer,t,2);return Atomics.store(d,0,1),Atomics.store(d,1,6),Atomics.notify(d,1),1}return-6}if(!u){var p=r.wasmInstance.exports.malloc;if(!(t=l?Number(p(BigInt(8))):p(8)))return-48}var v=r.wasmInstance.exports.free,h=l?function(e){v(BigInt(e))}:v,y=new Int32Array(r.wasmMemory.buffer,t,2);if(Atomics.store(y,0,0),Atomics.store(y,1,0),r.childThread){s(f(\"spawn-thread\",{startArg:e,errorOrTid:t})),Atomics.wait(y,1,0);var g=Atomics.load(y,0),_=Atomics.load(y,1);return u?g:(h(t),g?-_:_)}var E,w,m,L=n||0===n;L&&(E=new Int32Array(new SharedArrayBuffer(8208)),Atomics.store(E,0,0));var b=r.PThread;try{if(!(w=b.getNewWorker(E)))throw new Error(\"failed to get new worker\");if(m=b.markId(w),o&&w.unref(),w.postMessage(f(\"start\",{tid:m,arg:e,sab:E})),L){if(\"number\"==typeof n){if(\"timed-out\"===Atomics.wait(E,0,0,n)){try{b.cleanThread(w,m,!0)}catch(e){}throw new Error(\"Spawning thread timed out. Please check if the worker is created successfully and if message is handled properly in the worker.\")}}else Atomics.wait(E,0,0);if(Atomics.load(E,0)>1){try{b.cleanThread(w,m,!0)}catch(e){}throw function(e){var r,t,n=new Int32Array(e);if(Atomics.load(n,0)<=1)return null;var o=Atomics.load(n,1),i=Atomics.load(n,2),s=Atomics.load(n,3),u=new Uint8Array(e),f=u.slice(16,16+o),c=u.slice(16+o,16+o+i),l=u.slice(16+o+i,16+o+i+s),d=(new TextDecoder).decode(f),p=(new TextDecoder).decode(c),v=(new TextDecoder).decode(l),h=new(null!==(r=globalThis[d])&&void 0!==r?r:\"RuntimeError\"===d&&null!==(t=a.RuntimeError)&&void 0!==t?t:Error)(p);return Object.defineProperty(h,\"stack\",{value:v,writable:!0,enumerable:!1,configurable:!0}),h}(E.buffer)}}}catch(e){return Atomics.store(y,0,1),Atomics.store(y,1,6),Atomics.notify(y,1),null==b||b.printErr(e.stack),u?1:(h(t),-6)}return Atomics.store(y,0,0),Atomics.store(y,1,m),Atomics.notify(y,1),b.runningWorkers.push(w),L||w.whenLoaded.catch(function(e){throw delete w.whenLoaded,b.cleanThread(w,m,!0),e}),u?0:(h(t),m)};this.threadSpawn=p,this.PThread&&(this.PThread.threadSpawn=p)}return e.prototype.getImportObject=function(){return{wasi:{\"thread-spawn\":this.threadSpawn}}},e.prototype.setup=function(e,r,t){null!=t||(t=e.exports.memory),this.wasmInstance=e,this.wasmMemory=t,this.PThread&&this.PThread.setup(r,t)},e.prototype.preloadWorkers=function(){return this.PThread?this.PThread.preloadWorkers():Promise.resolve([])},e.prototype.initialize=function(e,r,t){var n=e.exports;null!=t||(t=n.memory),this.childThread&&(e=v(e,t)),this.setup(e,r,t);var a=this.wasi;if(\"_start\"in n&&\"function\"==typeof n._start)if(this.childThread){a.start(e);try{a[g(a,\"kStarted\")]=!1}catch(e){}}else!function(e,r){var t=g(e,[\"kInstance\",\"kSetMemory\"]),n=t[0],a=t[1];e[n]=r,e[a](r.exports.memory)}(a,e);else a.initialize(e);return e},e.prototype.start=function(e,r,t){var n=e.exports;return null!=t||(t=n.memory),this.childThread&&(e=v(e,t)),this.setup(e,r,t),{exitCode:this.wasi.start(e),instance:e}},e.prototype.terminateAllThreads=function(){var e;this.childThread?this.postMessage(f(\"terminate-all-threads\",{})):null===(e=this.PThread)||void 0===e||e.terminateAllThreads()},e}();function g(e,r){var t=Object.getOwnPropertySymbols(e),n=function(e){return function(r){return r.description?r.description===e:r.toString()===\"Symbol(\".concat(e,\")\")}};return Array.isArray(r)?r.map(function(e){return t.filter(n(e))[0]}):t.filter(n(r))[0]}var _=function(){function e(e){var r=i(e);if(\"function\"!=typeof r)throw new TypeError(\"options.postMessage is not a function\");this.postMessage=r,this.onLoad=null==e?void 0:e.onLoad,this.onError=\"function\"==typeof(null==e?void 0:e.onError)?e.onError:function(e,r){throw r},this.instance=void 0,this.messagesBeforeLoad=[]}return e.prototype.instantiate=function(e){if(\"function\"==typeof this.onLoad)return this.onLoad(e);throw new Error(\"ThreadMessageHandler.prototype.instantiate is not implemented\")},e.prototype.handle=function(e){var r,t=this;if(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.__emnapi__){var n=e.data.__emnapi__.type,a=e.data.__emnapi__.payload;try{\"load\"===n?this._load(a):\"start\"===n&&this.handleAfterLoad(e,function(){t._start(a)})}catch(e){this.onError(e,n)}}},e.prototype._load=function(e){var r=this;if(void 0===this.instance){var t;try{t=this.instantiate(e)}catch(r){return void this._loaded(r,null,e)}var n=t&&\"then\"in t?t.then:void 0;\"function\"==typeof n?n.call(t,function(t){r._loaded(null,t,e)},function(t){r._loaded(t,null,e)}):this._loaded(null,t,e)}},e.prototype._start=function(e){var r=this.instance.exports.wasi_thread_start;if(\"function\"!=typeof r){var t=new TypeError(\"wasi_thread_start is not exported\");throw E(e.sab,2,t),t}var n=this.postMessage,a=e.tid,o=e.arg;E(e.sab,1);try{r(a,o)}catch(t){if(\"unwind\"!==t)throw t;return}n(f(\"cleanup-thread\",{tid:a}))},e.prototype._loaded=function(e,r,t){if(e)throw E(t.sab,2,e),e;if(null==r){var n=new TypeError(\"onLoad should return an object\");throw E(t.sab,2,n),n}var a=r.instance;if(!a){var o=new TypeError('onLoad should return an object which includes \"instance\"');throw E(t.sab,2,o),o}this.instance=a,(0,this.postMessage)(f(\"loaded\",{}));var i=this.messagesBeforeLoad;this.messagesBeforeLoad=[];for(var s=0;s<i.length;s++){var u=i[s];this.handle({data:u})}},e.prototype.handleAfterLoad=function(e,r){void 0!==this.instance?r.call(this,e):this.messagesBeforeLoad.push(e.data)},e}();function E(e,r,t){e&&(!function(e,r,t){var n=new Int32Array(e);if(Atomics.store(n,0,r),r>1&&t){var a=t.name,o=t.message,i=t.stack,s=(new TextEncoder).encode(a),u=(new TextEncoder).encode(o),f=(new TextEncoder).encode(i);Atomics.store(n,1,s.length),Atomics.store(n,2,u.length),Atomics.store(n,3,f.length);var c=new Uint8Array(e);c.set(s,16),c.set(u,16+s.length),c.set(f,16+s.length+u.length)}}(e.buffer,r,t),Atomics.notify(e,0))}function w(e){var t=function(){var t,n,a,o,i,s=\"object\"==typeof process&&null!==process&&\"object\"==typeof process.versions&&null!==process.versions&&\"string\"==typeof process.versions.node,u=Boolean(e.childThread),f=\"number\"==typeof e.waitThreadStart?e.waitThreadStart:Boolean(e.waitThreadStart);function c(e){if(\"function\"==typeof r.RuntimeError)throw new r.RuntimeError(e);throw Error(e)}var l,p,v,h={imports:{env:{},napi:{},emnapi:{}},exports:{},emnapi:{},loaded:!1,filename:\"\",childThread:u,initWorker:void 0,waitThreadStart:f,PThread:void 0,init:function(e){if(h.loaded)return h.exports;if(!e)throw new TypeError(\"Invalid napi init options\");var s=e.instance;if(!(null==s?void 0:s.exports))throw new TypeError(\"Invalid wasm instance\");t=s;var u=s.exports,f=e.module,d=e.memory||u.memory,v=e.table||u.__indirect_function_table;if(!(f instanceof r.Module))throw new TypeError(\"Invalid wasm module\");if(!(d instanceof r.Memory))throw new TypeError(\"Invalid wasm memory\");if(!(v instanceof r.Table))throw new TypeError(\"Invalid wasm table\");if(n=d,a=v,\"function\"!=typeof u.malloc)throw new TypeError(\"malloc is not exported\");if(\"function\"!=typeof u.free)throw new TypeError(\"free is not exported\");if(o=u.malloc,i=u.free,!h.childThread){var y=8,g=s.exports.node_api_module_get_api_version_v1;\"function\"==typeof g&&(y=g());var _=h.envObject||(h.envObject=l.createEnv(h.filename,y,function(e){return a.get(e)},function(e){return a.get(e)},c,p)),E=l.openScope(_);try{_.callIntoModule(function(e){var r=h.exports,t=E.add(r),n=(0,s.exports.napi_register_wasm_v1)(e.id,t.id);h.exports=n?l.handleStore.get(n).value:r})}catch(e){if(\"unwind\"!==e)throw e}finally{l.closeScope(_,E)}return h.loaded=!0,delete h.envObject,h.exports}}},y=void 0;if(u){l=null==e?void 0:e.context;var g=\"function\"==typeof e.postMessage?e.postMessage:\"function\"==typeof postMessage?postMessage:void 0;if(\"function\"!=typeof g)throw new TypeError(\"No postMessage found\");h.postMessage=g}else{var _=e.context;if(\"object\"!=typeof _||null===_)throw new TypeError(\"Invalid `options.context`. Use `import { getDefaultContext } from '@emnapi/runtime'`\");l=_}if(\"string\"==typeof e.filename&&(h.filename=e.filename),\"function\"==typeof e.onCreateWorker&&(y=e.onCreateWorker),\"function\"==typeof e.print?e.print:console.log.bind(console),v=\"function\"==typeof e.printErr?e.printErr:console.warn.bind(console),\"nodeBinding\"in e){var E=e.nodeBinding;if(\"object\"!=typeof E||null===E)throw new TypeError(\"Invalid `options.nodeBinding`. Use @emnapi/node-binding package\");p=E}var w=0;if(\"asyncWorkPoolSize\"in e){if(\"number\"!=typeof e.asyncWorkPoolSize)throw new TypeError(\"options.asyncWorkPoolSize must be a integer\");(w=e.asyncWorkPoolSize|0)>1024?w=1024:w<-1024&&(w=-1024)}var m=!u&&w<=0;function L(){return Math.abs(w)}function b(e){if(!e)return!1;if(e._emnapiSendListener)return!0;var r=function(e){var r=(s?e:e.data).__emnapi__;if(r&&\"async-send\"===r.type)if(u){(0,h.postMessage)({__emnapi__:r})}else{var t=r.payload.callback;a.get(t)(r.payload.data)}};return e._emnapiSendListener={handler:r,dispose:function(){s?e.off(\"message\",r):e.removeEventListener(\"message\",r,!1),delete e._emnapiSendListener}},s?e.on(\"message\",r):e.addEventListener(\"message\",r,!1),!0}h.imports.env._emnapi_async_work_pool_size=L,h.emnapi.addSendListener=b;var S=new d(u?{printErr:v,childThread:!0}:{printErr:v,beforeLoad:function(e){b(e)},reuseWorker:e.reuseWorker,onCreateWorker:y});function A(e,r){l.feature.setImmediate(function(){a.get(e)(r)})}function C(e,r){Promise.resolve().then(function(){a.get(e)(r)})}function k(e,r){var t,a=[r>>>0,(t=r,+Math.abs(t)>=1?t>0?(0|Math.min(+Math.floor(t/4294967296),4294967295))>>>0:~~+Math.ceil((t-+(~~t>>>0))/4294967296)>>>0:0)],o=new DataView(n.buffer);o.setInt32(e,a[0],!0),o.setInt32(e+4,a[1],!0)}h.PThread=S;var I,T=Object.freeze({__proto__:null,$emnapiSetValueI64:k,_emnapi_call_finalizer:function(e,r,t,n,a){l.envStore.get(r).callFinalizerInternal(e,t,n,a)},_emnapi_callback_into_module:function(e,r,t,n,o){var i=l.envStore.get(r),s=l.openScope(i);try{i.callbackIntoModule(Boolean(e),function(){a.get(t)(r,n)})}catch(e){throw l.closeScope(i,s),o&&l.closeScope(i),e}l.closeScope(i,s)},_emnapi_close_handle_scope:function(e){return l.closeScope()},_emnapi_ctx_decrease_waiting_request_counter:function(){l.decreaseWaitingRequestCounter()},_emnapi_ctx_increase_waiting_request_counter:function(){l.increaseWaitingRequestCounter()},_emnapi_get_node_version:function(e,r,t){var a=\"object\"==typeof process&&null!==process&&\"object\"==typeof process.versions&&null!==process.versions&&\"string\"==typeof process.versions.node?process.versions.node.split(\".\").map(function(e){return Number(e)}):[0,0,0],o=new DataView(n.buffer);o.setUint32(e,a[0],!0),o.setUint32(r,a[1],!0),o.setUint32(t,a[2],!0)},_emnapi_get_now:function(){return performance.timeOrigin+performance.now()},_emnapi_is_main_browser_thread:function(){return\"undefined\"==typeof window||\"undefined\"==typeof document||s?0:1},_emnapi_is_main_runtime_thread:function(){return u?0:1},_emnapi_next_tick:C,_emnapi_open_handle_scope:function(){return l.openScope().id},_emnapi_runtime_keepalive_pop:function(){},_emnapi_runtime_keepalive_push:function(){},_emnapi_set_immediate:A,_emnapi_unwind:function(){throw\"unwind\"},napi_clear_last_error:function(e){return l.envStore.get(e).clearLastError()},napi_set_last_error:function(e,r,t,n){return l.envStore.get(e).setLastError(r,t,n)}});function U(e){var r=new DataView(n.buffer).getInt32(e+20,!0);return S.pthreads[r]}var V=new Promise(function(e){I=function(){V.ready=!0,e()}});V.ready=!1;var B=Object.freeze({__proto__:null,_emnapi_after_uvthreadpool_ready:function(e,r,t){V.ready?a.get(e)(r,t):V.then(function(){a.get(e)(r,t)})},_emnapi_async_send_js:function(e,r,t){if(u)(0,h.postMessage)({__emnapi__:{type:\"async-send\",payload:{callback:r,data:t}}});else switch(e){case 0:A(r,t);break;case 1:C(r,t)}},_emnapi_emit_async_thread_ready:function(){u&&(0,h.postMessage)({__emnapi__:{type:\"async-thread-ready\",payload:{}}})},_emnapi_tell_js_uvthreadpool:function(e,r){for(var t=[],a=new DataView(n.buffer),o=function(r){var n=U(a.getUint32(e+4*r,!0));t.push(new Promise(function(e){var r=function(t){var a=(s?t:t.data).__emnapi__;a&&\"async-thread-ready\"===a.type&&(e(),n&&\"function\"==typeof n.unref&&n.unref(),s?n.off(\"message\",r):n.removeEventListener(\"message\",r))};s?n.on(\"message\",r):n.addEventListener(\"message\",r)}))},i=0;i<r;i++)o(i);Promise.all(t).then(I)},_emnapi_worker_ref:function(e){if(!u){var r=U(e);r&&\"function\"==typeof r.ref&&r.ref()}},_emnapi_worker_unref:function(e){if(!u){var r=U(e);r&&\"function\"==typeof r.unref&&r.unref()}}});var x=Object.freeze({__proto__:null,napi_adjust_external_memory:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(!t)return a.setLastError(1);var o=Number(r);if(o<0)return a.setLastError(1);var i=n.buffer.byteLength,s=i+o;return s+=(65536-s%65536)%65536,-1===n.grow(s-i+65535>>16)?a.setLastError(9):(l.feature.supportBigInt?new DataView(n.buffer).setBigInt64(t,BigInt(n.buffer.byteLength),!0):k(t,n.buffer.byteLength),a.clearLastError())}}),D={idGen:{},values:[void 0],queued:new Set,pending:[],init:function(){var e={nextId:1,list:[],generate:function(){var r;return e.list.length?r=e.list.shift():(r=e.nextId,e.nextId++),r},reuse:function(r){e.list.push(r)}};D.idGen=e,D.values=[void 0],D.queued=new Set,D.pending=[]},create:function(e,r,t,n,a,o){var i=0,s=0;if(p){var u=p.node.emitAsyncInit(r,t,-1);i=u.asyncId,s=u.triggerAsyncId}var f=D.idGen.generate();return D.values[f]={env:e,id:f,resource:r,asyncId:i,triggerAsyncId:s,status:0,execute:n,complete:a,data:o},f},callComplete:function(e,r){var t=e.complete,n=e.env,o=e.data,i=function(){if(t){var e=l.envStore.get(n),i=l.openScope(e);try{e.callbackIntoModule(!0,function(){a.get(t)(n,r,o)})}finally{l.closeScope(e,i)}}};p?p.node.makeCallback(e.resource,i,[],{asyncId:e.asyncId,triggerAsyncId:e.triggerAsyncId}):i()},queue:function(e){var r=D.values[e];if(r&&0===r.status){if(r.status=1,D.queued.size>=(Math.abs(w)||4))return void D.pending.push(e);D.queued.add(e);var t=r.env,n=r.data,o=r.execute;r.status=2,l.feature.setImmediate(function(){if(a.get(o)(t,n),D.queued.delete(e),r.status=3,l.feature.setImmediate(function(){D.callComplete(r,0)}),D.pending.length>0){var i=D.pending.shift();D.values[i].status=0,D.queue(i)}})}},cancel:function(e){var r=D.pending.indexOf(e);if(-1!==r){var t=D.values[e];return t&&1===t.status?(t.status=4,D.pending.splice(r,1),l.feature.setImmediate(function(){D.callComplete(t,11)}),0):9}return 9},remove:function(e){var r=D.values[e];r&&(p&&p.node.emitAsyncDestroy({asyncId:r.asyncId,triggerAsyncId:r.triggerAsyncId}),D.values[e]=void 0,D.idGen.reuse(e))}};function M(e,r,t,a){if(p){var o=l.handleStore.get(e).value,i=l.handleStore.get(r).value,s=p.node.emitAsyncInit(o,i,t),u=s.asyncId,f=s.triggerAsyncId;if(a){var c=new DataView(n.buffer);c.setFloat64(a,u,!0),c.setFloat64(a+8,f,!0)}}}function O(e,r){p&&p.node.emitAsyncDestroy({asyncId:e,triggerAsyncId:r})}var j=Object.freeze({__proto__:null,_emnapi_async_destroy_js:function(e){if(!p)return 9;var r=new DataView(n.buffer),t=r.getInt32(e,!0),a=r.getInt32(e+4,!0),o=BigInt(t>>>0)|BigInt(a)<<BigInt(32),i=p.napi.asyncDestroy(o);return 0!==i.status?i.status:0},_emnapi_async_init_js:function(e,r,t){if(!p)return 9;var a;e&&(a=Object(l.handleStore.get(e).value));var o=l.handleStore.get(r).value,i=p.napi.asyncInit(a,o);if(0!==i.status)return i.status;var s=i.value;s>=BigInt(-1)*(BigInt(1)<<BigInt(63))&&s<BigInt(1)<<BigInt(63)||(s&=(BigInt(1)<<BigInt(64))-BigInt(1))>=BigInt(1)<<BigInt(63)&&(s-=BigInt(1)<<BigInt(64));var u=Number(s&BigInt(4294967295)),f=Number(s>>BigInt(32)),c=new DataView(n.buffer);return c.setInt32(t,u,!0),c.setInt32(t+4,f,!0),0},_emnapi_env_check_gc_access:function(e){l.envStore.get(e).checkGCAccess()},_emnapi_node_emit_async_destroy:O,_emnapi_node_emit_async_init:M,_emnapi_node_make_callback:function(e,r,t,a,o,i,s,u){var f,c=0;if(p){var d=l.handleStore.get(r).value,v=l.handleStore.get(t).value;o>>>=0;for(var h=Array(o),y=new DataView(n.buffer);c<o;c++){var g=y.getUint32(a+4*c,!0);h[c]=l.handleStore.get(g).value}var _=p.node.makeCallback(d,v,h,{asyncId:i,triggerAsyncId:s});if(u)f=l.envStore.get(e).ensureHandleId(_),y.setUint32(u,f,!0)}},napi_close_callback_scope:function(e,r){throw new Error(\"napi_close_callback_scope has not been implemented yet\")},napi_make_callback:function(e,r,t,a,o,i,s){var u,f=0;if(!e)return 1;var c=l.envStore.get(e);if(c.checkGCAccess(),!c.tryCatch.isEmpty())return c.setLastError(10);if(!c.canCallIntoJs())return c.setLastError(c.moduleApiVersion>=10?23:10);c.clearLastError();try{if(!p)return c.setLastError(9);if(!t)return c.setLastError(1);if(o>0&&!i)return c.setLastError(1);var d=Object(l.handleStore.get(t).value),v=l.handleStore.get(a).value;if(\"function\"!=typeof v)return c.setLastError(1);var h=new DataView(n.buffer),y=h.getInt32(r,!0),g=h.getInt32(r+4,!0),_=BigInt(y>>>0)|BigInt(g)<<BigInt(32);o>>>=0;for(var E=Array(o);f<o;f++){var w=h.getUint32(i+4*f,!0);E[f]=l.handleStore.get(w).value}var m=p.napi.makeCallback(_,d,v,E);if(m.error)throw m.error;return 0!==m.status?c.setLastError(m.status):(s&&(u=c.ensureHandleId(m.value),h.setUint32(s,u,!0)),c.getReturnStatus())}catch(e){return c.tryCatch.setError(e),c.setLastError(10)}},napi_open_callback_scope:function(e,r,t,n){throw new Error(\"napi_open_callback_scope has not been implemented yet\")}}),R={offset:{__size__:0,resource:0,async_id:0,trigger_async_id:0,queue_size:0,is_some:0,queue:0,thread_count:0,state:0,dispatch_state:0,context:0,max_queue_size:0,ref:0,env:0,finalize_data:0,finalize_cb:0,call_js_cb:0,handles_closing:0,async_ref:0,mutex:0,cond:0},init:function(){if(R.offset.__size__=184,R.offset.resource=0,R.offset.async_id=8,R.offset.trigger_async_id=16,R.offset.queue_size=60,R.offset.is_some=24,R.offset.queue=64,R.offset.thread_count=136,R.offset.state=140,R.offset.dispatch_state=144,R.offset.context=148,R.offset.max_queue_size=152,R.offset.ref=156,R.offset.env=160,R.offset.finalize_data=164,R.offset.finalize_cb=168,R.offset.call_js_cb=172,R.offset.handles_closing=176,R.offset.async_ref=180,R.offset.mutex=32,R.offset.cond=56,R.offset.mutex=R.offset.mutex+4,void 0!==S){S.unusedWorkers.forEach(R.addListener),S.runningWorkers.forEach(R.addListener);var e=S.getNewWorker;S.getNewWorker=function(){var r=e.apply(this,arguments);return R.addListener(r),r}}},addListener:function(e){if(!e)return!1;if(e._emnapiTSFNListener)return!0;var r=function(e){var r=(s?e:e.data).__emnapi__;if(r){var t=r.type,n=r.payload;\"tsfn-send\"===t&&R.dispatch(n.tsfn)}};return e._emnapiTSFNListener={handler:r,dispose:function(){s?e.off(\"message\",r):e.removeEventListener(\"message\",r,!1),delete e._emnapiTSFNListener}},s?e.on(\"message\",r):e.addEventListener(\"message\",r,!1),!0},initQueue:function(e){var r=o(8);return!!r&&(new Uint8Array(n.buffer,r,8).fill(0),R.storeSizeTypeValue(e+R.offset.queue,r,!1),!0)},destroyQueue:function(e){var r=R.loadSizeTypeValue(e+R.offset.queue,!1);r&&i(r)},pushQueue:function(e,r){var t=R.loadSizeTypeValue(e+R.offset.queue,!1),n=R.loadSizeTypeValue(t,!1),a=R.loadSizeTypeValue(t+4,!1),i=o(8);if(!i)throw new Error(\"OOM\");R.storeSizeTypeValue(i,r,!1),R.storeSizeTypeValue(i+4,0,!1),0===n&&0===a?(R.storeSizeTypeValue(t,i,!1),R.storeSizeTypeValue(t+4,i,!1)):(R.storeSizeTypeValue(a+4,i,!1),R.storeSizeTypeValue(t+4,i,!1)),R.addQueueSize(e)},shiftQueue:function(e){var r=R.loadSizeTypeValue(e+R.offset.queue,!1),t=R.loadSizeTypeValue(r,!1);if(0===t)return 0;var n=t,a=R.loadSizeTypeValue(t+4,!1);R.storeSizeTypeValue(r,a,!1),0===a&&R.storeSizeTypeValue(r+4,0,!1),R.storeSizeTypeValue(n+4,0,!1);var o=R.loadSizeTypeValue(n,!1);return i(n),R.subQueueSize(e),o},push:function(e,r,t){var n=R.getMutex(e),a=R.getCond(e),o=function(){var r=R.getQueueSize(e),t=R.getMaxQueueSize(e);return r>=t&&t>0&&0===R.getState(e)},i=\"undefined\"!=typeof window&&\"undefined\"!=typeof document&&!s,u=!1,f=n.execute(function(){for(;o();){if(0===t)return 15;if(i)return 21;a.wait()}return 0===R.getState(e)?(R.pushQueue(e,r),R.send(e),0):0===R.getThreadCount(e)?1:(R.subThreadCount(e),2!==R.getState(e)||0!==R.getThreadCount(e)||(u=!0),16)});return u&&R.destroy(e),f},getMutex:function(e){var r=e+R.offset.mutex,t={lock:function(){var e=\"undefined\"!=typeof window&&\"undefined\"!=typeof document&&!s,t=new Int32Array(n.buffer,r,1);if(e)for(;;){if(0===Atomics.compareExchange(t,0,0,10))return}else for(;;){if(0===Atomics.compareExchange(t,0,0,10))return;Atomics.wait(t,0,10)}},unlock:function(){var e=new Int32Array(n.buffer,r,1);if(10!==Atomics.compareExchange(e,0,10,0))throw new Error(\"Tried to unlock while not holding the mutex\");Atomics.notify(e,0,1)},execute:function(e){t.lock();try{return e()}finally{t.unlock()}}};return t},getCond:function(e){var r=e+R.offset.cond,t=R.getMutex(e);return{wait:function(){var e=new Int32Array(n.buffer,r,1),a=Atomics.load(e,0);t.unlock(),Atomics.wait(e,0,a),t.lock()},signal:function(){var e=new Int32Array(n.buffer,r,1);Atomics.add(e,0,1),Atomics.notify(e,0,1)}}},getQueueSize:function(e){return R.loadSizeTypeValue(e+R.offset.queue_size,!0)},addQueueSize:function(e){var r,t,a=R.offset.queue_size;r=new Uint32Array(n.buffer),t=e+a>>2,Atomics.add(r,t,1)},subQueueSize:function(e){var r,t,a=R.offset.queue_size;r=new Uint32Array(n.buffer),t=e+a>>2,Atomics.sub(r,t,1)},getThreadCount:function(e){return R.loadSizeTypeValue(e+R.offset.thread_count,!0)},addThreadCount:function(e){var r,t,a=R.offset.thread_count;r=new Uint32Array(n.buffer),t=e+a>>2,Atomics.add(r,t,1)},subThreadCount:function(e){var r,t,a=R.offset.thread_count;r=new Uint32Array(n.buffer),t=e+a>>2,Atomics.sub(r,t,1)},getState:function(e){return Atomics.load(new Int32Array(n.buffer),e+R.offset.state>>2)},setState:function(e,r){Atomics.store(new Int32Array(n.buffer),e+R.offset.state>>2,r)},getHandlesClosing:function(e){return Atomics.load(new Int8Array(n.buffer),e+R.offset.handles_closing)},setHandlesClosing:function(e,r){Atomics.store(new Int8Array(n.buffer),e+R.offset.handles_closing,r)},getDispatchState:function(e){return Atomics.load(new Uint32Array(n.buffer),e+R.offset.dispatch_state>>2)},getContext:function(e){return R.loadSizeTypeValue(e+R.offset.context,!1)},getMaxQueueSize:function(e){return R.loadSizeTypeValue(e+R.offset.max_queue_size,!0)},getEnv:function(e){return R.loadSizeTypeValue(e+R.offset.env,!1)},getCallJSCb:function(e){return R.loadSizeTypeValue(e+R.offset.call_js_cb,!1)},getRef:function(e){return R.loadSizeTypeValue(e+R.offset.ref,!1)},getResource:function(e){return R.loadSizeTypeValue(e+R.offset.resource,!1)},getFinalizeCb:function(e){return R.loadSizeTypeValue(e+R.offset.finalize_cb,!1)},getFinalizeData:function(e){return R.loadSizeTypeValue(e+R.offset.finalize_data,!1)},loadSizeTypeValue:function(e,r){var t;return r?(t=new Uint32Array(n.buffer),Atomics.load(t,e>>2)):(t=new Int32Array(n.buffer),Atomics.load(t,e>>2))},storeSizeTypeValue:function(e,r,t){var a;return t?(a=new Uint32Array(n.buffer),void Atomics.store(a,e>>2,r)):(a=new Int32Array(n.buffer),void Atomics.store(a,e>>2,r>>>0))},releaseResources:function(e){if(2!==R.getState(e)){R.setState(e,2);var r=R.getEnv(e),t=l.envStore.get(r),a=R.getRef(e);a&&l.refStore.get(a).dispose();var o=R.getResource(e);l.refStore.get(o).dispose(),new DataView(n.buffer).setInt8(e+R.offset.is_some,0,!0),l.removeCleanupHook(t,R.cleanup,e),t.unref();var i=e+R.offset.async_ref>>2,s=new Uint32Array(n.buffer);if(Atomics.load(s,i)>0&&(Atomics.store(s,i,0),l.decreaseWaitingRequestCounter()),p){var u=new DataView(n.buffer);O(u.getFloat64(e+R.offset.async_id,!0),u.getFloat64(e+R.offset.trigger_async_id,!0))}}},destroy:function(e){R.destroyQueue(e),R.releaseResources(e),i(e)},emptyQueue:function(e){var r=[];R.getMutex(e).execute(function(){for(;R.getQueueSize(e)>0;)r.push(R.shiftQueue(e))});for(var t,n=R.getCallJSCb(e),o=R.getContext(e),i=0;i<r.length;i++)t=r[i],n&&a.get(n)(0,0,o,t)},maybeDelete:function(e){var r=!1;R.getMutex(e).execute(function(){R.getThreadCount(e)>0?R.releaseResources(e):r=!0}),r&&R.destroy(e)},finalize:function(e){var r=R.getEnv(e),t=l.envStore.get(r);l.openScope(t);var a=R.getFinalizeCb(e),o=R.getFinalizeData(e),i=R.getContext(e),s=function(){t.callFinalizerInternal(0,a,o,i)};try{if(R.emptyQueue(e),a)if(p){var u=R.getResource(e),f=l.refStore.get(u).get(),c=l.handleStore.get(f).value,d=new DataView(n.buffer),v=d.getFloat64(e+R.offset.async_id,!0),h=d.getFloat64(e+R.offset.trigger_async_id,!0);p.node.makeCallback(c,s,[],{asyncId:v,triggerAsyncId:h})}else s();R.maybeDelete(e)}finally{l.closeScope(t)}},cleanup:function(e){R.closeHandlesAndMaybeDelete(e,1)},closeHandlesAndMaybeDelete:function(e,r){var t=R.getEnv(e),n=l.envStore.get(t);l.openScope(n);try{if(r&&R.getMutex(e).execute(function(){R.setState(e,1),R.getMaxQueueSize(e)>0&&R.getCond(e).signal()}),R.getHandlesClosing(e))return;R.setHandlesClosing(e,1),l.feature.setImmediate(function(){R.finalize(e)})}finally{l.closeScope(n)}},dispatchOne:function(e){var r=0,t=!1,o=!1,i=R.getMutex(e),s=R.getCond(e);if(i.execute(function(){if(0===R.getState(e)){var n=R.getQueueSize(e);if(n>0){r=R.shiftQueue(e),t=!0;var a=R.getMaxQueueSize(e);n===a&&a>0&&s.signal(),n--}0===n?0===R.getThreadCount(e)&&(R.setState(e,1),R.getMaxQueueSize(e)>0&&s.signal(),R.closeHandlesAndMaybeDelete(e,0)):o=!0}else R.closeHandlesAndMaybeDelete(e,0)}),t){var u=R.getEnv(e),f=l.envStore.get(u);l.openScope(f);var c=function(){f.callbackIntoModule(!1,function(){var t=R.getCallJSCb(e),n=R.getRef(e),o=n?l.refStore.get(n).get():0;if(t){var i=R.getContext(e);a.get(t)(u,o,i,r)}else{var s=o?l.handleStore.get(o).value:null;\"function\"==typeof s&&s()}})};try{if(p){var d=R.getResource(e),v=l.refStore.get(d).get(),h=l.handleStore.get(v).value,y=new DataView(n.buffer);p.node.makeCallback(h,c,[],{asyncId:y.getFloat64(e+R.offset.async_id,!0),triggerAsyncId:y.getFloat64(e+R.offset.trigger_async_id,!0)})}else c()}finally{l.closeScope(f)}}return o},dispatch:function(e){for(var r=!0,t=1e3,a=new Uint32Array(n.buffer),o=e+R.offset.dispatch_state>>2;r&&0!==--t;)Atomics.store(a,o,1),r=R.dispatchOne(e),1!==Atomics.exchange(a,o,0)&&(r=!0);r&&R.send(e)},send:function(e){1&~Atomics.or(new Uint32Array(n.buffer),e+R.offset.dispatch_state>>2,2)&&(void 0!==u&&u?postMessage({__emnapi__:{type:\"tsfn-send\",payload:{tsfn:e}}}):l.feature.setImmediate(function(){R.dispatch(e)}))}};var W={pool:[],workerReady:null,globalAddress:0,globalOffset:{idle_threads:0,q:4,next:4,prev:8,mutex:12,cond:16,exit_message:20,end:28},offset:{resource:0,async_id:8,trigger_async_id:16,env:24,status:28,queue:32,queue_next:32,queue_prev:36,data:40,execute:44,complete:48,end:52},init:function(){if(W.pool=[],W.workerReady=null,void 0!==S){S.unusedWorkers.forEach(W.addListener),S.runningWorkers.forEach(W.addListener);var e=S.getNewWorker;S.getNewWorker=function(){var r=e.apply(this,arguments);return W.addListener(r),r}}},addListener:function(e){if(!e)return!1;if(e._emnapiAWMTListener)return!0;var r=function(e){var r=(s?e:e.data).__emnapi__;if(r){var t=r.type,n=r.payload;\"async-work-complete\"===t&&W.callComplete(n.work,0)}};return e._emnapiAWMTListener={handler:r,dispose:function(){s?e.off(\"message\",r):e.removeEventListener(\"message\",r,!1),delete e._emnapiAWMTListener}},s?e.on(\"message\",r):e.addEventListener(\"message\",r,!1),!0},initGlobal:function(){if(!W.globalAddress){W.globalAddress=o(W.globalOffset.end);var e=W.globalOffset.end,r=W.globalAddress;new Uint8Array(n.buffer,r,e).fill(0),W.queueInit(W.globalAddress+W.globalOffset.q),W.queueInit(W.globalAddress+W.globalOffset.exit_message)}},terminateWorkers:function(){W.pool.forEach(function(e){var r,t;null===(r=e._emnapiAWMTListener)||void 0===r||r.dispose(),null===(t=e._emnapiTSFNListener)||void 0===t||t.dispose(),e.terminate()}),W.pool.length=0},initWorkers:function(e){if(u)return W.workerReady||(W.workerReady=Promise.resolve());if(W.workerReady)return W.workerReady;if(!(\"emnapi_async_worker_create\"in t.exports))throw new TypeError(\"`emnapi_async_worker_create` is not exported, please try to add `--export=emnapi_async_worker_create` to linker flags\");var r=t.exports.emnapi_async_worker_create,a=[];W.initGlobal();for(var o=0;o<e;++o)a.push(r(1,W.globalAddress));var i=a.map(function(e){if(0===e)return Promise.reject(new Error(\"Failed to create async worker\"));if(e>0){var r=new DataView(n.buffer).getInt32(e+20,!0);return S.pthreads[r].whenLoaded}return W.pool[-e-1].whenLoaded});return W.workerReady=Promise.all(i),W.workerReady},getResource:function(e){return new DataView(n.buffer).getUint32(e+W.offset.resource,!0)},getExecute:function(e){return new DataView(n.buffer).getUint32(e+W.offset.execute,!0)},getComplete:function(e){return new DataView(n.buffer).getUint32(e+W.offset.complete,!0)},getEnv:function(e){return new DataView(n.buffer).getUint32(e+W.offset.env,!0)},getData:function(e){return new DataView(n.buffer).getUint32(e+W.offset.data,!0)},getMutex:function(){var e=W.globalAddress+W.globalOffset.mutex,r={lock:function(){var r=\"undefined\"!=typeof window&&\"undefined\"!=typeof document&&!s,t=new Int32Array(n.buffer,e,1);if(r)for(;;){if(0===Atomics.compareExchange(t,0,0,10))return}else for(;;){if(0===Atomics.compareExchange(t,0,0,10))return;Atomics.wait(t,0,10)}},unlock:function(){var r=new Int32Array(n.buffer,e,1);if(10!==Atomics.compareExchange(r,0,10,0))throw new Error(\"Tried to unlock while not holding the mutex\");Atomics.notify(r,0,1)},execute:function(e){r.lock();try{return e()}finally{r.unlock()}}};return r},getCond:function(){var e=W.globalAddress+W.globalOffset.cond,r=W.getMutex();return{wait:function(){var t=new Int32Array(n.buffer,e,1),a=Atomics.load(t,0);r.unlock(),Atomics.wait(t,0,a),r.lock()},signal:function(){var r=new Int32Array(n.buffer,e,1);Atomics.add(r,0,1),Atomics.notify(r,0,1)}}},queueInit:function(e){var r=new DataView(n.buffer);r.setUint32(e,e,!0),r.setUint32(e+4,e,!0)},queueInsertTail:function(e,r){var t=new DataView(n.buffer);t.setUint32(r,e,!0);var a=t.getUint32(e+4,!0);t.setUint32(r+4,a,!0);var o=t.getUint32(r+4,!0);t.setUint32(o,r,!0),t.setUint32(e+4,r,!0)},queueRemove:function(e){var r=new DataView(n.buffer),t=r.getUint32(e+4,!0),a=r.getUint32(e,!0);r.setUint32(t,a,!0),r.setUint32(a+4,t,!0)},queueEmpty:function(e){return e==new DataView(n.buffer).getUint32(e,!0)},scheduleWork:function(e){var r;(null===(r=W.workerReady)||void 0===r?void 0:r.ready)||W.initWorkers(L()).then(function(){W.workerReady.ready=!0}).catch(function(e){throw W.workerReady=null,e}),l.increaseWaitingRequestCounter();var t=new Int32Array(n.buffer,e+W.offset.status,1);Atomics.store(t,0,0);var a=W.getMutex(),o=W.getCond();a.lock();try{W.queueInsertTail(W.globalAddress+W.globalOffset.q,e+W.offset.queue)}catch(e){throw l.decreaseWaitingRequestCounter(),a.unlock(),e}new DataView(n.buffer).getUint32(W.globalAddress+W.globalOffset.idle_threads,!0)>0&&o.signal(),a.unlock()},cancelWork:function(e){var r=!1;return W.getMutex().execute(function(){var t=new DataView(n.buffer);(r=!W.queueEmpty(e+W.offset.queue)&&2!==t.getInt32(e+W.offset.status,!0))&&W.queueRemove(e+W.offset.queue)}),r?0!==Atomics.compareExchange(new Int32Array(n.buffer,e+W.offset.status,1),0,0,1)?9:(l.feature.setImmediate(function(){W.callComplete(e,11)}),0):9},callComplete:function(e,r){l.decreaseWaitingRequestCounter();var t=W.getComplete(e),o=W.getEnv(e),i=W.getData(e),s=l.envStore.get(o),u=l.openScope(s),f=function(){t&&s.callbackIntoModule(!0,function(){a.get(t)(o,r,i)})};try{if(p){var c=W.getResource(e),d=l.refStore.get(c).get(),v=l.handleStore.get(d).value,h=new DataView(n.buffer),y=h.getFloat64(e+W.offset.async_id,!0),g=h.getFloat64(e+W.offset.trigger_async_id,!0);p.node.makeCallback(v,f,[],{asyncId:y,triggerAsyncId:g})}else f()}finally{l.closeScope(s,u)}}};W.init();var z=m?function(e,r,t,a,o,i,s){if(!e)return 1;var u,f=l.envStore.get(e);if(f.checkGCAccess(),!a)return f.setLastError(1);if(!s)return f.setLastError(1);if(u=r?Object(l.handleStore.get(r).value):{},!t)return f.setLastError(1);var c=String(l.handleStore.get(t).value),d=D.create(e,u,c,a,o,i);return new DataView(n.buffer).setUint32(s,d,!0),f.clearLastError()}:function(e,r,t,a,i,s,u){if(!e)return 1;var f,c=l.envStore.get(e);if(c.checkGCAccess(),!a)return c.setLastError(1);if(!u)return c.setLastError(1);if(f=r?Object(l.handleStore.get(r).value):{},!t)return c.setLastError(1);var d=W.offset.end,p=o(d);if(!p)return c.setLastError(9);new Uint8Array(n.buffer).subarray(p,p+d).fill(0);var v=c.ensureHandleId(f),h=l.createReference(c,v,1,1).id,y=new DataView(n.buffer);return y.setUint32(p,h,!0),M(v,t,-1,p+W.offset.async_id),y.setUint32(p+W.offset.env,e,!0),y.setUint32(p+W.offset.execute,a,!0),y.setUint32(p+W.offset.complete,i,!0),y.setUint32(p+W.offset.data,s,!0),W.queueInit(p+W.offset.queue),y.setUint32(u,p,!0),c.clearLastError()},G=m?function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?(D.remove(r),t.clearLastError()):t.setLastError(1)}:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=W.getResource(r);if(l.refStore.get(a).dispose(),p){var o=new DataView(n.buffer);O(o.getFloat64(r+W.offset.async_id,!0),o.getFloat64(r+W.offset.trigger_async_id,!0))}return i(r),t.clearLastError()},F=m?function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(D.queue(r),t.clearLastError()):t.setLastError(1)}:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(W.scheduleWork(r),t.clearLastError()):t.setLastError(1)},P=m?function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(!r)return t.setLastError(1);var n=D.cancel(r);return 0===n?t.clearLastError():t.setLastError(n)}:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(!r)return t.setLastError(1);var n=W.cancelWork(r);return 0===n?t.clearLastError():t.setLastError(n)};h.initWorker=function(e,r){if(!h.childThread)throw new Error(\"startThread is only available in child threads\");if(\"function\"!=typeof t.exports.emnapi_async_worker_init)throw new TypeError(\"`emnapi_async_worker_init` is not exported, please try to add `--export=emnapi_async_worker_init` to linker flags\");t.exports.emnapi_async_worker_init(e),a.get(r[0])(r[1])};var N=Object.freeze({__proto__:null,_emnapi_async_worker:function(e){W.globalAddress=e;var r=W.getMutex(),t=W.getCond();r.lock();for(var o=e+W.globalOffset.exit_message,i=e+W.globalOffset.idle_threads,s=e+W.globalOffset.q,u=new DataView(n.buffer);;){for(;W.queueEmpty(s);)Atomics.add(new Int32Array(n.buffer,i,1),0,1),t.wait(),Atomics.sub(new Int32Array(n.buffer,i,1),0,1);var f=u.getUint32(s,!0);if(f===o){t.signal(),r.unlock();break}var l=f-W.offset.queue;W.queueRemove(f),W.queueInit(f),r.unlock();var d=new Int32Array(n.buffer,l+W.offset.status,1);1===Atomics.load(d,0)&&c(\"unreachable\");var p=W.getExecute(l),v=W.getEnv(l),y=W.getData(l);a.get(p)(v,y),Atomics.store(d,0,2),(0,h.postMessage)({__emnapi__:{type:\"async-work-complete\",payload:{work:l}}}),r.lock()}return 0},_emnapi_spawn_worker:function(e,r){if(\"function\"!=typeof y)throw new TypeError(\"`options.onCreateWorker` is not a function\");var n=[];if(!(\"emnapi_async_worker_create\"in t.exports))throw new TypeError(\"`emnapi_async_worker_create` is not exported, please try to add `--export=emnapi_async_worker_create` to linker flags\");n.push(t.exports.emnapi_async_worker_create(0,0));var a,o=function(e){!(\"message\"in e)||-1===e.message.indexOf(\"RuntimeError\")&&-1===e.message.indexOf(\"unreachable\")||W.terminateWorkers()};try{var u=y({type:\"async-work\",name:\"emnapi-async-worker\"}),f=S.loadWasmModuleToWorker(u);s?u.on(\"error\",o):u.addEventListener(\"error\",o,!1),W.addListener(u),R.addListener(u),[].push(f.then(function(){\"function\"==typeof u.unref&&u.unref()})),a=W.pool.push(u)-1;var c=n[0];u.threadBlockBase=c,u.postMessage({__emnapi__:{type:\"async-worker-init\",payload:{arg:c,func:[e,r]}}})}catch(e){c=n[0];throw i(c),e}return a},napi_cancel_async_work:P,napi_create_async_work:z,napi_delete_async_work:G,napi_queue_async_work:F}),q={registry:\"function\"==typeof FinalizationRegistry?new FinalizationRegistry(function(e){i(e)}):void 0,table:new WeakMap,wasmMemoryViewTable:new WeakMap,init:function(){q.registry=\"function\"==typeof FinalizationRegistry?new FinalizationRegistry(function(e){i(e)}):void 0,q.table=new WeakMap,q.wasmMemoryViewTable=new WeakMap},isSharedArrayBuffer:function(e){return\"function\"==typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(e)},isDetachedArrayBuffer:function(e){if(0===e.byteLength)try{new Uint8Array(e)}catch(e){return!0}return!1},getArrayBufferPointer:function(e,r){var t,a={address:0,ownership:0,runtimeAllocated:0};if(e===n.buffer)return a;var i=q.isDetachedArrayBuffer(e);if(q.table.has(e)){var s=q.table.get(e);return i?(s.address=0,s):(r&&0===s.ownership&&1===s.runtimeAllocated&&new Uint8Array(n.buffer).set(new Uint8Array(e),s.address),s)}if(i||0===e.byteLength)return a;if(!r)return a;var u=o(e.byteLength);if(!u)throw new Error(\"Out of memory\");return new Uint8Array(n.buffer).set(new Uint8Array(e),u),a.address=u,a.ownership=q.registry?0:1,a.runtimeAllocated=1,q.table.set(e,a),null===(t=q.registry)||void 0===t||t.register(e,u),a},getOrUpdateMemoryView:function(e){if(e.buffer===n.buffer)return q.wasmMemoryViewTable.has(e)||q.wasmMemoryViewTable.set(e,{Ctor:e.constructor,address:e.byteOffset,length:e instanceof DataView?e.byteLength:e.length,ownership:1,runtimeAllocated:0}),e;if((q.isDetachedArrayBuffer(e.buffer)||\"function\"==typeof SharedArrayBuffer&&e.buffer instanceof SharedArrayBuffer)&&q.wasmMemoryViewTable.has(e)){var r=q.wasmMemoryViewTable.get(e),t=r.Ctor,a=void 0,o=l.feature.Buffer;return a=\"function\"==typeof o&&t===o?o.from(n.buffer,r.address,r.length):new t(n.buffer,r.address,r.length),q.wasmMemoryViewTable.set(a,r),a}return e},getViewPointer:function(e,r){if((e=q.getOrUpdateMemoryView(e)).buffer===n.buffer){if(q.wasmMemoryViewTable.has(e)){var t=q.wasmMemoryViewTable.get(e);return{address:t.address,ownership:t.ownership,runtimeAllocated:t.runtimeAllocated,view:e}}return{address:e.byteOffset,ownership:1,runtimeAllocated:0,view:e}}var a=q.getArrayBufferPointer(e.buffer,r),o=a.address,i=a.ownership,s=a.runtimeAllocated;return{address:0===o?0:o+e.byteOffset,ownership:i,runtimeAllocated:s,view:e}}},J={utf8Decoder:void 0,utf16Decoder:void 0,init:function(){var e,r={decode:function(e){for(var r=0,t=Math.min(4096,e.length+1),n=new Uint16Array(t),a=[],o=0;;){var i=r<e.length;if(!i||o>=t-1){var s=n.subarray(0,o);if(a.push(String.fromCharCode.apply(null,s)),!i)return a.join(\"\");e=e.subarray(r),r=0,o=0}var u=e[r++];if(128&u){if(192==(224&u)){var f=63&e[r++];n[o++]=(31&u)<<6|f}else if(224==(240&u)){f=63&e[r++];var c=63&e[r++];n[o++]=(31&u)<<12|f<<6|c}else if(240==(248&u)){var l=(7&u)<<18|(f=63&e[r++])<<12|(c=63&e[r++])<<6|63&e[r++];l>65535&&(l-=65536,n[o++]=l>>>10&1023|55296,l=56320|1023&l),n[o++]=l}}else n[o++]=u}}};e=\"function\"==typeof TextDecoder?new TextDecoder:r,J.utf8Decoder=e;var t,n={decode:function(e){var r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(r.length<=4096)return String.fromCharCode.apply(null,r);for(var t=[],n=0,a=0;n<r.length;n+=a)a=Math.min(4096,r.length-n),t.push(String.fromCharCode.apply(null,r.subarray(n,n+a)));return t.join(\"\")}};t=\"function\"==typeof TextDecoder?new TextDecoder(\"utf-16le\"):n,J.utf16Decoder=t},lengthBytesUTF8:function(e){for(var r,t=0,n=0;n<e.length;++n)(r=e.charCodeAt(n))<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3;return t},UTF8ToString:function(e,r){if(!e||!r)return\"\";e>>>=0;var t=new Uint8Array(n.buffer),a=e;if(-1===r)for(;t[a];)++a;else a=e+(r>>>0);if((r=a-e)<=16){for(var o=e,i=\"\";o<a;){var s=t[o++];if(128&s){var u=63&t[o++];if(192!=(224&s)){var f=63&t[o++];if((s=224==(240&s)?(15&s)<<12|u<<6|f:(7&s)<<18|u<<12|f<<6|63&t[o++])<65536)i+=String.fromCharCode(s);else{var c=s-65536;i+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else i+=String.fromCharCode((31&s)<<6|u)}else i+=String.fromCharCode(s)}return i}return J.utf8Decoder.decode(\"function\"==typeof SharedArrayBuffer&&t.buffer instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(t.buffer)?t.slice(e,a):t.subarray(e,a))},stringToUTF8:function(e,r,t){var a=new Uint8Array(n.buffer),o=r;if(!(t>0))return 0;for(var i=o>>>=0,s=o+t-1,u=0;u<e.length;++u){var f=e.charCodeAt(u);if(f>=55296&&f<=57343)f=65536+((1023&f)<<10)|1023&e.charCodeAt(++u);if(f<=127){if(o>=s)break;a[o++]=f}else if(f<=2047){if(o+1>=s)break;a[o++]=192|f>>6,a[o++]=128|63&f}else if(f<=65535){if(o+2>=s)break;a[o++]=224|f>>12,a[o++]=128|f>>6&63,a[o++]=128|63&f}else{if(o+3>=s)break;a[o++]=240|f>>18,a[o++]=128|f>>12&63,a[o++]=128|f>>6&63,a[o++]=128|63&f}}return a[o]=0,o-i},UTF16ToString:function(e,r){if(!e||!r)return\"\";var t=e>>>=0;if(-1===r){for(var a=t>>1,o=new Uint16Array(n.buffer);o[a];)++a;t=a<<1}else t=e+2*(r>>>0);if((r=t-e)<=32)return String.fromCharCode.apply(null,new Uint16Array(n.buffer,e,r/2));var i=new Uint8Array(n.buffer);return J.utf16Decoder.decode(\"function\"==typeof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(i.buffer)?i.slice(e,t):i.subarray(e,t))},stringToUTF16:function(e,r,t){if(void 0===t&&(t=2147483647),t<2)return 0;for(var a=r,o=(t-=2)<2*e.length?t/2:e.length,i=new DataView(n.buffer),s=0;s<o;++s){var u=e.charCodeAt(s);i.setInt16(r,u,!0),r+=2}return i.setInt16(r,0,!0),r-a},newString:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);i.checkGCAccess();var s=-1===t,u=t>>>0;if(0!==t&&!r)return i.setLastError(1);if(!a)return i.setLastError(1);if(!(s||u<=2147483647))return i.setLastError(1);var f=o(r,s,u),c=l.addToCurrentScope(f).id;return new DataView(n.buffer).setUint32(a,c,!0),i.clearLastError()},newExternalString:function(e,r,t,a,o,i,s,u,f){if(!e)return 1;var c=l.envStore.get(e);c.checkGCAccess();var d=-1===t,p=t>>>0;if(0!==t&&!r)return c.setLastError(1);if(!i)return c.setLastError(1);if(!(d||p<=2147483647))return c.setLastError(1);var v=u(e,r,t,i);if(0===v){if(s)new DataView(n.buffer).setInt8(s,1,!0);a&&c.callFinalizer(a,r,o)}return v}};function H(e,r,t,a,o,i,s){if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!r)return u.setLastError(1);var f=l.handleStore.get(r);if(!f.isTypedArray())return u.setLastError(1);var c,d=f.value,p=new DataView(n.buffer);if(t){var v=void 0;if(d instanceof Int8Array)v=0;else if(d instanceof Uint8Array)v=1;else if(d instanceof Uint8ClampedArray)v=2;else if(d instanceof Int16Array)v=3;else if(d instanceof Uint16Array)v=4;else if(d instanceof Int32Array)v=5;else if(d instanceof Uint32Array)v=6;else if(\"function\"==typeof Float16Array&&d instanceof Float16Array)v=11;else if(d instanceof Float32Array)v=7;else if(d instanceof Float64Array)v=8;else if(d instanceof BigInt64Array)v=9;else{if(!(d instanceof BigUint64Array))return u.setLastError(9);v=10}p.setInt32(t,v,!0)}if(a&&p.setUint32(a,d.length,!0),o||i){if(c=d.buffer,o){var h=q.getViewPointer(d,!0).address;p.setUint32(o,h,!0)}if(i){var y=u.ensureHandleId(c);p.setUint32(i,y,!0)}}return s&&p.setUint32(s,d.byteOffset,!0),u.clearLastError()}function Q(e,r,t,a,o,i){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!r)return s.setLastError(1);var u=l.handleStore.get(r);if(!u.isDataView())return s.setLastError(1);var f,c=u.value,d=new DataView(n.buffer);if(t&&d.setUint32(t,c.byteLength,!0),a||o){if(f=c.buffer,a){var p=q.getViewPointer(c,!0).address;d.setUint32(a,p,!0)}if(o){var v=s.ensureHandleId(f);d.setUint32(o,v,!0)}}return i&&d.setUint32(i,c.byteOffset,!0),s.clearLastError()}var $=Object.freeze({__proto__:null,napi_get_array_length:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(!o.isArray())return a.setLastError(8);var i=o.value.length>>>0;return new DataView(n.buffer).setUint32(t,i,!0),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_get_arraybuffer_info:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!r)return o.setLastError(1);var i=l.handleStore.get(r);if(!i.isArrayBuffer()&&!q.isSharedArrayBuffer(i.value))return o.setLastError(1);var s=new DataView(n.buffer);if(t){var u=q.getArrayBufferPointer(i.value,!0).address;s.setUint32(t,u,!0)}return a&&s.setUint32(a,i.value.byteLength,!0),o.clearLastError()},napi_get_buffer_info:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);var o=l.handleStore.get(r);return o.isBuffer(l.feature.Buffer)?o.isDataView()?Q(e,r,n,t,0,0):H(e,r,0,n,t,0,0):a.setLastError(1)},napi_get_dataview_info:Q,napi_get_date_value:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var i=l.handleStore.get(r);return i.isDate()?(a=i.value.valueOf(),new DataView(n.buffer).setFloat64(t,a,!0),o.getReturnStatus()):o.setLastError(1)}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_get_prototype:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(null==o.value)throw new TypeError(\"Cannot convert undefined or null to object\");var i=void 0;try{i=o.isObject()||o.isFunction()?o.value:Object(o.value)}catch(e){return a.setLastError(2)}var s=a.ensureHandleId(Object.getPrototypeOf(i));return new DataView(n.buffer).setUint32(t,s,!0),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_get_typedarray_info:H,napi_get_value_bigint_int64:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!l.feature.supportBigInt)return o.setLastError(9);if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(r).value;if(\"bigint\"!=typeof i)return o.setLastError(6);var s=new DataView(n.buffer);i>=BigInt(-1)*(BigInt(1)<<BigInt(63))&&i<BigInt(1)<<BigInt(63)?s.setInt8(a,1,!0):(s.setInt8(a,0,!0),(i&=(BigInt(1)<<BigInt(64))-BigInt(1))>=BigInt(1)<<BigInt(63)&&(i-=BigInt(1)<<BigInt(64)));var u=Number(i&BigInt(4294967295)),f=Number(i>>BigInt(32));return s.setInt32(t,u,!0),s.setInt32(t+4,f,!0),o.clearLastError()},napi_get_value_bigint_uint64:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!l.feature.supportBigInt)return o.setLastError(9);if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(r).value;if(\"bigint\"!=typeof i)return o.setLastError(6);var s=new DataView(n.buffer);i>=BigInt(0)&&i<BigInt(1)<<BigInt(64)?s.setInt8(a,1,!0):(s.setInt8(a,0,!0),i&=(BigInt(1)<<BigInt(64))-BigInt(1));var u=Number(i&BigInt(4294967295)),f=Number(i>>BigInt(32));return s.setUint32(t,u,!0),s.setUint32(t+4,f,!0),o.clearLastError()},napi_get_value_bigint_words:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!l.feature.supportBigInt)return i.setLastError(9);if(!r)return i.setLastError(1);if(!a)return i.setLastError(1);var s=l.handleStore.get(r);if(!s.isBigInt())return i.setLastError(17);for(var u=s.value<BigInt(0),f=new DataView(n.buffer),c=f.getUint32(a,!0),d=0,p=u?s.value*BigInt(-1):s.value;p!==BigInt(0);)d++,p>>=BigInt(64);if(p=u?s.value*BigInt(-1):s.value,t||o){if(!t)return i.setLastError(1);if(!o)return i.setLastError(1);for(var v=[];p!==BigInt(0);){var h=p&(BigInt(1)<<BigInt(64))-BigInt(1);v.push(h),p>>=BigInt(64)}for(var y=Math.min(c,v.length),g=0;g<y;g++){var _=Number(v[g]&BigInt(4294967295)),E=Number(v[g]>>BigInt(32));f.setUint32(o+8*g,_,!0),f.setUint32(o+(8*g+4),E,!0)}f.setInt32(t,u?1:0,!0),f.setUint32(a,y,!0)}else c=d,f.setUint32(a,c,!0);return i.clearLastError()},napi_get_value_bool:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(\"boolean\"!=typeof o.value)return a.setLastError(7);var i=o.value?1:0;return new DataView(n.buffer).setInt8(t,i,!0),a.clearLastError()},napi_get_value_double:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(\"number\"!=typeof o.value)return a.setLastError(6);var i=o.value;return new DataView(n.buffer).setFloat64(t,i,!0),a.clearLastError()},napi_get_value_external:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(!o.isExternal())return a.setLastError(1);var i=o.data();return new DataView(n.buffer).setUint32(t,i,!0),a.clearLastError()},napi_get_value_int32:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(\"number\"!=typeof o.value)return a.setLastError(6);var i=new Int32Array([o.value])[0];return new DataView(n.buffer).setInt32(t,i,!0),a.clearLastError()},napi_get_value_int64:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(\"number\"!=typeof o.value)return a.setLastError(6);var i=o.value,s=new DataView(n.buffer);return i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY||isNaN(i)?(s.setInt32(t,0,!0),s.setInt32(t+4,0,!0)):i<-0x8000000000000000?(s.setInt32(t,0,!0),s.setInt32(t+4,2147483648,!0)):i>=0x8000000000000000?(s.setUint32(t,4294967295,!0),s.setUint32(t+4,2147483647,!0)):k(t,Math.trunc(i)),a.clearLastError()},napi_get_value_string_latin1:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!r)return i.setLastError(1);a>>>=0;var s=l.handleStore.get(r);if(\"string\"!=typeof s.value)return i.setLastError(3);var u=new DataView(n.buffer);if(t)if(0!==a){for(var f=0,c=void 0,d=0;d<a-1;++d)c=255&s.value.charCodeAt(d),u.setUint8(t+d,c,!0),f++;u.setUint8(t+f,0,!0),o&&u.setUint32(o,f,!0)}else o&&u.setUint32(o,0,!0);else{if(!o)return i.setLastError(1);u.setUint32(o,s.value.length,!0)}return i.clearLastError()},napi_get_value_string_utf16:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!r)return i.setLastError(1);a>>>=0;var s=l.handleStore.get(r);if(\"string\"!=typeof s.value)return i.setLastError(3);var u=new DataView(n.buffer);if(t)if(0!==a){var f=J.stringToUTF16(s.value,t,2*a);o&&u.setUint32(o,f/2,!0)}else o&&u.setUint32(o,0,!0);else{if(!o)return i.setLastError(1);u.setUint32(o,s.value.length,!0)}return i.clearLastError()},napi_get_value_string_utf8:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!r)return i.setLastError(1);a>>>=0;var s=l.handleStore.get(r);if(\"string\"!=typeof s.value)return i.setLastError(3);var u=new DataView(n.buffer);if(t)if(0!==a){var f=J.stringToUTF8(s.value,t,a);o&&u.setUint32(o,f,!0)}else o&&u.setUint32(o,0,!0);else{if(!o)return i.setLastError(1);var c=J.lengthBytesUTF8(s.value);u.setUint32(o,c,!0)}return i.clearLastError()},napi_get_value_uint32:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r);if(\"number\"!=typeof o.value)return a.setLastError(6);var i=new Uint32Array([o.value])[0];return new DataView(n.buffer).setUint32(t,i,!0),a.clearLastError()},node_api_set_prototype:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{if(!t)return n.setLastError(1);var a=l.handleStore.get(r).value;if(null==a)throw new TypeError(\"Cannot convert undefined or null to object\");var o=typeof a,i=void 0;try{i=\"object\"===o&&null!==a||\"function\"===o?a:Object(a)}catch(e){return n.setLastError(2)}var s=l.handleStore.get(t).value;return Object.setPrototypeOf(i,s),n.getReturnStatus()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}}});function Y(e,r,t,a){return J.newString(e,r,t,a,function(e,r,t){var a=\"\",o=0,i=new DataView(n.buffer);if(r)for(;;){if(!(s=i.getUint8(e,!0)))break;a+=String.fromCharCode(s),e++}else for(;o<t;){var s;if(!(s=i.getUint8(e,!0)))break;a+=String.fromCharCode(s),o++,e++}return a})}function X(e,r,t,n){return J.newString(e,r,t,n,function(e){return J.UTF16ToString(e,t)})}function Z(e,r,t,n){return J.newString(e,r,t,n,function(e){return J.UTF8ToString(e,t)})}var K=Object.freeze({__proto__:null,napi_create_bigint_int64:function(e,r,t,a){if(!e)return 1;var o,i=l.envStore.get(e);if(i.checkGCAccess(),!l.feature.supportBigInt)return i.setLastError(9);if(!t)return i.setLastError(1);o=r;var s=l.addToCurrentScope(o).id;return new DataView(n.buffer).setUint32(t,s,!0),i.clearLastError()},napi_create_bigint_uint64:function(e,r,t,a){if(!e)return 1;var o,i=l.envStore.get(e);if(i.checkGCAccess(),!l.feature.supportBigInt)return i.setLastError(9);if(!t)return i.setLastError(1);o=r&(BigInt(1)<<BigInt(64))-BigInt(1);var s=l.addToCurrentScope(o).id;return new DataView(n.buffer).setUint32(t,s,!0),i.clearLastError()},napi_create_bigint_words:function(e,r,t,a,o){var i,s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!l.feature.supportBigInt)return u.setLastError(9);if(!o)return u.setLastError(1);if((t>>>=0)>2147483647)return u.setLastError(1);if(t>16384)throw new RangeError(\"Maximum BigInt size exceeded\");var f=BigInt(0),c=new DataView(n.buffer);for(s=0;s<t;s++){var d=c.getUint32(a+8*s,!0),p=c.getUint32(a+(8*s+4),!0);f+=(BigInt(d)|BigInt(p)<<BigInt(32))<<BigInt(64*s)}return f*=BigInt(r)%BigInt(2)===BigInt(0)?BigInt(1):BigInt(-1),i=l.addToCurrentScope(f).id,c.setUint32(o,i,!0),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}},napi_create_double:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);var o=l.addToCurrentScope(r).id;return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_create_int32:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);var o=l.addToCurrentScope(r).id;return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_create_int64:function(e,r,t,a){if(!e)return 1;var o,i=l.envStore.get(e);if(i.checkGCAccess(),!t)return i.setLastError(1);o=Number(r);var s=l.addToCurrentScope(o).id;return new DataView(n.buffer).setUint32(t,s,!0),i.clearLastError()},napi_create_string_latin1:Y,napi_create_string_utf16:X,napi_create_string_utf8:Z,napi_create_uint32:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);var o=l.addToCurrentScope(r>>>0).id;return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},node_api_create_external_string_latin1:function(e,r,t,n,a,o,i){return J.newExternalString(e,r,t,n,a,o,i,Y,void 0)},node_api_create_external_string_utf16:function(e,r,t,n,a,o,i){return J.newExternalString(e,r,t,n,a,o,i,X,void 0)},node_api_create_property_key_latin1:function(e,r,t,n){return Y(e,r,t,n)},node_api_create_property_key_utf16:function(e,r,t,n){return X(e,r,t,n)},node_api_create_property_key_utf8:function(e,r,t,n){return Z(e,r,t,n)}});function ee(e,r,t,n,o){var i,s=r&&t?J.UTF8ToString(r,t):\"\",u=a.get(n),f=function(e){return u(e.id,e.ctx.scopeStore.currentScope.id)},c=function(e,r){return function(){var t=e.ctx.openScope(e),n=t.callbackInfo;n.data=o,n.args=arguments,n.thiz=this,n.fn=i;try{var a=e.callIntoModule(r);return a?e.ctx.handleStore.get(a).value:void 0}finally{n.data=0,n.args=void 0,n.thiz=void 0,n.fn=void 0,e.ctx.closeScope(e,t)}}};if(\"\"===s)return{status:0,f:i=c(e,f)};if(!/^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(s))return{status:1,f:void 0};if(l.feature.supportNewFunction){var d=c(e,f);try{i=new Function(\"_\",\"return function \"+s+'(){\"use strict\";return _.apply(this,arguments);};')(d)}catch(r){i=c(e,f),l.feature.canSetFunctionName&&Object.defineProperty(i,\"name\",{value:s})}}else i=c(e,f),l.feature.canSetFunctionName&&Object.defineProperty(i,\"name\",{value:s});return{status:0,f:i}}function re(e,r,t,n,a,o,i,s,u){if(a||o){var f=void 0,c=void 0;a&&(f=ee(e,0,0,a,u).f),o&&(c=ee(e,0,0,o,u).f);var d={configurable:!!(4&s),enumerable:!!(2&s),get:f,set:c};Object.defineProperty(r,t,d)}else if(n){d={configurable:!!(4&s),enumerable:!!(2&s),writable:!!(1&s),value:ee(e,0,0,n,u).f};Object.defineProperty(r,t,d)}else{d={configurable:!!(4&s),enumerable:!!(2&s),writable:!!(1&s),value:l.handleStore.get(i).value};Object.defineProperty(r,t,d)}}function te(e){var r=l.handleStore.get(e);return r.isObject()||r.isFunction()?(void 0!==q&&ArrayBuffer.isView(r.value)&&q.wasmMemoryViewTable.has(r.value)&&(r=l.addToCurrentScope(q.wasmMemoryViewTable.get(r.value))),{status:0,handle:r}):{status:1}}function ne(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(1);if(0===a&&!t)return i.setLastError(1);var s=l.handleStore.get(r);if(!s.isObject()&&!s.isFunction())return i.setLastError(1);var u=i.getObjectBinding(s.value),f=u.wrapped,c=l.refStore.get(f);if(!c)return i.setLastError(1);if(t)o=c.data(),new DataView(n.buffer).setUint32(t,o,!0);return 1===a&&(u.wrapped=0,1===c.ownership()?c.resetFinalizer():c.dispose()),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}}function ae(e,r,t,a,o,i){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!l.feature.supportFinalizer)return s.setLastError(9);if(!r)return s.setLastError(1);if(!a)return s.setLastError(1);var u=te(r);if(0!==u.status)return s.setLastError(u.status);var f=u.handle,c=i?1:0,d=l.createReferenceWithFinalizer(s,f.id,0,c,a,t,o);if(i){var p=d.id;new DataView(n.buffer).setUint32(i,p,!0)}return s.clearLastError()}var oe=Object.freeze({__proto__:null,napi_add_finalizer:ae,napi_check_object_type_tag:function(e,r,t,a){var o=!0;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(i.tryCatch.hasCaught()?10:1);var s=l.handleStore.get(r);if(!s.isObject()&&!s.isFunction())return i.setLastError(i.tryCatch.hasCaught()?10:2);if(!t)return i.setLastError(i.tryCatch.hasCaught()?10:1);if(!a)return i.setLastError(i.tryCatch.hasCaught()?10:1);var u=i.getObjectBinding(s.value);if(null!==u.tag){var f=u.tag,c=new Uint32Array(n.buffer,t,4);o=f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]}else o=!1;return new DataView(n.buffer).setInt8(a,o?1:0,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_define_class:function(e,r,t,a,o,i,s,u){var f,c,d;if(!e)return 1;var p=l.envStore.get(e);if(p.checkGCAccess(),!p.tryCatch.isEmpty())return p.setLastError(10);if(!p.canCallIntoJs())return p.setLastError(p.moduleApiVersion>=10?23:10);p.clearLastError();try{if(!u)return p.setLastError(1);if(!a)return p.setLastError(1);if((i>>>=0)>0&&!s)return p.setLastError(1);if(t<-1||t>2147483647||!r)return p.setLastError(1);var v=ee(p,r,t,a,o);if(0!==v.status)return p.setLastError(v.status);for(var h=v.f,y=void 0,g=new DataView(n.buffer),_=0;_<i;_++){f=s+32*_;var E=g.getUint32(f,!0),w=g.getUint32(f+4,!0),m=g.getUint32(f+8,!0),L=g.getUint32(f+12,!0),b=g.getUint32(f+16,!0),S=g.getUint32(f+20,!0);d=g.getInt32(f+24,!0);var A=g.getUint32(f+28,!0);if(E)y=J.UTF8ToString(E,-1);else{if(!w)return p.setLastError(4);if(\"string\"!=typeof(y=l.handleStore.get(w).value)&&\"symbol\"!=typeof y)return p.setLastError(4)}1024&d?re(p,h,y,m,L,b,S,d,A):re(p,h.prototype,y,m,L,b,S,d,A)}return c=l.addToCurrentScope(h).id,g.setUint32(u,c,!0),p.getReturnStatus()}catch(e){return p.tryCatch.setError(e),p.setLastError(10)}},napi_remove_wrap:function(e,r,t){return ne(e,r,t,1)},napi_type_tag_object:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!r)return a.setLastError(a.tryCatch.hasCaught()?10:1);var o=l.handleStore.get(r);if(!o.isObject()&&!o.isFunction())return a.setLastError(a.tryCatch.hasCaught()?10:2);if(!t)return a.setLastError(a.tryCatch.hasCaught()?10:1);var i=a.getObjectBinding(o.value);if(null!==i.tag)return a.setLastError(a.tryCatch.hasCaught()?10:1);var s=new Uint8Array(16);return s.set(new Uint8Array(n.buffer,t,16)),i.tag=new Uint32Array(s.buffer),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_unwrap:function(e,r,t){return ne(e,r,t,0)},napi_wrap:function(e,r,t,a,o,i){return function(e,r,t,a,o,i){var s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!l.feature.supportFinalizer){if(a)throw l.createNotSupportWeakRefError(\"napi_wrap\",'Parameter \"finalize_cb\" must be 0(NULL)');if(i)throw l.createNotSupportWeakRefError(\"napi_wrap\",'Parameter \"result\" must be 0(NULL)')}if(!r)return u.setLastError(1);var f=te(r);if(0!==f.status)return u.setLastError(f.status);var c=f.handle;if(0!==u.getObjectBinding(c.value).wrapped)return u.setLastError(1);var d=void 0;if(i){if(!a)return u.setLastError(1);s=(d=l.createReferenceWithFinalizer(u,c.id,0,1,a,t,o)).id,new DataView(n.buffer).setUint32(i,s,!0)}else d=a?l.createReferenceWithFinalizer(u,c.id,0,0,a,t,o):l.createReferenceWithData(u,c.id,0,0,t);return u.getObjectBinding(c.value).wrapped=d.id,u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}}(e,r,t,a,o,i)},node_api_post_finalizer:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);return a.enqueueFinalizer(l.createTrackedFinalizer(a,r,t,n)),a.clearLastError()}});function ie(e,r,t,a,o,i,s){var u;if(!e)return 1;var f=l.envStore.get(e);if(f.checkGCAccess(),!f.tryCatch.isEmpty())return f.setLastError(10);if(!f.canCallIntoJs())return f.setLastError(f.moduleApiVersion>=10?23:10);f.clearLastError();try{if(!s)return f.setLastError(1);if(a>>>=0,t||(a=0),a>2147483647)throw new RangeError(\"Cannot create a memory view larger than 2147483647 bytes\");if(t+a>n.buffer.byteLength)throw new RangeError(\"Memory out of range\");if(!l.feature.supportFinalizer&&o)throw l.createNotSupportWeakRefError(\"emnapi_create_memory_view\",'Parameter \"finalize_cb\" must be 0(NULL)');var c=void 0;switch(r){case 0:c={Ctor:Int8Array,address:t,length:a,ownership:1,runtimeAllocated:0};break;case 1:c={Ctor:Uint8Array,address:t,length:a,ownership:1,runtimeAllocated:0};break;case 2:c={Ctor:Uint8ClampedArray,address:t,length:a,ownership:1,runtimeAllocated:0};break;case 3:c={Ctor:Int16Array,address:t,length:a>>1,ownership:1,runtimeAllocated:0};break;case 4:c={Ctor:Uint16Array,address:t,length:a>>1,ownership:1,runtimeAllocated:0};break;case 5:c={Ctor:Int32Array,address:t,length:a>>2,ownership:1,runtimeAllocated:0};break;case 6:c={Ctor:Uint32Array,address:t,length:a>>2,ownership:1,runtimeAllocated:0};break;case 7:c={Ctor:Float32Array,address:t,length:a>>2,ownership:1,runtimeAllocated:0};break;case 8:c={Ctor:Float64Array,address:t,length:a>>3,ownership:1,runtimeAllocated:0};break;case 9:c={Ctor:BigInt64Array,address:t,length:a>>3,ownership:1,runtimeAllocated:0};break;case 10:c={Ctor:BigUint64Array,address:t,length:a>>3,ownership:1,runtimeAllocated:0};break;case-1:c={Ctor:DataView,address:t,length:a,ownership:1,runtimeAllocated:0};break;case 11:if(\"function\"!=typeof Float16Array)return f.setLastError(1);c={Ctor:Float16Array,address:t,length:a>>1,ownership:1,runtimeAllocated:0};break;case-2:if(!l.feature.Buffer)throw l.createNotSupportBufferError(\"emnapi_create_memory_view\",\"\");c={Ctor:l.feature.Buffer,address:t,length:a,ownership:1,runtimeAllocated:0};break;default:return f.setLastError(1)}var d=c.Ctor,p=-2===r?l.feature.Buffer.from(n.buffer,c.address,c.length):new d(n.buffer,c.address,c.length),v=l.addToCurrentScope(p);if(q.wasmMemoryViewTable.set(p,c),o){var h=ae(e,v.id,t,o,i,0);if(10===h){var y=f.tryCatch.extractException();throw f.clearLastError(),y}if(0!==h)return f.setLastError(h)}return u=v.id,new DataView(n.buffer).setUint32(s,u,!0),f.getReturnStatus()}catch(y){return f.tryCatch.setError(y),f.setLastError(10)}}function se(e,r,t,a){var o;if(t=null!=t?t:0,t>>>=0,r instanceof ArrayBuffer||q.isSharedArrayBuffer(r)){if(!(s=q.getArrayBufferPointer(r,!1).address))throw new Error(\"Unknown ArrayBuffer address\");if(\"number\"==typeof a&&-1!==a||(a=r.byteLength-t),0===(a>>>=0))return r;o=new Uint8Array(r,t,a);var i=new Uint8Array(n.buffer);return e?i.set(o,s):o.set(i.subarray(s,s+a)),r}if(ArrayBuffer.isView(r)){var s,u=q.getViewPointer(r,!1),f=u.view;if(!(s=u.address))throw new Error(\"Unknown ArrayBuffer address\");if(\"number\"==typeof a&&-1!==a||(a=f.byteLength-t),0===(a>>>=0))return f;o=new Uint8Array(f.buffer,f.byteOffset+t,a);i=new Uint8Array(n.buffer);return e?i.set(o,s):o.set(i.subarray(s,s+a)),f}throw new TypeError(\"emnapiSyncMemory expect ArrayBuffer or ArrayBufferView as first parameter\")}function ue(e){var r,t=e instanceof ArrayBuffer,n=e instanceof DataView,a=ArrayBuffer.isView(e)&&!n;if(!(t||a||n||q.isSharedArrayBuffer(e)))throw new TypeError(\"emnapiGetMemoryAddress expect ArrayBuffer or ArrayBufferView as first parameter\");return{address:(r=t?q.getArrayBufferPointer(e,!1):q.getViewPointer(e,!1)).address,ownership:r.ownership,runtimeAllocated:r.runtimeAllocated}}var fe=Object.freeze({__proto__:null,$emnapiGetMemoryAddress:ue,$emnapiSyncMemory:se,emnapi_create_memory_view:ie,emnapi_get_memory_address:function(e,r,t,a,o){var i,s,u,f;if(!e)return 1;var c=l.envStore.get(e);if(c.checkGCAccess(),!c.tryCatch.isEmpty())return c.setLastError(10);if(!c.canCallIntoJs())return c.setLastError(c.moduleApiVersion>=10?23:10);c.clearLastError();try{if(!r)return c.setLastError(1);if(!t&&!a&&!o)return c.setLastError(1);i=(f=ue(c.ctx.handleStore.get(r).value)).address;var d=new DataView(n.buffer);return t&&d.setUint32(t,i,!0),a&&(u=f.ownership,d.setInt32(a,u,!0)),o&&(s=f.runtimeAllocated,d.setInt8(o,s,!0)),c.getReturnStatus()}catch(e){return c.tryCatch.setError(e),c.setLastError(10)}},emnapi_get_runtime_version:function(e,r){if(!e)return 1;var t,a=l.envStore.get(e);if(!r)return a.setLastError(1);try{t=l.getRuntimeVersions().version}catch(e){return a.setLastError(9)}var o=t.split(\".\").map(function(e){return Number(e)}),i=new DataView(n.buffer);return i.setUint32(r,o[0],!0),i.setUint32(r+4,o[1],!0),i.setUint32(r+8,o[2],!0),a.clearLastError()},emnapi_is_node_binding_available:function(){return p?1:0},emnapi_is_support_bigint:function(){return l.feature.supportBigInt?1:0},emnapi_is_support_weakref:function(){return l.feature.supportFinalizer?1:0},emnapi_sync_memory:function(e,r,t,a,o){var i;if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!s.tryCatch.isEmpty())return s.setLastError(10);if(!s.canCallIntoJs())return s.setLastError(s.moduleApiVersion>=10?23:10);s.clearLastError();try{if(!t)return s.setLastError(1);var u=new DataView(n.buffer),f=u.getUint32(t,!0),c=s.ctx.handleStore.get(f);if(!(c.isArrayBuffer()||c.isTypedArray()||c.isDataView()||q.isSharedArrayBuffer(c.value)))return s.setLastError(1);var d=se(Boolean(r),c.value,a,o);return c.value!==d&&(i=s.ensureHandleId(d),u.setUint32(t,i,!0)),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}}});function ce(e,r,t){e>>>=0;var a=t?new SharedArrayBuffer(e):new ArrayBuffer(e);if(r){var o=q.getArrayBufferPointer(a,!0).address;new DataView(n.buffer).setUint32(r,o,!0)}return a}var le=Object.freeze({__proto__:null,napi_create_array:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=l.addToCurrentScope([]).id;return new DataView(n.buffer).setUint32(r,a,!0),t.clearLastError()},napi_create_array_with_length:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);r>>>=0;var o=l.addToCurrentScope(new Array(r)).id;return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_create_arraybuffer:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);var s=ce(r,t,!1);return o=l.addToCurrentScope(s).id,new DataView(n.buffer).setUint32(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_create_buffer:function(e,r,t,a){var i,s,u;if(!e)return 1;var f=l.envStore.get(e);if(f.checkGCAccess(),!f.tryCatch.isEmpty())return f.setLastError(10);if(!f.canCallIntoJs())return f.setLastError(f.moduleApiVersion>=10?23:10);f.clearLastError();try{if(!a)return f.setLastError(1);var c=l.feature.Buffer;if(!c)throw l.createNotSupportBufferError(\"napi_create_buffer\",\"\");var d=void 0;r>>>=0;var p=new DataView(n.buffer);if(t&&0!==r){if(!(u=o(r)))throw new Error(\"Out of memory\");new Uint8Array(n.buffer).subarray(u,u+r).fill(0);var v=c.from(n.buffer,u,r),h={Ctor:c,address:u,length:r,ownership:q.registry?0:1,runtimeAllocated:1};q.wasmMemoryViewTable.set(v,h),null===(i=q.registry)||void 0===i||i.register(h,u),s=l.addToCurrentScope(v).id,p.setUint32(a,s,!0),p.setUint32(t,u,!0)}else d=c.alloc(r),s=l.addToCurrentScope(d).id,p.setUint32(a,s,!0);return f.getReturnStatus()}catch(e){return f.tryCatch.setError(e),f.setLastError(10)}},napi_create_buffer_copy:function(e,r,t,a,o){var i;if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!s.tryCatch.isEmpty())return s.setLastError(10);if(!s.canCallIntoJs())return s.setLastError(s.moduleApiVersion>=10?23:10);s.clearLastError();try{if(!o)return s.setLastError(1);var u=l.feature.Buffer;if(!u)throw l.createNotSupportBufferError(\"napi_create_buffer_copy\",\"\");var f=ce(r,a,!1),c=u.from(f);return c.set(new Uint8Array(n.buffer).subarray(t,t+r)),i=l.addToCurrentScope(c).id,new DataView(n.buffer).setUint32(o,i,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_create_dataview:function(e,r,t,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!t)return i.setLastError(1);if(!o)return i.setLastError(1);r>>>=0,a>>>=0;var s=l.handleStore.get(t).value;return s instanceof ArrayBuffer||q.isSharedArrayBuffer(s)?function(e){if(r+a>e.byteLength){var t=new RangeError(\"byte_offset + byte_length should be less than or equal to the size in bytes of the array passed in\");throw t.code=\"ERR_NAPI_INVALID_DATAVIEW_ARGS\",t}var s=new DataView(e,a,r);e===n.buffer&&(q.wasmMemoryViewTable.has(s)||q.wasmMemoryViewTable.set(s,{Ctor:DataView,address:a,length:r,ownership:1,runtimeAllocated:0}));var u=l.addToCurrentScope(s).id;return new DataView(n.buffer).setUint32(o,u,!0),i.getReturnStatus()}(s):i.setLastError(1)}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_create_date:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{return t?(a=l.addToCurrentScope(new Date(r)).id,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()):o.setLastError(1)}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_create_external:function(e,r,t,a,o){var i;if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!s.tryCatch.isEmpty())return s.setLastError(10);if(!s.canCallIntoJs())return s.setLastError(s.moduleApiVersion>=10?23:10);s.clearLastError();try{if(!o)return s.setLastError(1);if(!l.feature.supportFinalizer&&t)throw l.createNotSupportWeakRefError(\"napi_create_external\",'Parameter \"finalize_cb\" must be 0(NULL)');var u=l.getCurrentScope().addExternal(r);return t&&l.createReferenceWithFinalizer(s,u.id,0,0,t,r,a),i=u.id,new DataView(n.buffer).setUint32(o,i,!0),s.clearLastError()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_create_external_arraybuffer:function(e,r,t,a,o,i){var s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!i)return u.setLastError(1);if(t>>>=0,r||(t=0),r+t>n.buffer.byteLength)throw new RangeError(\"Memory out of range\");if(!l.feature.supportFinalizer&&a)throw l.createNotSupportWeakRefError(\"napi_create_external_arraybuffer\",'Parameter \"finalize_cb\" must be 0(NULL)');var f=new ArrayBuffer(t);if(0===t)try{(new(0,l.feature.MessageChannel)).port1.postMessage(f,[f])}catch(e){}else new Uint8Array(f).set(new Uint8Array(n.buffer).subarray(r,r+t)),q.table.set(f,{address:r,ownership:1,runtimeAllocated:0});var c=l.addToCurrentScope(f);if(a){var d=ae(e,c.id,r,a,o,0);if(10===d){var p=u.tryCatch.extractException();throw u.clearLastError(),p}if(0!==d)return u.setLastError(d)}return s=c.id,new DataView(n.buffer).setUint32(i,s,!0),u.getReturnStatus()}catch(p){return u.tryCatch.setError(p),u.setLastError(10)}},napi_create_external_buffer:function(e,r,t,n,a,o){return ie(e,-2,t,r,n,a,o)},napi_create_object:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=l.addToCurrentScope({}).id;return new DataView(n.buffer).setUint32(r,a,!0),t.clearLastError()},napi_create_symbol:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);var o=new DataView(n.buffer);if(r){var i=l.handleStore.get(r).value;if(\"string\"!=typeof i)return a.setLastError(3);var s=l.addToCurrentScope(Symbol(i)).id;o.setUint32(t,s,!0)}else{var u=l.addToCurrentScope(Symbol()).id;o.setUint32(t,u,!0)}return a.clearLastError()},napi_create_typedarray:function(e,r,t,a,o,i){var s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!a)return u.setLastError(1);if(!i)return u.setLastError(1);var f=l.handleStore.get(a);if(!f.isArrayBuffer())return u.setLastError(1);var c=f.value,d=function(e,r,t,a,o,u){var f,c;if((o>>>=0,u>>>=0,t>1)&&o%t!==0)return(c=new RangeError(\"start offset of \".concat(null!==(f=r.name)&&void 0!==f?f:\"\",\" should be a multiple of \").concat(t))).code=\"ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT\",e.tryCatch.setError(c),e.setLastError(9);if(u*t+o>a.byteLength)return(c=new RangeError(\"Invalid typed array length\")).code=\"ERR_NAPI_INVALID_TYPEDARRAY_LENGTH\",e.tryCatch.setError(c),e.setLastError(9);var d=new r(a,o,u);return a===n.buffer&&(q.wasmMemoryViewTable.has(d)||q.wasmMemoryViewTable.set(d,{Ctor:r,address:o,length:u,ownership:1,runtimeAllocated:0})),s=l.addToCurrentScope(d).id,new DataView(n.buffer).setUint32(i,s,!0),e.getReturnStatus()};switch(r){case 0:return d(u,Int8Array,1,c,o,t);case 1:return d(u,Uint8Array,1,c,o,t);case 2:return d(u,Uint8ClampedArray,1,c,o,t);case 3:return d(u,Int16Array,2,c,o,t);case 4:return d(u,Uint16Array,2,c,o,t);case 5:return d(u,Int32Array,4,c,o,t);case 6:return d(u,Uint32Array,4,c,o,t);case 7:return d(u,Float32Array,4,c,o,t);case 8:return d(u,Float64Array,8,c,o,t);case 9:return d(u,BigInt64Array,8,c,o,t);case 10:return d(u,BigUint64Array,8,c,o,t);case 11:return\"function\"!=typeof Float16Array?u.setLastError(1):d(u,Float16Array,2,c,o,t);default:return u.setLastError(1)}}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}},node_api_create_buffer_from_arraybuffer:function(e,r,t,a,o){var i;if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!s.tryCatch.isEmpty())return s.setLastError(10);if(!s.canCallIntoJs())return s.setLastError(s.moduleApiVersion>=10?23:10);s.clearLastError();try{if(!r)return s.setLastError(1);if(!o)return s.setLastError(1);t>>>=0,a>>>=0;var u=l.handleStore.get(r);if(!u.isArrayBuffer())return s.setLastError(1);var f=u.value;if(a+t>f.byteLength){var c=new RangeError(\"The byte offset + length is out of range\");throw c.code=\"ERR_OUT_OF_RANGE\",c}var d=l.feature.Buffer;if(!d)throw l.createNotSupportBufferError(\"node_api_create_buffer_from_arraybuffer\",\"\");var p=d.from(f,t,a);return f===n.buffer&&(q.wasmMemoryViewTable.has(p)||q.wasmMemoryViewTable.set(p,{Ctor:d,address:t,length:a,ownership:1,runtimeAllocated:0})),i=l.addToCurrentScope(p).id,new DataView(n.buffer).setUint32(o,i,!0),s.getReturnStatus()}catch(c){return s.tryCatch.setError(c),s.setLastError(10)}},node_api_create_object_with_properties:function(e,r,t,a,o,i){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!i)return s.setLastError(1);if((o>>>=0)>0){if(!t)return s.setLastError(1);if(!a)return s.setLastError(1)}for(var u,f=r?l.handleStore.get(r).value:null,c={},d=new DataView(n.buffer),p=0;p<o;p++){var v=l.handleStore.get(d.getUint32(t+4*p,!0)).value;if(\"string\"!=typeof v&&\"symbol\"!=typeof v)return s.setLastError(4);c[v]={value:l.handleStore.get(d.getUint32(a+4*p,!0)).value,writable:!0,enumerable:!0,configurable:!0}}try{u=Object.defineProperties(Object.create(f),c)}catch(e){return s.setLastError(9)}var h=l.addToCurrentScope(u).id;return d.setUint32(i,h,!0),s.clearLastError()},node_api_create_sharedarraybuffer:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);var s=ce(r,t,!0);return o=l.addToCurrentScope(s).id,new DataView(n.buffer).setUint32(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},node_api_symbol_for:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!a)return o.setLastError(1);var i=-1===t,s=t>>>0;if(0!==t&&!r)return o.setLastError(1);if(!(i||s<=2147483647))return o.setLastError(1);var u=J.UTF8ToString(r,t),f=l.addToCurrentScope(Symbol.for(u)).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()}});var de=Object.freeze({__proto__:null,napi_get_boolean:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!t)return a.setLastError(1);var o=0===r?3:4;return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_get_global:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?(new DataView(n.buffer).setUint32(r,5,!0),t.clearLastError()):t.setLastError(1)},napi_get_null:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?(new DataView(n.buffer).setUint32(r,2,!0),t.clearLastError()):t.setLastError(1)},napi_get_undefined:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?(new DataView(n.buffer).setUint32(r,1,!0),t.clearLastError()):t.setLastError(1)}});var pe=Object.freeze({__proto__:null,napi_get_instance_data:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(!r)return t.setLastError(1);var a=t.getInstanceData();return new DataView(n.buffer).setUint32(r,a,!0),t.clearLastError()},napi_set_instance_data:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);return a.setInstanceData(r,t,n),a.clearLastError()}});var ve=Object.freeze({__proto__:null,_emnapi_get_last_error_info:function(e,r,t,a){var o=l.envStore.get(e).lastError,i=o.errorCode,s=o.engineErrorCode>>>0,u=o.engineReserved,f=new DataView(n.buffer);f.setInt32(r,i,!0),f.setUint32(t,s,!0),f.setUint32(a,u,!0)},napi_create_error:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(t).value;if(\"string\"!=typeof i)return o.setLastError(3);var s=new Error(i);if(r){var u=l.handleStore.get(r).value;if(\"string\"!=typeof u)return o.setLastError(3);s.code=u}var f=l.addToCurrentScope(s).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()},napi_create_range_error:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(t).value;if(\"string\"!=typeof i)return o.setLastError(3);var s=new RangeError(i);if(r){var u=l.handleStore.get(r).value;if(\"string\"!=typeof u)return o.setLastError(3);s.code=u}var f=l.addToCurrentScope(s).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()},napi_create_type_error:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(t).value;if(\"string\"!=typeof i)return o.setLastError(3);var s=new TypeError(i);if(r){var u=l.handleStore.get(r).value;if(\"string\"!=typeof u)return o.setLastError(3);s.code=u}var f=l.addToCurrentScope(s).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()},napi_fatal_error:function(e,r,t,n){var a=J.UTF8ToString(e,r),o=J.UTF8ToString(t,n);p?p.napi.fatalError(a,o):c(\"FATAL ERROR: \"+a+\" \"+o)},napi_fatal_exception:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!t.tryCatch.isEmpty())return t.setLastError(10);if(!t.canCallIntoJs())return t.setLastError(t.moduleApiVersion>=10?23:10);t.clearLastError();try{if(!r)return t.setLastError(1);var n=t.ctx.handleStore.get(r);try{t.triggerFatalException(n.value)}catch(e){return t.setLastError(9)}return t.clearLastError()}catch(r){return t.tryCatch.setError(r),t.setLastError(10)}},napi_get_and_clear_last_exception:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=new DataView(n.buffer);if(!t.tryCatch.hasCaught())return a.setUint32(r,1,!0),t.clearLastError();var o=t.tryCatch.exception(),i=t.ensureHandleId(o);return a.setUint32(r,i,!0),t.tryCatch.reset(),t.clearLastError()},napi_is_exception_pending:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=t.tryCatch.hasCaught();return new DataView(n.buffer).setInt8(r,a?1:0,!0),t.clearLastError()},napi_throw:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!t.tryCatch.isEmpty())return t.setLastError(10);if(!t.canCallIntoJs())return t.setLastError(t.moduleApiVersion>=10?23:10);t.clearLastError();try{return r?(t.tryCatch.setError(l.handleStore.get(r).value),t.clearLastError()):t.setLastError(1)}catch(e){return t.tryCatch.setError(e),t.setLastError(10)}},napi_throw_error:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{if(!t)return n.setLastError(1);var a=new Error(J.UTF8ToString(t,-1));return r&&(a.code=J.UTF8ToString(r,-1)),n.tryCatch.setError(a),n.clearLastError()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}},napi_throw_range_error:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{if(!t)return n.setLastError(1);var a=new RangeError(J.UTF8ToString(t,-1));return r&&(a.code=J.UTF8ToString(r,-1)),n.tryCatch.setError(a),n.clearLastError()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}},napi_throw_type_error:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{if(!t)return n.setLastError(1);var a=new TypeError(J.UTF8ToString(t,-1));return r&&(a.code=J.UTF8ToString(r,-1)),n.tryCatch.setError(a),n.clearLastError()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}},node_api_create_syntax_error:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(t).value;if(\"string\"!=typeof i)return o.setLastError(3);var s=new SyntaxError(i);if(r){var u=l.handleStore.get(r).value;if(\"string\"!=typeof u)return o.setLastError(3);s.code=u}var f=l.addToCurrentScope(s).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()},node_api_throw_syntax_error:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{if(!t)return n.setLastError(1);var a=new SyntaxError(J.UTF8ToString(t,-1));return r&&(a.code=J.UTF8ToString(r,-1)),n.tryCatch.setError(a),n.clearLastError()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}}});function he(e,r,t,a,o,i){var s=l.envStore.get(e),u=ee(s,r,t,a,o);if(0!==u.status)return s.setLastError(u.status);var f=u.f,c=l.addToCurrentScope(f).id;return new DataView(n.buffer).setUint32(i,c,!0),s.getReturnStatus()}var ye=Object.freeze({__proto__:null,_emnapi_create_function:he,napi_call_function:function(e,r,t,a,o,i){var s,u=0;if(!e)return 1;var f=l.envStore.get(e);if(f.checkGCAccess(),!f.tryCatch.isEmpty())return f.setLastError(10);if(!f.canCallIntoJs())return f.setLastError(f.moduleApiVersion>=10?23:10);f.clearLastError();try{if(!r)return f.setLastError(1);if((a>>>=0)>0&&!o)return f.setLastError(1);var c=l.handleStore.get(r).value;if(!t)return f.setLastError(1);var d=l.handleStore.get(t).value;if(\"function\"!=typeof d)return f.setLastError(1);for(var p=[],v=new DataView(n.buffer);u<a;u++){var h=v.getUint32(o+4*u,!0);p.push(l.handleStore.get(h).value)}var y=d.apply(c,p);return i&&(s=f.ensureHandleId(y),v.setUint32(i,s,!0)),f.clearLastError()}catch(e){return f.tryCatch.setError(e),f.setLastError(10)}},napi_create_function:function(e,r,t,n,a,o){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{return o&&n?he(e,r,t,n,a,o):i.setLastError(1)}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_get_cb_info:function(e,r,t,a,o,i){if(!e)return 1;var s=l.envStore.get(e);if(!r)return s.setLastError(1);var u=l.scopeStore.get(r).callbackInfo,f=new DataView(n.buffer);if(a){if(!t)return s.setLastError(1);for(var c=f.getUint32(t,!0),d=u.args.length,p=c<d?c:d,v=0;v<p;v++){var h=s.ensureHandleId(u.args[v]);f.setUint32(a+4*v,h,!0)}if(v<c)for(;v<c;v++)f.setUint32(a+4*v,1,!0)}if(t&&f.setUint32(t,u.args.length,!0),o){var y=s.ensureHandleId(u.thiz);f.setUint32(o,y,!0)}return i&&f.setUint32(i,u.data,!0),s.clearLastError()},napi_get_new_target:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.scopeStore.get(r).callbackInfo,i=o.thiz,s=o.fn,u=null==i||null==i.constructor?0:i instanceof s?a.ensureHandleId(i.constructor):0;return new DataView(n.buffer).setUint32(t,u,!0),a.clearLastError()},napi_new_instance:function(e,r,t,a,o){var i,s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!r)return u.setLastError(1);if((t>>>=0)>0&&!a)return u.setLastError(1);if(!o)return u.setLastError(1);var f=l.handleStore.get(r).value;if(\"function\"!=typeof f)return u.setLastError(1);var c=void 0,d=new DataView(n.buffer);if(l.feature.supportReflect){var p=Array(t);for(i=0;i<t;i++){var v=d.getUint32(a+4*i,!0);p[i]=l.handleStore.get(v).value}c=Reflect.construct(f,p,f)}else{var h=Array(t+1);for(h[0]=void 0,i=0;i<t;i++){v=d.getUint32(a+4*i,!0);h[i+1]=l.handleStore.get(v).value}c=new(f.bind.apply(f,h))}return o&&(s=u.ensureHandleId(c),d.setUint32(o,s,!0)),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}}});var ge=Object.freeze({__proto__:null,_emnapi_env_ref:function(e){l.envStore.get(e).ref()},_emnapi_env_unref:function(e){l.envStore.get(e).unref()},napi_add_env_cleanup_hook:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);return r?(l.addCleanupHook(n,r,t),0):n.setLastError(1)},napi_close_escapable_handle_scope:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?0===t.openHandleScopes?13:(l.closeScope(t),t.clearLastError()):t.setLastError(1)},napi_close_handle_scope:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?0===t.openHandleScopes?13:(l.closeScope(t),t.clearLastError()):t.setLastError(1)},napi_create_reference:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!r)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.handleStore.get(r);if(o.moduleApiVersion<10&&!(i.isObject()||i.isFunction()||i.isSymbol()))return o.setLastError(1);var s=l.createReference(o,i.id,t>>>0,1);return new DataView(n.buffer).setUint32(a,s.id,!0),o.clearLastError()},napi_delete_reference:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(l.refStore.get(r).dispose(),t.clearLastError()):t.setLastError(1)},napi_escape_handle:function(e,r,t,a){if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!r)return o.setLastError(1);if(!t)return o.setLastError(1);if(!a)return o.setLastError(1);var i=l.scopeStore.get(r);if(!i.escapeCalled()){var s=i.escape(t),u=s?s.id:0;return new DataView(n.buffer).setUint32(a,u,!0),o.clearLastError()}return o.setLastError(12)},napi_get_reference_value:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.refStore.get(r).get(a);return new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_open_escapable_handle_scope:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=l.openScope(t);return new DataView(n.buffer).setUint32(r,a.id,!0),t.clearLastError()},napi_open_handle_scope:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var a=l.openScope(t);return new DataView(n.buffer).setUint32(r,a.id,!0),t.clearLastError()},napi_reference_ref:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);var o=l.refStore.get(r).ref();return t&&new DataView(n.buffer).setUint32(t,o,!0),a.clearLastError()},napi_reference_unref:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);var o=l.refStore.get(r);if(0===o.refcount())return a.setLastError(9);var i=o.unref();return t&&new DataView(n.buffer).setUint32(t,i,!0),a.clearLastError()},napi_remove_env_cleanup_hook:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);return r?(l.removeCleanupHook(n,r,t),0):n.setLastError(1)}});var _e=Object.freeze({__proto__:null,_emnapi_get_filename:function(e,r,t){var n=l.envStore.get(e).filename;return r?J.stringToUTF8(n,r,t):J.lengthBytesUTF8(n)}});var Ee=Object.freeze({__proto__:null,napi_create_promise:function(e,r,t){var a,o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(1);if(!t)return i.setLastError(1);var s=new DataView(n.buffer),u=new Promise(function(e,t){var n=l.createDeferred({resolve:e,reject:t});a=n.id,s.setUint32(r,a,!0)});return o=l.addToCurrentScope(u).id,s.setUint32(t,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_is_promise:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isPromise()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_reject_deferred:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{return r&&t?(l.deferredStore.get(r).reject(l.handleStore.get(t).value),n.getReturnStatus()):n.setLastError(1)}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}},napi_resolve_deferred:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);if(n.checkGCAccess(),!n.tryCatch.isEmpty())return n.setLastError(10);if(!n.canCallIntoJs())return n.setLastError(n.moduleApiVersion>=10?23:10);n.clearLastError();try{return r&&t?(l.deferredStore.get(r).resolve(l.handleStore.get(t).value),n.getReturnStatus()):n.setLastError(1)}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}}});function we(e,r,t,a,o,i){var s;if(!e)return 1;var u=l.envStore.get(e);if(u.checkGCAccess(),!u.tryCatch.isEmpty())return u.setLastError(10);if(!u.canCallIntoJs())return u.setLastError(u.moduleApiVersion>=10?23:10);u.clearLastError();try{if(!i)return u.setLastError(1);if(!r)return u.setLastError(1);var f=l.handleStore.get(r);if(null==f.value)throw new TypeError(\"Cannot convert undefined or null to object\");var c=void 0;try{c=f.isObject()||f.isFunction()?f.value:Object(f.value)}catch(e){return u.setLastError(2)}if(0!==t&&1!==t)return u.setLastError(1);if(0!==o&&1!==o)return u.setLastError(1);var d=[],p=void 0,v=void 0,h=void 0,y=!0,g=/^(0|[1-9][0-9]*)$/;do{for(p=Object.getOwnPropertyNames(c),v=Object.getOwnPropertySymbols(c),h=0;h<p.length;h++)d.push({name:g.test(p[h])?Number(p[h]):p[h],desc:Object.getOwnPropertyDescriptor(c,p[h]),own:y});for(h=0;h<v.length;h++)d.push({name:v[h],desc:Object.getOwnPropertyDescriptor(c,v[h]),own:y});if(1===t)break;c=Object.getPrototypeOf(c),y=!1}while(c);var _=[],E=function(e,r,t,n){if(-1===e.indexOf(r))if(0===n)e.push(r);else if(1===n){var a=\"number\"==typeof r?String(r):r;\"string\"==typeof a&&8&t||e.push(a)}};for(h=0;h<d.length;h++){var w=d[h],m=w.name,L=w.desc;if(0===a)E(_,m,a,o);else{if(8&a&&\"string\"==typeof m)continue;if(16&a&&\"symbol\"==typeof m)continue;var b=!0;switch(7&a){case 1:b=Boolean(L.writable);break;case 2:b=Boolean(L.enumerable);break;case 3:b=Boolean(L.writable&&L.enumerable);break;case 4:b=Boolean(L.configurable);break;case 5:b=Boolean(L.configurable&&L.writable);break;case 6:b=Boolean(L.configurable&&L.enumerable);break;case 7:b=Boolean(L.configurable&&L.enumerable&&L.writable)}b&&E(_,m,a,o)}}return s=l.addToCurrentScope(_).id,new DataView(n.buffer).setUint32(i,s,!0),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}}var me=Object.freeze({__proto__:null,napi_define_properties:function(e,r,t,a){var o,i;if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!s.tryCatch.isEmpty())return s.setLastError(10);if(!s.canCallIntoJs())return s.setLastError(s.moduleApiVersion>=10?23:10);s.clearLastError();try{if((t>>>=0)>0&&!a)return s.setLastError(1);if(!r)return s.setLastError(1);var u=l.handleStore.get(r),f=u.value;if(!u.isObject()&&!u.isFunction())return s.setLastError(2);for(var c=void 0,d=new DataView(n.buffer),p=0;p<t;p++){o=a+32*p;var v=d.getUint32(o,!0),h=d.getUint32(o+4,!0),y=d.getUint32(o+8,!0),g=d.getUint32(o+12,!0),_=d.getUint32(o+16,!0),E=d.getUint32(o+20,!0);i=d.getInt32(o+24,!0);var w=d.getUint32(o+28,!0);if(v)c=J.UTF8ToString(v,-1);else{if(!h)return s.setLastError(4);if(\"string\"!=typeof(c=l.handleStore.get(h).value)&&\"symbol\"!=typeof c)return s.setLastError(4)}re(s,f,c,y,g,_,E,i,w)}return s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_delete_element:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(!s.isObject()&&!s.isFunction())return i.setLastError(2);if(l.feature.supportReflect)o=Reflect.deleteProperty(s.value,t>>>0);else try{o=delete s.value[t>>>0]}catch(e){o=!1}if(a)new DataView(n.buffer).setInt8(a,o?1:0,!0);return i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_delete_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!t)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(!s.isObject()&&!s.isFunction())return i.setLastError(2);var u=l.handleStore.get(t).value;if(l.feature.supportReflect)o=Reflect.deleteProperty(s.value,u);else try{o=delete s.value[u]}catch(e){o=!1}if(a)new DataView(n.buffer).setInt8(a,o?1:0,!0);return i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_get_all_property_names:we,napi_get_element:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=i.ensureHandleId(u[t>>>0]),new DataView(n.buffer).setUint32(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_get_named_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);if(!t)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=i.ensureHandleId(u[J.UTF8ToString(t,-1)]),new DataView(n.buffer).setUint32(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_get_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!t)return i.setLastError(1);if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=i.ensureHandleId(u[l.handleStore.get(t).value]),new DataView(n.buffer).setUint32(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_get_property_names:function(e,r,t){return we(e,r,0,18,1,t)},napi_has_element:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=t>>>0 in u?1:0,new DataView(n.buffer).setInt8(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_has_named_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);if(!t)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=J.UTF8ToString(t,-1)in u,new DataView(n.buffer).setInt8(a,o?1:0,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_has_own_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!t)return i.setLastError(1);if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}var f=l.handleStore.get(t).value;return\"string\"!=typeof f&&\"symbol\"!=typeof f?i.setLastError(4):(o=Object.prototype.hasOwnProperty.call(u,l.handleStore.get(t).value),new DataView(n.buffer).setInt8(a,o?1:0,!0),i.getReturnStatus())}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_has_property:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!t)return i.setLastError(1);if(!a)return i.setLastError(1);if(!r)return i.setLastError(1);var s=l.handleStore.get(r);if(null==s.value)throw new TypeError(\"Cannot convert undefined or null to object\");var u=void 0;try{u=s.isObject()||s.isFunction()?s.value:Object(s.value)}catch(e){return i.setLastError(2)}return o=l.handleStore.get(t).value in u?1:0,new DataView(n.buffer).setInt8(a,o,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_object_freeze:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!t.tryCatch.isEmpty())return t.setLastError(10);if(!t.canCallIntoJs())return t.setLastError(t.moduleApiVersion>=10?23:10);t.clearLastError();try{if(!r)return t.setLastError(1);var n=l.handleStore.get(r),a=n.value;return n.isObject()||n.isFunction()?(Object.freeze(a),t.getReturnStatus()):t.setLastError(2)}catch(e){return t.tryCatch.setError(e),t.setLastError(10)}},napi_object_seal:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!t.tryCatch.isEmpty())return t.setLastError(10);if(!t.canCallIntoJs())return t.setLastError(t.moduleApiVersion>=10?23:10);t.clearLastError();try{if(!r)return t.setLastError(1);var n=l.handleStore.get(r),a=n.value;return n.isObject()||n.isFunction()?(Object.seal(a),t.getReturnStatus()):t.setLastError(2)}catch(e){return t.tryCatch.setError(e),t.setLastError(10)}},napi_set_element:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!n)return a.setLastError(1);if(!r)return a.setLastError(1);var o=l.handleStore.get(r);return o.isObject()||o.isFunction()?(o.value[t>>>0]=l.handleStore.get(n).value,a.getReturnStatus()):a.setLastError(2)}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_set_named_property:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!n)return a.setLastError(1);if(!r)return a.setLastError(1);var o=l.handleStore.get(r);return o.isObject()||o.isFunction()?t?(l.handleStore.get(r).value[J.UTF8ToString(t,-1)]=l.handleStore.get(n).value,a.getReturnStatus()):a.setLastError(1):a.setLastError(2)}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_set_property:function(e,r,t,n){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!t)return a.setLastError(1);if(!n)return a.setLastError(1);if(!r)return a.setLastError(1);var o=l.handleStore.get(r);return o.isObject()||o.isFunction()?(o.value[l.handleStore.get(t).value]=l.handleStore.get(n).value,a.getReturnStatus()):a.setLastError(2)}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}}});var Le=Object.freeze({__proto__:null,napi_run_script:function(e,r,t){var a,o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(1);if(!t)return i.setLastError(1);var s=l.handleStore.get(r);if(!s.isString())return i.setLastError(3);var u=l.handleStore.get(5).value.eval(s.value);o=i.ensureHandleId(u),new DataView(n.buffer).setUint32(t,o,!0),a=i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}return a}});var be=Object.freeze({__proto__:null,napi_coerce_to_bool:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{return r&&t?(a=l.handleStore.get(r).value?4:3,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()):o.setLastError(1)}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_coerce_to_number:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var i=l.handleStore.get(r);if(i.isBigInt())throw new TypeError(\"Cannot convert a BigInt value to a number\");return a=l.addToCurrentScope(Number(i.value)).id,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_coerce_to_object:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError(\"Cannot convert undefined or null to object\");return a=o.ensureHandleId(Object(i.value)),new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_coerce_to_string:function(e,r,t){var a;if(!e)return 1;var o=l.envStore.get(e);if(o.checkGCAccess(),!o.tryCatch.isEmpty())return o.setLastError(10);if(!o.canCallIntoJs())return o.setLastError(o.moduleApiVersion>=10?23:10);o.clearLastError();try{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var i=l.handleStore.get(r);if(i.isSymbol())throw new TypeError(\"Cannot convert a Symbol value to a string\");return a=l.addToCurrentScope(String(i.value)).id,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()}catch(e){return o.tryCatch.setError(e),o.setLastError(10)}},napi_detach_arraybuffer:function(e,r){if(!e)return 1;var t=l.envStore.get(e);if(t.checkGCAccess(),!r)return t.setLastError(1);var n=l.handleStore.get(r).value;if(!(n instanceof ArrayBuffer))return\"function\"==typeof SharedArrayBuffer&&n instanceof SharedArrayBuffer?t.setLastError(20):t.setLastError(19);try{(new(0,l.feature.MessageChannel)).port1.postMessage(n,[n])}catch(e){return t.setLastError(9)}return t.clearLastError()},napi_instanceof:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{if(!r)return i.setLastError(1);if(!a)return i.setLastError(1);if(!t)return i.setLastError(1);var s=new DataView(n.buffer);s.setInt8(a,0,!0);var u=l.handleStore.get(t);return u.isFunction()?(o=l.handleStore.get(r).value instanceof u.value?1:0,s.setInt8(a,o,!0),i.getReturnStatus()):i.setLastError(5)}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_is_array:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isArray()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_arraybuffer:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isArrayBuffer()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_buffer:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isBuffer(l.feature.Buffer)?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_dataview:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isDataView()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_date:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isDate()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_detached_arraybuffer:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!a.tryCatch.isEmpty())return a.setLastError(10);if(!a.canCallIntoJs())return a.setLastError(a.moduleApiVersion>=10?23:10);a.clearLastError();try{if(!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r),i=new DataView(n.buffer);if(o.isArrayBuffer()&&0===o.value.byteLength)try{new Uint8Array(o.value)}catch(e){return i.setInt8(t,1,!0),a.getReturnStatus()}return i.setInt8(t,0,!0),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_is_error:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).value instanceof Error?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_is_typedarray:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r).isTypedArray()?1:0;return new DataView(n.buffer).setInt8(t,o,!0),a.clearLastError()},napi_strict_equals:function(e,r,t,a){var o;if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!i.tryCatch.isEmpty())return i.setLastError(10);if(!i.canCallIntoJs())return i.setLastError(i.moduleApiVersion>=10?23:10);i.clearLastError();try{return r&&(t&&a)?(o=l.handleStore.get(r).value===l.handleStore.get(t).value?1:0,new DataView(n.buffer).setInt8(a,o,!0),i.getReturnStatus()):i.setLastError(1)}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_typeof:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o,i=l.handleStore.get(r);if(i.isNumber())o=3;else if(i.isBigInt())o=9;else if(i.isString())o=4;else if(i.isFunction())o=7;else if(i.isExternal())o=8;else if(i.isObject())o=6;else if(i.isBoolean())o=2;else if(i.isUndefined())o=0;else if(i.isSymbol())o=5;else{if(!i.isNull())return a.setLastError(1);o=1}return new DataView(n.buffer).setInt32(t,o,!0),a.clearLastError()},node_api_is_sharedarraybuffer:function(e,r,t){if(!e)return 1;var a=l.envStore.get(e);if(a.checkGCAccess(),!r)return a.setLastError(1);if(!t)return a.setLastError(1);var o=l.handleStore.get(r),i=\"function\"==typeof SharedArrayBuffer&&o.value instanceof SharedArrayBuffer||\"[object SharedArrayBuffer]\"===Object.prototype.toString.call(o.value)?1:0;return new DataView(n.buffer).setInt8(t,i,!0),a.clearLastError()}});var Se=Object.freeze({__proto__:null,napi_get_version:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(new DataView(n.buffer).setUint32(r,10,!0),t.clearLastError()):t.setLastError(1)}});function Ae(e){for(var r=Object.keys(e),t=0;t<r.length;++t){var n=r[t];0!==n.indexOf(\"$\")&&(0===n.indexOf(\"emnapi_\")?h.imports.emnapi[n]=e[n]:0===n.indexOf(\"_emnapi_\")||\"napi_set_last_error\"===n||\"napi_clear_last_error\"===n?h.imports.env[n]=e[n]:h.imports.napi[n]=e[n])}}return D.init(),q.init(),J.init(),R.init(),S.init(),h.emnapi.syncMemory=se,h.emnapi.getMemoryAddress=ue,Ae(B),Ae(x),Ae(N),Ae(T),Ae($),Ae(K),Ae(le),Ae(de),Ae(oe),Ae(pe),Ae(fe),Ae(ve),Ae(ye),Ae(ge),Ae(_e),Ae(j),Ae(Ee),Ae(me),Ae(Le),Ae(be),Ae(Se),h.imports.napi.napi_create_threadsafe_function=function(e,r,t,a,s,u,f,c,d,p,v){if(!e)return 1;var h=l.envStore.get(e);if(h.checkGCAccess(),!a)return h.setLastError(1);if(s>>>=0,0===(u>>>=0))return h.setLastError(1);if(!v)return h.setLastError(1);var y,g=0;if(r){if(\"function\"!=typeof l.handleStore.get(r).value)return h.setLastError(1);g=l.createReference(h,r,1,1).id}else if(!p)return h.setLastError(1);if(t){if(null==(y=l.handleStore.get(t).value))return h.setLastError(2);y=Object(y)}else y={};var _=h.ensureHandleId(y),E=l.handleStore.get(a).value;if(\"symbol\"==typeof E)return h.setLastError(3);E=String(E);var w=h.ensureHandleId(E),m=R.offset.__size__,L=o(m);if(!L)return h.setLastError(9);new Uint8Array(n.buffer).subarray(L,L+m).fill(0);var b=l.createReference(h,_,1,1),S=b.id,A=new DataView(n.buffer);return A.setUint32(L+R.offset.resource,S,!0),R.initQueue(L)?(M(_,w,-1,L+R.offset.async_id),A.setInt8(L+R.offset.is_some,1,!0),A.setUint32(L+R.offset.thread_count,u,!0),A.setUint32(L+R.offset.context,d,!0),A.setUint32(L+R.offset.max_queue_size,s,!0),A.setUint32(L+R.offset.ref,g,!0),A.setUint32(L+R.offset.env,e,!0),A.setUint32(L+R.offset.finalize_data,f,!0),A.setUint32(L+R.offset.finalize_cb,c,!0),A.setUint32(L+R.offset.call_js_cb,p,!0),l.addCleanupHook(h,R.cleanup,L),h.ref(),l.increaseWaitingRequestCounter(),A.setUint32(L+R.offset.async_ref,1,!0),A.setUint32(v,L,!0),h.clearLastError()):(i(L),b.dispose(),h.setLastError(9))},h.imports.napi.napi_get_threadsafe_function_context=function(e,r){if(!e||!r)return c(),1;var t=R.getContext(e);return new DataView(n.buffer).setUint32(r,t,!0),0},h.imports.napi.napi_call_threadsafe_function=function(e,r,t){return e?R.push(e,r,t):(c(),1)},h.imports.napi.napi_acquire_threadsafe_function=function(e){return e?R.getMutex(e).execute(function(){return 0===R.getState(e)?(R.addThreadCount(e),0):16}):(c(),1)},h.imports.napi.napi_release_threadsafe_function=function(e,r){if(!e)return c(),1;var t=R.getMutex(e),n=R.getCond(e),a=!1,o=t.execute(function(){return 0===R.getThreadCount(e)?1:(R.subThreadCount(e),0!==R.getThreadCount(e)&&1!==r||0===R.getState(e)&&(1===r&&R.setState(e,1),1===R.getState(e)&&R.getMaxQueueSize(e)>0&&n.signal(),R.send(e)),2!==R.getState(e)||0!==R.getThreadCount(e)||(a=!0),0)});return a&&R.destroy(e),o},h.imports.napi.napi_unref_threadsafe_function=function(e,r){if(!r)return c(),1;var t=r+R.offset.async_ref>>2,a=new Uint32Array(n.buffer),o=Atomics.load(a,t);return o>0&&(Atomics.store(a,t,o-1),1===o&&l.decreaseWaitingRequestCounter()),0},h.imports.napi.napi_ref_threadsafe_function=function(e,r){if(!r)return c(),1;var t=r+R.offset.async_ref>>2,a=new Uint32Array(n.buffer),o=Atomics.load(a,t);return o||l.increaseWaitingRequestCounter(),Atomics.store(a,t,o+1),0},h}();return t}function m(e,r,t,n){var a,o=(n=null!=n?n:{}).getMemory,i=n.getTable,s=n.beforeInit;if(null!=o&&\"function\"!=typeof o)throw new TypeError(\"options.getMemory is not a function\");if(null!=i&&\"function\"!=typeof i)throw new TypeError(\"options.getTable is not a function\");if(null!=s&&\"function\"!=typeof s)throw new TypeError(\"options.beforeInit is not a function\");var u=\"object\"==typeof r&&null!==r;if(u){if(r.loaded)throw new Error(\"napiModule has already loaded\");a=r}else a=w(n);var f,c=n.wasi,l={env:a.imports.env,napi:a.imports.napi,emnapi:a.imports.emnapi};c&&(f=new y(a.childThread?{wasi:c,childThread:!0,postMessage:a.postMessage}:{wasi:c,threadManager:a.PThread,waitThreadStart:a.waitThreadStart}),Object.assign(l,\"function\"==typeof c.getImportObject?c.getImportObject():{wasi_snapshot_preview1:c.wasiImport}),Object.assign(l,f.getImportObject()));var d=n.overwriteImports;if(\"function\"==typeof d){var p=d(l);\"object\"==typeof p&&null!==p&&(l=p)}return e(t,l,function(r,t){if(r)throw r;var n=t.instance,d=n,p=n.exports,v=\"memory\"in p,h=\"memory\"in l.env,y=o?o(p):v?p.memory:h?l.env.memory:void 0;if(!y)throw new Error(\"memory is neither exported nor imported\");var g=i?i(p):p.__indirect_function_table;if(c&&!v){var _=Object.create(null);Object.assign(_,p,{memory:y}),d={exports:_}}var E=t.module;c?d=f.initialize(d,E,y):a.PThread.setup(E,y);var w=function(){s&&s({instance:n,module:E}),a.init({instance:d,module:E,memory:y,table:g});var e={instance:n,module:E,usedInstance:d};return u||(e.napiModule=a),e};if(a.PThread.shouldPreloadWorkers()){var m=a.PThread.loadWasmModuleToAllWorkers();if(e===L)return m.then(w);throw new Error(\"Synchronous loading is not supported with worker pool (reuseWorker.size > 0)\")}return w()})}function L(e,r,t){return n(e,r).then(function(e){return t(null,e)},function(e){return t(e)})}function b(e,n,a){var o;try{o=function(e,n){if(!e)throw new TypeError(\"Invalid wasm source\");var a;if(t(n),n=null!=n?n:{},e instanceof ArrayBuffer||ArrayBuffer.isView(e))a=new r.Module(e);else{if(!(e instanceof WebAssembly.Module))throw new TypeError(\"Invalid wasm source\");a=e}return{instance:new r.Instance(a,n),module:a}}(e,n)}catch(e){return a(e)}return a(null,o)}var S=function(e,r){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},S(e,r)};var A=function(){return A=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},A.apply(this,arguments)};\"function\"==typeof SuppressedError&&SuppressedError;var C=function(e){function r(r){var t=this;if(\"function\"!=typeof r.onLoad)throw new TypeError(\"options.onLoad is not a function\");var n=r.onError;return(t=e.call(this,A(A({},r),{onError:function(e,r){var a,o=null===(a=t.instance)||void 0===a?void 0:a.exports.emnapi_thread_crashed;if(\"function\"==typeof o&&o(),\"function\"!=typeof n)throw e;n(e,r)}}))||this).napiModule=void 0,t}return function(e,r){if(\"function\"!=typeof r&&null!==r)throw new TypeError(\"Class extends value \"+String(r)+\" is not a constructor or null\");function t(){this.constructor=e}S(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}(r,e),r.prototype.instantiate=function(e){var r=this,t=this.onLoad(e);return\"function\"==typeof t.then?t.then(function(e){return r.napiModule=e.napiModule,e}):(this.napiModule=t.napiModule,t)},r.prototype.handle=function(r){var t,n=this;if(e.prototype.handle.call(this,r),null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.__emnapi__){var a=r.data.__emnapi__.type,o=r.data.__emnapi__.payload;try{\"async-worker-init\"===a&&this.handleAfterLoad(r,function(){n.napiModule.initWorker(o.arg,o.func)})}catch(e){this.onError(e,a)}}},r}(_);e.MessageHandler=C,e.ThreadManager=d,e.ThreadMessageHandler=_,e.WASIThreads=y,e.createInstanceProxy=v,e.createNapiModule=w,e.instantiateNapiModule=function(e,r){return m(L,void 0,e,r)},e.instantiateNapiModuleSync=function(e,r){return m(b,void 0,e,r)},e.isSharedArrayBuffer=s,e.isTrapError=u,e.loadNapiModule=function(e,r,t){if(\"object\"!=typeof e||null===e)throw new TypeError(\"Invalid napiModule\");return m(L,e,r,t)},e.loadNapiModuleSync=function(e,r,t){if(\"object\"!=typeof e||null===e)throw new TypeError(\"Invalid napiModule\");return m(b,e,r,t)},e.version=\"1.9.0\"});\n;\n\n(function () {\n 'use strict';\n var handler = new emnapiCore.MessageHandler({\n onLoad: function (data) {\n var wasi = new wasmUtil.WASI({ version: 'preview1' });\n return emnapiCore.instantiateNapiModuleSync(data.wasmModule, {\n childThread: true,\n wasi: wasi,\n context: emnapi.getDefaultContext(),\n overwriteImports: function (importObject) {\n importObject.env = Object.assign(\n {},\n importObject.env,\n importObject.napi,\n importObject.emnapi,\n { memory: data.wasmMemory }\n );\n return importObject;\n }\n });\n }\n });\n self.onmessage = function (e) { handler.handle(e); };\n})();\n";
|
|
6
|
+
module.exports = { source };
|
package/dist/binaries/wasm.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export const verifyAddressInfo: any;
|
|
|
5
5
|
export const verifyContractProof: any;
|
|
6
6
|
export const verifyDocumentsProof: any;
|
|
7
7
|
export const verifyEpochsInfoProof: any;
|
|
8
|
+
export const verifyFinalizedEpochInfosProof: any;
|
|
8
9
|
export const verifyIdentifierByNonUniquePublicKeyHashProof: any;
|
|
9
10
|
export const verifyIdentityBalanceProof: any;
|
|
10
11
|
export const verifyIdentityByIdentifierProof: any;
|
|
@@ -64,6 +65,7 @@ export const DocumentUpdatePriceTransitionNAPI: any;
|
|
|
64
65
|
export const DynamicValue: any;
|
|
65
66
|
export const EpochBasedDistributionNAPI: any;
|
|
66
67
|
export const ExtendedEpochInfoNAPI: any;
|
|
68
|
+
export const FinalizedEpochInfoNAPI: any;
|
|
67
69
|
export const GroupNAPI: any;
|
|
68
70
|
export const GroupStateTransitionInfoNAPI: any;
|
|
69
71
|
export const IdentifierNAPI: any;
|
|
@@ -155,6 +157,7 @@ export const VerifiedContractNAPI: any;
|
|
|
155
157
|
export const VerifiedDocumentNAPI: any;
|
|
156
158
|
export const VerifiedDocumentsNAPI: any;
|
|
157
159
|
export const VerifiedEpochsInfoNAPI: any;
|
|
160
|
+
export const VerifiedFinlizedEpochInfosNAPI: any;
|
|
158
161
|
export const VerifiedIdentifierByNonUniquePublicKeyHashNAPI: any;
|
|
159
162
|
export const VerifiedIdentityBalanceRootHashNAPI: any;
|
|
160
163
|
export const VerifiedIdentityByIdentifierNAPI: any;
|
package/dist/binaries/wasm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as protocol from "./wasmCreation.cjs";
|
|
2
|
-
export const { orchardOvkFromSeed, recoverNotes, verifyAddressesInfos, verifyAddressInfo, verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifyMostRecentShieldedAnchorProof, verifyShieldedAnchorsProof, verifyShieldedEncryptedNotesProof, verifyShieldedNotesCountProof, verifyShieldedNullifiersProof, verifyShieldedPoolStateProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AssetLockValueNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, CommitmentTreeNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateFromShieldedPoolResultNAPI, IdentityCreateFromShieldedPoolTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenBalanceOptionalNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, MerklePathNAPI, NoteNAPI, OrchardAddressNAPI, OrchardProverNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressInfoNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, RecoveredNoteNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SerializedActionNAPI, SharedEncryptedNoteNAPI, ShieldedBuilderNAPI, ShieldedMemoNAPI, ShieldedTransferTransitionNAPI, ShieldedWithdrawalResultNAPI, ShieldedWithdrawalTransitionNAPI, ShieldFromAssetLockTransitionNAPI, ShieldTransitionNAPI, SpendableNoteNAPI, StateTransitionNAPI, StoredAssetLockInfoNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, UnshieldTransitionNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedMostRecentShieldedAnchorNAPI, VerifiedPlatformAddressesInfosNAPI, VerifiedPlatformAddressInfoNAPI, VerifiedShieldedAnchorsNAPI, VerifiedShieldedEncryptedNoteNAPI, VerifiedShieldedEncryptedNotesNAPI, VerifiedShieldedNotesCountNAPI, VerifiedShieldedNullifierNAPI, VerifiedShieldedNullifiersNAPI, VerifiedShieldedPoolStateNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = protocol.default;
|
|
2
|
+
export const { orchardOvkFromSeed, recoverNotes, verifyAddressesInfos, verifyAddressInfo, verifyContractProof, verifyDocumentsProof, verifyEpochsInfoProof, verifyFinalizedEpochInfosProof, verifyIdentifierByNonUniquePublicKeyHashProof, verifyIdentityBalanceProof, verifyIdentityByIdentifierProof, verifyIdentityByUniqueKeyHashProof, verifyIdentityContractNonceProof, verifyIdentityKeysByIdentifierProof, verifyIdentityNonceProof, verifyMostRecentShieldedAnchorProof, verifyShieldedAnchorsProof, verifyShieldedEncryptedNotesProof, verifyShieldedNotesCountProof, verifyShieldedNullifiersProof, verifyShieldedPoolStateProof, verifySignatureDigest, verifyStateTransitionResult, verifyTokenBalancesForIdentitiesProof, verifyTokenContractInfoProof, verifyTokenDirectPurchasePrices, verifyTokensBalancesForIdentityProof, verifyTokenTotalSupplyProof, verifyTotalCreditsProof, verifyVotePollVoteStateProof, ActionTakerNAPI, AddressCreditWithdrawalTransitionNAPI, AddressFundingFromAssetLockTransitionNAPI, AddressFundsFeeStrategyStepNAPI, AddressFundsTransferTransitionNAPI, AddressWitnessNAPI, AssetLockProofNAPI, AssetLockValueNAPI, AuthorizedActionTakersNAPI, BatchedTransitionNAPI, BatchTransitionNAPI, BlockBasedDistributionNAPI, BlockInfoNAPI, ChainAssetLockProofNAPI, ChangeControlRulesNAPI, CommitmentTreeNAPI, ConsensusErrorNAPI, ContenderWithSerializedDocumentNAPI, ContestedDocumentVotePollQueryExecutionResultNAPI, ContractBoundsNAPI, CoreScriptNAPI, DataContractCreateTransitionNAPI, DataContractNAPI, DataContractUpdateTransitionNAPI, DistributionFunctionNAPI, DocumentBaseTransitionNAPI, DocumentCreateTransitionNAPI, DocumentDeleteTransitionNAPI, DocumentNAPI, DocumentPurchaseTransitionNAPI, DocumentReplaceTransitionNAPI, DocumentTransferTransitionNAPI, DocumentTransitionNAPI, DocumentUpdatePriceTransitionNAPI, DynamicValue, EpochBasedDistributionNAPI, ExtendedEpochInfoNAPI, FinalizedEpochInfoNAPI, GroupNAPI, GroupStateTransitionInfoNAPI, IdentifierNAPI, IdentityCreateFromAddressesTransitionNAPI, IdentityCreateFromShieldedPoolResultNAPI, IdentityCreateFromShieldedPoolTransitionNAPI, IdentityCreateTransitionNAPI, IdentityCreditTransferNAPI, IdentityCreditTransferToAddressesTransitionNAPI, IdentityCreditWithdrawalTransitionNAPI, IdentityNAPI, IdentityPublicKeyInCreationNAPI, IdentityPublicKeyNAPI, IdentityTokenBalanceNAPI, IdentityTokenBalanceOptionalNAPI, IdentityTokenInfoNAPI, IdentityTopUpFromAddressesTransitionNAPI, IdentityTopUpTransitionNAPI, IdentityUpdateTransitionNAPI, InputAddressNAPI, InstantAssetLockProofNAPI, InstantLockNAPI, MasternodeVoteTransitionNAPI, MerklePathNAPI, NoteNAPI, OrchardAddressNAPI, OrchardProverNAPI, OutPointNAPI, OutputAddressNAPI, OutputAddressNullableCreditsNAPI, PartialIdentityNAPI, PlatformAddressInfoNAPI, PlatformAddressNAPI, PrefundedVotingBalanceNAPI, PrivateEncryptedNoteNAPI, PrivateKeyNAPI, PublicKeyNAPI, RecoveredNoteNAPI, ResourceVoteChoiceNAPI, RewardDistributionTypeNAPI, SerializedActionNAPI, SharedEncryptedNoteNAPI, ShieldedBuilderNAPI, ShieldedMemoNAPI, ShieldedTransferTransitionNAPI, ShieldedWithdrawalResultNAPI, ShieldedWithdrawalTransitionNAPI, ShieldFromAssetLockTransitionNAPI, ShieldTransitionNAPI, SpendableNoteNAPI, StateTransitionNAPI, StoredAssetLockInfoNAPI, TimeBasedDistributionNAPI, TokenBaseTransitionNAPI, TokenBurnTransitionNAPI, TokenClaimTransitionNAPI, TokenConfigUpdateTransitionNAPI, TokenConfigurationChangeItemNAPI, TokenConfigurationConventionNAPI, TokenConfigurationLocalizationNAPI, TokenConfigurationNAPI, TokenContractInfoNAPI, TokenDestroyFrozenFundsTransitionNAPI, TokenDirectPurchaseTransitionNAPI, TokenDistributionRecipientNAPI, TokenDistributionRulesNAPI, TokenEmergencyActionTransitionNAPI, TokenFreezeTransitionNAPI, TokenKeepsHistoryRulesNAPI, TokenMarketplaceRulesNAPI, TokenMintTransitionNAPI, TokenPaymentInfoNAPI, TokenPerpetualDistributionNAPI, TokenPreProgrammedDistributionNAPI, TokenPricingScheduleNAPI, TokenSetPriceForDirectPurchaseTransitionNAPI, TokenStatusNAPI, TokenTradeModeNAPI, TokenTransferTransitionNAPI, TokenTransitionNAPI, TokenUnFreezeTransitionNAPI, TotalSingleTokenBalanceNAPI, TransactionNAPI, TxInNAPI, TxOutNAPI, UnshieldTransitionNAPI, VerifiedBalanceTransferNAPI, VerifiedContractNAPI, VerifiedDocumentNAPI, VerifiedDocumentsNAPI, VerifiedEpochsInfoNAPI, VerifiedFinlizedEpochInfosNAPI, VerifiedIdentifierByNonUniquePublicKeyHashNAPI, VerifiedIdentityBalanceRootHashNAPI, VerifiedIdentityByIdentifierNAPI, VerifiedIdentityByUniqueKeyHashNAPI, VerifiedIdentityContractNonceNAPI, VerifiedIdentityFullWithAddressInfosNAPI, VerifiedIdentityKeysByIdentifierNAPI, VerifiedIdentityNonceNAPI, VerifiedIdentityTokenInfoNAPI, VerifiedIdentityWithAddressInfosNAPI, VerifiedMostRecentShieldedAnchorNAPI, VerifiedPlatformAddressesInfosNAPI, VerifiedPlatformAddressInfoNAPI, VerifiedShieldedAnchorsNAPI, VerifiedShieldedEncryptedNoteNAPI, VerifiedShieldedEncryptedNotesNAPI, VerifiedShieldedNotesCountNAPI, VerifiedShieldedNullifierNAPI, VerifiedShieldedNullifiersNAPI, VerifiedShieldedPoolStateNAPI, VerifiedStateTransitionResultNAPI, VerifiedTokenBalancesForIdentitiesNAPI, VerifiedTokenContractInfoNAPI, VerifiedTokenDirectPurchasePricesNAPI, VerifiedTokenGroupActionWithDocumentNAPI, VerifiedTokenGroupActionWithTokenBalanceNAPI, VerifiedTokenGroupActionWithTokenIdentityInfoNAPI, VerifiedTokenGroupActionWithTokenPricingScheduleNAPI, VerifiedTokenPricingScheduleNAPI, VerifiedTokensBalancesForIdentityNAPI, VerifiedTokenTotalSupplyNAPI, VerifiedTotalCreditsNAPI, VerifiedVoteStateNAPI, VoteNAPI, VotePollNAPI, WitnessNAPI, ActionGoalNAPI, AssetLockProofTypeNAPI, BatchTypeNAPI, GasFeesPaidByNAPI, GroupActionStatusNAPI, KeyTypeNAPI, NetworkNAPI, PlatformVersionNAPI, PoolingNAPI, PurposeNAPI, SecurityLevelNAPI, TokenDistributionTypeNAPI, TokenEmergencyActionNAPI, VoteStateResultTypeNAPI } = protocol.default;
|