UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

2 lines 49.2 kB
self.XAtlas=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){(function(t){var n,r=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var r,o,i=void 0!==(e=e||{})?e:{};i.ready=new Promise((function(e,t){r=e,o=t})),Object.getOwnPropertyDescriptor(i.ready,"___getTypeName")||(Object.defineProperty(i.ready,"___getTypeName",{configurable:!0,get:function(){ve("You are getting ___getTypeName 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,"___getTypeName",{configurable:!0,set:function(){ve("You are setting ___getTypeName 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,"___embind_register_native_and_builtin_types")||(Object.defineProperty(i.ready,"___embind_register_native_and_builtin_types",{configurable:!0,get:function(){ve("You are getting ___embind_register_native_and_builtin_types 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,"___embind_register_native_and_builtin_types",{configurable:!0,set:function(){ve("You are setting ___embind_register_native_and_builtin_types 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,"___stdio_exit")||(Object.defineProperty(i.ready,"___stdio_exit",{configurable:!0,get:function(){ve("You are getting ___stdio_exit 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,"___stdio_exit",{configurable:!0,set:function(){ve("You are setting ___stdio_exit 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(){ve("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(){ve("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 a=Object.assign({},i),s=[],l=!1,u=!0,c=!1,d=!1;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 f,p="";function h(e){return i.locateFile?i.locateFile(e,p):p+e}if(d){if("object"==typeof t||"object"==typeof window||"function"==typeof importScripts)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?)");f=function(e){let t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(t=read(e,"binary"),S("object"==typeof t),t)},"undefined"!=typeof scriptArgs?s=scriptArgs:void 0!==arguments&&(s=arguments),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)}else{if(!l&&!u)throw new Error("environment detection error");if(u?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),n&&(p=n),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"","object"!=typeof window&&"function"!=typeof importScripts)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?)");u&&(f=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})}var m=i.print||console.log.bind(console),g=i.printErr||console.warn.bind(console);function y(e){y.shown||(y.shown={}),y.shown[e]||(y.shown[e]=1,g(e))}function v(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){ve("Module."+e+" has been replaced with plain "+t+" (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 _(e){Object.getOwnPropertyDescriptor(i,e)&&ve("`Module."+e+"` was supplied but `"+e+"` not included in INCOMING_MODULE_JS_API")}function b(e,t){var n="'"+e+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";return t&&(n+=". Alternatively, forcing filesystem support (-s FORCE_FILESYSTEM=1) can export this for you"),n}function w(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){ve(b(e,t))}})}function T(e,t){Object.getOwnPropertyDescriptor(i,e)||(i[e]=()=>ve(b(e,t)))}Object.assign(i,a),a=null,Ht(),i.arguments&&(s=i.arguments),v("arguments","arguments_"),i.thisProgram&&i.thisProgram,v("thisProgram","thisProgram"),i.quit&&i.quit,v("quit","quit_"),S(void 0===i.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),S(void 0===i.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),S(void 0===i.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),S(void 0===i.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),S(void 0===i.read,"Module.read option was removed (modify read_ in JS)"),S(void 0===i.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),S(void 0===i.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),S(void 0===i.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),S(void 0===i.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),v("read","read_"),v("readAsync","readAsync"),v("readBinary","readBinary"),v("setWindowTitle","setWindowTitle"),S(!l,"web environment detected but not enabled at build time. Add 'web' to `-s ENVIRONMENT` to enable."),S(!c,"node environment detected but not enabled at build time. Add 'node' to `-s ENVIRONMENT` to enable."),S(!d,"shell environment detected but not enabled at build time. Add 'shell' to `-s ENVIRONMENT` to enable.");var E,A,P=e=>{};i.wasmBinary&&(E=i.wasmBinary),v("wasmBinary","wasmBinary"),i.noExitRuntime,v("noExitRuntime","noExitRuntime"),"object"!=typeof WebAssembly&&ve("no native wasm support detected");var C=!1;function S(e,t){e||ve("Assertion failed"+(t?": "+t:""))}var F="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function O(e,t,n){for(var r=t+n,o=t;e[o]&&!(o>=r);)++o;if(o-t>16&&e.buffer&&F)return F.decode(e.subarray(t,o));for(var i="";t<o;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var l=63&e[t++];if(224==(240&a)?a=(15&a)<<12|s<<6|l:(240!=(248&a)&&y("Invalid UTF-8 leading byte 0x"+a.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),a=(7&a)<<18|s<<12|l<<6|63&e[t++]),a<65536)i+=String.fromCharCode(a);else{var u=a-65536;i+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else i+=String.fromCharCode((31&a)<<6|s)}else i+=String.fromCharCode(a)}return i}function I(e,t){return e?O(U,e,t):""}function M(e,t,n,r){if(!(r>0))return 0;for(var o=n,i=n+r-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=i)break;t[n++]=s}else if(s<=2047){if(n+1>=i)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=i)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=i)break;s>1114111&&y("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-o}function k(e,t,n){return S("number"==typeof n,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),M(e,U,t,n)}function R(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++n)),r<=127?++t:t+=r<=2047?2:r<=65535?3:4}return t}var x,L,U,D,N,W,j,H,z,V="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function B(e,t){S(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var n=e,r=n>>1,o=r+t/2;!(r>=o)&&N[r];)++r;if((n=r<<1)-e>32&&V)return V.decode(U.subarray(e,n));for(var i="",a=0;!(a>=t/2);++a){var s=D[e+2*a>>1];if(0==s)break;i+=String.fromCharCode(s)}return i}function G(e,t,n){if(S(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),S("number"==typeof n,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===n&&(n=2147483647),n<2)return 0;for(var r=t,o=(n-=2)<2*e.length?n/2:e.length,i=0;i<o;++i){var a=e.charCodeAt(i);D[t>>1]=a,t+=2}return D[t>>1]=0,t-r}function Y(e){return 2*e.length}function J(e,t){S(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var n=0,r="";!(n>=t/4);){var o=W[e+4*n>>2];if(0==o)break;if(++n,o>=65536){var i=o-65536;r+=String.fromCharCode(55296|i>>10,56320|1023&i)}else r+=String.fromCharCode(o)}return r}function q(e,t,n){if(S(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),S("number"==typeof n,"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===n&&(n=2147483647),n<4)return 0;for(var r=t,o=r+n-4,i=0;i<e.length;++i){var a=e.charCodeAt(i);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),W[t>>2]=a,(t+=4)+4>o)break}return W[t>>2]=0,t-r}function K(e){for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r>=55296&&r<=57343&&++n,t+=4}return t}function Z(e){x=e,i.HEAP8=L=new Int8Array(e),i.HEAP16=D=new Int16Array(e),i.HEAP32=W=new Int32Array(e),i.HEAPU8=U=new Uint8Array(e),i.HEAPU16=N=new Uint16Array(e),i.HEAPU32=j=new Uint32Array(e),i.HEAPF32=H=new Float32Array(e),i.HEAPF64=z=new Float64Array(e)}var X=5242880;i.TOTAL_STACK&&S(X===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var Q,$=i.INITIAL_MEMORY||16777216;function ee(){var e=qt();S(0==(3&e)),W[e>>2]=34821223,W[e+4>>2]=2310721022,W[0]=1668509029}function te(){if(!C){var e=qt(),t=j[e>>2],n=j[e+4>>2];34821223==t&&2310721022==n||ve("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+n.toString(16)+" 0x"+t.toString(16)),1668509029!==W[0]&&ve("Runtime error: The application has corrupted its heap memory area (address zero)!")}}v("INITIAL_MEMORY","INITIAL_MEMORY"),S($>=X,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+$+"! (TOTAL_STACK="+X+")"),S("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),S(!i.wasmMemory,"Use of `wasmMemory` detected. Use -s IMPORTED_MEMORY to define wasmMemory externally"),S(16777216==$,"Detected runtime INITIAL_MEMORY setting. Use -s IMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian! (Run with -s SUPPORT_BIG_ENDIAN=1 to bypass)"}();var ne=[],re=[],oe=[],ie=!1;function ae(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)ue(i.preRun.shift());Fe(ne)}function se(){te(),S(!ie),ie=!0,Fe(re)}function le(){if(te(),i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)de(i.postRun.shift());Fe(oe)}function ue(e){ne.unshift(e)}function ce(e){re.unshift(e)}function de(e){oe.unshift(e)}S(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(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 fe=0,pe=null,he=null,me={};function ge(e){fe++,i.monitorRunDependencies&&i.monitorRunDependencies(fe),e?(S(!me[e]),me[e]=1,null===pe&&"undefined"!=typeof setInterval&&(pe=setInterval((function(){if(C)return clearInterval(pe),void(pe=null);var e=!1;for(var t in me)e||(e=!0,g("still waiting on run dependencies:")),g("dependency: "+t);e&&g("(end of list)")}),1e4))):g("warning: run dependency added without ID")}function ye(e){if(fe--,i.monitorRunDependencies&&i.monitorRunDependencies(fe),e?(S(me[e]),delete me[e]):g("warning: run dependency removed without ID"),0==fe&&(null!==pe&&(clearInterval(pe),pe=null),he)){var t=he;he=null,t()}}function ve(e){i.onAbort&&i.onAbort(e),g(e="Aborted("+e+")"),C=!0;var t=new WebAssembly.RuntimeError(e);throw o(t),t}i.preloadedImages={},i.preloadedAudios={};var _e={error:function(){ve("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -s FORCE_FILESYSTEM=1")},init:function(){_e.error()},createDataFile:function(){_e.error()},createPreloadedFile:function(){_e.error()},createLazyFile:function(){_e.error()},open:function(){_e.error()},mkdev:function(){_e.error()},registerDevice:function(){_e.error()},analyzePath:function(){_e.error()},loadFilesFromDB:function(){_e.error()},ErrnoError:function(){_e.error()}};i.FS_createDataFile=_e.createDataFile,i.FS_createPreloadedFile=_e.createPreloadedFile;var be,we="data:application/octet-stream;base64,";function Te(e){return e.startsWith(we)}function Ee(e){return e.startsWith("file://")}function Ae(e,t){return function(){var n=e,r=t;return t||(r=i.asm),S(ie,"native function `"+n+"` called before runtime initialization"),r[e]||S(r[e],"exported native function `"+n+"` not found"),r[e].apply(null,arguments)}}function Pe(e){try{if(e==be&&E)return new Uint8Array(E);if(f)return f(e);throw"both async and sync fetching of the wasm failed"}catch(e){ve(e)}}function Ce(){return E||!l&&!u||"function"!=typeof fetch?Promise.resolve().then((function(){return Pe(be)})):fetch(be,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+be+"'";return e.arrayBuffer()})).catch((function(){return Pe(be)}))}function Se(){var e={env:Vt,wasi_snapshot_preview1:Vt};function t(e,t){var n=e.exports;i.asm=n,S(A=i.asm.memory,"memory not found in wasm exports"),Z(A.buffer),S(Q=i.asm.__indirect_function_table,"table not found in wasm exports"),ce(i.asm.__wasm_call_ctors),ye("wasm-instantiate")}ge("wasm-instantiate");var n=i;function r(e){S(i===n,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),n=null,t(e.instance)}function a(t){return Ce().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){g("failed to asynchronously prepare wasm: "+e),Ee(be)&&g("warning: Loading from a file URI ("+be+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),ve(e)}))}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(e){return g("Module.instantiateWasm callback failed with error: "+e),!1}return(E||"function"!=typeof WebAssembly.instantiateStreaming||Te(be)||"function"!=typeof fetch?a(r):fetch(be,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(r,(function(e){return g("wasm streaming compile failed: "+e),g("falling back to ArrayBuffer instantiation"),a(r)}))}))).catch(o),{}}function Fe(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var n=t.func;"number"==typeof n?void 0===t.arg?Oe(n)():Oe(n)(t.arg):n(void 0===t.arg?null:t.arg)}else t(i)}}function Oe(e){return Q.get(e)}Te(be="xatlas_web.wasm")||(be=h(be));var Ie={};function Me(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function ke(e){return this.fromWireType(j[e>>2])}var Re={},xe={},Le={},Ue=48,De=57;function Ne(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=Ue&&t<=De?"_"+e:e}function We(e,t){return e=Ne(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function je(e,t){var n=We(t,(function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var He=void 0;function ze(e){throw new He(e)}function Ve(e,t,n){function r(t){var r=n(t);r.length!==e.length&&ze("Mismatched type converter count");for(var o=0;o<e.length;++o)Qe(e[o],r[o])}e.forEach((function(e){Le[e]=t}));var o=new Array(t.length),i=[],a=0;t.forEach((e,t)=>{xe.hasOwnProperty(e)?o[t]=xe[e]:(i.push(e),Re.hasOwnProperty(e)||(Re[e]=[]),Re[e].push(()=>{o[t]=xe[e],++a===i.length&&r(o)}))}),0===i.length&&r(o)}function Be(e){var t=Ie[e];delete Ie[e];var n=t.rawConstructor,r=t.rawDestructor,o=t.fields;Ve([e],o.map(e=>e.getterReturnType).concat(o.map(e=>e.setterArgumentType)),e=>{var i={};return o.forEach((t,n)=>{var r=t.fieldName,a=e[n],s=t.getter,l=t.getterContext,u=e[n+o.length],c=t.setter,d=t.setterContext;i[r]={read:e=>a.fromWireType(s(l,e)),write:(e,t)=>{var n=[];c(d,e,u.toWireType(n,t)),Me(n)}}}),[{name:t.name,fromWireType:function(e){var t={};for(var n in i)t[n]=i[n].read(e);return r(e),t},toWireType:function(e,t){for(var o in i)if(!(o in t))throw new TypeError('Missing field: "'+o+'"');var a=n();for(o in i)i[o].write(a,t[o]);return null!==e&&e.push(r,a),a},argPackAdvance:8,readValueFromPointer:ke,destructorFunction:r}]})}function Ge(e,t,n,r,o){}function Ye(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 Je(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);qe=e}var qe=void 0;function Ke(e){for(var t="",n=e;U[n];)t+=qe[U[n++]];return t}var Ze=void 0;function Xe(e){throw new Ze(e)}function Qe(e,t,n={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var r=t.name;if(e||Xe('type "'+r+'" must have a positive integer typeid pointer'),xe.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;Xe("Cannot register type '"+r+"' twice")}if(xe[e]=t,delete Le[e],Re.hasOwnProperty(e)){var o=Re[e];delete Re[e],o.forEach(e=>e())}}function $e(e,t,n,r,o){var i=Ye(n);Qe(e,{name:t=Ke(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:o},argPackAdvance:8,readValueFromPointer:function(e){var r;if(1===n)r=L;else if(2===n)r=D;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+t);r=W}return this.fromWireType(r[e>>i])},destructorFunction:null})}var et=[],tt=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function nt(e){e>4&&0==--tt[e].refcount&&(tt[e]=void 0,et.push(e))}function rt(){for(var e=0,t=5;t<tt.length;++t)void 0!==tt[t]&&++e;return e}function ot(){for(var e=5;e<tt.length;++e)if(void 0!==tt[e])return tt[e];return null}function it(){i.count_emval_handles=rt,i.get_first_emval=ot}var at={toValue:e=>(e||Xe("Cannot use deleted val. handle = "+e),tt[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=et.length?et.pop():tt.length;return tt[t]={refcount:1,value:e},t}}};function st(e,t){Qe(e,{name:t=Ke(t),fromWireType:function(e){var t=at.toValue(e);return nt(e),t},toWireType:function(e,t){return at.toHandle(t)},argPackAdvance:8,readValueFromPointer:ke,destructorFunction:null})}function lt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function ut(e,t){switch(t){case 2:return function(e){return this.fromWireType(H[e>>2])};case 3:return function(e){return this.fromWireType(z[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function ct(e,t,n){var r=Ye(n);Qe(e,{name:t=Ke(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+lt(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:ut(t,r),destructorFunction:null})}function dt(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var n=We(e.name||"unknownFunctionName",(function(){}));n.prototype=e.prototype;var r=new n,o=e.apply(r,t);return o instanceof Object?o:r}function ft(e,t,n,r,o){var i=t.length;i<2&&Xe("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==n,s=!1,l=1;l<t.length;++l)if(null!==t[l]&&void 0===t[l].destructorFunction){s=!0;break}var u="void"!==t[0].name,c="",d="";for(l=0;l<i-2;++l)c+=(0!==l?", ":"")+"arg"+l,d+=(0!==l?", ":"")+"arg"+l+"Wired";var f="return function "+Ne(e)+"("+c+") {\nif (arguments.length !== "+(i-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(i-2)+" args!');\n}\n";s&&(f+="var destructors = [];\n");var p=s?"destructors":"null",h=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],m=[Xe,r,o,Me,t[0],t[1]];for(a&&(f+="var thisWired = classParam.toWireType("+p+", this);\n"),l=0;l<i-2;++l)f+="var arg"+l+"Wired = argType"+l+".toWireType("+p+", arg"+l+"); // "+t[l+2].name+"\n",h.push("argType"+l),m.push(t[l+2]);if(a&&(d="thisWired"+(d.length>0?", ":"")+d),f+=(u?"var rv = ":"")+"invoker(fn"+(d.length>0?", ":"")+d+");\n",s)f+="runDestructors(destructors);\n";else for(l=a?1:2;l<t.length;++l){var g=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==t[l].destructorFunction&&(f+=g+"_dtor("+g+"); // "+t[l].name+"\n",h.push(g+"_dtor"),m.push(t[l].destructorFunction))}return u&&(f+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),f+="}\n",h.push(f),dt(Function,h).apply(null,m)}function pt(e,t,n){if(void 0===e[t].overloadTable){var r=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Xe("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}}function ht(e,t,n){i.hasOwnProperty(e)?((void 0===n||void 0!==i[e].overloadTable&&void 0!==i[e].overloadTable[n])&&Xe("Cannot register public name '"+e+"' twice"),pt(i,e,e),i.hasOwnProperty(n)&&Xe("Cannot register multiple overloads of a function with the same number of arguments ("+n+")!"),i[e].overloadTable[n]=t):(i[e]=t,void 0!==n&&(i[e].numArguments=n))}function mt(e,t){for(var n=[],r=0;r<e;r++)n.push(W[(t>>2)+r]);return n}function gt(e,t,n){i.hasOwnProperty(e)||ze("Replacing nonexistant public symbol"),void 0!==i[e].overloadTable&&void 0!==n?i[e].overloadTable[n]=t:(i[e]=t,i[e].argCount=n)}function yt(e,t,n){S("dynCall_"+e in i,"bad function pointer type - no table for sig '"+e+"'"),n&&n.length?S(n.length===e.substring(1).replace(/j/g,"--").length):S(1==e.length);var r=i["dynCall_"+e];return n&&n.length?r.apply(null,[t].concat(n)):r.call(null,t)}function vt(e,t,n){return e.includes("j")?yt(e,t,n):(S(Oe(t),"missing table entry in dynCall: "+t),Oe(t).apply(null,n))}function _t(e,t){S(e.includes("j"),"getDynCaller should only be called with i64 sigs");var n=[];return function(){return n.length=0,Object.assign(n,arguments),vt(e,t,n)}}function bt(e,t){var n=(e=Ke(e)).includes("j")?_t(e,t):Oe(t);return"function"!=typeof n&&Xe("unknown function pointer with signature "+e+": "+t),n}var wt=void 0;function Tt(e){var t=Gt(e),n=Ke(t);return Bt(t),n}function Et(e,t){var n=[],r={};throw t.forEach((function e(t){r[t]||xe[t]||(Le[t]?Le[t].forEach(e):(n.push(t),r[t]=!0))})),new wt(e+": "+n.map(Tt).join([", "]))}function At(e,t,n,r,o,i){var a=mt(t,n);e=Ke(e),o=bt(r,o),ht(e,(function(){Et("Cannot call "+e+" due to unbound types",a)}),t-1),Ve([],a,(function(n){var r=[n[0],null].concat(n.slice(1));return gt(e,ft(e,r,null,o,i),t-1),[]}))}function Pt(e,t,n){switch(t){case 0:return n?function(e){return L[e]}:function(e){return U[e]};case 1:return n?function(e){return D[e>>1]}:function(e){return N[e>>1]};case 2:return n?function(e){return W[e>>2]}:function(e){return j[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function Ct(e,t,n,r,o){t=Ke(t),-1===o&&(o=4294967295);var i=Ye(n),a=e=>e;if(0===r){var s=32-8*n;a=e=>e<<s>>>s}var l=t.includes("unsigned"),u=(e,n)=>{if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+lt(e)+'" to '+n);if(e<r||e>o)throw new TypeError('Passing a number "'+lt(e)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+r+", "+o+"]!")};Qe(e,{name:t,fromWireType:a,toWireType:l?function(e,t){return u(t,this.name),t>>>0}:function(e,t){return u(t,this.name),t},argPackAdvance:8,readValueFromPointer:Pt(t,i,0!==r),destructorFunction:null})}function St(e,t,n){var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function o(e){var t=j,n=t[e>>=2],o=t[e+1];return new r(x,o,n)}Qe(e,{name:n=Ke(n),fromWireType:o,argPackAdvance:8,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})}function Ft(e,t){var n="std::string"===(t=Ke(t));Qe(e,{name:t,fromWireType:function(e){var t,r=j[e>>2];if(n)for(var o=e+4,i=0;i<=r;++i){var a=e+4+i;if(i==r||0==U[a]){var s=I(o,a-o);void 0===t?t=s:(t+=String.fromCharCode(0),t+=s),o=a+1}}else{var l=new Array(r);for(i=0;i<r;++i)l[i]=String.fromCharCode(U[e+4+i]);t=l.join("")}return Bt(e),t},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r="string"==typeof t;r||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||Xe("Cannot pass non-string to std::string");var o=(n&&r?()=>R(t):()=>t.length)(),i=Yt(4+o+1);if(j[i>>2]=o,n&&r)k(t,i+4,o+1);else if(r)for(var a=0;a<o;++a){var s=t.charCodeAt(a);s>255&&(Bt(i),Xe("String has UTF-16 code units that do not fit in 8 bits")),U[i+4+a]=s}else for(a=0;a<o;++a)U[i+4+a]=t[a];return null!==e&&e.push(Bt,i),i},argPackAdvance:8,readValueFromPointer:ke,destructorFunction:function(e){Bt(e)}})}function Ot(e,t,n){var r,o,i,a,s;n=Ke(n),2===t?(r=B,o=G,a=Y,i=()=>N,s=1):4===t&&(r=J,o=q,a=K,i=()=>j,s=2),Qe(e,{name:n,fromWireType:function(e){for(var n,o=j[e>>2],a=i(),l=e+4,u=0;u<=o;++u){var c=e+4+u*t;if(u==o||0==a[c>>s]){var d=r(l,c-l);void 0===n?n=d:(n+=String.fromCharCode(0),n+=d),l=c+t}}return Bt(e),n},toWireType:function(e,r){"string"!=typeof r&&Xe("Cannot pass non-string to C++ string type "+n);var i=a(r),l=Yt(4+i+t);return j[l>>2]=i>>s,o(r,l+4,i+t),null!==e&&e.push(Bt,l),l},argPackAdvance:8,readValueFromPointer:ke,destructorFunction:function(e){Bt(e)}})}function It(e,t,n,r,o,i){Ie[e]={name:Ke(t),rawConstructor:bt(n,r),rawDestructor:bt(o,i),fields:[]}}function Mt(e,t,n,r,o,i,a,s,l,u){Ie[e].fields.push({fieldName:Ke(t),getterReturnType:n,getter:bt(r,o),getterContext:i,setterArgumentType:a,setter:bt(s,l),setterContext:u})}function kt(e,t){Qe(e,{isVoid:!0,name:t=Ke(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})}function Rt(){ve("native code called abort()")}function xt(e,t,n){U.copyWithin(e,t,t+n)}function Lt(e){try{return A.grow(e-x.byteLength+65535>>>16),Z(A.buffer),1}catch(t){g("emscripten_realloc_buffer: Attempted to grow heap from "+x.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}function Ut(e){var t,n,r=U.length;if(S((e>>>=0)>r),e>2147483648)return g("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is 2147483648 bytes!"),!1;for(var o=1;o<=4;o*=2){var i=r*(1+.2/o);i=Math.min(i,e+100663296);var a=Math.min(2147483648,(t=Math.max(e,i))+((n=65536)-t%n)%n);if(Lt(a))return!0}return g("Failed to grow the heap from "+r+" bytes to "+a+" bytes, not enough memory!"),!1}var Dt={buffers:[null,[],[]],printChar:function(e,t){var n=Dt.buffers[e];S(n),0===t||10===t?((1===e?m:g)(O(n,0)),n.length=0):n.push(t)},varargs:void 0,get:function(){return S(null!=Dt.varargs),Dt.varargs+=4,W[Dt.varargs-4>>2]},getStr:function(e){return I(e)},get64:function(e,t){return S(e>=0?0===t:-1===t),e}};function Nt(e,t,n,r){for(var o=0,i=0;i<n;i++){var a=W[t>>2],s=W[t+4>>2];t+=8;for(var l=0;l<s;l++)Dt.printChar(e,U[a+l]);o+=s}return W[r>>2]=o,0}function Wt(e,t){i.onAtlasProgress&&i.onAtlasProgress(e,t)}function jt(e){P(e)}function Ht(){_("fetchSettings")}He=i.InternalError=je(Error,"InternalError"),Je(),Ze=i.BindingError=je(Error,"BindingError"),it(),wt=i.UnboundTypeError=je(Error,"UnboundTypeError");var zt,Vt={_embind_finalize_value_object:Be,_embind_register_bigint:Ge,_embind_register_bool:$e,_embind_register_emval:st,_embind_register_float:ct,_embind_register_function:At,_embind_register_integer:Ct,_embind_register_memory_view:St,_embind_register_std_string:Ft,_embind_register_std_wstring:Ot,_embind_register_value_object:It,_embind_register_value_object_field:Mt,_embind_register_void:kt,abort:Rt,emscripten_memcpy_big:xt,emscripten_resize_heap:Ut,fd_write:Nt,onAtlasProgress:Wt,setTempRet0:jt},Bt=(Se(),i.___wasm_call_ctors=Ae("__wasm_call_ctors"),i._free=Ae("free")),Gt=i.___getTypeName=Ae("__getTypeName"),Yt=(i.___embind_register_native_and_builtin_types=Ae("__embind_register_native_and_builtin_types"),i.___errno_location=Ae("__errno_location"),i.___stdio_exit=Ae("__stdio_exit"),i._malloc=Ae("malloc")),Jt=i._emscripten_stack_init=function(){return(Jt=i._emscripten_stack_init=i.asm.emscripten_stack_init).apply(null,arguments)},qt=(i._emscripten_stack_get_free=function(){return(i._emscripten_stack_get_free=i.asm.emscripten_stack_get_free).apply(null,arguments)},i._emscripten_stack_get_base=function(){return(i._emscripten_stack_get_base=i.asm.emscripten_stack_get_base).apply(null,arguments)},i._emscripten_stack_get_end=function(){return(qt=i._emscripten_stack_get_end=i.asm.emscripten_stack_get_end).apply(null,arguments)});function Kt(){Jt(),ee()}function Zt(e){function t(){zt||(zt=!0,i.calledRun=!0,C||(se(),r(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),S(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),le()))}e=e||s,fe>0||(Kt(),ae(),fe>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t(),te()))}if(i.stackSave=Ae("stackSave"),i.stackRestore=Ae("stackRestore"),i.stackAlloc=Ae("stackAlloc"),i.dynCall_jiji=Ae("dynCall_jiji"),T("intArrayFromString",!1),T("intArrayToString",!1),T("ccall",!1),T("cwrap",!1),T("setValue",!1),T("getValue",!1),T("allocate",!1),T("UTF8ArrayToString",!1),T("UTF8ToString",!1),T("stringToUTF8Array",!1),T("stringToUTF8",!1),T("lengthBytesUTF8",!1),T("stackTrace",!1),T("addOnPreRun",!1),T("addOnInit",!1),T("addOnPreMain",!1),T("addOnExit",!1),T("addOnPostRun",!1),T("writeStringToMemory",!1),T("writeArrayToMemory",!1),T("writeAsciiToMemory",!1),T("addRunDependency",!0),T("removeRunDependency",!0),T("FS_createFolder",!1),T("FS_createPath",!0),T("FS_createDataFile",!0),T("FS_createPreloadedFile",!0),T("FS_createLazyFile",!0),T("FS_createLink",!1),T("FS_createDevice",!0),T("FS_unlink",!0),T("getLEB",!1),T("getFunctionTables",!1),T("alignFunctionTables",!1),T("registerFunctions",!1),T("addFunction",!1),T("removeFunction",!1),T("getFuncWrapper",!1),T("prettyPrint",!1),T("dynCall",!1),T("getCompilerSetting",!1),T("print",!1),T("printErr",!1),T("getTempRet0",!1),T("setTempRet0",!1),T("callMain",!1),T("abort",!1),T("keepRuntimeAlive",!1),T("zeroMemory",!1),T("stringToNewUTF8",!1),T("emscripten_realloc_buffer",!1),T("ENV",!1),T("ERRNO_CODES",!1),T("ERRNO_MESSAGES",!1),T("setErrNo",!1),T("inetPton4",!1),T("inetNtop4",!1),T("inetPton6",!1),T("inetNtop6",!1),T("readSockaddr",!1),T("writeSockaddr",!1),T("DNS",!1),T("getHostByName",!1),T("Protocols",!1),T("Sockets",!1),T("getRandomDevice",!1),T("traverseStack",!1),T("UNWIND_CACHE",!1),T("convertPCtoSourceLocation",!1),T("readAsmConstArgsArray",!1),T("readAsmConstArgs",!1),T("mainThreadEM_ASM",!1),T("jstoi_q",!1),T("jstoi_s",!1),T("getExecutableName",!1),T("listenOnce",!1),T("autoResumeAudioContext",!1),T("dynCallLegacy",!1),T("getDynCaller",!1),T("dynCall",!1),T("setWasmTableEntry",!1),T("getWasmTableEntry",!1),T("handleException",!1),T("runtimeKeepalivePush",!1),T("runtimeKeepalivePop",!1),T("callUserCallback",!1),T("maybeExit",!1),T("safeSetTimeout",!1),T("asmjsMangle",!1),T("asyncLoad",!1),T("alignMemory",!1),T("mmapAlloc",!1),T("reallyNegative",!1),T("unSign",!1),T("reSign",!1),T("formatString",!1),T("PATH",!1),T("PATH_FS",!1),T("SYSCALLS",!1),T("getSocketFromFD",!1),T("getSocketAddress",!1),T("JSEvents",!1),T("registerKeyEventCallback",!1),T("specialHTMLTargets",!1),T("maybeCStringToJsString",!1),T("findEventTarget",!1),T("findCanvasEventTarget",!1),T("getBoundingClientRect",!1),T("fillMouseEventData",!1),T("registerMouseEventCallback",!1),T("registerWheelEventCallback",!1),T("registerUiEventCallback",!1),T("registerFocusEventCallback",!1),T("fillDeviceOrientationEventData",!1),T("registerDeviceOrientationEventCallback",!1),T("fillDeviceMotionEventData",!1),T("registerDeviceMotionEventCallback",!1),T("screenOrientation",!1),T("fillOrientationChangeEventData",!1),T("registerOrientationChangeEventCallback",!1),T("fillFullscreenChangeEventData",!1),T("registerFullscreenChangeEventCallback",!1),T("registerRestoreOldStyle",!1),T("hideEverythingExceptGivenElement",!1),T("restoreHiddenElements",!1),T("setLetterbox",!1),T("currentFullscreenStrategy",!1),T("restoreOldWindowedStyle",!1),T("softFullscreenResizeWebGLRenderTarget",!1),T("doRequestFullscreen",!1),T("fillPointerlockChangeEventData",!1),T("registerPointerlockChangeEventCallback",!1),T("registerPointerlockErrorEventCallback",!1),T("requestPointerLock",!1),T("fillVisibilityChangeEventData",!1),T("registerVisibilityChangeEventCallback",!1),T("registerTouchEventCallback",!1),T("fillGamepadEventData",!1),T("registerGamepadEventCallback",!1),T("registerBeforeUnloadEventCallback",!1),T("fillBatteryEventData",!1),T("battery",!1),T("registerBatteryEventCallback",!1),T("setCanvasElementSize",!1),T("getCanvasElementSize",!1),T("demangle",!1),T("demangleAll",!1),T("jsStackTrace",!1),T("stackTrace",!1),T("getEnvStrings",!1),T("checkWasiClock",!1),T("flush_NO_FILESYSTEM",!1),T("writeI53ToI64",!1),T("writeI53ToI64Clamped",!1),T("writeI53ToI64Signaling",!1),T("writeI53ToU64Clamped",!1),T("writeI53ToU64Signaling",!1),T("readI53FromI64",!1),T("readI53FromU64",!1),T("convertI32PairToI53",!1),T("convertU32PairToI53",!1),T("setImmediateWrapped",!1),T("clearImmediateWrapped",!1),T("polyfillSetImmediate",!1),T("uncaughtExceptionCount",!1),T("exceptionLast",!1),T("exceptionCaught",!1),T("ExceptionInfo",!1),T("CatchInfo",!1),T("exception_addRef",!1),T("exception_decRef",!1),T("Browser",!1),T("funcWrappers",!1),T("getFuncWrapper",!1),T("setMainLoop",!1),T("wget",!1),T("FS",!1),T("MEMFS",!1),T("TTY",!1),T("PIPEFS",!1),T("SOCKFS",!1),T("_setNetworkCallback",!1),T("tempFixedLengthArray",!1),T("miniTempWebGLFloatBuffers",!1),T("heapObjectForWebGLType",!1),T("heapAccessShiftForWebGLHeap",!1),T("GL",!1),T("emscriptenWebGLGet",!1),T("computeUnpackAlignedImageSize",!1),T("emscriptenWebGLGetTexPixelData",!1),T("emscriptenWebGLGetUniform",!1),T("webglGetUniformLocation",!1),T("webglPrepareUniformLocationsBeforeFirstUse",!1),T("webglGetLeftBracePos",!1),T("emscriptenWebGLGetVertexAttrib",!1),T("writeGLArray",!1),T("AL",!1),T("SDL_unicode",!1),T("SDL_ttfContext",!1),T("SDL_audio",!1),T("SDL",!1),T("SDL_gfx",!1),T("GLUT",!1),T("EGL",!1),T("GLFW_Window",!1),T("GLFW",!1),T("GLEW",!1),T("IDBStore",!1),T("runAndAbortIfError",!1),T("InternalError",!1),T("BindingError",!1),T("UnboundTypeError",!1),T("PureVirtualError",!1),T("init_embind",!1),T("throwInternalError",!1),T("throwBindingError",!1),T("throwUnboundTypeError",!1),T("ensureOverloadTable",!1),T("exposePublicSymbol",!1),T("replacePublicSymbol",!1),T("extendError",!1),T("createNamedFunction",!1),T("registeredInstances",!1),T("getBasestPointer",!1),T("registerInheritedInstance",!1),T("unregisterInheritedInstance",!1),T("getInheritedInstance",!1),T("getInheritedInstanceCount",!1),T("getLiveInheritedInstances",!1),T("registeredTypes",!1),T("awaitingDependencies",!1),T("typeDependencies",!1),T("registeredPointers",!1),T("registerType",!1),T("whenDependentTypesAreResolved",!1),T("embind_charCodes",!1),T("embind_init_charCodes",!1),T("readLatin1String",!1),T("getTypeName",!1),T("heap32VectorToArray",!1),T("requireRegisteredType",!1),T("getShiftFromSize",!1),T("integerReadValueFromPointer",!1),T("enumReadValueFromPointer",!1),T("floatReadValueFromPointer",!1),T("simpleReadValueFromPointer",!1),T("runDestructors",!1),T("new_",!1),T("craftInvokerFunction",!1),T("embind__requireFunction",!1),T("tupleRegistrations",!1),T("structRegistrations",!1),T("genericPointerToWireType",!1),T("constNoSmartPtrRawPointerToWireType",!1),T("nonConstNoSmartPtrRawPointerToWireType",!1),T("init_RegisteredPointer",!1),T("RegisteredPointer",!1),T("RegisteredPointer_getPointee",!1),T("RegisteredPointer_destructor",!1),T("RegisteredPointer_deleteObject",!1),T("RegisteredPointer_fromWireType",!1),T("runDestructor",!1),T("releaseClassHandle",!1),T("finalizationRegistry",!1),T("detachFinalizer_deps",!1),T("detachFinalizer",!1),T("attachFinalizer",!1),T("makeClassHandle",!1),T("init_ClassHandle",!1),T("ClassHandle",!1),T("ClassHandle_isAliasOf",!1),T("throwInstanceAlreadyDeleted",!1),T("ClassHandle_clone",!1),T("ClassHandle_delete",!1),T("deletionQueue",!1),T("ClassHandle_isDeleted",!1),T("ClassHandle_deleteLater",!1),T("flushPendingDeletes",!1),T("delayFunction",!1),T("setDelayFunction",!1),T("RegisteredClass",!1),T("shallowCopyInternalPointer",!1),T("downcastPointer",!1),T("upcastPointer",!1),T("validateThis",!1),T("char_0",!1),T("char_9",!1),T("makeLegalFunctionName",!1),T("emval_handle_array",!1),T("emval_free_list",!1),T("emval_symbols",!1),T("init_emval",!1),T("count_emval_handles",!1),T("get_first_emval",!1),T("getStringOrSymbol",!1),T("Emval",!1),T("emval_newers",!1),T("craftEmvalAllocator",!1),T("emval_get_global",!1),T("emval_methodCallers",!1),T("emval_registeredMethods",!1),T("warnOnce",!1),T("stackSave",!1),T("stackRestore",!1),T("stackAlloc",!1),T("AsciiToString",!1),T("stringToAscii",!1),T("UTF16ToString",!1),T("stringToUTF16",!1),T("lengthBytesUTF16",!1),T("UTF32ToString",!1),T("stringToUTF32",!1),T("lengthBytesUTF32",!1),T("allocateUTF8",!1),T("allocateUTF8OnStack",!1),i.writeStackCookie=ee,i.checkStackCookie=te,w("ALLOC_NORMAL",!1),w("ALLOC_STACK",!1),he=function e(){zt||Zt(),zt||(he=e)},i.run=Zt,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Zt(),e.ready});e.exports=r}).call(this,n(1))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,u=[],c=!1,d=-1;function f(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&p())}function p(){if(!c){var e=s(f);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new h(e,t)),1!==u.length||c||s(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t),n.d(t,"XAtlasAPI",(function(){return b}));var r=n(0),o=n.n(r);const i=Symbol("Comlink.proxy"),a=Symbol("Comlink.endpoint"),s=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.thrown"),u=e=>"object"==typeof e&&null!==e||"function"==typeof e,c=new Map([["proxy",{canHandle:e=>u(e)&&e[i],serialize(e){const{port1:t,port2:n}=new MessageChannel;return d(e,t),[n,[n]]},deserialize(e){return e.start(),function e(t,n=[],r=function(){}){let o=!1;const i=new Proxy(r,{get(r,a){if(p(o),a===s)return()=>v(t,{type:"RELEASE",path:n.map(e=>e.toString())}).then(()=>{f(t),o=!0});if("then"===a){if(0===n.length)return{then:()=>i};const e=v(t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return e.then.bind(e)}return e(t,[...n,a])},set(e,r,i){p(o);const[a,s]=g(i);return v(t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:a},s).then(y)},apply(r,i,s){p(o);const l=n[n.length-1];if(l===a)return v(t,{type:"ENDPOINT"}).then(y);if("bind"===l)return e(t,n.slice(0,-1));const[u,c]=h(s);return v(t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:u},c).then(y)},construct(e,r){p(o);const[i,a]=h(r);return v(t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:i},a).then(y)}});return i}(e,[],t);var t}}],["throw",{canHandle:e=>u(e)&&l in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function d(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:o,type:a,path:s}=Object.assign({path:[]},r.data),u=(r.data.argumentList||[]).map(y);let c;try{const t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(a){case"GET":c=n;break;case"SET":t[s.slice(-1)[0]]=y(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,u);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[i]:!0})}(new n(...u));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;d(e,n),c=function(e,t){return m.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[l]:0}}Promise.resolve(c).catch(e=>({value:e,[l]:0})).then(e=>{const[r,i]=g(e);t.postMessage(Object.assign(Object.assign({},r),{id:o}),i),"RELEASE"===a&&(t.removeEventListener("message",n),f(t))})})),t.start&&t.start()}function f(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function h(e){const t=e.map(g);return[t.map(e=>e[0]),(n=t.map(e=>e[1]),Array.prototype.concat.apply([],n))];var n}const m=new WeakMap;function g(e){for(const[t,n]of c)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},m.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return c.get(e.name).deserialize(e.value);case"RAW":return e.value}}function v(e,t,n){return new Promise(r=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===o&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)})}let _=()=>{};class b{constructor(e,t,n){this.xatlas=null,this.loaded=!1,_=e||(()=>{}),this.atlasCreated=!1,this.meshes=[];let r={};n&&(r={...r,onAtlasProgress:n});const i=e=>{r={...r,locateFile:(t,n)=>e&&"xatlas_web.wasm"===t?e:n+t},o()(r).then(e=>{this.moduleLoaded(e)})};if(t){let e=t("xatlas_web.wasm","");e&&e.then?e.then(i):i(e)}else i()}moduleLoaded(e){this.xatlas=e,this.loaded=!0,_&&_()}createAtlas(){this.xatlas.createAtlas(),this.meshes=[],this.atlasCreated=!0}addMesh(e,t,n=null,r=null,o,i=!1,a=!1,s=1){if(!this.loaded||!this.atlasCreated)throw"Create atlas first";let l=this.xatlas.createMesh(t.length/3,e.length,null!=n&&i,null!=r&&a);this.xatlas.HEAPU16.set(e,l.indexOffset/2);let u=new Float32Array([...t]);if(1!==s){"number"==typeof s&&(s=[s,s,s]);for(let e=0,t=u.length;e<t;e+=3)u[e]*=s[0],u[e+1]*=s[1],u[e+2]*=s[2]}this.xatlas.HEAPF32.set(u,l.positionOffset/4),null!=n&&i&&this.xatlas.HEAPF32.set(n,l.normalOffset/4),null!=r&&a&&this.xatlas.HEAPF32.set(r,l.uvOffset/4);let c=this.xatlas.addMesh();if(0!==c)return console.log("Error adding mesh: ",c),null;let d={meshId:l.meshId,meshObj:o,vertices:t,normals:n||null,indexes:n||null,coords:r||null};return this.meshes.push(d),d}createMesh(e,t,n,r){return this.xatlas.createMesh(e,t,n,r)}generateAtlas(e,t,n=!0){if(!this.loaded||!this.atlasCreated)throw"Create atlas first";if(this.meshes.length<1)throw"Add meshes first";if(e={...this.defaultChartOptions(),...e},t={...this.defaultPackOptions(),...t},this.xatlas.generateAtlas(e,t),!n)return[];let r=[];for(let{meshId:e,meshObj:t,vertices:n,normals:o,coords:i}of this.meshes){let a=this.getMeshData(e),s=new Uint16Array(this.xatlas.HEAPU32.subarray(a.indexOffset/4,a.indexOffset/4+a.newIndexCount)),l=new Uint16Array(this.xatlas.HEAPU32.subarray(a.originalIndexOffset/4,a.originalIndexOffset/4+a.newVertexCount)),u=new Float32Array(this.xatlas.HEAPF32.subarray(a.uvOffset/4,a.uvOffset/4+2*a.newVertexCount));this.xatlas.destroyMeshData(a);let c={};c.vertices=new Float32Array(3*a.newVertexCount),c.coords1=u,o&&(c.normals=new Float32Array(3*a.newVertexCount)),c.coords=i?new Float32Array(2*a.newVertexCount):c.coords1;for(let e=0,t=a.newVertexCount;e<t;e++){let t=l[e];c.vertices[3*e+0]=n[3*t+0],c.vertices[3*e+1]=n[3*t+1],c.vertices[3*e+2]=n[3*t+2],c.normals&&o&&(c.normals[3*e+0]=o[3*t+0],c.normals[3*e+1]=o[3*t+1],c.normals[3*e+2]=o[3*t+2]),c.coords&&i&&(c.coords[2*e+0]=i[2*t+0],c.coords[2*e+1]=i[2*t+1])}r.push({index:s,vertex:c,mesh:t,vertexCount:a.newVertexCount,oldIndexes:l})}return r}defaultChartOptions(){return{fixWinding:!1,maxBoundaryLength:0,maxChartArea:0,maxCost:2,maxIterations:1,normalDeviationWeight:2,normalSeamWeight:4,roundnessWeight:.009999999776482582,straightnessWeight:6,textureSeamWeight:.5,useInputMeshUvs:!1}}defaultPackOptions(){return{bilinear:!0,blockAlign:!1,bruteForce:!1,createImage:!1,maxChartSize:0,padding:0,resolution:0,rotateCharts:!0,rotateChartsToAxis:!0,texelsPerUnit:0}}setProgressLogging(e){this.xatlas.setProgressLogging(e)}getMeshData(e){return this.xatlas.getMeshData(e)}destroyMeshData(e){this.xatlas.destroyMeshData(e)}destroyAtlas(){this.atlasCreated=!1,this.xatlas.destroyAtlas(),this.meshes=[],this.xatlas.doLeakCheck()}}d(b)}]); //# sourceMappingURL=xatlas.js.map