@tailwindcss/oxide-wasm32-wasi 4.3.1 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.js +320 -98
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.d.ts +0 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.cjs.min.js +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.d.mts +0 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.d.ts +0 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.esm-bundler.js +385 -97
- package/node_modules/@emnapi/core/dist/emnapi-core.js +399 -120
- package/node_modules/@emnapi/core/dist/emnapi-core.min.d.mts +0 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.min.js +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.min.mjs +1 -1
- package/node_modules/@emnapi/core/dist/emnapi-core.mjs +320 -98
- package/node_modules/@emnapi/core/package.json +2 -2
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.cjs.min.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.esm-bundler.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.iife.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.min.js +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.min.mjs +1 -1
- package/node_modules/@emnapi/runtime/dist/emnapi.mjs +1 -1
- package/node_modules/@emnapi/runtime/package.json +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.js +14 -23
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.d.ts +0 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.cjs.min.js +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.mts +0 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.d.ts +0 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.esm-bundler.js +14 -23
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.js +14 -23
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.d.mts +0 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.js +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.min.mjs +1 -1
- package/node_modules/@emnapi/wasi-threads/dist/wasi-threads.mjs +14 -23
- package/node_modules/@emnapi/wasi-threads/package.json +1 -1
- package/package.json +4 -4
- package/tailwindcss-oxide.wasm32-wasi.wasm +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
!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)>>>0))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){t>>>=0,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){e>>>=0,r>>>=0,t>>>=0;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 x=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>>>=0);r&&"function"==typeof r.ref&&r.ref()}},_emnapi_worker_unref:function(e){if(!u){var r=U(e>>>=0);r&&"function"==typeof r.unref&&r.unref()}}});var B=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=l.adjustAmountOfExternalAllocatedMemory(r);return t>>>=0,l.feature.supportBigInt?new DataView(n.buffer).setBigInt64(t,BigInt(o),!0):k(t,Number(o)),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){a>>>=0;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;e>>>=0;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));t>>>=0;var 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;a>>>=0,o>>>=0,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)u>>>=0,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);r>>>=0;var h=new DataView(n.buffer),y=h.getInt32(r,!0),g=h.getInt32(r+4,!0),_=BigInt(y>>>0)|BigInt(g)<<BigInt(32);i>>>=0,o>>>=0,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&&(s>>>=0,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={_liveSet:{},offset:{__size__:0,resource:0,async_id:0,trigger_async_id:0,queue_size:0,is_some:0,queue:0,async_pending:0,async_u_fd: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._liveSet=new Set,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.async_pending=132,R.offset.async_u_fd=96,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,a=r.payload;if("tsfn-send"===t){var o=a.tsfn+R.offset.async_pending;0!==Atomics.load(new Int32Array(n.buffer),o>>>2)&&R.enqueue(a.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&&(r>>>=0,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);if(r){for(var t=R.loadSizeTypeValue(r,!1);0!==t;){var n=R.loadSizeTypeValue(t+4,!1);i(t),t=n}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");i>>>=0,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._liveSet.delete(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),a=l.envStore.get(t);l.openScope(a);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),Atomics.store(new Int32Array(n.buffer),e+R.offset.async_pending>>>2,1),l.feature.setImmediate(function(){R.finalize(e)})}finally{l.closeScope(a)}},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)},enqueue:function(e){var r=e+R.offset.async_pending,t=e+R.offset.async_u_fd,a=new Int32Array(n.buffer);0===Atomics.exchange(a,t>>>2,1)&&l.feature.setImmediate(function(){R._liveSet.has(e)&&(0!==Atomics.load(a,r>>>2)?l.feature.setImmediate(function(){try{if(0===Atomics.exchange(a,r>>>2,0))return;if(!R._liveSet.has(e))return;R.dispatch(e)}finally{R._liveSet.has(e)&&(Atomics.store(a,t>>>2,0),0!==Atomics.load(a,r>>>2)&&R.enqueue(e))}}):Atomics.store(a,t>>>2,0))})},send:function(e){if(1&~Atomics.or(new Uint32Array(n.buffer),e+R.offset.dispatch_state>>>2,2)){var r=e+R.offset.async_pending;0===Atomics.load(new Int32Array(n.buffer),r>>>2)&&0===Atomics.exchange(new Int32Array(n.buffer),r>>>2,1)&&(void 0!==u&&u?postMessage({__emnapi__:{type:"tsfn-send",payload:{tsfn:e}}}):R.enqueue(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),W.globalAddress>>>=0;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"));var r;if(e<0&&(r=W.pool[-e-1]))return r.whenLoaded;e>>>=0;var t=new DataView(n.buffer).getInt32(e+20,!0);return(r=S.pthreads[t]).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 s>>>=0,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);p>>>=0,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),u>>>=0,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?(r>>>=0,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);r>>>=0;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?(r>>>=0,D.queue(r),t.clearLastError()):t.setLastError(1)}:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(r>>>=0,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);r>>>=0;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);r>>>=0;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){e>>>=0,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 u>>>=0,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)||q.isSharedArrayBuffer(e.buffer))&&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||4294967295===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||4294967295===r){for(var a=t>>>1,o=new Uint16Array(n.buffer);o[a];)++a;t=a<<1>>>0}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(t>>>=0,!e)return 1;var i=l.envStore.get(e);i.checkGCAccess();var s=-1===t||4294967295===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>>>=0,s,u);a>>>=0;var 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(t>>>=0,!e)return 1;var c=l.envStore.get(e);c.checkGCAccess();var d=-1===t||4294967295===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=f.value,d=new DataView(n.buffer);if(t){t>>>=0;var p=void 0;if(c instanceof Int8Array)p=0;else if(c instanceof Uint8Array)p=1;else if(c instanceof Uint8ClampedArray)p=2;else if(c instanceof Int16Array)p=3;else if(c instanceof Uint16Array)p=4;else if(c instanceof Int32Array)p=5;else if(c instanceof Uint32Array)p=6;else if("function"==typeof Float16Array&&c instanceof Float16Array)p=11;else if(c instanceof Float32Array)p=7;else if(c instanceof Float64Array)p=8;else if(c instanceof BigInt64Array)p=9;else{if(!(c instanceof BigUint64Array))return u.setLastError(9);p=10}d.setInt32(t,p,!0)}if(c=q.getOrUpdateMemoryView(c),a&&(a>>>=0,d.setUint32(a,c.length,!0)),o||i){if(o){o>>>=0;var v=q.getViewPointer(c,!0).address;d.setUint32(o,v,!0)}if(i){i>>>=0;var h=u.ensureHandleId(c.buffer);d.setUint32(i,h,!0)}}return s&&(s>>>=0,d.setUint32(s,c.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=q.getOrUpdateMemoryView(u.value),c=new DataView(n.buffer);if(t&&(t>>>=0,c.setUint32(t,f.byteLength,!0)),a||o){if(a){a>>>=0;var d=q.getViewPointer(f,!0).address;c.setUint32(a,d,!0)}if(o){o>>>=0;var p=s.ensureHandleId(f.buffer);c.setUint32(o,p,!0)}}return i&&(i>>>=0,c.setUint32(i,f.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);t>>>=0;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){t>>>=0;var u=q.getArrayBufferPointer(i.value,!0).address;s.setUint32(t,u,!0)}return a&&(a>>>=0,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()?(t>>>=0,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)}t>>>=0;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);a>>>=0,t>>>=0;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);a>>>=0,t>>>=0;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);var u=s.value<BigInt(0);t>>>=0,o>>>=0,a>>>=0;var f=new DataView(n.buffer),c=f.getUint32(a,!0);c>>>=0;for(var 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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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;t>>>=0;var 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);o>>>=0,t>>>=0,a>>>=0,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);o>>>=0,t>>>=0,a>>>=0,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);o>>>=0,t>>>=0,a>>>=0,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);t>>>=0;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 t>>>=0,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 t>>>=0,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(a>>>=0,t>>>=0,(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),o>>>=0,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);t>>>=0;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);t>>>=0;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 t>>>=0,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);t>>>=0;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>>>=0)&&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)t>>>=0,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;t>>>=0,a>>>=0,o>>>=0;var d=l.createReferenceWithFinalizer(s,f.id,0,c,a,t,o);if(i){i>>>=0;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){t>>>=0;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 a>>>=0,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(t>>>=0,s>>>=0,i>>>=0,(i>>>=0)>0&&!s)return p.setLastError(1);if(!(t>=-1&&t<=2147483647||4294967295===t)||!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),d>>>=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,u>>>=0,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>>>=0))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);d=l.createReferenceWithFinalizer(u,c.id,0,1,a,t,o),i>>>=0,s=d.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,s>>>=0,a>>>=0,(t>>>=0)||(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&&4294967295!==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&&4294967295!==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&&(t>>>=0,d.setUint32(t,i,!0)),a&&(a>>>=0,u=f.ownership,d.setInt32(a,u,!0)),o&&(o>>>=0,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)});r>>>=0;var 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);t>>>=0,a>>>=0,o>>>=0;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&&(t>>>=0,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,e>>>=0;var a=t?new SharedArrayBuffer(e):new ArrayBuffer(e);if(r){r>>>=0;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);r>>>=0;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,t>>>=0,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);a>>>=0;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","");a>>>=0;var d=void 0;r>>>=0,r>>>=0;var p=new DataView(n.buffer);if(t&&0!==r){if(!(u=o(r)))throw new Error("Out of memory");u>>>=0,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),t>>>=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 t>>>=0,r>>>=0,c.set(new Uint8Array(n.buffer).subarray(t,t+r)),i=l.addToCurrentScope(c).id,o>>>=0,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,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})),o>>>=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?(t>>>=0,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),o>>>=0,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,i>>>=0,t>>>=0,(r>>>=0)||(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);r>>>=0;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);t>>>=0;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;o>>>=0,t>>>=0;var 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})),i>>>=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,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})),o>>>=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,(o>>>=0)>0){if(!t)return s.setLastError(1);if(!a)return s.setLastError(1)}var u=r?l.handleStore.get(r).value:null,f={};t>>>=0,a>>>=0;for(var 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);f[v]={value:l.handleStore.get(d.getUint32(a+4*p,!0)).value,writable:!0,enumerable:!0,configurable:!0}}try{c=Object.defineProperties(Object.create(u),f)}catch(e){return s.setLastError(9)}var h=l.addToCurrentScope(c).id;return i>>>=0,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);a>>>=0;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);r>>>=0,a>>>=0;var i=-1===(t>>>=0)||4294967295===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);t>>>=0;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?(r>>>=0,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?(r>>>=0,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?(r>>>=0,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);r>>>=0;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 r>>>=0,t>>>=0,n>>>=0,a.setInstanceData(r,t,n),a.clearLastError()}});var ve=Object.freeze({__proto__:null,_emnapi_get_last_error_info:function(e,r,t,a){r>>>=0,t>>>=0,a>>>=0;var o=l.envStore.get(e).lastError,i=o.errorCode,s=o.engineErrorCode>>>0,u=o.engineReserved;u>>>=0;var 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}a>>>=0;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}a>>>=0;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}a>>>=0;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){e>>>=0,r>>>=0,t>>>=0,n>>>=0;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);r>>>=0;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 r>>>=0,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);r>>>=0,t>>>=0;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);r>>>=0,t>>>=0;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);r>>>=0,t>>>=0;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}a>>>=0;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);r>>>=0,t>>>=0;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){t>>>=0;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;i>>>=0;var 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,o>>>=0,i>>>=0,(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;t>>>=0,a>>>=0;var f=new DataView(n.buffer);if(a){if(!t)return s.setLastError(1);var c=f.getUint32(t,!0);c>>>=0;for(var 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){o>>>=0;var y=s.ensureHandleId(u.thiz);f.setUint32(o,y,!0)}return i&&(i>>>=0,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);t>>>=0;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,a>>>=0,o>>>=0,(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?(r>>>=0,t>>>=0,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 a>>>=0,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()){t>>>=0,a>>>=0;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 t>>>=0,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 r>>>=0,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 r>>>=0,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&&(t>>>=0,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&&(t>>>=0,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?(r>>>=0,t>>>=0,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,r>>>=0,s.setUint32(r,a,!0)});return t>>>=0,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);t>>>=0;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 i>>>=0,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(a>>>=0,t>>>=0,(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),i>>>=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)a>>>=0,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)a>>>=0,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 a>>>=0,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 t>>>=0,a>>>=0,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 a>>>=0,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 a>>>=0,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 t>>>=0,a>>>=0,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),a>>>=0,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 a>>>=0,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?(t>>>=0,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);t>>>=0,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{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var i=l.handleStore.get(r);return t>>>=0,a=i.value?4:3,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()}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 t>>>=0,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 t>>>=0,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 t>>>=0,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);a>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;var 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);t>>>=0;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);t>>>=0;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{if(!r)return i.setLastError(1);if(!t)return i.setLastError(1);if(!a)return i.setLastError(1);var s=l.handleStore.get(r).value,u=l.handleStore.get(t).value;return a>>>=0,o=s===u?1:0,new DataView(n.buffer).setInt8(a,o,!0),i.getReturnStatus()}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(t>>>=0,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);t>>>=0;var 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(x),Ae(B),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,u>>>=0,e>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,s>>>=0,0===(u>>>=0))return h.setLastError(1);if(!v)return h.setLastError(1);var y,g=0;if(r>>>=0){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);L>>>=0,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),R._liveSet.add(L),h.ref(),l.increaseWaitingRequestCounter(),A.setUint32(L+R.offset.async_ref,1,!0),v>>>=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;e>>>=0,r>>>=0;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?(e>>>=0,r>>>=0,R.push(e,r,t)):(c(),1)},h.imports.napi.napi_acquire_threadsafe_function=function(e){return e?(e>>>=0,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;e>>>=0;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>>>=0)+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>>>=0)+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.10.0"});
|
|
1
|
+
!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 s="string"==typeof e;if(s||"undefined"!=typeof URL&&e instanceof URL){if(s&&"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 s(e){return"function"==typeof(null==e?void 0:e.postMessage)?e.postMessage:"function"==typeof postMessage?postMessage:void 0}function i(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(!i(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.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),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,s=this;return e.whenLoaded=new Promise(function(i,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(),i(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{s.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){!t&&this._reuseWorker?this.returnWorkerToPool(e):(delete this.pthreads[r],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=Object.values(this.pthreads),r=0;r<e.length;++r)this.terminateWorker(e[r]);for(r=0;r<this.unusedWorkers.length;++r)this.terminateWorker(this.unusedWorkers[r]);this.unusedWorkers=[],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,s){var i;return"memory"===n?null!==(i="function"==typeof r?r():r)&&void 0!==i?i:Reflect.get(t,n,s):"_initialize"===n?n in t?a:void 0:"_start"===n?n in t?o:void 0:Reflect.get(t,n,s)},n.has=function(e,r){return"memory"===r||Reflect.has(t,r)};var s=new Proxy(Object.create(null),n);return new Proxy(e,{get:function(e,r,t){return"exports"===r?s: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 s=r.start;"function"==typeof s&&(r.start=function(e){try{return s.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 i=s(e);if(this.childThread&&"function"!=typeof i)throw new TypeError("options.postMessage is not a function");this.postMessage=i;var l=Boolean(e.wasm64),p=function(e,t){var s,u=void 0!==t;try{c(r.wasmMemory)}catch(e){if(null===(s=r.PThread)||void 0===s||s.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)>>>0))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){i(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))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)throw function(e){var r,t,n=new Int32Array(e);if(Atomics.load(n,0)<=1)return null;var o=Atomics.load(n,1),s=Atomics.load(n,2),i=Atomics.load(n,3),u=new Uint8Array(e),f=u.slice(16,16+o),c=u.slice(16+o,16+o+s),l=u.slice(16+o+s,16+o+s+i),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){if(void 0!==w&&void 0!==m)try{b.cleanThread(w,m,!0)}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),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=s(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 s=this.messagesBeforeLoad;this.messagesBeforeLoad=[];for(var i=0;i<s.length;i++){var u=s[i];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,s=t.stack,i=(new TextEncoder).encode(a),u=(new TextEncoder).encode(o),f=(new TextEncoder).encode(s);Atomics.store(n,1,i.length),Atomics.store(n,2,u.length),Atomics.store(n,3,f.length);var c=new Uint8Array(e);c.set(i,16),c.set(u,16+i.length),c.set(f,16+i.length+u.length)}}(e.buffer,r,t),Atomics.notify(e,0))}function w(e){var t=function(){var t,n,a,o,s,i="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 i=e.instance;if(!(null==i?void 0:i.exports))throw new TypeError("Invalid wasm instance");t=i;var u=i.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,s=u.free,!h.childThread){var y=8,g=i.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,i.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=(i?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(){i?e.off("message",r):e.removeEventListener("message",r,!1),delete e._emnapiSendListener}},i?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){t>>>=0,l.envStore.get(r).callFinalizerInternal(e,t,n,a)},_emnapi_callback_into_module:function(e,r,t,n,o){var s=l.envStore.get(r),i=l.openScope(s);try{s.callbackIntoModule(Boolean(e),function(){a.get(t)(r,n)})}catch(e){throw l.closeScope(s,i),o&&l.closeScope(s),e}l.closeScope(s,i)},_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){e>>>=0,r>>>=0,t>>>=0;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||i?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=(i?t:t.data).__emnapi__;a&&"async-thread-ready"===a.type&&(e(),n&&"function"==typeof n.unref&&n.unref(),i?n.off("message",r):n.removeEventListener("message",r))};i?n.on("message",r):n.addEventListener("message",r)}))},s=0;s<r;s++)o(s);Promise.all(t).then(I)},_emnapi_worker_ref:function(e){if(!u){var r=U(e>>>=0);r&&"function"==typeof r.ref&&r.ref()}},_emnapi_worker_unref:function(e){if(!u){var r=U(e>>>=0);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=l.adjustAmountOfExternalAllocatedMemory(r);return t>>>=0,l.feature.supportBigInt?new DataView(n.buffer).setBigInt64(t,BigInt(o),!0):k(t,Number(o)),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 s=0,i=0;if(p){var u=p.node.emitAsyncInit(r,t,-1);s=u.asyncId,i=u.triggerAsyncId}var f=D.idGen.generate();return D.values[f]={env:e,id:f,resource:r,asyncId:s,triggerAsyncId:i,status:0,execute:n,complete:a,data:o},f},callComplete:function(e,r){var t=e.complete,n=e.env,o=e.data,s=function(){if(t){var e=l.envStore.get(n),s=l.openScope(e);try{e.callbackIntoModule(!0,function(){a.get(t)(n,r,o)})}finally{l.closeScope(e,s)}}};p?p.node.makeCallback(e.resource,s,[],{asyncId:e.asyncId,triggerAsyncId:e.triggerAsyncId}):s()},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 s=D.pending.shift();D.values[s].status=0,D.queue(s)}})}},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,s=l.handleStore.get(r).value,i=p.node.emitAsyncInit(o,s,t),u=i.asyncId,f=i.triggerAsyncId;if(a){a>>>=0;var c=new DataView(n.buffer);c.setFloat64(a,u,!0),c.setFloat64(a+8,f,!0)}}}function F(e,r){p&&p.node.emitAsyncDestroy({asyncId:e,triggerAsyncId:r})}var O=Object.freeze({__proto__:null,_emnapi_async_destroy_js:function(e){if(!p)return 9;e>>>=0;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),s=p.napi.asyncDestroy(o);return 0!==s.status?s.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,s=p.napi.asyncInit(a,o);if(0!==s.status)return s.status;var i=s.value;i>=BigInt(-1)*(BigInt(1)<<BigInt(63))&&i<BigInt(1)<<BigInt(63)||(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));t>>>=0;var 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:F,_emnapi_node_emit_async_init:M,_emnapi_node_make_callback:function(e,r,t,a,o,s,i,u){var f,c=0;if(p){var d=l.handleStore.get(r).value,v=l.handleStore.get(t).value;a>>>=0,o>>>=0,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:s,triggerAsyncId:i});if(u)u>>>=0,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,s,i){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&&!s)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);r>>>=0;var h=new DataView(n.buffer),y=h.getInt32(r,!0),g=h.getInt32(r+4,!0),_=BigInt(y>>>0)|BigInt(g)<<BigInt(32);s>>>=0,o>>>=0,o>>>=0;for(var E=Array(o);f<o;f++){var w=h.getUint32(s+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):(i&&(i>>>=0,u=c.ensureHandleId(m.value),h.setUint32(i,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")}}),j={_liveSet:{},offset:{__size__:0,resource:0,async_id:0,trigger_async_id:0,queue_size:0,is_some:0,queue:0,async_pending:0,async_u_fd: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(j._liveSet=new Set,j.offset.__size__=184,j.offset.resource=0,j.offset.async_id=8,j.offset.trigger_async_id=16,j.offset.queue_size=60,j.offset.is_some=24,j.offset.queue=64,j.offset.async_pending=132,j.offset.async_u_fd=96,j.offset.thread_count=136,j.offset.state=140,j.offset.dispatch_state=144,j.offset.context=148,j.offset.max_queue_size=152,j.offset.ref=156,j.offset.env=160,j.offset.finalize_data=164,j.offset.finalize_cb=168,j.offset.call_js_cb=172,j.offset.handles_closing=176,j.offset.async_ref=180,j.offset.mutex=32,j.offset.cond=56,j.offset.mutex=j.offset.mutex+4,void 0!==S){S.unusedWorkers.forEach(j.addListener),Object.values(S.pthreads).forEach(j.addListener);var e=S.getNewWorker;S.getNewWorker=function(){var r=e.apply(this,arguments);return j.addListener(r),r}}},addListener:function(e){if(!e)return!1;if(e._emnapiTSFNListener)return!0;var r=function(e){var r=(i?e:e.data).__emnapi__;if(r){var t=r.type,n=r.payload;if("tsfn-send"===t){var a=n.tsfn+j.offset.async_pending;0!==Atomics.load(new Int32Array(j.ensureBufferFor(a+4)),a>>>2)&&j.enqueue(n.tsfn)}}};return e._emnapiTSFNListener={handler:r,dispose:function(){i?e.off("message",r):e.removeEventListener("message",r,!1),delete e._emnapiTSFNListener}},i?e.on("message",r):e.addEventListener("message",r,!1),!0},ensureBufferFor:function(e){var r=n.buffer;return e>r.byteLength&&(n.grow(0),r=n.buffer),r},initQueue:function(e){var r=o(8);return!!r&&(r>>>=0,new Uint8Array(j.ensureBufferFor(r+8),r,8).fill(0),j.storeSizeTypeValue(e+j.offset.queue,r,!1),!0)},destroyQueue:function(e){var r=j.loadSizeTypeValue(e+j.offset.queue,!1);if(r){for(var t=j.loadSizeTypeValue(r,!1);0!==t;){var n=j.loadSizeTypeValue(t+4,!1);s(t),t=n}s(r)}},pushQueue:function(e,r){var t=j.loadSizeTypeValue(e+j.offset.queue,!1),n=j.loadSizeTypeValue(t,!1),a=j.loadSizeTypeValue(t+4,!1),s=o(8);if(!s)throw new Error("OOM");s>>>=0,j.storeSizeTypeValue(s,r,!1),j.storeSizeTypeValue(s+4,0,!1),0===n&&0===a?(j.storeSizeTypeValue(t,s,!1),j.storeSizeTypeValue(t+4,s,!1)):(j.storeSizeTypeValue(a+4,s,!1),j.storeSizeTypeValue(t+4,s,!1)),j.addQueueSize(e)},shiftQueue:function(e){var r=j.loadSizeTypeValue(e+j.offset.queue,!1),t=j.loadSizeTypeValue(r,!1);if(0===t)return 0;var n=t,a=j.loadSizeTypeValue(t+4,!1);j.storeSizeTypeValue(r,a,!1),0===a&&j.storeSizeTypeValue(r+4,0,!1),j.storeSizeTypeValue(n+4,0,!1);var o=j.loadSizeTypeValue(n,!1);return s(n),j.subQueueSize(e),o},push:function(e,r,t){var n=j.getMutex(e),a=j.getCond(e),o=function(){var r=j.getQueueSize(e),t=j.getMaxQueueSize(e);return r>=t&&t>0&&0===j.getState(e)},s="undefined"!=typeof window&&"undefined"!=typeof document&&!i,u=!1,f=n.execute(function(){for(;o();){if(0===t)return 15;if(s)return 21;a.wait()}return 0===j.getState(e)?(j.pushQueue(e,r),j.send(e),0):0===j.getThreadCount(e)?1:(j.subThreadCount(e),2!==j.getState(e)||0!==j.getThreadCount(e)||(u=!0),16)});return u&&j.destroy(e),f},getMutex:function(e){var r=e+j.offset.mutex,t={lock:function(){var e="undefined"!=typeof window&&"undefined"!=typeof document&&!i,t=new Int32Array(j.ensureBufferFor(r+4),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(j.ensureBufferFor(r+4),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+j.offset.cond,t=j.getMutex(e);return{wait:function(){var e=new Int32Array(j.ensureBufferFor(r+4),r,1),n=Atomics.load(e,0);t.unlock(),Atomics.wait(e,0,n),t.lock()},signal:function(){var e=new Int32Array(j.ensureBufferFor(r+4),r,1);Atomics.add(e,0,1),Atomics.notify(e,0,1)}}},getQueueSize:function(e){return j.loadSizeTypeValue(e+j.offset.queue_size,!0)},addQueueSize:function(e){var r,t,n=j.offset.queue_size;r=new Uint32Array(j.ensureBufferFor(e+n+4)),t=e+n>>>2,Atomics.add(r,t,1)},subQueueSize:function(e){var r,t,n=j.offset.queue_size;r=new Uint32Array(j.ensureBufferFor(e+n+4)),t=e+n>>>2,Atomics.sub(r,t,1)},getThreadCount:function(e){return j.loadSizeTypeValue(e+j.offset.thread_count,!0)},addThreadCount:function(e){var r,t,n=j.offset.thread_count;r=new Uint32Array(j.ensureBufferFor(e+n+4)),t=e+n>>>2,Atomics.add(r,t,1)},subThreadCount:function(e){var r,t,n=j.offset.thread_count;r=new Uint32Array(j.ensureBufferFor(e+n+4)),t=e+n>>>2,Atomics.sub(r,t,1)},getState:function(e){return Atomics.load(new Int32Array(j.ensureBufferFor(e+j.offset.state+4)),e+j.offset.state>>>2)},setState:function(e,r){Atomics.store(new Int32Array(j.ensureBufferFor(e+j.offset.state+4)),e+j.offset.state>>>2,r)},getHandlesClosing:function(e){return Atomics.load(new Int8Array(j.ensureBufferFor(e+j.offset.handles_closing+1)),e+j.offset.handles_closing)},setHandlesClosing:function(e,r){Atomics.store(new Int8Array(j.ensureBufferFor(e+j.offset.handles_closing+1)),e+j.offset.handles_closing,r)},getDispatchState:function(e){return Atomics.load(new Uint32Array(j.ensureBufferFor(e+j.offset.dispatch_state+4)),e+j.offset.dispatch_state>>>2)},getContext:function(e){return j.loadSizeTypeValue(e+j.offset.context,!1)},getMaxQueueSize:function(e){return j.loadSizeTypeValue(e+j.offset.max_queue_size,!0)},getEnv:function(e){return j.loadSizeTypeValue(e+j.offset.env,!1)},getCallJSCb:function(e){return j.loadSizeTypeValue(e+j.offset.call_js_cb,!1)},getRef:function(e){return j.loadSizeTypeValue(e+j.offset.ref,!1)},getResource:function(e){return j.loadSizeTypeValue(e+j.offset.resource,!1)},getFinalizeCb:function(e){return j.loadSizeTypeValue(e+j.offset.finalize_cb,!1)},getFinalizeData:function(e){return j.loadSizeTypeValue(e+j.offset.finalize_data,!1)},loadSizeTypeValue:function(e,r){var t;return r?(t=new Uint32Array(j.ensureBufferFor(e+4)),Atomics.load(t,e>>>2)):(t=new Int32Array(j.ensureBufferFor(e+4)),Atomics.load(t,e>>>2))},storeSizeTypeValue:function(e,r,t){var n;return t?(n=new Uint32Array(j.ensureBufferFor(e+4)),void Atomics.store(n,e>>>2,r)):(n=new Int32Array(j.ensureBufferFor(e+4)),void Atomics.store(n,e>>>2,r>>>0))},releaseResources:function(e){if(2!==j.getState(e)){j.setState(e,2);var r=j.getEnv(e),t=l.envStore.get(r),a=j.getRef(e);a&&l.refStore.get(a).dispose();var o=j.getResource(e);l.refStore.get(o).dispose(),j.ensureBufferFor(e+j.offset.is_some+1),new DataView(n.buffer).setInt8(e+j.offset.is_some,0,!0),l.removeCleanupHook(t,j.cleanup,e),t.unref();var s=e+j.offset.async_ref,i=s>>>2,u=new Uint32Array(j.ensureBufferFor(s+4));if(Atomics.load(u,i)>0&&(Atomics.store(u,i,0),l.decreaseWaitingRequestCounter()),p){var f=new DataView(j.ensureBufferFor(e+j.offset.trigger_async_id+8));F(f.getFloat64(e+j.offset.async_id,!0),f.getFloat64(e+j.offset.trigger_async_id,!0))}}},destroy:function(e){j._liveSet.delete(e),j.destroyQueue(e),j.releaseResources(e),s(e)},emptyQueue:function(e){var r=[];j.getMutex(e).execute(function(){for(;j.getQueueSize(e)>0;)r.push(j.shiftQueue(e))});for(var t,n=j.getCallJSCb(e),o=j.getContext(e),s=0;s<r.length;s++)t=r[s],n&&a.get(n)(0,0,o,t)},maybeDelete:function(e){var r=!1;j.getMutex(e).execute(function(){j.getThreadCount(e)>0?j.releaseResources(e):r=!0}),r&&j.destroy(e)},finalize:function(e){var r=j.getEnv(e),t=l.envStore.get(r);l.openScope(t);var n=j.getFinalizeCb(e),a=j.getFinalizeData(e),o=j.getContext(e),s=function(){t.callFinalizerInternal(0,n,a,o)};try{if(j.emptyQueue(e),n)if(p){var i=j.getResource(e),u=l.refStore.get(i).get(),f=l.handleStore.get(u).value,c=new DataView(j.ensureBufferFor(e+j.offset.trigger_async_id+8)),d=c.getFloat64(e+j.offset.async_id,!0),v=c.getFloat64(e+j.offset.trigger_async_id,!0);p.node.makeCallback(f,s,[],{asyncId:d,triggerAsyncId:v})}else s();j.maybeDelete(e)}finally{l.closeScope(t)}},cleanup:function(e){j.closeHandlesAndMaybeDelete(e,1)},closeHandlesAndMaybeDelete:function(e,r){var t=j.getEnv(e),n=l.envStore.get(t);l.openScope(n);try{if(r&&j.getMutex(e).execute(function(){j.setState(e,1),j.getMaxQueueSize(e)>0&&j.getCond(e).signal()}),j.getHandlesClosing(e))return;j.setHandlesClosing(e,1),Atomics.store(new Int32Array(j.ensureBufferFor(e+j.offset.async_pending+4)),e+j.offset.async_pending>>>2,1),l.feature.setImmediate(function(){j.finalize(e)})}finally{l.closeScope(n)}},dispatchOne:function(e){var r=0,t=!1,n=!1,o=j.getMutex(e),s=j.getCond(e);if(o.execute(function(){if(0===j.getState(e)){var a=j.getQueueSize(e);if(a>0){r=j.shiftQueue(e),t=!0;var o=j.getMaxQueueSize(e);a===o&&o>0&&s.signal(),a--}0===a?0===j.getThreadCount(e)&&(j.setState(e,1),j.getMaxQueueSize(e)>0&&s.signal(),j.closeHandlesAndMaybeDelete(e,0)):n=!0}else j.closeHandlesAndMaybeDelete(e,0)}),t){var i=j.getEnv(e),u=l.envStore.get(i);l.openScope(u);var f=function(){u.callbackIntoModule(!1,function(){var t=j.getCallJSCb(e),n=j.getRef(e),o=n?l.refStore.get(n).get():0;if(t){var s=j.getContext(e);a.get(t)(i,o,s,r)}else{var u=o?l.handleStore.get(o).value:null;"function"==typeof u&&u()}})};try{if(p){var c=j.getResource(e),d=l.refStore.get(c).get(),v=l.handleStore.get(d).value,h=new DataView(j.ensureBufferFor(e+j.offset.trigger_async_id+8));p.node.makeCallback(v,f,[],{asyncId:h.getFloat64(e+j.offset.async_id,!0),triggerAsyncId:h.getFloat64(e+j.offset.trigger_async_id,!0)})}else f()}finally{l.closeScope(u)}}return n},dispatch:function(e){for(var r=!0,t=1e3,n=e+j.offset.dispatch_state,a=new Uint32Array(j.ensureBufferFor(n+4)),o=n>>>2;r&&0!==--t;)Atomics.store(a,o,1),r=j.dispatchOne(e),1!==Atomics.exchange(a,o,0)&&(r=!0);r&&j.send(e)},enqueue:function(e){var r=e+j.offset.async_pending,t=e+j.offset.async_u_fd,n=new Int32Array(j.ensureBufferFor(Math.max(r,t)+4));0===Atomics.exchange(n,t>>>2,1)&&l.feature.setImmediate(function(){j._liveSet.has(e)&&(0!==Atomics.load(n,r>>>2)?l.feature.setImmediate(function(){try{if(0===Atomics.exchange(n,r>>>2,0))return;if(!j._liveSet.has(e))return;j.dispatch(e)}finally{j._liveSet.has(e)&&(Atomics.store(n,t>>>2,0),0!==Atomics.load(n,r>>>2)&&j.enqueue(e))}}):Atomics.store(n,t>>>2,0))})},send:function(e){var r=e+j.offset.dispatch_state;if(1&~Atomics.or(new Uint32Array(j.ensureBufferFor(r+4)),r>>>2,2)){var t=e+j.offset.async_pending;0===Atomics.load(new Int32Array(j.ensureBufferFor(t+4)),t>>>2)&&0===Atomics.exchange(new Int32Array(j.ensureBufferFor(t+4)),t>>>2,1)&&(void 0!==u&&u?postMessage({__emnapi__:{type:"tsfn-send",payload:{tsfn:e}}}):j.enqueue(e))}}};var R={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},ensureBufferFor:function(e){var r=n.buffer;return e>r.byteLength&&(n.grow(0),r=n.buffer),r},init:function(){if(R.pool=[],R.workerReady=null,void 0!==S){S.unusedWorkers.forEach(R.addListener),Object.values(S.pthreads).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._emnapiAWMTListener)return!0;var r=function(e){var r=(i?e:e.data).__emnapi__;if(r){var t=r.type,n=r.payload;"async-work-complete"===t&&R.callComplete(n.work,0)}};return e._emnapiAWMTListener={handler:r,dispose:function(){i?e.off("message",r):e.removeEventListener("message",r,!1),delete e._emnapiAWMTListener}},i?e.on("message",r):e.addEventListener("message",r,!1),!0},initGlobal:function(){if(!R.globalAddress){R.globalAddress=o(R.globalOffset.end),R.globalAddress>>>=0;var e=R.globalOffset.end,r=R.globalAddress;new Uint8Array(R.ensureBufferFor(r+e),r,e).fill(0),R.queueInit(R.globalAddress+R.globalOffset.q),R.queueInit(R.globalAddress+R.globalOffset.exit_message)}},terminateWorkers:function(){R.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()}),R.pool.length=0},initWorkers:function(e){if(u)return R.workerReady||(R.workerReady=Promise.resolve());if(R.workerReady)return R.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,n=[];R.initGlobal();for(var a=0;a<e;++a)n.push(r(1,R.globalAddress));var o=n.map(function(e){if(0===e)return Promise.reject(new Error("Failed to create async worker"));var r;if(e<0&&(r=R.pool[-e-1]))return r.whenLoaded;e>>>=0;var t=new DataView(R.ensureBufferFor(e+20+4)).getInt32(e+20,!0);return(r=S.pthreads[t]).whenLoaded});return R.workerReady=Promise.all(o),R.workerReady},getResource:function(e){return R.ensureBufferFor(e+R.offset.resource+4),new DataView(n.buffer).getUint32(e+R.offset.resource,!0)},getExecute:function(e){return R.ensureBufferFor(e+R.offset.execute+4),new DataView(n.buffer).getUint32(e+R.offset.execute,!0)},getComplete:function(e){return R.ensureBufferFor(e+R.offset.complete+4),new DataView(n.buffer).getUint32(e+R.offset.complete,!0)},getEnv:function(e){return R.ensureBufferFor(e+R.offset.env+4),new DataView(n.buffer).getUint32(e+R.offset.env,!0)},getData:function(e){return R.ensureBufferFor(e+R.offset.data+4),new DataView(n.buffer).getUint32(e+R.offset.data,!0)},getMutex:function(){var e=R.globalAddress+R.globalOffset.mutex,r={lock:function(){var r="undefined"!=typeof window&&"undefined"!=typeof document&&!i,t=new Int32Array(R.ensureBufferFor(e+4),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(R.ensureBufferFor(e+4),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=R.globalAddress+R.globalOffset.cond,r=R.getMutex();return{wait:function(){var t=new Int32Array(R.ensureBufferFor(e+4),e,1),n=Atomics.load(t,0);r.unlock(),Atomics.wait(t,0,n),r.lock()},signal:function(){var r=new Int32Array(R.ensureBufferFor(e+4),e,1);Atomics.add(r,0,1),Atomics.notify(r,0,1)}}},queueInit:function(e){R.ensureBufferFor(e+4+4);var r=new DataView(n.buffer);r.setUint32(e,e,!0),r.setUint32(e+4,e,!0)},queueInsertTail:function(e,r){R.ensureBufferFor(e+4+4),R.ensureBufferFor(r+4+4);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){R.ensureBufferFor(e+4+4);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 R.ensureBufferFor(e+4),e==new DataView(n.buffer).getUint32(e,!0)},scheduleWork:function(e){var r;(null===(r=R.workerReady)||void 0===r?void 0:r.ready)||R.initWorkers(L()).then(function(){R.workerReady.ready=!0}).catch(function(e){throw R.workerReady=null,e}),l.increaseWaitingRequestCounter();var t=new Int32Array(R.ensureBufferFor(e+R.offset.status+4),e+R.offset.status,1);Atomics.store(t,0,0);var a=R.getMutex(),o=R.getCond();a.lock();try{R.queueInsertTail(R.globalAddress+R.globalOffset.q,e+R.offset.queue)}catch(e){throw l.decreaseWaitingRequestCounter(),a.unlock(),e}R.ensureBufferFor(R.globalAddress+R.globalOffset.idle_threads+4),new DataView(n.buffer).getUint32(R.globalAddress+R.globalOffset.idle_threads,!0)>0&&o.signal(),a.unlock()},cancelWork:function(e){var r=!1;return R.getMutex().execute(function(){R.ensureBufferFor(e+R.offset.status+4);var t=new DataView(n.buffer);(r=!R.queueEmpty(e+R.offset.queue)&&2!==t.getInt32(e+R.offset.status,!0))&&R.queueRemove(e+R.offset.queue)}),r?0!==Atomics.compareExchange(new Int32Array(R.ensureBufferFor(e+R.offset.status+4),e+R.offset.status,1),0,0,1)?9:(l.feature.setImmediate(function(){R.callComplete(e,11)}),0):9},callComplete:function(e,r){l.decreaseWaitingRequestCounter();var t=R.getComplete(e),n=R.getEnv(e),o=R.getData(e),s=l.envStore.get(n),i=l.openScope(s),u=function(){t&&s.callbackIntoModule(!0,function(){a.get(t)(n,r,o)})};try{if(p){var f=R.getResource(e),c=l.refStore.get(f).get(),d=l.handleStore.get(c).value,v=new DataView(R.ensureBufferFor(e+R.offset.trigger_async_id+8)),h=v.getFloat64(e+R.offset.async_id,!0),y=v.getFloat64(e+R.offset.trigger_async_id,!0);p.node.makeCallback(d,u,[],{asyncId:h,triggerAsyncId:y})}else u()}finally{l.closeScope(s,i)}}};R.init();var z=m?function(e,r,t,a,o,s,i){if(!e)return 1;var u,f=l.envStore.get(e);if(f.checkGCAccess(),!a)return f.setLastError(1);if(!i)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,s);return i>>>=0,new DataView(n.buffer).setUint32(i,d,!0),f.clearLastError()}:function(e,r,t,a,s,i,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=R.offset.end,p=o(d);if(!p)return c.setLastError(9);p>>>=0,new Uint8Array(R.ensureBufferFor(p+d)).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+R.offset.async_id),y.setUint32(p+R.offset.env,e,!0),y.setUint32(p+R.offset.execute,a,!0),y.setUint32(p+R.offset.complete,s,!0),y.setUint32(p+R.offset.data,i,!0),R.queueInit(p+R.offset.queue),u>>>=0,y.setUint32(u,p,!0),c.clearLastError()},W=m?function(e,r){if(!e)return 1;var t=l.envStore.get(e);return t.checkGCAccess(),r?(r>>>=0,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);r>>>=0;var n=R.getResource(r);if(l.refStore.get(n).dispose(),p){var a=new DataView(R.ensureBufferFor(r+R.offset.trigger_async_id+8));F(a.getFloat64(r+R.offset.async_id,!0),a.getFloat64(r+R.offset.trigger_async_id,!0))}return s(r),t.clearLastError()},G=m?function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(r>>>=0,D.queue(r),t.clearLastError()):t.setLastError(1)}:function(e,r){if(!e)return 1;var t=l.envStore.get(e);return r?(r>>>=0,R.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);r>>>=0;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);r>>>=0;var n=R.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){e>>>=0,R.globalAddress=e;var r=R.getMutex(),t=R.getCond();r.lock();for(var o=e+R.globalOffset.exit_message,s=e+R.globalOffset.idle_threads,i=e+R.globalOffset.q,u=new DataView(n.buffer);;){for(R.ensureBufferFor(i+4);R.queueEmpty(i);)Atomics.add(new Int32Array(R.ensureBufferFor(s+4),s,1),0,1),t.wait(),Atomics.sub(new Int32Array(R.ensureBufferFor(s+4),s,1),0,1);var f=u.getUint32(i,!0);if(f===o){t.signal(),r.unlock();break}var l=f-R.offset.queue;R.queueRemove(f),R.queueInit(f),r.unlock();var d=new Int32Array(R.ensureBufferFor(l+R.offset.status+4),l+R.offset.status,1);1===Atomics.load(d,0)&&c("unreachable");var p=R.getExecute(l),v=R.getEnv(l),y=R.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")||R.terminateWorkers()};try{var u=y({type:"async-work",name:"emnapi-async-worker"}),f=S.loadWasmModuleToWorker(u);i?u.on("error",o):u.addEventListener("error",o,!1),R.addListener(u),j.addListener(u),[].push(f.then(function(){"function"==typeof u.unref&&u.unref()})),a=R.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 s(c),e}return a},napi_cancel_async_work:P,napi_create_async_work:z,napi_delete_async_work:W,napi_queue_async_work:G}),q={registry:"function"==typeof FinalizationRegistry?new FinalizationRegistry(function(e){s(e)}):void 0,table:new WeakMap,wasmMemoryViewTable:new WeakMap,init:function(){q.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry(function(e){s(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 s=q.isDetachedArrayBuffer(e);if(q.table.has(e)){var i=q.table.get(e);return s?(i.address=0,i):(r&&0===i.ownership&&1===i.runtimeAllocated&&new Uint8Array(n.buffer).set(new Uint8Array(e),i.address),i)}if(s||0===e.byteLength)return a;if(!r)return a;var u=o(e.byteLength);if(!u)throw new Error("Out of memory");return u>>>=0,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)||q.isSharedArrayBuffer(e.buffer))&&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,s=a.ownership,i=a.runtimeAllocated;return{address:0===o?0:o+e.byteOffset,ownership:s,runtimeAllocated:i,view:e}}},J={registry:void 0,handleTable:new WeakMap,init:function(){J.handleTable=new WeakMap,J.registry="function"==typeof FinalizationRegistry?new FinalizationRegistry(function(e){J.release(e)}):void 0},allocMeta:function(e,r,t,a,s){var i=o(24);if(!i)throw new Error("Out of memory");i>>>=0,Atomics.store(new Int32Array(n.buffer,i,1),0,1);var u=new DataView(n.buffer);return u.setUint32(i+4,e,!0),u.setUint32(i+8,r,!0),u.setUint32(i+12,t,!0),u.setUint32(i+16,a,!0),u.setUint32(i+20,s,!0),i},readMeta:function(e){var r=new DataView(n.buffer);return{external_data:r.getUint32(e+4,!0),byte_length:r.getUint32(e+8,!0),finalize_cb:r.getUint32(e+12,!0),finalize_data:r.getUint32(e+16,!0),finalize_hint:r.getUint32(e+20,!0)}},release:function(e){if(1===Atomics.sub(new Int32Array(n.buffer,e,1),0,1)){var r=J.readMeta(e),t=r.finalize_cb;if(t){var o=r.finalize_data,i=r.finalize_hint;a.get(t)(o,i)}s(e)}}},H={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 s=r<e.length;if(!s||o>=t-1){var i=n.subarray(0,o);if(a.push(String.fromCharCode.apply(null,i)),!s)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,H.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,H.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||4294967295===r)for(;t[a];)++a;else a=e+(r>>>0);if((r=a-e)<=16){for(var o=e,s="";o<a;){var i=t[o++];if(128&i){var u=63&t[o++];if(192!=(224&i)){var f=63&t[o++];if((i=224==(240&i)?(15&i)<<12|u<<6|f:(7&i)<<18|u<<12|f<<6|63&t[o++])<65536)s+=String.fromCharCode(i);else{var c=i-65536;s+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else s+=String.fromCharCode((31&i)<<6|u)}else s+=String.fromCharCode(i)}return s}return H.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 s=o>>>=0,i=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>=i)break;a[o++]=f}else if(f<=2047){if(o+1>=i)break;a[o++]=192|f>>6,a[o++]=128|63&f}else if(f<=65535){if(o+2>=i)break;a[o++]=224|f>>12,a[o++]=128|f>>6&63,a[o++]=128|63&f}else{if(o+3>=i)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-s},UTF16ToString:function(e,r){if(!e||!r)return"";var t=e>>>=0;if(-1===r||4294967295===r){for(var a=t>>>1,o=new Uint16Array(n.buffer);o[a];)++a;t=a<<1>>>0}else t=e+2*(r>>>0);if((r=t-e)<=32)return String.fromCharCode.apply(null,new Uint16Array(n.buffer,e,r/2));var s=new Uint8Array(n.buffer);return H.utf16Decoder.decode("function"==typeof SharedArrayBuffer&&s.buffer instanceof SharedArrayBuffer||"[object SharedArrayBuffer]"===Object.prototype.toString.call(s.buffer)?s.slice(e,t):s.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,s=new DataView(n.buffer),i=0;i<o;++i){var u=e.charCodeAt(i);s.setInt16(r,u,!0),r+=2}return s.setInt16(r,0,!0),r-a},newString:function(e,r,t,a,o){if(t>>>=0,!e)return 1;var s=l.envStore.get(e);s.checkGCAccess();var i=-1===t||4294967295===t,u=t>>>0;if(0!==t&&!r)return s.setLastError(1);if(!a)return s.setLastError(1);if(!(i||u<=2147483647))return s.setLastError(1);var f=o(r>>>=0,i,u);a>>>=0;var c=l.addToCurrentScope(f).id;return new DataView(n.buffer).setUint32(a,c,!0),s.clearLastError()},newExternalString:function(e,r,t,a,o,s,i,u,f){if(t>>>=0,!e)return 1;var c=l.envStore.get(e);c.checkGCAccess();var d=-1===t||4294967295===t,p=t>>>0;if(0!==t&&!r)return c.setLastError(1);if(!s)return c.setLastError(1);if(!(d||p<=2147483647))return c.setLastError(1);var v=u(e,r,t,s);if(0===v){if(i)new DataView(n.buffer).setInt8(i,1,!0);a&&c.callFinalizer(a,r,o)}return v}};function Q(e,r,t,a,o,s,i){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=f.value,d=new DataView(n.buffer);if(t){t>>>=0;var p=void 0;if(c instanceof Int8Array)p=0;else if(c instanceof Uint8Array)p=1;else if(c instanceof Uint8ClampedArray)p=2;else if(c instanceof Int16Array)p=3;else if(c instanceof Uint16Array)p=4;else if(c instanceof Int32Array)p=5;else if(c instanceof Uint32Array)p=6;else if("function"==typeof Float16Array&&c instanceof Float16Array)p=11;else if(c instanceof Float32Array)p=7;else if(c instanceof Float64Array)p=8;else if(c instanceof BigInt64Array)p=9;else{if(!(c instanceof BigUint64Array))return u.setLastError(9);p=10}d.setInt32(t,p,!0)}if(c=q.getOrUpdateMemoryView(c),a&&(a>>>=0,d.setUint32(a,c.length,!0)),o||s){if(o){o>>>=0;var v=q.getViewPointer(c,!0).address;d.setUint32(o,v,!0)}if(s){s>>>=0;var h=u.ensureHandleId(c.buffer);d.setUint32(s,h,!0)}}return i&&(i>>>=0,d.setUint32(i,c.byteOffset,!0)),u.clearLastError()}function $(e,r,t,a,o,s){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!r)return i.setLastError(1);var u=l.handleStore.get(r);if(!u.isDataView())return i.setLastError(1);var f=q.getOrUpdateMemoryView(u.value),c=new DataView(n.buffer);if(t&&(t>>>=0,c.setUint32(t,f.byteLength,!0)),a||o){if(a){a>>>=0;var d=q.getViewPointer(f,!0).address;c.setUint32(a,d,!0)}if(o){o>>>=0;var p=i.ensureHandleId(f.buffer);c.setUint32(o,p,!0)}}return s&&(s>>>=0,c.setUint32(s,f.byteOffset,!0)),i.clearLastError()}var Y=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);t>>>=0;var s=o.value.length>>>0;return new DataView(n.buffer).setUint32(t,s,!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 s=l.handleStore.get(r);if(!s.isArrayBuffer()&&!q.isSharedArrayBuffer(s.value))return o.setLastError(1);var i=new DataView(n.buffer);if(t){t>>>=0;var u=q.getArrayBufferPointer(s.value,!0).address;i.setUint32(t,u,!0)}return a&&(a>>>=0,i.setUint32(a,s.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()?$(e,r,n,t,0,0):Q(e,r,0,n,t,0,0):a.setLastError(1)},napi_get_dataview_info:$,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 s=l.handleStore.get(r);return s.isDate()?(t>>>=0,a=s.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 s=void 0;try{s=o.isObject()||o.isFunction()?o.value:Object(o.value)}catch(e){return a.setLastError(2)}t>>>=0;var i=a.ensureHandleId(Object.getPrototypeOf(s));return new DataView(n.buffer).setUint32(t,i,!0),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_get_typedarray_info:Q,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 s=l.handleStore.get(r).value;if("bigint"!=typeof s)return o.setLastError(6);a>>>=0,t>>>=0;var i=new DataView(n.buffer);s>=BigInt(-1)*(BigInt(1)<<BigInt(63))&&s<BigInt(1)<<BigInt(63)?i.setInt8(a,1,!0):(i.setInt8(a,0,!0),(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));return i.setInt32(t,u,!0),i.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 s=l.handleStore.get(r).value;if("bigint"!=typeof s)return o.setLastError(6);a>>>=0,t>>>=0;var i=new DataView(n.buffer);s>=BigInt(0)&&s<BigInt(1)<<BigInt(64)?i.setInt8(a,1,!0):(i.setInt8(a,0,!0),s&=(BigInt(1)<<BigInt(64))-BigInt(1));var u=Number(s&BigInt(4294967295)),f=Number(s>>BigInt(32));return i.setUint32(t,u,!0),i.setUint32(t+4,f,!0),o.clearLastError()},napi_get_value_bigint_words:function(e,r,t,a,o){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!l.feature.supportBigInt)return s.setLastError(9);if(!r)return s.setLastError(1);if(!a)return s.setLastError(1);var i=l.handleStore.get(r);if(!i.isBigInt())return s.setLastError(17);var u=i.value<BigInt(0);t>>>=0,o>>>=0,a>>>=0;var f=new DataView(n.buffer),c=f.getUint32(a,!0);c>>>=0;for(var d=0,p=u?i.value*BigInt(-1):i.value;p!==BigInt(0);)d++,p>>=BigInt(64);if(p=u?i.value*BigInt(-1):i.value,t||o){if(!t)return s.setLastError(1);if(!o)return s.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 s.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);t>>>=0;var s=o.value?1:0;return new DataView(n.buffer).setInt8(t,s,!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);t>>>=0;var s=o.value;return new DataView(n.buffer).setFloat64(t,s,!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);t>>>=0;var s=o.data();return new DataView(n.buffer).setUint32(t,s,!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);t>>>=0;var s=new Int32Array([o.value])[0];return new DataView(n.buffer).setInt32(t,s,!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 s=o.value;t>>>=0;var i=new DataView(n.buffer);return s===Number.POSITIVE_INFINITY||s===Number.NEGATIVE_INFINITY||isNaN(s)?(i.setInt32(t,0,!0),i.setInt32(t+4,0,!0)):s<-0x8000000000000000?(i.setInt32(t,0,!0),i.setInt32(t+4,2147483648,!0)):s>=0x8000000000000000?(i.setUint32(t,4294967295,!0),i.setUint32(t+4,2147483647,!0)):k(t,Math.trunc(s)),a.clearLastError()},napi_get_value_string_latin1:function(e,r,t,a,o){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!r)return s.setLastError(1);o>>>=0,t>>>=0,a>>>=0,a>>>=0;var i=l.handleStore.get(r);if("string"!=typeof i.value)return s.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&i.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 s.setLastError(1);u.setUint32(o,i.value.length,!0)}return s.clearLastError()},napi_get_value_string_utf16:function(e,r,t,a,o){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!r)return s.setLastError(1);o>>>=0,t>>>=0,a>>>=0,a>>>=0;var i=l.handleStore.get(r);if("string"!=typeof i.value)return s.setLastError(3);var u=new DataView(n.buffer);if(t)if(0!==a){var f=H.stringToUTF16(i.value,t,2*a);o&&u.setUint32(o,f/2,!0)}else o&&u.setUint32(o,0,!0);else{if(!o)return s.setLastError(1);u.setUint32(o,i.value.length,!0)}return s.clearLastError()},napi_get_value_string_utf8:function(e,r,t,a,o){if(!e)return 1;var s=l.envStore.get(e);if(s.checkGCAccess(),!r)return s.setLastError(1);o>>>=0,t>>>=0,a>>>=0,a>>>=0;var i=l.handleStore.get(r);if("string"!=typeof i.value)return s.setLastError(3);var u=new DataView(n.buffer);if(t)if(0!==a){var f=H.stringToUTF8(i.value,t,a);o&&u.setUint32(o,f,!0)}else o&&u.setUint32(o,0,!0);else{if(!o)return s.setLastError(1);var c=H.lengthBytesUTF8(i.value);u.setUint32(o,c,!0)}return s.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);t>>>=0;var s=new Uint32Array([o.value])[0];return new DataView(n.buffer).setUint32(t,s,!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,s=void 0;try{s="object"===o&&null!==a||"function"===o?a:Object(a)}catch(e){return n.setLastError(2)}var i=l.handleStore.get(t).value;return Object.setPrototypeOf(s,i),n.getReturnStatus()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}}});function X(e,r,t,a){return H.newString(e,r,t,a,function(e,r,t){var a="",o=0,s=new DataView(n.buffer);if(r)for(;;){if(!(i=s.getUint8(e,!0)))break;a+=String.fromCharCode(i),e++}else for(;o<t;){var i;if(!(i=s.getUint8(e,!0)))break;a+=String.fromCharCode(i),o++,e++}return a})}function Z(e,r,t,n){return H.newString(e,r,t,n,function(e){return H.UTF16ToString(e,t)})}function K(e,r,t,n){return H.newString(e,r,t,n,function(e){return H.UTF8ToString(e,t)})}var ee=Object.freeze({__proto__:null,napi_create_bigint_int64:function(e,r,t,a){if(!e)return 1;var o,s=l.envStore.get(e);if(s.checkGCAccess(),!l.feature.supportBigInt)return s.setLastError(9);if(!t)return s.setLastError(1);o=r;var i=l.addToCurrentScope(o).id;return t>>>=0,new DataView(n.buffer).setUint32(t,i,!0),s.clearLastError()},napi_create_bigint_uint64:function(e,r,t,a){if(!e)return 1;var o,s=l.envStore.get(e);if(s.checkGCAccess(),!l.feature.supportBigInt)return s.setLastError(9);if(!t)return s.setLastError(1);o=r&(BigInt(1)<<BigInt(64))-BigInt(1);var i=l.addToCurrentScope(o).id;return t>>>=0,new DataView(n.buffer).setUint32(t,i,!0),s.clearLastError()},napi_create_bigint_words:function(e,r,t,a,o){var s,i;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(a>>>=0,t>>>=0,(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(i=0;i<t;i++){var d=c.getUint32(a+8*i,!0),p=c.getUint32(a+(8*i+4),!0);f+=(BigInt(d)|BigInt(p)<<BigInt(32))<<BigInt(64*i)}return f*=BigInt(r)%BigInt(2)===BigInt(0)?BigInt(1):BigInt(-1),o>>>=0,s=l.addToCurrentScope(f).id,c.setUint32(o,s,!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);t>>>=0;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);t>>>=0;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,s=l.envStore.get(e);if(s.checkGCAccess(),!t)return s.setLastError(1);o=Number(r);var i=l.addToCurrentScope(o).id;return t>>>=0,new DataView(n.buffer).setUint32(t,i,!0),s.clearLastError()},napi_create_string_latin1:X,napi_create_string_utf16:Z,napi_create_string_utf8:K,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);t>>>=0;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,s){return H.newExternalString(e,r,t,n,a,o,s,X,void 0)},node_api_create_external_string_utf16:function(e,r,t,n,a,o,s){return H.newExternalString(e,r,t,n,a,o,s,Z,void 0)},node_api_create_property_key_latin1:function(e,r,t,n){return X(e,r,t,n)},node_api_create_property_key_utf16:function(e,r,t,n){return Z(e,r,t,n)},node_api_create_property_key_utf8:function(e,r,t,n){return K(e,r,t,n)}});function re(e,r,t,n,o){var s,i=(r>>>=0)&&t?H.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=s;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(""===i)return{status:0,f:s=c(e,f)};if(!/^[_$a-zA-Z][_$a-zA-Z0-9]*$/.test(i))return{status:1,f:void 0};if(l.feature.supportNewFunction){var d=c(e,f);try{s=new Function("_","return function "+i+'(){"use strict";return _.apply(this,arguments);};')(d)}catch(r){s=c(e,f),l.feature.canSetFunctionName&&Object.defineProperty(s,"name",{value:i})}}else s=c(e,f),l.feature.canSetFunctionName&&Object.defineProperty(s,"name",{value:i});return{status:0,f:s}}function te(e,r,t,n,a,o,s,i,u){if(a||o){var f=void 0,c=void 0;a&&(f=re(e,0,0,a,u).f),o&&(c=re(e,0,0,o,u).f);var d={configurable:!!(4&i),enumerable:!!(2&i),get:f,set:c};Object.defineProperty(r,t,d)}else if(n){d={configurable:!!(4&i),enumerable:!!(2&i),writable:!!(1&i),value:re(e,0,0,n,u).f};Object.defineProperty(r,t,d)}else{d={configurable:!!(4&i),enumerable:!!(2&i),writable:!!(1&i),value:l.handleStore.get(s).value};Object.defineProperty(r,t,d)}}function ne(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 ae(e,r,t,a){var o;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(0===a&&!t)return s.setLastError(1);var i=l.handleStore.get(r);if(!i.isObject()&&!i.isFunction())return s.setLastError(1);var u=s.getObjectBinding(i.value),f=u.wrapped,c=l.refStore.get(f);if(!c)return s.setLastError(1);if(t)t>>>=0,o=c.data(),new DataView(n.buffer).setUint32(t,o,!0);return 1===a&&(u.wrapped=0,1===c.ownership()?c.resetFinalizer():c.dispose()),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}}function oe(e,r,t,a,o,s){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!l.feature.supportFinalizer)return i.setLastError(9);if(!r)return i.setLastError(1);if(!a)return i.setLastError(1);var u=ne(r);if(0!==u.status)return i.setLastError(u.status);var f=u.handle,c=s?1:0;t>>>=0,a>>>=0,o>>>=0;var d=l.createReferenceWithFinalizer(i,f.id,0,c,a,t,o);if(s){s>>>=0;var p=d.id;new DataView(n.buffer).setUint32(s,p,!0)}return i.clearLastError()}var se=Object.freeze({__proto__:null,napi_add_finalizer:oe,napi_check_object_type_tag:function(e,r,t,a){var o=!0;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(s.tryCatch.hasCaught()?10:1);var i=l.handleStore.get(r);if(!i.isObject()&&!i.isFunction())return s.setLastError(s.tryCatch.hasCaught()?10:2);if(!t)return s.setLastError(s.tryCatch.hasCaught()?10:1);if(!a)return s.setLastError(s.tryCatch.hasCaught()?10:1);var u=s.getObjectBinding(i.value);if(null!==u.tag){t>>>=0;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 a>>>=0,new DataView(n.buffer).setInt8(a,o?1:0,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_define_class:function(e,r,t,a,o,s,i,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(t>>>=0,i>>>=0,s>>>=0,(s>>>=0)>0&&!i)return p.setLastError(1);if(!(t>=-1&&t<=2147483647||4294967295===t)||!r)return p.setLastError(1);var v=re(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;_<s;_++){f=i+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),d>>>=0;var A=g.getUint32(f+28,!0);if(E)y=H.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?te(p,h,y,m,L,b,S,d,A):te(p,h.prototype,y,m,L,b,S,d,A)}return c=l.addToCurrentScope(h).id,u>>>=0,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 ae(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>>>=0))return a.setLastError(a.tryCatch.hasCaught()?10:1);var s=a.getObjectBinding(o.value);if(null!==s.tag)return a.setLastError(a.tryCatch.hasCaught()?10:1);var i=new Uint8Array(16);return i.set(new Uint8Array(n.buffer,t,16)),s.tag=new Uint32Array(i.buffer),a.getReturnStatus()}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},napi_unwrap:function(e,r,t){return ae(e,r,t,0)},napi_wrap:function(e,r,t,a,o,s){return function(e,r,t,a,o,s){var i;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(s)throw l.createNotSupportWeakRefError("napi_wrap",'Parameter "result" must be 0(NULL)')}if(!r)return u.setLastError(1);var f=ne(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(s){if(!a)return u.setLastError(1);d=l.createReferenceWithFinalizer(u,c.id,0,1,a,t,o),s>>>=0,i=d.id,new DataView(n.buffer).setUint32(s,i,!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,s)},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,s,i){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(!i)return f.setLastError(1);if(a>>>=0,i>>>=0,a>>>=0,(t>>>=0)||(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=oe(e,v.id,t,o,s,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(i,u,!0),f.getReturnStatus()}catch(y){return f.tryCatch.setError(y),f.setLastError(10)}}function ue(e,r,t,a){var o;if(t=null!=t?t:0,t>>>=0,r instanceof ArrayBuffer||q.isSharedArrayBuffer(r)){if(!(i=q.getArrayBufferPointer(r,!1).address))throw new Error("Unknown ArrayBuffer address");if("number"==typeof a&&-1!==a&&4294967295!==a||(a=r.byteLength-t),0===(a>>>=0))return r;o=new Uint8Array(r,t,a);var s=new Uint8Array(n.buffer);return e?s.set(o,i):o.set(s.subarray(i,i+a)),r}if(ArrayBuffer.isView(r)){var i,u=q.getViewPointer(r,!1),f=u.view;if(!(i=u.address))throw new Error("Unknown ArrayBuffer address");if("number"==typeof a&&-1!==a&&4294967295!==a||(a=f.byteLength-t),0===(a>>>=0))return f;o=new Uint8Array(f.buffer,f.byteOffset+t,a);s=new Uint8Array(n.buffer);return e?s.set(o,i):o.set(s.subarray(i,i+a)),f}throw new TypeError("emnapiSyncMemory expect ArrayBuffer or ArrayBufferView as first parameter")}function fe(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}}function ce(e,r){if(null!=r&&!q.isSharedArrayBuffer(r))throw new TypeError("Expected a SharedArrayBuffer");if(!J.registry)throw new Error("FinalizationRegistry is not supported in this environment");e>>>=0;var t=J.readMeta(e),a=t.external_data;if(a>>>=0,null==r)r=new SharedArrayBuffer(t.byte_length),new Uint8Array(r).set(new Uint8Array(n.buffer,a,t.byte_length));else if(J.handleTable.has(r))return r;return Atomics.add(new Int32Array(n.buffer,e,1),0,1),q.table.has(r)||a&&q.table.set(r,{address:a,ownership:1,runtimeAllocated:0}),J.handleTable.set(r,e),J.registry.register(r,e),r}var le=Object.freeze({__proto__:null,$emnapiAcquireExternalSharedArrayBuffer:ce,$emnapiGetMemoryAddress:fe,$emnapiSyncMemory:ue,emnapi_acquire_external_sharedarraybuffer:function(e){e>>>=0,Atomics.add(new Int32Array(n.buffer,e,1),0,1)},emnapi_create_memory_view:ie,emnapi_get_external_sharedarraybuffer_handle: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);t>>>=0;var o=l.handleStore.get(r).value;if(!q.isSharedArrayBuffer(o))return a.setLastError(1);var s=J.handleTable.get(o);return void 0===s?a.setLastError(1):(new DataView(n.buffer).setUint32(t,s,!0),a.getReturnStatus())}catch(e){return a.tryCatch.setError(e),a.setLastError(10)}},emnapi_get_memory_address:function(e,r,t,a,o){var s,i,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);s=(f=fe(c.ctx.handleStore.get(r).value)).address;var d=new DataView(n.buffer);return t&&(t>>>=0,d.setUint32(t,s,!0)),a&&(a>>>=0,u=f.ownership,d.setInt32(a,u,!0)),o&&(o>>>=0,i=f.runtimeAllocated,d.setInt8(o,i,!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)});r>>>=0;var s=new DataView(n.buffer);return s.setUint32(r,o[0],!0),s.setUint32(r+4,o[1],!0),s.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_release_external_sharedarraybuffer:function(e){e>>>=0,J.release(e)},emnapi_sync_memory:function(e,r,t,a,o){var s;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);t>>>=0,a>>>=0,o>>>=0;var u=new DataView(n.buffer),f=u.getUint32(t,!0),c=i.ctx.handleStore.get(f);if(!(c.isArrayBuffer()||c.isTypedArray()||c.isDataView()||q.isSharedArrayBuffer(c.value)))return i.setLastError(1);var d=ue(Boolean(r),c.value,a,o);return c.value!==d&&(t>>>=0,s=i.ensureHandleId(d),u.setUint32(t,s,!0)),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}}});function de(e,r,t){e>>>=0,e>>>=0;var a=t?new SharedArrayBuffer(e):new ArrayBuffer(e);if(r){r>>>=0;var o=q.getArrayBufferPointer(a,!0).address;new DataView(n.buffer).setUint32(r,o,!0)}return a}var pe=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);r>>>=0;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,t>>>=0,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 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(!a)return s.setLastError(1);a>>>=0;var i=de(r,t,!1);return o=l.addToCurrentScope(i).id,new DataView(n.buffer).setUint32(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_create_buffer:function(e,r,t,a){var s,i,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","");a>>>=0;var d=void 0;r>>>=0,r>>>=0;var p=new DataView(n.buffer);if(t&&0!==r){if(!(u=o(r)))throw new Error("Out of memory");u>>>=0,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===(s=q.registry)||void 0===s||s.register(h,u),i=l.addToCurrentScope(v).id,p.setUint32(a,i,!0),t>>>=0,p.setUint32(t,u,!0)}else d=c.alloc(r),i=l.addToCurrentScope(d).id,p.setUint32(a,i,!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 s;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(!o)return i.setLastError(1);var u=l.feature.Buffer;if(!u)throw l.createNotSupportBufferError("napi_create_buffer_copy","");var f=de(r,a,!1),c=u.from(f);return t>>>=0,r>>>=0,c.set(new Uint8Array(n.buffer).subarray(t,t+r)),s=l.addToCurrentScope(c).id,o>>>=0,new DataView(n.buffer).setUint32(o,s,!0),i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_create_dataview:function(e,r,t,a,o){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);if(!o)return s.setLastError(1);r>>>=0,a>>>=0,r>>>=0,a>>>=0;var i=l.handleStore.get(t).value;return i instanceof ArrayBuffer||q.isSharedArrayBuffer(i)?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 i=new DataView(e,a,r);e===n.buffer&&(q.wasmMemoryViewTable.has(i)||q.wasmMemoryViewTable.set(i,{Ctor:DataView,address:a,length:r,ownership:1,runtimeAllocated:0})),o>>>=0;var u=l.addToCurrentScope(i).id;return new DataView(n.buffer).setUint32(o,u,!0),s.getReturnStatus()}(i):s.setLastError(1)}catch(e){return s.tryCatch.setError(e),s.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?(t>>>=0,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 s;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(!o)return i.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(i,u.id,0,0,t,r,a),o>>>=0,s=u.id,new DataView(n.buffer).setUint32(o,s,!0),i.clearLastError()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_create_external_arraybuffer:function(e,r,t,a,o,s){var i;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(!s)return u.setLastError(1);if(t>>>=0,s>>>=0,t>>>=0,(r>>>=0)||(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=oe(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 i=c.id,new DataView(n.buffer).setUint32(s,i,!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);r>>>=0;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);t>>>=0;var o=new DataView(n.buffer);if(r){var s=l.handleStore.get(r).value;if("string"!=typeof s)return a.setLastError(3);var i=l.addToCurrentScope(Symbol(s)).id;o.setUint32(t,i,!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,s){var i;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(!s)return u.setLastError(1);var f=l.handleStore.get(a).value;o>>>=0,t>>>=0;var c=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>>>=0,i=l.addToCurrentScope(d).id,new DataView(n.buffer).setUint32(s,i,!0),e.getReturnStatus()};if(!(f instanceof ArrayBuffer||q.isSharedArrayBuffer(f)))return u.setLastError(1);switch(r){case 0:return c(u,Int8Array,1,f,o,t);case 1:return c(u,Uint8Array,1,f,o,t);case 2:return c(u,Uint8ClampedArray,1,f,o,t);case 3:return c(u,Int16Array,2,f,o,t);case 4:return c(u,Uint16Array,2,f,o,t);case 5:return c(u,Int32Array,4,f,o,t);case 6:return c(u,Uint32Array,4,f,o,t);case 7:return c(u,Float32Array,4,f,o,t);case 8:return c(u,Float64Array,8,f,o,t);case 9:return c(u,BigInt64Array,8,f,o,t);case 10:return c(u,BigUint64Array,8,f,o,t);case 11:return"function"!=typeof Float16Array?u.setLastError(1):c(u,Float16Array,2,f,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 s;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(!o)return i.setLastError(1);t>>>=0,a>>>=0,t>>>=0,a>>>=0;var u=l.handleStore.get(r);if(!u.isArrayBuffer())return i.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})),o>>>=0,s=l.addToCurrentScope(p).id,new DataView(n.buffer).setUint32(o,s,!0),i.getReturnStatus()}catch(c){return i.tryCatch.setError(c),i.setLastError(10)}},node_api_create_external_sharedarraybuffer:function(e,r,t,a,o,s){var i;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(!s)return u.setLastError(1);if(t>>>=0,s>>>=0,t>>>=0,(r>>>=0)||(t=0),r+t>n.buffer.byteLength)throw new RangeError("Memory out of range");if(!J.registry&&a)throw l.createNotSupportWeakRefError("node_api_create_external_sharedarraybuffer",'Parameter "finalize_cb" must be 0(NULL)');var f=new SharedArrayBuffer(t);if(0!==t)new Uint8Array(f).set(new Uint8Array(n.buffer).subarray(r,r+t)),q.table.set(f,{address:r,ownership:1,runtimeAllocated:0});if(i=l.addToCurrentScope(f).id,a){a>>>=0,o>>>=0;var c=J.allocMeta(r,t,a,r,o);J.handleTable.set(f,c),J.registry.register(f,c)}return new DataView(n.buffer).setUint32(s,i,!0),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}},node_api_create_object_with_properties:function(e,r,t,a,o,s){if(!e)return 1;var i=l.envStore.get(e);if(i.checkGCAccess(),!s)return i.setLastError(1);if(o>>>=0,(o>>>=0)>0){if(!t)return i.setLastError(1);if(!a)return i.setLastError(1)}var u=r?l.handleStore.get(r).value:null,f={};t>>>=0,a>>>=0;for(var 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 i.setLastError(4);f[v]={value:l.handleStore.get(d.getUint32(a+4*p,!0)).value,writable:!0,enumerable:!0,configurable:!0}}try{c=Object.defineProperties(Object.create(u),f)}catch(e){return i.setLastError(9)}var h=l.addToCurrentScope(c).id;return s>>>=0,d.setUint32(s,h,!0),i.clearLastError()},node_api_create_sharedarraybuffer:function(e,r,t,a){var o;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(!a)return s.setLastError(1);a>>>=0;var i=de(r,t,!0);return o=l.addToCurrentScope(i).id,new DataView(n.buffer).setUint32(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.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);r>>>=0,a>>>=0;var s=-1===(t>>>=0)||4294967295===t,i=t>>>0;if(0!==t&&!r)return o.setLastError(1);if(!(s||i<=2147483647))return o.setLastError(1);var u=H.UTF8ToString(r,t),f=l.addToCurrentScope(Symbol.for(u)).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()}});var ve=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);t>>>=0;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?(r>>>=0,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?(r>>>=0,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?(r>>>=0,new DataView(n.buffer).setUint32(r,1,!0),t.clearLastError()):t.setLastError(1)}});var he=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);r>>>=0;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 r>>>=0,t>>>=0,n>>>=0,a.setInstanceData(r,t,n),a.clearLastError()}});var ye=Object.freeze({__proto__:null,_emnapi_get_last_error_info:function(e,r,t,a){r>>>=0,t>>>=0,a>>>=0;var o=l.envStore.get(e).lastError,s=o.errorCode,i=o.engineErrorCode>>>0,u=o.engineReserved;u>>>=0;var f=new DataView(n.buffer);f.setInt32(r,s,!0),f.setUint32(t,i,!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 s=l.handleStore.get(t).value;if("string"!=typeof s)return o.setLastError(3);var i=new Error(s);if(r){var u=l.handleStore.get(r).value;if("string"!=typeof u)return o.setLastError(3);i.code=u}a>>>=0;var f=l.addToCurrentScope(i).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 s=l.handleStore.get(t).value;if("string"!=typeof s)return o.setLastError(3);var i=new RangeError(s);if(r){var u=l.handleStore.get(r).value;if("string"!=typeof u)return o.setLastError(3);i.code=u}a>>>=0;var f=l.addToCurrentScope(i).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 s=l.handleStore.get(t).value;if("string"!=typeof s)return o.setLastError(3);var i=new TypeError(s);if(r){var u=l.handleStore.get(r).value;if("string"!=typeof u)return o.setLastError(3);i.code=u}a>>>=0;var f=l.addToCurrentScope(i).id;return new DataView(n.buffer).setUint32(a,f,!0),o.clearLastError()},napi_fatal_error:function(e,r,t,n){e>>>=0,r>>>=0,t>>>=0,n>>>=0;var a=H.UTF8ToString(e,r),o=H.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);r>>>=0;var a=new DataView(n.buffer);if(!t.tryCatch.hasCaught())return a.setUint32(r,1,!0),t.clearLastError();var o=t.tryCatch.exception(),s=t.ensureHandleId(o);return a.setUint32(r,s,!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 r>>>=0,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);r>>>=0,t>>>=0;var a=new Error(H.UTF8ToString(t,-1));return r&&(a.code=H.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);r>>>=0,t>>>=0;var a=new RangeError(H.UTF8ToString(t,-1));return r&&(a.code=H.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);r>>>=0,t>>>=0;var a=new TypeError(H.UTF8ToString(t,-1));return r&&(a.code=H.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 s=l.handleStore.get(t).value;if("string"!=typeof s)return o.setLastError(3);var i=new SyntaxError(s);if(r){var u=l.handleStore.get(r).value;if("string"!=typeof u)return o.setLastError(3);i.code=u}a>>>=0;var f=l.addToCurrentScope(i).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);r>>>=0,t>>>=0;var a=new SyntaxError(H.UTF8ToString(t,-1));return r&&(a.code=H.UTF8ToString(r,-1)),n.tryCatch.setError(a),n.clearLastError()}catch(e){return n.tryCatch.setError(e),n.setLastError(10)}}});function ge(e,r,t,a,o,s){t>>>=0;var i=l.envStore.get(e),u=re(i,r,t,a,o);if(0!==u.status)return i.setLastError(u.status);var f=u.f;s>>>=0;var c=l.addToCurrentScope(f).id;return new DataView(n.buffer).setUint32(s,c,!0),i.getReturnStatus()}var _e=Object.freeze({__proto__:null,_emnapi_create_function:ge,napi_call_function:function(e,r,t,a,o,s){var i,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,o>>>=0,s>>>=0,(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 s&&(i=f.ensureHandleId(y),v.setUint32(s,i,!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 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{return o&&n?ge(e,r,t,n,a,o):s.setLastError(1)}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_get_cb_info:function(e,r,t,a,o,s){if(!e)return 1;var i=l.envStore.get(e);if(!r)return i.setLastError(1);var u=l.scopeStore.get(r).callbackInfo;t>>>=0,a>>>=0;var f=new DataView(n.buffer);if(a){if(!t)return i.setLastError(1);var c=f.getUint32(t,!0);c>>>=0;for(var d=u.args.length,p=c<d?c:d,v=0;v<p;v++){var h=i.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){o>>>=0;var y=i.ensureHandleId(u.thiz);f.setUint32(o,y,!0)}return s&&(s>>>=0,f.setUint32(s,u.data,!0)),i.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);t>>>=0;var o=l.scopeStore.get(r).callbackInfo,s=o.thiz,i=o.fn,u=null==s||null==s.constructor?0:s instanceof i?a.ensureHandleId(s.constructor):0;return new DataView(n.buffer).setUint32(t,u,!0),a.clearLastError()},napi_new_instance:function(e,r,t,a,o){var s,i;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,a>>>=0,o>>>=0,(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(s=0;s<t;s++){var v=d.getUint32(a+4*s,!0);p[s]=l.handleStore.get(v).value}c=Reflect.construct(f,p,f)}else{var h=Array(t+1);for(h[0]=void 0,s=0;s<t;s++){v=d.getUint32(a+4*s,!0);h[s+1]=l.handleStore.get(v).value}c=new(f.bind.apply(f,h))}return o&&(i=u.ensureHandleId(c),d.setUint32(o,i,!0)),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}}});var Ee=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?(r>>>=0,t>>>=0,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 s=l.handleStore.get(r);if(o.moduleApiVersion<10&&!(s.isObject()||s.isFunction()||s.isSymbol()))return o.setLastError(1);var i=l.createReference(o,s.id,t>>>0,1);return a>>>=0,new DataView(n.buffer).setUint32(a,i.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 s=l.scopeStore.get(r);if(!s.escapeCalled()){t>>>=0,a>>>=0;var i=s.escape(t),u=i?i.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 t>>>=0,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 r>>>=0,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 r>>>=0,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&&(t>>>=0,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 s=o.unref();return t&&(t>>>=0,new DataView(n.buffer).setUint32(t,s,!0)),a.clearLastError()},napi_remove_env_cleanup_hook:function(e,r,t){if(!e)return 1;var n=l.envStore.get(e);return r?(r>>>=0,t>>>=0,l.removeCleanupHook(n,r,t),0):n.setLastError(1)}});var we=Object.freeze({__proto__:null,_emnapi_get_filename:function(e,r,t){var n=l.envStore.get(e).filename;return r?H.stringToUTF8(n,r,t):H.lengthBytesUTF8(n)}});var me=Object.freeze({__proto__:null,napi_create_promise:function(e,r,t){var a,o;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(!t)return s.setLastError(1);var i=new DataView(n.buffer),u=new Promise(function(e,t){var n=l.createDeferred({resolve:e,reject:t});a=n.id,r>>>=0,i.setUint32(r,a,!0)});return t>>>=0,o=l.addToCurrentScope(u).id,i.setUint32(t,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.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);t>>>=0;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 Le(e,r,t,a,o,s){var i;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(!s)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>>>=0,i=l.addToCurrentScope(_).id,new DataView(n.buffer).setUint32(s,i,!0),u.getReturnStatus()}catch(e){return u.tryCatch.setError(e),u.setLastError(10)}}var be=Object.freeze({__proto__:null,napi_define_properties:function(e,r,t,a){var o,s;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>>>=0,t>>>=0,(t>>>=0)>0&&!a)return i.setLastError(1);if(!r)return i.setLastError(1);var u=l.handleStore.get(r),f=u.value;if(!u.isObject()&&!u.isFunction())return i.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);s=d.getInt32(o+24,!0),s>>>=0;var w=d.getUint32(o+28,!0);if(v)c=H.UTF8ToString(v,-1);else{if(!h)return i.setLastError(4);if("string"!=typeof(c=l.handleStore.get(h).value)&&"symbol"!=typeof c)return i.setLastError(4)}te(i,f,c,y,g,_,E,s,w)}return i.getReturnStatus()}catch(e){return i.tryCatch.setError(e),i.setLastError(10)}},napi_delete_element:function(e,r,t,a){var o;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);var i=l.handleStore.get(r);if(!i.isObject()&&!i.isFunction())return s.setLastError(2);if(l.feature.supportReflect)o=Reflect.deleteProperty(i.value,t>>>0);else try{o=delete i.value[t>>>0]}catch(e){o=!1}if(a)a>>>=0,new DataView(n.buffer).setInt8(a,o?1:0,!0);return s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_delete_property:function(e,r,t,a){var o;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);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(!i.isObject()&&!i.isFunction())return s.setLastError(2);var u=l.handleStore.get(t).value;if(l.feature.supportReflect)o=Reflect.deleteProperty(i.value,u);else try{o=delete i.value[u]}catch(e){o=!1}if(a)a>>>=0,new DataView(n.buffer).setInt8(a,o?1:0,!0);return s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_get_all_property_names:Le,napi_get_element:function(e,r,t,a){var o;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(!a)return s.setLastError(1);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return a>>>=0,o=s.ensureHandleId(u[t>>>0]),new DataView(n.buffer).setUint32(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_get_named_property:function(e,r,t,a){var o;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(!a)return s.setLastError(1);if(!r)return s.setLastError(1);if(!t)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return t>>>=0,a>>>=0,o=s.ensureHandleId(u[H.UTF8ToString(t,-1)]),new DataView(n.buffer).setUint32(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_get_property:function(e,r,t,a){var o;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);if(!a)return s.setLastError(1);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return a>>>=0,o=s.ensureHandleId(u[l.handleStore.get(t).value]),new DataView(n.buffer).setUint32(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_get_property_names:function(e,r,t){return Le(e,r,0,18,1,t)},napi_has_element:function(e,r,t,a){var o;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(!a)return s.setLastError(1);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return a>>>=0,o=t>>>0 in u?1:0,new DataView(n.buffer).setInt8(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_has_named_property:function(e,r,t,a){var o;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(!a)return s.setLastError(1);if(!r)return s.setLastError(1);if(!t)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return t>>>=0,a>>>=0,o=H.UTF8ToString(t,-1)in u,new DataView(n.buffer).setInt8(a,o?1:0,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_has_own_property:function(e,r,t,a){var o;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);if(!a)return s.setLastError(1);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}var f=l.handleStore.get(t).value;return"string"!=typeof f&&"symbol"!=typeof f?s.setLastError(4):(o=Object.prototype.hasOwnProperty.call(u,l.handleStore.get(t).value),a>>>=0,new DataView(n.buffer).setInt8(a,o?1:0,!0),s.getReturnStatus())}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}},napi_has_property:function(e,r,t,a){var o;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);if(!a)return s.setLastError(1);if(!r)return s.setLastError(1);var i=l.handleStore.get(r);if(null==i.value)throw new TypeError("Cannot convert undefined or null to object");var u=void 0;try{u=i.isObject()||i.isFunction()?i.value:Object(i.value)}catch(e){return s.setLastError(2)}return a>>>=0,o=l.handleStore.get(t).value in u?1:0,new DataView(n.buffer).setInt8(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.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?(t>>>=0,l.handleStore.get(r).value[H.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 Se=Object.freeze({__proto__:null,napi_run_script:function(e,r,t){var a,o;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(!t)return s.setLastError(1);var i=l.handleStore.get(r);if(!i.isString())return s.setLastError(3);var u=l.handleStore.get(5).value.eval(i.value);t>>>=0,o=s.ensureHandleId(u),new DataView(n.buffer).setUint32(t,o,!0),a=s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.setLastError(10)}return a}});var Ae=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{if(!r)return o.setLastError(1);if(!t)return o.setLastError(1);var s=l.handleStore.get(r);return t>>>=0,a=s.value?4:3,new DataView(n.buffer).setUint32(t,a,!0),o.getReturnStatus()}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 s=l.handleStore.get(r);if(s.isBigInt())throw new TypeError("Cannot convert a BigInt value to a number");return t>>>=0,a=l.addToCurrentScope(Number(s.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 s=l.handleStore.get(r);if(null==s.value)throw new TypeError("Cannot convert undefined or null to object");return t>>>=0,a=o.ensureHandleId(Object(s.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 s=l.handleStore.get(r);if(s.isSymbol())throw new TypeError("Cannot convert a Symbol value to a string");return t>>>=0,a=l.addToCurrentScope(String(s.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 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(!a)return s.setLastError(1);if(!t)return s.setLastError(1);a>>>=0;var i=new DataView(n.buffer);i.setInt8(a,0,!0);var u=l.handleStore.get(t);return u.isFunction()?(o=l.handleStore.get(r).value instanceof u.value?1:0,i.setInt8(a,o,!0),s.getReturnStatus()):s.setLastError(5)}catch(e){return s.tryCatch.setError(e),s.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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;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);t>>>=0;var s=new DataView(n.buffer);if(o.isArrayBuffer()&&0===o.value.byteLength)try{new Uint8Array(o.value)}catch(e){return s.setInt8(t,1,!0),a.getReturnStatus()}return s.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);t>>>=0;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);t>>>=0;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 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(!t)return s.setLastError(1);if(!a)return s.setLastError(1);var i=l.handleStore.get(r).value,u=l.handleStore.get(t).value;return a>>>=0,o=i===u?1:0,new DataView(n.buffer).setInt8(a,o,!0),s.getReturnStatus()}catch(e){return s.tryCatch.setError(e),s.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,s=l.handleStore.get(r);if(t>>>=0,s.isNumber())o=3;else if(s.isBigInt())o=9;else if(s.isString())o=4;else if(s.isFunction())o=7;else if(s.isExternal())o=8;else if(s.isObject())o=6;else if(s.isBoolean())o=2;else if(s.isUndefined())o=0;else if(s.isSymbol())o=5;else{if(!s.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);t>>>=0;var s="function"==typeof SharedArrayBuffer&&o.value instanceof SharedArrayBuffer||"[object SharedArrayBuffer]"===Object.prototype.toString.call(o.value)?1:0;return new DataView(n.buffer).setInt8(t,s,!0),a.clearLastError()}});var Ce=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 ke(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(),H.init(),j.init(),S.init(),h.emnapi.syncMemory=ue,h.emnapi.getMemoryAddress=fe,h.emnapi.acquireExternalSharedArrayBuffer=ce,ke(B),ke(x),ke(N),ke(T),ke(Y),ke(ee),ke(pe),ke(ve),ke(se),ke(he),ke(le),ke(ye),ke(_e),ke(Ee),ke(we),ke(O),ke(me),ke(be),ke(Se),ke(Ae),ke(Ce),h.imports.napi.napi_create_threadsafe_function=function(e,r,t,a,i,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(i>>>=0,u>>>=0,e>>>=0,f>>>=0,c>>>=0,d>>>=0,p>>>=0,i>>>=0,0===(u>>>=0))return h.setLastError(1);if(!v)return h.setLastError(1);var y,g=0;if(r>>>=0){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=j.offset.__size__,L=o(m);if(!L)return h.setLastError(9);L>>>=0,new Uint8Array(j.ensureBufferFor(L+m)).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+j.offset.resource,S,!0),j.initQueue(L)?(M(_,w,-1,L+j.offset.async_id),A.setInt8(L+j.offset.is_some,1,!0),A.setUint32(L+j.offset.thread_count,u,!0),A.setUint32(L+j.offset.context,d,!0),A.setUint32(L+j.offset.max_queue_size,i,!0),A.setUint32(L+j.offset.ref,g,!0),A.setUint32(L+j.offset.env,e,!0),A.setUint32(L+j.offset.finalize_data,f,!0),A.setUint32(L+j.offset.finalize_cb,c,!0),A.setUint32(L+j.offset.call_js_cb,p,!0),l.addCleanupHook(h,j.cleanup,L),j._liveSet.add(L),h.ref(),l.increaseWaitingRequestCounter(),A.setUint32(L+j.offset.async_ref,1,!0),v>>>=0,A.setUint32(v,L,!0),h.clearLastError()):(s(L),b.dispose(),h.setLastError(9))},h.imports.napi.napi_get_threadsafe_function_context=function(e,r){if(!e||!r)return c(),1;e>>>=0,r>>>=0;var t=j.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?(e>>>=0,r>>>=0,j.push(e,r,t)):(c(),1)},h.imports.napi.napi_acquire_threadsafe_function=function(e){return e?(e>>>=0,j.getMutex(e).execute(function(){return 0===j.getState(e)?(j.addThreadCount(e),0):16})):(c(),1)},h.imports.napi.napi_release_threadsafe_function=function(e,r){if(!e)return c(),1;e>>>=0;var t=j.getMutex(e),n=j.getCond(e),a=!1,o=t.execute(function(){return 0===j.getThreadCount(e)?1:(j.subThreadCount(e),0!==j.getThreadCount(e)&&1!==r||0===j.getState(e)&&(1===r&&j.setState(e,1),1===j.getState(e)&&j.getMaxQueueSize(e)>0&&n.signal(),j.send(e)),2!==j.getState(e)||0!==j.getThreadCount(e)||(a=!0),0)});return a&&j.destroy(e),o},h.imports.napi.napi_unref_threadsafe_function=function(e,r){if(!r)return c(),1;var t=(r>>>=0)+j.offset.async_ref,n=t>>>2,a=new Uint32Array(j.ensureBufferFor(t+4)),o=Atomics.load(a,n);return o>0&&(Atomics.store(a,n,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>>>=0)+j.offset.async_ref,n=t>>>2,a=new Uint32Array(j.ensureBufferFor(t+4)),o=Atomics.load(a,n);return o||l.increaseWaitingRequestCounter(),Atomics.store(a,n,o+1),0},h}();return t}function m(e,r,t,n){var a,o=(n=null!=n?n:{}).getMemory,s=n.getTable,i=n.beforeInit;if(null!=o&&"function"!=typeof o)throw new TypeError("options.getMemory is not a function");if(null!=s&&"function"!=typeof s)throw new TypeError("options.getTable is not a function");if(null!=i&&"function"!=typeof i)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=s?s(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(){i&&i({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=i,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.11.1"});
|