@viji-dev/sdk 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Viji SDK
2
2
 
3
- Development environment for [Viji Creative](https://viji.art) scenes. Write scene code in your IDE, preview it live in the browser with real-time parameter controls, audio analysis, video input, and interaction handling — the same execution environment as the Viji platform. Supports Canvas 2D, WebGL, P5.js, and GLSL shaders.
3
+ Development environment for [Viji](https://www.viji.io) scenes. Write scene code in your IDE, preview it live in the browser with real-time parameter controls, audio analysis, video input, and interaction handling — the same execution environment as the Viji platform. Supports Canvas 2D, WebGL, P5.js, and GLSL shaders.
4
4
 
5
5
  ## Installation
6
6
 
@@ -29,26 +29,20 @@ viji create my-scene
29
29
  viji dev
30
30
  ```
31
31
 
32
- Open `http://localhost:3000` in your browser to see the SDK UI. Edit `scenes/my-scene/main.js` in your IDE — changes appear in real time.
32
+ Open `http://localhost:3000` in your browser to see the SDK UI. Edit `scenes/my-scene/main.js` in your IDE — changes appear in real time. Both JS and TS scenes get full autocompletion for the Viji API.
33
33
 
34
34
  ## CLI Commands
35
35
 
36
- ### `viji create <scene-name> [--renderer <type>]`
36
+ ### `viji create <scene-name> [--renderer <type>] [--ts]`
37
37
 
38
38
  Create a new scene in the `scenes/` folder.
39
39
 
40
40
  - `viji create my-scene` — native renderer (Canvas 2D / WebGL), the default
41
41
  - `viji create my-scene --renderer p5` — P5.js renderer
42
42
  - `viji create my-scene --renderer shader` — GLSL fragment shader
43
+ - `viji create my-scene --ts` — TypeScript scene file (works with any renderer)
43
44
 
44
- Creates the following structure:
45
-
46
- ```
47
- scenes/
48
- └── my-scene/
49
- └── main.js # or main.glsl for shader scenes
50
- global.d.ts # generated once for IDE type support
51
- ```
45
+ On the first run, the SDK installs type definitions locally for IDE autocompletion. This creates `node_modules/`, `package.json`, and `global.d.ts` in your workspace — all auto-generated, no manual setup needed.
52
46
 
53
47
  ### `viji dev [--port <port>] [--host <host>] [--open]`
54
48
 
@@ -94,11 +88,11 @@ my-viji-scenes/
94
88
  │ │ └── main.glsl
95
89
  │ └── p5-sketch/
96
90
  │ └── main.js
97
- └── global.d.ts # IDE type support (auto-generated)
91
+ ├── global.d.ts # IDE type support (auto-generated)
92
+ ├── node_modules/ # type definitions (auto-generated)
93
+ └── package.json # auto-generated
98
94
  ```
99
95
 
100
- No configuration files, no `node_modules`, no build tools in your workspace. Everything is handled by the globally installed SDK.
101
-
102
96
  ## License
103
97
 
104
98
  Copyright (c) 2025 Artem Verkhovskiy and Dmitry Manoilenko.
package/bin/viji.js CHANGED
@@ -24,6 +24,7 @@ program
24
24
  .command('create')
25
25
  .argument('<scene-name>', 'Name of the new scene')
26
26
  .option('--renderer <type>', 'Renderer type (native|p5|shader)', 'native')
27
+ .option('--ts', 'Generate TypeScript scene file')
27
28
  .description('Create a new scene in the current workspace')
28
29
  .action(createCommand);
29
30
 
@@ -1,4 +1,4 @@
1
- import{bd as kn}from"./index-BhFxsauQ.js";function jn(ve,ot){for(var Oe=0;Oe<ot.length;Oe++){const Z=ot[Oe];if(typeof Z!="string"&&!Array.isArray(Z)){for(const H in Z)if(H!=="default"&&!(H in ve)){const i=Object.getOwnPropertyDescriptor(Z,H);i&&Object.defineProperty(ve,H,i.get?i:{enumerable:!0,get:()=>Z[H]})}}}return Object.freeze(Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"}))}var Ei={exports:{}};(function(ve,ot){var Oe=(function(){var Z=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(H){H=H||{};var i=typeof H<"u"?H:{},At,Mt;i.ready=new Promise(function(e,t){At=e,Mt=t}),Object.getOwnPropertyDescriptor(i.ready,"_main")||(Object.defineProperty(i.ready,"_main",{configurable:!0,get:function(){f("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_main",{configurable:!0,set:function(){f("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_malloc")||(Object.defineProperty(i.ready,"_malloc",{configurable:!0,get:function(){f("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_malloc",{configurable:!0,set:function(){f("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_free")||(Object.defineProperty(i.ready,"_free",{configurable:!0,get:function(){f("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_free",{configurable:!0,set:function(){f("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackSave")||(Object.defineProperty(i.ready,"_stackSave",{configurable:!0,get:function(){f("You are getting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackSave",{configurable:!0,set:function(){f("You are setting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackRestore")||(Object.defineProperty(i.ready,"_stackRestore",{configurable:!0,get:function(){f("You are getting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackRestore",{configurable:!0,set:function(){f("You are setting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackAlloc")||(Object.defineProperty(i.ready,"_stackAlloc",{configurable:!0,get:function(){f("You are getting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackAlloc",{configurable:!0,set:function(){f("You are setting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___data_end")||(Object.defineProperty(i.ready,"___data_end",{configurable:!0,get:function(){f("You are getting ___data_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___data_end",{configurable:!0,set:function(){f("You are setting ___data_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___wasm_call_ctors")||(Object.defineProperty(i.ready,"___wasm_call_ctors",{configurable:!0,get:function(){f("You are getting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___wasm_call_ctors",{configurable:!0,set:function(){f("You are setting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_fflush")||(Object.defineProperty(i.ready,"_fflush",{configurable:!0,get:function(){f("You are getting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_fflush",{configurable:!0,set:function(){f("You are setting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___errno_location")||(Object.defineProperty(i.ready,"___errno_location",{configurable:!0,get:function(){f("You are getting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___errno_location",{configurable:!0,set:function(){f("You are setting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"__ZSt18uncaught_exceptionv")||(Object.defineProperty(i.ready,"__ZSt18uncaught_exceptionv",{configurable:!0,get:function(){f("You are getting __ZSt18uncaught_exceptionv on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"__ZSt18uncaught_exceptionv",{configurable:!0,set:function(){f("You are setting __ZSt18uncaught_exceptionv on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_setThrew")||(Object.defineProperty(i.ready,"_setThrew",{configurable:!0,get:function(){f("You are getting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_setThrew",{configurable:!0,set:function(){f("You are setting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"onRuntimeInitialized")||(Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,get:function(){f("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,set:function(){f("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));var we={},K;for(K in i)i.hasOwnProperty(K)&&(we[K]=i[K]);var St="./this.program",Ct=function(e,t){throw t},Ti=!0;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var $="";function hi(e){return i.locateFile?i.locateFile(e,$):$+e}var at,gi;{if(document.currentScript&&($=document.currentScript.src),Z&&($=Z),$.indexOf("blob:")!==0?$=$.substr(0,$.lastIndexOf("/")+1):$="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");at=function(t){var r=new XMLHttpRequest;return r.open("GET",t,!1),r.send(null),r.responseText}}var J=i.print||console.log.bind(console),S=i.printErr||console.warn.bind(console);for(K in we)we.hasOwnProperty(K)&&(i[K]=we[K]);we=null,i.arguments&&i.arguments,Object.getOwnPropertyDescriptor(i,"arguments")||Object.defineProperty(i,"arguments",{configurable:!0,get:function(){f("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),i.thisProgram&&(St=i.thisProgram),Object.getOwnPropertyDescriptor(i,"thisProgram")||Object.defineProperty(i,"thisProgram",{configurable:!0,get:function(){f("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),i.quit&&(Ct=i.quit),Object.getOwnPropertyDescriptor(i,"quit")||Object.defineProperty(i,"quit",{configurable:!0,get:function(){f("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),w(typeof i.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),w(typeof i.read>"u","Module.read option was removed (modify read_ in JS)"),w(typeof i.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),w(typeof i.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),w(typeof i.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),w(typeof i.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),Object.getOwnPropertyDescriptor(i,"read")||Object.defineProperty(i,"read",{configurable:!0,get:function(){f("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"readAsync")||Object.defineProperty(i,"readAsync",{configurable:!0,get:function(){f("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"readBinary")||Object.defineProperty(i,"readBinary",{configurable:!0,get:function(){f("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"setWindowTitle")||Object.defineProperty(i,"setWindowTitle",{configurable:!0,get:function(){f("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}});function B(e){B.shown||(B.shown={}),B.shown[e]||(B.shown[e]=1,S(e))}var me;i.wasmBinary&&(me=i.wasmBinary),Object.getOwnPropertyDescriptor(i,"wasmBinary")||Object.defineProperty(i,"wasmBinary",{configurable:!0,get:function(){f("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}});var st;i.noExitRuntime&&(st=i.noExitRuntime),Object.getOwnPropertyDescriptor(i,"noExitRuntime")||Object.defineProperty(i,"noExitRuntime",{configurable:!0,get:function(){f("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),typeof WebAssembly!="object"&&f("no native wasm support detected");var oe,vi=new WebAssembly.Table({initial:4301,maximum:4301,element:"anyfunc"}),Fe=!1;function w(e,t){e||f("Assertion failed: "+t)}var Ft=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ue(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&Ft)return Ft.decode(e.subarray(t,a));for(var s="";t<a;){var c=e[t++];if(!(c&128)){s+=String.fromCharCode(c);continue}var l=e[t++]&63;if((c&224)==192){s+=String.fromCharCode((c&31)<<6|l);continue}var d=e[t++]&63;if((c&240)==224?c=(c&15)<<12|l<<6|d:((c&248)!=240&&B("Invalid UTF-8 leading byte 0x"+c.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),c=(c&7)<<18|l<<12|d<<6|e[t++]&63),c<65536)s+=String.fromCharCode(c);else{var _=c-65536;s+=String.fromCharCode(55296|_>>10,56320|_&1023)}}return s}function ae(e,t){return e?ue(X,e,t):""}function ft(e,t,r,n){if(!(n>0))return 0;for(var a=r,s=r+n-1,c=0;c<e.length;++c){var l=e.charCodeAt(c);if(l>=55296&&l<=57343){var d=e.charCodeAt(++c);l=65536+((l&1023)<<10)|d&1023}if(l<=127){if(r>=s)break;t[r++]=l}else if(l<=2047){if(r+1>=s)break;t[r++]=192|l>>6,t[r++]=128|l&63}else if(l<=65535){if(r+2>=s)break;t[r++]=224|l>>12,t[r++]=128|l>>6&63,t[r++]=128|l&63}else{if(r+3>=s)break;l>=2097152&&B("Invalid Unicode code point 0x"+l.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[r++]=240|l>>18,t[r++]=128|l>>12&63,t[r++]=128|l>>6&63,t[r++]=128|l&63}}return t[r]=0,r-a}function It(e,t,r){return w(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ft(e,X,t,r)}function Ie(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++r)&1023),n<=127?++t:n<=2047?t+=2:n<=65535?t+=3:t+=4}return t}var Nt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Oi(e,t){w(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&Xe[n];)++n;if(r=n<<1,r-e>32&&Nt)return Nt.decode(X.subarray(e,r));for(var s=0,c="";;){var l=_e[e+s*2>>1];if(l==0||s==t/2)return c;++s,c+=String.fromCharCode(l)}}function wi(e,t,r){if(w(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),w(typeof r=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<2)return 0;r-=2;for(var n=t,a=r<e.length*2?r/2:e.length,s=0;s<a;++s){var c=e.charCodeAt(s);_e[t>>1]=c,t+=2}return _e[t>>1]=0,t-n}function mi(e){return e.length*2}function Di(e,t){w(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var a=v[e+r*4>>2];if(a==0)break;if(++r,a>=65536){var s=a-65536;n+=String.fromCharCode(55296|s>>10,56320|s&1023)}else n+=String.fromCharCode(a)}return n}function Ri(e,t,r){if(w(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),w(typeof r=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,s=0;s<e.length;++s){var c=e.charCodeAt(s);if(c>=55296&&c<=57343){var l=e.charCodeAt(++s);c=65536+((c&1023)<<10)|l&1023}if(v[t>>2]=c,t+=4,t+4>a)break}return v[t>>2]=0,t-n}function Pi(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function bi(e,t){w(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),U.set(e,t)}function Ai(e,t,r){for(var n=0;n<e.length;++n)w(e.charCodeAt(n)===e.charCodeAt(n)&255),U[t++>>0]=e.charCodeAt(n);U[t>>0]=0}var Ne=65536;function Mi(e,t){return e%t>0&&(e+=t-e%t),e}var ee,U,X,_e,Xe,v,k,Xt,Ut;function kt(e){ee=e,i.HEAP8=U=new Int8Array(e),i.HEAP16=_e=new Int16Array(e),i.HEAP32=v=new Int32Array(e),i.HEAPU8=X=new Uint8Array(e),i.HEAPU16=Xe=new Uint16Array(e),i.HEAPU32=k=new Uint32Array(e),i.HEAPF32=Xt=new Float32Array(e),i.HEAPF64=Ut=new Float64Array(e)}var Si=5713952,De=471072,jt=5713952,Ci=470912;w(Si%16===0,"stack must start aligned"),w(jt%16===0,"heap must start aligned");var ct=5242880;i.TOTAL_STACK&&w(ct===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Re=i.INITIAL_MEMORY||16777216;Object.getOwnPropertyDescriptor(i,"INITIAL_MEMORY")||Object.defineProperty(i,"INITIAL_MEMORY",{configurable:!0,get:function(){f("Module.INITIAL_MEMORY has been replaced with plain INITIAL_INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),w(Re>=ct,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Re+"! (TOTAL_STACK="+ct+")"),w(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!==void 0&&Int32Array.prototype.set!==void 0,"JS engine does not provide full typed array support"),i.wasmMemory?oe=i.wasmMemory:oe=new WebAssembly.Memory({initial:Re/Ne,maximum:2147483648/Ne}),oe&&(ee=oe.buffer),Re=ee.byteLength,w(Re%Ne===0),w(65536%Ne===0),kt(ee),v[Ci>>2]=jt;function xt(){w((De&3)==0),k[(De>>2)+1]=34821223,k[(De>>2)+2]=2310721022,v[0]=1668509029}function pe(){var e=k[(De>>2)+1],t=k[(De>>2)+2];(e!=34821223||t!=2310721022)&&f("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+t.toString(16)+" "+e.toString(16)),v[0]!==1668509029&&f("Runtime error: The application has corrupted its heap memory area (address zero)!")}(function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian!"})();function Ue(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(i);continue}var r=t.func;typeof r=="number"?t.arg===void 0?i.dynCall_v(r):i.dynCall_vi(r,t.arg):r(t.arg===void 0?null:t.arg)}}var Ht=[],Lt=[],Fi=[],Qt=[],lt=!1,Bt=!1;function Ii(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)ji(i.preRun.shift());Ue(Ht)}function Ni(){pe(),w(!lt),lt=!0,!i.noFSInit&&!o.init.initialized&&o.init(),Ue(Lt)}function Xi(){pe(),o.ignorePermissions=!1,Ue(Fi)}function Ui(){pe(),Bt=!0}function ki(){if(pe(),i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xi(i.postRun.shift());Ue(Qt)}function ji(e){Ht.unshift(e)}function xi(e){Qt.unshift(e)}w(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var dt=Math.abs,ke=Math.ceil,je=Math.floor,ut=Math.min,se=0,fe=null,Pe=null,Ee={};function Hi(e){for(var t=e;;){if(!Ee[e])return e;e=t+Math.random()}}function Wt(e){se++,i.monitorRunDependencies&&i.monitorRunDependencies(se),e?(w(!Ee[e]),Ee[e]=1,fe===null&&typeof setInterval<"u"&&(fe=setInterval(function(){if(Fe){clearInterval(fe),fe=null;return}var t=!1;for(var r in Ee)t||(t=!0,S("still waiting on run dependencies:")),S("dependency: "+r);t&&S("(end of list)")},1e4))):S("warning: run dependency added without ID")}function _t(e){if(se--,i.monitorRunDependencies&&i.monitorRunDependencies(se),e?(w(Ee[e]),delete Ee[e]):S("warning: run dependency removed without ID"),se==0&&(fe!==null&&(clearInterval(fe),fe=null),Pe)){var t=Pe;Pe=null,t()}}i.preloadedImages={},i.preloadedAudios={};function f(e){i.onAbort&&i.onAbort(e),e+="",J(e),S(e),Fe=!0;var t="abort("+e+") at "+Gt();throw e=t,new WebAssembly.RuntimeError(e)}function Li(e,t){return String.prototype.startsWith?e.startsWith(t):e.indexOf(t)===0}var Qi="data:application/octet-stream;base64,";function $t(e){return Li(e,Qi)}function u(e,t){return function(){var r=e,n=t;return n=i.asm,w(lt,"native function `"+r+"` called before runtime initialization"),w(!Bt,"native function `"+r+"` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n[e]||w(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}var ce="essentia-wasm.web.wasm";$t(ce)||(ce=hi(ce));function Yt(){try{if(me)return new Uint8Array(me);if(!gi)throw"both async and sync fetching of the wasm failed"}catch(e){f(e)}}function Bi(){return!me&&Ti&&typeof fetch=="function"?fetch(ce,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ce+"'";return e.arrayBuffer()}).catch(function(){return Yt()}):new Promise(function(e,t){e(Yt())})}function Wi(){var e={env:pi,wasi_snapshot_preview1:pi};function t(l,d){var _=l.exports;i.asm=_,_t("wasm-instantiate")}Wt("wasm-instantiate");var r=i;function n(l){w(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(l.instance)}function a(l){return Bi().then(function(d){return WebAssembly.instantiate(d,e)}).then(l,function(d){S("failed to asynchronously prepare wasm: "+d),f(d)})}function s(){if(!me&&typeof WebAssembly.instantiateStreaming=="function"&&!$t(ce)&&typeof fetch=="function")fetch(ce,{credentials:"same-origin"}).then(function(l){var d=WebAssembly.instantiateStreaming(l,e);return d.then(n,function(_){return S("wasm streaming compile failed: "+_),S("falling back to ArrayBuffer instantiation"),a(n)})});else return a(n)}if(i.instantiateWasm)try{var c=i.instantiateWasm(e,t);return c}catch(l){return S("Module.instantiateWasm callback failed with error: "+l),!1}return s(),{}}var I,Y;Lt.push({func:function(){Cn()}});function $i(e){return B("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function zt(e){var t=/\b_Z[\w\d_]+/g;return e.replace(t,function(r){var n=$i(r);return r===n?r:n+" ["+r+"]"})}function Yi(){var e=new Error;if(!e.stack){try{throw new Error}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function Gt(){var e=Yi();return i.extraStackTrace&&(e+=`
1
+ import{bd as kn}from"./index-DjBaYzeu.js";function jn(ve,ot){for(var Oe=0;Oe<ot.length;Oe++){const Z=ot[Oe];if(typeof Z!="string"&&!Array.isArray(Z)){for(const H in Z)if(H!=="default"&&!(H in ve)){const i=Object.getOwnPropertyDescriptor(Z,H);i&&Object.defineProperty(ve,H,i.get?i:{enumerable:!0,get:()=>Z[H]})}}}return Object.freeze(Object.defineProperty(ve,Symbol.toStringTag,{value:"Module"}))}var Ei={exports:{}};(function(ve,ot){var Oe=(function(){var Z=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(H){H=H||{};var i=typeof H<"u"?H:{},At,Mt;i.ready=new Promise(function(e,t){At=e,Mt=t}),Object.getOwnPropertyDescriptor(i.ready,"_main")||(Object.defineProperty(i.ready,"_main",{configurable:!0,get:function(){f("You are getting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_main",{configurable:!0,set:function(){f("You are setting _main on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_malloc")||(Object.defineProperty(i.ready,"_malloc",{configurable:!0,get:function(){f("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_malloc",{configurable:!0,set:function(){f("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_free")||(Object.defineProperty(i.ready,"_free",{configurable:!0,get:function(){f("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_free",{configurable:!0,set:function(){f("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackSave")||(Object.defineProperty(i.ready,"_stackSave",{configurable:!0,get:function(){f("You are getting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackSave",{configurable:!0,set:function(){f("You are setting _stackSave on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackRestore")||(Object.defineProperty(i.ready,"_stackRestore",{configurable:!0,get:function(){f("You are getting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackRestore",{configurable:!0,set:function(){f("You are setting _stackRestore on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_stackAlloc")||(Object.defineProperty(i.ready,"_stackAlloc",{configurable:!0,get:function(){f("You are getting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_stackAlloc",{configurable:!0,set:function(){f("You are setting _stackAlloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___data_end")||(Object.defineProperty(i.ready,"___data_end",{configurable:!0,get:function(){f("You are getting ___data_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___data_end",{configurable:!0,set:function(){f("You are setting ___data_end on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___wasm_call_ctors")||(Object.defineProperty(i.ready,"___wasm_call_ctors",{configurable:!0,get:function(){f("You are getting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___wasm_call_ctors",{configurable:!0,set:function(){f("You are setting ___wasm_call_ctors on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_fflush")||(Object.defineProperty(i.ready,"_fflush",{configurable:!0,get:function(){f("You are getting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_fflush",{configurable:!0,set:function(){f("You are setting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___errno_location")||(Object.defineProperty(i.ready,"___errno_location",{configurable:!0,get:function(){f("You are getting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___errno_location",{configurable:!0,set:function(){f("You are setting ___errno_location on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"__ZSt18uncaught_exceptionv")||(Object.defineProperty(i.ready,"__ZSt18uncaught_exceptionv",{configurable:!0,get:function(){f("You are getting __ZSt18uncaught_exceptionv on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"__ZSt18uncaught_exceptionv",{configurable:!0,set:function(){f("You are setting __ZSt18uncaught_exceptionv on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_setThrew")||(Object.defineProperty(i.ready,"_setThrew",{configurable:!0,get:function(){f("You are getting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_setThrew",{configurable:!0,set:function(){f("You are setting _setThrew on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"onRuntimeInitialized")||(Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,get:function(){f("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,set:function(){f("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));var we={},K;for(K in i)i.hasOwnProperty(K)&&(we[K]=i[K]);var St="./this.program",Ct=function(e,t){throw t},Ti=!0;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)");var $="";function hi(e){return i.locateFile?i.locateFile(e,$):$+e}var at,gi;{if(document.currentScript&&($=document.currentScript.src),Z&&($=Z),$.indexOf("blob:")!==0?$=$.substr(0,$.lastIndexOf("/")+1):$="",!(typeof window=="object"||typeof importScripts=="function"))throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");at=function(t){var r=new XMLHttpRequest;return r.open("GET",t,!1),r.send(null),r.responseText}}var J=i.print||console.log.bind(console),S=i.printErr||console.warn.bind(console);for(K in we)we.hasOwnProperty(K)&&(i[K]=we[K]);we=null,i.arguments&&i.arguments,Object.getOwnPropertyDescriptor(i,"arguments")||Object.defineProperty(i,"arguments",{configurable:!0,get:function(){f("Module.arguments has been replaced with plain arguments_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),i.thisProgram&&(St=i.thisProgram),Object.getOwnPropertyDescriptor(i,"thisProgram")||Object.defineProperty(i,"thisProgram",{configurable:!0,get:function(){f("Module.thisProgram has been replaced with plain thisProgram (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),i.quit&&(Ct=i.quit),Object.getOwnPropertyDescriptor(i,"quit")||Object.defineProperty(i,"quit",{configurable:!0,get:function(){f("Module.quit has been replaced with plain quit_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),w(typeof i.memoryInitializerPrefixURL>"u","Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.pthreadMainPrefixURL>"u","Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.cdInitializerPrefixURL>"u","Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),w(typeof i.filePackagePrefixURL>"u","Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),w(typeof i.read>"u","Module.read option was removed (modify read_ in JS)"),w(typeof i.readAsync>"u","Module.readAsync option was removed (modify readAsync in JS)"),w(typeof i.readBinary>"u","Module.readBinary option was removed (modify readBinary in JS)"),w(typeof i.setWindowTitle>"u","Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),w(typeof i.TOTAL_MEMORY>"u","Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),Object.getOwnPropertyDescriptor(i,"read")||Object.defineProperty(i,"read",{configurable:!0,get:function(){f("Module.read has been replaced with plain read_ (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"readAsync")||Object.defineProperty(i,"readAsync",{configurable:!0,get:function(){f("Module.readAsync has been replaced with plain readAsync (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"readBinary")||Object.defineProperty(i,"readBinary",{configurable:!0,get:function(){f("Module.readBinary has been replaced with plain readBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),Object.getOwnPropertyDescriptor(i,"setWindowTitle")||Object.defineProperty(i,"setWindowTitle",{configurable:!0,get:function(){f("Module.setWindowTitle has been replaced with plain setWindowTitle (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}});function B(e){B.shown||(B.shown={}),B.shown[e]||(B.shown[e]=1,S(e))}var me;i.wasmBinary&&(me=i.wasmBinary),Object.getOwnPropertyDescriptor(i,"wasmBinary")||Object.defineProperty(i,"wasmBinary",{configurable:!0,get:function(){f("Module.wasmBinary has been replaced with plain wasmBinary (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}});var st;i.noExitRuntime&&(st=i.noExitRuntime),Object.getOwnPropertyDescriptor(i,"noExitRuntime")||Object.defineProperty(i,"noExitRuntime",{configurable:!0,get:function(){f("Module.noExitRuntime has been replaced with plain noExitRuntime (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),typeof WebAssembly!="object"&&f("no native wasm support detected");var oe,vi=new WebAssembly.Table({initial:4301,maximum:4301,element:"anyfunc"}),Fe=!1;function w(e,t){e||f("Assertion failed: "+t)}var Ft=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function ue(e,t,r){for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.subarray&&Ft)return Ft.decode(e.subarray(t,a));for(var s="";t<a;){var c=e[t++];if(!(c&128)){s+=String.fromCharCode(c);continue}var l=e[t++]&63;if((c&224)==192){s+=String.fromCharCode((c&31)<<6|l);continue}var d=e[t++]&63;if((c&240)==224?c=(c&15)<<12|l<<6|d:((c&248)!=240&&B("Invalid UTF-8 leading byte 0x"+c.toString(16)+" encountered when deserializing a UTF-8 string on the asm.js/wasm heap to a JS string!"),c=(c&7)<<18|l<<12|d<<6|e[t++]&63),c<65536)s+=String.fromCharCode(c);else{var _=c-65536;s+=String.fromCharCode(55296|_>>10,56320|_&1023)}}return s}function ae(e,t){return e?ue(X,e,t):""}function ft(e,t,r,n){if(!(n>0))return 0;for(var a=r,s=r+n-1,c=0;c<e.length;++c){var l=e.charCodeAt(c);if(l>=55296&&l<=57343){var d=e.charCodeAt(++c);l=65536+((l&1023)<<10)|d&1023}if(l<=127){if(r>=s)break;t[r++]=l}else if(l<=2047){if(r+1>=s)break;t[r++]=192|l>>6,t[r++]=128|l&63}else if(l<=65535){if(r+2>=s)break;t[r++]=224|l>>12,t[r++]=128|l>>6&63,t[r++]=128|l&63}else{if(r+3>=s)break;l>=2097152&&B("Invalid Unicode code point 0x"+l.toString(16)+" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF)."),t[r++]=240|l>>18,t[r++]=128|l>>12&63,t[r++]=128|l>>6&63,t[r++]=128|l&63}}return t[r]=0,r-a}function It(e,t,r){return w(typeof r=="number","stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),ft(e,X,t,r)}function Ie(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++r)&1023),n<=127?++t:n<=2047?t+=2:n<=65535?t+=3:t+=4}return t}var Nt=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function Oi(e,t){w(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&Xe[n];)++n;if(r=n<<1,r-e>32&&Nt)return Nt.decode(X.subarray(e,r));for(var s=0,c="";;){var l=_e[e+s*2>>1];if(l==0||s==t/2)return c;++s,c+=String.fromCharCode(l)}}function wi(e,t,r){if(w(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),w(typeof r=="number","stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<2)return 0;r-=2;for(var n=t,a=r<e.length*2?r/2:e.length,s=0;s<a;++s){var c=e.charCodeAt(s);_e[t>>1]=c,t+=2}return _e[t>>1]=0,t-n}function mi(e){return e.length*2}function Di(e,t){w(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var a=v[e+r*4>>2];if(a==0)break;if(++r,a>=65536){var s=a-65536;n+=String.fromCharCode(55296|s>>10,56320|s&1023)}else n+=String.fromCharCode(a)}return n}function Ri(e,t,r){if(w(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),w(typeof r=="number","stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r===void 0&&(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,s=0;s<e.length;++s){var c=e.charCodeAt(s);if(c>=55296&&c<=57343){var l=e.charCodeAt(++s);c=65536+((c&1023)<<10)|l&1023}if(v[t>>2]=c,t+=4,t+4>a)break}return v[t>>2]=0,t-n}function Pi(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function bi(e,t){w(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),U.set(e,t)}function Ai(e,t,r){for(var n=0;n<e.length;++n)w(e.charCodeAt(n)===e.charCodeAt(n)&255),U[t++>>0]=e.charCodeAt(n);U[t>>0]=0}var Ne=65536;function Mi(e,t){return e%t>0&&(e+=t-e%t),e}var ee,U,X,_e,Xe,v,k,Xt,Ut;function kt(e){ee=e,i.HEAP8=U=new Int8Array(e),i.HEAP16=_e=new Int16Array(e),i.HEAP32=v=new Int32Array(e),i.HEAPU8=X=new Uint8Array(e),i.HEAPU16=Xe=new Uint16Array(e),i.HEAPU32=k=new Uint32Array(e),i.HEAPF32=Xt=new Float32Array(e),i.HEAPF64=Ut=new Float64Array(e)}var Si=5713952,De=471072,jt=5713952,Ci=470912;w(Si%16===0,"stack must start aligned"),w(jt%16===0,"heap must start aligned");var ct=5242880;i.TOTAL_STACK&&w(ct===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Re=i.INITIAL_MEMORY||16777216;Object.getOwnPropertyDescriptor(i,"INITIAL_MEMORY")||Object.defineProperty(i,"INITIAL_MEMORY",{configurable:!0,get:function(){f("Module.INITIAL_MEMORY has been replaced with plain INITIAL_INITIAL_MEMORY (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}}),w(Re>=ct,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Re+"! (TOTAL_STACK="+ct+")"),w(typeof Int32Array<"u"&&typeof Float64Array<"u"&&Int32Array.prototype.subarray!==void 0&&Int32Array.prototype.set!==void 0,"JS engine does not provide full typed array support"),i.wasmMemory?oe=i.wasmMemory:oe=new WebAssembly.Memory({initial:Re/Ne,maximum:2147483648/Ne}),oe&&(ee=oe.buffer),Re=ee.byteLength,w(Re%Ne===0),w(65536%Ne===0),kt(ee),v[Ci>>2]=jt;function xt(){w((De&3)==0),k[(De>>2)+1]=34821223,k[(De>>2)+2]=2310721022,v[0]=1668509029}function pe(){var e=k[(De>>2)+1],t=k[(De>>2)+2];(e!=34821223||t!=2310721022)&&f("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+t.toString(16)+" "+e.toString(16)),v[0]!==1668509029&&f("Runtime error: The application has corrupted its heap memory area (address zero)!")}(function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,t[0]!==115||t[1]!==99)throw"Runtime error: expected the system to be little-endian!"})();function Ue(e){for(;e.length>0;){var t=e.shift();if(typeof t=="function"){t(i);continue}var r=t.func;typeof r=="number"?t.arg===void 0?i.dynCall_v(r):i.dynCall_vi(r,t.arg):r(t.arg===void 0?null:t.arg)}}var Ht=[],Lt=[],Fi=[],Qt=[],lt=!1,Bt=!1;function Ii(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)ji(i.preRun.shift());Ue(Ht)}function Ni(){pe(),w(!lt),lt=!0,!i.noFSInit&&!o.init.initialized&&o.init(),Ue(Lt)}function Xi(){pe(),o.ignorePermissions=!1,Ue(Fi)}function Ui(){pe(),Bt=!0}function ki(){if(pe(),i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)xi(i.postRun.shift());Ue(Qt)}function ji(e){Ht.unshift(e)}function xi(e){Qt.unshift(e)}w(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),w(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var dt=Math.abs,ke=Math.ceil,je=Math.floor,ut=Math.min,se=0,fe=null,Pe=null,Ee={};function Hi(e){for(var t=e;;){if(!Ee[e])return e;e=t+Math.random()}}function Wt(e){se++,i.monitorRunDependencies&&i.monitorRunDependencies(se),e?(w(!Ee[e]),Ee[e]=1,fe===null&&typeof setInterval<"u"&&(fe=setInterval(function(){if(Fe){clearInterval(fe),fe=null;return}var t=!1;for(var r in Ee)t||(t=!0,S("still waiting on run dependencies:")),S("dependency: "+r);t&&S("(end of list)")},1e4))):S("warning: run dependency added without ID")}function _t(e){if(se--,i.monitorRunDependencies&&i.monitorRunDependencies(se),e?(w(Ee[e]),delete Ee[e]):S("warning: run dependency removed without ID"),se==0&&(fe!==null&&(clearInterval(fe),fe=null),Pe)){var t=Pe;Pe=null,t()}}i.preloadedImages={},i.preloadedAudios={};function f(e){i.onAbort&&i.onAbort(e),e+="",J(e),S(e),Fe=!0;var t="abort("+e+") at "+Gt();throw e=t,new WebAssembly.RuntimeError(e)}function Li(e,t){return String.prototype.startsWith?e.startsWith(t):e.indexOf(t)===0}var Qi="data:application/octet-stream;base64,";function $t(e){return Li(e,Qi)}function u(e,t){return function(){var r=e,n=t;return n=i.asm,w(lt,"native function `"+r+"` called before runtime initialization"),w(!Bt,"native function `"+r+"` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)"),n[e]||w(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}var ce="essentia-wasm.web.wasm";$t(ce)||(ce=hi(ce));function Yt(){try{if(me)return new Uint8Array(me);if(!gi)throw"both async and sync fetching of the wasm failed"}catch(e){f(e)}}function Bi(){return!me&&Ti&&typeof fetch=="function"?fetch(ce,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+ce+"'";return e.arrayBuffer()}).catch(function(){return Yt()}):new Promise(function(e,t){e(Yt())})}function Wi(){var e={env:pi,wasi_snapshot_preview1:pi};function t(l,d){var _=l.exports;i.asm=_,_t("wasm-instantiate")}Wt("wasm-instantiate");var r=i;function n(l){w(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(l.instance)}function a(l){return Bi().then(function(d){return WebAssembly.instantiate(d,e)}).then(l,function(d){S("failed to asynchronously prepare wasm: "+d),f(d)})}function s(){if(!me&&typeof WebAssembly.instantiateStreaming=="function"&&!$t(ce)&&typeof fetch=="function")fetch(ce,{credentials:"same-origin"}).then(function(l){var d=WebAssembly.instantiateStreaming(l,e);return d.then(n,function(_){return S("wasm streaming compile failed: "+_),S("falling back to ArrayBuffer instantiation"),a(n)})});else return a(n)}if(i.instantiateWasm)try{var c=i.instantiateWasm(e,t);return c}catch(l){return S("Module.instantiateWasm callback failed with error: "+l),!1}return s(),{}}var I,Y;Lt.push({func:function(){Cn()}});function $i(e){return B("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function zt(e){var t=/\b_Z[\w\d_]+/g;return e.replace(t,function(r){var n=$i(r);return r===n?r:n+" ["+r+"]"})}function Yi(){var e=new Error;if(!e.stack){try{throw new Error}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function Gt(){var e=Yi();return i.extraStackTrace&&(e+=`
2
2
  `+i.extraStackTrace()),zt(e)}function zi(e,t,r,n){f("Assertion failed: "+ae(e)+", at: "+[t?ae(t):"unknown filename",r,n?ae(n):"unknown function"])}function Gi(e){return rt(e)}function Vi(e,t){B("atexit() called, but EXIT_RUNTIME is not set, so atexits() will not be called. set EXIT_RUNTIME to 1 (see the FAQ)")}function qi(e,t){return Vi()}function Zi(e,t,r){throw S("Compiled code throwing an exception, "+[e,t,r]),"uncaught_exception"in Pt?Pt.uncaught_exceptions++:Pt.uncaught_exceptions=1,e+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function Ki(){f("stack overflow")}function xe(e){return v[In()>>2]=e,e}function Ji(e,t){return xe(63),-1}var P={splitPath:function(e){var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:function(e,t){for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];a==="."?e.splice(n,1):a===".."?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:function(e){var t=e.charAt(0)==="/",r=e.substr(-1)==="/";return e=P.normalizeArray(e.split("/").filter(function(n){return!!n}),!t).join("/"),!e&&!t&&(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:function(e){var t=P.splitPath(e),r=t[0],n=t[1];return!r&&!n?".":(n&&(n=n.substr(0,n.length-1)),r+n)},basename:function(e){if(e==="/")return"/";var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},extname:function(e){return P.splitPath(e)[3]},join:function(){var e=Array.prototype.slice.call(arguments,0);return P.normalize(e.join("/"))},join2:function(e,t){return P.normalize(e+"/"+t)}},W={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:o.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,t=n.charAt(0)==="/"}return e=P.normalizeArray(e.split("/").filter(function(a){return!!a}),!t).join("/"),(t?"/":"")+e||"."},relative:function(e,t){e=W.resolve(e).substr(1),t=W.resolve(t).substr(1);function r(_){for(var p=0;p<_.length&&_[p]==="";p++);for(var h=_.length-1;h>=0&&_[h]==="";h--);return p>h?[]:_.slice(p,h-p+1)}for(var n=r(e.split("/")),a=r(t.split("/")),s=Math.min(n.length,a.length),c=s,l=0;l<s;l++)if(n[l]!==a[l]){c=l;break}for(var d=[],l=c;l<n.length;l++)d.push("..");return d=d.concat(a.slice(c)),d.join("/")}},te={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){te.ttys[e]={input:[],output:[],ops:t},o.registerDevice(e,te.stream_ops)},stream_ops:{open:function(e){var t=te.ttys[e.node.rdev];if(!t)throw new o.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.get_char)throw new o.ErrnoError(60);for(var s=0,c=0;c<n;c++){var l;try{l=e.tty.ops.get_char(e.tty)}catch{throw new o.ErrnoError(29)}if(l===void 0&&s===0)throw new o.ErrnoError(6);if(l==null)break;s++,t[r+c]=l}return s&&(e.node.timestamp=Date.now()),s},write:function(e,t,r,n,a){if(!e.tty||!e.tty.ops.put_char)throw new o.ErrnoError(60);try{for(var s=0;s<n;s++)e.tty.ops.put_char(e.tty,t[r+s])}catch{throw new o.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),s}},default_tty_ops:{get_char:function(e){if(!e.input.length){var t=null;if(typeof window<"u"&&typeof window.prompt=="function"?(t=window.prompt("Input: "),t!==null&&(t+=`
3
3
  `)):typeof readline=="function"&&(t=readline(),t!==null&&(t+=`
4
4
  `)),!t)return null;e.input=it(t,!0)}return e.input.shift()},put_char:function(e,t){t===null||t===10?(J(ue(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(J(ue(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){t===null||t===10?(S(ue(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(S(ue(e.output,0)),e.output=[])}}},m={ops_table:null,mount:function(e){return m.createNode(null,"/",16895,0)},createNode:function(e,t,r,n){if(o.isBlkdev(r)||o.isFIFO(r))throw new o.ErrnoError(63);m.ops_table||(m.ops_table={dir:{node:{getattr:m.node_ops.getattr,setattr:m.node_ops.setattr,lookup:m.node_ops.lookup,mknod:m.node_ops.mknod,rename:m.node_ops.rename,unlink:m.node_ops.unlink,rmdir:m.node_ops.rmdir,readdir:m.node_ops.readdir,symlink:m.node_ops.symlink},stream:{llseek:m.stream_ops.llseek}},file:{node:{getattr:m.node_ops.getattr,setattr:m.node_ops.setattr},stream:{llseek:m.stream_ops.llseek,read:m.stream_ops.read,write:m.stream_ops.write,allocate:m.stream_ops.allocate,mmap:m.stream_ops.mmap,msync:m.stream_ops.msync}},link:{node:{getattr:m.node_ops.getattr,setattr:m.node_ops.setattr,readlink:m.node_ops.readlink},stream:{}},chrdev:{node:{getattr:m.node_ops.getattr,setattr:m.node_ops.setattr},stream:o.chrdev_stream_ops}});var a=o.createNode(e,t,r,n);return o.isDir(a.mode)?(a.node_ops=m.ops_table.dir.node,a.stream_ops=m.ops_table.dir.stream,a.contents={}):o.isFile(a.mode)?(a.node_ops=m.ops_table.file.node,a.stream_ops=m.ops_table.file.stream,a.usedBytes=0,a.contents=null):o.isLink(a.mode)?(a.node_ops=m.ops_table.link.node,a.stream_ops=m.ops_table.link.stream):o.isChrdev(a.mode)&&(a.node_ops=m.ops_table.chrdev.node,a.stream_ops=m.ops_table.chrdev.stream),a.timestamp=Date.now(),e&&(e.contents[t]=a),a},getFileDataAsRegularArray:function(e){if(e.contents&&e.contents.subarray){for(var t=[],r=0;r<e.usedBytes;++r)t.push(e.contents[r]);return t}return e.contents},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){var n=1024*1024;t=Math.max(t,r*(r<n?2:1.125)>>>0),r!=0&&(t=Math.max(t,256));var a=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(a.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t){if(t==0){e.contents=null,e.usedBytes=0;return}if(!e.contents||e.contents.subarray){var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t;return}if(e.contents||(e.contents=[]),e.contents.length>t)e.contents.length=t;else for(;e.contents.length<t;)e.contents.push(0);e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=o.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,o.isDir(e.mode)?t.size=4096:o.isFile(e.mode)?t.size=e.usedBytes:o.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&m.resizeFileStorage(e,t.size)},lookup:function(e,t){throw o.genericErrors[44]},mknod:function(e,t,r,n){return m.createNode(e,t,r,n)},rename:function(e,t,r){if(o.isDir(e.mode)){var n;try{n=o.lookupNode(t,r)}catch{}if(n)for(var a in n.contents)throw new o.ErrnoError(55)}delete e.parent.contents[e.name],e.name=r,t.contents[r]=e,e.parent=t},unlink:function(e,t){delete e.contents[t]},rmdir:function(e,t){var r=o.lookupNode(e,t);for(var n in r.contents)throw new o.ErrnoError(55);delete e.contents[t]},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var n=m.createNode(e,t,41471,0);return n.link=r,n},readlink:function(e){if(!o.isLink(e.mode))throw new o.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,n,a){var s=e.node.contents;if(a>=e.node.usedBytes)return 0;var c=Math.min(e.node.usedBytes-a,n);if(w(c>=0),c>8&&s.subarray)t.set(s.subarray(a,a+c),r);else for(var l=0;l<c;l++)t[r+l]=s[a+l];return c},write:function(e,t,r,n,a,s){if(w(!(t instanceof ArrayBuffer)),t.buffer===U.buffer&&(s&&B("file packager has copied file data into memory, but in memory growth we are forced to copy it again (see --no-heap-copy)"),s=!1),!n)return 0;var c=e.node;if(c.timestamp=Date.now(),t.subarray&&(!c.contents||c.contents.subarray)){if(s)return w(a===0,"canOwn must imply no weird position inside the file"),c.contents=t.subarray(r,r+n),c.usedBytes=n,n;if(c.usedBytes===0&&a===0)return c.contents=t.slice(r,r+n),c.usedBytes=n,n;if(a+n<=c.usedBytes)return c.contents.set(t.subarray(r,r+n),a),n}if(m.expandFileStorage(c,a+n),c.contents.subarray&&t.subarray)c.contents.set(t.subarray(r,r+n),a);else for(var l=0;l<n;l++)c.contents[a+l]=t[r+l];return c.usedBytes=Math.max(c.usedBytes,a+n),n},llseek:function(e,t,r){var n=t;if(r===1?n+=e.position:r===2&&o.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new o.ErrnoError(28);return n},allocate:function(e,t,r){m.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap:function(e,t,r,n,a,s){if(w(t===0),!o.isFile(e.node.mode))throw new o.ErrnoError(43);var c,l,d=e.node.contents;if(!(s&2)&&d.buffer===ee)l=!1,c=d.byteOffset;else{if((n>0||n+r<d.length)&&(d.subarray?d=d.subarray(n,n+r):d=Array.prototype.slice.call(d,n,n+r)),l=!0,c=rt(r),!c)throw new o.ErrnoError(48);U.set(d,c)}return{ptr:c,allocated:l}},msync:function(e,t,r,n,a){if(!o.isFile(e.node.mode))throw new o.ErrnoError(43);return a&2||m.stream_ops.write(e,t,0,n,r,!1),0}}},er={0:"Success",1:"Arg list too long",2:"Permission denied",3:"Address already in use",4:"Address not available",5:"Address family not supported by protocol family",6:"No more processes",7:"Socket already connected",8:"Bad file number",9:"Trying to read unreadable message",10:"Mount device busy",11:"Operation canceled",12:"No children",13:"Connection aborted",14:"Connection refused",15:"Connection reset by peer",16:"File locking deadlock error",17:"Destination address required",18:"Math arg out of domain of func",19:"Quota exceeded",20:"File exists",21:"Bad address",22:"File too large",23:"Host is unreachable",24:"Identifier removed",25:"Illegal byte sequence",26:"Connection already in progress",27:"Interrupted system call",28:"Invalid argument",29:"I/O error",30:"Socket is already connected",31:"Is a directory",32:"Too many symbolic links",33:"Too many open files",34:"Too many links",35:"Message too long",36:"Multihop attempted",37:"File or path name too long",38:"Network interface is not configured",39:"Connection reset by network",40:"Network is unreachable",41:"Too many open files in system",42:"No buffer space available",43:"No such device",44:"No such file or directory",45:"Exec format error",46:"No record locks available",47:"The link has been severed",48:"Not enough core",49:"No message of desired type",50:"Protocol not available",51:"No space left on device",52:"Function not implemented",53:"Socket is not connected",54:"Not a directory",55:"Directory not empty",56:"State not recoverable",57:"Socket operation on non-socket",59:"Not a typewriter",60:"No such device or address",61:"Value too large for defined data type",62:"Previous owner died",63:"Not super-user",64:"Broken pipe",65:"Protocol error",66:"Unknown protocol",67:"Protocol wrong type for socket",68:"Math result not representable",69:"Read only file system",70:"Illegal seek",71:"No such process",72:"Stale file handle",73:"Connection timed out",74:"Text file busy",75:"Cross-device link",100:"Device not a stream",101:"Bad font file fmt",102:"Invalid slot",103:"Invalid request code",104:"No anode",105:"Block device required",106:"Channel number out of range",107:"Level 3 halted",108:"Level 3 reset",109:"Link number out of range",110:"Protocol driver not attached",111:"No CSI structure available",112:"Level 2 halted",113:"Invalid exchange",114:"Invalid request descriptor",115:"Exchange full",116:"No data (for no delay io)",117:"Timer expired",118:"Out of streams resources",119:"Machine is not on the network",120:"Package not installed",121:"The object is remote",122:"Advertise error",123:"Srmount error",124:"Communication error on send",125:"Cross mount point (not really error)",126:"Given log. name not unique",127:"f.d. invalid for this operation",128:"Remote address changed",129:"Can access a needed shared lib",130:"Accessing a corrupted shared lib",131:".lib section in a.out corrupted",132:"Attempting to link in too many libs",133:"Attempting to exec a shared library",135:"Streams pipe error",136:"Too many users",137:"Socket type not supported",138:"Not supported",139:"Protocol family not supported",140:"Can't send after socket shutdown",141:"Too many references",142:"Host is down",148:"No medium (in tape drive)",156:"Level 2 not synchronized"},Vt={EPERM:63,ENOENT:44,ESRCH:71,EINTR:27,EIO:29,ENXIO:60,E2BIG:1,ENOEXEC:45,EBADF:8,ECHILD:12,EAGAIN:6,EWOULDBLOCK:6,ENOMEM:48,EACCES:2,EFAULT:21,ENOTBLK:105,EBUSY:10,EEXIST:20,EXDEV:75,ENODEV:43,ENOTDIR:54,EISDIR:31,EINVAL:28,ENFILE:41,EMFILE:33,ENOTTY:59,ETXTBSY:74,EFBIG:22,ENOSPC:51,ESPIPE:70,EROFS:69,EMLINK:34,EPIPE:64,EDOM:18,ERANGE:68,ENOMSG:49,EIDRM:24,ECHRNG:106,EL2NSYNC:156,EL3HLT:107,EL3RST:108,ELNRNG:109,EUNATCH:110,ENOCSI:111,EL2HLT:112,EDEADLK:16,ENOLCK:46,EBADE:113,EBADR:114,EXFULL:115,ENOANO:104,EBADRQC:103,EBADSLT:102,EDEADLOCK:16,EBFONT:101,ENOSTR:100,ENODATA:116,ETIME:117,ENOSR:118,ENONET:119,ENOPKG:120,EREMOTE:121,ENOLINK:47,EADV:122,ESRMNT:123,ECOMM:124,EPROTO:65,EMULTIHOP:36,EDOTDOT:125,EBADMSG:9,ENOTUNIQ:126,EBADFD:127,EREMCHG:128,ELIBACC:129,ELIBBAD:130,ELIBSCN:131,ELIBMAX:132,ELIBEXEC:133,ENOSYS:52,ENOTEMPTY:55,ENAMETOOLONG:37,ELOOP:32,EOPNOTSUPP:138,EPFNOSUPPORT:139,ECONNRESET:15,ENOBUFS:42,EAFNOSUPPORT:5,EPROTOTYPE:67,ENOTSOCK:57,ENOPROTOOPT:50,ESHUTDOWN:140,ECONNREFUSED:14,EADDRINUSE:3,ECONNABORTED:13,ENETUNREACH:40,ENETDOWN:38,ETIMEDOUT:73,EHOSTDOWN:142,EHOSTUNREACH:23,EINPROGRESS:26,EALREADY:7,EDESTADDRREQ:17,EMSGSIZE:35,EPROTONOSUPPORT:66,ESOCKTNOSUPPORT:137,EADDRNOTAVAIL:4,ENETRESET:39,EISCONN:30,ENOTCONN:53,ETOOMANYREFS:141,EUSERS:136,EDQUOT:19,ESTALE:72,ENOTSUP:138,ENOMEDIUM:148,EILSEQ:25,EOVERFLOW:61,ECANCELED:11,ENOTRECOVERABLE:56,EOWNERDEAD:62,ESTRPIPE:135},o={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof o.ErrnoError))throw e+" : "+Gt();return xe(e.errno)},lookupPath:function(e,t){if(e=W.resolve(o.cwd(),e),t=t||{},!e)return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};for(var n in r)t[n]===void 0&&(t[n]=r[n]);if(t.recurse_count>8)throw new o.ErrnoError(32);for(var a=P.normalizeArray(e.split("/").filter(function(y){return!!y}),!1),s=o.root,c="/",l=0;l<a.length;l++){var d=l===a.length-1;if(d&&t.parent)break;if(s=o.lookupNode(s,a[l]),c=P.join2(c,a[l]),o.isMountpoint(s)&&(!d||d&&t.follow_mount)&&(s=s.mounted.root),!d||t.follow)for(var _=0;o.isLink(s.mode);){var p=o.readlink(c);c=W.resolve(P.dirname(c),p);var h=o.lookupPath(c,{recurse_count:t.recurse_count});if(s=h.node,_++>40)throw new o.ErrnoError(32)}}return{path:c,node:s}},getPath:function(e){for(var t;;){if(o.isRoot(e)){var r=e.mount.mountpoint;return t?r[r.length-1]!=="/"?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:function(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%o.nameTable.length},hashAddNode:function(e){var t=o.hashName(e.parent.id,e.name);e.name_next=o.nameTable[t],o.nameTable[t]=e},hashRemoveNode:function(e){var t=o.hashName(e.parent.id,e.name);if(o.nameTable[t]===e)o.nameTable[t]=e.name_next;else for(var r=o.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:function(e,t){var r=o.mayLookup(e);if(r)throw new o.ErrnoError(r,e);for(var n=o.hashName(e.id,t),a=o.nameTable[n];a;a=a.name_next){var s=a.name;if(a.parent.id===e.id&&s===t)return a}return o.lookup(e,t)},createNode:function(e,t,r,n){var a=new o.FSNode(e,t,r,n);return o.hashAddNode(a),a},destroyNode:function(e){o.hashRemoveNode(e)},isRoot:function(e){return e===e.parent},isMountpoint:function(e){return!!e.mounted},isFile:function(e){return(e&61440)===32768},isDir:function(e){return(e&61440)===16384},isLink:function(e){return(e&61440)===40960},isChrdev:function(e){return(e&61440)===8192},isBlkdev:function(e){return(e&61440)===24576},isFIFO:function(e){return(e&61440)===4096},isSocket:function(e){return(e&49152)===49152},flagModes:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},modeStringToFlags:function(e){var t=o.flagModes[e];if(typeof t>"u")throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:function(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions:function(e,t){return o.ignorePermissions?0:t.indexOf("r")!==-1&&!(e.mode&292)||t.indexOf("w")!==-1&&!(e.mode&146)||t.indexOf("x")!==-1&&!(e.mode&73)?2:0},mayLookup:function(e){var t=o.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:function(e,t){try{var r=o.lookupNode(e,t);return 20}catch{}return o.nodePermissions(e,"wx")},mayDelete:function(e,t,r){var n;try{n=o.lookupNode(e,t)}catch(s){return s.errno}var a=o.nodePermissions(e,"wx");if(a)return a;if(r){if(!o.isDir(n.mode))return 54;if(o.isRoot(n)||o.getPath(n)===o.cwd())return 10}else if(o.isDir(n.mode))return 31;return 0},mayOpen:function(e,t){return e?o.isLink(e.mode)?32:o.isDir(e.mode)&&(o.flagsToPermissionString(t)!=="r"||t&512)?31:o.nodePermissions(e,o.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd:function(e,t){e=e||0,t=t||o.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!o.streams[r])return r;throw new o.ErrnoError(33)},getStream:function(e){return o.streams[e]},createStream:function(e,t,r){o.FSStream||(o.FSStream=function(){},o.FSStream.prototype={object:{get:function(){return this.node},set:function(c){this.node=c}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}});var n=new o.FSStream;for(var a in e)n[a]=e[a];e=n;var s=o.nextfd(t,r);return e.fd=s,o.streams[s]=e,e},closeStream:function(e){o.streams[e]=null},chrdev_stream_ops:{open:function(e){var t=o.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:function(){throw new o.ErrnoError(70)}},major:function(e){return e>>8},minor:function(e){return e&255},makedev:function(e,t){return e<<8|t},registerDevice:function(e,t){o.devices[e]={stream_ops:t}},getDevice:function(e){return o.devices[e]},getMounts:function(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push.apply(r,n.mounts)}return t},syncfs:function(e,t){typeof e=="function"&&(t=e,e=!1),o.syncFSRequests++,o.syncFSRequests>1&&S("warning: "+o.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=o.getMounts(o.root.mount),n=0;function a(c){return w(o.syncFSRequests>0),o.syncFSRequests--,t(c)}function s(c){if(c)return s.errored?void 0:(s.errored=!0,a(c));++n>=r.length&&a(null)}r.forEach(function(c){if(!c.type.syncfs)return s(null);c.type.syncfs(c,e,s)})},mount:function(e,t,r){if(typeof e=="string")throw e;var n=r==="/",a=!r,s;if(n&&o.root)throw new o.ErrnoError(10);if(!n&&!a){var c=o.lookupPath(r,{follow_mount:!1});if(r=c.path,s=c.node,o.isMountpoint(s))throw new o.ErrnoError(10);if(!o.isDir(s.mode))throw new o.ErrnoError(54)}var l={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(l);return d.mount=l,l.root=d,n?o.root=d:s&&(s.mounted=l,s.mount&&s.mount.mounts.push(l)),d},unmount:function(e){var t=o.lookupPath(e,{follow_mount:!1});if(!o.isMountpoint(t.node))throw new o.ErrnoError(28);var r=t.node,n=r.mounted,a=o.getMounts(n);Object.keys(o.nameTable).forEach(function(c){for(var l=o.nameTable[c];l;){var d=l.name_next;a.indexOf(l.mount)!==-1&&o.destroyNode(l),l=d}}),r.mounted=null;var s=r.mount.mounts.indexOf(n);w(s!==-1),r.mount.mounts.splice(s,1)},lookup:function(e,t){return e.node_ops.lookup(e,t)},mknod:function(e,t,r){var n=o.lookupPath(e,{parent:!0}),a=n.node,s=P.basename(e);if(!s||s==="."||s==="..")throw new o.ErrnoError(28);var c=o.mayCreate(a,s);if(c)throw new o.ErrnoError(c);if(!a.node_ops.mknod)throw new o.ErrnoError(63);return a.node_ops.mknod(a,s,t,r)},create:function(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,o.mknod(e,t,0)},mkdir:function(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,o.mknod(e,t,0)},mkdirTree:function(e,t){for(var r=e.split("/"),n="",a=0;a<r.length;++a)if(r[a]){n+="/"+r[a];try{o.mkdir(n,t)}catch(s){if(s.errno!=20)throw s}}},mkdev:function(e,t,r){return typeof r>"u"&&(r=t,t=438),t|=8192,o.mknod(e,t,r)},symlink:function(e,t){if(!W.resolve(e))throw new o.ErrnoError(44);var r=o.lookupPath(t,{parent:!0}),n=r.node;if(!n)throw new o.ErrnoError(44);var a=P.basename(t),s=o.mayCreate(n,a);if(s)throw new o.ErrnoError(s);if(!n.node_ops.symlink)throw new o.ErrnoError(63);return n.node_ops.symlink(n,a,e)},rename:function(e,t){var r=P.dirname(e),n=P.dirname(t),a=P.basename(e),s=P.basename(t),c,l,d;try{c=o.lookupPath(e,{parent:!0}),l=c.node,c=o.lookupPath(t,{parent:!0}),d=c.node}catch{throw new o.ErrnoError(10)}if(!l||!d)throw new o.ErrnoError(44);if(l.mount!==d.mount)throw new o.ErrnoError(75);var _=o.lookupNode(l,a),p=W.relative(e,n);if(p.charAt(0)!==".")throw new o.ErrnoError(28);if(p=W.relative(t,r),p.charAt(0)!==".")throw new o.ErrnoError(55);var h;try{h=o.lookupNode(d,s)}catch{}if(_!==h){var y=o.isDir(_.mode),T=o.mayDelete(l,a,y);if(T)throw new o.ErrnoError(T);if(T=h?o.mayDelete(d,s,y):o.mayCreate(d,s),T)throw new o.ErrnoError(T);if(!l.node_ops.rename)throw new o.ErrnoError(63);if(o.isMountpoint(_)||h&&o.isMountpoint(h))throw new o.ErrnoError(10);if(d!==l&&(T=o.nodePermissions(l,"w"),T))throw new o.ErrnoError(T);try{o.trackingDelegate.willMovePath&&o.trackingDelegate.willMovePath(e,t)}catch(O){S("FS.trackingDelegate['willMovePath']('"+e+"', '"+t+"') threw an exception: "+O.message)}o.hashRemoveNode(_);try{l.node_ops.rename(_,d,s)}catch(O){throw O}finally{o.hashAddNode(_)}try{o.trackingDelegate.onMovePath&&o.trackingDelegate.onMovePath(e,t)}catch(O){S("FS.trackingDelegate['onMovePath']('"+e+"', '"+t+"') threw an exception: "+O.message)}}},rmdir:function(e){var t=o.lookupPath(e,{parent:!0}),r=t.node,n=P.basename(e),a=o.lookupNode(r,n),s=o.mayDelete(r,n,!0);if(s)throw new o.ErrnoError(s);if(!r.node_ops.rmdir)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);try{o.trackingDelegate.willDeletePath&&o.trackingDelegate.willDeletePath(e)}catch(c){S("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+c.message)}r.node_ops.rmdir(r,n),o.destroyNode(a);try{o.trackingDelegate.onDeletePath&&o.trackingDelegate.onDeletePath(e)}catch(c){S("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+c.message)}},readdir:function(e){var t=o.lookupPath(e,{follow:!0}),r=t.node;if(!r.node_ops.readdir)throw new o.ErrnoError(54);return r.node_ops.readdir(r)},unlink:function(e){var t=o.lookupPath(e,{parent:!0}),r=t.node,n=P.basename(e),a=o.lookupNode(r,n),s=o.mayDelete(r,n,!1);if(s)throw new o.ErrnoError(s);if(!r.node_ops.unlink)throw new o.ErrnoError(63);if(o.isMountpoint(a))throw new o.ErrnoError(10);try{o.trackingDelegate.willDeletePath&&o.trackingDelegate.willDeletePath(e)}catch(c){S("FS.trackingDelegate['willDeletePath']('"+e+"') threw an exception: "+c.message)}r.node_ops.unlink(r,n),o.destroyNode(a);try{o.trackingDelegate.onDeletePath&&o.trackingDelegate.onDeletePath(e)}catch(c){S("FS.trackingDelegate['onDeletePath']('"+e+"') threw an exception: "+c.message)}},readlink:function(e){var t=o.lookupPath(e),r=t.node;if(!r)throw new o.ErrnoError(44);if(!r.node_ops.readlink)throw new o.ErrnoError(28);return W.resolve(o.getPath(r.parent),r.node_ops.readlink(r))},stat:function(e,t){var r=o.lookupPath(e,{follow:!t}),n=r.node;if(!n)throw new o.ErrnoError(44);if(!n.node_ops.getattr)throw new o.ErrnoError(63);return n.node_ops.getattr(n)},lstat:function(e){return o.stat(e,!0)},chmod:function(e,t,r){var n;if(typeof e=="string"){var a=o.lookupPath(e,{follow:!r});n=a.node}else n=e;if(!n.node_ops.setattr)throw new o.ErrnoError(63);n.node_ops.setattr(n,{mode:t&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:function(e,t){o.chmod(e,t,!0)},fchmod:function(e,t){var r=o.getStream(e);if(!r)throw new o.ErrnoError(8);o.chmod(r.node,t)},chown:function(e,t,r,n){var a;if(typeof e=="string"){var s=o.lookupPath(e,{follow:!n});a=s.node}else a=e;if(!a.node_ops.setattr)throw new o.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown:function(e,t,r){o.chown(e,t,r,!0)},fchown:function(e,t,r){var n=o.getStream(e);if(!n)throw new o.ErrnoError(8);o.chown(n.node,t,r)},truncate:function(e,t){if(t<0)throw new o.ErrnoError(28);var r;if(typeof e=="string"){var n=o.lookupPath(e,{follow:!0});r=n.node}else r=e;if(!r.node_ops.setattr)throw new o.ErrnoError(63);if(o.isDir(r.mode))throw new o.ErrnoError(31);if(!o.isFile(r.mode))throw new o.ErrnoError(28);var a=o.nodePermissions(r,"w");if(a)throw new o.ErrnoError(a);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:function(e,t){var r=o.getStream(e);if(!r)throw new o.ErrnoError(8);if((r.flags&2097155)===0)throw new o.ErrnoError(28);o.truncate(r.node,t)},utime:function(e,t,r){var n=o.lookupPath(e,{follow:!0}),a=n.node;a.node_ops.setattr(a,{timestamp:Math.max(t,r)})},open:function(e,t,r,n,a){if(e==="")throw new o.ErrnoError(44);t=typeof t=="string"?o.modeStringToFlags(t):t,r=typeof r>"u"?438:r,t&64?r=r&4095|32768:r=0;var s;if(typeof e=="object")s=e;else{e=P.normalize(e);try{var c=o.lookupPath(e,{follow:!(t&131072)});s=c.node}catch{}}var l=!1;if(t&64)if(s){if(t&128)throw new o.ErrnoError(20)}else s=o.mknod(e,r,0),l=!0;if(!s)throw new o.ErrnoError(44);if(o.isChrdev(s.mode)&&(t&=-513),t&65536&&!o.isDir(s.mode))throw new o.ErrnoError(54);if(!l){var d=o.mayOpen(s,t);if(d)throw new o.ErrnoError(d)}t&512&&o.truncate(s,0),t&=-131713;var _=o.createStream({node:s,path:o.getPath(s),flags:t,seekable:!0,position:0,stream_ops:s.stream_ops,ungotten:[],error:!1},n,a);_.stream_ops.open&&_.stream_ops.open(_),i.logReadFiles&&!(t&1)&&(o.readFiles||(o.readFiles={}),e in o.readFiles||(o.readFiles[e]=1,S("FS.trackingDelegate error on read file: "+e)));try{if(o.trackingDelegate.onOpenFile){var p=0;(t&2097155)!==1&&(p|=o.tracking.openFlags.READ),(t&2097155)!==0&&(p|=o.tracking.openFlags.WRITE),o.trackingDelegate.onOpenFile(e,p)}}catch(h){S("FS.trackingDelegate['onOpenFile']('"+e+"', flags) threw an exception: "+h.message)}return _},close:function(e){if(o.isClosed(e))throw new o.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{o.closeStream(e.fd)}e.fd=null},isClosed:function(e){return e.fd===null},llseek:function(e,t,r){if(o.isClosed(e))throw new o.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new o.ErrnoError(70);if(r!=0&&r!=1&&r!=2)throw new o.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:function(e,t,r,n,a){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===1)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.read)throw new o.ErrnoError(28);var s=typeof a<"u";if(!s)a=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var c=e.stream_ops.read(e,t,r,n,a);return s||(e.position+=c),c},write:function(e,t,r,n,a,s){if(n<0||a<0)throw new o.ErrnoError(28);if(o.isClosed(e))throw new o.ErrnoError(8);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(o.isDir(e.node.mode))throw new o.ErrnoError(31);if(!e.stream_ops.write)throw new o.ErrnoError(28);e.seekable&&e.flags&1024&&o.llseek(e,0,2);var c=typeof a<"u";if(!c)a=e.position;else if(!e.seekable)throw new o.ErrnoError(70);var l=e.stream_ops.write(e,t,r,n,a,s);c||(e.position+=l);try{e.path&&o.trackingDelegate.onWriteToFile&&o.trackingDelegate.onWriteToFile(e.path)}catch(d){S("FS.trackingDelegate['onWriteToFile']('"+e.path+"') threw an exception: "+d.message)}return l},allocate:function(e,t,r){if(o.isClosed(e))throw new o.ErrnoError(8);if(t<0||r<=0)throw new o.ErrnoError(28);if((e.flags&2097155)===0)throw new o.ErrnoError(8);if(!o.isFile(e.node.mode)&&!o.isDir(e.node.mode))throw new o.ErrnoError(43);if(!e.stream_ops.allocate)throw new o.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:function(e,t,r,n,a,s){if((a&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new o.ErrnoError(2);if((e.flags&2097155)===1)throw new o.ErrnoError(2);if(!e.stream_ops.mmap)throw new o.ErrnoError(43);return e.stream_ops.mmap(e,t,r,n,a,s)},msync:function(e,t,r,n,a){return!e||!e.stream_ops.msync?0:e.stream_ops.msync(e,t,r,n,a)},munmap:function(e){return 0},ioctl:function(e,t,r){if(!e.stream_ops.ioctl)throw new o.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e,t){if(t=t||{},t.flags=t.flags||"r",t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error('Invalid encoding type "'+t.encoding+'"');var r,n=o.open(e,t.flags),a=o.stat(e),s=a.size,c=new Uint8Array(s);return o.read(n,c,0,s,0),t.encoding==="utf8"?r=ue(c,0):t.encoding==="binary"&&(r=c),o.close(n),r},writeFile:function(e,t,r){r=r||{},r.flags=r.flags||"w";var n=o.open(e,r.flags,r.mode);if(typeof t=="string"){var a=new Uint8Array(Ie(t)+1),s=ft(t,a,0,a.length);o.write(n,a,0,s,void 0,r.canOwn)}else if(ArrayBuffer.isView(t))o.write(n,t,0,t.byteLength,void 0,r.canOwn);else throw new Error("Unsupported data type");o.close(n)},cwd:function(){return o.currentPath},chdir:function(e){var t=o.lookupPath(e,{follow:!0});if(t.node===null)throw new o.ErrnoError(44);if(!o.isDir(t.node.mode))throw new o.ErrnoError(54);var r=o.nodePermissions(t.node,"x");if(r)throw new o.ErrnoError(r);o.currentPath=t.path},createDefaultDirectories:function(){o.mkdir("/tmp"),o.mkdir("/home"),o.mkdir("/home/web_user")},createDefaultDevices:function(){o.mkdir("/dev"),o.registerDevice(o.makedev(1,3),{read:function(){return 0},write:function(r,n,a,s,c){return s}}),o.mkdev("/dev/null",o.makedev(1,3)),te.register(o.makedev(5,0),te.default_tty_ops),te.register(o.makedev(6,0),te.default_tty1_ops),o.mkdev("/dev/tty",o.makedev(5,0)),o.mkdev("/dev/tty1",o.makedev(6,0));var e;if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var t=new Uint8Array(1);e=function(){return crypto.getRandomValues(t),t[0]}}e||(e=function(){f("no cryptographic support found for random_device. consider polyfilling it if you want to use something insecure like Math.random(), e.g. put this in a --pre-js: var crypto = { getRandomValues: function(array) { for (var i = 0; i < array.length; i++) array[i] = (Math.random()*256)|0 } };")}),o.createDevice("/dev","random",e),o.createDevice("/dev","urandom",e),o.mkdir("/dev/shm"),o.mkdir("/dev/shm/tmp")},createSpecialDirectories:function(){o.mkdir("/proc"),o.mkdir("/proc/self"),o.mkdir("/proc/self/fd"),o.mount({mount:function(){var e=o.createNode("/proc/self","fd",16895,73);return e.node_ops={lookup:function(t,r){var n=+r,a=o.getStream(n);if(!a)throw new o.ErrnoError(8);var s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:function(){return a.path}}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams:function(){i.stdin?o.createDevice("/dev","stdin",i.stdin):o.symlink("/dev/tty","/dev/stdin"),i.stdout?o.createDevice("/dev","stdout",null,i.stdout):o.symlink("/dev/tty","/dev/stdout"),i.stderr?o.createDevice("/dev","stderr",null,i.stderr):o.symlink("/dev/tty1","/dev/stderr");var e=o.open("/dev/stdin","r"),t=o.open("/dev/stdout","w"),r=o.open("/dev/stderr","w");w(e.fd===0,"invalid handle for stdin ("+e.fd+")"),w(t.fd===1,"invalid handle for stdout ("+t.fd+")"),w(r.fd===2,"invalid handle for stderr ("+r.fd+")")},ensureErrnoError:function(){o.ErrnoError||(o.ErrnoError=function(t,r){this.node=r,this.setErrno=function(n){this.errno=n;for(var a in Vt)if(Vt[a]===n){this.code=a;break}},this.setErrno(t),this.message=er[t],this.stack&&(Object.defineProperty(this,"stack",{value:new Error().stack,writable:!0}),this.stack=zt(this.stack))},o.ErrnoError.prototype=new Error,o.ErrnoError.prototype.constructor=o.ErrnoError,[44].forEach(function(e){o.genericErrors[e]=new o.ErrnoError(e),o.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:function(){o.ensureErrnoError(),o.nameTable=new Array(4096),o.mount(m,{},"/"),o.createDefaultDirectories(),o.createDefaultDevices(),o.createSpecialDirectories(),o.filesystems={MEMFS:m}},init:function(e,t,r){w(!o.init.initialized,"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)"),o.init.initialized=!0,o.ensureErrnoError(),i.stdin=e||i.stdin,i.stdout=t||i.stdout,i.stderr=r||i.stderr,o.createStandardStreams()},quit:function(){o.init.initialized=!1;var e=i._fflush;e&&e(0);for(var t=0;t<o.streams.length;t++){var r=o.streams[t];r&&o.close(r)}},getMode:function(e,t){var r=0;return e&&(r|=365),t&&(r|=146),r},joinPath:function(e,t){var r=P.join.apply(null,e);return t&&r[0]=="/"&&(r=r.substr(1)),r},absolutePath:function(e,t){return W.resolve(t,e)},standardizePath:function(e){return P.normalize(e)},findObject:function(e,t){var r=o.analyzePath(e,t);return r.exists?r.object:(xe(r.error),null)},analyzePath:function(e,t){try{var r=o.lookupPath(e,{follow:!t});e=r.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var r=o.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=r.path,n.parentObject=r.node,n.name=P.basename(e),r=o.lookupPath(e,{follow:!t}),n.exists=!0,n.path=r.path,n.object=r.node,n.name=r.node.name,n.isRoot=r.path==="/"}catch(a){n.error=a.errno}return n},createFolder:function(e,t,r,n){var a=P.join2(typeof e=="string"?e:o.getPath(e),t),s=o.getMode(r,n);return o.mkdir(a,s)},createPath:function(e,t,r,n){e=typeof e=="string"?e:o.getPath(e);for(var a=t.split("/").reverse();a.length;){var s=a.pop();if(s){var c=P.join2(e,s);try{o.mkdir(c)}catch{}e=c}}return c},createFile:function(e,t,r,n,a){var s=P.join2(typeof e=="string"?e:o.getPath(e),t),c=o.getMode(n,a);return o.create(s,c)},createDataFile:function(e,t,r,n,a,s){var c=t?P.join2(typeof e=="string"?e:o.getPath(e),t):e,l=o.getMode(n,a),d=o.create(c,l);if(r){if(typeof r=="string"){for(var _=new Array(r.length),p=0,h=r.length;p<h;++p)_[p]=r.charCodeAt(p);r=_}o.chmod(d,l|146);var y=o.open(d,"w");o.write(y,r,0,r.length,0,s),o.close(y),o.chmod(d,l)}return d},createDevice:function(e,t,r,n){var a=P.join2(typeof e=="string"?e:o.getPath(e),t),s=o.getMode(!!r,!!n);o.createDevice.major||(o.createDevice.major=64);var c=o.makedev(o.createDevice.major++,0);return o.registerDevice(c,{open:function(l){l.seekable=!1},close:function(l){n&&n.buffer&&n.buffer.length&&n(10)},read:function(l,d,_,p,h){for(var y=0,T=0;T<p;T++){var O;try{O=r()}catch{throw new o.ErrnoError(29)}if(O===void 0&&y===0)throw new o.ErrnoError(6);if(O==null)break;y++,d[_+T]=O}return y&&(l.node.timestamp=Date.now()),y},write:function(l,d,_,p,h){for(var y=0;y<p;y++)try{n(d[_+y])}catch{throw new o.ErrnoError(29)}return p&&(l.node.timestamp=Date.now()),y}}),o.mkdev(a,s,c)},createLink:function(e,t,r,n,a){var s=P.join2(typeof e=="string"?e:o.getPath(e),t);return o.symlink(r,s)},forceLoadFile:function(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;var t=!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(at)try{e.contents=it(at(e.url),!0),e.usedBytes=e.contents.length}catch{t=!1}else throw new Error("Cannot load without read() or XMLHttpRequest.");return t||xe(29),t},createLazyFile:function(e,t,r,n,a){function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(y){if(!(y>this.length-1||y<0)){var T=y%this.chunkSize,O=y/this.chunkSize|0;return this.getter(O)[T]}},s.prototype.setDataGetter=function(y){this.getter=y},s.prototype.cacheLength=function(){var y=new XMLHttpRequest;if(y.open("HEAD",r,!1),y.send(null),!(y.status>=200&&y.status<300||y.status===304))throw new Error("Couldn't load "+r+". Status: "+y.status);var T=Number(y.getResponseHeader("Content-length")),O,b=(O=y.getResponseHeader("Accept-Ranges"))&&O==="bytes",F=(O=y.getResponseHeader("Content-Encoding"))&&O==="gzip",C=1024*1024;b||(C=T);var E=function(A,R){if(A>R)throw new Error("invalid range ("+A+", "+R+") or no bytes requested!");if(R>T-1)throw new Error("only "+T+" bytes available! programmer error!");var M=new XMLHttpRequest;if(M.open("GET",r,!1),T!==C&&M.setRequestHeader("Range","bytes="+A+"-"+R),typeof Uint8Array<"u"&&(M.responseType="arraybuffer"),M.overrideMimeType&&M.overrideMimeType("text/plain; charset=x-user-defined"),M.send(null),!(M.status>=200&&M.status<300||M.status===304))throw new Error("Couldn't load "+r+". Status: "+M.status);return M.response!==void 0?new Uint8Array(M.response||[]):it(M.responseText||"",!0)},g=this;g.setDataGetter(function(A){var R=A*C,M=(A+1)*C-1;if(M=Math.min(M,T-1),typeof g.chunks[A]>"u"&&(g.chunks[A]=E(R,M)),typeof g.chunks[A]>"u")throw new Error("doXHR failed!");return g.chunks[A]}),(F||!T)&&(C=T=1,T=this.getter(0).length,C=T,J("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=T,this._chunkSize=C,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var c,l}else var l={isDevice:!1,url:r};var d=o.createFile(e,t,l,n,a);l.contents?d.contents=l.contents:l.url&&(d.contents=null,d.url=l.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var _={},p=Object.keys(d.stream_ops);return p.forEach(function(h){var y=d.stream_ops[h];_[h]=function(){if(!o.forceLoadFile(d))throw new o.ErrnoError(29);return y.apply(null,arguments)}}),_.read=function(y,T,O,b,F){if(!o.forceLoadFile(d))throw new o.ErrnoError(29);var C=y.node.contents;if(F>=C.length)return 0;var E=Math.min(C.length-F,b);if(w(E>=0),C.slice)for(var g=0;g<E;g++)T[O+g]=C[F+g];else for(var g=0;g<E;g++)T[O+g]=C.get(F+g);return E},d.stream_ops=_,d},createPreloadedFile:function(e,t,r,n,a,s,c,l,d,_){Browser.init();var p=t?W.resolve(P.join2(e,t)):e,h=Hi("cp "+p);function y(T){function O(F){_&&_(),l||o.createDataFile(e,t,F,n,a,d),s&&s(),_t(h)}var b=!1;i.preloadPlugins.forEach(function(F){b||F.canHandle(p)&&(F.handle(T,p,O,function(){c&&c(),_t(h)}),b=!0)}),b||O(T)}Wt(h),typeof r=="string"?Browser.asyncLoad(r,function(T){y(T)},c):y(r)},indexedDB:function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},DB_NAME:function(){return"EM_FS_"+window.location.pathname},DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=o.indexedDB();try{var a=n.open(o.DB_NAME(),o.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=function(){J("creating db");var c=a.result;c.createObjectStore(o.DB_STORE_NAME)},a.onsuccess=function(){var c=a.result,l=c.transaction([o.DB_STORE_NAME],"readwrite"),d=l.objectStore(o.DB_STORE_NAME),_=0,p=0,h=e.length;function y(){p==0?t():r()}e.forEach(function(T){var O=d.put(o.analyzePath(T).object.contents,T);O.onsuccess=function(){_++,_+p==h&&y()},O.onerror=function(){p++,_+p==h&&y()}}),l.onerror=r},a.onerror=r},loadFilesFromDB:function(e,t,r){t=t||function(){},r=r||function(){};var n=o.indexedDB();try{var a=n.open(o.DB_NAME(),o.DB_VERSION)}catch(s){return r(s)}a.onupgradeneeded=r,a.onsuccess=function(){var c=a.result;try{var l=c.transaction([o.DB_STORE_NAME],"readonly")}catch(T){r(T);return}var d=l.objectStore(o.DB_STORE_NAME),_=0,p=0,h=e.length;function y(){p==0?t():r()}e.forEach(function(T){var O=d.get(T);O.onsuccess=function(){o.analyzePath(T).exists&&o.unlink(T),o.createDataFile(P.dirname(T),P.basename(T),O.result,!0,!0,!0),_++,_+p==h&&y()},O.onerror=function(){p++,_+p==h&&y()}}),l.onerror=r},a.onerror=r}},j={mappings:{},DEFAULT_POLLMASK:5,umask:511,calculateAt:function(e,t){if(t[0]!=="/"){var r;if(e===-100)r=o.cwd();else{var n=o.getStream(e);if(!n)throw new o.ErrnoError(8);r=n.path}t=P.join2(r,t)}return t},doStat:function(e,t,r){try{var n=e(t)}catch(a){if(a&&a.node&&P.normalize(t)!==P.normalize(o.getPath(a.node)))return-54;throw a}return v[r>>2]=n.dev,v[r+4>>2]=0,v[r+8>>2]=n.ino,v[r+12>>2]=n.mode,v[r+16>>2]=n.nlink,v[r+20>>2]=n.uid,v[r+24>>2]=n.gid,v[r+28>>2]=n.rdev,v[r+32>>2]=0,Y=[n.size>>>0,(I=n.size,+dt(I)>=1?I>0?(ut(+je(I/4294967296),4294967295)|0)>>>0:~~+ke((I-+(~~I>>>0))/4294967296)>>>0:0)],v[r+40>>2]=Y[0],v[r+44>>2]=Y[1],v[r+48>>2]=4096,v[r+52>>2]=n.blocks,v[r+56>>2]=n.atime.getTime()/1e3|0,v[r+60>>2]=0,v[r+64>>2]=n.mtime.getTime()/1e3|0,v[r+68>>2]=0,v[r+72>>2]=n.ctime.getTime()/1e3|0,v[r+76>>2]=0,Y=[n.ino>>>0,(I=n.ino,+dt(I)>=1?I>0?(ut(+je(I/4294967296),4294967295)|0)>>>0:~~+ke((I-+(~~I>>>0))/4294967296)>>>0:0)],v[r+80>>2]=Y[0],v[r+84>>2]=Y[1],0},doMsync:function(e,t,r,n,a){var s=X.slice(e,e+r);o.msync(t,s,a,r,n)},doMkdir:function(e,t){return e=P.normalize(e),e[e.length-1]==="/"&&(e=e.substr(0,e.length-1)),o.mkdir(e,t,0),0},doMknod:function(e,t,r){switch(t&61440){case 32768:case 8192:case 24576:case 4096:case 49152:break;default:return-28}return o.mknod(e,t,r),0},doReadlink:function(e,t,r){if(r<=0)return-28;var n=o.readlink(e),a=Math.min(r,Ie(n)),s=U[t+a];return It(n,t,r+1),U[t+a]=s,a},doAccess:function(e,t){if(t&-8)return-28;var r,n=o.lookupPath(e,{follow:!0});if(r=n.node,!r)return-44;var a="";return t&4&&(a+="r"),t&2&&(a+="w"),t&1&&(a+="x"),a&&o.nodePermissions(r,a)?-2:0},doDup:function(e,t,r){var n=o.getStream(r);return n&&o.close(n),o.open(e,t,0,r,r).fd},doReadv:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var c=v[t+s*8>>2],l=v[t+(s*8+4)>>2],d=o.read(e,U,c,l,n);if(d<0)return-1;if(a+=d,d<l)break}return a},doWritev:function(e,t,r,n){for(var a=0,s=0;s<r;s++){var c=v[t+s*8>>2],l=v[t+(s*8+4)>>2],d=o.write(e,U,c,l,n);if(d<0)return-1;a+=d}return a},varargs:void 0,get:function(){w(j.varargs!=null),j.varargs+=4;var e=v[j.varargs-4>>2];return e},getStr:function(e){var t=ae(e);return t},getStreamFromFD:function(e){var t=o.getStream(e);if(!t)throw new o.ErrnoError(8);return t},get64:function(e,t){return e>=0?w(t===0):w(t===-1),e}};function tr(e,t){if((e|0)===-1||t===0)return-28;var r=j.mappings[e];if(!r)return 0;if(t===r.len){var n=o.getStream(r.fd);r.prot&2&&j.doMsync(e,n,t,r.flags,r.offset),j.mappings[e]=null,r.allocated&&q(r.malloc)}return 0}function ir(e,t){try{return tr(e,t)}catch(r){return(typeof o>"u"||!(r instanceof o.ErrnoError))&&f(r),-r.errno}}function pt(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function rr(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);qt=e}var qt=void 0;function N(e){for(var t="",r=e;X[r];)t+=qt[X[r++]];return t}var ye={},le={},He={},nr=48,or=57;function Le(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=nr&&t<=or?"_"+e:e}function Et(e,t){return e=Le(e),new Function("body","return function "+e+`() {